Work in progress

This commit is contained in:
jonjenssen authored and JJ committed 2026-06-17 13:55:32 +02:00
1 parent 650bac4002
commit 797d9ac2db
10 files changed
+70 -22

No files matched your search

@@ -231,7 +231,7 @@ RiaGuiApplication::~RiaGuiApplication()
delete m_mainWindow.data();
m_mainWindow.clear();
// m_mainPlotWindow.reset();
m_mainPlotWindow.reset();
}
//--------------------------------------------------------------------------------------------------
@@ -20,11 +20,13 @@
#include "RiaGuiApplication.h"
#include "Rim3dView.h"
#include "RimPlotWindow.h"
#include "RimProject.h"
#include "RimViewWindow.h"
#include "RiuDockWidgetTools.h"
#include "RiuMainWindowBase.h"
#include "RiuPlotMainWindowTools.h"
#include "RiuViewer.h"
#include "DockManager.h"
@@ -210,5 +212,9 @@ void RimDockWindowController::setAsActiveViewer()
mainWin->refreshDrawStyleActions();
}
}
else if ( auto plotView = dynamic_cast<RimPlotWindow*>( pdmView ) )
{
RiuPlotMainWindowTools::selectAsCurrentItem( plotView );
}
}
}
@@ -21,6 +21,7 @@
#include "cafPdmChildField.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPtrField.h"
class RiuMainWindowBase;
class RimViewWindow;
@@ -29,6 +29,7 @@
#include "cafPdmFieldScriptingCapability.h"
#include "cafPdmUiComboBoxEditor.h"
#include <QMouseEvent>
#include <QPainter>
CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimPlotWindow, "RimPlotWindow" ); // Do not use. Abstract class
@@ -435,3 +436,14 @@ bool RimPlotWindow::handleGlobalWheelEvent( QWheelEvent* wheelEvent )
{
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotWindow::onMousePressEvent( QMouseEvent* mouseEvent )
{
if ( mouseEvent )
{
setAsActiveViewer();
}
}
@@ -35,6 +35,7 @@ class QwtPlotCurve;
class QKeyEvent;
class QWheelEvent;
class QPaintDevice;
class QMouseEvent;
//==================================================================================================
///
@@ -92,6 +93,9 @@ public:
virtual bool handleGlobalKeyEvent( QKeyEvent* keyEvent );
virtual bool handleGlobalWheelEvent( QWheelEvent* wheelEvent );
public slots:
void onMousePressEvent( QMouseEvent* event );
protected:
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
@@ -2833,6 +2833,10 @@ void RimSummaryPlot::onPlotItemSelected( std::shared_ptr<RiuPlotItem> plotItem,
auto rimPlotCurve = riuPlotCurve->ownerRimCurve();
// if ( auto multiPlot = firstAncestorOrThisOfType<RimMultiPlot>() )
//{
// RiuPlotMainWindowTools::setActiveViewer( multiPlot->dockWindowName() );
// }
RiuPlotMainWindowTools::selectOrToggleObject( rimPlotCurve, toggle );
}
@@ -1264,7 +1264,22 @@ void RiuMainWindow::slotViewFullScreen( bool showFullScreen )
if ( showFullScreen )
{
m_lastDockState = dockManager()->saveState( DOCKSTATE_VERSION );
QString activeViewerName;
if ( auto activeViewer = RiaGuiApplication::instance()->activeReservoirView() )
{
activeViewerName = activeViewer->dockWindowName();
}
dockManager()->restoreState( RiuDockWidgetTools::hideAllDocking3DState(), DOCKSTATE_VERSION );
if ( !activeViewerName.isEmpty() )
{
if ( auto dw = dockManager()->findDockWidget( activeViewerName ) )
{
dockManager()->addDockWidget( ads::DockWidgetArea::CenterDockWidgetArea, dw, dockManager()->centralWidget()->dockAreaWidget() );
}
}
}
else
{
@@ -122,6 +122,7 @@ void RiuMainWindowBase::setActiveViewer( QString viewerName )
{
for ( auto view : viewWindows() )
{
auto dockName = view->dockWidget()->objectName();
if ( view->dockWidget() && view->dockWidget()->objectName() == viewerName )
{
view->setAsActiveViewer();
@@ -774,7 +774,7 @@ std::vector<RimViewWindow*> RiuPlotMainWindow::viewWindows()
for ( auto v : RimProject::current()->descendantsOfType<RimPlotWindow>() )
{
views.push_back( v );
if ( v->dockWidget() ) views.push_back( v );
}
return views;
@@ -913,27 +913,29 @@ void RiuPlotMainWindow::selectedObjectsChanged( caf::PdmUiTreeView* projectTree,
if ( selectedWindow )
{
if ( selectedWindow->viewWidget() )
{
setBlockViewSelectionOnSubWindowActivated( true );
setActiveViewer( selectedWindow->dockWindowName() );
setBlockViewSelectionOnSubWindowActivated( false );
}
m_activePlotViewWindow = selectedWindow;
if ( firstSelectedObject )
if ( auto multiSummaryPlot = firstSelectedObject->firstAncestorOrThisOfType<RimSummaryMultiPlot>() )
{
auto multiSummaryPlot = firstSelectedObject->firstAncestorOrThisOfType<RimSummaryMultiPlot>();
if ( multiSummaryPlot )
{
updateMultiPlotToolBar();
setBlockViewSelectionOnSubWindowActivated( true );
setActiveViewer( multiSummaryPlot->dockWindowName() );
setBlockViewSelectionOnSubWindowActivated( false );
auto summaryPlot = firstSelectedObject->firstAncestorOrThisOfType<RimSummaryPlot>();
if ( summaryPlot )
{
multiSummaryPlot->makeSureIsVisible( summaryPlot );
}
updateMultiPlotToolBar();
auto summaryPlot = firstSelectedObject->firstAncestorOrThisOfType<RimSummaryPlot>();
if ( summaryPlot )
{
multiSummaryPlot->makeSureIsVisible( summaryPlot );
}
}
else
{
if ( selectedWindow->dockWidget() )
{
setBlockViewSelectionOnSubWindowActivated( true );
setActiveViewer( selectedWindow->dockWindowName() );
setBlockViewSelectionOnSubWindowActivated( false );
}
}
@@ -987,9 +989,11 @@ void RiuPlotMainWindow::customMenuRequested( const QPoint& pos )
//--------------------------------------------------------------------------------------------------
void RiuPlotMainWindow::dragEnterEvent( QDragEnterEvent* event )
{
// QPoint curpos = m_mdiArea->mapFromGlobal( QCursor::pos() );
// if ( m_mdiArea->rect().contains( curpos ) ) event->acceptProposedAction();
if ( m_centralDockWidget != nullptr )
{
QPoint curpos = m_centralDockWidget->mapFromGlobal( QCursor::pos() );
if ( m_centralDockWidget->rect().contains( curpos ) ) event->acceptProposedAction();
}
}
//--------------------------------------------------------------------------------------------------
@@ -107,6 +107,7 @@ RiuQwtPlotWidget::RiuQwtPlotWidget( RimPlot* plotDefinition, QWidget* parent )
SLOT( onPlotItemSelected( std::shared_ptr<RiuPlotItem>, bool, int ) ) );
connect( this, SIGNAL( onKeyPressEvent( QKeyEvent* ) ), plotDefinition, SLOT( onKeyPressEvent( QKeyEvent* ) ) );
connect( this, SIGNAL( onWheelEvent( QWheelEvent* ) ), plotDefinition, SLOT( onWheelEvent( QWheelEvent* ) ) );
connect( this, SIGNAL( onMousePressEvent( QMouseEvent* ) ), plotDefinition, SLOT( onMousePressEvent( QMouseEvent* ) ) );
connect( this, SIGNAL( destroyed() ), plotDefinition, SLOT( onViewerDestroyed() ) );
}