Salome HOME
Updated copyright comment
[modules/gui.git] / src / PV3DViewer / PV3DViewer_ViewManager.cxx
1 // Copyright (C) 2023-2024  CEA, EDF
2 //
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, or (at your option) any later version.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #include "PV3DViewer_ViewManager.h"
21 #include "PV3DViewer_ViewWindow.h"
22 #include "PV3DViewer_ViewModel.h"
23 // #include "PV3DViewer_Core.h"
24 #include "PVViewer_InitSingleton.h"
25 #include "PVViewer_GUIElements.h"
26 #include "PVServer_ServiceWrapper.h"
27
28 #include <utilities.h>
29
30 #include "SUIT_Desktop.h"
31 #include "SUIT_Study.h"
32 #include "SUIT_Session.h"
33 #include "SUIT_MessageBox.h"
34 #include "SUIT_ResourceMgr.h"
35
36 #include <pqServer.h>
37 #include <pqServerConnectReaction.h>
38 #include <pqActiveObjects.h>
39
40 /*!
41   Constructor
42 */
43 PV3DViewer_ViewManager::PV3DViewer_ViewManager(SUIT_Study* study, SUIT_Desktop* desktop)
44 : SUIT_ViewManager( study, desktop, new PV3DViewer_ViewModel() )
45 {
46   setTitle( tr( "PARAVIEW3D_VIEW_TITLE" ) );
47
48   // Initialize minimal paraview stuff (if not already done)
49   PVViewer_InitSingleton::Init(desktop);
50
51   connect( desktop, SIGNAL( windowActivated( SUIT_ViewWindow* ) ),
52            this, SLOT( onWindowActivated( SUIT_ViewWindow* ) ) );
53 }
54
55 /*!Enable toolbars if view \a view is ParaView viewer and disable otherwise.
56 */
57 void PV3DViewer_ViewManager::onWindowActivated(SUIT_ViewWindow* view)
58 {
59   if (view)
60   {
61     PV3DViewer_ViewWindow* pvWindow = dynamic_cast<PV3DViewer_ViewWindow*>(view);
62     PVViewer_GUIElements * guiElements = PVViewer_GUIElements::GetInstance( myDesktop );
63     guiElements->setToolBarEnabled(pvWindow!=0);
64   }
65 }