From 6288523cfee31a474435ce3445e67733f532d916 Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Sun, 19 Nov 2006 14:11:42 +0000 Subject: * 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 --- apps/SOURCES | 1 - apps/debug_menu.c | 10 ++++----- apps/playlist.c | 1 - apps/plugin.c | 8 +++---- apps/plugin.h | 18 ++++++++-------- apps/plugins/clock.c | 9 ++++---- apps/plugins/jpeg.c | 4 ++-- apps/plugins/lib/SOURCES | 1 + apps/plugins/splitedit.c | 3 ++- apps/plugins/video.c | 4 ++-- apps/plugins/viewer.c | 3 ++- apps/recorder/widgets.c | 54 ------------------------------------------------ apps/recorder/widgets.h | 33 ----------------------------- apps/screens.c | 3 --- apps/tree.c | 3 --- 15 files changed, 31 insertions(+), 124 deletions(-) delete mode 100644 apps/recorder/widgets.c delete mode 100644 apps/recorder/widgets.h (limited to 'apps') diff --git a/apps/SOURCES b/apps/SOURCES index 0fdb6f5955..c9587cf5bb 100644 --- a/apps/SOURCES +++ b/apps/SOURCES @@ -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 diff --git a/apps/debug_menu.c b/apps/debug_menu.c index e1bb5ccb9f..ecdbe26370 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c @@ -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++; diff --git a/apps/playlist.c b/apps/playlist.c index 134b52ea8b..23d79a6476 100644 --- a/apps/playlist.c +++ b/apps/playlist.c @@ -92,7 +92,6 @@ #include "usb.h" #ifdef HAVE_LCD_BITMAP #include "icons.h" -#include "widgets.h" #endif #include "lang.h" diff --git a/apps/plugin.c b/apps/plugin.c index a00a54e4ec..f5e6cebf65 100644 --- a/apps/plugin.c +++ b/apps/plugin.c @@ -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, diff --git a/apps/plugin.h b/apps/plugin.h index 608009d549..339afe93a8 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -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, diff --git a/apps/plugins/clock.c b/apps/plugins/clock.c index 032344263a..6a1d306339 100644 --- a/apps/plugins/clock.c +++ b/apps/plugins/clock.c @@ -89,6 +89,7 @@ Original release, featuring analog / digital modes and a few options. *****************************/ #include "plugin.h" #include "time.h" +#include "checkbox.h" #include 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) { diff --git a/apps/plugins/jpeg.c b/apps/plugins/jpeg.c index 81b5098a2a..878c94408e 100644 --- a/apps/plugins/jpeg.c +++ b/apps/plugins/jpeg.c @@ -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); } diff --git a/apps/plugins/lib/SOURCES b/apps/plugins/lib/SOURCES index d57db3bbc8..7441a98182 100644 --- a/apps/plugins/lib/SOURCES +++ b/apps/plugins/lib/SOURCES @@ -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 diff --git a/apps/plugins/splitedit.c b/apps/plugins/splitedit.c index fa5ff8e35f..3d422ecb6c 100644 --- a/apps/plugins/splitedit.c +++ b/apps/plugins/splitedit.c @@ -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); } diff --git a/apps/plugins/video.c b/apps/plugins/video.c index e82ec1a84f..5891740bfa 100644 --- a/apps/plugins/video.c +++ b/apps/plugins/video.c @@ -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); diff --git a/apps/plugins/viewer.c b/apps/plugins/viewer.c index af73257508..af795e736b 100644 --- a/apps/plugins/viewer.c +++ b/apps/plugins/viewer.c @@ -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 diff --git a/apps/recorder/widgets.c b/apps/recorder/widgets.c deleted file mode 100644 index f06ac4402f..0000000000 --- a/apps/recorder/widgets.c +++ /dev/null @@ -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 -#include -#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 diff --git a/apps/recorder/widgets.h b/apps/recorder/widgets.h deleted file mode 100644 index 0a028144e8..0000000000 --- a/apps/recorder/widgets.h +++ /dev/null @@ -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 - -#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__ */ diff --git a/apps/screens.c b/apps/screens.c index 8b69fdfee2..835cf09a13 100644 --- a/apps/screens.c +++ b/apps/screens.c @@ -65,9 +65,6 @@ #include #endif -#if defined(HAVE_LCD_BITMAP) -#include "widgets.h" -#endif #ifdef HAVE_MMC #include "ata_mmc.h" #endif diff --git a/apps/tree.c b/apps/tree.c index fea7b21529..24b5c2114c 100644 --- a/apps/tree.c +++ b/apps/tree.c @@ -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" -- cgit v1.2.3