Changeset 1337


Ignore:
Timestamp:
09/14/11 08:25:24 (3 years ago)
Author:
philmoz
Message:

Fix for text reader when opening a new file.
Change made in changeset 1310 to fix crash when selecting fonts caused problem for text reader.

Location:
trunk/core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/core/gui.c

    r1326 r1337  
    29702970    } 
    29712971    gui_fselect_init(LANG_STR_SELECT_TEXT_FILE, path, gui_draw_read_selected); 
     2972    void gui_fselect_set_key_redraw(int n); 
     2973    gui_fselect_set_key_redraw(1); 
    29722974} 
    29732975 
  • trunk/core/gui_fselect.c

    r1310 r1337  
    6969static void (*fselect_on_select)(const char *fn); 
    7070static char raw_operation; 
     71static int set_key_redraw_mode; 
    7172 
    7273//------------------------------------------------------------------- 
     
    200201 
    201202//------------------------------------------------------------------- 
     203// Set flag to control how the erase/redraw happens when the set key 
     204// is pressed. 
     205// 0 - screen erase & mode restore done after call to fselect_on_select 
     206// 1 - screen erase & mode restore done before call to fselect_on_select 
     207// Needed for text reader to work correctly and to stop intermittent 
     208// crashes when selecting fonts (hack - whole gui/kbd system needs an overhaul). 
     209void gui_fselect_set_key_redraw(int n) 
     210{ 
     211    set_key_redraw_mode = n; 
     212} 
     213 
    202214void gui_fselect_init(int title, const char* dir, void (*on_select)(const char *fn)) { 
    203215    int i; 
     
    229241    gui_fselect_redraw = 2; 
    230242    gui_set_mode(GUI_MODE_FSELECT); 
     243    gui_fselect_set_key_redraw(0); 
    231244} 
    232245 
     
    973986 
    974987//------------------------------------------------------------------- 
     988static void exit_fselect() 
     989{ 
     990    gui_fselect_free_data(); 
     991    gui_fselect_marked_free_data(); 
     992    if (set_key_redraw_mode) 
     993    { 
     994        gui_set_mode(gui_fselect_mode_old); 
     995        draw_restore(); 
     996    } 
     997    if (fselect_on_select)  
     998    { 
     999        fselect_on_select(selected_file); 
     1000    } 
     1001    if (!set_key_redraw_mode) 
     1002    { 
     1003        gui_set_mode(gui_fselect_mode_old); 
     1004        draw_restore(); 
     1005    } 
     1006} 
     1007 
    9751008void gui_fselect_kbd_process() { 
    9761009    int i; 
     
    10501083                } else  { 
    10511084                    sprintf(selected_file, "%s/%s", current_dir, selected->name); 
    1052                     gui_fselect_free_data(); 
    1053                     gui_fselect_marked_free_data(); 
    1054                     if (fselect_on_select)  
    1055                         fselect_on_select(selected_file); 
    1056                     gui_set_mode(gui_fselect_mode_old); 
    1057                     draw_restore(); 
     1085                    exit_fselect(); 
    10581086                } 
    10591087            } 
     
    10761104            break; 
    10771105        case KEY_MENU: 
    1078             gui_fselect_free_data(); 
    1079             gui_fselect_marked_free_data(); 
    1080             if (fselect_on_select)  
    1081                 fselect_on_select(NULL); 
    1082             gui_set_mode(gui_fselect_mode_old); 
    1083             draw_restore(); 
    1084             break; 
    1085     } 
    1086 } 
    1087  
    1088 //------------------------------------------------------------------- 
     1106            exit_fselect(); 
     1107            break; 
     1108    } 
     1109} 
     1110 
     1111//------------------------------------------------------------------- 
Note: See TracChangeset for help on using the changeset viewer.