summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2014-01-12 15:11:46 +0100
committerThomas Martitz <kugel@rockbox.org>2014-01-12 15:22:29 +0100
commit3ae73433ab826c7a4f3c49b4d0a86fd9dc29a9cc (patch)
treefe285fbee6684aa0337723ac4af9280e13d8f3c9 /apps
parent6e882b43b6242e102f4514904c57abb68ad69efe (diff)
downloadrockbox-3ae73433ab826c7a4f3c49b4d0a86fd9dc29a9cc.tar.gz
rockbox-3ae73433ab826c7a4f3c49b4d0a86fd9dc29a9cc.zip
skin_engine: New param "noborder" for the bar tags.
By specifying this param the bar will not have a border/box. Instead the inner part that fills up is maximized on the bar area. Note that this only affects bars using foreground and background colors, not those constructed with images. Change-Id: Ib8dd49ecbaf9e16b96de840f5f365871b73d4fa4
Diffstat (limited to 'apps')
-rw-r--r--apps/gui/scrollbar.c35
-rw-r--r--apps/gui/scrollbar.h1
-rwxr-xr-xapps/gui/skin_engine/skin_display.c5
-rw-r--r--apps/gui/skin_engine/skin_parser.c8
-rw-r--r--apps/gui/skin_engine/wps_internals.h1
5 files changed, 38 insertions, 12 deletions
diff --git a/apps/gui/scrollbar.c b/apps/gui/scrollbar.c
index aafd4b093a..2e4bd8580c 100644
--- a/apps/gui/scrollbar.c
+++ b/apps/gui/scrollbar.c
@@ -94,11 +94,20 @@ void gui_scrollbar_draw(struct screen * screen, int x, int y,
94 max_shown = items; 94 max_shown = items;
95 } 95 }
96 96
97 inner_x = x + 1; 97 if (flags & BORDER_NOFILL)
98 inner_y = y + 1; 98 {
99 inner_wd = width - 2; 99 inner_x = x;
100 inner_ht = height - 2; 100 inner_y = y;
101 101 inner_wd = width;
102 inner_ht = height;
103 }
104 else
105 {
106 inner_x = x + 1;
107 inner_y = y + 1;
108 inner_wd = width - 2;
109 inner_ht = height - 2;
110 }
102 /* Boundary check to make sure that height is reasonable, otherwise nothing 111 /* Boundary check to make sure that height is reasonable, otherwise nothing
103 * to do 112 * to do
104 */ 113 */
@@ -113,16 +122,18 @@ void gui_scrollbar_draw(struct screen * screen, int x, int y,
113 scrollbar_helper(min_shown, max_shown, items, inner_len, &size, &start); 122 scrollbar_helper(min_shown, max_shown, items, inner_len, &size, &start);
114 123
115 /* draw box */ 124 /* draw box */
125 if (!(flags & BORDER_NOFILL))
126 {
116#ifdef HAVE_LCD_COLOR 127#ifdef HAVE_LCD_COLOR
117 /* must avoid corners if case of (flags & FOREGROUND) */ 128 /* must avoid corners if case of (flags & FOREGROUND) */
118 screen->hline(inner_x, x + inner_wd, y); 129 screen->hline(inner_x, x + inner_wd, y);
119 screen->hline(inner_x, x + inner_wd, y + height - 1); 130 screen->hline(inner_x, x + inner_wd, y + height - 1);
120 screen->vline(x, inner_y, y + inner_ht); 131 screen->vline(x, inner_y, y + inner_ht);
121 screen->vline(x + width - 1, inner_y, y + inner_ht); 132 screen->vline(x + width - 1, inner_y, y + inner_ht);
122#else 133#else
123 screen->drawrect(x, y, width, height); 134 screen->drawrect(x, y, width, height);
124#endif 135#endif
125 136 }
126 screen->set_drawmode(DRMODE_SOLID | DRMODE_INVERSEVID); 137 screen->set_drawmode(DRMODE_SOLID | DRMODE_INVERSEVID);
127 138
128#ifdef HAVE_LCD_COLOR 139#ifdef HAVE_LCD_COLOR
diff --git a/apps/gui/scrollbar.h b/apps/gui/scrollbar.h
index 606b9bd3d3..dcaef5721d 100644
--- a/apps/gui/scrollbar.h
+++ b/apps/gui/scrollbar.h
@@ -30,6 +30,7 @@ enum orientation {
30 HORIZONTAL = 0x0001, /* Horizontal orientation */ 30 HORIZONTAL = 0x0001, /* Horizontal orientation */
31 INVERTFILL = 0x0002, /* Invert the fill direction */ 31 INVERTFILL = 0x0002, /* Invert the fill direction */
32 INNER_NOFILL = 0x0004, /* Do not fill inner part */ 32 INNER_NOFILL = 0x0004, /* Do not fill inner part */
33 BORDER_NOFILL = 0x0008, /* Do not fill border part */
33#ifdef HAVE_LCD_COLOR 34#ifdef HAVE_LCD_COLOR
34 FOREGROUND = 0x0020, /* Do not clear background pixels */ 35 FOREGROUND = 0x0020, /* Do not clear background pixels */
35 INNER_FILL = 0x0040, /* Fill inner part even if FOREGROUND */ 36 INNER_FILL = 0x0040, /* Fill inner part even if FOREGROUND */
diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c
index 82eaa1f553..137bced19b 100755
--- a/apps/gui/skin_engine/skin_display.c
+++ b/apps/gui/skin_engine/skin_display.c
@@ -202,6 +202,11 @@ void draw_progressbar(struct gui_wps *gwps, int line, struct progressbar *pb)
202 flags |= INNER_NOFILL; 202 flags |= INNER_NOFILL;
203 } 203 }
204 204
205 if (pb->noborder)
206 {
207 flags |= BORDER_NOFILL;
208 }
209
205 if (SKINOFFSETTOPTR(get_skin_buffer(gwps->data), pb->slider)) 210 if (SKINOFFSETTOPTR(get_skin_buffer(gwps->data), pb->slider))
206 { 211 {
207 struct gui_img *img = SKINOFFSETTOPTR(get_skin_buffer(gwps->data), pb->slider); 212 struct gui_img *img = SKINOFFSETTOPTR(get_skin_buffer(gwps->data), pb->slider);
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c
index 1de1047583..06b37d875c 100644
--- a/apps/gui/skin_engine/skin_parser.c
+++ b/apps/gui/skin_engine/skin_parser.c
@@ -901,6 +901,7 @@ static int parse_progressbar_tag(struct skin_element* element,
901 pb->vp = PTRTOSKINOFFSET(skin_buffer, vp); 901 pb->vp = PTRTOSKINOFFSET(skin_buffer, vp);
902 pb->follow_lang_direction = follow_lang_direction > 0; 902 pb->follow_lang_direction = follow_lang_direction > 0;
903 pb->nofill = false; 903 pb->nofill = false;
904 pb->noborder = false;
904 pb->nobar = false; 905 pb->nobar = false;
905 pb->image = PTRTOSKINOFFSET(skin_buffer, NULL); 906 pb->image = PTRTOSKINOFFSET(skin_buffer, NULL);
906 pb->slider = PTRTOSKINOFFSET(skin_buffer, NULL); 907 pb->slider = PTRTOSKINOFFSET(skin_buffer, NULL);
@@ -978,6 +979,8 @@ static int parse_progressbar_tag(struct skin_element* element,
978 pb->invert_fill_direction = true; 979 pb->invert_fill_direction = true;
979 else if (!strcmp(text, "nofill")) 980 else if (!strcmp(text, "nofill"))
980 pb->nofill = true; 981 pb->nofill = true;
982 else if (!strcmp(text, "noborder"))
983 pb->noborder = true;
981 else if (!strcmp(text, "nobar")) 984 else if (!strcmp(text, "nobar"))
982 pb->nobar = true; 985 pb->nobar = true;
983 else if (!strcmp(text, "slider")) 986 else if (!strcmp(text, "slider"))
@@ -1051,6 +1054,11 @@ static int parse_progressbar_tag(struct skin_element* element,
1051 1054
1052 if (image_filename) 1055 if (image_filename)
1053 { 1056 {
1057 /* noborder is incompatible together with image. There is no border
1058 * anyway. */
1059 if (pb->noborder)
1060 return WPS_ERROR_INVALID_PARAM;
1061
1054 pb->image = PTRTOSKINOFFSET(skin_buffer, 1062 pb->image = PTRTOSKINOFFSET(skin_buffer,
1055 skin_find_item(image_filename, SKIN_FIND_IMAGE, wps_data)); 1063 skin_find_item(image_filename, SKIN_FIND_IMAGE, wps_data));
1056 if (!SKINOFFSETTOPTR(skin_buffer, pb->image)) /* load later */ 1064 if (!SKINOFFSETTOPTR(skin_buffer, pb->image)) /* load later */
diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h
index 339669570a..e7996b0530 100644
--- a/apps/gui/skin_engine/wps_internals.h
+++ b/apps/gui/skin_engine/wps_internals.h
@@ -120,6 +120,7 @@ struct progressbar {
120 120
121 bool invert_fill_direction; 121 bool invert_fill_direction;
122 bool nofill; 122 bool nofill;
123 bool noborder;
123 bool nobar; 124 bool nobar;
124 OFFSETTYPE(struct gui_img *) slider; 125 OFFSETTYPE(struct gui_img *) slider;
125 bool horizontal; 126 bool horizontal;