summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Everton <dan@iocaine.org>2006-02-21 08:59:59 +0000
committerDan Everton <dan@iocaine.org>2006-02-21 08:59:59 +0000
commit1b5030cb9fb61b466116bd037116e6866f851ffc (patch)
tree74e3511b02cd225359edaf556b41b8c52b1d8101
parented5f612c26b3c8753f7ff6488f2d927c32b9b3d6 (diff)
downloadrockbox-1b5030cb9fb61b466116bd037116e6866f851ffc.tar.gz
rockbox-1b5030cb9fb61b466116bd037116e6866f851ffc.zip
Use scrollbar widget for the sliders instead of custom drawing routines.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8761 a1c6a512-1295-4272-9138-f99709370657
-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 @@
#include "screens.h"
#include "icons.h"
#include "font.h"
-#include "widgets.h"
#include "lang.h"
#include "sprintf.h"
#include "talk.h"
@@ -45,6 +44,7 @@
#include "talk.h"
#include "screen_access.h"
#include "keyboard.h"
+#include "gui/scrollbar.h"
/* Key definitions */
#if (CONFIG_KEYPAD == IRIVER_H100_PAD || \
@@ -345,9 +345,6 @@ static bool eq_advanced_menu(void)
return result;
}
-#define SLIDER_KNOB_HEIGHT 6
-#define SLIDER_KNOB_WIDTH 4
-
enum eq_slider_mode {
GAIN,
CUTOFF,
@@ -360,22 +357,8 @@ enum eq_type {
HIGH_SHELF
};
-/* Draw a slider */
-static void draw_slider(const struct screen * screen, int x, int y,
- int width, int steps, int current_step)
-{
- int knob_x = ((width * 100 / steps) * current_step) / 100
- + (SLIDER_KNOB_WIDTH / 2);
-
- /* Draw groove */
- screen->fillrect(x, y + 2, width, 2);
-
- /* Draw knob */
- screen->fillrect(x + knob_x, y, SLIDER_KNOB_WIDTH, SLIDER_KNOB_HEIGHT);
-}
-
/* Draw the UI for a whole EQ band */
-static int draw_eq_slider(const struct screen * screen, int x, int y,
+static int draw_eq_slider(struct screen * screen, int x, int y,
int width, int cutoff, int q, int gain, bool selected,
enum eq_slider_mode mode, enum eq_type type)
{
@@ -386,6 +369,7 @@ static int draw_eq_slider(const struct screen * screen, int x, int y,
int abs_gain = abs(gain);
int current_x, total_height, separator_width, separator_height;
int w, h;
+ const int slider_height = 6;
/* Start two pixels in, one for border, one for margin */
current_x = x + 2;
@@ -394,7 +378,7 @@ static int draw_eq_slider(const struct screen * screen, int x, int y,
screen->getstringsize(separator, &separator_width, &separator_height);
/* Total height includes margins, text, and line selector */
- total_height = separator_height + SLIDER_KNOB_HEIGHT + 2 + 3;
+ total_height = separator_height + slider_height + 2 + 3;
/* Print out the band label */
if (type == LOW_SHELF) {
@@ -463,9 +447,10 @@ static int draw_eq_slider(const struct screen * screen, int x, int y,
screen->drawrect(x, y, width, total_height);
}
- /* Draw horizontal slider */
- draw_slider(screen, x + 3, y + h + 3, width - 6, steps,
- abs(EQ_GAIN_MIN) + gain);
+ /* Draw horizontal slider. Reuse scrollbar for this */
+ gui_scrollbar_draw(screen, x + 3, y + h + 3, width - 6, slider_height, steps,
+ abs(EQ_GAIN_MIN) + gain - 10, abs(EQ_GAIN_MIN) + gain + 10,
+ HORIZONTAL);
return total_height;
}