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 "nomDeLogiciel.h" |
---|
13 | |
---|
14 | GWt_globalParameters::GWt_globalParameters(PspaApplication* ps) |
---|
15 | { |
---|
16 | |
---|
17 | pspa_ = ps; |
---|
18 | WVBoxLayout* globLayout = new WVBoxLayout(); |
---|
19 | decorationStyle().setBackgroundColor (WColor("blue")); |
---|
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 | |
---|
104 | void GWt_globalParameters::renew() |
---|
105 | { |
---|
106 | string* param = pspa_->getDataManager()->getGlobalParameters()->getParametersString(); |
---|
107 | if ( param == NULL ) |
---|
108 | { |
---|
109 | pspa_->addConsoleMessage(" GWt_globalParameters : empty parameter set"); |
---|
110 | } |
---|
111 | int nbparam = atoi(param[0].c_str()); |
---|
112 | if ( nbparam != 4 ) |
---|
113 | { |
---|
114 | pspa_->addConsoleMessage(" GWt_globalParameters : wrong number of parameters"); |
---|
115 | } |
---|
116 | frequencyEdit_->setText(param[1].c_str()); |
---|
117 | stepEdit_->setText(param[2].c_str()); |
---|
118 | nstepMAxEdit_->setText(param[3].c_str()); |
---|
119 | nscEdit_->setText(param[4].c_str()); |
---|
120 | } |
---|
121 | |
---|
122 | void GWt_globalParameters::updateGlobals() |
---|
123 | { |
---|
124 | string envoi[5]; |
---|
125 | envoi[0] = string("4"); |
---|
126 | envoi[1] = frequencyEdit_->text().toUTF8(); |
---|
127 | envoi[2] = stepEdit_->text().toUTF8(); |
---|
128 | envoi[3] = nstepMAxEdit_->text().toUTF8(); |
---|
129 | envoi[4] = nscEdit_->text().toUTF8(); |
---|
130 | pspa_->getDataManager()->getGlobalParameters()->setParametersString(envoi); |
---|
131 | } |
---|
132 | |
---|
133 | // void GWt_globalParameters::getExecute(unsigned index, unsigned& first, unsigned& last, int& programm) |
---|
134 | // { |
---|
135 | // string debut; |
---|
136 | // string fin; |
---|
137 | // if ( index == 1) |
---|
138 | // { |
---|
139 | // debut = origineEdit1_->text().toUTF8(); |
---|
140 | // fin = extremiteEdit1_->text().toUTF8(); |
---|
141 | // programm = selectionBox1_->currentIndex(); |
---|
142 | // cout << " current index " << programm << endl; |
---|
143 | // } |
---|
144 | // else |
---|
145 | // { |
---|
146 | // debut = origineEdit2_->text().toUTF8(); |
---|
147 | // fin = extremiteEdit2_->text().toUTF8(); |
---|
148 | // } |
---|
149 | // first = atoi ( debut.c_str() ); |
---|
150 | // last = atoi ( fin.c_str() ); |
---|
151 | // programm++; |
---|
152 | |
---|
153 | // } |
---|
154 | |
---|
155 | // void GWt_globalParameters::addElem() |
---|
156 | // { |
---|
157 | // int dernier = pspa_->getDataManager()->beamLineSize(); |
---|
158 | // extremiteEdit1_->setText( mixedTools::intToString(dernier) ); |
---|
159 | // } |
---|
160 | |
---|
161 | |
---|