]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
PAL11112 : user cannot specify co-ordinates by click in viewer
authorasl <asl@opencascade.com>
Fri, 3 Mar 2006 08:43:30 +0000 (08:43 +0000)
committerasl <asl@opencascade.com>
Fri, 3 Mar 2006 08:43:30 +0000 (08:43 +0000)
src/GEOMBase/GEOMBase_Skeleton.cxx
src/GEOMGUI/GeometryGUI.cxx
src/GEOMGUI/GeometryGUI.h

index 84760134d3a45ff2bc892dc0f6ab811c47f1e31e..57b32e089e9d979e3fab4003a3f0fe17de36f904 100644 (file)
@@ -81,12 +81,8 @@ void GEOMBase_Skeleton::Init()
 {
   myGeomGUI = 0;
   SalomeApp_Application* app = (SalomeApp_Application*)(SUIT_Session::session()->activeApplication());
-  if (app)
-    {
-      SalomeApp_Module* module = dynamic_cast<SalomeApp_Module*>(app->loadModule("Geometry"));
-      if (module)
-       myGeomGUI =  dynamic_cast<GeometryGUI*>(module);
-    }
+  if( app )
+    myGeomGUI = dynamic_cast<GeometryGUI*>( app->module( "Geometry" ) );
   
   /* init variables */
   myGeomBase = new GEOMBase();  // SAN -- TO BE REMOVED !!!
@@ -95,10 +91,10 @@ void GEOMBase_Skeleton::Init()
   /* signals and slots connections */
   connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
   if (myGeomGUI) 
-    {
-      connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
-      connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
-    }
+  {
+    connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
+    connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
+  }
   
   /* Move widget on the botton right corner of main widget */
 //   int x, y;
index 04cf3d313c0f3774bb22f629e75d3758454655fc..f113bc8f0b2974cda76367e146941a0613dc10b6 100644 (file)
@@ -551,13 +551,13 @@ void GeometryGUI::OnGUIEvent( int id )
 // function : GeometryGUI::OnKeyPress()
 // purpose  : Called when any key is pressed by user [static]
 //=================================================================================
-bool GeometryGUI::OnKeyPress( QKeyEvent* pe, SUIT_ViewWindow* win )
+void GeometryGUI::OnKeyPress( SUIT_ViewWindow* win, QKeyEvent* pe )
 {
   GUIMap::Iterator it;
   bool bOk = true;
   for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it )
     bOk = bOk && it.data()->OnKeyPress( pe, application()->desktop(), win );
-  return bOk;
+//  return bOk;
 }
 
 
@@ -565,13 +565,13 @@ bool GeometryGUI::OnKeyPress( QKeyEvent* pe, SUIT_ViewWindow* win )
 // function : GeometryGUI::OnMouseMove()
 // purpose  : Manages mouse move events [static]
 //=================================================================================
-bool GeometryGUI::OnMouseMove( QMouseEvent* pe, SUIT_ViewWindow* win )
+void GeometryGUI::OnMouseMove( SUIT_ViewWindow* win, QMouseEvent* pe )
 {  
   GUIMap::Iterator it;
   bool bOk = true;
   for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it )
     bOk = bOk && it.data()->OnMouseMove( pe, application()->desktop(), win );
-  return bOk;
+//  return bOk;
 }
 
 
@@ -579,7 +579,7 @@ bool GeometryGUI::OnMouseMove( QMouseEvent* pe, SUIT_ViewWindow* win )
 // function : GeometryGUI::0nMousePress()
 // purpose  : Manage mouse press events [static]
 //=================================================================================
-bool GeometryGUI::OnMousePress( QMouseEvent* pe, SUIT_ViewWindow* win )
+void GeometryGUI::OnMousePress( SUIT_ViewWindow* win, QMouseEvent* pe )
 {
   GUIMap::Iterator it;
   // OnMousePress() should return false if this event should be processed further
@@ -587,7 +587,7 @@ bool GeometryGUI::OnMousePress( QMouseEvent* pe, SUIT_ViewWindow* win )
   bool processed = false;
   for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it )
     processed = processed || it.data()->OnMousePress( pe, application()->desktop(), win );
