diff options
-rw-r--r-- | apps/abrepeat.c | 65 | ||||
-rw-r--r-- | apps/abrepeat.h | 9 | ||||
-rwxr-xr-x | apps/gui/skin_engine/skin_display.c | 67 |
3 files changed, 79 insertions, 62 deletions
diff --git a/apps/abrepeat.c b/apps/abrepeat.c index a149069709..999d9dcf38 100644 --- a/apps/abrepeat.c +++ b/apps/abrepeat.c | |||
@@ -27,6 +27,7 @@ | |||
27 | unsigned int ab_A_marker IDATA_ATTR = AB_MARKER_NONE; | 27 | unsigned int ab_A_marker IDATA_ATTR = AB_MARKER_NONE; |
28 | unsigned int ab_B_marker IDATA_ATTR = AB_MARKER_NONE; | 28 | unsigned int ab_B_marker IDATA_ATTR = AB_MARKER_NONE; |
29 | 29 | ||
30 | |||
30 | static inline bool ab_A_marker_set(void) | 31 | static inline bool ab_A_marker_set(void) |
31 | { | 32 | { |
32 | return ab_A_marker != AB_MARKER_NONE; | 33 | return ab_A_marker != AB_MARKER_NONE; |
@@ -37,6 +38,7 @@ static inline bool ab_B_marker_set(void) | |||
37 | return ab_B_marker != AB_MARKER_NONE; | 38 | return ab_B_marker != AB_MARKER_NONE; |
38 | } | 39 | } |
39 | 40 | ||
41 | |||
40 | #if (CONFIG_CODEC == SWCODEC) | 42 | #if (CONFIG_CODEC == SWCODEC) |
41 | void ab_end_of_track_report(void) | 43 | void ab_end_of_track_report(void) |
42 | { | 44 | { |
@@ -158,67 +160,16 @@ void ab_set_B_marker(unsigned int song_position) | |||
158 | ab_A_marker = AB_MARKER_NONE; | 160 | ab_A_marker = AB_MARKER_NONE; |
159 | } | 161 | } |
160 | 162 | ||
161 | #ifdef HAVE_LCD_BITMAP | 163 | bool ab_get_A_marker(unsigned *song_position) |
162 | |||
163 | static int ab_calc_mark_x_pos(int mark, int capacity, | ||
164 | int offset, int size) | ||
165 | { | ||
166 | return offset + ( (size * mark) / capacity ); | ||
167 | } | ||
168 | |||
169 | static void ab_draw_vertical_line_mark(struct screen * screen, | ||
170 | int x, int y, int h) | ||
171 | { | 164 | { |
172 | screen->set_drawmode(DRMODE_COMPLEMENT); | 165 | *song_position = ab_A_marker; |
173 | screen->vline(x, y, y+h-1); | 166 | return ab_A_marker_set(); |
174 | } | ||
175 | |||
176 | #define DIRECTION_RIGHT 1 | ||
177 | #define DIRECTION_LEFT -1 | ||
178 | |||
179 | static void ab_draw_arrow_mark(struct screen * screen, | ||
180 | int x, int y, int h, int direction) | ||
181 | { | ||
182 | /* draw lines in decreasing size until a height of zero is reached */ | ||
183 | screen->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | ||
184 | while( h > 0 ) | ||
185 | { | ||
186 | screen->vline(x, y, y+h-1); | ||
187 | h -= 2; | ||
188 | y++; | ||
189 | x += direction; | ||
190 | screen->set_drawmode(DRMODE_COMPLEMENT); | ||
191 | } | ||
192 | } | 167 | } |
193 | 168 | ||
194 | void ab_draw_markers(struct screen * screen, int capacity, | 169 | bool ab_get_B_marker(unsigned *song_position) |
195 | int x, int y, int w, int h) | ||
196 | { | 170 | { |
197 | int xa = ab_calc_mark_x_pos(ab_A_marker, capacity, x, w); | 171 | *song_position = ab_B_marker; |
198 | int xb = ab_calc_mark_x_pos(ab_B_marker, capacity, x, w); | 172 | return ab_B_marker_set(); |
199 | /* if both markers are set, determine if they're far enough apart | ||
200 | to draw arrows */ | ||
201 | if ( ab_A_marker_set() && ab_B_marker_set() ) | ||
202 | { | ||
203 | int arrow_width = (h+1) / 2; | ||
204 | if ( (xb-xa) < (arrow_width*2) ) | ||
205 | { | ||
206 | ab_draw_vertical_line_mark(screen, xa, y, h); | ||
207 | ab_draw_vertical_line_mark(screen, xb, y, h); | ||
208 | return; | ||
209 | } | ||
210 | } | ||
211 | |||
212 | if (ab_A_marker_set()) | ||
213 | { | ||
214 | ab_draw_arrow_mark(screen, xa, y, h, DIRECTION_RIGHT); | ||
215 | } | ||
216 | if (ab_B_marker_set()) | ||
217 | { | ||
218 | ab_draw_arrow_mark(screen, xb, y, h, DIRECTION_LEFT); | ||
219 | } | ||
220 | } | 173 | } |
221 | 174 | ||
222 | #endif /* HAVE_LCD_BITMAP */ | ||
223 | |||
224 | #endif /* AB_REPEAT_ENABLE */ | 175 | #endif /* AB_REPEAT_ENABLE */ |
diff --git a/apps/abrepeat.h b/apps/abrepeat.h index 49557a34b7..ec0a07c827 100644 --- a/apps/abrepeat.h +++ b/apps/abrepeat.h | |||
@@ -37,14 +37,13 @@ void ab_jump_to_A_marker(void); | |||
37 | void ab_reset_markers(void); | 37 | void ab_reset_markers(void); |
38 | void ab_set_A_marker(unsigned int song_position); | 38 | void ab_set_A_marker(unsigned int song_position); |
39 | void ab_set_B_marker(unsigned int song_position); | 39 | void ab_set_B_marker(unsigned int song_position); |
40 | /* These return whether the marker are actually set. | ||
41 | * The actual positions are returned via output parameter */ | ||
42 | bool ab_get_A_marker(unsigned int *song_position); | ||
43 | bool ab_get_B_marker(unsigned int *song_position); | ||
40 | #if (CONFIG_CODEC == SWCODEC) | 44 | #if (CONFIG_CODEC == SWCODEC) |
41 | void ab_end_of_track_report(void); | 45 | void ab_end_of_track_report(void); |
42 | #endif | 46 | #endif |
43 | #ifdef HAVE_LCD_BITMAP | ||
44 | #include "screen_access.h" | ||
45 | void ab_draw_markers(struct screen * screen, int capacity, | ||
46 | int x, int y, int w, int h); | ||
47 | #endif | ||
48 | 47 | ||
49 | /* These functions really need to be inlined for speed */ | 48 | /* These functions really need to be inlined for speed */ |
50 | extern unsigned int ab_A_marker; | 49 | extern unsigned int ab_A_marker; |
diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c index 137bced19b..60557bba0d 100755 --- a/apps/gui/skin_engine/skin_display.c +++ b/apps/gui/skin_engine/skin_display.c | |||
@@ -97,6 +97,73 @@ void skin_update(enum skinnable_screens skin, enum screen_type screen, | |||
97 | 97 | ||
98 | #ifdef HAVE_LCD_BITMAP | 98 | #ifdef HAVE_LCD_BITMAP |
99 | 99 | ||
100 | |||
101 | #ifdef AB_REPEAT_ENABLE | ||
102 | |||
103 | #define DIRECTION_RIGHT 1 | ||
104 | #define DIRECTION_LEFT -1 | ||
105 | |||
106 | static int ab_calc_mark_x_pos(int mark, int capacity, | ||
107 | int offset, int size) | ||
108 | { | ||
109 | return offset + ( (size * mark) / capacity ); | ||
110 | } | ||
111 | |||
112 | static void ab_draw_vertical_line_mark(struct screen * screen, | ||
113 | int x, int y, int h) | ||
114 | { | ||
115 | screen->set_drawmode(DRMODE_COMPLEMENT); | ||
116 | screen->vline(x, y, y+h-1); | ||
117 | } | ||
118 | |||
119 | static void ab_draw_arrow_mark(struct screen * screen, | ||
120 | int x, int y, int h, int direction) | ||
121 | { | ||
122 | /* draw lines in decreasing size until a height of zero is reached */ | ||
123 | screen->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | ||
124 | while( h > 0 ) | ||
125 | { | ||
126 | screen->vline(x, y, y+h-1); | ||
127 | h -= 2; | ||
128 | y++; | ||
129 | x += direction; | ||
130 | screen->set_drawmode(DRMODE_COMPLEMENT); | ||
131 | } | ||
132 | } | ||
133 | |||
134 | void ab_draw_markers(struct screen * screen, int capacity, | ||
135 | int x, int y, int w, int h) | ||
136 | { | ||
137 | bool a_set, b_set; | ||
138 | unsigned int a, b; | ||
139 | int xa, xb; | ||
140 | |||
141 | a_set = ab_get_A_marker(&a); | ||
142 | b_set = ab_get_B_marker(&b); | ||
143 | xa = ab_calc_mark_x_pos(a, capacity, x, w); | ||
144 | xb = ab_calc_mark_x_pos(b, capacity, x, w); | ||
145 | /* if both markers are set, determine if they're far enough apart | ||
146 | to draw arrows */ | ||
147 | if ( a_set && b_set ) | ||
148 | { | ||
149 | int arrow_width = (h+1) / 2; | ||
150 | if ( (xb-xa) < (arrow_width*2) ) | ||
151 | { | ||
152 | ab_draw_vertical_line_mark(screen, xa, y, h); | ||
153 | ab_draw_vertical_line_mark(screen, xb, y, h); | ||
154 | return; | ||
155 | } | ||
156 | } | ||
157 | |||
158 | if (a_set) | ||
159 | ab_draw_arrow_mark(screen, xa, y, h, DIRECTION_RIGHT); | ||
160 | |||
161 | if (b_set) | ||
162 | ab_draw_arrow_mark(screen, xb, y, h, DIRECTION_LEFT); | ||
163 | } | ||
164 | |||
165 | #endif | ||
166 | |||
100 | void draw_progressbar(struct gui_wps *gwps, int line, struct progressbar *pb) | 167 | void draw_progressbar(struct gui_wps *gwps, int line, struct progressbar *pb) |
101 | { | 168 | { |
102 | struct screen *display = gwps->display; | 169 | struct screen *display = gwps->display; |