/// Update current viewer
virtual void update() = 0;
+ /// Method returns True if the viewer can process editing objects
+ /// by mouse drugging. If this is impossible thet it has to return False.
+ virtual bool canDragByMouse() const { return true; }
+
signals:
/// Signal emited when last view window is closed
void lastViewClosed();
{
OCCViewer_ViewWindow* aViewWnd = dynamic_cast<OCCViewer_ViewWindow*>(theView);
Handle(AIS_InteractiveContext) aContext = AISContext();
- if (aContext->HasDetected())
+ if (aContext->HasDetected()) // Set focus to provide key events in the view
aViewWnd->getViewPort()->setFocus(Qt::MouseFocusReason);
emit mouseMove(myView, theEvent);
}
+//**********************************************
+bool NewGeom_SalomeViewer::canDragByMouse() const
+{
+ OCCViewer_Viewer* aViewer = mySelector->viewer();
+ return (aViewer->interactionStyle() != 0);
+}
+
+
//**********************************************
void NewGeom_SalomeViewer::onKeyPress(SUIT_ViewWindow* theView, QKeyEvent* theEvent)
{
/// Update current viewer
virtual void update();
+ /// Method returns True if the viewer can process editing objects
+ /// by mouse drugging. If this is impossible thet it has to return False.
+ virtual bool canDragByMouse() const;
private slots:
void onMousePress(SUIT_ViewWindow*, QMouseEvent*);
if (!(theEvent->buttons() & Qt::LeftButton))
return;
+ // Clear dragging mode
+ myIsDragging = false;
+
ModuleBase_IWorkshop* aWorkshop = myModule->workshop();
+ ModuleBase_IViewer* aViewer = aWorkshop->viewer();
+ if (!aViewer->canDragByMouse())
+ return;
+
ModuleBase_Operation* aOperation = aWorkshop->currentOperation();
if (aOperation && aOperation->isEditOperation()) {
ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel();
}
}
- // Clear dragging mode
- myIsDragging = false;
-
// Use only for sketch operations
if (aOperation && myCurrentSketch) {
if (!PartSet_Tools::sketchPlane(myCurrentSketch))
return;
// MoveTo in order to highlight current object
- ModuleBase_IViewer* aViewer = aWorkshop->viewer();
aViewer->AISContext()->MoveTo(theEvent->x(), theEvent->y(), theWnd->v3dView());
// Remember highlighted objects for editing
void PartSet_SketcherMgr::onMouseReleased(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent)
{
ModuleBase_IWorkshop* aWorkshop = myModule->workshop();
+ ModuleBase_IViewer* aViewer = aWorkshop->viewer();
+ if (!aViewer->canDragByMouse())
+ return;
ModuleBase_Operation* aOp = aWorkshop->currentOperation();
if (aOp) {
if (sketchOperationIdList().contains(aOp->id())) {
get2dPoint(theWnd, theEvent, myClickedPoint);
// Only for sketcher operations
- ModuleBase_IViewer* aViewer = aWorkshop->viewer();
if (myIsDragging) {
if (myDragDone) {
//aOp->commit();
{
myWorkshop->displayer()->updateViewer();
}
+
+//***************************************
+bool XGUI_ViewerProxy::canDragByMouse() const
+{
+ if (myWorkshop->isSalomeMode()) {
+ ModuleBase_IViewer* aViewer = myWorkshop->salomeConnector()->viewer();
+ return aViewer->canDragByMouse();
+ } else {
+ return true;
+ }
+}
\ No newline at end of file
/// Update current viewer
virtual void update();
+ /// Method returns True if the viewer can process editing objects
+ /// by mouse drugging. If this is impossible thet it has to return False.
+ virtual bool canDragByMouse() const;
+
private slots:
void onTryCloseView(AppElements_ViewWindow*);
void onDeleteView(AppElements_ViewWindow*);