Advertisement
Guest User

Untitled

a guest
Dec 14th, 2011
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.10 KB | None | 0 0
  1. diff --git a/apps/gui/skin_engine/skin_render.c b/apps/gui/skin_engine/skin_render.c
  2. index e408caa..1e5ba4e 100644
  3. --- a/apps/gui/skin_engine/skin_render.c
  4. +++ b/apps/gui/skin_engine/skin_render.c
  5. @@ -735,10 +735,9 @@ void skin_render_viewport(struct skin_element* viewport, struct gui_wps *gwps,
  6. {
  7. if (info.line_scrolls)
  8. {
  9. - /* if the line is a scrolling one we don't want to update
  10. - too often, so that it has the time to scroll */
  11. - if ((refresh_type & SKIN_REFRESH_SCROLL) || info.force_redraw)
  12. - write_line(display, align, info.line_number, true, info.text_style);
  13. + if (!info.force_redraw)
  14. + info.text_style |= STYLE_NOSCROLL_RESTART;
  15. + write_line(display, align, info.line_number, true, info.text_style);
  16. }
  17. else
  18. write_line(display, align, info.line_number, false, info.text_style);
  19. @@ -911,8 +910,8 @@ void skin_render_playlistviewer(struct playlistviewer* viewer,
  20. {
  21. /* if the line is a scrolling one we don't want to update
  22. too often, so that it has the time to scroll */
  23. - if ((refresh_type & SKIN_REFRESH_SCROLL) || info.force_redraw)
  24. - write_line(display, align, info.line_number, true, info.text_style);
  25. + // if ((refresh_type & SKIN_REFRESH_SCROLL) || info.force_redraw)
  26. + write_line(display, align, info.line_number, true, info.text_style&STYLE_NOSCROLL_RESTART);
  27. }
  28. else
  29. write_line(display, align, info.line_number, false, info.text_style);
  30. diff --git a/firmware/drivers/lcd-bitmap-common.c b/firmware/drivers/lcd-bitmap-common.c
  31. index 3806bb0..c83616f 100644
  32. --- a/firmware/drivers/lcd-bitmap-common.c
  33. +++ b/firmware/drivers/lcd-bitmap-common.c
  34. @@ -365,6 +365,20 @@ void LCDFN(puts_offset)(int x, int y, const unsigned char *str, int offset)
  35.  
  36. /*** scrolling ***/
  37.  
  38. +static struct scrollinfo* find_scrolling_line(int line)
  39. +{
  40. + struct scrollinfo* s = NULL;
  41. + int i;
  42. +
  43. + for(i=0; i<LCDFN(scroll_info).lines; i++)
  44. + {
  45. + s = &LCDFN(scroll_info).scroll[i];
  46. + if (s->y == line)
  47. + return s;
  48. + }
  49. + return NULL;
  50. +}
  51. +
  52. void LCDFN(puts_scroll_style_xyoffset)(int x, int y, const unsigned char *string,
  53. int style, int x_offset, int y_offset)
  54. {
  55. @@ -372,32 +386,48 @@ void LCDFN(puts_scroll_style_xyoffset)(int x, int y, const unsigned char *string
  56. char *end;
  57. int w, h;
  58. int len;
  59. + bool restart = false;
  60. + int space_width;
  61.  
  62. - if ((unsigned)y >= (unsigned)current_vp->height)
  63. + if (!string || ((unsigned)y >= (unsigned)current_vp->height))
  64. return;
  65.  
  66. - /* remove any previously scrolling line at the same location */
  67. - LCDFN(scroll_stop_line)(current_vp, y);
  68. + s = find_scrolling_line(y);
  69. + if (!s || ((style&STYLE_NOSCROLL_RESTART) == 0))
  70. + restart = true;
  71.  
  72. - if (LCDFN(scroll_info).lines >= LCDM(SCROLLABLE_LINES)) return;
  73. - if (!string)
  74. - return;
  75. - LCDFN(puts_style_xyoffset)(x, y, string, style, x_offset, y_offset);
  76. + if (restart)
  77. + {
  78. + /* remove any previously scrolling line at the same location */
  79. + LCDFN(scroll_stop_line)(current_vp, y);
  80. +
  81. + if (LCDFN(scroll_info).lines >= LCDM(SCROLLABLE_LINES)) return;
  82. + LCDFN(puts_style_xyoffset)(x, y, string, style, x_offset, y_offset);
  83. + }
  84.  
  85. LCDFN(getstringsize)(string, &w, &h);
  86.  
  87. if (current_vp->width - x * 8 >= w)
  88. return;
  89.  
  90. - /* prepare scroll line */
  91. - s = &LCDFN(scroll_info).scroll[LCDFN(scroll_info).lines];
  92. - s->start_tick = current_tick + LCDFN(scroll_info).delay;
  93. - s->style = style;
  94. -
  95. + if (restart)
  96. + {
  97. + /* prepare scroll line */
  98. + s = &LCDFN(scroll_info).scroll[LCDFN(scroll_info).lines];
  99. + s->start_tick = current_tick + LCDFN(scroll_info).delay;
  100. + s->style = style & ~STYLE_NOSCROLL_RESTART;
  101. + }
  102. strlcpy(s->line, string, sizeof s->line);
  103. + space_width = LCDFN(getstringsize)(" ", NULL, NULL);
  104.  
  105. /* get width */
  106. - s->width = LCDFN(getstringsize)(s->line, &w, &h);
  107. + LCDFN(getstringsize)(s->line, &w, &h);
  108. + if (!restart && s->width > w)
  109. + {
  110. + if (s->startx > w)
  111. + s->startx = w;
  112. + }
  113. + s->width = w;
  114.  
  115. /* scroll bidirectional or forward only depending on the string
  116. width */
  117. @@ -411,7 +441,7 @@ void LCDFN(puts_scroll_style_xyoffset)(int x, int y, const unsigned char *string
  118. if (!s->bidir) { /* add spaces if scrolling in the round */
  119. strlcat(s->line, " ", sizeof s->line);
  120. /* get new width incl. spaces */
  121. - s->width = LCDFN(getstringsize)(s->line, &w, &h);
  122. + s->width += space_width * 3;
  123. }
  124.  
  125. end = strchr(s->line, '\0');
  126. @@ -420,12 +450,16 @@ void LCDFN(puts_scroll_style_xyoffset)(int x, int y, const unsigned char *string
  127.  
  128. s->vp = current_vp;
  129. s->y = y;
  130. - s->offset = x_offset;
  131. - s->startx = x * LCDFN(getstringsize)(" ", NULL, NULL);
  132. + if (restart)
  133. + {
  134. + s->offset = x_offset;
  135. + s->startx = x * space_width;
  136. + s->backward = false;
  137. + }
  138. s->y_offset = y_offset;
  139. - s->backward = false;
  140.  
  141. - LCDFN(scroll_info).lines++;
  142. + if (restart)
  143. + LCDFN(scroll_info).lines++;
  144. }
  145.  
  146. void LCDFN(puts_scroll)(int x, int y, const unsigned char *string)
  147. diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h
  148. index 2d0123c..b0ac820 100644
  149. --- a/firmware/export/lcd.h
  150. +++ b/firmware/export/lcd.h
  151. @@ -130,6 +130,10 @@ enum screen_type {
  152. * of a char. Remove this hack when the whole LCD api goes to fully
  153. * pixel based positioning - jdgordon */
  154. #define STYLE_XY_PIXELS 0x00010000
  155. +/* HACK: This might not even be needed... don't restart scrolling
  156. + * when we update the lines text - jdgordon */
  157. +#define STYLE_NOSCROLL_RESTART 0x00020000
  158. +
  159. #define STYLE_COLOR_MASK 0x0000FFFF
  160. #ifdef HAVE_LCD_COLOR
  161. #define STYLE_CURLN_MASK 0x0000FF00
  162.  
  163.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement