예제 #1
0
static void gui_load_script_selected(const char *fn) {
    if (fn) {
        gui_menu_cancel_redraw();   // Stop menu redraw until after menu rebuilt from script params
        save_params_values(0);
        script_load(fn);
        gui_set_need_restore();
    }
}
예제 #2
0
파일: gui_script.c 프로젝트: c10ud/CHDK
static void gui_reset_script_default(int arg)
{
    gui_menu_cancel_redraw();       // Stop menu redraw until after menu rebuilt from script params
    save_params_values(0);
    conf.script_file[0] = 0;        // Reset loaded script
    script_load(conf.script_file);
    gui_set_need_restore();
}
예제 #3
0
파일: kbd.c 프로젝트: shentok/chdk-a430
void script_start( int autostart )
{
    int i;

    shot_histogram_set(0);
    if (autostart) auto_started = 1; else auto_started = 0;
    delay_target_ticks = 0;
    kbd_int_stack_ptr = 0;
    kbd_last_clicked = 0;
    /*if (!autostart)*/ kbd_key_release_all();

    script_console_clear();
    script_print_screen_init();

			if (conf.script_param_save)
				{
        save_params_values(0);
      }
    if( autostart )
      script_console_add_line("***Autostart***");
    else
      script_console_add_line(lang_str(LANG_CONSOLE_TEXT_STARTED));

    if( is_lua() ) {
      
      if( !lua_script_start(state_ubasic_script) ) {
    script_print_screen_end();
    wait_and_end();
    return;
      }
      for (i=0; i<SCRIPT_NUM_PARAMS; ++i) {
    if( script_params[i][0] ) {
    char var = 'a'+i;
    lua_pushlstring( L, &var, 1 );
    lua_pushnumber( L, conf.ubasic_vars[i] );
    lua_settable( L, LUA_GLOBALSINDEX );
    }
      }
      state_lua_kbd_first_call_to_resume = 1;
    }
    else {
      ubasic_init(state_ubasic_script);

      for (i=0; i<SCRIPT_NUM_PARAMS; ++i) {
        ubasic_set_variable(i, conf.ubasic_vars[i]);
      }
    }

    state_kbd_script_run = 1;

    if (conf.alt_prevent_shutdown != ALT_PREVENT_SHUTDOWN_ALT_SCRIPT) {
        enable_shutdown();
    }
}
예제 #4
0
파일: gui_script.c 프로젝트: c10ud/CHDK
static void cb_change_param_save_enum()
{
    if (conf.script_param_set != DEFAULT_PARAM_SET)
    {
        if (conf.script_param_save)
            save_params_values(0);
    }
    else
    {
        conf.script_param_save = 0;
    }
}
예제 #5
0
static const char* gui_script_param_set_enum(int change, int arg)
{
    static const char* modes[]={ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "Default" };

    if (change != 0)
    {
        save_params_values(0);
        gui_enum_value_change(&conf.script_param_set,change,sizeof(modes)/sizeof(modes[0]));

        if ( !load_params_values(conf.script_file, conf.script_param_set) )
            script_reset_to_default_params_values();
        gui_update_script_submenu();
    }

    return modes[conf.script_param_set];
}
예제 #6
0
static const char* gui_script_param_save_enum(int change, int arg)
{
    static const char* modes[]={ "Off", "On" };

    if (conf.script_param_set != DEFAULT_PARAM_SET)
    {
        if (change != 0)
        {
            gui_enum_value_change(&conf.script_param_save,change,sizeof(modes)/sizeof(modes[0]));
            if (conf.script_param_save)
                save_params_values(0);
        }

        return modes[conf.script_param_save];
    }

    return modes[0];
}
예제 #7
0
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();
}
예제 #8
0
static void gui_load_script_default(int arg) {
    script_reset_to_default_params_values();
    gui_update_script_submenu();
    save_params_values(1);
}