From: asl Date: Fri, 3 Mar 2006 08:43:30 +0000 (+0000) Subject: PAL11112 : user cannot specify co-ordinates by click in viewer X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ad6a10f1cfa76b1a1f87367ba0f335c6ae424baf;p=modules%2Fgeom.git PAL11112 : user cannot specify co-ordinates by click in viewer --- diff --git a/src/GEOMBase/GEOMBase_Skeleton.cxx b/src/GEOMBase/GEOMBase_Skeleton.cxx index 84760134d..57b32e089 100644 --- a/src/GEOMBase/GEOMBase_Skeleton.cxx +++ b/src/GEOMBase/GEOMBase_Skeleton.cxx @@ -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(app->loadModule("Geometry")); - if (module) - myGeomGUI = dynamic_cast(module); - } + if( app ) + myGeomGUI = dynamic_cast( 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; diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index 04cf3d313..f113bc8f0 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -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 ) ); diff --git a/src/GEOMGUI/GeometryGUI.h b/src/GEOMGUI/GeometryGUI.h index 57f0d6542..85b39ffc5 100644 --- a/src/GEOMGUI/GeometryGUI.h +++ b/src/GEOMGUI/GeometryGUI.h @@ -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 :