Commit e36f5989 authored by Jan Möbius's avatar Jan Möbius
Browse files

Changed selection interface

The qicons have been replaced by QString. The path to the icon has to be given now
This avoids the problem of qpixmap creation in the selection plugins, when no gui is present
Added deprecation warning, to informa about deprecated plugin interface usage

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@15791 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 0f101415
......@@ -97,7 +97,7 @@ class SelectionInterface {
\code
emit addSelectionEnvironment("Mesh Object Selections", "Select Triangle Mesh Primitives.",
QIcon(someIconPath + "mesh_selection.png"), environmentHandle_);
someIconPath + "mesh_selection.png", environmentHandle_);
\endcode
* Now, our handle to the newly created environment is in environmentHandle_.
* We should now see a new tab widget in the selection base tool box
......@@ -118,9 +118,9 @@ class SelectionInterface {
* we want to enable selection for the three of them:
\code
emit addPrimitiveType(environmentHandle_, "Select Vertices", QIcon(iconPath + "vertexType.png"), vertexType_);
emit addPrimitiveType(environmentHandle_, "Select Edges", QIcon(iconPath + "edgeType.png"), edgeType_);
emit addPrimitiveType(environmentHandle_, "Select Faces", QIcon(iconPath + "faceType.png"), faceType_);
emit addPrimitiveType(environmentHandle_, "Select Vertices", iconPath + "vertexType.png", vertexType_);
emit addPrimitiveType(environmentHandle_, "Select Edges", iconPath + "edgeType.png", edgeType_);
emit addPrimitiveType(environmentHandle_, "Select Faces", iconPath + "faceType.png", faceType_);
\endcode
*
......@@ -149,10 +149,10 @@ class SelectionInterface {
*
* @param _modeName The name of the selection mode, e.g. "Mesh Selection"
* @param _description The description for the selection mode (also tooltip)
* @param _icon The icon for this mode (basically a type icon)
* @param _icon Path to 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, QString _icon, QString& _handleName) {};
/** \brief Register data type for a selection environment
*
......@@ -174,10 +174,10 @@ class SelectionInterface {
*
* @param _handleName The handle of the selection environment to which this type should be added
* @param _name The name of the primitive type, e.g. "B-Spline Surface Control Point"
* @param _icon The icon for the primitive type
* @param _icon Path to 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, QString _icon, PrimitiveType& _typeHandle) {};
/** @} */
......@@ -205,7 +205,7 @@ class SelectionInterface {
emit showToggleSelectionMode(environmentHandle_, true, vertexType_ | edgeType_ | faceType_);
emit showVolumeLassoSelectionMode(environmentHandle_, true, vertexType_ | edgeType_ | faceType_);
emit addCustomSelectionMode(environmentHandle_, "My Custom Selection", "Description of my mode", QIcon(someIconFile), vertexType_ | edgeType_);
emit addCustomSelectionMode(environmentHandle_, "My Custom Selection", "Description of my mode", someIconFile, vertexType_ | edgeType_);
\endcode
*
......@@ -342,11 +342,11 @@ class SelectionInterface {
* @param _handleName The handle of the selection environment in which this mode should be available
* @param _modeName The name of this mode (also button caption)
* @param _description A brief description of what the selection mode does
* @param _icon An icon which is used for this selection mode
* @param _icon Path to an icon which is used for this selection mode
* @param _associatedTypes Make this mode available only for the specified types (OR'ed)
* @param _customIdentifier Holds the identifier of the custom selection modes
*/
virtual void addCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QIcon _icon,
virtual void addCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon,
PrimitiveType _associatedTypes, QString& _customIdentifier) {};
/** \brief Add a custom interactive selection mode
......@@ -363,12 +363,12 @@ class SelectionInterface {
* @param _handleName The handle of the selection environment in which this mode should be available
* @param _modeName The name of this mode (also button caption)
* @param _description A brief description of what the selection mode does
* @param _icon An icon which is used for this selection mode
* @param _icon Path to an icon which is used for this selection mode
* @param _associatedTypes Make this mode available only for the specified types (OR'ed)
* @param _customIdentifier Holds the identifier of the custom selection modes
* @param _objectTypeRestriction Restrict the mode to this specific data type
*/
virtual void addCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QIcon _icon,
virtual void addCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon,
PrimitiveType _associatedTypes, QString& _customIdentifier,
DataType _objectTypeRestriction) {};
......@@ -993,10 +993,10 @@ class SelectionInterface {
*
* @param _modeName User visible name of the selection mode
* @param _description Description of the mode
* @param _icon Icon displayed in the selection toolbar
* @param _icon Path to an icon displayed in the selection toolbar
* @param _handleName Handle of the selection mode
*/
virtual void slotAddSelectionEnvironment(QString _modeName, QString _description, QIcon _icon, QString& _handleName) {};
virtual void slotAddSelectionEnvironment(QString _modeName, QString _description, QString _icon, QString& _handleName) {};
/** \brief Do not use. Implemented in SelectionBasePlugin
*
......@@ -1011,10 +1011,10 @@ class SelectionInterface {
*
* @param _handleName Handle of the selection mode
* @param _name User visible name of the selection mode
* @param _icon Icon displayed in the selection toolbar
* @param _icon Path to an icon displayed in the selection toolbar
* @param _typeHandle Handle for the type
*/
virtual void slotAddPrimitiveType(QString _handleName, QString _name, QIcon _icon, PrimitiveType& _typeHandle) {};
virtual void slotAddPrimitiveType(QString _handleName, QString _name, QString _icon, PrimitiveType& _typeHandle) {};
/** \brief Do not use. Implemented in SelectionBasePlugin
*
......@@ -1023,11 +1023,11 @@ class SelectionInterface {
* @param _handleName Handle of the selection mode
* @param _modeName User visible name of the selection mode
* @param _description Description of the mode
* @param _icon Icon displayed in the selection toolbar
* @param _icon Path to an icon displayed in the selection toolbar
* @param _associatedTypes primitive types supported by this mode
* @param _customIdentifier Identifier of this mode
*/
virtual void slotAddCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QIcon _icon,
virtual void slotAddCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon,
PrimitiveType _associatedTypes, QString& _customIdentifier) {};
/** \brief Do not use. Implemented in SelectionBasePlugin
......@@ -1035,12 +1035,12 @@ class SelectionInterface {
* @param _handleName Handle of the selection mode
* @param _modeName User visible name of the selection mode
* @param _description Description of the mode
* @param _icon Icon displayed in the selection toolbar
* @param _icon Path to an icon displayed in the selection toolbar
* @param _associatedTypes primitive types supported by this mode
* @param _customIdentifier Identifier of this mode
* @param _objectTypeRestriction Object types supported by this mode
*/
virtual void slotAddCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QIcon _icon,
virtual void slotAddCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon,
PrimitiveType _associatedTypes, QString& _customIdentifier,
DataType _objectTypeRestriction) {};
......@@ -1187,6 +1187,6 @@ all UI control elements and and the rendering of the selection tools whereas the
type selection plugins manage the real selection of their entities as well as scripting functions.
*/
Q_DECLARE_INTERFACE(SelectionInterface,"OpenFlipper.SelectionInterface/1.0")
Q_DECLARE_INTERFACE(SelectionInterface,"OpenFlipper.SelectionInterface/1.1")
#endif // SELECTIONINTERFACE_HH
......@@ -247,18 +247,18 @@ signals:
void getSubTextures( int _id, QString _multiTextureName, QStringList& _subTextures );
/// SelectionInterface: This signal is emitted when a new toolbutton should be added
void addSelectionEnvironment(QString _modeName, QString _description, QIcon _icon, QString& _handleName);
void addSelectionEnvironment(QString _modeName, QString _description, QString _icon, QString& _handleName);
/// SelectionInterface: This signal is emitted when a data type should be registered for a selection mode
void registerType(QString _handleName, DataType _type);
/// SelectionInterface: This signal is emitted when a selection plugin should handle a new primitive type
void addPrimitiveType(QString _handleName, QString _name, QIcon _icon, SelectionInterface::PrimitiveType& _typeHandle);
void addPrimitiveType(QString _handleName, QString _name, QString _icon, SelectionInterface::PrimitiveType& _typeHandle);
/// SelectionInterface: This signal is emitted when a custom selection mode is added
void addCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QIcon _icon,
void addCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon,
SelectionInterface::PrimitiveType _associatedTypes, QString& _customIdentifier);
void addCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QIcon _icon,
void addCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon,
SelectionInterface::PrimitiveType _associatedTypes, QString& _customIdentifier,
DataType _objectTypeRestriction);
......@@ -491,13 +491,13 @@ signals:
void slotEmptyObjectAdded ( int _id );
/// SelectionInterface: Called when a new selection type button should be added to the toolbar
void slotAddSelectionEnvironment(QString _modeName, QString _description, QIcon _icon, QString& _handleName);
void slotAddSelectionEnvironment(QString _modeName, QString _description, QString _icon, QString& _handleName);
/// SelectionInterface: Called when a data type is added for a specific selection type
void slotRegisterType(QString _handleName, DataType _type);
/// SelectionInterface: Called when a new, non-standard primitive type should be handled
void slotAddPrimitiveType(QString _handleName, QString _name, QIcon _icon, SelectionInterface::PrimitiveType& _typeHandle);
void slotAddPrimitiveType(QString _handleName, QString _name, QString _icon, SelectionInterface::PrimitiveType& _typeHandle);
/** \brief SelectionInterface: Add new selection mode for specified type
*
......@@ -508,7 +508,7 @@ signals:
* @param _associatedTypes primitive types supported by this mode
* @param _customIdentifier Identifier of this mode
*/
void slotAddCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QIcon _icon,
void slotAddCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon,
SelectionInterface::PrimitiveType _associatedTypes, QString& _customIdentifier);
/** \brief SelectionInterface: Add new selection mode for specified type
......@@ -521,7 +521,7 @@ signals:
* @param _customIdentifier Identifier of this mode
* @param _objectTypeRestriction Object types supported by this mode
*/
void slotAddCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QIcon _icon,
void slotAddCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon,
SelectionInterface::PrimitiveType _associatedTypes, QString& _customIdentifier,
DataType _objectTypeRestriction);
......
......@@ -1224,45 +1224,90 @@ void Core::loadPlugin(QString filename, bool silent, QString& _licenseErrors, QO
supported = supported + "SelectionBase ";
if ( checkSignal(plugin,"addSelectionEnvironment(QString,QString,QIcon,QString&)") )
connect(plugin , SIGNAL(addSelectionEnvironment(QString,QString,QIcon,QString&)),
this , SLOT(slotAddSelectionEnvironment(QString,QString,QIcon,QString&)),Qt::DirectConnection);
log(LOGERR,tr("Plugin uses deprecated addSelectionEnvironment(QString,QString,QIcon,QString&) , Replace the qicon by the path to the icon!"));
if ( checkSlot( plugin , "slotAddSelectionEnvironment(QString,QString,QIcon,QString&)" ) )
connect(this , SIGNAL(addSelectionEnvironment(QString,QString,QIcon,QString&)),
plugin , SLOT(slotAddSelectionEnvironment(QString,QString,QIcon,QString&)),Qt::DirectConnection);
if ( checkSignal(plugin,"addSelectionEnvironment(QString,QString,QString,QString&)") )
connect(plugin , SIGNAL(addSelectionEnvironment(QString,QString,QString,QString&)),
this , SLOT(slotAddSelectionEnvironment(QString,QString,QString,QString&)),Qt::DirectConnection);
// ===============
if ( checkSlot(plugin,"slotAddSelectionEnvironment(QString,QString,QIcon,QString&)") )
log(LOGERR,tr("Plugin uses deprecated slotAddSelectionEnvironment(QString,QString,QIcon,QString&) , Replace the qicon by the path to the icon!"));
if ( checkSlot( plugin , "slotAddSelectionEnvironment(QString,QString,QString,QString&)" ) )
connect(this , SIGNAL(addSelectionEnvironment(QString,QString,QString,QString&)),
plugin , SLOT(slotAddSelectionEnvironment(QString,QString,QString,QString&)),Qt::DirectConnection);
// ===============
if ( checkSignal(plugin,"registerType(QString,DataType)") )
connect(plugin , SIGNAL(registerType(QString,DataType)),
this , SLOT(slotRegisterType(QString,DataType)),Qt::DirectConnection);
// ===============
if ( checkSlot( plugin , "slotRegisterType(QString,DataType)" ) )
connect(this , SIGNAL(registerType(QString,DataType)),
plugin , SLOT(slotRegisterType(QString,DataType)),Qt::DirectConnection);
// ===============
if ( checkSignal(plugin,"addPrimitiveType(QString,QString,QIcon,SelectionInterface::PrimitiveType&)") )
connect(plugin , SIGNAL(addPrimitiveType(QString,QString,QIcon,SelectionInterface::PrimitiveType&)),
this , SLOT(slotAddPrimitiveType(QString,QString,QIcon,SelectionInterface::PrimitiveType&)),Qt::DirectConnection);
log(LOGERR,tr("Plugin uses deprecated addPrimitiveType(QString,QString,QIcon,SelectionInterface::PrimitiveType&) , Replace the qicon by the path to the icon!"));
if ( checkSignal(plugin,"addPrimitiveType(QString,QString,QString,SelectionInterface::PrimitiveType&)") )
connect(plugin , SIGNAL(addPrimitiveType(QString,QString,QString,SelectionInterface::PrimitiveType&)),
this , SLOT(slotAddPrimitiveType(QString,QString,QString,SelectionInterface::PrimitiveType&)),Qt::DirectConnection);
// ===============
if ( checkSlot(plugin,"slotAddPrimitiveType(QString,QString,QIcon,SelectionInterface::PrimitiveType&)") )
log(LOGERR,tr("Plugin uses deprecated slotAddPrimitiveType(QString,QString,QIcon,SelectionInterface::PrimitiveType&) , Replace the qicon by the path to the icon!"));
if ( checkSlot( plugin , "slotAddPrimitiveType(QString,QString,QString,SelectionInterface::PrimitiveType&)" ) )
connect(this , SIGNAL(addPrimitiveType(QString,QString,QString,SelectionInterface::PrimitiveType&)),
plugin , SLOT(slotAddPrimitiveType(QString,QString,QString,SelectionInterface::PrimitiveType&)),Qt::DirectConnection);
// ===============
if ( checkSlot( plugin , "slotAddPrimitiveType(QString,QString,QIcon,SelectionInterface::PrimitiveType&)" ) )
connect(this , SIGNAL(addPrimitiveType(QString,QString,QIcon,SelectionInterface::PrimitiveType&)),
plugin , SLOT(slotAddPrimitiveType(QString,QString,QIcon,SelectionInterface::PrimitiveType&)),Qt::DirectConnection);
if ( checkSignal(plugin,"addCustomSelectionMode(QString,QString,QString,QIcon,SelectionInterface::PrimitiveType,QString&)") )
connect(plugin , SIGNAL(addCustomSelectionMode(QString,QString,QString,QIcon,SelectionInterface::PrimitiveType,QString&)),
this , SLOT(slotAddCustomSelectionMode(QString,QString,QString,QIcon,SelectionInterface::PrimitiveType,QString&)),Qt::DirectConnection);
log(LOGERR,tr("Plugin uses deprecated addCustomSelectionMode(QString,QString,QString,QIcon,SelectionInterface::PrimitiveType,QString&) , Replace the qicon by the path to the icon!"));
if ( checkSignal(plugin,"addCustomSelectionMode(QString,QString,QString,QString,SelectionInterface::PrimitiveType,QString&)") )
connect(plugin , SIGNAL(addCustomSelectionMode(QString,QString,QString,QString,SelectionInterface::PrimitiveType,QString&)),
this , SLOT(slotAddCustomSelectionMode(QString,QString,QString,QString,SelectionInterface::PrimitiveType,QString&)),Qt::DirectConnection);
// ===============
if ( checkSignal(plugin,"addCustomSelectionMode(QString,QString,QString,QIcon,SelectionInterface::PrimitiveType,QString&,DataType)") )
log(LOGERR,tr("Plugin uses deprecated addCustomSelectionMode(QString,QString,QString,QIcon,SelectionInterface::PrimitiveType,QString&,DataType) , Replace the qicon by the path to the icon!"));
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&)") )
log(LOGERR,tr("Plugin uses deprecated slotAddCustomSelectionMode(QString,QString,QString,QIcon,SelectionInterface::PrimitiveType,QString&) , Replace the qicon by the path to the icon!"));
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 ( checkSlot( plugin , "slotAddCustomSelectionMode(QString,QString,QString,QString,SelectionInterface::PrimitiveType,QString&)" ) )
connect(this , SIGNAL(addCustomSelectionMode(QString,QString,QString,QString,SelectionInterface::PrimitiveType,QString&)),
plugin , SLOT(slotAddCustomSelectionMode(QString,QString,QString,QString,SelectionInterface::PrimitiveType,QString&)),Qt::DirectConnection);
// ===============
if ( checkSlot(plugin,"slotAddCustomSelectionMode(QString,QString,QString,QIcon,SelectionInterface::PrimitiveType,QString&,DataType)") )
log(LOGERR,tr("Plugin uses deprecated slotAddCustomSelectionMode(QString,QString,QString,QIcon,SelectionInterface::PrimitiveType,QString&,DataType) , Replace the qicon by the path to the icon!"));
if ( checkSlot( plugin , "slotAddCustomSelectionMode(QString,QString,QString,QString,SelectionInterface::PrimitiveType,QString&,DataType)" ) )
connect(this , SIGNAL(addCustomSelectionMode(QString,QString,QString,QString,SelectionInterface::PrimitiveType,QString&,DataType)),
plugin , SLOT(slotAddCustomSelectionMode(QString,QString,QString,QString,SelectionInterface::PrimitiveType,QString&,DataType)),Qt::DirectConnection);
// ===============
if ( checkSignal(plugin,"addSelectionOperations(QString,QStringList,QString,SelectionInterface::PrimitiveType)") )
connect(plugin , SIGNAL(addSelectionOperations(QString,QStringList,QString,SelectionInterface::PrimitiveType)),
this , SLOT(slotAddSelectionOperations(QString,QStringList,QString,SelectionInterface::PrimitiveType)),Qt::DirectConnection);
......
......@@ -57,7 +57,7 @@
// === Selection Communication ============================
//========================================================================================
void Core::slotAddSelectionEnvironment(QString _modeName, QString _description, QIcon _icon, QString& _handleName) {
void Core::slotAddSelectionEnvironment(QString _modeName, QString _description, QString _icon, QString& _handleName) {
emit addSelectionEnvironment(_modeName, _description, _icon, _handleName);
}
......@@ -65,16 +65,16 @@ void Core::slotRegisterType(QString _handleName, DataType _type) {
emit registerType(_handleName, _type);
}
void Core::slotAddPrimitiveType(QString _handleName, QString _name, QIcon _icon, SelectionInterface::PrimitiveType& _typeHandle) {
void Core::slotAddPrimitiveType(QString _handleName, QString _name, QString _icon, SelectionInterface::PrimitiveType& _typeHandle) {
emit addPrimitiveType(_handleName, _name, _icon, _typeHandle);
}
void Core::slotAddCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QIcon _icon,
void Core::slotAddCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon,
SelectionInterface::PrimitiveType _associatedTypes, QString& _customIdentifier) {
emit addCustomSelectionMode(_handleName, _modeName, _description, _icon, _associatedTypes, _customIdentifier);
}
void Core::slotAddCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QIcon _icon,
void Core::slotAddCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon,
SelectionInterface::PrimitiveType _associatedTypes, QString& _customIdentifier,
DataType _objectTypeRestriction) {
emit addCustomSelectionMode(_handleName, _modeName, _description, _icon, _associatedTypes, _customIdentifier, _objectTypeRestriction);
......
......@@ -91,45 +91,45 @@ void BSplineCurveSelectionPlugin::initializePlugin() {
void BSplineCurveSelectionPlugin::pluginsInitialized() {
// Create new selection environment for skeletons
// and register skeleton data type for the environment.
QString iconPath = OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator();
emit addSelectionEnvironment("B-Spline Curve Selections", "Select B-Spline curve primitives.",
QIcon(iconPath + "bsplinecurve.png"), environmentHandle_);
iconPath + "bsplinecurve.png", environmentHandle_);
// Register mesh object types
emit registerType(environmentHandle_, DATA_BSPLINE_CURVE);
emit addPrimitiveType(environmentHandle_, "Select Control Points", QIcon(iconPath + CONTROL_POINT_TYPE), controlPointType_);
emit addPrimitiveType(environmentHandle_, "Select Knots", QIcon(iconPath + KNOT_TYPE), knotType_);
emit addPrimitiveType(environmentHandle_, "Select Control Points", iconPath + CONTROL_POINT_TYPE, controlPointType_);
emit addPrimitiveType(environmentHandle_, "Select Knots", iconPath + KNOT_TYPE, knotType_);
allSupportedTypes_ = controlPointType_ | knotType_;
// Determine, which selection modes are requested
emit showToggleSelectionMode(environmentHandle_, true, allSupportedTypes_);
emit showVolumeLassoSelectionMode(environmentHandle_, true, allSupportedTypes_);
QStringList generalOperations;
generalOperations.append(G_CP_MODE);
generalOperations.append(G_K_MODE);
// Define control point and knot operations
QStringList controlPointOperations;
controlPointOperations.append(CP_SELECT_ALL);
controlPointOperations.append(CP_DESELECT_ALL);
controlPointOperations.append(CP_INVERT);
controlPointOperations.append(CP_DELETE);
QStringList knotOperations;
knotOperations.append(K_SELECT_ALL);
knotOperations.append(K_DESELECT_ALL);
knotOperations.append(K_INVERT);
knotOperations.append(K_DELETE);
emit addSelectionOperations(environmentHandle_, generalOperations, "Selection Operations");
emit addSelectionOperations(environmentHandle_, controlPointOperations, "Control Point Operations", controlPointType_);
emit addSelectionOperations(environmentHandle_, knotOperations, "Knot Operations", knotType_);
// Register key shortcuts:
// Select (a)ll
......
......@@ -101,9 +101,9 @@ signals:
void scriptInfo(QString _functionName);
// SelectionInterface
void addSelectionEnvironment(QString _modeName, QString _description, QIcon _icon, QString& _handleName);
void addSelectionEnvironment(QString _modeName, QString _description, QString _icon, QString& _handleName);
void registerType(QString _handleName, DataType _type);
void addPrimitiveType(QString _handleName, QString _name, QIcon _icon, SelectionInterface::PrimitiveType& _typeHandle);
void addPrimitiveType(QString _handleName, QString _name, QString _icon, SelectionInterface::PrimitiveType& _typeHandle);
void addSelectionOperations(QString _handleName, QStringList _operationsList, QString _category, SelectionInterface::PrimitiveType _type = 0u);
void showToggleSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
void showVolumeLassoSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
......
......@@ -97,13 +97,13 @@ void BSplineSurfaceSelectionPlugin::pluginsInitialized() {
QString iconPath = OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator();
emit addSelectionEnvironment("B-Spline Surface Selections", "Select B-Spline surface primitives.",
QIcon(iconPath + "bsplinesurface.png"), environmentHandle_);
iconPath + "bsplinesurface.png", environmentHandle_);
// Register mesh object types
emit registerType(environmentHandle_, DATA_BSPLINE_SURFACE);
emit addPrimitiveType(environmentHandle_, "Select Control Points", QIcon(iconPath + CONTROL_POINT_TYPE), controlPointType_);
emit addPrimitiveType(environmentHandle_, "Select Knots", QIcon(iconPath + KNOT_TYPE), knotType_);
emit addPrimitiveType(environmentHandle_, "Select Control Points", iconPath + CONTROL_POINT_TYPE, controlPointType_);
emit addPrimitiveType(environmentHandle_, "Select Knots", iconPath + KNOT_TYPE, knotType_);
allSupportedTypes_ = controlPointType_ | knotType_;
......
......@@ -101,9 +101,9 @@ signals:
void scriptInfo(QString _functionName);
// SelectionInterface
void addSelectionEnvironment(QString _modeName, QString _description, QIcon _icon, QString& _handleName);
void addSelectionEnvironment(QString _modeName, QString _description, QString _icon, QString& _handleName);
void registerType(QString _handleName, DataType _type);
void addPrimitiveType(QString _handleName, QString _name, QIcon _icon, SelectionInterface::PrimitiveType& _typeHandle);
void addPrimitiveType(QString _handleName, QString _name, QString _icon, SelectionInterface::PrimitiveType& _typeHandle);
void addSelectionOperations(QString _handleName, QStringList _operationsList, QString _category, SelectionInterface::PrimitiveType _type = 0u);
void showToggleSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
void showVolumeLassoSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
......
......@@ -384,7 +384,8 @@ void SelectionBasePlugin::slotKeyReleaseEvent(QKeyEvent* _event) {
//============================================================================================
void SelectionBasePlugin::slotAddSelectionEnvironment(QString _modeName, QString _description, QIcon _icon, QString& _handleName) {
void SelectionBasePlugin::slotAddSelectionEnvironment(QString _modeName, QString _description, QString _icon, QString& _handleName) {
/*
A new selection environment is to be added. We first test if the
associated selection environment already exists. If not, we create
......@@ -406,14 +407,18 @@ void SelectionBasePlugin::slotAddSelectionEnvironment(QString _modeName, QString
SelectionTypeFrameWidget* tab = createNewTypeFrame(env);
// Add type frame to tab widget
int index = tool_->typeTabWidget->addTab(tab, _icon, _modeName);
env.tabWidget = tool_->typeTabWidget->widget(index);
// Disable type frame unless there's at least one
// object of the desired type in the scene
tool_->typeTabWidget->setTabEnabled(index, false);
tool_->typeTabWidget->widget(index)->setEnabled(false);
if ( OpenFlipper::Options::gui () ) {
// Add type frame to tab widget
int index = tool_->typeTabWidget->addTab(tab, QIcon(_icon), _modeName);
env.tabWidget = tool_->typeTabWidget->widget(index);
// Disable type frame unless there's at least one
// object of the desired type in the scene
tool_->typeTabWidget->setTabEnabled(index, false);
tool_->typeTabWidget->widget(index)->setEnabled(false);
}
// Create a unique handle name for this selection environment
_handleName = getUniqueHandleName("h_" + _modeName.replace(" ", "_"));
......@@ -569,7 +574,7 @@ void SelectionBasePlugin::slotMouseEvent(QMouseEvent* _event) {
//============================================================================================
void SelectionBasePlugin::slotAddPrimitiveType(QString _handleName, QString _name, QIcon _icon, SelectionInterface::PrimitiveType& _typeHandle) {
void SelectionBasePlugin::slotAddPrimitiveType(QString _handleName, QString _name, QString _icon, SelectionInterface::PrimitiveType& _typeHandle) {
if ( OpenFlipper::Options::nogui() )
return;
......@@ -602,7 +607,7 @@ void SelectionBasePlugin::slotAddPrimitiveType(QString _handleName, QString _nam
}
// Add custom primitive type
PrimitiveAction* action = new PrimitiveAction(_icon, _name, env.primitiveActions);
PrimitiveAction* action = new PrimitiveAction(QIcon(_icon), _name, env.primitiveActions);
action->setCheckable(true);
action->selectionEnvironmentHandle(_handleName);
primitivesBarGroup_->addAction(action);
......@@ -930,7 +935,7 @@ void SelectionBasePlugin::slotPickModeChanged (const std::string& _pickmode) {
//============================================================================================
void SelectionBasePlugin::showSelectionMode(QString _mode, QIcon _icon, QString _desc, QString _handleName,
void SelectionBasePlugin::showSelectionMode(QString _mode, QString _icon, QString _desc, QString _handleName,
bool _show, SelectionInterface::PrimitiveType _associatedTypes,
QString& _customIdentifier, bool _custom, DataType _objectTypeRestriction) {
......@@ -1040,7 +1045,7 @@ void SelectionBasePlugin::showSelectionMode(QString _mode, QIcon _icon, QString
_customIdentifier = getUniqueIdentifierName(QString(_handleName + "_" + _mode).replace(" ", "_"));
// Create action
HandleAction* action = new HandleAction(_icon, _desc, selectionModesGroup_, _objectTypeRestriction);
HandleAction* action = new HandleAction(QIcon(_icon), _desc, selectionModesGroup_, _objectTypeRestriction);
action->setCheckable(true);
action->selectionEnvironmentHandle(_handleName);
action->selectionModeHandle(_customIdentifier);
......@@ -1076,7 +1081,7 @@ void SelectionBasePlugin::showSelectionMode(QString _mode, QIcon _icon, QString
//============================================================================================
void SelectionBasePlugin::slotAddCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QIcon _icon,
void SelectionBasePlugin::slotAddCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon,
SelectionInterface::PrimitiveType _associatedTypes, QString& _customIdentifier) {
showSelectionMode(_modeName, _icon, _description, _handleName, true, _associatedTypes, _customIdentifier, true);
......@@ -1085,7 +1090,7 @@ void SelectionBasePlugin::slotAddCustomSelectionMode(QString _handleName, QStrin
//============================================================================================
void SelectionBasePlugin::slotAddCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QIcon _icon,
void SelectionBasePlugin::slotAddCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon,
SelectionInterface::PrimitiveType _associatedTypes, QString& _customIdentifier,
DataType _objectTypeRestriction) {
......@@ -1098,9 +1103,8 @@ void SelectionBasePlugin::slotAddCustomSelectionMode(QString _handleName, QStrin
void SelectionBasePlugin::slotShowToggleSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes) {
QString iconPath = OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator();
QIcon icon(iconPath + TOGGLE_IMG);
QString dummy;
showSelectionMode(SB_TOGGLE, icon, TOGGLE_DESC, _handleName, _show, _associatedTypes, dummy);
showSelectionMode(SB_TOGGLE, iconPath + TOGGLE_IMG, TOGGLE_DESC, _handleName, _show, _associatedTypes, dummy);
updatePickModeToolBar();
}
......@@ -1109,9 +1113,8 @@ void SelectionBasePlugin::slotShowToggleSelectionMode(QString _handleName, bool
void SelectionBasePlugin::slotShowLassoSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes) {
QString iconPath = OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator();
QIcon icon(iconPath + LASSO_IMG);
QString dummy;
showSelectionMode(SB_LASSO, icon, LASSO_DESC, _handleName, _show, _associatedTypes, dummy);
showSelectionMode(SB_LASSO, iconPath + LASSO_IMG, LASSO_DESC, _handleName, _show, _associatedTypes, dummy);
updatePickModeToolBar();
}
......@@ -1120,9 +1123,8 @@ void SelectionBasePlugin::slotShowLassoSelectionMode(QString _handleName, bool _
void SelectionBasePlugin::slotShowVolumeLassoSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes) {
QString iconPath = OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator();
QIcon icon(iconPath + VOLUME_LASSO_IMG);
QString dummy;
showSelectionMode(SB_VOLUME_LASSO, icon, VOLUME_LASSO_DESC, _handleName, _show, _associatedTypes, dummy);
showSelectionMode(SB_VOLUME_LASSO, iconPath + VOLUME_LASSO_IMG, VOLUME_LASSO_DESC, _handleName, _show, _associatedTypes, dummy);
updatePickModeToolBar();
}
......@@ -1131,9 +1133,8 @@ void SelectionBasePlugin::slotShowVolumeLassoSelectionMode(QString _handleName,
void SelectionBasePlugin::slotShowSurfaceLassoSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes) {
QString iconPath = OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator();