diff options
-rw-r--r-- | apps/gui/color_picker.c | 26 | ||||
-rw-r--r-- | apps/menus/eq_menu.c | 9 |
2 files changed, 24 insertions, 11 deletions
diff --git a/apps/gui/color_picker.c b/apps/gui/color_picker.c index d344317c5e..827be69460 100644 --- a/apps/gui/color_picker.c +++ b/apps/gui/color_picker.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include "action.h" | 35 | #include "action.h" |
36 | #include "icon.h" | 36 | #include "icon.h" |
37 | #include "color_picker.h" | 37 | #include "color_picker.h" |
38 | #include "viewport.h" | ||
38 | 39 | ||
39 | /* structure for color info */ | 40 | /* structure for color info */ |
40 | struct rgb_pick | 41 | struct rgb_pick |
@@ -145,6 +146,10 @@ static void draw_screen(struct screen *display, char *title, | |||
145 | int slider_left, slider_width; | 146 | int slider_left, slider_width; |
146 | bool display_three_rows; | 147 | bool display_three_rows; |
147 | int max_label_width; | 148 | int max_label_width; |
149 | struct viewport vp; | ||
150 | |||
151 | viewport_set_defaults(&vp, display->screen_type); | ||
152 | display->set_viewport(&vp); | ||
148 | 153 | ||
149 | display->clear_display(); | 154 | display->clear_display(); |
150 | 155 | ||
@@ -158,7 +163,7 @@ static void draw_screen(struct screen *display, char *title, | |||
158 | enough to display the selected slider - calculate total height | 163 | enough to display the selected slider - calculate total height |
159 | of display with three sliders present */ | 164 | of display with three sliders present */ |
160 | display_three_rows = | 165 | display_three_rows = |
161 | display->getheight() >= | 166 | vp.height >= |
162 | MARGIN_TOP + | 167 | MARGIN_TOP + |
163 | display->getcharheight()*4 + /* Title + 3 sliders */ | 168 | display->getcharheight()*4 + /* Title + 3 sliders */ |
164 | TITLE_MARGIN_BOTTOM + | 169 | TITLE_MARGIN_BOTTOM + |
@@ -179,13 +184,13 @@ static void draw_screen(struct screen *display, char *title, | |||
179 | /* Draw title string */ | 184 | /* Draw title string */ |
180 | set_drawinfo(display, DRMODE_SOLID, text_color, background_color); | 185 | set_drawinfo(display, DRMODE_SOLID, text_color, background_color); |
181 | display->getstringsize(title, &x, &y); | 186 | display->getstringsize(title, &x, &y); |
182 | display->putsxy((display->getwidth() - x) / 2, MARGIN_TOP, title); | 187 | display->putsxy((vp.width - x) / 2, MARGIN_TOP, title); |
183 | 188 | ||
184 | /* Get slider positions and top starting position */ | 189 | /* Get slider positions and top starting position */ |
185 | text_top = MARGIN_TOP + y + TITLE_MARGIN_BOTTOM + SELECTOR_TB_MARGIN; | 190 | text_top = MARGIN_TOP + y + TITLE_MARGIN_BOTTOM + SELECTOR_TB_MARGIN; |
186 | slider_left = MARGIN_LEFT + SELECTOR_WIDTH + SELECTOR_LR_MARGIN + | 191 | slider_left = MARGIN_LEFT + SELECTOR_WIDTH + SELECTOR_LR_MARGIN + |
187 | max_label_width + SLIDER_MARGIN_LEFT; | 192 | max_label_width + SLIDER_MARGIN_LEFT; |
188 | slider_width = display->getwidth() - slider_left - SLIDER_MARGIN_RIGHT - | 193 | slider_width = vp.width - slider_left - SLIDER_MARGIN_RIGHT - |
189 | display->getcharwidth()*2 - SELECTOR_LR_MARGIN - | 194 | display->getcharwidth()*2 - SELECTOR_LR_MARGIN - |
190 | SELECTOR_WIDTH - MARGIN_RIGHT; | 195 | SELECTOR_WIDTH - MARGIN_RIGHT; |
191 | 196 | ||
@@ -209,7 +214,7 @@ static void draw_screen(struct screen *display, char *title, | |||
209 | /* Draw solid bar selection bar */ | 214 | /* Draw solid bar selection bar */ |
210 | display->fillrect(0, | 215 | display->fillrect(0, |
211 | text_top - SELECTOR_TB_MARGIN, | 216 | text_top - SELECTOR_TB_MARGIN, |
212 | display->getwidth(), | 217 | vp.width, |
213 | display->getcharheight() + | 218 | display->getcharheight() + |
214 | SELECTOR_TB_MARGIN*2); | 219 | SELECTOR_TB_MARGIN*2); |
215 | 220 | ||
@@ -226,7 +231,7 @@ static void draw_screen(struct screen *display, char *title, | |||
226 | SELECTOR_HEIGHT) / 2; | 231 | SELECTOR_HEIGHT) / 2; |
227 | screen_put_iconxy(display, MARGIN_LEFT, top, Icon_Cursor); | 232 | screen_put_iconxy(display, MARGIN_LEFT, top, Icon_Cursor); |
228 | screen_put_iconxy(display, | 233 | screen_put_iconxy(display, |
229 | display->getwidth() - MARGIN_RIGHT - | 234 | vp.width - MARGIN_RIGHT - |
230 | get_icon_width(display->screen_type), | 235 | get_icon_width(display->screen_type), |
231 | top, Icon_Cursor); | 236 | top, Icon_Cursor); |
232 | } | 237 | } |
@@ -280,9 +285,9 @@ static void draw_screen(struct screen *display, char *title, | |||
280 | /* Display color swatch on color screens only */ | 285 | /* Display color swatch on color screens only */ |
281 | int left = MARGIN_LEFT + SELECTOR_WIDTH + SELECTOR_LR_MARGIN; | 286 | int left = MARGIN_LEFT + SELECTOR_WIDTH + SELECTOR_LR_MARGIN; |
282 | int top = text_top + SWATCH_TOP_MARGIN; | 287 | int top = text_top + SWATCH_TOP_MARGIN; |
283 | int width = display->getwidth() - left - SELECTOR_LR_MARGIN - | 288 | int width = vp.width - left - SELECTOR_LR_MARGIN - |
284 | SELECTOR_WIDTH - MARGIN_RIGHT; | 289 | SELECTOR_WIDTH - MARGIN_RIGHT; |
285 | int height = display->getheight() - top - MARGIN_BOTTOM; | 290 | int height = vp.height - top - MARGIN_BOTTOM; |
286 | 291 | ||
287 | /* Only draw if room */ | 292 | /* Only draw if room */ |
288 | if (height >= display->getcharheight() + 2) | 293 | if (height >= display->getcharheight() + 2) |
@@ -315,15 +320,16 @@ static void draw_screen(struct screen *display, char *title, | |||
315 | if (i + y <= display->getheight() - MARGIN_BOTTOM) | 320 | if (i + y <= display->getheight() - MARGIN_BOTTOM) |
316 | { | 321 | { |
317 | set_drawinfo(display, DRMODE_SOLID, text_color, background_color); | 322 | set_drawinfo(display, DRMODE_SOLID, text_color, background_color); |
318 | x = (display->getwidth() - x) / 2; | 323 | x = (vp.width - x) / 2; |
319 | y = (i + display->getheight() - MARGIN_BOTTOM - y) / 2; | 324 | y = (i + vp.height - MARGIN_BOTTOM - y) / 2; |
320 | display->putsxy(x, y, buf); | 325 | display->putsxy(x, y, buf); |
321 | } | 326 | } |
322 | } | 327 | } |
323 | 328 | ||
324 | display->setfont(FONT_UI); | 329 | display->setfont(FONT_UI); |
325 | 330 | ||
326 | display->update(); | 331 | display->update_viewport(); |
332 | display->set_viewport(NULL); | ||
327 | /* Be sure screen mode is reset */ | 333 | /* Be sure screen mode is reset */ |
328 | set_drawinfo(display, DRMODE_SOLID, text_color, background_color); | 334 | set_drawinfo(display, DRMODE_SOLID, text_color, background_color); |
329 | } | 335 | } |
diff --git a/apps/menus/eq_menu.c b/apps/menus/eq_menu.c index 45bf9f41dd..77b6e6f07a 100644 --- a/apps/menus/eq_menu.c +++ b/apps/menus/eq_menu.c | |||
@@ -394,6 +394,7 @@ bool eq_menu_graphical(void) | |||
394 | 394 | ||
395 | 395 | ||
396 | FOR_NB_SCREENS(i) { | 396 | FOR_NB_SCREENS(i) { |
397 | screens[i].set_viewport(NULL); | ||
397 | screens[i].setfont(FONT_SYSFIXED); | 398 | screens[i].setfont(FONT_SYSFIXED); |
398 | screens[i].clear_display(); | 399 | screens[i].clear_display(); |
399 | 400 | ||
@@ -552,7 +553,12 @@ bool eq_menu_graphical(void) | |||
552 | exit_request = true; | 553 | exit_request = true; |
553 | result = false; | 554 | result = false; |
554 | break; | 555 | break; |
555 | 556 | case SYS_FOURHERTZ: | |
557 | /* eat this for the time being. this whole screen needs to be converted | ||
558 | * to viewports, so when that happens this message can be handled | ||
559 | * properly. | ||
560 | */ | ||
561 | break; | ||
556 | default: | 562 | default: |
557 | if(default_event_handler(button) == SYS_USB_CONNECTED) { | 563 | if(default_event_handler(button) == SYS_USB_CONNECTED) { |
558 | exit_request = true; | 564 | exit_request = true; |
@@ -572,6 +578,7 @@ bool eq_menu_graphical(void) | |||
572 | FOR_NB_SCREENS(i) { | 578 | FOR_NB_SCREENS(i) { |
573 | screens[i].setfont(FONT_UI); | 579 | screens[i].setfont(FONT_UI); |
574 | screens[i].clear_display(); | 580 | screens[i].clear_display(); |
581 | screens[i].set_viewport(NULL); | ||
575 | } | 582 | } |
576 | 583 | ||
577 | return result; | 584 | return result; |