| [1251] | 1 | // Classe CxxExecWindow : Control Window for CxxExecutor
 | 
|---|
 | 2 | // Classe CxxExecOptWindow : Option Window for CxxExecutor
 | 
|---|
 | 3 | // (c) DAPNIA (CEA)                 LAL (IN2P3/CNRS)
 | 
|---|
| [1269] | 4 | //                           R. Ansari  C.Magneville 10/2000
 | 
|---|
| [1251] | 5 | 
 | 
|---|
 | 6 | #include "cxxexecutor.h"
 | 
|---|
 | 7 | #include "cxxexecwin.h"
 | 
|---|
 | 8 | 
 | 
|---|
| [1269] | 9 | // --------------------------------------------------------------------
 | 
|---|
 | 10 | // --------------------------------------------------------------------
 | 
|---|
 | 11 | // ------------- Fenetre dde commande pour le CxxExecutor -------------
 | 
|---|
 | 12 | // --------------------------------------------------------------------
 | 
|---|
 | 13 | // --------------------------------------------------------------------
 | 
|---|
 | 14 | 
 | 
|---|
| [1251] | 15 | /* --Methode-- */
 | 
|---|
 | 16 | CxxExecWind::CxxExecWind(PIStdImgApp* par, CxxExecutor * cxxexec)
 | 
|---|
 | 17 | : PIWindow((PIMsgHandler *)par, "CxxExecutor", PIWK_normal, 400, 300, 150, 150)
 | 
