(#446) Added feature "Delete all linked views"

This commit is contained in:
Magne Sjaastad 2015-09-16 14:40:50 +02:00
parent 36f5f628f3
commit 4c781b12be
5 changed files with 105 additions and 1 deletions

View File

@ -11,6 +11,7 @@ ${CEE_CURRENT_LIST_DIR}RicShowAllLinkedViewsFeature.h
${CEE_CURRENT_LIST_DIR}RicLinkViewFeature.h
${CEE_CURRENT_LIST_DIR}RicUnLinkViewFeature.h
${CEE_CURRENT_LIST_DIR}RicShowLinkOptionsFeature.h
${CEE_CURRENT_LIST_DIR}RicDeleteAllLinkedViewsFeature.h
)
set (SOURCE_GROUP_SOURCE_FILES
@ -20,6 +21,7 @@ ${CEE_CURRENT_LIST_DIR}RicShowAllLinkedViewsFeature.cpp
${CEE_CURRENT_LIST_DIR}RicLinkViewFeature.cpp
${CEE_CURRENT_LIST_DIR}RicUnLinkViewFeature.cpp
${CEE_CURRENT_LIST_DIR}RicShowLinkOptionsFeature.cpp
${CEE_CURRENT_LIST_DIR}RicDeleteAllLinkedViewsFeature.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@ -0,0 +1,62 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicDeleteAllLinkedViewsFeature.h"
#include "RiaApplication.h"
#include "RimProject.h"
#include "RimViewLinker.h"
#include "RimViewLinkerCollection.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicDeleteAllLinkedViewsFeature, "RicDeleteAllLinkedViewsFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicDeleteAllLinkedViewsFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicDeleteAllLinkedViewsFeature::onActionTriggered(bool isChecked)
{
RimProject* proj = RiaApplication::instance()->project();
if (proj->viewLinkerCollection()->viewLinker())
{
delete proj->viewLinkerCollection()->viewLinker();
proj->viewLinkerCollection()->viewLinker = NULL;
proj->uiCapability()->updateConnectedEditors();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicDeleteAllLinkedViewsFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Delete All Linked Views");
}

View File

@ -0,0 +1,38 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
#include <vector>
//==================================================================================================
///
//==================================================================================================
class RicDeleteAllLinkedViewsFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
virtual bool isCommandEnabled();
virtual void onActionTriggered( bool isChecked );
virtual void setupActionLook(QAction* actionToSetup);
};

View File

@ -805,7 +805,7 @@ void RimProject::actionsBasedOnSelection(QMenu& contextMenu)
{
commandIds << "RicShowAllLinkedViewsFeature";
commandIds << "Separator";
commandIds << "RicDeleteItemFeature";
commandIds << "RicDeleteAllLinkedViewsFeature";
}
else if (dynamic_cast<RimWellLogPlotCollection*>(uiItem))
{

View File

@ -70,6 +70,8 @@ RimViewLinker::RimViewLinker(void)
//--------------------------------------------------------------------------------------------------
RimViewLinker::~RimViewLinker(void)
{
removeOverrides();
viewLinks.deleteAllChildObjects();
}