mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
of windows. This might introduce problems.
This commit is contained in:
@@ -1591,6 +1591,16 @@ RiuMainPlotWindow* RiaApplication::mainPlotWindow()
|
||||
return m_mainPlotWindow;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuMainWindowBase* RiaApplication::mainWindowByID(int mainWindowID)
|
||||
{
|
||||
if (mainWindowID == 0) return RiuMainWindow::instance();
|
||||
else if (mainWindowID == 1) return m_mainPlotWindow;
|
||||
else return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -55,6 +55,7 @@ class RimViewWindow;
|
||||
class RimWellLogPlot;
|
||||
class RimWellAllocationPlot;
|
||||
|
||||
class RiuMainWindowBase;
|
||||
class RiuMainPlotWindow;
|
||||
class RiuRecentFileActionProvider;
|
||||
|
||||
@@ -185,6 +186,7 @@ public:
|
||||
|
||||
RiuMainPlotWindow* getOrCreateAndShowMainPlotWindow();
|
||||
RiuMainPlotWindow* mainPlotWindow();
|
||||
RiuMainWindowBase* mainWindowByID(int mainWindowID);
|
||||
|
||||
static RimViewWindow* activeViewWindow();
|
||||
|
||||
|
@@ -39,6 +39,7 @@ RimWellLogPlot* RicNewWellLogPlotFeatureImpl::createWellLogPlot()
|
||||
CVF_ASSERT(wellLogPlotColl);
|
||||
|
||||
RimWellLogPlot* plot = new RimWellLogPlot();
|
||||
plot->setAsPlotMDI();
|
||||
wellLogPlotColl->wellLogPlots().push_back(plot);
|
||||
|
||||
// Make sure the summary plot window is created and visible
|
||||
|
@@ -83,6 +83,7 @@ ${CEE_CURRENT_LIST_DIR}RimPlotCurve.h
|
||||
${CEE_CURRENT_LIST_DIR}RimEclipseInputCaseOpm.h
|
||||
${CEE_CURRENT_LIST_DIR}RimIntersectionBox.h
|
||||
${CEE_CURRENT_LIST_DIR}RimMultiSnapshotDefinition.h
|
||||
${CEE_CURRENT_LIST_DIR}RimMdiWindowController.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@@ -164,6 +165,7 @@ ${CEE_CURRENT_LIST_DIR}RimPlotCurve.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimEclipseInputCaseOpm.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimIntersectionBox.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimMultiSnapshotDefinition.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimMdiWindowController.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
@@ -46,6 +46,8 @@ RimWellAllocationPlot::RimWellAllocationPlot()
|
||||
CAF_PDM_InitField(&m_showPlotTitle, "ShowPlotTitle", true, "Show Plot Title", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_simulationWell, "SimulationWell", "Simulation Well", "", "", "");
|
||||
|
||||
this->setAsPlotMDI();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -53,12 +55,9 @@ RimWellAllocationPlot::RimWellAllocationPlot()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellAllocationPlot::~RimWellAllocationPlot()
|
||||
{
|
||||
if (RiaApplication::instance()->mainPlotWindow())
|
||||
{
|
||||
RiaApplication::instance()->mainPlotWindow()->removeViewer(m_wellAllocationPlot);
|
||||
}
|
||||
removeWidgetFromMDI();
|
||||
|
||||
deletePlotWidget();
|
||||
deleteViewWidget();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -74,12 +73,12 @@ void RimWellAllocationPlot::setSimulationWell(RimEclipseWell* simWell)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationPlot::deletePlotWidget()
|
||||
void RimWellAllocationPlot::deleteViewWidget()
|
||||
{
|
||||
if (m_wellAllocationPlot)
|
||||
if (m_wellAllocationPlotWidget)
|
||||
{
|
||||
m_wellAllocationPlot->deleteLater();
|
||||
m_wellAllocationPlot = nullptr;
|
||||
m_wellAllocationPlotWidget->deleteLater();
|
||||
m_wellAllocationPlotWidget = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +95,7 @@ void RimWellAllocationPlot::updateFromWell()
|
||||
}
|
||||
|
||||
setDescription(simName);
|
||||
updateViewerWidget();
|
||||
updateViewerWidgetBasic();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -104,7 +103,7 @@ void RimWellAllocationPlot::updateFromWell()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimWellAllocationPlot::viewWidget()
|
||||
{
|
||||
return m_wellAllocationPlot;
|
||||
return m_wellAllocationPlotWidget;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -148,17 +147,6 @@ QList<caf::PdmOptionItemInfo> RimWellAllocationPlot::calculateValueOptions(const
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationPlot::handleViewerDeletion()
|
||||
{
|
||||
m_showWindow = false;
|
||||
|
||||
uiCapability()->updateUiIconFromToggleField();
|
||||
updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -166,7 +154,7 @@ void RimWellAllocationPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedF
|
||||
{
|
||||
if (changedField == &m_showWindow)
|
||||
{
|
||||
updateViewerWidget();
|
||||
updateViewerWidgetBasic();
|
||||
|
||||
uiCapability()->updateUiIconFromToggleField();
|
||||
}
|
||||
@@ -181,16 +169,6 @@ void RimWellAllocationPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedF
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationPlot::setupBeforeSave()
|
||||
{
|
||||
if (m_wellAllocationPlot && RiaApplication::instance()->mainPlotWindow())
|
||||
{
|
||||
this->setMdiWindowGeometry(RiaApplication::instance()->mainPlotWindow()->windowGeometryForViewer(m_wellAllocationPlot));
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@@ -225,59 +203,16 @@ QString RimWellAllocationPlot::description() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationPlot::loadDataAndUpdate()
|
||||
{
|
||||
updateViewerWidget();
|
||||
updateViewerWidgetBasic();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationPlot::updateViewerWidget()
|
||||
QWidget* RimWellAllocationPlot::createViewWidget(QWidget* mainWindowParent)
|
||||
{
|
||||
RiuMainPlotWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
|
||||
if (!mainPlotWindow) return;
|
||||
|
||||
if (m_showWindow())
|
||||
{
|
||||
if (!m_wellAllocationPlot)
|
||||
{
|
||||
m_wellAllocationPlot = new RiuWellAllocationPlot(this, mainPlotWindow);
|
||||
|
||||
mainPlotWindow->addViewer(m_wellAllocationPlot, this->mdiWindowGeometry());
|
||||
mainPlotWindow->setActiveViewer(m_wellAllocationPlot);
|
||||
}
|
||||
|
||||
updateViewerWidgetWindowTitle();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_wellAllocationPlot)
|
||||
{
|
||||
this->setMdiWindowGeometry(mainPlotWindow->windowGeometryForViewer(m_wellAllocationPlot));
|
||||
|
||||
mainPlotWindow->removeViewer(m_wellAllocationPlot);
|
||||
|
||||
deletePlotWidget();
|
||||
}
|
||||
}
|
||||
m_wellAllocationPlotWidget = new RiuWellAllocationPlot(this, mainWindowParent);
|
||||
return m_wellAllocationPlotWidget;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationPlot::updateViewerWidgetWindowTitle()
|
||||
{
|
||||
if (m_wellAllocationPlot)
|
||||
{
|
||||
m_wellAllocationPlot->setWindowTitle(m_userName);
|
||||
|
||||
if (m_showPlotTitle)
|
||||
{
|
||||
m_wellAllocationPlot->setTitle(m_userName);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_wellAllocationPlot->setTitle("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -54,8 +54,6 @@ public:
|
||||
|
||||
void loadDataAndUpdate();
|
||||
|
||||
void handleViewerDeletion();
|
||||
|
||||
virtual QWidget* viewWidget() override;
|
||||
virtual void zoomAll() override;
|
||||
|
||||
@@ -67,16 +65,19 @@ protected:
|
||||
virtual caf::PdmFieldHandle* objectToggleField() { return &m_showWindow; }
|
||||
virtual caf::PdmFieldHandle* userDescriptionField() { return &m_userName; }
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
virtual void setupBeforeSave() override;
|
||||
|
||||
virtual QImage snapshotWindowContent() override;
|
||||
|
||||
private:
|
||||
void updateViewerWidget();
|
||||
void updateViewerWidgetWindowTitle();
|
||||
void deletePlotWidget();
|
||||
void updateFromWell();
|
||||
|
||||
// RimViewWindow overrides
|
||||
|
||||
virtual caf::PdmField<bool>* getShowWindowField() override { return &m_showWindow; }
|
||||
virtual QWidget* createViewWidget(QWidget* mainWindowParent) override;
|
||||
virtual void deleteViewWidget() override;
|
||||
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_showWindow;
|
||||
|
||||
@@ -85,5 +86,5 @@ private:
|
||||
|
||||
caf::PdmPtrField<RimEclipseWell*> m_simulationWell;
|
||||
|
||||
QPointer<RiuWellAllocationPlot> m_wellAllocationPlot;
|
||||
QPointer<RiuWellAllocationPlot> m_wellAllocationPlotWidget;
|
||||
};
|
||||
|
@@ -159,26 +159,6 @@ RimEclipseView::~RimEclipseView()
|
||||
m_reservoir = NULL;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseView::updateViewerWidgetWindowTitle()
|
||||
{
|
||||
if (m_viewer)
|
||||
{
|
||||
QString windowTitle;
|
||||
if (m_reservoir.notNull())
|
||||
{
|
||||
windowTitle = QString("%1 - %2").arg(m_reservoir->caseUserDescription()).arg(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
windowTitle = name;
|
||||
}
|
||||
|
||||
m_viewer->layoutWidget()->setWindowTitle(windowTitle);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Clamp the current timestep to actual possibilities
|
||||
@@ -208,7 +188,7 @@ void RimEclipseView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
|
||||
if (showWindow)
|
||||
{
|
||||
bool generateDisplayModel = (viewer() == NULL);
|
||||
updateViewerWidget();
|
||||
updateViewerWidgetBasic();
|
||||
|
||||
if (generateDisplayModel)
|
||||
{
|
||||
@@ -709,7 +689,7 @@ void RimEclipseView::loadDataAndUpdate()
|
||||
|
||||
this->faultResultSettings()->customFaultResult()->loadResult();
|
||||
|
||||
updateViewerWidget();
|
||||
updateViewerWidgetBasic();
|
||||
|
||||
this->m_propertyFilterCollection()->loadAndInitializePropertyFilters();
|
||||
|
||||
@@ -731,6 +711,8 @@ void RimEclipseView::loadDataAndUpdate()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseView::initAfterRead()
|
||||
{
|
||||
RimViewWindow::initAfterRead();
|
||||
|
||||
this->faultResultSettings()->setReservoirView(this);
|
||||
this->cellResult()->setReservoirView(this);
|
||||
this->cellEdgeResult()->setReservoirView(this);
|
||||
|
@@ -164,7 +164,6 @@ private:
|
||||
void updateLegends();
|
||||
void updateMinMaxValuesAndAddLegendToView(QString legendLabel, RimEclipseCellColors* resultColors, RigCaseCellResultsData* cellResultsData);
|
||||
virtual void resetLegendsInViewer();
|
||||
virtual void updateViewerWidgetWindowTitle();
|
||||
|
||||
std::set<RivCellSetEnum> allVisibleFaultGeometryTypes() const;
|
||||
void updateFaultColors();
|
||||
|
@@ -99,28 +99,6 @@ RimGeoMechView::~RimGeoMechView(void)
|
||||
delete m_propertyFilterCollection;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechView::updateViewerWidgetWindowTitle()
|
||||
{
|
||||
if (m_viewer)
|
||||
{
|
||||
QString windowTitle;
|
||||
if (m_geomechCase.notNull())
|
||||
{
|
||||
windowTitle = QString("%1 - %2").arg(m_geomechCase->caseUserDescription()).arg(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
windowTitle = name;
|
||||
}
|
||||
|
||||
m_viewer->layoutWidget()->setWindowTitle(windowTitle);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -156,7 +134,7 @@ void RimGeoMechView::loadDataAndUpdate()
|
||||
progress.incrementProgress();
|
||||
progress.setProgressDescription("Create Display model");
|
||||
|
||||
updateViewerWidget();
|
||||
updateViewerWidgetBasic();
|
||||
|
||||
this->geoMechPropertyFilterCollection()->loadAndInitializePropertyFilters();
|
||||
|
||||
@@ -504,7 +482,7 @@ void RimGeoMechView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
|
||||
if (showWindow)
|
||||
{
|
||||
bool generateDisplayModel = (viewer() == NULL);
|
||||
updateViewerWidget();
|
||||
updateViewerWidgetBasic();
|
||||
|
||||
if (generateDisplayModel)
|
||||
{
|
||||
@@ -532,6 +510,7 @@ void RimGeoMechView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechView::initAfterRead()
|
||||
{
|
||||
RimViewWindow::initAfterRead();
|
||||
this->cellResult()->setGeoMechCase(m_geomechCase);
|
||||
|
||||
this->updateUiIconFromToggleField();
|
||||
|
@@ -99,7 +99,6 @@ private:
|
||||
virtual void updateCurrentTimeStep();
|
||||
virtual void updateStaticCellColors();
|
||||
|
||||
virtual void updateViewerWidgetWindowTitle();
|
||||
virtual void resetLegendsInViewer();
|
||||
|
||||
void updateLegends();
|
||||
|
191
ApplicationCode/ProjectDataModel/RimMdiWindowController.cpp
Normal file
191
ApplicationCode/ProjectDataModel/RimMdiWindowController.cpp
Normal file
@@ -0,0 +1,191 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 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 "RimMdiWindowController.h"
|
||||
#include "RiuMainWindowBase.h"
|
||||
#include "RiaApplication.h"
|
||||
#include "RimViewWindow.h"
|
||||
|
||||
CAF_PDM_XML_SOURCE_INIT(RimMdiWindowController, "MdiWindowController");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimMdiWindowController::RimMdiWindowController()
|
||||
{
|
||||
CAF_PDM_InitField(&m_mainWindowID, "MainWindowID", -1, "", "", "", "" );
|
||||
CAF_PDM_InitField(& m_x , "xPos", -1, "", "", "", "" );
|
||||
CAF_PDM_InitField(& m_y , "yPos", -1, "", "", "", "" );
|
||||
CAF_PDM_InitField(& m_width , "Width", -1, "", "", "", "" );
|
||||
CAF_PDM_InitField(& m_height , "Height", -1, "", "", "", "" );
|
||||
CAF_PDM_InitField(& m_isMaximized, "IsMaximized", false, "", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimMdiWindowController::~RimMdiWindowController()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMdiWindowController::setMdiWindowGeometry(const RimMdiWindowGeometry& windowGeometry)
|
||||
{
|
||||
m_mainWindowID = windowGeometry.mainWindowID;
|
||||
m_x = windowGeometry.x;
|
||||
m_y = windowGeometry.y;
|
||||
m_width = windowGeometry.width;
|
||||
m_height = windowGeometry.height;
|
||||
m_isMaximized = windowGeometry.isMaximized;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimMdiWindowGeometry RimMdiWindowController::mdiWindowGeometry()
|
||||
{
|
||||
RimMdiWindowGeometry windowGeometry;
|
||||
|
||||
windowGeometry.mainWindowID = m_mainWindowID;
|
||||
windowGeometry.x = m_x ;
|
||||
windowGeometry.y = m_y ;
|
||||
windowGeometry.width = m_width ;
|
||||
windowGeometry.height = m_height ;
|
||||
windowGeometry.isMaximized = m_isMaximized ;
|
||||
|
||||
return windowGeometry;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMdiWindowController::handleViewerDeletion()
|
||||
{
|
||||
showWindowField() = false;
|
||||
|
||||
uiCapability()->updateUiIconFromToggleField();
|
||||
updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMdiWindowController::removeWindowFromMDI()
|
||||
{
|
||||
RiuMainWindowBase* mainWin = getMainWindow();
|
||||
if (mainWin && viewWidget()) mainWin->removeViewer(viewWidget());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMdiWindowController::showWindowFieldChangedByUi()
|
||||
{
|
||||
updateViewerWidget();
|
||||
|
||||
viewPdmObject()->uiCapability()->updateUiIconFromToggleField();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimViewWindow* RimMdiWindowController::viewPdmObject()
|
||||
{
|
||||
RimViewWindow * viewWindowObj;
|
||||
this->firstAncestorOrThisOfType(viewWindowObj);
|
||||
return viewWindowObj;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmField<bool>& RimMdiWindowController::showWindowField()
|
||||
{
|
||||
return *(viewPdmObject()->getShowWindowField());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimMdiWindowController::viewWidget()
|
||||
{
|
||||
return viewPdmObject()->viewWidget();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuMainWindowBase* RimMdiWindowController::getMainWindow()
|
||||
{
|
||||
return RiaApplication::instance()->mainWindowByID(m_mainWindowID);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMdiWindowController::setupBeforeSave()
|
||||
{
|
||||
if ( viewWidget() && getMainWindow() )
|
||||
{
|
||||
this->setMdiWindowGeometry(getMainWindow()->windowGeometryForViewer(viewWidget()));
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMdiWindowController::updateViewerWidget()
|
||||
{
|
||||
RiuMainWindowBase* mainWindow = getMainWindow();
|
||||
if ( !mainWindow ) return;
|
||||
|
||||
if ( showWindowField() )
|
||||
{
|
||||
if ( !viewWidget() )
|
||||
{
|
||||
// m_wellAllocationPlotWidget = new RiuWellAllocationPlot(this, mainPlotWindow);
|
||||
QWidget * viewWidget = viewPdmObject()->createViewWidget(mainWindow);
|
||||
|
||||
mainWindow->addViewer(viewWidget, this->mdiWindowGeometry());
|
||||
mainWindow->setActiveViewer(viewWidget);
|
||||
|
||||
viewPdmObject()->updateViewWidgetAfterCreation();
|
||||
}
|
||||
else
|
||||
{
|
||||
mainWindow->setActiveViewer(viewWidget());
|
||||
}
|
||||
|
||||
viewPdmObject()->updateViewerWidgetWindowTitle();
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( viewWidget() )
|
||||
{
|
||||
this->setMdiWindowGeometry(mainWindow->windowGeometryForViewer(viewWidget()));
|
||||
|
||||
mainWindow->removeViewer(viewWidget());
|
||||
|
||||
viewPdmObject()->deleteViewWidget();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
139
ApplicationCode/ProjectDataModel/RimMdiWindowController.h
Normal file
139
ApplicationCode/ProjectDataModel/RimMdiWindowController.h
Normal file
@@ -0,0 +1,139 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 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 "cafPdmObject.h"
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmField.h"
|
||||
|
||||
#if 0
|
||||
class RimMdiWindowController;
|
||||
|
||||
class RimViewWindow : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
public:
|
||||
RimViewWindow(void);
|
||||
virtual ~RimViewWindow(void)
|
||||
{
|
||||
if (m_windowController()) delete m_windowController();
|
||||
}
|
||||
|
||||
void handleViewerDeletion() { if (m_windowController()) m_windowController->handleViewerDeletion(); }
|
||||
void updateViewerWidgetBasic() { if (m_windowController()) m_windowController->updateViewerWidget(); }
|
||||
|
||||
void setAs3DMDI() { setAsMDI(0); }
|
||||
void setAsPlotMDI() { setAsMDI(1); }
|
||||
|
||||
void setMdiWindowGeometry(const RimMdiWindowGeometry& windowGeometry);
|
||||
RimMdiWindowGeometry mdiWindowGeometry();
|
||||
|
||||
virtual QImage snapshotWindowContent() = 0;
|
||||
virtual void zoomAll() = 0;
|
||||
|
||||
protected:
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override
|
||||
{
|
||||
if ( m_windowController() )
|
||||
{
|
||||
if ( changedField == showWindowField() )
|
||||
{
|
||||
m_windowController()->showWindowFieldChangedByUi();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
///////// Interface for the Window controller
|
||||
friend class RimMdiWindowController;
|
||||
|
||||
virtual QWidget* viewWidget() = 0;
|
||||
virtual QWidget* createViewWidget(QWidget* mainWindowParent) = 0;
|
||||
virtual void updateViewWidgetAfterCreation() = 0;
|
||||
virtual void deleteViewWidget() = 0;
|
||||
|
||||
virtual caf::PdmField<bool>* showWindowField() = 0;
|
||||
|
||||
//////////
|
||||
|
||||
void setAsMDI(int mainWindowID)
|
||||
{
|
||||
if (!m_windowController())
|
||||
{
|
||||
m_windowController = new RimMdiWindowController;
|
||||
RimMdiWindowGeometry mwg;
|
||||
mwg.mainWindowID = mainWindowID;
|
||||
setMdiWindowGeometry(mwg);
|
||||
}
|
||||
}
|
||||
|
||||
caf::PdmChildField<RimMdiWindowController*> m_windowController;
|
||||
|
||||
// Obsolete field
|
||||
caf::PdmField< std::vector<int> > m_windowGeometry;
|
||||
};
|
||||
#endif
|
||||
|
||||
class RimViewWindow;
|
||||
class RiuMainWindowBase;
|
||||
struct RimMdiWindowGeometry;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimMdiWindowController : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimMdiWindowController();
|
||||
virtual ~RimMdiWindowController();
|
||||
|
||||
void setMdiWindowGeometry(const RimMdiWindowGeometry& windowGeometry);
|
||||
RimMdiWindowGeometry mdiWindowGeometry();
|
||||
|
||||
void updateViewerWidget();
|
||||
void handleViewerDeletion();
|
||||
void removeWindowFromMDI();
|
||||
void showWindowFieldChangedByUi();
|
||||
|
||||
protected:
|
||||
|
||||
RimViewWindow* viewPdmObject();
|
||||
caf::PdmField<bool>& showWindowField();
|
||||
QWidget* viewWidget();
|
||||
RiuMainWindowBase* getMainWindow();
|
||||
|
||||
// Overridden PDM methods
|
||||
virtual void setupBeforeSave() override;
|
||||
|
||||
private:
|
||||
|
||||
caf::PdmField< int > m_mainWindowID;
|
||||
|
||||
caf::PdmField< int > m_x;
|
||||
caf::PdmField< int > m_y;
|
||||
caf::PdmField< int > m_width;
|
||||
caf::PdmField< int > m_height;
|
||||
caf::PdmField< bool> m_isMaximized;
|
||||
};
|
||||
|
||||
|
@@ -140,6 +140,8 @@ RimView::RimView(void)
|
||||
|
||||
m_wellPathPipeVizModel = new cvf::ModelBasicList;
|
||||
m_wellPathPipeVizModel->setName("WellPathPipeModel");
|
||||
|
||||
this->setAs3DMDI();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -169,12 +171,9 @@ RimView::~RimView(void)
|
||||
|
||||
delete this->m_overlayInfoConfig();
|
||||
|
||||
if (m_viewer)
|
||||
{
|
||||
RiuMainWindow::instance()->removeViewer(m_viewer->layoutWidget());
|
||||
}
|
||||
removeWidgetFromMDI();
|
||||
|
||||
delete m_viewer;
|
||||
deleteViewWidget();
|
||||
|
||||
delete m_rangeFilterCollection;
|
||||
delete m_overrideRangeFilterCollection;
|
||||
@@ -193,64 +192,76 @@ RiuViewer* RimView::viewer()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimView::updateViewerWidget()
|
||||
QWidget* RimView::createViewWidget(QWidget* mainWindowParent)
|
||||
{
|
||||
if (showWindow())
|
||||
{
|
||||
bool isViewerCreated = false;
|
||||
if (!m_viewer)
|
||||
{
|
||||
QGLFormat glFormat;
|
||||
glFormat.setDirectRendering(RiaApplication::instance()->useShaders());
|
||||
QGLFormat glFormat;
|
||||
glFormat.setDirectRendering(RiaApplication::instance()->useShaders());
|
||||
|
||||
m_viewer = new RiuViewer(glFormat, NULL);
|
||||
m_viewer->setOwnerReservoirView(this);
|
||||
m_viewer = new RiuViewer(glFormat, NULL);
|
||||
m_viewer->setOwnerReservoirView(this);
|
||||
|
||||
RiuMainWindow::instance()->addViewer(m_viewer->layoutWidget(), mdiWindowGeometry());
|
||||
m_viewer->setDefaultPerspectiveNearPlaneDistance(10);
|
||||
|
||||
this->resetLegendsInViewer();
|
||||
|
||||
m_viewer->updateNavigationPolicy();
|
||||
m_viewer->enablePerfInfoHud(RiaApplication::instance()->showPerformanceInfo());
|
||||
|
||||
isViewerCreated = true;
|
||||
}
|
||||
|
||||
RiuMainWindow::instance()->setActiveViewer(m_viewer->layoutWidget());
|
||||
|
||||
if(isViewerCreated)
|
||||
{
|
||||
m_viewer->mainCamera()->setViewMatrix(cameraPosition);
|
||||
m_viewer->setPointOfInterest(cameraPointOfInterest());
|
||||
m_viewer->enableParallelProjection(!isPerspectiveView());
|
||||
}
|
||||
m_viewer->mainCamera()->viewport()->setClearColor(cvf::Color4f(backgroundColor()));
|
||||
|
||||
this->updateGridBoxData();
|
||||
this->createHighlightAndGridBoxDisplayModel();
|
||||
|
||||
m_viewer->update();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_viewer && m_viewer->layoutWidget())
|
||||
{
|
||||
if (m_viewer->layoutWidget()->parentWidget())
|
||||
{
|
||||
m_viewer->layoutWidget()->parentWidget()->hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_viewer->layoutWidget()->hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
updateViewerWidgetWindowTitle();
|
||||
return m_viewer->layoutWidget();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimView::updateViewWidgetAfterCreation()
|
||||
{
|
||||
m_viewer->setDefaultPerspectiveNearPlaneDistance(10);
|
||||
|
||||
this->resetLegendsInViewer();
|
||||
|
||||
m_viewer->updateNavigationPolicy();
|
||||
m_viewer->enablePerfInfoHud(RiaApplication::instance()->showPerformanceInfo());
|
||||
|
||||
m_viewer->mainCamera()->setViewMatrix(cameraPosition);
|
||||
m_viewer->setPointOfInterest(cameraPointOfInterest());
|
||||
m_viewer->enableParallelProjection(!isPerspectiveView());
|
||||
|
||||
m_viewer->mainCamera()->viewport()->setClearColor(cvf::Color4f(backgroundColor()));
|
||||
|
||||
this->updateGridBoxData();
|
||||
this->createHighlightAndGridBoxDisplayModel();
|
||||
|
||||
m_viewer->update();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimView::updateViewerWidgetWindowTitle()
|
||||
{
|
||||
if (m_viewer)
|
||||
{
|
||||
QString windowTitle;
|
||||
if (ownerCase())
|
||||
{
|
||||
windowTitle = QString("%1 - %2").arg(ownerCase()->caseUserDescription()).arg(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
windowTitle = name;
|
||||
}
|
||||
|
||||
m_viewer->layoutWidget()->setWindowTitle(windowTitle);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimView::deleteViewWidget()
|
||||
{
|
||||
if (m_viewer)
|
||||
{
|
||||
m_viewer->deleteLater();
|
||||
m_viewer = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -367,8 +378,6 @@ void RimView::setupBeforeSave()
|
||||
hasUserRequestedAnimation = m_viewer->isAnimationActive(); // JJS: This is not conceptually correct. The variable is updated as we go, and store the user intentions. But I guess that in practice...
|
||||
cameraPosition = m_viewer->mainCamera()->viewMatrix();
|
||||
cameraPointOfInterest = m_viewer->pointOfInterest();
|
||||
|
||||
setMdiWindowGeometry(RiuMainWindow::instance()->windowGeometryForViewer(m_viewer->layoutWidget()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -617,9 +626,9 @@ void RimView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QV
|
||||
}
|
||||
else if (changedField == &backgroundColor)
|
||||
{
|
||||
if (viewer() != NULL)
|
||||
if (m_viewer != nullptr)
|
||||
{
|
||||
updateViewerWidget();
|
||||
m_viewer->mainCamera()->viewport()->setClearColor(cvf::Color4f(backgroundColor()));
|
||||
}
|
||||
}
|
||||
else if (changedField == &maximumFrameRate)
|
||||
@@ -953,6 +962,7 @@ cvf::ref<caf::DisplayCoordTransform> RimView::displayCoordTransform()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimView::viewWidget()
|
||||
{
|
||||
return m_viewer;
|
||||
if ( m_viewer ) return m_viewer->layoutWidget();
|
||||
else return nullptr;
|
||||
}
|
||||
|
||||
|
@@ -199,9 +199,6 @@ protected:
|
||||
virtual void updateScaleTransform() = 0;
|
||||
virtual cvf::Transform* scaleTransform() = 0;
|
||||
|
||||
void updateViewerWidget();
|
||||
virtual void updateViewerWidgetWindowTitle() = 0;
|
||||
|
||||
virtual void resetLegendsInViewer() = 0;
|
||||
virtual void calculateCurrentTotalCellVisibility(cvf::UByteArray* totalVisibility) = 0;
|
||||
|
||||
@@ -217,8 +214,14 @@ protected:
|
||||
|
||||
// Overridden PDM methods:
|
||||
virtual void setupBeforeSave();
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||
|
||||
virtual caf::PdmField<bool>* getShowWindowField() override { return &showWindow; }
|
||||
virtual QWidget* createViewWidget(QWidget* mainWindowParent) override;
|
||||
virtual void updateViewWidgetAfterCreation() override;
|
||||
virtual void updateViewerWidgetWindowTitle() override;
|
||||
virtual void deleteViewWidget() override;
|
||||
|
||||
cvf::ref<cvf::UByteArray> m_currentReservoirCellVisibility;
|
||||
|
||||
|
@@ -17,7 +17,9 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimViewWindow.h"
|
||||
|
||||
#include "RimMdiWindowController.h"
|
||||
#include "cvfAssert.h"
|
||||
#include <QWidget>
|
||||
|
||||
CAF_PDM_XML_ABSTRACT_SOURCE_INIT(RimViewWindow, "ViewWindow"); // Do not use. Abstract class
|
||||
|
||||
@@ -26,9 +28,14 @@ CAF_PDM_XML_ABSTRACT_SOURCE_INIT(RimViewWindow, "ViewWindow"); // Do not use. Ab
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimViewWindow::RimViewWindow(void)
|
||||
{
|
||||
CAF_PDM_InitFieldNoDefault(&m_windowController, "WindowController", "", "", "", "");
|
||||
m_windowController.uiCapability()->setUiHidden(true);
|
||||
|
||||
|
||||
// Obsolete field
|
||||
CAF_PDM_InitFieldNoDefault(&m_windowGeometry, "WindowGeometry", "", "", "", "");
|
||||
m_windowGeometry.uiCapability()->setUiHidden(true);
|
||||
|
||||
m_windowGeometry.xmlCapability()->setIOWritable(false);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -36,7 +43,31 @@ RimViewWindow::RimViewWindow(void)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimViewWindow::~RimViewWindow(void)
|
||||
{
|
||||
if ( m_windowController() ) delete m_windowController() ;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimViewWindow::removeWidgetFromMDI()
|
||||
{
|
||||
if ( m_windowController() ) m_windowController->removeWindowFromMDI();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimViewWindow::handleViewerDeletion()
|
||||
{
|
||||
if ( m_windowController() ) m_windowController->handleViewerDeletion();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimViewWindow::updateViewerWidgetBasic()
|
||||
{
|
||||
if ( m_windowController() ) m_windowController->updateViewerWidget();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -44,17 +75,10 @@ RimViewWindow::~RimViewWindow(void)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimViewWindow::setMdiWindowGeometry(const RimMdiWindowGeometry& windowGeometry)
|
||||
{
|
||||
std::vector<int> geom;
|
||||
geom.clear();
|
||||
if (windowGeometry.isValid())
|
||||
{
|
||||
geom.push_back(windowGeometry.x);
|
||||
geom.push_back(windowGeometry.y);
|
||||
geom.push_back(windowGeometry.width);
|
||||
geom.push_back(windowGeometry.height);
|
||||
geom.push_back(windowGeometry.isMaximized);
|
||||
}
|
||||
m_windowGeometry.setValue(geom);
|
||||
CVF_ASSERT(m_windowController());
|
||||
|
||||
if (m_windowController()) m_windowController()->setMdiWindowGeometry(windowGeometry);
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -62,17 +86,84 @@ void RimViewWindow::setMdiWindowGeometry(const RimMdiWindowGeometry& windowGeome
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimMdiWindowGeometry RimViewWindow::mdiWindowGeometry()
|
||||
{
|
||||
CVF_ASSERT(m_windowController());
|
||||
|
||||
RimMdiWindowGeometry wg;
|
||||
if (m_windowGeometry.value().size() == 5)
|
||||
{
|
||||
wg.x = m_windowGeometry.value()[0];
|
||||
wg.y = m_windowGeometry.value()[1];
|
||||
wg.width = m_windowGeometry.value()[2];
|
||||
wg.height = m_windowGeometry.value()[3];
|
||||
wg.isMaximized = m_windowGeometry.value()[4];
|
||||
}
|
||||
if (m_windowController()) return m_windowController()->mdiWindowGeometry();
|
||||
else return RimMdiWindowGeometry();
|
||||
|
||||
return wg;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimViewWindow::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
if ( m_windowController() )
|
||||
{
|
||||
if ( changedField == getShowWindowField() )
|
||||
{
|
||||
m_windowController()->showWindowFieldChangedByUi();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimViewWindow::updateViewerWidgetWindowTitle()
|
||||
{
|
||||
if ( viewWidget() )
|
||||
{
|
||||
caf::PdmUiFieldHandle* uiFieldHandle = this->userDescriptionField()->uiCapability();
|
||||
if ( uiFieldHandle )
|
||||
{
|
||||
QVariant v = uiFieldHandle->uiValue();
|
||||
viewWidget()->setWindowTitle(v.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimViewWindow::setAsMDI(int mainWindowID)
|
||||
{
|
||||
if ( !m_windowController() )
|
||||
{
|
||||
m_windowController = new RimMdiWindowController;
|
||||
RimMdiWindowGeometry mwg;
|
||||
mwg.mainWindowID = mainWindowID;
|
||||
setMdiWindowGeometry(mwg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
#include "RimView.h"
|
||||
|
||||
void RimViewWindow::initAfterRead()
|
||||
{
|
||||
if (m_windowGeometry.value().size() == 5)
|
||||
{
|
||||
RimMdiWindowGeometry wg;
|
||||
int mainWindowID = -1;
|
||||
|
||||
if (dynamic_cast<RimView*> (this))
|
||||
mainWindowID = 0;
|
||||
else
|
||||
mainWindowID = 1;
|
||||
|
||||
wg.mainWindowID = mainWindowID;
|
||||
wg.x = m_windowGeometry.value()[0];
|
||||
wg.y = m_windowGeometry.value()[1];
|
||||
wg.width = m_windowGeometry.value()[2];
|
||||
wg.height = m_windowGeometry.value()[3];
|
||||
wg.isMaximized = m_windowGeometry.value()[4];
|
||||
|
||||
setAsMDI(mainWindowID);
|
||||
setMdiWindowGeometry(wg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -20,13 +20,18 @@
|
||||
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmChildField.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RimMdiWindowController;
|
||||
|
||||
struct RimMdiWindowGeometry
|
||||
{
|
||||
RimMdiWindowGeometry() : x(0), y(0), width(-1), height(-1) {}
|
||||
bool isValid() const { return (width >= 0 && height >= 0);}
|
||||
RimMdiWindowGeometry() : mainWindowID(-1), x(0), y(0), width(-1), height(-1) {}
|
||||
bool isValid() const { return (mainWindowID >= 0 && width >= 0 && height >= 0);}
|
||||
|
||||
int mainWindowID;
|
||||
|
||||
int x;
|
||||
int y;
|
||||
@@ -42,15 +47,45 @@ public:
|
||||
RimViewWindow(void);
|
||||
virtual ~RimViewWindow(void);
|
||||
|
||||
void removeWidgetFromMDI();
|
||||
void handleViewerDeletion();
|
||||
void updateViewerWidgetBasic();
|
||||
|
||||
void setAs3DMDI() { setAsMDI(0); }
|
||||
void setAsPlotMDI() { setAsMDI(1); }
|
||||
|
||||
void setMdiWindowGeometry(const RimMdiWindowGeometry& windowGeometry);
|
||||
RimMdiWindowGeometry mdiWindowGeometry();
|
||||
|
||||
virtual QImage snapshotWindowContent() = 0;
|
||||
virtual void zoomAll() = 0;
|
||||
virtual QImage snapshotWindowContent() = 0;
|
||||
virtual QWidget* viewWidget() = 0;
|
||||
|
||||
virtual QWidget* viewWidget() = 0;
|
||||
virtual void zoomAll() = 0;
|
||||
|
||||
private:
|
||||
protected:
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
|
||||
|
||||
///////// Interface for the Window controller
|
||||
friend class RimMdiWindowController;
|
||||
|
||||
virtual caf::PdmField<bool>* getShowWindowField() = 0;
|
||||
virtual QWidget* createViewWidget(QWidget* mainWindowParent) = 0;
|
||||
virtual void updateViewWidgetAfterCreation() {};
|
||||
virtual void updateViewerWidgetWindowTitle(); // Has real default implementation
|
||||
virtual void deleteViewWidget() = 0;
|
||||
|
||||
|
||||
//////////
|
||||
|
||||
void setAsMDI(int mainWindowID);
|
||||
|
||||
caf::PdmChildField<RimMdiWindowController*> m_windowController;
|
||||
|
||||
// Obsoleted field
|
||||
virtual void initAfterRead() override;
|
||||
caf::PdmField< std::vector<int> > m_windowGeometry;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
@@ -86,52 +86,11 @@ RimWellLogPlot::RimWellLogPlot()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellLogPlot::~RimWellLogPlot()
|
||||
{
|
||||
if (RiaApplication::instance()->mainPlotWindow())
|
||||
{
|
||||
RiaApplication::instance()->mainPlotWindow()->removeViewer(m_viewer);
|
||||
}
|
||||
removeWidgetFromMDI();
|
||||
|
||||
detachAllCurves();
|
||||
m_tracks.deleteAllChildObjects();
|
||||
|
||||
delete m_viewer;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::updateViewerWidget()
|
||||
{
|
||||
RiuMainPlotWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
|
||||
if (!mainPlotWindow) return;
|
||||
|
||||
if (m_showWindow())
|
||||
{
|
||||
if (!m_viewer)
|
||||
{
|
||||
m_viewer = new RiuWellLogPlot(this, mainPlotWindow);
|
||||
|
||||
recreateTrackPlots();
|
||||
|
||||
mainPlotWindow->addViewer(m_viewer, this->mdiWindowGeometry());
|
||||
mainPlotWindow->setActiveViewer(m_viewer);
|
||||
}
|
||||
|
||||
updateViewerWidgetWindowTitle();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_viewer)
|
||||
{
|
||||
this->setMdiWindowGeometry(mainPlotWindow->windowGeometryForViewer(m_viewer));
|
||||
|
||||
mainPlotWindow->removeViewer(m_viewer);
|
||||
detachAllCurves();
|
||||
|
||||
delete m_viewer;
|
||||
m_viewer = NULL;
|
||||
}
|
||||
}
|
||||
deleteViewWidget();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -147,7 +106,7 @@ void RimWellLogPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
|
||||
}
|
||||
else
|
||||
{
|
||||
updateViewerWidget();
|
||||
updateViewerWidgetBasic();
|
||||
}
|
||||
|
||||
uiCapability()->updateUiIconFromToggleField();
|
||||
@@ -391,21 +350,6 @@ void RimWellLogPlot::depthZoomMinMax(double* minimumDepth, double* maximumDepth)
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::setupBeforeSave()
|
||||
{
|
||||
if (m_viewer)
|
||||
{
|
||||
if (RiaApplication::instance()->mainPlotWindow())
|
||||
{
|
||||
this->setMdiWindowGeometry(RiaApplication::instance()->mainPlotWindow()->windowGeometryForViewer(m_viewer));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -427,7 +371,7 @@ void RimWellLogPlot::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::loadDataAndUpdate()
|
||||
{
|
||||
updateViewerWidget();
|
||||
updateViewerWidgetBasic();
|
||||
updateTracks();
|
||||
}
|
||||
|
||||
@@ -548,29 +492,27 @@ QString RimWellLogPlot::description() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::updateViewerWidgetWindowTitle()
|
||||
QWidget* RimWellLogPlot::createViewWidget(QWidget* mainWindowParent)
|
||||
{
|
||||
if (m_viewer)
|
||||
{
|
||||
m_viewer->setWindowTitle(m_userName);
|
||||
}
|
||||
m_viewer = new RiuWellLogPlot(this, mainWindowParent);
|
||||
|
||||
recreateTrackPlots();
|
||||
|
||||
return m_viewer;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::handleViewerDeletion()
|
||||
void RimWellLogPlot::deleteViewWidget()
|
||||
{
|
||||
m_showWindow = false;
|
||||
detachAllCurves();
|
||||
|
||||
if (m_viewer)
|
||||
{
|
||||
detachAllCurves();
|
||||
m_viewer = NULL;
|
||||
}
|
||||
|
||||
uiCapability()->updateUiIconFromToggleField();
|
||||
updateConnectedEditors();
|
||||
if (m_viewer)
|
||||
{
|
||||
m_viewer->deleteLater();
|
||||
m_viewer = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -91,7 +91,6 @@ protected:
|
||||
|
||||
// Overridden PDM methods
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||
virtual void setupBeforeSave();
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
|
||||
virtual caf::PdmFieldHandle* objectToggleField();
|
||||
virtual caf::PdmFieldHandle* userDescriptionField() { return &m_userName; }
|
||||
@@ -100,13 +99,16 @@ protected:
|
||||
|
||||
|
||||
private:
|
||||
void updateViewerWidget();
|
||||
void updateViewerWidgetWindowTitle();
|
||||
void applyZoomAllDepths();
|
||||
void applyDepthZoomFromVisibleDepth();
|
||||
void recreateTrackPlots();
|
||||
void detachAllCurves();
|
||||
void handleViewerDeletion();
|
||||
|
||||
// RimViewWindow overrides
|
||||
|
||||
virtual caf::PdmField<bool>* getShowWindowField() override { return &m_showWindow; }
|
||||
virtual QWidget* createViewWidget(QWidget* mainWindowParent) override;
|
||||
virtual void deleteViewWidget() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_showWindow;
|
||||
|
@@ -72,7 +72,11 @@ RimWellLogTrack::~RimWellLogTrack()
|
||||
{
|
||||
curves.deleteAllChildObjects();
|
||||
|
||||
delete m_wellLogTrackPlotWidget;
|
||||
if (m_wellLogTrackPlotWidget)
|
||||
{
|
||||
m_wellLogTrackPlotWidget->deleteLater();
|
||||
m_wellLogTrackPlotWidget = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -85,6 +85,8 @@ RimSummaryPlot::RimSummaryPlot()
|
||||
|
||||
CAF_PDM_InitField(&m_isAutoZoom, "AutoZoom", true, "Auto Zoom", "", "", "");
|
||||
m_isAutoZoom.uiCapability()->setUiHidden(true);
|
||||
|
||||
setAsPlotMDI();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -92,29 +94,14 @@ RimSummaryPlot::RimSummaryPlot()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryPlot::~RimSummaryPlot()
|
||||
{
|
||||
if (RiaApplication::instance()->mainPlotWindow())
|
||||
{
|
||||
RiaApplication::instance()->mainPlotWindow()->removeViewer(m_qwtPlot);
|
||||
}
|
||||
removeWidgetFromMDI();
|
||||
|
||||
deletePlotWidget();
|
||||
deleteViewWidget();
|
||||
|
||||
m_curves.deleteAllChildObjects();
|
||||
m_curveFilters.deleteAllChildObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::deletePlotWidget()
|
||||
{
|
||||
if (m_qwtPlot)
|
||||
{
|
||||
m_qwtPlot->deleteLater();
|
||||
m_qwtPlot = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -367,22 +354,6 @@ void RimSummaryPlot::updateTimeAxis()
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::handleViewerDeletion()
|
||||
{
|
||||
m_showWindow = false;
|
||||
|
||||
if (m_qwtPlot)
|
||||
{
|
||||
detachAllCurves();
|
||||
}
|
||||
|
||||
uiCapability()->updateUiIconFromToggleField();
|
||||
updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -512,7 +483,7 @@ void RimSummaryPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
|
||||
}
|
||||
else
|
||||
{
|
||||
updateViewerWidget();
|
||||
updateViewerWidgetBasic();
|
||||
}
|
||||
|
||||
uiCapability()->updateUiIconFromToggleField();
|
||||
@@ -524,16 +495,6 @@ void RimSummaryPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::setupBeforeSave()
|
||||
{
|
||||
if (m_qwtPlot && RiaApplication::instance()->mainPlotWindow())
|
||||
{
|
||||
this->setMdiWindowGeometry(RiaApplication::instance()->mainPlotWindow()->windowGeometryForViewer(m_qwtPlot));
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@@ -578,7 +539,7 @@ void RimSummaryPlot::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::loadDataAndUpdate()
|
||||
{
|
||||
updateViewerWidget();
|
||||
updateViewerWidgetBasic();
|
||||
|
||||
for (RimSummaryCurveFilter* curveFilter: m_curveFilters)
|
||||
{
|
||||
@@ -669,44 +630,37 @@ QString RimSummaryPlot::description() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::updateViewerWidget()
|
||||
QWidget* RimSummaryPlot::createViewWidget(QWidget* mainWindowParent)
|
||||
{
|
||||
RiuMainPlotWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
|
||||
if (!mainPlotWindow) return;
|
||||
|
||||
if (m_showWindow())
|
||||
if (!m_qwtPlot)
|
||||
{
|
||||
if (!m_qwtPlot)
|
||||
m_qwtPlot = new RiuSummaryQwtPlot(this, mainWindowParent);
|
||||
|
||||
for(RimSummaryCurveFilter* curveFilter: m_curveFilters)
|
||||
{
|
||||
m_qwtPlot = new RiuSummaryQwtPlot(this, mainPlotWindow);
|
||||
|
||||
for(RimSummaryCurveFilter* curveFilter: m_curveFilters)
|
||||
{
|
||||
curveFilter->setParentQwtPlot(m_qwtPlot);
|
||||
}
|
||||
|
||||
for(RimSummaryCurve* curve : m_curves)
|
||||
{
|
||||
curve->setParentQwtPlot(m_qwtPlot);
|
||||
}
|
||||
|
||||
mainPlotWindow->addViewer(m_qwtPlot, this->mdiWindowGeometry());
|
||||
mainPlotWindow->setActiveViewer(m_qwtPlot);
|
||||
curveFilter->setParentQwtPlot(m_qwtPlot);
|
||||
}
|
||||
|
||||
updateViewerWidgetWindowTitle();
|
||||
for(RimSummaryCurve* curve : m_curves)
|
||||
{
|
||||
curve->setParentQwtPlot(m_qwtPlot);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
return m_qwtPlot;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::deleteViewWidget()
|
||||
{
|
||||
detachAllCurves();
|
||||
|
||||
if (m_qwtPlot)
|
||||
{
|
||||
if (m_qwtPlot)
|
||||
{
|
||||
this->setMdiWindowGeometry(mainPlotWindow->windowGeometryForViewer(m_qwtPlot));
|
||||
|
||||
mainPlotWindow->removeViewer(m_qwtPlot);
|
||||
detachAllCurves();
|
||||
|
||||
deletePlotWidget();
|
||||
}
|
||||
m_qwtPlot->deleteLater();
|
||||
m_qwtPlot = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -64,7 +64,7 @@ public:
|
||||
|
||||
void loadDataAndUpdate();
|
||||
|
||||
void handleViewerDeletion();
|
||||
void detachAllCurves();
|
||||
void updateCaseNameHasChanged();
|
||||
|
||||
void updateAxes();
|
||||
@@ -91,16 +91,11 @@ protected:
|
||||
virtual caf::PdmFieldHandle* objectToggleField() { return &m_showWindow; }
|
||||
virtual caf::PdmFieldHandle* userDescriptionField() { return &m_userName; }
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
virtual void setupBeforeSave() override;
|
||||
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override;
|
||||
|
||||
virtual QImage snapshotWindowContent() override;
|
||||
|
||||
private:
|
||||
void updateViewerWidget();
|
||||
void updateViewerWidgetWindowTitle();
|
||||
void detachAllCurves();
|
||||
void deletePlotWidget();
|
||||
|
||||
void updateAxis(RimDefines::PlotAxis plotAxis);
|
||||
std::vector<RimSummaryCurve*> curvesForAxis(RimDefines::PlotAxis plotAxis) const;
|
||||
@@ -109,6 +104,12 @@ private:
|
||||
void updateTimeAxis();
|
||||
void setZoomIntervalsInQwtPlot();
|
||||
|
||||
// RimViewWindow overrides
|
||||
|
||||
virtual caf::PdmField<bool>* getShowWindowField() override { return &m_showWindow; }
|
||||
virtual QWidget* createViewWidget(QWidget* mainWindowParent) override;
|
||||
void updateViewerWidgetWindowTitle() override;
|
||||
virtual void deleteViewWidget() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_showWindow;
|
||||
|
@@ -766,6 +766,7 @@ RimMdiWindowGeometry RiuMainPlotWindow::windowGeometryForWidget(QWidget* widget)
|
||||
|
||||
if (widget)
|
||||
{
|
||||
geo.mainWindowID = 1;
|
||||
geo.x = widget->pos().x();
|
||||
geo.y = widget->pos().y();
|
||||
geo.width = widget->size().width();
|
||||
|
@@ -57,9 +57,9 @@ public:
|
||||
void initializeGuiNewProjectLoaded();
|
||||
void cleanupGuiBeforeProjectClose();
|
||||
|
||||
void removeViewer( QWidget* viewer );
|
||||
void addViewer(QWidget* viewer, const RimMdiWindowGeometry& windowsGeometry);
|
||||
void setActiveViewer(QWidget* subWindow);
|
||||
void removeViewer( QWidget* viewer ) override;
|
||||
void addViewer(QWidget* viewer, const RimMdiWindowGeometry& windowsGeometry) override;
|
||||
void setActiveViewer(QWidget* subWindow) override;
|
||||
|
||||
caf::PdmUiTreeView* projectTreeView() { return m_projectTreeView;}
|
||||
|
||||
@@ -71,7 +71,7 @@ public:
|
||||
|
||||
void setExpanded(const caf::PdmUiItem* uiItem, bool expanded);
|
||||
|
||||
RimMdiWindowGeometry windowGeometryForViewer(QWidget* viewer);
|
||||
RimMdiWindowGeometry windowGeometryForViewer(QWidget* viewer) override;
|
||||
RimMdiWindowGeometry windowGeometryForWidget(QWidget* widget);
|
||||
|
||||
void tileWindows();
|
||||
|
@@ -1638,6 +1638,7 @@ RimMdiWindowGeometry RiuMainWindow::windowGeometryForWidget(QWidget* widget)
|
||||
|
||||
if (widget)
|
||||
{
|
||||
geo.mainWindowID = 0;
|
||||
geo.x = widget->pos().x();
|
||||
geo.y = widget->pos().y();
|
||||
geo.width = widget->size().width();
|
||||
|
@@ -77,9 +77,9 @@ public:
|
||||
void cleanupGuiCaseClose();
|
||||
void cleanupGuiBeforeProjectClose();
|
||||
|
||||
void removeViewer( QWidget* viewer );
|
||||
void addViewer(QWidget* viewer, const RimMdiWindowGeometry& windowsGeometry);
|
||||
void setActiveViewer(QWidget* subWindow);
|
||||
void removeViewer( QWidget* viewer ) override;
|
||||
void addViewer(QWidget* viewer, const RimMdiWindowGeometry& windowsGeometry) override;
|
||||
void setActiveViewer(QWidget* subWindow) override;
|
||||
|
||||
void setResultInfo(const QString& info) const;
|
||||
|
||||
|
@@ -19,6 +19,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <QMainWindow>
|
||||
struct RimMdiWindowGeometry;
|
||||
|
||||
class RiuMainWindowBase : public QMainWindow
|
||||
{
|
||||
@@ -29,6 +30,12 @@ public:
|
||||
|
||||
virtual QString mainWindowName() = 0;
|
||||
|
||||
virtual void removeViewer( QWidget* viewer ) = 0;
|
||||
virtual void addViewer(QWidget* viewer, const RimMdiWindowGeometry& windowsGeometry)= 0;
|
||||
virtual void setActiveViewer(QWidget* subWindow) = 0;
|
||||
|
||||
virtual RimMdiWindowGeometry windowGeometryForViewer(QWidget* viewer) = 0;
|
||||
|
||||
void loadWinGeoAndDockToolBarLayout();
|
||||
void saveWinGeoAndDockToolBarLayout();
|
||||
void showWindow();
|
||||
|
@@ -151,6 +151,7 @@ RiuSummaryQwtPlot::~RiuSummaryQwtPlot()
|
||||
|
||||
if (m_plotDefinition)
|
||||
{
|
||||
m_plotDefinition->detachAllCurves();
|
||||
m_plotDefinition->handleViewerDeletion();
|
||||
}
|
||||
|
||||
|
@@ -182,8 +182,7 @@ RiuViewer::~RiuViewer()
|
||||
{
|
||||
if (m_rimView)
|
||||
{
|
||||
m_rimView->showWindow = false;
|
||||
m_rimView->uiCapability()->updateUiIconFromToggleField();
|
||||
m_rimView->handleViewerDeletion();
|
||||
|
||||
m_rimView->cameraPosition = m_mainCamera->viewMatrix();
|
||||
m_rimView->cameraPointOfInterest = pointOfInterest();
|
||||
|
@@ -65,6 +65,7 @@ RiuWellLogPlot::~RiuWellLogPlot()
|
||||
{
|
||||
if (m_plotDefinition)
|
||||
{
|
||||
m_plotDefinition->detachAllCurves();
|
||||
m_plotDefinition->handleViewerDeletion();
|
||||
}
|
||||
}
|
||||
|
@@ -72,8 +72,8 @@ private slots:
|
||||
private:
|
||||
QHBoxLayout* m_layout;
|
||||
QScrollBar* m_scrollBar;
|
||||
QList<QwtLegend*> m_legends;
|
||||
QList<RiuWellLogTrack*> m_trackPlots;
|
||||
QList<QPointer<QwtLegend> > m_legends;
|
||||
QList<QPointer<RiuWellLogTrack> > m_trackPlots;
|
||||
caf::PdmPointer<RimWellLogPlot> m_plotDefinition;
|
||||
QTimer* m_scheduleUpdateChildrenLayoutTimer;
|
||||
};
|
||||
|
Reference in New Issue
Block a user