Changeset 2017
- Timestamp:
- 07/28/12 04:53:34 (10 months ago)
- Location:
- trunk/core
- Files:
-
- 2 edited
-
gui.c (modified) (1 diff)
-
gui_fselect.c (modified) (55 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/core/gui.c
r2015 r2017 1964 1964 gui_mode = mode; 1965 1965 1966 gui_osd_need_restore = 0; 1967 1966 1968 // Flag for screen erase/redraw unless mode is marked not to (e.g. menu box popup) 1967 1969 if (((gui_mode->flags & (GUI_MODE_FLAG_NODRAWRESTORE|GUI_MODE_FLAG_NORESTORE_ON_SWITCH)) == 0) && -
trunk/core/gui_fselect.c
r2015 r2017 18 18 19 19 /* 20 HISTORY:1.1 - added tbox usage [CHDK 1.1.1 required]20 HISTORY: 1.1 - added tbox usage [CHDK 1.1.1 required] 21 21 */ 22 22 … … 25 25 void gui_fselect_draw(int enforce_redraw); 26 26 27 gui_handler GUI_MODE_FSELECT_MODULE = 27 gui_handler GUI_MODE_FSELECT_MODULE = 28 28 /*GUI_MODE_FSELECT*/ { GUI_MODE_FSELECT, gui_fselect_draw, gui_fselect_kbd_process, gui_fselect_kbd_process_menu_btn, 0, GUI_MODE_MAGICNUM }; 29 29 … … 91 91 static coord head_x, head_y, head_w, head_h; //header window coord 92 92 static 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 93 static coord foot_x, foot_y, foot_w, foot_h; //footer window coord 94 94 95 95 static int gui_fselect_redraw; // flag request fselect redraw: 0-no, 1-only filelist, 2-whole_redraw(incl.border) … … 98 98 99 99 static void (*fselect_on_select)(const char *fn); 100 static char raw_operation; // info for process_raw_files() RAW_OPERATION_AVERAGE, RAW_OPERATION_SUM, 100 static char raw_operation; // info for process_raw_files() RAW_OPERATION_AVERAGE, RAW_OPERATION_SUM, 101 101 static int set_key_redraw_mode; // dirty hack: screen erase & mode restore done after(0) or before(1) call to fselect_on_select 102 102 … … 111 111 #define MPOPUP_CHDK_REPLACE 0x1000 112 112 113 #define MPOPUP_RAWOPS 0x0020114 #define MPOPUP_MORE 0x0040113 #define MPOPUP_RAWOPS 0x0020 114 #define MPOPUP_MORE 0x0040 115 115 116 116 … … 124 124 { MPOPUP_EDITOR, (int)"Edit" }, 125 125 { 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 }, 129 129 }; 130 130 131 #define MPOPUP_RAW_ADD 0x0020132 #define MPOPUP_RAW_AVERAGE 0x0040131 #define MPOPUP_RAW_ADD 0x0020 132 #define MPOPUP_RAW_AVERAGE 0x0040 133 133 #define MPOPUP_SUBTRACT 0x0100 134 134 #define MPOPUP_RAW_DEVELOP 0x0200 … … 141 141 { MPOPUP_SUBTRACT, LANG_POPUP_SUB_FROM_MARKED }, 142 142 { MPOPUP_DNG_TO_CRW, (int)"DNG -> CHDK RAW"}, 143 { 0, 0 },143 { 0, 0 }, 144 144 }; 145 145 … … 150 150 static struct mpopup_item popup_more[]= { 151 151 { 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 }, 155 155 }; 156 156 … … 160 160 161 161 for (j=0; j<step; ++j) { 162 if (selected->prev==top && top->prev) 162 if (selected->prev==top && top->prev) 163 163 top=top->prev; 164 if (selected->prev) 164 if (selected->prev) 165 165 selected=selected->prev; 166 166 else … … 182 182 if (i==BODY_LINES-1 && ptr && ptr->prev==selected && ptr->next) 183 183 top=top->next; 184 if (selected->next) 184 if (selected->next) 185 185 selected=selected->next; 186 186 else … … 277 277 ptr = &((*ptr)->next); 278 278 ++count; 279 } 279 } 280 280 } 281 281 de = safe_readdir(d); … … 284 284 } 285 285 *ptr=NULL; 286 286 287 287 if (count) { 288 288 // sort … … 295 295 prev=prev->next; 296 296 } 297 297 298 298 qsort(ptr, count, sizeof(struct fitem*), fselect_sort_nothumb); 299 299 300 300 for (i=0; i<count-1; ++i) { 301 301 ptr[i]->n=i; … … 340 340 struct STD_stat st; 341 341 // check if input 'dir' exists 342 if (safe_stat(current_dir,&st) == 0) 342 if (safe_stat(current_dir,&st) == 0) 343 343 { 344 344 // exists - check if it is a directory or file … … 370 370 371 371 //------------------------------------------------------------------- 372 void gui_fselect_init(int title, const char* prev_dir, const char* default_dir, void (*on_select)(const char *fn)) 372 void gui_fselect_init(int title, const char* prev_dir, const char* default_dir, void (*on_select)(const char *fn)) 373 373 { 374 374 int i; 375 375 376 376 int chars_width = NAME_FONT_SIZE + SIZE_FONT_SIZE + TIME_FONT_SIZE; 377 377 main_w = SPACING/*N*/+SPACING+TAB_DIVIDER+SPACING/*S*/+SPACING+TAB_DIVIDER+SPACING/*T*/+SPACING+SCROLLBAR+chars_width; … … 379 379 main_x = (camera_screen.width - main_w) >> 1; 380 380 main_y = (camera_screen.height - main_h) >> 1; 381 381 382 382 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; 384 384 head_y = main_y; 385 head_h = HEAD_FONT_LINES; 385 head_h = HEAD_FONT_LINES; 386 386 body_y = head_y + head_h + TAB_DIVIDER; 387 387 body_h = BODY_FONT_LINES; 388 388 foot_y = body_y + body_h + TAB_DIVIDER; 389 389 foot_h = FOOT_FONT_LINES; 390 390 391 391 fselect_title = lang_str(title); 392 392 393 393 // 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)) 395 395 if (!gui_fselect_find_start_dir(default_dir)) 396 396 gui_fselect_find_start_dir("A"); … … 431 431 title_font_size = strlen(fselect_title) * FONT_WIDTH; 432 432 draw_string(head_x+((head_w-title_font_size)>>1), head_y, fselect_title, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE)); //title text 433 433 434 434 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 435 435 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 437 437 } 438 438 … … 453 453 } 454 454 455 if ( enforce_redraw )456 gui_fselect_redraw = 2;455 if ( enforce_redraw ) 456 gui_fselect_redraw = 2; 457 457 458 458 if (gui_fselect_redraw) { … … 468 468 sum_size = 0; 469 469 for (i=0, ptr=top; i<BODY_LINES && ptr; ++i, ptr=ptr->next) { 470 470 471 471 cl_marked = MAKE_COLOR((ptr==selected)?COLOR_RED:COLOR_GREY, (ptr->marked)?cl_markered:COLOR_WHITE); 472 472 cl_selected = (ptr==selected)?MAKE_COLOR(COLOR_RED, COLOR_RED):MAKE_COLOR(COLOR_GREY, COLOR_GREY); 473 473 474 474 // print name 475 for (j=0; j<NAME_SIZE && ptr->name[j]; ++j) 475 for (j=0; j<NAME_SIZE && ptr->name[j]; ++j) 476 476 buf[j] = ptr->name[j]; 477 477 478 478 if (j==NAME_SIZE && ptr->name[j]) buf[NAME_SIZE-1] = '~'; // too long name 479 479 480 480 if (ptr->attr & DOS_ATTR_DIRECTORY && ptr->attr != 0xFF) { //? 481 481 if (j<NAME_SIZE) { … … 488 488 for (; j<NAME_SIZE && (buf[j++]=' ');); //fill upto NAME_SIZE 489 489 buf[NAME_SIZE] = 0; // eos 490 490 491 491 off_body_y = body_y+(i*FONT_HEIGHT); 492 492 draw_filled_rect(body_x, off_body_y, off_name_x-1, off_body_y+FONT_HEIGHT-1, cl_selected); 493 493 draw_string(off_name_x, off_body_y, buf, cl_marked); 494 494 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 496 496 // print size or <Dir> 497 497 if (ptr->attr & DOS_ATTR_DIRECTORY) { … … 512 512 else 513 513 sprintf(buf, "%3ld.%ld G", ptr->size/(1024*1024*1024), (ptr->size%(1024*1024*1024)*10)/(1024*1024*1024)); // "999.9 G" 514 514 515 515 if (ptr->marked) 516 516 sum_size += ptr->size; … … 519 519 //tab divider 520 520 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); 522 522 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 525 525 // print modification time 526 526 if (ptr->mtime) { … … 534 534 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); 535 535 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); 537 537 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); 538 538 } … … 543 543 draw_filled_rect(body_x, off_body_y, body_x+body_w-1, body_y+body_h-1, MAKE_COLOR(COLOR_GREY, COLOR_GREY)); 544 544 } 545 545 546 546 // scrollbar 547 547 draw_filled_rect(off_body_x, body_y, off_body_x+SCROLLBAR-1, body_y+body_h-1, MAKE_COLOR(COLOR_BLACK, COLOR_BLACK)); … … 559 559 strncpy(buf, current_dir+i-max_dir_len, max_dir_len); 560 560 buf[0] = '.'; 561 buf[1] = '.'; 561 buf[1] = '.'; 562 562 } else { 563 strcpy(buf, current_dir); 563 strcpy(buf, current_dir); 564 564 } 565 565 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 567 567 draw_string(off_name_x, foot_y, buf, MAKE_COLOR(COLOR_GREY, COLOR_WHITE)); //current dir 568 568 569 569 if (sum_size) { 570 570 sprintf(buf, "%d b", sum_size); //selected size … … 626 626 started(); 627 627 found=1;//A JPG file with the same Canon number was found 628 } 628 } 629 629 } 630 safe_closedir(d4); 631 } 630 safe_closedir(d4); 631 } 632 632 } 633 633 safe_closedir(d3); … … 641 641 found=0; 642 642 finished(); 643 } 643 } 644 644 } 645 645 } … … 656 656 sprintf(current_dir+strlen(current_dir), "/%s", selected->name); 657 657 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 659 659 if (de->d_name[0] == 'C' || de->d_name[9] == 'C') {//If file is RAW (Either CRW/CR2 prefix or file extension) 660 660 d2=safe_opendir(current_dir); … … 665 665 started(); 666 666 found=1;//A JPG file with the same Canon number was found 667 } 667 } 668 668 } 669 safe_closedir(d2); 670 //If no JPG found, delete RAW file 669 safe_closedir(d2); 670 //If no JPG found, delete RAW file 671 671 if (found == 0) { 672 672 sprintf(selected_item, "%s/%s", current_dir, de->d_name); … … 697 697 } 698 698 } 699 //If no JPG found, delete RAW file 699 //If no JPG found, delete RAW file 700 700 if (found == 0) { 701 701 sprintf(selected_file, "%s/%s", current_dir, ptr->name); … … 898 898 899 899 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) 901 901 ++cnt; 902 902 } … … 909 909 910 910 if (!cnt) { 911 if (selected && selected->attr != 0xFF && !(selected->attr & DOS_ATTR_DIRECTORY)) 911 if (selected && selected->attr != 0xFF && !(selected->attr & DOS_ATTR_DIRECTORY)) 912 912 ++cnt; 913 913 } … … 960 960 fsrc = safe_open(selected_file, O_RDONLY, 0777); 961 961 if (fsrc>=0) { 962 strcpy(selected_file,"A/DISKBOOT.BIN");962 strcpy(selected_file,"A/DISKBOOT.BIN"); 963 963 fdst = safe_open(selected_file, O_WRONLY|STD_O_CREAT|STD_O_TRUNC, 0777); 964 964 if (fdst>=0) { … … 970 970 t.actime = t.modtime = selected->mtime; 971 971 utime(selected_file, &t); 972 //shutdown();972 //shutdown(); 973 973 gui_browser_progress_show("Please reboot",100); 974 974 } … … 981 981 static void fselect_marked_inverse_selection() { 982 982 struct fitem *ptr; 983 983 984 984 for (ptr=head; ptr; ptr=ptr->next) 985 985 if (ptr->attr != 0xFF && !(ptr->attr & DOS_ATTR_DIRECTORY)) 986 986 ptr->marked = !ptr->marked; 987 987 988 988 gui_fselect_redraw = 2; 989 989 } … … 995 995 librawop_p=module_rawop_load(); 996 996 if (!librawop_p) 997 return;//exit if fail997 return; //exit if fail 998 998 if ( !API_VERSION_MATCH_REQUIREMENT( librawop_p->version, 1, 0 ) ) 999 999 return; … … 1017 1017 if (btn != MBOX_BTN_YES) return; 1018 1018 1019 librawop_p=module_rawop_load();1020 if (!librawop_p)1021 return;//exit if fail1022 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; 1024 1024 1025 1025 if(!(raw_subtract_from = malloc(300))) //3x full path … … 1029 1029 sprintf(raw_subtract_sub,"%s/%s",current_dir,selected->name); 1030 1030 for (ptr=head; ptr; ptr=ptr->next) { 1031 if (ptr->marked && ptr->attr != 0xFF && 1031 if (ptr->marked && ptr->attr != 0xFF && 1032 1032 !(ptr->attr & DOS_ATTR_DIRECTORY) && 1033 1033 ptr->size == hook_raw_size() && … … 1099 1099 static void fselect_mpopup_rawop_cb(unsigned int actn) { 1100 1100 switch (actn) { 1101 case MPOPUP_RAW_AVERAGE:1102 raw_operation=RAW_OPERATION_AVERAGE;1101 case MPOPUP_RAW_AVERAGE: 1102 raw_operation=RAW_OPERATION_AVERAGE; 1103 1103 process_raw_files(); 1104 1104 break; … … 1115 1115 setup_batch_subtract(); 1116 1116 break; 1117 case MPOPUP_DNG_TO_CRW:1117 case MPOPUP_DNG_TO_CRW: 1118 1118 process_dng_to_raw_files(); 1119 1119 break; 1120 }1120 } 1121 1121 } 1122 1122 1123 1123 static void mkdir_cb(const char* name) 1124 1124 { 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); 1128 1128 gui_fselect_readdir = 1; 1129 gui_fselect_redraw = 2;1130 }1129 gui_fselect_redraw = 2; 1130 } 1131 1131 } 1132 1132 1133 1133 static void rename_cb(const char* name) 1134 1134 { 1135 if (name) {1136 char newname[100];1135 if (name) { 1136 char newname[100]; 1137 1137 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); 1140 1140 gui_fselect_readdir = 1; 1141 gui_fselect_redraw = 2;1142 }1141 gui_fselect_redraw = 2; 1142 } 1143 1143 } 1144 1144 … … 1146 1146 1147 1147 switch (actn) { 1148 case MPOPUP_MKDIR:1148 case MPOPUP_MKDIR: 1149 1149 if (module_tbox_load()) 1150 1150 module_tbox_load()->textbox_init(LANG_POPUP_MKDIR, LANG_PROMPT_MKDIR, "", 15, mkdir_cb, 0); … … 1157 1157 module_tbox_load()->textbox_init(LANG_POPUP_RENAME, LANG_PROMPT_RENAME, selected->name, 15, rename_cb, 0); 1158 1158 break; 1159 }1159 } 1160 1160 gui_fselect_redraw = 2; 1161 1161 } … … 1203 1203 MBOX_TEXT_CENTER|MBOX_BTN_YES_NO|MBOX_DEF_BTN2, fselect_purge_cb); 1204 1204 } 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 1206 1206 sprintf(buf, lang_str(LANG_FSELECT_PURGE_LIST_TEXT), fselect_marked_count()); 1207 1207 gui_mbox_init(LANG_FSELECT_PURGE_TITLE, (int)buf, … … 1220 1220 break; 1221 1221 1222 case MPOPUP_RAWOPS:1222 case MPOPUP_RAWOPS: 1223 1223 module_mpopup_init( popup_rawop, mpopup_rawop_flag, fselect_mpopup_rawop_cb, 0); 1224 1224 break; 1225 1225 1226 case MPOPUP_MORE: 1226 case MPOPUP_MORE: 1227 1227 module_mpopup_init( popup_more, mpopup_more_flag, fselect_mpopup_more_cb, 0); 1228 1228 break; … … 1244 1244 gui_fselect_free_data(); 1245 1245 gui_fselect_marked_free_data(); 1246 module_rawop_unload();1246 module_rawop_unload(); 1247 1247 } 1248 1248 1249 1249 static void exit_fselect(char* file) 1250 1250 { 1251 finalize_fselect();1251 finalize_fselect(); 1252 1252 1253 1253 if (set_key_redraw_mode) … … 1255 1255 gui_set_mode(gui_fselect_mode_old); 1256 1256 } 1257 if (fselect_on_select) 1257 if (fselect_on_select) 1258 1258 { 1259 1259 fselect_on_select(file); … … 1271 1271 { 1272 1272 int i; 1273 1273 1274 1274 switch (kbd_get_autoclicked_key() | get_jogdial_direction()) { 1275 1275 case JOGDIAL_LEFT: … … 1330 1330 mpopup_rawop_flag |= MPOPUP_RAW_DEVELOP; 1331 1331 1332 if ( module_convert_dng_to_chdk_raw(0) ) // if dng module exist1332 if ( module_convert_dng_to_chdk_raw(0) ) // if dng module exist 1333 1333 if((fselect_marked_count()>1)||(selected->size > hook_raw_size())) 1334 1334 mpopup_rawop_flag |= MPOPUP_DNG_TO_CRW; … … 1364 1364 } else { 1365 1365 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 1368 1370 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); 1379 1387 } 1380 1388 } … … 1402 1410 // just free resource. callback called with NULL ptr 1403 1411 exit_fselect(0); 1404 module_async_unload(module_idx);1412 module_async_unload(module_idx); 1405 1413 } 1406 1414 … … 1415 1423 1416 1424 void* MODULE_EXPORT_LIST[] = { 1417 /* 0 */(void*)EXPORTLIST_MAGIC_NUMBER,1418 /* 1 */(void*)01419 };1425 /* 0 */ (void*)EXPORTLIST_MAGIC_NUMBER, 1426 /* 1 */ (void*)0 1427 }; 1420 1428 1421 1429 1422 1430 //--------------------------------------------------------- 1423 // PURPOSE: Bind module symbols with chdk. 1424 // Required function1431 // PURPOSE: Bind module symbols with chdk. 1432 // Required function 1425 1433 // PARAMETERS: pointer to chdk list of export 1426 1434 // RETURN VALUE: 1 error, 0 ok … … 1432 1440 1433 1441 if ( !API_VERSION_MATCH_REQUIREMENT( gui_version.common_api, 1, 0 ) ) 1434 return 1;1442 return 1; 1435 1443 if ( !API_VERSION_MATCH_REQUIREMENT( conf.api_version, 2, 0 ) ) 1436 return 1;1444 return 1; 1437 1445 1438 1446 return 0; … … 1447 1455 int _module_unloader() 1448 1456 { 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; 1453 1461 1454 1462 return 0; … … 1465 1473 1466 1474 if ( argn!=0 && argn!=5 ) { 1467 module_async_unload(moduleidx);1475 module_async_unload(moduleidx); 1468 1476 return 1; 1469 1477 } … … 1486 1494 /******************** Module Information structure ******************/ 1487 1495 1488 struct ModuleInfo _module_info = { MODULEINFO_V1_MAGICNUM,1489 sizeof(struct ModuleInfo),1490 1491 ANY_CHDK_BRANCH, 0,// Requirements of CHDK version1492 ANY_PLATFORM_ALLOWED,// Specify platform dependency1493 0,// flag1494 -LANG_MENU_MISC_FILE_BROWSER,// Module name1495 1, 1,// Module version1496 01497 };1496 struct 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 }; 1498 1506 1499 1507 /*************** END OF AUXILARY PART *******************/
Note: See TracChangeset
for help on using the changeset viewer.