Linked Views: Refactored and cleaned up more. Refactored some features.

This commit is contained in:
Jacob Støren
2015-09-24 14:29:13 +02:00
parent 5e0505dfe8
commit d83d9e967b
10 changed files with 131 additions and 240 deletions

View File

@@ -42,8 +42,9 @@ bool RicShowLinkOptionsFeature::isCommandEnabled()
RimView* activeView = RiaApplication::instance()->activeReservoirView();
if (!activeView) return false;
RimProject* proj = RiaApplication::instance()->project();
if (proj->findViewLinkerFromView(activeView))
RimViewController* viewController = activeView->controllingViewLink();
if (viewController)
{
return true;
}
@@ -59,28 +60,9 @@ void RicShowLinkOptionsFeature::onActionTriggered(bool isChecked)
RimView* activeView = RiaApplication::instance()->activeReservoirView();
if (!activeView) return;
RimProject* proj = RiaApplication::instance()->project();
RimViewLinker* viewLinker = proj->findViewLinkerFromView(activeView);
if (viewLinker)
{
if (viewLinker->masterView() == activeView)
{
RiuMainWindow::instance()->projectTreeView()->selectAsCurrentItem(viewLinker);
RimViewController* viewController = activeView->controllingViewLink();
return;
}
for (size_t i = 0; i < viewLinker->viewLinks.size(); i++)
{
RimViewController* viewLink = viewLinker->viewLinks[i];
if (viewLink->managedView() == activeView)
{
RiuMainWindow::instance()->projectTreeView()->selectAsCurrentItem(viewLink);
return;
}
}
}
RiuMainWindow::instance()->projectTreeView()->selectAsCurrentItem(viewController);
}
//--------------------------------------------------------------------------------------------------