#2412 Disable irrelevant toolbar commands

This commit is contained in:
Jacob Støren
2018-01-29 12:23:30 +01:00
parent 6dead054c4
commit f931b92341
2 changed files with 6 additions and 5 deletions

View File

@@ -34,7 +34,7 @@ CAF_CMD_SOURCE_INIT(RicTogglePerspectiveViewFeature, "RicTogglePerspectiveViewFe
bool RicTogglePerspectiveViewFeature::isCommandEnabled() bool RicTogglePerspectiveViewFeature::isCommandEnabled()
{ {
this->action(); // Retrieve the action to update the looks this->action(); // Retrieve the action to update the looks
return RiaApplication::instance()->activeReservoirView() && RiaApplication::instance()->activeReservoirView()->viewer(); return RiaApplication::instance()->activeGridView() && RiaApplication::instance()->activeReservoirView()->viewer();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -42,7 +42,7 @@ bool RicTogglePerspectiveViewFeature::isCommandEnabled()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicTogglePerspectiveViewFeature::onActionTriggered(bool isChecked) void RicTogglePerspectiveViewFeature::onActionTriggered(bool isChecked)
{ {
if(RiaApplication::instance()->activeReservoirView() && RiaApplication::instance()->activeReservoirView()->viewer()) if(RiaApplication::instance()->activeGridView() && RiaApplication::instance()->activeReservoirView()->viewer())
{ {
bool isPerspective = RiaApplication::instance()->activeReservoirView()->isPerspectiveView(); bool isPerspective = RiaApplication::instance()->activeReservoirView()->isPerspectiveView();
RiaApplication::instance()->activeReservoirView()->isPerspectiveView = !isPerspective; RiaApplication::instance()->activeReservoirView()->isPerspectiveView = !isPerspective;

View File

@@ -723,7 +723,7 @@ void RiuMainWindow::slotRefreshEditActions()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuMainWindow::slotRefreshViewActions() void RiuMainWindow::slotRefreshViewActions()
{ {
bool enabled = true; bool enabled = RiaApplication::instance()->activeGridView() != nullptr;
m_viewFromNorth->setEnabled(enabled); m_viewFromNorth->setEnabled(enabled);
m_viewFromSouth->setEnabled(enabled); m_viewFromSouth->setEnabled(enabled);
m_viewFromEast->setEnabled(enabled); m_viewFromEast->setEnabled(enabled);
@@ -1445,6 +1445,7 @@ void RiuMainWindow::refreshDrawStyleActions()
{ {
Rim3dView* view = RiaApplication::instance()->activeReservoirView(); Rim3dView* view = RiaApplication::instance()->activeReservoirView();
bool enable = view != NULL; bool enable = view != NULL;
bool isGridView = RiaApplication::instance()->activeGridView() != nullptr;
m_drawStyleLinesAction->setEnabled(enable); m_drawStyleLinesAction->setEnabled(enable);
m_drawStyleLinesSolidAction->setEnabled(enable); m_drawStyleLinesSolidAction->setEnabled(enable);
@@ -1458,9 +1459,9 @@ void RiuMainWindow::refreshDrawStyleActions()
m_disableLightingAction->setChecked(lightingDisabledInView); m_disableLightingAction->setChecked(lightingDisabledInView);
m_disableLightingAction->blockSignals(false); m_disableLightingAction->blockSignals(false);
if (enable) m_drawStyleHideGridCellsAction->setEnabled(isGridView);
if (isGridView)
{ {
m_drawStyleHideGridCellsAction->setEnabled(true);
m_drawStyleHideGridCellsAction->blockSignals(true); m_drawStyleHideGridCellsAction->blockSignals(true);
m_drawStyleHideGridCellsAction->setChecked(!view->isGridVisualizationMode()); m_drawStyleHideGridCellsAction->setChecked(!view->isGridVisualizationMode());
m_drawStyleHideGridCellsAction->blockSignals(false); m_drawStyleHideGridCellsAction->blockSignals(false);