mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Prototyped commands for new treeview
This commit is contained in:
parent
f8871e9808
commit
f748b68e0c
@ -102,6 +102,7 @@ list( APPEND REFERENCED_CMAKE_FILES
|
|||||||
ProjectDataModel/CMakeLists_files.cmake
|
ProjectDataModel/CMakeLists_files.cmake
|
||||||
ModelVisualization/CMakeLists_files.cmake
|
ModelVisualization/CMakeLists_files.cmake
|
||||||
GeoMech/GeoMechVisualization/CMakeLists_files.cmake
|
GeoMech/GeoMechVisualization/CMakeLists_files.cmake
|
||||||
|
Commands/CMakeLists_files.cmake
|
||||||
)
|
)
|
||||||
|
|
||||||
# Include source file lists from *.cmake files
|
# Include source file lists from *.cmake files
|
||||||
|
23
ApplicationCode/Commands/CMakeLists_files.cmake
Normal file
23
ApplicationCode/Commands/CMakeLists_files.cmake
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
|
||||||
|
# Use this workaround until we're on 2.8.3 on all platforms and can use CMAKE_CURRENT_LIST_DIR directly
|
||||||
|
if (${CMAKE_VERSION} VERSION_GREATER "2.8.2")
|
||||||
|
set(CEE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_DIR}/)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set (SOURCE_GROUP_HEADER_FILES
|
||||||
|
${CEE_CURRENT_LIST_DIR}RicRangeFilterNew.h
|
||||||
|
)
|
||||||
|
|
||||||
|
set (SOURCE_GROUP_SOURCE_FILES
|
||||||
|
${CEE_CURRENT_LIST_DIR}RicRangeFilterNew.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
list(APPEND CODE_HEADER_FILES
|
||||||
|
${SOURCE_GROUP_HEADER_FILES}
|
||||||
|
)
|
||||||
|
|
||||||
|
list(APPEND CODE_SOURCE_FILES
|
||||||
|
${SOURCE_GROUP_SOURCE_FILES}
|
||||||
|
)
|
||||||
|
|
||||||
|
source_group( "CommandFeature" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CEE_CURRENT_LIST_DIR}CMakeLists_files.cmake )
|
124
ApplicationCode/Commands/RicRangeFilterNew.cpp
Normal file
124
ApplicationCode/Commands/RicRangeFilterNew.cpp
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2014 Ceetron Solutions AS, USFOS AS, AMOS - NTNU
|
||||||
|
//
|
||||||
|
// RPM is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// RPM is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
//
|
||||||
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||||
|
// for more details.
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "RicRangeFilterNew.h"
|
||||||
|
|
||||||
|
#include "RimCellRangeFilter.h"
|
||||||
|
#include "RimCellRangeFilterCollection.h"
|
||||||
|
#include "RimEclipseView.h"
|
||||||
|
|
||||||
|
#include "cafSelectionManager.h"
|
||||||
|
|
||||||
|
#include <QAction>
|
||||||
|
|
||||||
|
CAF_CMD_SOURCE_INIT(RicRangeFilterNew, "RicRangeFilterNew");
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RicRangeFilterNew::isCommandEnabled()
|
||||||
|
{
|
||||||
|
std::vector<RimCellRangeFilter*> selectedRangeFilter;
|
||||||
|
caf::SelectionManager::instance()->objectsByType(&selectedRangeFilter);
|
||||||
|
|
||||||
|
std::vector<RimCellRangeFilterCollection*> selectedRangeFilterCollection;
|
||||||
|
caf::SelectionManager::instance()->objectsByType(&selectedRangeFilterCollection);
|
||||||
|
|
||||||
|
if (selectedRangeFilter.size() > 0 || selectedRangeFilterCollection.size() > 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicRangeFilterNew::onActionTriggered(bool isChecked)
|
||||||
|
{
|
||||||
|
std::vector<RimCellRangeFilterCollection*> selectedRangeFilterCollection;
|
||||||
|
caf::SelectionManager::instance()->objectsByType(&selectedRangeFilterCollection);
|
||||||
|
|
||||||
|
if (selectedRangeFilterCollection.size() == 1)
|
||||||
|
{
|
||||||
|
// selectedRangeFilterCollection[0]->rangeFilters.push_back(new RimCellRangeFilter);
|
||||||
|
// selectedRangeFilterCollection[0]->reservoirView()->createDisplayModelAndRedraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
EvmProject* proj = EvaApplication::instance()->project();
|
||||||
|
|
||||||
|
std::vector<EvmNode*> selectedNodes;
|
||||||
|
caf::SelectionManager::instance()->objectsByType(&selectedNodes, caf::SelectionManager::CURRENT);
|
||||||
|
|
||||||
|
caf::CmdAddItemFeature* addItemFeature = dynamic_cast<caf::CmdAddItemFeature*>(caf::CmdFeatureManager::instance()->getCommandFeature(caf::CmdAddItemFeature::idNameStatic()));
|
||||||
|
assert(addItemFeature);
|
||||||
|
|
||||||
|
if (selectedNodes.size() > 0)
|
||||||
|
{
|
||||||
|
caf::SelectionManager::instance()->setActiveChildArrayFieldHandle(&proj->boundaryConditions);
|
||||||
|
|
||||||
|
std::vector<caf::CmdExecuteCommand*> commands;
|
||||||
|
for (size_t i = 0; i < selectedNodes.size(); i++)
|
||||||
|
{
|
||||||
|
// Not allowed to add more than one BC
|
||||||
|
if (proj->findBoundaryConditionForNode(selectedNodes[i]->id)) continue;
|
||||||
|
|
||||||
|
std::vector<caf::PdmObjectHandle*> newSelection;
|
||||||
|
newSelection.push_back(selectedNodes[i]);
|
||||||
|
caf::CmdSelectionChangeExec* selectionChangeExec = caf::CmdSelectionHelper::createSelectionCommand(newSelection, caf::SelectionManager::CURRENT);
|
||||||
|
commands.push_back(selectionChangeExec);
|
||||||
|
|
||||||
|
int indexAfter = -1;
|
||||||
|
caf::CmdAddItemExec* addItemExec = new caf::CmdAddItemExec(caf::SelectionManager::instance()->notificationCenter());
|
||||||
|
|
||||||
|
caf::CmdAddItemExecData* data = addItemExec->commandData();
|
||||||
|
data->m_rootObject = caf::PdmReferenceHelper::findRoot(&proj->nodalLoads);
|
||||||
|
data->m_pathToField = caf::PdmReferenceHelper::referenceFromRootToField(data->m_rootObject, &proj->boundaryConditions);
|
||||||
|
data->m_indexAfter = indexAfter;
|
||||||
|
|
||||||
|
commands.push_back(addItemExec);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (commands.size() > 0)
|
||||||
|
{
|
||||||
|
// Add an empty selection when boundary conditions has been assigned
|
||||||
|
std::vector<caf::PdmObjectHandle*> newSelection;
|
||||||
|
caf::CmdSelectionChangeExec* selectionChangeExec = caf::CmdSelectionHelper::createSelectionCommand(newSelection, caf::SelectionManager::CURRENT);
|
||||||
|
commands.push_back(selectionChangeExec);
|
||||||
|
}
|
||||||
|
|
||||||
|
caf::CmdExecCommandManager::instance()->processExecuteCommandsAsMacro("New Boundary Conditions", commands);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicRangeFilterNew::setupActionLook(QAction* actionToSetup)
|
||||||
|
{
|
||||||
|
// actionToSetup->setIcon(QIcon(":/Constraint16x16.png"));
|
||||||
|
actionToSetup->setText("New Range Filter");
|
||||||
|
}
|
||||||
|
|
38
ApplicationCode/Commands/RicRangeFilterNew.h
Normal file
38
ApplicationCode/Commands/RicRangeFilterNew.h
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2014 Ceetron Solutions AS, USFOS AS, AMOS - NTNU
|
||||||
|
//
|
||||||
|
// RPM is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// RPM is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
//
|
||||||
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||||
|
// for more details.
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "cafCmdFeature.h"
|
||||||
|
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class RicRangeFilterNew : public caf::CmdFeature
|
||||||
|
{
|
||||||
|
CAF_CMD_HEADER_INIT;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Overrides
|
||||||
|
virtual bool isCommandEnabled();
|
||||||
|
virtual void onActionTriggered( bool isChecked );
|
||||||
|
virtual void setupActionLook( QAction* actionToSetup );
|
||||||
|
};
|
||||||
|
|
||||||
|
|
118
ApplicationCode/Commands/RicRangeFilterNewSliceI.cpp
Normal file
118
ApplicationCode/Commands/RicRangeFilterNewSliceI.cpp
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2014 Ceetron Solutions AS, USFOS AS, AMOS - NTNU
|
||||||
|
//
|
||||||
|
// RPM is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// RPM is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
//
|
||||||
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||||
|
// for more details.
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "EvcNewBoundaryConditionSelectedItemsFeature.h"
|
||||||
|
|
||||||
|
#include "EvaApplication.h"
|
||||||
|
|
||||||
|
#include "EvmNode.h"
|
||||||
|
#include "EvmProject.h"
|
||||||
|
|
||||||
|
#include "cafCmdExecCommandManager.h"
|
||||||
|
#include "cafCmdSelectionChangeExec.h"
|
||||||
|
#include "cafCmdFeatureManager.h"
|
||||||
|
#include "cafCmdSelectionHelper.h"
|
||||||
|
#include "cafSelectionManager.h"
|
||||||
|
|
||||||
|
#include "defaultfeatures/cafCmdAddItemFeature.h"
|
||||||
|
#include "defaultfeatures/cafCmdAddItemExec.h"
|
||||||
|
#include "defaultfeatures/cafCmdAddItemExecData.h"
|
||||||
|
|
||||||
|
#include <QAction>
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
CAF_CMD_SOURCE_INIT(EvcNewBoundaryConditionSelectedItemsFeature, "EvcNewBoundaryConditionSelectedItemsFeature");
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool EvcNewBoundaryConditionSelectedItemsFeature::isCommandEnabled()
|
||||||
|
{
|
||||||
|
std::vector<EvmNode*> selectedNodes;
|
||||||
|
caf::SelectionManager::instance()->objectsByType(&selectedNodes, caf::SelectionManager::CURRENT);
|
||||||
|
|
||||||
|
if (selectedNodes.size() > 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void EvcNewBoundaryConditionSelectedItemsFeature::onActionTriggered(bool isChecked)
|
||||||
|
{
|
||||||
|
EvmProject* proj = EvaApplication::instance()->project();
|
||||||
|
|
||||||
|
std::vector<EvmNode*> selectedNodes;
|
||||||
|
caf::SelectionManager::instance()->objectsByType(&selectedNodes, caf::SelectionManager::CURRENT);
|
||||||
|
|
||||||
|
caf::CmdAddItemFeature* addItemFeature = dynamic_cast<caf::CmdAddItemFeature*>(caf::CmdFeatureManager::instance()->getCommandFeature(caf::CmdAddItemFeature::idNameStatic()));
|
||||||
|
assert(addItemFeature);
|
||||||
|
|
||||||
|
if (selectedNodes.size() > 0)
|
||||||
|
{
|
||||||
|
caf::SelectionManager::instance()->setActiveChildArrayFieldHandle(&proj->boundaryConditions);
|
||||||
|
|
||||||
|
std::vector<caf::CmdExecuteCommand*> commands;
|
||||||
|
for (size_t i = 0; i < selectedNodes.size(); i++)
|
||||||
|
{
|
||||||
|
// Not allowed to add more than one BC
|
||||||
|
if (proj->findBoundaryConditionForNode(selectedNodes[i]->id)) continue;
|
||||||
|
|
||||||
|
std::vector<caf::PdmObjectHandle*> newSelection;
|
||||||
|
newSelection.push_back(selectedNodes[i]);
|
||||||
|
caf::CmdSelectionChangeExec* selectionChangeExec = caf::CmdSelectionHelper::createSelectionCommand(newSelection, caf::SelectionManager::CURRENT);
|
||||||
|
commands.push_back(selectionChangeExec);
|
||||||
|
|
||||||
|
int indexAfter = -1;
|
||||||
|
caf::CmdAddItemExec* addItemExec = new caf::CmdAddItemExec(caf::SelectionManager::instance()->notificationCenter());
|
||||||
|
|
||||||
|
caf::CmdAddItemExecData* data = addItemExec->commandData();
|
||||||
|
data->m_rootObject = caf::PdmReferenceHelper::findRoot(&proj->nodalLoads);
|
||||||
|
data->m_pathToField = caf::PdmReferenceHelper::referenceFromRootToField(data->m_rootObject, &proj->boundaryConditions);
|
||||||
|
data->m_indexAfter = indexAfter;
|
||||||
|
|
||||||
|
commands.push_back(addItemExec);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (commands.size() > 0)
|
||||||
|
{
|
||||||
|
// Add an empty selection when boundary conditions has been assigned
|
||||||
|
std::vector<caf::PdmObjectHandle*> newSelection;
|
||||||
|
caf::CmdSelectionChangeExec* selectionChangeExec = caf::CmdSelectionHelper::createSelectionCommand(newSelection, caf::SelectionManager::CURRENT);
|
||||||
|
commands.push_back(selectionChangeExec);
|
||||||
|
}
|
||||||
|
|
||||||
|
caf::CmdExecCommandManager::instance()->processExecuteCommandsAsMacro("New Boundary Conditions", commands);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void EvcNewBoundaryConditionSelectedItemsFeature::setupActionLook(QAction* actionToSetup)
|
||||||
|
{
|
||||||
|
actionToSetup->setIcon(QIcon(":/Constraint16x16.png"));
|
||||||
|
}
|
||||||
|
|
38
ApplicationCode/Commands/RicRangeFilterNewSliceI.h
Normal file
38
ApplicationCode/Commands/RicRangeFilterNewSliceI.h
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2014 Ceetron Solutions AS, USFOS AS, AMOS - NTNU
|
||||||
|
//
|
||||||
|
// RPM is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// RPM is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
//
|
||||||
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||||
|
// for more details.
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "cafCmdFeature.h"
|
||||||
|
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class EvcNewBoundaryConditionSelectedItemsFeature : public caf::CmdFeature
|
||||||
|
{
|
||||||
|
CAF_CMD_HEADER_INIT;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Overrides
|
||||||
|
virtual bool isCommandEnabled();
|
||||||
|
virtual void onActionTriggered( bool isChecked );
|
||||||
|
virtual void setupActionLook( QAction* actionToSetup );
|
||||||
|
};
|
||||||
|
|
||||||
|
|
@ -503,3 +503,50 @@ void RimProject::computeUtmAreaOfInterest()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "cafCmdFeatureManager.h"
|
||||||
|
#include "cafSelectionManager.h"
|
||||||
|
|
||||||
|
#include "RimCellRangeFilterCollection.h"
|
||||||
|
#include "RimCellRangeFilter.h"
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimProject::actionsBasedOnSelection(std::vector<QAction*>& actions)
|
||||||
|
{
|
||||||
|
caf::CmdFeatureManager* commandManager = caf::CmdFeatureManager::instance();
|
||||||
|
|
||||||
|
std::vector<caf::PdmUiItem*> uiItems;
|
||||||
|
caf::SelectionManager::instance()->selectedItems(uiItems);
|
||||||
|
|
||||||
|
if (uiItems.size() == 1)
|
||||||
|
{
|
||||||
|
if (dynamic_cast<RimCellRangeFilterCollection*>(uiItems[0]))
|
||||||
|
{
|
||||||
|
actions.push_back(commandManager->action("RicRangeFilterNew"));
|
||||||
|
}
|
||||||
|
if (dynamic_cast<RimCellRangeFilter*>(uiItems[0]))
|
||||||
|
{
|
||||||
|
actions.push_back(commandManager->action("RicRangeFilterNew"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
for (size_t i = 0; i < uiItems.size(); i++)
|
||||||
|
{
|
||||||
|
if (dynamic_cast<RimCellRangeFilter*>(uiItems[i]))
|
||||||
|
{
|
||||||
|
actions.push_back(commandManager->action("NewRangeFilter"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
#include "cafPdmChildField.h"
|
#include "cafPdmChildField.h"
|
||||||
#include "cafPdmDocument.h"
|
#include "cafPdmDocument.h"
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
class RigCaseData;
|
class RigCaseData;
|
||||||
class RigGridManager;
|
class RigGridManager;
|
||||||
class RigMainGrid;
|
class RigMainGrid;
|
||||||
@ -35,6 +37,9 @@ class RimOilField;
|
|||||||
class RimScriptCollection;
|
class RimScriptCollection;
|
||||||
class RimWellPathImport;
|
class RimWellPathImport;
|
||||||
|
|
||||||
|
|
||||||
|
class QAction;
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
@ -70,6 +75,8 @@ public:
|
|||||||
|
|
||||||
RimOilField* activeOilField();
|
RimOilField* activeOilField();
|
||||||
|
|
||||||
|
void actionsBasedOnSelection(std::vector<QAction*>& actions);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Overridden methods
|
// Overridden methods
|
||||||
void initScriptDirectories();
|
void initScriptDirectories();
|
||||||
|
@ -69,6 +69,7 @@
|
|||||||
#include "RimGeoMechModels.h"
|
#include "RimGeoMechModels.h"
|
||||||
#include "RimGeoMechView.h"
|
#include "RimGeoMechView.h"
|
||||||
#include "RigFemPartResultsCollection.h"
|
#include "RigFemPartResultsCollection.h"
|
||||||
|
#include "cafSelectionManager.h"
|
||||||
|
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
@ -558,6 +559,9 @@ void RiuMainWindow::createDockPanels()
|
|||||||
|
|
||||||
connect(m_projectTreeView->treeView()->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
|
connect(m_projectTreeView->treeView()->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
|
||||||
this, SLOT(selectedObjectsChanged(const QItemSelection&, const QItemSelection &)));
|
this, SLOT(selectedObjectsChanged(const QItemSelection&, const QItemSelection &)));
|
||||||
|
m_projectTreeView->treeView()->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
|
connect(m_projectTreeView->treeView(), SIGNAL(customContextMenuRequested(const QPoint&)), SLOT(customMenuRequested(const QPoint&)));
|
||||||
|
|
||||||
|
|
||||||
// MODTODO
|
// MODTODO
|
||||||
//m_windowsMenu->addAction(dockWidget->toggleViewAction());
|
//m_windowsMenu->addAction(dockWidget->toggleViewAction());
|
||||||
@ -2190,11 +2194,33 @@ void RiuMainWindow::forceProjectTreeRepaint()
|
|||||||
m_OBSOLETE_treeView->scroll(0,-1);
|
m_OBSOLETE_treeView->scroll(0,-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuMainWindow::selectedObjectsChanged(const QItemSelection& selected, const QItemSelection & deselected)
|
void RiuMainWindow::selectedObjectsChanged(const QItemSelection& selected, const QItemSelection & deselected)
|
||||||
{
|
{
|
||||||
|
std::vector<caf::PdmUiItem*> uiItems;
|
||||||
|
m_projectTreeView->selectedObjects(uiItems);
|
||||||
|
|
||||||
// MODTODO
|
caf::SelectionManager::instance()->setSelectedItems(uiItems);
|
||||||
|
}
|
||||||
// Wire up update of property editor
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RiuMainWindow::customMenuRequested(const QPoint& pos)
|
||||||
|
{
|
||||||
|
QMenu menu;
|
||||||
|
|
||||||
|
std::vector<QAction*> actions;
|
||||||
|
|
||||||
|
RiaApplication* app = RiaApplication::instance();
|
||||||
|
app->project()->actionsBasedOnSelection(actions);
|
||||||
|
|
||||||
|
for (size_t i = 0; i < actions.size(); i++)
|
||||||
|
{
|
||||||
|
menu.addAction(actions[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
menu.exec(pos);
|
||||||
}
|
}
|
||||||
|
@ -279,6 +279,7 @@ private slots:
|
|||||||
void OBSOLETE_slotCurrentChanged(const QModelIndex & current, const QModelIndex & previous);
|
void OBSOLETE_slotCurrentChanged(const QModelIndex & current, const QModelIndex & previous);
|
||||||
|
|
||||||
void selectedObjectsChanged(const QItemSelection& selected, const QItemSelection & deselected);
|
void selectedObjectsChanged(const QItemSelection& selected, const QItemSelection & deselected);
|
||||||
|
void customMenuRequested(const QPoint& pos);
|
||||||
|
|
||||||
|
|
||||||
// Animation slots
|
// Animation slots
|
||||||
|
Loading…
Reference in New Issue
Block a user