Index: Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_globalParameters.cc
===================================================================
--- Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_globalParameters.cc	(revision 408)
+++ Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_globalParameters.cc	(revision 427)
@@ -1,168 +1,118 @@
-#include "GWt_globalParameters.h"
-#include <Wt/WVBoxLayout>
-#include <Wt/WGroupBox>
-#include <Wt/WText>
+
+#include <Wt/WDialog>
 #include <Wt/WLineEdit>
 #include <Wt/WBreak>
 #include <Wt/WPushButton>
 
-#include <Wt/WComboBox>
-
-#include "mixedTools.h"
+#include "GWt_globalParameters.h"
 #include "GWt_console.h"
 
+#include "dataManager.h"
 
-GWt_globalParameters::GWt_globalParameters(PspaApplication* ps)
+GWt_globalParameters::GWt_globalParameters(dataManager* dt)
 {
-    
-    pspa_ = ps;
-    WVBoxLayout* globLayout = new WVBoxLayout();
-    //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
-    WContainerWidget *result = new WContainerWidget();
-    WPanel *panel = new WPanel(result);
-    panel->setTitle(" global parameters ");
-    
-    
-    WText* freqText = new WText("frequency (MHz) : ");
-    frequencyEdit_ = new WLineEdit();
-    
-    WText *stepText = new WText("step in phase (deg.) : ");
-    stepEdit_ = new WLineEdit();
-    
-    WText *nstepMaxText = new WText("max step number : ");
-    nstepMAxEdit_ = new WLineEdit();
-    
-    WText *nscText = new WText("periodicity of s.c. computation : ");
-    nscEdit_ = new WLineEdit();
-    
-    
-    
-    WContainerWidget* contenu = new WContainerWidget();
-    contenu->addWidget(freqText);
-    contenu->addWidget(frequencyEdit_);
-    contenu->addWidget(new WBreak());
-    contenu->addWidget(stepText);
-    contenu->addWidget(stepEdit_);
-    contenu->addWidget(new WBreak());
-    contenu->addWidget(nstepMaxText);
-    contenu->addWidget(nstepMAxEdit_);
-    contenu->addWidget(new WBreak());
-    contenu->addWidget(nscText);
-    contenu->addWidget(nscEdit_);
-    
-    
-    
-    panel->setCentralWidget(contenu);
-    // panel->setCollapsible(true);
-    
-    
-    //  WPanel *panelModules = new WPanel(result);
-    // panelModules->setTitle(" sections of beam Line for executing softwres ");
-    
-    
-    // WPushButton* push_add = new WPushButton("add");
-    
-    
-    // contenuSections_ = new WContainerWidget();
-    
-    // addSection();
-    // contenuSections_->addWidget( push_add);
-    
-    
-    // panelModules->setCentralWidget(contenuSections_);
-    
-    
-    globLayout->addWidget(result);
-    
-    setLayout(globLayout);
-    globLayout->setContentsMargins(0,0,0,0);
-    renew();
+  dt_ = dt;
 }
 
-// void GWt_globalParameters::addSection()
-// {
-//   unsigned k;
-//   //   WComboBox* selectionBox = new WComboBox();
+GWt_globalParameters::GWt_globalParameters(dataManager* dt,WContainerWidget* wt)
+{
+  dt_ = dt;
+  status_ = new WText("Go ahead...",wt);
+}
 
-//     sectionSelection_.push_back(new WComboBox());
+void GWt_globalParameters::initilializeDialog()
+{
+  string* param = dialogBegin();
 
-//     contenuSections_->addWidget(new WBreak());
+  dialog_ = new WDialog("global parameters");
+  new WText("Enter frequency (MHz) : ",dialog_->contents());
+  frequencyEdit_ = new WLineEdit(param[1].c_str(),dialog_->contents());
+  new WBreak(dialog_->contents());
+  new WText("Enter step in phase (deg) : ",dialog_->contents());
+  stepEdit_ = new WLineEdit(param[2].c_str(),dialog_->contents());
+  new WBreak(dialog_->contents());
+  new WText("Enter max step number : ",dialog_->contents());
+  nstepMAxEdit_ = new WLineEdit(param[3].c_str(),dialog_->contents());
+  new WBreak(dialog_->contents());
+  new WText("Enter periodicity of s.c. computation : ",dialog_->contents());
+  nscEdit_ = new WLineEdit(param[4].c_str(),dialog_->contents());
+  new WBreak(dialog_->contents());
 
-//     contenuSections_->addWidget(new WText(" from : "));
-//     contenuSections_->addWidget(new WLineEdit());
-//     contenuSections_->addWidget(new WText(" to : "));
-//     contenuSections_->addWidget(new WLineEdit());
+  WPushButton *ok =  new WPushButton("Ok", dialog_->contents());
+  ok->clicked().connect(dialog_, &WDialog::accept);
+  WPushButton *no = new WPushButton("Cancel", dialog_->contents());
+  no->clicked().connect(dialog_, &WDialog::reject);
 
+  dialog_->finished().connect(this,&GWt_globalParameters::dialogDone);
+  //dialog_->show();
+  dialog_->exec(WAnimation(WAnimation::SlideInFromTop));
+}
 
