mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Added support for active summary plot
This commit is contained in:
parent
cac86dcec9
commit
75c08979c7
@ -20,15 +20,19 @@
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimSummaryPlot.h"
|
||||
#include "RimView.h"
|
||||
#include "RimViewWindow.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
|
||||
#include "RiuMainPlotWindow.h"
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuSummaryQwtPlot.h"
|
||||
#include "RiuWellLogPlot.h"
|
||||
|
||||
#include <QClipboard>
|
||||
#include <QAction>
|
||||
#include <QClipboard>
|
||||
#include <QMdiSubWindow>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicSnapshotViewToClipboardFeature, "RicSnapshotViewToClipboardFeature");
|
||||
|
||||
@ -56,7 +60,22 @@ void RicSnapshotViewToClipboardFeature::onActionTriggered(bool isChecked)
|
||||
|
||||
if (dynamic_cast<RiuMainPlotWindow*>(topLevelWidget))
|
||||
{
|
||||
viewWindow = RiaApplication::instance()->activeWellLogPlot();
|
||||
RiuMainPlotWindow* mainPlotWindow = dynamic_cast<RiuMainPlotWindow*>(topLevelWidget);
|
||||
QList<QMdiSubWindow*> subwindows = mainPlotWindow->subWindowList(QMdiArea::StackingOrder);
|
||||
if (subwindows.size() > 0)
|
||||
{
|
||||
RiuSummaryQwtPlot* summaryQwtPlot = dynamic_cast<RiuSummaryQwtPlot*>(subwindows.back()->widget());
|
||||
if (summaryQwtPlot)
|
||||
{
|
||||
viewWindow = summaryQwtPlot->ownerPlotDefinition();
|
||||
}
|
||||
|
||||
RiuWellLogPlot* wellLogPlot = dynamic_cast<RiuWellLogPlot*>(subwindows.back()->widget());
|
||||
if (wellLogPlot)
|
||||
{
|
||||
viewWindow = wellLogPlot->ownerPlotDefinition();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (viewWindow)
|
||||
|
@ -131,6 +131,14 @@ void RimSummaryPlot::updateYAxisUnit()
|
||||
m_qwtPlot->setYAxisTitle(assembledYAxisText);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimSummaryPlot::viewer()
|
||||
{
|
||||
return m_qwtPlot;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -55,6 +55,8 @@ public:
|
||||
void handleViewerDeletion();
|
||||
void updateYAxisUnit();
|
||||
|
||||
QWidget* viewer();
|
||||
|
||||
protected:
|
||||
// Overridden PDM methods
|
||||
virtual caf::PdmFieldHandle* objectToggleField() { return &m_showWindow; }
|
||||
|
@ -23,12 +23,14 @@
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
#include "RimTreeViewStateSerializer.h"
|
||||
#include "RimViewWindow.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
|
||||
#include "RiuDragDrop.h"
|
||||
#include "RiuMdiSubWindow.h"
|
||||
#include "RiuSummaryQwtPlot.h"
|
||||
#include "RiuToolTipMenu.h"
|
||||
#include "RiuTreeViewEventFilter.h"
|
||||
#include "RiuWellLogPlot.h"
|
||||
@ -364,24 +366,41 @@ void RiuMainPlotWindow::slotSubWindowActivated(QMdiSubWindow* subWindow)
|
||||
RimProject * proj = RiaApplication::instance()->project();
|
||||
if (!proj) return;
|
||||
|
||||
RiuWellLogPlot* wellLogPlotViewer = dynamic_cast<RiuWellLogPlot*>(subWindow->widget());
|
||||
|
||||
if (wellLogPlotViewer)
|
||||
{
|
||||
RimWellLogPlot* wellLogPlot = wellLogPlotViewer->ownerPlotDefinition();
|
||||
|
||||
if (wellLogPlot != RiaApplication::instance()->activeWellLogPlot())
|
||||
RiuWellLogPlot* wellLogPlotViewer = dynamic_cast<RiuWellLogPlot*>(subWindow->widget());
|
||||
if (wellLogPlotViewer)
|
||||
{
|
||||
RiaApplication::instance()->setActiveWellLogPlot(wellLogPlot);
|
||||
if (wellLogPlot)
|
||||
RimWellLogPlot* wellLogPlot = wellLogPlotViewer->ownerPlotDefinition();
|
||||
|
||||
if (wellLogPlot != RiaApplication::instance()->activeWellLogPlot())
|
||||
{
|
||||
RiaApplication::instance()->setActiveWellLogPlot(wellLogPlot);
|
||||
projectTreeView()->selectAsCurrentItem(wellLogPlot);
|
||||
}
|
||||
}
|
||||
return;
|
||||
else
|
||||
{
|
||||
RiaApplication::instance()->setActiveWellLogPlot(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -457,7 +476,9 @@ void RiuMainPlotWindow::selectedObjectsChanged()
|
||||
|
||||
if (!firstSelectedObject) return;
|
||||
|
||||
bool isActiveViewChanged = false;
|
||||
// Well log plot
|
||||
|
||||
bool isActiveWellLogPlotChanged = false;
|
||||
|
||||
RimWellLogPlot* selectedWellLogPlot = dynamic_cast<RimWellLogPlot*>(firstSelectedObject);
|
||||
|
||||
@ -473,13 +494,41 @@ void RiuMainPlotWindow::selectedObjectsChanged()
|
||||
setActiveViewer(selectedWellLogPlot->viewer());
|
||||
|
||||
}
|
||||
isActiveViewChanged = true;
|
||||
isActiveWellLogPlotChanged = true;
|
||||
}
|
||||
|
||||
if (isActiveViewChanged)
|
||||
if (isActiveWellLogPlotChanged)
|
||||
{
|
||||
RiaApplication::instance()->setActiveWellLogPlot(selectedWellLogPlot);
|
||||
}
|
||||
|
||||
// Summary plot
|
||||
|
||||
bool isActiveSummaryPlotChanged = false;
|
||||
|
||||
RimSummaryPlot* selectedSummaryPlot = dynamic_cast<RimSummaryPlot*>(firstSelectedObject);
|
||||
|
||||
if (!selectedSummaryPlot)
|
||||
{
|
||||
firstSelectedObject->firstAnchestorOrThisOfType(selectedSummaryPlot);
|
||||
}
|
||||
|
||||
if (selectedSummaryPlot)
|
||||
{
|
||||
if (selectedSummaryPlot->viewer())
|
||||
{
|
||||
setActiveViewer(selectedSummaryPlot->viewer());
|
||||
}
|
||||
isActiveSummaryPlotChanged = true;
|
||||
}
|
||||
|
||||
if (isActiveSummaryPlotChanged)
|
||||
{
|
||||
RiaApplication::instance()->setActiveSummaryPlot(selectedSummaryPlot);
|
||||
}
|
||||
|
||||
if (isActiveWellLogPlotChanged || isActiveSummaryPlotChanged)
|
||||
{
|
||||
// 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
|
||||
// Set focus back to the tree view to be able to continue keyboard tree view navigation
|
||||
|
Loading…
Reference in New Issue
Block a user