diff --git a/ApplicationLibCode/Application/RiaGuiApplication.cpp b/ApplicationLibCode/Application/RiaGuiApplication.cpp index f858290fec..9377748201 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.cpp +++ b/ApplicationLibCode/Application/RiaGuiApplication.cpp @@ -1625,6 +1625,10 @@ void RiaGuiApplication::runMultiCaseSnapshots( const QString& templateProj { if ( !m_mainWindow ) return; + QByteArray curState = m_mainWindow->dockManager()->saveState( 0 ); + m_mainWindow->dockManager()->restoreState( + RiuDockWidgetTools::defaultDockState( RiuDockWidgetTools::dockStateHideAll3DWindowName() ) ); + const size_t numGridFiles = gridFileNames.size(); for ( size_t i = 0; i < numGridFiles; i++ ) { @@ -1639,6 +1643,7 @@ void RiaGuiApplication::runMultiCaseSnapshots( const QString& templateProj RicSnapshotAllViewsToFileFeature::exportSnapshotOfViewsIntoFolder( snapshotFolderName ); } } + m_mainWindow->dockManager()->restoreState( curState ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp b/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp index 0739248025..c110de405f 100644 --- a/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp +++ b/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp @@ -35,6 +35,7 @@ #include "RimMainPlotCollection.h" #include "RimProject.h" +#include "RiuDockWidgetTools.h" #include "RiuMainWindow.h" #include "RiuMainWindowTools.h" #include "RiuPlotMainWindow.h" @@ -658,6 +659,9 @@ void RiaRegressionTestRunner::executeRegressionTests( const QString& regressionT if ( mainWnd ) { mainWnd->statusBar()->close(); + QByteArray curState = mainWnd->dockManager()->saveState( 0 ); + mainWnd->dockManager()->restoreState( + RiuDockWidgetTools::defaultDockState( RiuDockWidgetTools::dockStateHideAll3DWindowName() ) ); mainWnd->setDefaultWindowSize(); @@ -666,6 +670,7 @@ void RiaRegressionTestRunner::executeRegressionTests( const QString& regressionT m_rootPath = regressionTestPath; m_testFilter = testFilter; runRegressionTest(); + mainWnd->dockManager()->restoreState( curState ); } } diff --git a/ApplicationLibCode/CommandFileInterface/RicfExportSnapshots.cpp b/ApplicationLibCode/CommandFileInterface/RicfExportSnapshots.cpp index 30395974b2..7a41173112 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfExportSnapshots.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfExportSnapshots.cpp @@ -27,6 +27,7 @@ #include "RiaLogging.h" #include "RiaRegressionTestRunner.h" +#include "RiuDockWidgetTools.h" #include "RiuMainWindow.h" #include "cafPdmFieldScriptingCapability.h" @@ -82,6 +83,11 @@ caf::PdmScriptResponse RicfExportSnapshots::execute() RiuMainWindow* mainWnd = RiuMainWindow::instance(); CVF_ASSERT( mainWnd ); + + QByteArray curState = mainWnd->dockManager()->saveState( 0 ); + mainWnd->dockManager()->restoreState( + RiuDockWidgetTools::defaultDockState( RiuDockWidgetTools::dockStateHideAll3DWindowName() ) ); + RiaGuiApplication::instance()->processEvents(); QString absolutePathToSnapshotDir = @@ -135,5 +141,7 @@ caf::PdmScriptResponse RicfExportSnapshots::execute() RiaGuiApplication::instance()->processEvents(); + mainWnd->dockManager()->restoreState( curState ); + return caf::PdmScriptResponse(); } diff --git a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp index cb40ce9f9f..a06689172c 100644 --- a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp +++ b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp @@ -198,6 +198,46 @@ QString RiuDockWidgetTools::messagesName() return "dockMessages"; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiuDockWidgetTools::dockState3DEclipseName() +{ + return "Default (Eclipse data)"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiuDockWidgetTools::dockState3DGeoMechName() +{ + return "Default (GeoMech data)"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiuDockWidgetTools::dockStatePlotWindowName() +{ + return "Default (Plot Window)"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiuDockWidgetTools::dockStateHideAllPlotWindowName() +{ + return "Hide All (Plot Window)"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiuDockWidgetTools::dockStateHideAll3DWindowName() +{ + return "Hide All"; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -232,3 +272,244 @@ void RiuDockWidgetTools::showDockWidget( const ads::CDockManager* dockManager, c dw->raise(); } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QByteArray RiuDockWidgetTools::defaultDockState( const QString& layoutName ) +{ + if ( layoutName == dockState3DEclipseName() ) + return defaultEclipseDockState(); + else if ( layoutName == dockState3DGeoMechName() ) + return defaultGeoMechDockState(); + else if ( layoutName == dockStatePlotWindowName() ) + return defaultPlotDockState(); + else if ( layoutName == dockStateHideAll3DWindowName() ) + return hideAllDocking3DState(); + else if ( layoutName == dockStateHideAllPlotWindowName() ) + return hideAllDockingPlotState(); + + // unknown dock state name found + CAF_ASSERT( false ); + return QByteArray(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QByteArray RiuDockWidgetTools::defaultEclipseDockState() +{ + // In Debug builds: + // Set up the dock widgets the way you want it using the GUI inside ResInsight - then use "Export Layout to + // Clipboard" from the Windows menu and paste the exported text into this file to update the default states. + + static const char stateData[] = + { '\x00', '\x00', '\x05', '\x2e', '\x78', '\xda', '\x95', '\x54', '\x4d', '\x4f', '\x02', '\x31', '\x10', + '\xbd', '\xfb', '\x2b', '\x9a', '\xbd', '\x23', '\xfb', '\x85', '\x42', '\xb2', '\x40', '\x08', '\x48', + '\xe2', '\x01', '\x45', '\x96', '\x8f', '\xa3', '\xa9', '\xbb', '\x23', '\x56', '\xbb', '\x2d', '\x99', + '\x16', '\x50', '\xe3', '\x8f', '\xb7', '\x0b', '\x66', '\x05', '\x2c', '\x8b', '\x9c', '\x76', '\x3b', + '\xef', '\xbd', '\x99', '\x79', '\xd3', '\x49', '\xa3', '\xf6', '\x7b', '\xc6', '\xc9', '\x0a', '\x50', + '\x31', '\x29', '\x9a', '\x8e', '\x77', '\xe9', '\x3a', '\x04', '\x44', '\x22', '\x53', '\x26', '\xe6', + '\x4d', '\x67', '\x32', '\xee', '\x57', '\xea', '\x4e', '\xbb', '\x15', '\x3d', '\xe8', '\x4e', '\xba', + '\xa2', '\x22', '\x81', '\xb4', '\x27', '\x93', '\x37', '\x83', '\xc5', '\x1f', '\x4a', '\x43', '\x46', + '\xa6', '\x85', '\xd0', '\x21', '\x13', '\x05', '\xb8', '\x7b', '\xee', '\x4a', '\xa1', '\x29', '\x13', + '\x26', '\xb2', '\x3d', '\x82', '\xd0', '\x48', '\xf9', '\x8c', '\xa5', '\x73', '\xd0', '\x4d', '\x27', + '\xe8', '\x91', '\x29', '\x83', '\xb5', '\x72', '\x5a', '\x51', '\x41', '\x24', '\x7d', '\x2e', '\xa9', + '\xde', '\x54', '\x76', '\x4d', '\x3c', '\x5e', '\x70', '\xa6', '\xb5', '\x09', '\xdf', '\x23', '\x33', + '\x62', '\x83', '\xe4', '\x99', '\xbf', '\xf2', '\xcc', '\x4b', '\x61', '\x52', '\xf8', '\x47', '\x39', + '\x95', '\x3d', '\x4e', '\x07', '\x81', '\x92', '\x31', '\x7d', '\x32', '\x7d', '\x04', '\x06', '\x58', + '\x22', '\x42', '\x0e', '\x65', '\xa6', '\xe6', '\x8c', '\x89', '\x54', '\xae', '\x1f', '\x53', '\x63', + '\x6a', '\x88', '\xf2', '\x15', '\x12', '\x3d', '\x46', '\x00', '\xa3', '\xd9', '\xb6', '\x49', '\xee', + '\x68', '\x06', '\xa5', '\x4c', '\xd2', '\xe5', '\x52', '\x41', '\x9a', '\x37', '\x5c', '\x2d', '\x57', + '\xf5', '\xa8', '\xa6', '\xb1', '\x5c', '\x62', '\x02', '\x67', '\x0a', '\xe3', '\x04', '\xd9', '\x42', + '\x2b', '\x8b', '\xaa', '\x9a', '\x3b', '\xdb', '\xf3', '\xe7', '\xed', '\xf8', '\xcb', '\xb5', '\x0b', + '\x94', '\x0b', '\x40', '\xfd', '\x71', '\x93', '\x32', '\x2d', '\xf1', '\xd0', '\x97', '\x85', '\x61', + '\x2d', '\x10', '\xb3', '\x4f', '\x50', '\xad', '\xeb', '\x46', '\x8d', '\x84', '\xb5', '\x1a', '\x89', + '\xaa', '\xdb', '\xb3', '\xf9', '\xfe', '\x0c', '\xff', '\xec', '\x6b', '\xd8', '\x6d', '\xb3', '\x58', + '\x04', '\x73', '\xfb', '\x74', '\xbe', '\x01', '\x0f', '\xda', '\xfc', '\x65', '\x58', '\x9b', '\x3b', + '\xb1', '\x25', '\x81', '\x53', '\x3a', '\xa1', '\x11', '\xa8', '\x25', '\xd7', '\xb7', '\xe2', '\x59', + '\xda', '\xa6', '\xb3', '\x83', '\x9e', '\x1a', '\x7d', '\x68', '\x4d', '\x3c', '\xe4', '\x52', '\x1f', + '\x4f', '\xbc', '\x41', '\x4b', '\x36', '\x21', '\x67', '\x0e', '\xe4', '\x0b', '\xaa', '\x2e', '\xc3', + '\x84', '\xc3', '\x3e', '\xdd', '\xb3', '\xd2', '\x47', '\xc0', '\x87', '\x80', '\xd9', '\x7f', '\x32', + '\x0f', '\x57', '\xb6', '\x06', '\xfe', '\x3a', '\xf3', '\x0f', '\x9c', '\x0d', '\x40', '\x29', '\x3a', + '\x07', '\x65', '\xf3', '\x55', '\x60', '\xa7', '\x6a', '\xa3', '\x4c', '\x0c', '\x75', '\x20', '\xc5', + '\xa9', '\xb5', '\x0b', '\x6a', '\x1e', '\xf1', '\x42', '\xd7', '\x27', '\x61', '\xe8', '\xda', '\x77', + '\x6f', '\x13', '\x69', '\xd4', '\x7d', '\xe2', '\x5f', '\xd5', '\x4b', '\x18', '\x41', '\xd8', '\x20', + '\xbe', '\xef', '\xda', '\x17', '\xb8', '\x5a', '\x3c', '\x42', '\xe6', '\xff', '\xc8', '\x6b', '\xd7', + '\xba', '\xf8', '\x06', '\x84', '\x98', '\xbb', '\x1d' }; + + QByteArray retVal( stateData, sizeof( stateData ) ); + + return retVal; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QByteArray RiuDockWidgetTools::defaultGeoMechDockState() +{ + static const char stateData[] = + { '\x00', '\x00', '\x05', '\x2e', '\x78', '\xda', '\x95', '\x54', '\x4d', '\x53', '\xc2', '\x30', '\x10', + '\xbd', '\xfb', '\x2b', '\x32', '\xbd', '\x2b', '\xfd', '\x42', '\x61', '\x06', '\x70', '\x1c', '\x90', + '\x19', '\x0f', '\x28', '\x5a', '\x84', '\xa3', '\x13', '\xdb', '\x15', '\xa3', '\x69', '\xc2', '\x6c', + '\x02', '\xa8', '\xe3', '\x8f', '\x77', '\x0b', '\x4e', '\x05', '\x0c', '\x45', '\x4f', '\x4d', '\xf6', + '\xbd', '\xb7', '\xd9', '\xb7', '\xd9', '\xa6', '\x75', '\xfe', '\x96', '\x4b', '\xb6', '\x00', '\x34', + '\x42', '\xab', '\xb6', '\x17', '\x9c', '\xf8', '\x1e', '\x03', '\x95', '\xea', '\x4c', '\xa8', '\x69', + '\xdb', '\xbb', '\x1f', '\xf5', '\x8f', '\x1b', '\xde', '\x79', '\xa7', '\x75', '\x6b', '\x2f', '\xb2', + '\x05', '\x57', '\x29', '\x64', '\x3d', '\x9d', '\xbe', '\x12', '\x96', '\xbc', '\x1b', '\x0b', '\x39', + '\x1b', '\x97', '\x42', '\x8f', '\xdd', '\x1b', '\xc0', '\xcd', '\x7d', '\x57', '\x2b', '\xcb', '\x85', + '\xa2', '\xc8', '\x7a', '\x0b', '\xca', '\x22', '\x97', '\x13', '\x91', '\x4d', '\xc1', '\xb6', '\xbd', + '\xa8', '\xc7', '\xc6', '\x02', '\x96', '\xc6', '\xeb', '\xb4', '\x4a', '\x22', '\xeb', '\x4b', '\xcd', + '\xed', '\xea', '\x64', '\x9f', '\xe2', '\xc9', '\x4c', '\x0a', '\x6b', '\x29', '\x7c', '\x83', '\x82', + '\xc4', '\x84', '\x14', '\x99', '\x3f', '\x8b', '\xcc', '\x73', '\x45', '\x29', '\xc2', '\xbd', '\x9c', + '\xe3', '\x2d', '\xce', '\x05', '\x02', '\x67', '\x23', '\xfe', '\x48', '\x75', '\x44', '\x04', '\xcc', + '\x11', '\xa1', '\x80', '\x72', '\x3a', '\x73', '\x22', '\x54', '\xa6', '\x97', '\x0f', '\x19', '\x99', + '\x1a', '\xa2', '\x7e', '\x81', '\xd4', '\x8e', '\x10', '\x80', '\x34', '\xeb', '\x32', '\xd9', '\x35', + '\xcf', '\xa1', '\x92', '\xc9', '\xba', '\x52', '\x1b', '\xc8', '\x8a', '\x82', '\x6b', '\xd5', '\xaa', + '\x1e', '\xb7', '\x3c', '\xd1', '\x73', '\x4c', '\xe1', '\x9f', '\xc2', '\x24', '\x45', '\x31', '\xb3', + '\xc6', '\xa1', '\xaa', '\x15', '\xce', '\xb6', '\xfc', '\x05', '\x1b', '\xfe', '\x0a', '\xed', '\x0c', + '\xf5', '\x0c', '\xd0', '\xbe', '\x5f', '\x66', '\xc2', '\x6a', '\xdc', '\xf5', '\xe5', '\x60', '\x38', + '\x0f', '\x48', '\xc4', '\x07', '\x98', '\xce', '\x59', '\xb3', '\xce', '\xe2', '\x7a', '\x9d', '\xb5', + '\x6a', '\xeb', '\x3d', '\x7d', '\xbf', '\x9b', '\xff', '\xef', '\x6b', '\xd8', '\x2c', '\xb3', '\x1c', + '\x04', '\xba', '\x7d', '\x3e', '\x5d', '\x81', '\x3b', '\x65', '\xfe', '\x30', '\x9c', '\xc5', '\x1d', + '\x98', '\x92', '\xc8', '\xab', '\xec', '\xd0', '\x1d', '\x98', '\xb9', '\xb4', '\x57', '\xea', '\x49', + '\xbb', '\xba', '\xb3', '\x81', '\x1e', '\x6a', '\x7d', '\xec', '\x4c', '\x3c', '\x94', '\xda', '\xee', + '\x4f', '\xbc', '\x42', '\x2b', '\x26', '\xa1', '\x60', '\x0e', '\xf4', '\x33', '\x9a', '\xae', '\xc0', + '\x54', '\xc2', '\x5f', '\xe8', '\x77', '\x20', '\x87', '\x80', '\xf9', '\x36', '\x35', '\x70', '\x52', + '\x87', '\x0b', '\xeb', '\xa0', '\xfd', '\x76', '\x16', '\xee', '\x38', '\x1b', '\x80', '\x31', '\x7c', + '\x0a', '\xc6', '\xe5', '\xab', '\xc4', '\x0e', '\x94', '\x49', '\xff', '\x50', '\x4a', '\xd4', '\x81', + '\x56', '\x87', '\xc6', '\x2e', '\xaa', '\x07', '\x2c', '\x88', '\xfd', '\x90', '\xc5', '\xb1', '\xef', + '\x9e', '\xbd', '\x55', '\xa4', '\xd9', '\x08', '\x59', '\x78', '\xda', '\xa8', '\x60', '\x44', '\x71', + '\x93', '\x85', '\xa1', '\xef', '\x1e', '\xe0', '\x5a', '\xf9', '\x08', '\xd1', '\x7a', '\xcf', '\x6b', + '\xd7', '\x39', '\xfa', '\x02', '\x85', '\x8e', '\xbb', '\x1e' }; + + QByteArray retVal( stateData, sizeof( stateData ) ); + + return retVal; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QByteArray RiuDockWidgetTools::defaultPlotDockState() +{ + static const char stateData[] = + { '\x00', '\x00', '\x04', '\x87', '\x78', '\xda', '\xa5', '\x54', '\x4d', '\x6f', '\xc2', '\x30', '\x0c', + '\xbd', '\xef', '\x57', '\x44', '\xbd', '\xb3', '\x7e', '\x20', '\xb1', '\x22', '\x95', '\x22', '\x04', + '\xe3', '\xc6', '\xc6', '\xd4', '\x02', '\xc7', '\x29', '\x6b', '\xac', '\x2a', '\x5a', '\x9b', '\x54', + '\x49', '\xca', '\xc6', '\xb4', '\x1f', '\x3f', '\xb7', '\x9d', '\x2a', '\x40', '\xe5', '\x63', '\xec', + '\xd4', '\xd8', '\x7e', '\xcf', '\x7e', '\x8e', '\xdd', '\x04', '\xe3', '\xcf', '\x3c', '\x23', '\x5b', + '\x50', '\x9a', '\x4b', '\x31', '\xb2', '\xdc', '\x7b', '\xc7', '\x22', '\x20', '\x12', '\xc9', '\xb8', + '\x48', '\x47', '\xd6', '\x2a', '\x9e', '\xf7', '\x7c', '\x6b', '\x1c', '\x06', '\x2f', '\x66', '\xc2', + '\xb6', '\x54', '\x24', '\xc0', '\x66', '\x32', '\x79', '\xc7', '\x58', '\xb4', '\xd3', '\x06', '\x72', + '\xb2', '\x6e', '\x89', '\x16', '\x59', '\x69', '\x50', '\xfb', '\xf6', '\x54', '\x0a', '\x43', '\xb9', + '\x40', '\x4f', '\x63', '\x82', '\x30', '\x8a', '\x66', '\x1b', '\xce', '\x52', '\x30', '\x23', '\x6b', + '\x99', '\x49', '\x43', '\x36', '\x5c', '\x30', '\xf9', '\x61', '\x85', '\x41', '\x8b', '\x25', '\xf3', + '\x4c', '\x52', '\x53', '\x17', '\x77', '\xd0', '\x1f', '\x15', '\x19', '\x37', '\x06', '\xdd', '\xcf', + '\x8a', '\x23', '\x1f', '\x23', '\x55', '\xf2', '\xef', '\x2a', '\x79', '\x29', '\x30', '\x4b', '\xff', + '\x24', '\xa6', '\xd7', '\x62', '\x3c', '\xc4', '\x4c', '\x14', '\x50', '\x12', '\xd3', '\x37', '\x5d', + '\x51', '\xc8', '\xb4', '\x54', '\x0a', '\xaa', '\x50', '\x81', '\x22', '\x16', '\x58', '\xb7', '\xd1', + '\xf1', '\xca', '\xb0', '\xb7', '\x4a', '\x97', '\x8e', '\x15', '\x00', '\xb2', '\x1a', '\xad', '\xe4', + '\x89', '\xe6', '\x70', '\x01', '\x4b', '\xa6', '\x99', '\xd4', '\xc0', '\x2a', '\xd1', '\xf6', '\x65', + '\x5e', '\x0c', '\x79', '\x91', '\x51', '\x03', '\xb7', '\x70', '\xa3', '\x44', '\xf1', '\xa2', '\xb3', + '\xaa', '\x5d', '\x35', '\x79', '\xd0', '\xaa', '\x7b', '\xa1', '\x55', '\x25', '\x0b', '\x50', '\x66', + '\xf7', '\xc8', '\xb8', '\x91', '\xea', '\x9a', '\x7e', '\x0f', '\x09', '\x9d', '\xe5', '\x23', '\xfe', + '\x05', '\x3a', '\xf4', '\x87', '\x0e', '\xe9', '\xfb', '\x0f', '\x24', '\xb0', '\x1b', '\x1b', '\xbf', + '\xbf', '\x53', '\x3a', '\x29', '\x70', '\x7f', '\x21', '\x70', '\x0b', '\x68', '\x5a', '\xc7', '\x8f', + '\x44', '\x1d', '\x80', '\x3a', '\xcb', '\xff', '\x6d', '\x19', '\xbc', '\xf3', '\x37', '\x34', '\xa3', + '\x86', '\x46', '\xb2', '\x54', '\x09', '\x5c', '\xb9', '\x11', '\x47', '\x84', '\x33', '\xa3', '\xad', + '\x67', '\x59', '\xe6', '\x39', '\x55', '\xbb', '\x65', '\x9d', '\x47', '\xd0', '\x14', '\xd4', '\x7f', + '\x47', '\xba', '\x00', '\xad', '\x31', '\x8f', '\xbe', '\x42', '\x6a', '\x0b', '\xbd', '\x71', '\x8c', + '\x8d', '\xc7', '\x1b', '\xb8', '\xc4', '\x73', '\xdc', '\x21', '\xf1', '\x06', '\x7e', '\x27', '\xcc', + '\x6e', '\x7f', '\x6d', '\x3c', '\x9f', '\x78', '\x46', '\xc2', '\xbb', '\x1f', '\x8d', '\x36', '\x8d', + '\x30' }; + + QByteArray retVal( stateData, sizeof( stateData ) ); + + return retVal; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QByteArray RiuDockWidgetTools::hideAllDocking3DState() +{ + static const char stateData[] = + { '\x00', '\x00', '\x05', '\x29', '\x78', '\xda', '\x95', '\x54', '\x4d', '\x53', '\xc2', '\x30', '\x10', + '\xbd', '\xfb', '\x2b', '\x32', '\xbd', '\x23', '\x05', '\xd4', '\xf1', '\xc0', '\xc7', '\x30', '\x20', + '\x33', '\x1e', '\x50', '\xa4', '\x7c', '\x1c', '\x9d', '\xd8', '\xae', '\x18', '\x4d', '\x13', '\x66', + '\x13', '\x40', '\x1c', '\x7f', '\xbc', '\xdb', '\x22', '\xb5', '\xad', '\xd0', '\xc2', '\xa9', '\xcd', + '\xbe', '\xb7', '\x9b', '\xf7', '\x92', '\x37', '\x69', '\x76', '\x3e', '\x43', '\xc9', '\xd6', '\x80', + '\x46', '\x68', '\xd5', '\x72', '\x6a', '\x97', '\xae', '\xc3', '\x40', '\xf9', '\x3a', '\x10', '\x6a', + '\xd1', '\x72', '\xa6', '\x93', '\x41', '\xe5', '\xd6', '\xe9', '\xb4', '\x9b', '\x4f', '\xb6', '\x1b', + '\xac', '\xb9', '\xf2', '\x21', '\xe8', '\x6b', '\xff', '\x83', '\x30', '\x6f', '\x6b', '\x2c', '\x84', + '\x6c', '\x96', '\x34', '\x3a', '\x6c', '\x6a', '\x00', '\xd3', '\xeb', '\x9e', '\x56', '\x96', '\x0b', + '\x45', '\x95', '\xdd', '\x12', '\x94', '\x45', '\x2e', '\xe7', '\x22', '\x58', '\x80', '\x6d', '\x39', + '\x8d', '\x3e', '\x9b', '\x09', '\xd8', '\x18', '\xa7', '\xdd', '\x4c', '\x88', '\x6c', '\x20', '\x35', + '\xb7', '\xf1', '\xce', '\x2e', '\xd5', '\xbd', '\xa5', '\x14', '\xd6', '\x52', '\xf9', '\x11', '\x05', + '\x35', '\x13', '\x12', '\x4d', '\xfe', '\x8e', '\x26', '\xaf', '\x14', '\x8d', '\xa8', '\x1f', '\xe5', + '\x54', '\x32', '\x9c', '\x2e', '\x02', '\x67', '\x13', '\xfe', '\x42', '\x3a', '\x1a', '\x04', '\xac', + '\x10', '\x21', '\x82', '\x42', '\xda', '\x73', '\x2e', '\x54', '\xa0', '\x37', '\xcf', '\x01', '\x99', + '\xf2', '\x7c', '\x14', '\x4b', '\x6b', '\x26', '\x08', '\x40', '\x3d', '\x3b', '\x99', '\xec', '\x81', + '\x87', '\xf0', '\x8f', '\x39', '\x42', '\xfd', '\x0e', '\xbe', '\x8d', '\x99', '\xac', '\x27', '\xb5', + '\x81', '\x20', '\x72', '\x58', '\x2d', '\xee', '\xea', '\x73', '\xcb', '\x3d', '\xbd', '\x42', '\x1f', + '\xce', '\x6c', '\x4c', '\x0b', '\xcb', '\x76', '\x55', '\x23', '\x67', '\x19', '\x7f', '\xb5', '\x94', + '\xbf', '\xa8', '\x77', '\x89', '\x7a', '\x09', '\x68', '\xb7', '\x77', '\x81', '\xb0', '\x1a', '\xf3', + '\xbe', '\x0e', '\x30', '\x0e', '\x6e', '\xe0', '\x89', '\x2f', '\x30', '\x6d', '\x97', '\xd5', '\xea', + '\xd7', '\x37', '\xac', '\x59', '\xdd', '\x2d', '\xe9', '\xfb', '\x7b', '\xf6', '\x67', '\xdf', '\x42', + '\x5a', '\x65', '\x92', '\x03', '\xba', '\x7c', '\xbe', '\x88', '\xc1', '\x9c', '\xca', '\x3f', '\xc6', + '\x5e', '\x9b', '\x9b', '\xd6', '\x56', '\x12', '\x92', '\x86', '\x53', '\x78', '\x40', '\x63', '\x30', + '\x2b', '\x69', '\xef', '\xd5', '\xab', '\x3e', '\x74', '\x38', '\x29', '\xb4', '\xec', '\xe4', '\xaf', + '\x72', '\x83', '\x47', '\x6b', '\x3b', '\x92', '\xda', '\x1e', '\x9f', '\x1a', '\xa3', '\x05', '\x29', + '\x88', '\x98', '\x43', '\xfd', '\x86', '\xa6', '\x27', '\xd0', '\x97', '\x70', '\x0a', '\x7d', '\x0c', + '\x72', '\x04', '\x18', '\x9e', '\x42', '\xdd', '\xcb', '\x2b', '\xb3', '\x55', '\xcf', '\xdb', '\x42', + '\xed', '\x83', '\x31', '\x43', '\xad', '\x8e', '\x05', '\x6a', '\x48', '\x30', '\x5f', '\x80', '\x29', + '\x55', '\x90', '\x9d', '\x54', '\x18', '\x3c', '\x97', '\x51', '\xf2', '\xdc', '\xc3', '\xd1', '\x8b', + '\x2b', '\x71', '\x32', '\x8b', '\x08', '\x05', '\x13', '\xaa', '\xc9', '\xfb', '\x43', '\xff', '\x47', + '\x1e', '\xba', '\xf6', '\xc5', '\x0f', '\xd0', '\x5d', '\xba', '\xc1' }; + + QByteArray retVal( stateData, sizeof( stateData ) ); + + return retVal; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QByteArray RiuDockWidgetTools::hideAllDockingPlotState() +{ + static const char stateData[] = + { '\x00', '\x00', '\x04', '\x78', '\x78', '\xda', '\xa5', '\x54', '\xc1', '\x4e', '\x83', '\x40', '\x10', + '\xbd', '\xfb', '\x15', '\x1b', '\xee', '\x15', '\x4a', '\xa3', '\xe9', '\x81', '\xd2', '\x34', '\xad', + '\xbd', '\x55', '\x6b', '\xa0', '\xf6', '\x68', '\x56', '\x76', '\x42', '\x36', '\x2e', '\xbb', '\x64', + '\x77', '\xa9', '\xd6', '\xf8', '\xf1', '\x0e', '\x60', '\x09', '\x98', '\x62', '\x6b', '\x3d', '\xc1', + '\xcc', '\xbc', '\x37', '\xf3', '\xde', '\xce', '\x42', '\x30', '\x7d', '\xcf', '\x04', '\xd9', '\x81', + '\x36', '\x5c', '\xc9', '\x89', '\x33', '\xbc', '\xf6', '\x1c', '\x02', '\x32', '\x51', '\x8c', '\xcb', + '\x74', '\xe2', '\x6c', '\xe2', '\xe5', '\x60', '\xec', '\x4c', '\xc3', '\xe0', '\xd1', '\xce', '\xd8', + '\x8e', '\xca', '\x04', '\xd8', '\x42', '\x25', '\xaf', '\x58', '\x8b', '\xf6', '\xc6', '\x42', '\x46', + '\x9e', '\x1a', '\xa2', '\x43', '\x36', '\x06', '\x74', '\x3b', '\x9e', '\x2b', '\x69', '\x29', '\x97', + '\x98', '\xa9', '\x43', '\x90', '\x56', '\x53', '\xb1', '\xe5', '\x2c', '\x05', '\x3b', '\x71', '\xd6', + '\x42', '\x59', '\xb2', '\xe5', '\x92', '\xa9', '\x37', '\x27', '\x0c', '\x1a', '\x2c', '\x59', '\x0a', + '\x45', '\x6d', '\x35', '\xdc', '\xc3', '\x7c', '\x94', '\x0b', '\x6e', '\x2d', '\xa6', '\x1f', '\x34', + '\x47', '\x3e', '\x56', '\xca', '\xe6', '\x9f', '\x65', '\xf3', '\x42', '\x62', '\x97', '\x51', '\x2f', + '\x66', '\xd0', '\x60', '\x7c', '\xc4', '\xcc', '\x34', '\x50', '\x12', '\xd3', '\x17', '\x53', '\x52', + '\xc8', '\xbc', '\xd0', '\x1a', '\xca', '\x52', '\x8e', '\x22', '\x56', '\x38', '\xb7', '\xd6', '\xf1', + '\xcc', '\xd0', '\x5b', '\x94', '\x68', '\x9e', '\x5b', '\x13', '\x6b', '\x00', '\xe4', '\xd5', '\x6a', + '\xc9', '\x3d', '\xcd', '\xe0', '\x28', '\xba', '\x74', '\x51', '\x63', '\xc9', '\x5c', '\x28', '\x03', + '\xac', '\xb4', '\xea', '\x9e', '\xe6', '\xc5', '\x90', '\xe5', '\x82', '\x5a', '\xb8', '\x84', '\xdb', + '\x56', '\xd8', '\x65', '\xba', '\xa5', '\xcd', '\x8e', '\xd9', '\xe1', '\xef', '\x66', '\xd7', '\x5a', + '\xe5', '\xa0', '\xed', '\xfe', '\x8e', '\x71', '\xab', '\xf4', '\x39', '\x7e', '\xbb', '\x84', '\xa3', + '\xe3', '\x23', '\xfe', '\x01', '\x26', '\xf4', '\xc8', '\xd0', '\x1f', '\x8f', '\x48', '\xe0', '\xd6', + '\x21', '\x3e', '\xbf', '\xd7', '\xd4', '\xab', '\xaf', '\x7d', '\x23', '\xf0', '\x1a', '\xd0', '\xb4', + '\xaa', '\xff', '\xd0', '\xd4', '\x01', '\x1d', '\xa6', '\x7b', '\xed', '\xe9', '\x7f', '\xbb', '\x0d', + '\x7e', '\x4b', '\x40', '\x75', '\xb8', '\x45', '\x96', '\x51', '\xbd', '\x5f', '\x57', '\xd6', '\x25', + '\x4d', '\xe1', '\x9c', '\x53', '\x59', '\x50', '\x4b', '\x23', '\x55', '\xe8', '\x04', '\x4e', '\xad', + '\xb3', '\x67', '\xc4', '\x3f', '\xd7', '\xb8', '\x02', '\x63', '\xb0', '\x8f', '\x39', '\x43', '\x6a', + '\x03', '\xbd', '\x6c', '\x75', '\x07', '\x80', '\x7f', '\x73', '\xeb', '\x11', '\xef', '\x28', '\xc4', + '\x6d', '\xbe', '\x65', '\x7c', '\xef', '\xf9', '\x6f', '\x84', '\x57', '\x5f', '\x87', '\xd7', '\x88', + '\x5d' }; + + QByteArray retVal( stateData, sizeof( stateData ) ); + + return retVal; +} diff --git a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h index 412f0468b8..765d339678 100644 --- a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h +++ b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h @@ -18,6 +18,7 @@ #pragma once +#include #include #include #include @@ -66,9 +67,24 @@ public: static QString plotMainWindowMessagesName(); static QString plotMainWindowUndoStackName(); + static QString dockState3DEclipseName(); + static QString dockState3DGeoMechName(); + static QString dockStatePlotWindowName(); + static QString dockStateHideAllPlotWindowName(); + static QString dockStateHideAll3DWindowName(); + static QAction* toggleActionForWidget( const ads::CDockManager* dockManager, const QString& dockWidgetName ); static ads::CDockWidget* findDockWidget( const ads::CDockManager* dockManager, const QString& dockWidgetName ); static void showDockWidget( const ads::CDockManager* dockManager, const QString& dockWidgetName ); + + static QByteArray defaultDockState( const QString& layoutName ); + static QByteArray hideAllDocking3DState(); + static QByteArray hideAllDockingPlotState(); + +private: + static QByteArray defaultEclipseDockState(); + static QByteArray defaultGeoMechDockState(); + static QByteArray defaultPlotDockState(); }; diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp index cf3d65e755..8ba196b417 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp @@ -876,7 +876,6 @@ void RiuMainWindow::createDockPanels() if ( bottomArea ) bottomArea->setCurrentIndex( 0 ); auto widgets = dockManager()->dockWidgetsMap().values(); - std::reverse( widgets.begin(), widgets.end() ); for ( ads::CDockWidget* dock : widgets ) { connect( dock->toggleViewAction(), SIGNAL( triggered() ), SLOT( slotDockWidgetToggleViewActionTriggered() ) ); @@ -2081,3 +2080,14 @@ RicGridCalculatorDialog* RiuMainWindow::gridCalculatorDialog( bool createIfNotPr return m_gridCalculatorDialog.get(); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QStringList RiuMainWindow::defaultDockStateNames() +{ + QStringList retList = { RiuDockWidgetTools::dockState3DEclipseName(), + RiuDockWidgetTools::dockState3DGeoMechName(), + RiuDockWidgetTools::dockStateHideAll3DWindowName() }; + return retList; +} diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.h b/ApplicationLibCode/UserInterface/RiuMainWindow.h index 191dab32c8..00828a1098 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.h +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.h @@ -138,7 +138,8 @@ public: RicGridCalculatorDialog* gridCalculatorDialog( bool createIfNotPresent ); protected: - void closeEvent( QCloseEvent* event ) override; + void closeEvent( QCloseEvent* event ) override; + QStringList defaultDockStateNames() override; private: void createActions(); diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp index f2b9767248..163459718a 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp @@ -39,6 +39,7 @@ #include "DockWidget.h" #include +#include #include #include #include @@ -49,6 +50,8 @@ #include #include +#define DOCKSTATE_VERSION 1 + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -137,23 +140,23 @@ void RiuMainWindowBase::loadWinGeoAndDockToolBarLayout() // Company and appname set through QCoreApplication QSettings settings; - QVariant winGeo = settings.value( QString( "%1/winGeometry" ).arg( registryFolderName() ) ); - QVariant layout = settings.value( QString( "%1/toolBarLayout" ).arg( registryFolderName() ) ); - QVariant dockState = settings.value( QString( "%1/dockLayout" ).arg( registryFolderName() ) ); + QVariant winGeo = settings.value( QString( "%1/winGeometry" ).arg( registryFolderName() ) ); + QVariant toolbarLayout = settings.value( QString( "%1/toolBarLayout" ).arg( registryFolderName() ) ); + QVariant dockState = settings.value( QString( "%1/dockLayout" ).arg( registryFolderName() ) ); if ( winGeo.isValid() ) { if ( restoreGeometry( winGeo.toByteArray() ) ) { - if ( layout.isValid() ) + if ( toolbarLayout.isValid() ) { - restoreState( layout.toByteArray(), 0 ); + restoreState( toolbarLayout.toByteArray(), 0 ); } } } if ( dockState.isValid() ) { - m_dockManager->restoreState( dockState.toByteArray(), 1 ); + m_dockManager->restoreState( dockState.toByteArray(), DOCKSTATE_VERSION ); } settings.beginGroup( registryFolderName() ); @@ -186,7 +189,8 @@ void RiuMainWindowBase::saveWinGeoAndDockToolBarLayout() settings.setValue( QString( "%1/isMaximized" ).arg( registryFolderName() ), isMaximized() ); - settings.setValue( QString( "%1/dockLayout" ).arg( registryFolderName() ), m_dockManager->saveState( 1 ) ); + settings.setValue( QString( "%1/dockLayout" ).arg( registryFolderName() ), + m_dockManager->saveState( DOCKSTATE_VERSION ) ); } //-------------------------------------------------------------------------------------------------- @@ -578,6 +582,22 @@ ads::CDockAreaWidget* RiuMainWindowBase::addTabbedWidgets( std::vector( this->sender() ); + if ( action ) + { + QString layoutName = action->text(); + + QByteArray state = RiuDockWidgetTools::defaultDockState( layoutName ); + + dockManager()->restoreState( state, DOCKSTATE_VERSION ); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -617,6 +637,39 @@ void RiuMainWindowBase::deleteDockLayout() } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuMainWindowBase::exportDockLayout() +{ + QClipboard* clipboard = QApplication::clipboard(); + if ( clipboard ) + { + QByteArray state = dockManager()->saveState( DOCKSTATE_VERSION ); + + QString exportStr; + int i = 0; + + exportStr = "static const char stateData[] = {\n"; + + for ( unsigned char c : state ) + { + if ( i > 0 ) + { + if ( i % 25 == 0 ) + exportStr += ",\n"; + else + exportStr += ", "; + } + exportStr += QString( "'\\x%1'" ).arg( c, 2, 16, QChar( '0' ) ); + i++; + } + exportStr += "\n};\n"; + + clipboard->setText( exportStr ); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -650,11 +703,22 @@ void RiuMainWindowBase::addDefaultEntriesToWindowsMenu() QAction* saveLayoutAction = m_windowMenu->addAction( "Save Window Layout..." ); connect( saveLayoutAction, SIGNAL( triggered() ), this, SLOT( saveDockLayout() ) ); - QStringList names = dockManager()->perspectiveNames(); - if ( names.size() > 0 ) + QStringList defaultNames = defaultDockStateNames(); + QStringList names = dockManager()->perspectiveNames(); + + if ( defaultNames.size() + names.size() > 0 ) { QMenu* layoutsMenu = m_windowMenu->addMenu( "Use Window Layout" ); - QMenu* deleteLayoutMenu = m_windowMenu->addMenu( "Delete Window Layout" ); + QMenu* deleteLayoutMenu = nullptr; + if ( names.size() > 0 ) deleteLayoutMenu = m_windowMenu->addMenu( "Delete Window Layout" ); + + for ( auto& defLayout : defaultNames ) + { + QAction* defLayoutAction = layoutsMenu->addAction( defLayout ); + connect( defLayoutAction, SIGNAL( triggered() ), this, SLOT( setDefaultDockLayout() ) ); + } + + if ( defaultNames.size() > 0 ) layoutsMenu->addSeparator(); for ( auto& layout : names ) { @@ -665,6 +729,11 @@ void RiuMainWindowBase::addDefaultEntriesToWindowsMenu() } } +#ifdef _DEBUG + QAction* exportLayoutAction = m_windowMenu->addAction( "Export Layout to Clipboard" ); + connect( exportLayoutAction, SIGNAL( triggered() ), this, SLOT( exportDockLayout() ) ); +#endif + m_windowMenu->addSeparator(); QAction* cascadeWindowsAction = new QAction( "Cascade Windows", this ); connect( cascadeWindowsAction, SIGNAL( triggered() ), m_mdiArea, SLOT( cascadeSubWindows() ) ); diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowBase.h b/ApplicationLibCode/UserInterface/RiuMainWindowBase.h index 5f76b7aaaf..f0797d71ac 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowBase.h +++ b/ApplicationLibCode/UserInterface/RiuMainWindowBase.h @@ -111,6 +111,8 @@ protected: void addDefaultEntriesToWindowsMenu(); + virtual QStringList defaultDockStateNames() = 0; + protected slots: void slotDockWidgetToggleViewActionTriggered(); void slotRefreshHelpActions(); @@ -119,9 +121,11 @@ protected slots: void slotUndo(); void slotRefreshUndoRedoActions(); + void setDefaultDockLayout(); void setDockLayout(); void deleteDockLayout(); void saveDockLayout(); + void exportDockLayout(); protected: bool m_allowActiveViewChangeFromSelection; // To be used in selectedObjectsChanged() to control diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp index 9373757a29..8c4c6049f1 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp @@ -87,7 +87,7 @@ RiuPlotMainWindow::RiuPlotMainWindow() m_mdiArea = new RiuMdiArea( this ); connect( m_mdiArea, SIGNAL( subWindowActivated( QMdiSubWindow* ) ), SLOT( slotSubWindowActivated( QMdiSubWindow* ) ) ); - ads::CDockWidget* widget = new ads::CDockWidget( "Plots", this ); + ads::CDockWidget* widget = new ads::CDockWidget( "Plot Window", this ); widget->setWidget( m_mdiArea ); auto dockArea = dockManager()->setCentralWidget( widget ); dockArea->setVisible( true ); @@ -596,8 +596,6 @@ void RiuPlotMainWindow::createDockPanels() if ( bottomArea ) bottomArea->setCurrentIndex( 0 ); auto widgets = dockManager()->dockWidgetsMap().values(); - std::reverse( widgets.begin(), widgets.end() ); - for ( ads::CDockWidget* dock : widgets ) { connect( dock->toggleViewAction(), SIGNAL( triggered() ), SLOT( slotDockWidgetToggleViewActionTriggered() ) ); @@ -1149,3 +1147,13 @@ void RiuPlotMainWindow::dropEvent( QDropEvent* event ) RicSummaryPlotBuilder::createAndAppendSummaryMultiPlot( objects ); } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QStringList RiuPlotMainWindow::defaultDockStateNames() +{ + QStringList retList = { RiuDockWidgetTools::dockStatePlotWindowName(), + RiuDockWidgetTools::dockStateHideAllPlotWindowName() }; + return retList; +} diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h index fd19fd3e3f..d5bc2509cb 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h @@ -102,6 +102,8 @@ protected: void dragEnterEvent( QDragEnterEvent* event ) override; void dropEvent( QDropEvent* event ) override; + QStringList defaultDockStateNames() override; + private: void setPdmRoot( caf::PdmObject* pdmRoot );