#include <XGUI_ModuleConnector.h>
#include <XGUI_Workshop.h>
#include <XGUI_Displayer.h>
+#include <XGUI_DataModel.h>
+#include <XGUI_ObjectsBrowser.h>
#include <Events_Loop.h>
#include <ModelAPI_Events.h>
aAction = new QAction(QIcon(":icons/edit.png"), tr("Edit..."), this);
connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onEdit(bool)));
myActions["EDIT_CMD"] = aAction;
+
+ aAction = new QAction(QIcon(), tr("Select parent feature"), this);
+ aAction->setCheckable(false);
+ connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onSelectParentFeature()));
+ myActions["SELECT_PARENT_CMD"] = aAction;
}
bool hasAttribute = false;
bool hasFeature = false;
- QList<ModuleBase_ViewerPrs> aPrsList = aSelection->getSelected(ModuleBase_ISelection::AllControls);
+ QList<ModuleBase_ViewerPrs> aPrsList = aSelection->getSelected(ModuleBase_ISelection::Viewer);
TopoDS_Shape aShape;
ResultPtr aResult;
FeaturePtr aFeature;
return true;
}
+void PartSet_MenuMgr::updateViewerMenu(const QMap<QString, QAction*>& theStdActions)
+{
+ ModuleBase_Operation* anOperation = myModule->workshop()->currentOperation();
+
+ bool isActiveSketch = PartSet_SketcherMgr::isSketchOperation(anOperation) ||
+ PartSet_SketcherMgr::isNestedSketchOperation(anOperation);
+ if (isActiveSketch) {
+ theStdActions["WIREFRAME_CMD"]->setEnabled(false);
+ theStdActions["SHADING_CMD"]->setEnabled(false);
+ theStdActions["SHOW_ONLY_CMD"]->setEnabled(false);
+ theStdActions["SHOW_CMD"]->setEnabled(false);
+ theStdActions["HIDE_CMD"]->setEnabled(false);
+ theStdActions["HIDEALL_CMD"]->setEnabled(false);
+ }
+}
+
+
void PartSet_MenuMgr::onLineHighlighted(QAction* theAction)
{
if (myPrevId != -1) {
anOperation->abort();
SessionPtr aMgr = ModelAPI_Session::get();
- std::set<FeaturePtr> anIgnoredFeatures;
- anIgnoredFeatures.insert(myModule->sketchMgr()->activeSketch());
QString aName = tr("Detach %1").arg(aLine->data()->name().c_str());
aMgr->startOperation(aName.toStdString());
- aWorkshop->deleteFeatures(aToDelFeatures, anIgnoredFeatures);
+ aWorkshop->deleteFeatures(aToDelFeatures);
aMgr->finishOperation();
}
myCoinsideLines.clear();
if (aFeature.get() != NULL)
myModule->editFeature(aFeature);
}
+
+void PartSet_MenuMgr::onSelectParentFeature()
+{
+ QObjectPtrList aObjects = myModule->workshop()->selection()->selectedObjects();
+ if (aObjects.size() != 1)
+ return;
+
+ SessionPtr aMgr = ModelAPI_Session::get();
+ ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>( aObjects.first() );
+ if( !aResult.get() )
+ return;
+
+ FeaturePtr aParentFeature = aResult->document()->feature( aResult );
+ QObjectPtrList aSelection;
+ aSelection.append( aParentFeature );
+ myModule->workshop()->selection()->setSelectedObjects( aSelection );
+}