* Move checkbox to plugin api (core never uses it)

* replace the last of the scrollbar() calls with gui_scrollbar_draw()


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11552 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jonathan Gordon 2006-11-19 14:11:42 +00:00
parent 687328b777
commit 6288523cfe
15 changed files with 31 additions and 124 deletions

View file

@ -56,7 +56,6 @@ recorder/bmp.c
recorder/icons.c
recorder/keyboard.c
recorder/peakmeter.c
recorder/widgets.c
#if LCD_DEPTH > 1
recorder/backdrop.c
#endif

View file

@ -67,7 +67,7 @@
#endif
#ifdef HAVE_LCD_BITMAP
#include "widgets.h"
#include "scrollbar.h"
#include "peakmeter.h"
#endif
#include "logfdisp.h"
@ -260,11 +260,11 @@ bool dbg_audio_thread(void)
lcd_puts(0, 5, buf);
/* Playable space left */
scrollbar(0, 6*8, 112, 4, d.audiobuflen, 0,
gui_scrollbar_draw(&screens[SCREEN_MAIN],0, 6*8, 112, 4, d.audiobuflen, 0,
d.playable_space, HORIZONTAL);
/* Show the watermark limit */
scrollbar(0, 6*8+4, 112, 4, d.audiobuflen, 0,
gui_scrollbar_draw(&screens[SCREEN_MAIN],0, 6*8+4, 112, 4, d.audiobuflen, 0,
d.low_watermark_level, HORIZONTAL);
snprintf(buf, sizeof(buf), "wm: %x - %x",
@ -334,14 +334,14 @@ bool dbg_audio_thread(void)
lcd_puts(0, line++, buf);
/* Playable space left */
scrollbar(0, line*8, LCD_WIDTH, 6, bufsize, 0, bufused, HORIZONTAL);
gui_scrollbar_draw(&screens[SCREEN_MAIN],0, line*8, LCD_WIDTH, 6, bufsize, 0, bufused, HORIZONTAL);
line++;
snprintf(buf, sizeof(buf), "codec: %8ld/%8ld", audio_filebufused(), (long) filebuflen);
lcd_puts(0, line++, buf);
/* Playable space left */
scrollbar(0, line*8, LCD_WIDTH, 6, filebuflen, 0,
gui_scrollbar_draw(&screens[SCREEN_MAIN],0, line*8, LCD_WIDTH, 6, filebuflen, 0,
audio_filebufused(), HORIZONTAL);
line++;

View file

@ -92,7 +92,6 @@
#include "usb.h"
#ifdef HAVE_LCD_BITMAP
#include "icons.h"
#include "widgets.h"
#endif
#include "lang.h"

View file

@ -38,6 +38,7 @@
#endif
#ifdef HAVE_LCD_BITMAP
#include "scrollbar.h"
#include "peakmeter.h"
#include "bmp.h"
#include "bidi.h"
@ -99,6 +100,7 @@ static const struct plugin_api rockbox_api = {
lcd_get_background,
lcd_bitmap_part,
lcd_bitmap,
lcd_set_backdrop,
#endif
#if LCD_DEPTH == 16
lcd_bitmap_transparent_part,
@ -114,8 +116,7 @@ static const struct plugin_api rockbox_api = {
lcd_blit,
lcd_update,
lcd_update_rect,
scrollbar,
checkbox,
gui_scrollbar_draw,
font_get,
font_getstringsize,
font_get_width,
@ -467,9 +468,6 @@ static const struct plugin_api rockbox_api = {
#endif /* HAVE_RECORDING */
#endif /* CONFIG_CODEC == SWCODEC */
#if LCD_DEPTH > 1
lcd_set_backdrop,
#endif
#ifdef IRAM_STEAL
plugin_iram_init,

View file

@ -66,7 +66,7 @@
#include "timer.h"
#include "playlist.h"
#ifdef HAVE_LCD_BITMAP
#include "widgets.h"
#include "scrollbar.h"
#endif
#include "menu.h"
#include "rbunicode.h"
@ -107,12 +107,12 @@
#define PLUGIN_MAGIC 0x526F634B /* RocK */
/* increase this every time the api struct changes */
#define PLUGIN_API_VERSION 36
#define PLUGIN_API_VERSION 37
/* update this to latest version if a change to the api struct breaks
backwards compatibility (and please take the opportunity to sort in any
new function which are "waiting" at the end of the function table) */
#define PLUGIN_MIN_API_VERSION 34
#define PLUGIN_MIN_API_VERSION 37
/* plugin return codes */
enum plugin_status {
@ -169,6 +169,7 @@ struct plugin_api {
int stride, int x, int y, int width, int height);
void (*lcd_bitmap)(const fb_data *src, int x, int y, int width,
int height);
void (*lcd_set_backdrop)(fb_data* backdrop);
#endif
#if LCD_DEPTH == 16
void (*lcd_bitmap_transparent_part)(const fb_data *src,
@ -189,9 +190,10 @@ struct plugin_api {
int bheight, int stride);
void (*lcd_update)(void);
void (*lcd_update_rect)(int x, int y, int width, int height);
void (*scrollbar)(int x, int y, int width, int height, int items,
int min_shown, int max_shown, int orientation);
void (*checkbox)(int x, int y, int width, int height, bool checked);
void (*gui_scrollbar_draw)(struct screen * screen, int x, int y,
int width, int height, int items,
int min_shown, int max_shown,
unsigned flags);
struct font* (*font_get)(int font);
int (*font_getstringsize)(const unsigned char *str, int *w, int *h,
int fontnumber);
@ -579,9 +581,7 @@ struct plugin_api {
#endif /* HAVE_RECORDING */
#endif /* CONFIG_CODEC == SWCODEC */
#if LCD_DEPTH > 1
void (*lcd_set_backdrop)(fb_data* backdrop);
#endif
#ifdef IRAM_STEAL
void (*plugin_iram_init)(char *iramstart, char *iramcopy, size_t iram_size,

View file

@ -89,6 +89,7 @@ Original release, featuring analog / digital modes and a few options.
*****************************/
#include "plugin.h"
#include "time.h"
#include "checkbox.h"
#include <pluginbitmaps/clock_logo.h>
PLUGIN_HEADER
@ -2386,7 +2387,7 @@ void draw_extras(int year, int day, int month, int hour, int minute, int second)
rb->lcd_putsxy((LCDWIDTH/2)-(w/2), 5, buf);
}
else if(settings.digital[digital_seconds] == 2) /* Second progressbar */
rb->scrollbar(0, 0, LCD_WIDTH, 4, 60, 0, second, HORIZONTAL);
rb->gui_scrollbar_draw(rb->screens[SCREEN_MAIN],0, 0, LCD_WIDTH, 4, 60, 0, second, HORIZONTAL);
else if(settings.digital[digital_seconds] == 3) /* Invert the LCD as seconds pass */
{
rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
@ -2417,7 +2418,7 @@ void draw_extras(int year, int day, int month, int hour, int minute, int second)
}
else if(settings.lcd[lcd_seconds] == 2) /* Second progressbar */
{
rb->scrollbar(0, 0, LCD_WIDTH, 4, 60, 0, second, HORIZONTAL);
rb->gui_scrollbar_draw(rb->screens[SCREEN_MAIN],0, 0, LCD_WIDTH, 4, 60, 0, second, HORIZONTAL);
}
else if(settings.lcd[lcd_seconds] == 3) /* Invert the LCD as seconds pass */
{
@ -2727,8 +2728,8 @@ void counter_settings(void)
rb->lcd_puts(0, 7, "OFF: Return");
/* tell user what mode is selected */
rb->checkbox(1, 17, 8, 6, counting_up);
rb->checkbox(1, 25, 8, 6, !counting_up);
checkbox(rb,1, 17, 8, 6, counting_up);
checkbox(rb,1, 25, 8, 6, !counting_up);
switch(cursorpos)
{

View file

@ -2386,7 +2386,7 @@ void cb_progess(int current, int total)
rb->yield(); /* be nice to the other threads */
if(!running_slideshow)
{
rb->scrollbar(0, LCD_HEIGHT-8, LCD_WIDTH, 8, total, 0,
rb->gui_scrollbar_draw(rb->screens[SCREEN_MAIN],0, LCD_HEIGHT-8, LCD_WIDTH, 8, total, 0,
current, HORIZONTAL);
rb->lcd_update_rect(0, LCD_HEIGHT-8, LCD_WIDTH, 8);
}
@ -2394,7 +2394,7 @@ void cb_progess(int current, int total)
else
{
/* in slideshow mode, keep gui interference to a minimum */
rb->scrollbar(0, LCD_HEIGHT-4, LCD_WIDTH, 4, total, 0,
rb->gui_scrollbar_draw(rb->screens[SCREEN_MAIN],0, LCD_HEIGHT-4, LCD_WIDTH, 4, total, 0,
current, HORIZONTAL);
rb->lcd_update_rect(0, LCD_HEIGHT-4, LCD_WIDTH, 4);
}

View file

@ -18,6 +18,7 @@ playergfx.c
profile_plugin.c
#endif
#ifdef HAVE_LCD_BITMAP
checkbox.c
xlcd_core.c
xlcd_draw.c
xlcd_scroll.c

View file

@ -604,7 +604,8 @@ static int copy_file(
return -1;
}
rb->scrollbar(0, prg_y, LCD_WIDTH, prg_h, bytes, 0, i, HORIZONTAL);
rb->gui_scrollbar_draw(&rb->screens[SCREEN_MAIN],0, prg_y, LCD_WIDTH,
prg_h, bytes, 0, i, HORIZONTAL);
rb->lcd_update_rect(0, prg_y, LCD_WIDTH, prg_h);
}

View file

@ -27,7 +27,6 @@
#include "plugin.h"
#include "sh7034.h"
#include "system.h"
#include "../apps/recorder/widgets.h" /* not in search path, booh */
#ifndef SIMULATOR /* not for simulator by now */
#ifdef HAVE_LCD_BITMAP /* and definitely not for the Player, haha */
@ -256,7 +255,8 @@ void DrawPosition(int pos, int total)
/* draw a slider over the rest of the line */
rb->lcd_getstringsize(gPrint, &w, &h);
w++;
rb->scrollbar(w, LCD_HEIGHT-7, LCD_WIDTH-w, 7, total, 0, pos, HORIZONTAL);
rb->gui_scrollbar_draw(&rb->screens[SCREEN_MAIN],w, LCD_HEIGHT-7, LCD_WIDTH-w,
7, total, 0, pos, HORIZONTAL);
if (gPlay.state == paused) /* we have to draw ourselves */
rb->lcd_update_rect(0, LCD_HEIGHT-8, LCD_WIDTH, 8);

View file

@ -662,7 +662,8 @@ static void viewer_scrollbar(void) {
else
max_shown = min_shown + (next_screen_ptr - screen_top_ptr);
rb->scrollbar(0, 0, SCROLLBAR_WIDTH-1, LCD_HEIGHT, items, min_shown, max_shown, VERTICAL);
rb->gui_scrollbar_draw(rb->screens[SCREEN_MAIN],0, 0, SCROLLBAR_WIDTH-1,
LCD_HEIGHT, items, min_shown, max_shown, VERTICAL);
}
#endif

View file

@ -1,54 +0,0 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2002 Markus Braun
*
* All files in this archive are subject to the GNU General Public License.
* See the file COPYING in the source tree root for full license agreement.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#include <lcd.h>
#include <limits.h>
#include "scrollbar.h"
#ifdef HAVE_LCD_BITMAP
/*
* Print a scroll bar
*/
void scrollbar(int x, int y, int width, int height, int items, int min_shown,
int max_shown, int orientation)
{
gui_scrollbar_draw(&screens[SCREEN_MAIN],x,y,width,height,
items,min_shown, max_shown, orientation);
}
/*
* Print a checkbox
*/
void checkbox(int x, int y, int width, int height, bool checked)
{
/* draw box */
lcd_drawrect(x, y, width, height);
/* clear inner area */
lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
lcd_fillrect(x + 1, y + 1, width - 2, height - 2);
lcd_set_drawmode(DRMODE_SOLID);
if (checked){
lcd_drawline(x + 2, y + 2, x + width - 2 - 1 , y + height - 2 - 1);
lcd_drawline(x + 2, y + height - 2 - 1, x + width - 2 - 1, y + 2);
}
}
#endif

View file

@ -1,33 +0,0 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2002 Markus Braun
*
* All files in this archive are subject to the GNU General Public License.
* See the file COPYING in the source tree root for full license agreement.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#ifndef __WIDGETS_H__
#define __WIDGETS_H__
#include <lcd.h>
#ifdef HAVE_LCD_BITMAP
/* Orientation for scrollbar */
enum {
VERTICAL = 0,
HORIZONTAL
};
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 */
#endif /* __WIDGETS_H__ */

View file

@ -65,9 +65,6 @@
#include <bitmaps/remote_usblogo.h>
#endif
#if defined(HAVE_LCD_BITMAP)
#include "widgets.h"
#endif
#ifdef HAVE_MMC
#include "ata_mmc.h"
#endif

View file

@ -79,9 +79,6 @@
#include "textarea.h"
#include "action.h"
#ifdef HAVE_LCD_BITMAP
#include "widgets.h"
#endif
#if LCD_DEPTH > 1
#include "backdrop.h"