|---|
 | 18 | {
 | 
|---|
 | 19 |   dap = par;
 | 
|---|
 | 20 |   cxxex = cxxexec;
 | 
|---|
| [1269] | 21 |   mFName[0] = "";
 | 
|---|
 | 22 |   mFName[1] = "";
 | 
|---|
| [1251] | 23 | 
 | 
|---|
 | 24 |   int bsx, bsy, szx, szy;
 | 
|---|
 | 25 |   int px, py, spx, spy;
 | 
|---|
| [1269] | 26 |   int xtext, ytext;
 | 
|---|
 | 27 | 
 | 
|---|
 | 28 |   ////////////////////////////////////
 | 
|---|
 | 29 |   //       Window Definition        //
 | 
|---|
 | 30 |   ////////////////////////////////////
 | 
|---|
 | 31 | 
 | 
|---|
| [1251] | 32 |   // On definit la taille a partir de la taille par defaut des composantes 
 | 
|---|
 | 33 |   PIApplicationPrefCompSize(bsx, bsy);
 | 
|---|
 | 34 |   // On redefinit la taille de la fenetre
 | 
|---|
 | 35 |   spx = bsx/6;
 | 
|---|
 | 36 |   spy = bsy/6;
 | 
|---|
| [1269] | 37 |   xtext = 8*bsx;
 | 
|---|
 | 38 |   ytext = 8*bsy;
 | 
|---|
 | 39 |   szx = xtext+2*spx;   
 | 
|---|
 | 40 |   szy = 2*ytext+5*bsy+10*spy;
 | 
|---|
| [1251] | 41 |   SetSize(szx, szy);
 | 
|---|
 | 42 | 
 | 
|---|
| [1269] | 43 |   ////////////////////////////////////
 | 
|---|
 | 44 |   //       User Function Code       //
 | 
|---|
 | 45 |   ////////////////////////////////////
 | 
|---|
 | 46 | 
 | 
|---|
 | 47 | // Creation du champ texte 
 | 
|---|
| [1251] | 48 |   px = spx;
 | 
|---|
| [1269] | 49 |   py = spy;
 | 
|---|
 | 50 |   mText[0] = new PIText(this,"helptext",true,true,xtext,0.75*ytext,px,py);
 | 
|---|
 | 51 |   mText[0]->SetTextEditable(true);
 | 
|---|
 | 52 |   mText[0]->SetText("");
 | 
|---|
| [1251] | 53 | 
 | 
|---|
| [1269] | 54 | // Creation du champ titre, des boutons d'action et label fichier
 | 
|---|
 | 55 |   px = spx;
 | 
|---|
 | 56 |   py += (int)(spy+0.75*ytext);
 | 
|---|
 | 57 |   mLab[3] = new PILabel(this,"FileFunc",xtext,bsy,px,py);
 | 
|---|
 | 58 |   mLab[3]->SetLabel("");
 | 
|---|
 | 59 |   mLab[3]->SetBorderWidth(1);
 | 
|---|
 | 60 |   px = spx;
 | 
|---|
 | 61 |   py += spy+bsy;
 | 
|---|
 | 62 |   mLab[0] = new PILabel(this,"Function",2*bsx,bsy,px,py);
 | 
|---|
 | 63 |   mLab[0]->SetLabel("User Function Code");
 | 
|---|
 | 64 |   mLab[0]->SetBorderWidth(1);
 | 
|---|
 | 65 |   px += spx+2*bsx;
 | 
|---|
 | 66 |   mBut[0] = new PIButton(this,"Open",500,bsx,bsy,px,py);
 | 
|---|
 | 67 |   px += bsx+spx;
 | 
|---|
 | 68 |   mBut[1] = new PIButton(this,"Save",510,bsx,bsy,px,py);
 | 
|---|
 | 69 |   px += bsx+spx;
 | 
|---|
 | 70 |   mBut[2] = new PIButton(this,"Save As",520,bsx,bsy,px,py);
 | 
|---|
 | 71 |   px += bsx+spx;
 | 
|---|
 | 72 |   mBut[3] = new PIButton(this,"Reset Name",530,1.5*bsx,bsy,px,py);
 | 
|---|
 | 73 | 
 | 
|---|
 | 74 |   ////////////////////////////////////
 | 
|---|
 | 75 |   //           User Code            //
 | 
|---|
 | 76 |   ////////////////////////////////////
 | 
|---|
 | 77 | 
 | 
|---|
| [1251] | 78 | // Creation du champ texte 
 | 
|---|
| [1269] | 79 |   px = spx;
 | 
|---|
 | 80 |   py += 2*spy+bsy;
 | 
|---|
 | 81 |   mText[1] = new PIText(this,"helptext",true,true,xtext,1.25*ytext,px,py);
 | 
|---|
 | 82 |   mText[1]->SetTextEditable(true);
 | 
|---|
 | 83 |   mText[1]->SetText("");
 | 
|---|
| [1251] | 84 | 
 | 
|---|
| [1269] | 85 | // Creation du champ titre, des boutons d'action et label fichier
 | 
|---|
 | 86 |   px = spx;
 | 
|---|
 | 87 |   py += (int)(spy+1.25*ytext);
 | 
|---|
 | 88 |   mLab[4] = new PILabel(this,"FileCode",xtext,bsy,px,py);
 | 
|---|
 | 89 |   mLab[4]->SetLabel("");
 | 
|---|
 | 90 |   mLab[4]->SetBorderWidth(1);
 | 
|---|
 | 91 |   px = spx;
 | 
|---|
 | 92 |   py += spy+bsy;
 | 
|---|
 | 93 |   mLab[1] = new PILabel(this,"Code",2*bsx,bsy,px,py);
 | 
|---|
 | 94 |   mLab[1]->SetLabel("User Code");
 | 
|---|
 | 95 |   mLab[1]->SetBorderWidth(1);
 | 
|---|
 | 96 |   px += spx+2*bsx;
 | 
|---|
 | 97 |   mBut[4] = new PIButton(this,"Open",501,bsx,bsy,px,py);
 | 
|---|
 | 98 |   px += bsx+spx;
 | 
|---|
 | 99 |   mBut[5] = new PIButton(this,"Save",511,bsx,bsy,px,py);
 | 
|---|
 | 100 |   px += bsx+spx;
 | 
|---|
 | 101 |   mBut[6] = new PIButton(this,"Save As",521,bsx,bsy,px,py);
 | 
|---|
 | 102 |   px += bsx+spx;
 | 
|---|
 | 103 |   mBut[7] = new PIButton(this,"Reset Name",531,1.5*bsx,bsy,px,py);
 | 
|---|
| [1251] | 104 | 
 | 
|---|
| [1269] | 105 |   ////////////////////////////////////
 | 
|---|
 | 106 |   //     Buttons for execution      //
 | 
|---|
 | 107 |   ////////////////////////////////////
 | 
|---|
| [1251] | 108 | 
 | 
|---|
| [1269] | 109 | // Creation du champ titre pour le code
 | 
|---|
 | 110 |   px = spx;
 | 
|---|
 | 111 |   py += 2*spy+bsy;
 | 
|---|
 | 112 |   mLab[2] = new PILabel(this, "Execute",2*bsx,bsy,px,py);
 | 
|---|
 | 113 |   mLab[2]->SetLabel("Execute :");
 | 
|---|
 | 114 |   mLab[2]->SetBorderWidth(1);
 | 
|---|
 | 115 | 
 | 
|---|
 | 116 | // Creation des boutons d'action 
 | 
|---|
 | 117 |   px += (int)(szx/2 - 1.2*bsx - spx);
 | 
|---|
 | 118 |   mBut[8] = new PIButton(this,"Exec",600,1.2*bsx,bsy,px,py);
 | 
|---|
 | 119 |   px += (int)(1.2*bsx+spx);
 | 
|---|
 | 120 |   mBut[9] = new PIButton(this,"Dismiss",601,1.2*bsx,bsy,px,py);
 | 
|---|
 | 121 | 
 | 
|---|
 | 122 |   ////////////////////////////////////
 | 
|---|
 | 123 |   //  Set Attributes for Elements   //
 | 
|---|
 | 124 |   ////////////////////////////////////
 | 
|---|
 | 125 | 
 | 
|---|
| [1285] | 126 |   int ii;
 | 
|---|
 | 127 |   for(ii=0; ii<5; ii++) 
 | 
|---|
| [1269] | 128 |     mLab[ii]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
 | 
|---|
| [1285] | 129 |   for(ii=0; ii<10; ii++) 
 | 
|---|
| [1251] | 130 |     mBut[ii]->SetBinding(PIBK_elastic , PIBK_elastic , PIBK_elastic , PIBK_elastic);
 | 
|---|
| [1285] | 131 |   for(ii=0; ii<2; ii++) 
 | 
|---|
| [1269] | 132 |     mText[ii]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
 | 
|---|
| [1251] | 133 | 
 | 
|---|
| [1269] | 134 |   // File Chooser
 | 
|---|
| [1251] | 135 |   pfc = new PIFileChooser(this,"CxxExec-FileChooser", 5000); 
 | 
|---|
 | 136 | }
 | 
