Changeset 1998


Ignore:
Timestamp:
07/18/12 19:05:44 (10 months ago)
Author:
tsv
Message:

Update Simple mode: help files are respect locale, shoot act as cancel, default incrementor for focus is 100

Location:
branches/tsvstar-uitest
Files:
3 added
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • branches/tsvstar-uitest/core/gui.c

    r1996 r1998  
    27042704} 
    27052705 
     2706static void copy_fname_w_new_ext( char* tgt, char* src, char* ext ) 
     2707{ 
     2708        if ( !src || !tgt ) return; 
     2709 
     2710        // copy filename 
     2711        char *str = strrchr( src, '/' ); 
     2712        if (!str ) { str = src; } else { str++;} 
     2713        strcpy( tgt, str ); 
     2714 
     2715        // replce extension 
     2716        str = strrchr( tgt, '.' ); 
     2717        if ( !str ) { str = tgt+strlen(tgt); } 
     2718        strcpy(  str, ext ); 
     2719 
     2720                 
     2721} 
     2722 
     2723 
    27062724// Called from the GUI task code to set the ALT mode state 
    27072725void gui_activate_alt_mode() 
     
    27122730 
    27132731                // "Newbie" mode mean start help file 
     2732                // Break regular ALT sequence only if module ok and help exists  
    27142733                if ( conf.chdk_gui_mode_enum == CHDK_MODE_NEWBIE &&  !state_kbd_script_run ) 
    27152734                { 
     
    27172736                        conf_save(); 
    27182737 
    2719                         // Break regular ALT sequence only if module ok and help exists 
    2720                         unsigned int argv[] ={ (unsigned int)"A/CHDK/CHDK.HLP" }; 
     2738                        // make path to help file 
     2739 
     2740                        char path_buf[60]; 
     2741                        unsigned int argv[] ={ (unsigned int)path_buf }; 
     2742                        strcpy( path_buf, "A/CHDK/HELP/"); 
     2743 
     2744                        char* helpfile_name = path_buf + strlen(path_buf); 
     2745 
     2746                        // if not success, try to load "_current_locale_.hlp" 
     2747                        if ( conf.lang_file[0] ) { 
     2748                                copy_fname_w_new_ext( helpfile_name, conf.lang_file, ".hlp"); 
     2749 
     2750                                if ( module_run("txtread.flt", 0, sizeof(argv)/sizeof(argv[0]), argv, UNLOAD_IF_ERR) == 0 ) 
     2751                                        break; 
     2752                        } 
     2753 
     2754                        // if not success, try to load "_base_language_.hlp" 
     2755                        copy_fname_w_new_ext( helpfile_name, gui_lang_source_filename, ".hlp"); 
     2756                        if ( module_run("txtread.flt", 0, sizeof(argv)/sizeof(argv[0]), argv, UNLOAD_IF_ERR) == 0 ) 
     2757                                break; 
     2758 
     2759                        //if not success, try to load "english.hlp" 
     2760                        argv[0] = (unsigned int)"A/CHDK/HELP/ENGLISH.HLP"; 
    27212761                        if ( module_run("txtread.flt", 0, sizeof(argv)/sizeof(argv[0]), argv, UNLOAD_IF_ERR) == 0 ) 
    27222762                                break; 
  • branches/tsvstar-uitest/core/gui_lang.h

    r1976 r1998  
    703703extern void gui_lang_init(); 
    704704 
     705extern char* gui_lang_source_filename; 
     706 
    705707//------------------------------------------------------------------- 
    706708#endif 
  • branches/tsvstar-uitest/core/gui_menu.c

    r1996 r1998  
    105105                int itemid = lang_strhash31( curr_menu->menu[gui_menu_curr_item].text ); 
    106106                if ( itemid == LANG_MENU_SUBJ_DIST_BRACKET_VALUE || 
    107                          itemid == LANG_MENU_ISO_BRACKET_VALUE || 
    108                          itemid == LANG_MENU_OVERRIDE_SUBJ_DIST_VALUE || 
     107                         itemid == LANG_MENU_OVERRIDE_SUBJ_DIST_VALUE ) 
     108                { 
     109                        int_incr = 100; 
     110                } 
     111                else if ( itemid == LANG_MENU_ISO_BRACKET_VALUE || 
    109112                         itemid == LANG_MENU_OVERRIDE_ISO_VALUE ) 
    110113                { 
     
    631634} 
    632635 
     636 
     637// Purpose: cancel edit mode without apply changes 
     638void gui_menu_cancel_editmode() 
     639{ 
     640        // cancel change 
     641    int *valueptr = menuitem_get_valueptr(curr_menu,gui_menu_curr_item); 
     642 
     643    if ( valueptr ) 
     644        *valueptr = item_prev_value; 
     645 
     646    gui_menu_set_editmode(0); 
     647    gui_menu_left(0);   // process bounds and callbacks 
     648 
     649        // keep quickdisable state on cancel 
     650        if ( item_prev_value < 0 ) 
     651                turn_current_item_off(); 
     652} 
     653 
    633654//------------------------------------------------------------------- 
    634655// Process button presses when in GUI_MODE_MENU mode 
     
    641662        case KEY_SHOOT_HALF: 
    642663#endif 
     664                        if ( flag_editmode ) { 
     665                                gui_menu_cancel_editmode(); 
     666                                break; 
     667                        } 
     668 
    643669            if (conf.user_menu_enable == 3) { 
    644670                if (curr_menu->title != LANG_MENU_USER_MENU) { 
     
    815841        case KEY_DISPLAY: 
    816842                if ( flag_editmode ) { 
    817  
    818                     // cancel change 
    819                     int *valueptr = menuitem_get_valueptr(curr_menu,gui_menu_curr_item); 
    820  
    821                     if ( valueptr ) 
    822                         *valueptr = item_prev_value; 
    823  
    824                     gui_menu_set_editmode(0); 
    825                     gui_menu_left(0);   // process bounds and callbacks 
    826  
    827                                         // keep quickdisable state on cancel 
    828                                         if ( item_prev_value < 0 ) 
    829                                                 turn_current_item_off(); 
    830                                            
     843                                        gui_menu_cancel_editmode();                                        
    831844                } else { 
    832845                        gui_menu_back(); 
  • branches/tsvstar-uitest/tools/makelang.c

    r1975 r1998  
    6060        lang_load_from_mem ( file2 ); 
    6161 
     62 
     63        char* lng_filename = (argc>2 && file2) ? argv[2] : argv[1]; 
     64 
    6265        int num_empty_lines=0; 
    6366        char buf[200]; 
    6467 
    65         printf("//Auto generated file. Do not edit the contents of this file.\n//Update the CHDK/LANG/*.lng files to make changes.\n//Generated from %s\n\n",(argc>2)?argv[2]:argv[1]); 
     68        printf("//Auto generated file. Do not edit the contents of this file.\n//Update the CHDK/LANG/*.lng files to make changes.\n//Generated from %s\n\n",lng_filename); 
     69 
     70        printf("char* gui_lang_source_filename=\""); 
     71        for (i=0;i<8 && lng_filename[i] && lng_filename[i]!='.'; i++) 
     72          printf("%c",lng_filename[i]); 
     73        printf("\";\n\n"); 
     74 
    6675        printf("static char* gui_lang_default = \\\n"); 
    6776         
Note: See TracChangeset for help on using the changeset viewer.