// because the displayed objects should be removed from the viewer, but
// the AIS context is obtained from the selector.
ModuleBase_Operation* anOperation = myWorkshop->operationMgr()->currentOperation();
- if (anOperation)
+ while (anOperation) {
anOperation->abort();
-
+ anOperation = myWorkshop->operationMgr()->currentOperation();
+ }
// Delete selector because it has to be redefined on next activation
if (mySelector) {
myProxyViewer->setSelector(0);
//**********************************************
void NewGeom_SalomeViewer::enableSelection(bool isEnabled)
{
- //mySelector->viewer()->enableSelection(isEnabled);
+ if (mySelector)
+ mySelector->viewer()->enableSelection(isEnabled);
// The enableSelection() in SALOME 7.5 cause of forced Viewer update(we have blinking)
// After this is corrected, the first row should be recommented, the last - removed
- if (mySelector)
- mySelector->viewer()->setInteractionStyle(isEnabled ? SUIT_ViewModel::STANDARD
- : SUIT_ViewModel::KEY_FREE);
+ //mySelector->viewer()->setInteractionStyle(isEnabled ? SUIT_ViewModel::STANDARD
+ // : SUIT_ViewModel::KEY_FREE);
}
//**********************************************
if (!(theEvent->buttons() & Qt::LeftButton))
return;
+ // Clear dragging mode
+ myIsDragging = false;
+
ModuleBase_IWorkshop* aWorkshop = myModule->workshop();
ModuleBase_Operation* aOperation = aWorkshop->currentOperation();
// Use only for sketch operations
if (isSketcher) {
myIsDragging = true;
-
get2dPoint(theWnd, theEvent, myCurX, myCurY);
myDragDone = false;
launchEditing();
{
ModuleBase_IWorkshop* aWorkshop = myModule->workshop();
ModuleBase_Operation* aOp = aWorkshop->currentOperation();
- if (!aOp)
- return;
- if (!sketchOperationIdList().contains(aOp->id()))
- return;
-
- // Only for sketcher operations
- ModuleBase_IViewer* aViewer = aWorkshop->viewer();
- if (myIsDragging) {
- aWorkshop->viewer()->enableSelection(myPreviousSelectionEnabled);
- myIsDragging = false;
- if (myDragDone) {
- //aOp->commit();
- myFeature2AttributeMap.clear();
-
- // Reselect edited object
- /*aViewer->AISContext()->MoveTo(theEvent->x(), theEvent->y(), theWnd->v3dView());
- if (theEvent->modifiers() & Qt::ShiftModifier)
- aViewer->AISContext()->ShiftSelect();
- else
- aViewer->AISContext()->Select();
- */
- return;
+ if (aOp) {
+ if (sketchOperationIdList().contains(aOp->id())) {
+ // Only for sketcher operations
+ ModuleBase_IViewer* aViewer = aWorkshop->viewer();
+ if (myIsDragging) {
+ if (myDragDone) {
+ //aOp->commit();
+ myFeature2AttributeMap.clear();
+
+ // Reselect edited object
+ /*aViewer->AISContext()->MoveTo(theEvent->x(), theEvent->y(), theWnd->v3dView());
+ if (theEvent->modifiers() & Qt::ShiftModifier)
+ aViewer->AISContext()->ShiftSelect();
+ else
+ aViewer->AISContext()->Select();
+ */
+ }
+ }
}
}
+ aWorkshop->viewer()->enableSelection(myPreviousSelectionEnabled);
+ myIsDragging = false;
}
void PartSet_SketcherMgr::onMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent)
aViewer->enableSelection(false);
ModuleBase_Operation* aOperation = myModule->workshop()->currentOperation();
+ if (!aOperation)
+ return;
if (aOperation->id().toStdString() == SketchPlugin_Sketch::ID())
return; // No edit operation activated
void PartSet_WidgetSketchLabel::setSketchingMode()
{
- qDebug("### Set sketching mode");
-
XGUI_Displayer* aDisp = myWorkshop->displayer();
// Clear standard selection modes if they are defined
//aDisp->activateObjects(aModes);
closeLocalContexts(false);
}
aContext->Display(anAISIO, false);
- qDebug("### Display %i", (long)anAISIO.Access());
aContext->SetDisplayMode(anAISIO, isShading? Shading : Wireframe, false);
// Customization of presentation
AISObjectPtr anObj = myResult2AISObjectMap[theObject];
Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
aContext->Deactivate(anAIS);
- qDebug("### Deactivate obj %i", (long)anAIS.Access());
}
}
foreach(int aMode, theModes) {
//aContext->Load(anAIS, aMode, true);
aContext->Activate(anAIS, aMode);
- qDebug("### 1. Activate obj %i, %i", (long)anAIS.Access(), aMode);
}
} else {
//aContext->Load(anAIS, 0, true);
aContext->Activate(anAIS);
- qDebug("### 2. Activate obj %i", (long)anAIS.Access());
}
}
}
if (myActiveSelectionModes.size() == 0) {
//aContext->Load(anAISIO, 0, true);
aContext->Activate(anAISIO);
- qDebug("### 2. Activate all %i", (long)anAISIO.Access());
} else {
foreach(int aMode, myActiveSelectionModes) {
//aContext->Load(anAISIO, aMode, true);
aContext->Activate(anAISIO, aMode);
- qDebug("### 1. Activate all %i, %i", (long)anAISIO.Access(), aMode);
}
}
}
for(aLIt.Initialize(aPrsList); aLIt.More(); aLIt.Next()){
anAISIO = aLIt.Value();
aContext->Deactivate(anAISIO);
- //aTrihedron = Handle(AIS_Trihedron)::DownCast(anAISIO);
- //if (aTrihedron.IsNull()) {
- // qDebug("### Deactivate all %i", (long)anAISIO.Access());
- // //aContext->Activate(anAISIO);
- //}
}
}
//aContext->ClearCurrents();
aContext->OpenLocalContext();
- qDebug("### Open context");
//aContext->NotUseDisplayedObjects();
//myUseExternalObjects = false;
//aContext->ClearSelected();
aContext->CloseAllContexts(false);
- qDebug("### Close context");
// Redisplay all object if they were displayed in localContext
Handle(AIS_InteractiveObject) aAISIO;
Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
if ((!aContext.IsNull()) && (!aContext->HasOpenedContext())) {
aContext->OpenLocalContext();
- qDebug("### Open context");
}
return aContext;
}
//**************************************************************
void XGUI_Workshop::closeDocument()
{
+ ModuleBase_Operation* anOperation = operationMgr()->currentOperation();
+ while (anOperation) {
+ anOperation->abort();
+ anOperation = operationMgr()->currentOperation();
+ }
myDisplayer->closeLocalContexts();
myDisplayer->eraseAll();
objectBrowser()->clearContent();