Clip counter manual update, language tweak and translation
[maemo-rb.git] / apps / gui / textarea.c
blob0dd063c493667aba3756b274c8f7331262a93216
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2005 by Kevin Ferrare
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
20 #include "textarea.h"
21 #include "font.h"
23 void gui_textarea_clear(struct screen * display)
25 #ifdef HAVE_LCD_BITMAP
26 int y_start = gui_textarea_get_ystart(display);
27 int y_end = gui_textarea_get_yend(display);
28 screen_clear_area(display, 0, y_start, display->width, y_end - y_start);
29 display->stop_scroll();
30 screen_set_ymargin(display, y_start);
31 #else
32 display->clear_display();
33 #endif
36 void gui_textarea_update(struct screen * display)
38 #ifdef HAVE_LCD_BITMAP
39 int y_start = gui_textarea_get_ystart(display);
40 int y_end = gui_textarea_get_yend(display);
41 display->update_rect(0, y_start, display->width, y_end - y_start);
42 #else
43 display->update();
44 #endif
47 int gui_textarea_put_message(struct screen * display,
48 struct text_message * message,
49 int ystart)
51 int i;
52 gui_textarea_clear(display);
53 for(i=0;i<message->nb_lines && i+ystart<display->nb_lines;i++)
54 display->puts_scroll(0, i+ystart, (unsigned char *)message->message_lines[i]);
55 gui_textarea_update(display);
56 return(i);
59 void gui_textarea_update_nblines(struct screen * display)
61 int height=display->height;
62 #ifdef HAVE_LCD_BITMAP
63 if(global_settings.statusbar)
64 height -= STATUSBAR_HEIGHT;
65 #ifdef HAS_BUTTONBAR
66 if(global_settings.buttonbar && display->has_buttonbar)
67 height -= BUTTONBAR_HEIGHT;
68 #endif
69 display->getstringsize((unsigned char *)"A", &display->char_width,
70 &display->char_height);
71 #else
72 display->char_width = 1;
73 display->char_height = 1;
74 #endif
75 display->nb_lines = height / display->char_height;