From 296854d74965646c2826fe76793945f2e446e3b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Tue, 21 Aug 2018 15:49:44 +0200 Subject: [PATCH] caf: Rename of SelectionRole to SelectionLevel and CURRENT to FIRST_LEVEL Replace use of SelectionLevel enum as argument with int --- .../RicDeleteOptionItemFeature.cpp | 4 ++-- .../RicNewOptionItemFeature.cpp | 4 ++-- .../RicDeleteWellPathAttributeFeature.cpp | 4 ++-- .../RicDeleteWellPathTargetFeature.cpp | 4 ++-- .../RicNewWellPathAttributeFeature.cpp | 4 ++-- .../RicNewWellPathListTargetFeature.cpp | 4 ++-- .../cafCommand/cafCmdSelectionChangeExec.cpp | 4 ++-- .../cafCommand/cafCmdSelectionChangeExec.h | 4 ++-- Fwk/AppFwk/cafCommand/cafCmdSelectionHelper.cpp | 12 +++++++----- Fwk/AppFwk/cafCommand/cafCmdSelectionHelper.h | 8 +++----- .../defaultfeatures/cafCmdDeleteItemFeature.cpp | 4 ++-- .../cafPdmUiCore/cafSelectionManager.h | 12 ++++++------ .../cafUserInterface/cafPdmUiLineEditor.cpp | 2 +- .../cafUserInterface/cafPdmUiTableView.cpp | 5 +++-- Fwk/AppFwk/cafUserInterface/cafPdmUiTableView.h | 4 ++-- .../cafPdmUiTableViewEditor.cpp | 17 +++++++++-------- .../cafUserInterface/cafPdmUiTableViewEditor.h | 14 ++++++++------ .../cafUserInterface/cafPdmUiTreeViewEditor.cpp | 2 +- 18 files changed, 58 insertions(+), 54 deletions(-) diff --git a/ApplicationCode/Commands/FractureCommands/RicDeleteOptionItemFeature.cpp b/ApplicationCode/Commands/FractureCommands/RicDeleteOptionItemFeature.cpp index 6b5ea27ed4..02b73dffaa 100644 --- a/ApplicationCode/Commands/FractureCommands/RicDeleteOptionItemFeature.cpp +++ b/ApplicationCode/Commands/FractureCommands/RicDeleteOptionItemFeature.cpp @@ -33,7 +33,7 @@ CAF_CMD_SOURCE_INIT(RicDeleteOptionItemFeature, "RicDeleteOptionItemFeature"); void RicDeleteOptionItemFeature::onActionTriggered(bool isChecked) { std::vector optionItems; - caf::SelectionManager::instance()->objectsByType(&optionItems, caf::SelectionManager::CURRENT); + caf::SelectionManager::instance()->objectsByType(&optionItems, caf::SelectionManager::FIRST_LEVEL); if (!optionItems.empty()) { @@ -64,7 +64,7 @@ void RicDeleteOptionItemFeature::setupActionLook(QAction* actionToSetup) bool RicDeleteOptionItemFeature::isCommandEnabled() { std::vector optionItems; - caf::SelectionManager::instance()->objectsByType(&optionItems, caf::SelectionManager::CURRENT); + caf::SelectionManager::instance()->objectsByType(&optionItems, caf::SelectionManager::FIRST_LEVEL); return !optionItems.empty(); } diff --git a/ApplicationCode/Commands/FractureCommands/RicNewOptionItemFeature.cpp b/ApplicationCode/Commands/FractureCommands/RicNewOptionItemFeature.cpp index 3a1d94171e..1c7fc9726a 100644 --- a/ApplicationCode/Commands/FractureCommands/RicNewOptionItemFeature.cpp +++ b/ApplicationCode/Commands/FractureCommands/RicNewOptionItemFeature.cpp @@ -55,7 +55,7 @@ void RicNewOptionItemFeature::onActionTriggered(bool isChecked) { std::vector optionItems; - caf::SelectionManager::instance()->objectsByType(&optionItems, caf::SelectionManager::CURRENT); + caf::SelectionManager::instance()->objectsByType(&optionItems, caf::SelectionManager::FIRST_LEVEL); if (!optionItems.empty()) { selectedOptionItem = optionItems.front(); @@ -64,7 +64,7 @@ void RicNewOptionItemFeature::onActionTriggered(bool isChecked) } std::vector multipleFractions; - caf::SelectionManager::instance()->objectsByType(&multipleFractions, caf::SelectionManager::CURRENT); + caf::SelectionManager::instance()->objectsByType(&multipleFractions, caf::SelectionManager::FIRST_LEVEL); if (!multipleFractions.empty()) { multipleFractionUi = multipleFractions[0]; diff --git a/ApplicationCode/Commands/WellPathCommands/RicDeleteWellPathAttributeFeature.cpp b/ApplicationCode/Commands/WellPathCommands/RicDeleteWellPathAttributeFeature.cpp index 0b7d9ab30d..35e83b6f2f 100644 --- a/ApplicationCode/Commands/WellPathCommands/RicDeleteWellPathAttributeFeature.cpp +++ b/ApplicationCode/Commands/WellPathCommands/RicDeleteWellPathAttributeFeature.cpp @@ -32,7 +32,7 @@ bool RicDeleteWellPathAttributeFeature::isCommandEnabled() { { std::vector objects; - caf::SelectionManager::instance()->objectsByType(&objects, caf::SelectionManager::CURRENT); + caf::SelectionManager::instance()->objectsByType(&objects, caf::SelectionManager::FIRST_LEVEL); if ( objects.size() > 0 ) { @@ -49,7 +49,7 @@ bool RicDeleteWellPathAttributeFeature::isCommandEnabled() void RicDeleteWellPathAttributeFeature::onActionTriggered(bool isChecked) { std::vector attributes; - caf::SelectionManager::instance()->objectsByType(&attributes, caf::SelectionManager::CURRENT); + caf::SelectionManager::instance()->objectsByType(&attributes, caf::SelectionManager::FIRST_LEVEL); if (attributes.size() > 0) { RimWellPathAttributeCollection* wellPathAttributeCollection = nullptr; diff --git a/ApplicationCode/Commands/WellPathCommands/RicDeleteWellPathTargetFeature.cpp b/ApplicationCode/Commands/WellPathCommands/RicDeleteWellPathTargetFeature.cpp index 7a10ebe238..968cf83f2d 100644 --- a/ApplicationCode/Commands/WellPathCommands/RicDeleteWellPathTargetFeature.cpp +++ b/ApplicationCode/Commands/WellPathCommands/RicDeleteWellPathTargetFeature.cpp @@ -31,7 +31,7 @@ CAF_CMD_SOURCE_INIT(RicDeleteWellPathTargetFeature, "RicDeleteWellPathTargetFeat bool RicDeleteWellPathTargetFeature::isCommandEnabled() { std::vector objects; - caf::SelectionManager::instance()->objectsByType(&objects, caf::SelectionManager::CURRENT); + caf::SelectionManager::instance()->objectsByType(&objects, caf::SelectionManager::FIRST_LEVEL); if ( objects.size() > 0 ) { @@ -47,7 +47,7 @@ bool RicDeleteWellPathTargetFeature::isCommandEnabled() void RicDeleteWellPathTargetFeature::onActionTriggered(bool isChecked) { std::vector targets; - caf::SelectionManager::instance()->objectsByType(&targets, caf::SelectionManager::CURRENT); + caf::SelectionManager::instance()->objectsByType(&targets, caf::SelectionManager::FIRST_LEVEL); if (targets.size() > 0) { diff --git a/ApplicationCode/Commands/WellPathCommands/RicNewWellPathAttributeFeature.cpp b/ApplicationCode/Commands/WellPathCommands/RicNewWellPathAttributeFeature.cpp index 9ecb48b3d9..3aae604ded 100644 --- a/ApplicationCode/Commands/WellPathCommands/RicNewWellPathAttributeFeature.cpp +++ b/ApplicationCode/Commands/WellPathCommands/RicNewWellPathAttributeFeature.cpp @@ -41,7 +41,7 @@ bool RicNewWellPathAttributeFeature::isCommandEnabled() } { std::vector objects; - caf::SelectionManager::instance()->objectsByType(&objects, caf::SelectionManager::CURRENT); + caf::SelectionManager::instance()->objectsByType(&objects, caf::SelectionManager::FIRST_LEVEL); if ( objects.size() > 0 ) { @@ -58,7 +58,7 @@ bool RicNewWellPathAttributeFeature::isCommandEnabled() void RicNewWellPathAttributeFeature::onActionTriggered(bool isChecked) { std::vector attributes; - caf::SelectionManager::instance()->objectsByType(&attributes, caf::SelectionManager::CURRENT); + caf::SelectionManager::instance()->objectsByType(&attributes, caf::SelectionManager::FIRST_LEVEL); if (attributes.size() > 0) { RimWellPathAttributeCollection* attributeCollection = nullptr; diff --git a/ApplicationCode/Commands/WellPathCommands/RicNewWellPathListTargetFeature.cpp b/ApplicationCode/Commands/WellPathCommands/RicNewWellPathListTargetFeature.cpp index ad8b79599f..cc086a0364 100644 --- a/ApplicationCode/Commands/WellPathCommands/RicNewWellPathListTargetFeature.cpp +++ b/ApplicationCode/Commands/WellPathCommands/RicNewWellPathListTargetFeature.cpp @@ -41,7 +41,7 @@ bool RicNewWellPathListTargetFeature::isCommandEnabled() } { std::vector objects; - caf::SelectionManager::instance()->objectsByType(&objects, caf::SelectionManager::CURRENT); + caf::SelectionManager::instance()->objectsByType(&objects, caf::SelectionManager::FIRST_LEVEL); if ( objects.size() > 0 ) { @@ -58,7 +58,7 @@ bool RicNewWellPathListTargetFeature::isCommandEnabled() void RicNewWellPathListTargetFeature::onActionTriggered(bool isChecked) { std::vector targets; - caf::SelectionManager::instance()->objectsByType(&targets, caf::SelectionManager::CURRENT); + caf::SelectionManager::instance()->objectsByType(&targets, caf::SelectionManager::FIRST_LEVEL); if (targets.size() > 0) { auto firstTarget = targets.front(); diff --git a/Fwk/AppFwk/cafCommand/cafCmdSelectionChangeExec.cpp b/Fwk/AppFwk/cafCommand/cafCmdSelectionChangeExec.cpp index 0ea8f7b077..42300c7c13 100644 --- a/Fwk/AppFwk/cafCommand/cafCmdSelectionChangeExec.cpp +++ b/Fwk/AppFwk/cafCommand/cafCmdSelectionChangeExec.cpp @@ -57,7 +57,7 @@ QString CmdSelectionChangeExec::name() //-------------------------------------------------------------------------------------------------- void CmdSelectionChangeExec::redo() { - SelectionManager::instance()->setSelectionFromReferences(m_commandData->m_newSelection.v(), m_commandData->m_selectionRole.v()); + SelectionManager::instance()->setSelectionFromReferences(m_commandData->m_newSelection.v(), m_commandData->m_selectionLevel.v()); } //-------------------------------------------------------------------------------------------------- @@ -65,7 +65,7 @@ void CmdSelectionChangeExec::redo() //-------------------------------------------------------------------------------------------------- void CmdSelectionChangeExec::undo() { - SelectionManager::instance()->setSelectionFromReferences(m_commandData->m_previousSelection.v(), m_commandData->m_selectionRole.v()); + SelectionManager::instance()->setSelectionFromReferences(m_commandData->m_previousSelection.v(), m_commandData->m_selectionLevel.v()); } //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafCommand/cafCmdSelectionChangeExec.h b/Fwk/AppFwk/cafCommand/cafCmdSelectionChangeExec.h index f8c7782054..309238c6cd 100644 --- a/Fwk/AppFwk/cafCommand/cafCmdSelectionChangeExec.h +++ b/Fwk/AppFwk/cafCommand/cafCmdSelectionChangeExec.h @@ -61,12 +61,12 @@ public: { CAF_PDM_InitObject("CmdSelectionChangeExecData uiName", "", "CmdSelectionChangeExecData tooltip", "CmdSelectionChangeExecData whatsthis"); - CAF_PDM_InitFieldNoDefault(&m_selectionRole, "selectionRole", "selectionRole", "", "", ""); + CAF_PDM_InitFieldNoDefault(&m_selectionLevel, "selectionLevel", "selectionLevel", "", "", ""); CAF_PDM_InitField(&m_previousSelection, "previousSelection", std::vector(), "previousSelection", "", "", ""); CAF_PDM_InitField(&m_newSelection, "newSelection", std::vector(), "newSelection", "", "", ""); } - PdmField< int > m_selectionRole; + PdmField< int > m_selectionLevel; PdmField< std::vector > m_previousSelection; PdmField< std::vector > m_newSelection; }; diff --git a/Fwk/AppFwk/cafCommand/cafCmdSelectionHelper.cpp b/Fwk/AppFwk/cafCommand/cafCmdSelectionHelper.cpp index e3a78c5c62..d2d461e975 100644 --- a/Fwk/AppFwk/cafCommand/cafCmdSelectionHelper.cpp +++ b/Fwk/AppFwk/cafCommand/cafCmdSelectionHelper.cpp @@ -40,6 +40,8 @@ #include "cafCmdExecCommandManager.h" #include "cafCmdSelectionChangeExec.h" +#include "cafSelectionManager.h" + namespace caf { @@ -47,9 +49,9 @@ namespace caf //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void CmdSelectionHelper::executeSelectionCommand(const std::vector& selection, SelectionManager::SelectionRole role) +void CmdSelectionHelper::executeSelectionCommand(const std::vector& selection, int selectionLevel) { - CmdSelectionChangeExec* selectionChangeExec = createSelectionCommand(selection, role); + CmdSelectionChangeExec* selectionChangeExec = createSelectionCommand(selection, selectionLevel); CmdExecCommandManager::instance()->processExecuteCommand(selectionChangeExec); } @@ -57,11 +59,11 @@ void CmdSelectionHelper::executeSelectionCommand(const std::vector& selection, SelectionManager::SelectionRole role) +CmdSelectionChangeExec* CmdSelectionHelper::createSelectionCommand(const std::vector& selection, int selectionLevel) { CmdSelectionChangeExec* selectionChangeExec = new CmdSelectionChangeExec(SelectionManager::instance()->notificationCenter()); - selectionChangeExec->commandData()->m_selectionRole.v() = role; - SelectionManager::instance()->selectionAsReferences(selectionChangeExec->commandData()->m_previousSelection.v(), role); + selectionChangeExec->commandData()->m_selectionLevel.v() = selectionLevel; + SelectionManager::instance()->selectionAsReferences(selectionChangeExec->commandData()->m_previousSelection.v(), selectionLevel); for (size_t i = 0; i < selection.size(); i++) { diff --git a/Fwk/AppFwk/cafCommand/cafCmdSelectionHelper.h b/Fwk/AppFwk/cafCommand/cafCmdSelectionHelper.h index bb933ba9fa..1a9e919866 100644 --- a/Fwk/AppFwk/cafCommand/cafCmdSelectionHelper.h +++ b/Fwk/AppFwk/cafCommand/cafCmdSelectionHelper.h @@ -37,20 +37,18 @@ #pragma once -#include "cafSelectionManager.h" - #include - namespace caf { class CmdSelectionChangeExec; +class PdmObjectHandle; class CmdSelectionHelper { public: - static void executeSelectionCommand(const std::vector& selection, SelectionManager::SelectionRole role); - static CmdSelectionChangeExec* createSelectionCommand(const std::vector& selection, SelectionManager::SelectionRole role); + static void executeSelectionCommand(const std::vector& selection, int selectionLevel); + static CmdSelectionChangeExec* createSelectionCommand(const std::vector& selection, int selectionLevel); }; diff --git a/Fwk/AppFwk/cafCommand/defaultfeatures/cafCmdDeleteItemFeature.cpp b/Fwk/AppFwk/cafCommand/defaultfeatures/cafCmdDeleteItemFeature.cpp index 09ae65ca65..1901fd9e7d 100644 --- a/Fwk/AppFwk/cafCommand/defaultfeatures/cafCmdDeleteItemFeature.cpp +++ b/Fwk/AppFwk/cafCommand/defaultfeatures/cafCmdDeleteItemFeature.cpp @@ -58,7 +58,7 @@ namespace caf CmdExecuteCommand* CmdDeleteItemFeature::createExecuteCommand() { std::vector items; - SelectionManager::instance()->selectedItems(items, SelectionManager::CURRENT); + SelectionManager::instance()->selectedItems(items, SelectionManager::FIRST_LEVEL); caf::PdmChildArrayFieldHandle* childArrayFieldHandle = caf::SelectionManager::instance()->activeChildArrayFieldHandle(); if (!childArrayFieldHandle) return nullptr; @@ -106,7 +106,7 @@ CmdExecuteCommand* CmdDeleteItemFeature::createExecuteCommand() //-------------------------------------------------------------------------------------------------- bool CmdDeleteItemFeature::isCommandEnabled() { - caf::PdmObject* currentPdmObject = dynamic_cast(caf::SelectionManager::instance()->selectedItem(caf::SelectionManager::CURRENT)); + caf::PdmObject* currentPdmObject = dynamic_cast(caf::SelectionManager::instance()->selectedItem(caf::SelectionManager::FIRST_LEVEL)); if (!currentPdmObject) return false; caf::PdmChildArrayFieldHandle* childArrayFieldHandle = caf::SelectionManager::instance()->activeChildArrayFieldHandle(); diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafSelectionManager.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafSelectionManager.h index c80c015050..325a3e38d5 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafSelectionManager.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafSelectionManager.h @@ -57,12 +57,12 @@ class PdmChildArrayFieldHandle; class SelectionManager { public: - enum SelectionRole - { // Suggested renaming: - BASE_LEVEL, // BASE_LEVEL = 0, - CURRENT, // FIRST_LEVEL = 1, - // SECOND_LEVEL = 2, - UNDEFINED = -1 + enum SelectionLevel + { + UNDEFINED = -1, + BASE_LEVEL = 0, + FIRST_LEVEL = 1, + SECOND_LEVEL = 2 }; public: diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiLineEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiLineEditor.cpp index 72a04d689f..1f65bb9010 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiLineEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiLineEditor.cpp @@ -298,7 +298,7 @@ bool PdmUiLineEditor::isMultipleFieldsWithSameKeywordSelected(PdmFieldHandle* ed // For current selection, find all fields with same keyword std::vector items; - SelectionManager::instance()->selectedItems(items, SelectionManager::CURRENT); + SelectionManager::instance()->selectedItems(items, SelectionManager::FIRST_LEVEL); for (size_t i = 0; i < items.size(); i++) { diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTableView.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTableView.cpp index 5e2b6dbd74..6d916446f3 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTableView.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTableView.cpp @@ -40,6 +40,7 @@ #include "cafPdmChildArrayField.h" #include "cafPdmObject.h" #include "cafPdmUiTableViewEditor.h" +#include "cafSelectionManager.h" #include #include "cafPdmUiCommandSystemProxy.h" @@ -152,9 +153,9 @@ void PdmUiTableView::enableHeaderText(bool enable) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void PdmUiTableView::setSelectionRole(SelectionManager::SelectionRole role) +void PdmUiTableView::setSelectionLevel(int selectionLevel) { - m_listViewEditor->setSelectionRole(role); + m_listViewEditor->setSelectionLevel(selectionLevel); } //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTableView.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiTableView.h index c0be537a84..a0595670d0 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTableView.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTableView.h @@ -39,7 +39,7 @@ #include "cafNotificationCenter.h" #include "cafPdmUiFieldEditorHandle.h" -#include "cafSelectionManager.h" +//#include "cafSelectionManager.h" #include #include @@ -69,7 +69,7 @@ public: void setChildArrayField(PdmChildArrayFieldHandle* childArrayField); void setUiConfigurationName(QString uiConfigName); void enableHeaderText(bool enable); - void setSelectionRole(SelectionManager::SelectionRole role); + void setSelectionLevel(int selectionLevel); PdmObjectHandle* pdmObjectFromModelIndex(const QModelIndex& mi); diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewEditor.cpp index 6cc4f0f84f..2a95cbfb51 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewEditor.cpp @@ -42,6 +42,7 @@ #include "cafPdmUiEditorHandle.h" #include "cafPdmUiTableViewDelegate.h" #include "cafPdmUiTableViewQModel.h" +#include "cafSelectionManager.h" #include #include @@ -72,7 +73,7 @@ PdmUiTableViewEditor::PdmUiTableViewEditor() m_checkboxDelegate = new PdmUiCheckBoxDelegate(this); - m_selectionRole = SelectionManager::CURRENT; + m_selectionLevel = SelectionManager::FIRST_LEVEL; m_isBlockingSelectionManagerChanged = false; } @@ -142,7 +143,7 @@ void PdmUiTableViewEditor::configureAndUpdateUi(const QString& uiConfigName) { PdmUiTableViewEditorAttribute editorAttrib; childArrayFH->ownerObject()->uiCapability()->editorAttribute(childArrayFH, uiConfigName, &editorAttrib); - this->setSelectionRole(editorAttrib.selectionRole); + this->setSelectionLevel(editorAttrib.selectionLevel); this->enableHeaderText(editorAttrib.enableHeaderText); } @@ -230,9 +231,9 @@ void PdmUiTableViewEditor::enableHeaderText(bool enable) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void PdmUiTableViewEditor::setSelectionRole(SelectionManager::SelectionRole role) +void PdmUiTableViewEditor::setSelectionLevel(int selectionLevel) { - m_selectionRole = role; + m_selectionLevel = selectionLevel; } //-------------------------------------------------------------------------------------------------- @@ -242,10 +243,10 @@ void PdmUiTableViewEditor::onSelectionManagerSelectionChanged(int selectionLevel { if (m_isBlockingSelectionManagerChanged) return; - if (isSelectionRoleDefined() && (m_selectionRole == selectionLevel)) + if (isSelectionRoleDefined() && (m_selectionLevel == selectionLevel)) { std::vector items; - SelectionManager::instance()->selectedItems(items, m_selectionRole); + SelectionManager::instance()->selectedItems(items, m_selectionLevel); QItemSelection totalSelection; for (auto item: items) @@ -274,7 +275,7 @@ void PdmUiTableViewEditor::slotSelectionChanged(const QItemSelection & selected, //-------------------------------------------------------------------------------------------------- bool PdmUiTableViewEditor::isSelectionRoleDefined() const { - return m_selectionRole != SelectionManager::UNDEFINED; + return m_selectionLevel != SelectionManager::UNDEFINED; } //-------------------------------------------------------------------------------------------------- @@ -320,7 +321,7 @@ void PdmUiTableViewEditor::updateSelectionManagerFromTableSelection() } m_isBlockingSelectionManagerChanged = true; - SelectionManager::instance()->setSelectedItems(items, m_selectionRole); + SelectionManager::instance()->setSelectedItems(items, m_selectionLevel); m_isBlockingSelectionManagerChanged = false; } } diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewEditor.h index 754c286b85..0a153255a5 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewEditor.h @@ -40,7 +40,8 @@ #include "cafPdmDocument.h" #include "cafPdmUiFieldEditorHandle.h" #include "cafPdmUiObjectEditorHandle.h" -#include "cafSelectionManager.h" +#include "cafSelectionChangedReceiver.h" +//#include "cafSelectionManager.h" #include #include @@ -58,6 +59,7 @@ class PdmUiFieldEditorHandle; class PdmUiItem; class PdmUiTableViewDelegate; class PdmUiTableViewQModel; +class PdmChildArrayFieldHandle; //-------------------------------------------------------------------------------------------------- /// @@ -81,13 +83,13 @@ class PdmUiTableViewEditorAttribute : public PdmUiEditorAttribute { public: PdmUiTableViewEditorAttribute() - : selectionRole(SelectionManager::CURRENT) + : selectionLevel(1) , enableHeaderText(true) { } - SelectionManager::SelectionRole selectionRole; - bool enableHeaderText; + int selectionLevel; + bool enableHeaderText; }; @@ -105,7 +107,7 @@ public: ~PdmUiTableViewEditor(); void enableHeaderText(bool enable); - void setSelectionRole(SelectionManager::SelectionRole role); + void setSelectionLevel(int selectionLevel); PdmObjectHandle* pdmObjectFromModelIndex(const QModelIndex& mi); QTableView* tableView(); @@ -140,7 +142,7 @@ private: PdmUiCheckBoxDelegate* m_checkboxDelegate; bool m_useDefaultContextMenu; - SelectionManager::SelectionRole m_selectionRole; + int m_selectionLevel; bool m_isBlockingSelectionManagerChanged; caf::PdmChildArrayFieldHandle* m_previousFieldHandle; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp index c010ccee8a..0d6e90260c 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp @@ -279,7 +279,7 @@ void PdmUiTreeViewEditor::customMenuRequested(QPoint pos) //-------------------------------------------------------------------------------------------------- PdmChildArrayFieldHandle* PdmUiTreeViewEditor::currentChildArrayFieldHandle() { - PdmUiItem* currentSelectedItem = SelectionManager::instance()->selectedItem(SelectionManager::CURRENT); + PdmUiItem* currentSelectedItem = SelectionManager::instance()->selectedItem(SelectionManager::FIRST_LEVEL); PdmUiFieldHandle* uiFieldHandle = dynamic_cast(currentSelectedItem); if (uiFieldHandle)