|---|
 | 137 | 
 | 
|---|
 | 138 | /* --Methode-- */
 | 
|---|
 | 139 | CxxExecWind::~CxxExecWind()
 | 
|---|
 | 140 | {
 | 
|---|
| [1285] | 141 |   int i;
 | 
|---|
 | 142 |   for(i=0; i<5; i++)  delete mLab[i];
 | 
|---|
 | 143 |   for(i=0; i<10; i++) delete mBut[i];
 | 
|---|
 | 144 |   for(i=0; i<2; i++)  delete mText[i];
 | 
|---|
| [1251] | 145 |   delete pfc;
 | 
|---|
 | 146 | }
 | 
|---|
 | 147 | 
 | 
|---|
 | 148 | /* --Methode-- */
 | 
|---|
 | 149 | void CxxExecWind::Show()
 | 
|---|
 | 150 | {
 | 
|---|
| [1269] | 151 | mLab[3]->SetLabel(mFName[0]);
 | 
|---|
 | 152 | mLab[4]->SetLabel(mFName[1]);
 | 
|---|
 | 153 | PIWindow::Show();
 | 
|---|
| [1251] | 154 | }
 | 
|---|
 | 155 | 
 | 
|---|
 | 156 | /* --Methode-- */
 | 
|---|
 | 157 | void CxxExecWind::Process(PIMessage msg, PIMsgHandler* /*sender*/, void* data)
 | 
