Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

[Rockbox] Line Selector Option
Monday, July 30th, 2007 at 7:28:06am UTC 

  1. Index: apps/screen_access.c
  2. ===================================================================
  3. --- apps/screen_access.c        (revision 14071)
  4. +++ apps/screen_access.c        (working copy)
  5. @@ -154,6 +154,10 @@
  6.              screen->get_foreground=&lcd_get_foreground;
  7.              screen->set_background=&lcd_set_background;
  8.              screen->set_foreground=&lcd_set_foreground;
  9. +#ifdef HAVE_LCD_COLOR
  10. +            screen->set_selector=&lcd_set_selector;
  11. +            screen->set_selector_text=&lcd_set_selector_text;
  12. +#endif
  13.  #endif /* LCD_DEPTH > 1 */
  14.              screen->update_rect=&lcd_update_rect;
  15.              screen->fillrect=&lcd_fillrect;
  16. Index: apps/screen_access.h
  17. ===================================================================
  18. --- apps/screen_access.h        (revision 14071)
  19. +++ apps/screen_access.h        (working copy)
  20. @@ -103,6 +103,10 @@
  21.      void (*set_background)(unsigned background);
  22.      void (*set_foreground)(unsigned foreground);
  23.  #endif /* (LCD_DEPTH > 1) || (LCD_REMOTE_DEPTH > 1) */
  24. +#if defined(HAVE_LCD_COLOR)
  25. +    void (*set_selector)(unsigned selector);
  26. +    void (*set_selector_text)(unsigned selector_text);
  27. +#endif
  28.      void (*update_rect)(int x, int y, int width, int height);
  29.      void (*fillrect)(int x, int y, int width, int height);
  30.      void (*drawrect)(int x, int y, int width, int height);
  31. Index: apps/lang/english.lang
  32. ===================================================================
  33. --- apps/lang/english.lang      (revision 14071)
  34. +++ apps/lang/english.lang      (working copy)
  35. @@ -3269,13 +3269,13 @@
  36.    desc: in settings_menu
  37.    user:
  38.    <source>
  39. -    *: "Line Selector"
  40. +    *: "Line Selector Type"
  41.    </source>
  42.    <dest>
  43. -    *: "Line Selector"
  44. +    *: "Line Selector Type"
  45.    </dest>
  46.    <voice>
  47. -    *: "Line Selector"
  48. +    *: "Line Selector Type"
  49.    </voice>
  50.  </phrase>
  51.  <phrase>
  52. @@ -11054,3 +11054,46 @@
  53.      *: "Can't write to recording directory"
  54.    </voice>
  55.  </phrase>
  56. +<phrase>
  57. +  id: LANG_SELECTOR_COLOR
  58. +  desc: line selector color option
  59. +  user:
  60. +  <source>
  61. +    *: "Line Selector Colour"
  62. +  </source>
  63. +  <dest>
  64. +    *: "Line Selector Colour"
  65. +  </dest>
  66. +  <voice>
  67. +    *: "Line Selector Colour"
  68. +  </voice>
  69. +</phrase>
  70. +<phrase>
  71. +  id: LANG_SELECTOR_TEXT_COLOR
  72. +  desc: line selector text color option
  73. +  user:
  74. +  <source>
  75. +    *: "Line Selector Text Colour"
  76. +  </source>
  77. +  <dest>
  78. +    *: "Line Selector Text Colour"
  79. +  </dest>
  80. +  <voice>
  81. +    *: "Line Selector Text Colour"
  82. +  </voice>
  83. +</phrase>
  84. +<phrase>
  85. +  id: LANG_INVERT_CURSOR_COLOR
  86. +  desc: in settings_menu
  87. +  user:
  88. +  <source>
  89. +    *: "Bar (Colour)"
  90. +  </source>
  91. +  <dest>
  92. +    *: "Bar (Colour)"
  93. +  </dest>
  94. +  <voice>
  95. +    *: "Bar (Colour)"
  96. +  </voice>
  97. +</phrase>
  98. +
  99. Index: apps/settings.c
  100. ===================================================================
  101. --- apps/settings.c     (revision 14071)
  102. +++ apps/settings.c     (working copy)
  103. @@ -764,6 +764,8 @@
  104.  #ifdef HAVE_LCD_COLOR
  105.      screens[SCREEN_MAIN].set_foreground(global_settings.fg_color);
  106.      screens[SCREEN_MAIN].set_background(global_settings.bg_color);
  107. +    screens[SCREEN_MAIN].set_selector(global_settings.ls_color);
  108. +    screens[SCREEN_MAIN].set_selector_text(global_settings.lst_color);
  109.  #endif
  110.  
  111.  #if defined(HAVE_REMOTE_LCD) && (NB_SCREENS > 1)
  112. Index: apps/gui/list.c
  113. ===================================================================
  114. --- apps/gui/list.c     (revision 14071)
  115. +++ apps/gui/list.c     (working copy)
  116. @@ -390,10 +390,16 @@
  117.             current_item <  gui_list->selected_item + gui_list->selected_size)
  118.          {/* The selected item must be displayed scrolling */
  119.  #ifdef HAVE_LCD_BITMAP
  120. -            if (global_settings.invert_cursor)/* Display inverted-line-style*/
  121. +            if (global_settings.invert_cursor == 1)/* Display inverted-line-style*/
  122.              {
  123.                  style |= STYLE_INVERT;
  124.              }
  125. +#ifdef HAVE_LCD_COLOR
  126. +            else if (global_settings.invert_cursor == 2)
  127. +            {
  128. +                style |= STYLE_HIGHLIGHT;
  129. +            }
  130. +#endif
  131.              else  /*  if (!global_settings.invert_cursor) */
  132.              {
  133.                  if (current_item % gui_list->selected_size != 0)
  134. Index: apps/settings.h
  135. ===================================================================
  136. --- apps/settings.h     (revision 14071)
  137. +++ apps/settings.h     (working copy)
  138. @@ -407,7 +407,7 @@
  139.      int contrast;   /* lcd contrast */
  140.  #endif
  141.      bool invert;    /* invert display */
  142. -    bool invert_cursor; /* invert the current file in dir browser and menu
  143. +    int invert_cursor; /* invert the current file in dir browser and menu
  144.                             instead of using the default cursor */
  145.      bool flip_display; /* turn display (and button layout) by 180 degrees */
  146.      int poweroff;   /* power off timer */
  147. @@ -630,6 +630,8 @@
  148.  #ifdef HAVE_LCD_COLOR
  149.      int bg_color; /* background color native format */
  150.      int fg_color; /* foreground color native format */
  151. +    int ls_color; /* background color for the selector */
  152. +    int lst_color; /* color of the text for the selector */
  153.  #endif
  154.      bool party_mode;    /* party mode - unstoppable music */
  155.      
  156. Index: apps/menus/display_menu.c
  157. ===================================================================
  158. --- apps/menus/display_menu.c   (revision 14071)
  159. +++ apps/menus/display_menu.c   (working copy)
  160. @@ -157,13 +157,40 @@
  161.      settings_save();
  162.      return res;
  163.  }
  164. +
  165. +static int set_ls_color(void)
  166. +{
  167. +    int res;
  168. +    res = (int)set_color(&screens[SCREEN_MAIN],str(LANG_SELECTOR_COLOR),
  169. +                     &global_settings.ls_color,-1);
  170. +
  171. +    screens[SCREEN_MAIN].set_selector(global_settings.ls_color);
  172. +    settings_save();
  173. +    return res;
  174. +}
  175. +
  176. +static int set_lst_color(void)
  177. +{
  178. +    int res;
  179. +    res = (int)set_color(&screens[SCREEN_MAIN],str(LANG_SELECTOR_COLOR),
  180. +                     &global_settings.lst_color,global_settings.ls_color);
  181. +
  182. +    screens[SCREEN_MAIN].set_selector_text(global_settings.lst_color);
  183. +    settings_save();
  184. +    return res;
  185. +}
  186. +
  187.  static int reset_color(void)
  188.  {
  189.      global_settings.fg_color = LCD_DEFAULT_FG;
  190.      global_settings.bg_color = LCD_DEFAULT_BG;
  191. +    global_settings.ls_color = LCD_DEFAULT_LS;
  192. +    global_settings.lst_color = LCD_DEFAULT_FG;
  193.  
  194.      screens[SCREEN_MAIN].set_foreground(global_settings.fg_color);
  195.      screens[SCREEN_MAIN].set_background(global_settings.bg_color);
  196. +    screens[SCREEN_MAIN].set_selector(global_settings.ls_color);
  197. +    screens[SCREEN_MAIN].set_selector_text(global_settings.lst_color);
  198.      settings_save();
  199.      return 0;
  200.  }
  201. @@ -171,6 +198,10 @@
  202.                      set_bg_color, NULL, NULL, Icon_NOICON);
  203.  MENUITEM_FUNCTION(set_fg_col, 0, ID2P(LANG_FOREGROUND_COLOR),
  204.                      set_fg_color, NULL, NULL, Icon_NOICON);
  205. +MENUITEM_FUNCTION(set_ls_col, 0, ID2P(LANG_SELECTOR_COLOR),
  206. +                    set_ls_color, NULL, NULL, Icon_NOICON);
  207. +MENUITEM_FUNCTION(set_lst_col, 0, ID2P(LANG_SELECTOR_TEXT_COLOR),
  208. +                    set_lst_color, NULL, NULL, Icon_NOICON);
  209.  MENUITEM_FUNCTION(reset_colors, 0, ID2P(LANG_RESET_COLORS),
  210.                      reset_color, NULL, NULL, Icon_NOICON);
  211.  #endif
  212. @@ -214,7 +245,7 @@
  213.              ,&clear_main_bd,
  214.  #endif
  215.  #ifdef HAVE_LCD_COLOR
  216. -            &set_bg_col, &set_fg_col, &reset_colors
  217. +            &set_bg_col, &set_fg_col, &set_ls_col, &set_lst_col, &reset_colors
  218.  #endif
  219.           );
  220.  /*    LCD MENU                    */
  221. Index: apps/settings_list.c
  222. ===================================================================
  223. --- apps/settings_list.c        (revision 14071)
  224. +++ apps/settings_list.c        (working copy)
  225. @@ -444,8 +444,15 @@
  226.          LANG_INVERT_LCD_INVERSE, LANG_INVERT_LCD_NORMAL, lcd_set_invert_display),
  227.      OFFON_SETTING(0,flip_display, LANG_FLIP_DISPLAY, false,"flip display", NULL),
  228.      /* display */
  229. -    BOOL_SETTING(F_TEMPVAR, invert_cursor, LANG_INVERT_CURSOR, true ,"invert cursor", off_on,
  230. -        LANG_INVERT_CURSOR_BAR, LANG_INVERT_CURSOR_POINTER, NULL),
  231. +    CHOICE_SETTING(F_TEMPVAR|F_THEMESETTING, invert_cursor, LANG_INVERT_CURSOR, 1,
  232. +#ifdef HAVE_LCD_COLOR
  233. +        "selector type", "pointer, bar (inverse), bar (color)", NULL, 3,
  234. +        ID2P(LANG_INVERT_CURSOR_POINTER), ID2P(LANG_INVERT_CURSOR_BAR),
  235. +        ID2P(LANG_INVERT_CURSOR_COLOR)),
  236. +#else
  237. +        "selector type", "pointer, bar (inverse)", NULL, 2,
  238. +        ID2P(LANG_INVERT_CURSOR_POINTER), ID2P(LANG_INVERT_CURSOR_BAR)),
  239. +#endif       
  240.      OFFON_SETTING(F_THEMESETTING,statusbar, LANG_STATUS_BAR, true,"statusbar", NULL),
  241.      OFFON_SETTING(0,scrollbar, LANG_SCROLL_BAR, true,"scrollbar", NULL),
  242.  #if CONFIG_KEYPAD == RECORDER_PAD
  243. @@ -611,6 +618,10 @@
  244.          "foreground color",NULL,UNUSED},
  245.      {F_T_INT|F_RGB|F_THEMESETTING ,&global_settings.bg_color,-1,INT(LCD_DEFAULT_BG),
  246.          "background color",NULL,UNUSED},
  247. +    {F_T_INT|F_RGB|F_THEMESETTING ,&global_settings.ls_color,-1,INT(LCD_DEFAULT_LS),
  248. +        "line selector color",NULL,UNUSED},
  249. +    {F_T_INT|F_RGB|F_THEMESETTING ,&global_settings.lst_color,-1,INT(LCD_DEFAULT_FG),
  250. +        "line selector text color",NULL,UNUSED},
  251.  #endif
  252.      /* more playback */
  253.      OFFON_SETTING(0,play_selected,LANG_PLAY_SELECTED,true,"play selected",NULL),
  254. Index: firmware/export/lcd.h
  255. ===================================================================
  256. --- firmware/export/lcd.h       (revision 14071)
  257. +++ firmware/export/lcd.h       (working copy)
  258. @@ -27,6 +27,7 @@
  259.  #define STYLE_DEFAULT    0x00000000
  260.  #define STYLE_INVERT     0x20000000
  261.  #define STYLE_COLORED    0x10000000
  262. +#define STYLE_HIGHLIGHT  0x40000000
  263.  #define STYLE_COLOR_MASK 0x0000FFFF
  264.  
  265.  #ifdef SIMULATOR
  266. @@ -229,6 +230,7 @@
  267.  #define LCD_WHITE      LCD_RGBPACK(255, 255, 255)
  268.  #define LCD_DEFAULT_FG LCD_BLACK
  269.  #define LCD_DEFAULT_BG LCD_RGBPACK(182, 198, 229) /* rockbox blue */
  270. +#define LCD_DEFAULT_LS LCD_WHITE
  271.  
  272.  #elif LCD_DEPTH > 1 /* greyscale */
  273.  #define LCD_MAX_LEVEL ((1 << LCD_DEPTH) - 1)
  274. @@ -348,6 +350,10 @@
  275.  extern unsigned lcd_get_foreground(void);
  276.  extern void     lcd_set_background(unsigned background);
  277.  extern unsigned lcd_get_background(void);
  278. +#ifdef HAVE_LCD_COLOR
  279. +extern void     lcd_set_selector(unsigned selector);
  280. +extern void     lcd_set_selector_text(unsigned selector_text);
  281. +#endif
  282.  extern void     lcd_set_drawinfo(int mode, unsigned foreground,
  283.                                   unsigned background);
  284.  void lcd_set_backdrop(fb_data* backdrop);
  285. Index: firmware/export/scroll_engine.h
  286. ===================================================================
  287. --- firmware/export/scroll_engine.h     (revision 14071)
  288. +++ firmware/export/scroll_engine.h     (working copy)
  289. @@ -43,8 +43,12 @@
  290.      int startx;
  291.  #ifdef HAVE_LCD_BITMAP
  292.      int width;  /* length of line in pixels */
  293. -    bool invert; /* invert the scrolled text */
  294. +#ifdef HAVE_LCD_COLOR
  295. +    int invert; /* invert the scrolled text */
  296. +#else
  297. +    bool invert;
  298.  #endif
  299. +#endif/* HAVE_LCD_BITMAP */
  300.      bool backward; /* scroll presently forward or backward? */
  301.      bool bidir;
  302.      long start_tick;
  303. Index: firmware/drivers/lcd-16bit.c
  304. ===================================================================
  305. --- firmware/drivers/lcd-16bit.c        (revision 14071)
  306. +++ firmware/drivers/lcd-16bit.c        (working copy)
  307. @@ -51,9 +51,13 @@
  308.  #if !defined(TOSHIBA_GIGABEAT_F) || defined(SIMULATOR)
  309.  static unsigned fg_pattern IDATA_ATTR = LCD_DEFAULT_FG;
  310.  static unsigned bg_pattern IDATA_ATTR = LCD_DEFAULT_BG;
  311. +static unsigned ls_pattern IDATA_ATTR = LCD_DEFAULT_LS;
  312. +static unsigned lst_pattern IDATA_ATTR = LCD_DEFAULT_FG;
  313.  #else
  314.  unsigned fg_pattern IDATA_ATTR = LCD_DEFAULT_FG;
  315.  unsigned bg_pattern IDATA_ATTR = LCD_DEFAULT_BG;
  316. +unsigned ls_pattern IDATA_ATTR = LCD_DEFAULT_LS;
  317. +unsigned lst_pattern IDATA_ATTR = LCD_DEFAULT_FG;
  318.  #endif
  319.  
  320.  static int drawmode = DRMODE_SOLID;
  321. @@ -103,6 +107,16 @@
  322.      return bg_pattern;
  323.  }
  324.  
  325. +void lcd_set_selector(unsigned color)
  326. +{
  327. +    ls_pattern = color;
  328. +}
  329. +
  330. +void lcd_set_selector_text(unsigned color)
  331. +{
  332. +    lst_pattern = color;
  333. +}
  334. +
  335.  void lcd_set_drawinfo(int mode, unsigned fg_color, unsigned bg_color)
  336.  {
  337.      lcd_set_drawmode(mode);
  338. @@ -807,7 +821,11 @@
  339.      ypos = ymargin + y*h;
  340.      drawmode = (style & STYLE_INVERT) ?
  341.                 (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID;
  342. -    if (style & STYLE_COLORED) {
  343. +    if (style & STYLE_HIGHLIGHT) {
  344. +        fg_pattern = lst_pattern;
  345. +        bg_pattern = ls_pattern;
  346. +    }   
  347. +    else if (style & STYLE_COLORED) {
  348.          if (drawmode == DRMODE_SOLID)
  349.              fg_pattern = style & STYLE_COLOR_MASK;
  350.          else
  351. @@ -851,8 +869,11 @@
  352.      s->start_tick = current_tick + lcd_scroll_info.delay;
  353.      s->invert = false;
  354.      if (style & STYLE_INVERT) {
  355. -        s->invert = true;
  356. +        s->invert = 1;
  357.      }
  358. +    else if (style & STYLE_HIGHLIGHT) {
  359. +        s->invert = 2;
  360. +    }
  361.      lcd_puts_style_offset(x,y,string,style,offset);
  362.  
  363.      lcd_getstringsize(string, &w, &h);
  364. @@ -960,8 +981,12 @@
  365.          }
  366.  
  367.          lastmode = drawmode;
  368. -        drawmode = s->invert ?
  369. +        drawmode = s->invert == 1 ?
  370.              (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID;
  371. +        if (s->invert == 2) {
  372. +            fg_pattern = lst_pattern;
  373. +            bg_pattern = ls_pattern;
  374. +        }
  375.          lcd_putsxyofs(xpos, ypos, s->offset, s->line);
  376.          drawmode = lastmode;
  377.          lcd_update_rect(xpos, ypos, LCD_WIDTH - xpos, pf->height);

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

comments powered by Disqus
worth-right
worth-right