#include <MINFScript.h>
Public Member Functions | |
| AddParmDlg (const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h, UInt_t options=kMainFrame|kVerticalFrame) | |
| ~AddParmDlg () | |
| virtual void | AbortMacro () |
| virtual void | AddParameter () |
| virtual void | DelParameter () |
| virtual void | PopUpParmDialog () |
| virtual Bool_t | ProcessMessage (Long_t msg, Long_t parm, Long_t) |
| virtual void | RunMacro () |
| virtual void | SetMacroName (Text_t *name) |
| virtual void | SetArgs (Int_t args) |
| virtual void | SetReqArgs (Int_t reqargs) |
Private Attributes | |
| TGListBox * | fParListBox |
| TGTextEntry * | fParTEntry |
| TGTextBuffer * | fParTBuf |
| TGLabel * | fEditLabel |
| TGLabel * | fListLabel |
| TGTextButton * | fAddPar |
| TGTextButton * | fDelPar |
| TGTextButton * | fRunMacro |
| TGTextButton * | fAbortMacro |
| Char_t * | fMacroName |
| Int_t | fEntryID |
| macro name with parameters | |
| Int_t | fArgs |
| Int_t | fReqArgs |
|
||||||||||||||||||||||||
|
Definition at line 352 of file MINFScript.cxx. References fAbortMacro, fAddPar, fDelPar, fEditLabel, fListLabel, fParListBox, fParTBuf, fParTEntry, fRunMacro, and main(). 00353 : 00354 TGTransientFrame(p, main, w, h, options) 00355 , fParListBox(0) 00356 , fParTEntry(0) 00357 , fParTBuf(0) 00358 , fEditLabel(0) 00359 , fListLabel(0) 00360 , fAddPar(0) 00361 , fDelPar(0) 00362 , fRunMacro(0) 00363 , fAbortMacro(0) 00364 , fMacroName(0) 00365 { 00366 Move(400, 100); 00367 SetWindowName("Add Parameters To Macro"); 00368 00369 // some informative labels. 00370 fEditLabel = new TGLabel(this, "Parameter: "); 00371 fListLabel = new TGLabel(this, "List of parameters:"); 00372 00373 fEditLabel->Move(10, 55); 00374 fListLabel->Move(140, 85); 00375 00376 // edit box for parameters. 00377 fParTBuf = new TGTextBuffer(255); 00378 fParTEntry = new TGTextEntry(this, fParTBuf); 00379 fParTEntry->Resize(220, fParTEntry->GetDefaultHeight()); 00380 fParTEntry->Move(80, 50); 00381 00382 // buttons. 00383 fAddPar = new TGTextButton(this, "&Add Parameter", 1); 00384 fDelPar = new TGTextButton(this, "&Delete Parameter", 2); 00385 fRunMacro = new TGTextButton(this, "&Run Macro", 3); 00386 fAbortMacro = new TGTextButton(this, "&Cancel", 4); 00387 00388 fAddPar->Resize(120, fAddPar->GetDefaultHeight()); 00389 fAddPar->Move(10, 100); 00390 00391 fDelPar->Resize(120, fDelPar->GetDefaultHeight()); 00392 fDelPar->Move(10, 130); 00393 00394 fRunMacro->Resize(120, fRunMacro->GetDefaultHeight()); 00395 fRunMacro->Move(20, 170); 00396 00397 fAbortMacro->Resize(120, fRunMacro->GetDefaultHeight()); 00398 fAbortMacro->Move(170, 170); 00399 00400 // listbox to hold parameters. 00401 fParListBox = new TGListBox(this, 1); 00402 00403 fParListBox->Resize(160, 52); 00404 fParListBox->Move(140, 100); 00405 }
|
|
|
Definition at line 407 of file MINFScript.cxx. 00408 {
00409
00410 // clean up.
00411 delete fParListBox;
00412 delete fParTEntry;
00413 // Apparently adopted by fParTEntry so don't do: delete fParTBuf;
00414 // Apparently adopted by this so don't do: delete fEditLabel;
00415 // Apparently adopted by this so don't do: delete fListLabel;
00416 delete fAddPar;
00417 delete fDelPar;
00418 delete fRunMacro;
00419 delete fAbortMacro;
00420 }
|
|
|
Definition at line 423 of file MINFScript.cxx. References fMacroName, and fParListBox. Referenced by ProcessMessage(). 00424 {
00425
00426 // unmap dialog.
00427 fParListBox->UnmapWindow();
00428 this->UnmapWindow();
00429
00430 // making macro's name a zero string means that we have no
00431 // macro execution.
00432 strcpy(fMacroName, "");
00433 }
|
|
|
Definition at line 436 of file MINFScript.cxx. References fEntryID, fParListBox, and fParTBuf. Referenced by ProcessMessage(). 00437 {
00438 Char_t *str;
00439
00440 // check if we have already entered all arguments.
00441 if (fEntryID == fArgs) {
00442 #if WARNBOX
00443 new TGMsgBox(fClient->GetRoot(), this,
00444 "Add Parameter", "You can't add more parameters!",
00445 kMBIconStop);
00446 #endif
00447 return;
00448 }
00449
00450 // get text from edit box.
00451 str = (Char_t *) fParTBuf->GetString();
00452
00453 // add only if we have some text.
00454 if (fParTBuf->GetTextLength()) {
00455 fParListBox->AddEntry(str, fEntryID++);
00456
00457 // update.
00458 fParListBox->MapSubwindows();
00459 fParListBox->Layout();
00460 }
00461 }
|
|
|
Definition at line 464 of file MINFScript.cxx. References fEntryID, and fParListBox. Referenced by ProcessMessage(). 00465 {
00466 TGTextLBEntry *entry;
00467 TGString *str;
00468 Int_t item;
00469
00470 // item we want to delete.
00471 item = fParListBox->GetSelected();
00472
00473 if (item >= 0) {
00474
00475 // delete item.
00476 fParListBox->RemoveEntry(item);
00477
00478 // move all other items one step up.
00479 for (Int_t i=item; i < fEntryID - 1; i++) {
00480
00481 // find next item, and get the string.
00482 fParListBox->Select(i+1, kTRUE);
00483 entry = (TGTextLBEntry *) fParListBox->GetSelectedEntry();
00484 str = (TGString *) entry->GetText();
00485
00486 // insert it one step up.
00487 fParListBox->InsertEntry(str->GetString(), i, i-1);
00488
00489 // delete it from its original position.
00490 fParListBox->RemoveEntry(fParListBox->GetSelected());
00491 }
00492
00493 // one item minus.
00494 fEntryID--;
00495 }
00496
00497 // update.
00498 fParListBox->MapSubwindows();
00499 fParListBox->Layout();
00500 }
|
|
|
Definition at line 503 of file MINFScript.cxx. References fParListBox. Referenced by MINFScript::RunScript(). 00504 {
00505 // pop up the dialog.
00506 fParListBox->MapSubwindows();
00507 fParListBox->MapWindow();
00508 fParListBox->Layout();
00509
00510 MapSubwindows();
00511 MapWindow();
00512 fClient->WaitForUnmap(this);
00513 }
|
|
||||||||||||||||
|
Definition at line 516 of file MINFScript.cxx. References AbortMacro(), AddParameter(), DelParameter(), and RunMacro(). 00517 {
00518
00519 // Process messages coming from widgets associated with the dialog.
00520 switch (GET_MSG(msg)) {
00521
00522 case kC_COMMAND:
00523
00524 switch (GET_SUBMSG(msg)) {
00525
00526 case kCM_BUTTON:
00527
00528 switch(parm) {
00529 case 1:
00530 AddParameter();
00531 break;
00532 case 2:
00533 DelParameter();
00534 break;
00535 case 3:
00536 RunMacro();
00537 break;
00538 case 4:
00539 AbortMacro();
00540 break;
00541
00542 default:
00543 break;
00544 }
00545
00546 default:
00547 break;
00548 }
00549
00550 default:
00551 break;
00552 }
00553
00554 return kTRUE;
00555 }
|
|
|
Definition at line 558 of file MINFScript.cxx. References fEntryID, fMacroName, and fParListBox. Referenced by ProcessMessage(). 00559 {
00560
00561 // check if we have enough arguments to run the macro.
00562 if (fEntryID < fReqArgs) {
00563 #if WARNBOX
00564 new TGMsgBox(fClient->GetRoot(), this,
00565 "Run Macro", "Macro needs more parameters!",
00566 kMBIconStop);
00567 #endif
00568 return;
00569 }
00570
00571 // this routine parses the fParListBox, retrieves our
00572 // parameters tries to run the macro.
00573 TGTextLBEntry *entry;
00574 TGString *str;
00575
00576 strcat(fMacroName, "(");
00577
00578 for (Int_t i=0; i < fEntryID; i++) {
00579 fParListBox->Select(i, kTRUE);
00580 entry = (TGTextLBEntry *) fParListBox->GetSelectedEntry();
00581 str = (TGString *) entry->GetText();
00582
00583 strcat(fMacroName, str->GetString());
00584
00585 if (i+1 != fEntryID) strcat(fMacroName, ", ");
00586 }
00587
00588 // close statement.
00589 strcat(fMacroName, ")");
00590
00591 // unmap dialog.
00592 fParListBox->UnmapWindow();
00593 this->UnmapWindow();
00594
00595 // debug.
00596 cout << "Attempt to run: " << fMacroName << endl;
00597 }
|
|
|
Definition at line 94 of file MINFScript.h. References fArgs. Referenced by MINFScript::ParseMacro(). 00094 { fArgs = args; }
|
|
|
Definition at line 92 of file MINFScript.h. References fMacroName. Referenced by MINFScript::RunScript(). 00092 { fMacroName = name; }
|
|
|
Definition at line 96 of file MINFScript.h. References fReqArgs. Referenced by MINFScript::ParseMacro(). 00096 { fReqArgs = reqargs; }
|
|
|
Definition at line 111 of file MINFScript.h. Referenced by AddParmDlg(). |
|
|
Definition at line 108 of file MINFScript.h. Referenced by AddParmDlg(). |
|
|
Definition at line 115 of file MINFScript.h. Referenced by SetArgs(). |
|
|
Definition at line 109 of file MINFScript.h. Referenced by AddParmDlg(). |
|
|
Definition at line 105 of file MINFScript.h. Referenced by AddParmDlg(). |
|
|
macro name with parameters
Definition at line 114 of file MINFScript.h. Referenced by AddParameter(), DelParameter(), and RunMacro(). |
|
|
Definition at line 106 of file MINFScript.h. Referenced by AddParmDlg(). |
|
|
Definition at line 113 of file MINFScript.h. Referenced by AbortMacro(), RunMacro(), and SetMacroName(). |
|
|
Definition at line 100 of file MINFScript.h. Referenced by AbortMacro(), AddParameter(), AddParmDlg(), DelParameter(), PopUpParmDialog(), and RunMacro(). |
|
|
Definition at line 102 of file MINFScript.h. Referenced by AddParameter(), and AddParmDlg(). |
|
|
Definition at line 101 of file MINFScript.h. Referenced by AddParmDlg(). |
|
|
Definition at line 116 of file MINFScript.h. Referenced by SetReqArgs(). |
|
|
Definition at line 110 of file MINFScript.h. Referenced by AddParmDlg(). |
1.3.9.1