summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYoshihisa Uchida <uchida@rockbox.org>2010-06-08 10:34:13 +0000
committerYoshihisa Uchida <uchida@rockbox.org>2010-06-08 10:34:13 +0000
commit88bd00903af1692f05f3a71c397e0c62f760e756 (patch)
tree68e1ae0dab9bb9b348b00c1fa33b30c1d14965f4
parent12fa759aadf67ca63c366edf08d9e8901b41c9bb (diff)
downloadrockbox-88bd00903af1692f05f3a71c397e0c62f760e756.tar.gz
rockbox-88bd00903af1692f05f3a71c397e0c62f760e756.tar.bz2
rockbox-88bd00903af1692f05f3a71c397e0c62f760e756.zip
text viewer: 1) fix uisim abends when fonts list is displayed.
2) simplify the logic to change font. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26685 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugins/text_viewer/tv_menu.c4
-rw-r--r--apps/plugins/text_viewer/tv_window.c19
2 files changed, 11 insertions, 12 deletions
diff --git a/apps/plugins/text_viewer/tv_menu.c b/apps/plugins/text_viewer/tv_menu.c
index d9b5343490..eb92782385 100644
--- a/apps/plugins/text_viewer/tv_menu.c
+++ b/apps/plugins/text_viewer/tv_menu.c
@@ -254,6 +254,7 @@ static bool tv_font_setting(void)
int new_font = 0;
int old_font;
bool res;
+ unsigned char font_path[MAX_PATH];
struct tree_context *tree;
struct tree_context backup;
@@ -266,7 +267,8 @@ static bool tv_font_setting(void)
rb->strlcat(backup.currdir, "/", MAX_PATH);
rb->strlcat(backup.currdir, dc[tree->selected_item].name, MAX_PATH);
tree->dirfilter = &dirfilter;
- rb->set_current_file(FONT_DIR"/");
+ rb->snprintf(font_path, MAX_PATH, "%s/", FONT_DIR);
+ rb->set_current_file(font_path);
count = tree->filesindir;
struct opt_items names[count];
diff --git a/apps/plugins/text_viewer/tv_window.c b/apps/plugins/text_viewer/tv_window.c
index 676aff40ab..36fbb9268c 100644
--- a/apps/plugins/text_viewer/tv_window.c
+++ b/apps/plugins/text_viewer/tv_window.c
@@ -278,11 +278,11 @@ bool tv_traverse_lines(void)
static void tv_change_preferences(const struct tv_preferences *oldp)
{
#ifdef HAVE_LCD_BITMAP
- static bool is_executing = false;
+ static bool font_changing = false;
const unsigned char *font_str;
- is_executing = true;
- font_str = oldp? oldp->font_name: rb->global_settings->font_file;
+ font_str = (oldp && !font_changing)? oldp->font_name : rb->global_settings->font_file;
+ font_changing = true;
/* change font */
if (rb->strcmp(font_str, prefs->font_name))
@@ -291,25 +291,22 @@ static void tv_change_preferences(const struct tv_preferences *oldp)
{
struct tv_preferences new_prefs = *prefs;
- if (!tv_set_font(font_str) && oldp != NULL)
- {
- font_str = rb->global_settings->font_file;
- tv_set_font(font_str);
- }
-
rb->strlcpy(new_prefs.font_name, font_str, MAX_PATH);
tv_set_preferences(&new_prefs);
}
}
+ else if (!oldp || font_changing)
+ tv_set_font(font_str);
/* calculates display lines */
tv_check_header_and_footer();
display_lines = tv_calc_display_lines();
- if (!is_executing)
+ /* if font_changing == false, the remaining processes need not be executed. */
+ if (!font_changing)
return;
- is_executing = false;
+ font_changing = false;
#else
(void)oldp;