connect(aContextMenuMgr, SIGNAL(actionTriggered(const QString&, bool)), this,
SLOT(onContextMenuCommand(const QString&, bool)));
- connect(myWorkshop->viewer(), SIGNAL(mousePress(QMouseEvent*)), this,
- SLOT(onMousePressed(QMouseEvent*)));
- connect(myWorkshop->viewer(), SIGNAL(mouseRelease(QMouseEvent*)), this,
- SLOT(onMouseReleased(QMouseEvent*)));
- connect(myWorkshop->viewer(), SIGNAL(mouseMove(QMouseEvent*)), this,
- SLOT(onMouseMoved(QMouseEvent*)));
- connect(myWorkshop->viewer(), SIGNAL(keyRelease(QKeyEvent*)), this,
- SLOT(onKeyRelease(QKeyEvent*)));
- connect(myWorkshop->viewer(), SIGNAL(mouseDoubleClick(QMouseEvent*)), this,
- SLOT(onMouseDoubleClick(QMouseEvent*)));
}
PartSet_Module::~PartSet_Module()
XGUI_Workshop* aXWshp = xWorkshop();
PartSet_OperationSketchBase* aPreviewOp =
dynamic_cast<PartSet_OperationSketchBase*>(workshop()->currentOperation());
- Handle(V3d_View) aView = myWorkshop->viewer()->activeView();
- if (aPreviewOp && (!aView.IsNull())) {
+ if (aPreviewOp) {
ModuleBase_ISelection* aSelection = workshop()->selection();
// Initialise operation with preliminary selection
- std::list<ModuleBase_ViewerPrs> aSelected = aSelection->getSelected();
- std::list<ModuleBase_ViewerPrs> aHighlighted = aSelection->getHighlighted();
-
- aPreviewOp->mousePressed(theEvent, aView, aSelected, aHighlighted);
+ //QList<ModuleBase_ViewerPrs> aSelected = aSelection->getSelected();
+ //QList<ModuleBase_ViewerPrs> aHighlighted = aSelection->getHighlighted();
+ //QList<ObjectPtr> aObjList;
+ //bool aHasShift = (theEvent->modifiers() & Qt::ShiftModifier);
+ //if (aHasShift) {
+ // foreach(ModuleBase_ViewerPrs aPrs, aSelected)
+ // aObjList.append(aPrs.object());
+
+ // foreach (ModuleBase_ViewerPrs aPrs, aHighlighted) {
+ // if (!aObjList.contains(aPrs.object()))
+ // aObjList.append(aPrs.object());
+ // }
+ //} else {
+ // foreach(ModuleBase_ViewerPrs aPrs, aHighlighted)
+ // aObjList.append(aPrs.object());
+ //}
+ //onSetSelection(aObjList);
+ aPreviewOp->mousePressed(theEvent, myWorkshop->viewer(), aSelection);
}
}
{
PartSet_OperationSketchBase* aPreviewOp =
dynamic_cast<PartSet_OperationSketchBase*>(myWorkshop->currentOperation());
- Handle(V3d_View) aView = myWorkshop->viewer()->activeView();
- if (aPreviewOp && (!aView.IsNull())) {
+ if (aPreviewOp) {
ModuleBase_ISelection* aSelection = workshop()->selection();
// Initialise operation with preliminary selection
- std::list<ModuleBase_ViewerPrs> aSelected = aSelection->getSelected();
- std::list<ModuleBase_ViewerPrs> aHighlighted = aSelection->getHighlighted();
-
- aPreviewOp->mouseReleased(theEvent, aView, aSelected, aHighlighted);
+ aPreviewOp->mouseReleased(theEvent, myWorkshop->viewer(), aSelection);
}
}
{
PartSet_OperationSketchBase* aPreviewOp =
dynamic_cast<PartSet_OperationSketchBase*>(myWorkshop->currentOperation());
- Handle(V3d_View) aView = myWorkshop->viewer()->activeView();
- if (aPreviewOp && (!aView.IsNull()))
- aPreviewOp->mouseMoved(theEvent, aView);
+ if (aPreviewOp)
+ aPreviewOp->mouseMoved(theEvent, myWorkshop->viewer());
}
void PartSet_Module::onKeyRelease(QKeyEvent* theEvent)
if (aPreviewOp && (!aView.IsNull())) {
ModuleBase_ISelection* aSelection = workshop()->selection();
// Initialise operation with preliminary selection
- std::list<ModuleBase_ViewerPrs> aSelected = aSelection->getSelected();
- std::list<ModuleBase_ViewerPrs> aHighlighted = aSelection->getHighlighted();
- aPreviewOp->mouseDoubleClick(theEvent, aView, aSelected, aHighlighted);
+ aPreviewOp->mouseDoubleClick(theEvent, aView, aSelection);
}
}
}
ModuleBase_ISelection* aSelection = workshop()->selection();
// Initialise operation with preliminary selection
- std::list<ModuleBase_ViewerPrs> aSelected = aSelection->getSelected();
- std::list<ModuleBase_ViewerPrs> aHighlighted = aSelection->getHighlighted();
- aSketchOp->initSelection(aSelected, aHighlighted);
+ aSketchOp->initSelection(aSelection);
} //else if (aFeature) {
//anOperation->setFeature(aFeature);
////Deactivate result of current feature in order to avoid its selection
SLOT(onFeatureConstructed(ObjectPtr, int)));
connect(aPreviewOp, SIGNAL(restartRequired(std::string, ObjectPtr)), this,
SLOT(onRestartOperation(std::string, ObjectPtr)));
- connect(aPreviewOp, SIGNAL(multiSelectionEnabled(bool)), this,
- SLOT(onMultiSelectionEnabled(bool)));
+ // If manage multi selection the it will be impossible to select more then one
+ // object under operation Edit
+// connect(aPreviewOp, SIGNAL(multiSelectionEnabled(bool)), this,
+// SLOT(onMultiSelectionEnabled(bool)));
connect(aPreviewOp, SIGNAL(stopSelection(const QList<ObjectPtr>&, const bool)), this,
SLOT(onStopSelection(const QList<ObjectPtr>&, const bool)));
return gp_Pln(aOrig, aDir);
}
+
+void PartSet_Module::onSelectionChanged()
+{
+ ModuleBase_ISelection* aSelect = myWorkshop->selection();
+ QList<ModuleBase_ViewerPrs> aSelected = aSelect->getSelected();
+ // We need to stop edit operation if selection is cleared
+ if (aSelected.size() == 0) {
+ PartSet_OperationFeatureEdit* anEditOp =
+ dynamic_cast<PartSet_OperationFeatureEdit*>(myWorkshop->currentOperation());
+ if (!anEditOp)
+ return;
+ anEditOp->commit();
+ } else {
+ PartSet_OperationSketchBase* aSketchOp =
+ dynamic_cast<PartSet_OperationSketchBase*>(myWorkshop->currentOperation());
+ if (aSketchOp) {
+ aSketchOp->selectionChanged(aSelect);
+ }
+ }
+}