diff options
author | Torsten Paul <Torsten.Paul@gmx.de> | 2013-10-31 21:54:05 (GMT) |
---|---|---|
committer | Torsten Paul <Torsten.Paul@gmx.de> | 2013-10-31 21:56:31 (GMT) |
commit | be4c72d9e9e03a2f70eb55d8aa70ca43d084045f (patch) | |
tree | 69be070a0e2893150a82872966e8eb6a4f7543b1 | |
parent | 170d4a54970f34d4790b0b3ae3a3d4f2f7502660 (diff) |
Add menu entry "Reset View" to reset viewport to initial settings (fixes Issue #434).
-rw-r--r-- | src/MainWindow.h | 1 | ||||
-rw-r--r-- | src/MainWindow.ui | 7 | ||||
-rw-r--r-- | src/QGLView.cc | 11 | ||||
-rw-r--r-- | src/QGLView.h | 1 | ||||
-rw-r--r-- | src/mainwin.cc | 7 |
5 files changed, 24 insertions, 3 deletions
diff --git a/src/MainWindow.h b/src/MainWindow.h index 4f88fbf..ac999bf 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -164,6 +164,7 @@ public slots: void viewCenter(); void viewPerspective(); void viewOrthogonal(); + void viewResetView(); void hideConsole(); void animateUpdateDocChanged(); void animateUpdate(); diff --git a/src/MainWindow.ui b/src/MainWindow.ui index 68bc064..4cb043f 100644 --- a/src/MainWindow.ui +++ b/src/MainWindow.ui @@ -213,6 +213,8 @@ <addaction name="viewActionDiagonal"/> <addaction name="viewActionCenter"/> <addaction name="separator"/> + <addaction name="viewActionResetView"/> + <addaction name="separator"/> <addaction name="viewActionPerspective"/> <addaction name="viewActionOrthogonal"/> <addaction name="separator"/> @@ -697,6 +699,11 @@ <string>Show Library Folder...</string> </property> </action> + <action name="viewActionResetView"> + <property name="text"> + <string>Reset View</string> + </property> + </action> </widget> <customwidgets> <customwidget> diff --git a/src/QGLView.cc b/src/QGLView.cc index 8aaeaf2..25ed323 100644 --- a/src/QGLView.cc +++ b/src/QGLView.cc @@ -64,9 +64,7 @@ static bool running_under_wine = false; void QGLView::init() { cam.type = Camera::GIMBAL; - cam.object_rot << 35, 0, -25; - cam.object_trans << 0, 0, 0; - cam.viewer_distance = 500; + resetView(); this->mouse_drag_active = false; this->statusLabel = NULL; @@ -83,6 +81,13 @@ void QGLView::init() #endif } +void QGLView::resetView() +{ + cam.object_rot << 35, 0, -25; + cam.object_trans << 0, 0, 0; + cam.viewer_distance = 500; +} + void QGLView::initializeGL() { GLenum err = glewInit(); diff --git a/src/QGLView.h b/src/QGLView.h index f3e3681..12be085 100644 --- a/src/QGLView.h +++ b/src/QGLView.h @@ -41,6 +41,7 @@ public: } std::string getRendererInfo() const; bool save(const char *filename); + void resetView(); public: QLabel *statusLabel; diff --git a/src/mainwin.cc b/src/mainwin.cc index 65c511f..5b986b1 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -334,6 +334,7 @@ MainWindow::MainWindow(const QString &filename) connect(this->viewActionBack, SIGNAL(triggered()), this, SLOT(viewAngleBack())); connect(this->viewActionDiagonal, SIGNAL(triggered()), this, SLOT(viewAngleDiagonal())); connect(this->viewActionCenter, SIGNAL(triggered()), this, SLOT(viewCenter())); + connect(this->viewActionResetView, SIGNAL(triggered()), this, SLOT(viewResetView())); connect(this->viewActionPerspective, SIGNAL(triggered()), this, SLOT(viewPerspective())); connect(this->viewActionOrthogonal, SIGNAL(triggered()), this, SLOT(viewOrthogonal())); connect(this->viewActionHide, SIGNAL(triggered()), this, SLOT(hideConsole())); @@ -1772,6 +1773,12 @@ void MainWindow::viewOrthogonal() this->qglview->updateGL(); } +void MainWindow::viewResetView() +{ + this->qglview->resetView(); + this->qglview->updateGL(); +} + void MainWindow::hideConsole() { QSettings settings; |