|---|
 | 158 | {
 | 
|---|
| [1269] | 159 |   msg = UserMsg(msg);
 | 
|---|
 | 160 |   switch (msg)  {
 | 
|---|
 | 161 |     case 600:    // Bouton Execute C++
 | 
|---|
| [1319] | 162 |       SetUnSensitive();
 | 
|---|
 | 163 |       dap->GetConsole()->AddStr(
 | 
|---|
 | 164 |          "CxxExecWind::Process() - Executing C++ Code ... \n", PIVA_Magenta);
 | 
|---|
| [1321] | 165 |       dap->SetBusy();
 | 
|---|
| [1269] | 166 |       cxxex->ExecuteCXX(mText[1]->GetText(),mText[0]->GetText());
 | 
|---|
| [1319] | 167 |       dap->GetConsole()->AddStr(
 | 
|---|
| [1321] | 168 |          "CxxExecWind ... End of Executing C++ Code \n");
 | 
|---|
| [1319] | 169 |       SetSensitive();
 | 
|---|
| [1251] | 170 |       dap->SetReady();
 | 
|---|
 | 171 |       break;
 | 
|---|
| [1269] | 172 |     case 601:   // Bouton Dismiss - On cache la fenetre
 | 
|---|
 | 173 |       this->Hide();
 | 
|---|
 | 174 |       break;
 | 
|---|
 | 175 |     case 500:    // Open File for Function
 | 
|---|
 | 176 |     case 501:    // Open File for Code
 | 
|---|
 | 177 |       {
 | 
|---|
 | 178 |       int i = msg-500;
 | 
|---|
| [1251] | 179 |       pfc->AcceptNewFile(false); 
 | 
|---|
| [1269] | 180 |       pfc->SetMsg(5500+i);
 | 
|---|
| [1251] | 181 |       dap->SetBlocked();
 | 
|---|
 | 182 |       pfc->Show();
 | 
|---|
 | 183 |       break;
 | 
|---|
| [1269] | 184 |       }
 | 
|---|
 | 185 |     case 5500:  // Return from open-file dialog for Function
 | 
|---|
 | 186 |     case 5501:  // Return from open-file dialog for Code
 | 
|---|
 | 187 |       {
 | 
|---|
 | 188 |       int i = msg-5500;
 | 
|---|
| [1251] | 189 |       dap->SetBusy();
 | 
|---|
| [1269] | 190 |       if(data) {
 | 
|---|
 | 191 |         mFName[i] = pfc->GetFileName();
 | 
|---|
 | 192 |         mLab[3+i]->SetLabel(mFName[i]);
 | 
|---|
 | 193 |         string code = stringfrfile(mFName[i]);
 | 
|---|
 | 194 |         mText[i]->SetText(code);
 | 
|---|
| [1251] | 195 |       }
 | 
|---|
 | 196 |       dap->SetReady();
 | 
|---|
 | 197 |       break;
 | 
|---|
 | 198 |       }
 | 
|---|
| [1269] | 199 |     case 510:  // Save for Function
 | 
|---|
 | 200 |     case 511:  // Save for Code
 | 
|---|
 | 201 |     case 520:  // Save-File for Function
 | 
|---|
 | 202 |     case 521:  // Save-File for Code
 | 
|---|
 | 203 |       {
 | 
|---|
 | 204 |       int i = msg%10;
 | 
|---|
 | 205 |       if( msg<515 && mFName[i].length()>0 ) {
 | 
|---|
 | 206 |         string code = mText[i]->GetText();
 | 
|---|
 | 207 |         filefrstring(mFName[i],code);
 | 
|---|
 | 208 |       } else {
 | 
|---|
| [1251] | 209 |         pfc->AcceptNewFile(true); 
 | 
|---|
| [1269] | 210 |         pfc->SetMsg(5520+i);
 | 
|---|
| [1251] | 211 |         dap->SetBlocked();
 | 
|---|
 | 212 |         pfc->Show();    
 | 
|---|
 | 213 |       }
 | 
|---|
 | 214 |       break;
 | 
|---|
| [1269] | 215 |       }
 | 
|---|
 | 216 |     case 5520:  // Return from Save-file dialog for Function
 | 
|---|
 | 217 |     case 5521:  // Return from Save-file dialog for Code
 | 
|---|
 | 218 |       {
 | 
|---|
 | 219 |       int i = msg-5520;
 | 
|---|
| [1251] | 220 |       dap->SetBusy();
 | 
|---|
 | 221 |       if (data) {
 | 
|---|
| [1269] | 222 |         mFName[i] = pfc->GetFileName();
 | 
|---|
 | 223 |         mLab[3+i]->SetLabel(mFName[i]);
 | 
|---|
 | 224 |         string code = mText[i]->GetText();
 | 
|---|
 | 225 |         filefrstring(mFName[i],code);
 | 
|---|
| [1251] | 226 |       }
 | 
|---|
 | 227 |       dap->SetReady();
 | 
|---|
 | 228 |       break;
 | 
|---|
| [1269] | 229 |       }
 | 
|---|
 | 230 |     case 530:  // Reset name for Function
 | 
|---|
 | 231 |     case 531:  // Reset name for Code
 | 
|---|
 | 232 |       {
 | 
|---|
 | 233 |       int i = msg-530;
 | 
|---|
 | 234 |       mFName[i] = "";
 | 
|---|
 | 235 |       mLab[3+i]->SetLabel(mFName[i]);
 | 
|---|
 | 236 |       }
 | 
|---|
| [1251] | 237 |   }
 | 
|---|
 | 238 | 
 | 
|---|
 | 239 |   // In case of compile errors, we end-up here !    
 | 
|---|
| [1269] | 240 |   mBut[8]->SetSensitive();
 | 
|---|
| [1251] | 241 |   dap->SetReady();
 | 
|---|
 | 242 |   return;
 | 
|---|
 | 243 | }
 | 
