2016-06-24 15:53:04 +02:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// Copyright (C) 2016 Statoil ASA
|
2019-09-06 10:40:57 +02:00
|
|
|
//
|
2016-06-24 15:53:04 +02:00
|
|
|
// ResInsight is free software: you can redistribute it and/or modify
|
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
// (at your option) any later version.
|
2019-09-06 10:40:57 +02:00
|
|
|
//
|
2016-06-24 15:53:04 +02:00
|
|
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
2019-09-06 10:40:57 +02:00
|
|
|
//
|
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2016-06-24 15:53:04 +02:00
|
|
|
// for more details.
|
|
|
|
|
//
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2023-04-26 16:30:15 +02:00
|
|
|
#include <QByteArray>
|
2016-06-24 15:53:04 +02:00
|
|
|
#include <QMainWindow>
|
2026-05-19 18:29:29 +02:00
|
|
|
#include <QPointer>
|
2026-05-15 02:25:56 +02:00
|
|
|
#include <QString>
|
|
|
|
|
#include <QStringList>
|
2017-10-19 07:39:16 +02:00
|
|
|
|
2022-01-28 13:19:52 +01:00
|
|
|
#include "cafPdmUiDragDropInterface.h"
|
|
|
|
|
|
2023-02-02 07:41:45 +01:00
|
|
|
#include "ads_globals.h"
|
2022-07-07 12:03:02 +02:00
|
|
|
|
2022-01-28 13:19:52 +01:00
|
|
|
#include <memory>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
2023-02-02 07:41:45 +01:00
|
|
|
namespace ads
|
|
|
|
|
{
|
|
|
|
|
class CDockManager;
|
|
|
|
|
class CDockAreaWidget;
|
|
|
|
|
class CDockWidget;
|
|
|
|
|
} // namespace ads
|
|
|
|
|
|
2018-02-27 11:23:43 +01:00
|
|
|
namespace caf
|
|
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
class PdmObject;
|
|
|
|
|
class PdmUiTreeView;
|
|
|
|
|
class PdmUiItem;
|
2024-09-02 14:08:19 +02:00
|
|
|
class PdmUiPropertyView;
|
2019-09-06 10:40:57 +02:00
|
|
|
} // namespace caf
|
2019-04-02 19:18:00 +02:00
|
|
|
|
2022-08-23 16:05:31 +02:00
|
|
|
class QAction;
|
2021-02-09 13:31:27 +01:00
|
|
|
class QUndoView;
|
2019-03-28 18:30:55 +01:00
|
|
|
|
2026-05-19 18:08:18 +02:00
|
|
|
class RimViewWindow;
|
|
|
|
|
|
2017-10-19 07:39:16 +02:00
|
|
|
//==================================================================================================
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2017-10-19 07:39:16 +02:00
|
|
|
//==================================================================================================
|
2016-06-24 15:53:04 +02:00
|
|
|
class RiuMainWindowBase : public QMainWindow
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2026-05-28 18:32:16 +02:00
|
|
|
static const int DOCKSTATE_VERSION = 4;
|
|
|
|
|
|
2022-07-07 12:03:02 +02:00
|
|
|
RiuMainWindowBase();
|
|
|
|
|
~RiuMainWindowBase() override;
|
2016-06-24 15:53:04 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
virtual QString mainWindowName() = 0;
|
|
|
|
|
|
2026-06-16 17:29:48 +02:00
|
|
|
virtual void initializeViewer( ads::CDockWidget* dockWidget, QWidget* viewer ) {};
|
|
|
|
|
virtual void setActiveViewer( QString viewerName );
|
|
|
|
|
virtual void onViewerRemoved() = 0;
|
|
|
|
|
virtual RimViewWindow* activeViewer() = 0;
|
2026-05-19 18:08:18 +02:00
|
|
|
|
|
|
|
|
virtual std::vector<RimViewWindow*> viewWindows() = 0;
|
2016-06-24 15:53:04 +02:00
|
|
|
|
2026-05-06 16:54:21 +02:00
|
|
|
void loadWinGeoAndDockToolBarLayout();
|
|
|
|
|
void saveWinGeoAndDockToolBarLayout();
|
|
|
|
|
void showWindow();
|
2017-01-17 13:06:57 +01:00
|
|
|
|
2022-01-28 13:19:52 +01:00
|
|
|
std::vector<caf::PdmUiTreeView*> projectTreeViews();
|
|
|
|
|
caf::PdmUiTreeView* projectTreeView( int treeId );
|
|
|
|
|
caf::PdmUiTreeView* getTreeViewWithItem( const caf::PdmUiItem* item );
|
|
|
|
|
|
|
|
|
|
void setExpanded( const caf::PdmUiItem* uiItem, bool expanded = true );
|
2019-05-15 10:47:30 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
void selectAsCurrentItem( const caf::PdmObject* object, bool allowActiveViewChange = true );
|
2019-10-11 15:54:19 +02:00
|
|
|
void toggleItemInSelection( const caf::PdmObject* object, bool allowActiveViewChange = true );
|
2018-02-27 11:23:43 +01:00
|
|
|
|
2019-10-30 10:34:39 +01:00
|
|
|
void setBlockSubWindowActivatedSignal( bool block );
|
|
|
|
|
bool isBlockingSubWindowActivatedSignal() const;
|
2019-09-27 15:29:14 +02:00
|
|
|
|
2019-10-30 10:34:39 +01:00
|
|
|
void setBlockViewSelectionOnSubWindowActivated( bool block );
|
|
|
|
|
bool isBlockingViewSelectionOnSubWindowActivated() const;
|
2019-04-04 19:19:13 +02:00
|
|
|
|
2026-08-23 08:55:30 +02:00
|
|
|
void setBeingDestroyed();
|
|
|
|
|
bool isBeingDestroyed() const;
|
|
|
|
|
|
2026-10-11 08:42:54 +02:00
|
|
|
// Closing a main window hides it and removes all views from docking. The views must be recreated before the
|
|
|
|
|
// window is shown again.
|
|
|
|
|
bool hasBeenClosed() const;
|
|
|
|
|
void clearClosedState();
|
|
|
|
|
|
2022-07-07 12:03:02 +02:00
|
|
|
ads::CDockManager* dockManager() const;
|
|
|
|
|
|
2026-05-28 18:32:16 +02:00
|
|
|
QString dockWidgetStateString() const;
|
2026-06-09 17:50:23 +02:00
|
|
|
bool restoreDockWidgetState( QString dockStateString );
|
2026-06-24 16:07:21 +02:00
|
|
|
bool restoreLastDockWidgetState();
|
2026-05-28 18:32:16 +02:00
|
|
|
|
2026-08-24 09:43:45 +02:00
|
|
|
public slots:
|
|
|
|
|
void tileViewWindows();
|
|
|
|
|
|
2019-04-16 10:41:03 +02:00
|
|
|
protected:
|
2022-01-28 13:19:52 +01:00
|
|
|
void createTreeViews( int numberOfTrees );
|
2026-05-06 16:54:21 +02:00
|
|
|
void setUpCentralDockWidget();
|
|
|
|
|
|
2022-01-28 13:19:52 +01:00
|
|
|
void restoreTreeViewStates( QString treeStateString, QString treeIndexString );
|
|
|
|
|
|
2022-07-07 12:03:02 +02:00
|
|
|
ads::CDockAreaWidget* addTabbedWidgets( std::vector<ads::CDockWidget*> widgets,
|
|
|
|
|
ads::DockWidgetArea whereToDock,
|
|
|
|
|
ads::CDockAreaWidget* dockInside = nullptr );
|
|
|
|
|
|
|
|
|
|
void addDefaultEntriesToWindowsMenu();
|
|
|
|
|
|
2022-08-10 17:06:13 +02:00
|
|
|
virtual QStringList defaultDockStateNames() = 0;
|
|
|
|
|
|
2024-09-11 15:56:35 +02:00
|
|
|
void showEvent( QShowEvent* event ) override;
|
2026-06-24 16:07:21 +02:00
|
|
|
void closeEvent( QCloseEvent* event ) override;
|
2024-09-11 15:56:35 +02:00
|
|
|
|
2026-06-19 09:25:33 +02:00
|
|
|
virtual void onCentralWidgetContextMenu( QMenu& menu ) {};
|
|
|
|
|
|
2026-09-14 20:30:46 +02:00
|
|
|
std::vector<RimViewWindow*> removeActiveViewWindows();
|
|
|
|
|
|
2018-04-26 20:05:42 +02:00
|
|
|
protected slots:
|
2019-09-06 10:40:57 +02:00
|
|
|
void slotDockWidgetToggleViewActionTriggered();
|
2026-05-18 13:39:38 +02:00
|
|
|
void slotDockViewerVisibilityChanged( bool visible );
|
|
|
|
|
void slotDockViewerClosed();
|
2020-02-03 16:06:37 +01:00
|
|
|
void slotRefreshHelpActions();
|
2026-06-16 14:40:47 +02:00
|
|
|
void slotHideTabs( bool hideTabs );
|
2026-06-19 09:25:33 +02:00
|
|
|
void slotCentralWidgetContextMenu( const QPoint& pos );
|
2018-02-27 11:23:43 +01:00
|
|
|
|
2021-02-09 13:31:27 +01:00
|
|
|
void slotRedo();
|
|
|
|
|
void slotUndo();
|
|
|
|
|
void slotRefreshUndoRedoActions();
|
|
|
|
|
|
2022-08-10 17:06:13 +02:00
|
|
|
void setDefaultDockLayout();
|
2022-07-07 12:03:02 +02:00
|
|
|
void setDockLayout();
|
|
|
|
|
void deleteDockLayout();
|
|
|
|
|
void saveDockLayout();
|
2022-08-10 17:06:13 +02:00
|
|
|
void exportDockLayout();
|
2022-07-07 12:03:02 +02:00
|
|
|
|
2026-08-21 16:25:32 +02:00
|
|
|
void maximizeViewWindows();
|
2026-09-14 20:30:46 +02:00
|
|
|
void tileWindowsVertically();
|
|
|
|
|
void tileWindowsHorizontally();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void tileWindows( ads::DockWidgetArea whereToDock );
|
2026-08-21 16:25:32 +02:00
|
|
|
|
2018-02-27 11:23:43 +01:00
|
|
|
protected:
|
2022-01-28 13:19:52 +01:00
|
|
|
bool m_allowActiveViewChangeFromSelection; // To be used in selectedObjectsChanged() to control
|
2019-09-06 10:40:57 +02:00
|
|
|
// whether to select the corresponding active view or not
|
2021-02-09 13:31:27 +01:00
|
|
|
|
2026-08-21 16:25:32 +02:00
|
|
|
QAction* m_hideTabsAction;
|
|
|
|
|
QAction* m_tileWindowsAction;
|
|
|
|
|
QAction* m_maximizeWindowsAction;
|
2026-09-14 20:30:46 +02:00
|
|
|
QAction* m_tileHorizontallyAction;
|
|
|
|
|
QAction* m_tileVerticallyAction;
|
2026-08-21 16:25:32 +02:00
|
|
|
|
2021-02-09 13:31:27 +01:00
|
|
|
QAction* m_undoAction;
|
|
|
|
|
QAction* m_redoAction;
|
|
|
|
|
QUndoView* m_undoView;
|
|
|
|
|
|
2026-04-07 18:29:02 +02:00
|
|
|
QMenu* m_windowMenu;
|
2022-07-07 12:03:02 +02:00
|
|
|
|
2023-04-26 16:30:15 +02:00
|
|
|
QByteArray m_lastDockState;
|
|
|
|
|
|
2024-09-02 14:08:19 +02:00
|
|
|
std::vector<caf::PdmUiTreeView*> m_projectTreeViews;
|
|
|
|
|
std::vector<std::shared_ptr<caf::PdmUiPropertyView>> m_propertyViews;
|
|
|
|
|
|
2026-05-06 16:54:21 +02:00
|
|
|
QPointer<ads::CDockWidget> m_centralDockWidget;
|
|
|
|
|
|
2016-08-03 14:05:55 +02:00
|
|
|
private:
|
2019-09-06 10:40:57 +02:00
|
|
|
QString registryFolderName();
|
2019-03-28 18:30:55 +01:00
|
|
|
|
2022-01-28 13:19:52 +01:00
|
|
|
std::vector<std::unique_ptr<caf::PdmUiDragDropInterface>> m_dragDropInterfaces;
|
2026-05-06 16:54:21 +02:00
|
|
|
|
|
|
|
|
bool m_blockSubWindowActivation;
|
|
|
|
|
bool m_blockSubWindowProjectTreeSelection;
|
|
|
|
|
bool m_hasBeenVisible;
|
2026-08-23 08:55:30 +02:00
|
|
|
bool m_isBeingDestroyed;
|
2026-10-11 08:42:54 +02:00
|
|
|
bool m_hasBeenClosed;
|
2022-07-07 12:03:02 +02:00
|
|
|
|
|
|
|
|
ads::CDockManager* m_dockManager;
|
2016-06-24 15:53:04 +02:00
|
|
|
};
|