From: sln Date: Tue, 20 May 2008 09:02:42 +0000 (+0000) Subject: NPAL19051: Possibility to clone specified view from SalomePyQt code is added. X-Git-Tag: TG_ELNO_visualization_28May2008~11 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4ef00bdd0d350edf2bf6208f1d6b8cefc8d5b6fe;p=modules%2Fgui.git NPAL19051: Possibility to clone specified view from SalomePyQt code is added. 1)New method cloneView() is added. 2)Part of functionality is moved from onCloneView() slot to cloneView() --- diff --git a/src/Plot2d/Plot2d_ViewManager.cxx b/src/Plot2d/Plot2d_ViewManager.cxx index 7681bd3f2..a94f5642c 100755 --- a/src/Plot2d/Plot2d_ViewManager.cxx +++ b/src/Plot2d/Plot2d_ViewManager.cxx @@ -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; } diff --git a/src/Plot2d/Plot2d_ViewManager.h b/src/Plot2d/Plot2d_ViewManager.h index a26b01cb6..2a6ffba94 100755 --- a/src/Plot2d/Plot2d_ViewManager.h +++ b/src/Plot2d/Plot2d_ViewManager.h @@ -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);