diff --git a/qt/draw_widget.cpp b/qt/draw_widget.cpp index efcb03597d..014fa5156b 100644 --- a/qt/draw_widget.cpp +++ b/qt/draw_widget.cpp @@ -113,6 +113,18 @@ namespace qt UpdateScaleControl(); } + void DrawWidget::ScalePlusLight() + { + m_framework.Scale(1.5); + UpdateScaleControl(); + } + + void DrawWidget::ScaleMinusLight() + { + m_framework.Scale(2.0/3.0); + UpdateScaleControl(); + } + void DrawWidget::ShowAll() { m_framework.ShowAll(); diff --git a/qt/draw_widget.hpp b/qt/draw_widget.hpp index 8d7ada771c..3ce003535a 100644 --- a/qt/draw_widget.hpp +++ b/qt/draw_widget.hpp @@ -44,8 +44,12 @@ namespace qt void MoveRight(); void MoveUp(); void MoveDown(); + void ScalePlus(); void ScaleMinus(); + void ScalePlusLight(); + void ScaleMinusLight(); + void ShowAll(); void Repaint(); void ScaleChanged(int action); diff --git a/qt/mainwindow.cpp b/qt/mainwindow.cpp index 47e4ca3268..fcef224df8 100644 --- a/qt/mainwindow.cpp +++ b/qt/mainwindow.cpp @@ -194,6 +194,12 @@ namespace pBar->addSeparator(); } } + + struct hotkey_t + { + int key; + char const * slot; + }; } void MainWindow::CreateNavigationBar() @@ -202,6 +208,29 @@ void MainWindow::CreateNavigationBar() pBar->setOrientation(Qt::Vertical); pBar->setIconSize(QSize(32, 32)); + { + // add navigation hot keys + hotkey_t arr[] = { + { Qt::Key_Left, SLOT(MoveLeft()) }, + { Qt::Key_Right, SLOT(MoveRight()) }, + { Qt::Key_Up, SLOT(MoveUp()) }, + { Qt::Key_Down, SLOT(MoveDown()) }, + { Qt::Key_Equal, SLOT(ScalePlus()) }, + { Qt::Key_Minus, SLOT(ScaleMinus()) }, + { Qt::ALT + Qt::Key_Equal, SLOT(ScalePlusLight()) }, + { Qt::ALT + Qt::Key_Minus, SLOT(ScaleMinusLight()) }, + { Qt::Key_A, SLOT(ShowAll()) } + }; + + for (size_t i = 0; i < ARRAY_SIZE(arr); ++i) + { + QAction * pAct = new QAction(this); + pAct->setShortcut(QKeySequence(arr[i].key)); + connect(pAct, SIGNAL(triggered()), m_pDrawWidget, arr[i].slot); + addAction(pAct); + } + } + { // add my position button with "checked" behavior m_pMyPosition = pBar->addAction(QIcon(":/navig64/location.png"), diff --git a/qt/mainwindow.hpp b/qt/mainwindow.hpp index 411feebfc1..27091e818d 100644 --- a/qt/mainwindow.hpp +++ b/qt/mainwindow.hpp @@ -16,11 +16,13 @@ namespace qt { QAction * m_pMyPosition; DrawWidget * m_pDrawWidget; + +#ifdef DEBUG // code removed for desktop releases QDockWidget * m_Docks[2]; //FindTableWnd * m_pFindTable; -#ifdef DEBUG // code removed for desktop releases UpdateDialog * m_updateDialog; #endif // DEBUG + storage::Storage m_storage; Q_OBJECT @@ -44,13 +46,14 @@ namespace qt void CreateClassifPanel(); void CreateGuidePanel(); -#endif +#endif // DEBUG void CreateNavigationBar(); //void CreateFindTable(QLayout * pLayout); - #if defined(Q_WS_WIN) + +#if defined(Q_WS_WIN) /// to handle menu messages virtual bool winEvent(MSG * msg, long * result); - #endif +#endif protected Q_SLOTS: //void OnFeatureEntered(int row, int col);