void zoom_preview (int current) { set_zoom_display (current); draw_screen_display (); rb->splash (0, "Preview"); }
/* Call every time the board size might have changed! */ void setup_display (void) { set_zoom_display (0); /* 0 means set to default */ /* The cursor starts out in the top right of the board * (on the hoshi point for most board sizes), unless the board * is really small in which case the cursor starts at the center * of the board. */ int start_x, start_y; if (board_width >= 7) { start_x = board_width - 4; } else { start_x = board_width / 2; } if (board_height >= 7) { start_y = 3; } else { start_y = board_height / 2; } cursor_pos = POS (start_x, start_y); last_cursor_pos = INVALID_POS; last_int_size = -1; clear_marks_display (); }
static bool do_zoom (void) { unsigned int zoom_level; unsigned int old_val; bool done = false; unsigned int min_val = min_zoom_display (); unsigned int max_val = max_zoom_display (); zoom_level = old_val = current_zoom_display (); int action; zoom_preview (zoom_level); while (!done) { switch (action = rb->get_action (CONTEXT_LIST, TIMEOUT_BLOCK)) { case ACTION_STD_OK: set_zoom_display (zoom_level); done = true; rb->splash (HZ / 2, "Zoom Set"); saved_circle_size = intersection_size; break; case ACTION_STD_CANCEL: set_zoom_display (old_val); done = true; rb->splash (HZ / 2, "Cancelled"); break; case ACTION_STD_CONTEXT: zoom_level = old_val; zoom_preview (zoom_level); break; case ACTION_STD_NEXT: case ACTION_STD_NEXTREPEAT: zoom_level = zoom_level * 3 / 2; /* 1 * 3 / 2 is 1 again... */ if (zoom_level == 1) { ++zoom_level; } if (zoom_level > max_val) { zoom_level = min_val; } zoom_preview (zoom_level); break; case ACTION_STD_PREV: case ACTION_STD_PREVREPEAT: zoom_level = zoom_level * 2 / 3; if (zoom_level < min_val) { zoom_level = max_val; } zoom_preview (zoom_level); break; case ACTION_NONE: break; default: if (rb->default_event_handler (action) == SYS_USB_CONNECTED) { return true; } break; } } return false; }