From be4c72d9e9e03a2f70eb55d8aa70ca43d084045f Mon Sep 17 00:00:00 2001 From: Torsten Paul Date: Thu, 31 Oct 2013 22:54:05 +0100 Subject: Add menu entry "Reset View" to reset viewport to initial settings (fixes Issue #434). 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 @@ + + @@ -697,6 +699,11 @@ Show Library Folder... + + + Reset View + + 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; -- cgit v0.10.1