| 1 | #include "kbd.h" |
|---|
| 2 | #include "stdlib.h" |
|---|
| 3 | #include "platform.h" |
|---|
| 4 | #include "core.h" |
|---|
| 5 | #include "keyboard.h" |
|---|
| 6 | #include "conf.h" |
|---|
| 7 | #include "camera.h" |
|---|
| 8 | #include "lang.h" |
|---|
| 9 | #include "ubasic.h" |
|---|
| 10 | #include "histogram.h" |
|---|
| 11 | #include "script.h" |
|---|
| 12 | #include "gui_lang.h" |
|---|
| 13 | #include "motion_detector.h" |
|---|
| 14 | #include "lua.h" |
|---|
| 15 | #include "lualib.h" |
|---|
| 16 | #include "lauxlib.h" |
|---|
| 17 | #include "luascript.h" |
|---|
| 18 | #include "../lib/lua/lstate.h" // for L->nCcalls, baseCcalls |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | #define SCRIPT_END 0 |
|---|
| 22 | #define SCRIPT_CLICK 1 |
|---|
| 23 | #define SCRIPT_SHOOT 2 |
|---|
| 24 | #define SCRIPT_SLEEP 3 |
|---|
| 25 | #define SCRIPT_PRESS 4 |
|---|
| 26 | #define SCRIPT_RELEASE 5 |
|---|
| 27 | #define SCRIPT_PR_WAIT_SAVE 6 |
|---|
| 28 | #define SCRIPT_WAIT_SAVE 7 |
|---|
| 29 | #define SCRIPT_WAIT_FLASH 8 |
|---|
| 30 | #define SCRIPT_WAIT_EXPHIST 9 |
|---|
| 31 | #define SCRIPT_PR_WAIT_EXPHIST 10 |
|---|
| 32 | #define SCRIPT_WAIT_CLICK 11 |
|---|
| 33 | #define SCRIPT_MOTION_DETECTOR 12 |
|---|
| 34 | |
|---|
| 35 | #define KBD_STACK_SIZE 24 |
|---|
| 36 | |
|---|
| 37 | static long kbd_int_stack[KBD_STACK_SIZE]; |
|---|
| 38 | static int kbd_int_stack_ptr; |
|---|
| 39 | |
|---|
| 40 | #define KBD_STACK_PUSH(v) kbd_int_stack[kbd_int_stack_ptr++] = (v); |
|---|
| 41 | #define KBD_STACK_PREV(p) (kbd_int_stack[kbd_int_stack_ptr-(p)]) |
|---|
| 42 | |
|---|
| 43 | static int soft_half_press = 0; |
|---|
| 44 | static int kbd_blocked; |
|---|
| 45 | static int key_pressed; |
|---|
| 46 | int state_kbd_script_run; |
|---|
| 47 | int state_lua_kbd_first_call_to_resume; // AUJ |
|---|
| 48 | static long delay_target_ticks; |
|---|
| 49 | static long kbd_last_clicked; |
|---|
| 50 | |
|---|
| 51 | // ------ add by Masuji SUTO (start) -------------- |
|---|
| 52 | static int mvideo,mplay; |
|---|
| 53 | static int nSW=0; |
|---|
| 54 | static int nRmt=0; |
|---|
| 55 | static int nWt=0; |
|---|
| 56 | static int nCount=0; |
|---|
| 57 | static int nCa=0; |
|---|
| 58 | static int nCount2=0; |
|---|
| 59 | static int nTxvideo=0; |
|---|
| 60 | static int nTxzoom=0; |
|---|
| 61 | static int nTxzname=KEY_ZOOM_IN; |
|---|
| 62 | static int nPlyname=KEY_LEFT; |
|---|
| 63 | static int nIntzpos; |
|---|
| 64 | static int nReczoom=0; |
|---|
| 65 | static int nTxtblcr=0; |
|---|
| 66 | int shutter_int=0; |
|---|
| 67 | |
|---|
| 68 | #if defined(CAMERA_ixus960_sd950) |
|---|
| 69 | static int nFirst=1; |
|---|
| 70 | #endif |
|---|
| 71 | |
|---|
| 72 | #if defined(CAMERA_a450) || defined(CAMERA_ixus50_sd400) || defined(CAMERA_ixus55_sd450) || defined(CAMERA_ixus60_sd600) || defined(CAMERA_ixus65_sd630) || defined(CAMERA_ixus70_sd1000) || defined(CAMERA_ixus700_sd500) || defined(CAMERA_ixus750_sd550) || defined(CAMERA_ixus850_sd800) |
|---|
| 73 | #define ZSTEP_TABLE_SIZE 7 |
|---|
| 74 | static int nTxtbl[]={0,1,2,3,4,5,6}; |
|---|
| 75 | #endif |
|---|
| 76 | |
|---|
| 77 | #if defined(CAMERA_s2is) || defined(CAMERA_s3is) || defined(CAMERA_s5is) |
|---|
| 78 | #define ZSTEP_TABLE_SIZE 8 |
|---|
| 79 | static int nTxtbl[]={0,11,25,41,64,86,105,128}; |
|---|
| 80 | #endif |
|---|
| 81 | |
|---|
| 82 | #if defined(CAMERA_tx1) |
|---|
| 83 | #define ZSTEP_TABLE_SIZE 8 |
|---|
| 84 | static int nTxtbl[]={0,18,43,55,76,93,113,124}; |
|---|
| 85 | #endif |
|---|
| 86 | |
|---|
| 87 | #if defined(CAMERA_a460) || defined(CAMERA_a530) || defined (CAMERA_a540) || defined(CAMERA_a550) || defined(CAMERA_a560) || defined(CAMERA_a570) || defined(CAMERA_ixus860_sd870) || defined(CAMERA_ixus960_sd950) |
|---|
| 88 | #define ZSTEP_TABLE_SIZE 8 |
|---|
| 89 | static int nTxtbl[]={0,1,2,3,4,5,6,7}; |
|---|
| 90 | #endif |
|---|
| 91 | |
|---|
| 92 | |
|---|
| 93 | #if defined(CAMERA_a610) || defined(CAMERA_a620) || defined(CAMERA_a630) || defined(CAMERA_a640) || defined(CAMERA_ixus800_sd700) || defined(CAMERA_ixus950_sd850) |
|---|
| 94 | #define ZSTEP_TABLE_SIZE 9 |
|---|
| 95 | static int nTxtbl[]={0,1,2,3,4,5,6,7,8}; |
|---|
| 96 | #endif |
|---|
| 97 | |
|---|
| 98 | #if defined (CAMERA_a700) || defined(CAMERA_a710) || defined (CAMERA_a720) |
|---|
| 99 | #define ZSTEP_TABLE_SIZE 8 |
|---|
| 100 | static int nTxtbl[]={0,2,4,6,8,10,12,14}; |
|---|
| 101 | #endif |
|---|
| 102 | |
|---|
| 103 | #if defined(CAMERA_a650) || defined(CAMERA_g7) |
|---|
| 104 | #define ZSTEP_TABLE_SIZE 8 |
|---|
| 105 | static int nTxtbl[]={0,2,4,6,8,10,12,13}; |
|---|
| 106 | #endif |
|---|
| 107 | // ------ add by Masuji SUTO (end) -------------- |
|---|
| 108 | #if defined(CAMERA_sx100is) |
|---|
| 109 | #define ZSTEP_TABLE_SIZE 8 |
|---|
| 110 | static int nTxtbl[]={0,3,6,9,13,16,20,23}; |
|---|
| 111 | #endif |
|---|
| 112 | |
|---|
| 113 | void kbd_sched_delay(long msec) |
|---|
| 114 | { |
|---|
| 115 | KBD_STACK_PUSH(msec); |
|---|
| 116 | KBD_STACK_PUSH(SCRIPT_SLEEP); |
|---|
| 117 | } |
|---|
| 118 | |
|---|
| 119 | |
|---|
| 120 | void kbd_sched_motion_detector(){ |
|---|
| 121 | KBD_STACK_PUSH(SCRIPT_MOTION_DETECTOR); |
|---|
| 122 | } |
|---|
| 123 | |
|---|
| 124 | void kbd_sched_press(long key) |
|---|
| 125 | { |
|---|
| 126 | // WARNING stack program flow is reversed |
|---|
| 127 | kbd_sched_delay(20); |
|---|
| 128 | |
|---|
| 129 | KBD_STACK_PUSH(key); |
|---|
| 130 | KBD_STACK_PUSH(SCRIPT_PRESS); |
|---|
| 131 | } |
|---|
| 132 | |
|---|
| 133 | void kbd_sched_release(long key) |
|---|
| 134 | { |
|---|
| 135 | // WARNING stack program flow is reversed |
|---|
| 136 | kbd_sched_delay(20); |
|---|
| 137 | |
|---|
| 138 | KBD_STACK_PUSH(key); |
|---|
| 139 | KBD_STACK_PUSH(SCRIPT_RELEASE); |
|---|
| 140 | } |
|---|
| 141 | |
|---|
| 142 | void md_kbd_sched_immediate_shoot(int no_release) |
|---|
| 143 | { |
|---|
| 144 | kbd_int_stack_ptr-=1;// REMOVE MD ITEM |
|---|
| 145 | |
|---|
| 146 | // stack operations are reversed! |
|---|
| 147 | if (!no_release) // only release shutter if allowed |
|---|
| 148 | { |
|---|
| 149 | kbd_sched_release(KEY_SHOOT_FULL); |
|---|
| 150 | kbd_sched_delay(20); |
|---|
| 151 | } |
|---|
| 152 | KBD_STACK_PUSH(SCRIPT_MOTION_DETECTOR); // it will removed right after exit from this function |
|---|
| 153 | kbd_key_press(KEY_SHOOT_FULL); // not a stack operation... pressing right now |
|---|
| 154 | } |
|---|
| 155 | |
|---|
| 156 | |
|---|
| 157 | void kbd_sched_click(long key) |
|---|
| 158 | { |
|---|
| 159 | // WARNING stack program flow is reversed |
|---|
| 160 | kbd_sched_release(key); |
|---|
| 161 | kbd_sched_press(key); |
|---|
| 162 | } |
|---|
| 163 | |
|---|
| 164 | static void kbd_sched_wait_click(int timeout) |
|---|
| 165 | { |
|---|
| 166 | // WARNING stack program flow is reversed |
|---|
| 167 | KBD_STACK_PUSH(timeout); |
|---|
| 168 | KBD_STACK_PUSH(SCRIPT_WAIT_CLICK); |
|---|
| 169 | } |
|---|
| 170 | |
|---|
| 171 | void kbd_sched_shoot() |
|---|
| 172 | { |
|---|
| 173 | // WARNING stack program flow is reversed |
|---|
| 174 | |
|---|
| 175 | kbd_sched_delay(conf.script_shoot_delay*100);// XXX FIXME find out how to wait to jpeg save finished |
|---|
| 176 | |
|---|
| 177 | KBD_STACK_PUSH(SCRIPT_WAIT_SAVE); |
|---|
| 178 | |
|---|
| 179 | KBD_STACK_PUSH(KEY_SHOOT_FULL); |
|---|
| 180 | KBD_STACK_PUSH(SCRIPT_RELEASE); |
|---|
| 181 | |
|---|
| 182 | kbd_sched_delay(20); |
|---|
| 183 | |
|---|
| 184 | KBD_STACK_PUSH(KEY_SHOOT_FULL); |
|---|
| 185 | KBD_STACK_PUSH(SCRIPT_PRESS); |
|---|
| 186 | |
|---|
| 187 | KBD_STACK_PUSH(SCRIPT_WAIT_FLASH); |
|---|
| 188 | KBD_STACK_PUSH(SCRIPT_WAIT_EXPHIST); |
|---|
| 189 | KBD_STACK_PUSH(SCRIPT_PR_WAIT_EXPHIST); |
|---|
| 190 | |
|---|
| 191 | kbd_sched_delay(10); |
|---|
| 192 | |
|---|
| 193 | KBD_STACK_PUSH(KEY_SHOOT_HALF); |
|---|
| 194 | KBD_STACK_PUSH(SCRIPT_PRESS); |
|---|
| 195 | |
|---|
| 196 | KBD_STACK_PUSH(SCRIPT_PR_WAIT_SAVE); |
|---|
| 197 | |
|---|
| 198 | } |
|---|
| 199 | |
|---|
| 200 | static lua_State* L, *Lt; |
|---|
| 201 | |
|---|
| 202 | static int is_lua() |
|---|
| 203 | { |
|---|
| 204 | int len; |
|---|
| 205 | char const* s; |
|---|
| 206 | s = conf.script_file; |
|---|
| 207 | len = strlen( s ); |
|---|
| 208 | return len >= 4 && ( s[len-1] == 'a' || s[len-1] == 'A' ) |
|---|
| 209 | && ( s[len-2] == 'u' || s[len-2] == 'U' ) |
|---|
| 210 | && ( s[len-3] == 'l' || s[len-3] == 'L' ) |
|---|
| 211 | && s[len-4] == '.'; |
|---|
| 212 | } |
|---|
| 213 | |
|---|
| 214 | static void lua_count_hook(lua_State *L, lua_Debug *ar) |
|---|
| 215 | { |
|---|
| 216 | if( L->nCcalls <= L->baseCcalls ) |
|---|
| 217 | lua_yield( L, 0 ); |
|---|
| 218 | } |
|---|
| 219 | |
|---|
| 220 | static int lua_script_start( char const* script ) |
|---|
| 221 | { |
|---|
| 222 | L = lua_open(); |
|---|
| 223 | luaL_openlibs( L ); |
|---|
| 224 | register_lua_funcs( L ); |
|---|
| 225 | |
|---|
| 226 | Lt = lua_newthread( L ); |
|---|
| 227 | lua_setfield( L, LUA_REGISTRYINDEX, "Lt" ); |
|---|
| 228 | if( luaL_loadstring( Lt, script ) != 0 ) { |
|---|
| 229 | script_console_add_line( lua_tostring( Lt, -1 ) ); |
|---|
| 230 | lua_close( L ); |
|---|
| 231 | L = 0; |
|---|
| 232 | Lt = 0; |
|---|
| 233 | return 0; |
|---|
| 234 | } |
|---|
| 235 | lua_sethook(Lt, lua_count_hook, LUA_MASKCOUNT, 1000 ); |
|---|
| 236 | return 1; |
|---|
| 237 | } |
|---|
| 238 | |
|---|
| 239 | static void wait_and_end(void) |
|---|
| 240 | { |
|---|
| 241 | script_console_add_line("PRESS SHUTTER TO CLOSE"); |
|---|
| 242 | |
|---|
| 243 | // We're not running any more, but we have scheduled stuff that |
|---|
| 244 | // needs to finish. So keep the script marked as running, but don't |
|---|
| 245 | // call any more scripting functions. |
|---|
| 246 | state_kbd_script_run = 3; |
|---|
| 247 | } |
|---|
| 248 | |
|---|
| 249 | static void script_start( int autostart ) |
|---|
| 250 | { |
|---|
| 251 | int i; |
|---|
| 252 | |
|---|
| 253 | shot_histogram_enabled = 0; |
|---|
| 254 | if (autostart) auto_started = 1; else auto_started = 0; |
|---|
| 255 | delay_target_ticks = 0; |
|---|
| 256 | kbd_int_stack_ptr = 0; |
|---|
| 257 | kbd_last_clicked = 0; |
|---|
| 258 | /*if (!autostart)*/ kbd_key_release_all(); |
|---|
| 259 | |
|---|
| 260 | script_console_clear(); |
|---|
| 261 | script_print_screen_init(); |
|---|
| 262 | |
|---|
| 263 | save_params_values(0); |
|---|
| 264 | |
|---|
| 265 | if( autostart ) |
|---|
| 266 | script_console_add_line("***Autostart***"); |
|---|
| 267 | else |
|---|
| 268 | script_console_add_line(lang_str(LANG_CONSOLE_TEXT_STARTED)); |
|---|
| 269 | |
|---|
| 270 | if( is_lua() ) { |
|---|
| 271 | |
|---|
| 272 | if( !lua_script_start(state_ubasic_script) ) { |
|---|
| 273 | script_print_screen_end(); |
|---|
| 274 | wait_and_end(); |
|---|
| 275 | return; |
|---|
| 276 | } |
|---|
| 277 | for (i=0; i<SCRIPT_NUM_PARAMS; ++i) { |
|---|
| 278 | if( script_params[i][0] ) { |
|---|
| 279 | char var = 'a'+i; |
|---|
| 280 | lua_pushlstring( L, &var, 1 ); |
|---|
| 281 | lua_pushnumber( L, conf.ubasic_vars[i] ); |
|---|
| 282 | lua_settable( L, LUA_GLOBALSINDEX ); |
|---|
| 283 | } |
|---|
| 284 | } |
|---|
| 285 | state_lua_kbd_first_call_to_resume = 1; |
|---|
| 286 | } |
|---|
| 287 | else { |
|---|
| 288 | ubasic_init(state_ubasic_script); |
|---|
| 289 | |
|---|
| 290 | for (i=0; i<SCRIPT_NUM_PARAMS; ++i) { |
|---|
| 291 | ubasic_set_variable(i, conf.ubasic_vars[i]); |
|---|
| 292 | } |
|---|
| 293 | } |
|---|
| 294 | |
|---|
| 295 | state_kbd_script_run = 1; |
|---|
| 296 | |
|---|
| 297 | if (conf.alt_prevent_shutdown != ALT_PREVENT_SHUTDOWN_ALT_SCRIPT) { |
|---|
| 298 | enable_shutdown(); |
|---|
| 299 | } |
|---|
| 300 | } |
|---|
| 301 | |
|---|
| 302 | void script_end() |
|---|
| 303 | { |
|---|
| 304 | script_print_screen_end(); |
|---|
| 305 | if( L ) { |
|---|
| 306 | lua_close( L ); |
|---|
| 307 | L = 0; |
|---|
| 308 | Lt = 0; |
|---|
| 309 | } |
|---|
| 310 | else { |
|---|
| 311 | ubasic_end(); |
|---|
| 312 | } |
|---|
| 313 | |
|---|
| 314 | if (conf.alt_prevent_shutdown != ALT_PREVENT_SHUTDOWN_NO) { |
|---|
| 315 | disable_shutdown(); |
|---|
| 316 | } |
|---|
| 317 | kbd_key_release_all(); |
|---|
| 318 | state_kbd_script_run = 0; |
|---|
| 319 | vid_bitmap_refresh(); |
|---|
| 320 | } |
|---|
| 321 | |
|---|
| 322 | void process_script() |
|---|
| 323 | { |
|---|
| 324 | long t; |
|---|
| 325 | int Lres; |
|---|
| 326 | |
|---|
| 327 | // process stack operations |
|---|
| 328 | if (kbd_int_stack_ptr){ |
|---|
| 329 | switch (KBD_STACK_PREV(1)){ |
|---|
| 330 | |
|---|
| 331 | case SCRIPT_MOTION_DETECTOR: |
|---|
| 332 | if(md_detect_motion()==0){ |
|---|
| 333 | kbd_int_stack_ptr-=1; |
|---|
| 334 | if (L) |
|---|
| 335 | { |
|---|
| 336 | // We need to recover the motion detector's |
|---|
| 337 | // result from ubasic variable 0 and push |
|---|
| 338 | // it onto the thread's stack. -- AUJ |
|---|
| 339 | lua_pushnumber( Lt, ubasic_get_variable(0) ); |
|---|
| 340 | } |
|---|
| 341 | } |
|---|
| 342 | return; |
|---|
| 343 | |
|---|
| 344 | case SCRIPT_PRESS: |
|---|
| 345 | kbd_key_press(KBD_STACK_PREV(2)); |
|---|
| 346 | kbd_int_stack_ptr-=2; // pop op. |
|---|
| 347 | return; |
|---|
| 348 | case SCRIPT_RELEASE: |
|---|
| 349 | kbd_key_release(KBD_STACK_PREV(2)); |
|---|
| 350 | kbd_int_stack_ptr-=2; // pop op. |
|---|
| 351 | return; |
|---|
| 352 | case SCRIPT_SLEEP: |
|---|
| 353 | t = get_tick_count(); |
|---|
| 354 | // FIXME take care if overflow occurs |
|---|
| 355 | if (delay_target_ticks == 0){ |
|---|
| 356 | /* setup timer */ |
|---|
| 357 | delay_target_ticks = t+KBD_STACK_PREV(2); |
|---|
| 358 | } else { |
|---|
| 359 | if (delay_target_ticks <= t){ |
|---|
| 360 | delay_target_ticks = 0; |
|---|
| 361 | kbd_int_stack_ptr-=2; // pop sleep op. |
|---|
| 362 | } |
|---|
| 363 | } |
|---|
| 364 | return; |
|---|
| 365 | case SCRIPT_PR_WAIT_SAVE: |
|---|
| 366 | state_shooting_progress = SHOOTING_PROGRESS_NONE; |
|---|
| 367 | state_expos_recalculated = 0; |
|---|
| 368 | histogram_stop(); |
|---|
| 369 | |
|---|
| 370 | kbd_int_stack_ptr-=1; // pop op. |
|---|
| 371 | return; |
|---|
| 372 | case SCRIPT_WAIT_SAVE:{ |
|---|
| 373 | if (state_shooting_progress == SHOOTING_PROGRESS_DONE) |
|---|
| 374 | kbd_int_stack_ptr-=1; // pop op. |
|---|
| 375 | return; |
|---|
| 376 | } |
|---|
| 377 | case SCRIPT_WAIT_FLASH:{ |
|---|
| 378 | if (shooting_is_flash_ready()) |
|---|
| 379 | kbd_int_stack_ptr-=1; // pop op. |
|---|
| 380 | return; |
|---|
| 381 | } |
|---|
| 382 | case SCRIPT_WAIT_EXPHIST:{ |
|---|
| 383 | if (state_expos_recalculated) { |
|---|
| 384 | kbd_int_stack_ptr-=1; // pop op. |
|---|
| 385 | state_expos_under = under_exposed; |
|---|
| 386 | state_expos_over = over_exposed; |
|---|
| 387 | } |
|---|
| 388 | return; |
|---|
| 389 | } |
|---|
| 390 | case SCRIPT_PR_WAIT_EXPHIST: { |
|---|
| 391 | if (shooting_in_progress() || mvideo) { |
|---|
| 392 | state_expos_recalculated = 0; |
|---|
| 393 | histogram_restart(); |
|---|
| 394 | kbd_int_stack_ptr-=1; // pop op. |
|---|
| 395 | } |
|---|
| 396 | return; |
|---|
| 397 | } |
|---|
| 398 | case SCRIPT_WAIT_CLICK: { |
|---|
| 399 | t = get_tick_count(); |
|---|
| 400 | if (delay_target_ticks == 0){ |
|---|
| 401 | /* setup timer */ |
|---|
| 402 | delay_target_ticks = t+((KBD_STACK_PREV(2))?KBD_STACK_PREV(2):86400000); |
|---|
| 403 | } else { |
|---|
| 404 | kbd_last_clicked = kbd_get_clicked_key(); |
|---|
| 405 | if (kbd_last_clicked || delay_target_ticks <= t) { |
|---|
| 406 | if (!kbd_last_clicked) |
|---|
| 407 | kbd_last_clicked=0xFFFF; |
|---|
| 408 | delay_target_ticks = 0; |
|---|
| 409 | kbd_int_stack_ptr-=2; // pop op. |
|---|
| 410 | } |
|---|
| 411 | } |
|---|
| 412 | return; |
|---|
| 413 | } |
|---|
| 414 | default: |
|---|
| 415 | /*finished();*/ |
|---|
| 416 | script_end(); |
|---|
| 417 | } |
|---|
| 418 | } |
|---|
| 419 | |
|---|
| 420 | if (state_kbd_script_run != 3) |
|---|
| 421 | { |
|---|
| 422 | if( L ) { |
|---|
| 423 | int top; |
|---|
| 424 | if (state_lua_kbd_first_call_to_resume) |
|---|
| 425 | { |
|---|
| 426 | state_lua_kbd_first_call_to_resume = 0; |
|---|
| 427 | top = 0; |
|---|
| 428 | } |
|---|
| 429 | else |
|---|
| 430 | { |
|---|
| 431 | top = lua_gettop(Lt); |
|---|
| 432 | } |
|---|
| 433 | Lres = lua_resume( Lt, top ); |
|---|
| 434 | |
|---|
| 435 | if (Lres != LUA_YIELD && Lres != 0) { |
|---|
| 436 | script_console_add_line( lua_tostring( Lt, -1 ) ); |
|---|
| 437 | wait_and_end(); |
|---|
| 438 | return; |
|---|
| 439 | } |
|---|
| 440 | |
|---|
| 441 | if (Lres != LUA_YIELD) { |
|---|
| 442 | script_console_add_line(lang_str(LANG_CONSOLE_TEXT_FINISHED)); |
|---|
| 443 | script_end(); |
|---|
| 444 | } |
|---|
| 445 | } |
|---|
| 446 | else { |
|---|
| 447 | ubasic_run(); |
|---|
| 448 | if (ubasic_finished()) { |
|---|
| 449 | script_console_add_line(lang_str(LANG_CONSOLE_TEXT_FINISHED)); |
|---|
| 450 | script_end(); |
|---|
| 451 | } |
|---|
| 452 | } |
|---|
| 453 | } |
|---|
| 454 | } |
|---|
| 455 | |
|---|
| 456 | void ubasic_camera_press(const char *s) |
|---|
| 457 | { |
|---|
| 458 | long k = keyid_by_name(s); |
|---|
| 459 | if (k > 0) { |
|---|
| 460 | kbd_sched_press(k); |
|---|
| 461 | } else { |
|---|
| 462 | ubasic_error = 3; |
|---|
| 463 | } |
|---|
| 464 | } |
|---|
| 465 | |
|---|
| 466 | void ubasic_camera_release(const char *s) |
|---|
| 467 | { |
|---|
| 468 | long k = keyid_by_name(s); |
|---|
| 469 | if (k > 0) { |
|---|
| 470 | kbd_sched_release(k); |
|---|
| 471 | } else { |
|---|
| 472 | ubasic_error = 3; |
|---|
| 473 | } |
|---|
| 474 | } |
|---|
| 475 | |
|---|
| 476 | void ubasic_camera_click(const char *s) |
|---|
| 477 | { |
|---|
| 478 | long k = keyid_by_name(s); |
|---|
| 479 | if (k > 0) { |
|---|
| 480 | kbd_sched_click(k); |
|---|
| 481 | } else { |
|---|
| 482 | ubasic_error = 3; |
|---|
| 483 | } |
|---|
| 484 | } |
|---|
| 485 | |
|---|
| 486 | void ubasic_camera_wait_click(int timeout) |
|---|
| 487 | { |
|---|
| 488 | kbd_sched_wait_click(timeout); |
|---|
| 489 | } |
|---|
| 490 | |
|---|
| 491 | int ubasic_camera_is_pressed(const char *s) |
|---|
| 492 | { |
|---|
| 493 | long k = keyid_by_name(s); |
|---|
| 494 | if (k==0xFF) return get_usb_power(1); |
|---|
| 495 | if (k > 0) { |
|---|
| 496 | return (kbd_is_key_pressed(k)); |
|---|
| 497 | } else { |
|---|
| 498 | ubasic_error = 3; |
|---|
| 499 | } |
|---|
| 500 | return 0; |
|---|
| 501 | } |
|---|
| 502 | |
|---|
| 503 | int ubasic_camera_is_clicked(const char *s) |
|---|
| 504 | { |
|---|
| 505 | long k = keyid_by_name(s); |
|---|
| 506 | if (k==0xFF) return get_usb_power(1); |
|---|
| 507 | if (k > 0) { |
|---|
| 508 | return (kbd_last_clicked == k); |
|---|
| 509 | } else { |
|---|
| 510 | ubasic_error = 3; |
|---|
| 511 | } |
|---|
| 512 | return 0; |
|---|
| 513 | } |
|---|
| 514 | |
|---|
| 515 | void ubasic_camera_sleep(long v) |
|---|
| 516 | { |
|---|
| 517 | kbd_sched_delay(v); |
|---|
| 518 | } |
|---|
| 519 | |
|---|
| 520 | void ubasic_camera_shoot() |
|---|
| 521 | { |
|---|
| 522 | kbd_sched_shoot(); |
|---|
| 523 | } |
|---|
| 524 | // remote autostart |
|---|
| 525 | void script_autostart() |
|---|
| 526 | { |
|---|
| 527 | kbd_blocked = 1; |
|---|
| 528 | gui_kbd_enter(); |
|---|
| 529 | script_console_clear(); |
|---|
| 530 | script_console_add_line("***Autostart***"); //lang_str(LANG_CONSOLE_TEXT_STARTED)); |
|---|
| 531 | script_start( 1 ); |
|---|
| 532 | } |
|---|
| 533 | void exit_alt() |
|---|
| 534 | { |
|---|
| 535 | kbd_blocked = 0; |
|---|
| 536 | gui_kbd_leave(); |
|---|
| 537 | } |
|---|
| 538 | |
|---|
| 539 | // ------ add by Masuji SUTO (start) -------------- |
|---|
| 540 | void set_key_press(int nSet) |
|---|
| 541 | { |
|---|
| 542 | key_pressed = nSet; |
|---|
| 543 | kbd_blocked = nSet; |
|---|
| 544 | nRmt = nSet; |
|---|
| 545 | } |
|---|
| 546 | // ------ add by Masuji SUTO (end) -------------- |
|---|
| 547 | |
|---|
| 548 | /*------------------- Alex scriptless remote additions start --------------------*/ |
|---|
| 549 | static int remoteHalfShutter=0, remoteFullShutter=0, remoteShooting=0, remoteClickTimer=0; |
|---|
| 550 | #define REMOTE_MAX_CLICK_LENGTH 50 |
|---|
| 551 | /*-------------------- Alex scriptless remote additions end ---------------------*/ |
|---|
| 552 | |
|---|
| 553 | long kbd_process() |
|---|
| 554 | { |
|---|
| 555 | /* Alternative keyboard mode stated/exited by pressing print key. |
|---|
| 556 | * While running Alt. mode shoot key will start a script execution. |
|---|
| 557 | */ |
|---|
| 558 | static int nCER=0; |
|---|
| 559 | // ------ modif by Masuji SUTO (start) -------------- |
|---|
| 560 | |
|---|
| 561 | unsigned int mmode; |
|---|
| 562 | unsigned int nCrzpos,i; |
|---|
| 563 | unsigned int drmode; |
|---|
| 564 | |
|---|
| 565 | if(conf.ricoh_ca1_mode && conf.remote_enable) |
|---|
| 566 | { |
|---|
| 567 | drmode = shooting_get_drive_mode(); |
|---|
| 568 | mmode = mode_get(); |
|---|
| 569 | mplay = (mmode&MODE_MASK)==MODE_PLAY; |
|---|
| 570 | mvideo= ((mmode&MODE_SHOOTING_MASK)==MODE_VIDEO_STD || (mmode&MODE_SHOOTING_MASK)==MODE_VIDEO_SPEED || (mmode&MODE_SHOOTING_MASK)==MODE_VIDEO_COMPACT ||(mmode&MODE_SHOOTING_MASK)==MODE_VIDEO_MY_COLORS || (mmode&MODE_SHOOTING_MASK)==MODE_VIDEO_COLOR_ACCENT); |
|---|
| 571 | } |
|---|
| 572 | // deals with alt-mode switch and delay emulation |
|---|
| 573 | if (key_pressed) |
|---|
| 574 | { |
|---|
| 575 | if (kbd_is_key_pressed(conf.alt_mode_button) || |
|---|
| 576 | ((key_pressed >= CAM_EMUL_KEYPRESS_DELAY) && |
|---|
| 577 | (key_pressed < CAM_EMUL_KEYPRESS_DELAY+CAM_EMUL_KEYPRESS_DURATION))) |
|---|
| 578 | { |
|---|
| 579 | if (key_pressed <= CAM_EMUL_KEYPRESS_DELAY+CAM_EMUL_KEYPRESS_DURATION) |
|---|
| 580 | key_pressed++; |
|---|
| 581 | if (key_pressed == CAM_EMUL_KEYPRESS_DELAY) |
|---|
| 582 | kbd_key_press(conf.alt_mode_button); |
|---|
| 583 | else if (key_pressed == +CAM_EMUL_KEYPRESS_DELAY+CAM_EMUL_KEYPRESS_DURATION) |
|---|
| 584 | kbd_key_release(conf.alt_mode_button); |
|---|
| 585 | return 1; |
|---|
| 586 | } else |
|---|
| 587 | if (kbd_get_pressed_key() == 0) |
|---|
| 588 | { |
|---|
| 589 | if (key_pressed != 100 && (key_pressed < CAM_EMUL_KEYPRESS_DELAY)) |
|---|
| 590 | { |
|---|
| 591 | kbd_blocked = 1-kbd_blocked; |
|---|
| 592 | if (kbd_blocked) gui_kbd_enter(); else gui_kbd_leave(); |
|---|
| 593 | } |
|---|
| 594 | key_pressed = 0; |
|---|
| 595 | return 1; |
|---|
| 596 | } |
|---|
| 597 | return 1; |
|---|
| 598 | } |
|---|
| 599 | |
|---|
| 600 | // auto iso shift |
|---|
| 601 | if (kbd_is_key_pressed(KEY_SHOOT_HALF) && kbd_is_key_pressed(conf.alt_mode_button)) return 0; |
|---|
| 602 | |
|---|
| 603 | if (kbd_is_key_pressed(conf.alt_mode_button)) |
|---|
| 604 | { |
|---|
| 605 | if (conf.ricoh_ca1_mode && conf.remote_enable) conf.synch_enable=1; |
|---|
| 606 | key_pressed = 1; |
|---|
| 607 | kbd_key_release_all(); |
|---|
| 608 | return 1; |
|---|
| 609 | } |
|---|
| 610 | |
|---|
| 611 | // deals with the rest |
|---|
| 612 | if (kbd_blocked && nRmt==0) |
|---|
| 613 | { |
|---|
| 614 | /*------------------- Alex scriptless remote additions start --------------------*/ |
|---|
| 615 | if (remoteShooting) { |
|---|
| 616 | |
|---|
| 617 | if (remoteHalfShutter) { |
|---|
| 618 | if (get_usb_power(1)) { |
|---|
| 619 | if (remoteClickTimer < REMOTE_MAX_CLICK_LENGTH) { |
|---|
| 620 | remoteHalfShutter=0; |
|---|
| 621 | remoteFullShutter=1; |
|---|
| 622 | kbd_key_press(KEY_SHOOT_FULL); |
|---|
| 623 | } |
|---|
| 624 | return 1; |
|---|
| 625 | } else { |
|---|
| 626 | --remoteClickTimer; |
|---|
| 627 | if ( remoteClickTimer == 0 ) { |
|---|
| 628 | kbd_key_release_all(); |
|---|
| 629 | remoteHalfShutter=0; |
|---|
| 630 | remoteShooting=0; |
|---|
| 631 | kbd_blocked=0; |
|---|
| 632 | return 0; |
|---|
| 633 | } |
|---|
| 634 | } |
|---|
| 635 | } |
|---|
| 636 | |
|---|
| 637 | if (remoteFullShutter) { |
|---|
| 638 | if (get_usb_power(1)) { |
|---|
| 639 | return 1; |
|---|
| 640 | } else { |
|---|
| 641 | kbd_key_release_all(); |
|---|
| 642 | remoteFullShutter=0; |
|---|
| 643 | remoteShooting=0; |
|---|
| 644 | kbd_blocked=0; |
|---|
| 645 | return 0; |
|---|
| 646 | } |
|---|
| 647 | } |
|---|
| 648 | |
|---|
| 649 | } |
|---|
| 650 | /*-------------------- Alex scriptless remote additions end ---------------------*/ |
|---|
| 651 | if (kbd_is_key_pressed(KEY_SHOOT_FULL)) |
|---|
| 652 | { |
|---|
| 653 | key_pressed = 100; |
|---|
| 654 | if (!state_kbd_script_run) |
|---|
| 655 | { |
|---|
| 656 | script_start(0); |
|---|
| 657 | } else if (state_kbd_script_run == 2 || state_kbd_script_run == 3) |
|---|
| 658 | { |
|---|
| 659 | script_console_add_line(lang_str(LANG_CONSOLE_TEXT_INTERRUPTED)); |
|---|
| 660 | script_end(); |
|---|
| 661 | } else if (L) |
|---|
| 662 | { |
|---|
| 663 | state_kbd_script_run = 2; |
|---|
| 664 | lua_getglobal(Lt, "restore"); |
|---|
| 665 | if (lua_isfunction(Lt, -1)) |
|---|
| 666 | { |
|---|
| 667 | if (lua_pcall( Lt, 0, 0, 0 )) |
|---|
| 668 | { |
|---|
| 669 | script_console_add_line( lua_tostring( Lt, -1 ) ); |
|---|
| 670 | } |
|---|
| 671 | } |
|---|
| 672 | script_console_add_line(lang_str(LANG_CONSOLE_TEXT_INTERRUPTED)); |
|---|
| 673 | script_end(); |
|---|
| 674 | } |
|---|
| 675 | else |
|---|
| 676 | { |
|---|
| 677 | state_kbd_script_run = 2; |
|---|
| 678 | if (jump_label("restore") == 0) |
|---|
| 679 | { |
|---|
| 680 | script_console_add_line(lang_str(LANG_CONSOLE_TEXT_INTERRUPTED)); |
|---|
| 681 | script_end(); |
|---|
| 682 | } |
|---|
| 683 | } |
|---|
| 684 | } |
|---|
| 685 | |
|---|
| 686 | if (state_kbd_script_run) |
|---|
| 687 | process_script(); else |
|---|
| 688 | gui_kbd_process(); |
|---|
| 689 | } else |
|---|
| 690 | { |
|---|
| 691 | |
|---|
| 692 | #ifndef SYNCHABLE_REMOTE_NOT_ENABLED |
|---|
| 693 | if(conf.ricoh_ca1_mode && conf.remote_enable) |
|---|
| 694 | { |
|---|
| 695 | |
|---|
| 696 | // ------ add by Masuji SUTO (start) -------------- |
|---|
| 697 | if(nWt>0) {nWt--;return 1;} |
|---|
| 698 | #if defined(CAMERA_ixus960) |
|---|
| 699 | if(nFirst==1){ |
|---|
| 700 | if(nSW==0){ |
|---|
| 701 | nSW=1; |
|---|
| 702 | nWt=10; |
|---|
| 703 | kbd_key_release_all(); |
|---|
| 704 | kbd_key_press(KEY_SHOOT_HALF); |
|---|
| 705 | soft_half_press = 1; |
|---|
| 706 | set_key_press(1); |
|---|
| 707 | return 1; |
|---|
| 708 | } |
|---|
| 709 | else if(nSW==1){ |
|---|
| 710 | nSW=2; |
|---|
| 711 | nWt=10; |
|---|
| 712 | kbd_key_release(KEY_SHOOT_HALF); |
|---|
| 713 | soft_half_press = 0; |
|---|
| 714 | set_key_press(1); |
|---|
| 715 | return 1; |
|---|
| 716 | } |
|---|
| 717 | else if(nSW==2){ |
|---|
| 718 | set_key_press(0); |
|---|
| 719 | nWt=10; |
|---|
| 720 | nSW=0; |
|---|
| 721 | nFirst=0; |
|---|
| 722 | return 1; |
|---|
| 723 | } |
|---|
| 724 | } |
|---|
| 725 | #endif |
|---|
| 726 | if (kbd_is_key_pressed(KEY_SHOOT_FULL)) conf.synch_enable=0; |
|---|
| 727 | if (kbd_is_key_pressed(KEY_SHOOT_HALF) && nTxzoom>0) { |
|---|
| 728 | nCount2=0; |
|---|
| 729 | nTxzoom=0; |
|---|
| 730 | nReczoom=0; |
|---|
| 731 | nTxvideo=0; |
|---|
| 732 | debug_led(0); |
|---|
| 733 | } |
|---|
| 734 | if (mplay && (kbd_is_key_pressed(KEY_LEFT) || kbd_is_key_pressed(KEY_RIGHT))){ |
|---|
| 735 | nPlyname=KEY_LEFT; |
|---|
| 736 | if(kbd_is_key_pressed(KEY_RIGHT)) nPlyname=KEY_RIGHT; |
|---|
| 737 | } |
|---|
| 738 | if (kbd_is_key_pressed(KEY_VIDEO)){ |
|---|
| 739 | nCount2=0; |
|---|
| 740 | nTxzoom=0; |
|---|
| 741 | nReczoom=0; |
|---|
| 742 | nTxvideo++; |
|---|
| 743 | if(nTxvideo<50){ |
|---|
| 744 | kbd_key_release_all(); |
|---|
| 745 | debug_led(1); |
|---|
| 746 | } |
|---|
| 747 | else { |
|---|
| 748 | debug_led(0); |
|---|
| 749 | return 0; |
|---|
| 750 | } |
|---|
| 751 | return 1; |
|---|
| 752 | } |
|---|
| 753 | else if(nTxvideo>49) nTxvideo=0; |
|---|
| 754 | if (kbd_is_key_pressed(KEY_ZOOM_IN) || kbd_is_key_pressed(KEY_ZOOM_OUT)){ |
|---|
| 755 | nCount2=0; |
|---|
| 756 | nTxvideo=0; |
|---|
| 757 | if(kbd_is_key_pressed(KEY_ZOOM_IN)) { |
|---|
| 758 | if(nTxzname==KEY_ZOOM_IN) nTxzoom++; |
|---|
| 759 | else nTxzoom=1; |
|---|
| 760 | nTxzname=KEY_ZOOM_IN; |
|---|
| 761 | } |
|---|
| 762 | else { |
|---|
| 763 | if(nTxzname==KEY_ZOOM_OUT) nTxzoom++; |
|---|
| 764 | else nTxzoom=1; |
|---|
| 765 | nTxzname=KEY_ZOOM_OUT; |
|---|
| 766 | } |
|---|
| 767 | if(nTxzoom<50){ |
|---|
| 768 | kbd_key_release_all(); |
|---|
| 769 | debug_led(1); |
|---|
| 770 | } |
|---|
| 771 | else { |
|---|
| 772 | debug_led(0); |
|---|
| 773 | return 0; |
|---|
| 774 | } |
|---|
| 775 | return 1; |
|---|
| 776 | } |
|---|
| 777 | if(!get_usb_power(1) && nSW<100 && nCount==0 && nTxzoom>0) { |
|---|
| 778 | nCount2++; |
|---|
| 779 | if(nCount2>conf.zoom_timeout*100){ |
|---|
| 780 | if(nTxzoom>0){ |
|---|
| 781 | nTxzoom=0; |
|---|
| 782 | nReczoom=0; |
|---|
| 783 | debug_led(0); |
|---|
| 784 | } |
|---|
| 785 | nCount2=0; |
|---|
| 786 | } |
|---|
| 787 | return 1; |
|---|
| 788 | } |
|---|
| 789 | if(get_usb_power(1) && nSW<100 && nCount==0) {nCount2=0;kbd_key_release_all();conf.synch_enable=1;} |
|---|
| 790 | |
|---|
| 791 | |
|---|
| 792 | if(get_usb_power(1) && nSW<100 && nCount==0) {kbd_key_release_all();conf.synch_enable=1;} |
|---|
| 793 | if(get_usb_power(1) && nSW<100 && nCount<6){ |
|---|
| 794 | nCount++; |
|---|
| 795 | return 1; |
|---|
| 796 | } |
|---|
| 797 | if(nCount>0 && nSW<100){ |
|---|
| 798 | if(mplay) { |
|---|
| 799 | if(get_usb_power(1)) return 1; |
|---|
| 800 | kbd_key_release_all(); |
|---|
| 801 | kbd_key_press(nPlyname); |
|---|
| 802 | set_key_press(1); |
|---|
| 803 | nCount=0; |
|---|
| 804 | nCa=2; |
|---|
| 805 | nSW=101; |
|---|
| 806 | nWt=5; |
|---|
| 807 | return 1; |
|---|
| 808 | } |
|---|
| 809 | if(nTxvideo>49) nTxvideo=0; |
|---|
| 810 | if(nCount<5) nCa=1; //for Richo remote switch CA-1 |
|---|
| 811 | else nCa=2; //for hand made remote switch |
|---|
| 812 | nCount=0; |
|---|
| 813 | // debug_led(1); |
|---|
| 814 | nSW=109; |
|---|
| 815 | } |
|---|
| 816 | |
|---|
| 817 | // ------------------------------------------------------------- hand made switch -------------- |
|---|
| 818 | |
|---|
| 819 | if(nCa==2){ |
|---|
| 820 | if(nSW==101){ |
|---|
| 821 | kbd_key_release_all(); |
|---|
| 822 | set_key_press(0); |
|---|
| 823 | nWt=50; |
|---|
| 824 | nSW=0; |
|---|
| 825 | nCa=0; |
|---|
| 826 | return 1; |
|---|
| 827 | } |
|---|
| 828 | if(nSW==109){ |
|---|
| 829 | // nSW=110; |
|---|
| 830 | nCER=0; |
|---|
| 831 | if(nTxzoom>0 && conf.remote_zoom_enable){ |
|---|
| 832 | if(nTxzoom<100){ |
|---|
| 833 | nIntzpos=lens_get_zoom_point(); |
|---|
| 834 | for(i=0;i<ZSTEP_TABLE_SIZE;i++){ |
|---|
| 835 | if(nIntzpos<=nTxtbl[i]){ |
|---|
| 836 | if(i>0){ |
|---|
| 837 | if(abs(nTxtbl[i]-nIntzpos)<=abs(nTxtbl[i-1]-nIntzpos)) nTxtblcr=i; |
|---|
| 838 | else nTxtblcr=i-1; |
|---|
| 839 | } |
|---|
| 840 | else nTxtblcr=i; |
|---|
| 841 | i=ZSTEP_TABLE_SIZE; |
|---|
| 842 | } |
|---|
| 843 | } |
|---|
| 844 | if(nTxzname==KEY_ZOOM_IN){ |
|---|
| 845 | nTxtblcr++; |
|---|
| 846 | if(nTxtblcr>(ZSTEP_TABLE_SIZE-1)) nTxtblcr=(ZSTEP_TABLE_SIZE-1); |
|---|
| 847 | } |
|---|
| 848 | else{ |
|---|
| 849 | nTxtblcr--; |
|---|
| 850 | if(nTxtblcr<0) nTxtblcr=0; |
|---|
| 851 | } |
|---|
| 852 | nSW=108; |
|---|
| 853 | return 1; |
|---|
| 854 | } |
|---|
| 855 | nTxzoom=0; |
|---|
| 856 | nReczoom=0; |
|---|
| 857 | } |
|---|
| 858 | if(nTxvideo>0 && conf.remote_zoom_enable) {nSW=121;return 1;} |
|---|
| 859 | nSW=110; |
|---|
| 860 | nWt=2; |
|---|
| 861 | kbd_key_release_all(); |
|---|
| 862 | kbd_key_press(KEY_SHOOT_HALF); |
|---|
| 863 | // key_pressed = 1; |
|---|
| 864 | // kbd_blocked = 1; |
|---|
| 865 | // nRmt=1; |
|---|
| 866 | soft_half_press = 1; |
|---|
| 867 | set_key_press(1); |
|---|
| 868 | return 1; |
|---|
| 869 | } |
|---|
| 870 | if(nTxzoom>0 && nSW==108 && conf.remote_zoom_enable){ |
|---|
| 871 | nCrzpos=lens_get_zoom_point(); |
|---|
| 872 | if(nIntzpos!=nCrzpos) {nReczoom=0;} |
|---|
| 873 | if(nIntzpos==nCrzpos && nCER>50){ |
|---|
| 874 | if(!get_usb_power(1)){ |
|---|
| 875 | kbd_key_release_all(); |
|---|
| 876 | set_key_press(0); |
|---|
| 877 | nTxzoom=1; |
|---|
| 878 | nSW=0; |
|---|
| 879 | nCount=0; |
|---|
| 880 | nWt=10; |
|---|
| 881 | nReczoom=1; |
|---|
| 882 | return 1; |
|---|
| 883 | } |
|---|
| 884 | } |
|---|
| 885 | if(nReczoom==0 && ((nTxzname==KEY_ZOOM_IN && nCrzpos>=nTxtbl[nTxtblcr]) || (nTxzname==KEY_ZOOM_OUT && nCrzpos<=nTxtbl[nTxtblcr]))){ |
|---|
| 886 | if(get_usb_power(1)){ |
|---|
| 887 | i=1; |
|---|
| 888 | if(nTxzname==KEY_ZOOM_IN){ |
|---|
| 889 | nTxtblcr++; |
|---|
| 890 | if(nTxtblcr>(ZSTEP_TABLE_SIZE-1)){ |
|---|
| 891 | nTxtblcr=(ZSTEP_TABLE_SIZE-1); |
|---|
| 892 | nTxzname=KEY_ZOOM_OUT; |
|---|
| 893 | } |
|---|
| 894 | } |
|---|
| 895 | else{ |
|---|
| 896 | nTxtblcr--; |
|---|
| 897 | if(nTxtblcr<0){ |
|---|
| 898 | nTxtblcr=0; |
|---|
| 899 | nTxzname=KEY_ZOOM_IN; |
|---|
| 900 | } |
|---|
| 901 | } |
|---|
| 902 | if(i==1) return 1; |
|---|
| 903 | } |
|---|
| 904 | kbd_key_release_all(); |
|---|
| 905 | set_key_press(0); |
|---|
| 906 | nTxzoom=1; |
|---|
| 907 | // lens_set_zoom_speed(25); |
|---|
| 908 | nSW=120; |
|---|
| 909 | nWt=5; |
|---|
| 910 | return 1; |
|---|
| 911 | } |
|---|
| 912 | kbd_key_release_all(); |
|---|
| 913 | kbd_key_press(nTxzname); |
|---|
| 914 | set_key_press(1); |
|---|
| 915 | nCER++; |
|---|
| 916 | return 1; |
|---|
| 917 | } |
|---|
| 918 | |
|---|
| 919 | if(nTxvideo>0 && nSW==121){ |
|---|
| 920 | if(!get_usb_power(1)) { |
|---|
| 921 | nWt=10; |
|---|
| 922 | kbd_key_press(KEY_VIDEO); |
|---|
| 923 | set_key_press(1); |
|---|
| 924 | nSW=122; |
|---|
| 925 | } |
|---|
| 926 | return 1; |
|---|
| 927 | } |
|---|
| 928 | if(nTxvideo>0 && nSW==122){ |
|---|
| 929 | nWt=10; |
|---|
| 930 | kbd_key_release(KEY_VIDEO); |
|---|
| 931 | set_key_press(1); |
|---|
| 932 | nSW=123; |
|---|
| 933 | return 1; |
|---|
| 934 | } |
|---|
| 935 | if(nTxvideo>0 && nSW==123){ |
|---|
| 936 | set_key_press(0); |
|---|
| 937 | nWt=50; |
|---|
| 938 | nSW=0; |
|---|
| 939 | nCa=0; |
|---|
| 940 | nTxvideo=0; |
|---|
| 941 | debug_led(0); |
|---|
| 942 | return 1; |
|---|
| 943 | } |
|---|
| 944 | |
|---|
| 945 | if(nSW==110){ |
|---|
| 946 | if (shooting_in_progress() || mvideo || nCER>100) { |
|---|
| 947 | state_expos_recalculated = 0; |
|---|
| 948 | histogram_restart(); |
|---|
| 949 | nCER=0; |
|---|
| 950 | nSW=111; |
|---|
| 951 | } |
|---|
| 952 | else {nCER++;return 1;} |
|---|
| 953 | } |
|---|
| 954 | if(nSW==111){ |
|---|
| 955 | if (state_expos_recalculated || nCER>100) { |
|---|
| 956 | state_expos_under = under_exposed; |
|---|
| 957 | state_expos_over = over_exposed; |
|---|
| 958 | nCER=0; |
|---|
| 959 | nSW=112; |
|---|
| 960 | //presynch(); |
|---|
| 961 | } |
|---|
| 962 | else {nCER++;return 1;} |
|---|
| 963 | } |
|---|
| 964 | if(nSW==112){ |
|---|
| 965 | if (shooting_is_flash_ready() || nCER>10){ |
|---|
| 966 | nCER=0; |
|---|
| 967 | nSW=113; |
|---|
| 968 | } |
|---|
| 969 | else {nCER++;return 1;} |
|---|
| 970 | } |
|---|
| 971 | if(nSW==113){ |
|---|
| 972 | if(get_usb_power(1) && !mvideo) nSW=114; |
|---|
| 973 | else if(!get_usb_power(1) && mvideo) nSW=114; |
|---|
| 974 | else return 1; |
|---|
| 975 | } |
|---|
| 976 | if(nTxzoom>0 && nSW==120 && conf.remote_zoom_enable){ |
|---|
| 977 | nCrzpos=lens_get_zoom_point(); |
|---|
| 978 | if((nTxzname==KEY_ZOOM_IN && nCrzpos<=nTxtbl[nTxtblcr]) || (nTxzname==KEY_ZOOM_OUT && nCrzpos>=nTxtbl[nTxtblcr])){ |
|---|
| 979 | kbd_key_release_all(); |
|---|
| 980 | set_key_press(0); |
|---|
| 981 | nTxzoom=1; |
|---|
| 982 | lens_set_zoom_speed(100); |
|---|
| 983 | nSW=0; |
|---|
| 984 | nCount=0; |
|---|
| 985 | nWt=10; |
|---|
| 986 | return 1; |
|---|
| 987 | } |
|---|
| 988 | lens_set_zoom_speed(5); |
|---|
| 989 | kbd_key_release_all(); |
|---|
| 990 | if(nTxzname==KEY_ZOOM_IN) kbd_key_press(KEY_ZOOM_OUT); |
|---|
| 991 | else kbd_key_press(KEY_ZOOM_IN); |
|---|
| 992 | set_key_press(1); |
|---|
| 993 | return 1; |
|---|
| 994 | } |
|---|
| 995 | |
|---|
| 996 | if(nSW==114){ |
|---|
| 997 | nSW=115; |
|---|
| 998 | nWt=2; |
|---|
| 999 | shutter_int=0; |
|---|
| 1000 | kbd_key_press(KEY_SHOOT_FULL); |
|---|
| 1001 | set_key_press(1); |
|---|
| 1002 | // kbd_blocked = 1; |
|---|
| 1003 | // nRmt=1; |
|---|
| 1004 | nCount=0; |
|---|
| 1005 | return 1; |
|---|
| 1006 | } |
|---|
| 1007 | if(nSW==115){ |
|---|
| 1008 | // debug_led(0); |
|---|
| 1009 | if(drmode==1 && shutter_int==0){ |
|---|
| 1010 | return 1; |
|---|
| 1011 | } |
|---|
| 1012 | nSW=116; |
|---|
| 1013 | nWt=2; |
|---|
| 1014 | kbd_key_release(KEY_SHOOT_FULL); |
|---|
| 1015 | set_key_press(1); |
|---|
| 1016 | soft_half_press = 0; |
|---|
| 1017 | // kbd_blocked = 1; |
|---|
| 1018 | // nRmt=1; |
|---|
| 1019 | return 1; |
|---|
| 1020 | } |
|---|
| 1021 | if(!get_usb_power(1) && nSW==116) { |
|---|
| 1022 | set_key_press(0); |
|---|
| 1023 | // kbd_blocked = 0; |
|---|
| 1024 | // key_pressed = 0; |
|---|
| 1025 | nWt=50; |
|---|
| 1026 | nSW=0; |
|---|
| 1027 | // nRmt=0; |
|---|
| 1028 | nCa=0; |
|---|
| 1029 | //postsynch(); |
|---|
| 1030 | return 1; |
|---|
| 1031 | } |
|---|
| 1032 | } |
|---|
| 1033 | |
|---|
| 1034 | // ------------------------------------------------------------- Ricoh remote switch CA-1 -------------- |
|---|
| 1035 | if(nCa==1){ |
|---|
| 1036 | if(get_usb_power(1) && nSW>108 && nSW<120){ |
|---|
| 1037 | nCount++; |
|---|
| 1038 | } |
|---|
| 1039 | if(nSW==109){ |
|---|
| 1040 | // nSW=110; |
|---|
| 1041 | nCER=0; |
|---|
| 1042 | if(nTxzoom>0 && conf.remote_zoom_enable){ |
|---|
| 1043 | if(nTxzoom<100){ |
|---|
| 1044 | nIntzpos=lens_get_zoom_point(); |
|---|
| 1045 | for(i=0;i<ZSTEP_TABLE_SIZE;i++){ |
|---|
| 1046 | if(nIntzpos<=nTxtbl[i]){ |
|---|
| 1047 | if(i>0){ |
|---|
| 1048 | if(abs(nTxtbl[i]-nIntzpos)<=abs(nTxtbl[i-1]-nIntzpos)) nTxtblcr=i; |
|---|
| 1049 | else nTxtblcr=i-1; |
|---|
| 1050 | } |
|---|
| 1051 | else nTxtblcr=i; |
|---|
| 1052 | i=ZSTEP_TABLE_SIZE; |
|---|
| 1053 | } |
|---|
| 1054 | } |
|---|
| 1055 | if(nTxzname==KEY_ZOOM_IN){ |
|---|
| 1056 | nTxtblcr++; |
|---|
| 1057 | if(nTxtblcr>(ZSTEP_TABLE_SIZE-1)) nTxtblcr=(ZSTEP_TABLE_SIZE-1); |
|---|
| 1058 | } |
|---|
| 1059 | else{ |
|---|
| 1060 | nTxtblcr--; |
|---|
| 1061 | if(nTxtblcr<0) nTxtblcr=0; |
|---|
| 1062 | } |
|---|
| 1063 | nSW=113; |
|---|
| 1064 | return 1; |
|---|
| 1065 | } |
|---|
| 1066 | nTxzoom=0; |
|---|
| 1067 | nReczoom=0; |
|---|
| 1068 | } |
|---|
| 1069 | if(nTxvideo>0 && conf.remote_zoom_enable) {nSW=121;return 1;} |
|---|
| 1070 | nSW=110; |
|---|
| 1071 | nWt=2; |
|---|
| 1072 | kbd_key_release_all(); |
|---|
| 1073 | kbd_key_press(KEY_SHOOT_HALF); |
|---|
| 1074 | // debug_led(1); |
|---|
| 1075 | soft_half_press = 1; |
|---|
| 1076 | set_key_press(1); |
|---|
| 1077 | // key_pressed = 1; |
|---|
| 1078 | // kbd_blocked = 1; |
|---|
| 1079 | // nRmt=1; |
|---|
| 1080 | return 1; |
|---|
| 1081 | } |
|---|
| 1082 | if(nTxvideo>0 && nSW==121){ |
|---|
| 1083 | if(get_usb_power(1)) { |
|---|
| 1084 | nWt=10; |
|---|
| 1085 | kbd_key_press(KEY_VIDEO); |
|---|
| 1086 | set_key_press(1); |
|---|
| 1087 | nSW=122; |
|---|
| 1088 | } |
|---|
| 1089 | return 1; |
|---|
| 1090 | } |
|---|
| 1091 | if(nTxvideo>0 && nSW==122){ |
|---|
| 1092 | nWt=10; |
|---|
| 1093 | kbd_key_release(KEY_VIDEO); |
|---|
| 1094 | set_key_press(1); |
|---|
| 1095 | nSW=123; |
|---|
| 1096 | return 1; |
|---|
| 1097 | } |
|---|
| 1098 | if(nTxvideo>0 && nSW==123){ |
|---|
| 1099 | set_key_press(0); |
|---|
| 1100 | nWt=100; |
|---|
| 1101 | nCount=0; |
|---|
| 1102 | nSW=0; |
|---|
| 1103 | nCa=0; |
|---|
| 1104 | nTxvideo=0; |
|---|
| 1105 | debug_led(0); |
|---|
| 1106 | return 1; |
|---|
| 1107 | } |
|---|
| 1108 | |
|---|
| 1109 | if(nSW==110){ |
|---|
| 1110 | if (shooting_in_progress() || mvideo || nCER>100) { |
|---|
| 1111 | // debug_led(0); |
|---|
| 1112 | state_expos_recalculated = 0; |
|---|
| 1113 | histogram_restart(); |
|---|
| 1114 | nCER=0; |
|---|
| 1115 | nSW=111; |
|---|
| 1116 | } |
|---|
| 1117 | else {nCER++;return 1;} |
|---|
| 1118 | } |
|---|
| 1119 | if(nSW==111){ |
|---|
| 1120 | if (state_expos_recalculated || nCER>100) { |
|---|
| 1121 | state_expos_under = under_exposed; |
|---|
| 1122 | state_expos_over = over_exposed; |
|---|
| 1123 | nCER=0; |
|---|
| 1124 | nSW=112; |
|---|
| 1125 | //presynch(); |
|---|
| 1126 | } |
|---|
| 1127 | else {nCER++;return 1;} |
|---|
| 1128 | } |
|---|
| 1129 | if(nSW==112){ |
|---|
| 1130 | if (shooting_is_flash_ready() || nCER>10){ |
|---|
| 1131 | nCER=0; |
|---|
| 1132 | nSW=113; |
|---|
| 1133 | } |
|---|
| 1134 | else {nCER++;return 1;} |
|---|
| 1135 | } |
|---|
| 1136 | if(nTxzoom>0 && nSW==114 && conf.remote_zoom_enable){ |
|---|
| 1137 | nCrzpos=lens_get_zoom_point(); |
|---|
| 1138 | if(nIntzpos!=nCrzpos) {nReczoom=0;} |
|---|
| 1139 | if(nIntzpos==nCrzpos && nCER>50){ |
|---|
| 1140 | if(nCount>0){ |
|---|
| 1141 | kbd_key_release_all(); |
|---|
| 1142 | set_key_press(0); |
|---|
| 1143 | nTxzoom=1; |
|---|
| 1144 | nSW=0; |
|---|
| 1145 | nCount=0; |
|---|
| 1146 | nWt=10; |
|---|
| 1147 | nReczoom=1; |
|---|
| 1148 | return 1; |
|---|
| 1149 | } |
|---|
| 1150 | } |
|---|
| 1151 | if(nReczoom==0 && ((nTxzname==KEY_ZOOM_IN && nCrzpos>=nTxtbl[nTxtblcr]) || (nTxzname==KEY_ZOOM_OUT && nCrzpos<=nTxtbl[nTxtblcr]))){ |
|---|
| 1152 | if(nCount==0){ |
|---|
| 1153 | i=1; |
|---|
| 1154 | if(nTxzname==KEY_ZOOM_IN){ |
|---|
| 1155 | nTxtblcr++; |
|---|
| 1156 | if(nTxtblcr>(ZSTEP_TABLE_SIZE-1)){ |
|---|
| 1157 | nTxtblcr=(ZSTEP_TABLE_SIZE-1); |
|---|
| 1158 | nTxzname=KEY_ZOOM_OUT; |
|---|
| 1159 | } |
|---|
| 1160 | } |
|---|
| 1161 | else{ |
|---|
| 1162 | nTxtblcr--; |
|---|
| 1163 | if(nTxtblcr<0){ |
|---|
| 1164 | nTxtblcr=0; |
|---|
| 1165 | nTxzname=KEY_ZOOM_IN; |
|---|
| 1166 | } |
|---|
| 1167 | } |
|---|
| 1168 | if(i==1) return 1; |
|---|
| 1169 | } |
|---|
| 1170 | kbd_key_release_all(); |
|---|
| 1171 | set_key_press(0); |
|---|
| 1172 | nTxzoom=1; |
|---|
| 1173 | // lens_set_zoom_speed(25); |
|---|
| 1174 | nSW=115; |
|---|
| 1175 | nWt=5; |
|---|
| 1176 | return 1; |
|---|
| 1177 | } |
|---|
| 1178 | kbd_key_release_all(); |
|---|
| 1179 | kbd_key_press(nTxzname); |
|---|
| 1180 | set_key_press(1); |
|---|
| 1181 | nCER++; |
|---|
| 1182 | return 1; |
|---|
| 1183 | } |
|---|
| 1184 | if(nTxzoom>0 && nSW==115 && conf.remote_zoom_enable){ |
|---|
| 1185 | if(nCount==0) return 1; |
|---|
| 1186 | nCrzpos=lens_get_zoom_point(); |
|---|
| 1187 | if((nTxzname==KEY_ZOOM_IN && nCrzpos<=nTxtbl[nTxtblcr]) || (nTxzname==KEY_ZOOM_OUT && nCrzpos>=nTxtbl[nTxtblcr])){ |
|---|
| 1188 | kbd_key_release_all(); |
|---|
| 1189 | set_key_press(0); |
|---|
| 1190 | nTxzoom=1; |
|---|
| 1191 | lens_set_zoom_speed(100); |
|---|
| 1192 | nSW=0; |
|---|
| 1193 | nCount=0; |
|---|
| 1194 | nWt=10; |
|---|
| 1195 | return 1; |
|---|
| 1196 | } |
|---|
| 1197 | lens_set_zoom_speed(5); |
|---|
| 1198 | kbd_key_release_all(); |
|---|
| 1199 | if(nTxzname==KEY_ZOOM_IN) kbd_key_press(KEY_ZOOM_OUT); |
|---|
| 1200 | else kbd_key_press(KEY_ZOOM_IN); |
|---|
| 1201 | set_key_press(1); |
|---|
| 1202 | return 1; |
|---|
| 1203 | } |
|---|
| 1204 | |
|---|
| 1205 | |
|---|
| 1206 | if(get_usb_power(1)){ |
|---|
| 1207 | return 1; |
|---|
| 1208 | } |
|---|
| 1209 | if(nCount>0 && nSW==113){ |
|---|
| 1210 | if(nCount<9){ |
|---|
| 1211 | if(nTxzoom>0 && conf.remote_zoom_enable){ |
|---|
| 1212 | kbd_key_release_all(); |
|---|
| 1213 | set_key_press(0); |
|---|
| 1214 | nTxzoom=0; |
|---|
| 1215 | nReczoom=0; |
|---|
| 1216 | nSW=0; |
|---|
| 1217 | nCa=0; |
|---|
| 1218 | nCount=0; |
|---|
| 1219 | nWt=10; |
|---|
| 1220 | // lens_set_zoom_speed(100); |
|---|
| 1221 | debug_led(0); |
|---|
| 1222 | return 1; |
|---|
| 1223 | } |
|---|
| 1224 | nSW=125; |
|---|
| 1225 | nWt=10; |
|---|
| 1226 | kbd_key_release(KEY_SHOOT_HALF); |
|---|
| 1227 | soft_half_press = 0; |
|---|
| 1228 | set_key_press(1); |
|---|
| 1229 | // kbd_blocked = 1; |
|---|
| 1230 | // nRmt=1; |
|---|
| 1231 | nCount=0; |
|---|
| 1232 | return 1; |
|---|
| 1233 | } |
|---|
| 1234 | else{ |
|---|
| 1235 | if(nTxzoom>0 && conf.remote_zoom_enable){ |
|---|
| 1236 | nCount=0; |
|---|
| 1237 | nSW=114; |
|---|
| 1238 | return 1; |
|---|
| 1239 | } |
|---|
| 1240 | nSW=124; |
|---|
| 1241 | nWt=2; |
|---|
| 1242 | shutter_int=0; |
|---|
| 1243 | // debug_led(0); |
|---|
| 1244 | kbd_key_press(KEY_SHOOT_FULL); |
|---|
| 1245 | set_key_press(1); |
|---|
| 1246 | // kbd_blocked = 1; |
|---|
| 1247 | // nRmt=1; |
|---|
| 1248 | nCount=0; |
|---|
| 1249 | return 1; |
|---|
| 1250 | } |
|---|
| 1251 | } |
|---|
| 1252 | if(nSW==124){ |
|---|
| 1253 | // debug_led(0); |
|---|
| 1254 | if(drmode==1 && shutter_int==0){ |
|---|
| 1255 | return 1; |
|---|
| 1256 | } |
|---|
| 1257 | nSW=125; |
|---|
| 1258 | nWt=2; |
|---|
| 1259 | kbd_key_release(KEY_SHOOT_FULL); |
|---|
| 1260 | soft_half_press = 0; |
|---|
| 1261 | set_key_press(1); |
|---|
| 1262 | // kbd_blocked = 1; |
|---|
| 1263 | // nRmt=1; |
|---|
| 1264 | return 1; |
|---|
| 1265 | } |
|---|
| 1266 | if(!get_usb_power(1) && nSW==125) { |
|---|
| 1267 | set_key_press(0); |
|---|
| 1268 | // kbd_blocked = 0; |
|---|
| 1269 | // key_pressed = 0; |
|---|
| 1270 | nWt=50; |
|---|
| 1271 | nSW=0; |
|---|
| 1272 | // nRmt=0; |
|---|
| 1273 | nCa=0; |
|---|
| 1274 | //postsynch(); |
|---|
| 1275 | return 1; |
|---|
| 1276 | } |
|---|
| 1277 | } |
|---|
| 1278 | |
|---|
| 1279 | // ------ add by Masuji SUTO (end) -------------- |
|---|
| 1280 | |
|---|
| 1281 | } // ricoh_ca1_mode |
|---|
| 1282 | #endif |
|---|
| 1283 | /*------------------- Alex scriptless remote additions start --------------------*/ |
|---|
| 1284 | if (conf.remote_enable && !conf.ricoh_ca1_mode && key_pressed != 2 && get_usb_power(1)) { |
|---|
| 1285 | remoteShooting = 1; |
|---|
| 1286 | kbd_blocked = 1; |
|---|
| 1287 | kbd_key_release_all(); |
|---|
| 1288 | remoteClickTimer = REMOTE_MAX_CLICK_LENGTH; |
|---|
| 1289 | if (shooting_get_focus_mode()) { |
|---|
| 1290 | remoteFullShutter = 1; |
|---|
| 1291 | kbd_key_press(KEY_SHOOT_FULL); |
|---|
| 1292 | } else { |
|---|
| 1293 | remoteHalfShutter = 1; |
|---|
| 1294 | kbd_key_press(KEY_SHOOT_HALF); |
|---|
| 1295 | } |
|---|
| 1296 | return 1; |
|---|
| 1297 | } |
|---|
| 1298 | /*-------------------- Alex scriptless remote additions end ---------------------*/ |
|---|
| 1299 | |
|---|
| 1300 | if (conf.use_zoom_mf && kbd_use_zoom_as_mf()) { |
|---|
| 1301 | return 1; |
|---|
| 1302 | } |
|---|
| 1303 | if ((conf.fast_ev || conf.fast_movie_control || conf.fast_movie_quality_control) && kbd_use_up_down_left_right_as_fast_switch()) { |
|---|
| 1304 | return 1; |
|---|
| 1305 | } |
|---|
| 1306 | other_kbd_process(); // processed other keys in not <alt> mode |
|---|
| 1307 | } |
|---|
| 1308 | |
|---|
| 1309 | return kbd_blocked; |
|---|
| 1310 | } |
|---|
| 1311 | |
|---|
| 1312 | static const struct Keynames { |
|---|
| 1313 | int keyid; |
|---|
| 1314 | char *keyname; |
|---|
| 1315 | } keynames[] = { |
|---|
| 1316 | { KEY_UP, "up" }, |
|---|
| 1317 | { KEY_DOWN, "down" }, |
|---|
| 1318 | { KEY_LEFT, "left" }, |
|---|
| 1319 | { KEY_RIGHT, "right" }, |
|---|
| 1320 | { KEY_SET, "set" }, |
|---|
| 1321 | { KEY_SHOOT_HALF, "shoot_half" }, |
|---|
| 1322 | { KEY_SHOOT_FULL, "shoot_full" }, |
|---|
| 1323 | { KEY_ZOOM_IN, "zoom_in" }, |
|---|
| 1324 | { KEY_ZOOM_OUT, "zoom_out" }, |
|---|
| 1325 | { KEY_MENU, "menu" }, |
|---|
| 1326 | { KEY_DISPLAY, "display" }, |
|---|
| 1327 | { KEY_PRINT, "print" }, |
|---|
| 1328 | { KEY_ERASE, "erase" }, |
|---|
| 1329 | { KEY_ISO, "iso" }, |
|---|
| 1330 | { KEY_FLASH, "flash" }, |
|---|
| 1331 | { KEY_MF, "mf" }, |
|---|
| 1332 | { KEY_MACRO, "macro" }, |
|---|
| 1333 | { KEY_VIDEO, "video" }, |
|---|
| 1334 | { KEY_TIMER, "timer" }, |
|---|
| 1335 | { KEY_EXPO_CORR, "expo_corr" }, |
|---|
| 1336 | { KEY_MICROPHONE, "fe" }, |
|---|
| 1337 | { 0xFF, "remote" }, |
|---|
| 1338 | { 0xFFFF, "no_key" }, |
|---|
| 1339 | }; |
|---|
| 1340 | |
|---|
| 1341 | int keyid_by_name (const char *n) |
|---|
| 1342 | { |
|---|
| 1343 | int i; |
|---|
| 1344 | for (i=0;i<sizeof(keynames)/sizeof(keynames[0]);i++) |
|---|
| 1345 | if (strcmp(keynames[i].keyname,n) == 0) |
|---|
| 1346 | return keynames[i].keyid; |
|---|
| 1347 | return 0; |
|---|
| 1348 | } |
|---|
| 1349 | |
|---|
| 1350 | int kbd_is_blocked() { |
|---|
| 1351 | return kbd_blocked; |
|---|
| 1352 | } |
|---|
| 1353 | |
|---|
| 1354 | long kbd_use_up_down_left_right_as_fast_switch() { |
|---|
| 1355 | static const char* modes[]={ "0.25x", "0.5x","0.75x", "1x", "1.25x", "1.5x", "1.75x", "2x", "2.5x", "3x"}; |
|---|
| 1356 | static long key_pressed = 0; |
|---|
| 1357 | if (!(kbd_is_key_pressed(KEY_UP)) && !(kbd_is_key_pressed(KEY_DOWN))) key_pressed = 0; |
|---|
| 1358 | if (kbd_is_key_pressed(KEY_UP) && (mode_get()&MODE_MASK) == MODE_REC && ((mode_get()&MODE_SHOOTING_MASK) != MODE_M) && ((mode_get()&MODE_SHOOTING_MASK) != MODE_VIDEO_STD) && movie_status<4 && (canon_shoot_menu_active==0)) { |
|---|
| 1359 | |
|---|
| 1360 | if (conf.fast_ev && key_pressed == 0) { |
|---|
| 1361 | #if (CAM_PROPSET == 1) |
|---|
| 1362 | shooting_set_prop(25,shooting_get_prop(25)+(conf.fast_ev_step+1)*16); |
|---|
| 1363 | shooting_set_prop(26,shooting_get_prop(26)+(conf.fast_ev_step+1)*16); |
|---|
| 1364 | #elif (CAM_PROPSET == 2) |
|---|
| 1365 | shooting_set_prop(107,shooting_get_prop(107)+(conf.fast_ev_step+1)*16); |
|---|
| 1366 | shooting_set_prop(207,shooting_get_prop(207)+(conf.fast_ev_step+1)*16); |
|---|
| 1367 | #endif |
|---|
| 1368 | EnterToCompensationEVF(); |
|---|
| 1369 | key_pressed = KEY_UP; |
|---|
| 1370 | |
|---|
| 1371 | return 1; |
|---|
| 1372 | } |
|---|
| 1373 | |
|---|
| 1374 | } |
|---|
| 1375 | if (kbd_is_key_pressed(KEY_UP) && (mode_get()&MODE_MASK) == MODE_REC && movie_status == 4 && (canon_shoot_menu_active==0)) { |
|---|
| 1376 | |
|---|
| 1377 | if (conf.fast_movie_quality_control && key_pressed == 0) { |
|---|
| 1378 | |
|---|
| 1379 | |
|---|
| 1380 | if (conf.video_mode==0) |
|---|
| 1381 | { |
|---|
| 1382 | conf.video_bitrate+=1; |
|---|
| 1383 | if (conf.video_bitrate<0) |
|---|
| 1384 | conf.video_bitrate=sizeof(modes)/sizeof(modes[0])-1; |
|---|
| 1385 | else if (conf.video_bitrate>=(sizeof(modes)/sizeof(modes[0]))) |
|---|
| 1386 | conf.video_bitrate=sizeof(modes)/sizeof(modes[0])-1; |
|---|
| 1387 | shooting_video_bitrate_change(conf.video_bitrate); |
|---|
| 1388 | movie_reset = 1; |
|---|
| 1389 | } |
|---|
| 1390 | |
|---|
| 1391 | if (conf.video_mode==1) |
|---|
| 1392 | { |
|---|
| 1393 | conf.video_quality+=1; |
|---|
| 1394 | if (conf.video_quality<1) |
|---|
| 1395 | conf.video_quality=1; |
|---|
| 1396 | else if (conf.video_quality>99) |
|---|
| 1397 | conf.video_quality=99; |
|---|
| 1398 | movie_reset = 1; |
|---|
| 1399 | } |
|---|
| 1400 | key_pressed = KEY_UP; |
|---|
| 1401 | return 1; |
|---|
| 1402 | } |
|---|
| 1403 | |
|---|
| 1404 | } |
|---|
| 1405 | if (kbd_is_key_pressed(KEY_DOWN) && (mode_get()&MODE_MASK) == MODE_REC && ((mode_get()&MODE_SHOOTING_MASK) != MODE_M) && ((mode_get()&MODE_SHOOTING_MASK) != MODE_VIDEO_STD) && movie_status<4 && (canon_shoot_menu_active==0)) { |
|---|
| 1406 | |
|---|
| 1407 | |
|---|
| 1408 | if (conf.fast_ev && key_pressed == 0) { |
|---|
| 1409 | kbd_key_release_all(); |
|---|
| 1410 | #if (CAM_PROPSET == 1) |
|---|
| 1411 | shooting_set_prop(25,shooting_get_prop(25)-(conf.fast_ev_step+1)*16); |
|---|
| 1412 | shooting_set_prop(26,shooting_get_prop(26)-(conf.fast_ev_step+1)*16); |
|---|
| 1413 | #elif (CAM_PROPSET == 2) |
|---|
| 1414 | shooting_set_prop(107,shooting_get_prop(107)-(conf.fast_ev_step+1)*16); |
|---|
| 1415 | shooting_set_prop(207,shooting_get_prop(207)-(conf.fast_ev_step+1)*16); |
|---|
| 1416 | #endif |
|---|
| 1417 | key_pressed = KEY_DOWN; |
|---|
| 1418 | EnterToCompensationEVF(); |
|---|
| 1419 | return 1; |
|---|
| 1420 | } |
|---|
| 1421 | |
|---|
| 1422 | } |
|---|
| 1423 | |
|---|
| 1424 | if (kbd_is_key_pressed(KEY_DOWN) && (mode_get()&MODE_MASK) == MODE_REC && movie_status == 4 && (canon_shoot_menu_active==0)) { |
|---|
| 1425 | |
|---|
| 1426 | |
|---|
| 1427 | if (conf.fast_movie_quality_control && key_pressed == 0) { |
|---|
| 1428 | |
|---|
| 1429 | if (conf.video_mode==0) |
|---|
| 1430 | { |
|---|
| 1431 | conf.video_bitrate+=-1; |
|---|
| 1432 | if (conf.video_bitrate<0) |
|---|
| 1433 | conf.video_bitrate=0; |
|---|
| 1434 | |
|---|
| 1435 | |
|---|
| 1436 | shooting_video_bitrate_change(conf.video_bitrate); |
|---|
| 1437 | movie_reset = 1; |
|---|
| 1438 | } |
|---|
| 1439 | if (conf.video_mode==1) |
|---|
| 1440 | { |
|---|
| 1441 | conf.video_quality-=1; |
|---|
| 1442 | if (conf.video_quality<1) |
|---|
| 1443 | conf.video_quality=1; |
|---|
| 1444 | else if (conf.video_quality>99) |
|---|
| 1445 | conf.video_quality=99; |
|---|
| 1446 | movie_reset = 1; |
|---|
| 1447 | } |
|---|
| 1448 | |
|---|
| 1449 | |
|---|
| 1450 | |
|---|
| 1451 | key_pressed = KEY_DOWN; |
|---|
| 1452 | return 1; |
|---|
| 1453 | } |
|---|
| 1454 | |
|---|
| 1455 | } |
|---|
| 1456 | |
|---|
| 1457 | if (kbd_is_key_pressed(KEY_LEFT) && (mode_get()&MODE_MASK) == MODE_REC && movie_status == 4 && (canon_shoot_menu_active==0)) { |
|---|
| 1458 | |
|---|
| 1459 | |
|---|
| 1460 | if (conf.fast_movie_control && key_pressed == 0) { |
|---|
| 1461 | |
|---|
| 1462 | movie_status = 1; |
|---|
| 1463 | |
|---|
| 1464 | |
|---|
| 1465 | key_pressed = KEY_LEFT; |
|---|
| 1466 | return 1; |
|---|
| 1467 | } |
|---|
| 1468 | |
|---|
| 1469 | } |
|---|
| 1470 | |
|---|
| 1471 | if (kbd_is_key_pressed(KEY_RIGHT) && (mode_get()&MODE_MASK) == MODE_REC && movie_status == 1 && (canon_shoot_menu_active==0)) { |
|---|
| 1472 | |
|---|
| 1473 | |
|---|
| 1474 | if (conf.fast_movie_control && key_pressed == 0) { |
|---|
| 1475 | |
|---|
| 1476 | movie_status = 4; |
|---|
| 1477 | movie_reset = 1; |
|---|
| 1478 | |
|---|
| 1479 | |
|---|
| 1480 | key_pressed = KEY_RIGHT; |
|---|
| 1481 | return 1; |
|---|
| 1482 | } |
|---|
| 1483 | |
|---|
| 1484 | } |
|---|
| 1485 | |
|---|
| 1486 | return 0; |
|---|
| 1487 | } |
|---|