Changeset 2207 for trunk/MagicSoft/Mars/mmain/MStatusDisplay.cc
- Timestamp:
- 06/23/03 11:19:04 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mmain/MStatusDisplay.cc
r2194 r2207 340 340 void MStatusDisplay::SetLogStream(MLog *log, Bool_t enable) 341 341 { 342 if (gROOT->IsBatch()) 343 return; 344 342 345 if (log && fLogBox==NULL) 343 346 { … … 455 458 void MStatusDisplay::SetStatusLine1(const char *txt) 456 459 { 460 if (gROOT->IsBatch()) 461 return; 457 462 fStatusBar->SetText(txt, 0); 458 463 gClient->ProcessEventsFor(fStatusBar); … … 465 470 void MStatusDisplay::SetStatusLine2(const char *txt) 466 471 { 472 if (gROOT->IsBatch()) 473 return; 467 474 fStatusBar->SetText(txt, 1); 468 475 gClient->ProcessEventsFor(fStatusBar); … … 491 498 // 492 499 MStatusDisplay::MStatusDisplay(Long_t t) 493 : TGMainFrame(gClient ->GetRoot(), 1, 1), fTimer(this, t, kTRUE), fStatus(kLoopNone), fLog(&gLog), fLogIdx(-1), fLogTimer(this, 250, kTRUE), fLogBox(NULL), fIsLocked(0)500 : TGMainFrame(gClient ? gClient->GetRoot() : NULL, 1, 1), fTimer(this, t, kTRUE), fStatus(kLoopNone), fLog(&gLog), fLogIdx(-1), fLogTimer(this, 250, kTRUE), fLogBox(NULL), fIsLocked(0) 494 501 { 495 502 gROOT->GetListOfSpecials()->Add(this); 496 gROOT->GetListOfCleanups()->Add(this);497 503 498 504 fFont = gVirtualX->LoadQueryFont("7x13bold"); 505 506 fBatch.SetOwner(); 499 507 500 508 // … … 521 529 // Add Widgets (from top to bottom) 522 530 // 523 AddMenuBar(); 524 AddTabs(); 525 AddProgressBar(); 526 AddStatusBar(); 531 if (gClient) // BATCH MODE 532 { 533 AddMenuBar(); 534 AddTabs(); 535 AddProgressBar(); 536 AddStatusBar(); 537 } 527 538 528 539 // … … 547 558 MStatusDisplay::~MStatusDisplay() 548 559 { 560 gROOT->GetListOfSpecials()->Remove(this); 561 549 562 SetLogStream(NULL); 550 563 … … 553 566 if (fFont) 554 567 gVirtualX->DeleteFont(fFont); 555 556 gROOT->GetListOfSpecials()->Remove(this); 557 gROOT->GetListOfCleanups()->Remove(this); 558 } 568 } 559 569 560 570 // -------------------------------------------------------------------------- … … 594 604 TCanvas *MStatusDisplay::GetCanvas(int i) const 595 605 { 606 if (gROOT->IsBatch()) 607 return (TCanvas*)fBatch.At(i-1); 608 596 609 if (i<0 || i>=fTab->GetNumberOfTabs()) 597 610 { … … 656 669 TCanvas &MStatusDisplay::AddTab(const char *name) 657 670 { 671 if (gROOT->IsBatch()) 672 { 673 TCanvas *c = new TCanvas(name, name); 674 fBatch.Add(c); 675 return *c; 676 } 677 658 678 // Add new tab 659 679 TGCompositeFrame *f = fTab->AddTab(name); 660 680 661 // create root emb edded canvas and add it to the tab681 // create root emb 0edded canvas and add it to the tab 662 682 TRootEmbeddedCanvas *ec = new TRootEmbeddedCanvas(name, f, f->GetWidth(), f->GetHeight(), 0); 663 683 f->AddFrame(ec, fLayCanvas); … … 676 696 // layout and map new tab 677 697 //#if ROOT_VERSION_CODE < ROOT_VERSION(3,03,00) 698 // MapSubwindows(); 699 // Layout(); 700 //#else 701 Layout(); 678 702 MapSubwindows(); 679 703 Layout(); 680 //#else681 // Layout();682 // MapSubwindows();683 704 //#endif 684 705 … … 707 728 return; 708 729 709 c->Modified(); 710 c->Update(); 711 c->Paint(); 730 // Code taken from TCanvas::Update() and TCanvas::Paint 731 c->FeedbackMode(kFALSE); // Goto double buffer mode 732 c->Paint(); // Repaint all pad's 733 c->Flush(); // Copy all pad pixmaps to the screen 734 //c->SetCursor(kCross); 735 736 // Old version 737 //c->Modified(); 738 //c->Update(); 739 //c->Paint(); 712 740 } 713 741 … … 803 831 Bool_t MStatusDisplay::HasCanvas(const TCanvas *c) const 804 832 { 833 if (gROOT->IsBatch()) 834 return fBatch.FindObject(c); 835 805 836 for (int i=1; i<fTab->GetNumberOfTabs(); i++) 806 837 if (c==GetCanvas(i)) … … 829 860 case kLoopStop: 830 861 case kFileExit: 831 if (id==kFileExit && !fIsLocked)862 if (id==kFileExit) 832 863 delete this; 833 864 fStatus = (Status_t)id; … … 1154 1185 void MStatusDisplay::SetNoContextMenu(Bool_t flag) 1155 1186 { 1156 if (fIsLocked>1 )1187 if (fIsLocked>1 || gROOT->IsBatch()) 1157 1188 return; 1158 1189 … … 1173 1204 Bool_t MStatusDisplay::HandleTimer(TTimer *timer) 1174 1205 { 1206 if (gROOT->IsBatch()) 1207 return kTRUE; 1208 1175 1209 const Int_t c = fTab->GetCurrent(); 1176 1210 … … 1302 1336 } 1303 1337 1304 if ( num>=fTab->GetNumberOfTabs())1338 if (!gROOT->IsBatch() && num>=fTab->GetNumberOfTabs()) 1305 1339 { 1306 1340 *fLog << warn << "MStatusDisplay::Write: Tab doesn't exist... skipped." << endl; 1307 1341 return 0; 1308 1342 } 1343 if (gROOT->IsBatch() && num>fBatch.GetSize()) 1344 { 1345 *fLog << warn << "MStatusDisplay::Write: Tab doesn't exist... skipped." << endl; 1346 return 0; 1347 } 1309 1348 1310 1349 TObjArray list; 1311 1350 1312 const Int_t from = num<0 ? 1 : num; 1313 const Int_t to = num<0 ? fTab->GetNumberOfTabs() : num+1; 1351 const Int_t max = gROOT->IsBatch() ? fBatch.GetSize()+1 : fTab->GetNumberOfTabs(); 1352 const Int_t from = num<0 ? 1 : num; 1353 const Int_t to = num<0 ? max : num+1; 1314 1354 1315 1355 TCanvas *c; … … 1406 1446 Bool_t MStatusDisplay::CheckTabForCanvas(int num) const 1407 1447 { 1448 if (gROOT->IsBatch()) 1449 return num>0 && num<=fBatch.GetSize() || num<0; 1450 1408 1451 if (num>=fTab->GetNumberOfTabs()) 1409 1452 { … … 1530 1573 // Maintain tab numbers 1531 1574 // 1532 const Int_t from = num<0 ? 1 : num; 1533 const Int_t to = num<0 ? fTab->GetNumberOfTabs() : num+1; 1575 const Int_t max = gROOT->IsBatch() ? fBatch.GetSize()+1 : fTab->GetNumberOfTabs(); 1576 const Int_t from = num<0 ? 1 : num; 1577 const Int_t to = num<0 ? max : num+1; 1534 1578 1535 1579 for (int i=from; i<to; i++) … … 1572 1616 CanvasSetFillColor(*n, kWhite); 1573 1617 l.Add(n); 1574 1575 1618 // 1576 1619 // Paint canvas into root file … … 1578 1621 if (num<0) 1579 1622 *fLog << inf << " - "; 1580 *fLog << inf << "Writing Tab #" << i << ": " << c->GetName() << " (" << n<< ") ";1623 *fLog << inf << "Writing Tab #" << i << ": " << c->GetName() << " (" << c << ") "; 1581 1624 if (num>0) 1582 1625 *fLog << "to " << name; … … 1614 1657 1615 1658 gPad = NULL; // Important! 1616 1617 1659 l.Delete(); 1618 1660 … … 1621 1663 1622 1664 gVirtualPS = psave; 1623 padsav->cd(); 1665 if (padsav) 1666 padsav->cd(); 1624 1667 1625 1668 *fLog << inf << "done." << endl; … … 1632 1675 Bool_t MStatusDisplay::SaveAsGIF(Int_t num, TString name) 1633 1676 { 1677 if (gROOT->IsBatch()) 1678 { 1679 *fLog << warn << "Sorry, writing gif-files is not available in batch mode." << endl; 1680 return 0; 1681 } 1634 1682 SetStatusLine1("Writing GIF file..."); 1635 1683 SetStatusLine2("");
Note:
See TracChangeset
for help on using the changeset viewer.