1 // Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/
19 #include "Plot2d_ViewManager.h"
20 #include "Plot2d_ViewModel.h"
21 #include "Plot2d_ViewWindow.h"
23 int Plot2d_ViewManager::myMaxId = 0;
28 Plot2d_ViewManager::Plot2d_ViewManager( SUIT_Study* study, SUIT_Desktop* desk )
29 : SUIT_ViewManager( study, desk )
32 Plot2d_Viewer* v = new Plot2d_Viewer();
39 Plot2d_ViewManager::~Plot2d_ViewManager()
44 \return corresponding viewer
46 Plot2d_Viewer* Plot2d_ViewManager::getPlot2dModel() const
48 return (Plot2d_Viewer*)myViewModel;
52 Sets default name of view
53 \param the View - view to be renamed
55 void Plot2d_ViewManager::setViewName( SUIT_ViewWindow* theView )
57 int aPos = myViews.find(theView);
58 theView->setCaption( QString( "Plot2d scene:%1 - viewer:%2" ).arg(myId).arg(aPos+1));
63 \param theView - view to be added
65 bool Plot2d_ViewManager::insertView( SUIT_ViewWindow* theView )
67 bool res = SUIT_ViewManager::insertView( theView );
70 Plot2d_ViewWindow* view = (Plot2d_ViewWindow*)theView;
71 connect( view, SIGNAL( cloneView() ), this, SLOT( onCloneView() ) );
79 void Plot2d_ViewManager::createView()
85 SLOT: called if action "Clone view" is activated, emits signal cloneView()
87 void Plot2d_ViewManager::onCloneView()
89 SUIT_ViewWindow* vw = createViewWindow();
91 Plot2d_ViewWindow *newWnd = 0, *clonedWnd = 0;
92 if( vw && vw->inherits( "Plot2d_ViewWindow" ) )
93 newWnd = ( Plot2d_ViewWindow* )vw;
94 if( sender() && sender()->inherits( "Plot2d_ViewWindow" ) )
95 clonedWnd = ( Plot2d_ViewWindow* )sender();
97 if( newWnd && clonedWnd )
98 emit cloneView( clonedWnd->getViewFrame(), newWnd->getViewFrame() );