]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
NPAL19051: Possibility to clone specified view from SalomePyQt code is added.
authorsln <sln@opencascade.com>
Tue, 20 May 2008 09:02:42 +0000 (09:02 +0000)
committersln <sln@opencascade.com>
Tue, 20 May 2008 09:02:42 +0000 (09:02 +0000)
1)New method cloneView() is added.
2)Part of functionality is moved from onCloneView() slot to cloneView()

src/Plot2d/Plot2d_ViewManager.cxx
src/Plot2d/Plot2d_ViewManager.h

index 7681bd3f2b4eeba76076ef263cb5581d7f7d6cc4..a94f5642c01f410ea16e7017796d91f855a1337d 100755 (executable)
@@ -71,15 +71,30 @@ void Plot2d_ViewManager::createView()
   SLOT: called if action "Clone view" is activated, emits signal cloneView()
 */
 void Plot2d_ViewManager::onCloneView()
+{
+  if( sender() && sender()->inherits( "Plot2d_ViewWindow" ) )
+  {
+    Plot2d_ViewWindow* srcWnd = ( Plot2d_ViewWindow* )sender();
+    cloneView( srcWnd );
+  }
+}
+
+/*!
+  \brief Creates clone of source window
+  \param srcWnd source window
+  \return Pointer on the new window
+  \sa onCloneView()
+*/
+Plot2d_ViewWindow* Plot2d_ViewManager::cloneView( Plot2d_ViewWindow* srcWnd )
 {
   SUIT_ViewWindow* vw = createViewWindow();
 
-  Plot2d_ViewWindow  *newWnd = 0, *clonedWnd = 0;
+  Plot2d_ViewWindow* newWnd = 0;
   if( vw && vw->inherits( "Plot2d_ViewWindow" ) )
     newWnd = ( Plot2d_ViewWindow* )vw;
-  if( sender() && sender()->inherits( "Plot2d_ViewWindow" ) )
-    clonedWnd = ( Plot2d_ViewWindow* )sender();
   
-  if( newWnd && clonedWnd )
-    emit cloneView( clonedWnd->getViewFrame(), newWnd->getViewFrame() );
+  if( newWnd && srcWnd )
+    emit cloneView( srcWnd->getViewFrame(), newWnd->getViewFrame() );
+
+  return newWnd;
 }
index a26b01cb69406c7a2eb6582dff135c9d4e1bda7b..2a6ffba94deb65b1dd3095b53d7cff92b9da90b2 100755 (executable)
@@ -23,6 +23,7 @@
 #include "SUIT_ViewManager.h"
 
 class SUIT_Desktop;
+class Plot2d_ViewWindow;
 class Plot2d_Viewer;
 class Plot2d_ViewFrame;
 
@@ -35,6 +36,7 @@ public:
   ~Plot2d_ViewManager();
 
   Plot2d_Viewer*     getPlot2dModel() const;
+  Plot2d_ViewWindow* cloneView( Plot2d_ViewWindow* srcWnd );
 
 protected:
   bool         insertView(SUIT_ViewWindow* theView);