Files
ResInsight/ApplicationLibCode/Commands/SummaryPlotCommands/RicViewZoomAllFeature.cpp
T

68 lines
2.4 KiB
C++
Raw Normal View History

2016-07-05 10:47:03 +02:00
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- Statoil ASA
2018-05-14 09:52:27 +02:00
//
2016-07-05 10:47:03 +02:00
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
2018-05-14 09:52:27 +02:00
//
2016-07-05 10:47:03 +02:00
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
2018-05-14 09:52:27 +02:00
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
2016-07-05 10:47:03 +02:00
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicViewZoomAllFeature.h"
2019-05-06 10:36:05 +02:00
#include "RiaGuiApplication.h"
2016-07-05 10:47:03 +02:00
2018-01-09 10:11:28 +01:00
#include "Rim3dView.h"
2016-07-05 10:47:03 +02:00
#include "RimViewWindow.h"
2018-05-14 09:52:27 +02:00
#include "RiuInterfaceToViewWindow.h"
2016-07-05 10:47:03 +02:00
#include "RiuMainWindow.h"
2018-05-14 09:52:27 +02:00
#include "RiuPlotMainWindow.h"
2016-07-05 10:47:03 +02:00
#include <QAction>
CAF_CMD_SOURCE_INIT( RicViewZoomAllFeature, "RicViewZoomAllFeature" );
2016-07-05 10:47:03 +02:00
//--------------------------------------------------------------------------------------------------
2018-05-14 09:52:27 +02:00
///
2016-07-05 10:47:03 +02:00
//--------------------------------------------------------------------------------------------------
void RicViewZoomAllFeature::onActionTriggered( bool isChecked )
2016-07-05 10:47:03 +02:00
{
disableModelChangeContribution();
2017-04-20 12:21:41 +02:00
QWidget* topLevelWidget = RiaGuiApplication::activeWindow();
if ( dynamic_cast<RiuMainWindow*>( topLevelWidget ) )
2016-07-05 10:47:03 +02:00
{
2026-05-26 16:03:49 +02:00
if ( auto viewWindow = RiaGuiApplication::instance()->activeReservoirView() )
{
viewWindow->zoomAll();
}
}
2026-05-26 16:03:49 +02:00
else if ( auto plotMainWin = dynamic_cast<RiuPlotMainWindow*>( topLevelWidget ) )
{
2026-06-16 17:29:48 +02:00
if ( auto activePlotView = plotMainWin->activeViewer() )
2026-05-26 16:03:49 +02:00
{
activePlotView->zoomAllAndReleaseUserDefinedRanges();
2026-05-26 16:03:49 +02:00
}
2016-07-05 10:47:03 +02:00
}
}
//--------------------------------------------------------------------------------------------------
2018-05-14 09:52:27 +02:00
///
2016-07-05 10:47:03 +02:00
//--------------------------------------------------------------------------------------------------
void RicViewZoomAllFeature::setupActionLook( QAction* actionToSetup )
2016-07-05 10:47:03 +02:00
{
actionToSetup->setText( "Zoom All" );
actionToSetup->setToolTip( "Zoom All (Ctrl+Alt+A)" );
2020-10-01 17:25:19 +02:00
actionToSetup->setIcon( QIcon( ":/ZoomAll.svg" ) );
applyShortcutWithHintToAction( actionToSetup, QKeySequence( tr( "Ctrl+Alt+A" ) ) );
2016-07-05 10:47:03 +02:00
}