mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-13 17:02:13 -05:00
#4892 Simplified Unlink View command. Works on pprimary view as well.
This commit is contained in:
1 parent
159d54477a
commit
1774d123cc
4 files changed
+47
-13
No files matched your search
@@ -31,6 +31,7 @@
|
|||||||
#include "cafSelectionManager.h"
|
#include "cafSelectionManager.h"
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
#include "RimViewLinkerCollection.h"
|
||||||
|
|
||||||
CAF_CMD_SOURCE_INIT( RicUnLinkViewFeature, "RicUnLinkViewFeature" );
|
CAF_CMD_SOURCE_INIT( RicUnLinkViewFeature, "RicUnLinkViewFeature" );
|
||||||
|
|
||||||
@@ -43,9 +44,7 @@ bool RicUnLinkViewFeature::isCommandEnabled()
|
|||||||
;
|
;
|
||||||
if ( !activeView ) return false;
|
if ( !activeView ) return false;
|
||||||
|
|
||||||
RimViewController* viewController = activeView->viewController();
|
if ( activeView->assosiatedViewLinker() )
|
||||||
|
|
||||||
if ( viewController )
|
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -63,16 +62,39 @@ void RicUnLinkViewFeature::onActionTriggered( bool isChecked )
|
|||||||
if ( !activeView ) return;
|
if ( !activeView ) return;
|
||||||
|
|
||||||
RimViewController* viewController = activeView->viewController();
|
RimViewController* viewController = activeView->viewController();
|
||||||
viewController->applyRangeFilterCollectionByUserChoice();
|
RimViewLinker* viewLinker = activeView->assosiatedViewLinker();
|
||||||
|
|
||||||
caf::SelectionManager::instance()->setSelectedItem( viewController );
|
if ( viewController )
|
||||||
caf::CmdFeature* feature = caf::CmdFeatureManager::instance()->getCommandFeature( "RicDeleteItemFeature" );
|
|
||||||
if ( feature )
|
|
||||||
{
|
{
|
||||||
feature->action()->trigger();
|
viewController->applyRangeFilterCollectionByUserChoice();
|
||||||
|
delete viewController;
|
||||||
return;
|
viewLinker->removeViewController( nullptr ); // Remove the slots in the vector that was set to nullptr by the destructor
|
||||||
}
|
}
|
||||||
|
else if ( viewLinker )
|
||||||
|
{
|
||||||
|
viewLinker->applyRangeFilterCollectionByUserChoice();
|
||||||
|
|
||||||
|
RimGridView* firstControlledView = viewLinker->firstControlledView();
|
||||||
|
|
||||||
|
if ( firstControlledView )
|
||||||
|
{
|
||||||
|
viewLinker->setMasterView(firstControlledView);
|
||||||
|
|
||||||
|
viewLinker->updateDependentViews();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Remove the view linker object from the view linker collection
|
||||||
|
// viewLinkerCollection->viewLinker is a PdmChildField containing one RimViewLinker child object
|
||||||
|
RiaApplication::instance()->project()->viewLinkerCollection->viewLinker.removeChildObject(viewLinker);
|
||||||
|
|
||||||
|
delete viewLinker;
|
||||||
|
}
|
||||||
|
activeView->updateHolder();
|
||||||
|
}
|
||||||
|
|
||||||
|
RiaApplication::instance()->project()->viewLinkerCollection.uiCapability()->updateConnectedEditors();
|
||||||
|
RiaApplication::instance()->project()->uiCapability()->updateConnectedEditors();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -82,5 +104,4 @@ void RicUnLinkViewFeature::setupActionLook( QAction* actionToSetup )
|
|||||||
{
|
{
|
||||||
actionToSetup->setText( "Unlink View" );
|
actionToSetup->setText( "Unlink View" );
|
||||||
actionToSetup->setIcon( QIcon( ":/UnLinkView16x16.png" ) );
|
actionToSetup->setIcon( QIcon( ":/UnLinkView16x16.png" ) );
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -961,7 +961,7 @@ bool RimViewController::isRangeFiltersControlled() const
|
|||||||
{
|
{
|
||||||
if ( !isRangeFilterControlPossible() ) return false;
|
if ( !isRangeFilterControlPossible() ) return false;
|
||||||
|
|
||||||
if ( ownerViewLinker()->isActive() && this->m_isActive() )
|
if (ownerViewLinker() && ownerViewLinker()->isActive() && this->m_isActive() )
|
||||||
{
|
{
|
||||||
return m_syncRangeFilters;
|
return m_syncRangeFilters;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -278,6 +278,8 @@ void RimViewLinker::allViewsForCameraSync( const RimGridView* source, std::vecto
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimViewLinker::updateDependentViews()
|
void RimViewLinker::updateDependentViews()
|
||||||
{
|
{
|
||||||
|
if (m_viewControllers.empty()) return;
|
||||||
|
|
||||||
updateOverrides();
|
updateOverrides();
|
||||||
updateCellResult();
|
updateCellResult();
|
||||||
updateScaleZ( m_masterView, m_masterView->scaleZ() );
|
updateScaleZ( m_masterView, m_masterView->scaleZ() );
|
||||||
@@ -642,7 +644,7 @@ void RimViewLinker::addViewControllers( caf::PdmUiTreeOrdering& uiTreeOrdering )
|
|||||||
{
|
{
|
||||||
for ( const auto& viewController : m_viewControllers )
|
for ( const auto& viewController : m_viewControllers )
|
||||||
{
|
{
|
||||||
uiTreeOrdering.add( viewController );
|
if (viewController) uiTreeOrdering.add( viewController );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -675,3 +677,13 @@ void RimViewLinker::removeViewController( RimViewController* viewController )
|
|||||||
{
|
{
|
||||||
m_viewControllers.removeChildObject( viewController );
|
m_viewControllers.removeChildObject( viewController );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimGridView* RimViewLinker::firstControlledView()
|
||||||
|
{
|
||||||
|
if (m_viewControllers.empty()) return nullptr;
|
||||||
|
|
||||||
|
return m_viewControllers[0]->managedView();
|
||||||
|
}
|
||||||
@@ -64,6 +64,7 @@ public:
|
|||||||
bool isFirstViewDependentOnSecondView( const RimGridView* firstView, const RimGridView* secondView ) const;
|
bool isFirstViewDependentOnSecondView( const RimGridView* firstView, const RimGridView* secondView ) const;
|
||||||
void updateDependentViews();
|
void updateDependentViews();
|
||||||
void removeViewController( RimViewController* viewController );
|
void removeViewController( RimViewController* viewController );
|
||||||
|
RimGridView* firstControlledView();
|
||||||
|
|
||||||
void updateOverrides();
|
void updateOverrides();
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user