Changeset 1467
- Timestamp:
- 12/11/11 01:43:46 (18 months ago)
- Location:
- branches/reyalp-flt
- Files:
-
- 26 added
- 49 edited
-
Makefile (modified) (3 diffs)
-
core/Makefile (modified) (3 diffs)
-
core/curves.c (modified) (6 diffs)
-
core/curves.h (modified) (1 diff)
-
core/edgeoverlay.c (modified) (22 diffs)
-
core/edgeoverlay.h (modified) (1 diff)
-
core/flt.h (added)
-
core/gui.c (modified) (34 diffs)
-
core/gui_4wins.c (modified) (4 diffs)
-
core/gui_4wins.h (modified) (1 diff)
-
core/gui_bench.c (modified) (3 diffs)
-
core/gui_calendar.c (modified) (5 diffs)
-
core/gui_calendar.h (modified) (1 diff)
-
core/gui_debug.c (modified) (5 diffs)
-
core/gui_debug.h (modified) (1 diff)
-
core/gui_draw.c (modified) (1 diff)
-
core/gui_draw.h (modified) (1 diff)
-
core/gui_fselect.c (modified) (18 diffs)
-
core/gui_fselect.h (modified) (1 diff)
-
core/gui_mastermind.c (modified) (4 diffs, 1 prop)
-
core/gui_mastermind.h (modified) (1 diff, 1 prop)
-
core/gui_mbox.c (modified) (3 diffs)
-
core/gui_mbox.h (modified) (1 diff)
-
core/gui_menu.c (modified) (4 diffs)
-
core/gui_menu.h (modified) (1 diff)
-
core/gui_mpopup.c (modified) (6 diffs)
-
core/gui_mpopup.h (modified) (1 diff)
-
core/gui_osd.c (modified) (1 diff)
-
core/gui_osd.h (modified) (1 diff)
-
core/gui_palette.c (modified) (5 diffs)
-
core/gui_palette.h (modified) (1 diff)
-
core/gui_read.c (modified) (16 diffs)
-
core/gui_read.h (modified) (1 diff)
-
core/gui_reversi.c (modified) (4 diffs)
-
core/gui_reversi.h (modified) (1 diff)
-
core/gui_snake.c (added)
-
core/gui_sokoban.c (modified) (9 diffs)
-
core/gui_sokoban.h (modified) (1 diff)
-
core/gui_tetris.c (added)
-
core/kbd.c (modified) (3 diffs)
-
core/luascript.c (modified) (8 diffs)
-
core/main.c (modified) (4 diffs)
-
core/module_exportlist.c (added)
-
core/module_exportlist.h (added)
-
core/module_load.c (added)
-
core/module_load.h (added)
-
core/modules (added)
-
core/modules.c (added)
-
core/modules.h (added)
-
core/modules/Makefile (added)
-
core/modules/module_inspector.c (added)
-
core/modules/simple_module.c (added)
-
core/raw.c (modified) (3 diffs)
-
core/raw_merge.c (modified) (15 diffs)
-
core/raw_merge.h (modified) (2 diffs)
-
core/script.c (modified) (1 diff)
-
doc/MODULES_TOC.txt (added)
-
include/gui.h (modified) (2 diffs)
-
platform/g10/sub/102a/boot.c (modified) (1 diff)
-
platform/g10/sub/103b/boot.c (modified) (1 diff)
-
platform/g10/sub/104a/boot.c (modified) (1 diff)
-
platform/s95/kbd.c (modified) (2 diffs)
-
tools/Makefile (modified) (5 diffs)
-
tools/elf2flt (added)
-
tools/elf2flt/Makefile (added)
-
tools/elf2flt/elf-arm.c (added)
-
tools/elf2flt/elf.h (added)
-
tools/elf2flt/elfflt.c (added)
-
tools/elf2flt/elfflt.h (added)
-
tools/elf2flt/flt.h (added)
-
tools/elf2flt/fltdump.c (added)
-
tools/elf2flt/main.c (added)
-
tools/elf2flt/myio.c (added)
-
tools/elf2flt/myio.h (added)
-
tools/makeexport.c (added)
Legend:
- Unmodified
- Added
- Removed
-
branches/reyalp-flt/Makefile
r1371 r1467 81 81 endif 82 82 endif 83 rm -f $(topdir)CHDK/MODULES/* 84 cp $(topdir)core/modules/*.flt $(topdir)CHDK/MODULES 85 zip -9 $(topdir)bin/$(VER)-$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)$(STATE).zip $(topdir)CHDK/MODULES/* 83 86 # if COPY_TO is defined then copy this camera/firmware version to the copied firmware version 84 87 # Define COPY_TO in $(topdir)/platform/$(PLATFORM)/sub/$(PLATFORMSUB)/makefile.inc of the source … … 93 96 endif 94 97 rm -f $(topdir)bin/DISKBOOT.BIN 98 rm -f $(topdir)CHDK/MODULES/* 99 rm -f $(topdir)core/modules/*.flt 95 100 96 101 … … 128 133 zip -9j $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)doc/readme.txt > $(DEVNULL) 129 134 zip -9j $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)$(STATE).zip $(topdir)doc/readme.txt > $(DEVNULL) 135 rm -f $(topdir)CHDK/MODULES/* 136 cp $(topdir)core/modules/*.flt $(topdir)CHDK/MODULES 137 zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)CHDK/MODULES/* > $(DEVNULL) 138 zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)$(STATE).zip $(topdir)CHDK/MODULES/* > $(DEVNULL) 139 rm -f $(topdir)CHDK/MODULES/* 140 rm -f $(topdir)core/modules/*.flt 130 141 131 142 ifdef PLATFORMOS -
branches/reyalp-flt/core/Makefile
r1465 r1467 10 10 LDOPTS+=-Wl,-N,-Ttext,$(MEMISOSTART) 11 11 12 SUBDIRS=modules 13 12 14 all: main.bin 15 16 # Core CHDK flag 17 CFLAGS+=-DTHIS_IS_CHDK_CORE 13 18 14 19 OPT_OBJS= 15 20 ifdef OPT_GAME_REVERSI 16 21 CFLAGS+=-DOPT_GAME_REVERSI 17 OPT_OBJS+=gui_reversi.o22 #OPT_OBJS+=gui_reversi.o 18 23 endif 19 24 ifdef OPT_GAME_SOKOBAN 20 25 CFLAGS+=-DOPT_GAME_SOKOBAN 21 OPT_OBJS+=gui_sokoban.o26 #OPT_OBJS+=gui_sokoban.o 22 27 endif 23 28 ifdef OPT_GAME_CONNECT4 24 29 CFLAGS+=-DOPT_GAME_CONNECT4 25 OPT_OBJS+=gui_4wins.o30 #OPT_OBJS+=gui_4wins.o 26 31 endif 27 32 ifdef OPT_GAME_MASTERMIND 28 33 CFLAGS+=-DOPT_GAME_MASTERMIND 29 OPT_OBJS+=gui_mastermind.o34 #OPT_OBJS+=gui_mastermind.o 30 35 endif 31 36 ifdef OPT_CURVES 32 37 CFLAGS+=-DOPT_CURVES 33 OPT_OBJS+=curves.o38 #OPT_OBJS+=curves.o 34 39 endif 35 40 ifdef OPT_TEXTREADER 36 41 CFLAGS+=-DOPT_TEXTREADER 37 OPT_OBJS+=gui_read.o42 #OPT_OBJS+=gui_read.o 38 43 endif 39 44 ifdef OPT_CALENDAR 40 45 CFLAGS+=-DOPT_CALENDAR 41 OPT_OBJS+=gui_calendar.o46 #OPT_OBJS+=gui_calendar.o 42 47 endif 43 48 ifdef OPT_DEBUGGING 44 49 # global in root makefile.inc 45 50 #CFLAGS+=-DOPT_DEBUGGING 46 OPT_OBJS+=gui_debug.o gui_bench.o51 #OPT_OBJS+=gui_debug.o gui_bench.o 47 52 endif 48 53 ifdef OPT_EDGEOVERLAY 49 54 CFLAGS+=-DOPT_EDGEOVERLAY 50 OPT_OBJS+=edgeoverlay.o55 #OPT_OBJS+=edgeoverlay.o 51 56 endif 52 57 ifdef OPT_MD_DEBUG … … 72 77 endif 73 78 74 OBJS=entry.o nothumb.o main.o gui_draw.o gui_menu.o gui_palette.o gui_mbox.o \75 gui _fselect.o gui.o kbd.o action_stack.o conf.o\79 OBJS=entry.o main.o gui_draw.o gui_menu.o gui_mbox.o \ 80 gui.o kbd.o action_stack.o conf.o\ 76 81 histogram.o gui_batt.o gui_space.o gui_osd.o raw.o \ 77 gui_usb.o gui_lang.o gui_ mpopup.o gui_grid.o raw_merge.o\82 gui_usb.o gui_lang.o gui_grid.o modules.o module_load.o\ 78 83 levent.o shot_histogram.o dng.o bitvector.o console.o $(OPT_OBJS) 79 84 … … 113 118 rm -f $(OBJS:.o=.d) 114 119 120 module_load.o: module_load.c module_load.h module_exportlist.c module_exportlist.h flt.h 121 122 module_exportlist.h: $(topdir)tools/makeexport$(EXE) module_exportlist.c 123 @echo $< \-\> $@ 124 $(topdir)tools/makeexport$(EXE) module_exportlist.c module_exportlist.h modules/exportlist.txt 125 126 flt.h: $(topdir)tools/elf2flt/flt.h 127 @echo $< \-\> $@ 128 @echo "//DO NOT EDIT THIS FILE. This is automatic copy of tools/elf2flt/flt.h" > flt.h 129 cat $(topdir)tools/elf2flt/flt.h >>flt.h 130 115 131 gui_lang.o: gui_lang.c gui_lang.h gui_lang_str.h 116 132 -
branches/reyalp-flt/core/curves.c
r727 r1467 4 4 #include "raw.h" 5 5 6 #ifdef OPT_CURVES 6 //#ifdef OPT_CURVES 7 #if 1 7 8 8 9 #include "curves.h" 10 11 char *conf_curve_file; 12 int *conf_curve_enable; 9 13 10 14 /* … … 101 105 102 106 void curve_set_mode(int value) { 103 if((value>=0) && (value<=4)) conf.curve_enable=value;107 if((value>=0) && (value<=4)) *conf_curve_enable=value; 104 108 curve_init_mode(); 105 109 } 106 110 107 111 void curve_init_mode() { 108 switch( conf.curve_enable) {112 switch(*conf_curve_enable) { 109 113 case 1: // custom - ensure alloc and load conf.curve_file 110 curve_load_data(conf .curve_file,CURVE_CUSTOM);114 curve_load_data(conf_curve_file,CURVE_CUSTOM); 111 115 break; 112 116 case 2: // system - ensure alloc and load syscurve … … 116 120 break; 117 121 default: 118 conf.curve_enable = 0;122 *conf_curve_enable = 0; 119 123 case 0: // disabled - free 120 124 curve_free_data(); … … 371 375 short EVbias = shooting_get_ev_correction1(); 372 376 373 switch( conf.curve_enable) {377 switch(*conf_curve_enable) { 374 378 case 0: 375 379 break; … … 385 389 case 2: 386 390 case 3: // +1EV, +2EV 387 if (current_curve_type == CURVE_SYSTEM) curveL_apply( conf.curve_enable & 1 );391 if (current_curve_type == CURVE_SYSTEM) curveL_apply( *conf_curve_enable & 1 ); 388 392 break; 389 393 case 4: // Auto DR … … 401 405 } 402 406 407 // ========= MODULE INIT ================= 408 409 #include "module_load.h" 410 411 412 int module_idx=-1; 413 414 /***************** BEGIN OF AUXILARY PART ********************* 415 ATTENTION: DO NOT REMOVE OR CHANGE SIGNATURES IN THIS SECTION 416 **************************************************************/ 417 418 int _chdk_required_ver = 1; // minimal required chdk build. 0-no limitation 419 int _chdk_required_platfid = 0; // platform-specific module. 0-no limitation 420 421 void* MODULE_EXPORT_LIST[] = { 422 /* 0 */ (void*)EXPORTLIST_MAGIC_NUMBER, 423 /* 1 */ (void*)5, 424 425 curve_set_mode, 426 curve_init_mode, 427 curve_apply, 428 }; 429 430 431 //--------------------------------------------------------- 432 // PURPOSE: Bind module symbols with chdk. 433 // Required function 434 // PARAMETERS: pointer to chdk list of export 435 // RETURN VALUE: 1 error, 0 ok 436 //--------------------------------------------------------- 437 int _module_loader( void** chdk_export_list ) 438 { 439 if ( (unsigned int)chdk_export_list[0] != EXPORTLIST_MAGIC_NUMBER ) 440 return 1; 441 442 // Safe bind of conf. 443 tConfigVal configVal; 444 CONF_BIND_STR(185, conf_curve_file); 445 CONF_BIND_INT(186, conf_curve_enable ); 446 447 // Startup initialize 448 curve_init_mode(); 449 450 return 0; 451 } 452 453 454 455 //--------------------------------------------------------- 456 // PURPOSE: Finalize module operations (close allocs, etc) 457 // RETURN VALUE: 0-ok, 1-fail 458 //--------------------------------------------------------- 459 int _module_unloader() 460 { 461 // This could be happens only if on-load mistake 462 // CHDK never unload this library (but load only if needed) 463 // Reason: a) curve_set_mode by LUA is not stored anywhere 464 // b) perfomance reason - to avoid load on each raw_processing 465 return 0; 466 } 467 468 469 470 /*************** END OF AUXILARY PART *******************/ 471 472 403 473 #endif -
branches/reyalp-flt/core/curves.h
r709 r1467 5 5 6 6 7 // Defines of exported to chdk symbols 8 #ifdef THIS_IS_CHDK_CORE 9 // This section is for CHDK core 10 extern void (*curve_set_mode)(); 11 extern void (*curve_init_mode)(); 12 extern void (*curve_apply)(); 13 #else 14 // This section is for module 15 extern void curve_set_mode(); 16 extern void curve_init_mode(); 17 extern void curve_apply(); 18 #endif 19 7 20 //------------------------------------------------------------------- 8 extern void curve_set_mode();9 extern void curve_init_mode();10 extern void curve_apply();11 21 //------------------------------------------------------------------- 12 22 -
branches/reyalp-flt/core/edgeoverlay.c
r1365 r1467 1 1 #include "platform.h" 2 2 3 #ifdef OPT_EDGEOVERLAY4 3 #include "edgeoverlay.h" 5 4 #include "conf.h" … … 14 13 #define EDGE_SLICES 2 15 14 15 int* conf_edge_overlay_filter; 16 color* conf_osd_color; 17 int* conf_edge_overlay_zoom; 18 int* conf_edge_overlay_thresh; 19 color* conf_edge_overlay_color; 20 int* conf_edge_overlay_pano; 21 int* conf_edge_overlay_pano_overlap; 22 int* conf_edge_overlay_show; 23 int* conf_edge_overlay_play; 24 16 25 typedef enum _edge_fsm_state 17 26 { … … 54 63 memset(edgebuf->ptr, 0, edgebuf->ptrLen); 55 64 } 56 if ( conf.edge_overlay_filter && (smbuf == NULL))65 if (*conf_edge_overlay_filter && (smbuf == NULL)) 57 66 { 58 67 smbuf = (unsigned char*)malloc(viewport_byte_width*3); … … 62 71 { 63 72 // Disable filtering if we do not have enough memory for it 64 conf.edge_overlay_filter = 0;73 *conf_edge_overlay_filter = 0; 65 74 } 66 75 } … … 133 142 if( !is_buffer_ready() ) 134 143 { 135 draw_string(0, 0, "No overlay to save.", conf.osd_color);144 draw_string(0, 0, "No overlay to save.", *conf_osd_color); 136 145 return; 137 146 } … … 168 177 utime(fn, &t); 169 178 sprintf(msg, "Saved as %s",fn); 170 draw_string(0, 0, msg, conf.osd_color);179 draw_string(0, 0, msg, *conf_osd_color); 171 180 } 172 181 closedir(d); … … 190 199 { 191 200 fsm_state = EDGE_FROZEN; // switch to "edge overlay frozen"-mode 192 if ( conf.edge_overlay_zoom)201 if (*conf_edge_overlay_zoom) 193 202 { 194 203 shooting_set_zoom(zoom); … … 298 307 memset(edgebuf->ptr + slice*compressed_slice, 0, compressed_slice); 299 308 300 if ( conf.edge_overlay_filter)309 if (*conf_edge_overlay_filter) 301 310 { 302 311 // Prefill smbuf with three lines of avergae-filtered data. … … 320 329 shutter_fullpress |= kbd_is_key_pressed(KEY_SHOOT_FULL); 321 330 322 if ( conf.edge_overlay_filter)331 if (*conf_edge_overlay_filter) 323 332 { 324 333 // We need to shift up our smbuf one line, … … 372 381 conv2 = -conv2; 373 382 374 if (conv1 + conv2 > conf.edge_overlay_thresh)383 if (conv1 + conv2 > *conf_edge_overlay_thresh) 375 384 { 376 385 bv_set(edgebuf, (y-viewport_yoffset-EDGE_HMARGIN)*viewport_width + xdiv3, 1); … … 402 411 conv2 = -conv2; 403 412 404 if (conv1 + conv2 > conf.edge_overlay_thresh)413 if (conv1 + conv2 > *conf_edge_overlay_thresh) 405 414 { 406 415 bv_set(edgebuf, (y-viewport_yoffset-EDGE_HMARGIN)*viewport_width + xdiv3+1, 1); … … 416 425 // care so much about performance, you can enable it. 417 426 // 418 // if ( conf.edge_overlay_filter)427 // if (*conf_edge_overlay_filter) 419 428 // { 420 429 // // Here we do basic filtering on the detected edges. … … 451 460 // bv_get(edgebuf, (y+1)*viewport_width + (x+1)); 452 461 // 453 // if (! conf.edge_overlay_show)462 // if (!*conf_edge_overlay_show) 454 463 // { 455 464 // if (sum >= 5) // if we have at least 5 neighboring edges … … 479 488 int x_off, y_off; 480 489 481 const color cl = conf.edge_overlay_color;490 const color cl = *conf_edge_overlay_color; 482 491 const int y_slice_min = viewport_yoffset+EDGE_HMARGIN+ slice *slice_height; 483 492 const int y_slice_max = viewport_yoffset+EDGE_HMARGIN+(slice+1)*slice_height; … … 510 519 const int aspect_correct_x_off = x_off; 511 520 const int bEdge = bv_get(edgebuf, y_edgebuf + x); 512 const int bDraw = bEdge || (draw_get_pixel(aspect_correct_x_off, y_off) == conf.edge_overlay_color);513 const color cl = bEdge ? conf.edge_overlay_color : 0;521 const int bDraw = bEdge || (draw_get_pixel(aspect_correct_x_off, y_off) == *conf_edge_overlay_color); 522 const color cl = bEdge ? *conf_edge_overlay_color : 0; 514 523 if (bEdge || bDraw) 515 524 draw_pixel(aspect_correct_x_off, y_off, cl); … … 569 578 const int x_max = (viewport_width - 2); 570 579 571 switch( conf.edge_overlay_pano)580 switch(*conf_edge_overlay_pano) 572 581 { 573 582 case 0: // pano off … … 576 585 break; 577 586 case 1: // pano from left to right 578 xoffset = -x_max*(100- conf.edge_overlay_pano_overlap)/100;587 xoffset = -x_max*(100-*conf_edge_overlay_pano_overlap)/100; 579 588 break; 580 589 case 2: // pano from top to bottom 581 yoffset = -y_max*(100- conf.edge_overlay_pano_overlap)/100;590 yoffset = -y_max*(100-*conf_edge_overlay_pano_overlap)/100; 582 591 break; 583 592 case 3: // pano from right to left 584 xoffset = x_max*(100- conf.edge_overlay_pano_overlap)/100;593 xoffset = x_max*(100-*conf_edge_overlay_pano_overlap)/100; 585 594 break; 586 595 case 4: // pano from bottom to top 587 yoffset = y_max*(100- conf.edge_overlay_pano_overlap)/100;596 yoffset = y_max*(100-*conf_edge_overlay_pano_overlap)/100; 588 597 break; 589 598 case 5: // free mode … … 594 603 } 595 604 } 605 596 606 597 607 … … 605 615 void edge_overlay() 606 616 { 607 608 617 // Was the shutter fully pressed the last time we ran? 609 618 // We use this to make sure that the user has released … … 623 632 const int bHalfPress = kbd_is_key_pressed(KEY_SHOOT_HALF); 624 633 const int bPlayMode = (mode_get() & MODE_MASK) == MODE_PLAY; 625 const int bPanoramaMode = ( conf.edge_overlay_pano != 0);626 const int bNeedHalfPress = ( conf.edge_overlay_show != 1);627 const int bDisplayInPlay = ( conf.edge_overlay_play == 1);634 const int bPanoramaMode = (*conf_edge_overlay_pano != 0); 635 const int bNeedHalfPress = (*conf_edge_overlay_show != 1); 636 const int bDisplayInPlay = (*conf_edge_overlay_play == 1); 628 637 const int bGuiModeNone = (gui_get_mode() == GUI_MODE_NONE); 629 638 const int bGuiModeAlt = (gui_get_mode() == GUI_MODE_ALT); … … 708 717 // calculations. 709 718 bFullPress |= draw_edge_overlay(); 710 draw_string(0, 0, "Frozen", conf.osd_color);719 draw_string(0, 0, "Frozen", *conf_osd_color); 711 720 } 712 721 … … 741 750 } // function 742 751 743 #endif 744 752 753 754 755 756 // ========= MODULE INIT ================= 757 758 #include "module_load.h" 759 int module_idx=-1; 760 761 /***************** BEGIN OF AUXILARY PART ********************* 762 ATTENTION: DO NOT REMOVE OR CHANGE SIGNATURES IN THIS SECTION 763 **************************************************************/ 764 765 int _chdk_required_ver = 1; // minimal required chdk build. 0-no limitation 766 int _chdk_required_platfid = 0; // platform-specific module. 0-no limitation 767 768 void* MODULE_EXPORT_LIST[] = { 769 /* 0 */ (void*)EXPORTLIST_MAGIC_NUMBER, 770 /* 1 */ (void*)5, 771 772 edge_overlay, 773 save_edge_overlay, 774 load_edge_overlay 775 }; 776 777 778 //--------------------------------------------------------- 779 // PURPOSE: Bind module symbols with chdk. 780 // Required function 781 // PARAMETERS: pointer to chdk list of export 782 // RETURN VALUE: 1 error, 0 ok 783 //--------------------------------------------------------- 784 int _module_loader( void** chdk_export_list ) 785 { 786 if ( (unsigned int)chdk_export_list[0] != EXPORTLIST_MAGIC_NUMBER ) 787 return 1; 788 789 tConfigVal configVal; 790 CONF_BIND_INT(188, conf_edge_overlay_thresh); 791 CONF_BIND_COLOR(189, conf_edge_overlay_color); 792 CONF_BIND_INT(222, conf_edge_overlay_play); 793 CONF_BIND_INT(223, conf_edge_overlay_pano); 794 CONF_BIND_INT(224, conf_edge_overlay_zoom); 795 CONF_BIND_INT(241, conf_edge_overlay_filter); 796 CONF_BIND_INT(242, conf_edge_overlay_show); 797 CONF_BIND_INT(243, conf_edge_overlay_pano_overlap); 798 CONF_BIND_COLOR( 28, conf_osd_color); 799 800 return 0; 801 } 802 803 804 805 //--------------------------------------------------------- 806 // PURPOSE: Finalize module operations (close allocs, etc) 807 // RETURN VALUE: 0-ok, 1-fail 808 //--------------------------------------------------------- 809 int _module_unloader() 810 { 811 // This could be happens only if on-load mistake 812 // CHDK never unload this library (but load only if needed) 813 // Reason: edve_overlay allocate different bufs which should be kept 814 // because even if we turn off edgeovr we could turn on back and 815 // should get same content. 816 return 0; 817 } 818 819 820 821 /*************** END OF AUXILARY PART *******************/ 822 -
branches/reyalp-flt/core/edgeoverlay.h
r928 r1467 9 9 #define EDGE_SAVE_DIR "A/CHDK/EDGE" 10 10 11 // Defines of exported to chdk symbols 12 #ifdef THIS_IS_CHDK_CORE 13 // This section is for CHDK core 14 extern void (*edge_overlay)(); 15 extern void (*save_edge_overlay)(void); 16 extern void (*load_edge_overlay)( const char* ); 17 #else 18 // This section is for module 11 19 void edge_overlay(); 12 20 void save_edge_overlay(void); 13 21 void load_edge_overlay( const char* ); 22 #endif 14 23 15 24 #endif -
branches/reyalp-flt/core/gui.c
r1459 r1467 50 50 #endif 51 51 #ifdef OPT_EDGEOVERLAY 52 #include " edgeoverlay.h"52 #include "modules.h" 53 53 #endif 54 54 #ifdef OPT_SCRIPTING … … 56 56 int script_params_has_changed=0; 57 57 #endif 58 #include "module_load.h" 59 58 60 //------------------------------------------------------------------- 59 61 … … 171 173 static void gui_debug_shortcut(void); 172 174 static void save_romlog(int arg); 175 static void gui_draw_modinspector(int arg); 173 176 #endif 174 177 static void gui_draw_fselect(int arg); … … 377 380 MENU_ITEM(0x5c,LANG_MENU_DEBUG_SHOW_MISC_VALS, MENUITEM_BOOL, &conf.debug_misc_vals_show, 0 ), 378 381 MENU_ITEM(0x2a,LANG_MENU_DEBUG_MEMORY_BROWSER, MENUITEM_PROC, gui_draw_debug, 0 ), 382 MENU_ITEM(0x2a,(int)"Module Inspector", MENUITEM_PROC, gui_draw_modinspector, 0 ), 379 383 MENU_ITEM(0x2a,LANG_MENU_DEBUG_BENCHMARK, MENUITEM_PROC, gui_draw_bench, 0 ), 380 384 MENU_ENUM2(0x5c,LANG_MENU_DEBUG_SHORTCUT_ACTION, &conf.debug_shortcut_action, gui_debug_shortcut_modes ), … … 1084 1088 gui_enum_value_change(&conf.curve_enable,change,sizeof(modes)/sizeof(modes[0])); 1085 1089 1086 if(change )1090 if(change && curve_init_mode) 1087 1091 curve_init_mode(); 1088 1092 return modes[conf.curve_enable]; … … 1137 1141 1138 1142 void gui_load_script(int arg) { 1139 gui_fselect_init(LANG_STR_SELECT_SCRIPT_FILE, conf.script_file, "A/CHDK/SCRIPTS", gui_load_script_selected);1143 module_fselect_init(LANG_STR_SELECT_SCRIPT_FILE, conf.script_file, "A/CHDK/SCRIPTS", gui_load_script_selected); 1140 1144 } 1141 1145 … … 1516 1520 void gui_raw_develop(int arg){ 1517 1521 int m=mode_get(); 1518 gui_fselect_init(LANG_RAW_DEVELOP_SELECT_FILE, "A/DCIM", "A", raw_fselect_cb);1522 module_fselect_init(LANG_RAW_DEVELOP_SELECT_FILE, "A/DCIM", "A", raw_fselect_cb); 1519 1523 } 1520 1524 … … 1629 1633 1630 1634 //------------------------------------------------------------------- 1631 static volatile enum Gui_Mode gui_mode; 1635 static volatile gui_mode_t gui_mode; // current gui mode. if <GUI_MODE_LASTIDX - idx in guiHandlers (core modes), otherwise pointer to gui_handler object (module modes) 1636 1632 1637 static volatile int gui_restore; 1633 1638 static volatile int gui_in_redraw; … … 1637 1642 static Conf old_conf; 1638 1643 #endif 1644 1645 extern gui_handler guiHandlers[]; 1639 1646 1640 1647 //------------------------------------------------------------------- … … 1659 1666 #ifdef OPT_CURVES 1660 1667 // initialize curves, loading files if required by current mode 1661 curve_init_mode();1668 //curve_init_mode(); // @tsv it will be initialize on first load 1662 1669 #endif 1663 1670 #if ZOOM_OVERRIDE … … 1673 1680 // TODO we could sanity check here, but curve_set_type should fail gracefullish 1674 1681 strcpy(conf.curve_file,fn); 1675 if(conf.curve_enable == 1 )1682 if(conf.curve_enable == 1 && curve_init_mode) 1676 1683 curve_init_mode(); 1677 1684 } … … 1680 1687 //------------------------------------------------------------------- 1681 1688 void gui_load_curve(int arg) { 1682 gui_fselect_init(LANG_STR_SELECT_CURVE_FILE, conf.curve_file, CURVE_DIR, gui_load_curve_selected);1683 } 1684 1685 #endif 1686 //------------------------------------------------------------------- 1687 enum Gui_Modegui_get_mode() {1689 module_fselect_init(LANG_STR_SELECT_CURVE_FILE, conf.curve_file, CURVE_DIR, gui_load_curve_selected); 1690 } 1691 1692 #endif 1693 //------------------------------------------------------------------- 1694 gui_mode_t gui_get_mode() { 1688 1695 return gui_mode; 1689 1696 } 1690 1697 1691 1698 //------------------------------------------------------------------- 1692 void gui_set_mode(enum Gui_Mode mode) { 1699 void gui_set_mode(gui_mode_t mode) 1700 { 1701 // Sanity check for case module pointer - is this really gui_handler 1702 if ( mode >= GUI_MODE_COUNT && ((gui_handler*)mode)->magicnum != GUI_MODE_MAGICNUM ) { 1703 // If sanity failed (module is unload) - set to default mode 1704 gui_mode = GUI_MODE_NONE; 1705 draw_restore(); 1706 return; 1707 } 1708 1693 1709 #ifdef CAM_TOUCHSCREEN_UI 1694 1710 if (((gui_mode == 0) != (mode == 0)) || // Change from GUI_MODE_NONE to any other or vice-versa … … 1960 1976 } 1961 1977 1962 // Menu button handled for text reader1963 #ifdef OPT_TEXTREADER1964 void gui_read_kbd_process_menu_btn()1965 {1966 gui_read_kbd_process();1967 gui_default_kbd_process_menu_btn();1968 }1969 #endif1970 1971 1978 // Menu button handled for Menu mode 1972 1979 void gui_menu_kbd_process_menu_btn() … … 1987 1994 1988 1995 //------------------------------------------------------------------- 1989 // Structure to store gui redraw and kbd process handlers for each mode1990 typedef struct1991 {1992 void (*redraw)(void); // Called to redraw screen1993 void (*kbd_process)(void); // Main button handler for mode1994 void (*kbd_process_menu_btn)(void); // Menu button handler for mode1995 } gui_handler;1996 1997 1996 // GUI handler table (entries must be in the same order and have the same number of entries as Gui_Mode enum) 1998 1997 gui_handler guiHandlers[] = 1999 1998 { 2000 /*GUI_MODE_NONE*/ { gui_draw_osd, 0, 0 }, 2001 /*GUI_MODE_ALT*/ { gui_chdk_draw, gui_chdk_kbd_process, gui_chdk_kbd_process_menu_btn }, 2002 /*GUI_MODE_MENU*/ { gui_menu_draw, gui_menu_kbd_process, gui_menu_kbd_process_menu_btn }, 2003 /*GUI_MODE_PALETTE*/ { gui_palette_draw, gui_palette_kbd_process, gui_default_kbd_process_menu_btn }, 2004 /*GUI_MODE_MBOX*/ { gui_mbox_draw, gui_mbox_kbd_process, 0 }, 2005 #ifdef OPT_GAME_REVERSI 2006 /*GUI_MODE_REVERSI*/ { gui_reversi_draw, gui_reversi_kbd_process, gui_default_kbd_process_menu_btn }, 2007 #else 2008 { 0, 0, 0 }, 2009 #endif 2010 #ifdef OPT_GAME_SOKOBAN 2011 /*GUI_MODE_SOKOBAN*/ { gui_sokoban_draw, gui_sokoban_kbd_process, gui_default_kbd_process_menu_btn }, 2012 #else 2013 { 0, 0, 0 }, 2014 #endif 2015 #ifdef OPT_DEBUGGING 2016 /*GUI_MODE_DEBUG*/ { gui_debug_draw, gui_debug_kbd_process, gui_default_kbd_process_menu_btn }, 2017 #else 2018 { 0, 0, 0 }, 2019 #endif 2020 /*GUI_MODE_FSELECT*/ { gui_fselect_draw, gui_fselect_kbd_process, gui_fselect_kbd_process }, 2021 #ifdef OPT_TEXTREADER 2022 /*GUI_MODE_READ*/ { gui_read_draw, gui_read_kbd_process, gui_read_kbd_process_menu_btn }, 2023 #else 2024 { 0, 0, 0 }, 2025 #endif 2026 /*GUI_MODE_OSD*/ { gui_osd_draw, gui_osd_kbd_process, gui_default_kbd_process_menu_btn }, 2027 #ifdef OPT_CALENDAR 2028 /*GUI_MODE_CALENDAR*/ { gui_calendar_draw, gui_calendar_kbd_process, gui_default_kbd_process_menu_btn }, 2029 #else 2030 { 0, 0, 0 }, 2031 #endif 2032 #ifdef OPT_DEBUGGING 2033 /*GUI_MODE_BENCH*/ { gui_bench_draw, gui_bench_kbd_process, gui_default_kbd_process_menu_btn }, 2034 #else 2035 { 0, 0, 0 }, 2036 #endif 2037 /*GUI_MODE_MPOPUP*/ { gui_mpopup_draw, gui_mpopup_kbd_process, gui_mpopup_kbd_process }, 2038 #ifdef OPT_GAME_CONNECT4 2039 /*GUI_MODE_4WINS*/ { gui_4wins_draw, gui_4wins_kbd_process, gui_default_kbd_process_menu_btn }, 2040 #else 2041 { 0, 0, 0 }, 2042 #endif 2043 #ifdef OPT_GAME_MASTERMIND 2044 /*GUI_MODE_MASTERMIND*/ { gui_mastermind_draw, gui_mastermind_kbd_process, gui_default_kbd_process_menu_btn }, 2045 #else 2046 { 0, 0, 0 }, 2047 #endif 1999 /*GUI_MODE_NONE*/ { gui_draw_osd, 0, 0, 0, GUI_MODE_MAGICNUM }, 2000 /*GUI_MODE_ALT*/ { gui_chdk_draw, gui_chdk_kbd_process, gui_chdk_kbd_process_menu_btn, 0, GUI_MODE_MAGICNUM }, 2001 /*GUI_MODE_MENU*/ { gui_menu_draw, gui_menu_kbd_process, gui_menu_kbd_process_menu_btn, 0, GUI_MODE_MAGICNUM }, 2002 /*GUI_MODE_MBOX*/ { gui_mbox_draw, gui_mbox_kbd_process, 0, GUI_MODE_FLAG_NORESTORE_ON_SWITCH, GUI_MODE_MAGICNUM }, 2003 /*GUI_MODE_OSD*/ { gui_osd_draw, gui_osd_kbd_process, gui_default_kbd_process_menu_btn, 0, GUI_MODE_MAGICNUM }, // THIS IS OSD LAYOUT EDITOR 2048 2004 }; 2049 2005 … … 2052 2008 void gui_redraw() 2053 2009 { 2054 enum Gui_Mode gui_mode_old; 2010 static gui_mode_t gui_mode_prev_tick = GUI_MODE_NONE; 2011 gui_mode_t gui_mode_old; 2012 2013 static int flag_gui_enforce_redraw = 0; 2055 2014 2056 2015 #ifdef CAM_DETECT_SCREEN_ERASE … … 2058 2017 { 2059 2018 draw_set_guard(); 2060 gui_menu_force_redraw(); 2061 gui_fselect_force_redraw(); 2019 2020 flag_gui_enforce_redraw |= GUI_REDRAWFLAG_ERASEGUARD; 2021 //gui_menu_force_redraw(); 2022 //gui_fselect_force_redraw(); //@tsv 2062 2023 #ifdef CAM_TOUCHSCREEN_UI 2063 2024 extern int redraw_buttons; … … 2078 2039 2079 2040 // Call redraw handler 2080 if (guiHandlers[gui_mode].redraw) guiHandlers[gui_mode].redraw(); 2041 gui_handler* cur_gui_handler = (gui_mode<GUI_MODE_COUNT)? (&guiHandlers[gui_mode]) : (gui_handler*)gui_mode; 2042 if (cur_gui_handler->redraw) cur_gui_handler->redraw(flag_gui_enforce_redraw); 2043 flag_gui_enforce_redraw=0; 2081 2044 2082 2045 // Forced redraw if needed 2083 2046 gui_in_redraw = 0; 2084 if ((gui_mode_old != gui_mode && (gui_mode_old != GUI_MODE_NONE && gui_mode_old != GUI_MODE_ALT) && (gui_mode != GUI_MODE_MBOX && gui_mode != GUI_MODE_MPOPUP)) || gui_restore) { 2085 if (gui_restore) gui_menu_force_redraw(); 2047 cur_gui_handler = (gui_mode<GUI_MODE_COUNT)? (&guiHandlers[gui_mode]) : (gui_handler*)gui_mode; 2048 if ((gui_mode_old != gui_mode 2049 && (gui_mode_old != GUI_MODE_NONE && gui_mode_old != GUI_MODE_ALT) 2050 && !(cur_gui_handler->flags & GUI_MODE_FLAG_NORESTORE_ON_SWITCH)) 2051 || gui_restore ) 2052 { 2053 2054 if (gui_restore) 2055 flag_gui_enforce_redraw |= GUI_REDRAWFLAG_DRAW_RESTORED; 2086 2056 gui_restore = 0; 2087 if (gui_mode != GUI_MODE_REVERSI && gui_mode != GUI_MODE_SOKOBAN && gui_mode != GUI_MODE_4WINS && gui_mode != GUI_MODE_MASTERMIND) 2057 2058 if ( !( cur_gui_handler->flags & GUI_MODE_FLAG_NODRAWRESTORE) ) 2088 2059 draw_restore(); 2089 2060 } 2061 2062 if ( gui_mode_prev_tick != gui_mode ) { 2063 flag_gui_enforce_redraw |= GUI_REDRAWFLAG_MODE_WAS_CHANGED; 2064 gui_mode_prev_tick = gui_mode; 2065 } 2090 2066 } 2091 2067 … … 2094 2070 void gui_kbd_process() 2095 2071 { 2072 gui_handler* cur_gui_handler = (gui_mode<GUI_MODE_COUNT)? (&guiHandlers[gui_mode]) : (gui_handler*)gui_mode; 2073 2096 2074 // Call menu button handler if menu button pressed 2097 2075 if (kbd_is_key_clicked(KEY_MENU)) 2098 2076 { 2099 if ( guiHandlers[gui_mode].kbd_process_menu_btn) guiHandlers[gui_mode].kbd_process_menu_btn();2077 if (cur_gui_handler->kbd_process_menu_btn) cur_gui_handler->kbd_process_menu_btn(); 2100 2078 return; 2101 2079 } 2102 2080 2103 2081 // Call mode handler for other buttons 2104 if ( guiHandlers[gui_mode].kbd_process) guiHandlers[gui_mode].kbd_process();2082 if (cur_gui_handler->kbd_process) cur_gui_handler->kbd_process(); 2105 2083 } 2106 2084 … … 2142 2120 #endif 2143 2121 draw_restore(); 2144 if (gui_mode == GUI_MODE_READ && !rbf_load(conf.menu_rbf_file))2145 rbf_load_from_8x16(current_font);2146 2122 rbf_set_codepage(FONT_CP_WIN); 2147 2123 vid_turn_on_updates(); 2148 2124 gui_set_mode(GUI_MODE_NONE); 2125 2126 // Unload all modules which are marked as safe to unload 2127 module_async_unload_allrunned(0); 2149 2128 2150 2129 conf_update_prevent_shutdown(); … … 2561 2540 //------------------------------------------------------------------- 2562 2541 void gui_draw_palette(int arg) { 2563 draw_restore(); 2564 gui_palette_init(PALETTE_MODE_DEFAULT, 0x00, NULL); 2565 gui_set_mode(GUI_MODE_PALETTE); 2542 module_palette_run(PALETTE_MODE_DEFAULT, 0x00, NULL); 2566 2543 } 2567 2544 … … 2600 2577 } 2601 2578 2602 gui_set_mode(GUI_MODE_REVERSI); 2603 gui_reversi_init(); 2579 module_run("reversi.flt", 0, 0,0, UNLOAD_IF_ERR); 2604 2580 } 2605 2581 #endif … … 2613 2589 return; 2614 2590 } 2615 if ( gui_sokoban_init() ) 2616 gui_set_mode(GUI_MODE_SOKOBAN);2591 2592 module_run("sokoban.flt", 0, 0,0, UNLOAD_IF_ERR); 2617 2593 } 2618 2594 #endif … … 2625 2601 return; 2626 2602 } 2627 if ( gui_4wins_init() ) 2628 gui_set_mode(GUI_MODE_4WINS);2603 2604 module_run("4wins.flt", 0, 0,0, UNLOAD_IF_ERR); 2629 2605 } 2630 2606 #endif … … 2637 2613 return; 2638 2614 } 2639 if ( gui_mastermind_init() ) 2640 gui_set_mode(GUI_MODE_MASTERMIND); 2615 module_run("mastmind.flt", 0, 0,0, UNLOAD_IF_ERR); 2641 2616 } 2642 2617 #endif … … 2648 2623 // gui_debug_init(0x7F5B8); 2649 2624 // gui_debug_init(malloc(16)); 2650 gui_debug_init((void*)conf.mem_view_addr_init); 2625 // gui_debug_init((void*)conf.mem_view_addr_init); 2626 2627 unsigned int argv[] ={ (unsigned int)conf.mem_view_addr_init }; 2628 module_run("memview.flt", 0, 1,argv, UNLOAD_IF_ERR); 2629 } 2630 2631 void gui_draw_modinspector(int arg) { 2632 module_run("modinsp.flt", 0, 0,0, UNLOAD_IF_ERR); 2651 2633 } 2652 2634 2653 2635 //------------------------------------------------------------------- 2654 2636 void gui_draw_bench(int arg) { 2655 gui_set_mode(GUI_MODE_BENCH); 2656 gui_bench_init(); 2637 module_run("benchm.flt", 0, 0,0, UNLOAD_IF_ERR); 2657 2638 } 2658 2639 #endif … … 2717 2698 //------------------------------------------------------------------- 2718 2699 void gui_draw_fselect(int arg) { 2719 gui_fselect_init(LANG_STR_FILE_BROWSER, "A", "A", NULL);2700 module_fselect_init(LANG_STR_FILE_BROWSER, "A", "A", NULL); 2720 2701 } 2721 2702 … … 2726 2707 } 2727 2708 void gui_grid_lines_load(int arg) { 2728 gui_fselect_init(LANG_STR_SELECT_GRID_FILE, conf.grid_lines_file, "A/CHDK/GRIDS", gui_grid_lines_load_selected);2709 module_fselect_init(LANG_STR_SELECT_GRID_FILE, conf.grid_lines_file, "A/CHDK/GRIDS", gui_grid_lines_load_selected); 2729 2710 } 2730 2711 … … 2742 2723 rbf_load_from_8x16(current_font); 2743 2724 rbf_set_codepage(conf.reader_codepage); 2744 gui_set_mode(GUI_MODE_READ); 2745 gui_read_init(fn); 2725 2726 unsigned int argv[] ={ (unsigned int)fn }; 2727 module_run("txtread.flt", 0, sizeof(argv)/sizeof(argv[0]), argv, UNLOAD_IF_ERR); 2746 2728 } 2747 2729 } 2748 2730 2749 2731 void gui_draw_read(int arg) { 2750 gui_fselect_init(LANG_STR_SELECT_TEXT_FILE, conf.reader_file, "A/CHDK/BOOKS", gui_draw_read_selected);2732 module_fselect_init_w_mode(LANG_STR_SELECT_TEXT_FILE, conf.reader_file, "A/CHDK/BOOKS", gui_draw_read_selected, 1); 2751 2733 void gui_fselect_set_key_redraw(int n); 2752 gui_fselect_set_key_redraw(1);2734 //gui_fselect_set_key_redraw(1); @tsv 2753 2735 } 2754 2736 … … 2771 2753 #ifdef OPT_EDGEOVERLAY 2772 2754 static void gui_load_edge_selected( const char* fn ) { 2773 if( fn )2774 load_edge_overlay(fn);2755 if( fn && module_edgeovr_load()) 2756 load_edge_overlay(fn); 2775 2757 } 2776 2758 2777 2759 void gui_menuproc_edge_save(int arg) { 2778 save_edge_overlay(); 2760 if ( module_edgeovr_load() ) 2761 save_edge_overlay(); 2779 2762 } 2780 2763 2781 2764 void gui_menuproc_edge_load(int arg) { 2782 gui_fselect_init(LANG_MENU_EDGE_LOAD, EDGE_SAVE_DIR, EDGE_SAVE_DIR, gui_load_edge_selected);2765 module_fselect_init(LANG_MENU_EDGE_LOAD, EDGE_SAVE_DIR, EDGE_SAVE_DIR, gui_load_edge_selected); 2783 2766 } 2784 2767 #endif … … 2787 2770 #ifdef OPT_CALENDAR 2788 2771 void gui_draw_calendar(int arg) { 2789 gui_set_mode(GUI_MODE_CALENDAR); 2790 gui_calendar_init(); 2772 module_run("calend.flt", 0, 0,0, UNLOAD_IF_ERR); 2791 2773 } 2792 2774 #endif … … 2799 2781 } 2800 2782 void gui_draw_load_rbf(int arg) { 2801 gui_fselect_init(LANG_STR_SELECT_FONT_FILE, conf.reader_rbf_file, "A/CHDK/FONTS", gui_draw_rbf_selected);2783 module_fselect_init(LANG_STR_SELECT_FONT_FILE, conf.reader_rbf_file, "A/CHDK/FONTS", gui_draw_rbf_selected); 2802 2784 } 2803 2785 #endif … … 2813 2795 } 2814 2796 void gui_draw_load_menu_rbf(int arg) { 2815 gui_fselect_init(LANG_STR_SELECT_FONT_FILE, conf.menu_rbf_file, "A/CHDK/FONTS", gui_draw_menu_rbf_selected);2797 module_fselect_init(LANG_STR_SELECT_FONT_FILE, conf.menu_rbf_file, "A/CHDK/FONTS", gui_draw_menu_rbf_selected); 2816 2798 } 2817 2799 … … 2825 2807 } 2826 2808 void gui_draw_load_symbol_rbf(int arg) { 2827 gui_fselect_init(LANG_STR_SELECT_SYMBOL_FILE, conf.menu_symbol_rbf_file, "A/CHDK/SYMBOLS", gui_draw_symbol_rbf_selected);2809 module_fselect_init(LANG_STR_SELECT_SYMBOL_FILE, conf.menu_symbol_rbf_file, "A/CHDK/SYMBOLS", gui_draw_symbol_rbf_selected); 2828 2810 } 2829 2811 … … 2837 2819 } 2838 2820 void gui_draw_load_lang(int arg) { 2839 gui_fselect_init(LANG_STR_SELECT_LANG_FILE, conf.lang_file, "A/CHDK/LANG", gui_draw_lang_selected);2821 module_fselect_init(LANG_STR_SELECT_LANG_FILE, conf.lang_file, "A/CHDK/LANG", gui_draw_lang_selected); 2840 2822 } 2841 2823 -
branches/reyalp-flt/core/gui_4wins.c
r1338 r1467 13 13 #include "gui_mbox.h" 14 14 #include "gui_4wins.h" 15 16 #include "module_load.h" 17 void gui_module_menu_kbd_process(); 18 19 gui_handler GUI_MODE_4WINS = 20 /*GUI_MODE_4WINS*/ { gui_4wins_draw, gui_4wins_kbd_process, gui_module_menu_kbd_process, GUI_MODE_FLAG_NODRAWRESTORE, GUI_MODE_MAGICNUM }; 21 15 22 16 23 #define BORDER 20 … … 331 338 draw_mode(); 332 339 if(cur_player==2&&!mode_rival) set(); 340 341 gui_set_mode((unsigned int)&GUI_MODE_4WINS); 342 333 343 return 1; 334 344 } 345 346 int basic_module_init() { 347 return gui_4wins_init(); 348 } 349 335 350 //------------------------------------------------------------------- 336 351 void gui_4wins_kbd_process() … … 352 367 } 353 368 //------------------------------------------------------------------- 354 void gui_4wins_draw( ) {369 void gui_4wins_draw(int enforce_redraw) { 355 370 static char str[16]; 356 371 sprintf(str, "%3d%%", get_batt_perc()); … … 358 373 gui_osd_draw_clock(CAM_TS_BUTTON_BORDER+290,208,INFO_TEXT_COLOR); 359 374 } 375 376 extern int module_idx; 377 void gui_module_menu_kbd_process() { 378 gui_default_kbd_process_menu_btn(); 379 module_async_unload(module_idx); 380 } -
branches/reyalp-flt/core/gui_4wins.h
r600 r1467 5 5 extern int gui_4wins_init(); 6 6 extern void gui_4wins_kbd_process(); 7 extern void gui_4wins_draw( );7 extern void gui_4wins_draw(int enforce_redraw); 8 8 9 9 //------------------------------------------------------------------- -
branches/reyalp-flt/core/gui_bench.c
r1024 r1467 8 8 #include "gui_draw.h" 9 9 #include "gui_bench.h" 10 11 #include "module_load.h" 12 void gui_bench_draw_callback(int enforce_redraw); 13 void gui_bench_menu_kbd_process(); 14 15 gui_handler GUI_MODE_BENCH = 16 /*GUI_MODE_BENCH*/ { gui_bench_draw_callback, gui_bench_kbd_process, gui_bench_menu_kbd_process, 0, GUI_MODE_MAGICNUM }; 17 10 18 11 19 //------------------------------------------------------------------- … … 99 107 } 100 108 } 109 110 void gui_bench_draw_callback(int enforce_redraw) { 111 gui_bench_draw(); 112 } 113 101 114 102 115 //------------------------------------------------------------------- … … 229 242 //------------------------------------------------------------------- 230 243 244 int basic_module_init() { 245 gui_bench_init(); 246 gui_set_mode( (unsigned int)&GUI_MODE_BENCH ); 247 return 1; 248 } 249 250 extern int module_idx; 251 252 void gui_bench_menu_kbd_process() { 253 gui_default_kbd_process_menu_btn(); 254 module_async_unload(module_idx); 255 } -
branches/reyalp-flt/core/gui_calendar.c
r1338 r1467 9 9 #include "gui_lang.h" 10 10 #include "gui_calendar.h" 11 12 #include "module_load.h" 13 void gui_calendar_menu_kbd_process(); 14 15 gui_handler GUI_MODE_CALENDAR = 16 /*GUI_MODE_CALENDAR*/ { gui_calendar_draw, gui_calendar_kbd_process, gui_calendar_menu_kbd_process, 0, GUI_MODE_MAGICNUM }; 11 17 12 18 //------------------------------------------------------------------- … … 75 81 76 82 //------------------------------------------------------------------- 77 void gui_calendar_init() { 83 int basic_module_init() { 84 85 gui_set_mode( (unsigned int)&GUI_MODE_CALENDAR ); 86 78 87 calendar_goto_today(); 79 88 cal_w = FONT_WIDTH*4*7; … … 83 92 gui_calendar_initial_draw(); 84 93 need_redraw = 1; 94 return 1; 85 95 } 86 96 … … 122 132 123 133 //------------------------------------------------------------------- 124 void gui_calendar_draw( ) {134 void gui_calendar_draw(int enforce_redraw) { 125 135 int x, y; 126 136 static char str[32]; … … 173 183 } 174 184 185 extern int module_idx; 186 187 void gui_calendar_menu_kbd_process() { 188 gui_default_kbd_process_menu_btn(); 189 module_async_unload(module_idx); 190 } -
branches/reyalp-flt/core/gui_calendar.h
r515 r1467 5 5 extern void gui_calendar_init(); 6 6 extern void gui_calendar_kbd_process(); 7 extern void gui_calendar_draw( );7 extern void gui_calendar_draw(int enforce_redraw); 8 8 9 9 //------------------------------------------------------------------- -
branches/reyalp-flt/core/gui_debug.c
r1024 r1467 8 8 #include "conf.h" 9 9 10 #include "module_load.h" 11 12 extern void gui_module_menu_kbd_process(); 13 int *conf_mem_view_addr_init; 14 15 gui_handler GUI_MODE_DEBUG = 16 /*GUI_MODE_DEBUG*/ { gui_debug_draw, gui_debug_kbd_process, gui_module_menu_kbd_process, 0, GUI_MODE_MAGICNUM }; 10 17 11 18 //------------------------------------------------------------------- … … 23 30 debug_cont_update = 1; 24 31 step = 4; 25 gui_set_mode( GUI_MODE_DEBUG);32 gui_set_mode((unsigned int)&GUI_MODE_DEBUG); 26 33 } 27 34 … … 56 63 57 64 //------------------------------------------------------------------- 58 void gui_debug_draw( ) {65 void gui_debug_draw(int enforce_redraw) { 59 66 switch (debug_to_draw) { 60 67 case 1: … … 87 94 gui_debug_draw_values(2, addr); 88 95 gui_debug_draw_values(8, *((void**)addr)); 89 conf.mem_view_addr_init = (long)addr;96 *conf_mem_view_addr_init = (long)addr; 90 97 91 98 if (debug_cont_update==0) debug_to_draw = 0; … … 142 149 143 150 //------------------------------------------------------------------- 151 152 extern int module_idx; 153 void gui_module_menu_kbd_process() { 154 gui_default_kbd_process_menu_btn(); 155 module_async_unload(module_idx); 156 } 157 158 159 // ========= MODULE INIT ================= 160 #include "module_load.h" 161 int module_idx=-1; 162 163 /***************** BEGIN OF AUXILARY PART ********************* 164 ATTENTION: DO NOT REMOVE OR CHANGE SIGNATURES IN THIS SECTION 165 **************************************************************/ 166 167 int _chdk_required_ver = 1; // minimal required chdk build. 0-no limitation 168 int _chdk_required_platfid = 0; // platform-specific module. 0-no limitation 169 170 void* MODULE_EXPORT_LIST[] = { 171 /* 0 */ (void*)EXPORTLIST_MAGIC_NUMBER, 172 /* 1 */ (void*)0 173 }; 174 175 176 //--------------------------------------------------------- 177 // PURPOSE: Bind module symbols with chdk. 178 // Required function 179 // PARAMETERS: pointer to chdk list of export 180 // RETURN VALUE: 1 error, 0 ok 181 //--------------------------------------------------------- 182 int _module_loader( void** chdk_export_list ) 183 { 184 if ( (unsigned int)chdk_export_list[0] != EXPORTLIST_MAGIC_NUMBER ) 185 return 1; 186 187 tConfigVal configVal; 188 CONF_BIND_INT(195, conf_mem_view_addr_init); 189 190 return 0; 191 } 192 193 194 195 //--------------------------------------------------------- 196 // PURPOSE: Finalize module operations (close allocs, etc) 197 // RETURN VALUE: 0-ok, 1-fail 198 //--------------------------------------------------------- 199 int _module_unloader() 200 { 201 return 0; 202 } 203 204 205 //--------------------------------------------------------- 206 // PURPOSE: Default action for simple modules (direct run) 207 // NOTE: Please comment this function if no default action and this library module 208 //--------------------------------------------------------- 209 int _module_run(int moduleidx, int argn, int* arguments) 210 { 211 module_idx=moduleidx; 212 213 if ( argn!=1) { 214 module_async_unload(moduleidx); 215 return 1; 216 } 217 218 void* adr=(char*)arguments[0]; 219 gui_debug_init(adr); 220 221 return 0; 222 } 223 224 225 /*************** END OF AUXILARY PART *******************/ -
branches/reyalp-flt/core/gui_debug.h
r515 r1467 6 6 extern void gui_debug_init(void* st_addr); 7 7 extern void gui_debug_kbd_process(); 8 extern void gui_debug_draw( );8 extern void gui_debug_draw(int enforce_redraw); 9 9 10 10 //------------------------------------------------------------------- -
branches/reyalp-flt/core/gui_draw.c
r1365 r1467 303 303 } 304 304 305 // Restore CANON_OSD 305 306 //------------------------------------------------------------------- 306 307 void draw_restore() { -
branches/reyalp-flt/core/gui_draw.h
r1414 r1467 3 3 4 4 #include "camera.h" // ensure the camera defintion is loaded 5 6 #include "gui.h" // for color, coord definitions 5 7 6 8 //------------------------------------------------------------------- -
branches/reyalp-flt/core/gui_fselect.c
r1423 r1467 10 10 #include "gui_mpopup.h" 11 11 #include "gui_fselect.h" 12 #include " raw_merge.h"12 #include "modules.h" 13 13 #include "raw.h" 14 14 #include "conf.h" 15 15 #include "dng.h" 16 17 #include "module_load.h" 18 19 gui_handler GUI_MODE_FSELECT = 20 /*GUI_MODE_FSELECT*/ { gui_fselect_draw, gui_fselect_kbd_process, gui_fselect_kbd_process, 0, GUI_MODE_MAGICNUM }; 21 22 extern int module_idx; 23 24 int *conf_sub_batch_prefix; 25 int *conf_sub_batch_ext; 26 27 struct librawop_sym* librawop_p; 28 16 29 17 30 //------------------------------------------------------------------- … … 47 60 static char selected_file[100]; // This full path to current file. So it is return value 48 61 static char buf[100]; 49 static enum Gui_Modegui_fselect_mode_old; // stored previous gui_mode62 static gui_mode_t gui_fselect_mode_old; // stored previous gui_mode 50 63 51 64 // basic element of file list … … 82 95 static int set_key_redraw_mode; // dirty hack: screen erase & mode restore done after(0) or before(1) call to fselect_on_select 83 96 97 // FSelector POPUP 98 #define MPOPUP_CUT 0x0001 99 #define MPOPUP_COPY 0x0002 100 #define MPOPUP_PASTE 0x0004 101 #define MPOPUP_DELETE 0x0008 102 #define MPOPUP_SELINV 0x0010 103 #define MPOPUP_RAW_ADD 0x0020 104 #define MPOPUP_RAW_AVERAGE 0x0040 105 #define MPOPUP_PURGE 0x0080 106 #define MPOPUP_SUBTRACT 0x0100 107 #define MPOPUP_RAW_DEVELOP 0x0200 108 #define MPOPUP_DNG_TO_CRW 0x0400 109 #define MPOPUP_EDITOR 0x0800 110 #define MPOPUP_CHDK_REPLACE 0x1000 111 112 static struct mpopup_item popup[]= { 113 { MPOPUP_CUT, LANG_POPUP_CUT }, 114 { MPOPUP_COPY, LANG_POPUP_COPY }, 115 { MPOPUP_PASTE, LANG_POPUP_PASTE }, 116 { MPOPUP_DELETE, LANG_POPUP_DELETE }, 117 { MPOPUP_SELINV, LANG_POPUP_SELINV }, 118 { MPOPUP_RAW_ADD, LANG_POPUP_RAW_SUM}, 119 { MPOPUP_RAW_AVERAGE, LANG_POPUP_RAW_AVERAGE }, 120 { MPOPUP_RAW_DEVELOP, LANG_MENU_RAW_DEVELOP }, 121 { MPOPUP_PURGE, LANG_POPUP_PURGE }, 122 { MPOPUP_SUBTRACT, LANG_POPUP_SUB_FROM_MARKED }, 123 { MPOPUP_DNG_TO_CRW, (int)"DNG -> CHDK RAW"}, 124 { MPOPUP_EDITOR, (int)"Edit" }, 125 { MPOPUP_CHDK_REPLACE, (int)"Set this CHDK" }, 126 { 0, 0 }, 127 }; 128 84 129 //------------------------------------------------------------------- 85 130 static void fselect_goto_prev(int step) { … … 117 162 selected = top; 118 163 } 119 }120 }121 122 //-------------------------------------------------------------------123 // Called from other gui functions to force redraw of menu124 void gui_fselect_force_redraw()125 {126 if (gui_get_mode() == GUI_MODE_FSELECT)127 {128 gui_fselect_redraw = 2;129 164 } 130 165 } … … 305 340 306 341 //------------------------------------------------------------------- 307 void gui_fselect_init(int title, const char* prev_dir, const char* default_dir, void (*on_select)(const char *fn)) { 342 void gui_fselect_init(int title, const char* prev_dir, const char* default_dir, void (*on_select)(const char *fn)) 343 { 308 344 int i; 309 345 … … 354 390 gui_fselect_mode_old = gui_get_mode(); 355 391 gui_fselect_redraw = 2; 356 gui_set_mode( GUI_MODE_FSELECT);392 gui_set_mode((unsigned int)&GUI_MODE_FSELECT); 357 393 gui_fselect_set_key_redraw(0); 358 394 } … … 381 417 382 418 //------------------------------------------------------------------- 383 void gui_fselect_draw( ) {419 void gui_fselect_draw(int enforce_redraw) { 384 420 int i, j, off_name_x, off_size_x, off_time_x, off_body_x, off_body_y; 385 421 struct fitem *ptr; … … 389 425 color cl_markered = ((mode_get()&MODE_MASK) == MODE_REC)?COLOR_YELLOW:0x66; 390 426 color cl_marked, cl_selected; 427 428 if ( enforce_redraw ) 429 gui_fselect_redraw = 2; 391 430 392 431 if (gui_fselect_redraw) { … … 874 913 875 914 //------------------------------------------------------------------- 915 static void fselect_chdk_replace_cb(unsigned int btn) { 916 int ss, sd = 0, fsrc, fdst, i=0; 917 register int *buf; 918 unsigned char fend; 919 static struct utimbuf t; 920 921 if (btn != MBOX_BTN_YES) return; 922 923 buf = umalloc(MARKED_BUF_SIZE); 924 sprintf(selected_file, "%s/%s", current_dir, selected->name); 925 fsrc = open(selected_file, O_RDONLY, 0777); 926 if (fsrc>=0) { 927 strcpy(selected_file,"A/DISKBOOT.BIN"); 928 fdst = open(selected_file, O_WRONLY|O_CREAT|O_TRUNC, 0777); 929 if (fdst>=0) { 930 do { 931 ss=read(fsrc, buf, MARKED_BUF_SIZE); 932 if (ss>0) sd=write(fdst, buf, ss); 933 } while (ss>0 && ss==sd); 934 close(fdst); 935 t.actime = t.modtime = selected->mtime; 936 utime(selected_file, &t); 937 //shutdown(); 938 gui_browser_progress_show("Please reboot",100); 939 } 940 if (fsrc>=0) close(fsrc); 941 } 942 ufree(buf); 943 } 944 945 //------------------------------------------------------------------- 876 946 static void fselect_marked_inverse_selection() { 877 947 struct fitem *ptr; … … 887 957 void process_raw_files(void){ 888 958 struct fitem *ptr; 889 if ((fselect_marked_count()>1) && raw_merge_start(raw_operation)) { 959 960 librawop_p=module_rawop_load(); 961 if (!librawop_p) 962 return; //exit if fail 963 964 if ((fselect_marked_count()>1) && librawop_p->raw_merge_start(raw_operation)) { 890 965 for (ptr=head; ptr; ptr=ptr->next) 891 966 if (ptr->marked && ptr->attr != 0xFF && !(ptr->attr & DOS_ATTR_DIRECTORY)) { 892 967 sprintf(selected_file, "%s/%s", current_dir, ptr->name); 893 raw_merge_add_file(selected_file);968 librawop_p->raw_merge_add_file(selected_file); 894 969 } 895 raw_merge_end();970 librawop_p->raw_merge_end(); 896 971 gui_fselect_read_dir(current_dir); 897 972 } … … 904 979 char *raw_subtract_dest; 905 980 if (btn != MBOX_BTN_YES) return; 981 982 librawop_p=module_rawop_load(); 983 if (!librawop_p) 984 return; //exit if fail 906 985 907 986 if(!(raw_subtract_from = malloc(300))) //3x full path … … 916 995 (strcmp(ptr->name,selected->name)) != 0) { 917 996 sprintf(raw_subtract_from,"%s/%s",current_dir,ptr->name); 918 sprintf(raw_subtract_dest,"%s/%s%s",current_dir,img_prefixes[ conf.sub_batch_prefix],ptr->name+4);919 strcpy(raw_subtract_dest + strlen(raw_subtract_dest) - 4,img_exts[ conf.sub_batch_ext]);997 sprintf(raw_subtract_dest,"%s/%s%s",current_dir,img_prefixes[*conf_sub_batch_prefix],ptr->name+4); 998 strcpy(raw_subtract_dest + strlen(raw_subtract_dest) - 4,img_exts[*conf_sub_batch_ext]); 920 999 // don't let users attempt to write one of the files being read 921 1000 if( strcmp(raw_subtract_dest,raw_subtract_from) != 0 && strcmp(raw_subtract_dest,raw_subtract_sub) != 0) { 922 raw_subtract(raw_subtract_from,raw_subtract_sub,raw_subtract_dest);1001 librawop_p->raw_subtract(raw_subtract_from,raw_subtract_sub,raw_subtract_dest); 923 1002 } 924 1003 } … … 1047 1126 raw_prepare_develop(buf); 1048 1127 break; 1128 case MPOPUP_CHDK_REPLACE: 1129 gui_mbox_init((int)"Replacing CHDK", (int)"Do you want to replace current CHDK with this file", 1130 MBOX_TEXT_CENTER|MBOX_BTN_YES_NO|MBOX_DEF_BTN2, fselect_chdk_replace_cb); 1131 break; 1132 case MPOPUP_EDITOR: 1133 gui_mbox_init((int)"Editor", (int)"edit", MBOX_BTN_OK|MBOX_TEXT_CENTER, NULL); 1134 break; 1049 1135 case MPOPUP_SUBTRACT: 1050 1136 { … … 1062 1148 1063 1149 //------------------------------------------------------------------- 1064 static void exit_fselect(char* file)1150 void finalize_fselect() 1065 1151 { 1066 1152 gui_fselect_free_data(); 1067 1153 gui_fselect_marked_free_data(); 1154 module_rawop_unload(); 1155 } 1156 1157 static void exit_fselect(char* file) 1158 { 1159 /*DOPEN(0); 1160 DLOG_INT("gui_fselect_exit()\n",0); 1161 DCLOSE;*/ 1162 finalize_fselect(); 1163 1068 1164 if (set_key_redraw_mode) 1069 1165 { … … 1074 1170 { 1075 1171 fselect_on_select(file); 1172 // if called mode will return control to filemanager - we need to redraw it 1173 gui_fselect_redraw = 2; 1076 1174 } 1077 1175 if (!set_key_redraw_mode) … … 1144 1242 i |= MPOPUP_DNG_TO_CRW; 1145 1243 #endif 1146 gui_mpopup_init(i, fselect_mpopup_cb); 1244 1245 if (selected->name[9] == 'B' && selected->name[10] == 'I' && selected->name[11] == 'N') //If item is DCIM folder 1246 i |= MPOPUP_CHDK_REPLACE; 1247 1248 module_mpopup_init( popup, i, fselect_mpopup_cb, 0); 1147 1249 } 1148 1250 break; … … 1161 1263 } else { 1162 1264 sprintf(selected_file, "%s/%s", current_dir, selected->name); 1265 1266 char *ext = strchr(selected->name,'.'); 1267 if ( ext && (ext[1]|0x20)=='f' && (ext[2]|0x20)=='l' && (ext[3]|0x20)=='t') { 1268 if (!fselect_on_select) { 1269 1270 /* //This decrease visual lag before module start, but cost memory fragment 1271 flag_after=0; 1272 if ( module_find(name) < 0 ) { 1273 if ( !module_load( selected_file, 0 ) ) 1274 break; 1275 flag_after=2; 1276 } 1277 1278 */ 1279 1280 exit_fselect(0); 1281 module_run(selected_file, 0, 0,0, UNLOAD_IF_ERR); 1282 1283 break; 1284 } 1285 } 1286 1163 1287 exit_fselect(selected_file); 1288 module_async_unload(module_idx); 1164 1289 } 1165 1290 } … … 1184 1309 // just free resource. callback called with NULL ptr 1185 1310 exit_fselect(0); 1186 break; 1187 } 1188 } 1189 1190 //------------------------------------------------------------------- 1311 module_async_unload(module_idx); 1312 break; 1313 } 1314 } 1315 1316 1317 1318 // ========= MODULE INIT ================= 1319 #include "module_load.h" 1320 int module_idx=-1; 1321 1322 /***************** BEGIN OF AUXILARY PART ********************* 1323 ATTENTION: DO NOT REMOVE OR CHANGE SIGNATURES IN THIS SECTION 1324 **************************************************************/ 1325 1326 int _chdk_required_ver = 1; // minimal required chdk build. 0-no limitation 1327 int _chdk_required_platfid = 0; // platform-specific module. 0-no limitation 1328 1329 void* MODULE_EXPORT_LIST[] = { 1330 /* 0 */ (void*)EXPORTLIST_MAGIC_NUMBER, 1331 /* 1 */ (void*)0 1332 }; 1333 1334 1335 //--------------------------------------------------------- 1336 // PURPOSE: Bind module symbols with chdk. 1337 // Required function 1338 // PARAMETERS: pointer to chdk list of export 1339 // RETURN VALUE: 1 error, 0 ok 1340 //--------------------------------------------------------- 1341 int _module_loader( void** chdk_export_list ) 1342 { 1343 if ( (unsigned int)chdk_export_list[0] != EXPORTLIST_MAGIC_NUMBER ) 1344 return 1; 1345 1346 tConfigVal configVal; 1347 CONF_BIND_INT(209, conf_sub_batch_prefix); 1348 CONF_BIND_INT(210, conf_sub_batch_ext); 1349 1350 return 0; 1351 } 1352 1353 1354 1355 //--------------------------------------------------------- 1356 // PURPOSE: Finalize module operations (close allocs, etc) 1357 // RETURN VALUE: 0-ok, 1-fail 1358 //--------------------------------------------------------- 1359 int _module_unloader() 1360 { 1361 finalize_fselect(); 1362 1363 GUI_MODE_FSELECT.magicnum = 0; //sanity clean to prevent accidentaly assign/restore guimode to unloaded module 1364 1365 return 0; 1366 } 1367 1368 1369 //--------------------------------------------------------- 1370 // PURPOSE: Default action for simple modules (direct run) 1371 // NOTE: Please comment this function if no default action and this library module 1372 //--------------------------------------------------------- 1373 int _module_run(int moduleidx, int argn, int* arguments) 1374 { 1375 module_idx=moduleidx; 1376 1377 if ( argn!=5) { 1378 module_async_unload(moduleidx); 1379 return 1; 1380 } 1381 1382 // Autounloading is unsafe because it should exists to catch finalization of mpopup 1383 module_set_flags(module_idx, MODULE_FLAG_DISABLE_AUTOUNLOAD); 1384 1385 gui_fselect_init( arguments[0], (const char*) arguments[1], (const char*) arguments[2], (void*)arguments[3]); 1386 gui_fselect_set_key_redraw(arguments[4]); 1387 1388 1389 return 0; 1390 } 1391 1392 1393 /*************** END OF AUXILARY PART *******************/ -
branches/reyalp-flt/core/gui_fselect.h
r1423 r1467 6 6 extern char* gui_fselect_result(); 7 7 extern void gui_fselect_kbd_process(); 8 extern void gui_fselect_draw( );8 extern void gui_fselect_draw(int enforce_redraw); 9 9 extern void gui_fselect_force_redraw(); 10 extern void finalize_fselect(); 10 11 //------------------------------------------------------------------- 11 12 #endif -
branches/reyalp-flt/core/gui_mastermind.c
- Property svn:eol-style set to native
r1338 r1467 12 12 #include "gui_mastermind.h" 13 13 14 #include "module_load.h" 15 void gui_module_menu_kbd_process(); 16 17 gui_handler GUI_MODE_MASTERMIND = 18 /*GUI_MODE_MASTERMIND*/ { gui_mastermind_draw, gui_mastermind_kbd_process, gui_module_menu_kbd_process, GUI_MODE_FLAG_NODRAWRESTORE, GUI_MODE_MAGICNUM }; 19 20 14 21 #define BORDER 20 15 22 #define RECT_SIZE 10 … … 133 140 for(i=0;i<4;i++) curr_color[i]=99; 134 141 142 gui_set_mode((unsigned int)&GUI_MODE_MASTERMIND); 135 143 return 1; 136 144 } 145 137 146 //------------------------------------------------------------------- 138 147 static void draw_box(color border) … … 217 226 } 218 227 //------------------------------------------------------------------- 219 void gui_mastermind_draw( ) {228 void gui_mastermind_draw(int enforce_redraw) { 220 229 unsigned long t; 221 230 static struct tm *ttm; … … 228 237 draw_txt_string((screen_width-CAM_TS_BUTTON_BORDER)/FONT_WIDTH-2-1-1-9-2-5-4, screen_height/FONT_HEIGHT-1, buf, TEXT_COLOR); 229 238 } 239 240 241 int basic_module_init() { 242 return gui_mastermind_init(); 243 } 244 245 extern int module_idx; 246 void gui_module_menu_kbd_process() { 247 gui_default_kbd_process_menu_btn(); 248 module_async_unload(module_idx); 249 } -
branches/reyalp-flt/core/gui_mastermind.h
- Property svn:eol-style set to native
r649 r1467 5 5 extern int gui_mastermind_init(); 6 6 extern void gui_mastermind_kbd_process(); 7 extern void gui_mastermind_draw( );7 extern void gui_mastermind_draw(int enforce_redraw); 8 8 9 9 //------------------------------------------------------------------- -
branches/reyalp-flt/core/gui_mbox.c
r1431 r1467 11 11 12 12 //------------------------------------------------------------------- 13 static enum Gui_Modegui_mbox_mode_old;13 static gui_mode_t gui_mbox_mode_old; 14 14 static const char* mbox_title; 15 15 static const char* mbox_msg; … … 86 86 87 87 //------------------------------------------------------------------- 88 void gui_mbox_draw( ) {88 void gui_mbox_draw(int enforce_redraw) { 89 89 if (mbox_to_draw) { 90 90 char c[MAX_LINES][MAX_WIDTH+1]; … … 172 172 173 173 //------------------------------------------------------------------- 174 175 void gui_browser_progress_show(const char* msg, const unsigned int perc) { 176 coord x=60, y=100; 177 unsigned int w=240, h=40, len; 178 179 draw_rect_shadow(x+1, y+1, x+w+1, y+h+1, COLOR_BLACK, 3); //shadow 180 draw_filled_rect(x, y, x+w, y+h, MAKE_COLOR(COLOR_GREY, COLOR_WHITE)); // main box 181 len = strlen(msg); 182 draw_string(x+((w-len*FONT_WIDTH)>>1), y+2, msg, MAKE_COLOR(COLOR_GREY, COLOR_WHITE)); //title text 183 draw_filled_rect(x+10, y+4+FONT_HEIGHT, x+w-10, y+h-10, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE)); // progress rect 184 draw_filled_rect(x+11, y+5+FONT_HEIGHT, x+11+(w-22)*perc/100, y+h-11, MAKE_COLOR(COLOR_RED, COLOR_RED)); // progress bar 185 } -
branches/reyalp-flt/core/gui_mbox.h
r515 r1467 27 27 extern void gui_mbox_init(int title, int msg, const unsigned int flags, void (*on_select)(unsigned int btn)); 28 28 extern void gui_mbox_kbd_process(); 29 extern void gui_mbox_draw(); 29 extern void gui_mbox_draw(int enforce_redraw); 30 31 extern void gui_browser_progress_show(const char* msg, const unsigned int perc); 30 32 31 33 //------------------------------------------------------------------- -
branches/reyalp-flt/core/gui_menu.c
r1425 r1467 8 8 #include "gui.h" 9 9 #include "gui_draw.h" 10 #include " gui_palette.h"10 #include "modules.h" 11 11 #include "gui_menu.h" 12 12 #include "gui_lang.h" … … 77 77 for(n = 0; curr_menu->menu[n].text; n++); 78 78 return n; 79 }80 81 //-------------------------------------------------------------------82 // Called from other gui functions to force redraw of menu83 void gui_menu_force_redraw()84 {85 if (gui_get_mode() == GUI_MODE_MENU)86 {87 gui_menu_redraw = 2;88 }89 79 } 90 80 … … 523 513 case MENUITEM_COLOR_FG: 524 514 case MENUITEM_COLOR_BG: 525 draw_restore();526 515 item_color=((unsigned char*)(curr_menu->menu[gui_menu_curr_item].value)) + (((curr_menu->menu[gui_menu_curr_item].type & MENUITEM_MASK)==MENUITEM_COLOR_BG)?1:0); 527 gui_palette_init(PALETTE_MODE_SELECT, (*item_color)&0xFF, gui_menu_color_selected); 528 gui_set_mode(GUI_MODE_PALETTE); 516 module_palette_run(PALETTE_MODE_SELECT, (*item_color)&0xFF, gui_menu_color_selected); 529 517 gui_menu_redraw=2; 530 518 break; … … 680 668 681 669 //------------------------------------------------------------------- 682 void gui_menu_draw( ) {670 void gui_menu_draw(int enforce_redraw) { 683 671 static char tbuf[64]; 684 672 int i, j; 685 673 const char *ch = ""; 674 675 if ( enforce_redraw ) 676 gui_menu_redraw = 2; 686 677 687 678 if (gui_menu_redraw) -
branches/reyalp-flt/core/gui_menu.h
r1407 r1467 63 63 extern void gui_menu_init(CMenu *menu_ptr); 64 64 extern void gui_menu_kbd_process(); 65 extern void gui_menu_draw( );65 extern void gui_menu_draw(int enforce_redraw); 66 66 extern void mod_user_menu(CMenuItem curr_menu_item, int* gui_menu_add_item, int mod); 67 67 extern void gui_menu_force_redraw(); -
branches/reyalp-flt/core/gui_mpopup.c
r1407 r1467 9 9 #include "gui_mpopup.h" 10 10 11 #include "module_load.h" 12 13 extern int module_idx; 14 15 gui_handler GUI_MODE_MPOPUP = 16 /*GUI_MODE_MPOPUP*/ { gui_mpopup_draw, gui_mpopup_kbd_process, gui_mpopup_kbd_process, GUI_MODE_FLAG_NORESTORE_ON_SWITCH, GUI_MODE_MAGICNUM }; 17 11 18 // Simple popup menu. No title, no separators, only processing items 12 19 13 20 //------------------------------------------------------------------- 14 static enum Gui_Modegui_mpopup_mode_old;21 static gui_mode_t gui_mpopup_mode_old; 15 22 static char mpopup_to_draw; 16 23 17 static struct {18 unsigned int flag;19 int text;20 } actions[] = {21 { MPOPUP_CUT, LANG_POPUP_CUT },22 { MPOPUP_COPY, LANG_POPUP_COPY },23 { MPOPUP_PASTE, LANG_POPUP_PASTE },24 { MPOPUP_DELETE, LANG_POPUP_DELETE },25 { MPOPUP_SELINV, LANG_POPUP_SELINV },26 { MPOPUP_RAW_ADD, LANG_POPUP_RAW_SUM},27 { MPOPUP_RAW_AVERAGE, LANG_POPUP_RAW_AVERAGE },28 { MPOPUP_RAW_DEVELOP, LANG_MENU_RAW_DEVELOP },29 { MPOPUP_PURGE, LANG_POPUP_PURGE },30 { MPOPUP_SUBTRACT, LANG_POPUP_SUB_FROM_MARKED },31 #if DNG_SUPPORT32 { MPOPUP_DNG_TO_CRW, (int)"DNG -> CHDK RAW"},33 #endif34 };35 36 #define ACTIONSNUM (sizeof(actions)/sizeof(actions[0]))37 24 #define MAX_ACTIONS 10 25 26 struct mpopup_item* actions; 38 27 39 28 static int mpopup_actions[MAX_ACTIONS]; // Content of raised popupmenu … … 45 34 46 35 //------------------------------------------------------------------- 47 void gui_mpopup_init(const unsigned int flags, void (*on_select)(unsigned int actn)) { 36 void gui_mpopup_init(struct mpopup_item* popup_actions, const unsigned int flags, void (*on_select)(unsigned int actn), int mode) 37 { 48 38 int i; 49 39 50 40 mpopup_actions_num = 0; 51 for (i=0; i<ACTIONSNUM && mpopup_actions_num<MAX_ACTIONS; ++i) { 41 actions = popup_actions; 42 for (i=0; actions[i].flag && mpopup_actions_num<MAX_ACTIONS; ++i) { 52 43 if (flags & MPOPUP_MASK & actions[i].flag) 53 44 mpopup_actions[mpopup_actions_num++] = i; 54 45 } 55 if (mpopup_actions_num == 0) 46 if (mpopup_actions_num == 0) { 56 47 on_select(MPOPUP_CANCEL); 48 return; 49 } 57 50 58 51 mpopup_actions_active = 0; … … 61 54 mpopup_to_draw = 1; 62 55 mpopup_on_select = on_select; 63 gui_set_mode( GUI_MODE_MPOPUP);56 gui_set_mode((unsigned int)&GUI_MODE_MPOPUP); 64 57 } 65 58 … … 85 78 86 79 //------------------------------------------------------------------- 87 void gui_mpopup_draw( ) {80 void gui_mpopup_draw(int enforce_redraw) { 88 81 if (mpopup_to_draw) { 89 82 int i; … … 114 107 115 108 //------------------------------------------------------------------- 109 void exit_mpopup(int action) 110 { 111 gui_set_mode(gui_mpopup_mode_old); 112 if (mpopup_on_select) 113 mpopup_on_select(actions[mpopup_actions[action]].flag); 114 } 115 116 //------------------------------------------------------------------- 116 117 void gui_mpopup_kbd_process() { 117 118 switch (kbd_get_clicked_key() | get_jogdial_direction()) { … … 131 132 case KEY_LEFT: 132 133 kbd_reset_autoclicked_key(); 133 gui_set_mode(gui_mpopup_mode_old); 134 if (mpopup_on_select) 135 mpopup_on_select(MPOPUP_CANCEL); 134 exit_mpopup(MPOPUP_CANCEL); 135 module_async_unload(module_idx); 136 136 break; 137 137 case KEY_SET: 138 138 kbd_reset_autoclicked_key(); 139 gui_set_mode(gui_mpopup_mode_old); 140 if (mpopup_on_select) 141 mpopup_on_select(actions[mpopup_actions[mpopup_actions_active]].flag); 142 break; 143 } 144 } 145 146 //------------------------------------------------------------------- 147 void gui_browser_progress_show(const char* msg, const unsigned int perc) { 148 coord x=60, y=100; 149 unsigned int w=240, h=40, len; 150 151 draw_rect_shadow(x+1, y+1, x+w+1, y+h+1, COLOR_BLACK, 3); //shadow 152 draw_filled_rect(x, y, x+w, y+h, MAKE_COLOR(COLOR_GREY, COLOR_WHITE)); // main box 153 len = strlen(msg); 154 draw_string(x+((w-len*FONT_WIDTH)>>1), y+2, msg, MAKE_COLOR(COLOR_GREY, COLOR_WHITE)); //title text 155 draw_filled_rect(x+10, y+4+FONT_HEIGHT, x+w-10, y+h-10, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE)); // progress rect 156 draw_filled_rect(x+11, y+5+FONT_HEIGHT, x+11+(w-22)*perc/100, y+h-11, MAKE_COLOR(COLOR_RED, COLOR_RED)); // progress bar 157 } 139 exit_mpopup(mpopup_actions_active); 140 module_async_unload(module_idx); 141 break; 142 } 143 } 144 145 //------------------------------------------------------------------- 146 147 // ========= MODULE INIT ================= 148 149 int module_idx=-1; 150 151 /***************** BEGIN OF AUXILARY PART ********************* 152 ATTENTION: DO NOT REMOVE OR CHANGE SIGNATURES IN THIS SECTION 153 **************************************************************/ 154 155 int _chdk_required_ver = 1; // minimal required chdk build. 0-no limitation 156 int _chdk_required_platfid = 0; // platform-specific module. 0-no limitation 157 158 void* MODULE_EXPORT_LIST[] = { 159 /* 0 */ (void*)EXPORTLIST_MAGIC_NUMBER, 160 /* 1 */ (void*)0 161 }; 162 163 164 //--------------------------------------------------------- 165 // PURPOSE: Bind module symbols with chdk. 166 // Required function 167 // PARAMETERS: pointer to chdk list of export 168 // RETURN VALUE: 1 error, 0 ok 169 //--------------------------------------------------------- 170 int _module_loader( void** chdk_export_list ) 171 { 172 if ( (unsigned int)chdk_export_list[0] != EXPORTLIST_MAGIC_NUMBER ) 173 return 1; 174 175 return 0; 176 } 177 178 179 180 //--------------------------------------------------------- 181 // PURPOSE: Finalize module operations (close allocs, etc) 182 // RETURN VALUE: 0-ok, 1-fail 183 //--------------------------------------------------------- 184 int _module_unloader() 185 { 186 exit_mpopup(MPOPUP_CANCEL); 187 188 GUI_MODE_MPOPUP.magicnum = 0; //sanity clean to prevent accidentaly assign/restore guimode to unloaded module 189 190 return 0; 191 } 192 193 194 //--------------------------------------------------------- 195 // PURPOSE: Default action for simple modules (direct run) 196 // NOTE: Please comment this function if no default action and this library module 197 //--------------------------------------------------------- 198 int _module_run(int moduleidx, int argn, int* arguments) 199 { 200 module_idx=moduleidx; 201 202 if ( argn!=4) { 203 module_async_unload(moduleidx); 204 return 1; 205 } 206 207 // Currently only old (0) mode is supported 208 // This is for load error if newer version is required 209 if (arguments[3]!=0) 210 return 1; 211 212 gui_mpopup_init( (struct mpopup_item*)arguments[0], (const unsigned int)arguments[1], (void*) arguments[2], arguments[3]); 213 214 215 return 0; 216 } 217 218 219 /*************** END OF AUXILARY PART *******************/ -
branches/reyalp-flt/core/gui_mpopup.h
r666 r1467 3 3 4 4 //------------------------------------------------------------------- 5 #define MPOPUP_MASK 0x07FF 6 #define MPOPUP_CANCEL 0x0800 7 #define MPOPUP_CUT 0x0001 8 #define MPOPUP_COPY 0x0002 9 #define MPOPUP_PASTE 0x0004 10 #define MPOPUP_DELETE 0x0008 11 #define MPOPUP_SELINV 0x0010 12 #define MPOPUP_RAW_ADD 0x0020 13 #define MPOPUP_RAW_AVERAGE 0x0040 14 #define MPOPUP_PURGE 0x0080 15 #define MPOPUP_SUBTRACT 0x0100 16 #define MPOPUP_RAW_DEVELOP 0x0200 17 #define MPOPUP_DNG_TO_CRW 0x0400 5 #define MPOPUP_MASK 0x7FFF 6 #define MPOPUP_CANCEL 0x8000 7 8 struct mpopup_item { 9 unsigned int flag; 10 int text; 11 }; 18 12 19 13 //------------------------------------------------------------------- 20 extern void gui_mpopup_init( const unsigned int flags, void (*on_select)(unsigned int actn));14 extern void gui_mpopup_init(struct mpopup_item* popup_actions, const unsigned int flags, void (*on_select)(unsigned int actn), int mode); 21 15 extern void gui_mpopup_kbd_process(); 22 extern void gui_mpopup_draw(); 23 24 extern void gui_browser_progress_show(const char* msg, const unsigned int perc); 16 extern void gui_mpopup_draw(int enforce_redraw); 25 17 26 18 //------------------------------------------------------------------- -
branches/reyalp-flt/core/gui_osd.c
r1350 r1467 105 105 106 106 //------------------------------------------------------------------- 107 void gui_osd_draw( ) {107 void gui_osd_draw(int enforce_redraw) { 108 108 if (osd_to_draw) { 109 109 int i; -
branches/reyalp-flt/core/gui_osd.h
r683 r1467 36 36 extern void gui_osd_init(); 37 37 extern void gui_osd_kbd_process(); 38 extern void gui_osd_draw( );38 extern void gui_osd_draw(int enforce_redraw); 39 39 40 40 extern void gui_osd_draw_histo(); -
branches/reyalp-flt/core/gui_palette.c
r1338 r1467 10 10 #include "gui_palette.h" 11 11 12 13 #include "module_load.h" 14 void gui_module_menu_kbd_process(); 15 16 gui_handler GUI_MODE_PALETTE = 17 /*GUI_MODE_PALETTE*/ { gui_palette_draw, gui_palette_kbd_process, gui_module_menu_kbd_process, 0, GUI_MODE_MAGICNUM }; 18 12 19 //------------------------------------------------------------------- 13 20 static color cl; … … 18 25 //------------------------------------------------------------------- 19 26 void gui_palette_init(int mode, color st_color, void (*on_select)(color clr)) { 27 draw_restore(); 20 28 cl = st_color; 21 29 palette_mode = mode; 22 30 palette_on_select = on_select; 23 31 gui_palette_redraw = 1; 32 gui_set_mode((unsigned int)&GUI_MODE_PALETTE); 24 33 } 25 34 … … 49 58 if (palette_on_select) 50 59 palette_on_select(cl); 51 gui_ set_mode(GUI_MODE_MENU);60 gui_module_menu_kbd_process(); 52 61 } 53 62 break; … … 64 73 #define DISP_BOTTOM (FONT_HEIGHT + BORDER_SIZE + CELL_SIZE * 16) 65 74 66 void gui_palette_draw( ) {75 void gui_palette_draw(int enforce_redraw) { 67 76 unsigned int x, y, xl, xr; 68 77 char f=0; … … 108 117 } 109 118 119 extern int module_idx; 120 void gui_module_menu_kbd_process() { 121 gui_default_kbd_process_menu_btn(); 122 module_async_unload(module_idx); 123 } 124 125 // ========= MODULE INIT ================= 126 #include "module_load.h" 127 int module_idx=-1; 128 129 /***************** BEGIN OF AUXILARY PART ********************* 130 ATTENTION: DO NOT REMOVE OR CHANGE SIGNATURES IN THIS SECTION 131 **************************************************************/ 132 133 int _chdk_required_ver = 1; // minimal required chdk build. 0-no limitation 134 int _chdk_required_platfid = 0; // platform-specific module. 0-no limitation 135 136 void* MODULE_EXPORT_LIST[] = { 137 /* 0 */ (void*)EXPORTLIST_MAGIC_NUMBER, 138 /* 1 */ (void*)0 139 }; 140 141 142 //--------------------------------------------------------- 143 // PURPOSE: Bind module symbols with chdk. 144 // Required function 145 // PARAMETERS: pointer to chdk list of export 146 // RETURN VALUE: 1 error, 0 ok 147 //--------------------------------------------------------- 148 int _module_loader( void** chdk_export_list ) 149 { 150 if ( (unsigned int)chdk_export_list[0] != EXPORTLIST_MAGIC_NUMBER ) 151 return 1; 152 153 return 0; 154 } 155 156 157 158 //--------------------------------------------------------- 159 // PURPOSE: Finalize module operations (close allocs, etc) 160 // RETURN VALUE: 0-ok, 1-fail 161 //--------------------------------------------------------- 162 int _module_unloader() 163 { 164 GUI_MODE_PALETTE.magicnum = 0; //sanity clean to prevent accidentaly assign/restore guimode to unloaded module 165 166 return 0; 167 } 168 169 170 //--------------------------------------------------------- 171 // PURPOSE: Default action for simple modules (direct run) 172 // NOTE: Please comment this function if no default action and this library module 173 //--------------------------------------------------------- 174 int _module_run(int moduleidx, int argn, int* arguments) 175 { 176 module_idx=moduleidx; 177 178 if ( argn!=3) { 179 module_async_unload(moduleidx); 180 return 1; 181 } 182 183 gui_palette_init( arguments[0], (color)arguments[1], (void*)arguments[2]); 184 185 return 0; 186 } 187 188 189 /*************** END OF AUXILARY PART *******************/ -
branches/reyalp-flt/core/gui_palette.h
r515 r1467 12 12 extern void gui_palette_init(int mode, color st_color, void (*on_select)(color clr)); 13 13 extern void gui_palette_kbd_process(); 14 extern void gui_palette_draw( );14 extern void gui_palette_draw(int enforce_redraw); 15 15 16 16 //------------------------------------------------------------------- -
branches/reyalp-flt/core/gui_read.c
r1338 r1467 11 11 12 12 13 #include "module_load.h" 14 15 extern void gui_read_kbd_process_menu_btn(); 16 17 int *conf_reader_autoscroll; 18 int *conf_reader_autoscroll_delay; 19 int *conf_reader_pos; 20 int *conf_reader_wrap_by_words; 21 color *conf_reader_color; 22 char *conf_reader_file; 23 char *conf_menu_rbf_file; 24 25 gui_handler GUI_MODE_READ = 26 /*GUI_MODE_READ*/ { gui_read_draw, gui_read_kbd_process, gui_read_kbd_process_menu_btn, 0, GUI_MODE_MAGICNUM }; 27 13 28 //------------------------------------------------------------------- 14 29 static int read_file; … … 23 38 static int pause; 24 39 40 static int reader_is_active; // Flag raised when reader is succesfully runned 41 // purpose: we shouldn't process "leave" sequence if we call unload module but reader was not runed yet 42 25 43 //------------------------------------------------------------------- 26 44 static void gui_read_draw_batt() { … … 42 60 //------------------------------------------------------------------- 43 61 static void gui_read_draw_scroll_indicator() { 44 draw_txt_char((screen_width-CAM_TS_BUTTON_BORDER)/FONT_WIDTH-2, 0, ( conf.reader_autoscroll)?((pause)?'\x05':'\x04'):'\x03', MAKE_COLOR(COLOR_BLACK, COLOR_WHITE)); //title infoline62 draw_txt_char((screen_width-CAM_TS_BUTTON_BORDER)/FONT_WIDTH-2, 0, (*conf_reader_autoscroll)?((pause)?'\x05':'\x04'):'\x03', MAKE_COLOR(COLOR_BLACK, COLOR_WHITE)); //title infoline 45 63 } 46 64 … … 49 67 static struct stat st; 50 68 read_file = open(file, O_RDONLY, 0777); 51 if (strcmp(file, conf .reader_file)!=0) {52 conf.reader_pos = 0;53 strcpy(conf .reader_file, file);69 if (strcmp(file, conf_reader_file)!=0) { 70 *conf_reader_pos = 0; 71 strcpy(conf_reader_file, file); 54 72 } 55 73 read_on_screen = 0; 56 74 read_file_size = (read_file>=0 && stat((char*)file, &st)==0)?st.st_size:0; 57 if (read_file_size<= conf.reader_pos) {58 conf.reader_pos = 0;75 if (read_file_size<=*conf_reader_pos) { 76 *conf_reader_pos = 0; 59 77 } 60 78 pause = 0; … … 66 84 last_time = get_tick_count(); 67 85 86 reader_is_active=1; 87 gui_set_mode((unsigned int)&GUI_MODE_READ); 88 68 89 draw_filled_rect(0, 0, screen_width-1, y-1, MAKE_COLOR(COLOR_BLACK, COLOR_BLACK)); 69 draw_filled_rect(0, y, screen_width-1, screen_height-1, MAKE_COLOR(( conf.reader_color>>8)&0xFF, (conf.reader_color>>8)&0xFF));90 draw_filled_rect(0, y, screen_width-1, screen_height-1, MAKE_COLOR((*conf_reader_color>>8)&0xFF, (*conf_reader_color>>8)&0xFF)); 70 91 71 92 gui_read_draw_scroll_indicator(); … … 77 98 //------------------------------------------------------------------- 78 99 static void read_goto_next_line() { 79 draw_filled_rect(xx, yy, x+w-1, yy+rbf_font_height()-1, MAKE_COLOR( conf.reader_color>>8, conf.reader_color>>8));100 draw_filled_rect(xx, yy, x+w-1, yy+rbf_font_height()-1, MAKE_COLOR(*conf_reader_color>>8, *conf_reader_color>>8)); 80 101 xx = x; 81 102 yy += rbf_font_height(); … … 88 109 89 110 //------------------------------------------------------------------- 90 void gui_read_draw( ) {91 if ( conf.reader_autoscroll && !pause && get_tick_count()-last_time >= conf.reader_autoscroll_delay*1000 && (conf.reader_pos+read_on_screen)<read_file_size) {92 conf.reader_pos += read_on_screen;111 void gui_read_draw(int enforce_redraw) { 112 if (*conf_reader_autoscroll && !pause && get_tick_count()-last_time >= *conf_reader_autoscroll_delay*1000 && (*conf_reader_pos+read_on_screen)<read_file_size) { 113 *conf_reader_pos += read_on_screen; 93 114 read_to_draw = 1; 94 115 } … … 98 119 xx=x; yy=y; 99 120 100 lseek(read_file, conf.reader_pos, SEEK_SET);121 lseek(read_file, *conf_reader_pos, SEEK_SET); 101 122 read_on_screen=0; 102 123 … … 106 127 read_goto_next_line(); 107 128 if (yy < y+h) 108 draw_filled_rect(x, yy, x+w-1, y+h-1, MAKE_COLOR( conf.reader_color>>8, conf.reader_color>>8));129 draw_filled_rect(x, yy, x+w-1, y+h-1, MAKE_COLOR(*conf_reader_color>>8, *conf_reader_color>>8)); 109 130 break; 110 131 } … … 123 144 // no break here 124 145 default: 125 if ( conf.reader_wrap_by_words) {146 if (*conf_reader_wrap_by_words) { 126 147 if (buffer[i] == ' ') { 127 148 new_word = 1; … … 153 174 continue; 154 175 } 155 xx+=rbf_draw_char(xx, yy, buffer[i], conf.reader_color);176 xx+=rbf_draw_char(xx, yy, buffer[i], *conf_reader_color); 156 177 break; 157 178 } … … 165 186 } 166 187 167 sprintf(buffer, "(%3d%%) %d/%d ", (read_file_size)?( conf.reader_pos*100/read_file_size):0, conf.reader_pos, read_file_size);188 sprintf(buffer, "(%3d%%) %d/%d ", (read_file_size)?(*conf_reader_pos*100/read_file_size):0, *conf_reader_pos, read_file_size); 168 189 buffer[screen_width/FONT_WIDTH]=0; 169 190 draw_txt_string((CAM_TS_BUTTON_BORDER/FONT_WIDTH), 0, buffer, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE)); //title infoline … … 174 195 n=i*read_on_screen/read_file_size; // bar height 175 196 if (n<20) n=20; 176 i=(i-n)* conf.reader_pos/read_file_size; // top pos197 i=(i-n)**conf_reader_pos/read_file_size; // top pos 177 198 draw_filled_rect(x+w+6+2, y+1, x+w+6+6, y+1+i, MAKE_COLOR(COLOR_BLACK, COLOR_BLACK)); 178 199 draw_filled_rect(x+w+6+2, y+i+n, x+w+6+6, y+h-1-1, MAKE_COLOR(COLOR_BLACK, COLOR_BLACK)); … … 197 218 case KEY_UP: 198 219 case KEY_LEFT: 199 if ( conf.reader_pos>0) {200 conf.reader_pos -= 45*15;201 if ( conf.reader_pos<0) conf.reader_pos=0;220 if (*conf_reader_pos>0) { 221 *conf_reader_pos -= 45*15; 222 if (*conf_reader_pos<0) *conf_reader_pos=0; 202 223 read_to_draw = 1; 203 224 } … … 208 229 case KEY_RIGHT: 209 230 case KEY_SHOOT_HALF: 210 if (( conf.reader_pos+read_on_screen)<read_file_size) {211 conf.reader_pos += read_on_screen;231 if ((*conf_reader_pos+read_on_screen)<read_file_size) { 232 *conf_reader_pos += read_on_screen; 212 233 read_to_draw = 1; 213 234 } … … 221 242 break; 222 243 case KEY_MENU: 223 if (read_file >= 0) { 244 gui_read_kbd_leave(); 245 break; 246 } 247 } 248 249 extern int module_idx; 250 251 //------------------------------------------------------------------- 252 // Menu button handled for text reader 253 void gui_read_kbd_process_menu_btn() 254 { 255 gui_read_kbd_process(); 256 gui_default_kbd_process_menu_btn(); 257 module_async_unload(module_idx); 258 } 259 260 void gui_read_kbd_leave() 261 { 262 if ( !reader_is_active ) 263 return; 264 265 reader_is_active = 0; 266 if (!rbf_load(conf_menu_rbf_file)) 267 rbf_load_from_8x16(current_font); 268 rbf_set_codepage(FONT_CP_WIN); 269 if (read_file >= 0) { 224 270 close(read_file); 225 271 read_file=-1; 226 } 227 if (!rbf_load(conf.menu_rbf_file)) 228 rbf_load_from_8x16(current_font); 229 rbf_set_codepage(FONT_CP_WIN); 230 break; 231 } 232 } 233 234 //------------------------------------------------------------------- 272 } 273 } 274 275 // ========= MODULE INIT ================= 276 #include "module_load.h" 277 int module_idx=-1; 278 279 /***************** BEGIN OF AUXILARY PART ********************* 280 ATTENTION: DO NOT REMOVE OR CHANGE SIGNATURES IN THIS SECTION 281 **************************************************************/ 282 283 int _chdk_required_ver = 1; // minimal required chdk build. 0-no limitation 284 int _chdk_required_platfid = 0; // platform-specific module. 0-no limitation 285 286 void* MODULE_EXPORT_LIST[] = { 287 /* 0 */ (void*)EXPORTLIST_MAGIC_NUMBER, 288 /* 1 */ (void*)0 289 }; 290 291 292 //--------------------------------------------------------- 293 // PURPOSE: Bind module symbols with chdk. 294 // Required function 295 // PARAMETERS: pointer to chdk list of export 296 // RETURN VALUE: 1 error, 0 ok 297 //--------------------------------------------------------- 298 int _module_loader( void** chdk_export_list ) 299 { 300 if ( (unsigned int)chdk_export_list[0] != EXPORTLIST_MAGIC_NUMBER ) 301 return 1; 302 303 tConfigVal configVal; 304 CONF_BIND_COLOR( 31, conf_reader_color ); 305 CONF_BIND_STR( 38, conf_reader_file ); 306 CONF_BIND_INT( 39, conf_reader_pos ); 307 CONF_BIND_INT( 43, conf_reader_autoscroll ); 308 CONF_BIND_INT( 44, conf_reader_autoscroll_delay ); 309 CONF_BIND_INT( 61, conf_reader_wrap_by_words ); 310 CONF_BIND_STR( 66, conf_menu_rbf_file ); 311 312 return 0; 313 } 314 315 316 317 //--------------------------------------------------------- 318 // PURPOSE: Finalize module operations (close allocs, etc) 319 // RETURN VALUE: 0-ok, 1-fail 320 //--------------------------------------------------------- 321 int _module_unloader() 322 { 323 // We should make "leave sequence" to restore font settings 324 gui_read_kbd_leave(); 325 326 GUI_MODE_READ.magicnum = 0; //sanity clean to prevent accidentaly assign/restore guimode to unloaded module 327 328 return 0; 329 } 330 331 332 //--------------------------------------------------------- 333 // PURPOSE: Default action for simple modules (direct run) 334 // NOTE: Please comment this function if no default action and this library module 335 //--------------------------------------------------------- 336 int _module_run(int moduleidx, int argn, int* arguments) 337 { 338 module_idx=moduleidx; 339 340 if ( argn!=1 || arguments[0]==0) { 341 module_async_unload(moduleidx); 342 return 1; 343 } 344 345 char* fn=(char*)arguments[0]; 346 gui_read_init(fn); 347 348 return 0; 349 } 350 351 352 /*************** END OF AUXILARY PART *******************/ -
branches/reyalp-flt/core/gui_read.h
r515 r1467 7 7 extern int gui_read_init(const char* file); 8 8 extern void gui_read_kbd_process(); 9 extern void gui_read_draw(); 9 extern void gui_read_draw(int enforce_redraw); 10 extern void gui_read_kbd_leave(); 10 11 11 12 //------------------------------------------------------------------- -
branches/reyalp-flt/core/gui_reversi.c
r1338 r1467 10 10 #include "gui_mbox.h" 11 11 #include "gui_reversi.h" 12 13 #include "module_load.h" 14 void gui_module_menu_kbd_process(); 15 16 gui_handler GUI_MODE_REVERSI = 17 /*GUI_MODE_REVERSI*/ { gui_reversi_draw, gui_reversi_kbd_process, gui_module_menu_kbd_process, GUI_MODE_FLAG_NODRAWRESTORE, GUI_MODE_MAGICNUM }; 18 12 19 13 20 //------------------------------------------------------------------- … … 344 351 345 352 //------------------------------------------------------------------- 346 void gui_reversi_init() { 353 int basic_module_init() { 354 gui_set_mode((unsigned int)&GUI_MODE_REVERSI); 347 355 InitMainWindow(); 348 356 NewGame(); 349 357 need_redraw_all = 1; 358 return 1; 350 359 } 351 360 … … 397 406 398 407 //------------------------------------------------------------------- 399 void gui_reversi_draw( ) {408 void gui_reversi_draw(int enforce_redraw) { 400 409 if (need_redraw_all) { 401 410 need_redraw_all = 0; … … 415 424 } 416 425 426 427 extern int module_idx; 428 void gui_module_menu_kbd_process() { 429 gui_default_kbd_process_menu_btn(); 430 module_async_unload(module_idx); 431 } -
branches/reyalp-flt/core/gui_reversi.h
r515 r1467 5 5 extern void gui_reversi_init(); 6 6 extern void gui_reversi_kbd_process(); 7 extern void gui_reversi_draw( );7 extern void gui_reversi_draw(int enforce_redraw); 8 8 9 9 //------------------------------------------------------------------- -
branches/reyalp-flt/core/gui_sokoban.c
r1338 r1467 11 11 #include "gui_mbox.h" 12 12 #include "gui_sokoban.h" 13 14 #include "module_load.h" 15 void gui_module_menu_kbd_process(); 16 17 int *conf_sokoban_level; 18 19 gui_handler GUI_MODE_SOKOBAN = 20 /*GUI_MODE_SOKOBAN*/ { gui_sokoban_draw, gui_sokoban_kbd_process, gui_module_menu_kbd_process, GUI_MODE_FLAG_NODRAWRESTORE, GUI_MODE_MAGICNUM }; 21 13 22 14 23 //------------------------------------------------------------------- … … 197 206 198 207 free(buf); 199 conf.sokoban_level = lvl;208 *conf_sokoban_level = lvl; 200 209 moves = 0; 201 210 sokoban_undo_reset(); … … 215 224 //------------------------------------------------------------------- 216 225 static void sokoban_next_level() { 217 if (++ conf.sokoban_level >= num_levels) conf.sokoban_level = 0;218 sokoban_set_level( conf.sokoban_level);226 if (++*conf_sokoban_level >= num_levels) *conf_sokoban_level = 0; 227 sokoban_set_level(*conf_sokoban_level); 219 228 need_redraw_all = 1; 220 229 } … … 313 322 return 0; 314 323 } 315 else if( conf.sokoban_level >= num_levels) {316 conf.sokoban_level = 0;324 else if(*conf_sokoban_level >= num_levels) { 325 *conf_sokoban_level = 0; 317 326 } 318 327 cell_size = screen_height/FIELD_HEIGHT; 319 sokoban_set_level( conf.sokoban_level);328 sokoban_set_level(*conf_sokoban_level); 320 329 // if the file is no longer readable, set_level will set this 321 330 if(!num_levels) { … … 323 332 } 324 333 need_redraw_all = 1; 334 335 gui_set_mode((unsigned int)&GUI_MODE_SOKOBAN); 325 336 return 1; 326 337 } … … 363 374 case KEY_DISPLAY: 364 375 #endif 365 sokoban_set_level( conf.sokoban_level);376 sokoban_set_level(*conf_sokoban_level); 366 377 need_redraw_all = 1; 367 378 break; … … 376 387 377 388 //------------------------------------------------------------------- 378 void gui_sokoban_draw( ) {389 void gui_sokoban_draw(int enforce_redraw) { 379 390 int y, x; 380 391 static char str[16]; … … 420 431 draw_line(CAM_TS_BUTTON_BORDER+cell_size*FIELD_WIDTH+1, 0, CAM_TS_BUTTON_BORDER+cell_size*FIELD_WIDTH+1, screen_height-1, COLOR_BLACK); 421 432 422 sprintf(str, "%s: %-6d", lang_str(LANG_SOKOBAN_TEXT_LEVEL), conf.sokoban_level+1);433 sprintf(str, "%s: %-6d", lang_str(LANG_SOKOBAN_TEXT_LEVEL), *conf_sokoban_level+1); 423 434 draw_string(CAM_TS_BUTTON_BORDER+cell_size*FIELD_WIDTH+2, 8, str, MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE)); 424 435 sprintf(str, "%s: %-6d", lang_str(LANG_SOKOBAN_TEXT_MOVES), moves); … … 437 448 } 438 449 450 451 extern int module_idx; 452 void gui_module_menu_kbd_process() { 453 gui_default_kbd_process_menu_btn(); 454 module_async_unload(module_idx); 455 } 456 457 458 // ========= MODULE INIT ================= 459 #include "module_load.h" 460 int module_idx=-1; 461 462 /***************** BEGIN OF AUXILARY PART ********************* 463 ATTENTION: DO NOT REMOVE OR CHANGE SIGNATURES IN THIS SECTION 464 **************************************************************/ 465 466 int _chdk_required_ver = 1; // minimal required chdk build. 0-no limitation 467 int _chdk_required_platfid = 0; // platform-specific module. 0-no limitation 468 469 void* MODULE_EXPORT_LIST[] = { 470 /* 0 */ (void*)EXPORTLIST_MAGIC_NUMBER, 471 /* 1 */ (void*)0 472 }; 473 474 475 //--------------------------------------------------------- 476 // PURPOSE: Bind module symbols with chdk. 477 // Required function 478 // PARAMETERS: pointer to chdk list of export 479 // RETURN VALUE: 1 error, 0 ok 480 //--------------------------------------------------------- 481 int _module_loader( void** chdk_export_list ) 482 { 483 if ( (unsigned int)chdk_export_list[0] != EXPORTLIST_MAGIC_NUMBER ) 484 return 1; 485 486 // Safe bind of conf. 487 tConfigVal configVal; 488 CONF_BIND_INT(40, conf_sokoban_level ); 489 490 return 0; 491 } 492 493 494 495 //--------------------------------------------------------- 496 // PURPOSE: Finalize module operations (close allocs, etc) 497 // RETURN VALUE: 0-ok, 1-fail 498 //--------------------------------------------------------- 499 int _module_unloader() 500 { 501 return 0; 502 } 503 504 505 //--------------------------------------------------------- 506 // PURPOSE: Default action for simple modules (direct run) 507 // NOTE: Please comment this function if no default action and this library module 508 //--------------------------------------------------------- 509 int _module_run(int moduleidx, int argn, int* arguments) 510 { 511 module_idx=moduleidx; 512 513 int rv = gui_sokoban_init(); 514 if ( ! rv ) 515 module_async_unload(moduleidx); // fail to init - "unload me" 516 517 return 0; 518 } 519 520 521 /*************** END OF AUXILARY PART *******************/ -
branches/reyalp-flt/core/gui_sokoban.h
r522 r1467 5 5 extern int gui_sokoban_init(); 6 6 extern void gui_sokoban_kbd_process(); 7 extern void gui_sokoban_draw( );7 extern void gui_sokoban_draw(int enforce_redraw); 8 8 9 9 //------------------------------------------------------------------- -
branches/reyalp-flt/core/kbd.c
r1464 r1467 12 12 #include "lang.h" 13 13 #include "gui_lang.h" 14 15 #include "module_load.h" 16 #include "gui.h" 14 17 15 18 long kbd_last_clicked; … … 171 174 unsigned int nCrzpos,i; 172 175 unsigned int drmode = 0; 176 177 #if defined(CAMERA_s95) 178 extern volatile int kbd_KEY_RING_FUNC; 179 if (kbd_KEY_RING_FUNC && gui_get_mode()!=GUI_MODE_NONE) { 180 if (module_find("modinsp.flt")<0) 181 module_run("modinsp.flt", 0, 0,0, UNLOAD_IF_ERR); 182 } 183 #endif 184 173 185 174 186 if(conf.ricoh_ca1_mode && conf.remote_enable) { … … 267 279 // Note: this is blocked if CHDK is in the file selector. prevents problems 268 280 // when the file selector is called from a script. 269 if (kbd_is_key_pressed(KEY_SHOOT_FULL) && (gui_get_mode() != GUI_MODE_FSELECT) && (gui_get_mode() != GUI_MODE_MPOPUP)) { 281 // TODO selelect and popup checks temp disabled for module work 282 if (kbd_is_key_pressed(KEY_SHOOT_FULL)/* && (gui_get_mode() != GUI_MODE_FSELECT) && (gui_get_mode() != GUI_MODE_MPOPUP)*/) { 270 283 key_pressed = 100; 271 284 if (!state_kbd_script_run) { -
branches/reyalp-flt/core/luascript.c
r1452 r1467 10 10 #include "stdlib.h" 11 11 #include "raw.h" 12 #include " raw_merge.h"12 #include "modules.h" 13 13 #include "levent.h" 14 14 #include "console.h" … … 126 126 void lua_script_reset() 127 127 { 128 module_rawop_unload(); 128 129 lua_close( L ); 129 130 L = 0; … … 267 268 int value; 268 269 value=luaL_checknumber( L, 1 ); 270 if (module_curve_load()) 271 return luaL_argerror(L,1,"fail to load curves module"); 269 272 curve_set_mode(value); 270 273 return 0; … … 817 820 // the Func/Set key again will enter the Script menu, not the File Browser 818 821 kbd_reset_autoclicked_key(); 822 823 lua_pushstring( Lt, (fn && fn[0])? fn : NULL ); 824 819 825 } 820 826 … … 825 831 action_push(AS_FILE_BROWSER); 826 832 // Switch to file browser gui mode. Path can be supplied in call or defaults to "A" (root directory). 827 gui_fselect_init(LANG_STR_FILE_BROWSER, luaL_optstring( L, 1, "A" ), "A", file_browser_selected);833 module_fselect_init(LANG_STR_FILE_BROWSER, luaL_optstring( L, 1, "A" ), "A", file_browser_selected); 828 834 // Yield the script so that the action stack will process the AS_FILE_BROWSER action 829 835 return lua_yield(L, 0); … … 1237 1243 { 1238 1244 int op = luaL_checknumber(L,1); 1245 if (!module_rawop_load()) 1246 return luaL_argerror(L,1,"fail to load raw merge module"); 1239 1247 if (op == RAW_OPERATION_SUM || op == RAW_OPERATION_AVERAGE) { 1240 raw_merge_start(op);1248 librawop.raw_merge_start(op); 1241 1249 } 1242 1250 else { … … 1249 1257 static int luaCB_raw_merge_add_file( lua_State* L ) 1250 1258 { 1251 raw_merge_add_file(luaL_checkstring( L, 1 )); 1259 if (!module_rawop_load()) 1260 return luaL_argerror(L,1,"fail to load raw merge module"); 1261 librawop.raw_merge_add_file(luaL_checkstring( L, 1 )); 1252 1262 return 0; 1253 1263 } … … 1255 1265 static int luaCB_raw_merge_end( lua_State* L ) 1256 1266 { 1257 raw_merge_end(); 1267 if (!module_rawop_load()) 1268 return luaL_argerror(L,1,"fail to load raw merge module"); 1269 librawop.raw_merge_end(); 1258 1270 return 0; 1259 1271 } -
branches/reyalp-flt/core/main.c
r1441 r1467 8 8 #include "raw.h" 9 9 #ifdef OPT_EDGEOVERLAY 10 #include "edgeoverlay.h" 11 #endif 10 #include "modules.h" 11 #endif 12 13 #include "module_load.h" 14 #include "gui_draw.h" 15 12 16 static int raw_need_postprocess; 13 17 static volatile int spytask_can_start; … … 142 146 mkdir("A/CHDK/LANG"); 143 147 mkdir("A/CHDK/BOOKS"); 148 mkdir("A/CHDK/MODULES"); 144 149 mkdir("A/CHDK/GRIDS"); 145 150 #ifdef OPT_CURVES … … 180 185 181 186 histogram_process(); 187 188 182 189 #ifdef OPT_EDGEOVERLAY 183 if(conf.edge_overlay_thresh && conf.edge_overlay_enable) edge_overlay(); 190 if(conf.edge_overlay_thresh && conf.edge_overlay_enable) { 191 192 // We need to skip first tick because stability 193 static int skip_counter=1; 194 195 if (skip_counter>0) { 196 skip_counter--; 197 } 198 else if (module_edgeovr_load()) { 199 edge_overlay(); 200 } 201 } 184 202 #endif 185 203 } … … 190 208 } 191 209 210 // Process async module unload requests 211 module_tick_unloader(); 212 192 213 msleep(20); 193 214 } -
branches/reyalp-flt/core/raw.c
r1414 r1467 14 14 #endif 15 15 #ifdef OPT_CURVES 16 #include " curves.h"16 #include "modules.h" 17 17 #endif 18 18 #include "shot_histogram.h" … … 181 181 } 182 182 #ifdef OPT_CURVES 183 if (conf.curve_enable) curve_apply(); 183 if (conf.curve_enable) { 184 if (module_curve_load()) 185 curve_apply(); 186 } 184 187 #endif 185 188 finished(); … … 297 300 298 301 #ifdef OPT_CURVES 299 if (conf.curve_enable) curve_apply(); 302 if (conf.curve_enable) { 303 if (module_curve_load()) 304 curve_apply(); 305 } 300 306 #endif 301 307 return ret; -
branches/reyalp-flt/core/raw_merge.c
r1211 r1467 8 8 #include "lang.h" 9 9 #include "conf.h" 10 #include "module_exportlist.h" 11 10 12 #define TEMP_FILE_NAME "A/raw16.tmp" 11 13 #define TEMP_FILE_NAME_1 "A/raw16_1.tmp" … … 35 37 int result; 36 38 if ((from==0) || (sub==0)) return 0; // bad pixel 37 result = from - sub + CAM_ BLACK_LEVEL;38 if (result<CAM_ BLACK_LEVEL) result=CAM_BLACK_LEVEL;39 if (result>CAM_ WHITE_LEVEL) result=CAM_WHITE_LEVEL;39 result = from - sub + CAM_CHDK_BLACK_LEVEL; 40 if (result<CAM_CHDK_BLACK_LEVEL) result=CAM_CHDK_BLACK_LEVEL; 41 if (result>CAM_CHDK_WHITE_LEVEL) result=CAM_CHDK_WHITE_LEVEL; 40 42 return result; 41 43 … … 62 64 return 0; 63 65 64 if( (baccum=malloc(RAW_ ROWLEN)) &&65 (bsub=malloc(RAW_ ROWLEN)) &&66 if( (baccum=malloc(RAW_CHDK_ROWLEN)) && 67 (bsub=malloc(RAW_CHDK_ROWLEN)) && 66 68 (ffrom=fopen(from, "rb")) && 67 69 (fsub=fopen(sub, "rb")) && … … 70 72 { 71 73 started(); 72 for (j = 0; j < CAM_ RAW_ROWS; j++) {73 fread(baccum,1, RAW_ ROWLEN,ffrom);74 fread(bsub,1, RAW_ ROWLEN,fsub);75 76 #if CAM_ SENSOR_BITS_PER_PIXEL==1077 78 for(i = 0;i<RAW_ ROWLEN; i+=10) {74 for (j = 0; j < CAM_CHDK_RAW_ROWS; j++) { 75 fread(baccum,1, RAW_CHDK_ROWLEN,ffrom); 76 fread(bsub,1, RAW_CHDK_ROWLEN,fsub); 77 78 #if CAM_MODULE_SENSOR_BITS_PER_PIXEL==10 79 80 for(i = 0;i<RAW_CHDK_ROWLEN; i+=10) { 79 81 s =((0x3fc&(((unsigned short)bsub[i+1])<<2)) | (bsub[i+0] >> 6)); 80 82 d =((0x3fc&(((unsigned short)baccum[i+1])<<2)) | (baccum[i+0] >> 6)); … … 129 131 } 130 132 131 #elif CAM_ SENSOR_BITS_PER_PIXEL==12132 133 for(i = 0;i<RAW_ ROWLEN; i+=6) {133 #elif CAM_MODULE_SENSOR_BITS_PER_PIXEL==12 134 135 for(i = 0;i<RAW_CHDK_ROWLEN; i+=6) { 134 136 135 137 s=((0xFF0&(((unsigned short)bsub[i+1])<<4)) | (bsub[i+0] >> 4)); … … 162 164 #endif 163 165 164 fwrite(baccum,1,RAW_ ROWLEN,fdest);166 fwrite(baccum,1,RAW_CHDK_ROWLEN,fdest); 165 167 if ( (j & 0x1F) == 0 ) { 166 gui_browser_progress_show((char *)dest, j*100/CAM_ RAW_ROWS);168 gui_browser_progress_show((char *)dest, j*100/CAM_CHDK_RAW_ROWS); 167 169 } 168 170 } … … 187 189 int raw_merge_start(int action){ 188 190 unsigned int req, avail; 189 req=((CAM_ RAW_ROWPIX*CAM_RAW_ROWS)>>18)+1;191 req=((CAM_CHDK_RAW_ROWPIX*CAM_CHDK_RAW_ROWS)>>18)+1; 190 192 avail=GetFreeCardSpaceKb()>>10; 191 193 if (avail<req) { … … 196 198 raw_action=action; 197 199 raw_count=0; 198 row=malloc(CAM_ RAW_ROWPIX*sizeof(unsigned short));200 row=malloc(CAM_CHDK_RAW_ROWPIX*sizeof(unsigned short)); 199 201 if (!row) 200 202 return 0; 201 rawrow=malloc(RAW_ ROWLEN);203 rawrow=malloc(RAW_CHDK_ROWLEN); 202 204 if (!rawrow) { 203 205 free(row); … … 228 230 fbrawout=fopen(TEMP_FILE_NAME_1,"w+b"); 229 231 if (fbrawout){ 230 fread(rawrow, 1, RAW_ ROWLEN, fcraw);232 fread(rawrow, 1, RAW_CHDK_ROWLEN, fcraw); 231 233 if (raw_count) 232 fread(row, 1, CAM_ RAW_ROWPIX*sizeof(unsigned short), fbrawin);234 fread(row, 1, CAM_CHDK_RAW_ROWPIX*sizeof(unsigned short), fbrawin); 233 235 else 234 for (i=0;i<CAM_ RAW_ROWPIX;i++)236 for (i=0;i<CAM_CHDK_RAW_ROWPIX;i++) 235 237 row[i]=0; 236 238 237 for (nrow=0,j=0;nrow<CAM_ RAW_ROWS;nrow++,j++){238 239 #if CAM_ SENSOR_BITS_PER_PIXEL==10240 241 for (i=0,src=0; i<CAM_ RAW_ROWPIX; i+=8, src+=10){239 for (nrow=0,j=0;nrow<CAM_CHDK_RAW_ROWS;nrow++,j++){ 240 241 #if CAM_MODULE_SENSOR_BITS_PER_PIXEL==10 242 243 for (i=0,src=0; i<CAM_CHDK_RAW_ROWPIX; i+=8, src+=10){ 242 244 row[i+0]+=((0x3fc&(((unsigned short)rawrow[src+1])<<2)) | (rawrow[src+0] >> 6)); 243 245 row[i+1]+=((0x3f0&(((unsigned short)rawrow[src+0])<<4)) | (rawrow[src+3] >> 4)); … … 250 252 } 251 253 252 #elif CAM_ SENSOR_BITS_PER_PIXEL==12253 254 for (i=0,src=0; i<CAM_ RAW_ROWPIX; i+=4, src+=6){254 #elif CAM_MODULE_SENSOR_BITS_PER_PIXEL==12 255 256 for (i=0,src=0; i<CAM_CHDK_RAW_ROWPIX; i+=4, src+=6){ 255 257 row[i+0]+=((0xFF0&(((unsigned short)rawrow[src+1])<<4)) | (rawrow[src+0] >> 4)); 256 258 row[i+1]+=((0xF00&(((unsigned short)rawrow[src+0])<<8)) | (rawrow[src+3] )); … … 263 265 #endif 264 266 265 fwrite(row, 1, CAM_ RAW_ROWPIX*sizeof(unsigned short), fbrawout);267 fwrite(row, 1, CAM_CHDK_RAW_ROWPIX*sizeof(unsigned short), fbrawout); 266 268 if (raw_count) 267 fread(row, 1, CAM_ RAW_ROWPIX*sizeof(unsigned short), fbrawin);269 fread(row, 1, CAM_CHDK_RAW_ROWPIX*sizeof(unsigned short), fbrawin); 268 270 else 269 for (i=0;i<CAM_ RAW_ROWPIX;i++)271 for (i=0;i<CAM_CHDK_RAW_ROWPIX;i++) 270 272 row[i]=0; 271 fread(rawrow, 1, RAW_ ROWLEN, fcraw);272 if (j>=CAM_ RAW_ROWS/10) {273 j-=CAM_ RAW_ROWS/10;274 gui_browser_progress_show(filename, nrow*100/CAM_ RAW_ROWS);273 fread(rawrow, 1, RAW_CHDK_ROWLEN, fcraw); 274 if (j>=CAM_CHDK_RAW_ROWS/10) { 275 j-=CAM_CHDK_RAW_ROWS/10; 276 gui_browser_progress_show(filename, nrow*100/CAM_CHDK_RAW_ROWS); 275 277 } 276 278 } … … 307 309 fcraw=fopen(namebuf,"w+b"); 308 310 if (fcraw) { 309 fread(row, 1, CAM_ RAW_ROWPIX*sizeof(unsigned short), fbraw);310 for (nrow=0,j=0;nrow<CAM_ RAW_ROWS;nrow++,j++) {311 for (i=0;i<CAM_ RAW_ROWPIX;i++) {311 fread(row, 1, CAM_CHDK_RAW_ROWPIX*sizeof(unsigned short), fbraw); 312 for (nrow=0,j=0;nrow<CAM_CHDK_RAW_ROWS;nrow++,j++) { 313 for (i=0;i<CAM_CHDK_RAW_ROWPIX;i++) { 312 314 if (raw_action==RAW_OPERATION_AVERAGE) 313 315 row[i]/=raw_count; 314 316 else { 315 if (row[i]>CAM_ BLACK_LEVEL*(raw_count-1))316 row[i]-=CAM_ BLACK_LEVEL*(raw_count-1);317 if (row[i]>CAM_CHDK_BLACK_LEVEL*(raw_count-1)) 318 row[i]-=CAM_CHDK_BLACK_LEVEL*(raw_count-1); 317 319 else 318 320 row[i]=0; 319 if (row[i]>CAM_ WHITE_LEVEL)320 row[i]=CAM_ WHITE_LEVEL;321 if (row[i]>CAM_CHDK_WHITE_LEVEL) 322 row[i]=CAM_CHDK_WHITE_LEVEL; 321 323 } 322 324 } 323 #if CAM_ SENSOR_BITS_PER_PIXEL==10324 for (i=0,src=0;i<CAM_ RAW_ROWPIX;i+=8,src+=10) {325 #if CAM_MODULE_SENSOR_BITS_PER_PIXEL==10 326 for (i=0,src=0;i<CAM_CHDK_RAW_ROWPIX;i+=8,src+=10) { 325 327 rawrow[src+0]=(row[i+0]<<6)|(row[i+1]>>4); 326 328 rawrow[src+1]=(row[i+0]>>2); … … 334 336 rawrow[src+9]=(row[i+6]<<2)|(row[i+7]>>8); 335 337 } 336 #elif CAM_ SENSOR_BITS_PER_PIXEL==12337 for (i=0,src=0; i<CAM_ RAW_ROWPIX; i+=4, src+=6){338 #elif CAM_MODULE_SENSOR_BITS_PER_PIXEL==12 339 for (i=0,src=0; i<CAM_CHDK_RAW_ROWPIX; i+=4, src+=6){ 338 340 rawrow[src+0]=(row[i+0]<<4)|(row[i+1]>>8); 339 341 rawrow[src+1]=(row[i+0]>>4); … … 347 349 #endif 348 350 349 fwrite(rawrow, 1, RAW_ ROWLEN, fcraw);350 fread(row, 1, CAM_ RAW_ROWPIX*sizeof(unsigned short), fbraw);351 if (j>=CAM_ RAW_ROWS/5) {352 j-=CAM_ RAW_ROWS/5;353 gui_browser_progress_show(namebuf, nrow*100/CAM_ RAW_ROWS);351 fwrite(rawrow, 1, RAW_CHDK_ROWLEN, fcraw); 352 fread(row, 1, CAM_CHDK_RAW_ROWPIX*sizeof(unsigned short), fbraw); 353 if (j>=CAM_CHDK_RAW_ROWS/5) { 354 j-=CAM_CHDK_RAW_ROWS/5; 355 gui_browser_progress_show(namebuf, nrow*100/CAM_CHDK_RAW_ROWS); 354 356 } 355 357 } … … 368 370 } 369 371 372 373 // ========= MODULE INIT ================= 374 #include "module_load.h" 375 int module_idx=-1; 376 377 /***************** BEGIN OF AUXILARY PART ********************* 378 ATTENTION: DO NOT REMOVE OR CHANGE SIGNATURES IN THIS SECTION 379 **************************************************************/ 380 381 int _chdk_required_ver = 1; // minimal required chdk build. 0-no limitation 382 int _chdk_required_platfid = 0; // platform-specific module. 0-no limitation 383 384 void* MODULE_EXPORT_LIST[] = { 385 /* 0 */ (void*)EXPORTLIST_MAGIC_NUMBER, 386 /* 1 */ (void*)6, 387 388 raw_merge_start, 389 raw_merge_add_file, 390 raw_merge_end, 391 raw_subtract 392 }; 393 394 395 //--------------------------------------------------------- 396 // PURPOSE: Bind module symbols with chdk. 397 // Required function 398 // PARAMETERS: pointer to chdk list of export 399 // RETURN VALUE: 1 error, 0 ok 400 //--------------------------------------------------------- 401 int _module_loader( void** chdk_export_list ) 402 { 403 if ( (unsigned int)chdk_export_list[0] != EXPORTLIST_MAGIC_NUMBER ) 404 return 1; 405 406 return 0; 407 } 408 409 410 411 //--------------------------------------------------------- 412 // PURPOSE: Finalize module operations (close allocs, etc) 413 // RETURN VALUE: 0-ok, 1-fail 414 //--------------------------------------------------------- 415 int _module_unloader() 416 { 417 return 0; 418 } 419 420 421 422 /*************** END OF AUXILARY PART *******************/ -
branches/reyalp-flt/core/raw_merge.h
r594 r1467 5 5 #define RAW_OPERATION_AVERAGE 1 6 6 7 8 struct librawop_sym{ 9 int (*raw_merge_start)(int action); 10 void (*raw_merge_add_file)(const char * filename); 11 void (*raw_merge_end)(void); 12 int (*raw_subtract)(const char *from, const char *sub, const char *dest); 13 }; 14 15 // Defines of exported to chdk symbols 16 #ifdef THIS_IS_CHDK_CORE 17 // This section is for CHDK core 18 19 extern struct librawop_sym librawop; 20 21 #else 22 // This section is for module 23 7 24 int raw_merge_start(int action); 8 25 void raw_merge_add_file(const char * filename); … … 10 27 int raw_subtract(const char *from, const char *sub, const char *dest); 11 28 #endif 29 30 #endif -
branches/reyalp-flt/core/script.c
r1437 r1467 593 593 extern char* gui_fselect_result(); 594 594 // Send file name back to script caller 595 lua_pushstring( Lt, gui_fselect_result() );595 //// lua_pushstring( Lt, gui_fselect_result() ); 596 596 } 597 597 #endif -
branches/reyalp-flt/include/gui.h
r1338 r1467 8 8 9 9 // Don't delete or re-order entries unless guiHandlers (gui.c) table is updated to match 10 enum Gui_Mode {10 enum Gui_Mode_ { 11 11 GUI_MODE_NONE = 0, 12 12 GUI_MODE_ALT, 13 13 GUI_MODE_MENU, 14 GUI_MODE_PALETTE,15 14 GUI_MODE_MBOX, 16 GUI_MODE_REVERSI,17 GUI_MODE_SOKOBAN,18 GUI_MODE_DEBUG,19 GUI_MODE_FSELECT,20 GUI_MODE_READ,21 15 GUI_MODE_OSD, 22 GUI_MODE_CALENDAR, 23 GUI_MODE_BENCH, 24 GUI_MODE_MPOPUP, 25 GUI_MODE_4WINS, 26 GUI_MODE_MASTERMIND 16 GUI_MODE_COUNT 27 17 }; 18 19 typedef unsigned int gui_mode_t; 20 21 #define GUI_MODE_MAGICNUM 0xd36c1559 22 23 // Specific behaviour of gui mode 24 #define GUI_MODE_FLAG_NODRAWRESTORE 1 25 #define GUI_MODE_FLAG_NORESTORE_ON_SWITCH 2 26 27 28 // Values (bit-flag) for gui_draw argument 29 #define GUI_REDRAWFLAG_ERASEGUARD 1 30 #define GUI_REDRAWFLAG_MODE_WAS_CHANGED 2 31 #define GUI_REDRAWFLAG_DRAW_RESTORED 4 32 33 // Structure to store gui redraw and kbd process handlers for each mode 34 typedef struct 35 { 36 void (*redraw)(int); // Called to redraw screen 37 void (*kbd_process)(void); // Main button handler for mode 38 void (*kbd_process_menu_btn)(void); // Menu button handler for mode 39 int flags; 40 unsigned int magicnum; // Safety check for modules 41 } gui_handler; 42 43 void gui_default_kbd_process_menu_btn(); 44 28 45 29 46 extern void gui_redraw(); … … 32 49 extern void draw_pixel(coord x, coord y, color cl); 33 50 34 extern enum Gui_Mode gui_get_mode(); 35 extern void gui_set_mode(enum Gui_Mode mode); 51 extern gui_mode_t gui_get_mode(); 52 extern void gui_set_mode(gui_mode_t mode); 53 54 36 55 37 56 #ifdef OPT_SCRIPTING -
branches/reyalp-flt/platform/g10/sub/102a/boot.c
r1329 r1467 19 19 extern volatile int jogdial_stopped; 20 20 void JogDial_task_my(void); 21 22 enum Gui_Mode gui_get_mode() ;23 21 24 22 void __attribute__((naked,noinline)) task_blinker() { -
branches/reyalp-flt/platform/g10/sub/103b/boot.c
r1329 r1467 19 19 extern volatile int jogdial_stopped; 20 20 void JogDial_task_my(void); 21 22 enum Gui_Mode gui_get_mode() ;23 21 24 22 void __attribute__((naked,noinline)) task_blinker() { -
branches/reyalp-flt/platform/g10/sub/104a/boot.c
r1329 r1467 19 19 extern volatile int jogdial_stopped; 20 20 void JogDial_task_my(void); 21 22 enum Gui_Mode gui_get_mode() ;23 21 24 22 void __attribute__((naked,noinline)) task_blinker() { -
branches/reyalp-flt/platform/s95/kbd.c
r1344 r1467 224 224 225 225 226 volatile int kbd_KEY_RING_FUNC; 227 226 228 void my_kbd_read_keys() 227 229 { … … 233 235 234 236 _GetKbdState(kbd_new_state); 237 kbd_KEY_RING_FUNC = !(kbd_new_state[2]&0x4000); 238 235 239 236 240 if (kbd_process() == 0) { -
branches/reyalp-flt/tools/Makefile
r1395 r1467 4 4 5 5 include $(topdir)makefile.inc 6 include $(topdir)version.inc 6 7 7 8 OBJS=pakwif.o finsig_$(PLATFORMOS).o gensig_$(PLATFORMOS).o dumpchk.o dancingbits.o rawconvert.o dumputil.o find_levent.o find_eventproc.o yuvconvert.o font_8x16_pack.o makelang.o … … 11 12 endif 12 13 13 all: pakwif$(EXE) finsig_$(PLATFORMOS)$(EXE) dancingbits$(EXE) font_8x16_pack$(EXE) makelang$(EXE) 14 SUBDIRS+=elf2flt 15 16 17 all: makeexport$(EXE) pakwif$(EXE) finsig_$(PLATFORMOS)$(EXE) dancingbits$(EXE) font_8x16_pack$(EXE) makelang$(EXE) 14 18 15 19 # not needed by batch builds, not built by default … … 18 22 %.o: %.c 19 23 @echo $< \-\> $@ 20 $(HOSTCC) $(HOSTCFLAGS) -DPLATFORMOS_$(PLATFORMOS) - c -o $@ $<24 $(HOSTCC) $(HOSTCFLAGS) -DPLATFORMOS_$(PLATFORMOS) -DBUILD_NUMBER=\"$(BUILD_NUMBER)\" -c -o $@ $< 21 25 22 26 .dep/%.d: %.c .dep … … 24 28 sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \ 25 29 rm -f $@.$$$$ 30 31 makeexport$(EXE): makeexport.o 32 @echo $< \-\> $@ 33 $(HOSTCC) $(HOSTCFLAGS) -o $@ $^ 26 34 27 35 pakwif$(EXE): pakwif.o … … 70 78 71 79 clean: 72 rm -f pakwif$(EXE) $(OBJS) 80 rm -f pakwif$(EXE) $(OBJS) makeexport.o 73 81 # if [ -s sig_ref_vxworks_1.bin ] && [ -s sig_ref_vxworks_2.bin ] && [ -s sig_ref_vxworks_3.bin ] ; then \ 74 82 # rm -f signatures_vxworks.h ; \
Note: See TracChangeset
for help on using the changeset viewer.