|---|
 | 244 | 
 | 
|---|
| [1269] | 245 | /* --Methode-- */
 | 
|---|
 | 246 | void CxxExecWind::filefrstring(string filename,string& code)
 | 
|---|
 | 247 | {
 | 
|---|
 | 248 | if(filename.size()<1) return;
 | 
|---|
 | 249 | if(code.size()<1) return;
 | 
|---|
 | 250 | ofstream os(filename.c_str(),ios::out);
 | 
|---|
 | 251 | if(!os)
 | 
|---|
 | 252 |   {cout<<"CxxExecWind::filefrstring: unable to open "<<filename<<endl;
 | 
|---|
 | 253 |    return;}
 | 
|---|
 | 254 | os<<code<<endl;
 | 
|---|
 | 255 | }
 | 
|---|
 | 256 | 
 | 
|---|
 | 257 | /* --Methode-- */
 | 
|---|
 | 258 | string CxxExecWind::stringfrfile(string filename)
 | 
|---|
 | 259 | {
 | 
|---|
 | 260 | string code = "";
 | 
|---|
 | 261 | if(filename.size()<1) return code;
 | 
|---|
 | 262 | ifstream is(filename.c_str(),ios::in);
 | 
|---|
 | 263 | if(!is)
 | 
|---|
 | 264 |   {cout<<"CxxExecWind::stringfrfile: unable to open "<<filename<<endl;
 | 
|---|
 | 265 |    return code;}
 | 
|---|
 | 266 | char c;
 | 
|---|
 | 267 | while(is.get(c)) code += c;
 | 
|---|
 | 268 | return code;
 | 
|---|
 | 269 | }
 | 
