diff --git a/ApplicationCode/Application/RiaApplication.cpp b/ApplicationCode/Application/RiaApplication.cpp index 59e86b3012..2a3b1a62d6 100644 --- a/ApplicationCode/Application/RiaApplication.cpp +++ b/ApplicationCode/Application/RiaApplication.cpp @@ -203,6 +203,8 @@ RiaApplication::RiaApplication(int& argc, char** argv) //-------------------------------------------------------------------------------------------------- RiaApplication::~RiaApplication() { + deleteMainPlotWindow(); + delete m_preferences; } @@ -692,11 +694,8 @@ bool RiaApplication::closeProject(bool askToSaveIfDirty) if (m_mainPlotWindow) { m_mainPlotWindow->cleanupGuiBeforeProjectClose(); - - deleteMainPlotWindow(); } - caf::EffectGenerator::clearEffectCache(); m_project->close(); @@ -1329,7 +1328,10 @@ RiuMainPlotWindow* RiaApplication::getOrCreateAndShowMainPlotWindow() createMainPlotWindow(); } - m_mainPlotWindow->showWindow(); + if (!m_mainPlotWindow->isVisible()) + { + m_mainPlotWindow->show(); + } return m_mainPlotWindow; } diff --git a/ApplicationCode/Commands/CMakeLists_files.cmake b/ApplicationCode/Commands/CMakeLists_files.cmake index 77d5ba9ab0..92797fa730 100644 --- a/ApplicationCode/Commands/CMakeLists_files.cmake +++ b/ApplicationCode/Commands/CMakeLists_files.cmake @@ -42,6 +42,7 @@ ${CEE_CURRENT_LIST_DIR}RicComputeStatisticsFeature.h ${CEE_CURRENT_LIST_DIR}RicWellLogsImportFileFeature.h ${CEE_CURRENT_LIST_DIR}RicTileWindowsFeature.h +${CEE_CURRENT_LIST_DIR}RicShowPlotWindowFeature.h ${CEE_CURRENT_LIST_DIR}RicLaunchUnitTestsFeature.h ${CEE_CURRENT_LIST_DIR}RicExportToLasFileFeature.h ${CEE_CURRENT_LIST_DIR}RicImportInputEclipseCaseOpmFeature.h @@ -89,6 +90,7 @@ ${CEE_CURRENT_LIST_DIR}RicNewStatisticsCaseFeature.cpp ${CEE_CURRENT_LIST_DIR}RicComputeStatisticsFeature.cpp ${CEE_CURRENT_LIST_DIR}RicTileWindowsFeature.cpp +${CEE_CURRENT_LIST_DIR}RicShowPlotWindowFeature.cpp ${CEE_CURRENT_LIST_DIR}RicLaunchUnitTestsFeature.cpp ${CEE_CURRENT_LIST_DIR}RicExportToLasFileFeature.cpp ${CEE_CURRENT_LIST_DIR}RicImportInputEclipseCaseOpmFeature.cpp diff --git a/ApplicationCode/Commands/RicShowPlotWindowFeature.cpp b/ApplicationCode/Commands/RicShowPlotWindowFeature.cpp new file mode 100644 index 0000000000..6ce117526e --- /dev/null +++ b/ApplicationCode/Commands/RicShowPlotWindowFeature.cpp @@ -0,0 +1,50 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2016 Statoil ASA +// +// 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. +// +// 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. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicShowPlotWindowFeature.h" + +#include "RiaApplication.h" + +#include + +CAF_CMD_SOURCE_INIT(RicShowPlotWindowFeature, "RicShowPlotWindowFeature"); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicShowPlotWindowFeature::isCommandEnabled() +{ + return true; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicShowPlotWindowFeature::onActionTriggered(bool isChecked) +{ + RiaApplication::instance()->getOrCreateAndShowMainPlotWindow(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicShowPlotWindowFeature::setupActionLook(QAction* actionToSetup) +{ + actionToSetup->setText("Show Plot Window"); + actionToSetup->setIcon(QIcon(":/SummaryPlots16x16.png")); +} diff --git a/ApplicationCode/Commands/RicShowPlotWindowFeature.h b/ApplicationCode/Commands/RicShowPlotWindowFeature.h new file mode 100644 index 0000000000..9ffea25151 --- /dev/null +++ b/ApplicationCode/Commands/RicShowPlotWindowFeature.h @@ -0,0 +1,38 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2016 Statoil ASA +// +// 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. +// +// 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. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafCmdFeature.h" + + +//================================================================================================== +/// +//================================================================================================== +class RicShowPlotWindowFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +protected: + // Overrides + virtual bool isCommandEnabled(); + virtual void onActionTriggered( bool isChecked ); + virtual void setupActionLook( QAction* actionToSetup ); +}; + + diff --git a/ApplicationCode/UserInterface/RiuMainPlotWindow.cpp b/ApplicationCode/UserInterface/RiuMainPlotWindow.cpp index 2582656ab7..dbba638df9 100644 --- a/ApplicationCode/UserInterface/RiuMainPlotWindow.cpp +++ b/ApplicationCode/UserInterface/RiuMainPlotWindow.cpp @@ -160,12 +160,23 @@ void RiuMainPlotWindow::createMenus() //-------------------------------------------------------------------------------------------------- void RiuMainPlotWindow::createToolBars() { - // Snapshots - QToolBar* toolbar = addToolBar(tr("View Snapshots")); - toolbar->setObjectName(toolbar->windowTitle()); - toolbar->addAction(m_snapshotToClipboard); - toolbar->addAction(m_snapshotToFile); - toolbar->addAction(m_snapshotAllViewsToFile); + { + // Snapshots + QToolBar* toolbar = addToolBar(tr("View Snapshots")); + toolbar->setObjectName(toolbar->windowTitle()); + toolbar->addAction(m_snapshotToClipboard); + toolbar->addAction(m_snapshotToFile); + toolbar->addAction(m_snapshotAllViewsToFile); + } + + caf::CmdFeatureManager* cmdFeatureMgr = caf::CmdFeatureManager::instance(); + CVF_ASSERT(cmdFeatureMgr); + + { + QToolBar* toolbar = addToolBar(tr("Window Management")); + toolbar->setObjectName(toolbar->windowTitle()); + toolbar->addAction(cmdFeatureMgr->action("RicTileWindowsFeature")); + } } diff --git a/ApplicationCode/UserInterface/RiuMainWindow.cpp b/ApplicationCode/UserInterface/RiuMainWindow.cpp index 7f9d70bd2f..21e7a93721 100644 --- a/ApplicationCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationCode/UserInterface/RiuMainWindow.cpp @@ -509,9 +509,6 @@ void RiuMainWindow::createToolBars() m_viewToolBar->addAction(m_viewFromAbove); m_viewToolBar->addAction(m_viewFromBelow); m_viewToolBar->addSeparator(); - m_viewToolBar->addAction(cmdFeatureMgr->action("RicLinkVisibleViewsFeature")); - m_viewToolBar->addAction(cmdFeatureMgr->action("RicTileWindowsFeature")); - m_viewToolBar->addSeparator(); m_viewToolBar->addAction(m_drawStyleLinesAction); m_viewToolBar->addAction(m_drawStyleLinesSolidAction); m_viewToolBar->addAction(m_drawStyleSurfOnlyAction); @@ -535,6 +532,15 @@ void RiuMainWindow::createToolBars() addToolBar(m_animationToolBar); //connect(m_animationToolBar, SIGNAL(signalFrameRateChanged(double)), SLOT(slotFramerateChanged(double))); + { + // Snapshots + QToolBar* toolbar = addToolBar(tr("Window Management")); + toolbar->setObjectName(toolbar->windowTitle()); + toolbar->addAction(cmdFeatureMgr->action("RicLinkVisibleViewsFeature")); + toolbar->addAction(cmdFeatureMgr->action("RicTileWindowsFeature")); + toolbar->addAction(cmdFeatureMgr->action("RicShowPlotWindowFeature")); + } + refreshAnimationActions(); refreshDrawStyleActions(); }