1 // Copyright (C) 2016 CEA/DEN, EDF 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, or (at your option) any later version.
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/ or email : webmaster.salome@opencascade.com
20 #include "PresentationController.hxx"
21 #include "MEDModule.hxx"
22 #include "Basics_Utils.hxx"
23 #include "QtxActionGroup.h"
25 static const int OPTIONS_VIEW_MODE_ID = 943;
26 static const int OPTIONS_VIEW_MODE_REPLACE_ID = 944;
27 static const int OPTIONS_VIEW_MODE_OVERLAP_ID = 945;
28 static const int OPTIONS_VIEW_MODE_NEW_LAYOUT_ID = 946;
29 static const int OPTIONS_VIEW_MODE_SPLIT_VIEW_ID = 947;
31 PresentationController::PresentationController(MEDModule* salomeModule)
33 STDLOG("Creating a PresentationController");
34 _salomeModule = salomeModule;
37 PresentationController::~PresentationController()
39 STDLOG("Deleting the PresentationController");
43 PresentationController::createActions()
45 STDLOG("Creating PresentationController actions");
46 int toolbarId = _salomeModule->createTool("View Mode", "PresentationToolbar");
48 QtxActionGroup* ag = _salomeModule->createActionGroup(OPTIONS_VIEW_MODE_ID, true);
49 ag->setText("View mode");
50 ag->setUsesDropDown(true);
52 QString label = tr("LAB_VIEW_MODE_REPLACE");
53 QString tooltip = tr("TIP_VIEW_MODE_REPLACE");
54 QAction* a = _salomeModule->createAction(OPTIONS_VIEW_MODE_REPLACE_ID,label,QIcon(),label,tooltip,0);
55 a->setCheckable(true);
59 label = tr("LAB_VIEW_MODE_OVERLAP");
60 tooltip = tr("TIP_VIEW_MODE_OVERLAP");
61 a = _salomeModule->createAction(OPTIONS_VIEW_MODE_OVERLAP_ID,label,QIcon(),label,tooltip,0);
62 a->setCheckable(true);
65 label = tr("LAB_VIEW_MODE_NEW_LAYOUT");
66 tooltip = tr("TIP_VIEW_MODE_NEW_LAYOUT");
67 a = _salomeModule->createAction(OPTIONS_VIEW_MODE_NEW_LAYOUT_ID,label,QIcon(),label,tooltip,0);
68 a->setCheckable(true);
71 label = tr("LAB_VIEW_MODE_SPLIT_VIEW");
72 tooltip = tr("TIP_VIEW_MODE_SPLIT_VIEW");
73 a = _salomeModule->createAction(OPTIONS_VIEW_MODE_SPLIT_VIEW_ID,label,QIcon(),label,tooltip,0);
74 a->setCheckable(true);
77 _salomeModule->createTool(OPTIONS_VIEW_MODE_ID, toolbarId);
82 MEDCALC::MEDPresentationViewMode
83 PresentationController::getSelectedViewMode()
85 if (_salomeModule->action(OPTIONS_VIEW_MODE_REPLACE_ID)->isChecked()) {
86 return MEDCALC::VIEW_MODE_REPLACE;
88 else if (_salomeModule->action(OPTIONS_VIEW_MODE_OVERLAP_ID)->isChecked()) {
89 return MEDCALC::VIEW_MODE_OVERLAP;
91 else if (_salomeModule->action(OPTIONS_VIEW_MODE_NEW_LAYOUT_ID)->isChecked()) {
92 return MEDCALC::VIEW_MODE_NEW_LAYOUT;
94 else if (_salomeModule->action(OPTIONS_VIEW_MODE_SPLIT_VIEW_ID)->isChecked()) {
95 return MEDCALC::VIEW_MODE_SPLIT_VIEW;