mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1380 Major refactor of the management of views to fix the active view problem. Expect some trouble following this.
This commit is contained in:
parent
a914e38d53
commit
442d9d2e41
@ -1116,6 +1116,25 @@ RimView* RiaApplication::activeReservoirView()
|
|||||||
return m_activeReservoirView;
|
return m_activeReservoirView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimViewWindow* RiaApplication::activePlotWindow() const
|
||||||
|
{
|
||||||
|
RimViewWindow* viewWindow = nullptr;
|
||||||
|
|
||||||
|
if ( m_mainPlotWindow )
|
||||||
|
{
|
||||||
|
QList<QMdiSubWindow*> subwindows = m_mainPlotWindow->subWindowList(QMdiArea::StackingOrder);
|
||||||
|
if ( subwindows.size() > 0 )
|
||||||
|
{
|
||||||
|
viewWindow = RiuInterfaceToViewWindow::viewWindowFromWidget(subwindows.back()->widget());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return viewWindow;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -1124,54 +1143,6 @@ void RiaApplication::setActiveReservoirView(RimView* rv)
|
|||||||
m_activeReservoirView = rv;
|
m_activeReservoirView = rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RiaApplication::setActiveWellLogPlot(RimWellLogPlot* wlp)
|
|
||||||
{
|
|
||||||
m_activeWellLogPlot = wlp;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
RimWellLogPlot* RiaApplication::activeWellLogPlot()
|
|
||||||
{
|
|
||||||
return m_activeWellLogPlot;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RiaApplication::setActiveSummaryPlot(RimSummaryPlot* sp)
|
|
||||||
{
|
|
||||||
m_activeSummaryPlot = sp;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
RimSummaryPlot* RiaApplication::activeSummaryPlot()
|
|
||||||
{
|
|
||||||
return m_activeSummaryPlot;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RiaApplication::setActiveWellAllocationPlot(RimWellAllocationPlot* wap)
|
|
||||||
{
|
|
||||||
m_activeWellAllocationPlot = wap;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
RimWellAllocationPlot* RiaApplication::activeWellAllocationPlot()
|
|
||||||
{
|
|
||||||
return m_activeWellAllocationPlot;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -1620,42 +1591,20 @@ RimViewWindow* RiaApplication::activeViewWindow()
|
|||||||
{
|
{
|
||||||
RimViewWindow* viewWindow = NULL;
|
RimViewWindow* viewWindow = NULL;
|
||||||
|
|
||||||
QWidget* topLevelWidget = RiaApplication::activeWindow();
|
QWidget* mainWindowWidget = RiaApplication::activeWindow();
|
||||||
|
|
||||||
if (dynamic_cast<RiuMainWindow*>(topLevelWidget))
|
if (dynamic_cast<RiuMainWindow*>(mainWindowWidget))
|
||||||
{
|
{
|
||||||
viewWindow = RiaApplication::instance()->activeReservoirView();
|
viewWindow = RiaApplication::instance()->activeReservoirView();
|
||||||
}
|
}
|
||||||
|
else if (dynamic_cast<RiuMainPlotWindow*>(mainWindowWidget))
|
||||||
if (dynamic_cast<RiuMainPlotWindow*>(topLevelWidget))
|
|
||||||
{
|
{
|
||||||
RiuMainPlotWindow* mainPlotWindow = dynamic_cast<RiuMainPlotWindow*>(topLevelWidget);
|
RiuMainPlotWindow* mainPlotWindow = dynamic_cast<RiuMainPlotWindow*>(mainWindowWidget);
|
||||||
|
|
||||||
QList<QMdiSubWindow*> subwindows = mainPlotWindow->subWindowList(QMdiArea::StackingOrder);
|
QList<QMdiSubWindow*> subwindows = mainPlotWindow->subWindowList(QMdiArea::StackingOrder);
|
||||||
if (subwindows.size() > 0)
|
if (subwindows.size() > 0)
|
||||||
{
|
{
|
||||||
RiuSummaryQwtPlot* summaryQwtPlot = dynamic_cast<RiuSummaryQwtPlot*>(subwindows.back()->widget());
|
viewWindow = RiuInterfaceToViewWindow::viewWindowFromWidget(subwindows.back()->widget());
|
||||||
if (summaryQwtPlot)
|
|
||||||
{
|
|
||||||
viewWindow = summaryQwtPlot->ownerPlotDefinition();
|
|
||||||
}
|
|
||||||
|
|
||||||
RiuWellLogPlot* wellLogPlot = dynamic_cast<RiuWellLogPlot*>(subwindows.back()->widget());
|
|
||||||
if (wellLogPlot)
|
|
||||||
{
|
|
||||||
viewWindow = wellLogPlot->ownerPlotDefinition();
|
|
||||||
}
|
|
||||||
|
|
||||||
RiuWellAllocationPlot* wellAllocationPlot = dynamic_cast<RiuWellAllocationPlot*>(subwindows.back()->widget());
|
|
||||||
if (wellAllocationPlot)
|
|
||||||
{
|
|
||||||
viewWindow = wellAllocationPlot->ownerPlotDefinition();
|
|
||||||
}
|
|
||||||
|
|
||||||
RiuFlowCharacteristicsPlot* flowCharacteristicsPlot = dynamic_cast<RiuFlowCharacteristicsPlot*>(subwindows.back()->widget());
|
|
||||||
if (flowCharacteristicsPlot)
|
|
||||||
{
|
|
||||||
viewWindow = flowCharacteristicsPlot->ownerPlotDefinition();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,14 +96,7 @@ public:
|
|||||||
RimView* activeReservoirView();
|
RimView* activeReservoirView();
|
||||||
const RimView* activeReservoirView() const;
|
const RimView* activeReservoirView() const;
|
||||||
|
|
||||||
void setActiveWellLogPlot(RimWellLogPlot*);
|
RimViewWindow* activePlotWindow() const;
|
||||||
RimWellLogPlot* activeWellLogPlot();
|
|
||||||
|
|
||||||
void setActiveSummaryPlot(RimSummaryPlot*);
|
|
||||||
RimSummaryPlot* activeSummaryPlot();
|
|
||||||
|
|
||||||
void setActiveWellAllocationPlot(RimWellAllocationPlot*);
|
|
||||||
RimWellAllocationPlot* activeWellAllocationPlot();
|
|
||||||
|
|
||||||
void scheduleDisplayModelUpdateAndRedraw(RimView* resViewToUpdate);
|
void scheduleDisplayModelUpdateAndRedraw(RimView* resViewToUpdate);
|
||||||
|
|
||||||
@ -228,9 +221,6 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
caf::PdmPointer<RimView> m_activeReservoirView;
|
caf::PdmPointer<RimView> m_activeReservoirView;
|
||||||
caf::PdmPointer<RimWellLogPlot> m_activeWellLogPlot;
|
|
||||||
caf::PdmPointer<RimSummaryPlot> m_activeSummaryPlot;
|
|
||||||
caf::PdmPointer<RimWellAllocationPlot> m_activeWellAllocationPlot;
|
|
||||||
|
|
||||||
caf::PdmPointer<RimProject> m_project;
|
caf::PdmPointer<RimProject> m_project;
|
||||||
|
|
||||||
|
@ -35,7 +35,8 @@ CAF_CMD_SOURCE_INIT(RicShowContributingWellsFromPlotFeature, "RicShowContributin
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RicShowContributingWellsFromPlotFeature::isCommandEnabled()
|
bool RicShowContributingWellsFromPlotFeature::isCommandEnabled()
|
||||||
{
|
{
|
||||||
RimWellAllocationPlot* wellAllocationPlot = RiaApplication::instance()->activeWellAllocationPlot();
|
RimWellAllocationPlot* wellAllocationPlot = dynamic_cast<RimWellAllocationPlot*>(RiaApplication::instance()->activePlotWindow());
|
||||||
|
|
||||||
if (wellAllocationPlot) return true;
|
if (wellAllocationPlot) return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -46,7 +47,8 @@ bool RicShowContributingWellsFromPlotFeature::isCommandEnabled()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicShowContributingWellsFromPlotFeature::onActionTriggered(bool isChecked)
|
void RicShowContributingWellsFromPlotFeature::onActionTriggered(bool isChecked)
|
||||||
{
|
{
|
||||||
RimWellAllocationPlot* wellAllocationPlot = RiaApplication::instance()->activeWellAllocationPlot();
|
RimWellAllocationPlot* wellAllocationPlot = dynamic_cast<RimWellAllocationPlot*>(RiaApplication::instance()->activePlotWindow());
|
||||||
|
|
||||||
if (!wellAllocationPlot) return;
|
if (!wellAllocationPlot) return;
|
||||||
|
|
||||||
int timeStep = wellAllocationPlot->timeStep();
|
int timeStep = wellAllocationPlot->timeStep();
|
||||||
|
@ -101,7 +101,7 @@ RimSummaryPlot* RicNewGridTimeHistoryCurveFeature::userSelectedSummaryPlot()
|
|||||||
|
|
||||||
if (!defaultSelectedPlot)
|
if (!defaultSelectedPlot)
|
||||||
{
|
{
|
||||||
defaultSelectedPlot = RiaApplication::instance()->activeSummaryPlot();
|
defaultSelectedPlot = dynamic_cast<RimSummaryPlot*>( RiaApplication::instance()->activePlotWindow() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!defaultSelectedPlot && summaryPlotColl->summaryPlots().size() > 0)
|
if (!defaultSelectedPlot && summaryPlotColl->summaryPlots().size() > 0)
|
||||||
|
@ -66,53 +66,11 @@ void RicViewZoomAllFeature::onActionTriggered(bool isChecked)
|
|||||||
QList<QMdiSubWindow*> subwindows = mainPlotWindow->subWindowList(QMdiArea::StackingOrder);
|
QList<QMdiSubWindow*> subwindows = mainPlotWindow->subWindowList(QMdiArea::StackingOrder);
|
||||||
if (subwindows.size() > 0)
|
if (subwindows.size() > 0)
|
||||||
{
|
{
|
||||||
|
RimViewWindow* viewWindow = RiuInterfaceToViewWindow::viewWindowFromWidget(subwindows.back()->widget());
|
||||||
|
|
||||||
|
if (viewWindow)
|
||||||
{
|
{
|
||||||
RiuSummaryQwtPlot* summaryQwtPlot = dynamic_cast<RiuSummaryQwtPlot*>(subwindows.back()->widget());
|
viewWindow->zoomAll();
|
||||||
if (summaryQwtPlot)
|
|
||||||
{
|
|
||||||
RimViewWindow* viewWindow = summaryQwtPlot->ownerPlotDefinition();
|
|
||||||
|
|
||||||
viewWindow->zoomAll();
|
|
||||||
summaryQwtPlot->replot();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
RiuWellLogPlot* wellLogPlot = dynamic_cast<RiuWellLogPlot*>(subwindows.back()->widget());
|
|
||||||
if (wellLogPlot)
|
|
||||||
{
|
|
||||||
RimViewWindow* viewWindow = wellLogPlot->ownerPlotDefinition();
|
|
||||||
viewWindow->zoomAll();
|
|
||||||
wellLogPlot->update();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
RiuWellAllocationPlot* wellAllocationPlot = dynamic_cast<RiuWellAllocationPlot*>(subwindows.back()->widget());
|
|
||||||
if (wellAllocationPlot)
|
|
||||||
{
|
|
||||||
RimWellAllocationPlot* viewWindow = wellAllocationPlot->ownerPlotDefinition();
|
|
||||||
viewWindow->zoomAll();
|
|
||||||
wellAllocationPlot->update();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
RiuFlowCharacteristicsPlot* flowCharPlot = dynamic_cast<RiuFlowCharacteristicsPlot*>(subwindows.back()->widget());
|
|
||||||
if (flowCharPlot)
|
|
||||||
{
|
|
||||||
RimFlowCharacteristicsPlot* viewWindow = flowCharPlot->ownerPlotDefinition();
|
|
||||||
viewWindow->zoomAll();
|
|
||||||
flowCharPlot->update();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,7 @@ ${CEE_CURRENT_LIST_DIR}RiuCursors.cpp
|
|||||||
${CEE_CURRENT_LIST_DIR}RiuDragDrop.cpp
|
${CEE_CURRENT_LIST_DIR}RiuDragDrop.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RiuFemResultTextBuilder.cpp
|
${CEE_CURRENT_LIST_DIR}RiuFemResultTextBuilder.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RiuGeoQuestNavigation.cpp
|
${CEE_CURRENT_LIST_DIR}RiuGeoQuestNavigation.cpp
|
||||||
|
${CEE_CURRENT_LIST_DIR}RiuInterfaceToViewWindow.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RiuLineSegmentQwtPlotCurve.cpp
|
${CEE_CURRENT_LIST_DIR}RiuLineSegmentQwtPlotCurve.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RiuMainPlotWindow.cpp
|
${CEE_CURRENT_LIST_DIR}RiuMainPlotWindow.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RiuMainWindow.cpp
|
${CEE_CURRENT_LIST_DIR}RiuMainWindow.cpp
|
||||||
|
19
ApplicationCode/UserInterface/RiuInterfaceToViewWindow.cpp
Normal file
19
ApplicationCode/UserInterface/RiuInterfaceToViewWindow.cpp
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#include "RiuInterfaceToViewWindow.h"
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimViewWindow* RiuInterfaceToViewWindow::viewWindowFromWidget(QWidget* possibleViewWindowWidget)
|
||||||
|
{
|
||||||
|
auto interfaceToViewWindow = dynamic_cast<RiuInterfaceToViewWindow*>(possibleViewWindowWidget);
|
||||||
|
if ( interfaceToViewWindow )
|
||||||
|
{
|
||||||
|
return (interfaceToViewWindow->ownerViewWindow());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
@ -19,6 +19,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class RimViewWindow;
|
class RimViewWindow;
|
||||||
|
class QWidget;
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
//
|
//
|
||||||
@ -29,5 +30,6 @@ class RiuInterfaceToViewWindow
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual RimViewWindow* ownerViewWindow() const = 0;
|
virtual RimViewWindow* ownerViewWindow() const = 0;
|
||||||
|
static RimViewWindow* viewWindowFromWidget( QWidget* possibleViewWindowWidget);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -490,58 +490,13 @@ void RiuMainPlotWindow::slotSubWindowActivated(QMdiSubWindow* subWindow)
|
|||||||
RimProject * proj = RiaApplication::instance()->project();
|
RimProject * proj = RiaApplication::instance()->project();
|
||||||
if (!proj) return;
|
if (!proj) return;
|
||||||
|
|
||||||
|
// Select in Project Tree
|
||||||
|
|
||||||
|
RimViewWindow* viewWindow = RiuInterfaceToViewWindow::viewWindowFromWidget(subWindow->widget());
|
||||||
|
|
||||||
|
if (viewWindow)
|
||||||
{
|
{
|
||||||
RiuWellLogPlot* wellLogPlotViewer = dynamic_cast<RiuWellLogPlot*>(subWindow->widget());
|
projectTreeView()->selectAsCurrentItem(viewWindow);
|
||||||
if (wellLogPlotViewer)
|
|
||||||
{
|
|
||||||
RimWellLogPlot* wellLogPlot = wellLogPlotViewer->ownerPlotDefinition();
|
|
||||||
|
|
||||||
if (wellLogPlot != RiaApplication::instance()->activeWellLogPlot())
|
|
||||||
{
|
|
||||||
RiaApplication::instance()->setActiveWellLogPlot(wellLogPlot);
|
|
||||||
projectTreeView()->selectAsCurrentItem(wellLogPlot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
RiaApplication::instance()->setActiveWellLogPlot(NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
RiuSummaryQwtPlot* summaryPlotViewer = dynamic_cast<RiuSummaryQwtPlot*>(subWindow->widget());
|
|
||||||
if (summaryPlotViewer)
|
|
||||||
{
|
|
||||||
RimSummaryPlot* summaryPlot = summaryPlotViewer->ownerPlotDefinition();
|
|
||||||
|
|
||||||
if (summaryPlot != RiaApplication::instance()->activeSummaryPlot())
|
|
||||||
{
|
|
||||||
RiaApplication::instance()->setActiveSummaryPlot(summaryPlot);
|
|
||||||
projectTreeView()->selectAsCurrentItem(summaryPlot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
RiaApplication::instance()->setActiveSummaryPlot(NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
RiuWellAllocationPlot* wellAllocationPlotWidget = dynamic_cast<RiuWellAllocationPlot*>(subWindow->widget());
|
|
||||||
if (wellAllocationPlotWidget)
|
|
||||||
{
|
|
||||||
RimWellAllocationPlot* wellAllocationPlot = wellAllocationPlotWidget->ownerPlotDefinition();
|
|
||||||
|
|
||||||
if (wellAllocationPlot != RiaApplication::instance()->activeWellAllocationPlot())
|
|
||||||
{
|
|
||||||
RiaApplication::instance()->setActiveWellAllocationPlot(wellAllocationPlot);
|
|
||||||
projectTreeView()->selectAsCurrentItem(wellAllocationPlot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
RiaApplication::instance()->setActiveWellAllocationPlot(nullptr);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -618,66 +573,28 @@ void RiuMainPlotWindow::selectedObjectsChanged()
|
|||||||
|
|
||||||
if (!firstSelectedObject) return;
|
if (!firstSelectedObject) return;
|
||||||
|
|
||||||
// Well log plot
|
RimViewWindow* selectedWindow = dynamic_cast<RimViewWindow*>(firstSelectedObject);
|
||||||
|
if (!selectedWindow)
|
||||||
bool isActiveObjectChanged = false;
|
|
||||||
|
|
||||||
RimWellLogPlot* selectedWellLogPlot = dynamic_cast<RimWellLogPlot*>(firstSelectedObject);
|
|
||||||
if (!selectedWellLogPlot)
|
|
||||||
{
|
{
|
||||||
firstSelectedObject->firstAncestorOrThisOfType(selectedWellLogPlot);
|
firstSelectedObject->firstAncestorOrThisOfType(selectedWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedWellLogPlot)
|
// If we cant find the view window as an MDI sub window, we search higher in the
|
||||||
|
// project tree to find a possible parent view window that has.
|
||||||
|
if (selectedWindow && !findMdiSubWindow(selectedWindow->viewWidget()))
|
||||||
{
|
{
|
||||||
if (selectedWellLogPlot->viewWidget())
|
if (selectedWindow->parentField() && selectedWindow->parentField()->ownerObject())
|
||||||
{
|
{
|
||||||
setActiveViewer(selectedWellLogPlot->viewWidget());
|
selectedWindow->parentField()->ownerObject()->firstAncestorOrThisOfType(selectedWindow);
|
||||||
}
|
}
|
||||||
isActiveObjectChanged = true;
|
|
||||||
RiaApplication::instance()->setActiveWellLogPlot(selectedWellLogPlot);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Summary plot
|
if (selectedWindow)
|
||||||
|
|
||||||
RimSummaryPlot* selectedSummaryPlot = dynamic_cast<RimSummaryPlot*>(firstSelectedObject);
|
|
||||||
if (!selectedSummaryPlot)
|
|
||||||
{
|
{
|
||||||
firstSelectedObject->firstAncestorOrThisOfType(selectedSummaryPlot);
|
if (selectedWindow->viewWidget())
|
||||||
}
|
|
||||||
|
|
||||||
if (selectedSummaryPlot)
|
|
||||||
{
|
|
||||||
if (selectedSummaryPlot->viewWidget())
|
|
||||||
{
|
{
|
||||||
setActiveViewer(selectedSummaryPlot->viewWidget());
|
setActiveViewer(selectedWindow->viewWidget());
|
||||||
}
|
}
|
||||||
|
|
||||||
isActiveObjectChanged = true;
|
|
||||||
RiaApplication::instance()->setActiveSummaryPlot(selectedSummaryPlot);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Flow plot
|
|
||||||
|
|
||||||
RimWellAllocationPlot* wellAllocationPlot = dynamic_cast<RimWellAllocationPlot*>(firstSelectedObject);
|
|
||||||
if (!wellAllocationPlot)
|
|
||||||
{
|
|
||||||
firstSelectedObject->firstAncestorOrThisOfType(wellAllocationPlot);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wellAllocationPlot)
|
|
||||||
{
|
|
||||||
if (wellAllocationPlot->viewWidget())
|
|
||||||
{
|
|
||||||
setActiveViewer(wellAllocationPlot->viewWidget());
|
|
||||||
}
|
|
||||||
|
|
||||||
isActiveObjectChanged = true;
|
|
||||||
RiaApplication::instance()->setActiveWellAllocationPlot(wellAllocationPlot);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isActiveObjectChanged)
|
|
||||||
{
|
|
||||||
// The only way to get to this code is by selection change initiated from the project tree view
|
// The only way to get to this code is by selection change initiated from the project tree view
|
||||||
// As we are activating an MDI-window, the focus is given to this MDI-window
|
// As we are activating an MDI-window, the focus is given to this MDI-window
|
||||||
// Set focus back to the tree view to be able to continue keyboard tree view navigation
|
// Set focus back to the tree view to be able to continue keyboard tree view navigation
|
||||||
@ -775,33 +692,12 @@ RimMdiWindowGeometry RiuMainPlotWindow::windowGeometryForViewer(QWidget* viewer)
|
|||||||
QMdiSubWindow* mdiWindow = findMdiSubWindow(viewer);
|
QMdiSubWindow* mdiWindow = findMdiSubWindow(viewer);
|
||||||
if (mdiWindow)
|
if (mdiWindow)
|
||||||
{
|
{
|
||||||
return windowGeometryForWidget(mdiWindow);
|
return RiuMdiSubWindow::windowGeometryForWidget(mdiWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
RimMdiWindowGeometry geo;
|
RimMdiWindowGeometry geo;
|
||||||
return geo;
|
return geo;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
RimMdiWindowGeometry RiuMainPlotWindow::windowGeometryForWidget(QWidget* widget)
|
|
||||||
{
|
|
||||||
RimMdiWindowGeometry geo;
|
|
||||||
|
|
||||||
if (widget)
|
|
||||||
{
|
|
||||||
geo.mainWindowID = 1;
|
|
||||||
geo.x = widget->pos().x();
|
|
||||||
geo.y = widget->pos().y();
|
|
||||||
geo.width = widget->size().width();
|
|
||||||
geo.height = widget->size().height();
|
|
||||||
geo.isMaximized = widget->isMaximized();
|
|
||||||
}
|
|
||||||
|
|
||||||
return geo;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -72,7 +72,6 @@ public:
|
|||||||
void setExpanded(const caf::PdmUiItem* uiItem, bool expanded);
|
void setExpanded(const caf::PdmUiItem* uiItem, bool expanded);
|
||||||
|
|
||||||
RimMdiWindowGeometry windowGeometryForViewer(QWidget* viewer) override;
|
RimMdiWindowGeometry windowGeometryForViewer(QWidget* viewer) override;
|
||||||
RimMdiWindowGeometry windowGeometryForWidget(QWidget* widget);
|
|
||||||
|
|
||||||
void tileWindows();
|
void tileWindows();
|
||||||
bool isAnyMdiSubWindowVisible();
|
bool isAnyMdiSubWindowVisible();
|
||||||
|
@ -1640,33 +1640,13 @@ RimMdiWindowGeometry RiuMainWindow::windowGeometryForViewer(QWidget* viewer)
|
|||||||
QMdiSubWindow* mdiWindow = findMdiSubWindow(viewer);
|
QMdiSubWindow* mdiWindow = findMdiSubWindow(viewer);
|
||||||
if (mdiWindow)
|
if (mdiWindow)
|
||||||
{
|
{
|
||||||
return windowGeometryForWidget(mdiWindow);
|
return RiuMdiSubWindow::windowGeometryForWidget(mdiWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
RimMdiWindowGeometry geo;
|
RimMdiWindowGeometry geo;
|
||||||
return geo;
|
return geo;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
RimMdiWindowGeometry RiuMainWindow::windowGeometryForWidget(QWidget* widget)
|
|
||||||
{
|
|
||||||
RimMdiWindowGeometry geo;
|
|
||||||
|
|
||||||
if (widget)
|
|
||||||
{
|
|
||||||
geo.mainWindowID = 0;
|
|
||||||
geo.x = widget->pos().x();
|
|
||||||
geo.y = widget->pos().y();
|
|
||||||
geo.width = widget->size().width();
|
|
||||||
geo.height = widget->size().height();
|
|
||||||
geo.isMaximized = widget->isMaximized();
|
|
||||||
}
|
|
||||||
|
|
||||||
return geo;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -105,7 +105,6 @@ public:
|
|||||||
void setExpanded(const caf::PdmUiItem* uiItem, bool expanded);
|
void setExpanded(const caf::PdmUiItem* uiItem, bool expanded);
|
||||||
|
|
||||||
RimMdiWindowGeometry windowGeometryForViewer(QWidget* viewer);
|
RimMdiWindowGeometry windowGeometryForViewer(QWidget* viewer);
|
||||||
RimMdiWindowGeometry windowGeometryForWidget(QWidget* widget);
|
|
||||||
|
|
||||||
void tileWindows();
|
void tileWindows();
|
||||||
bool isAnyMdiSubWindowVisible();
|
bool isAnyMdiSubWindowVisible();
|
||||||
|
@ -53,30 +53,58 @@ void RiuMdiSubWindow::closeEvent(QCloseEvent* event)
|
|||||||
{
|
{
|
||||||
QWidget* mainWidget = widget();
|
QWidget* mainWidget = widget();
|
||||||
|
|
||||||
RiuWellLogPlot* wellLogPlot = dynamic_cast<RiuWellLogPlot*>(mainWidget);
|
RimViewWindow* viewWindow = RiuInterfaceToViewWindow::viewWindowFromWidget(mainWidget);
|
||||||
RiuSummaryQwtPlot* summaryPlot = dynamic_cast<RiuSummaryQwtPlot*>(mainWidget);
|
if ( viewWindow )
|
||||||
if (wellLogPlot)
|
|
||||||
{
|
{
|
||||||
RiuMainPlotWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
|
viewWindow->setMdiWindowGeometry(windowGeometryForWidget(this));
|
||||||
CVF_ASSERT(mainPlotWindow);
|
|
||||||
|
|
||||||
wellLogPlot->ownerPlotDefinition()->setMdiWindowGeometry(mainPlotWindow->windowGeometryForWidget(this));
|
|
||||||
}
|
|
||||||
else if (summaryPlot)
|
|
||||||
{
|
|
||||||
RiuMainPlotWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
|
|
||||||
CVF_ASSERT(mainPlotWindow);
|
|
||||||
|
|
||||||
summaryPlot->ownerPlotDefinition()->setMdiWindowGeometry(mainPlotWindow->windowGeometryForWidget(this));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RiuViewer* viewer = mainWidget->findChild<RiuViewer*>();
|
RiuViewer* viewer = mainWidget->findChild<RiuViewer*>();
|
||||||
if (viewer)
|
if (viewer)
|
||||||
{
|
{
|
||||||
viewer->ownerReservoirView()->setMdiWindowGeometry(RiuMainWindow::instance()->windowGeometryForWidget(this));
|
viewer->ownerReservoirView()->setMdiWindowGeometry(windowGeometryForWidget(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QMdiSubWindow::closeEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimMdiWindowGeometry RiuMdiSubWindow::windowGeometryForWidget(QWidget* widget)
|
||||||
|
{
|
||||||
|
RimMdiWindowGeometry geo;
|
||||||
|
|
||||||
|
// Find topmost parent
|
||||||
|
|
||||||
|
QWidget* nextParent = widget->parentWidget();
|
||||||
|
QWidget* parent = nullptr;
|
||||||
|
while(nextParent)
|
||||||
|
{
|
||||||
|
parent = nextParent;
|
||||||
|
nextParent = nextParent->parentWidget();
|
||||||
|
}
|
||||||
|
|
||||||
|
int mainWinID = 0;
|
||||||
|
if (parent)
|
||||||
|
{
|
||||||
|
if (parent == RiaApplication::instance()->mainPlotWindow())
|
||||||
|
{
|
||||||
|
mainWinID = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QMdiSubWindow::closeEvent(event);
|
if (widget)
|
||||||
|
{
|
||||||
|
geo.mainWindowID = mainWinID;
|
||||||
|
geo.x = widget->pos().x();
|
||||||
|
geo.y = widget->pos().y();
|
||||||
|
geo.width = widget->size().width();
|
||||||
|
geo.height = widget->size().height();
|
||||||
|
geo.isMaximized = widget->isMaximized();
|
||||||
|
}
|
||||||
|
|
||||||
|
return geo;
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QMdiSubWindow>
|
#include <QMdiSubWindow>
|
||||||
|
#include "RimViewWindow.h"
|
||||||
|
|
||||||
|
|
||||||
class RiuMdiSubWindow : public QMdiSubWindow
|
class RiuMdiSubWindow : public QMdiSubWindow
|
||||||
@ -28,6 +29,8 @@ public:
|
|||||||
|
|
||||||
~RiuMdiSubWindow();
|
~RiuMdiSubWindow();
|
||||||
|
|
||||||
|
static RimMdiWindowGeometry windowGeometryForWidget(QWidget* widget);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void closeEvent(QCloseEvent* event);
|
virtual void closeEvent(QCloseEvent* event);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user