void EventHandler::joystick_button(SDL_JoyButtonEvent *event) { if (event->state != SDL_PRESSED || event->button > MAXJOYBUTTON) return; switch (Global::inputDev.joystick_bind_b[event->button]) { case TInputDev::RESUME: Global::Simulation->resume(); break; case TInputDev::RESET: Global::Simulation->reset(); break; case TInputDev::PAUSE: Global::Simulation->pause(); LOG("Press <u> to resume."); break; case TInputDev::INCTHROTTLE: Global::TXInterface->increase_throttle(); break; case TInputDev::DECTHROTTLE: Global::TXInterface->decrease_throttle(); break; case TInputDev::ZOOMIN: zoom_in(); break; case TInputDev::ZOOMOUT: zoom_out(); break; default: break; } }
static void key_zoom(int k, t_env *e) { if (k == KEY_ZOOM_IN) zoom_in(e); if (k == KEY_ZOOM_OUT) zoom_out(e); }
static void zoom_out_button_clicked (GtkWidget *button, SoliPrintPreview *preview) { zoom_out (preview); gtk_widget_grab_focus (GTK_WIDGET (preview->layout)); }
void PatchScene::keyPressEvent(QKeyEvent* event) { if (event->key() == Qt::Key_Control) ctrl_down = true; if (event->key() == Qt::Key_Home) { zoom_fit(); event->accept(); } else if (ctrl_down) { if (event->key() == Qt::Key_Plus) { zoom_in(); event->accept(); } else if (event->key() == Qt::Key_Minus) { zoom_out(); event->accept(); } else if (event->key() == Qt::Key_1) { zoom_reset(); event->accept(); } else QGraphicsScene::keyPressEvent(event); } else QGraphicsScene::keyPressEvent(event); }
static gboolean scroll_event_activated (GtkWidget *widget, GdkEventScroll *event, SoliPrintPreview *preview) { if (event->state & GDK_CONTROL_MASK) { if ((event->direction == GDK_SCROLL_UP) || (event->direction == GDK_SCROLL_SMOOTH && event->delta_y < 0)) { zoom_in (preview); } else if ((event->direction == GDK_SCROLL_DOWN) || (event->direction == GDK_SCROLL_SMOOTH && event->delta_y > 0)) { zoom_out (preview); } return GDK_EVENT_STOP; } return GDK_EVENT_PROPAGATE; }
static void handle_keypress(int key, camera *camera) { switch(key) { case SDLK_LEFT: move_camera(camera, -arrows_camera_delta * ZOOM_LEVEL, 0); break; case SDLK_RIGHT: move_camera(camera, arrows_camera_delta * ZOOM_LEVEL, 0); break; case SDLK_UP: move_camera(camera, 0, -arrows_camera_delta * ZOOM_LEVEL); break; case SDLK_DOWN: move_camera(camera, 0, arrows_camera_delta * ZOOM_LEVEL); break; case SDLK_PAGEUP: zoom_in(camera); update_background(); break; case SDLK_PAGEDOWN: zoom_out(camera); update_background(); break; case SDLK_p: toggle_pause(); } }
int mouse_hook(int button, int x, int y, t_init *st) { if ((button == 5 || button == 1) && x <= (int)st->image_x && y <= (int)st->image_y) zoom_in(st, x, y); if ((button == 4 || button == 2) && x <= (int)st->image_x && y <= (int)st->image_y) zoom_out(st, x, y); return (0); }
gboolean mouse_handle_scroll_event(GtkWidget *widget, GdkEventScroll *event) { // handle zoom events // propagate everything except control modifier if (event->direction == GDK_SCROLL_UP) { if (event->state == 0) { // no modifiers // move up //canvas_move(widget, 0.0, -1*vscroll->step_increment); canvas_move(widget, 0.0, -1*gtk_adjustment_get_step_increment(vscroll)); } else if (event->state == GDK_SHIFT_MASK) { // shift modifier // move left canvas_move(widget, -1*gtk_adjustment_get_step_increment(hscroll), 0.0); } else if (event->state == GDK_CONTROL_MASK) { // ctrl modifier // zoom in zoom_in(widget, true); } } else if (event->direction == GDK_SCROLL_DOWN) { if (event->state == 0) { // move down canvas_move(widget, 0.0, gtk_adjustment_get_step_increment(vscroll)); } else if (event->state == GDK_SHIFT_MASK) { // shift modifier // move right canvas_move(widget, gtk_adjustment_get_step_increment(hscroll), 0.0); } else if (event->state == GDK_CONTROL_MASK) { // ctrl modifier // zoom out zoom_out(widget, true); } } else if (event->direction == GDK_SCROLL_LEFT) { canvas_move(widget, -1*gtk_adjustment_get_step_increment(hscroll), 0.0); } else if (event->direction == GDK_SCROLL_RIGHT) { canvas_move(widget, gtk_adjustment_get_step_increment(hscroll), 0.0); } return TRUE; }
/** Scroll event handler. * @param event event structure * @return signal return value */ bool SkillGuiGraphDrawingArea::on_scroll_event(GdkEventScroll *event) { if (event->direction == GDK_SCROLL_UP) { zoom_in(); } else if (event->direction == GDK_SCROLL_DOWN) { zoom_out(); } return true; }
int mouse_button(int button, int x, int y, t_env *e) { if (x < 0 || y < 0) return (0); if (button == 1 || button == 5) zoom_in(e, x, y); if (button == 2 || button == 4) zoom_out(e, x, y); return (0); }
static gboolean key_press_event(GtkWidget *widget, GdkEventKey *event, gpointer data) { struct coord pos = canvas_to_coord(curr_pos.x, curr_pos.y); DPRINTF("--- key press ---"); switch (event->keyval) { case ' ': user_origin = pos; update_pos(pos); break; case '+': case '=': zoom_in(pos); break; case '-': zoom_out(pos); break; case '*': zoom_to_extents(); break; case '#': zoom_to_frame(); break; case '.': tool_dehover(); draw_ctx.center = pos; redraw(); tool_hover(canvas_to_coord(curr_pos.x, curr_pos.y)); break; case GDK_BackSpace: case GDK_Delete: #if 0 case GDK_KP_Delete: if (selected_inst) { inst_delete(selected_inst); change_world(); } break; #endif case 'u': if (undelete()) change_world(); break; case '/': { /* @@@ find a better place for this */ extern int show_vars; show_vars = !show_vars; change_world(); } } return TRUE; }
void moth_gui::handle_mouse_button(SDL_MouseButtonEvent* button) { button_state = button->state; if (shift_state == SDL_PRESSED) { if (button->button == SDL_BUTTON_WHEELDOWN) { zoom_out(); } else if (button->button == SDL_BUTTON_WHEELUP) { zoom_in(); } } }
void GLWidget::wheelEvent (QWheelEvent *event) { if (event->delta () > 0) { zoom_in (); } else { zoom_out (); } updateGL (); }
void handle_zoom_out() { uint32_t cur_intr_time = millis(); if ( cur_intr_time < out_prev_intr_time ) { // time inversion caused by wraparound, so reset out_prev_intr_time = cur_intr_time; } if ( out_prev_intr_time == 0 || out_prev_intr_time + bounce_delay < cur_intr_time ) { zoom_out(); out_prev_intr_time = cur_intr_time; } }
int sierpinski_input(unsigned int button, unsigned int key, t_data *data) { int ret; ret = 0; if (button == M_LEFT || button == M_S_UP) ret += zoom_in(data); if (button == M_RIGHT || button == M_S_DOWN) ret += zoom_out(data); (void)key; return (ret); }
void event_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info) { Evas_Event_Mouse_Down *ev = event_info; if (ev->button == 1) { if (ev->flags == EVAS_BUTTON_DOUBLE_CLICK) zoom_in(); if (ev->flags == EVAS_BUTTON_TRIPLE_CLICK) zoom_out(); mouse_down = 1; new_x = old_x = ev->canvas.x; new_y = old_y = ev->canvas.y; evas_object_focus_set(view, EINA_FALSE); } }
void on_key_down(unsigned int keycode) { if (keycode == VK_F11) { toggle_full_screen(); } else if (keycode == L'R' && ::GetKeyState(VK_CONTROL) < 0) { browser_->Reload(); } else if (keycode == VK_OEM_PLUS && ::GetKeyState(VK_CONTROL) < 0) { zoom_in(); } else if (keycode == VK_OEM_MINUS && ::GetKeyState(VK_CONTROL) < 0) { zoom_out(); } else if (keycode == L'F' && ::GetKeyState(VK_CONTROL) < 0) { show_find_dialog(); } }
void GLWidget::set_default () { scale = 1.; xRot = 920; yRot = -112; zRot = 0; MIN_X = -MAJOR; MAX_X = MAJOR; MIN_Y = -MINOR; MAX_Y = MINOR; steps = 150; residual = 0.; zoom_out (); }
bool WidgetZoomHandler::handle_wheel_event(QWheelEvent* event) { if (event->delta() > 0) { zoom_in(); return true; } else if (event->delta() < 0) { zoom_out(); return true; } return false; }
void moth_gui::handle_key_down(SDL_keysym *key) { switch(key->sym) { case SDLK_RSHIFT: case SDLK_LSHIFT: shift_state = SDL_PRESSED; break; case SDLK_ESCAPE: running = 0; break; case SDLK_RIGHT: move_page_right(); break; case SDLK_LEFT: move_page_left(); break; case SDLK_g: handle_goto_page(); break; case SDLK_s: handle_save_copy(); break; case SDLK_f: handle_find(); break; case SDLK_n: handle_find_next(); break; case SDLK_p: handle_find_prev(); break; case SDLK_i: show_index(); break; case SDLK_PLUS: case SDLK_EQUALS: zoom_in(); break; case SDLK_MINUS: zoom_out(); break; default: break; } }
static gboolean scroll_event(GtkWidget *widget, GdkEventScroll *event, gpointer data) { struct coord pos = canvas_to_coord(event->x, event->y); gtk_widget_grab_focus(widget); switch (event->direction) { case GDK_SCROLL_UP: zoom_in(pos); break; case GDK_SCROLL_DOWN: zoom_out(pos); break; default: /* ignore */; } return TRUE; }
void TagScrollView::wheelEvent( QWheelEvent* e ) { if( e->modifiers() == Qt::CTRL ) { QPoint angle = e->angleDelta(); if( angle.isNull() ) { return; } if( angle.y() > 0 ) { zoom_in(); } else if( angle.y() < 0 ) { zoom_out(); } } else { QScrollArea::wheelEvent(e); } }
void Window::create_actions() { open_action = new QAction(QIcon(":/fileopen.ico"), tr("Open"), this); open_action->setShortcuts(QKeySequence::Open); connect(open_action, SIGNAL(triggered()), this, SLOT(open())); save_as_action = new QAction(QIcon(":/filesaveas.ico"), tr("Save As"), this); save_as_action->setShortcuts(QKeySequence::SaveAs); connect(save_as_action, SIGNAL(triggered()), this, SLOT(save_as())); save_as_action->setEnabled(false); exit_action = new QAction(QIcon(":/exit.ico"), tr("Quit"), this); exit_action->setShortcuts(QKeySequence::Quit); connect(exit_action, SIGNAL(triggered()), this, SLOT(close())); zoom_in_action = new QAction(QIcon(":/zoom_in.ico"),tr("Zoom &In (25%)"), this); zoom_in_action->setShortcuts(QList<QKeySequence>() << QKeySequence::ZoomIn << QKeySequence(tr("Ctrl++"))); zoom_in_action->setEnabled(false); connect(zoom_in_action, SIGNAL(triggered()), this, SLOT(zoom_in())); zoom_out_action = new QAction(QIcon(":/zoom_out.ico"),tr("Zoom &Out (25%)"), this); zoom_out_action->setShortcuts(QList<QKeySequence>() << QKeySequence::ZoomOut << QKeySequence(tr("Ctrl+-"))); zoom_out_action->setEnabled(false); connect(zoom_out_action, SIGNAL(triggered()), this, SLOT(zoom_out())); zoom_original_action = new QAction(QIcon(":/zoom_original.ico"),tr("&Normal Size"), this); zoom_original_action->setShortcut(tr("Ctrl+S")); zoom_original_action->setEnabled(false); connect(zoom_original_action, SIGNAL(triggered()), this, SLOT(zoom_original())); zoom_fit_action = new QAction(QIcon(":/zoom_fit_best.ico"),tr("&Fit to Window"), this); zoom_fit_action->setShortcut(tr("Ctrl+F")); zoom_fit_action->setEnabled(false); zoom_fit_action->setCheckable(true); connect(zoom_fit_action, SIGNAL(triggered()), this, SLOT(zoom_fit())); gaussian_blur_action = new QAction(tr("Gaussian blur"), this); gaussian_blur_action->setShortcut(tr("Ctrl+g")); gaussian_blur_action->setEnabled(false); connect(gaussian_blur_action, SIGNAL(triggered()), this, SLOT(gaussian_blur())); }
void MainWindow::create_actions() { action_exit = new action::ExitApplication(this); connect(action_exit, SIGNAL(triggered()), this, SLOT(close())); action_toggle_fullscreen = new action::Fullscreen(this); connect(action_toggle_fullscreen, SIGNAL(showFullScreen()), this, SLOT(showFullScreen())); connect(action_toggle_fullscreen, SIGNAL(showNormal()), this, SLOT(showNormal())); action_about = new action::About(this); connect(action_about, SIGNAL(triggered()), this, SLOT(on_about())); action_about_qt = new action::AboutQt(this); connect(action_about_qt, SIGNAL(triggered()), this, SLOT(on_about_qt())); action_zoom_in = new action::ZoomIn(this); connect(action_zoom_in, SIGNAL(triggered()), map_widget, SLOT(zoom_in())); action_zoom_out = new action::ZoomOut(this); connect(action_zoom_out, SIGNAL(triggered()), map_widget, SLOT(zoom_out())); }
static void handle_mousedown(SDL_MouseButtonEvent button_event, camera *camera, PLAYERS *players) { bool modifier = (SDL_GetModState() & KMOD_CTRL) > 0; gsl_vector *dest; int rel_map_size = MAP_SIZE / ZOOM_LEVEL; int start_x = (WIDTH - rel_map_size) / 2; int end_x = WIDTH - start_x; int start_y = (HEIGHT - rel_map_size) / 2; int end_y = HEIGHT - start_y; if(button_event.x > end_x || button_event.x < start_x || button_event.y > end_y || button_event.y < start_y) return; switch(button_event.button) { case 1: if(paused) toggle_pause(); select_units_at(modifier, button_event.x, button_event.y, camera, players); break; case 3: dest = calculate_map_position(button_event.x, button_event.y, camera); unit *un = check_for_unit_near(dest, players, NULL, false, true); if(un != NULL) { selected_units_attack(un); } else { move_selected_units_to(dest, players); } gsl_vector_free(dest); break; case 4: zoom_in(camera); update_background(); break; case 5: zoom_out(camera); update_background(); } }
void MarkdownViewer::init_actions() { assert(NULL == _action_reload); _action_reload = new QAction(QIcon(":/markdown-viewer/refresh"), tr("重新加载(&R)"), this); _action_reload->setStatusTip(tr("重新加载页面")); _action_reload->setToolTip(tr("重新加载页面")); _action_reload->setShortcut(QKeySequence::Refresh); _action_reload->setPriority(QAction::LowPriority); connect(_action_reload, SIGNAL(triggered()), this, SLOT(reload())); assert(NULL == _action_zoom_in); _action_zoom_in = new QAction(QIcon(":/markdown-viewer/zoom-in"), tr("放大(&I)"), this); _action_zoom_in->setStatusTip(tr("放大")); _action_zoom_in->setToolTip(tr("放大")); _action_zoom_in->setShortcut(QKeySequence::ZoomIn); _action_zoom_in->setPriority(QAction::LowPriority); connect(_action_zoom_in, SIGNAL(triggered()), this, SLOT(zoom_in())); assert(NULL == _action_zoom_out); _action_zoom_out = new QAction(QIcon(":/markdown-viewer/zoom-out"), tr("缩小(&O)"), this); _action_zoom_out->setStatusTip(tr("缩小")); _action_zoom_out->setToolTip(tr("缩小")); _action_zoom_out->setShortcut(QKeySequence::ZoomOut); _action_zoom_out->setPriority(QAction::LowPriority); connect(_action_zoom_out, SIGNAL(triggered()), this, SLOT(zoom_out())); assert(NULL == _action_reset_zoom); _action_reset_zoom = new QAction(QIcon(":/markdown-viewer/reset-zoom"), tr("重置缩放(&Z)"), this); _action_reset_zoom->setStatusTip(tr("重置缩放")); _action_reset_zoom->setToolTip(tr("重置缩放")); _action_reset_zoom->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Z)); _action_reset_zoom->setPriority(QAction::LowPriority); connect(_action_reset_zoom, SIGNAL(triggered()), this, SLOT(reset_zoom())); }
bool WidgetZoomHandler::handle_key_press_event(QKeyEvent* event) { switch (event->key()) { case Qt::Key_Plus: zoom_in(); return true; case Qt::Key_Minus: zoom_out(); return true; case Qt::Key_Equal: if (event->modifiers() & Qt::ShiftModifier) { zoom_in(); return true; } break; } return false; }
int key_hook(int keycode, t_mlx *mlx) { if (keycode == 18) mlx->motion = 1; if (keycode == 19) mlx->motion = 0; if (keycode == 53) exit(0); if (keycode == 20) { mlx->maxiter -= 10; choice(mlx); } if (keycode == 21) { mlx->maxiter += 10; choice(mlx); } if (keycode == 69) zoom_set(ZOOM, ZOOM, mlx); if (keycode == 78) zoom_out(ZOOM, ZOOM, mlx); return (0); }
static void view_zoomout_cb(puObject *obj) { zoom_out(); }
bool command_executor::execute_command(const hotkey_command& cmd, int /*index*/, bool press) { // hotkey release handling if (!press) { switch(cmd.id) { // release a scroll key, un-apply scrolling in the given direction case HOTKEY_SCROLL_UP: scroll_up(false); break; case HOTKEY_SCROLL_DOWN: scroll_down(false); break; case HOTKEY_SCROLL_LEFT: scroll_left(false); break; case HOTKEY_SCROLL_RIGHT: scroll_right(false); break; default: return false; // nothing else handles a hotkey release } return true; } // hotkey press handling switch(cmd.id) { case HOTKEY_SCROLL_UP: scroll_up(true); break; case HOTKEY_SCROLL_DOWN: scroll_down(true); break; case HOTKEY_SCROLL_LEFT: scroll_left(true); break; case HOTKEY_SCROLL_RIGHT: scroll_right(true); break; case HOTKEY_CYCLE_UNITS: cycle_units(); break; case HOTKEY_CYCLE_BACK_UNITS: cycle_back_units(); break; case HOTKEY_ENDTURN: end_turn(); break; case HOTKEY_UNIT_HOLD_POSITION: unit_hold_position(); break; case HOTKEY_END_UNIT_TURN: end_unit_turn(); break; case HOTKEY_LEADER: goto_leader(); break; case HOTKEY_UNDO: undo(); break; case HOTKEY_REDO: redo(); break; case HOTKEY_TERRAIN_DESCRIPTION: terrain_description(); break; case HOTKEY_UNIT_DESCRIPTION: unit_description(); break; case HOTKEY_RENAME_UNIT: rename_unit(); break; case HOTKEY_SAVE_GAME: save_game(); break; case HOTKEY_SAVE_REPLAY: save_replay(); break; case HOTKEY_SAVE_MAP: save_map(); break; case HOTKEY_LOAD_GAME: load_game(); break; case HOTKEY_TOGGLE_ELLIPSES: toggle_ellipses(); break; case HOTKEY_TOGGLE_GRID: toggle_grid(); break; case HOTKEY_STATUS_TABLE: status_table(); break; case HOTKEY_RECALL: recall(); break; case HOTKEY_LABEL_SETTINGS: label_settings(); break; case HOTKEY_RECRUIT: recruit(); break; case hotkey::HOTKEY_REPEAT_RECRUIT: repeat_recruit(); break; case HOTKEY_SPEAK: speak(); break; case HOTKEY_SPEAK_ALLY: whisper(); break; case HOTKEY_SPEAK_ALL: shout(); break; case HOTKEY_CREATE_UNIT: create_unit(); break; case HOTKEY_CHANGE_SIDE: change_side(); break; case HOTKEY_KILL_UNIT: kill_unit(); break; case HOTKEY_PREFERENCES: preferences(); break; case HOTKEY_OBJECTIVES: objectives(); break; case HOTKEY_UNIT_LIST: unit_list(); break; case HOTKEY_STATISTICS: show_statistics(); break; case HOTKEY_STOP_NETWORK: stop_network(); break; case HOTKEY_START_NETWORK: start_network(); break; case HOTKEY_LABEL_TEAM_TERRAIN: label_terrain(true); break; case HOTKEY_LABEL_TERRAIN: label_terrain(false); break; case HOTKEY_CLEAR_LABELS: clear_labels(); break; case HOTKEY_SHOW_ENEMY_MOVES: show_enemy_moves(false); break; case HOTKEY_BEST_ENEMY_MOVES: show_enemy_moves(true); break; case HOTKEY_DELAY_SHROUD: toggle_shroud_updates(); break; case HOTKEY_UPDATE_SHROUD: update_shroud_now(); break; case HOTKEY_CONTINUE_MOVE: continue_move(); break; case HOTKEY_SEARCH: search(); break; case HOTKEY_HELP: show_help(); break; case HOTKEY_CHAT_LOG: show_chat_log(); break; case HOTKEY_USER_CMD: user_command(); break; case HOTKEY_CUSTOM_CMD: custom_command(); break; case HOTKEY_AI_FORMULA: ai_formula(); break; case HOTKEY_CLEAR_MSG: clear_messages(); break; case HOTKEY_LANGUAGE: change_language(); break; case HOTKEY_REPLAY_PLAY: play_replay(); break; case HOTKEY_REPLAY_RESET: reset_replay(); break; case HOTKEY_REPLAY_STOP: stop_replay(); break; case HOTKEY_REPLAY_NEXT_TURN: replay_next_turn(); break; case HOTKEY_REPLAY_NEXT_SIDE: replay_next_side(); break; case HOTKEY_REPLAY_NEXT_MOVE: replay_next_move(); break; case HOTKEY_REPLAY_SHOW_EVERYTHING: replay_show_everything(); break; case HOTKEY_REPLAY_SHOW_EACH: replay_show_each(); break; case HOTKEY_REPLAY_SHOW_TEAM1: replay_show_team1(); break; case HOTKEY_REPLAY_SKIP_ANIMATION: replay_skip_animation(); break; case HOTKEY_REPLAY_EXIT: replay_exit(); break; case HOTKEY_WB_TOGGLE: whiteboard_toggle(); break; case HOTKEY_WB_EXECUTE_ACTION: whiteboard_execute_action(); break; case HOTKEY_WB_EXECUTE_ALL_ACTIONS: whiteboard_execute_all_actions(); break; case HOTKEY_WB_DELETE_ACTION: whiteboard_delete_action(); break; case HOTKEY_WB_BUMP_UP_ACTION: whiteboard_bump_up_action(); break; case HOTKEY_WB_BUMP_DOWN_ACTION: whiteboard_bump_down_action(); break; case HOTKEY_WB_SUPPOSE_DEAD: whiteboard_suppose_dead(); break; case HOTKEY_SELECT_HEX: select_hex(); break; case HOTKEY_DESELECT_HEX: deselect_hex(); break; case HOTKEY_MOVE_ACTION: move_action(); break; case HOTKEY_SELECT_AND_ACTION: select_and_action(); break; case HOTKEY_ACCELERATED: toggle_accelerated_speed(); break; case LUA_CONSOLE: lua_console(); break; case HOTKEY_ZOOM_IN: zoom_in(); break; case HOTKEY_ZOOM_OUT: zoom_out(); break; case HOTKEY_ZOOM_DEFAULT: zoom_default(); break; case HOTKEY_MAP_SCREENSHOT: map_screenshot(); break; case HOTKEY_QUIT_TO_DESKTOP: quit_confirmation::quit_to_desktop(); break; case HOTKEY_QUIT_GAME: quit_confirmation::quit_to_title(); break; default: return false; } return true; }