3838#include " RimTimeAxisAnnotation.h"
3939
4040#include " RiuInterfaceToViewWindow.h"
41+
42+ #include " RimViewWindow.h"
4143#include " RiuPlotWidget.h"
4244#include " RiuQwtPlotWidget.h"
4345
6264#include < QStringList>
6365#include < QVBoxLayout>
6466
65- static const char * DOCK_LAYOUT_REGISTRY_KEY = " CorrelationReportPlot/defaultDockLayout" ;
67+ static const char * DOCK_LAYOUT_REGISTRY_KEY = " CorrelationReportPlot/defaultDockLayout" ;
68+ static const cvf::Color3f TRACKING_ANNOTATION_COLOR = cvf::Color3f( 0 .6f , 0 .4f , 0 .08f );
6669
6770// --------------------------------------------------------------------------------------------------
6871// / Thin wrapper around CDockManager that implements RiuInterfaceToViewWindow so that
@@ -71,19 +74,19 @@ static const char* DOCK_LAYOUT_REGISTRY_KEY = "CorrelationReportPlot/defaultDock
7174class RiuCorrelationReportPlotWidget : public QFrame , public RiuInterfaceToViewWindow
7275{
7376public:
74- RiuCorrelationReportPlotWidget ( RimCorrelationReportPlot* plot , QWidget* parent = nullptr )
77+ RiuCorrelationReportPlotWidget ( RimViewWindow* viewWindow , QWidget* parent = nullptr )
7578 : QFrame( parent )
76- , m_plot( plot )
79+ , m_viewWindow( viewWindow )
7780 {
7881 setLayout ( new QVBoxLayout );
7982 layout ()->setContentsMargins ( 0 , 0 , 0 , 0 );
8083 layout ()->setSpacing ( 0 );
8184 }
8285
83- RimViewWindow* ownerViewWindow () const override { return m_plot ; }
86+ RimViewWindow* ownerViewWindow () const override { return m_viewWindow ; }
8487
8588private:
86- RimCorrelationReportPlot* m_plot ;
89+ RimViewWindow* m_viewWindow ;
8790};
8891
8992// --------------------------------------------------------------------------------------------------
@@ -115,7 +118,7 @@ class TimeReadoutPicker : public QwtPlotPicker
115118 timeAxisProps->removeAnnotation ( m_trackingAnnotation );
116119 m_trackingAnnotation = nullptr ;
117120 }
118- auto * anno = RimTimeAxisAnnotation::createTimeAnnotation ( timeTValue, cvf::Color3f ( 0 . 6f , 0 . 4f , 0 . 08f ) );
121+ auto * anno = RimTimeAxisAnnotation::createTimeAnnotation ( timeTValue, TRACKING_ANNOTATION_COLOR );
119122 anno->setPenStyle ( Qt::DashLine );
120123 timeAxisProps->appendAnnotation ( anno );
121124 m_trackingAnnotation = anno;
@@ -152,23 +155,23 @@ namespace
152155// Ensures the correlation report plot is selected in CAF whenever a context menu event is dispatched
153156// anywhere within the dock manager — so feature availability checks in RiuContextMenuLauncher
154157// see the correct item (mirrors what RiuMultiPlotPage::contextMenuEvent did explicitly).
155- class ReportPlotContextMenuFilter : public QObject
158+ class SelectionFixerOnContextMenu : public QObject
156159{
157160public:
158- ReportPlotContextMenuFilter ( RimCorrelationReportPlot* plot , QObject* parent )
161+ SelectionFixerOnContextMenu ( caf::PdmObject* item , QObject* parent )
159162 : QObject( parent )
160- , m_plot( plot )
163+ , m_item( item )
161164 {
162165 }
163166
164167 bool eventFilter ( QObject*, QEvent* event ) override
165168 {
166- if ( event->type () == QEvent::ContextMenu ) caf::SelectionManager::instance ()->setSelectedItem ( m_plot );
169+ if ( event->type () == QEvent::ContextMenu ) caf::SelectionManager::instance ()->setSelectedItem ( m_item );
167170 return false ; // never consume the event
168171 }
169172
170173private:
171- RimCorrelationReportPlot* m_plot ;
174+ caf::PdmObject* m_item ;
172175};
173176} // namespace
174177
@@ -232,8 +235,8 @@ RimCorrelationReportPlot::RimCorrelationReportPlot()
232235
233236 auto * curveSet = new RimEnsembleCurveSet ();
234237 curveSet->setColorMode ( RimEnsembleCurveSet::ColorMode::SINGLE_COLOR );
235- curveSet->setColor ( cvf::Color3f ( 0 . 6f , 0 . 4f , 0 . 08f ) );
236- const_cast <RimEnsembleStatistics*>( curveSet->statisticsOptions () )->enableCurveLabels ( false );
238+ curveSet->setColor ( TRACKING_ANNOTATION_COLOR );
239+ curveSet->statisticsOptions ()->enableCurveLabels ( false );
237240 m_summaryPlot->ensembleCurveSetCollection ()->addCurveSet ( curveSet );
238241
239242 m_summaryAddressSelector = new RimSummaryAddressSelector ();
@@ -385,13 +388,17 @@ void RimCorrelationReportPlot::recreatePlotWidgets()
385388 m_parameterResultCrossPlot->createPlotWidget ( m_dockManager );
386389 m_summaryPlot->createPlotWidget ( m_dockManager );
387390
388- // Install selection fixer on each plot widget (runs first due to LIFO filter order), so that
389- // RiuContextMenuLauncher sees the correct CAF selection when building the context menu.
390- auto * filter = new ReportPlotContextMenuFilter ( this , m_dockManager );
391- if ( m_correlationMatrixPlot->viewer () ) m_correlationMatrixPlot->viewer ()->installEventFilter ( filter );
392- if ( m_correlationPlot->viewer () ) m_correlationPlot->viewer ()->installEventFilter ( filter );
393- if ( m_parameterResultCrossPlot->viewer () ) m_parameterResultCrossPlot->viewer ()->installEventFilter ( filter );
394- if ( m_summaryPlot->plotWidget () ) m_summaryPlot->plotWidget ()->installEventFilter ( filter );
391+ // Install selection fixer on each plot widget.
392+ // Filter runs first (LIFO order) so RiuContextMenuLauncher sees the correct CAF selection.
393+ delete m_contextMenuFilter;
394+ m_contextMenuFilter = new SelectionFixerOnContextMenu ( this , this );
395+ for ( RiuPlotWidget* w : std::initializer_list<RiuPlotWidget*>{ m_correlationMatrixPlot->viewer (),
396+ m_correlationPlot->viewer (),
397+ m_parameterResultCrossPlot->viewer (),
398+ m_summaryPlot->plotWidget () } )
399+ {
400+ if ( w ) w->installEventFilter ( m_contextMenuFilter );
401+ }
395402
396403 // Wrap each plot in a dock widget
397404 m_matrixDockWidget = new ads::CDockWidget ( " Matrix Plot" , m_dockManager );
@@ -410,6 +417,9 @@ void RimCorrelationReportPlot::recreatePlotWidgets()
410417 m_summaryDockWidget->setWidget ( m_summaryPlot->plotWidget (), ads::CDockWidget::ForceNoScrollArea );
411418 m_summaryDockWidget->setFeature ( ads::CDockWidget::DockWidgetClosable, false );
412419
420+ // Disable zoom — clicks are used for time step selection, not zooming
421+ if ( m_summaryPlot->summaryPlotWidget () ) m_summaryPlot->summaryPlotWidget ()->setZoomEnabled ( false );
422+
413423 // Connect summary plot click → time step update; add time tracking readout
414424 auto * summaryWidget = dynamic_cast <RiuQwtPlotWidget*>( m_summaryPlot->plotWidget () );
415425 if ( summaryWidget )
@@ -440,14 +450,12 @@ void RimCorrelationReportPlot::recreatePlotWidgets()
440450 }
441451 else
442452 {
443- // Hard-coded default: matrix on left, corr top-right, cross bottom-right, summary far right
444- auto * matrixArea = m_dockManager->addDockWidget ( ads::LeftDockWidgetArea, m_matrixDockWidget );
445- auto * corrArea = m_dockManager->addDockWidget ( ads::RightDockWidgetArea, m_correlationDockWidget );
446- auto * crossArea = m_dockManager->addDockWidget ( ads::BottomDockWidgetArea, m_crossPlotDockWidget, corrArea );
447- m_dockManager->addDockWidget ( ads::RightDockWidgetArea, m_summaryDockWidget, corrArea );
448-
449- (void )matrixArea;
450- (void )crossArea;
453+ // Hard-coded default: matrix left (full height), corr top-right, cross bottom-right,
454+ // summary spanning full width at bottom
455+ auto * corrArea = m_dockManager->addDockWidget ( ads::CenterDockWidgetArea, m_correlationDockWidget );
456+ m_dockManager->addDockWidget ( ads::LeftDockWidgetArea, m_matrixDockWidget );
457+ m_dockManager->addDockWidget ( ads::BottomDockWidgetArea, m_crossPlotDockWidget, corrArea );
458+ m_dockManager->addDockWidget ( ads::BottomDockWidgetArea, m_summaryDockWidget );
451459
452460 m_summaryDockWidget->toggleView ( m_showSummaryPlot () );
453461 }
@@ -607,7 +615,7 @@ void RimCorrelationReportPlot::onLoadDataAndUpdate()
607615 auto * timeAxisProps = m_summaryPlot->timeAxisProperties ();
608616 if ( timeAxisProps )
609617 {
610- timeAxisProps->appendAnnotation ( RimTimeAxisAnnotation::createTimeAnnotation ( timeStep, cvf::Color3f ( 0 . 6f , 0 . 4f , 0 . 08f ) ) );
618+ timeAxisProps->appendAnnotation ( RimTimeAxisAnnotation::createTimeAnnotation ( timeStep, TRACKING_ANNOTATION_COLOR ) );
611619 m_summaryPlot->updateAnnotationsInPlotWidget ();
612620 }
613621 }
0 commit comments