void update(const float &t, const float &move) { if (!value) return; if (move > 0.f && (to_x != from_x || to_y != from_y)) { float tt = move - t; if (tt < 0.f) tt = t + tt; else tt = t; float tmp = tt / TRANS_TIME; float add_x = tmp * (to_x - from_x); float add_y = tmp * (to_y - from_y); pos_x += add_x; pos_y += add_y; m_text->setPosition(Vector3D(pos_x, pos_y)); m_back->setPosition(Vector3D(pos_x, pos_y)); std::vector<GLfloat> &t = m_text->getVertices(); for (unsigned int i = 0; i < t.size(); i += 2) { t[i] += add_x; t[i + 1] += add_y; } m_text->updateVertices(); } if (!_zoom(1.f * TRANS_TIME)) _unzoom(1.f * TRANS_TIME); if (m_text) m_text->update(t); if (m_back) m_back->update(t); }
static gboolean _key_release_event(GtkWidget *widget, GdkEventKey *event, gpointer data) { (void)widget; (void)data; //* switch(event->keyval) { case GDK_Left : case GDK_Right : case GDK_Up : case GDK_Down :_scroll(event); break; case GDK_equal : case GDK_plus : case GDK_minus :_rotation(event); break; case GDK_Page_Down: case GDK_Page_Up:_zoom(event); break; // case GDK_KEY_Escape:_resetView(&_engine.state); break; case GDK_r : //gtk_widget_draw(widget, NULL); break; // case GDK_KEY_h :_doRenderHelp = !_doRenderHelp; // _usage("s52gtk2"); // break; case GDK_v :g_print("%s\n", S52_version()); break; case GDK_x :_dumpParam(); break; case GDK_q :gtk_main_quit(); break; case GDK_w :_toggle(S52_MAR_TWO_SHADES); break; case GDK_s :_toggle(S52_MAR_SHALLOW_PATTERN); break; case GDK_o :_toggle(S52_MAR_SHIPS_OUTLINE); break; case GDK_l :_toggle(S52_MAR_FULL_SECTORS); break; case GDK_b :_toggle(S52_MAR_SYMBOLIZED_BND); break; case GDK_p :_toggle(S52_MAR_SYMPLIFIED_PNT); break; case GDK_n :_toggle(S52_MAR_FONT_SOUNDG); break; case GDK_u :_toggle(S52_MAR_SCAMIN); break; case GDK_i :_toggle(S52_MAR_ANTIALIAS); break; case GDK_j :_toggle(S52_MAR_QUAPNT01); break; case GDK_z :_toggle(S52_MAR_DISP_OVERLAP); break; //case GDK_1 :_toggle(S52_MAR_DISP_LAYER_LAST); break; case GDK_1 :_meterInc(S52_MAR_DISP_LAYER_LAST);break; case GDK_exclam:_meterDec(S52_MAR_DISP_LAYER_LAST);break; case GDK_2 :_inc(S52_MAR_ROT_BUOY_LIGHT); break; case GDK_3 :_toggle(S52_MAR_DISP_CRSR_POS); _toggle(S52_MAR_DISP_LEGEND); _toggle(S52_MAR_DISP_CALIB); _toggle(S52_MAR_DISP_DRGARE_PATTERN); break; case GDK_4 :_toggle(S52_MAR_DISP_GRATICULE); break; case GDK_5 :_toggle(S52_MAR_HEADNG_LINE); break; //case GDK_t :_meterInc(S52_MAR_SHOW_TEXT); break; //case GDK_T :_meterDec(S52_MAR_SHOW_TEXT); break; case GDK_t : case GDK_T :_toggle (S52_MAR_SHOW_TEXT); break; case GDK_c :_meterInc(S52_MAR_SAFETY_CONTOUR); break; case GDK_C :_meterDec(S52_MAR_SAFETY_CONTOUR); break; case GDK_d :_meterInc(S52_MAR_SAFETY_DEPTH); break; case GDK_D :_meterDec(S52_MAR_SAFETY_DEPTH); break; case GDK_a :_meterInc(S52_MAR_SHALLOW_CONTOUR);break; case GDK_A :_meterDec(S52_MAR_SHALLOW_CONTOUR);break; case GDK_e :_meterInc(S52_MAR_DEEP_CONTOUR); break; case GDK_E :_meterDec(S52_MAR_DEEP_CONTOUR); break; case GDK_f :_meterInc(S52_MAR_DISTANCE_TAGS); break; case GDK_F :_meterDec(S52_MAR_DISTANCE_TAGS); break; case GDK_g :_meterInc(S52_MAR_TIME_TAGS); break; case GDK_G :_meterDec(S52_MAR_TIME_TAGS); break; case GDK_y :_meterInc(S52_MAR_BEAM_BRG_NM); break; case GDK_Y :_meterDec(S52_MAR_BEAM_BRG_NM); break; case GDK_m :_meterInc(S52_MAR_DATUM_OFFSET); break; case GDK_M :_meterDec(S52_MAR_DATUM_OFFSET); break; //case GDK_7 :_disp(S52_MAR_DISP_CATEGORY, 'D'); break; // DISPLAYBASE //case GDK_8 :_disp(S52_MAR_DISP_CATEGORY, 'S'); break; // STANDARD //case GDK_9 :_disp(S52_MAR_DISP_CATEGORY, 'O'); break; // OTHER //case GDK_0 :_disp(S52_MAR_DISP_CATEGORY, 'A'); break; // OTHER (all) //case GDK_7 :_disp(S52_MAR_DISP_CATEGORY, 0); break; // DISPLAYBASE //case GDK_8 :_disp(S52_MAR_DISP_CATEGORY, 1); break; // STANDARD //case GDK_9 :_disp(S52_MAR_DISP_CATEGORY, 2); break; // OTHER //case GDK_0 :_disp(S52_MAR_DISP_CATEGORY, 3); break; // OTHER (all) case GDK_7 :_disp(S52_MAR_DISP_CATEGORY, S52_MAR_DISP_CATEGORY_BASE); break; // DISPLAYBASE case GDK_8 :_disp(S52_MAR_DISP_CATEGORY, S52_MAR_DISP_CATEGORY_STD); break; // STANDARD case GDK_9 :_disp(S52_MAR_DISP_CATEGORY, S52_MAR_DISP_CATEGORY_OTHER); break; // OTHER case GDK_0 :_disp(S52_MAR_DISP_CATEGORY, S52_MAR_DISP_CATEGORY_SELECT); break; // OTHER (all) case GDK_k :_cpal(S52_MAR_COLOR_PALETTE, 1.0);break; case GDK_K :_cpal(S52_MAR_COLOR_PALETTE, -1.0);break; case GDK_6 :_meterInc(S52_MAR_DISP_WHOLIN); break; case GDK_asciicircum: case GDK_question: case GDK_caret :_meterDec(S52_MAR_DISP_WHOLIN); break; //case GDK_3 :_cpal("S52_MAR_COLOR_PALETTE", 2.0); break; // DAY_WHITEBACK //case GDK_4 :_cpal("S52_MAR_COLOR_PALETTE", 3.0); break; // DUSK //case GDK_5 :_cpal("S52_MAR_COLOR_PALETTE", 4.0); break; // NIGHT //case GDK_F1 :S52_doneCell("/home/vitaly/CHARTS/for_sasha/GB5X01SE.000"); break; //case GDK_F2 :S52_doneCell("/home/vitaly/CHARTS/for_sasha/GB5X01NE.000"); break; case GDK_F1 :S52_setMarinerParam(S52_CMD_WRD_FILTER, S52_CMD_WRD_FILTER_SY); break; case GDK_F2 :S52_setMarinerParam(S52_CMD_WRD_FILTER, S52_CMD_WRD_FILTER_LS); break; case GDK_F3 :S52_setMarinerParam(S52_CMD_WRD_FILTER, S52_CMD_WRD_FILTER_LC); break; case GDK_F4 :S52_setMarinerParam(S52_CMD_WRD_FILTER, S52_CMD_WRD_FILTER_AC); break; case GDK_F5 :S52_setMarinerParam(S52_CMD_WRD_FILTER, S52_CMD_WRD_FILTER_AP); break; case GDK_F6 :S52_setMarinerParam(S52_CMD_WRD_FILTER, S52_CMD_WRD_FILTER_TX); break; case GDK_F7 :_mmInc(S52_MAR_DOTPITCH_MM_X); break; case GDK_F8 :_mmInc(S52_MAR_DOTPITCH_MM_Y); break; case GDK_F9 :_toggle(S52_MAR_DISP_NODATA_LAYER); break; default: g_print("key: 0x%04x\n", event->keyval); } //*/ // redraw _engine.do_S52draw = TRUE; return TRUE; }