summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Holmgren <magnushol@gmail.com>2006-02-07 20:22:47 +0000
committerMagnus Holmgren <magnushol@gmail.com>2006-02-07 20:22:47 +0000
commit566ce5f95163f8bbb7357dc7353bb132365f7b6e (patch)
tree870c25c5a1522eddd9bdd342088c232f987933ea
parent8f369c2d2293c060162ba79279083fe6e782a48d (diff)
downloadrockbox-566ce5f95163f8bbb7357dc7353bb132365f7b6e.tar.gz
rockbox-566ce5f95163f8bbb7357dc7353bb132365f7b6e.zip
Small progressbar fixes: Fix vertical positioning (when using non-default height). Add some checks for a reasonable size, as bad values can cause problems. Some code cleanup.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8611 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/gui/gwps-common.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index 2f9a7b3cbf..34d868f6a2 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -576,15 +576,20 @@ static char* get_tag(struct wps_data* wps_data,
576 if (p) 576 if (p)
577 wps_data->progress_end=atoi(++p); 577 wps_data->progress_end=atoi(++p);
578 else 578 else
579 wps_data->progress_end=NULL; 579 wps_data->progress_end=0;
580 }else { 580 }else {
581 wps_data->progress_start=0; 581 wps_data->progress_start=0;
582 wps_data->progress_end=NULL; 582 wps_data->progress_end=0;
583 } 583 }
584
585 if (wps_data->progress_height<3)
586 wps_data->progress_height=3;
587 if (wps_data->progress_end<wps_data->progress_start+3)
588 wps_data->progress_end=0;
584 }else { 589 }else {
585 wps_data->progress_height=6; 590 wps_data->progress_height=6;
586 wps_data->progress_start=0; 591 wps_data->progress_start=0;
587 wps_data->progress_end=NULL; 592 wps_data->progress_end=0;
588 } 593 }
589 return "\x01"; 594 return "\x01";
590#endif 595#endif
@@ -1525,20 +1530,22 @@ bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset,
1525 /* progress */ 1530 /* progress */
1526 if (flags & refresh_mode & WPS_REFRESH_PLAYER_PROGRESS) 1531 if (flags & refresh_mode & WPS_REFRESH_PLAYER_PROGRESS)
1527 { 1532 {
1528 int sby = i*h + offset + (h > 7 ? (h - 6) / 2 : 1); 1533 int sb_y = i*h + offset + ((h > data->progress_height + 1)
1529#define PROGRESS_BAR_HEIGHT gwps->data->progress_height /* this should probably be defined elsewhere; config-*.h perhaps? */ 1534 ? (h - data->progress_height) / 2 : 1);
1530 if (!gwps->data->progress_end) 1535
1531 gwps->data->progress_end=gwps->display->width; 1536 if (!data->progress_end)
1532 gui_scrollbar_draw(display, gwps->data->progress_start, sby, 1537 data->progress_end=display->width;
1533 gwps->data->progress_end-gwps->data->progress_start, 1538
1534 PROGRESS_BAR_HEIGHT, 1539 gui_scrollbar_draw(display, data->progress_start, sb_y,
1540 data->progress_end-data->progress_start,
1541 data->progress_height,
1535 state->id3->length?state->id3->length:1, 0, 1542 state->id3->length?state->id3->length:1, 0,
1536 state->id3->length?state->id3->elapsed + state->ff_rewind_count:0, 1543 state->id3->length?state->id3->elapsed + state->ff_rewind_count:0,
1537 HORIZONTAL); 1544 HORIZONTAL);
1538#ifdef AB_REPEAT_ENABLE 1545#ifdef AB_REPEAT_ENABLE
1539 if ( ab_repeat_mode_enabled() ) 1546 if ( ab_repeat_mode_enabled() )
1540 ab_draw_markers(display, state->id3->length, 0, sby, 1547 ab_draw_markers(display, state->id3->length, 0, sb_y,
1541 PROGRESS_BAR_HEIGHT); 1548 data->progress_height);
1542#endif 1549#endif
1543 update_line = true; 1550 update_line = true;
1544 } 1551 }