(#369) Started to use the new selection method in PdmUiTreeView

This commit is contained in:
Jacob Støren
2015-08-13 23:47:04 +02:00
parent 8052a1c672
commit 343e4dcc1c
5 changed files with 51 additions and 36 deletions

View File

@@ -27,6 +27,7 @@
#include "RimOilField.h"
#include "RiaApplication.h"
#include "RiuMainWindow.h"
//--------------------------------------------------------------------------------------------------
///
@@ -72,6 +73,8 @@ void RicEclipseCaseNewGroupExec::redo()
analysisModels->caseGroups().push_back(createdObject);
analysisModels->updateConnectedEditors();
RiuMainWindow::instance()->setCurrentObjectInTreeView(createdObject);
}
}

View File

@@ -28,6 +28,7 @@
#include "cafSelectionManager.h"
#include "cvfAssert.h"
#include "RiuMainWindow.h"
//--------------------------------------------------------------------------------------------------
///
@@ -63,6 +64,8 @@ void RicEclipsePropertyFilter::addPropertyFilter(RimEclipsePropertyFilterCollect
propertyFilterCollection->reservoirView()->scheduleGeometryRegen(PROPERTY_FILTERED);
propertyFilterCollection->updateConnectedEditors();
RiuMainWindow::instance()->setCurrentObjectInTreeView(propertyFilter);
}
//--------------------------------------------------------------------------------------------------
@@ -77,6 +80,7 @@ void RicEclipsePropertyFilter::insertPropertyFilter(RimEclipsePropertyFilterColl
propertyFilterCollection->reservoirView()->scheduleGeometryRegen(PROPERTY_FILTERED);
propertyFilterCollection->updateConnectedEditors();
RiuMainWindow::instance()->setCurrentObjectInTreeView(propertyFilter);
}
//--------------------------------------------------------------------------------------------------

View File

@@ -28,6 +28,7 @@
#include "cafSelectionManager.h"
#include "cvfAssert.h"
#include "RiuMainWindow.h"
//--------------------------------------------------------------------------------------------------
///
@@ -63,6 +64,8 @@ void RicGeoMechPropertyFilter::addPropertyFilter(RimGeoMechPropertyFilterCollect
propertyFilterCollection->reservoirView()->scheduleGeometryRegen(PROPERTY_FILTERED);
propertyFilterCollection->updateConnectedEditors();
RiuMainWindow::instance()->setCurrentObjectInTreeView(propertyFilter);
}
//--------------------------------------------------------------------------------------------------
@@ -77,6 +80,8 @@ void RicGeoMechPropertyFilter::insertPropertyFilter(RimGeoMechPropertyFilterColl
propertyFilterCollection->reservoirView()->scheduleGeometryRegen(PROPERTY_FILTERED);
propertyFilterCollection->updateConnectedEditors();
RiuMainWindow::instance()->setCurrentObjectInTreeView(propertyFilter);
}
//--------------------------------------------------------------------------------------------------

View File

@@ -21,6 +21,7 @@
#include "RimCellRangeFilter.h"
#include "RimCellRangeFilterCollection.h"
#include "RimView.h"
#include "RiuMainWindow.h"
//--------------------------------------------------------------------------------------------------
@@ -102,6 +103,8 @@ void RicRangeFilterNewExec::redo()
cellRangeFilterCollection->reservoirView()->scheduleGeometryRegen(RANGE_FILTERED_INACTIVE);
cellRangeFilterCollection->updateConnectedEditors();
RiuMainWindow::instance()->setCurrentObjectInTreeView(rangeFilter);
}
//--------------------------------------------------------------------------------------------------

View File

@@ -1607,50 +1607,50 @@ void RiuMainWindow::selectedObjectsChanged()
if (uiItems.size() == 1)
{
firstSelectedObject = dynamic_cast<caf::PdmObjectHandle*>(uiItems[0]);
}
m_pdmUiPropertyView->showProperties(firstSelectedObject);
RimView* activeReservoirView = RiaApplication::instance()->activeReservoirView();
m_pdmUiPropertyView->showProperties(firstSelectedObject);
// Find the reservoir view that the selected item is within
RimView* activeReservoirView = RiaApplication::instance()->activeReservoirView();
if (!firstSelectedObject)
{
caf::PdmFieldHandle* selectedField = dynamic_cast<caf::PdmFieldHandle*>(uiItems[0]);
if (selectedField) firstSelectedObject = selectedField->ownerObject();
}
// Find the reservoir view that the selected item is within
RimView* selectedReservoirView = dynamic_cast<RimView*>(firstSelectedObject);
if (!selectedReservoirView && firstSelectedObject )
{
firstSelectedObject->firstAncestorOfType(selectedReservoirView);
}
// If current selection is an item within a different reservoir view than active,
// show new reservoir view and set this as activate view
if (selectedReservoirView && selectedReservoirView != activeReservoirView)
{
RiaApplication::instance()->setActiveReservoirView(selectedReservoirView);
// Set focus in MDI area to this window if it exists
if (selectedReservoirView->viewer())
if (!firstSelectedObject)
{
setActiveViewer(selectedReservoirView->viewer());
caf::PdmFieldHandle* selectedField = dynamic_cast<caf::PdmFieldHandle*>(uiItems[0]);
if (selectedField) firstSelectedObject = selectedField->ownerObject();
}
// m_OBSOLETE_treeView->setCurrentIndex(current);
RimView* selectedReservoirView = dynamic_cast<RimView*>(firstSelectedObject);
if (!selectedReservoirView && firstSelectedObject)
{
firstSelectedObject->firstAncestorOfType(selectedReservoirView);
}
refreshDrawStyleActions();
refreshAnimationActions();
slotRefreshFileActions();
slotRefreshEditActions();
slotRefreshViewActions();
// If current selection is an item within a different reservoir view than active,
// show new reservoir view and set this as activate view
// The only way to get to this code is by selection change initiated from the project tree view
// As we are activating an MDI-window, the focus is given to this MDI-window
// Set focus back to the tree view to be able to continue keyboard tree view navigation
m_projectTreeView->treeView()->setFocus();
if (selectedReservoirView && selectedReservoirView != activeReservoirView)
{
RiaApplication::instance()->setActiveReservoirView(selectedReservoirView);
// Set focus in MDI area to this window if it exists
if (selectedReservoirView->viewer())
{
setActiveViewer(selectedReservoirView->viewer());
}
// m_OBSOLETE_treeView->setCurrentIndex(current);
refreshDrawStyleActions();
refreshAnimationActions();
slotRefreshFileActions();
slotRefreshEditActions();
slotRefreshViewActions();
// The only way to get to this code is by selection change initiated from the project tree view
// As we are activating an MDI-window, the focus is given to this MDI-window
// Set focus back to the tree view to be able to continue keyboard tree view navigation
m_projectTreeView->treeView()->setFocus();
}
}
}
@@ -1955,7 +1955,7 @@ void RiuMainWindow::setCurrentObjectInTreeView(caf::PdmObject* object)
}
}
// Todo: m_projectTreeView->setCurrentItemInTreeView(object);
m_projectTreeView->selectAsCurrentItem(object);
}
//--------------------------------------------------------------------------------------------------