2005-11-01 23:56:03 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* 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"
|
2005-11-20 01:02:14 +00:00
|
|
|
#include "font.h"
|
2007-11-07 01:37:00 +00:00
|
|
|
#include "lang.h"
|
|
|
|
#include "talk.h"
|
2005-11-01 23:56:03 +00:00
|
|
|
|
|
|
|
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);
|
2005-11-09 01:17:57 +00:00
|
|
|
screen_clear_area(display, 0, y_start, display->width, y_end - y_start);
|
2005-11-01 23:56:03 +00:00
|
|
|
display->stop_scroll();
|
|
|
|
screen_set_ymargin(display, y_start);
|
|
|
|
#else
|
|
|
|
display->clear_display();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void gui_textarea_update(struct screen * display)
|
|
|
|
{
|
2007-04-06 22:55:00 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2005-11-01 23:56:03 +00:00
|
|
|
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);
|
2007-04-06 22:55:00 +00:00
|
|
|
#else
|
|
|
|
display->update();
|
2005-11-01 23:56:03 +00:00
|
|
|
#endif
|
2007-04-06 22:55:00 +00:00
|
|
|
}
|
2005-11-01 23:56:03 +00:00
|
|
|
|
2005-11-18 02:07:02 +00:00
|
|
|
int gui_textarea_put_message(struct screen * display,
|
2008-04-26 09:30:24 +00:00
|
|
|
const struct text_message * message,
|
2005-11-18 02:07:02 +00:00
|
|
|
int ystart)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
gui_textarea_clear(display);
|
|
|
|
for(i=0;i<message->nb_lines && i+ystart<display->nb_lines;i++)
|
2007-11-07 01:37:00 +00:00
|
|
|
display->puts_scroll(0, i+ystart, P2STR((unsigned char *)message->
|
|
|
|
message_lines[i]));
|
2005-11-18 02:07:02 +00:00
|
|
|
gui_textarea_update(display);
|
|
|
|
return(i);
|
|
|
|
}
|
|
|
|
|
2005-11-01 23:56:03 +00:00
|
|
|
void gui_textarea_update_nblines(struct screen * display)
|
|
|
|
{
|
|
|
|
int height=display->height;
|
2007-04-06 22:55:00 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2005-11-01 23:56:03 +00:00
|
|
|
if(global_settings.statusbar)
|
|
|
|
height -= STATUSBAR_HEIGHT;
|
|
|
|
#ifdef HAS_BUTTONBAR
|
|
|
|
if(global_settings.buttonbar && display->has_buttonbar)
|
|
|
|
height -= BUTTONBAR_HEIGHT;
|
|
|
|
#endif
|
2005-12-05 22:44:42 +00:00
|
|
|
display->getstringsize((unsigned char *)"A", &display->char_width,
|
|
|
|
&display->char_height);
|
2005-11-01 23:56:03 +00:00
|
|
|
#else
|
|
|
|
display->char_width = 1;
|
|
|
|
display->char_height = 1;
|
|
|
|
#endif
|
2007-04-06 22:55:00 +00:00
|
|
|
display->nb_lines = height / display->char_height;
|
2005-11-01 23:56:03 +00:00
|
|
|
}
|
2007-11-07 01:37:00 +00:00
|
|
|
|
2008-04-26 09:30:24 +00:00
|
|
|
void talk_text_message(const struct text_message * message, bool enqueue)
|
2007-11-07 01:37:00 +00:00
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|