2016-06-24 08:53:04 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2016 Statoil ASA
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2016-06-24 08:53:04 -05: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 03:40:57 -05:00
|
|
|
//
|
2016-06-24 08:53:04 -05: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 03:40:57 -05:00
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2016-06-24 08:53:04 -05:00
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2023-04-26 09:30:15 -05:00
|
|
|
#include <QByteArray>
|
2016-06-24 08:53:04 -05:00
|
|
|
#include <QMainWindow>
|
2017-10-19 00:39:16 -05:00
|
|
|
|
2022-01-28 06:19:52 -06:00
|
|
|
#include "cafPdmUiDragDropInterface.h"
|
|
|
|
|
2023-02-02 00:41:45 -06:00
|
|
|
#include "ads_globals.h"
|
2022-07-07 05:03:02 -05:00
|
|
|
|
2022-01-28 06:19:52 -06:00
|
|
|
#include <memory>
|
|
|
|
#include <vector>
|
|
|
|
|
2022-10-31 07:26:26 -05:00
|
|
|
class RiuMdiArea;
|
2017-01-17 06:06:57 -06:00
|
|
|
struct RimMdiWindowGeometry;
|
2016-06-24 08:53:04 -05:00
|
|
|
|
2022-07-07 05:03:02 -05:00
|
|
|
class RiuMdiArea;
|
|
|
|
|
2023-02-02 00:41:45 -06:00
|
|
|
namespace ads
|
|
|
|
{
|
|
|
|
class CDockManager;
|
|
|
|
class CDockAreaWidget;
|
|
|
|
class CDockWidget;
|
|
|
|
} // namespace ads
|
|
|
|
|
2018-02-27 04:23:43 -06:00
|
|
|
namespace caf
|
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
class PdmObject;
|
|
|
|
class PdmUiTreeView;
|
|
|
|
class PdmUiItem;
|
|
|
|
} // namespace caf
|
2019-04-02 12:18:00 -05:00
|
|
|
|
2022-08-23 09:05:31 -05:00
|
|
|
class QAction;
|
2019-04-16 03:41:03 -05:00
|
|
|
class QMdiArea;
|
2019-03-29 06:00:29 -05:00
|
|
|
class QMdiSubWindow;
|
2021-02-09 06:31:27 -06:00
|
|
|
class QUndoView;
|
2019-03-28 12:30:55 -05:00
|
|
|
|
2017-10-19 00:39:16 -05:00
|
|
|
//==================================================================================================
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-10-19 00:39:16 -05:00
|
|
|
//==================================================================================================
|
2016-06-24 08:53:04 -05:00
|
|
|
class RiuMainWindowBase : public QMainWindow
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2022-07-07 05:03:02 -05:00
|
|
|
RiuMainWindowBase();
|
|
|
|
~RiuMainWindowBase() override;
|
2016-06-24 08:53:04 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
virtual QString mainWindowName() = 0;
|
|
|
|
|
2020-10-07 08:00:26 -05:00
|
|
|
QMdiSubWindow* createViewWindow();
|
|
|
|
|
2023-02-26 03:48:40 -06:00
|
|
|
virtual void removeViewer( QWidget* viewer ) = 0;
|
|
|
|
virtual void initializeViewer( QMdiSubWindow* viewWindow, QWidget* viewWidget, const RimMdiWindowGeometry& windowsGeometry ) = 0;
|
|
|
|
virtual void setActiveViewer( QWidget* subWindow ) = 0;
|
2016-06-24 08:53:04 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
virtual QMdiSubWindow* findMdiSubWindow( QWidget* viewer ) = 0;
|
2017-01-17 06:06:57 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
RimMdiWindowGeometry windowGeometryForViewer( QWidget* viewer );
|
|
|
|
void loadWinGeoAndDockToolBarLayout();
|
|
|
|
void saveWinGeoAndDockToolBarLayout();
|
|
|
|
void showWindow();
|
2017-01-17 06:06:57 -06:00
|
|
|
|
2022-01-28 06:19:52 -06: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 03:47:30 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
void selectAsCurrentItem( const caf::PdmObject* object, bool allowActiveViewChange = true );
|
2019-10-11 08:54:19 -05:00
|
|
|
void toggleItemInSelection( const caf::PdmObject* object, bool allowActiveViewChange = true );
|
2018-02-27 04:23:43 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
void enableShowFirstVisibleMdiWindowMaximized( bool enable );
|
2018-04-26 13:05:42 -05:00
|
|
|
|
2019-10-30 04:34:39 -05:00
|
|
|
void setBlockSubWindowActivatedSignal( bool block );
|
|
|
|
bool isBlockingSubWindowActivatedSignal() const;
|
2019-09-27 08:29:14 -05:00
|
|
|
|
2019-10-30 04:34:39 -05:00
|
|
|
void setBlockViewSelectionOnSubWindowActivated( bool block );
|
|
|
|
bool isBlockingViewSelectionOnSubWindowActivated() const;
|
2019-04-04 12:19:13 -05:00
|
|
|
|
2022-07-07 05:03:02 -05:00
|
|
|
ads::CDockManager* dockManager() const;
|
|
|
|
|
2022-10-31 07:26:26 -05:00
|
|
|
RiuMdiArea* mdiArea();
|
|
|
|
|
2019-04-16 03:41:03 -05:00
|
|
|
protected:
|
2022-01-28 06:19:52 -06:00
|
|
|
void createTreeViews( int numberOfTrees );
|
2022-10-31 07:26:26 -05:00
|
|
|
void removeViewerFromMdiArea( RiuMdiArea* mdiArea, QWidget* viewer );
|
2023-02-26 03:48:40 -06:00
|
|
|
void initializeSubWindow( RiuMdiArea* mdiArea, QMdiSubWindow* mdiSubWindow, const QPoint& subWindowPos, const QSize& subWindowSize );
|
2019-04-16 03:41:03 -05:00
|
|
|
|
2022-01-28 06:19:52 -06:00
|
|
|
void restoreTreeViewStates( QString treeStateString, QString treeIndexString );
|
|
|
|
|
2022-07-07 05:03:02 -05:00
|
|
|
ads::CDockAreaWidget* addTabbedWidgets( std::vector<ads::CDockWidget*> widgets,
|
|
|
|
ads::DockWidgetArea whereToDock,
|
|
|
|
ads::CDockAreaWidget* dockInside = nullptr );
|
|
|
|
|
|
|
|
void addDefaultEntriesToWindowsMenu();
|
|
|
|
|
2022-08-10 10:06:13 -05:00
|
|
|
virtual QStringList defaultDockStateNames() = 0;
|
|
|
|
|
2022-10-31 07:26:26 -05:00
|
|
|
virtual QStringList windowsMenuFeatureNames() = 0;
|
2022-08-23 09:05:31 -05:00
|
|
|
|
2018-04-26 13:05:42 -05:00
|
|
|
protected slots:
|
2019-09-06 03:40:57 -05:00
|
|
|
void slotDockWidgetToggleViewActionTriggered();
|
2020-02-03 09:06:37 -06:00
|
|
|
void slotRefreshHelpActions();
|
2018-02-27 04:23:43 -06:00
|
|
|
|
2021-02-09 06:31:27 -06:00
|
|
|
void slotRedo();
|
|
|
|
void slotUndo();
|
|
|
|
void slotRefreshUndoRedoActions();
|
|
|
|
|
2022-08-10 10:06:13 -05:00
|
|
|
void setDefaultDockLayout();
|
2022-07-07 05:03:02 -05:00
|
|
|
void setDockLayout();
|
|
|
|
void deleteDockLayout();
|
|
|
|
void saveDockLayout();
|
2022-08-10 10:06:13 -05:00
|
|
|
void exportDockLayout();
|
2022-07-07 05:03:02 -05:00
|
|
|
|
2018-02-27 04:23:43 -06:00
|
|
|
protected:
|
2022-01-28 06:19:52 -06:00
|
|
|
bool m_allowActiveViewChangeFromSelection; // To be used in selectedObjectsChanged() to control
|
2019-09-06 03:40:57 -05:00
|
|
|
// whether to select the corresponding active view or not
|
2021-02-09 06:31:27 -06:00
|
|
|
|
|
|
|
QAction* m_undoAction;
|
|
|
|
QAction* m_redoAction;
|
|
|
|
QUndoView* m_undoView;
|
|
|
|
|
2022-07-07 05:03:02 -05:00
|
|
|
RiuMdiArea* m_mdiArea;
|
|
|
|
QMenu* m_windowMenu;
|
|
|
|
|
2023-04-26 09:30:15 -05:00
|
|
|
const int DOCKSTATE_VERSION = 3;
|
|
|
|
|
|
|
|
QByteArray m_lastDockState;
|
|
|
|
|
2016-08-03 07:05:55 -05:00
|
|
|
private:
|
2019-09-06 03:40:57 -05:00
|
|
|
QString registryFolderName();
|
2019-03-28 12:30:55 -05:00
|
|
|
|
|
|
|
private:
|
2022-01-28 06:19:52 -06:00
|
|
|
std::vector<caf::PdmUiTreeView*> m_projectTreeViews;
|
|
|
|
std::vector<std::unique_ptr<caf::PdmUiDragDropInterface>> m_dragDropInterfaces;
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
bool m_showFirstVisibleWindowMaximized;
|
2019-09-27 08:29:14 -05:00
|
|
|
bool m_blockSubWindowActivation;
|
|
|
|
bool m_blockSubWindowProjectTreeSelection;
|
2022-07-07 05:03:02 -05:00
|
|
|
|
|
|
|
ads::CDockManager* m_dockManager;
|
2016-06-24 08:53:04 -05:00
|
|
|
};
|