Bring back primary and controlled tags in linked views. Remove obsolete menu command.

This commit is contained in:
Jon Jenssen
2026-08-20 10:28:45 +02:00
committed by JJ
parent d25dad35ef
commit 35ec18a3a4
7 changed files with 20 additions and 131 deletions
@@ -1,7 +1,6 @@
set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RicLinkVisibleViewsFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicLinkVisibleViewsFeatureUi.cpp
${CMAKE_CURRENT_LIST_DIR}/RicShowAllLinkedViewsFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicLinkViewFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicUnLinkViewFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicShowLinkOptionsFeature.cpp
@@ -1,71 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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"
#include "RimGridView.h"
#include "RimViewController.h"
#include "RimViewLinker.h"
#include "RimViewLinkerCollection.h"
#include "cafSelectionManager.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicShowAllLinkedViewsFeature, "RicShowAllLinkedViewsFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicShowAllLinkedViewsFeature::isCommandEnabled() const
{
return caf::SelectionManager::instance()->selectedItemAncestorOfType<RimViewLinkerCollection>() != nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicShowAllLinkedViewsFeature::onActionTriggered( bool isChecked )
{
auto linkedViews = caf::SelectionManager::instance()->objectsByType<RimViewLinker>();
auto managedViews = caf::SelectionManager::instance()->objectsByType<RimViewController>();
for ( auto& managedView : managedViews )
{
RimViewLinker* rimLinked = managedView->firstAncestorOrThisOfTypeAsserted<RimViewLinker>();
linkedViews.push_back( rimLinked );
}
for ( auto& linkedView : linkedViews )
{
auto views = linkedView->allViews();
for ( auto& view : views )
{
view->forceShowWindowOn();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicShowAllLinkedViewsFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Open All Linked Views" );
}
@@ -1,37 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 RicShowAllLinkedViewsFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
bool isCommandEnabled() const override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};
@@ -405,22 +405,18 @@ void Rim3dView::assignIdIfNecessary()
//--------------------------------------------------------------------------------------------------
void Rim3dView::updateWindowTitle()
{
if ( m_viewer )
auto title = autoName();
if ( isMasterView() && assosiatedViewLinker() && assosiatedViewLinker()->isActive() )
{
auto title = autoName();
if ( isMasterView() && assosiatedViewLinker() && assosiatedViewLinker()->isActive() )
{
title += " (Primary)";
}
else if ( viewController() && viewController()->isActive() )
{
title += " (Controlled)";
}
m_viewer->layoutWidget()->setWindowTitle( title );
title += " (Primary)";
}
RimViewWindow::updateWindowTitle();
else if ( viewController() && viewController()->isActive() )
{
title += " (Controlled)";
}
RimViewWindow::updateWindowTitleIcon( title );
}
//--------------------------------------------------------------------------------------------------
@@ -546,14 +546,8 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
menuBuilder << "Separator";
menuBuilder << "RicDeleteScriptPathFeature";
}
else if ( dynamic_cast<RimViewController*>( firstUiItem ) )
{
menuBuilder << "RicShowAllLinkedViewsFeature";
}
else if ( dynamic_cast<RimViewLinker*>( firstUiItem ) || dynamic_cast<RimViewLinkerCollection*>( firstUiItem ) )
{
menuBuilder << "RicShowAllLinkedViewsFeature";
menuBuilder << "Separator";
menuBuilder << "RicDeleteAllLinkedViewsFeature";
}
else if ( dynamic_cast<RimWellLogPlotCollection*>( firstUiItem ) )
@@ -336,11 +336,18 @@ void RimViewWindow::fieldChangedByUi( const caf::PdmFieldHandle* changedField, c
///
//--------------------------------------------------------------------------------------------------
void RimViewWindow::updateWindowTitle()
{
updateWindowTitleIcon( windowTitle() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimViewWindow::updateWindowTitleIcon(QString title)
{
if ( viewWidget() && dockWidget() )
{
viewWidget()->setWindowTitle( windowTitle() );
dockWidget()->setWindowTitle( windowTitle() );
viewWidget()->setWindowTitle( title );
dockWidget()->setWindowTitle( title );
if ( isActiveViewer() )
{
@@ -75,6 +75,7 @@ public:
void viewNavigationChanged();
virtual void updateWindowTitle();
void updateWindowTitleIcon(QString title);
void resetDockWindowId();
QString dockWindowName();