Removed progressbar() and slidebar()
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4854 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
e7bb8c0428
commit
2441061764
7 changed files with 24 additions and 121 deletions
|
@ -151,7 +151,6 @@ bool dbg_mpeg_thread(void)
|
|||
{
|
||||
char buf[32];
|
||||
int button;
|
||||
int percent;
|
||||
struct mpeg_debug d;
|
||||
|
||||
lcd_setmargins(0, 0);
|
||||
|
@ -182,11 +181,13 @@ bool dbg_mpeg_thread(void)
|
|||
snprintf(buf, sizeof(buf), "unswapped: %x", d.unswapped_space);
|
||||
lcd_puts(0, 5, buf);
|
||||
|
||||
percent = d.playable_space * 100 / d.mp3buflen;
|
||||
progressbar(0, 6*8, 112, 4, percent, Grow_Right);
|
||||
/* Playable space left */
|
||||
scrollbar(0, 6*8, 112, 4, d.mp3buflen, 0,
|
||||
d.playable_space, HORIZONTAL);
|
||||
|
||||
percent = d.low_watermark_level * 100 / d.mp3buflen;
|
||||
progressbar(0, 6*8+4, 112, 4, percent, Grow_Right);
|
||||
/* Show the watermark limit */
|
||||
scrollbar(0, 6*8+4, 112, 4, d.mp3buflen, 0,
|
||||
d.low_watermark_level, HORIZONTAL);
|
||||
|
||||
snprintf(buf, sizeof(buf), "wm: %x - %x",
|
||||
d.low_watermark_level, d.lowest_watermark_level);
|
||||
|
|
|
@ -107,8 +107,6 @@ static struct plugin_api rockbox_api = {
|
|||
lcd_getstringsize,
|
||||
lcd_update,
|
||||
lcd_update_rect,
|
||||
progressbar,
|
||||
slidebar,
|
||||
scrollbar,
|
||||
#ifndef SIMULATOR
|
||||
lcd_roll,
|
||||
|
|
|
@ -45,6 +45,9 @@
|
|||
#include "settings.h"
|
||||
#include "thread.h"
|
||||
#include "playlist.h"
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
#include "widgets.h"
|
||||
#endif
|
||||
|
||||
#ifdef PLUGIN
|
||||
#if defined(DEBUG) || defined(SIMULATOR)
|
||||
|
@ -132,10 +135,6 @@ struct plugin_api {
|
|||
int (*lcd_getstringsize)(unsigned char *str, int *w, int *h);
|
||||
void (*lcd_update)(void);
|
||||
void (*lcd_update_rect)(int x, int y, int width, int height);
|
||||
void (*progressbar)(int x, int y, int width, int height,
|
||||
int percent, int direction);
|
||||
void (*slidebar)(int x, int y, int width, int height,
|
||||
int percent, int direction);
|
||||
void (*scrollbar)(int x, int y, int width, int height, int items,
|
||||
int min_shown, int max_shown, int orientation);
|
||||
#ifndef SIMULATOR
|
||||
|
|
|
@ -1607,8 +1607,8 @@ int wait_for_button(void)
|
|||
void cb_progess(int current, int total)
|
||||
{
|
||||
rb->yield(); /* be nice to the other threads */
|
||||
rb->progressbar(0, LCD_HEIGHT-8, LCD_WIDTH, 8,
|
||||
current*100/total, 0 /*Grow_Right*/);
|
||||
rb->scrollbar(0, LCD_HEIGHT-8, LCD_WIDTH, 8, 0, total,
|
||||
current, HORIZONTAL);
|
||||
rb->lcd_update_rect(0, LCD_HEIGHT-8, LCD_WIDTH, 8);
|
||||
}
|
||||
|
||||
|
|
|
@ -225,7 +225,6 @@ void DrawPosition(int pos, int total)
|
|||
{
|
||||
int w,h;
|
||||
int sec; // estimated seconds
|
||||
int percent;
|
||||
|
||||
|
||||
/* print the estimated position */
|
||||
|
@ -239,8 +238,7 @@ void DrawPosition(int pos, int total)
|
|||
/* draw a slider over the rest of the line */
|
||||
rb->lcd_getstringsize(gPrint, &w, &h);
|
||||
w++;
|
||||
percent = pos/(total/100);
|
||||
rb->slidebar(w, LCD_HEIGHT-7, LCD_WIDTH-w, 7, percent, Grow_Right);
|
||||
rb->scrollbar(w, LCD_HEIGHT-7, LCD_WIDTH-w, 7, 0, total, pos, HORIZONTAL);
|
||||
|
||||
if (gPlay.state == paused) // we have to draw ourselves
|
||||
rb->lcd_update_rect(0, LCD_HEIGHT-8, LCD_WIDTH, 8);
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#ifdef HAVE_LCD_BITMAP
|
||||
|
||||
/* Valid dimensions return true, invalid false */
|
||||
bool valid_dimensions(int x, int y, int width, int height)
|
||||
static bool valid_dimensions(int x, int y, int width, int height)
|
||||
{
|
||||
if((x < 0) || (x + width > LCD_WIDTH) ||
|
||||
(y < 0) || (y + height > LCD_HEIGHT))
|
||||
|
@ -34,107 +34,6 @@ bool valid_dimensions(int x, int y, int width, int height)
|
|||
return true;
|
||||
}
|
||||
|
||||
void init_bar(int x, int y, int width, int height)
|
||||
{
|
||||
/* draw box */
|
||||
lcd_drawrect(x, y, width, height);
|
||||
|
||||
/* clear edge pixels */
|
||||
lcd_clearpixel(x, y);
|
||||
lcd_clearpixel((x + width - 1), y);
|
||||
lcd_clearpixel(x, (y + height - 1));
|
||||
lcd_clearpixel((x + width - 1), (y + height - 1));
|
||||
|
||||
/* clear pixels in progress bar */
|
||||
lcd_clearrect(x + 1, y + 1, width - 2, height - 2);
|
||||
}
|
||||
|
||||
/*
|
||||
* Print a progress bar
|
||||
*/
|
||||
void progressbar(int x, int y, int width, int height, int percent,
|
||||
int direction)
|
||||
{
|
||||
int pos;
|
||||
|
||||
/* check position and dimensions */
|
||||
if (!valid_dimensions(x, y, width, height))
|
||||
return;
|
||||
|
||||
init_bar(x, y, width, height);
|
||||
|
||||
/* draw bar */
|
||||
pos = percent;
|
||||
if(pos < 0)
|
||||
pos = 0;
|
||||
if(pos > 100)
|
||||
pos = 100;
|
||||
|
||||
switch (direction)
|
||||
{
|
||||
case Grow_Right:
|
||||
pos=(width - 2) * pos / 100;
|
||||
lcd_fillrect(x + 1, y + 1, pos, height - 2);
|
||||
break;
|
||||
case Grow_Left:
|
||||
pos=(width - 2) * (100 - pos) / 100;
|
||||
lcd_fillrect(x + pos, y + 1, width - 1 - pos, height - 2);
|
||||
break;
|
||||
case Grow_Down:
|
||||
pos=(height - 2) * pos / 100;
|
||||
lcd_fillrect(x + 1, y + 1, width - 2, pos);
|
||||
break;
|
||||
case Grow_Up:
|
||||
pos=(height - 2) * (100 - pos) / 100;
|
||||
lcd_fillrect(x + 1, y + pos, width - 2, height - 1 - pos);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Print a slidebar bar
|
||||
*/
|
||||
void slidebar(int x, int y, int width, int height, int percent, int direction)
|
||||
{
|
||||
int pos;
|
||||
|
||||
/* check position and dimensions */
|
||||
if (!valid_dimensions(x, y, width, height))
|
||||
return;
|
||||
|
||||
init_bar(x, y, width, height);
|
||||
|
||||
/* draw knob */
|
||||
pos = percent;
|
||||
if(pos < 0)
|
||||
pos = 0;
|
||||
if(pos > 100)
|
||||
pos = 100;
|
||||
|
||||
switch (direction)
|
||||
{
|
||||
case Grow_Right:
|
||||
pos = (width - height) * pos / 100;
|
||||
break;
|
||||
case Grow_Left:
|
||||
pos=(width - height) * (100 - pos) / 100;
|
||||
break;
|
||||
case Grow_Down:
|
||||
pos=(height - width) * pos / 100;
|
||||
break;
|
||||
case Grow_Up:
|
||||
pos=(height - width) * (100 - pos) / 100;
|
||||
break;
|
||||
}
|
||||
|
||||
if(direction == Grow_Left || direction == Grow_Right)
|
||||
lcd_fillrect(x + pos + 1, y + 1, height - 2, height - 2);
|
||||
else
|
||||
lcd_fillrect(x + 1, y + pos + 1, width - 2, width - 2);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Print a scroll bar
|
||||
*/
|
||||
|
@ -150,7 +49,17 @@ void scrollbar(int x, int y, int width, int height, int items, int min_shown,
|
|||
if (!valid_dimensions(x, y, width, height))
|
||||
return;
|
||||
|
||||
init_bar(x, y, width, height);
|
||||
/* draw box */
|
||||
lcd_drawrect(x, y, width, height);
|
||||
|
||||
/* clear edge pixels */
|
||||
lcd_clearpixel(x, y);
|
||||
lcd_clearpixel((x + width - 1), y);
|
||||
lcd_clearpixel(x, (y + height - 1));
|
||||
lcd_clearpixel((x + width - 1), (y + height - 1));
|
||||
|
||||
/* clear pixels in progress bar */
|
||||
lcd_clearrect(x + 1, y + 1, width - 2, height - 2);
|
||||
|
||||
/* min should be min */
|
||||
if(min_shown < max_shown) {
|
||||
|
|
|
@ -35,8 +35,6 @@ enum {
|
|||
HORIZONTAL
|
||||
};
|
||||
|
||||
extern void progressbar(int x, int y, int width, int height, int percent, int direction);
|
||||
extern void slidebar(int x, int y, int width, int height, int percent, int direction);
|
||||
extern void scrollbar(int x, int y, int width, int height, int items, int min_shown, int max_shown, int orientation);
|
||||
extern void checkbox(int x, int y, int width, int height, bool checked);
|
||||
#endif /* HAVE_LCD_BITMAP */
|
||||
|
|
Loading…
Reference in a new issue