-//     contenuSections_->addWidget(sectionSelection_.back());
+string* GWt_globalParameters::dialogBegin()
+{
+  string* param = dt_->getGlobalParameters()->getParametersString();
+  if ( param == NULL ) {
+    if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) {
+      GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console"));
+      console->addConsoleMessage(" GWt_globalParameters : empty parameter set");
+    }
+  }
 
-//     unsigned nb = nomDeLogiciel::getNumberOfSoftwares();
-//     for ( k=0; k < nb; k++) sectionSelection_.back()->addItem( nomDeLogiciel(k).getString() );
-//     //    selectionBox->addItem("Transport");
-// }
+  int nbparam = atoi(param[0].c_str());
+  if ( nbparam != 4 ) {
+    if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) {
+      GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console"));
+      console->addConsoleMessage(" GWt_globalParameters : wrong number of parameters");
+    }
+  }
+  
+  envoi_[0] = param[0].c_str();
+  envoi_[1] = param[1].c_str();
+  envoi_[2] = param[2].c_str();
+  envoi_[3] = param[3].c_str();
+  envoi_[4] = param[4].c_str();
+  setStatus();
+  return param;
+}
 
-
-void GWt_globalParameters::renew()
+void GWt_globalParameters::dialogDone(WDialog::DialogCode code)
 {
-    string* param = pspa_->getDataManager()->getGlobalParameters()->getParametersString();
-    if ( param == NULL )
-    {
-        if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) {
-            GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console"));
-            console->addConsoleMessage(" GWt_globalParameters : empty parameter set");
-        }
-    }
-    int nbparam = atoi(param[0].c_str());
-    if ( nbparam != 4 )
-    {
-        if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) {
-            GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console"));
-            console->addConsoleMessage(" GWt_globalParameters : wrong number of parameters");
-        }
-    }
-    frequencyEdit_->setText(param[1].c_str());
-    stepEdit_->setText(param[2].c_str());
-    nstepMAxEdit_->setText(param[3].c_str());
-    nscEdit_->setText(param[4].c_str());
+  if (code == WDialog::Accepted) updateGlobals();
+  return;
 }
 
 void GWt_globalParameters::updateGlobals()
 {
-    string envoi[5];
-    envoi[0] = string("4");
-    envoi[1] = frequencyEdit_->text().toUTF8();
-    envoi[2] = stepEdit_->text().toUTF8();
-    envoi[3] = nstepMAxEdit_->text().toUTF8();
-    envoi[4] = nscEdit_->text().toUTF8();
-    pspa_->getDataManager()->getGlobalParameters()->setParametersString(envoi);
+  envoi_[0] = string("4");
+  envoi_[1] = frequencyEdit_->text().toUTF8();
+  envoi_[2] = stepEdit_->text().toUTF8();
+  envoi_[3] = nstepMAxEdit_->text().toUTF8();
+  envoi_[4] = nscEdit_->text().toUTF8();
+
+  setStatus();
+  dt_->getGlobalParameters()->setParametersString(envoi_);
 }
 
-// void GWt_globalParameters::getExecute(unsigned index, unsigned& first, unsigned& last, int& programm)
-// {
-//   string debut;
-//   string fin;
-//   if ( index == 1)
-//     {
-//       debut = origineEdit1_->text().toUTF8();
-//       fin = extremiteEdit1_->text().toUTF8();
-//       programm = selectionBox1_->currentIndex();
-//       cout << " current index " << programm << endl;
-//     }
-//   else
-//     {
-//       debut = origineEdit2_->text().toUTF8();
-//       fin = extremiteEdit2_->text().toUTF8();
-//     }
-//   first = atoi ( debut.c_str() );
-//   last = atoi ( fin.c_str() );
-//   programm++;
+void GWt_globalParameters::renew()
+{
+  string* param = dialogBegin();
 
-// }
+  frequencyEdit_->setText(param[1].c_str());
+  stepEdit_->setText(param[2].c_str());
+  nstepMAxEdit_->setText(param[3].c_str());
+  nscEdit_->setText(param[4].c_str());
+}
 
-// void GWt_globalParameters::addElem()
-// {
-//     int dernier = pspa_->getDataManager()->beamLineSize();
-//     extremiteEdit1_->setText( mixedTools::intToString(dernier) );
-// }
+string* GWt_globalParameters::getGlobalParameters()
+{
+  return envoi_;
+}
 
-
+void GWt_globalParameters::setStatus()
+{
+  WString out= WString("<p>frequency="+envoi_[1]+"</p>"
+	               "<p>step in phase="+envoi_[2]+"</p>"
+  	               "<p>max step number="+envoi_[3]+"</p>"
+   	               "<p>periodicity of s.c. computation="+envoi_[4]+"</p>");
+  status_->setText(out);
+}
