static void shift_btn(shifter_dd *dt, void **wdata, int what, void **where) { int i; if ((what == op_EVT_OK) || (what == op_EVT_CANCEL)) { shift_play_state = FALSE; // Stop mem_pal_copy(mem_pal, dt->old_pal); update_stuff(UPD_PAL); run_destroy(wdata); return; } if (what == op_EVT_CHANGE) // Play toggle { cmd_read(where, dt); if (shift_play_state && !shift_timer_state) // Start timer shift_timer_state = threads_timeout_add(100, shift_play_timer_call, dt); return; } where = origin_slot(where); if (where == dt->fix) // Button to fix palette pressed { i = dt->frame[0]; if (!i || (i > dt->frame[2])) return; // Nothing to do mem_pal_copy(mem_pal, dt->old_pal); spot_undo(UNDO_PAL); shifter_set_palette(dt, i); mem_pal_copy(dt->old_pal, mem_pal); cmd_set(dt->slider, 0); update_stuff(UPD_PAL); } else if (where == dt->clear) // Button to clear all of the values { for (i = 0; i < NSHIFT; i++) spins[i][0][0] = spins[i][1][0] = spins[i][2][0] = 0; cmd_reset(dt->spinpack, dt); shifter_moved(dt, wdata, op_EVT_CHANGE, dt->spinpack); } else if (where == dt->create) // Button to create a sequence of undo images { if (!dt->frame[2]) return; // Nothing to do for (i = 0; i <= dt->frame[2]; i++) { shifter_set_palette(dt, i); spot_undo(UNDO_PAL); } shifter_set_palette(dt, dt->frame[0]); update_stuff(UPD_PAL); } }
static void shift_play_start() { if (!shift_play_state) { shift_play_state = 1; if (!shift_timer_state) shift_timer_state = threads_timeout_add( 100, shift_play_timer_call, NULL); } }