diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2008-10-05 13:45:21 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2008-10-05 13:45:21 +0000 |
commit | e8f7ad1b28ef1d44546a7769aa0c531b66c76111 (patch) | |
tree | 81548723db241f9f23be166e7f8c8ea4eb58e8c7 /apps/gui | |
parent | 6a81923e6e579b0af1ac7b781d2ca209e04acb71 (diff) | |
download | rockbox-e8f7ad1b28ef1d44546a7769aa0c531b66c76111.tar.gz rockbox-e8f7ad1b28ef1d44546a7769aa0c531b66c76111.zip |
yes... i'm just trying to boost my ohloh score!
(also minor code policing again)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18716 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui')
-rw-r--r-- | apps/gui/pitchscreen.c | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/apps/gui/pitchscreen.c b/apps/gui/pitchscreen.c index ac74c22652..7a05a57743 100644 --- a/apps/gui/pitchscreen.c +++ b/apps/gui/pitchscreen.c | |||
@@ -42,15 +42,19 @@ | |||
42 | 42 | ||
43 | #define PITCH_MODE_ABSOLUTE 1 | 43 | #define PITCH_MODE_ABSOLUTE 1 |
44 | #define PITCH_MODE_SEMITONE -PITCH_MODE_ABSOLUTE | 44 | #define PITCH_MODE_SEMITONE -PITCH_MODE_ABSOLUTE |
45 | #define ICON_BORDER 12 | 45 | #define ICON_BORDER 12 /* icons are currently 7x8, so add ~2 pixels */ |
46 | /* on both sides when drawing */ | ||
47 | |||
46 | 48 | ||
47 | static int pitch_mode = PITCH_MODE_ABSOLUTE; /* 1 - absolute, -1 - semitone */ | ||
48 | #define PITCH_MAX 2000 | 49 | #define PITCH_MAX 2000 |
49 | #define PITCH_MIN 500 | 50 | #define PITCH_MIN 500 |
50 | #define PITCH_SMALL_DELTA 1 | 51 | #define PITCH_SMALL_DELTA 1 |
51 | #define PITCH_BIG_DELTA 10 | 52 | #define PITCH_BIG_DELTA 10 |
52 | #define PITCH_NUDGE_DELTA 20 | 53 | #define PITCH_NUDGE_DELTA 20 |
53 | 54 | ||
55 | |||
56 | static int pitch_mode = PITCH_MODE_ABSOLUTE; /* 1 - absolute, -1 - semitone */ | ||
57 | |||
54 | enum | 58 | enum |
55 | { | 59 | { |
56 | PITCH_TOP = 0, | 60 | PITCH_TOP = 0, |
@@ -59,32 +63,30 @@ enum | |||
59 | PITCH_ITEM_COUNT, | 63 | PITCH_ITEM_COUNT, |
60 | }; | 64 | }; |
61 | 65 | ||
62 | static void pitchscreen_fix_viewports(enum screen_type screen, | 66 | static void pitchscreen_fix_viewports(struct viewport *parent, |
63 | struct viewport *parent, | 67 | struct viewport pitch_viewports[PITCH_ITEM_COUNT]) |
64 | struct viewport pitch_viewports[NB_SCREENS][PITCH_ITEM_COUNT]) | ||
65 | { | 68 | { |
66 | short n, height; | 69 | short n, height; |
67 | height = font_get(parent->font)->height; | 70 | height = font_get(parent->font)->height; |
68 | for (n = 0; n < PITCH_ITEM_COUNT; n++) | 71 | for (n = 0; n < PITCH_ITEM_COUNT; n++) |
69 | { | 72 | { |
70 | pitch_viewports[screen][n] = *parent; | 73 | pitch_viewports[n] = *parent; |
71 | pitch_viewports[screen][n].height = height; | 74 | pitch_viewports[n].height = height; |
72 | } | 75 | } |
73 | pitch_viewports[screen][PITCH_TOP].y += ICON_BORDER; | 76 | pitch_viewports[PITCH_TOP].y += ICON_BORDER; |
74 | 77 | ||
75 | pitch_viewports[screen][PITCH_MID].x += ICON_BORDER; | 78 | pitch_viewports[PITCH_MID].x += ICON_BORDER; |
76 | pitch_viewports[screen][PITCH_MID].width = parent->width - ICON_BORDER*2; | 79 | pitch_viewports[PITCH_MID].width = parent->width - ICON_BORDER*2; |
77 | pitch_viewports[screen][PITCH_MID].height = height * 2; | 80 | pitch_viewports[PITCH_MID].height = height * 2; |
78 | pitch_viewports[screen][PITCH_MID].y += parent->height / 2 - | 81 | pitch_viewports[PITCH_MID].y += parent->height / 2 - |
79 | pitch_viewports[screen][PITCH_MID].height / 2; | 82 | pitch_viewports[PITCH_MID].height / 2; |
80 | pitch_viewports[screen][PITCH_BOTTOM].y += parent->height - height - | 83 | pitch_viewports[PITCH_BOTTOM].y += parent->height - height - ICON_BORDER; |
81 | ICON_BORDER; | ||
82 | } | 84 | } |
83 | 85 | ||
84 | /* must be called before pitchscreen_draw, or within | 86 | /* must be called before pitchscreen_draw, or within |
85 | * since it neither clears nor updates the display */ | 87 | * since it neither clears nor updates the display */ |
86 | static void pitchscreen_draw_icons (struct screen *display, | 88 | static void pitchscreen_draw_icons (struct screen *display, |
87 | struct viewport *parent) | 89 | struct viewport *parent) |
88 | { | 90 | { |
89 | display->set_viewport(parent); | 91 | display->set_viewport(parent); |
90 | display->mono_bitmap(bitmap_icons_7x8[Icon_UpArrow], | 92 | display->mono_bitmap(bitmap_icons_7x8[Icon_UpArrow], |
@@ -101,11 +103,8 @@ static void pitchscreen_draw_icons (struct screen *display, | |||
101 | parent->height /2 - 4, 7, 8); | 103 | parent->height /2 - 4, 7, 8); |
102 | } | 104 | } |
103 | 105 | ||
104 | static void pitchscreen_draw ( | 106 | static void pitchscreen_draw (struct screen *display, int max_lines, |
105 | struct screen *display, | 107 | struct viewport pitch_viewports[PITCH_ITEM_COUNT], int pitch) |
106 | int max_lines, | ||
107 | struct viewport pitch_viewports[PITCH_ITEM_COUNT], | ||
108 | int pitch) | ||
109 | { | 108 | { |
110 | unsigned char* ptr; | 109 | unsigned char* ptr; |
111 | unsigned char buf[32]; | 110 | unsigned char buf[32]; |
@@ -182,7 +181,7 @@ static void pitchscreen_draw ( | |||
182 | display->update(); | 181 | display->update(); |
183 | } | 182 | } |
184 | 183 | ||
185 | static int pitch_increase(int pitch, int delta, bool allow_cutoff) | 184 | static int pitch_increase(int pitch, int delta, bool allow_cutoff) |
186 | { | 185 | { |
187 | int new_pitch; | 186 | int new_pitch; |
188 | 187 | ||
@@ -262,7 +261,8 @@ int gui_syncpitchscreen_run(void) | |||
262 | bool nudged = false; | 261 | bool nudged = false; |
263 | bool exit = false; | 262 | bool exit = false; |
264 | short i; | 263 | short i; |
265 | struct viewport parent[NB_SCREENS]; /* should be a parameter of this function */ | 264 | struct viewport parent[NB_SCREENS]; /* should maybe |
265 | be a parameter of this function */ | ||
266 | short max_lines[NB_SCREENS]; | 266 | short max_lines[NB_SCREENS]; |
267 | struct viewport pitch_viewports[NB_SCREENS][PITCH_ITEM_COUNT]; | 267 | struct viewport pitch_viewports[NB_SCREENS][PITCH_ITEM_COUNT]; |
268 | 268 | ||
@@ -272,7 +272,7 @@ int gui_syncpitchscreen_run(void) | |||
272 | screens[i].clear_display(); | 272 | screens[i].clear_display(); |
273 | viewport_set_defaults(&parent[i], i); | 273 | viewport_set_defaults(&parent[i], i); |
274 | max_lines[i] = viewport_get_nb_lines(&parent[i]); | 274 | max_lines[i] = viewport_get_nb_lines(&parent[i]); |
275 | pitchscreen_fix_viewports(i, &parent[i], pitch_viewports); | 275 | pitchscreen_fix_viewports(&parent[i], pitch_viewports[i]); |
276 | 276 | ||
277 | /* also, draw the icons now, it's only needed once */ | 277 | /* also, draw the icons now, it's only needed once */ |
278 | pitchscreen_draw_icons(&screens[i], &parent[i]); | 278 | pitchscreen_draw_icons(&screens[i], &parent[i]); |