summaryrefslogtreecommitdiff
path: root/apps/plugins/text_viewer/tv_window.c
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 /apps/plugins/text_viewer/tv_window.c
parent12fa759aadf67ca63c366edf08d9e8901b41c9bb (diff)
downloadrockbox-88bd00903af1692f05f3a71c397e0c62f760e756.tar.gz
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
Diffstat (limited to 'apps/plugins/text_viewer/tv_window.c')
-rw-r--r--apps/plugins/text_viewer/tv_window.c19
1 files changed, 8 insertions, 11 deletions
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)
278static void tv_change_preferences(const struct tv_preferences *oldp) 278static void tv_change_preferences(const struct tv_preferences *oldp)
279{ 279{
280#ifdef HAVE_LCD_BITMAP 280#ifdef HAVE_LCD_BITMAP
281 static bool is_executing = false; 281 static bool font_changing = false;
282 const unsigned char *font_str; 282 const unsigned char *font_str;
283 283
284 is_executing = true; 284 font_str = (oldp && !font_changing)? oldp->font_name : rb->global_settings->font_file;
285 font_str = oldp? oldp->font_name: rb->global_settings->font_file; 285 font_changing = true;
286 286
287 /* change font */ 287 /* change font */
288 if (rb->strcmp(font_str, prefs->font_name)) 288 if (rb->strcmp(font_str, prefs->font_name))
@@ -291,25 +291,22 @@ static void tv_change_preferences(const struct tv_preferences *oldp)
291 { 291 {
292 struct tv_preferences new_prefs = *prefs; 292 struct tv_preferences new_prefs = *prefs;
293 293
294 if (!tv_set_font(font_str) && oldp != NULL)
295 {
296 font_str = rb->global_settings->font_file;
297 tv_set_font(font_str);
298 }
299
300 rb->strlcpy(new_prefs.font_name, font_str, MAX_PATH); 294 rb->strlcpy(new_prefs.font_name, font_str, MAX_PATH);
301 tv_set_preferences(&new_prefs); 295 tv_set_preferences(&new_prefs);
302 } 296 }
303 } 297 }
298 else if (!oldp || font_changing)
299 tv_set_font(font_str);
304 300
305 /* calculates display lines */ 301 /* calculates display lines */
306 tv_check_header_and_footer(); 302 tv_check_header_and_footer();
307 display_lines = tv_calc_display_lines(); 303 display_lines = tv_calc_display_lines();
308 304
309 if (!is_executing) 305 /* if font_changing == false, the remaining processes need not be executed. */
306 if (!font_changing)
310 return; 307 return;
311 308
312 is_executing = false; 309 font_changing = false;
313#else 310#else
314 (void)oldp; 311 (void)oldp;
315 312