Logo ROOT   6.12/07
Reference Guide
TEveBrowser.cxx
Go to the documentation of this file.
1 // @(#)root/eve:$Id$
2 // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #include "TEveBrowser.h"
13 
14 #include "TEveUtil.h"
15 #include "TEveElement.h"
16 #include "TEveManager.h"
17 #include "TEveSelection.h"
18 #include "TEveGedEditor.h"
19 #include "TEveWindow.h"
20 #include "TEveWindowManager.h"
21 
22 #include "TGFileBrowser.h"
23 #include "TBrowser.h"
24 
25 #include <Riostream.h>
26 
27 #include "TClass.h"
28 #include "TROOT.h"
29 #include "TStyle.h"
30 #include "TSystem.h"
31 #include "TRint.h"
32 #include "TVirtualX.h"
33 #include "TEnv.h"
34 
35 #include "TApplication.h"
36 #include "TFile.h"
37 #include "TClassMenuItem.h"
38 
39 #include "TColor.h"
40 
41 #include "TGCanvas.h"
42 #include "TGSplitter.h"
43 #include "TGStatusBar.h"
44 #include "TGMenu.h"
45 #include "TGPicture.h"
46 #include "TGToolBar.h"
47 #include "TGLabel.h"
48 #include "TGXYLayout.h"
49 #include "TGNumberEntry.h"
50 #include <KeySymbols.h>
51 
52 #include "TGLSAViewer.h"
53 #include "TGLSAFrame.h"
54 #include "TGTab.h"
55 
56 #include "TGeoVolume.h"
57 #include "TGeoNode.h"
58 
59 /** \class TEveListTreeItem
60 \ingroup TEve
61 Special list-tree-item for Eve.
62 
63 Most state is picked directly from TEveElement, no need to store it
64 locally nor to manage its consistency.
65 
66 Handles also selected/highlighted colors and, in the future, drag-n-drop.
67 */
68 
70 
71 ////////////////////////////////////////////////////////////////////////////////
72 /// Warn about access to function members that should never be called.
73 /// TGListTree calls them in cases that are not used by Eve.
74 
75 void TEveListTreeItem::NotSupported(const char* func) const
76 {
77  Warning(Form("TEveListTreeItem::%s()", func), "not supported.");
78 }
79 
80 ////////////////////////////////////////////////////////////////////////////////
81 /// Return highlight color corresponding to current state of TEveElement.
82 
84 {
85  switch (fElement->GetSelectedLevel())
86  {
87  case 1: return TColor::Number2Pixel(kBlue - 2);
88  case 2: return TColor::Number2Pixel(kBlue - 6);
89  case 3: return TColor::Number2Pixel(kCyan - 2);
90  case 4: return TColor::Number2Pixel(kCyan - 6);
91  }
93 }
94 
95 ////////////////////////////////////////////////////////////////////////////////
96 /// Item's check-box state has been toggled ... forward to element's
97 /// render-state.
98 
100 {
103 }
104 
105 /** \class TEveGListTreeEditorFrame
106 \ingroup TEve
107 Composite GUI frame for parallel display of a TGListTree and TEveGedEditor.
108 */
109 
111 
113 
114 ////////////////////////////////////////////////////////////////////////////////
115 /// Constructor.
116 
118  TGMainFrame (p ? p : gClient->GetRoot(), width, height),
119  fFrame (0),
120  fLTFrame (0),
121  fListTree (0),
122  fSplitter (0),
123  fEditor (0),
124  fCtxMenu (0),
125  fSignalsConnected (kFALSE)
126 {
128 
129  fFrame = new TGCompositeFrame(this, width, height, kVerticalFrame);
130 
131  // List-tree
132  fLTFrame = new TGCompositeFrame(fFrame, width, 3*height/7, kVerticalFrame);
142  (kLHintsNormal | kLHintsExpandX | kLHintsExpandY, 1, 1, 1, 1));
145 
146  // Splitter
149 
150  // Editor
152  fFrame->SetEditable();
153  fEditor = (TEveGedEditor*) gROOT->GetClass(fgEditorClass)->New();
158  {
159  TGFrameElement *el = 0;
160  TIter next(fFrame->GetList());
161  while ((el = (TGFrameElement *) next())) {
162  if (el->fFrame == fEditor)
163  if (el->fLayout) {
165  el->fLayout->SetPadLeft(0); el->fLayout->SetPadRight(1);
166  el->fLayout->SetPadTop(2); el->fLayout->SetPadBottom(1);
167  break;
168  }
169  }
170  }
172 
174 
175  fCtxMenu = new TContextMenu("", "");
176 
177  Layout();
178  MapSubwindows();
179  MapWindow();
180 }
181 
182 ////////////////////////////////////////////////////////////////////////////////
183 /// Destructor.
184 
186 {
188 
189  delete fCtxMenu;
190 
191  // Should un-register editor, all items and list-tree from gEve ... eventually.
192 
193  delete fEditor;
194  delete fSplitter;
195  delete fListTree;
196  delete fLTCanvas;
197  delete fLTFrame;
198  delete fFrame;
199 }
200 
201 ////////////////////////////////////////////////////////////////////////////////
202 /// Set GED editor class.
203 
205 {
206  fgEditorClass = edclass;
207 }
208 
209 ////////////////////////////////////////////////////////////////////////////////
210 /// Connect list-tree signals.
211 
213 {
214  fListTree->Connect("MouseOver(TGListTreeItem*, UInt_t)", "TEveGListTreeEditorFrame",
215  this, "ItemBelowMouse(TGListTreeItem*, UInt_t)");
216  fListTree->Connect("Clicked(TGListTreeItem*, Int_t, UInt_t, Int_t, Int_t)", "TEveGListTreeEditorFrame",
217  this, "ItemClicked(TGListTreeItem*, Int_t, UInt_t, Int_t, Int_t)");
218  fListTree->Connect("DoubleClicked(TGListTreeItem*, Int_t)", "TEveGListTreeEditorFrame",
219  this, "ItemDblClicked(TGListTreeItem*, Int_t)");
220  fListTree->Connect("KeyPressed(TGListTreeItem*, ULong_t, ULong_t)", "TEveGListTreeEditorFrame",
221  this, "ItemKeyPress(TGListTreeItem*, UInt_t, UInt_t)");
222 
224 }
225 
226 ////////////////////////////////////////////////////////////////////////////////
227 /// Disconnect list-tree signals.
228 
230 {
231  if (!fSignalsConnected) return;
232 
233  fListTree->Disconnect("MouseOver(TGListTreeItem*, UInt_t)",
234  this, "ItemBelowMouse(TGListTreeItem*, UInt_t)");
235  fListTree->Disconnect("Clicked(TGListTreeItem*, Int_t, UInt_t, Int_t, Int_t)",
236  this, "ItemClicked(TGListTreeItem*, Int_t, UInt_t, Int_t, Int_t)");
237  fListTree->Disconnect("DoubleClicked(TGListTreeItem*, Int_t)",
238  this, "ItemDblClicked(TGListTreeItem*, Int_t)");
239  fListTree->Disconnect("KeyPressed(TGListTreeItem*, ULong_t, ULong_t)",
240  this, "ItemKeyPress(TGListTreeItem*, UInt_t, UInt_t)");
241 
243 }
244 
245 ////////////////////////////////////////////////////////////////////////////////
246 /// Reconfigure to horizontal layout, list-tree and editor side by side.
247 
249 {
250  UnmapWindow();
251 
255 
256  TGFrameElement *el = 0;
257  TIter next(fFrame->GetList());
258  while ((el = (TGFrameElement *) next()))
259  {
260  if (el->fFrame == fSplitter)
261  {
262  // This is needed so that splitter window gets destroyed on server.
264  delete fSplitter;
265  el->fFrame = fSplitter = new TGVSplitter(fFrame);
267  el->fLayout->SetPadLeft(2); el->fLayout->SetPadRight (2);
268  el->fLayout->SetPadTop (1); el->fLayout->SetPadBottom(1);
269  }
270  else if (el->fFrame == fEditor)
271  {
275  }
276  }
277 
278  fEditor->Resize(fEditor->GetWidth() / 2 - 1, fEditor->GetHeight());
280 
281  Layout();
282  MapSubwindows();
283  MapWindow();
284 }
285 
286 ////////////////////////////////////////////////////////////////////////////////
287 /// Reconfigure to vertical layout, list-tree above the editor.
288 
290 {
291  UnmapWindow();
292 
296 
297  TGFrameElement *el = 0;
298  TIter next(fFrame->GetList());
299  while ((el = (TGFrameElement *) next()))
300  {
301  if (el->fFrame == fSplitter)
302  {
303  // This is needed so that splitter window gets destroyed on server.
305  delete fSplitter;
306  el->fFrame = fSplitter = new TGHSplitter(fFrame);
308  el->fLayout->SetPadLeft(2); el->fLayout->SetPadRight (2);
309  el->fLayout->SetPadTop (1); el->fLayout->SetPadBottom(1);
310  }
311  else if (el->fFrame == fEditor)
312  {
316  }
317  }
318 
319  fEditor->Resize(fEditor->GetWidth(), fEditor->GetHeight() / 2 - 1);
321 
322  Layout();
323  MapSubwindows();
324  MapWindow();
325 }
326 
327 ////////////////////////////////////////////////////////////////////////////////
328 /// Different item is below mouse.
329 
331 {
332  TEveElement* el = entry ? (TEveElement*) entry->GetUserData() : 0;
334 }
335 
336 ////////////////////////////////////////////////////////////////////////////////
337 /// Item has been clicked, based on mouse button do:
338 /// - M1 - select, show in editor;
339 /// - M2 - paste (call gEve->ElementPaste();
340 /// - M3 - popup context menu.
341 
343 {
344  //printf("ItemClicked item %s List %d btn=%d, x=%d, y=%d\n",
345  // item->GetText(),fDisplayFrame->GetList()->GetEntries(), btn, x, y);
346 
347  static const TEveException eh("TEveGListTreeEditorFrame::ItemClicked ");
348 
349  TEveElement* el = (TEveElement*) item->GetUserData();
350  if (el == 0) return;
351  TObject* obj = el->GetObject(eh);
352 
353  switch (btn)
354  {
355  case 1:
357  break;
358 
359  case 2:
360  if (gEve->ElementPaste(el))
361  gEve->Redraw3D();
362  break;
363 
364  case 3:
365  // If control pressed, show menu for render-element itself.
366  // event->fState & kKeyControlMask
367  // ??? how do i get current event?
368  // !!!!! Have this now ... fix.
369  if (obj) fCtxMenu->Popup(x, y, obj);
370  break;
371 
372  default:
373  break;
374  }
375 }
376 
377 ////////////////////////////////////////////////////////////////////////////////
378 /// Item has been double-clicked, potentially expand the children.
379 
381 {
382  static const TEveException eh("TEveGListTreeEditorFrame::ItemDblClicked ");
383 
384  if (btn != 1) return;
385 
386  TEveElement* el = (TEveElement*) item->GetUserData();
387  if (el == 0) return;
388 
389  el->ExpandIntoListTree(fListTree, item);
390 
391  TObject* obj = el->GetObject(eh);
392  if (obj)
393  {
394  // Browse geonodes.
395  if (obj->IsA()->InheritsFrom(TGeoNode::Class()))
396  {
397  TGeoNode* n = dynamic_cast<TGeoNode*>(obj);
398  if (item->GetFirstChild() == 0 && n->GetNdaughters())
399  {
400  fListTree->DeleteChildren(item);
401  for (Int_t i=0; i< n->GetNdaughters(); i++)
402  {
403  TString title;
404  title.Form("%d : %s[%d]", i,
405  n->GetDaughter(i)->GetVolume()->GetName(),
406  n->GetDaughter(i)->GetNdaughters());
407 
408  TGListTreeItem* child = fListTree->AddItem(item, title.Data());
409  child->SetUserData(n->GetDaughter(i));
410  }
411  }
412  }
413  }
414 }
415 
416 ////////////////////////////////////////////////////////////////////////////////
417 /// A key has been pressed for an item.
418 ///
419 /// Only <Delete>, <Enter> and <Return> keys are handled here,
420 /// otherwise the control is passed back to TGListTree.
421 
423 {
424  static const TEveException eh("TEveGListTreeEditorFrame::ItemKeyPress ");
425 
426  entry = fListTree->GetCurrent();
427  if (entry == 0) return;
428 
429  TEveElement* el = (TEveElement*) entry->GetUserData();
430 
431  fListTree->SetEventHandled(); // Reset back to false in default case.
432 
433  switch (keysym)
434  {
435  case kKey_Delete:
436  {
437  if (entry->GetParent())
438  {
439  if (el->GetDenyDestroy() > 0 && el->GetNItems() == 1)
440  throw(eh + "DestroyDenied set for this item.");
441 
442  TEveElement* parent = (TEveElement*) entry->GetParent()->GetUserData();
443 
444  if (parent)
445  {
446  gEve->RemoveElement(el, parent);
447  gEve->Redraw3D();
448  }
449  }
450  else
451  {
452  if (el->GetDenyDestroy() > 0)
453  throw(eh + "DestroyDenied set for this top-level item.");
454  gEve->RemoveFromListTree(el, fListTree, entry);
455  gEve->Redraw3D();
456  }
457  break;
458  }
459 
460  case kKey_Enter:
461  case kKey_Return:
462  {
464  break;
465  }
466 
467  default:
468  {
470  break;
471  }
472  }
473 }
474 
475 
476 /** \class TEveBrowser
477 \ingroup TEve
478 Specialization of TRootBrowser for Eve.
479 */
480 
482 
483 ////////////////////////////////////////////////////////////////////////////////
484 /// Add "Export to CINT" into context-menu for class cl.
485 
487 {
488  TList* l = cl->GetMenuList();
490  "Export to CINT", "ExportToCINT", this, "const char*,TObject*", 1);
491 
492  l->AddFirst(n);
493 }
494 
495 ////////////////////////////////////////////////////////////////////////////////
496 /// Calculate position of a widget for reparenting into parent.
497 
499 {
500  UInt_t w, h;
501  Window_t childdum;
502  gVirtualX->GetWindowSize(parent->GetId(), x, y, w, h);
503  gVirtualX->TranslateCoordinates(parent->GetId(),
504  gClient->GetDefaultRoot()->GetId(),
505  0, 0, x, y, childdum);
506 }
507 
508 namespace
509 {
511  kNewMainFrameSlot, kNewTabSlot,
512  kNewViewer, kNewScene,
513  kNewBrowser, kNewCanvas, kNewCanvasExt, kNewTextEditor, kNewHtmlBrowser,
514  kSel_PS_Ignore, kSel_PS_Element, kSel_PS_Projectable, kSel_PS_Compound,
515  kSel_PS_PableCompound, kSel_PS_Master, kSel_PS_END,
516  kHil_PS_Ignore, kHil_PS_Element, kHil_PS_Projectable, kHil_PS_Compound,
517  kHil_PS_PableCompound, kHil_PS_Master, kHil_PS_END,
518  kVerticalBrowser,
519  kWinDecorNormal, kWinDecorHide, kWinDecorTitleBar, kWinDecorMiniBar
520 };
521 
522 }
523 
524 ////////////////////////////////////////////////////////////////////////////////
525 /// Constructor.
526 
528  TRootBrowser(0, "Eve Main Window", w, h, "", kFALSE),
529  fFileBrowser(0),
530  fEvePopup (0),
531  fSelPopup (0),
532  fHilPopup (0)
533 {
534  // Construct Eve menu.
535 
536  fEvePopup = new TGPopupMenu(gClient->GetRoot());
537  fEvePopup->AddEntry("New &MainFrame Slot", kNewMainFrameSlot);
538  fEvePopup->AddEntry("New &Tab Slot", kNewTabSlot);
540  fEvePopup->AddEntry("New &Viewer", kNewViewer);
541  fEvePopup->AddEntry("New &Scene", kNewScene);
543  fEvePopup->AddEntry("New &Browser", kNewBrowser);
544  fEvePopup->AddEntry("New &Canvas", kNewCanvas);
545  fEvePopup->AddEntry("New Canvas Ext", kNewCanvasExt);
546  fEvePopup->AddEntry("New Text &Editor", kNewTextEditor);
547  // fEvePopup->AddEntry("New HTML Browser", kNewHtmlBrowser);
549 
550  {
551  fSelPopup = new TGPopupMenu(gClient->GetRoot());
552  fSelPopup->AddEntry("Ignore", kSel_PS_Ignore);
553  fSelPopup->AddEntry("Element", kSel_PS_Element);
554  fSelPopup->AddEntry("Projectable", kSel_PS_Projectable);
555  fSelPopup->AddEntry("Compound", kSel_PS_Compound);
556  fSelPopup->AddEntry("Projectable and Compound",
557  kSel_PS_PableCompound);
558  fSelPopup->AddEntry("Master", kSel_PS_Master);
559  fSelPopup->RCheckEntry(kSel_PS_Ignore + gEve->GetSelection()->GetPickToSelect(),
560  kSel_PS_Ignore, kSel_PS_END - 1);
561  fEvePopup->AddPopup("Selection", fSelPopup);
562  }
563  {
564  fHilPopup = new TGPopupMenu(gClient->GetRoot());
565  fHilPopup->AddEntry("Ignore", kHil_PS_Ignore);
566  fHilPopup->AddEntry("Element", kHil_PS_Element);
567  fHilPopup->AddEntry("Projectable", kHil_PS_Projectable);
568  fHilPopup->AddEntry("Compound", kHil_PS_Compound);
569  fHilPopup->AddEntry("Projectable and Compound",
570  kHil_PS_PableCompound);
571  fHilPopup->AddEntry("Master", kHil_PS_Master);
572  fHilPopup->RCheckEntry(kHil_PS_Ignore + gEve->GetHighlight()->GetPickToSelect(),
573  kHil_PS_Ignore, kHil_PS_END - 1);
574  fEvePopup->AddPopup("Highlight", fHilPopup);
575  }
576 
578  fEvePopup->AddEntry("Vertical browser", kVerticalBrowser);
579  fEvePopup->CheckEntry(kVerticalBrowser);
580  {
581  TGPopupMenu *wd = new TGPopupMenu(gClient->GetRoot());
582  wd->AddEntry("Normal", kWinDecorNormal);
583  wd->AddEntry("Hide", kWinDecorHide);
584  wd->AddEntry("Title bars", kWinDecorTitleBar);
585  wd->AddEntry("Mini bars", kWinDecorMiniBar);
586  fEvePopup->AddPopup("Window decorations", wd);
587  }
588 
589  fEvePopup->Connect("Activated(Int_t)", "TEveBrowser",
590  this, "EveMenu(Int_t)");
591 
592  fMenuBar->AddPopup("&Eve", fEvePopup, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0));
593 
597 
598  // Rename "Close Window" to "Close Eve"
599  fMenuFile->GetEntry(kCloseWindow)->GetLabel()->SetString("Close Eve");
600 }
601 
602 ////////////////////////////////////////////////////////////////////////////////
603 /// Handle events from Eve menu.
604 
606 {
607  switch (id)
608  {
609  case kNewMainFrameSlot: {
611  gEve->GetWindowManager()->SelectWindow(ew_slot);
612  break;
613  }
614  case kNewTabSlot: {
616  gEve->GetWindowManager()->SelectWindow(ew_slot);
617  break;
618  }
619  case kNewViewer: {
620  gEve->SpawnNewViewer("Viewer Pepe");
621  break;
622  }
623  case kNewScene: {
624  gEve->SpawnNewScene("Scena Mica");
625  break;
626  }
627  case kNewBrowser: {
628  gROOT->ProcessLineFast("new TBrowser");
629  break;
630  }
631  case kNewCanvas: {
632  StartEmbedding(1);
633  gROOT->ProcessLineFast("new TCanvas");
634  StopEmbedding();
635  SetTabTitle("Canvas", 1);
636  break;
637  }
638  case kNewCanvasExt: {
639  gROOT->ProcessLineFast("new TCanvas");
640  break;
641  }
642  case kNewTextEditor: {
643  StartEmbedding(1);
644  gROOT->ProcessLineFast(Form("new TGTextEditor((const char *)0, (const TGWindow *)0x%lx)", (ULong_t)gClient->GetRoot()));
645  StopEmbedding();
646  SetTabTitle("Editor", 1);
647  break;
648  }
649  case kNewHtmlBrowser: {
650  gSystem->Load("libGuiHtml");
651  if (gSystem->Load("libRHtml") >= 0)
652  {
653  StartEmbedding(1);
654  gROOT->ProcessLine(Form("new TGHtmlBrowser(\"http://root.cern.ch/root/html/ClassIndex.html\", \
655  (const TGWindow *)0x%lx)", (ULong_t)gClient->GetRoot()));
656  StopEmbedding();
657  SetTabTitle("HTML", 1);
658  }
659  break;
660  }
661  case kSel_PS_Ignore:
662  case kSel_PS_Element:
663  case kSel_PS_Projectable:
664  case kSel_PS_Compound:
665  case kSel_PS_PableCompound:
666  case kSel_PS_Master: {
667  gEve->GetSelection()->SetPickToSelect(id - kSel_PS_Ignore);
668  fSelPopup->RCheckEntry(kSel_PS_Ignore + gEve->GetSelection()->GetPickToSelect(),
669  kSel_PS_Ignore, kSel_PS_END - 1);
670  break;
671  }
672  case kHil_PS_Ignore:
673  case kHil_PS_Element:
674  case kHil_PS_Projectable:
675  case kHil_PS_Compound:
676  case kHil_PS_PableCompound:
677  case kHil_PS_Master: {
678  gEve->GetHighlight()->SetPickToSelect(id - kHil_PS_Ignore);
679  fHilPopup->RCheckEntry(kHil_PS_Ignore + gEve->GetHighlight()->GetPickToSelect(),
680  kHil_PS_Ignore, kHil_PS_END - 1);
681  break;
682  }
683  case kVerticalBrowser: {
684  if (fEvePopup->IsEntryChecked(kVerticalBrowser)) {
686  fEvePopup->UnCheckEntry(kVerticalBrowser);
687  } else {
689  fEvePopup->CheckEntry(kVerticalBrowser);
690  }
691  break;
692  }
693  case kWinDecorNormal: {
695  break;
696  }
697  case kWinDecorHide: {
699  break;
700  }
701  case kWinDecorTitleBar: {
703  break;
704  }
705  case kWinDecorMiniBar: {
707  break;
708  }
709 
710  default: {
711  break;
712  }
713  }
714 }
715 
716 ////////////////////////////////////////////////////////////////////////////////
717 /// Initialize standard plugins.
718 
720 {
721  TString o(opt);
722 
723  // File Browser plugin ... we have to process it here.
724  if (o.Contains('F'))
725  {
726  StartEmbedding(0);
728  fb->BrowseObj(gROOT);
729  fb->Show();
730  fFileBrowser = fb;
731  StopEmbedding("Files");
732  o.ReplaceAll("F", ".");
733  }
734 
736 }
737 
738 ////////////////////////////////////////////////////////////////////////////////
739 /// Create a file-browser. Caller should provide Start/StopEmbedding() calls
740 /// and populate the new browser.
741 ///
742 /// If flag make_default is kTRUE, the default file-browser is set to the
743 /// newly created browser.
744 
746 {
747  TBrowserImp imp;
748  TBrowser *tb = new TBrowser("Pipi", "Strel", &imp);
749  TGFileBrowser *fb = new TGFileBrowser(gClient->GetRoot(), tb, 200, 500);
750  tb->SetBrowserImp((TBrowserImp *)this);
751  fb->SetBrowser(tb);
752  fb->SetNewBrowser(this);
753  gROOT->GetListOfBrowsers()->Remove(tb);
754  // This guy is never used and stays in list-of-cleanups after destruction.
755  // So let's just delete it now.
756  delete tb->GetContextMenu();
757 
758  if (make_default)
759  fFileBrowser = fb;
760 
761  return fb;
762 }
763 
764 ////////////////////////////////////////////////////////////////////////////////
765 /// Returns the default file-browser.
766 
768 {
769  return fFileBrowser;
770 }
771 
772 ////////////////////////////////////////////////////////////////////////////////
773 /// Set the default file browser.
774 
776 {
777  fFileBrowser = b;
778 }
779 
780 ////////////////////////////////////////////////////////////////////////////////
781 /// Override from TRootBrowser. We need to be more brutal as fBrowser is
782 /// not set in Eve case.
783 
785 {
786  delete this;
787 }
788 
789 ////////////////////////////////////////////////////////////////////////////////
790 /// Virtual from TRootBrowser. Need to intercept closing of Eve tabs.
791 
793 {
794  // Check if this is an Eve window and destroy accordingly.
796  if (pcf)
797  {
798  TGFrameElement *fe = (TGFrameElement *) pcf->GetList()->First();
799  if (fe)
800  {
801  TEveCompositeFrame *ecf = dynamic_cast<TEveCompositeFrame*>(fe->fFrame);
802  if (ecf)
803  {
805  return;
806  }
807  }
808  }
809 
810  // Fallback to standard tab destruction
812 }
813 
814 ////////////////////////////////////////////////////////////////////////////////
815 /// Virtual from TGMainFrame. Calls TEveManager::Terminate().
816 
818 {
820 }
821 
822 ////////////////////////////////////////////////////////////////////////////////
823 /// Hide the bottom tab (usually holding command-line widget).
824 
826 {
828  fV2->HideFrame(fH2);
829 }
830 
831 ////////////////////////////////////////////////////////////////////////////////
832 /// TRootBrowser keeps (somewhat unnecessarily) counters for number ob tabs
833 /// on each position. Eve bastardizes the right tab so we have to fix the counters
834 /// when a new window is added ... it doesn't seem to be needed when it is removed.
835 
837 {
840 }
void SetBrowserImp(TBrowserImp *i)
Definition: TBrowser.h:93
TContextMenu * fCtxMenu
Definition: TEveBrowser.h:98
virtual void HideFrame(TGFrame *f)
Hide sub frame.
Definition: TGFrame.cxx:1172
Describes one element of the context menu associated to a class The menu item may describe...
virtual void SetFrame(TGFrame *frame, Bool_t prev)=0
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:587
virtual void SetPadBottom(Int_t v)
Definition: TGLayout.h:97
virtual Pixel_t GetActiveColor() const
Return highlight color corresponding to current state of TEveElement.
Definition: TEveBrowser.cxx:83
virtual void SetCanvas(TGCanvas *canvas)
Definition: TGListTree.h:334
void ShowNormalEveDecorations()
Show eve decorations (title-bar or mini-bar) as specified for the contained window on all frames...
virtual void StartEmbedding(Int_t pos=kRight, Int_t subpos=-1)
Start embedding external frame in the tab "pos" and tab element "subpos".
virtual UInt_t GetOptions() const
Definition: TGFrame.h:244
virtual void * GetUserData() const =0
virtual void ReallyDelete()
Override from TRootBrowser.
virtual Bool_t IsChecked() const
Definition: TEveBrowser.h:68
virtual TGMenuEntry * GetEntry(Int_t id)
Find entry with specified id.
Definition: TGMenu.cxx:1887
TGCompositeFrame * GetTabContainer(Int_t tabIndex) const
Return container of tab with index tabIndex.
Definition: TGTab.cxx:563
virtual void Show()
Definition: TGFileBrowser.h:86
static TEveWindowSlot * CreateWindowInTab(TGTab *tab, TEveWindow *eve_parent=0)
Create a new tab in a given tab-widget and populate it with a default window-slot.
const char Option_t
Definition: RtypesCore.h:62
Specialization of TGedEditor for proper update propagation to TEveManager.
Definition: TEveGedEditor.h:26
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition: TString.h:638
TList * GetMenuList() const
Return the list of menu items associated with the class.
Definition: TClass.cxx:4162
virtual void UserPickedElement(TEveElement *el, Bool_t multi=kFALSE)
Called when user picks/clicks on an element.
TGHotString * GetLabel() const
Definition: TGMenu.h:101
UInt_t GetHeight() const
Definition: TGFrame.h:272
TH1 * h
Definition: legend2.C:5
void InitPlugins(Option_t *opt="")
Initialize default plugins.
TGPopupMenu * fSelPopup
Definition: TEveBrowser.h:140
void HideBottomTab()
Hide the bottom tab (usually holding command-line widget).
virtual void AddFirst(TObject *obj)
Add object at the beginning of the list.
Definition: TList.cxx:97
virtual Bool_t IsEntryChecked(Int_t id)
Return true if menu item is checked.
Definition: TGMenu.cxx:1835
virtual void SetContainer(TGFrame *f)
Definition: TGCanvas.h:232
void ItemKeyPress(TGListTreeItem *entry, UInt_t keysym, UInt_t mask)
A key has been pressed for an item.
virtual void UnCheckEntry(Int_t id)
Uncheck menu entry (i.e. remove check mark).
Definition: TGMenu.cxx:1797
#define gROOT
Definition: TROOT.h:402
Specialization of TRootBrowser for Eve.
Definition: TEveBrowser.h:129
virtual Bool_t SetRnrState(Bool_t rnr)
Set render state of this element and of its children to the same value.
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
Definition: TSystem.cxx:1829
void NotSupported(const char *func) const
Warn about access to function members that should never be called.
Definition: TEveBrowser.cxx:75
virtual void Associate(const TGWindow *w)
Definition: TGCanvas.h:99
Basic string class.
Definition: TString.h:125
#define gClient
Definition: TGClient.h:166
Description of TEveWindowSlot.
Definition: TEveWindow.h:301
TGFileBrowser * fFileBrowser
Definition: TEveBrowser.h:138
TGHorizontalFrame * fH2
Definition: TRootBrowser.h:71
Bool_t ElementPaste(TEveElement *element)
Paste has been called.
int Int_t
Definition: RtypesCore.h:41
Int_t DeleteChildren(TGListTreeItem *item)
Delete children of item from list.
bool Bool_t
Definition: RtypesCore.h:59
virtual void AddEntry(TGHotString *s, Int_t id, void *ud=0, const TGPicture *p=0, TGMenuEntry *before=0)
Add a menu entry.
Definition: TGMenu.cxx:987
void ReconfToHorizontal()
Reconfigure to horizontal layout, list-tree and editor side by side.
virtual void SetBrowser(TBrowser *b)
Definition: TBrowserImp.h:70
virtual Int_t GetNItems() const
Definition: TEveElement.h:222
void Redraw3D(Bool_t resetCameras=kFALSE, Bool_t dropLogicals=kFALSE)
Definition: TEveManager.h:168
Int_t GetPickToSelect() const
Definition: TEveSelection.h:64
void SetFileBrowser(TGFileBrowser *b)
Set the default file browser.
EEveMenu_e
UInt_t GetWidth() const
Definition: TGFrame.h:271
void RemoveFromListTree(TEveElement *element, TGListTree *lt, TGListTreeItem *lti)
Remove top-level element from list-tree with specified tree-item.
void SetPickToSelect(Int_t ps)
Definition: TEveSelection.h:65
virtual void AddSeparator(TGMenuEntry *before=0)
Add a menu separator to the menu.
Definition: TGMenu.cxx:1057
Handle_t GetId() const
Definition: TGObject.h:47
virtual void Layout()
Layout the elements of the composite frame.
Definition: TGFrame.cxx:1239
void SetAutoCheckBoxPic(Bool_t on)
Definition: TGListTree.h:367
static TString fgEditorClass
Definition: TEveBrowser.h:102
TEveWindow * GetEveWindow() const
Definition: TEveWindow.h:86
TGLayoutHints * fLayout
Definition: TGLayout.h:121
void DisconnectSignals()
Disconnect list-tree signals.
static TEveWindowSlot * CreateWindowMainFrame(TEveWindow *eve_parent=0)
Create a new main-frame and populate it with a default window-slot.
Definition: TEveWindow.cxx:977
Double_t x[n]
Definition: legend1.C:17
void HideAllEveDecorations()
Hide all eve decorations (title-bar and mini-bar) on all frames.
virtual void ElementChanged(Bool_t update_scenes=kTRUE, Bool_t redraw=kFALSE)
Call this after an element has been changed so that the state can be propagated around the framework...
ULong_t Pixel_t
Definition: GuiTypes.h:39
void Class()
Definition: Class.C:29
static void Terminate()
Properly terminate global TEveManager.
virtual void Toggle()
Item&#39;s check-box state has been toggled ...
Definition: TEveBrowser.cxx:99
virtual void SetUserData(void *, Bool_t=kFALSE)
Definition: TGListTree.h:94
TGPopupMenu * fEvePopup
Definition: TEveBrowser.h:139
TGHorizontalFrame * fTopMenuFrame
Definition: TRootBrowser.h:77
TGPopupMenu * fHilPopup
Definition: TEveBrowser.h:141
virtual void ReparentWindow(const TGWindow *p, Int_t x=0, Int_t y=0)
Reparent window, make p the new parent and position the window at position (x,y) in new parent...
Definition: TGFrame.h:249
TGCompositeFrame(const TGCompositeFrame &)
virtual void SetGlobal(Bool_t global)
Set editor global.
Definition: TGedEditor.cxx:271
TGFileBrowser * MakeFileBrowser(Bool_t make_default=kFALSE)
Create a file-browser.
TEveElement * fElement
Definition: TEveBrowser.h:36
virtual void Popup(Int_t x, Int_t y, TObject *obj, TVirtualPad *c=0, TVirtualPad *p=0)
Popup context menu at given location in canvas c and pad p for selected object.
void SetEventHandled(Bool_t eh=kTRUE)
Definition: TGListTree.h:437
TGCompositeFrame * fFrame
Definition: TEveBrowser.h:90
virtual TList * GetList() const
Definition: TGFrame.h:369
TGCompositeFrame * fLTFrame
Definition: TEveBrowser.h:91
TEveBrowser(const TEveBrowser &)
Abstract base-class for frame-slots that encompass EVE-windows (sub-classes of TEveWindow).
Definition: TEveWindow.h:39
virtual void ExpandIntoListTree(TGListTree *ltree, TGListTreeItem *parent)
Populates parent with elements.
void CalculateReparentXY(TGObject *parent, Int_t &x, Int_t &y)
Calculate position of a widget for reparenting into parent.
TGViewPort * GetViewPort() const
Definition: TGCanvas.h:227
TGVerticalFrame * fV2
Definition: TRootBrowser.h:73
virtual void CloseWindow()
Virtual from TGMainFrame. Calls TEveManager::Terminate().
A doubly linked list.
Definition: TList.h:44
void SetNewBrowser(TRootBrowser *b)
Definition: TGFileBrowser.h:90
void SanitizeTabCounts()
TRootBrowser keeps (somewhat unnecessarily) counters for number ob tabs on each position.
TGTab * fTabRight
Definition: TRootBrowser.h:63
virtual void BrowseObj(TObject *obj)
Browse object.
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:37
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot...
Definition: TQObject.cxx:867
virtual void SetPadRight(Int_t v)
Definition: TGLayout.h:99
virtual void DestroyWindowAndSlot()
Destroy eve-window and its frame-slot.
Definition: TEveWindow.cxx:867
TGListTreeItem * GetCurrent() const
Definition: TGListTree.h:398
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
Definition: TList.cxx:655
TGeoNode * GetDaughter(Int_t ind) const
Definition: TGeoNode.h:82
TEveGListTreeEditorFrame(const TEveGListTreeEditorFrame &)
R__EXTERN TSystem * gSystem
Definition: TSystem.h:540
TGSplitter * fSplitter
Definition: TEveBrowser.h:95
void SetUserControl(Bool_t ctrl=kTRUE)
Definition: TGListTree.h:435
void SetTabTitle(const char *title, Int_t pos=kRight, Int_t subpos=-1)
Set text "title" of Tab "subpos" in TGTab "pos".
R__EXTERN TEveManager * gEve
Definition: TEveManager.h:243
void AddItem(TGListTreeItem *parent, TGListTreeItem *item)
Add given item to list tree.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition: TObject.cxx:443
This class provides an interface to context sensitive popup menus.
Definition: TContextMenu.h:40
Int_t fCrTab[3]
Definition: TRootBrowser.h:92
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition: TString.cxx:2343
TEveViewer * SpawnNewViewer(const char *name, const char *title="", Bool_t embed=kTRUE)
Create a new GL viewer.
unsigned int UInt_t
Definition: RtypesCore.h:42
char * Form(const char *fmt,...)
TGListTree * fListTree
Definition: TEveBrowser.h:94
TGFrame * fFrame
Definition: TGLayout.h:119
virtual void ChangeOptions(UInt_t options)
Change composite frame options. Options is an OR of the EFrameTypes.
Definition: TGFrame.cxx:1025
virtual void CloseTab(Int_t id)
Remove tab element id from right tab.
void ReconfToVertical()
Reconfigure to vertical layout, list-tree above the editor.
void SetColorMode(EColorMarkupMode colorMode)
Definition: TGListTree.h:451
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:75
TEveWindowManager * GetWindowManager() const
Definition: TEveManager.h:142
void SetShowTitleBars(Bool_t state)
Set show title-bar state on all frames.
void Warning(const char *location, const char *msgfmt,...)
virtual void RCheckEntry(Int_t id, Int_t IDfirst, Int_t IDlast)
Radio-select entry (note that they cannot be unselected, the selection must be moved to another entry...
Definition: TGMenu.cxx:1850
#define gVirtualX
Definition: TVirtualX.h:350
static void SetEditorClass(const char *edclass)
Set GED editor class.
TGTab * GetTabRight() const
Definition: TRootBrowser.h:141
TEveSelection * GetHighlight() const
Definition: TEveManager.h:130
const Bool_t kFALSE
Definition: RtypesCore.h:88
void InitPlugins(Option_t *opt="FI")
Initialize standard plugins.
static ULong_t Number2Pixel(Int_t ci)
Static method that given a color index number, returns the corresponding pixel value.
Definition: TColor.cxx:1990
TGListTreeItem * GetParent() const
Definition: TGListTree.h:73
void SelectWindow(TEveWindow *w)
Entry-point for communicating the fact that a window was acted upon in such a way that it should beco...
#define ClassImp(name)
Definition: Rtypes.h:359
void ItemClicked(TGListTreeItem *entry, Int_t btn, UInt_t mask, Int_t x, Int_t y)
Item has been clicked, based on mouse button do:
virtual void SetEditDisabled(UInt_t on=1)
Set edit disable flag for this frame and subframes.
Definition: TGFrame.cxx:1004
virtual void SetLayoutHints(ULong_t lh)
Definition: TGLayout.h:95
virtual void SetCleanup(Int_t mode=kLocalCleanup)
Turn on automatic cleanup of child frames in dtor.
Definition: TGFrame.cxx:1054
void ItemDblClicked(TGListTreeItem *item, Int_t btn)
Item has been double-clicked, potentially expand the children.
void EveMenu(Int_t id)
Handle events from Eve menu.
TGListTreeItem * GetFirstChild() const
Definition: TGListTree.h:74
unsigned long ULong_t
Definition: RtypesCore.h:51
TGHorizontalFrame * fPreMenuFrame
Definition: TRootBrowser.h:78
Double_t y[n]
Definition: legend1.C:17
virtual void SetString(const char *s)
Definition: TGString.h:41
TEveSelection * GetSelection() const
Definition: TEveManager.h:129
TGPopupMenu * fMenuFile
Definition: TRootBrowser.h:82
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:570
Bool_t Disconnect(const char *signal=0, void *receiver=0, const char *slot=0)
Disconnects signal of this object from slot of receiver.
Definition: TQObject.cxx:1025
virtual void StopEmbedding(const char *name=0)
Definition: TRootBrowser.h:152
Int_t fNbTab[3]
Definition: TRootBrowser.h:91
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1099
Definition: Rtypes.h:59
virtual ~TEveGListTreeEditorFrame()
Destructor.
TGFileBrowser * GetFileBrowser() const
Returns the default file-browser.
virtual TObject * GetObject(const TEveException &eh) const
Get a TObject associated with this render-element.
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
Definition: TGFrame.cxx:1146
TGHSplitter * fHSplitter
Definition: TRootBrowser.h:75
Mother of all ROOT objects.
Definition: TObject.h:37
Handle_t Window_t
Definition: GuiTypes.h:28
A node represent a volume positioned inside another.They store links to both volumes and to the TGeoM...
Definition: TGeoNode.h:39
virtual void UnmapWindow()
Definition: TGFrame.h:253
virtual void SetPadTop(Int_t v)
Definition: TGLayout.h:96
TEveGedEditor * fEditor
Definition: TEveBrowser.h:96
virtual void CheckEntry(Int_t id)
Check a menu entry (i.e. add a check mark in front of it).
Definition: TGMenu.cxx:1772
void RemoveElement(TEveElement *element, TEveElement *parent)
Remove element from parent.
auto * l
Definition: textangle.C:4
Special list-tree-item for Eve.
Definition: TEveBrowser.h:29
void SetupCintExport(TClass *cl)
Add "Export to CINT" into context-menu for class cl.
virtual void MapWindow()
Definition: TGFrame.h:251
TGClient * fClient
Definition: TGObject.h:37
void ConnectSignals()
Connect list-tree signals.
TEveGListTreeEditorFrame * GetLTEFrame() const
Definition: TEveManager.h:138
const TGWindow * GetDefaultRoot() const
Returns the root (i.e.
Definition: TGClient.cxx:232
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Definition: TRolke.cxx:630
Int_t GetNdaughters() const
Definition: TGeoNode.h:90
TEveScene * SpawnNewScene(const char *name, const char *title="")
Create a new scene.
Exception class thrown by TEve classes and macros.
Definition: TEveUtil.h:102
Composite GUI frame for parallel display of a TGListTree and TEveGedEditor.
Definition: TEveBrowser.h:82
virtual void AddPopup(TGHotString *s, TGPopupMenu *popup, TGMenuEntry *before=0, const TGPicture *p=0)
Add a (cascading) popup menu to a popup menu.
Definition: TGMenu.cxx:1149
Definition: Rtypes.h:59
const Mask_t kKeyControlMask
Definition: GuiTypes.h:196
Int_t GetDenyDestroy() const
Returns the number of times deny-destroy has been requested on the element.
virtual void SetPadLeft(Int_t v)
Definition: TGLayout.h:98
virtual void SetEditable(Bool_t on=kTRUE)
Switch ON/OFF edit mode.
Definition: TGFrame.cxx:930
virtual void CloseTab(Int_t id)
Virtual from TRootBrowser. Need to intercept closing of Eve tabs.
virtual UChar_t GetSelectedLevel() const
Get selection level, needed for rendering selection and highlight feedback.
Int_t GetNumberOfTabs() const
Return number of tabs.
Definition: TGTab.cxx:658
const Bool_t kTRUE
Definition: RtypesCore.h:87
Base class for TEveUtil visualization elements, providing hierarchy management, rendering control and...
Definition: TEveElement.h:33
TContextMenu * GetContextMenu() const
Definition: TBrowser.h:94
TGeoVolume * GetVolume() const
Definition: TGeoNode.h:94
const Int_t n
Definition: legend1.C:16
virtual void AddPopup(TGHotString *s, TGPopupMenu *menu, TGLayoutHints *l, TGPopupMenu *before=0)
Add popup menu to menu bar.
Definition: TGMenu.cxx:415
static Pixel_t GetDefaultSelectedBackground()
Get default selected frame background.
Definition: TGFrame.cxx:678
TGMenuBar * fMenuBar
Definition: TRootBrowser.h:81
ABC describing GUI independent browser implementation protocol.
Definition: TBrowserImp.h:29
const char * Data() const
Definition: TString.h:345
void ItemBelowMouse(TGListTreeItem *entry, UInt_t mask)
Different item is below mouse.