mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#846 Use one tile window feature for both main windows
This commit is contained in:
parent
95d4cd15cd
commit
7c5dbf8bc2
@ -9,7 +9,6 @@ ${CEE_CURRENT_LIST_DIR}RicLaunchUnitTestsFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicShowPlotWindowFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicShowMainWindowFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicTileWindowsFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicTilePlotWindowsFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicOpenProjectFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicOpenLastUsedFileFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicSaveProjectFeature.h
|
||||
@ -24,7 +23,6 @@ ${CEE_CURRENT_LIST_DIR}RicLaunchUnitTestsFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicShowPlotWindowFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicShowMainWindowFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicTileWindowsFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicTilePlotWindowsFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicOpenProjectFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicOpenLastUsedFileFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicSaveProjectFeature.cpp
|
||||
|
@ -1,61 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2016 Statoil ASA
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicTilePlotWindowsFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiuMainPlotWindow.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicTilePlotWindowsFeature, "RicTilePlotWindowsFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicTilePlotWindowsFeature::isCommandEnabled()
|
||||
{
|
||||
RiuMainPlotWindow* wnd = RiaApplication::instance()->mainPlotWindow();
|
||||
if (wnd)
|
||||
{
|
||||
return wnd->isAnyMdiSubWindowVisible();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicTilePlotWindowsFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RiuMainPlotWindow* wnd = RiaApplication::instance()->mainPlotWindow();
|
||||
if (wnd)
|
||||
{
|
||||
wnd->tileWindows();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicTilePlotWindowsFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Tile Windows");
|
||||
actionToSetup->setIcon(QIcon(":/TileWindows24x24.png"));
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2016 Statoil ASA
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicTilePlotWindowsFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
virtual bool isCommandEnabled();
|
||||
virtual void onActionTriggered( bool isChecked );
|
||||
virtual void setupActionLook( QAction* actionToSetup );
|
||||
};
|
||||
|
||||
|
@ -20,8 +20,10 @@
|
||||
#include "RicTileWindowsFeature.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuMainPlotWindow.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QApplication>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicTileWindowsFeature, "RicTileWindowsFeature");
|
||||
|
||||
@ -30,7 +32,20 @@ CAF_CMD_SOURCE_INIT(RicTileWindowsFeature, "RicTileWindowsFeature");
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicTileWindowsFeature::isCommandEnabled()
|
||||
{
|
||||
return RiuMainWindow::instance()->isAnyMdiSubWindowVisible();
|
||||
QWidget* topLevelWidget = QApplication::activeWindow();
|
||||
|
||||
RiuMainWindow* mainWindow = dynamic_cast<RiuMainWindow*>(topLevelWidget);
|
||||
RiuMainPlotWindow* mainPlotWindow = dynamic_cast<RiuMainPlotWindow*>(topLevelWidget);
|
||||
if (mainWindow)
|
||||
{
|
||||
return mainWindow->isAnyMdiSubWindowVisible();
|
||||
}
|
||||
else if (mainPlotWindow)
|
||||
{
|
||||
return mainPlotWindow->isAnyMdiSubWindowVisible();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -38,7 +53,18 @@ bool RicTileWindowsFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicTileWindowsFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RiuMainWindow::instance()->tileWindows();
|
||||
QWidget* topLevelWidget = QApplication::activeWindow();
|
||||
|
||||
RiuMainWindow* mainWindow = dynamic_cast<RiuMainWindow*>(topLevelWidget);
|
||||
RiuMainPlotWindow* mainPlotWindow = dynamic_cast<RiuMainPlotWindow*>(topLevelWidget);
|
||||
if (mainWindow)
|
||||
{
|
||||
mainWindow->tileWindows();
|
||||
}
|
||||
else if (mainPlotWindow)
|
||||
{
|
||||
mainPlotWindow->tileWindows();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -228,7 +228,7 @@ void RiuMainPlotWindow::createToolBars()
|
||||
QToolBar* toolbar = addToolBar(tr("Window Management"));
|
||||
toolbar->setObjectName(toolbar->windowTitle());
|
||||
toolbar->addAction(cmdFeatureMgr->action("RicShowMainWindowFeature"));
|
||||
toolbar->addAction(cmdFeatureMgr->action("RicTilePlotWindowsFeature"));
|
||||
toolbar->addAction(cmdFeatureMgr->action("RicTileWindowsFeature"));
|
||||
}
|
||||
|
||||
{
|
||||
@ -501,7 +501,7 @@ void RiuMainPlotWindow::slotBuildWindowActions()
|
||||
QAction* closeAllSubWindowsAction = new QAction("Close All Windows", this);
|
||||
connect(closeAllSubWindowsAction, SIGNAL(triggered()), m_mdiArea, SLOT(closeAllSubWindows()));
|
||||
|
||||
m_windowMenu->addAction(caf::CmdFeatureManager::instance()->action("RicTilePlotWindowsFeature"));
|
||||
m_windowMenu->addAction(caf::CmdFeatureManager::instance()->action("RicTileWindowsFeature"));
|
||||
m_windowMenu->addAction(cascadeWindowsAction);
|
||||
m_windowMenu->addAction(closeAllSubWindowsAction);
|
||||
}
|
||||
|
@ -278,16 +278,12 @@ void RiuMainWindow::createActions()
|
||||
m_viewFromBelow = new QAction(QIcon(":/UpViewArrow.png"),"Look Up", this);
|
||||
m_viewFromBelow->setToolTip("Look Up");
|
||||
|
||||
m_zoomAll = new QAction(QIcon(":/ZoomAll16x16.png"),"Zoom all", this);
|
||||
m_zoomAll->setToolTip("Zoom to view all");
|
||||
|
||||
connect(m_viewFromNorth, SIGNAL(triggered()), SLOT(slotViewFromNorth()));
|
||||
connect(m_viewFromSouth, SIGNAL(triggered()), SLOT(slotViewFromSouth()));
|
||||
connect(m_viewFromEast, SIGNAL(triggered()), SLOT(slotViewFromEast()));
|
||||
connect(m_viewFromWest, SIGNAL(triggered()), SLOT(slotViewFromWest()));
|
||||
connect(m_viewFromAbove, SIGNAL(triggered()), SLOT(slotViewFromAbove()));
|
||||
connect(m_viewFromBelow, SIGNAL(triggered()), SLOT(slotViewFromBelow()));
|
||||
connect(m_zoomAll, SIGNAL(triggered()), SLOT(slotZoomAll()));
|
||||
|
||||
// Debug actions
|
||||
m_newPropertyView = new QAction("New Project and Property View", this);
|
||||
@ -403,7 +399,7 @@ void RiuMainWindow::createMenus()
|
||||
|
||||
// View menu
|
||||
QMenu* viewMenu = menuBar()->addMenu("&View");
|
||||
viewMenu->addAction(m_zoomAll);
|
||||
viewMenu->addAction(cmdFeatureMgr->action("RicViewZoomAllFeature"));
|
||||
viewMenu->addSeparator();
|
||||
viewMenu->addAction(m_viewFromSouth);
|
||||
viewMenu->addAction(m_viewFromNorth);
|
||||
@ -479,7 +475,7 @@ void RiuMainWindow::createToolBars()
|
||||
QToolBar* toolbar = addToolBar(tr("View"));
|
||||
toolbar->setObjectName(toolbar->windowTitle());
|
||||
toolbar->addAction(cmdFeatureMgr->action("RicTogglePerspectiveViewFeature"));
|
||||
toolbar->addAction(m_zoomAll);
|
||||
toolbar->addAction(cmdFeatureMgr->action("RicViewZoomAllFeature"));
|
||||
toolbar->addAction(m_viewFromNorth);
|
||||
toolbar->addAction(m_viewFromSouth);
|
||||
toolbar->addAction(m_viewFromEast);
|
||||
@ -995,17 +991,6 @@ void RiuMainWindow::slotViewFromBelow()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMainWindow::slotZoomAll()
|
||||
{
|
||||
if (RiaApplication::instance()->activeReservoirView() && RiaApplication::instance()->activeReservoirView()->viewer())
|
||||
{
|
||||
RiaApplication::instance()->activeReservoirView()->viewer()->zoomAll();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -148,7 +148,6 @@ private:
|
||||
QAction* m_viewFromWest;
|
||||
QAction* m_viewFromAbove;
|
||||
QAction* m_viewFromBelow;
|
||||
QAction* m_zoomAll;
|
||||
|
||||
// Mock actions
|
||||
QAction* m_mockModelAction;
|
||||
@ -198,7 +197,6 @@ private slots:
|
||||
void slotViewFromWest();
|
||||
void slotViewFromAbove();
|
||||
void slotViewFromBelow();
|
||||
void slotZoomAll();
|
||||
void slotScaleChanged(int scaleValue);
|
||||
|
||||
void slotDrawStyleChanged(QAction* activatedAction);
|
||||
|
Loading…
Reference in New Issue
Block a user