|---|
 | 270 | 
 | 
|---|
| [1251] | 271 | // --------------------------------------------------------------------
 | 
|---|
 | 272 | // --------------------------------------------------------------------
 | 
|---|
| [1269] | 273 | // --------------- Fenetre d'option pour le CxxExecutor ---------------
 | 
|---|
| [1251] | 274 | // --------------------------------------------------------------------
 | 
|---|
| [1269] | 275 | // --------------------------------------------------------------------
 | 
|---|
| [1251] | 276 | 
 | 
|---|
 | 277 | /* --Methode-- */
 | 
|---|
 | 278 | CxxOptionWind::CxxOptionWind(PIStdImgApp* par, CxxExecutor * cxxexec)
 | 
|---|
 | 279 | : PIWindow((PIMsgHandler *)par, "CxxOption", PIWK_normal, 400, 300, 150, 150)
 | 
|---|
 | 280 | {
 | 
|---|
 | 281 | 
 | 
|---|
 | 282 |   dap = par;
 | 
|---|
 | 283 |   cxxex = cxxexec;
 | 
|---|
 | 284 | 
 | 
|---|
 | 285 |   int bsx, bsy, szx, szy;
 | 
|---|
 | 286 |   int px, py, spx, spy;
 | 
|---|
| [1269] | 287 |   int xtext;
 | 
|---|
| [1251] | 288 |   // On definit la taille a partir de la taille par defaut des composantes 
 | 
|---|
 | 289 |   PIApplicationPrefCompSize(bsx, bsy);
 | 
|---|
 | 290 |   // On redefinit la taille de la fenetre
 | 
|---|
| [1269] | 291 |   spx = bsx/12; if(spx<2) spx=2;
 | 
|---|
| [1251] | 292 |   spy = bsy/6;
 | 
|---|
| [1269] | 293 |   xtext = 7*bsx;
 | 
|---|
 | 294 |   szx = (int)(xtext+1.5*bsx+3*spx);
 | 
|---|
| [1297] | 295 |   szy = 7*bsy+8*spy;
 | 
|---|
| [1251] | 296 |   SetSize(szx, szy);
 | 
|---|
 | 297 | 
 | 
|---|
 | 298 | // Creation de champs "labels"
 | 
|---|
| [1269] | 299 |   px = (szx-xtext)/2;
 | 
|---|
 | 300 |   py = spy;
 | 
|---|
 | 301 |   mTit = new PILabel(this,"CxxExecutor Options",xtext,bsy,px,py);
 | 
|---|
| [1251] | 302 |   mTit->SetBorderWidth(1);
 | 
|---|
| [1269] | 303 | 
 | 
|---|
 | 304 | // Creation des labels et des champs texte
 | 
|---|
 | 305 |   px = spx;
 | 
|---|
| [1251] | 306 |   py += spy+bsy;
 | 
|---|
| [1269] | 307 |   mLab[0] = new PILabel(this,"Include Files",1.5*bsx,bsy,px,py);
 | 
|---|
 | 308 |   px += (int)(1.5*bsx+spx);
 | 
|---|
 | 309 |   mText[0] = new PIText(this,"IncFiles",xtext,bsy,px,py);
 | 
|---|
 | 310 |   mText[0]->SetText("");
 | 
|---|
| [1251] | 311 | 
 | 
|---|
| [1269] | 312 |   px = spx;
 | 
|---|
| [1251] | 313 |   py += spy+bsy;
 | 
|---|
| [1269] | 314 |   mLab[1] = new PILabel(this,"Compile Opt.",1.5*bsx,bsy,px,py);
 | 
|---|
 | 315 |   px += (int)(1.5*bsx+spx);
 | 
|---|
 | 316 |   mText[1] = new PIText(this,"CompOpt",xtext,bsy,px,py);
 | 
|---|
| [1251] | 317 |   mText[1]->SetText("");
 | 
|---|
| [1269] | 318 | 
 | 
|---|
 | 319 |   px = spx;
 | 
|---|
| [1251] | 320 |   py += spy+bsy;
 | 
|---|
| [1269] | 321 |   mLab[2] = new PILabel(this,"Link Options",1.5*bsx,bsy,px,py);
 | 
|---|
 | 322 |   px += (int)(1.5*bsx+spx);
 | 
|---|
 | 323 |   mText[2] = new PIText(this,"LinkOpt",xtext,bsy,px,py);
 | 
|---|
| [1251] | 324 |   mText[2]->SetText("");
 | 
|---|
| [1269] | 325 | 
 | 
|---|
 | 326 |   px = spx;
 | 
|---|
| [1251] | 327 |   py += spy+bsy;
 | 
|---|
| [1269] | 328 |   mLab[3] = new PILabel(this,"Libraries",1.5*bsx,bsy,px,py);
 | 
|---|
 | 329 |   px += (int)(1.5*bsx+spx);
 | 
|---|
 | 330 |   mText[3] = new PIText(this,"LinkLib",xtext,bsy,px,py);
 | 
|---|
| [1251] | 331 |   mText[3]->SetText("");
 | 
|---|
 | 332 | 
 | 
|---|
| [1297] | 333 |   px = spx;
 | 
|---|
 | 334 |   py += spy+bsy;
 | 
|---|
 | 335 |   mLab[4] = new PILabel(this,"Modules",1.5*bsx,bsy,px,py);
 | 
|---|
 | 336 |   px += (int)(1.5*bsx+spx);
 | 
|---|
 | 337 |   mText[4] = new PIText(this,"ModImp",xtext,bsy,px,py);
 | 
|---|
 | 338 |   mText[4]->SetText("");
 | 
|---|
 | 339 | 
 | 
|---|
| [1251] | 340 | // Creation de bouton d'action 
 | 
|---|
 | 341 | 
 | 
|---|
| [1269] | 342 |   px = (int)(szx/2 - 1.5*bsx - spx - 1.5*bsx/2.);
 | 
|---|
 | 343 |   py += spy+bsy;
 | 
|---|
 | 344 |   mBut[0] = new PIButton(this,"Set Options",500,1.5*bsx,bsy,px,py);
 | 
|---|
 | 345 |   px += (int)(1.5*bsx+spx);
 | 
|---|
 | 346 |   mBut[1] = new PIButton(this,"Get Options",600,1.5*bsx,bsy,px,py);
 | 
|---|
 | 347 |   px += (int)(1.5*bsx+spx);
 | 
|---|
 | 348 |   mBut[2] = new PIButton(this,"Dismiss",700,1.5*bsx, bsy,px,py);
 | 
|---|
| [1251] | 349 | 
 | 
|---|
 | 350 | //  Taille et position proportionnelles a la taille de la fenetre pour les elements
 | 
|---|
 | 351 |   mTit->SetBinding(PIBK_elastic , PIBK_elastic , PIBK_elastic , PIBK_elastic);
 | 
|---|
| [1285] | 352 |   int i;
 | 
|---|
 | 353 |   for(i=0; i<4; i++)
 | 
|---|
| [1251] | 354 |     mLab[i]->SetBinding(PIBK_elastic , PIBK_elastic , PIBK_elastic , PIBK_elastic);
 | 
|---|
| [1285] | 355 |   for(i=0; i<4; i++)
 | 
|---|
| [1251] | 356 |     mText[i]->SetBinding(PIBK_elastic , PIBK_elastic , PIBK_elastic , PIBK_elastic);
 | 
|---|
| [1285] | 357 |   for(i=0; i<3; i++) 
 | 
|---|
| [1269] | 358 |     mBut[i]->SetBinding(PIBK_elastic , PIBK_elastic , PIBK_elastic , PIBK_elastic);
 | 
|---|
| [1251] | 359 | }
 | 
