Revert "Disable Zoom All if there's no active view."

This reverts commit 80fe9f9fd5.
This commit is contained in:
Gaute Lindkvist
2020-10-07 09:17:54 +02:00
parent 56ecd2c19a
commit 6a7c34cea2

View File

@@ -32,32 +32,12 @@
CAF_CMD_SOURCE_INIT( RicViewZoomAllFeature, "RicViewZoomAllFeature" );
RimViewWindow* activeViewWindow()
{
QWidget* topLevelWidget = RiaGuiApplication::activeWindow();
if ( dynamic_cast<RiuMainWindow*>( topLevelWidget ) )
{
return RiaGuiApplication::instance()->activeReservoirView();
}
else if ( dynamic_cast<RiuPlotMainWindow*>( topLevelWidget ) )
{
RiuPlotMainWindow* mainPlotWindow = dynamic_cast<RiuPlotMainWindow*>( topLevelWidget );
QList<QMdiSubWindow*> subwindows = mainPlotWindow->subWindowList( QMdiArea::StackingOrder );
if ( !subwindows.empty() )
{
return RiuInterfaceToViewWindow::viewWindowFromWidget( subwindows.back()->widget() );
}
}
return nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicViewZoomAllFeature::isCommandEnabled()
{
return activeViewWindow() != nullptr;
return true;
}
//--------------------------------------------------------------------------------------------------
@@ -67,10 +47,29 @@ void RicViewZoomAllFeature::onActionTriggered( bool isChecked )
{
this->disableModelChangeContribution();
RimViewWindow* viewWindow = activeViewWindow();
if ( viewWindow )
QWidget* topLevelWidget = RiaGuiApplication::activeWindow();
if ( dynamic_cast<RiuMainWindow*>( topLevelWidget ) )
{
viewWindow->zoomAll();
RimViewWindow* viewWindow = RiaGuiApplication::instance()->activeReservoirView();
if ( viewWindow )
{
viewWindow->zoomAll();
}
}
else if ( dynamic_cast<RiuPlotMainWindow*>( topLevelWidget ) )
{
RiuPlotMainWindow* mainPlotWindow = dynamic_cast<RiuPlotMainWindow*>( topLevelWidget );
QList<QMdiSubWindow*> subwindows = mainPlotWindow->subWindowList( QMdiArea::StackingOrder );
if ( !subwindows.empty() )
{
RimViewWindow* viewWindow = RiuInterfaceToViewWindow::viewWindowFromWidget( subwindows.back()->widget() );
if ( viewWindow )
{
viewWindow->zoomAll();
}
}
}
}