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

New Toolbox Interface ... This will break all Toolbox Plugins!!!

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@7243 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 2eb807fc
......@@ -86,6 +86,74 @@ void SelectionPlugin::initializePlugin() {
if ( OpenFlipper::Options::nogui() )
return;
tool_ = new selectionToolbarWidget();
QSize size(300, 300);
tool_->resize(size);
//Selection Mode
QString iconPath = OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator();
tool_->objectSelection->setIcon( QIcon(iconPath + "selection_object.png") );
tool_->vertexSelection->setIcon( QIcon(iconPath + "selection_vertex.png") );
tool_->edgeSelection->setIcon( QIcon(iconPath + "selection_edge.png") );
tool_->faceSelection->setIcon( QIcon(iconPath + "selection_face.png") );
// Set combo box entries for the different modes
tool_->convertFrom->addItem(tr("Modeling Area"));
tool_->convertFrom->addItem(tr("Handle Area"));
tool_->convertFrom->addItem(tr("Feature Area"));
tool_->convertTo->addItem(tr("Modeling Area"));
tool_->convertTo->addItem(tr("Handle Area"));
tool_->convertTo->addItem(tr("Feature Area"));
// Set combo box entries for the different selection types
tool_->convertFrom->addItem(tr("Vertex Selection"));
tool_->convertFrom->addItem(tr("Edge Selection"));
tool_->convertFrom->addItem(tr("Face Selection"));
tool_->convertTo->addItem(tr("Vertex Selection"));
tool_->convertTo->addItem(tr("Edge Selection"));
tool_->convertTo->addItem(tr("Face Selection"));
// Check checkboxes by default
tool_->checkAddArea->setChecked(true);
tool_->checkConvert->setChecked(true);
tool_->checkSelectionConvert->setChecked(true);
// Convert button
connect(tool_->convertButton, SIGNAL(clicked()), this, SLOT(slotConvertSelectionType()));
connect (tool_->restrictOnTargets, SIGNAL(clicked()), this, SLOT(slotToggleSelectionRestriction()) );
//Selection Buttons
connect( tool_->selectAll, SIGNAL(clicked()), this,SLOT(slotSelectAll()) );
connect( tool_->clearSelection, SIGNAL(clicked()), this,SLOT(slotClearSelection()) );
connect( tool_->growSelection, SIGNAL(clicked()), this,SLOT(slotGrowSelection()) );
connect( tool_->shrinkSelection, SIGNAL(clicked()), this,SLOT(slotShrinkSelection()) );
connect( tool_->invertSelection, SIGNAL(clicked()), this,SLOT(slotInvertSelection()) );
connect( tool_->selectBoundary, SIGNAL(clicked()), this,SLOT(slotSelectBoundary()) );
connect( tool_->deleteSelection, SIGNAL(clicked()), this,SLOT(slotDeleteSelection()) );
connect( tool_->colorizeSelection,SIGNAL(clicked()), this,SLOT(slotColorizeSelection()) );
connect( tool_->loadSelection, SIGNAL(clicked()), this,SLOT(slotLoadSelection()) );
connect( tool_->saveSelection, SIGNAL(clicked()), this,SLOT(slotSaveSelection()) );
// Clear Properties and Selections
connect( tool_->clearModelingArea, SIGNAL(clicked()), this,SLOT(slotClearArea()) );
connect( tool_->clearHandleRegion, SIGNAL(clicked()), this,SLOT(slotClearHandle()));
connect( tool_->clearFeatures, SIGNAL(clicked()), this,SLOT(slotClearFeatures()));
connect( tool_->clearVertexSelection, SIGNAL(clicked()), this,SLOT(slotClearAllVertexSelections()) );
connect( tool_->clearEdgeSelection, SIGNAL(clicked()), this,SLOT(slotClearAllEdgeSelections()));
connect( tool_->clearFaceSelection, SIGNAL(clicked()), this,SLOT(slotClearAllFaceSelections()));
emit addToolbox("Selections",tool_);
// create sphere for paint sphere selection
sphere_mat_node_ = new ACG::SceneGraph::MaterialNode(PluginFunctions::getRootNode(), tr("Sphere Color").toStdString());
......@@ -320,88 +388,6 @@ void SelectionPlugin::slotObjectUpdated(int _id){
}
/*******************************************************************************
ToolboxInterface implementation
*******************************************************************************/
/** \brief Create the selection toolbox-widget and return a reference to it
*
* @param _widget A reference to the selection toolbox that we will return
* @return return wether the widget was successfully generated
*/
bool SelectionPlugin::initializeToolbox(QWidget*& _widget)
{
tool_ = new selectionToolbarWidget();
_widget = tool_;
QSize size(300, 300);
tool_->resize(size);
//Selection Mode
QString iconPath = OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator();
tool_->objectSelection->setIcon( QIcon(iconPath + "selection_object.png") );
tool_->vertexSelection->setIcon( QIcon(iconPath + "selection_vertex.png") );
tool_->edgeSelection->setIcon( QIcon(iconPath + "selection_edge.png") );
tool_->faceSelection->setIcon( QIcon(iconPath + "selection_face.png") );
// Set combo box entries for the different modes
tool_->convertFrom->addItem(tr("Modeling Area"));
tool_->convertFrom->addItem(tr("Handle Area"));
tool_->convertFrom->addItem(tr("Feature Area"));
tool_->convertTo->addItem(tr("Modeling Area"));
tool_->convertTo->addItem(tr("Handle Area"));
tool_->convertTo->addItem(tr("Feature Area"));
// Set combo box entries for the different selection types
tool_->convertFrom->addItem(tr("Vertex Selection"));
tool_->convertFrom->addItem(tr("Edge Selection"));
tool_->convertFrom->addItem(tr("Face Selection"));
tool_->convertTo->addItem(tr("Vertex Selection"));
tool_->convertTo->addItem(tr("Edge Selection"));
tool_->convertTo->addItem(tr("Face Selection"));
// Check checkboxes by default
tool_->checkAddArea->setChecked(true);
tool_->checkConvert->setChecked(true);
tool_->checkSelectionConvert->setChecked(true);
// Convert button
connect(tool_->convertButton, SIGNAL(clicked()), this, SLOT(slotConvertSelectionType()));
connect (tool_->restrictOnTargets, SIGNAL(clicked()), this, SLOT(slotToggleSelectionRestriction()) );
//Selection Buttons
connect( tool_->selectAll, SIGNAL(clicked()), this,SLOT(slotSelectAll()) );
connect( tool_->clearSelection, SIGNAL(clicked()), this,SLOT(slotClearSelection()) );
connect( tool_->growSelection, SIGNAL(clicked()), this,SLOT(slotGrowSelection()) );
connect( tool_->shrinkSelection, SIGNAL(clicked()), this,SLOT(slotShrinkSelection()) );
connect( tool_->invertSelection, SIGNAL(clicked()), this,SLOT(slotInvertSelection()) );
connect( tool_->selectBoundary, SIGNAL(clicked()), this,SLOT(slotSelectBoundary()) );
connect( tool_->deleteSelection, SIGNAL(clicked()), this,SLOT(slotDeleteSelection()) );
connect( tool_->colorizeSelection,SIGNAL(clicked()), this,SLOT(slotColorizeSelection()) );
connect( tool_->loadSelection, SIGNAL(clicked()), this,SLOT(slotLoadSelection()) );
connect( tool_->saveSelection, SIGNAL(clicked()), this,SLOT(slotSaveSelection()) );
// Clear Properties and Selections
connect( tool_->clearModelingArea, SIGNAL(clicked()), this,SLOT(slotClearArea()) );
connect( tool_->clearHandleRegion, SIGNAL(clicked()), this,SLOT(slotClearHandle()));
connect( tool_->clearFeatures, SIGNAL(clicked()), this,SLOT(slotClearFeatures()));
connect( tool_->clearVertexSelection, SIGNAL(clicked()), this,SLOT(slotClearAllVertexSelections()) );
connect( tool_->clearEdgeSelection, SIGNAL(clicked()), this,SLOT(slotClearAllEdgeSelections()));
connect( tool_->clearFaceSelection, SIGNAL(clicked()), this,SLOT(slotClearAllFaceSelections()));
return true;
}
/*******************************************************************************
KeyInterface implementation
*******************************************************************************/
......
......@@ -120,15 +120,19 @@ class SelectionPlugin : public QObject, BaseInterface , MouseInterface, KeyInter
void updateView();
void updatedObject(int);
void objectSelectionChanged(int);
//PickingInterface
void addHiddenPickMode( const std::string _mode );
void setPickModeMouseTracking( const std::string _mode, bool _mouseTracking);
void setPickModeCursor( const std::string _mode, QCursor _cursor);
//BackupInterface
void createBackup( int _id , QString _name );
//LoggingInterface
void log(Logtype _type, QString _message);
void log(QString _message);
//ScriptInterface
void scriptInfo( QString _functionName );
......@@ -138,6 +142,10 @@ class SelectionPlugin : public QObject, BaseInterface , MouseInterface, KeyInter
//KeyInterface
void registerKey(int _key, Qt::KeyboardModifiers _modifiers, QString _description, bool _multiUse = false);
// ToolboxInterface
void addToolbox( QString _name , QWidget* _widget );
//ToolbarInterface
void addToolbar(QToolBar* _toolbar);
void getToolBar(QString _name, QToolBar*& _toolbar);
......@@ -146,17 +154,22 @@ class SelectionPlugin : public QObject, BaseInterface , MouseInterface, KeyInter
void deleteObject( int _id );
private slots:
//MouseInterface
void slotMouseWheelEvent(QWheelEvent * _event, const std::string & _mode);
void slotMouseEvent( QMouseEvent* _event );
//KeyInterface
void slotKeyEvent( QKeyEvent* _event );
void slotKeyReleaseEvent( QKeyEvent* _event );
//PickingInterface
void slotPickModeChanged( const std::string& _mode);
//INIInterface
void loadIniFile( INIFile& _ini , int _id);
void saveIniFile( INIFile& _ini , int _id);
//BaseInterface
void initializePlugin();
void pluginsInitialized();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment