Skip to content

Commit cdca328

Browse files
committed
Work in progress
1 parent 8185d76 commit cdca328

File tree

13 files changed

+244
-104
lines changed

13 files changed

+244
-104
lines changed

ApplicationLibCode/Commands/3dView/CMakeLists_files.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@ set(SOURCE_GROUP_HEADER_FILES
33
${CMAKE_CURRENT_LIST_DIR}/RicStoreUserDefinedCameraFeature.h
44
${CMAKE_CURRENT_LIST_DIR}/RicPopOutTo3dViewFeature.h
55
${CMAKE_CURRENT_LIST_DIR}/RicPopOutToPlotViewFeature.h
6+
${CMAKE_CURRENT_LIST_DIR}/RicConvert3dToMdiFeature.h
67
)
78

89
set(SOURCE_GROUP_SOURCE_FILES
910
${CMAKE_CURRENT_LIST_DIR}/RicApplyUserDefinedCameraFeature.cpp
1011
${CMAKE_CURRENT_LIST_DIR}/RicStoreUserDefinedCameraFeature.cpp
1112
${CMAKE_CURRENT_LIST_DIR}/RicPopOutTo3dViewFeature.cpp
1213
${CMAKE_CURRENT_LIST_DIR}/RicPopOutToPlotViewFeature.cpp
14+
${CMAKE_CURRENT_LIST_DIR}/RicConvert3dToMdiFeature.cpp
1315
)
1416

1517
list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/////////////////////////////////////////////////////////////////////////////////
2+
//
3+
// Copyright (C) 2026 Equinor ASA
4+
//
5+
// ResInsight is free software: you can redistribute it and/or modify
6+
// it under the terms of the GNU General Public License as published by
7+
// the Free Software Foundation, either version 3 of the License, or
8+
// (at your option) any later version.
9+
//
10+
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
11+
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
12+
// FITNESS FOR A PARTICULAR PURPOSE.
13+
//
14+
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
15+
// for more details.
16+
//
17+
/////////////////////////////////////////////////////////////////////////////////
18+
19+
#include "RicConvert3dToMdiFeature.h"
20+
21+
#include "RiaGuiApplication.h"
22+
23+
#include "RimGridView.h"
24+
#include "RiuMainWindow.h"
25+
26+
#include "RiuViewer.h"
27+
28+
#include "cafSelectionManager.h"
29+
30+
#include <QAction>
31+
#include <QSettings>
32+
33+
CAF_CMD_SOURCE_INIT( RicConvert3dToMdiFeature, "RicConvert3dToMdiFeature" );
34+
35+
//--------------------------------------------------------------------------------------------------
36+
///
37+
//--------------------------------------------------------------------------------------------------
38+
bool RicConvert3dToMdiFeature::isCommandEnabled() const
39+
{
40+
if ( auto view = dynamic_cast<Rim3dView*>( caf::SelectionManager::instance()->selectedItem() ) )
41+
{
42+
return view->isDockingViewer();
43+
}
44+
return false;
45+
}
46+
47+
//--------------------------------------------------------------------------------------------------
48+
///
49+
//--------------------------------------------------------------------------------------------------
50+
void RicConvert3dToMdiFeature::onActionTriggered( bool isChecked )
51+
{
52+
if ( auto view = dynamic_cast<Rim3dView*>( caf::SelectionManager::instance()->selectedItem() ) )
53+
{
54+
view->convertToMdi( RiaGuiApplication::instance()->mainWindow() );
55+
}
56+
}
57+
58+
//--------------------------------------------------------------------------------------------------
59+
///
60+
//--------------------------------------------------------------------------------------------------
61+
void RicConvert3dToMdiFeature::setupActionLook( QAction* actionToSetup )
62+
{
63+
actionToSetup->setText( "Convert to MDI view" );
64+
actionToSetup->setIcon( QIcon( ":/3DWindow.svg" ) );
65+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/////////////////////////////////////////////////////////////////////////////////
2+
//
3+
// Copyright (C) 2026 Equinor ASA
4+
//
5+
// ResInsight is free software: you can redistribute it and/or modify
6+
// it under the terms of the GNU General Public License as published by
7+
// the Free Software Foundation, either version 3 of the License, or
8+
// (at your option) any later version.
9+
//
10+
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
11+
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
12+
// FITNESS FOR A PARTICULAR PURPOSE.
13+
//
14+
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
15+
// for more details.
16+
//
17+
/////////////////////////////////////////////////////////////////////////////////
18+
19+
#pragma once
20+
21+
#include "cafCmdFeature.h"
22+
23+
//==================================================================================================
24+
///
25+
//==================================================================================================
26+
class RicConvert3dToMdiFeature : public caf::CmdFeature
27+
{
28+
CAF_CMD_HEADER_INIT;
29+
30+
protected:
31+
bool isCommandEnabled() const override;
32+
void onActionTriggered( bool isChecked ) override;
33+
void setupActionLook( QAction* actionToSetup ) override;
34+
};

ApplicationLibCode/Commands/3dView/RicPopOutTo3dViewFeature.cpp

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,24 @@ bool RicPopOutTo3dViewFeature::isCommandEnabled() const
4242
return !view->isDockingViewer();
4343
}
4444
return false;
45+
}
4546

46-
//--------------------------------------------------------------------------------------------------
47-
///
48-
//--------------------------------------------------------------------------------------------------
49-
void RicPopOutTo3dViewFeature::onActionTriggered( bool isChecked )
47+
//--------------------------------------------------------------------------------------------------
48+
///
49+
//--------------------------------------------------------------------------------------------------
50+
void RicPopOutTo3dViewFeature::onActionTriggered( bool isChecked )
51+
{
52+
if ( auto view = dynamic_cast<Rim3dView*>( caf::SelectionManager::instance()->selectedItem() ) )
5053
{
51-
if ( auto view = dynamic_cast<Rim3dView*>( caf::SelectionManager::instance()->selectedItem() ) )
52-
{
53-
view->convertToDocking( RiaGuiApplication::instance()->mainWindow() );
54-
}
54+
view->convertToDocking( RiaGuiApplication::instance()->mainWindow() );
5555
}
56+
}
5657

57-
//--------------------------------------------------------------------------------------------------
58-
///
59-
//--------------------------------------------------------------------------------------------------
60-
void RicPopOutTo3dViewFeature::setupActionLook( QAction * actionToSetup )
61-
{
62-
actionToSetup->setText( "Pop Out (in 3D View)" );
63-
actionToSetup->setIcon( QIcon( ":/3DWindow.svg" ) );
64-
}
58+
//--------------------------------------------------------------------------------------------------
59+
///
60+
//--------------------------------------------------------------------------------------------------
61+
void RicPopOutTo3dViewFeature::setupActionLook( QAction* actionToSetup )
62+
{
63+
actionToSetup->setText( "Pop Out (in 3D View)" );
64+
actionToSetup->setIcon( QIcon( ":/3DWindow.svg" ) );
65+
}

ApplicationLibCode/ProjectDataModel/Rim3dView.cpp

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include "RimGridView.h"
3636
#include "RimLegendConfig.h"
3737
#include "RimMainPlotCollection.h"
38+
#include "RimMdiWindowController.h"
3839
#include "RimMeasurement.h"
3940
#include "RimOilField.h"
4041
#include "RimProject.h"
@@ -53,6 +54,8 @@
5354
#include "RiuTimeStepChangedHandler.h"
5455
#include "RiuViewer.h"
5556

57+
#include "DockManager.h"
58+
5659
#include "cafCmdFeatureMenuBuilder.h"
5760
#include "cafDisplayCoordTransform.h"
5861
#include "cafFrameAnimationControl.h"
@@ -1879,6 +1882,7 @@ void Rim3dView::appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) const
18791882
{
18801883
if ( isDockingViewer() )
18811884
{
1885+
menuBuilder << "RicConvert3dToMdiFeature";
18821886
}
18831887
else
18841888
{
@@ -1898,7 +1902,27 @@ void Rim3dView::convertToDocking( RiuMainWindowBase* mainWindow )
18981902

18991903
QWidget* viewWidget = createViewWidget( nullptr );
19001904

1901-
mainWindow->initializeDockingViewer( viewWidget );
1905+
m_dockWidget = mainWindow->initializeDockingViewer( viewWidget );
1906+
updateViewWidgetAfterCreation();
1907+
scheduleCreateDisplayModelAndRedraw();
1908+
}
1909+
1910+
//--------------------------------------------------------------------------------------------------
1911+
///
1912+
//--------------------------------------------------------------------------------------------------
1913+
void Rim3dView::convertToMdi( RiuMainWindowBase* mainWindow )
1914+
{
1915+
if ( !isDockingViewer() ) return;
1916+
1917+
mainWindow->dockManager()->removeDockWidget( m_dockWidget );
1918+
1919+
m_dockWidget->takeWidget();
1920+
m_dockWidget = nullptr;
1921+
1922+
m_windowController->updateViewerWidget();
1923+
1924+
updateMdiWindowVisibility();
1925+
19021926
updateViewWidgetAfterCreation();
19031927
scheduleCreateDisplayModelAndRedraw();
19041928
}

ApplicationLibCode/ProjectDataModel/Rim3dView.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ namespace caf
7171
class DisplayCoordTransform;
7272
}
7373

74+
namespace ads
75+
{
76+
class CDockWidget;
77+
}
78+
7479
enum PartRenderMaskEnum
7580
{
7681
surfaceBit = 1,
@@ -96,7 +101,7 @@ class Rim3dView : public RimViewWindow, public RiuViewerToViewInterface, public
96101

97102
int id() const final;
98103

99-
bool isDockingViewer() const { return m_isDockingViewer; }
104+
bool isDockingViewer() const { return !m_dockWidget.isNull(); }
100105

101106
// Public fields:
102107

@@ -204,6 +209,7 @@ class Rim3dView : public RimViewWindow, public RiuViewerToViewInterface, public
204209
void synchronizeLocalAnnotationsFromGlobal();
205210

206211
void convertToDocking( RiuMainWindowBase* mainWindow );
212+
void convertToMdi( RiuMainWindowBase* mainWindow );
207213

208214
protected:
209215
static void removeModelByName( cvf::Scene* scene, const cvf::String& modelName );
@@ -364,5 +370,5 @@ class Rim3dView : public RimViewWindow, public RiuViewerToViewInterface, public
364370
const int m_animationIntervalMillisec;
365371
int m_animationTimerUsers;
366372

367-
bool m_isDockingViewer;
373+
QPointer<ads::CDockWidget> m_dockWidget;
368374
};

ApplicationLibCode/ProjectDataModel/RimViewWindow.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,10 @@ class RimViewWindow : public caf::PdmObject, public caf::FontHolderInterface
117117
virtual void assignIdIfNecessary() = 0;
118118

119119
protected:
120-
caf::PdmField<bool> m_showWindow;
121-
122-
private:
120+
caf::PdmField<bool> m_showWindow;
123121
caf::PdmChildField<RimMdiWindowController*> m_windowController;
124122

123+
private:
125124
// Obsoleted field
126125
caf::PdmField<std::vector<int>> obsoleteField_windowGeometry;
127126
};

0 commit comments

Comments
 (0)