mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4890 Window tiling
This commit is contained in:
@@ -20,7 +20,11 @@
|
||||
#include "RicTileWindowsFeature.h"
|
||||
|
||||
#include "RiaGuiApplication.h"
|
||||
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuMdiArea.h"
|
||||
#include "RiuPlotMainWindow.h"
|
||||
|
||||
#include <QAction>
|
||||
@@ -28,12 +32,31 @@
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicTileWindowsFeature, "RicTileWindowsFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicTileWindowsFeature::isCommandEnabled()
|
||||
{
|
||||
RiuMainWindow* mainWindow = RiuMainWindow::instance();
|
||||
auto* mainWindow = RiuMainWindow::instance();
|
||||
if ( mainWindow )
|
||||
{
|
||||
return mainWindow->isAnyMdiSubWindowVisible();
|
||||
@@ -49,18 +72,8 @@ void RicTileWindowsFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
this->disableModelChangeContribution();
|
||||
|
||||
RiuMainWindow* mainWindow = RiuMainWindow::instance();
|
||||
if ( mainWindow )
|
||||
{
|
||||
if ( !mainWindow->subWindowsAreTiled() )
|
||||
{
|
||||
mainWindow->tileSubWindows();
|
||||
}
|
||||
else
|
||||
{
|
||||
mainWindow->clearWindowTiling();
|
||||
}
|
||||
}
|
||||
auto* mainWindow = RiuMainWindow::instance();
|
||||
applyTiling( mainWindow, RiaDefines::WindowTileMode::DEFAULT );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -78,11 +91,7 @@ void RicTileWindowsFeature::setupActionLook( QAction* actionToSetup )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicTileWindowsFeature::isCommandChecked()
|
||||
{
|
||||
if ( RiaGuiApplication::instance()->mainWindow() )
|
||||
{
|
||||
return RiaGuiApplication::instance()->mainWindow()->subWindowsAreTiled();
|
||||
}
|
||||
return false;
|
||||
return RimProject::current()->subWindowsTileMode3DWindow() == RiaDefines::WindowTileMode::DEFAULT;
|
||||
}
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicTilePlotWindowsFeature, "RicTilePlotWindowsFeature" );
|
||||
@@ -106,18 +115,10 @@ bool RicTilePlotWindowsFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicTilePlotWindowsFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow();
|
||||
if ( mainPlotWindow )
|
||||
{
|
||||
if ( !mainPlotWindow->subWindowsAreTiled() )
|
||||
{
|
||||
mainPlotWindow->tileSubWindows();
|
||||
}
|
||||
else
|
||||
{
|
||||
mainPlotWindow->clearWindowTiling();
|
||||
}
|
||||
}
|
||||
this->disableModelChangeContribution();
|
||||
|
||||
auto* mainWindow = RiuPlotMainWindow::instance();
|
||||
RicTileWindowsFeature::applyTiling( mainWindow, RiaDefines::WindowTileMode::DEFAULT );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -135,9 +136,187 @@ void RicTilePlotWindowsFeature::setupActionLook( QAction* actionToSetup )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicTilePlotWindowsFeature::isCommandChecked()
|
||||
{
|
||||
if ( RiaGuiApplication::instance()->mainPlotWindow() )
|
||||
return RimProject::current()->subWindowsTileMode3DWindow() == RiaDefines::WindowTileMode::DEFAULT;
|
||||
}
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicTileWindowsVerticallyFeature, "RicTileWindowsVerticallyFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicTileWindowsVerticallyFeature::isCommandEnabled()
|
||||
{
|
||||
RiuMainWindow* mainWindow = RiuMainWindow::instance();
|
||||
if ( mainWindow )
|
||||
{
|
||||
return RiaGuiApplication::instance()->mainPlotWindow()->subWindowsAreTiled();
|
||||
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 )
|
||||
{
|
||||
return mainWindow->isAnyMdiSubWindowVisible();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user