diff --git a/Polyhedron/demo/Polyhedron/MainWindow.cpp b/Polyhedron/demo/Polyhedron/MainWindow.cpp index 1dc94f01231..7931f81fd5e 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.cpp +++ b/Polyhedron/demo/Polyhedron/MainWindow.cpp @@ -339,6 +339,18 @@ MainWindow::MainWindow(QWidget* parent) connect(ui->menuOperations, SIGNAL(aboutToShow()), this, SLOT(filterOperations())); } +//Recursive function that do a pass over a menu and its sub-menus(etc.) and hide them when they are empty +void filterMenuOperations(QMenu* menu) +{ + Q_FOREACH(QAction* action, menu->actions()) { + if(QMenu* menu = action->menu()) { + filterMenuOperations(menu); + action->setVisible(!(menu->isEmpty())); + } + } + +} + void MainWindow::filterOperations() { Q_FOREACH(const PluginNamePair& p, plugins) { @@ -347,15 +359,9 @@ void MainWindow::filterOperations() } } - // do a pass over all menus in Operations and hide them when they are empty - Q_FOREACH(QAction* action, ui->menuOperations->actions()) { - if(QMenu* menu = action->menu()) { - action->setVisible(!(menu->isEmpty())); - } - } + // do a pass over all menus in Operations and their sub-menus(etc.) and hide them when they are empty + filterMenuOperations(ui->menuOperations); } - - #ifdef QT_SCRIPT_LIB void MainWindow::evaluate_script(QString script, const QString& filename, @@ -409,6 +415,75 @@ bool actionsByName(QAction* x, QAction* y) { } } +//Recursively creates all subMenus containing an action. +void MainWindow::setMenus(QString name, QString parentName, QAction* a ) +{ + + bool hasSub = false; + QString menuName, subMenuName; + if (!name.isNull()) + { + //Get the menu and submenu names + for(int i=0; i()) { + if(!action->menu()) continue; + QString menuText = action->menu()->title(); + //If the menu title does not correspond to the name of the menu or submenu we want, + //go to the next one. + if(menuText != menuName) continue; + menu = action->menu(); + } + + bool hasAction = false; + if(menu == 0) + menu = new QMenu(menuName, this); + else //checks the action is not already in the menu + if(a->property("added").toBool()) + hasAction = true; + if(!hasAction) + menu->addAction(a); + a->setProperty("added", true); + //If the parent menu already exists, don't create a new one. + Q_FOREACH(QAction* action, findChildren()) { + if(!action->menu()) continue; + QString menuText = action->menu()->title(); + //If the menu title does not correspond to the name of the menu or submenu we want, + //go to the next one. + if(menuText != parentName) continue; + parentMenu = action->menu(); + } + + if(parentMenu == 0) + parentMenu = new QMenu(parentName, this); + parentMenu->addMenu(menu); + ui->menuOperations->removeAction(a); + } +} + + + void MainWindow::loadPlugins() { Q_FOREACH(QObject *obj, QPluginLoader::staticInstances()) @@ -463,13 +538,112 @@ void MainWindow::loadPlugins() } } - // sort the operations menu by name - QList actions = ui->menuOperations->actions(); - qSort(actions.begin(), actions.end(), actionsByName); - ui->menuOperations->clear(); - ui->menuOperations->addActions(actions); -} +//Creates sub-Menus for operations. + //!TODO : Make it recursive to allow sub-menus of sub-menus. + //!The argument should be the menuPath and it should recurse until hasSub stays false. + QList as = ui->menuOperations->actions(); + Q_FOREACH(QAction* a, as) +{ + QString menuPath = a->property("subMenuName").toString(); + setMenus(menuPath, ui->menuOperations->title(), a); + //QList actions; + /* QList menus; + Q_FOREACH(QMenu* menu, ui->menuOperations->findChildren()) { + menus.append(menu); + } + Q_FOREACH(QMenu* menu, menus) { + if(menu) + { + actions = menu->actions(); + Q_FOREACH(QAction* a, actions) + { + QString subMenuName = a->property("subMenuName").toString(); + if(!subMenuName.isNull()) + { + + QMenu* subMenu = new QMenu(subMenuName, this); + subMenu->addMenu(menu); + continue; + } + } + } + }*/ + // actions = ui->menuOperations->actions(); + /*Q_FOREACH(QAction* a, actions) + { + QString menuPath = a->property("subMenuName").toString(); + bool hasSub = false; + QString menuName, subMenuName; + if (!menuPath.isNull()) + { + //Get the menu and submenu names + for(int i=0; i()) { + if(!action->menu()) continue; + QString menuText = action->menu()->title(); + //If the menu title does not correspond to the name of the menu or submenu we want, + //go to the next one. + if(menuText != menuName && menuText != subMenuName) continue; + menu = action->menu(); + if(hasSub) + { + if(menuText != subMenuName) continue; + subMenu = action->menu(); + //find the parent menu of the submenu + Q_FOREACH(QMenu* parentmenu, findChildren()) + { + if(parentmenu->title() != menuName) continue; + menu = parentmenu; + } + } + } + + if(menu == 0) + { + menu = new QMenu(menuName, this); + } + if(hasSub) + { + if(subMenu == 0) + subMenu = new QMenu(subMenuName, this); + subMenu->addAction(a); + menu->addMenu(subMenu); + } + else + menu->addAction(a); + + ui->menuOperations->addMenu(menu); + ui->menuOperations->removeAction(a); + } + }*/ + // sort the operations menu by name + as = ui->menuOperations->actions(); + qSort(as.begin(), as.end(), actionsByName); + ui->menuOperations->clear(); + ui->menuOperations->addActions(as); + } + } bool MainWindow::hasPlugin(const QString& pluginName) const { diff --git a/Polyhedron/demo/Polyhedron/MainWindow.h b/Polyhedron/demo/Polyhedron/MainWindow.h index a23b4508c43..db6e7c73ca9 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.h +++ b/Polyhedron/demo/Polyhedron/MainWindow.h @@ -151,6 +151,13 @@ protected Q_SLOTS: void on_actionRecenterScene_triggered(); protected: + QList createSubMenus(QList); + /*! For each objects in the sceneView, loads the associated plugins. + * Gets the property "submenuName" of all the actions and creates submenus. + * Sorts the Operations menu by name. + * @see initPlugin(QObject*); + * @see initIOPlugin(QObject*); + */ void loadPlugins(); bool initPlugin(QObject*); bool initIOPlugin(QObject*); @@ -163,7 +170,7 @@ protected: private: QString strippedName(const QString &fullFileName); - + void setMenus(QString, QString, QAction *a); /// plugin black-list QSet plugin_blacklist; diff --git a/Polyhedron/demo/Polyhedron/MainWindow.ui b/Polyhedron/demo/Polyhedron/MainWindow.ui index 9edb8798e22..743a1ae47b9 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.ui +++ b/Polyhedron/demo/Polyhedron/MainWindow.ui @@ -37,7 +37,7 @@ 0 0 978 - 21 + 20 @@ -69,14 +69,6 @@ &Operations - - - &Subdivision - - - - - &Boolean operations @@ -89,32 +81,15 @@ - - - Parameterization - - - - - - - - PCA - - - - - + - - @@ -296,8 +271,8 @@ 0 0 - 534 - 174 + 541 + 175 diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_convex_hull_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_convex_hull_plugin.cpp index d1e486d3aae..6f2f4b58555 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_convex_hull_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_convex_hull_plugin.cpp @@ -23,8 +23,18 @@ class Polyhedron_demo_convex_hull_plugin : Q_OBJECT Q_INTERFACES(Polyhedron_demo_plugin_interface) Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") - public: + void init(QMainWindow* mainWindow, + Scene_interface* scene_interface) + { + mw = mainWindow; + scene = scene_interface; + actions_map["actionConvexHull"] = getActionFromMainWindow(mw, "actionConvexHull"); + actions_map["actionConvexHull"]->setProperty("subMenuName", "Object creation"); + autoConnectActions(); + + } + // used by Polyhedron_demo_plugin_helper QStringList actionsNames() const { return QStringList() << "actionConvexHull"; diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_corefinement_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_corefinement_plugin.cpp index 2b96734a0bf..b570dac0737 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_corefinement_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_corefinement_plugin.cpp @@ -41,6 +41,7 @@ public: this->scene = scene_interface; this->mw = mainWindow; actionPolyhedronCorefinement_3 = new QAction("Polyhedra corefinement (A/B)", mw); + actionPolyhedronCorefinement_3->setProperty("subMenuName", "Operation on multiple polyhedra"); if(actionPolyhedronCorefinement_3) { connect(actionPolyhedronCorefinement_3, SIGNAL(triggered()), this, SLOT(corefinement())); diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_cut_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_cut_plugin.cpp index a0f233fb1a4..7948416e1cc 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_cut_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_cut_plugin.cpp @@ -377,6 +377,7 @@ void Polyhedron_demo_cut_plugin::init(QMainWindow* mainWindow, scene = scene_interface; messages = m; actionCreateCutPlane = new QAction(tr("Create cutting plane"), mainWindow); + actionCreateCutPlane->setProperty("subMenuName","Operations with plane"); connect(actionCreateCutPlane, SIGNAL(triggered()), this, SLOT(createCutPlane())); } diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_edit_polyhedron_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_edit_polyhedron_plugin.cpp index 42f5aa79929..a9711aecef2 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_edit_polyhedron_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_edit_polyhedron_plugin.cpp @@ -86,6 +86,7 @@ void Polyhedron_demo_edit_polyhedron_plugin::init(QMainWindow* mainWindow, Scene scene = scene_interface; actionDeformation = new QAction("Surface Mesh Deformation", mw); + actionDeformation->setProperty("subMenuName", "Action on mesh"); actionDeformation->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_E)); connect(actionDeformation, SIGNAL(triggered()), this, SLOT(on_actionDeformation_triggered())); diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_fairing_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_fairing_plugin.cpp index 7768c52b572..e515e5cc452 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_fairing_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_fairing_plugin.cpp @@ -47,6 +47,8 @@ public: scene = scene_interface; messages = m; actionFairing = new QAction(tr("Fairing"), mw); + actionFairing->setProperty("subMenuName", "Action on mesh"); + connect(actionFairing, SIGNAL(triggered()), this, SLOT(fairing_action())); dock_widget = new QDockWidget("Fairing", mw); diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_hole_filling_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_hole_filling_plugin.cpp index cd392caa64c..f8bea441cdf 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_hole_filling_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_hole_filling_plugin.cpp @@ -396,6 +396,7 @@ void Polyhedron_demo_hole_filling_plugin::init(QMainWindow* mainWindow, messages = m; actionHoleFilling = new QAction(tr("Hole Filling"), mw); + actionHoleFilling->setProperty("subMenuName", "Action on mesh"); connect(actionHoleFilling, SIGNAL(triggered()), this, SLOT(hole_filling_action())); dock_widget = new QDockWidget("Hole Filling", mw); diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_inside_out_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_inside_out_plugin.cpp index 4fbe53793ef..9f82ee18d95 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_inside_out_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_inside_out_plugin.cpp @@ -24,6 +24,16 @@ public: return QStringList() << "actionInsideOut"; } + void init(QMainWindow* mainWindow, + Scene_interface* scene_interface) + { + mw = mainWindow; + scene = scene_interface; + actions_map["actionInsideOut"] = getActionFromMainWindow(mw, "actionInsideOut"); + actions_map["actionInsideOut"]->setProperty("subMenuName", "Action on normals"); + autoConnectActions(); + + } bool applicable(QAction*) const { const Scene_interface::Item_id index = scene->mainSelectionIndex(); return qobject_cast(scene->item(index)) diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_intersection_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_intersection_plugin.cpp index 8fa4dfbe973..dcb42c2a59b 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_intersection_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_intersection_plugin.cpp @@ -46,6 +46,7 @@ public: this->scene = scene_interface; this->mw = mainWindow; actionPolyhedronIntersection_3 = new QAction("Intersect polyhedra (A/B)", mw); + actionPolyhedronIntersection_3->setProperty("subMenuName", "Operation on multiple polyhedra"); if(actionPolyhedronIntersection_3) { connect(actionPolyhedronIntersection_3, SIGNAL(triggered()), this, SLOT(intersection())); diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_jet_fitting_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_jet_fitting_plugin.cpp index 0065b3ecf10..34fefe76c07 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_jet_fitting_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_jet_fitting_plugin.cpp @@ -25,6 +25,16 @@ public: QStringList actionsNames() const { return QStringList() << "actionEstimateCurvature"; } + void init(QMainWindow* mainWindow, + Scene_interface* scene_interface) + { + mw = mainWindow; + scene = scene_interface; + actions_map["actionEstimateCurvature"] = getActionFromMainWindow(mw, "actionEstimateCurvature"); + actions_map["actionEstimateCurvature"]->setProperty("subMenuName", "Object creation"); + autoConnectActions(); + + } bool applicable(QAction*) const { return qobject_cast(scene->item(scene->mainSelectionIndex())); diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_join_and_split_polyhedra_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_join_and_split_polyhedra_plugin.cpp index e6fe1580cb3..294700572d2 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_join_and_split_polyhedra_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_join_and_split_polyhedra_plugin.cpp @@ -32,10 +32,13 @@ public: { msg_interface = m; actionJoinPolyhedra= new QAction(tr("Join selected polyhedra"), mainWindow); + actionJoinPolyhedra->setProperty("subMenuName", "Operation on multiple polyhedra"); actionJoinPolyhedra->setObjectName("actionJoinPolyhedra"); actionSplitPolyhedra= new QAction(tr("Split selected polyhedra"), mainWindow); + actionSplitPolyhedra->setProperty("subMenuName", "Operation on multiple polyhedra"); actionSplitPolyhedra->setObjectName("actionSplitPolyhedra"); actionColorConnectedComponents = new QAction(tr("Color each connected component of selected polyhedra"), mainWindow); + actionColorConnectedComponents ->setProperty("subMenuName", "Color alteration"); actionColorConnectedComponents->setObjectName("actionColorConnectedComponents"); Polyhedron_demo_plugin_helper::init(mainWindow, scene_interface); } diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_mean_curvature_flow_skeleton_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_mean_curvature_flow_skeleton_plugin.cpp index 876f5cb37c3..2f44423c495 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_mean_curvature_flow_skeleton_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_mean_curvature_flow_skeleton_plugin.cpp @@ -119,9 +119,12 @@ public: ui = NULL; actionMCFSkeleton = new QAction(tr("Mean Curvature Skeleton (Advanced)"), mainWindow); + actionMCFSkeleton->setProperty("subMenuName", "Object creation"); actionMCFSkeleton->setObjectName("actionMCFSkeleton"); actionConvert_to_medial_skeleton = new QAction(tr("Extract Medial Skeleton"), mainWindow); + actionConvert_to_medial_skeleton->setProperty("subMenuName", "Object creation"); + actionConvert_to_medial_skeleton->setObjectName("actionConvert_to_medial_skeleton"); Polyhedron_demo_plugin_helper::init(mainWindow, scene_interface); diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_mesh_3_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_mesh_3_plugin.cpp index be639eeac0c..44ce4a1fb10 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_mesh_3_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_mesh_3_plugin.cpp @@ -39,6 +39,7 @@ public: this->mw = mainWindow; actionMesh_3 = new QAction("Create a tetrahedral mesh", mw); if(actionMesh_3) { + actionMesh_3->setProperty("subMenuName", "Operations with plane"); connect(actionMesh_3, SIGNAL(triggered()), this, SLOT(mesh_3())); } diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_mesh_segmentation_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_mesh_segmentation_plugin.cpp index 01d94643042..cf84bf82a38 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_mesh_segmentation_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_mesh_segmentation_plugin.cpp @@ -68,6 +68,7 @@ public: this->scene = scene_interface; this->mw = mainWindow; actionSegmentation = new QAction("Mesh Segmentation", mw); + actionSegmentation->setProperty("subMenuName", "Color alteration"); connect(actionSegmentation, SIGNAL(triggered()),this, SLOT(on_actionSegmentation_triggered())); // adding slot for itemAboutToBeDestroyed signal, aim is removing item from item-functor map. diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_mesh_simplification_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_mesh_simplification_plugin.cpp index 1df3f662b27..9fbe8f661c6 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_mesh_simplification_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_mesh_simplification_plugin.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -27,6 +28,16 @@ public: return QStringList() << "actionSimplify"; } + void init(QMainWindow* mainWindow, + Scene_interface* scene_interface) + { + mw = mainWindow; + scene = scene_interface; + actions_map["actionSimplify"] = getActionFromMainWindow(mw, "actionSimplify"); + actions_map["actionSimplify"]->setProperty("subMenuName", "Action on mesh"); + autoConnectActions(); + + } bool applicable(QAction*) const { return qobject_cast(scene->item(scene->mainSelectionIndex())); } diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_nef_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_nef_plugin.cpp index 445708afc7e..7e640b7b24f 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_nef_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_nef_plugin.cpp @@ -31,6 +31,24 @@ public: << "actionMinkowskiSum"; } + void init(QMainWindow* mainWindow, + Scene_interface* scene_interface) + { + mw = mainWindow; + scene = scene_interface; + actions_map["actionConvexDecomposition"] = getActionFromMainWindow(mw, "actionConvexDecomposition"); + actions_map["actionConvexDecomposition"]->setProperty("subMenuName", "Object creation"); + + actions_map["actionToNef"] = getActionFromMainWindow(mw, "actionToNef"); + actions_map["actionToPoly"] = getActionFromMainWindow(mw, "actionToPoly"); + actions_map["actionUnion"] = getActionFromMainWindow(mw, "actionUnion"); + actions_map["actionIntersection"] = getActionFromMainWindow(mw, "actionIntersection"); + actions_map["actionDifference"] = getActionFromMainWindow(mw, "actionDifference"); + actions_map["actionMinkowskiSum"] = getActionFromMainWindow(mw, "actionMinkowskiSum"); + autoConnectActions(); + + } + bool applicable(QAction*) const { const int indexA = scene->selectionAindex(); const int indexB = scene->selectionBindex(); diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_orient_soup_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_orient_soup_plugin.cpp index a66cc48b18c..0f722cd151b 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_orient_soup_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_orient_soup_plugin.cpp @@ -62,15 +62,18 @@ void Polyhedron_demo_orient_soup_plugin::init(QMainWindow* mainWindow, messages = m; actionOrient = new QAction(tr("&Orient polygon soup"), mainWindow); actionOrient->setObjectName("actionOrient"); + actionOrient->setProperty("subMenuName", "Action on normals"); connect(actionOrient, SIGNAL(triggered()), this, SLOT(orient())); actionShuffle = new QAction(tr("&Shuffle polygon soup"), mainWindow); + actionShuffle->setProperty("subMenuName", "Action on normals"); connect(actionShuffle, SIGNAL(triggered()), this, SLOT(shuffle())); actionDisplayNonManifoldEdges = new QAction(tr("Display non manifold edges"), mainWindow); + actionDisplayNonManifoldEdges->setProperty("subMenuName", "Detection"); connect(actionDisplayNonManifoldEdges, SIGNAL(triggered()), this, SLOT(displayNonManifoldEdges())); } diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_parameterization_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_parameterization_plugin.cpp index b1fb77bc71c..3671e9bdb8b 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_parameterization_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_parameterization_plugin.cpp @@ -1,5 +1,6 @@ #include #include +#include #include #include "Scene_polyhedron_item.h" @@ -40,6 +41,24 @@ public: << "actionLSC"; } + void init(QMainWindow* mainWindow, + Scene_interface* scene_interface) + { + mw = mainWindow; + scene = scene_interface; + actions_map["actionMVC"] = new QAction("MVC", mw); + actions_map["actionMVC"]->setProperty("subMenuName", "Color alteration/Parametrization"); + + actions_map["actionDCP"] = new QAction ("DCP", mw); + actions_map["actionDCP"]->setProperty("subMenuName", "Color alteration/Parametrization"); + + connect(actions_map["actionMVC"], SIGNAL(triggered()), + this, SLOT(on_actionMVC_triggered())); + connect(actions_map["actionDCP"], SIGNAL(triggered()), + this, SLOT(on_actionDCP_triggered())); + + } + bool applicable(QAction*) const { return qobject_cast(scene->item(scene->mainSelectionIndex())); } diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_pca_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_pca_plugin.cpp index 8ef2df2bfe6..2b8332ad3b8 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_pca_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_pca_plugin.cpp @@ -1,4 +1,6 @@ #include +#include +#include #include "Scene_polyhedron_item.h" #include "Scene_plane_item.h" #include "Polyhedron_type.h" @@ -39,6 +41,25 @@ public: << "actionFitLine"; } + void init(QMainWindow* mainWindow, + Scene_interface* scene_interface) + { + mw = mainWindow; + scene = scene_interface; + actions_map["actionFitPlane"] = new QAction("Fit Plane", mw); + actions_map["actionFitPlane"]->setProperty("subMenuName", "Object creation/PCA"); + + actions_map["actionFitLine"] = new QAction("Fit Line", mw); + actions_map["actionFitLine"]->setProperty("subMenuName", "Object creation/PCA"); + + connect(actions_map["actionFitPlane"], SIGNAL(triggered()), + this, SLOT(on_actionFitPlane_triggered())); + connect(actions_map["actionFitLine"], SIGNAL(triggered()), + this, SLOT(on_actionFitLine_triggered())); + + } + + bool applicable(QAction*) const { return qobject_cast(scene->item(scene->mainSelectionIndex())); } diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_plugin_helper.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_plugin_helper.cpp index 719670bf915..849a1633aa8 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_plugin_helper.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_plugin_helper.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "MainWindow.h" QAction* Polyhedron_demo_plugin_helper:: diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_point_inside_polyhedron_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_point_inside_polyhedron_plugin.cpp index 1405ef8de05..6e04d8fdc81 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_point_inside_polyhedron_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_point_inside_polyhedron_plugin.cpp @@ -63,6 +63,7 @@ public: messages = m; actionPointInsidePolyhedron = new QAction(tr("Point Inside Polyhedron"), mw); + actionPointInsidePolyhedron->setProperty("subMenuName", "Object creation"); connect(actionPointInsidePolyhedron, SIGNAL(triggered()), this, SLOT(point_inside_polyhedron_action())); dock_widget = new QDockWidget("Point Inside Polyhedron", mw); diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_polyhedron_slicer_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_polyhedron_slicer_plugin.cpp index 534ce5a04c4..068bad4016e 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_polyhedron_slicer_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_polyhedron_slicer_plugin.cpp @@ -97,6 +97,7 @@ void Polyhedron_demo_polyhedron_slicer_plugin::init(QMainWindow* mainWindow, plane_item = NULL; actionSlicerWidget = new QAction(tr("Polyhedron Slicer"), mw); + actionSlicerWidget->setProperty("subMenuName", "Operations with plane"); connect(actionSlicerWidget, SIGNAL(triggered()), this, SLOT(slicer_widget_action())); dock_widget = new QDockWidget("Polyhedron Slicer", mw); diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_polyhedron_stitching_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_polyhedron_stitching_plugin.cpp index 0f9ae0822b6..a24e17f2a32 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_polyhedron_stitching_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_polyhedron_stitching_plugin.cpp @@ -54,6 +54,7 @@ public: actionStitchBorders= new QAction(tr("Stitch polyhedron duplicated boundaries"), mainWindow); actionDetectBorders->setObjectName("actionDetectBorders"); actionStitchBorders->setObjectName("actionStitchBorders"); + actionDetectBorders->setProperty("subMenuName", "Detection operations"); Polyhedron_demo_plugin_helper::init(mainWindow, scene_interface); } diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_remeshing_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_remeshing_plugin.cpp index 7afcf2185d2..0e04fd1e99d 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_remeshing_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_remeshing_plugin.cpp @@ -35,6 +35,7 @@ public: this->scene = scene_interface; this->mw = mainWindow; actionRemeshing = this->getActionFromMainWindow(mw, "actionRemeshing"); + actionRemeshing->setProperty("subMenuName", "Action on mesh"); if(actionRemeshing) { connect(actionRemeshing, SIGNAL(triggered()), this, SLOT(remesh())); diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_self_intersection_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_self_intersection_plugin.cpp index 259d65073a8..e31c5f898cc 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_self_intersection_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_self_intersection_plugin.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include "opengl_tools.h" @@ -33,6 +34,17 @@ public: return QStringList() << "actionSelfIntersection"; } + void init(QMainWindow* mainWindow, + Scene_interface* scene_interface) + { + mw = mainWindow; + scene = scene_interface; + actions_map["actionSelfIntersection"] = getActionFromMainWindow(mw, "actionSelfIntersection"); + actions_map["actionSelfIntersection"]->setProperty("subMenuName", "Detection operations"); + autoConnectActions(); + + } + bool applicable(QAction*) const { return qobject_cast(scene->item(scene->mainSelectionIndex())); } diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_shortest_path_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_shortest_path_plugin.cpp index 4fc951ad8fb..34feda48cb8 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_shortest_path_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_shortest_path_plugin.cpp @@ -79,6 +79,7 @@ public: this->m_messages = messages; dock_widget = new QDockWidget("Shortest path", mw); + dock_widget->setVisible(false); ui_widget.setupUi(dock_widget); @@ -88,6 +89,7 @@ public: connect(ui_widget.Primitives_type_combo_box, SIGNAL(currentIndexChanged(int)), this, SLOT(on_Primitives_type_combo_box_changed(int))); actionMakeShortestPaths = new QAction("Make Shortest Path", this->mw); + actionMakeShortestPaths->setProperty("subMenuName", "Object creation"); connect(actionMakeShortestPaths, SIGNAL(triggered()), this, SLOT(on_actionMakeShortestPaths_triggered())); diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_subdivision_methods_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_subdivision_methods_plugin.cpp index 708f7e95e6b..29823cfd314 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_subdivision_methods_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_subdivision_methods_plugin.cpp @@ -1,5 +1,7 @@ #include #include +#include +#include #include "Polyhedron_demo_plugin_helper.h" #include "Polyhedron_demo_plugin_interface.h" @@ -23,6 +25,32 @@ public: << "actionSqrt3"; } + void init(QMainWindow* mainWindow, + Scene_interface* scene_interface) + { + mw = mainWindow; + scene = scene_interface; + actions_map["actionLoop"] = new QAction("Loop", mw); + actions_map["actionLoop"]->setProperty("subMenuName", "Action on mesh/Subdivisions"); + + actions_map["actionCatmullClark"] = new QAction("Catmull Clark", mw); + actions_map["actionCatmullClark"]->setProperty("subMenuName", "Action on mesh/Subdivisions"); + + actions_map["actionSqrt3"] = new QAction("Sqrt3", mw); + actions_map["actionSqrt3"]->setProperty("subMenuName", "Action on mesh/Subdivisions"); + + //autoConnectActions(); + connect(actions_map["actionLoop"], SIGNAL(triggered()), + this, SLOT(on_actionLoop_triggered())); + + connect(actions_map["actionCatmullClark"], SIGNAL(triggered()), + this, SLOT(on_actionCatmullClark_triggered())); + + connect(actions_map["actionSqrt3"], SIGNAL(triggered()), + this, SLOT(on_actionSqrt3_triggered())); + + } + bool applicable(QAction*) const { return qobject_cast(scene->item(scene->mainSelectionIndex())); } diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_triangulate_facets_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_triangulate_facets_plugin.cpp index c887859cc96..a529a4ff678 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_triangulate_facets_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_triangulate_facets_plugin.cpp @@ -29,11 +29,13 @@ public: this->mw = mainWindow; this->messages = m; actionTriangulateFacets = new QAction("Triangulate facets", mw); + actionTriangulateFacets->setProperty("subMenuName","Action on mesh"); if(actionTriangulateFacets) { connect(actionTriangulateFacets, SIGNAL(triggered()), this, SLOT(triangulate())); } actionUnTriangulateFacets = new QAction("Untriangulate facets", mw); + actionUnTriangulateFacets->setProperty("subMenuName","Action on mesh"); if(actionUnTriangulateFacets) { connect(actionUnTriangulateFacets, SIGNAL(triggered()), this, SLOT(untriangulate())); diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_trivial_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_trivial_plugin.cpp index 3be86d7988c..7862ad4adeb 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_trivial_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_trivial_plugin.cpp @@ -168,6 +168,7 @@ void Polyhedron_demo_trivial_plugin::init(QMainWindow* mainWindow, Scene_interfa { scene = scene_interface; actionBbox = new QAction(tr("Create bbox"), mainWindow); + actionBbox->setProperty("subMenuName", "Object creation"); connect(actionBbox, SIGNAL(triggered()), this, SLOT(bbox())); }