2015-09-16 08:46:01 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2015- Statoil ASA
|
|
|
|
// Copyright (C) 2015- Ceetron Solutions AS
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2015-09-16 08:46:01 -05: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.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2015-09-16 08:46:01 -05: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.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2015-09-16 08:46:01 -05:00
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "RicTileWindowsFeature.h"
|
|
|
|
|
2019-05-06 03:36:05 -05:00
|
|
|
#include "RiaGuiApplication.h"
|
2022-10-31 07:26:26 -05:00
|
|
|
|
|
|
|
#include "RimProject.h"
|
|
|
|
|
2015-09-16 08:46:01 -05:00
|
|
|
#include "RiuMainWindow.h"
|
2022-10-31 07:26:26 -05:00
|
|
|
#include "RiuMdiArea.h"
|
2018-04-26 23:28:08 -05:00
|
|
|
#include "RiuPlotMainWindow.h"
|
2015-09-16 08:46:01 -05:00
|
|
|
|
|
|
|
#include <QAction>
|
2016-10-06 00:55:02 -05:00
|
|
|
#include <QApplication>
|
2015-09-16 08:46:01 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_CMD_SOURCE_INIT( RicTileWindowsFeature, "RicTileWindowsFeature" );
|
2015-09-16 08:46:01 -05:00
|
|
|
|
2022-10-31 07:26:26 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RicTileWindowsFeature::applyTiling( RiuMainWindowBase* mainWindow, RiaDefines::WindowTileMode requestedTileMode )
|
|
|
|
{
|
|
|
|
auto mode = requestedTileMode;
|
|
|
|
|
|
|
|
// If requested mode is set, reset tiling mode to undefined
|
|
|
|
if ( RimProject::current()->subWindowsTileMode3DWindow() == requestedTileMode )
|
|
|
|
mode = RiaDefines::WindowTileMode::UNDEFINED;
|
|
|
|
|
|
|
|
RimProject::current()->setSubWindowsTileMode3DWindow( mode );
|
|
|
|
|
|
|
|
if ( mainWindow )
|
|
|
|
{
|
|
|
|
mainWindow->mdiArea()->applyTiling();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-09-16 08:46:01 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2015-09-16 08:46:01 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RicTileWindowsFeature::isCommandEnabled()
|
|
|
|
{
|
2022-10-31 07:26:26 -05:00
|
|
|
auto* mainWindow = RiuMainWindow::instance();
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( mainWindow )
|
2016-10-06 00:55:02 -05:00
|
|
|
{
|
|
|
|
return mainWindow->isAnyMdiSubWindowVisible();
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
2015-09-16 08:46:01 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2015-09-16 08:46:01 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RicTileWindowsFeature::onActionTriggered( bool isChecked )
|
2015-09-16 08:46:01 -05:00
|
|
|
{
|
2017-04-20 03:38:58 -05:00
|
|
|
this->disableModelChangeContribution();
|
|
|
|
|
2022-10-31 07:26:26 -05:00
|
|
|
auto* mainWindow = RiuMainWindow::instance();
|
|
|
|
applyTiling( mainWindow, RiaDefines::WindowTileMode::DEFAULT );
|
2016-11-03 03:59:41 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2016-11-03 03:59:41 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RicTileWindowsFeature::setupActionLook( QAction* actionToSetup )
|
2016-11-03 03:59:41 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
actionToSetup->setText( "Tile Windows" );
|
2020-10-01 10:25:19 -05:00
|
|
|
actionToSetup->setIcon( QIcon( ":/TileWindows.svg" ) );
|
2019-09-06 03:40:57 -05:00
|
|
|
actionToSetup->setCheckable( true );
|
2016-11-03 03:59:41 -05:00
|
|
|
}
|
|
|
|
|
2019-04-02 12:18:00 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RicTileWindowsFeature::isCommandChecked()
|
|
|
|
{
|
2022-10-31 07:26:26 -05:00
|
|
|
return RimProject::current()->subWindowsTileMode3DWindow() == RiaDefines::WindowTileMode::DEFAULT;
|
2019-04-02 12:18:00 -05:00
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_CMD_SOURCE_INIT( RicTilePlotWindowsFeature, "RicTilePlotWindowsFeature" );
|
2016-11-03 03:59:41 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2016-11-03 03:59:41 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RicTilePlotWindowsFeature::isCommandEnabled()
|
|
|
|
{
|
2019-05-06 03:36:05 -05:00
|
|
|
RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow();
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( mainPlotWindow )
|
2016-11-03 03:59:41 -05:00
|
|
|
{
|
|
|
|
return mainPlotWindow->isAnyMdiSubWindowVisible();
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2016-11-03 03:59:41 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RicTilePlotWindowsFeature::onActionTriggered( bool isChecked )
|
2016-11-03 03:59:41 -05:00
|
|
|
{
|
2022-10-31 07:26:26 -05:00
|
|
|
this->disableModelChangeContribution();
|
|
|
|
|
|
|
|
auto* mainWindow = RiuPlotMainWindow::instance();
|
|
|
|
RicTileWindowsFeature::applyTiling( mainWindow, RiaDefines::WindowTileMode::DEFAULT );
|
2015-09-16 08:46:01 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2015-09-16 08:46:01 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RicTilePlotWindowsFeature::setupActionLook( QAction* actionToSetup )
|
2015-09-16 08:46:01 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
actionToSetup->setText( "Tile Windows" );
|
2020-10-01 10:25:19 -05:00
|
|
|
actionToSetup->setIcon( QIcon( ":/TileWindows.svg" ) );
|
2019-09-06 03:40:57 -05:00
|
|
|
actionToSetup->setCheckable( true );
|
2019-04-02 12:18:00 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RicTilePlotWindowsFeature::isCommandChecked()
|
|
|
|
{
|
2022-10-31 07:26:26 -05:00
|
|
|
return RimProject::current()->subWindowsTileMode3DWindow() == RiaDefines::WindowTileMode::DEFAULT;
|
|
|
|
}
|
|
|
|
|
|
|
|
CAF_CMD_SOURCE_INIT( RicTileWindowsVerticallyFeature, "RicTileWindowsVerticallyFeature" );
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RicTileWindowsVerticallyFeature::isCommandEnabled()
|
|
|
|
{
|
|
|
|
RiuMainWindow* mainWindow = RiuMainWindow::instance();
|
|
|
|
if ( mainWindow )
|
|
|
|
{
|
|
|
|
return mainWindow->isAnyMdiSubWindowVisible();
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RicTileWindowsVerticallyFeature::onActionTriggered( bool isChecked )
|
|
|
|
{
|
|
|
|
this->disableModelChangeContribution();
|
|
|
|
|
|
|
|
auto* mainWindow = RiuMainWindow::instance();
|
|
|
|
RicTileWindowsFeature::applyTiling( mainWindow, RiaDefines::WindowTileMode::VERTICAL );
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RicTileWindowsVerticallyFeature::setupActionLook( QAction* actionToSetup )
|
|
|
|
{
|
|
|
|
actionToSetup->setText( "Tile Windows Vertically" );
|
|
|
|
actionToSetup->setIcon( QIcon( ":/TileWindows.svg" ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RicTileWindowsVerticallyFeature::isCommandChecked()
|
|
|
|
{
|
|
|
|
return RimProject::current()->subWindowsTileMode3DWindow() == RiaDefines::WindowTileMode::VERTICAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
CAF_CMD_SOURCE_INIT( RicTileWindowsHorizontallyFeature, "RicTileWindowsHorizontallyFeature" );
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RicTileWindowsHorizontallyFeature::isCommandEnabled()
|
|
|
|
{
|
|
|
|
RiuMainWindow* mainWindow = RiuMainWindow::instance();
|
|
|
|
if ( mainWindow )
|
|
|
|
{
|
|
|
|
return mainWindow->isAnyMdiSubWindowVisible();
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RicTileWindowsHorizontallyFeature::onActionTriggered( bool isChecked )
|
|
|
|
{
|
|
|
|
this->disableModelChangeContribution();
|
|
|
|
|
|
|
|
auto* mainWindow = RiuMainWindow::instance();
|
|
|
|
RicTileWindowsFeature::applyTiling( mainWindow, RiaDefines::WindowTileMode::HORIZONTAL );
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RicTileWindowsHorizontallyFeature::setupActionLook( QAction* actionToSetup )
|
|
|
|
{
|
|
|
|
actionToSetup->setText( "Tile Windows Horizontally" );
|
|
|
|
actionToSetup->setIcon( QIcon( ":/TileWindows.svg" ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RicTileWindowsHorizontallyFeature::isCommandChecked()
|
|
|
|
{
|
|
|
|
return RimProject::current()->subWindowsTileMode3DWindow() == RiaDefines::WindowTileMode::DEFAULT;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
/// Main Plot window features
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
CAF_CMD_SOURCE_INIT( RicTilePlotWindowsVerticallyFeature, "RicTilePlotWindowsVerticallyFeature" );
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RicTilePlotWindowsVerticallyFeature::isCommandEnabled()
|
|
|
|
{
|
|
|
|
auto* mainWindow = RiuPlotMainWindow::instance();
|
|
|
|
if ( mainWindow )
|
|
|
|
{
|
|
|
|
return mainWindow->isAnyMdiSubWindowVisible();
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RicTilePlotWindowsVerticallyFeature::onActionTriggered( bool isChecked )
|
|
|
|
{
|
|
|
|
this->disableModelChangeContribution();
|
|
|
|
|
|
|
|
auto* mainWindow = RiuPlotMainWindow::instance();
|
|
|
|
RicTileWindowsFeature::applyTiling( mainWindow, RiaDefines::WindowTileMode::VERTICAL );
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RicTilePlotWindowsVerticallyFeature::setupActionLook( QAction* actionToSetup )
|
|
|
|
{
|
|
|
|
actionToSetup->setText( "Tile Windows Vertically" );
|
|
|
|
actionToSetup->setIcon( QIcon( ":/TileWindows.svg" ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RicTilePlotWindowsVerticallyFeature::isCommandChecked()
|
|
|
|
{
|
|
|
|
return RimProject::current()->subWindowsTileModePlotWindow() == RiaDefines::WindowTileMode::VERTICAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
CAF_CMD_SOURCE_INIT( RicTilePlotWindowsHorizontallyFeature, "RicTilePlotWindowsHorizontallyFeature" );
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RicTilePlotWindowsHorizontallyFeature::isCommandEnabled()
|
|
|
|
{
|
|
|
|
auto* mainWindow = RiuPlotMainWindow::instance();
|
|
|
|
if ( mainWindow )
|
2019-04-02 12:18:00 -05:00
|
|
|
{
|
2022-10-31 07:26:26 -05:00
|
|
|
return mainWindow->isAnyMdiSubWindowVisible();
|
2019-04-02 12:18:00 -05:00
|
|
|
}
|
2022-10-31 07:26:26 -05:00
|
|
|
|
2019-04-02 12:18:00 -05:00
|
|
|
return false;
|
2015-09-16 08:46:01 -05:00
|
|
|
}
|
2022-10-31 07:26:26 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RicTilePlotWindowsHorizontallyFeature::onActionTriggered( bool isChecked )
|
|
|
|
{
|
|
|
|
this->disableModelChangeContribution();
|
|
|
|
|
|
|
|
auto* mainWindow = RiuPlotMainWindow::instance();
|
|
|
|
RicTileWindowsFeature::applyTiling( mainWindow, RiaDefines::WindowTileMode::HORIZONTAL );
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RicTilePlotWindowsHorizontallyFeature::setupActionLook( QAction* actionToSetup )
|
|
|
|
{
|
|
|
|
actionToSetup->setText( "Tile Windows Horizontally" );
|
|
|
|
actionToSetup->setIcon( QIcon( ":/TileWindows.svg" ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RicTilePlotWindowsHorizontallyFeature::isCommandChecked()
|
|
|
|
{
|
|
|
|
return RimProject::current()->subWindowsTileModePlotWindow() == RiaDefines::WindowTileMode::DEFAULT;
|
|
|
|
}
|