Commit 4fd29369 authored by Mike Kremer's avatar Mike Kremer
Browse files

Allow selection plugins to restrict its selection metaphors to specified data...

Allow selection plugins to restrict its selection metaphors to specified data types (or all if none is given).

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@14971 383ad7c9-94d9-4d36-a494-682f7c89f535
parent fb394e17
......@@ -72,7 +72,7 @@ class SelectionInterface {
typedef unsigned int PrimitiveType;
/// Destructor
virtual ~SelectionInterface() {};
virtual ~SelectionInterface() {}
//===========================================================================
/** @name Registering Selection Environments and primitives
......@@ -152,7 +152,7 @@ class SelectionInterface {
* @param _icon The icon for this mode (basically a type icon)
* @param _handleName The handle of the recently added selection environment. Needed for referencing
*/
virtual void addSelectionEnvironment(QString _modeName, QString _description, QIcon _icon, QString& _handleName) {};
virtual void addSelectionEnvironment(QString _modeName, QString _description, QIcon _icon, QString& _handleName) {}
/** \brief Register data type for a selection environment
*
......@@ -164,7 +164,7 @@ class SelectionInterface {
* @param _handleName The handle of the selection environment for this type
* @param _type The data type that should be added
*/
virtual void registerType(QString _handleName, DataType _type) {};
virtual void registerType(QString _handleName, DataType _type) {}
/** \brief Provide selection for primitives other than the standard ones
*
......@@ -177,7 +177,7 @@ class SelectionInterface {
* @param _icon The icon for the primitive type
* @param _typeHandle The returned handle to the added primitive type
*/
virtual void addPrimitiveType(QString _handleName, QString _name, QIcon _icon, PrimitiveType& _typeHandle) {};
virtual void addPrimitiveType(QString _handleName, QString _name, QIcon _icon, PrimitiveType& _typeHandle) {}
/** @} */
......@@ -235,7 +235,7 @@ class SelectionInterface {
* @param _show Indicates whether the mode should be available or not
* @param _associatedTypes Make this mode available only for the specified types (OR'ed)
*/
virtual void showToggleSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
virtual void showToggleSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {}
/** \brief Show lasso selection mode in a specified selection environment
*
......@@ -248,7 +248,7 @@ class SelectionInterface {
* @param _show Indicates whether the mode should be available or not
* @param _associatedTypes Make this mode available only for the specified types (OR'ed)
*/
virtual void showLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
virtual void showLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {}
/** \brief Show volume lasso selection mode in a specified selection environment
*
......@@ -261,7 +261,7 @@ class SelectionInterface {
* @param _show Indicates whether the mode should be available or not
* @param _associatedTypes Make this mode available only for the specified types (OR'ed)
*/
virtual void showVolumeLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
virtual void showVolumeLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {}
/** \brief Show surface lasso selection mode in a specified selection environment
*
......@@ -274,7 +274,7 @@ class SelectionInterface {
* @param _show Indicates whether the mode should be available or not
* @param _associatedTypes Make this mode available only for the specified types (OR'ed)
*/
virtual void showSurfaceLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
virtual void showSurfaceLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {}
/** \brief Show sphere selection mode in a specified selection environment
*
......@@ -287,7 +287,7 @@ class SelectionInterface {
* @param _show Indicates whether the mode should be available or not
* @param _associatedTypes Make this mode available only for the specified types (OR'ed)
*/
virtual void showSphereSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
virtual void showSphereSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {}
/** \brief Show closest boundary selection mode in a specified selection environment
*
......@@ -300,7 +300,7 @@ class SelectionInterface {
* @param _show Indicates whether the mode should be available or not
* @param _associatedTypes Make this mode available only for the specified types (OR'ed)
*/
virtual void showClosestBoundarySelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
virtual void showClosestBoundarySelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {}
/** \brief Show flood fill selection mode in a specified selection environment
*
......@@ -313,7 +313,7 @@ class SelectionInterface {
* @param _show Indicates whether the mode should be available or not
* @param _associatedTypes Make this mode available only for the specified types (OR'ed)
*/
virtual void showFloodFillSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
virtual void showFloodFillSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {}
/** \brief Show connected components selection mode in a specified selection environment
*
......@@ -326,7 +326,7 @@ class SelectionInterface {
* @param _show Indicates whether the mode should be available or not
* @param _associatedTypes Make this mode available only for the specified types (OR'ed)
*/
virtual void showComponentsSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
virtual void showComponentsSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {}
/** \brief Add a custom interactive selection mode
*
......@@ -347,7 +347,10 @@ class SelectionInterface {
* @param _customIdentifier Holds the identifier of the custom selection modes
*/
virtual void addCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QIcon _icon,
PrimitiveType _associatedTypes, QString& _customIdentifier) {};
PrimitiveType _associatedTypes, QString& _customIdentifier) {}
virtual void addCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QIcon _icon,
PrimitiveType _associatedTypes, QString& _customIdentifier,
DataType _objectTypeRestriction) {}
/** @} */
......@@ -370,7 +373,7 @@ class SelectionInterface {
*
* @param _types The list of currently active data types
*/
virtual void getActiveDataTypes(TypeList& _types) {};
virtual void getActiveDataTypes(TypeList& _types) {}
/** \brief Get the primitive type that is selected
*
......@@ -378,7 +381,7 @@ class SelectionInterface {
*
* @param _type Id of selected primitive type
*/
virtual void getActivePrimitiveType(PrimitiveType& _type) {};
virtual void getActivePrimitiveType(PrimitiveType& _type) {}
/** \brief Indicates whether selection should be performed on target objects only
*
......@@ -386,7 +389,7 @@ class SelectionInterface {
*
* @param _targetsOnly True if selection should restrict to target objects
*/
virtual void targetObjectsOnly(bool& _targetsOnly) {};
virtual void targetObjectsOnly(bool& _targetsOnly) {}
/** @} */
......@@ -439,7 +442,7 @@ class SelectionInterface {
*
* @param _file The file from which one can read the selection data
*/
virtual void slotLoadSelection(const INIFile& _file) {};
virtual void slotLoadSelection(const INIFile& _file) {}
/** \brief Save selection for all objects in the scene
*
......@@ -449,7 +452,7 @@ class SelectionInterface {
*
* @param _file The file into which one can store selection data
*/
virtual void slotSaveSelection(INIFile& _file) {};
virtual void slotSaveSelection(INIFile& _file) {}
public slots:
......@@ -460,7 +463,7 @@ class SelectionInterface {
* @param _objId The target object's id
* @param _filename The file in which the data is stored
*/
virtual void loadSelection(int _objId, const QString& _filename) {};
virtual void loadSelection(int _objId, const QString& _filename) {}
/** @} */
......@@ -522,7 +525,7 @@ class SelectionInterface {
* @param _key Key to register
* @param _modifiers Key modifiers (i.e. shift, control, meta keys, defaults to none)
*/
virtual void registerKeyShortcut(int _key, Qt::KeyboardModifiers _modifiers = Qt::NoModifier) {};
virtual void registerKeyShortcut(int _key, Qt::KeyboardModifiers _modifiers = Qt::NoModifier) {}
private slots:
......@@ -536,7 +539,7 @@ class SelectionInterface {
* @param _key The pressed key
* @param _modifiers Indicates whether mod-keys have been pressed synchronously
*/
virtual void slotKeyShortcutEvent(int _key, Qt::KeyboardModifiers _modifiers) {};
virtual void slotKeyShortcutEvent(int _key, Qt::KeyboardModifiers _modifiers) {}
/** @} */
......@@ -620,7 +623,7 @@ class SelectionInterface {
* @param _category The category under which the specified operations will be listed
* @param _type The primitive type for which the specified operations will be available (0u if operation should always be available)
*/
virtual void addSelectionOperations(QString _handleName, QStringList _operationsList, QString _category, PrimitiveType _type = 0u) {};
virtual void addSelectionOperations(QString _handleName, QStringList _operationsList, QString _category, PrimitiveType _type = 0u) {}
private slots:
......@@ -631,7 +634,7 @@ class SelectionInterface {
*
* @param _operation The identifier of the operation just as registered via addSelectionOperations
*/
virtual void slotSelectionOperation(QString _operation) {};
virtual void slotSelectionOperation(QString _operation) {}
/** @} */
......@@ -688,7 +691,7 @@ class SelectionInterface {
* @param _currentType The currently active primitive type
* @param _deselect True if entities should be deselected
*/
virtual void slotToggleSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
virtual void slotToggleSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {}
/** \brief Called whenever the user performs a lasso selection
*
......@@ -701,7 +704,7 @@ class SelectionInterface {
* @param _currentType The currently active primitive type
* @param _deselect True if entities should be deselected
*/
virtual void slotLassoSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
virtual void slotLassoSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {}
/** \brief Called whenever the user performs a volume lasso selection
*
......@@ -714,7 +717,7 @@ class SelectionInterface {
* @param _currentType The currently active primitive type
* @param _deselect True if entities should be deselected
*/
virtual void slotVolumeLassoSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
virtual void slotVolumeLassoSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {}
/** \brief Called whenever the user performs a surface lasso selection
*
......@@ -728,7 +731,7 @@ class SelectionInterface {
* @param _currentType The currently active primitive type
* @param _deselect True if entities should be deselected
*/
virtual void slotSurfaceLassoSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
virtual void slotSurfaceLassoSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {}
/** \brief Called whenever the user performs a sphere selection
*
......@@ -742,7 +745,7 @@ class SelectionInterface {
* @param _currentType The currently active primitive type
* @param _deselect True if entities should be deselected
*/
virtual void slotSphereSelection(QMouseEvent* _event, double _radius, PrimitiveType _currentType, bool _deselect) {};
virtual void slotSphereSelection(QMouseEvent* _event, double _radius, PrimitiveType _currentType, bool _deselect) {}
/** \brief Called whenever the user performs a closest boundary selection
*
......@@ -755,7 +758,7 @@ class SelectionInterface {
* @param _currentType The currently active primitive type
* @param _deselect True if entities should be deselected
*/
virtual void slotClosestBoundarySelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
virtual void slotClosestBoundarySelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {}
/** \brief Called whenever the user performs a flood fill selection
*
......@@ -769,7 +772,7 @@ class SelectionInterface {
* @param _currentType The currently active primitive type
* @param _deselect True if entities should be deselected
*/
virtual void slotFloodFillSelection(QMouseEvent* _event, double _maxAngle, PrimitiveType _currentType, bool _deselect) {};
virtual void slotFloodFillSelection(QMouseEvent* _event, double _maxAngle, PrimitiveType _currentType, bool _deselect) {}
/** \brief Called whenever the user performs a connected components selection
*
......@@ -781,7 +784,7 @@ class SelectionInterface {
* @param _currentType The currently active primitive type
* @param _deselect True if entities should be deselected
*/
virtual void slotComponentsSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
virtual void slotComponentsSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {}
/** \brief Called whenever the user performs a custom selection
*
......@@ -793,7 +796,7 @@ class SelectionInterface {
* @param _customIdentifier Holds the identifier of the custom selection modes
* @param _deselect True if entities should be deselected
*/
virtual void slotCustomSelection(QMouseEvent* _event, PrimitiveType _currentType, QString _customIdentifier, bool _deselect) {};
virtual void slotCustomSelection(QMouseEvent* _event, PrimitiveType _currentType, QString _customIdentifier, bool _deselect) {}
/** @} */
......@@ -817,7 +820,7 @@ class SelectionInterface {
*
* @param _operation The name of the requested operation
*/
virtual void selectionOperation(QString _operation) {};
virtual void selectionOperation(QString _operation) {}
/** \brief Emitted by selection base plugin whenever the user performs a toggle selection
......@@ -829,7 +832,7 @@ class SelectionInterface {
* @param _currentType The currently active primitive type
* @param _deselect True if entities should be deselected
*/
virtual void toggleSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
virtual void toggleSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {}
/** \brief Emitted by selection base plugin whenever the user performs a lasso selection
*
......@@ -840,7 +843,7 @@ class SelectionInterface {
* @param _currentType The currently active primitive type
* @param _deselect True if entities should be deselected
*/
virtual void lassoSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
virtual void lassoSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {}
/** \brief Emitted by selection base plugin whenever the user performs a volume lasso selection
*
......@@ -851,7 +854,7 @@ class SelectionInterface {
* @param _currentType The currently active primitive type
* @param _deselect True if entities should be deselected
*/
virtual void volumeLassoSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
virtual void volumeLassoSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {}
/** \brief Emitted by selection base plugin whenever the user performs a surface lasso selection
*
......@@ -862,7 +865,7 @@ class SelectionInterface {
* @param _currentType The currently active primitive type
* @param _deselect True if entities should be deselected
*/
virtual void surfaceLassoSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
virtual void surfaceLassoSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {}
/** \brief Emitted by selection base plugin whenever the user performs a sphere selection
*
......@@ -874,7 +877,7 @@ class SelectionInterface {
* @param _currentType The currently active primitive type
* @param _deselect True if entities should be deselected
*/
virtual void sphereSelection(QMouseEvent* _event, double _radius, PrimitiveType _currentType, bool _deselect) {};
virtual void sphereSelection(QMouseEvent* _event, double _radius, PrimitiveType _currentType, bool _deselect) {}
/** \brief Emitted by selection base plugin whenever the user performs a closest boundary selection
*
......@@ -885,7 +888,7 @@ class SelectionInterface {
* @param _currentType The currently active primitive type
* @param _deselect True if entities should be deselected
*/
virtual void closestBoundarySelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
virtual void closestBoundarySelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {}
/** \brief Emitted by selection base plugin whenever the user performs a flood fill selection
*
......@@ -897,7 +900,7 @@ class SelectionInterface {
* @param _currentType The currently active primitive type
* @param _deselect True if entities should be deselected
*/
virtual void floodFillSelection(QMouseEvent* _event, double _maxAngle, PrimitiveType _currentType, bool _deselect) {};
virtual void floodFillSelection(QMouseEvent* _event, double _maxAngle, PrimitiveType _currentType, bool _deselect) {}
/** \brief Emitted by selection base plugin whenever the user performs a connected components selection
*
......@@ -908,7 +911,7 @@ class SelectionInterface {
* @param _currentType The currently active primitive type
* @param _deselect True if entities should be deselected
*/
virtual void componentsSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
virtual void componentsSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {}
/** \brief Emitted by selection base plugin whenever the user performs a custom selection
*
......@@ -920,7 +923,7 @@ class SelectionInterface {
* @param _customIdentifier Holds the identifier of the custom selection modes
* @param _deselect True if entities should be deselected
*/
virtual void customSelection(QMouseEvent* _event, PrimitiveType _currentType, QString _customIdentifier, bool _deselect) {};
virtual void customSelection(QMouseEvent* _event, PrimitiveType _currentType, QString _customIdentifier, bool _deselect) {}
/** \brief Load selections from ini-file
*
......@@ -931,7 +934,7 @@ class SelectionInterface {
*
* @param _file The ini-file handle
*/
virtual void loadSelection(const INIFile& _file) {};
virtual void loadSelection(const INIFile& _file) {}
/** \brief Save selections into ini-file
*
......@@ -942,7 +945,7 @@ class SelectionInterface {
*
* @param _file The ini-file handle
*/
virtual void saveSelection(INIFile& _file) {};
virtual void saveSelection(INIFile& _file) {}
/** \brief Key shortcut event happened
*
......@@ -951,7 +954,7 @@ class SelectionInterface {
* @param _key Key to register
* @param _modifiers Key modifiers (i.e. shift, control, meta keys, defaults to none)
*/
virtual void keyShortcutEvent(int _key, Qt::KeyboardModifiers _modifiers = Qt::NoModifier) {};
virtual void keyShortcutEvent(int _key, Qt::KeyboardModifiers _modifiers = Qt::NoModifier) {}
/** @} */
......@@ -966,30 +969,33 @@ class SelectionInterface {
private slots:
virtual void slotAddSelectionEnvironment(QString _modeName, QString _description, QIcon _icon, QString& _handleName) {};
virtual void slotRegisterType(QString _handleName, DataType _type) {};
virtual void slotAddPrimitiveType(QString _handleName, QString _name, QIcon _icon, PrimitiveType& _typeHandle) {};
virtual void slotAddSelectionEnvironment(QString _modeName, QString _description, QIcon _icon, QString& _handleName) {}
virtual void slotRegisterType(QString _handleName, DataType _type) {}
virtual void slotAddPrimitiveType(QString _handleName, QString _name, QIcon _icon, PrimitiveType& _typeHandle) {}
virtual void slotAddCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QIcon _icon,
PrimitiveType _associatedTypes, QString& _customIdentifier) {}
virtual void slotAddCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QIcon _icon,
PrimitiveType _associatedTypes, QString& _customIdentifier) {};
PrimitiveType _associatedTypes, QString& _customIdentifier,
DataType _objectTypeRestriction) {}
virtual void slotShowToggleSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
virtual void slotShowLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
virtual void slotShowVolumeLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
virtual void slotShowSurfaceLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
virtual void slotShowSphereSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
virtual void slotShowClosestBoundarySelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
virtual void slotShowFloodFillSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
virtual void slotComponentsSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
virtual void slotShowToggleSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {}
virtual void slotShowLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {}
virtual void slotShowVolumeLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {}
virtual void slotShowSurfaceLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {}
virtual void slotShowSphereSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {}
virtual void slotShowClosestBoundarySelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {}
virtual void slotShowFloodFillSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {}
virtual void slotComponentsSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {}
virtual void slotRegisterKeyShortcut(int _key, Qt::KeyboardModifiers _modifiers) {};
virtual void slotRegisterKeyShortcut(int _key, Qt::KeyboardModifiers _modifiers) {}
virtual void slotGetActiveDataTypes(TypeList& _types) {};
virtual void slotGetActivePrimitiveType(PrimitiveType& _type) {};
virtual void slotGetActiveDataTypes(TypeList& _types) {}
virtual void slotGetActivePrimitiveType(PrimitiveType& _type) {}
virtual void slotTargetObjectsOnly(bool& _targetsOnly) {};
virtual void slotTargetObjectsOnly(bool& _targetsOnly) {}
virtual void slotAddSelectionOperations(QString _handleName, QStringList _operationsList, QString _category, PrimitiveType _type) {};
virtual void slotAddSelectionOperations(QString _handleName, QStringList _operationsList, QString _category, PrimitiveType _type) {}
/** @} */
......
......@@ -258,6 +258,9 @@ signals:
/// SelectionInterface: This signal is emitted when a custom selection mode is added
void addCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QIcon _icon,
SelectionInterface::PrimitiveType _associatedTypes, QString& _customIdentifier);
void addCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QIcon _icon,
SelectionInterface::PrimitiveType _associatedTypes, QString& _customIdentifier,
DataType _objectTypeRestriction);
/// SelectionInterface: This signal is used to add non-interactive operations for a specific primitive type
void addSelectionOperations(QString _handleName, QStringList _operationsList, QString _category, SelectionInterface::PrimitiveType _type);
......@@ -501,6 +504,9 @@ signals:
/// SelectionInterface: Add new selection mode for specified type
void slotAddCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QIcon _icon,
SelectionInterface::PrimitiveType _associatedTypes, QString& _customIdentifier);
void slotAddCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QIcon _icon,
SelectionInterface::PrimitiveType _associatedTypes, QString& _customIdentifier,
DataType _objectTypeRestriction);
/// SelectionInterface: Called in order to add non-interactive operations for a specific primitive type
void slotAddSelectionOperations(QString _handleName, QStringList _operationsList, QString _category, SelectionInterface::PrimitiveType _type);
......
......@@ -1251,9 +1251,17 @@ void Core::loadPlugin(QString filename, bool silent, QString& _licenseErrors, QO
connect(plugin , SIGNAL(addCustomSelectionMode(QString,QString,QString,QIcon,SelectionInterface::PrimitiveType,QString&)),
this , SLOT(slotAddCustomSelectionMode(QString,QString,QString,QIcon,SelectionInterface::PrimitiveType,QString&)),Qt::DirectConnection);
if ( checkSignal(plugin,"addCustomSelectionMode(QString,QString,QString,QIcon,SelectionInterface::PrimitiveType,QString&,DataType)") )
connect(plugin , SIGNAL(addCustomSelectionMode(QString,QString,QString,QIcon,SelectionInterface::PrimitiveType,QString&,DataType)),
this , SLOT(slotAddCustomSelectionMode(QString,QString,QString,QIcon,SelectionInterface::PrimitiveType,QString&,DataType)),Qt::DirectConnection);
if ( checkSlot( plugin , "slotAddCustomSelectionMode(QString,QString,QString,QIcon,SelectionInterface::PrimitiveType,QString&)" ) )
connect(this , SIGNAL(addCustomSelectionMode(QString,QString,QString,QIcon,SelectionInterface::PrimitiveType,QString&)),
plugin , SLOT(slotAddCustomSelectionMode(QString,QString,QString,QIcon,SelectionInterface::PrimitiveType,QString&)),Qt::DirectConnection);
if ( checkSlot( plugin , "slotAddCustomSelectionMode(QString,QString,QString,QIcon,SelectionInterface::PrimitiveType,QString&,DataType)" ) )
connect(this , SIGNAL(addCustomSelectionMode(QString,QString,QString,QIcon,SelectionInterface::PrimitiveType,QString&,DataType)),
plugin , SLOT(slotAddCustomSelectionMode(QString,QString,QString,QIcon,SelectionInterface::PrimitiveType,QString&,DataType)),Qt::DirectConnection);
if ( checkSignal(plugin,"addSelectionOperations(QString,QStringList,QString,SelectionInterface::PrimitiveType)") )
connect(plugin , SIGNAL(addSelectionOperations(QString,QStringList,QString,SelectionInterface::PrimitiveType)),
......
......@@ -74,6 +74,12 @@ void Core::slotAddCustomSelectionMode(QString _handleName, QString _modeName, QS
emit addCustomSelectionMode(_handleName, _modeName, _description, _icon, _associatedTypes, _customIdentifier);
}
void Core::slotAddCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QIcon _icon,
SelectionInterface::PrimitiveType _associatedTypes, QString& _customIdentifier,
DataType _objectTypeRestriction) {
emit addCustomSelectionMode(_handleName, _modeName, _description, _icon, _associatedTypes, _customIdentifier, _objectTypeRestriction);
}
void Core::slotAddSelectionOperations(QString _handleName,QStringList _operationsList, QString _category, SelectionInterface::PrimitiveType _type) {
emit addSelectionOperations(_handleName, _operationsList, _category, _type);
}
......
......@@ -43,6 +43,8 @@
#ifndef HELPERCLASSES_HH_INCLUDED
#define HELPERCLASSES_HH_INCLUDED
#include <OpenFlipper/common/DataTypes.hh>
#include <QAction>
#include <QPushButton>
#include <QGridLayout>
......@@ -51,20 +53,21 @@ class HandleAction : public QAction {
public:
/// Default constructor
HandleAction(QIcon _icon, QString _description, QObject* _parent = 0) :
HandleAction(QIcon _icon, QString _description, QObject* _parent = 0, DataType _objectTypeRestriction = DATA_ALL) :
QAction(_icon, _description, _parent),
associatedTypes_(0u) {};
associatedTypes_(0u),
objectTypeRestriction_(_objectTypeRestriction) {}
/// Default destructor
~HandleAction() {};
~HandleAction() {}
/// Get/Set selection environment handle name
void selectionEnvironmentHandle(QString _handle) { selectionEnvHandle_ = _handle; };
QString selectionEnvironmentHandle() { return selectionEnvHandle_; };
void selectionEnvironmentHandle(QString _handle) { selectionEnvHandle_ = _handle; }
QString selectionEnvironmentHandle() { return selectionEnvHandle_; }
/// Get/Set selection mode handle name
void selectionModeHandle(QString _handle) { selectionModeHandle_ = _handle; };
QString selectionModeHandle() { return selectionModeHandle_; };
void selectionModeHandle(QString _handle) { selectionModeHandle_ = _handle; }
QString selectionModeHandle() { return selectionModeHandle_; }
/// Get/Set associated primitive types
void addAssociatedType(unsigned int _associatedType) { associatedTypes_ |= _associatedType; }
......@@ -77,11 +80,21 @@ class HandleAction : public QAction {
return ((associatedTypes_ & _type) != 0);
}
void objectTypeRestriction(const DataType& _type) {
objectTypeRestriction_ = _type;
}
const DataType& objectTypeRestriction() const {
return objectTypeRestriction_;
}
private:
QString selectionEnvHandle_;
QString selectionModeHandle_;
unsigned int associatedTypes_;
DataType objectTypeRestriction_;
};
class PrimitiveAction : public QAction {
......
......@@ -100,7 +100,8 @@ sphere_mat_node_(0),
sphere_node_(0),
line_node_(0),
lassoSelection_(false),
toolIcon_(0)
toolIcon_(0),
availableObjectTypes_(0u)
{
// Reset active pick mode
......@@ -460,7 +461,7 @@ void SelectionBasePlugin::slotRegisterType(QString _handleName, DataType _type)
}
void SelectionBasePlugin::updatePickModeToolBar() {
// Add newly added primitive and tool buttons
QList<QAction*> primitivesList = primitivesBarGroup_->actions();
......@@ -492,10 +493,10 @@ void SelectionBasePlugin::updatePickModeToolBar() {
// Only activate those tools, that are available for the current
// active primitive type
for(std::map<QString,SelectionEnvironment>::iterator it = selectionEnvironments_.begin();
it != selectionEnvironments_.end(); ++it) {
// Default selection modes
toggleSelectionAction_->setEnabled(toggleSelectionAction_->isAssociated(currentPrimitiveType_, true));
lassoSelectionAction_->setEnabled(lassoSelectionAction_->isAssociated(currentPrimitiveType_, true));
......@@ -509,10 +510,10 @@ void SelectionBasePlugin::updatePickModeToolBar() {
// Custom selection modes
for(std::set<HandleAction*>::iterator cit = (*it).second.customSelectionModes.begin();
cit != (*it).second.customSelectionModes.end(); ++cit) {
(*cit)->setEnabled((*cit)->isAssociated(currentPrimitiveType_, true));
}
break;
(*cit)->setEnabled((availableObjectTypes_ & (*cit)->objectTypeRestriction()) &&
(*cit)->isAssociated(currentPrimitiveType_, true));
}
}
}
......@@ -926,7 +927,7 @@ void SelectionBasePlugin::slotPickModeChanged (const std::string& _pickmode) {
void SelectionBasePlugin::showSelectionMode(QString _mode, QIcon _icon, QString _desc, QString _handleName,
bool _show, SelectionInterface::PrimitiveType _associatedTypes,
QString& _customIdentifier, bool _custom) {
QString& _customIdentifier, bool _custom, DataType _objectTypeRestriction) {
// Find selection environment that is associated to _handleName
std::map<QString,SelectionEnvironment>::iterator it = selectionEnvironments_.find(_handleName);
......@@ -1031,7 +1032,7 @@ void SelectionBasePlugin::showSelectionMode(QString _mode, QIcon _icon, QString
_customIdentifier = getUniqueIdentifierName(QString(_handleName + "_" + _mode).replace(" ", "_"));