summaryrefslogtreecommitdiff
path: root/apps/eq_menu.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/eq_menu.c')
-rw-r--r--apps/eq_menu.c31
1 files changed, 8 insertions, 23 deletions
diff --git a/apps/eq_menu.c b/apps/eq_menu.c
index 32a22e08e8..a74fddb05a 100644
--- a/apps/eq_menu.c
+++ b/apps/eq_menu.c
@@ -33,7 +33,6 @@
33#include "screens.h" 33#include "screens.h"
34#include "icons.h" 34#include "icons.h"
35#include "font.h" 35#include "font.h"
36#include "widgets.h"
37#include "lang.h" 36#include "lang.h"
38#include "sprintf.h" 37#include "sprintf.h"
39#include "talk.h" 38#include "talk.h"
@@ -45,6 +44,7 @@
45#include "talk.h" 44#include "talk.h"
46#include "screen_access.h" 45#include "screen_access.h"
47#include "keyboard.h" 46#include "keyboard.h"
47#include "gui/scrollbar.h"
48 48
49/* Key definitions */ 49/* Key definitions */
50#if (CONFIG_KEYPAD == IRIVER_H100_PAD || \ 50#if (CONFIG_KEYPAD == IRIVER_H100_PAD || \
@@ -345,9 +345,6 @@ static bool eq_advanced_menu(void)
345 return result; 345 return result;
346} 346}
347 347
348#define SLIDER_KNOB_HEIGHT 6
349#define SLIDER_KNOB_WIDTH 4
350
351enum eq_slider_mode { 348enum eq_slider_mode {
352 GAIN, 349 GAIN,
353 CUTOFF, 350 CUTOFF,
@@ -360,22 +357,8 @@ enum eq_type {
360 HIGH_SHELF 357 HIGH_SHELF
361}; 358};
362 359
363/* Draw a slider */
364static void draw_slider(const struct screen * screen, int x, int y,
365 int width, int steps, int current_step)
366{
367 int knob_x = ((width * 100 / steps) * current_step) / 100
368 + (SLIDER_KNOB_WIDTH / 2);
369
370 /* Draw groove */
371 screen->fillrect(x, y + 2, width, 2);
372
373 /* Draw knob */
374 screen->fillrect(x + knob_x, y, SLIDER_KNOB_WIDTH, SLIDER_KNOB_HEIGHT);
375}
376
377/* Draw the UI for a whole EQ band */ 360/* Draw the UI for a whole EQ band */
378static int draw_eq_slider(const struct screen * screen, int x, int y, 361static int draw_eq_slider(struct screen * screen, int x, int y,
379 int width, int cutoff, int q, int gain, bool selected, 362 int width, int cutoff, int q, int gain, bool selected,
380 enum eq_slider_mode mode, enum eq_type type) 363 enum eq_slider_mode mode, enum eq_type type)
381{ 364{
@@ -386,6 +369,7 @@ static int draw_eq_slider(const struct screen * screen, int x, int y,
386 int abs_gain = abs(gain); 369 int abs_gain = abs(gain);
387 int current_x, total_height, separator_width, separator_height; 370 int current_x, total_height, separator_width, separator_height;
388 int w, h; 371 int w, h;
372 const int slider_height = 6;
389 373
390 /* Start two pixels in, one for border, one for margin */ 374 /* Start two pixels in, one for border, one for margin */
391 current_x = x + 2; 375 current_x = x + 2;
@@ -394,7 +378,7 @@ static int draw_eq_slider(const struct screen * screen, int x, int y,
394 screen->getstringsize(separator, &separator_width, &separator_height); 378 screen->getstringsize(separator, &separator_width, &separator_height);
395 379
396 /* Total height includes margins, text, and line selector */ 380 /* Total height includes margins, text, and line selector */
397 total_height = separator_height + SLIDER_KNOB_HEIGHT + 2 + 3; 381 total_height = separator_height + slider_height + 2 + 3;
398 382
399 /* Print out the band label */ 383 /* Print out the band label */
400 if (type == LOW_SHELF) { 384 if (type == LOW_SHELF) {
@@ -463,9 +447,10 @@ static int draw_eq_slider(const struct screen * screen, int x, int y,
463 screen->drawrect(x, y, width, total_height); 447 screen->drawrect(x, y, width, total_height);
464 } 448 }
465 449
466 /* Draw horizontal slider */ 450 /* Draw horizontal slider. Reuse scrollbar for this */
467 draw_slider(screen, x + 3, y + h + 3, width - 6, steps, 451 gui_scrollbar_draw(screen, x + 3, y + h + 3, width - 6, slider_height, steps,
468 abs(EQ_GAIN_MIN) + gain); 452 abs(EQ_GAIN_MIN) + gain - 10, abs(EQ_GAIN_MIN) + gain + 10,
453 HORIZONTAL);
469 454
470 return total_height; 455 return total_height;
471} 456}