Established RiuMainPlotWindow

This commit is contained in:
Magne Sjaastad 2016-06-24 15:10:18 +02:00
parent ef86eb0b8e
commit aef466087d
10 changed files with 2742 additions and 96 deletions

View File

@ -51,12 +51,17 @@
#include "RimGeoMechCellColors.h"
#include "RimGeoMechModels.h"
#include "RimGeoMechView.h"
#include "RimGridSummaryCase.h"
#include "RimIdenticalGridCaseGroup.h"
#include "RimMainPlotCollection.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "RimReservoirCellResultsStorage.h"
#include "RimScriptCollection.h"
#include "RimSummaryCase.h"
#include "RimSummaryCaseCollection.h"
#include "RimSummaryPlot.h"
#include "RimSummaryPlotCollection.h"
#include "RimViewLinker.h"
#include "RimViewLinkerCollection.h"
#include "RimWellLogPlot.h"
@ -64,6 +69,7 @@
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "RiuMainPlotWindow.h"
#include "RiuMainWindow.h"
#include "RiuProcessMonitor.h"
#include "RiuSelectionManager.h"
@ -98,11 +104,6 @@
#ifdef WIN32
#include <fcntl.h>
#endif
#include "RimSummaryPlotCollection.h"
#include "RimSummaryPlot.h"
#include "RimSummaryCaseCollection.h"
#include "RimSummaryCase.h"
#include "RimGridSummaryCase.h"
namespace caf
{
@ -686,6 +687,10 @@ bool RiaApplication::closeProject(bool askToSaveIfDirty)
mainWnd->cleanupGuiBeforeProjectClose();
RiuMainPlotWindow* mainPlotWnd = RiuMainPlotWindow::instance();
mainPlotWnd->cleanupGuiBeforeProjectClose();
caf::EffectGenerator::clearEffectCache();
m_project->close();

View File

@ -75,6 +75,7 @@ set( USER_INTERFACE_FILES
UserInterface/RiuResultTextBuilder.cpp
UserInterface/RiuFemResultTextBuilder.cpp
UserInterface/RiuMainWindow.cpp
UserInterface/RiuMainPlotWindow.cpp
UserInterface/RiuResultInfoPanel.cpp
UserInterface/RiuViewer.cpp
UserInterface/RiuSimpleHistogramWidget.cpp
@ -106,6 +107,10 @@ set( USER_INTERFACE_FILES
UserInterface/RiuSelectionColors.cpp
UserInterface/RiuSelectionChangedHandler.h
UserInterface/RiuSelectionChangedHandler.cpp
UserInterface/RiuToolTipMenu.h
UserInterface/RiuToolTipMenu.cpp
UserInterface/RiuMdiSubWindow.h
UserInterface/RiuMdiSubWindow.cpp
)
set( SOCKET_INTERFACE_FILES
@ -202,6 +207,7 @@ set ( QT_MOC_HEADERS
ProjectDataModel/RimMimeData.h
UserInterface/RiuMainWindow.h
UserInterface/RiuMainPlotWindow.h
UserInterface/RiuResultInfoPanel.h
UserInterface/RiuViewer.h
UserInterface/RiuProcessMonitor.h

View File

@ -22,14 +22,14 @@
#include "RimSummaryCurveFilter.h"
#include "RimSummaryPlotCollection.h"
#include "RiuSummaryQwtPlot.h"
#include "RiuMainPlotWindow.h"
#include "RiuSelectionColors.h"
#include "RiuSummaryQwtPlot.h"
#include "cvfBase.h"
#include "cvfColor3.h"
#include <QDateTime>
#include "RiuMainWindow.h"
CAF_PDM_SOURCE_INIT(RimSummaryPlot, "SummaryPlot");
@ -58,7 +58,7 @@ RimSummaryPlot::RimSummaryPlot()
//--------------------------------------------------------------------------------------------------
RimSummaryPlot::~RimSummaryPlot()
{
RiuMainWindow::instance()->removeViewer(m_qwtPlot);
RiuMainPlotWindow::instance()->removeViewer(m_qwtPlot);
deletePlotWidget();
@ -184,7 +184,7 @@ void RimSummaryPlot::setupBeforeSave()
{
if (m_qwtPlot)
{
this->setMdiWindowGeometry(RiuMainWindow::instance()->windowGeometryForViewer(m_qwtPlot));
this->setMdiWindowGeometry(RiuMainPlotWindow::instance()->windowGeometryForViewer(m_qwtPlot));
}
}
@ -227,7 +227,7 @@ void RimSummaryPlot::updateViewerWidget()
{
if (!m_qwtPlot)
{
m_qwtPlot = new RiuSummaryQwtPlot(this, RiuMainWindow::instance());
m_qwtPlot = new RiuSummaryQwtPlot(this, RiuMainPlotWindow::instance());
for(RimSummaryCurveFilter* curveFilter: m_curveFilters)
{
@ -239,8 +239,8 @@ void RimSummaryPlot::updateViewerWidget()
curve->setParentQwtPlot(m_qwtPlot);
}
RiuMainWindow::instance()->addViewer(m_qwtPlot, this->mdiWindowGeometry());
RiuMainWindow::instance()->setActiveViewer(m_qwtPlot);
RiuMainPlotWindow::instance()->addViewer(m_qwtPlot, this->mdiWindowGeometry());
RiuMainPlotWindow::instance()->setActiveViewer(m_qwtPlot);
}
//updateViewerWidgetWindowTitle();
@ -249,9 +249,9 @@ void RimSummaryPlot::updateViewerWidget()
{
if (m_qwtPlot)
{
this->setMdiWindowGeometry( RiuMainWindow::instance()->windowGeometryForViewer(m_qwtPlot));
this->setMdiWindowGeometry(RiuMainPlotWindow::instance()->windowGeometryForViewer(m_qwtPlot));
RiuMainWindow::instance()->removeViewer(m_qwtPlot);
RiuMainPlotWindow::instance()->removeViewer(m_qwtPlot);
detachAllCurves();
deletePlotWidget();

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,312 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <QEvent>
#include <QMainWindow>
#include <QPointer>
#include <QMdiArea>
class QActionGroup;
class QComboBox;
class QFrame;
class QItemSelection;
class QLabel;
class QLineEdit;
class QMdiSubWindow;
class QSpinBox;
class QTreeView;
class QUndoView;
class RimCase;
class RimEclipseCase;
class RiuProcessMonitor;
class RiuResultInfoPanel;
class RiuViewer;
class RiuWellLogPlot;
class RiuResultQwtPlot;
struct RimMdiWindowGeometry;
namespace caf
{
class PdmUiTreeView;
class AnimationToolBar;
class FrameAnimationControl;
class PdmObject;
class PdmUiPropertyView;
class UiPropertyCreatorPdm;
class PdmUiItem;
class PdmUiDragDropInterface;
}
namespace ssihub
{
class Interface;
}
//==================================================================================================
//
//
//
//==================================================================================================
class RiuMainPlotWindow : public QMainWindow
{
Q_OBJECT
public:
RiuMainPlotWindow();
static RiuMainPlotWindow* instance();
void initializeGuiNewProjectLoaded();
void cleanupGuiBeforeProjectClose();
void removeViewer( QWidget* viewer );
void addViewer(QWidget* viewer, const RimMdiWindowGeometry& windowsGeometry);
void setActiveViewer(QWidget* subWindow);
void setResultInfo(const QString& info) const;
void refreshAnimationActions();
void updateScaleValue();
caf::PdmUiTreeView* projectTreeView() { return m_projectTreeView;}
RiuProcessMonitor* processMonitor();
void hideAllDockWindows();
void loadWinGeoAndDockToolBarLayout();
void showWindow();
void selectAsCurrentItem(caf::PdmObject* object);
void selectedCases(std::vector<RimCase*>& cases);
void setDefaultWindowSize();
void refreshDrawStyleActions();
void setExpanded(const caf::PdmUiItem* uiItem, bool expanded);
void addRecentFiles(const QString& file);
void removeRecentFiles(const QString& file);
RimMdiWindowGeometry windowGeometryForViewer(QWidget* viewer);
RimMdiWindowGeometry windowGeometryForWidget(QWidget* widget);
void tileWindows();
bool isAnyMdiSubWindowVisible();
QMdiSubWindow* findMdiSubWindow(QWidget* viewer);
QList<QMdiSubWindow*> subWindowList(QMdiArea::WindowOrder order);
RiuResultQwtPlot* resultPlot();
protected:
virtual void closeEvent(QCloseEvent* event);
private:
void createActions();
void createMenus();
void createToolBars();
void createDockPanels();
void saveWinGeoAndDockToolBarLayout();
bool checkForDocumentModifications();
void updateRecentFileActions();
void storeTreeViewState();
void restoreTreeViewState();
private:
QByteArray m_initialDockAndToolbarLayout; // Initial dock window and toolbar layout, used to reset GUI
private:
// File actions
QAction* m_importGeoMechCaseAction;
QAction* m_openProjectAction;
QAction* m_openLastUsedProjectAction;
QAction* m_saveProjectAction;
QAction* m_saveProjectAsAction;
QAction* m_closeProjectAction;
QAction* m_exitAction;
// Recent files
enum { MaxRecentFiles = 5 };
QAction* m_recentFilesSeparatorAction;
QMenu* m_recentFilesMenu;
QAction* m_recentFileActions[MaxRecentFiles];
// Edit actions
QAction* m_editPreferences;
QAction* m_newPropertyView;
// View actions
QAction* m_viewFromNorth;
QAction* m_viewFromSouth;
QAction* m_viewFromEast;
QAction* m_viewFromWest;
QAction* m_viewFromAbove;
QAction* m_viewFromBelow;
QAction* m_zoomAll;
// Mock actions
QAction* m_mockModelAction;
QAction* m_mockResultsModelAction;
QAction* m_mockLargeResultsModelAction;
QAction* m_mockModelCustomizedAction;
QAction* m_mockInputModelAction;
QAction* m_snapshotToFile;
QAction* m_snapshotToClipboard;
QAction* m_snapshotAllViewsToFile;
QAction* m_createCommandObject;
QAction* m_showRegressionTestDialog;
QAction* m_executePaintEventPerformanceTest;
// Help actions
QAction* m_aboutAction;
QAction* m_commandLineHelpAction;
QAction* m_openUsersGuideInBrowserAction;
// Animation
caf::AnimationToolBar* m_animationToolBar;
// Toolbars
QToolBar* m_viewToolBar;
QToolBar* m_standardToolBar;
QToolBar* m_snapshotToolbar;
QMdiArea* m_mdiArea;
RiuViewer* m_mainViewer;
RiuResultInfoPanel* m_resultInfoPanel;
RiuProcessMonitor* m_processMonitor;
RiuResultQwtPlot* m_resultQwtPlot;
QMenu* m_windowMenu;
// Menu and action slots
private slots:
friend class RiuMdiSubWindow;
// File slots
void slotImportGeoMechModel();
void slotOpenProject();
void slotOpenLastUsedProject();
void slotSaveProject();
void slotSaveProjectAs();
void slotCloseProject();
void slotOpenRecentFile();
void slotRefreshFileActions();
// Edit slots
void slotRefreshEditActions();
void slotEditPreferences();
void slotNewObjectPropertyView();
// View slots
void slotRefreshViewActions();
void slotViewFromNorth();
void slotViewFromSouth();
void slotViewFromEast();
void slotViewFromWest();
void slotViewFromAbove();
void slotViewFromBelow();
void slotZoomAll();
void slotScaleChanged(int scaleValue);
void slotDrawStyleChanged(QAction* activatedAction);
void slotToggleHideGridCellsAction(bool);
void slotToggleFaultLabelsAction(bool);
void slotDisableLightingAction(bool);
void slotAddWellCellsToRangeFilterAction(bool doAdd);
// Debug slots
void slotUseShaders(bool enable);
void slotShowPerformanceInfo(bool enable);
void slotSnapshotToFile();
void slotSnapshotToClipboard();
void slotSnapshotAllViewsToFile();
void slotCreateCommandObject();
void slotShowRegressionTestDialog();
void slotExecutePaintEventPerformanceTest();
// Mock models
void slotMockModel();
void slotMockResultsModel();
void slotMockLargeResultsModel();
void slotMockModelCustomized();
void slotInputMockModel();
// Windows slots
void slotBuildWindowActions();
// Help slots
void slotAbout();
void slotShowCommandLineHelp();
void slotOpenUsersGuideInBrowserAction();
void slotSubWindowActivated(QMdiSubWindow* subWindow);
void selectedObjectsChanged();
void customMenuRequested(const QPoint& pos);
// Animation slots
void slotFramerateChanged(double frameRate);
// Pdm System :
public:
void setPdmRoot(caf::PdmObject* pdmRoot);
private:
caf::PdmUiTreeView* m_projectTreeView;
caf::PdmUiDragDropInterface* m_dragDropInterface;
QUndoView* m_undoView;
caf::PdmObject* m_pdmRoot;
caf::PdmUiPropertyView* m_pdmUiPropertyView;
QSpinBox* m_scaleFactor;
QActionGroup* m_dsActionGroup;
QAction* m_disableLightingAction;
QAction* m_drawStyleHideGridCellsAction;
QAction* m_toggleFaultsLabelAction;
QAction* m_drawStyleLinesAction;
QAction* m_drawStyleLinesSolidAction;
QAction* m_drawStyleFaultLinesSolidAction;
QAction* m_drawStyleSurfOnlyAction;
QAction* m_addWellCellsToRangeFilterAction;
std::vector<QPointer<QDockWidget> > additionalProjectViews;
bool m_blockSlotSubWindowActivated;
};

View File

@ -56,12 +56,14 @@
#include "RimWellPathImport.h"
#include "RiuDragDrop.h"
#include "RiuMdiSubWindow.h"
#include "RiuMultiCaseImportDialog.h"
#include "RiuProcessMonitor.h"
#include "RiuProjectPropertyView.h"
#include "RiuResultInfoPanel.h"
#include "RiuResultQwtPlot.h"
#include "RiuSummaryQwtPlot.h"
#include "RiuToolTipMenu.h"
#include "RiuTreeViewEventFilter.h"
#include "RiuViewer.h"
#include "RiuWellImportWizard.h"
@ -368,44 +370,6 @@ void RiuMainWindow::createActions()
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
class ToolTipableMenu : public QMenu
{
public:
ToolTipableMenu( QWidget * parent ) : QMenu( parent ) {};
bool event(QEvent* e)
{
if (e->type() == QEvent::ToolTip)
{
QHelpEvent* he = dynamic_cast<QHelpEvent*>(e);
QAction* act = actionAt(he->pos());
if (act)
{
// Remove ampersand as this is used to define shortcut key
QString actionTextWithoutAmpersand = act->text().remove("&");
if (actionTextWithoutAmpersand != act->toolTip())
{
QToolTip::showText(he->globalPos(), act->toolTip(), this);
}
return true;
}
}
else if (e->type() == QEvent::Paint && QToolTip::isVisible())
{
QToolTip::hideText();
}
return QMenu::event(e);
}
};
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -415,7 +379,7 @@ void RiuMainWindow::createMenus()
CVF_ASSERT(cmdFeatureMgr);
// File menu
QMenu* fileMenu = new ToolTipableMenu(menuBar());
QMenu* fileMenu = new RiuToolTipMenu(menuBar());
fileMenu->setTitle("&File");
menuBar()->addMenu(fileMenu);
@ -1199,49 +1163,6 @@ void RiuMainWindow::removeViewer(QWidget* viewer)
slotRefreshViewActions();
}
// Helper class used to trap the close event of an QMdiSubWindow
class RiuMdiSubWindow : public QMdiSubWindow
{
public:
RiuMdiSubWindow(QWidget* parent = 0, Qt::WindowFlags flags = 0)
: QMdiSubWindow(parent, flags)
{
}
~RiuMdiSubWindow()
{
RiuMainWindow::instance()->slotRefreshViewActions();
}
protected:
virtual void closeEvent(QCloseEvent* event)
{
QWidget* mainWidget = widget();
RiuWellLogPlot* wellLogPlot = dynamic_cast<RiuWellLogPlot*>(mainWidget);
RiuSummaryQwtPlot* summaryPlot = dynamic_cast<RiuSummaryQwtPlot*>(mainWidget);
if (wellLogPlot)
{
wellLogPlot->ownerPlotDefinition()->setMdiWindowGeometry(RiuMainWindow::instance()->windowGeometryForWidget(this));
}
else if (summaryPlot)
{
summaryPlot->ownerPlotDefinition()->setMdiWindowGeometry(RiuMainWindow::instance()->windowGeometryForWidget(this));
}
else
{
RiuViewer* viewer = mainWidget->findChild<RiuViewer*>();
if (viewer)
{
viewer->ownerReservoirView()->setMdiWindowGeometry(RiuMainWindow::instance()->windowGeometryForWidget(this));
}
}
QMdiSubWindow::closeEvent(event);
}
};
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -0,0 +1,73 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiuMdiSubWindow.h"
#include "RimSummaryPlot.h"
#include "RimView.h"
#include "RimWellLogPlot.h"
#include "RiuMainPlotWindow.h"
#include "RiuSummaryQwtPlot.h"
#include "RiuViewer.h"
#include "RiuWellLogPlot.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuMdiSubWindow::RiuMdiSubWindow(QWidget* parent /*= 0*/, Qt::WindowFlags flags /*= 0*/) : QMdiSubWindow(parent, flags)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuMdiSubWindow::~RiuMdiSubWindow()
{
RiuMainPlotWindow::instance()->slotRefreshViewActions();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMdiSubWindow::closeEvent(QCloseEvent* event)
{
QWidget* mainWidget = widget();
RiuWellLogPlot* wellLogPlot = dynamic_cast<RiuWellLogPlot*>(mainWidget);
RiuSummaryQwtPlot* summaryPlot = dynamic_cast<RiuSummaryQwtPlot*>(mainWidget);
if (wellLogPlot)
{
wellLogPlot->ownerPlotDefinition()->setMdiWindowGeometry(RiuMainPlotWindow::instance()->windowGeometryForWidget(this));
}
else if (summaryPlot)
{
summaryPlot->ownerPlotDefinition()->setMdiWindowGeometry(RiuMainPlotWindow::instance()->windowGeometryForWidget(this));
}
else
{
RiuViewer* viewer = mainWidget->findChild<RiuViewer*>();
if (viewer)
{
viewer->ownerReservoirView()->setMdiWindowGeometry(RiuMainPlotWindow::instance()->windowGeometryForWidget(this));
}
}
QMdiSubWindow::closeEvent(event);
}

View File

@ -0,0 +1,34 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <QMdiSubWindow>
class RiuMdiSubWindow : public QMdiSubWindow
{
public:
RiuMdiSubWindow(QWidget* parent = 0, Qt::WindowFlags flags = 0);
~RiuMdiSubWindow();
protected:
virtual void closeEvent(QCloseEvent* event);
};

View File

@ -0,0 +1,58 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiuToolTipMenu.h"
#include <QHelpEvent>
#include <QToolTip>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuToolTipMenu::RiuToolTipMenu(QWidget * parent) : QMenu(parent)
{
}
bool RiuToolTipMenu::event(QEvent* e)
{
if (e->type() == QEvent::ToolTip)
{
QHelpEvent* he = dynamic_cast<QHelpEvent*>(e);
QAction* act = actionAt(he->pos());
if (act)
{
// Remove ampersand as this is used to define shortcut key
QString actionTextWithoutAmpersand = act->text().remove("&");
if (actionTextWithoutAmpersand != act->toolTip())
{
QToolTip::showText(he->globalPos(), act->toolTip(), this);
}
return true;
}
}
else if (e->type() == QEvent::Paint && QToolTip::isVisible())
{
QToolTip::hideText();
}
return QMenu::event(e);
}

View File

@ -0,0 +1,32 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <QMenu>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
class RiuToolTipMenu : public QMenu
{
public:
RiuToolTipMenu(QWidget * parent);
bool event(QEvent* e);
};