2015-09-02 10:18:02 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2015- Statoil ASA
|
|
|
|
// Copyright (C) 2015- Ceetron Solutions AS
|
|
|
|
//
|
|
|
|
// 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 "RicShowAllLinkedViewsFeature.h"
|
|
|
|
|
2015-10-13 03:24:11 -05:00
|
|
|
#include "RimViewController.h"
|
2018-01-16 02:37:08 -06:00
|
|
|
#include "RimGridView.h"
|
2015-09-07 07:29:46 -05:00
|
|
|
#include "RimViewLinker.h"
|
2015-09-02 10:18:02 -05:00
|
|
|
|
|
|
|
#include "cafSelectionManager.h"
|
|
|
|
|
|
|
|
#include <QAction>
|
|
|
|
|
|
|
|
CAF_CMD_SOURCE_INIT(RicShowAllLinkedViewsFeature, "RicShowAllLinkedViewsFeature");
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RicShowAllLinkedViewsFeature::isCommandEnabled()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RicShowAllLinkedViewsFeature::onActionTriggered(bool isChecked)
|
|
|
|
{
|
2015-09-07 07:29:46 -05:00
|
|
|
std::vector<RimViewLinker*> linkedViews;
|
2015-09-02 10:18:02 -05:00
|
|
|
caf::SelectionManager::instance()->objectsByType(&linkedViews);
|
|
|
|
|
2015-09-24 04:29:01 -05:00
|
|
|
std::vector<RimViewController*> managedViews;
|
2015-09-02 10:18:02 -05:00
|
|
|
caf::SelectionManager::instance()->objectsByType(&managedViews);
|
|
|
|
for (size_t i = 0; i < managedViews.size(); i++)
|
|
|
|
{
|
2018-02-18 11:56:43 -06:00
|
|
|
RimViewLinker* rimLinked = nullptr;
|
2016-09-21 06:59:41 -05:00
|
|
|
managedViews[i]->firstAncestorOrThisOfType(rimLinked);
|
2015-10-26 04:14:45 -05:00
|
|
|
CVF_ASSERT(rimLinked);
|
2015-09-02 10:18:02 -05:00
|
|
|
|
|
|
|
linkedViews.push_back(rimLinked);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (size_t i = 0; i < linkedViews.size(); i++)
|
|
|
|
{
|
2018-01-15 07:52:22 -06:00
|
|
|
std::vector<RimGridView*> views;
|
2015-09-02 10:18:02 -05:00
|
|
|
linkedViews[i]->allViews(views);
|
|
|
|
|
|
|
|
for (size_t j = 0; j < views.size(); j++)
|
|
|
|
{
|
2017-01-20 09:25:05 -06:00
|
|
|
views[j]->forceShowWindowOn();
|
2015-09-02 10:18:02 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RicShowAllLinkedViewsFeature::setupActionLook(QAction* actionToSetup)
|
|
|
|
{
|
|
|
|
actionToSetup->setText("Open All Linked Views");
|
|
|
|
}
|
|
|
|
|