|---|
 | 360 | 
 | 
|---|
 | 361 | /* --Methode-- */
 | 
|---|
 | 362 | CxxOptionWind::~CxxOptionWind()
 | 
|---|
 | 363 | {
 | 
|---|
 | 364 |   delete mTit;
 | 
|---|
| [1285] | 365 |   int i;
 | 
|---|
| [1297] | 366 |   for(i=0; i<5; i++) delete mLab[i];
 | 
|---|
| [1285] | 367 |   for(i=0; i<3; i++) delete mBut[i];
 | 
|---|
| [1297] | 368 |   for(i=0; i<5; i++) delete mText[i];
 | 
|---|
| [1251] | 369 | }
 | 
|---|
 | 370 | 
 | 
|---|
 | 371 | /* --Methode-- */
 | 
|---|
 | 372 | void CxxOptionWind::Show()
 | 
|---|
 | 373 | {
 | 
|---|
 | 374 |   mText[0]->SetText(cxxex->GetInclude());
 | 
|---|
 | 375 |   mText[1]->SetText(cxxex->GetCompileOpt());
 | 
|---|
 | 376 |   mText[2]->SetText(cxxex->GetLinkOpt());
 | 
|---|
| [1269] | 377 |   mText[3]->SetText(cxxex->GetLinkLibs());
 | 
|---|
| [1297] | 378 |   mText[4]->SetText(cxxex->GetModuleImport());
 | 
|---|
| [1251] | 379 |   PIWindow::Show();
 | 
|---|
 | 380 | }
 | 
