diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2008-05-29 11:13:46 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2008-05-29 11:13:46 +0000 |
commit | 0501fb016c4d88d3430a34ecc55a003e062b5f63 (patch) | |
tree | 272d3d3c33190c499d2ee4507f23cf532c85e46e /apps/gui | |
parent | 43f0770943a3315561dbdcdb2bbb85b7026248b1 (diff) |
total removal of gui_textarea. The only thing using the text_message struct is the yesno screen so move its definition to yesno.h
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17653 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui')
-rw-r--r-- | apps/gui/textarea.c | 81 | ||||
-rw-r--r-- | apps/gui/textarea.h | 84 | ||||
-rw-r--r-- | apps/gui/yesno.c | 22 | ||||
-rw-r--r-- | apps/gui/yesno.h | 7 |
4 files changed, 26 insertions, 168 deletions
diff --git a/apps/gui/textarea.c b/apps/gui/textarea.c deleted file mode 100644 index 21028da375..0000000000 --- a/apps/gui/textarea.c +++ /dev/null @@ -1,81 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2005 by Kevin Ferrare - * - * 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 "textarea.h" -#include "font.h" -#include "lang.h" -#include "talk.h" - -void gui_textarea_clear(struct screen * display) -{ -#ifdef HAVE_LCD_BITMAP - int y_start = gui_textarea_get_ystart(display); - int y_end = gui_textarea_get_yend(display); - screen_clear_area(display, 0, y_start, display->width, y_end - y_start); - display->stop_scroll(); - screen_set_ymargin(display, y_start); -#else - display->clear_display(); -#endif -} - -void gui_textarea_update(struct screen * display) -{ -#ifdef HAVE_LCD_BITMAP - int y_start = gui_textarea_get_ystart(display); - int y_end = gui_textarea_get_yend(display); - display->update_rect(0, y_start, display->width, y_end - y_start); -#else - display->update(); -#endif -} - -void gui_textarea_update_nblines(struct screen * display) -{ - int height=display->height; -#ifdef HAVE_LCD_BITMAP - if(global_settings.statusbar) - height -= STATUSBAR_HEIGHT; -#ifdef HAS_BUTTONBAR - if(global_settings.buttonbar && display->has_buttonbar) - height -= BUTTONBAR_HEIGHT; -#endif - display->getstringsize((unsigned char *)"A", &display->char_width, - &display->char_height); -#else - display->char_width = 1; - display->char_height = 1; -#endif - display->nb_lines = height / display->char_height; -} - -void talk_text_message(const struct text_message * message, bool enqueue) -{ - int line; - if(message) - for(line=0; line<message->nb_lines; line++) - { - long id = P2ID((unsigned char *)message->message_lines[line]); - if(id>=0) - { - talk_id(id, enqueue); - enqueue = true; - } - } -} diff --git a/apps/gui/textarea.h b/apps/gui/textarea.h deleted file mode 100644 index 5e770eac38..0000000000 --- a/apps/gui/textarea.h +++ /dev/null @@ -1,84 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2005 by Kevin Ferrare - * - * 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 _GUI_TEXTAREA_H_ -#define _GUI_TEXTAREA_H_ -#include "screen_access.h" -#include "settings.h" -#include "statusbar.h" - -struct text_message -{ - const char **message_lines; - int nb_lines; -}; - -/* - * Clears the area in the screen in which text can be displayed - * and sets the y margin properly - * - display : the screen structure - */ -extern void gui_textarea_clear(struct screen * display); - -/* - * Updates the area in the screen in which text can be displayed - * - display : the screen structure - */ -extern void gui_textarea_update(struct screen * display); - -/* - * Compute the number of text lines the display can draw with the current font - * Also updates the char height and width - * - display : the screen structure - */ -extern void gui_textarea_update_nblines(struct screen * display); - -/* - * Speak a text_message. The message's lines may be virtual pointers - * representing language / voicefont IDs (see settings.h). - */ -extern void talk_text_message(const struct text_message * message, bool enqueue); - -#ifdef HAVE_LCD_BITMAP -/* - * Compute the number of pixels from which text can be displayed - * - display : the screen structure - * Returns the number of pixels - */ -#define gui_textarea_get_ystart(display) \ - ( (global_settings.statusbar)? STATUSBAR_HEIGHT : 0) - -/* - * Compute the number of pixels below which text can't be displayed - * - display : the screen structure - * Returns the number of pixels - */ -#ifdef HAS_BUTTONBAR -#define gui_textarea_get_yend(display) \ - ( (display)->height - ( (global_settings.buttonbar && \ - (display)->has_buttonbar)? \ - BUTTONBAR_HEIGHT : 0) ) -#else -#define gui_textarea_get_yend(display) \ - ( (display)->height ) -#endif /* HAS_BUTTONBAR */ - -#endif /* HAVE_LCD_BITMAP */ - -#endif /* _GUI_TEXTAREA_H_ */ diff --git a/apps/gui/yesno.c b/apps/gui/yesno.c index 9232015211..91358d8feb 100644 --- a/apps/gui/yesno.c +++ b/apps/gui/yesno.c @@ -16,7 +16,7 @@ * KIND, either express or implied. * ****************************************************************************/ - +#include "config.h" #include "yesno.h" #include "system.h" #include "kernel.h" @@ -24,7 +24,7 @@ #include "lang.h" #include "action.h" #include "talk.h" -#include "textarea.h" +#include "settings.h" #include "viewport.h" @@ -36,6 +36,24 @@ struct gui_yesno struct viewport *vp; struct screen * display; }; + +static void talk_text_message(const struct text_message * message, bool enqueue) +{ + int line; + if(message) + { + for(line=0; line<message->nb_lines; line++) + { + long id = P2ID((unsigned char *)message->message_lines[line]); + if(id>=0) + { + talk_id(id, enqueue); + enqueue = true; + } + } + } +} + static int put_message(struct screen *display, const struct text_message * message, int start, int max_y) diff --git a/apps/gui/yesno.h b/apps/gui/yesno.h index 9af64a7aad..fbccb5d8cc 100644 --- a/apps/gui/yesno.h +++ b/apps/gui/yesno.h @@ -21,7 +21,6 @@ #define _GUI_YESNO_H_ #include "screen_access.h" -#include "textarea.h" enum yesno_res { @@ -30,6 +29,12 @@ enum yesno_res YESNO_USB }; +struct text_message +{ + const char **message_lines; + int nb_lines; +}; + /* * Runs the yesno asker : * it will display the 'main_message' question, and wait for user keypress |