source: PSPA/Interface_Web/branches/12_03_12-managerComboBox/pspaWT/sources/userInterface/src/GWt_globalParameters.cc @ 397

Last change on this file since 397 was 397, checked in by garnier, 11 years ago

Améliorations de l'interface graphique

File size: 4.8 KB
Line 
1#include "GWt_globalParameters.h"
2#include <Wt/WVBoxLayout>
3#include <Wt/WGroupBox>
4#include <Wt/WText>
5#include <Wt/WLineEdit>
6#include <Wt/WBreak>
7#include <Wt/WPushButton>
8
9#include <Wt/WComboBox>
10
11#include "mixedTools.h"
12#include "GWt_console.h"
13
14
15GWt_globalParameters::GWt_globalParameters(PspaApplication* ps)
16{
17   
18    pspa_ = ps;
19    WVBoxLayout* globLayout = new WVBoxLayout();
20    //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
21    WContainerWidget *result = new WContainerWidget();
22    WPanel *panel = new WPanel(result);
23    panel->setTitle(" global parameters ");
24   
25   
26    WText* freqText = new WText("frequency (MHz) : ");
27    frequencyEdit_ = new WLineEdit();
28   
29    WText *stepText = new WText("step in phase (deg.) : ");
30    stepEdit_ = new WLineEdit();
31   
32    WText *nstepMaxText = new WText("max step number : ");
33    nstepMAxEdit_ = new WLineEdit();
34   
35    WText *nscText = new WText("periodicity of s.c. computation : ");
36    nscEdit_ = new WLineEdit();
37   
38   
39   
40    WContainerWidget* contenu = new WContainerWidget();
41    contenu->addWidget(freqText);
42    contenu->addWidget(frequencyEdit_);
43    contenu->addWidget(new WBreak());
44    contenu->addWidget(stepText);
45    contenu->addWidget(stepEdit_);
46    contenu->addWidget(new WBreak());
47    contenu->addWidget(nstepMaxText);
48    contenu->addWidget(nstepMAxEdit_);
49    contenu->addWidget(new WBreak());
50    contenu->addWidget(nscText);
51    contenu->addWidget(nscEdit_);
52   
53   
54   
55    panel->setCentralWidget(contenu);
56    // panel->setCollapsible(true);
57   
58   
59    //  WPanel *panelModules = new WPanel(result);
60    // panelModules->setTitle(" sections of beam Line for executing softwres ");
61   
62   
63    // WPushButton* push_add = new WPushButton("add");
64   
65   
66    // contenuSections_ = new WContainerWidget();
67   
68    // addSection();
69    // contenuSections_->addWidget( push_add);
70   
71   
72    // panelModules->setCentralWidget(contenuSections_);
73   
74   
75    globLayout->addWidget(result);
76   
77    setLayout(globLayout);
78    renew();
79}
80
81// void GWt_globalParameters::addSection()
82// {
83//   unsigned k;
84//   //   WComboBox* selectionBox = new WComboBox();
85
86//     sectionSelection_.push_back(new WComboBox());
87
88//     contenuSections_->addWidget(new WBreak());
89
90//     contenuSections_->addWidget(new WText(" from : "));
91//     contenuSections_->addWidget(new WLineEdit());
92//     contenuSections_->addWidget(new WText(" to : "));
93//     contenuSections_->addWidget(new WLineEdit());
94
95
96//     contenuSections_->addWidget(sectionSelection_.back());
97
98//     unsigned nb = nomDeLogiciel::getNumberOfSoftwares();
99//     for ( k=0; k < nb; k++) sectionSelection_.back()->addItem( nomDeLogiciel(k).getString() );
100//     //    selectionBox->addItem("Transport");
101// }
102
103
104void GWt_globalParameters::renew()
105{
106    string* param = pspa_->getDataManager()->getGlobalParameters()->getParametersString();
107    if ( param == NULL )
108    {
109        if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) {
110            GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console"));
111            console->addConsoleMessage(" GWt_globalParameters : empty parameter set");
112        }
113    }
114    int nbparam = atoi(param[0].c_str());
115    if ( nbparam != 4 )
116    {
117        if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) {
118            GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console"));
119            console->addConsoleMessage(" GWt_globalParameters : wrong number of parameters");
120        }
121    }
122    frequencyEdit_->setText(param[1].c_str());
123    stepEdit_->setText(param[2].c_str());
124    nstepMAxEdit_->setText(param[3].c_str());
125    nscEdit_->setText(param[4].c_str());
126}
127
128void GWt_globalParameters::updateGlobals()
129{
130    string envoi[5];
131    envoi[0] = string("4");
132    envoi[1] = frequencyEdit_->text().toUTF8();
133    envoi[2] = stepEdit_->text().toUTF8();
134    envoi[3] = nstepMAxEdit_->text().toUTF8();
135    envoi[4] = nscEdit_->text().toUTF8();
136    pspa_->getDataManager()->getGlobalParameters()->setParametersString(envoi);
137}
138
139// void GWt_globalParameters::getExecute(unsigned index, unsigned& first, unsigned& last, int& programm)
140// {
141//   string debut;
142//   string fin;
143//   if ( index == 1)
144//     {
145//       debut = origineEdit1_->text().toUTF8();
146//       fin = extremiteEdit1_->text().toUTF8();
147//       programm = selectionBox1_->currentIndex();
148//       cout << " current index " << programm << endl;
149//     }
150//   else
151//     {
152//       debut = origineEdit2_->text().toUTF8();
153//       fin = extremiteEdit2_->text().toUTF8();
154//     }
155//   first = atoi ( debut.c_str() );
156//   last = atoi ( fin.c_str() );
157//   programm++;
158
159// }
160
161// void GWt_globalParameters::addElem()
162// {
163//     int dernier = pspa_->getDataManager()->beamLineSize();
164//     extremiteEdit1_->setText( mixedTools::intToString(dernier) );
165// }
166
167
Note: See TracBrowser for help on using the repository browser.