1 | |
---|
2 | #include "GWt_bend.h" |
---|
3 | #include "mixedTools.h" |
---|
4 | |
---|
5 | #include <Wt/WText> |
---|
6 | #include <Wt/WLineEdit> |
---|
7 | #include <Wt/WBreak> |
---|
8 | #include <Wt/WDialog> |
---|
9 | #include <Wt/WPushButton> |
---|
10 | |
---|
11 | GWt_bend::GWt_bend(abstractElement* elem) : GWt_abstractElement(elem) |
---|
12 | { |
---|
13 | |
---|
14 | string* param = beginDialog(); |
---|
15 | |
---|
16 | new WText("angle (deg.) : ",dialog_->contents()); |
---|
17 | angleEdit_ = new WLineEdit( param->c_str(), dialog_->contents()); |
---|
18 | new WBreak(dialog_->contents()); |
---|
19 | |
---|
20 | new WText("radius (m) : ",dialog_->contents()); |
---|
21 | radiusEdit_ = new WLineEdit( (++param)->c_str(), dialog_->contents()); |
---|
22 | new WBreak(dialog_->contents()); |
---|
23 | |
---|
24 | new WText("momentum (MeV/c) : ",dialog_->contents()); |
---|
25 | momentumEdit_ = new WLineEdit( (++param)->c_str(), dialog_->contents()); |
---|
26 | new WBreak(dialog_->contents()); |
---|
27 | |
---|
28 | new WText("length (cm) : ",dialog_->contents()); |
---|
29 | xlengthEdit_ = new WLineEdit("0", dialog_->contents()); |
---|
30 | xlengthEdit_->setDisabled(true); |
---|
31 | new WBreak(dialog_->contents()); |
---|
32 | |
---|
33 | new WText("aperture (cm) : ",dialog_->contents()); |
---|
34 | apertureEdit_ = new WLineEdit( (++param)->c_str(), dialog_->contents()); |
---|
35 | apertureEdit_->setDisabled(true); |
---|
36 | new WBreak(dialog_->contents()); |
---|
37 | |
---|
38 | new WText("pole face rotations (deg.) entrance : ",dialog_->contents()); |
---|
39 | beta1Edit_ = new WLineEdit( (++param)->c_str(), dialog_->contents()); |
---|
40 | new WText("exit : ",dialog_->contents()); |
---|
41 | beta2Edit_ = new WLineEdit( (++param)->c_str(), dialog_->contents()); |
---|
42 | new WBreak(dialog_->contents()); |
---|
43 | |
---|
44 | WPushButton *submit = new WPushButton("OK",dialog_->contents()); |
---|
45 | submit->clicked().connect(dialog_, &Wt::WDialog::accept); |
---|
46 | dialog_->finished().connect(this, &GWt_bend::dialogDone); |
---|
47 | } |
---|
48 | |
---|
49 | void GWt_bend::dialogDone() |
---|
50 | { |
---|
51 | unsigned nbParam = element_->getNbParams(); |
---|
52 | string* envoi = new string[nbParam+1]; |
---|
53 | int compteur = -1; |
---|
54 | envoi[++compteur] = string(mixedTools::intToString(nbParam) ); |
---|
55 | envoi[++compteur] = labelEdit_->text().toUTF8(); |
---|
56 | cout << " GWt_bend::dialogDone() j'envoie " << envoi[compteur] << endl; |
---|
57 | envoi[++compteur] = angleEdit_->text().toUTF8(); |
---|
58 | envoi[++compteur] = radiusEdit_->text().toUTF8(); |
---|
59 | envoi[++compteur] = apertureEdit_->text().toUTF8(); |
---|
60 | envoi[++compteur] = beta1Edit_->text().toUTF8(); |
---|
61 | envoi[++compteur] = beta2Edit_->text().toUTF8(); |
---|
62 | envoi[++compteur] = momentumEdit_->text().toUTF8(); |
---|
63 | if ( compteur != (int)nbParam ) { |
---|
64 | cerr << " GWt_bend::dialogDone() pb nb de parametres, compteur = " << compteur << " nbParam= " << nbParam << endl; |
---|
65 | return; |
---|
66 | } |
---|
67 | element_->setParametersString(envoi); |
---|
68 | delete [] envoi; |
---|
69 | } |
---|