diff --git a/ApplicationExeCode/Resources/DisableZoom.png b/ApplicationExeCode/Resources/DisableZoom.png
new file mode 100644
index 0000000000..5f14b04504
Binary files /dev/null and b/ApplicationExeCode/Resources/DisableZoom.png differ
diff --git a/ApplicationExeCode/Resources/DisableZoom.svg b/ApplicationExeCode/Resources/DisableZoom.svg
new file mode 100644
index 0000000000..1afcab49eb
--- /dev/null
+++ b/ApplicationExeCode/Resources/DisableZoom.svg
@@ -0,0 +1,70 @@
+
+
diff --git a/ApplicationExeCode/Resources/ResInsight.qrc b/ApplicationExeCode/Resources/ResInsight.qrc
index 878f4b2413..3006ecae82 100644
--- a/ApplicationExeCode/Resources/ResInsight.qrc
+++ b/ApplicationExeCode/Resources/ResInsight.qrc
@@ -258,6 +258,7 @@
view-snapshots.svg
well-log-plot.svg
window-management.svg
+ DisableZoom.png
fs_CellFace.glsl
diff --git a/ApplicationExeCode/Resources/ZoomAll.svg b/ApplicationExeCode/Resources/ZoomAll.svg
index 306d8cb4e7..5aa7e97096 100644
--- a/ApplicationExeCode/Resources/ZoomAll.svg
+++ b/ApplicationExeCode/Resources/ZoomAll.svg
@@ -1,5 +1,53 @@
-
-
\ No newline at end of file
+
+
diff --git a/ApplicationLibCode/Application/RiaGuiApplication.cpp b/ApplicationLibCode/Application/RiaGuiApplication.cpp
index bfab7335f7..796b4cfa67 100644
--- a/ApplicationLibCode/Application/RiaGuiApplication.cpp
+++ b/ApplicationLibCode/Application/RiaGuiApplication.cpp
@@ -1687,11 +1687,16 @@ bool RiaGuiApplication::notify( QObject* receiver, QEvent* event )
{
if ( event->type() == QEvent::KeyPress )
{
- QKeyEvent* keyEvent = static_cast( event );
-
- RimPlotWindow* plot = dynamic_cast( activePlotWindow() );
+ QKeyEvent* keyEvent = static_cast( event );
+ RimPlotWindow* plot = dynamic_cast( activePlotWindow() );
if ( plot ) done = plot->handleGlobalKeyEvent( keyEvent );
}
+ else if ( event->type() == QEvent::Wheel )
+ {
+ QWheelEvent* wheelEvent = static_cast( event );
+ RimPlotWindow* plot = dynamic_cast( activePlotWindow() );
+ if ( plot ) done = plot->handleGlobalWheelEvent( wheelEvent );
+ }
if ( !done )
{
done = QApplication::notify( receiver, event );
diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp
index 6cd9459b7d..f22ee46235 100644
--- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp
+++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp
@@ -906,3 +906,14 @@ void RimMultiPlot::cleanupBeforeClose()
m_viewer = nullptr;
}
}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+bool RimMultiPlot::isMouseCursorInsidePlot()
+{
+ if ( !m_viewer ) return false;
+
+ QPoint curpos = m_viewer->mapFromGlobal( QCursor::pos() );
+ return ( m_viewer->rect().contains( curpos ) );
+}
diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h
index 2e9f255e39..8a0be401de 100644
--- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h
+++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h
@@ -141,6 +141,8 @@ protected:
virtual void updatePlotWindowTitle();
+ bool isMouseCursorInsidePlot();
+
private:
void cleanupBeforeClose();
void doUpdateLayout() override;
diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotWindow.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotWindow.cpp
index 1bf09c5fd1..90da745a7f 100644
--- a/ApplicationLibCode/ProjectDataModel/RimPlotWindow.cpp
+++ b/ApplicationLibCode/ProjectDataModel/RimPlotWindow.cpp
@@ -344,3 +344,11 @@ bool RimPlotWindow::handleGlobalKeyEvent( QKeyEvent* keyEvent )
{
return false;
}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+bool RimPlotWindow::handleGlobalWheelEvent( QWheelEvent* wheelEvent )
+{
+ return false;
+}
diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotWindow.h b/ApplicationLibCode/ProjectDataModel/RimPlotWindow.h
index d822179f45..2cc623b7d6 100644
--- a/ApplicationLibCode/ProjectDataModel/RimPlotWindow.h
+++ b/ApplicationLibCode/ProjectDataModel/RimPlotWindow.h
@@ -32,6 +32,7 @@ class RiuQwtPlotWidget;
class QwtPlotCurve;
class QKeyEvent;
+class QWheelEvent;
class QPaintDevice;
//==================================================================================================
@@ -76,6 +77,7 @@ public:
QPageLayout pageLayout() const;
virtual bool handleGlobalKeyEvent( QKeyEvent* keyEvent );
+ virtual bool handleGlobalWheelEvent( QWheelEvent* wheelEvent );
protected:
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp
index 2ce1367176..b014d1c782 100644
--- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp
+++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp
@@ -16,7 +16,7 @@
//
/////////////////////////////////////////////////////////////////////////////////
-#include "RimMultiPlot.h"
+#include "RimSummaryMultiPlot.h"
#include "RiaSummaryAddressAnalyzer.h"
#include "RiaSummaryStringTools.h"
@@ -31,7 +31,7 @@
#include "RimSummaryCurve.h"
#include "RimSummaryPlotControls.h"
-#include "RimSummaryMultiPlot.h"
+#include "RimMultiPlot.h"
#include "RimSummaryPlot.h"
#include "RimSummaryPlotNameHelper.h"
#include "RimSummaryPlotSourceStepping.h"
@@ -43,6 +43,8 @@
#include "cafPdmUiTreeOrdering.h"
#include "cafPdmUiTreeSelectionEditor.h"
+#include
+
CAF_PDM_SOURCE_INIT( RimSummaryMultiPlot, "MultiSummaryPlot" );
//--------------------------------------------------------------------------------------------------
///
@@ -60,6 +62,11 @@ RimSummaryMultiPlot::RimSummaryMultiPlot()
m_syncAxisRanges.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() );
m_syncAxisRanges.uiCapability()->setUiIconFromResourceString( ":/AxesSync16x16.png" );
+ CAF_PDM_InitField( &m_disableWheelZoom, "DisableWheelZoom", true, "", "", "Disable Mouse Wheel Zooming in Multi Summary Plot" );
+ m_disableWheelZoom.xmlCapability()->disableIO();
+ m_disableWheelZoom.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() );
+ m_disableWheelZoom.uiCapability()->setUiIconFromResourceString( ":/DisableZoom.png" );
+
CAF_PDM_InitFieldNoDefault( &m_sourceStepping, "SourceStepping", "" );
m_sourceStepping = new RimSummaryPlotSourceStepping;
m_sourceStepping->setSourceSteppingType( RimSummaryDataSourceStepping::Axis::Y_AXIS );
@@ -388,6 +395,7 @@ std::vector RimSummaryMultiPlot::fieldsToShowInToolbar()
{
std::vector toolBarFields;
+ toolBarFields.push_back( &m_disableWheelZoom );
toolBarFields.push_back( &m_syncAxisRanges );
auto& sourceObject = m_sourceStepping();
@@ -405,7 +413,48 @@ std::vector RimSummaryMultiPlot::fieldsToShowInToolbar()
//--------------------------------------------------------------------------------------------------
bool RimSummaryMultiPlot::handleGlobalKeyEvent( QKeyEvent* keyEvent )
{
- return RimSummaryPlotControls::handleKeyEvents( m_sourceStepping(), keyEvent );
+ if ( !RimSummaryPlotControls::handleKeyEvents( m_sourceStepping(), keyEvent ) )
+ {
+ if ( isMouseCursorInsidePlot() )
+ {
+ if ( keyEvent->key() == Qt::Key_PageUp )
+ {
+ m_viewer->goToPrevPage();
+ return true;
+ }
+ else if ( keyEvent->key() == Qt::Key_PageDown )
+ {
+ m_viewer->goToNextPage();
+ return true;
+ }
+ }
+ return false;
+ }
+ return true;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+bool RimSummaryMultiPlot::handleGlobalWheelEvent( QWheelEvent* wheelEvent )
+{
+ if ( m_disableWheelZoom )
+ {
+ if ( isMouseCursorInsidePlot() )
+ {
+ if ( wheelEvent->angleDelta().y() > 0 )
+ {
+ m_viewer->goToPrevPage();
+ }
+ else if ( wheelEvent->angleDelta().y() < 0 )
+ {
+ m_viewer->goToNextPage();
+ }
+
+ return true;
+ }
+ }
+ return false;
}
//--------------------------------------------------------------------------------------------------
diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h
index ee72b31cea..5c89288ea6 100644
--- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h
+++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h
@@ -63,6 +63,7 @@ public:
protected:
bool handleGlobalKeyEvent( QKeyEvent* keyEvent ) override;
+ bool handleGlobalWheelEvent( QWheelEvent* wheelEvent ) override;
private:
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
@@ -82,6 +83,7 @@ private:
caf::PdmField m_autoPlotTitles;
caf::PdmField m_autoPlotTitlesOnSubPlots;
caf::PdmField m_syncAxisRanges;
+ caf::PdmField m_disableWheelZoom;
caf::PdmChildField m_sourceStepping;
diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp
index e35a81d327..fb7d2ac677 100644
--- a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp
+++ b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp
@@ -99,6 +99,7 @@ RiuMultiPlotBook::RiuMultiPlotBook( RimMultiPlot* plotDefinition, QWidget* paren
, m_titleVisible( true )
, m_subTitlesVisible( true )
, m_previewMode( true )
+ , m_currentPageIndex( 0 )
{
const int spacing = 8;
@@ -585,3 +586,30 @@ void RiuMultiPlotBook::applyLook()
m_book->setPalette( newPalette );
}
}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RiuMultiPlotBook::changeCurrentPage( int pageDiff )
+{
+ m_currentPageIndex += pageDiff;
+ if ( m_currentPageIndex >= (int)m_pages.size() ) m_currentPageIndex = (int)m_pages.size() - 1;
+ if ( m_currentPageIndex < 0 ) m_currentPageIndex = 0;
+ if ( !m_pages.isEmpty() ) m_scrollArea->ensureWidgetVisible( m_pages[m_currentPageIndex] );
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RiuMultiPlotBook::goToNextPage()
+{
+ changeCurrentPage( 1 );
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RiuMultiPlotBook::goToPrevPage()
+{
+ changeCurrentPage( -1 );
+}
diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h
index 4a8072cc91..ee56dd5e90 100644
--- a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h
+++ b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h
@@ -86,6 +86,9 @@ public:
void renderTo( QPaintDevice* painter );
+ void goToNextPage();
+ void goToPrevPage();
+
protected:
void contextMenuEvent( QContextMenuEvent* ) override;
@@ -107,6 +110,9 @@ private:
const QList>& pages() const;
RiuMultiPlotPage* createPage();
void applyLook();
+
+ void changeCurrentPage( int pageDiff );
+
private slots:
virtual void performUpdate();
@@ -125,4 +131,5 @@ protected:
bool m_titleVisible;
bool m_subTitlesVisible;
bool m_previewMode;
+ int m_currentPageIndex;
};