Changeset 2017


Ignore:
Timestamp:
07/28/12 04:53:34 (10 months ago)
Author:
philmoz
Message:

Patch from tobimarg to allow opening .txt files in the text reader from the file browser.
http://chdk.setepontos.com/index.php?topic=650.msg88442#msg88442

Location:
trunk/core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/core/gui.c

    r2015 r2017  
    19641964    gui_mode = mode; 
    19651965 
     1966    gui_osd_need_restore = 0; 
     1967 
    19661968    // Flag for screen erase/redraw unless mode is marked not to (e.g. menu box popup) 
    19671969    if (((gui_mode->flags & (GUI_MODE_FLAG_NODRAWRESTORE|GUI_MODE_FLAG_NORESTORE_ON_SWITCH)) == 0) && 
  • trunk/core/gui_fselect.c

    r2015 r2017  
    1818 
    1919/* 
    20         HISTORY:        1.1 - added tbox usage [CHDK 1.1.1 required] 
     20    HISTORY:    1.1 - added tbox usage [CHDK 1.1.1 required] 
    2121*/ 
    2222 
     
    2525void gui_fselect_draw(int enforce_redraw); 
    2626 
    27 gui_handler GUI_MODE_FSELECT_MODULE =  
     27gui_handler GUI_MODE_FSELECT_MODULE = 
    2828    /*GUI_MODE_FSELECT*/    { GUI_MODE_FSELECT, gui_fselect_draw, gui_fselect_kbd_process, gui_fselect_kbd_process_menu_btn, 0, GUI_MODE_MAGICNUM }; 
    2929 
     
    9191static coord head_x, head_y, head_w, head_h; //header window coord 
    9292static coord body_x, body_y, body_w, body_h; //main body window coord 
    93 static coord foot_x, foot_y, foot_w, foot_h; //footer window coord  
     93static coord foot_x, foot_y, foot_w, foot_h; //footer window coord 
    9494 
    9595static int gui_fselect_redraw;  // flag request fselect redraw: 0-no, 1-only filelist, 2-whole_redraw(incl.border) 
     
    9898 
    9999static void (*fselect_on_select)(const char *fn); 
    100 static char raw_operation;      // info for process_raw_files() RAW_OPERATION_AVERAGE, RAW_OPERATION_SUM,  
     100static char raw_operation;      // info for process_raw_files() RAW_OPERATION_AVERAGE, RAW_OPERATION_SUM, 
    101101static int set_key_redraw_mode; // dirty hack: screen erase & mode restore done after(0) or before(1) call to fselect_on_select 
    102102 
     
    111111#define MPOPUP_CHDK_REPLACE     0x1000 
    112112 
    113 #define MPOPUP_RAWOPS                   0x0020 
    114 #define MPOPUP_MORE                             0x0040 
     113#define MPOPUP_RAWOPS           0x0020 
     114#define MPOPUP_MORE             0x0040 
    115115 
    116116 
     
    124124        { MPOPUP_EDITOR,        (int)"Edit" }, 
    125125        { MPOPUP_CHDK_REPLACE,  (int)"Set this CHDK" }, 
    126         { MPOPUP_RAWOPS,                (int)"Raw ops ->" }, 
    127         { MPOPUP_MORE,                  LANG_POPUP_MORE }, 
    128         { 0,                                    0 }, 
     126        { MPOPUP_RAWOPS,        (int)"Raw ops ->" }, 
     127        { MPOPUP_MORE,          LANG_POPUP_MORE }, 
     128        { 0,                    0 }, 
    129129}; 
    130130 
    131 #define MPOPUP_RAW_ADD                  0x0020 
    132 #define MPOPUP_RAW_AVERAGE              0x0040 
     131#define MPOPUP_RAW_ADD          0x0020 
     132#define MPOPUP_RAW_AVERAGE      0x0040 
    133133#define MPOPUP_SUBTRACT         0x0100 
    134134#define MPOPUP_RAW_DEVELOP      0x0200 
     
    141141        { MPOPUP_SUBTRACT,      LANG_POPUP_SUB_FROM_MARKED  }, 
    142142        { MPOPUP_DNG_TO_CRW,    (int)"DNG -> CHDK RAW"}, 
    143         { 0,                                    0 }, 
     143        { 0,                    0 }, 
    144144}; 
    145145 
     
    150150static struct mpopup_item popup_more[]= { 
    151151        { MPOPUP_MKDIR,         LANG_POPUP_MKDIR }, 
    152         { MPOPUP_RMDIR,                 LANG_POPUP_RMDIR }, 
    153         { MPOPUP_RENAME,                LANG_POPUP_RENAME }, 
    154         { 0,                                    0 }, 
     152        { MPOPUP_RMDIR,         LANG_POPUP_RMDIR }, 
     153        { MPOPUP_RENAME,        LANG_POPUP_RENAME }, 
     154        { 0,                    0 }, 
    155155}; 
    156156 
     
    160160 
    161161    for (j=0; j<step; ++j) { 
    162         if (selected->prev==top && top->prev)  
     162        if (selected->prev==top && top->prev) 
    163163            top=top->prev; 
    164         if (selected->prev)  
     164        if (selected->prev) 
    165165            selected=selected->prev; 
    166166        else 
     
    182182        if (i==BODY_LINES-1 && ptr && ptr->prev==selected && ptr->next) 
    183183            top=top->next; 
    184         if (selected->next)  
     184        if (selected->next) 
    185185            selected=selected->next; 
    186186        else 
     
    277277                    ptr = &((*ptr)->next); 
    278278                    ++count; 
    279                 }    
     279                } 
    280280            } 
    281281            de = safe_readdir(d); 
     
    284284    } 
    285285    *ptr=NULL; 
    286      
     286 
    287287    if (count) { 
    288288        // sort 
     
    295295                prev=prev->next; 
    296296            } 
    297              
     297 
    298298            qsort(ptr, count, sizeof(struct fitem*), fselect_sort_nothumb); 
    299              
     299 
    300300            for (i=0; i<count-1; ++i) { 
    301301                ptr[i]->n=i; 
     
    340340        struct STD_stat st; 
    341341        // check if input 'dir' exists 
    342         if (safe_stat(current_dir,&st) == 0)      
     342        if (safe_stat(current_dir,&st) == 0) 
    343343        { 
    344344            // exists - check if it is a directory or file 
     
    370370 
    371371//------------------------------------------------------------------- 
    372 void gui_fselect_init(int title, const char* prev_dir, const char* default_dir, void (*on_select)(const char *fn))  
     372void gui_fselect_init(int title, const char* prev_dir, const char* default_dir, void (*on_select)(const char *fn)) 
    373373{ 
    374374    int i; 
    375      
     375 
    376376    int chars_width = NAME_FONT_SIZE + SIZE_FONT_SIZE + TIME_FONT_SIZE; 
    377377    main_w = SPACING/*N*/+SPACING+TAB_DIVIDER+SPACING/*S*/+SPACING+TAB_DIVIDER+SPACING/*T*/+SPACING+SCROLLBAR+chars_width; 
     
    379379    main_x = (camera_screen.width - main_w) >> 1; 
    380380    main_y = (camera_screen.height - main_h) >> 1; 
    381      
     381 
    382382    head_x = body_x = foot_x = main_x; 
    383     head_w = body_w = foot_w = main_w;     
     383    head_w = body_w = foot_w = main_w; 
    384384    head_y = main_y; 
    385     head_h = HEAD_FONT_LINES;     
     385    head_h = HEAD_FONT_LINES; 
    386386    body_y = head_y + head_h + TAB_DIVIDER; 
    387387    body_h = BODY_FONT_LINES; 
    388388    foot_y = body_y + body_h + TAB_DIVIDER; 
    389389    foot_h = FOOT_FONT_LINES; 
    390      
     390 
    391391    fselect_title = lang_str(title); 
    392392 
    393393    // Try and set start directory, and optionally selected file, from inputs 
    394     if (!gui_fselect_find_start_dir(prev_dir))  
     394    if (!gui_fselect_find_start_dir(prev_dir)) 
    395395        if (!gui_fselect_find_start_dir(default_dir)) 
    396396            gui_fselect_find_start_dir("A"); 
     
    431431    title_font_size = strlen(fselect_title) * FONT_WIDTH; 
    432432    draw_string(head_x+((head_w-title_font_size)>>1), head_y, fselect_title, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE)); //title text 
    433      
     433 
    434434    draw_rect_thick(main_x-BORDER, main_y-BORDER, main_x+main_w+BORDER-1, main_y+main_h+BORDER-1, COLOR_WHITE, BORDER); //border frame 
    435435    draw_line(body_x, body_y-1, body_x+body_w-1, body_y-1, MAKE_COLOR(COLOR_WHITE, COLOR_WHITE)); //border head-body 
    436     draw_line(foot_x, foot_y-1, foot_x+foot_w-1, foot_y-1, MAKE_COLOR(COLOR_WHITE, COLOR_WHITE)); //border body-foot     
     436    draw_line(foot_x, foot_y-1, foot_x+foot_w-1, foot_y-1, MAKE_COLOR(COLOR_WHITE, COLOR_WHITE)); //border body-foot 
    437437} 
    438438 
     
    453453    } 
    454454 
    455         if ( enforce_redraw ) 
    456                 gui_fselect_redraw = 2; 
     455    if ( enforce_redraw ) 
     456        gui_fselect_redraw = 2; 
    457457 
    458458    if (gui_fselect_redraw) { 
     
    468468        sum_size = 0; 
    469469        for (i=0, ptr=top; i<BODY_LINES && ptr; ++i, ptr=ptr->next) { 
    470          
     470 
    471471            cl_marked = MAKE_COLOR((ptr==selected)?COLOR_RED:COLOR_GREY, (ptr->marked)?cl_markered:COLOR_WHITE); 
    472472            cl_selected = (ptr==selected)?MAKE_COLOR(COLOR_RED, COLOR_RED):MAKE_COLOR(COLOR_GREY, COLOR_GREY); 
    473          
     473 
    474474            // print name 
    475             for (j=0; j<NAME_SIZE && ptr->name[j]; ++j)  
     475            for (j=0; j<NAME_SIZE && ptr->name[j]; ++j) 
    476476                buf[j] = ptr->name[j]; 
    477                  
     477 
    478478            if (j==NAME_SIZE && ptr->name[j]) buf[NAME_SIZE-1] = '~'; // too long name 
    479              
     479 
    480480            if (ptr->attr & DOS_ATTR_DIRECTORY && ptr->attr != 0xFF) { //? 
    481481                if (j<NAME_SIZE) { 
     
    488488            for (; j<NAME_SIZE && (buf[j++]=' ');); //fill upto NAME_SIZE 
    489489            buf[NAME_SIZE] = 0; // eos 
    490              
     490 
    491491            off_body_y = body_y+(i*FONT_HEIGHT); 
    492492            draw_filled_rect(body_x, off_body_y, off_name_x-1, off_body_y+FONT_HEIGHT-1, cl_selected); 
    493493            draw_string(off_name_x, off_body_y, buf, cl_marked); 
    494494            draw_filled_rect(off_name_x+NAME_FONT_SIZE, off_body_y, off_name_x+NAME_FONT_SIZE+SPACING-1, off_body_y+FONT_HEIGHT-1, cl_selected); 
    495              
     495 
    496496            // print size or <Dir> 
    497497            if (ptr->attr & DOS_ATTR_DIRECTORY) { 
     
    512512                else 
    513513                    sprintf(buf, "%3ld.%ld G", ptr->size/(1024*1024*1024), (ptr->size%(1024*1024*1024)*10)/(1024*1024*1024)); // "999.9 G" 
    514                      
     514 
    515515                if (ptr->marked) 
    516516                  sum_size += ptr->size; 
     
    519519            //tab divider 
    520520            draw_line(off_size_x-TAB_DIVIDER-SPACING, off_body_y, off_size_x-TAB_DIVIDER-SPACING, off_body_y+FONT_HEIGHT-1, COLOR_WHITE); 
    521             draw_filled_rect(off_size_x-SPACING, off_body_y, off_size_x-1, off_body_y+FONT_HEIGHT-1, cl_selected);             
     521            draw_filled_rect(off_size_x-SPACING, off_body_y, off_size_x-1, off_body_y+FONT_HEIGHT-1, cl_selected); 
    522522            draw_string(off_size_x, off_body_y, buf, cl_marked); 
    523             draw_filled_rect(off_size_x+SIZE_FONT_SIZE, off_body_y, off_size_x+SIZE_FONT_SIZE+SPACING-1, off_body_y+FONT_HEIGHT-1, cl_selected);             
    524              
     523            draw_filled_rect(off_size_x+SIZE_FONT_SIZE, off_body_y, off_size_x+SIZE_FONT_SIZE+SPACING-1, off_body_y+FONT_HEIGHT-1, cl_selected); 
     524 
    525525            // print modification time 
    526526            if (ptr->mtime) { 
     
    534534            draw_line(off_time_x-TAB_DIVIDER-SPACING, off_body_y, off_time_x-TAB_DIVIDER-SPACING, off_body_y+FONT_HEIGHT-1, COLOR_WHITE); 
    535535            draw_filled_rect(off_time_x-SPACING, off_body_y, off_time_x-1, off_body_y+FONT_HEIGHT-1, cl_selected); 
    536             draw_string(off_time_x, off_body_y, buf, cl_marked);             
     536            draw_string(off_time_x, off_body_y, buf, cl_marked); 
    537537            draw_filled_rect(off_time_x+TIME_FONT_SIZE, off_body_y, off_time_x+TIME_FONT_SIZE+SPACING-1, off_body_y+FONT_HEIGHT-1, cl_selected); 
    538538        } 
     
    543543            draw_filled_rect(body_x, off_body_y, body_x+body_w-1, body_y+body_h-1, MAKE_COLOR(COLOR_GREY, COLOR_GREY)); 
    544544        } 
    545          
     545 
    546546       // scrollbar 
    547547        draw_filled_rect(off_body_x, body_y, off_body_x+SCROLLBAR-1, body_y+body_h-1, MAKE_COLOR(COLOR_BLACK, COLOR_BLACK)); 
     
    559559          strncpy(buf, current_dir+i-max_dir_len, max_dir_len); 
    560560          buf[0] = '.'; 
    561           buf[1] = '.';           
     561          buf[1] = '.'; 
    562562        } else { 
    563           strcpy(buf, current_dir);           
     563          strcpy(buf, current_dir); 
    564564        } 
    565565        buf[max_dir_len] = 0; 
    566         draw_filled_rect(foot_x, foot_y, foot_x+foot_w-1, foot_y+foot_h-1, MAKE_COLOR(COLOR_GREY, COLOR_GREY)); //footer box         
     566        draw_filled_rect(foot_x, foot_y, foot_x+foot_w-1, foot_y+foot_h-1, MAKE_COLOR(COLOR_GREY, COLOR_GREY)); //footer box 
    567567        draw_string(off_name_x, foot_y, buf, MAKE_COLOR(COLOR_GREY, COLOR_WHITE)); //current dir 
    568          
     568 
    569569        if (sum_size) { 
    570570          sprintf(buf, "%d b", sum_size); //selected size 
     
    626626                                                started(); 
    627627                                                found=1;//A JPG file with the same Canon number was found 
    628                                         }                                  
     628                                        } 
    629629                                    } 
    630                                     safe_closedir(d4);                  
    631                                 }   
     630                                    safe_closedir(d4); 
     631                                } 
    632632                            } 
    633633                            safe_closedir(d3); 
     
    641641                                found=0; 
    642642                                finished(); 
    643                             }                              
     643                            } 
    644644                        } 
    645645                    } 
     
    656656            sprintf(current_dir+strlen(current_dir), "/%s", selected->name); 
    657657            d=safe_opendir(current_dir); 
    658             while ((de=safe_readdir(d)) != NULL) {//Loop to find all the RAW files inside the Canon folder  
     658            while ((de=safe_readdir(d)) != NULL) {//Loop to find all the RAW files inside the Canon folder 
    659659                if (de->d_name[0] == 'C' || de->d_name[9] == 'C') {//If file is RAW (Either CRW/CR2 prefix or file extension) 
    660660                    d2=safe_opendir(current_dir); 
     
    665665                                started(); 
    666666                                found=1;//A JPG file with the same Canon number was found 
    667                         }                                  
     667                        } 
    668668                    } 
    669                     safe_closedir(d2);  
    670                     //If no JPG found, delete RAW file                 
     669                    safe_closedir(d2); 
     670                    //If no JPG found, delete RAW file 
    671671                    if (found == 0) { 
    672672                        sprintf(selected_item, "%s/%s", current_dir, de->d_name); 
     
    697697                        } 
    698698                    } 
    699                     //If no JPG found, delete RAW file            
     699                    //If no JPG found, delete RAW file 
    700700                    if (found == 0) { 
    701701                        sprintf(selected_file, "%s/%s", current_dir, ptr->name); 
     
    898898 
    899899    for (ptr=head; ptr; ptr=ptr->next) { 
    900         if (ptr->attr != 0xFF && !(ptr->attr & DOS_ATTR_DIRECTORY) && ptr->marked)  
     900        if (ptr->attr != 0xFF && !(ptr->attr & DOS_ATTR_DIRECTORY) && ptr->marked) 
    901901            ++cnt; 
    902902    } 
     
    909909 
    910910    if (!cnt) { 
    911         if (selected && selected->attr != 0xFF && !(selected->attr & DOS_ATTR_DIRECTORY))  
     911        if (selected && selected->attr != 0xFF && !(selected->attr & DOS_ATTR_DIRECTORY)) 
    912912            ++cnt; 
    913913    } 
     
    960960    fsrc = safe_open(selected_file, O_RDONLY, 0777); 
    961961    if (fsrc>=0) { 
    962             strcpy(selected_file,"A/DISKBOOT.BIN"); 
     962        strcpy(selected_file,"A/DISKBOOT.BIN"); 
    963963            fdst = safe_open(selected_file, O_WRONLY|STD_O_CREAT|STD_O_TRUNC, 0777); 
    964964            if (fdst>=0) { 
     
    970970                t.actime = t.modtime = selected->mtime; 
    971971                utime(selected_file, &t); 
    972                 //shutdown(); 
     972            //shutdown(); 
    973973                        gui_browser_progress_show("Please reboot",100); 
    974974            } 
     
    981981static void fselect_marked_inverse_selection() { 
    982982    struct fitem  *ptr; 
    983      
     983 
    984984    for (ptr=head; ptr; ptr=ptr->next) 
    985985        if (ptr->attr != 0xFF && !(ptr->attr & DOS_ATTR_DIRECTORY)) 
    986986            ptr->marked = !ptr->marked; 
    987      
     987 
    988988    gui_fselect_redraw = 2; 
    989989} 
     
    995995 librawop_p=module_rawop_load(); 
    996996 if (!librawop_p) 
    997         return;         //exit if fail 
     997    return;     //exit if fail 
    998998  if ( !API_VERSION_MATCH_REQUIREMENT( librawop_p->version, 1, 0 ) ) 
    999999    return; 
     
    10171017    if (btn != MBOX_BTN_YES) return; 
    10181018 
    1019         librawop_p=module_rawop_load(); 
    1020         if (!librawop_p) 
    1021                 return;         //exit if fail 
    1022         if ( !API_VERSION_MATCH_REQUIREMENT( librawop_p->version, 1, 0 ) ) 
    1023                 return; 
     1019    librawop_p=module_rawop_load(); 
     1020    if (!librawop_p) 
     1021        return;     //exit if fail 
     1022    if ( !API_VERSION_MATCH_REQUIREMENT( librawop_p->version, 1, 0 ) ) 
     1023        return; 
    10241024 
    10251025    if(!(raw_subtract_from = malloc(300))) //3x full path 
     
    10291029    sprintf(raw_subtract_sub,"%s/%s",current_dir,selected->name); 
    10301030    for (ptr=head; ptr; ptr=ptr->next) { 
    1031         if (ptr->marked && ptr->attr != 0xFF &&  
     1031        if (ptr->marked && ptr->attr != 0xFF && 
    10321032            !(ptr->attr & DOS_ATTR_DIRECTORY) && 
    10331033            ptr->size == hook_raw_size() && 
     
    10991099static void fselect_mpopup_rawop_cb(unsigned int actn) { 
    11001100    switch (actn) { 
    1101             case MPOPUP_RAW_AVERAGE: 
    1102             raw_operation=RAW_OPERATION_AVERAGE; 
     1101        case MPOPUP_RAW_AVERAGE: 
     1102            raw_operation=RAW_OPERATION_AVERAGE; 
    11031103            process_raw_files(); 
    11041104            break; 
     
    11151115            setup_batch_subtract(); 
    11161116            break; 
    1117             case MPOPUP_DNG_TO_CRW: 
     1117        case MPOPUP_DNG_TO_CRW: 
    11181118            process_dng_to_raw_files(); 
    11191119            break; 
    1120         } 
     1120    } 
    11211121} 
    11221122 
    11231123static void mkdir_cb(const char* name) 
    11241124{ 
    1125         if (name) { 
    1126                 sprintf(selected_file,"%s/%s",current_dir,name); 
    1127                 mkdir(selected_file);            
     1125    if (name) { 
     1126        sprintf(selected_file,"%s/%s",current_dir,name); 
     1127        mkdir(selected_file); 
    11281128        gui_fselect_readdir = 1; 
    1129             gui_fselect_redraw = 2; 
    1130         } 
     1129        gui_fselect_redraw = 2; 
     1130    } 
    11311131} 
    11321132 
    11331133static void rename_cb(const char* name) 
    11341134{ 
    1135         if (name) { 
    1136                 char newname[100]; 
     1135    if (name) { 
     1136        char newname[100]; 
    11371137        sprintf(selected_file, "%s/%s", current_dir, selected->name); 
    1138                 sprintf(newname,"%s/%s",current_dir,name); 
    1139                 rename(selected_file,newname); 
     1138        sprintf(newname,"%s/%s",current_dir,name); 
     1139        rename(selected_file,newname); 
    11401140        gui_fselect_readdir = 1; 
    1141             gui_fselect_redraw = 2; 
    1142         } 
     1141        gui_fselect_redraw = 2; 
     1142    } 
    11431143} 
    11441144 
     
    11461146 
    11471147    switch (actn) { 
    1148             case MPOPUP_MKDIR: 
     1148        case MPOPUP_MKDIR: 
    11491149            if (module_tbox_load()) 
    11501150                module_tbox_load()->textbox_init(LANG_POPUP_MKDIR, LANG_PROMPT_MKDIR, "", 15, mkdir_cb, 0); 
     
    11571157                module_tbox_load()->textbox_init(LANG_POPUP_RENAME, LANG_PROMPT_RENAME, selected->name, 15, rename_cb, 0); 
    11581158            break; 
    1159         } 
     1159    } 
    11601160    gui_fselect_redraw = 2; 
    11611161} 
     
    12031203                         MBOX_TEXT_CENTER|MBOX_BTN_YES_NO|MBOX_DEF_BTN2, fselect_purge_cb); 
    12041204           } 
    1205            else if (selected->name[9] == 'C' || selected->name[9] == 'T' || selected->name[9] == 'W' || selected->name[9] == 'J') {//If seleted item is a file produced by the camera  
     1205           else if (selected->name[9] == 'C' || selected->name[9] == 'T' || selected->name[9] == 'W' || selected->name[9] == 'J') {//If seleted item is a file produced by the camera 
    12061206               sprintf(buf, lang_str(LANG_FSELECT_PURGE_LIST_TEXT), fselect_marked_count()); 
    12071207               gui_mbox_init(LANG_FSELECT_PURGE_TITLE, (int)buf, 
     
    12201220            break; 
    12211221 
    1222                 case MPOPUP_RAWOPS: 
     1222        case MPOPUP_RAWOPS: 
    12231223            module_mpopup_init( popup_rawop, mpopup_rawop_flag, fselect_mpopup_rawop_cb, 0); 
    12241224            break; 
    12251225 
    1226                 case MPOPUP_MORE:                        
     1226        case MPOPUP_MORE: 
    12271227            module_mpopup_init( popup_more, mpopup_more_flag, fselect_mpopup_more_cb, 0); 
    12281228        break; 
     
    12441244    gui_fselect_free_data(); 
    12451245    gui_fselect_marked_free_data(); 
    1246         module_rawop_unload(); 
     1246    module_rawop_unload(); 
    12471247} 
    12481248 
    12491249static void exit_fselect(char* file) 
    12501250{ 
    1251         finalize_fselect(); 
     1251    finalize_fselect(); 
    12521252 
    12531253    if (set_key_redraw_mode) 
     
    12551255        gui_set_mode(gui_fselect_mode_old); 
    12561256    } 
    1257     if (fselect_on_select)  
     1257    if (fselect_on_select) 
    12581258    { 
    12591259        fselect_on_select(file); 
     
    12711271{ 
    12721272    int i; 
    1273      
     1273 
    12741274    switch (kbd_get_autoclicked_key() | get_jogdial_direction()) { 
    12751275        case JOGDIAL_LEFT: 
     
    13301330                    mpopup_rawop_flag |= MPOPUP_RAW_DEVELOP; 
    13311331 
    1332                 if ( module_convert_dng_to_chdk_raw(0) )        // if dng module exist 
     1332                if ( module_convert_dng_to_chdk_raw(0) )    // if dng module exist 
    13331333                    if((fselect_marked_count()>1)||(selected->size > hook_raw_size())) 
    13341334                        mpopup_rawop_flag |= MPOPUP_DNG_TO_CRW; 
     
    13641364                } else  { 
    13651365                    sprintf(selected_file, "%s/%s", current_dir, selected->name); 
    1366                                          
    1367                                         char *ext = strchr(selected->name,'.'); 
     1366 
     1367                    char *ext = strchr(selected->name,'.'); 
     1368                    int do_exit = 1; 
     1369 
    13681370                    if ( ext && (ext[1]|0x20)=='f' && (ext[2]|0x20)=='l' && (ext[3]|0x20)=='t') { 
    1369                                         if (!fselect_on_select) { 
    1370                                 exit_fselect(0); 
    1371                                                 module_run(selected_file, 0, 0,0, UNLOAD_IF_ERR); 
    1372  
    1373                                                         break; 
    1374                                                 } 
    1375                                         } 
    1376  
    1377                     exit_fselect(selected_file); 
    1378                                         module_async_unload(module_idx); 
     1371                        if (!fselect_on_select) { 
     1372                            exit_fselect(0); 
     1373                            do_exit = 0; 
     1374                            module_run(selected_file, 0, 0,0, UNLOAD_IF_ERR); 
     1375                        } 
     1376                    } else if ( ext && (ext[1]|0x20)=='t' && (ext[2]|0x20)=='x' && (ext[3]|0x20)=='t') { 
     1377                        if (!fselect_on_select) { 
     1378                            exit_fselect(0); 
     1379                            do_exit = 0; 
     1380                            int argv[] = {(int)selected_file}; 
     1381                            module_run("txtread.flt", 0, 1, argv, UNLOAD_IF_ERR); 
     1382                        } 
     1383                    } 
     1384 
     1385                    if (do_exit) exit_fselect(selected_file); 
     1386                    module_async_unload(module_idx); 
    13791387                } 
    13801388            } 
     
    14021410    // just free resource. callback called with NULL ptr 
    14031411    exit_fselect(0); 
    1404         module_async_unload(module_idx); 
     1412    module_async_unload(module_idx); 
    14051413} 
    14061414 
     
    14151423 
    14161424void* MODULE_EXPORT_LIST[] = { 
    1417         /* 0 */ (void*)EXPORTLIST_MAGIC_NUMBER, 
    1418         /* 1 */ (void*)0 
    1419                 }; 
     1425    /* 0 */ (void*)EXPORTLIST_MAGIC_NUMBER, 
     1426    /* 1 */ (void*)0 
     1427        }; 
    14201428 
    14211429 
    14221430//--------------------------------------------------------- 
    1423 // PURPOSE:   Bind module symbols with chdk.  
    1424 //              Required function 
     1431// PURPOSE:   Bind module symbols with chdk. 
     1432//      Required function 
    14251433// PARAMETERS: pointer to chdk list of export 
    14261434// RETURN VALUE: 1 error, 0 ok 
     
    14321440 
    14331441  if ( !API_VERSION_MATCH_REQUIREMENT( gui_version.common_api, 1, 0 ) ) 
    1434           return 1; 
     1442      return 1; 
    14351443  if ( !API_VERSION_MATCH_REQUIREMENT( conf.api_version, 2, 0 ) ) 
    1436         return 1; 
     1444    return 1; 
    14371445 
    14381446  return 0; 
     
    14471455int _module_unloader() 
    14481456{ 
    1449         finalize_fselect(); 
    1450  
    1451         //sanity clean to prevent accidentaly assign/restore guimode to unloaded module  
    1452         GUI_MODE_FSELECT_MODULE.magicnum = 0; 
     1457    finalize_fselect(); 
     1458 
     1459    //sanity clean to prevent accidentaly assign/restore guimode to unloaded module 
     1460    GUI_MODE_FSELECT_MODULE.magicnum = 0; 
    14531461 
    14541462    return 0; 
     
    14651473 
    14661474  if ( argn!=0 && argn!=5 ) { 
    1467         module_async_unload(moduleidx); 
     1475    module_async_unload(moduleidx); 
    14681476    return 1; 
    14691477  } 
     
    14861494/******************** Module Information structure ******************/ 
    14871495 
    1488 struct ModuleInfo _module_info = {      MODULEINFO_V1_MAGICNUM, 
    1489                                                                         sizeof(struct ModuleInfo), 
    1490  
    1491                                                                         ANY_CHDK_BRANCH, 0,                     // Requirements of CHDK version 
    1492                                                                         ANY_PLATFORM_ALLOWED,           // Specify platform dependency 
    1493                                                                         0,                                                      // flag 
    1494                                                                         -LANG_MENU_MISC_FILE_BROWSER,   // Module name 
    1495                                                                         1, 1,                                           // Module version 
    1496                                                                         0 
    1497                                                                 }; 
     1496struct ModuleInfo _module_info = {  MODULEINFO_V1_MAGICNUM, 
     1497                                    sizeof(struct ModuleInfo), 
     1498 
     1499                                    ANY_CHDK_BRANCH, 0,         // Requirements of CHDK version 
     1500                                    ANY_PLATFORM_ALLOWED,       // Specify platform dependency 
     1501                                    0,                          // flag 
     1502                                    -LANG_MENU_MISC_FILE_BROWSER,   // Module name 
     1503                                    1, 1,                       // Module version 
     1504                                    0 
     1505                                }; 
    14981506 
    14991507/*************** END OF AUXILARY PART *******************/ 
Note: See TracChangeset for help on using the changeset viewer.