-  return processed;
+//  return processed;
 }
 
 /*
@@ -1117,10 +1117,6 @@ bool GeometryGUI::activateModule( SUIT_Study* study )
 
   connect( application()->desktop(), SIGNAL( windowActivated( SUIT_ViewWindow* ) ), 
          this, SLOT( onWindowActivated( SUIT_ViewWindow* ) ) );
-  connect( (STD_Application*)application(), SIGNAL( viewManagerAdded( SUIT_ViewManager* ) ),
-          this, SLOT( onViewManagerAdded( SUIT_ViewManager* ) ) );
-  connect( (STD_Application*)application(), SIGNAL( viewManagerRemoved( SUIT_ViewManager* ) ),
-          this, SLOT( onViewManagerRemoved( SUIT_ViewManager* ) ) );
 
   GUIMap::Iterator it;
   for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it )
@@ -1161,10 +1157,6 @@ bool GeometryGUI::deactivateModule( SUIT_Study* study )
 
   disconnect( application()->desktop(), SIGNAL( windowActivated( SUIT_ViewWindow* ) ), 
             this, SLOT( onWindowActivated( SUIT_ViewWindow* ) ) );
-  disconnect( (STD_Application*)application(), SIGNAL( viewManagerAdded( SUIT_ViewManager* ) ),
-            this, SLOT( onViewManagerAdded( SUIT_ViewManager* ) ) );
-  disconnect( (STD_Application*)application(), SIGNAL( viewManagerRemoved( SUIT_ViewManager* ) ),
-            this, SLOT( onViewManagerRemoved( SUIT_ViewManager* ) ) );
 
   EmitSignalCloseAllDialogs();
 
@@ -1535,6 +1527,15 @@ void GeometryGUI::onViewManagerAdded( SUIT_ViewManager* vm )
 {
   if ( vm->getType() == OCCViewer_Viewer::Type() )
   {
+    qDebug( "connect" );
+    connect( vm, SIGNAL( keyPress  ( SUIT_ViewWindow*, QKeyEvent* ) ),
+            this, SLOT( OnKeyPress( SUIT_ViewWindow*, QKeyEvent* ) ) );
+    connect( vm, SIGNAL( mousePress( SUIT_ViewWindow*, QMouseEvent* ) ),
+            this, SLOT( OnMousePress( SUIT_ViewWindow*, QMouseEvent* ) ) );
+    connect( vm, SIGNAL( mouseMove ( SUIT_ViewWindow*, QMouseEvent* ) ),
+            this, SLOT( OnMouseMove( SUIT_ViewWindow*, QMouseEvent* ) ) );
+
+
     LightApp_SelectionMgr* sm = getApp()->selectionMgr();
     myOCCSelectors.append( new GEOMGUI_OCCSelector( ((OCCViewer_ViewManager*)vm)->getOCCViewer(), sm ) );
 
index 57f0d65420412352affd4e89106b45caa940b728..85b39ffc5aaa01af50221d6fe13d29ed41513835 100644 (file)
@@ -117,10 +117,6 @@ public:
 
   void                        OnGUIEvent( int id );
 
-  virtual bool                OnKeyPress( QKeyEvent*, SUIT_ViewWindow* );
-  virtual bool                OnMousePress( QMouseEvent*, SUIT_ViewWindow* );
-  virtual bool                OnMouseMove( QMouseEvent*, SUIT_ViewWindow* );
-
 //  virtual bool                SetSettings();
 //  virtual void                SupportedViewType ( int* buffer, int bufferSize );
   virtual void                BuildPresentation( const Handle(SALOME_InteractiveObject)&, SUIT_ViewWindow* = 0 );
@@ -145,11 +141,16 @@ public:
 public slots:
   virtual bool                deactivateModule( SUIT_Study* );
   virtual bool                activateModule( SUIT_Study* );
+  virtual void                OnKeyPress  ( SUIT_ViewWindow*, QKeyEvent*   );
+  virtual void                OnMousePress( SUIT_ViewWindow*, QMouseEvent* );
+  virtual void                OnMouseMove ( SUIT_ViewWindow*, QMouseEvent* );
+
+protected slots:
+  virtual void                onViewManagerAdded( SUIT_ViewManager* );
+  virtual void                onViewManagerRemoved( SUIT_ViewManager* );
 
 private slots:
   void                        OnGUIEvent();
-  void                        onViewManagerAdded( SUIT_ViewManager* );
-  void                        onViewManagerRemoved( SUIT_ViewManager* );
   void                        onWindowActivated( SUIT_ViewWindow* );
 
 signals :