summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/filetypes.c2
-rw-r--r--apps/gui/list.c49
-rw-r--r--apps/gui/list.h10
-rw-r--r--apps/gui/textarea.c5
-rw-r--r--apps/menu.c1
-rw-r--r--apps/screen_access.c19
-rw-r--r--apps/screen_access.h12
-rw-r--r--apps/tree.c4
8 files changed, 88 insertions, 14 deletions
diff --git a/apps/filetypes.c b/apps/filetypes.c
index 5d1c556ca2..d5a900317f 100644
--- a/apps/filetypes.c
+++ b/apps/filetypes.c
@@ -162,7 +162,7 @@ int filetype_get_icon(int attr)
#ifdef HAVE_LCD_BITMAP
return NULL;
#else
- return -1;
+ return Icon_Unknown;
#endif
}
else
diff --git a/apps/gui/list.c b/apps/gui/list.c
index d566dabfbb..cd5af40a98 100644
--- a/apps/gui/list.c
+++ b/apps/gui/list.c
@@ -55,6 +55,7 @@ void gui_list_init(struct gui_list * gui_list,
gui_list->start_item = 0;
gui_list->limit_scroll = false;
gui_list->data=data;
+ gui_list->cursor_flash_state=false;
}
void gui_list_set_display(struct gui_list * gui_list, struct screen * display)
@@ -68,6 +69,42 @@ void gui_list_set_display(struct gui_list * gui_list, struct screen * display)
gui_list_put_selection_in_screen(gui_list, false);
}
+void gui_list_flash(struct gui_list * gui_list)
+{
+ struct screen * display=gui_list->display;
+ gui_list->cursor_flash_state=!gui_list->cursor_flash_state;
+ int selected_line=gui_list->selected_item-gui_list->start_item;
+#ifdef HAVE_LCD_BITMAP
+ int cursor_xpos=global_settings.scrollbar?1:0;
+ int line_xpos=display->getxmargin();
+ int line_ypos=display->getymargin()+display->char_height*selected_line;
+ if (global_settings.invert_cursor)
+ {
+ display->set_drawmode(DRMODE_COMPLEMENT);
+ display->fillrect(line_xpos, line_ypos, display->width,
+ display->char_height);
+ display->set_drawmode(DRMODE_SOLID);
+ display->invertscroll(0, selected_line);
+ }
+ else
+ {
+ if(gui_list->cursor_flash_state)
+ screen_clear_area(display, cursor_xpos*SCROLLBAR_WIDTH, line_ypos,
+ CURSOR_WIDTH, CURSOR_HEIGHT);
+ else
+ screen_put_cursorxy(display, cursor_xpos, selected_line);
+ }
+ display->update_rect(0, line_ypos,display->width,
+ display->char_height);
+#else
+ if(gui_list->cursor_flash_state)
+ display->putc(0, selected_line, ' ');
+ else
+ screen_put_cursorxy(display, 0, selected_line);
+ gui_textarea_update(display);
+#endif
+}
+
void gui_list_put_selection_in_screen(struct gui_list * gui_list,
bool put_from_end)
{
@@ -117,9 +154,7 @@ void gui_list_draw(struct gui_list * gui_list)
text_pos += SCROLLBAR_WIDTH;
}
if(!draw_cursor)
- {
icon_pos--;
- }
else
text_pos += CURSOR_WIDTH;
@@ -181,7 +216,8 @@ void gui_list_draw(struct gui_list * gui_list)
gui_list->callback_get_item_icon(current_item,
gui_list->data,
&icon);
- screen_put_iconxy(display, icon_pos, i, icon);
+ if(icon)
+ screen_put_iconxy(display, icon_pos, i, icon);
}
}
#ifdef HAVE_LCD_BITMAP
@@ -429,6 +465,13 @@ void gui_synclist_limit_scroll(struct gui_synclist * lists, bool scroll)
gui_list_limit_scroll(&(lists->gui_list[i]), scroll);
}
+void gui_synclist_flash(struct gui_synclist * lists)
+{
+ int i;
+ for(i = 0;i < NB_SCREENS;i++)
+ gui_list_flash(&(lists->gui_list[i]));
+}
+
bool gui_synclist_do_button(struct gui_synclist * lists, unsigned button)
{
gui_synclist_limit_scroll(lists, true);
diff --git a/apps/gui/list.h b/apps/gui/list.h
index cb488c21b7..94a172f642 100644
--- a/apps/gui/list.h
+++ b/apps/gui/list.h
@@ -93,6 +93,7 @@ struct gui_list
{
int nb_items;
int selected_item;
+ bool cursor_flash_state;
int start_item; /* the item that is displayed at the top of the screen */
void (*callback_get_item_icon)
@@ -236,6 +237,14 @@ extern void gui_list_del_item(struct gui_list * gui_list);
(gui_list)->limit_scroll=scroll
/*
+ * One call on 2, the selected lune will either blink the cursor or
+ * invert/display normal the selected line
+ * - gui_list : the list structure
+ */
+extern void gui_list_flash(struct gui_list * gui_list);
+
+
+/*
* This part handles as many lists as there are connected screens
* (the api is similar to the ones above)
* The lists on the screens are synchronized ;
@@ -278,6 +287,7 @@ extern void gui_synclist_select_previous_page(struct gui_synclist * lists,
extern void gui_synclist_add_item(struct gui_synclist * lists);
extern void gui_synclist_del_item(struct gui_synclist * lists);
extern void gui_synclist_limit_scroll(struct gui_synclist * lists, bool scroll);
+extern void gui_synclist_flash(struct gui_synclist * lists);
/*
* Do the action implied by the given button,
diff --git a/apps/gui/textarea.c b/apps/gui/textarea.c
index c49602611f..d8e730fdc2 100644
--- a/apps/gui/textarea.c
+++ b/apps/gui/textarea.c
@@ -24,10 +24,7 @@ void gui_textarea_clear(struct screen * display)
#ifdef HAVE_LCD_BITMAP
int y_start = gui_textarea_get_ystart(display);
int y_end = gui_textarea_get_yend(display);
-
- display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
- display->fillrect(0, y_start, display->width, y_end - y_start);
- display->set_drawmode(DRMODE_SOLID);
+ screen_clear_area(display, 0, y_start, display->width, y_end - y_start);
display->stop_scroll();
screen_set_ymargin(display, y_start);
#else
diff --git a/apps/menu.c b/apps/menu.c
index b682bec526..474593b435 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -168,7 +168,6 @@ int menu_show(int m)
#ifdef MENU_RC_EXIT_MENU
case MENU_RC_EXIT_MENU:
#endif
- //lcd_stop_scroll();
exit = true;
break;
diff --git a/apps/screen_access.c b/apps/screen_access.c
index 44d560fa7c..5dde0cb8ae 100644
--- a/apps/screen_access.c
+++ b/apps/screen_access.c
@@ -65,6 +65,7 @@ void screen_init(struct screen * screen, enum screen_type screen_type)
screen->scroll_delay=&lcd_remote_scroll_delay;
screen->scroll_step=&lcd_remote_scroll_step;
screen->puts_scroll_style=&lcd_remote_puts_scroll_style;
+ screen->invertscroll=&lcd_remote_invertscroll;
#endif /* HAVE_LCD_BITMAP */
#ifdef HAVE_LCD_CHARCELLS
@@ -114,6 +115,7 @@ void screen_init(struct screen * screen, enum screen_type screen_type)
screen->scroll_delay=&lcd_scroll_delay;
screen->scroll_step=&lcd_scroll_step;
screen->puts_scroll_style=&lcd_puts_scroll_style;
+ screen->invertscroll=&lcd_invertscroll;
#endif /* HAVE_LCD_BITMAP */
#ifdef HAVE_LCD_CHARCELLS
@@ -150,8 +152,17 @@ void screen_init(struct screen * screen, enum screen_type screen_type)
void screen_access_init(void)
{
- screen_init(&screens[0], SCREEN_MAIN);
-#if defined(HAVE_REMOTE_LCD) && !defined(ROCKBOX_HAS_LOGF)
- screen_init(&screens[1], SCREEN_REMOTE);
-#endif
+ int i;
+ for(i=0;i<NB_SCREENS;i++)
+ screen_init(&screens[i], i);
+}
+
+#ifdef HAVE_LCD_BITMAP
+void screen_clear_area(struct screen * display, int xstart, int ystart,
+ int width, int height)
+{
+ display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
+ display->fillrect(xstart, ystart, width, height);
+ display->set_drawmode(DRMODE_SOLID);
}
+#endif
diff --git a/apps/screen_access.h b/apps/screen_access.h
index 08e0ef0cb2..5b30cb0aa7 100644
--- a/apps/screen_access.h
+++ b/apps/screen_access.h
@@ -83,6 +83,7 @@ struct screen
void (*drawline)(int x1, int y1, int x2, int y2);
void (*vline)(int x, int y1, int y2);
void (*hline)(int x1, int x2, int y);
+ void (*invertscroll) (int x, int y);
#endif /* HAVE_LCD_BITMAP */
#ifdef HAVE_LCD_CHARCELLS
@@ -136,6 +137,17 @@ extern void screen_init(struct screen * screen, enum screen_type screen_type);
#define screen_set_ymargin(screen, ymargin) \
(screen)->setmargins((screen)->getxmargin(), ymargin);
+#ifdef HAVE_LCD_BITMAP
+/*
+ * Clear only a given area of the screen
+ * - screen : the screen structure
+ * - xstart, ystart : where the area starts
+ * - width, height : size of the area
+ */
+void screen_clear_area(struct screen * display, int xstart, int ystart,
+ int width, int height);
+#endif
+
/*
* Initializes the whole screen_access api
*/
diff --git a/apps/tree.c b/apps/tree.c
index c1b53cf308..0e91a58944 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -337,6 +337,9 @@ static int update_dir(void)
}
}
gui_synclist_set_nb_items(&tree_lists, tc.filesindir);
+ if( tc.selected_item >= tc.filesindir)
+ tc.selected_item=tc.filesindir-1;
+
gui_synclist_select_item(&tree_lists, tc.selected_item);
gui_synclist_draw(&tree_lists);
gui_syncstatusbar_draw(&statusbars, true);
@@ -799,7 +802,6 @@ static bool dirbrowse(void)
}
onplay_result = onplay(buf, attr, curr_context);
}
-
switch (onplay_result)
{
case ONPLAY_OK: