mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-09 23:16:00 -06:00
(#446) Changed from list of ViewLinkers to one single ViewLinker
This commit is contained in:
parent
66333e0367
commit
36f5f628f3
@ -82,10 +82,9 @@ void RicLinkVisibleViewsFeature::setupActionLook(QAction* actionToSetup)
|
||||
void RicLinkVisibleViewsFeature::allLinkedViews(std::vector<RimView*>& views)
|
||||
{
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
for (size_t i = 0; i < proj->viewLinkerCollection()->viewLinkers().size(); i++)
|
||||
if (proj->viewLinkerCollection()->viewLinker())
|
||||
{
|
||||
RimViewLinker* linkedViews = proj->viewLinkerCollection()->viewLinkers()[i];
|
||||
linkedViews->allViews(views);
|
||||
proj->viewLinkerCollection()->viewLinker()->allViews(views);
|
||||
}
|
||||
}
|
||||
|
||||
@ -128,10 +127,10 @@ void RicLinkVisibleViewsFeature::linkViews(std::vector<RimView*>& views)
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
RimViewLinker* viewLinker = NULL;
|
||||
|
||||
if (proj->viewLinkerCollection->viewLinkers().size() > 0)
|
||||
if (proj->viewLinkerCollection->viewLinker())
|
||||
{
|
||||
// We have a view linker, add not already linked views
|
||||
viewLinker = proj->viewLinkerCollection->viewLinkers()[0];
|
||||
viewLinker = proj->viewLinkerCollection->viewLinker();
|
||||
|
||||
for (size_t i = 0; i < views.size(); i++)
|
||||
{
|
||||
@ -166,7 +165,7 @@ void RicLinkVisibleViewsFeature::linkViews(std::vector<RimView*>& views)
|
||||
|
||||
RimView* masterView = featureUi.masterView();
|
||||
viewLinker = new RimViewLinker;
|
||||
proj->viewLinkerCollection()->viewLinkers().push_back(viewLinker);
|
||||
proj->viewLinkerCollection()->viewLinker = viewLinker;
|
||||
viewLinker->setMainView(masterView);
|
||||
|
||||
for (size_t i = 0; i < views.size(); i++)
|
||||
|
@ -155,7 +155,8 @@ void RimProject::close()
|
||||
|
||||
commandObjects.deleteAllChildObjects();
|
||||
|
||||
viewLinkerCollection->viewLinkers().deleteAllChildObjects();
|
||||
delete viewLinkerCollection->viewLinker();
|
||||
viewLinkerCollection->viewLinker = NULL;
|
||||
|
||||
fileName = "";
|
||||
|
||||
@ -475,10 +476,9 @@ void RimProject::allNotLinkedViews(std::vector<RimView*>& views)
|
||||
allCases(cases);
|
||||
|
||||
std::vector<RimView*> alreadyLinkedViews;
|
||||
for (size_t i = 0; i < viewLinkerCollection->viewLinkers().size(); i++)
|
||||
if (viewLinkerCollection->viewLinker())
|
||||
{
|
||||
RimViewLinker* viewLinker = viewLinkerCollection->viewLinkers()[i];
|
||||
viewLinker->allViews(alreadyLinkedViews);
|
||||
viewLinkerCollection->viewLinker()->allViews(alreadyLinkedViews);
|
||||
}
|
||||
|
||||
for (size_t caseIdx = 0; caseIdx < cases.size(); caseIdx++)
|
||||
@ -938,7 +938,7 @@ void RimProject::appendScriptItems(QMenu* menu, RimScriptCollection* scriptColle
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimProject::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/)
|
||||
{
|
||||
if (viewLinkerCollection()->viewLinkers().size() > 0)
|
||||
if (viewLinkerCollection()->viewLinker())
|
||||
{
|
||||
// Use object instead of field to avoid duplicate entries in the tree view
|
||||
uiTreeOrdering.add(viewLinkerCollection());
|
||||
@ -973,9 +973,9 @@ void RimProject::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QS
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimViewLinker* RimProject::findViewLinkerFromView(RimView* view)
|
||||
{
|
||||
for (size_t i = 0; i < viewLinkerCollection()->viewLinkers().size(); i++)
|
||||
if (viewLinkerCollection()->viewLinker())
|
||||
{
|
||||
RimViewLinker* group = viewLinkerCollection()->viewLinkers()[i];
|
||||
RimViewLinker* group = viewLinkerCollection()->viewLinker();
|
||||
if (view == group->mainView()) return group;
|
||||
|
||||
for (size_t j = 0; j < group->viewLinks.size(); j++)
|
||||
|
@ -38,8 +38,8 @@ RimViewLinkerCollection::RimViewLinkerCollection(void)
|
||||
CAF_PDM_InitField(&isActive, "Active", true, "Active", "", "", "");
|
||||
isActive.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&viewLinkers, "ViewLinkers", "View Linkers", "", "", "");
|
||||
viewLinkers.uiCapability()->setUiHidden(true);
|
||||
CAF_PDM_InitFieldNoDefault(&viewLinker, "ViewLinkers", "View Linkers", "", "", "");
|
||||
viewLinker.uiCapability()->setUiHidden(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -47,7 +47,7 @@ RimViewLinkerCollection::RimViewLinkerCollection(void)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimViewLinkerCollection::~RimViewLinkerCollection(void)
|
||||
{
|
||||
viewLinkers.deleteAllChildObjects();
|
||||
if (viewLinker()) delete viewLinker();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -55,16 +55,13 @@ RimViewLinkerCollection::~RimViewLinkerCollection(void)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimViewLinkerCollection::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/)
|
||||
{
|
||||
for (size_t cIdx = 0; cIdx < viewLinkers.size(); ++cIdx)
|
||||
RimViewLinker* childObject = viewLinker();
|
||||
if (childObject)
|
||||
{
|
||||
RimViewLinker* childObject = viewLinkers[cIdx];
|
||||
if (childObject)
|
||||
uiTreeOrdering.add(childObject);
|
||||
for (size_t j = 0; j < childObject->viewLinks.size(); j++)
|
||||
{
|
||||
uiTreeOrdering.add(childObject);
|
||||
for (size_t j = 0; j < childObject->viewLinks.size(); j++)
|
||||
{
|
||||
uiTreeOrdering.add(childObject->viewLinks()[j]);
|
||||
}
|
||||
uiTreeOrdering.add(childObject->viewLinks()[j]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,16 +77,16 @@ void RimViewLinkerCollection::fieldChangedByUi(const caf::PdmFieldHandle* change
|
||||
{
|
||||
if (isActive)
|
||||
{
|
||||
for (size_t cIdx = 0; cIdx < viewLinkers.size(); ++cIdx)
|
||||
if (viewLinker())
|
||||
{
|
||||
viewLinkers[cIdx]->applyAllOperations();
|
||||
viewLinker()->applyAllOperations();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (size_t cIdx = 0; cIdx < viewLinkers.size(); ++cIdx)
|
||||
if (viewLinker())
|
||||
{
|
||||
viewLinkers[cIdx]->removeOverrides();
|
||||
viewLinker()->removeOverrides();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#include "RimDefines.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
@ -39,8 +39,8 @@ public:
|
||||
RimViewLinkerCollection(void);
|
||||
virtual ~RimViewLinkerCollection(void);
|
||||
|
||||
caf::PdmField<bool> isActive;
|
||||
caf::PdmChildArrayField<RimViewLinker*> viewLinkers;
|
||||
caf::PdmField<bool> isActive;
|
||||
caf::PdmChildField<RimViewLinker*> viewLinker;
|
||||
|
||||
protected:
|
||||
virtual caf::PdmFieldHandle* objectToggleField() { return &isActive; }
|
||||
|
Loading…
Reference in New Issue
Block a user