|---|
 | 381 | 
 | 
|---|
 | 382 | /* --Methode-- */
 | 
|---|
 | 383 | void CxxOptionWind::Process(PIMessage msg, PIMsgHandler* /*sender*/, void* /*data*/)
 | 
|---|
 | 384 | {
 | 
|---|
 | 385 |   string opt;
 | 
|---|
 | 386 |   switch (UserMsg(msg))  {
 | 
|---|
 | 387 |     case 500:    // Bouton Set Options
 | 
|---|
 | 388 |       opt = mText[0]->GetText();
 | 
|---|
 | 389 |       cxxex->FillInclude(opt);
 | 
|---|
 | 390 |       opt = mText[1]->GetText();
 | 
|---|
 | 391 |       cxxex->FillCompileOpt(opt);
 | 
|---|
 | 392 |       opt = mText[2]->GetText();
 | 
|---|
 | 393 |       cxxex->FillLinkOpt(opt);
 | 
|---|
 | 394 |       opt = mText[3]->GetText();
 | 
|---|
 | 395 |       cxxex->FillLinkLibs(opt);
 | 
|---|
| [1297] | 396 |       opt = mText[4]->GetText();
 | 
|---|
 | 397 |       cxxex->FillModuleImport(opt);
 | 
|---|
| [1251] | 398 |       break;
 | 
|---|
 | 399 |     case 600:    // Bouton Get Options
 | 
|---|
 | 400 |       mText[0]->SetText(cxxex->GetInclude());
 | 
|---|
 | 401 |       mText[1]->SetText(cxxex->GetCompileOpt());
 | 
|---|
 | 402 |       mText[2]->SetText(cxxex->GetLinkOpt());
 | 
|---|
| [1269] | 403 |       mText[3]->SetText(cxxex->GetLinkLibs());
 | 
|---|
| [1297] | 404 |       mText[4]->SetText(cxxex->GetModuleImport());
 | 
|---|
| [1251] | 405 |       break;
 | 
|---|
 | 406 |     case 700:   // Bouton Dismiss - On cache la fenetre
 | 
|---|
 | 407 |       this->Hide();
 | 
|---|
 | 408 |       break;
 | 
|---|
 | 409 |   }
 | 
|---|
 | 410 | return;
 | 
|---|
 | 411 | }
 | 
|---|