diff --git a/ApplicationCode/ProjectDataModel/RimReservoirView.cpp b/ApplicationCode/ProjectDataModel/RimReservoirView.cpp index c7ecc4c863..d7becb9891 100644 --- a/ApplicationCode/ProjectDataModel/RimReservoirView.cpp +++ b/ApplicationCode/ProjectDataModel/RimReservoirView.cpp @@ -344,6 +344,8 @@ void RimReservoirView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, createDisplayModelAndRedraw(); m_viewer->update(); } + + RiuMainWindow::instance()->updateScaleValue(); } else if (changedField == &maximumFrameRate) { diff --git a/ApplicationCode/UserInterface/RiuMainWindow.cpp b/ApplicationCode/UserInterface/RiuMainWindow.cpp index 83a51fd03a..2b1128799b 100644 --- a/ApplicationCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationCode/UserInterface/RiuMainWindow.cpp @@ -115,6 +115,7 @@ void RiuMainWindow::initializeGuiNewProjectLoaded() { slotRefreshFileActions(); slotRefreshEditActions(); + slotRefreshViewActions(); refreshAnimationActions(); refreshDrawStyleActions(); setPdmRoot(RiaApplication::instance()->project()); @@ -376,6 +377,14 @@ void RiuMainWindow::createToolBars() m_viewToolBar->addAction(m_drawStyleSurfOnlyAction); m_viewToolBar->addAction(m_drawStyleToggleFaultsAction); + QLabel* scaleLabel = new QLabel(m_viewToolBar); + scaleLabel->setText("Scale"); + m_viewToolBar->addWidget(scaleLabel); + + m_scaleFactor = new QSpinBox(m_viewToolBar); + m_scaleFactor->setValue(0); + m_viewToolBar->addWidget(m_scaleFactor); + connect(m_scaleFactor, SIGNAL(valueChanged(int)), SLOT(slotScaleChanged(int))); // Create animation toolbar m_animationToolBar = new caf::AnimationToolBar("Animation", this); @@ -536,9 +545,6 @@ void RiuMainWindow::slotRefreshEditActions() //-------------------------------------------------------------------------------------------------- void RiuMainWindow::slotRefreshViewActions() { -// RiaApplication* app = RiaApplication::instance(); -// RISceneManager* proj = app->project(); - bool enabled = true; m_viewFromNorth->setEnabled(enabled); m_viewFromSouth->setEnabled(enabled); @@ -546,6 +552,8 @@ void RiuMainWindow::slotRefreshViewActions() m_viewFromWest->setEnabled(enabled); m_viewFromAbove->setEnabled(enabled); m_viewFromBelow->setEnabled(enabled); + + updateScaleValue(); } //-------------------------------------------------------------------------------------------------- @@ -1078,6 +1086,7 @@ void RiuMainWindow::slotSubWindowActivated(QMdiSubWindow* subWindow) } } + slotRefreshViewActions(); refreshAnimationActions(); refreshDrawStyleActions(); break; @@ -1457,3 +1466,34 @@ void RiuMainWindow::setCurrentObjectInTreeView(caf::PdmObject* object) } } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuMainWindow::slotScaleChanged(int scaleValue) +{ + if (RiaApplication::instance()->activeReservoirView()) + { + RiaApplication::instance()->activeReservoirView()->scaleZ.setValueFromUi(scaleValue); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuMainWindow::updateScaleValue() +{ + if (RiaApplication::instance()->activeReservoirView()) + { + m_scaleFactor->setEnabled(true); + + int scaleValue = RiaApplication::instance()->activeReservoirView()->scaleZ(); + m_scaleFactor->blockSignals(true); + m_scaleFactor->setValue(scaleValue); + m_scaleFactor->blockSignals(false); + } + else + { + m_scaleFactor->setEnabled(false); + } +} diff --git a/ApplicationCode/UserInterface/RiuMainWindow.h b/ApplicationCode/UserInterface/RiuMainWindow.h index 702699cce1..70c0c1f41a 100644 --- a/ApplicationCode/UserInterface/RiuMainWindow.h +++ b/ApplicationCode/UserInterface/RiuMainWindow.h @@ -32,6 +32,7 @@ class QLabel; class QLineEdit; class QItemSelection; class QActionGroup; +class QSpinBox; class RiuViewer; class RiuResultInfoPanel; @@ -72,6 +73,7 @@ public: void setResultInfo(const QString& info) const; void refreshAnimationActions(); + void updateScaleValue(); RimUiTreeModelPdm* uiPdmModel() { return m_treeModelPdm;} @@ -191,6 +193,7 @@ private slots: void slotViewFromAbove(); void slotViewFromBelow(); void slotZoomAll(); + void slotScaleChanged(int scaleValue); void slotDrawStyleChanged(QAction* activatedAction); void slotToggleFaultsAction(bool); @@ -233,6 +236,8 @@ private: caf::PdmObject* m_pdmRoot; caf::PdmUiPropertyView* m_pdmUiPropertyView; + QSpinBox* m_scaleFactor; + QActionGroup* m_dsActionGroup; QAction* m_drawStyleToggleFaultsAction; QAction* m_drawStyleLinesAction;