//------------------------------------------------------------------- static int gui_console_kbd_process() { switch (kbd_get_clicked_key() | get_jogdial_direction()) { case JOGDIAL_LEFT: case KEY_UP: if (console_scroll < (MAX_CONSOLE_HISTORY-MAX_CONSOLE_DISP_LINES)) { console_scroll++; console_redraw_flag = 1; } break; case JOGDIAL_RIGHT: case KEY_DOWN: if (console_scroll > 0) { console_scroll--; console_redraw_flag = 1; } break; case KEY_SET: gui_set_mode(gui_console_mode_old); break; } return 0; }
static void modinspect_unload_cb(unsigned int btn) { if (btn==MBOX_BTN_YES) { module_async_unload_allrunned(0); gui_set_mode(modinspect_old_guimode); // if core gui - return to it } modinspect_redraw=2; }
//------------------------------------------------------------------- void gui_debug_init(void *st_addr) { addr = st_addr; debug_to_draw = 1; debug_cont_update = 1; step = 4; gui_set_mode(GUI_MODE_DEBUG); }
//------------------------------------------------------------------- int gui_read_init(const char* file) { running = 1; static struct stat st; read_file = open(file, O_RDONLY, 0777); if (strcmp(file, conf.reader_file)!=0) { conf.reader_pos = 0; strcpy(conf.reader_file, file); } read_on_screen = 0; read_file_size = (read_file>=0 && stat((char*)file, &st)==0)?st.st_size:0; if (read_file_size<=conf.reader_pos) { conf.reader_pos = 0; } pause = 0; read_to_draw = 1; x=camera_screen.disp_left+6; y=FONT_HEIGHT; w=camera_screen.disp_width-6-6-8; h=camera_screen.height-y; last_time = get_tick_count(); reader_is_active=1; old_mode = gui_set_mode(&GUI_MODE_READ); return (read_file >= 0); }
//------------------------------------------------------------------- int gui_read_init(const char* file) { static struct STD_stat st; read_file = safe_open(file, O_RDONLY, 0777); if (strcmp(file, conf.reader_file)!=0) { conf.reader_pos = 0; strcpy(conf.reader_file, file); } read_on_screen = 0; read_file_size = (read_file>=0 && safe_stat((char*)file, &st)==0)?st.st_size:0; if (read_file_size<=conf.reader_pos) { conf.reader_pos = 0; } pause = 0; read_to_draw = 1; x=camera_screen.ts_button_border+6; y=FONT_HEIGHT; w=camera_screen.width-camera_screen.ts_button_border*2-6-6-8; h=camera_screen.height-y; last_time = get_tick_count(); reader_is_active=1; old_mode = gui_set_mode(&GUI_MODE_READ); draw_filled_rect(0, 0, camera_screen.width-1, y-1, MAKE_COLOR(COLOR_BLACK, COLOR_BLACK)); draw_filled_rect(0, y, camera_screen.width-1, camera_screen.height-1, MAKE_COLOR(BG_COLOR(conf.reader_color), BG_COLOR(conf.reader_color))); gui_read_draw_scroll_indicator(); gui_read_draw_batt(); return (read_file >= 0); }
// Terminate a script, either because of error, or the script finished void script_end() { // Tell other code that script has ended camera_info.state.state_kbd_script_run = SCRIPT_STATE_INACTIVE; camera_info.state.osd_title_line = 1 ; // reset the script terminate key script_terminate_key = KEY_SHOOT_FULL ; script_print_screen_end(); console_set_autoredraw(1); // Force console display on in case script turned it off // Restore old handler - prevent calling MD draw after module unloaded if (old_gui_handler) { extern gui_handler defaultGuiHandler; // if script switched in or out of alt, try to preserve // TODO is there ever a situation where it should be something other than default or alt? if(old_gui_handler == &altGuiHandler && camera_info.state.gui_mode_none) { gui_set_mode(&defaultGuiHandler); } else if(old_gui_handler == &defaultGuiHandler && camera_info.state.gui_mode_alt) { gui_set_mode(&altGuiHandler); } else { gui_set_mode(old_gui_handler); } old_gui_handler = 0; } // Reset script language module libscriptapi->script_reset(); // Kill off the action_stack for the script, since we've just reset the script // language and unloaded the MD module, we don't need to let the stack empty // itself. action_stack_kill(running_script_stack_name); running_script_stack_name = -1; libshothisto->shot_histogram_set(0); kbd_key_release_all(); conf_setAutosave(1); // Turn on autosave of config file in conf_setValue in case script turned it off conf_update_prevent_shutdown(); }
//------------------------------------------------------------------- int basic_module_init() { gui_set_mode(&GUI_MODE_CALENDAR); calendar_goto_today(); cal_w = FONT_WIDTH*4*7; cal_h = 4+FONT_HEIGHT+4+4+FONT_HEIGHT+4+(FONT_HEIGHT+4)*6; cal_x = (camera_screen.width-cal_w)/2; cal_y = FONT_HEIGHT+(camera_screen.height-FONT_HEIGHT-cal_h)/2; need_redraw = 2; return 1; }
//------------------------------------------------------------------- // Return to previous menu on stack static void gui_menu_back() { if (gui_menu_stack_ptr > 0) { gui_menu_stack_ptr--; gui_menu_set_curr_menu(gui_menu_stack[gui_menu_stack_ptr].menu, gui_menu_stack[gui_menu_stack_ptr].toppos, gui_menu_stack[gui_menu_stack_ptr].curpos); gui_menu_erase_and_redraw(); } else { // 'Back' selected; but no menu to go back to // Occurs when script menu opened using 'Func/Set' button // Return to normal <ALT> mode. gui_set_mode(&altGuiHandler); } }
void gui_load_user_menu_script(const char *fn) { if (fn) { #ifdef OPT_SCRIPTING script_load(fn, SCRIPT_LOAD_LAST_PARAMSET ); load_params_names_cfg(); #endif // exit menu system on the assumption the user will want to run the script just loaded gui_set_mode(&altGuiHandler); kbd_reset_autoclicked_key(); rinit(); } }
long script_start_gui( int autostart ) { int i; if (conf.script_file[0] == 0) return 0; libshothisto->shot_histogram_set(0); camera_info.state.auto_started = autostart; // Kill high speed USB timer if running stop_usb_HPtimer(); // Keyboard init camera_info.state.kbd_last_clicked = 0; camera_info.state.kbd_last_checked_time = get_tick_count(); kbd_key_release_all(); // Close old console, will be re-opened when first line added console_close(); script_print_screen_init(); save_params_values(0); script_console_add_line((autostart)?LANG_CONSOLE_TEXT_AUTOSTARTED:LANG_CONSOLE_TEXT_STARTED); module_set_script_lang(conf.script_file); if ( !libscriptapi->script_start_file(conf.script_file) ) { return -1; } sc_param *p = script_params; while (p) { libscriptapi->set_variable(p->name, p->val, (p->range == 1), (p->data_type == DTYPE_TABLE), p->option_count, p->options); p = p->next; } conf_update_prevent_shutdown(); old_gui_handler = gui_set_mode(&scriptGuiHandler); return script_stack_start(); }
int basic_module_init() { gui_bench_init(); gui_set_mode(&GUI_MODE_BENCH); return 1; }
int basic_module_init() { modinspect_redraw=2; modinspect_old_guimode = gui_set_mode(&GUI_MODE_MODULE_INSPECTOR); return 1; }
//------------------------------------------------------------------- void display_console() { console_redraw_flag = 1; console_scroll = 0; gui_console_mode_old = gui_set_mode(&mboxGuiHandler); }
void gui_module_menu_kbd_process() { gui_set_mode(modinspect_old_guimode); module_async_unload(module_idx); }
int gui_snake_init() { draw_filled_rect(0,0,camera_screen.width,camera_screen.height, COLOR_WHITE); snake_start(); gui_set_mode(&GUI_MODE_SNAKE); return 1; }
int basic_module_init() { gui_set_mode(&GUI_MODE_TETRIS); gui_tetris_init(); return 1; }
//------------------------------------------------------------------- // Menu button handled for text reader void gui_read_kbd_process_menu_btn() { gui_read_kbd_process(); gui_set_mode(old_mode); module_async_unload(module_idx); }
//------------------------------------------------------------------- // Menu button handled for text reader void gui_read_kbd_process_menu_btn() { gui_read_kbd_process(); gui_set_mode(old_mode); }