Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/geom.git] / src / BasicGUI / BasicGUI.cxx
index 8c47c0f4bbdb8a40c74d4403e012d4bd4b97f8d2..41b484848580dcdc38986992e21545a7083d72d0 100644 (file)
 
 using namespace std;
 
-//=======================================================================
-// function : GetBasicGUI()
-// purpose  : Get the only BasicGUI object [ static ]
-//=======================================================================
-BasicGUI* BasicGUI::GetBasicGUI( GeometryGUI* parent )
-{
-  return new BasicGUI( parent );
-}
-
 //=======================================================================
 // function : BasicGUI()
 // purpose  : Constructor
@@ -146,38 +137,41 @@ bool BasicGUI::OnMousePress( QMouseEvent* pe, SUIT_Desktop* parent, SUIT_ViewWin
   QDialog* aDlg = getGeometryGUI()->GetActiveDialogBox();
 
   // Create Point dialog, OCC viewer 
-  if ( aDlg && aDlg->isA( "BasicGUI_PointDlg" ) && theViewWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() &&  pe->state() != Qt::ControlButton )
+  if ( aDlg && aDlg->isA( "BasicGUI_PointDlg" ) &&
+       theViewWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() &&
+       pe->state() != Qt::ControlButton )
   {
     BasicGUI_PointDlg* aPntDlg = (BasicGUI_PointDlg*) aDlg;
     if ( aPntDlg->acceptMouseEvent() )
+    {
+      OCCViewer_Viewer* anOCCViewer =
+        ((OCCViewer_ViewManager*)(theViewWindow->getViewManager()))->getOCCViewer();
+      Handle(AIS_InteractiveContext) ic = anOCCViewer->getAISContext();
+
+      gp_Pnt aPnt;    
+
+      ic->InitSelected();
+      if ( pe->state() == Qt::ShiftButton )
+        ic->ShiftSelect();  // Append selection
+      else
+        ic->Select();       // New selection
+
+      ic->InitSelected();
+      if ( ic->MoreSelected() )
       {
-       OCCViewer_Viewer* anOCCViewer = ((OCCViewer_ViewManager*)(theViewWindow->getViewManager()))->getOCCViewer();
-       Handle(AIS_InteractiveContext) ic = anOCCViewer->getAISContext();
-       
-       gp_Pnt aPnt;    
-
-       ic->InitSelected();
-       if( pe->state() == Qt::ShiftButton )
-         ic->ShiftSelect();  // Append selection
-       else
-         ic->Select();       // New selection
-
-       ic->InitSelected();
-       if( ic->MoreSelected() )
-         {
-           TopoDS_Shape aShape = ic->SelectedShape();
-           if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX )
-             aPnt = BRep_Tool::Pnt( TopoDS::Vertex( ic->SelectedShape() ) );
-         }
-       else
-         {
-           OCCViewer_ViewPort3d* vp =  ((OCCViewer_ViewWindow*)theViewWindow)->getViewPort();
-           aPnt = ConvertClickToPoint( pe->x(), pe->y(), vp->getView() );
-         }
-
-       aPntDlg->OnPointSelected( aPnt );  // "feed" the point to point construction dialog
-      } // acceptMouseEvent()
-  } 
+        TopoDS_Shape aShape = ic->SelectedShape();
+        if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX )
+          aPnt = BRep_Tool::Pnt( TopoDS::Vertex( ic->SelectedShape() ) );
+      }
+      else
+      {
+        OCCViewer_ViewPort3d* vp =  ((OCCViewer_ViewWindow*)theViewWindow)->getViewPort();
+        aPnt = ConvertClickToPoint( pe->x(), pe->y(), vp->getView() );
+      }
+
+      aPntDlg->OnPointSelected( aPnt );  // "feed" the point to point construction dialog
+    } // acceptMouseEvent()
+  }
   return false;
 }
 
@@ -213,11 +207,9 @@ gp_Pnt BasicGUI::ConvertClickToPoint( int x, int y, Handle(V3d_View) aView)
 //=====================================================================================
 extern "C"
 {
-#ifdef WNT
-       __declspec( dllexport )
-#endif
+GEOM_BASICGUI_EXPORT
   GEOMGUI* GetLibGUI( GeometryGUI* parent )
   {
-    return BasicGUI::GetBasicGUI( parent );
+    return new BasicGUI( parent );
   }
 }