summaryrefslogtreecommitdiff
path: root/apps/plugins/pdbox
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/pdbox')
-rw-r--r--apps/plugins/pdbox/pdbox-gui.c42
1 files changed, 24 insertions, 18 deletions
diff --git a/apps/plugins/pdbox/pdbox-gui.c b/apps/plugins/pdbox/pdbox-gui.c
index a03e97c361..33d15ab661 100644
--- a/apps/plugins/pdbox/pdbox-gui.c
+++ b/apps/plugins/pdbox/pdbox-gui.c
@@ -24,9 +24,6 @@
24 24
25#include "lib/xlcd.h" 25#include "lib/xlcd.h"
26 26
27/* Declare back- and foreground colors. */
28#define BGCOLOR (LCD_BLACK)
29#define FGCOLOR (LCD_WHITE)
30/* Button colors. */ 27/* Button colors. */
31#define BTNCOLOR_DARK (LCD_DARKGRAY) 28#define BTNCOLOR_DARK (LCD_DARKGRAY)
32#define BTNCOLOR_LIGHT (LCD_LIGHTGRAY) 29#define BTNCOLOR_LIGHT (LCD_LIGHTGRAY)
@@ -38,6 +35,10 @@ extern bool quit;
38/* Screen multiplier. */ 35/* Screen multiplier. */
39static float screen_multiplier; 36static float screen_multiplier;
40 37
38/* Back- and foreground colors. */
39static unsigned bgcolor;
40static unsigned fgcolor;
41
41/* Displacement of the slanted corner in the contour of the number widget. */ 42/* Displacement of the slanted corner in the contour of the number widget. */
42static int number_corner; 43static int number_corner;
43 44
@@ -157,13 +158,18 @@ void pd_gui_init(void)
157 screen_multiplier = ((float) LCD_WIDTH) / 160.0f; 158 screen_multiplier = ((float) LCD_WIDTH) / 160.0f;
158 number_corner = 5 * screen_multiplier; 159 number_corner = 5 * screen_multiplier;
159 160
160 /* Set back- and foreground color. */ 161 /* Get back- and foreground colors. */
161 rb->lcd_set_background(BGCOLOR); 162 bgcolor = rb->lcd_get_background();
162 rb->lcd_set_foreground(FGCOLOR); 163 fgcolor = rb->lcd_get_foreground();
163 164
164 /* Clear background. */ 165 /* Clear background. */
165 rb->lcd_clear_display(); 166 rb->lcd_clear_display();
166 167
168 /* Draw background of appropriate color. */
169 rb->lcd_set_foreground(bgcolor);
170 rb->lcd_fillrect(0, 0, LCD_WIDTH, LCD_HEIGHT);
171 rb->lcd_set_foreground(fgcolor);
172
167 /* Update display. */ 173 /* Update display. */
168 rb->lcd_update(); 174 rb->lcd_update();
169} 175}
@@ -411,7 +417,7 @@ unsigned int pd_gui_load_patch(struct pd_widget* wg, unsigned int max_widgets)
411void pd_gui_draw_standard(void) 417void pd_gui_draw_standard(void)
412{ 418{
413 /* Draw main circle. */ 419 /* Draw main circle. */
414 rb->lcd_set_foreground(FGCOLOR); 420 rb->lcd_set_foreground(fgcolor);
415 fillcircle(LCD_WIDTH / 2, 421 fillcircle(LCD_WIDTH / 2,
416 LCD_HEIGHT / 2, 422 LCD_HEIGHT / 2,
417 2 * MIN(LCD_WIDTH, LCD_HEIGHT) / 5); 423 2 * MIN(LCD_WIDTH, LCD_HEIGHT) / 5);
@@ -444,7 +450,7 @@ void pd_gui_draw_standard(void)
444 MIN(LCD_WIDTH, LCD_HEIGHT) / 8); 450 MIN(LCD_WIDTH, LCD_HEIGHT) / 8);
445 451
446 /* Restore foreground color. */ 452 /* Restore foreground color. */
447 rb->lcd_set_foreground(FGCOLOR); 453 rb->lcd_set_foreground(fgcolor);
448} 454}
449 455
450/* Draw custom user interface. */ 456/* Draw custom user interface. */
@@ -460,9 +466,9 @@ void pd_gui_draw_custom(struct pd_widget* wg, unsigned int widgets)
460 { 466 {
461 case PD_BANG: 467 case PD_BANG:
462 /* Clear area to (re-)draw. */ 468 /* Clear area to (re-)draw. */
463 rb->lcd_set_foreground(BGCOLOR); 469 rb->lcd_set_foreground(bgcolor);
464 rb->lcd_fillrect(wg->x, wg->y, wg->w, wg->h); 470 rb->lcd_fillrect(wg->x, wg->y, wg->w, wg->h);
465 rb->lcd_set_foreground(FGCOLOR); 471 rb->lcd_set_foreground(fgcolor);
466 /* Draw border (rectangle). */ 472 /* Draw border (rectangle). */
467 rb->lcd_drawrect(wg->x, wg->y, wg->w, wg->h); 473 rb->lcd_drawrect(wg->x, wg->y, wg->w, wg->h);
468 /* Draw button (circle), being filled depending on value. */ 474 /* Draw button (circle), being filled depending on value. */
@@ -478,9 +484,9 @@ void pd_gui_draw_custom(struct pd_widget* wg, unsigned int widgets)
478 484
479 case PD_VSLIDER: 485 case PD_VSLIDER:
480 /* Clear area to (re-)draw. */ 486 /* Clear area to (re-)draw. */
481 rb->lcd_set_foreground(BGCOLOR); 487 rb->lcd_set_foreground(bgcolor);
482 rb->lcd_fillrect(wg->x, wg->y, wg->w, wg->h); 488 rb->lcd_fillrect(wg->x, wg->y, wg->w, wg->h);
483 rb->lcd_set_foreground(FGCOLOR); 489 rb->lcd_set_foreground(fgcolor);
484 /* Draw border. */ 490 /* Draw border. */
485 rb->lcd_drawrect(wg->x, wg->y, wg->w, wg->h); 491 rb->lcd_drawrect(wg->x, wg->y, wg->w, wg->h);
486 /* Draw slider. */ 492 /* Draw slider. */
@@ -491,9 +497,9 @@ void pd_gui_draw_custom(struct pd_widget* wg, unsigned int widgets)
491 497
492 case PD_HSLIDER: 498 case PD_HSLIDER:
493 /* Clear area to (re-)draw. */ 499 /* Clear area to (re-)draw. */
494 rb->lcd_set_foreground(BGCOLOR); 500 rb->lcd_set_foreground(bgcolor);
495 rb->lcd_fillrect(wg->x, wg->y, wg->w, wg->h); 501 rb->lcd_fillrect(wg->x, wg->y, wg->w, wg->h);
496 rb->lcd_set_foreground(FGCOLOR); 502 rb->lcd_set_foreground(fgcolor);
497 /* Draw border. */ 503 /* Draw border. */
498 rb->lcd_drawrect(wg->x, wg->y, wg->w, wg->h); 504 rb->lcd_drawrect(wg->x, wg->y, wg->w, wg->h);
499 /* Draw slider. */ 505 /* Draw slider. */
@@ -504,9 +510,9 @@ void pd_gui_draw_custom(struct pd_widget* wg, unsigned int widgets)
504 510
505 case PD_HRADIO: 511 case PD_HRADIO:
506 /* Clear area to (re-)draw. */ 512 /* Clear area to (re-)draw. */
507 rb->lcd_set_foreground(BGCOLOR); 513 rb->lcd_set_foreground(bgcolor);
508 rb->lcd_fillrect(wg->x, wg->y, wg->w, wg->h); 514 rb->lcd_fillrect(wg->x, wg->y, wg->w, wg->h);
509 rb->lcd_set_foreground(FGCOLOR); 515 rb->lcd_set_foreground(fgcolor);
510 for(j = 0; j < wg->w / wg->h; j++) 516 for(j = 0; j < wg->w / wg->h; j++)
511 { 517 {
512 /* Draw border. */ 518 /* Draw border. */
@@ -520,9 +526,9 @@ void pd_gui_draw_custom(struct pd_widget* wg, unsigned int widgets)
520 526
521 case PD_VRADIO: 527 case PD_VRADIO:
522 /* Clear area to (re-)draw. */ 528 /* Clear area to (re-)draw. */
523 rb->lcd_set_foreground(BGCOLOR); 529 rb->lcd_set_foreground(bgcolor);
524 rb->lcd_fillrect(wg->x, wg->y, wg->w, wg->h); 530 rb->lcd_fillrect(wg->x, wg->y, wg->w, wg->h);
525 rb->lcd_set_foreground(FGCOLOR); 531 rb->lcd_set_foreground(fgcolor);
526 for(j = 0; j < wg->h / wg->w; j++) 532 for(j = 0; j < wg->h / wg->w; j++)
527 { 533 {
528 /* Draw border. */ 534 /* Draw border. */