Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TRootCanvas.cxx
Go to the documentation of this file.
1// @(#)root/gui:$Id: b4c21444ab4f787f65b2b44199fc0440c3c2ce81 $
2// Author: Fons Rademakers 15/01/98
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, 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
13/** \class TRootCanvas
14 \ingroup guiwidgets
15
16This class creates a main window with menubar, scrollbars and a
17drawing area. The widgets used are the new native ROOT GUI widgets.
18
19*/
20
21
22#include "RConfigure.h"
23
24#include "TRootCanvas.h"
25#include "TRootApplication.h"
26#include "TRootHelpDialog.h"
27#include "TGClient.h"
28#include "TGCanvas.h"
29#include "TGMenu.h"
30#include "TGWidget.h"
31#include "TGFileBrowser.h"
32#include "TGFileDialog.h"
33#include "TGStatusBar.h"
34#include "TGTextEditDialogs.h"
35#include "TROOT.h"
36#include "TClass.h"
37#include "TSystem.h"
38#include "TCanvas.h"
39#include "TBrowser.h"
40#include "TClassTree.h"
41#include "TMarker.h"
42#include "TStyle.h"
43#include "TColorWheel.h"
44#include "TVirtualX.h"
45#include "TApplication.h"
46#include "TFile.h"
47#include "TInterpreter.h"
48#include "TEnv.h"
49#include "TMath.h"
50#include <iostream>
51#include "TGDockableFrame.h"
52#include "TPadPainter.h"
53
54#include "TG3DLine.h"
55#include "TGToolBar.h"
56#include "TGToolTip.h"
57#include "TVirtualPadEditor.h"
58#include "TRootControlBar.h"
59#include "TGuiBuilder.h"
60#include "TImage.h"
61#include "TASUtils.h"
62#include "TError.h"
63#include "TGDNDManager.h"
64#include "TBufferFile.h"
65#include "TRootBrowser.h"
66#include "TGTab.h"
67#include "TGedEditor.h"
68
69#include "TPluginManager.h"
70#include "TVirtualGL.h"
71
72#ifdef WIN32
73#include "TWin32SplashThread.h"
74#endif
75
76#include "HelpText.h"
77
78namespace {
79
80bool IsGeometryPrimitive(TObject *obj)
81{
82 static TClass *geoVolumeClass = TClass::GetClass("TGeoVolume");
83 static TClass *geoShapeClass = TClass::GetClass("TGeoShape");
84 static TClass *geoOverlapClass = TClass::GetClass("TGeoOverlap");
85 static TClass *geoTrackClass = TClass::GetClass("TGeoTrack");
86
87 if (!obj)
88 return false;
89
90 return (geoVolumeClass && obj->InheritsFrom(geoVolumeClass)) ||
91 (geoShapeClass && obj->InheritsFrom(geoShapeClass)) ||
92 (geoOverlapClass && obj->InheritsFrom(geoOverlapClass)) ||
93 (geoTrackClass && obj->InheritsFrom(geoTrackClass));
94}
95
96bool PadHasGeometryContent(TVirtualPad *pad)
97{
98 if (!pad)
99 return false;
100
101 TList *primitives = pad->GetListOfPrimitives();
102 if (!primitives)
103 return false;
104
105 TIter next(primitives);
106 while (TObject *obj = next()) {
107 if (IsGeometryPrimitive(obj))
108 return true;
109 if (obj->InheritsFrom(TVirtualPad::Class()) && PadHasGeometryContent(static_cast<TVirtualPad *>(obj)))
110 return true;
111 }
112
113 return false;
114}
115
116} // namespace
117
118// Canvas menu command ids
205// clang-format off
206static const char *gOpenTypes[] = { "ROOT files", "*.root",
207 "All files", "*",
208 0, 0 };
209
210static const char *gSaveAsTypes[] = { "PDF", "*.pdf",
211 "SVG", "*.svg",
212 "TeX", "*.tex",
213 "PostScript", "*.ps",
214 "Encapsulated PostScript", "*.eps",
215 "PNG", "*.png",
216 "JPEG", "*.jpg",
217 "GIF", "*.gif",
218 "BMP", "*.bmp",
219 "ROOT macros", "*.C",
220 "ROOT files", "*.root",
221 "XML", "*.xml",
222 "HTML", "*.html",
223 "XPM", "*.xpm",
224 "TIFF", "*.tiff",
225 "XCF", "*.xcf",
226 "All files", "*",
227 0, 0 };
228
230 // { filename, tooltip, staydown, id, button}
231 { "newcanvas.xpm", "New", kFALSE, kFileNewCanvas, 0 },
232 { "open.xpm", "Open", kFALSE, kFileOpen, 0 },
233 { "save.xpm", "Save As", kFALSE, kFileSaveAs, 0 },
234 { "printer.xpm", "Print", kFALSE, kFilePrint, 0 },
235 { "", "", kFALSE, -1, 0 },
236 { "interrupt.xpm", "Interrupt", kFALSE, kOptionInterrupt,0 },
237 { "refresh2.xpm", "Refresh", kFALSE, kOptionRefresh, 0 },
238 { "", "", kFALSE, -1, 0 },
239 { "inspect.xpm", "Inspect", kFALSE, kInspectRoot, 0 },
240 { "browser.xpm", "Browser", kFALSE, kToolsBrowser, 0 },
241 { 0, 0, kFALSE, 0, 0 }
242};
243
245 { "pointer.xpm", "Modify", kFALSE, kToolModify, 0 },
246 { "arc.xpm", "Arc", kFALSE, kToolArc, 0 },
247 { "line.xpm", "Line", kFALSE, kToolLine, 0 },
248 { "arrow.xpm", "Arrow", kFALSE, kToolArrow, 0 },
249 { "diamond.xpm", "Diamond", kFALSE, kToolDiamond, 0 },
250 { "ellipse.xpm", "Ellipse", kFALSE, kToolEllipse, 0 },
251 { "pad.xpm", "Pad", kFALSE, kToolPad, 0 },
252 { "pave.xpm", "Pave", kFALSE, kToolPave, 0 },
253 { "pavelabel.xpm", "Pave Label", kFALSE, kToolPLabel, 0 },
254 { "pavetext.xpm", "Pave Text", kFALSE, kToolPText, 0 },
255 { "pavestext.xpm", "Paves Text", kFALSE, kToolPsText, 0 },
256 { "graph.xpm", "Graph", kFALSE, kToolGraph, 0 },
257 { "curlyline.xpm", "Curly Line", kFALSE, kToolCurlyLine, 0 },
258 { "curlyarc.xpm", "Curly Arc", kFALSE, kToolCurlyArc, 0 },
259 { "latex.xpm", "Text/Latex", kFALSE, kToolLatex, 0 },
260 { "marker.xpm", "Marker", kFALSE, kToolMarker, 0 },
261 { "cut.xpm", "Graphical Cut", kFALSE, kToolCutG, 0 },
262 { 0, 0, kFALSE, 0, 0 }
263};
264// clang-format on
265
266//////////////////////////////////////////////////////////////////////////
267// //
268// TRootContainer //
269// //
270// Utility class used by TRootCanvas. The TRootContainer is the frame //
271// embedded in the TGCanvas widget. The ROOT graphics goes into this //
272// frame. This class is used to enable input events on this graphics //
273// frame and forward the events to the TRootCanvas handlers. //
274// //
275//////////////////////////////////////////////////////////////////////////
276
278private:
279 TRootCanvas *fCanvas; // pointer back to canvas imp
280public:
281 TRootContainer(TRootCanvas *c, Window_t id, const TGWindow *parent);
282
283 Bool_t HandleButton(Event_t *ev) override;
290 { return fCanvas->HandleContainerKey(ev); }
292 { return fCanvas->HandleContainerMotion(ev); }
294 { return fCanvas->HandleContainerExpose(ev); }
296 { return fCanvas->HandleContainerCrossing(ev); }
297 void SavePrimitive(std::ostream &out, Option_t * = "") override;
298 void SetEditable(Bool_t) override { }
299};
300
301////////////////////////////////////////////////////////////////////////////////
302/// Create a canvas container.
303
318
319////////////////////////////////////////////////////////////////////////////////
320/// Directly handle scroll mouse buttons (4 and 5), only pass buttons
321/// 1, 2 and 3 on to the TCanvas.
322
324{
326 UInt_t page = vp->GetHeight()/4;
327 Int_t newpos;
328
329 gVirtualX->SetInputFocus(GetMainFrame()->GetId());
330
331 if (event->fCode == kButton4) {
332 //scroll up
333 newpos = fCanvas->fCanvasWindow->GetVsbPosition() - page;
334 if (newpos < 0) newpos = 0;
336// return kTRUE;
337 }
338 if (event->fCode == kButton5) {
339 // scroll down
340 newpos = fCanvas->fCanvasWindow->GetVsbPosition() + page;
342// return kTRUE;
343 }
345}
346
347
348////////////////////////////////////////////////////////////////////////////////
349/// Create a basic ROOT canvas.
350
361
362////////////////////////////////////////////////////////////////////////////////
363/// Create a basic ROOT canvas.
364
376
377////////////////////////////////////////////////////////////////////////////////
378/// Create the actual canvas.
379
381{
382 fButton = 0;
383 fAutoFit = kTRUE; // check also menu entry
384 fEditor = 0;
386
387 // Create menus
396
397 static Int_t img = 0;
398
399 if (!img) {
402 TImage* itmp = TImage::Create();
403 img = itmp ? 1 : -1;
404 if (itmp) {
405 delete itmp;
406 itmp=NULL;
407 }
408 gErrorIgnoreLevel = sav;
409 }
410 if (img > 0) {
414 }
415
418
420 fFileMenu->AddEntry("&New Canvas", kFileNewCanvas);
421 fFileMenu->AddEntry("&Open...", kFileOpen);
422 fFileMenu->AddEntry("&Close Canvas", kFileCloseCanvas);
425 fFileMenu->AddEntry("Save &As...", kFileSaveAs);
427 fFileMenu->AddEntry("&Print...", kFilePrint);
429 fFileMenu->AddEntry("&Quit ROOT", kFileQuit);
430
434
436 fEditMenu->AddEntry("&Style...", kEditStyle);
438 fEditMenu->AddEntry("Cu&t", kEditCut);
439 fEditMenu->AddEntry("&Copy", kEditCopy);
440 fEditMenu->AddEntry("&Paste", kEditPaste);
444 fEditMenu->AddEntry("&Undo", kEditUndo);
445 fEditMenu->AddEntry("&Redo", kEditRedo);
446
452
456
458 fViewMenu->AddEntry("&Editor", kViewEditor);
459 fViewMenu->AddEntry("&Toolbar", kViewToolbar);
460 fViewMenu->AddEntry("Event &Statusbar", kViewEventStatus);
461 fViewMenu->AddEntry("T&oolTip Info", kViewToolTips);
463 fViewMenu->AddEntry("&Colors", kViewColors);
464 fViewMenu->AddEntry("&Fonts", kViewFonts);
465 fViewMenu->AddEntry("&Markers", kViewMarkers);
467 fViewMenu->AddEntry("&Iconify", kViewIconify);
469 fViewMenu->AddPopup("&View With", fViewWithMenu);
470
472
474 fOptionMenu->AddEntry("&Auto Resize Canvas", kOptionAutoResize);
475 fOptionMenu->AddEntry("&Resize Canvas", kOptionResizeCanvas);
476 fOptionMenu->AddEntry("&Move Opaque", kOptionMoveOpaque);
477 fOptionMenu->AddEntry("Resize &Opaque", kOptionResizeOpaque);
479 fOptionMenu->AddEntry("&Interrupt", kOptionInterrupt);
480 fOptionMenu->AddEntry("R&efresh", kOptionRefresh);
482 fOptionMenu->AddEntry("&Pad Auto Exec", kOptionAutoExec);
484 fOptionMenu->AddEntry("&Statistics", kOptionStatistics);
485 fOptionMenu->AddEntry("Histogram &Title", kOptionHistTitle);
486 fOptionMenu->AddEntry("&Fit Parameters", kOptionFitParams);
487 fOptionMenu->AddEntry("Can Edit &Histograms", kOptionCanEdit);
488
489 // Opaque options initialized in InitWindow()
491 if (gStyle->GetOptStat())
493 if (gStyle->GetOptTitle())
495 if (gStyle->GetOptFit())
497 if (gROOT->GetEditHistograms())
499
501 fToolsMenu->AddEntry("&Inspect ROOT", kInspectRoot);
502 fToolsMenu->AddEntry("&Class Tree", kClassesTree);
503 fToolsMenu->AddEntry("&Fit Panel", kFitPanel);
504 fToolsMenu->AddEntry("&Start Browser", kToolsBrowser);
505 fToolsMenu->AddEntry("&Gui Builder", kToolsBuilder);
506 fToolsMenu->AddEntry("&Event Recorder", kToolsRecorder);
507
509 fHelpMenu->AddLabel("Basic Help On...");
511 fHelpMenu->AddEntry("&Canvas", kHelpOnCanvas);
512 fHelpMenu->AddEntry("&Menus", kHelpOnMenus);
513 fHelpMenu->AddEntry("&Graphics Editor", kHelpOnGraphicsEd);
514 fHelpMenu->AddEntry("&Browser", kHelpOnBrowser);
515 fHelpMenu->AddEntry("&Objects", kHelpOnObjects);
516 fHelpMenu->AddEntry("&PostScript", kHelpOnPS);
518 fHelpMenu->AddEntry("&About ROOT...", kHelpAbout);
519
520 // This main frame will process the menu commands
521 fFileMenu->Associate(this);
523 fEditMenu->Associate(this);
525 fViewMenu->Associate(this);
527 fViewWithMenu->Connect("PoppedUp()", "TRootCanvas", this, "UpdateViewWithMenu()");
528 fOptionMenu->Associate(this);
529 fToolsMenu->Associate(this);
530 fHelpMenu->Associate(this);
531
532 // Create menubar layout hints
536
537 // Create menubar
538 fMenuBar = new TGMenuBar(this, 1, 1, kHorizontalFrame);
545
547
551
552 // Create toolbar dock
553 fToolDock = new TGDockableFrame(this);
557
558 // will allocate it later
559 fToolBar = 0;
560 fVertical1 = 0;
561 fVertical2 = 0;
564
568
569 fMainFrame = new TGCompositeFrame(this, GetWidth() + 4, GetHeight() + 4,
572
573 // Create editor frame that will host the pad editor
577
578 // Create canvas and canvas container that will host the ROOT graphics
581
582 fCanvasID = -1;
583
584 if (fCanvas->UseGL()) {
586 //first, initialize GL (if not yet)
587 if (!gGLManager) {
588 TString x = "win32";
589 if (gVirtualX->InheritsFrom("TGX11"))
590 x = "x11";
591 else if (gVirtualX->InheritsFrom("TGCocoa"))
592 x = "osx";
593
594 TPluginHandler *ph = gROOT->GetPluginManager()->FindHandler("TGLManager", x);
595
596 if (ph && ph->LoadPlugin() != -1) {
597 if (!ph->ExecPlugin(0))
598 Error("CreateCanvas", "GL manager plugin failed");
599 }
600 }
601
602 if (gGLManager) {
604 if (fCanvasID != -1) {
605 //Create gl context.
606 const Int_t glCtx = gGLManager->CreateGLContext(fCanvasID);
607 if (glCtx != -1) {
609 fCanvas->SetGLDevice(glCtx);//Now, fCanvas is responsible for context deletion!
610 } else
611 Error("CreateCanvas", "GL context creation failed.");
612 } else
613 Error("CreateCanvas", "GL window creation failed\n");
614 }
615 }
616
617 if (fCanvasID == -1)
619
620 Window_t win = gVirtualX->GetWindowID(fCanvasID);
624
627
628 // create the tooltip with a timeout of 250 ms
630
631 fCanvas->Connect("ProcessedEvent(Int_t, Int_t, Int_t, TObject*)",
632 "TRootCanvas", this,
633 "EventInfo(Int_t, Int_t, Int_t, TObject*)");
634
635 // Create status bar
636 int parts[] = { 33, 10, 10, 47 };
637 fStatusBar = new TGStatusBar(this, 10, 10);
638 fStatusBar->SetParts(parts, 4);
639
641
643
644 // Misc
647 fIconPic = SetIconPixmap("macro_s.xpm");
648 SetClassHints("ROOT", "Canvas");
649
652
653 // by default status bar, tool bar and pad editor are hidden
658
661
662 // we need to use GetDefaultSize() to initialize the layout algorithm...
664
665 gVirtualX->SetDNDAware(fId, fDNDTypeList);
667}
668
669////////////////////////////////////////////////////////////////////////////////
670/// Delete ROOT basic canvas. Order is significant. Delete in reverse
671/// order of creation.
672
674{
675 delete fToolTip;
676 if (fIconPic) gClient->FreePicture(fIconPic);
677 if (fEditor && !fEmbedded) delete fEditor;
678 if (fToolBar) {
679 Disconnect(fToolDock, "Docked()", this, "AdjustSize()");
680 Disconnect(fToolDock, "Undocked()", this, "AdjustSize()");
681 fToolBar->Cleanup();
682 delete fToolBar;
683 }
684
685 if (!MustCleanup()) {
686 delete fStatusBar;
687 delete fStatusBarLayout;
688 delete fCanvasContainer;
689 delete fCanvasWindow;
690
691 delete fEditorFrame;
692 delete fEditorLayout;
693 delete fMainFrame;
694 delete fMainFrameLayout;
695 delete fToolBarSep;
696 delete fToolDock;
697 delete fToolBarLayout;
698 delete fHorizontal1;
699 delete fHorizontal1Layout;
700
701 delete fMenuBar;
702 delete fMenuBarLayout;
703 delete fMenuBarItemLayout;
704 delete fMenuBarHelpLayout;
705 delete fCanvasLayout;
706 delete fDockLayout;
707 }
708
709 delete fFileMenu;
710 delete fFileSaveMenu;
711 delete fEditMenu;
712 delete fEditClearMenu;
713 delete fViewMenu;
714 delete fViewWithMenu;
715 delete fOptionMenu;
716 delete fToolsMenu;
717 delete fHelpMenu;
718}
719
720////////////////////////////////////////////////////////////////////////////////
721/// Called via TCanvasImp interface by TCanvas.
722
724{
726 if(gged && gged->GetCanvas() == fCanvas) {
727 if (fEmbedded) {
728 ((TGedEditor *)gged)->SetModel(0, 0, kButton1Down);
729 ((TGedEditor *)gged)->SetCanvas(0);
730 }
731 else gged->Hide();
732 }
733
734 if (fCanvasID != -1) {
735 gVirtualX->SelectWindow(fCanvasID);
736 gVirtualX->CloseWindow();
737 fCanvasID = -1;
738 }
739}
740
741////////////////////////////////////////////////////////////////////////////////
742/// Really delete the canvas and this GUI.
743
745{
747 if(gged && gged->GetCanvas() == fCanvas) {
748 if (fEmbedded) {
749 ((TGedEditor *)gged)->SetModel(0, 0, kButton1Down);
750 ((TGedEditor *)gged)->SetCanvas(0);
751 }
752 else gged->Hide();
753 }
754
755 fToolTip->Hide();
756 Disconnect(fCanvas, "ProcessedEvent(Int_t, Int_t, Int_t, TObject*)",
757 this, "EventInfo(Int_t, Int_t, Int_t, TObject*)");
758
760 fCanvas->Clear();
761 fCanvas->SetName("");
762 if (gPad && gPad->GetCanvas() == fCanvas)
763 gPad = nullptr;
764 delete this;
765}
766
767////////////////////////////////////////////////////////////////////////////////
768/// In case window is closed via WM we get here.
769
774
775////////////////////////////////////////////////////////////////////////////////
776/// Return width of canvas container.
777
782
783////////////////////////////////////////////////////////////////////////////////
784/// Return height of canvas container.
785
790
791////////////////////////////////////////////////////////////////////////////////
792/// Gets the size and position of the window containing the canvas. This
793/// size includes the menubar and borders.
794
796{
797 gVirtualX->GetWindowSize(fId, x, y, w, h);
798
799 Window_t childdum;
800 gVirtualX->TranslateCoordinates(fId, gClient->GetDefaultRoot()->GetId(),
801 0, 0, x, y, childdum);
802 if (!fCanvas->GetShowEditor()) return 0;
803 return fEditorFrame->GetWidth();
804}
805
806////////////////////////////////////////////////////////////////////////////////
807/// Set text in status bar.
808
809void TRootCanvas::SetStatusText(const char *txt, Int_t partidx)
810{
811 fStatusBar->SetText(txt, partidx);
812}
813
814////////////////////////////////////////////////////////////////////////////////
815/// Handle menu and other command generated by the user.
816
818{
819 TRootHelpDialog *hd;
820 TList *lc;
821
822 switch (GET_MSG(msg)) {
823
824 case kC_COMMAND:
825
826 switch (GET_SUBMSG(msg)) {
827
828 case kCM_BUTTON:
829 case kCM_MENU:
830
831 switch (parm1) {
832 // Handle toolbar items...
833 case kToolModify:
834 gROOT->SetEditorMode();
835 break;
836 case kToolArc:
837 gROOT->SetEditorMode("Arc");
838 break;
839 case kToolLine:
840 gROOT->SetEditorMode("Line");
841 break;
842 case kToolArrow:
843 gROOT->SetEditorMode("Arrow");
844 break;
845 case kToolDiamond:
846 gROOT->SetEditorMode("Diamond");
847 break;
848 case kToolEllipse:
849 gROOT->SetEditorMode("Ellipse");
850 break;
851 case kToolPad:
852 gROOT->SetEditorMode("Pad");
853 break;
854 case kToolPave:
855 gROOT->SetEditorMode("Pave");
856 break;
857 case kToolPLabel:
858 gROOT->SetEditorMode("PaveLabel");
859 break;
860 case kToolPText:
861 gROOT->SetEditorMode("PaveText");
862 break;
863 case kToolPsText:
864 gROOT->SetEditorMode("PavesText");
865 break;
866 case kToolGraph:
867 gROOT->SetEditorMode("PolyLine");
868 break;
869 case kToolCurlyLine:
870 gROOT->SetEditorMode("CurlyLine");
871 break;
872 case kToolCurlyArc:
873 gROOT->SetEditorMode("CurlyArc");
874 break;
875 case kToolLatex:
876 gROOT->SetEditorMode("Text");
877 break;
878 case kToolMarker:
879 gROOT->SetEditorMode("Marker");
880 break;
881 case kToolCutG:
882 gROOT->SetEditorMode("CutG");
883 break;
884
885 // Handle File menu items...
886 case kFileNewCanvas:
887 gROOT->MakeDefCanvas();
888 break;
889 case kFileOpen:
890 {
891 static TString dir(".");
892 TGFileInfo fi;
894 fi.SetIniDir(dir);
895 new TGFileDialog(fClient->GetDefaultRoot(), this, kFDOpen,&fi);
896 if (!fi.fFilename) return kTRUE;
897 dir = fi.fIniDir;
898 TFile::Open(fi.fFilename, "update");
899 TIter next(gROOT->GetListOfBrowsers());
900 TBrowser *b;
901 while ((b = (TBrowser *)next())) {
902 TRootBrowser *rb = dynamic_cast<TRootBrowser *>(b->GetBrowserImp());
903 if (rb) {
904 TGFileBrowser *fb = dynamic_cast<TGFileBrowser *>(rb->GetActBrowser());
905 if (fb)
906 fb->Selected(0);
907 }
908 }
909 gROOT->RefreshBrowsers();
910 }
911 break;
912 case kFileSaveAs:
913 {
914 TString workdir = gSystem->WorkingDirectory();
915 static TString dir(".");
916 static Int_t typeidx = 0;
917 static Bool_t overwr = kFALSE;
918 TGFileInfo fi;
919 TString defaultType = gEnv->GetValue("Canvas.SaveAsDefaultType", ".pdf");
920 if (typeidx == 0) {
921 for (int i=1;gSaveAsTypes[i];i+=2) {
922 TString ftype = gSaveAsTypes[i];
923 if (ftype.EndsWith(defaultType.Data())) {
924 typeidx = i-1;
925 break;
926 }
927 }
928 }
930 fi.SetIniDir(dir);
931 fi.fFileTypeIdx = typeidx;
932 fi.fOverwrite = overwr;
933 new TGFileDialog(fClient->GetDefaultRoot(), this, kFDSave, &fi);
934 gSystem->ChangeDirectory(workdir.Data());
935 if (!fi.fFilename) return kTRUE;
936 Bool_t appendedType = kFALSE;
937 TString fn = fi.fFilename;
938 TString ft = fi.fFileTypes[fi.fFileTypeIdx+1];
939 // clang-format off
940 dir = fi.fIniDir;
941 typeidx = fi.fFileTypeIdx;
942 overwr = fi.fOverwrite;
943again:
944 if (fn.EndsWith(".root") ||
945 fn.EndsWith(".ps") ||
946 fn.EndsWith(".eps") ||
947 fn.EndsWith(".pdf") ||
948 fn.EndsWith(".html") ||
949 fn.EndsWith(".svg") ||
950 fn.EndsWith(".tex") ||
951 fn.EndsWith(".gif") ||
952 fn.EndsWith(".bmp") ||
953 fn.EndsWith(".xml") ||
954 fn.EndsWith(".xpm") ||
955 fn.EndsWith(".jpg") ||
956 fn.EndsWith(".png") ||
957 fn.EndsWith(".xcf") ||
958 fn.EndsWith(".tiff")) {
959 fCanvas->SaveAs(fn);
960 } else if (fn.EndsWith(".C"))
961 fCanvas->SaveSource(fn);
962 else {
963 if (!appendedType) {
964 if (ft.Index(".") != kNPOS) {
965 fn += ft(ft.Index("."), ft.Length());
966 appendedType = kTRUE;
967 goto again;
968 }
969 }
970 Warning("ProcessMessage", "file %s cannot be saved with this extension", fi.fFilename);
971 }
972 for (int i = 1; gSaveAsTypes[i]; i += 2) {
973 TString ftype = gSaveAsTypes[i];
974 ftype.ReplaceAll("*.", ".");
975 if (fn.EndsWith(ftype.Data())) {
976 typeidx = i - 1;
977 break;
978 }
979 }
980 }
981 break;
982 case kFileSaveAsRoot:
983 fCanvas->SaveAs(".root");
984 break;
985 case kFileSaveAsC:
987 break;
988 case kFileSaveAsPS:
989 fCanvas->SaveAs();
990 break;
991 case kFileSaveAsEPS:
992 fCanvas->SaveAs(".eps");
993 break;
994 case kFileSaveAsPDF:
995 fCanvas->SaveAs(".pdf");
996 break;
997 case kFileSaveAsHTML:
998 fCanvas->SaveAs(".html");
999 break;
1000 case kFileSaveAsSVG:
1001 fCanvas->SaveAs(".svg");
1002 break;
1003 case kFileSaveAsGIF:
1004 fCanvas->SaveAs(".gif");
1005 break;
1006 case kFileSaveAsJPG:
1007 fCanvas->SaveAs(".jpg");
1008 break;
1009 case kFileSaveAsPNG:
1010 fCanvas->SaveAs(".png");
1011 break;
1012 case kFileSaveAsBMP:
1013 fCanvas->SaveAs(".bmp");
1014 break;
1015 case kFileSaveAsTEX:
1016 fCanvas->SaveAs(".tex");
1017 break;
1018 case kFilePrint:
1019 PrintCanvas();
1020 break;
1021 case kFileCloseCanvas:
1023 break;
1024 case kFileQuit:
1025 if (!gApplication->ReturnFromRun()) {
1029 }
1032 if (TClass::GetClass("TStyleManager", kFALSE, kTRUE))
1033 gROOT->ProcessLine("TStyleManager::Terminate()");
1035 break;
1036
1037 // Handle Edit menu items...
1038 case kEditStyle:
1039 if (!TClass::GetClass("TStyleManager"))
1040 gSystem->Load("libGed");
1041 gROOT->ProcessLine("TStyleManager::Show()");
1042 break;
1043 case kEditCut:
1044 // still noop
1045 break;
1046 case kEditCopy:
1047 // still noop
1048 break;
1049 case kEditPaste:
1050 // still noop
1051 break;
1052 case kEditUndo:
1053 // noop
1054 break;
1055 case kEditRedo:
1056 // noop
1057 break;
1058 case kEditClearPad:
1059 gPad->Clear();
1060 gPad->Modified();
1061 gPad->Update();
1062 break;
1063 case kEditClearCanvas:
1064 fCanvas->Clear();
1065 fCanvas->Modified();
1066 fCanvas->Update();
1067 break;
1068
1069 // Handle View menu items...
1070 case kViewEditor:
1072 break;
1073 case kViewToolbar:
1075 break;
1076 case kViewEventStatus:
1078 break;
1079 case kViewToolTips:
1081 break;
1082 case kViewColors:
1083 {
1084 TVirtualPad *padsav = gPad->GetCanvas();
1085 //This was the code with the old color table
1086 // TCanvas *m = new TCanvas("colors","Color Table");
1087 // TPad::DrawColorTable();
1088 // m->Update();
1089 TColorWheel *wheel = new TColorWheel();
1090 wheel->Draw();
1091
1092 //tp: with Cocoa, window is visible (and repainted)
1093 //before wheel->Draw() was called and you can see "empty"
1094 //canvas.
1095 gPad->Update();
1096 //
1097 if (padsav) padsav->cd();
1098 }
1099 break;
1100 case kViewFonts:
1101 // noop
1102 break;
1103 case kViewMarkers:
1104 {
1105 TVirtualPad *padsav = gPad ? gPad->GetCanvas() : nullptr;
1106 TCanvas *m = new TCanvas("markers","Marker Types",600,200);
1108 m->Update();
1109 if (padsav) padsav->cd();
1110 }
1111 break;
1112 case kViewIconify:
1113 Iconify();
1114 break;
1115 case kViewX3D: {
1116 TVirtualPad *pad = gPad ? gPad : (fCanvas ? fCanvas->GetSelectedPad() : nullptr);
1117 if (!pad)
1118 pad = fCanvas;
1119 if (!PadHasGeometryContent(pad))
1120 pad->GetViewer3D("x3d");
1121 break;
1122 }
1123 case kViewOpenGL:
1124 gPad->GetViewer3D("ogl");
1125 break;
1126
1127 // Handle Option menu items...
1128 case kOptionAutoExec:
1130 if (fCanvas->GetAutoExec()) {
1132 } else {
1134 }
1135 break;
1136 case kOptionAutoResize:
1137 {
1139 int opt = fCanvasContainer->GetOptions();
1140 if (fAutoFit) {
1141 opt &= ~kFixedSize;
1143 } else {
1144 opt |= kFixedSize;
1146 }
1148 // in case of autofit this will generate a configure
1149 // event for the container and this will force the
1150 // update of the TCanvas
1151 //Layout();
1152 }
1153 Layout();
1154 break;
1156 FitCanvas();
1157 break;
1158 case kOptionMoveOpaque:
1159 if (fCanvas->OpaqueMoving()) {
1160 fCanvas->MoveOpaque(0);
1162 } else {
1163 fCanvas->MoveOpaque(1);
1165 }
1166 break;
1168 if (fCanvas->OpaqueResizing()) {
1171 } else {
1174 }
1175 break;
1176 case kOptionInterrupt:
1177 gROOT->SetInterrupt();
1178 break;
1179 case kOptionRefresh:
1180 fCanvas->Paint();
1181 fCanvas->Update();
1182 break;
1183 case kOptionStatistics:
1184 if (gStyle->GetOptStat()) {
1185 gStyle->SetOptStat(0);
1186 delete gPad->FindObject("stats");
1188 } else {
1189 gStyle->SetOptStat(1);
1191 }
1192 gPad->Modified();
1193 fCanvas->Update();
1194 break;
1195 case kOptionHistTitle:
1196 if (gStyle->GetOptTitle()) {
1197 gStyle->SetOptTitle(0);
1198 delete gPad->FindObject("title");
1200 } else {
1201 gStyle->SetOptTitle(1);
1203 }
1204 gPad->Modified();
1205 fCanvas->Update();
1206 break;
1207 case kOptionFitParams:
1208 if (gStyle->GetOptFit()) {
1209 gStyle->SetOptFit(0);
1211 } else {
1212 gStyle->SetOptFit(1);
1214 }
1215 gPad->Modified();
1216 fCanvas->Update();
1217 break;
1218 case kOptionCanEdit:
1219 if (gROOT->GetEditHistograms()) {
1220 gROOT->SetEditHistograms(kFALSE);
1222 } else {
1223 gROOT->SetEditHistograms(kTRUE);
1225 }
1226 break;
1227
1228 // Handle Tools menu items...
1229 case kInspectRoot:
1230 fCanvas->cd();
1231 gROOT->Inspect();
1232 fCanvas->Update();
1233 break;
1234 case kToolsBrowser:
1235 new TBrowser("browser");
1236 break;
1237 case kToolsBuilder:
1239 break;
1240 case kToolsRecorder:
1241 gROOT->ProcessLine("new TGRecorder()");
1242 break;
1243
1244 // Handle Tools menu items...
1245 case kClassesTree:
1246 {
1247 TString cdef;
1248 lc = (TList*)gROOT->GetListOfCanvases();
1249 if (lc->FindObject("ClassTree")) {
1250 cdef = TString::Format("ClassTree_%d", lc->GetSize()+1);
1251 } else {
1252 cdef = "ClassTree";
1253 }
1254 new TClassTree(cdef.Data(), "TObject");
1255 fCanvas->Update();
1256 }
1257 break;
1258
1259 case kFitPanel:
1260 {
1261 // use plugin manager to create instance of TFitEditor
1262 TPluginHandler *handler = gROOT->GetPluginManager()->FindHandler("TFitEditor");
1263 if (handler && handler->LoadPlugin() != -1) {
1264 if (handler->ExecPlugin(2, fCanvas, 0) == 0)
1265 Error("FitPanel", "Unable to crate the FitPanel");
1266 }
1267 else
1268 Error("FitPanel", "Unable to find the FitPanel plug-in");
1269 }
1270 break;
1271
1272 // Handle Help menu items...
1273 case kHelpAbout:
1274 {
1275#ifdef WIN32
1277#else
1278
1279 char str[32];
1280 snprintf(str, 32, "About ROOT %s...", gROOT->GetVersion());
1281 hd = new TRootHelpDialog(this, str, 600, 400);
1282 hd->SetText(gHelpAbout);
1283 hd->Popup();
1284#endif
1285 }
1286 break;
1287 case kHelpOnCanvas:
1288 hd = new TRootHelpDialog(this, "Help on Canvas...", 600, 400);
1289 hd->SetText(gHelpCanvas);
1290 hd->Popup();
1291 break;
1292 case kHelpOnMenus:
1293 hd = new TRootHelpDialog(this, "Help on Menus...", 600, 400);
1295 hd->Popup();
1296 break;
1297 case kHelpOnGraphicsEd:
1298 hd = new TRootHelpDialog(this, "Help on Graphics Editor...", 600, 400);
1300 hd->Popup();
1301 break;
1302 case kHelpOnBrowser:
1303 hd = new TRootHelpDialog(this, "Help on Browser...", 600, 400);
1304 hd->SetText(gHelpBrowser);
1305 hd->Popup();
1306 break;
1307 case kHelpOnObjects:
1308 hd = new TRootHelpDialog(this, "Help on Objects...", 600, 400);
1309 hd->SetText(gHelpObjects);
1310 hd->Popup();
1311 break;
1312 case kHelpOnPS:
1313 hd = new TRootHelpDialog(this, "Help on PostScript...", 600, 400);
1315 hd->Popup();
1316 break;
1317 // clang-format on
1318 }
1319 default:
1320 break;
1321 }
1322 default:
1323 break;
1324 }
1325 return kTRUE;
1326}
1327
1328////////////////////////////////////////////////////////////////////////////////
1329/// Called by TCanvas ctor to get window indetifier.
1330
1340
1341////////////////////////////////////////////////////////////////////////////////
1342/// Set size of canvas container. Units in pixels.
1343/// If w==0 and h==0, set autofit mode
1344
1346{
1347 // turn off autofit, we want to stay at the given size
1348 int opt = fCanvasContainer->GetOptions();
1349 if (!w && !h) {
1350 fAutoFit = kTRUE;
1352 opt &= ~kFixedSize; // turn off fixed size mode
1353 } else {
1354 fAutoFit = kFALSE;
1356 opt |= kFixedSize; // turn on fixed size mode
1357 }
1361 Layout(); // force layout (will update container to given size)
1362 fCanvas->Resize();
1363 fCanvas->Update();
1364}
1365
1366////////////////////////////////////////////////////////////////////////////////
1367/// Set cursor for the canvas
1368
1370{
1371 if (fCanvasID != -1)
1372 gVirtualX->SetCursor(fCanvasID, cursor);
1373}
1374
1375////////////////////////////////////////////////////////////////////////////////
1376/// Set canvas position (units in pixels).
1377
1382
1383////////////////////////////////////////////////////////////////////////////////
1384/// Set size of canvas (units in pixels).
1385
1387{
1388 Resize(w, h);
1389
1390 // Make sure the change of size is really done.
1391 gVirtualX->Update(1);
1392 if (!gThreadXAR) {
1393 gSystem->Sleep(100);
1395 gSystem->Sleep(10);
1397 }
1398}
1399
1400////////////////////////////////////////////////////////////////////////////////
1401/// Put canvas window on top of the window stack.
1402
1404{
1405 gVirtualX->RaiseWindow(GetId());
1406}
1407
1408////////////////////////////////////////////////////////////////////////////////
1409/// Change title on window.
1410
1411void TRootCanvas::SetWindowTitle(const char *title)
1412{
1413 SetWindowName(title);
1414 SetIconName(title);
1415 fToolDock->SetWindowName(TString::Format("ToolBar: %s", title));
1416}
1417
1418////////////////////////////////////////////////////////////////////////////////
1419/// Fit canvas container to current window size.
1420
1422{
1423 if (!fAutoFit) {
1424 int opt = fCanvasContainer->GetOptions();
1425 int oopt = opt;
1426 opt &= ~kFixedSize; // turn off fixed size mode
1428 Layout(); // force layout
1429 fCanvas->Resize();
1430 fCanvas->Update();
1432 }
1433}
1434
1435////////////////////////////////////////////////////////////////////////////////
1436/// Print the canvas.
1437
1439{
1440 Int_t ret = 0;
1441 Bool_t pname = kTRUE;
1442 char *printer, *printCmd;
1443 static TString sprinter, sprintCmd;
1444
1445 if (sprinter == "")
1446 printer = StrDup(gEnv->GetValue("Print.Printer", ""));
1447 else
1448 printer = StrDup(sprinter);
1449 if (sprintCmd == "")
1450#ifndef WIN32
1451 printCmd = StrDup(gEnv->GetValue("Print.Command", ""));
1452#else
1453 printCmd = StrDup(gEnv->GetValue("Print.Command", "start AcroRd32.exe /p"));
1454#endif
1455 else
1456 printCmd = StrDup(sprintCmd);
1457
1458 new TGPrintDialog(fClient->GetDefaultRoot(), this, 400, 150,
1459 &printer, &printCmd, &ret);
1460 if (ret) {
1461 sprinter = printer;
1462 sprintCmd = printCmd;
1463
1464 if (sprinter == "")
1465 pname = kFALSE;
1466
1467 TString fn = "rootprint";
1468 FILE *f = gSystem->TempFileName(fn, gEnv->GetValue("Print.Directory", gSystem->TempDirectory()));
1469 if (f) fclose(f);
1470 fn += TString::Format(".%s",gEnv->GetValue("Print.FileType", "pdf"));
1471 fCanvas->Print(fn);
1472
1473 TString cmd = sprintCmd;
1474 if (cmd.Contains("%p"))
1475 cmd.ReplaceAll("%p", sprinter);
1476 else if (pname) {
1477 cmd += " "; cmd += sprinter; cmd += " ";
1478 }
1479
1480 if (cmd.Contains("%f"))
1481 cmd.ReplaceAll("%f", fn);
1482 else {
1483 cmd += " "; cmd += fn; cmd += " ";
1484 }
1485
1486 gSystem->Exec(cmd);
1487#ifndef WIN32
1488 gSystem->Unlink(fn);
1489#endif
1490 }
1491 delete [] printer;
1492 delete [] printCmd;
1493}
1494
1495////////////////////////////////////////////////////////////////////////////////
1496/// Display a tooltip with infos about the primitive below the cursor.
1497
1499{
1500 fToolTip->Hide();
1501 if (!fCanvas->GetShowToolTips() || selected == 0 ||
1502 event != kMouseMotion || fButton != 0)
1503 return;
1504 TString tipInfo;
1505 TString objInfo = selected->GetObjectInfo(px, py);
1506 if (objInfo.BeginsWith("-")) {
1507 // if the string begins with '-', display only the object info
1508 objInfo.Remove(TString::kLeading, '-');
1509 tipInfo = objInfo;
1510 }
1511 else {
1512 const char *title = selected->GetTitle();
1513 tipInfo += TString::Format("%s::%s", selected->ClassName(),
1514 selected->GetName());
1515 if (title && strlen(title))
1516 tipInfo += TString::Format("\n%s", selected->GetTitle());
1517 tipInfo += TString::Format("\n%d, %d", px, py);
1518 if (!objInfo.IsNull())
1519 tipInfo += TString::Format("\n%s", objInfo.Data());
1520 }
1521 fToolTip->SetText(tipInfo.Data());
1522 fToolTip->SetPosition(px+15, py+15);
1523 fToolTip->Reset();
1524}
1525
1526////////////////////////////////////////////////////////////////////////////////
1527/// Show or hide menubar.
1528
1530{
1531 if (show) ShowFrame(fMenuBar);
1532 else HideFrame(fMenuBar);
1533}
1534
1535////////////////////////////////////////////////////////////////////////////////
1536/// Show or hide statusbar.
1537
1539{
1542
1543 UInt_t h = GetHeight();
1544 UInt_t sh = fStatusBar->GetHeight()+2;
1545
1546 if (show) {
1549 if (dh - ch >= sh) h = h + sh;
1550 else h = ch;
1551 } else {
1554 if (dh - ch < sh) h = ch;
1555 else h = h - sh;
1556 }
1557 Resize(GetWidth(), h);
1558}
1559
1560////////////////////////////////////////////////////////////////////////////////
1561/// Show or hide side frame.
1562
1564{
1566
1567 UInt_t w = GetWidth();
1569 UInt_t h = GetHeight();
1571
1572 auto lambda_show = [&, this]() {
1573 if (show) {
1574 if (!fEditor)
1575 CreateEditor();
1577 if (gged && gged->GetCanvas() == fCanvas) {
1578 gged->Hide();
1579 }
1582 h += s;
1583 }
1585 fEditor->Show();
1587 w += e;
1588 } else {
1591 h -= s;
1592 }
1593 if (fEditor)
1594 fEditor->Hide();
1597 w -= e;
1598 }
1599 };
1600
1601 if (fParent && fParent != fClient->GetDefaultRoot()) {
1604 if (main && main->InheritsFrom("TRootBrowser")) {
1605 TRootBrowser *browser = (TRootBrowser *)main;
1606 if (!fEmbedded)
1607 browser->GetTabRight()->Connect("Selected(Int_t)", "TRootCanvas",
1608 this, "Activated(Int_t)");
1609 fEmbedded = kTRUE;
1610 if (show && (!fEditor || !((TGedEditor *)fEditor)->IsMapped())) {
1611 if (!browser->GetTabLeft()->GetTabTab("Pad Editor")) {
1612 if (browser->GetActFrame()) { //already in edit mode
1613 TTimer::SingleShot(200, "TRootCanvas", this, "ShowEditor(=kTRUE)");
1614 } else {
1616 if (!fEditor)
1618 else {
1619 ((TGedEditor *)fEditor)->ReparentWindow(fClient->GetRoot());
1620 ((TGedEditor *)fEditor)->MapWindow();
1621 }
1622 browser->StopEmbedding("Pad Editor");
1623 if (fEditor) {
1625 gROOT->GetListOfCleanups()->Remove((TGedEditor *)fEditor);
1626 ((TGedEditor *)fEditor)->SetCanvas(fCanvas);
1627 ((TGedEditor *)fEditor)->SetModel(fCanvas, fCanvas, kButton1Down);
1628 }
1629 }
1630 }
1631 else
1633 }
1634 if (show) browser->GetTabLeft()->SetTab("Pad Editor");
1635 } else {
1636 lambda_show();
1637 main->Layout();
1638 }
1639 }
1640 else {
1641 lambda_show();
1642 Resize(w, h);
1643 }
1644}
1645
1646////////////////////////////////////////////////////////////////////////////////
1647/// Create embedded editor.
1648
1650{
1653 gPad = Canvas();
1654 // next two lines are related to the old editor
1655 Int_t show = gEnv->GetValue("Canvas.ShowEditor", 0);
1656 gEnv->SetValue("Canvas.ShowEditor","true");
1661
1662 // next line is related to the old editor
1663 if (show == 0) gEnv->SetValue("Canvas.ShowEditor","false");
1664}
1665
1666////////////////////////////////////////////////////////////////////////////////
1667/// Show or hide toolbar.
1668
1670{
1671 if (show && !fToolBar) {
1672
1675
1676 Int_t spacing = 6, i;
1677 for (i = 0; gToolBarData[i].fPixmap; i++) {
1678 if (strlen(gToolBarData[i].fPixmap) == 0) {
1679 spacing = 6;
1680 continue;
1681 }
1682 fToolBar->AddButton(this, &gToolBarData[i], spacing);
1683 spacing = 0;
1684 }
1691
1692 spacing = 6;
1693 for (i = 0; gToolBarData1[i].fPixmap; i++) {
1694 if (strlen(gToolBarData1[i].fPixmap) == 0) {
1695 spacing = 6;
1696 continue;
1697 }
1698 fToolBar->AddButton(this, &gToolBarData1[i], spacing);
1699 spacing = 0;
1700 }
1702 fToolDock->Layout();
1704 fToolDock->Connect("Docked()", "TRootCanvas", this, "AdjustSize()");
1705 fToolDock->Connect("Undocked()", "TRootCanvas", this, "AdjustSize()");
1706 }
1707
1708 if (!fToolBar) return;
1709
1710 UInt_t h = GetHeight();
1712 UInt_t dh = fToolBar->GetHeight();
1713
1714 if (show) {
1718 h = h + sh;
1719 }
1722 h = h + dh + sh;
1723 } else {
1724 if (fToolDock->IsUndocked()) {
1726 h = h + 2*sh;
1727 } else h = h - dh;
1728
1732 h = h - sh;
1733 }
1735 h = h - sh;
1737 }
1738 Resize(GetWidth(), h);
1739}
1740
1741////////////////////////////////////////////////////////////////////////////////
1742/// Enable or disable tooltip info.
1743
1745{
1746 if (show)
1748 else
1750}
1751
1752////////////////////////////////////////////////////////////////////////////////
1753/// Returns kTRUE if the editor is shown.
1754
1759
1760////////////////////////////////////////////////////////////////////////////////
1761/// Returns kTRUE if the menu bar is shown.
1762
1764{
1765 return (fMenuBar) && fMenuBar->IsMapped();
1766}
1767
1768////////////////////////////////////////////////////////////////////////////////
1769/// Returns kTRUE if the status bar is shown.
1770
1772{
1773 return (fStatusBar) && fStatusBar->IsMapped();
1774}
1775
1776////////////////////////////////////////////////////////////////////////////////
1777/// Returns kTRUE if the tool bar is shown.
1778
1780{
1781 return (fToolBar) && fToolBar->IsMapped();
1782}
1783
1784////////////////////////////////////////////////////////////////////////////////
1785/// Returns kTRUE if the tooltips are enabled.
1786
1788{
1789 return (fCanvas) && fCanvas->GetShowToolTips();
1790}
1791
1792////////////////////////////////////////////////////////////////////////////////
1793/// Keep the same canvas size while docking/undocking toolbar.
1794
1796{
1797 UInt_t h = GetHeight();
1798 UInt_t dh = fToolBar->GetHeight();
1800
1801 if (fToolDock->IsUndocked()) {
1804 h = h - sh;
1805 }
1807 h = h - dh - sh;
1808 } else {
1811 h = h + sh;
1812 }
1814 h = h + dh + sh;
1815 }
1816 Resize(GetWidth(), h);
1817}
1818
1819////////////////////////////////////////////////////////////////////////////////
1820/// Handle mouse button events in the canvas container.
1821
1823{
1824 Int_t button = event->fCode;
1825 Int_t x = event->fX;
1826 Int_t y = event->fY;
1827
1828 if (event->fType == kButtonPress) {
1829 if (fToolTip && fCanvas->GetShowToolTips()) {
1830 fToolTip->Hide();
1831 // do not sync GL canvas - avoid flicking
1832 if (!fCanvas->UseGL() && (fCanvasID != -1)) {
1833 gVirtualX->UpdateWindowW(gVirtualX->GetWindowContext(fCanvasID), 0);
1835 }
1836 }
1837 fButton = button;
1838 if (button == kButton1) {
1839 if (event->fState & kKeyShiftMask)
1841 else
1843 }
1844 if (button == kButton2)
1846 if (button == kButton3) {
1848 fButton = 0; // button up is consumed by TContextMenu
1849 }
1850
1851 } else if (event->fType == kButtonRelease) {
1852 if (button == kButton4)
1854 if (button == kButton5)
1856 if (button == kButton1)
1858 if (button == kButton2)
1860 if (button == kButton3)
1862
1863 fButton = 0;
1864 }
1865
1866 return kTRUE;
1867}
1868
1869////////////////////////////////////////////////////////////////////////////////
1870/// Handle mouse button double click events in the canvas container.
1871
1873{
1874 Int_t button = event->fCode;
1875 Int_t x = event->fX;
1876 Int_t y = event->fY;
1877
1878 if (button == kButton1)
1880 if (button == kButton2)
1882 if (button == kButton3)
1884
1885 return kTRUE;
1886}
1887
1888////////////////////////////////////////////////////////////////////////////////
1889/// Handle configure (i.e. resize) event.
1890
1892{
1893 if (fAutoFit) {
1894 fCanvas->Resize();
1895 fCanvas->Update();
1896 }
1897
1899 // get menu height
1900 static Int_t dh = 0;
1901 if (!dh)
1904 fCanvas->GetAspectRatio()) + dh;
1906 }
1907 return kTRUE;
1908}
1909
1910////////////////////////////////////////////////////////////////////////////////
1911/// Handle keyboard events in the canvas container.
1912
1914{
1915 static EGEventType previous_event = kOtherEvent;
1916 static UInt_t previous_keysym = 0;
1917
1918 if (event->fType == kGKeyPress) {
1919 fButton = event->fCode;
1920 UInt_t keysym;
1921 char str[2];
1922 gVirtualX->LookupString(event, str, sizeof(str), keysym);
1923
1924 if (str[0] == kESC){ // ESC sets the escape flag
1925 gROOT->SetEscape();
1928 gPad->Modified();
1929 return kTRUE;
1930 }
1931 if (str[0] == 3) // ctrl-c sets the interrupt flag
1932 gROOT->SetInterrupt();
1933
1934 // handle arrow keys
1935 if (keysym > 0x1011 && keysym < 0x1016) {
1936 Window_t dum1, dum2, wid;
1937 UInt_t mask = 0;
1938 Int_t mx, my, tx, ty;
1939 wid = gVirtualX->GetDefaultRootWindow();
1940 gVirtualX->QueryPointer(wid, dum1, dum2, mx, my, mx, my, mask);
1941 gVirtualX->TranslateCoordinates(gClient->GetDefaultRoot()->GetId(),
1943 mx, my, tx, ty, dum1);
1945 // handle case where we got consecutive same keypressed events coming
1946 // from auto-repeat on Windows (as it fires only successive keydown events)
1947 if ((previous_keysym == keysym) && (previous_event == kGKeyPress)) {
1948 switch (keysym) {
1949 case 0x1012: // left
1950 gVirtualX->Warp(--mx, my, wid); --tx;
1951 break;
1952 case 0x1013: // up
1953 gVirtualX->Warp(mx, --my, wid); --ty;
1954 break;
1955 case 0x1014: // right
1956 gVirtualX->Warp(++mx, my, wid); ++tx;
1957 break;
1958 case 0x1015: // down
1959 gVirtualX->Warp(mx, ++my, wid); ++ty;
1960 break;
1961 default:
1962 break;
1963 }
1965 }
1966 previous_keysym = keysym;
1967 }
1968 else {
1969 fCanvas->HandleInput(kKeyPress, str[0], keysym);
1970 }
1971 } else if (event->fType == kKeyRelease) {
1972 UInt_t keysym;
1973 char str[2];
1974 gVirtualX->LookupString(event, str, sizeof(str), keysym);
1975
1976 if (keysym > 0x1011 && keysym < 0x1016) {
1977 Window_t dum1, dum2, wid;
1978 UInt_t mask = 0;
1979 Int_t mx, my, tx, ty;
1980 wid = gVirtualX->GetDefaultRootWindow();
1981 gVirtualX->QueryPointer(wid, dum1, dum2, mx, my, mx, my, mask);
1982 switch (keysym) {
1983 case 0x1012: // left
1984 gVirtualX->Warp(--mx, my, wid);
1985 break;
1986 case 0x1013: // up
1987 gVirtualX->Warp(mx, --my, wid);
1988 break;
1989 case 0x1014: // right
1990 gVirtualX->Warp(++mx, my, wid);
1991 break;
1992 case 0x1015: // down
1993 gVirtualX->Warp(mx, ++my, wid);
1994 break;
1995 default:
1996 break;
1997 }
1998 gVirtualX->TranslateCoordinates(gClient->GetDefaultRoot()->GetId(),
2000 mx, my, tx, ty, dum1);
2002 previous_keysym = keysym;
2003 }
2004 fButton = 0;
2005 }
2006 previous_event = event->fType;
2007 return kTRUE;
2008}
2009
2010////////////////////////////////////////////////////////////////////////////////
2011/// Handle mouse motion event in the canvas container.
2012
2014{
2015 Int_t x = event->fX;
2016 Int_t y = event->fY;
2017
2018 if (fButton == 0)
2020 if (fButton == kButton1) {
2021 if (event->fState & kKeyShiftMask)
2023 else
2025 }
2026 if (fButton == kButton2)
2028
2029 return kTRUE;
2030}
2031
2032////////////////////////////////////////////////////////////////////////////////
2033/// Handle expose events.
2034
2036{
2037 if (event->fCount == 0) {
2038 fCanvas->Flush();
2039 }
2040
2041 return kTRUE;
2042}
2043
2044////////////////////////////////////////////////////////////////////////////////
2045/// Handle enter/leave events. Only leave is activated at the moment.
2046
2048{
2049 Int_t x = event->fX;
2050 Int_t y = event->fY;
2051
2052 // pointer grabs create also an enter and leave event but with fCode
2053 // either kNotifyGrab or kNotifyUngrab, don't propagate these events
2054 if (event->fType == kLeaveNotify && event->fCode == kNotifyNormal)
2056
2057 if (event->fType == kEnterNotify && event->fCode == kNotifyNormal)
2059
2060 return kTRUE;
2061}
2062
2063////////////////////////////////////////////////////////////////////////////////
2064/// Handle drop events.
2065
2067{
2068 static Atom_t rootObj = gVirtualX->InternAtom("application/root", kFALSE);
2069 static Atom_t uriObj = gVirtualX->InternAtom("text/uri-list", kFALSE);
2070
2071 if (data->fDataType == rootObj) {
2072 TBufferFile buf(TBuffer::kRead, data->fDataLength, (void *)data->fData);
2073 buf.SetReadMode();
2075 if (!obj) return kTRUE;
2076 gPad->Clear();
2077 if (obj->InheritsFrom("TKey")) {
2078 TObject *object = (TObject *)gROOT->ProcessLine(TString::Format("((TKey *)0x%zx)->ReadObj();", (size_t)obj));
2079 if (!object) return kTRUE;
2080 if (object->InheritsFrom("TGraph"))
2081 object->Draw("ALP");
2082 else if (object->InheritsFrom("TImage"))
2083 object->Draw("x");
2084 else if (object->IsA()->GetMethodAllAny("Draw"))
2085 object->Draw();
2086 }
2087 else if (obj->InheritsFrom("TGraph"))
2088 obj->Draw("ALP");
2089 else if (obj->IsA()->GetMethodAllAny("Draw"))
2090 obj->Draw();
2091 gPad->Modified();
2092 gPad->Update();
2093 return kTRUE;
2094 }
2095 else if (data->fDataType == uriObj) {
2096 TString sfname((char *)data->fData);
2097 if (sfname.Length() > 7) {
2098 sfname.ReplaceAll("\r\n", "");
2099 TUrl uri(sfname.Data());
2100 if (sfname.EndsWith(".bmp") ||
2101 sfname.EndsWith(".gif") ||
2102 sfname.EndsWith(".jpg") ||
2103 sfname.EndsWith(".png") ||
2104 sfname.EndsWith(".ps") ||
2105 sfname.EndsWith(".eps") ||
2106 sfname.EndsWith(".pdf") ||
2107 sfname.EndsWith(".tiff") ||
2108 sfname.EndsWith(".xpm")) {
2109 TImage *img = TImage::Open(uri.GetFile());
2110 if (img) {
2111 img->Draw("x");
2112 img->SetEditable(kTRUE);
2113 }
2114 }
2115 gPad->Modified();
2116 gPad->Update();
2117 }
2118 }
2119 return kFALSE;
2120}
2121
2122////////////////////////////////////////////////////////////////////////////////
2123/// Handle dragging position events.
2124
2126 Int_t /*xroot*/, Int_t /*yroot*/)
2127{
2128 TPad *pad = fCanvas->Pick(x, y, 0);
2129 if (pad) {
2130 pad->cd();
2131 gROOT->SetSelectedPad(pad);
2132 // make sure the pad is highlighted (on Windows)
2133 pad->Update();
2134 }
2135 return action;
2136}
2137
2138////////////////////////////////////////////////////////////////////////////////
2139/// Handle drag enter events.
2140
2142{
2143 static Atom_t rootObj = gVirtualX->InternAtom("application/root", kFALSE);
2144 static Atom_t uriObj = gVirtualX->InternAtom("text/uri-list", kFALSE);
2145 Atom_t ret = kNone;
2146 for (int i = 0; typelist[i] != kNone; ++i) {
2147 if (typelist[i] == rootObj)
2148 ret = rootObj;
2149 if (typelist[i] == uriObj)
2150 ret = uriObj;
2151 }
2152 return ret;
2153}
2154
2155////////////////////////////////////////////////////////////////////////////////
2156/// Handle drag leave events.
2157
2159{
2160 return kTRUE;
2161}
2162
2163////////////////////////////////////////////////////////////////////////////////
2164/// Slot handling tab switching in the browser, to properly set the canvas
2165/// and the model to the editor.
2166
2168{
2169 if (fEmbedded) {
2170 TGTab *sender = (TGTab *)gTQSender;
2171 if (sender) {
2172 TGCompositeFrame *cont = sender->GetTabContainer(id);
2173 if (cont == fParent) {
2174 if (!fEditor)
2176 if (fEditor && ((TGedEditor *)fEditor)->IsMapped()) {
2177 ((TGedEditor *)fEditor)->SetCanvas(fCanvas);
2178 ((TGedEditor *)fEditor)->SetModel(fCanvas, fCanvas, kButton1Down);
2179 }
2180 }
2181 }
2182 }
2183}
2184
2185////////////////////////////////////////////////////////////////////////////////
2186/// Update the "View With" submenu based on the currently selected pad content.
2187
2189{
2190 TVirtualPad *pad = fCanvas ? fCanvas->GetSelectedPad() : nullptr;
2191 if (!pad)
2192 pad = fCanvas;
2193
2194 if (PadHasGeometryContent(pad))
2196 else
2198}
2199
2200
2201////////////////////////////////////////////////////////////////////////////////
2202/// Update canvas display
2203
2205{
2206 if (gVirtualX)
2207 gVirtualX->Update(mode % 100);
2208
2209 if (mode == 101) {
2210 // used by TGLPadPainter
2211 // when requesting window atributes sync works better
2212 // workaround for issue #22157
2213 WindowAttributes_t attributes;
2214 gVirtualX->GetWindowAttributes(GetMainFrame()->GetId(), attributes);
2215 }
2216
2217 if (sleep)
2218 gSystem->Sleep(30);
2219}
2220
2221////////////////////////////////////////////////////////////////////////////////
2222/// Save a canvas container as a C++ statement(s) on output stream out.
2223
2224void TRootContainer::SavePrimitive(std::ostream &out, Option_t * /*= ""*/)
2225{
2226 out << "\n // canvas container\n";
2227 out << " Int_t canvasID = gVirtualX->InitWindow((ULongptr_t)" << GetParent()->GetParent()->GetName()
2228 << "->GetId());\n";
2229 out << " Window_t winC = gVirtualX->GetWindowID(canvasID);\n";
2230 out << " TGCompositeFrame *" << GetName() << " = new TGCompositeFrame(gClient, winC, " << GetParent()->GetName()
2231 << ");\n";
2232}
2233
2234
2235////////////////////////////////////////////////////////////////////////////////
2236/// Create pad painter instance
2237
2242
EEventType
Definition Buttons.h:15
@ kMouseMotion
Definition Buttons.h:23
@ kWheelUp
Definition Buttons.h:18
@ kButton3Up
Definition Buttons.h:19
@ kButton2Motion
Definition Buttons.h:20
@ kButton3Down
Definition Buttons.h:17
@ kButton2Down
Definition Buttons.h:17
@ kKeyPress
Definition Buttons.h:20
@ kButton2Double
Definition Buttons.h:24
@ kArrowKeyRelease
Definition Buttons.h:21
@ kButton1Double
Definition Buttons.h:24
@ kButton3Double
Definition Buttons.h:24
@ kButton1Shift
Definition Buttons.h:18
@ kButton1Motion
Definition Buttons.h:20
@ kButton1Up
Definition Buttons.h:19
@ kWheelDown
Definition Buttons.h:18
@ kArrowKeyPress
Definition Buttons.h:21
@ kButton2Up
Definition Buttons.h:19
@ kMouseLeave
Definition Buttons.h:23
@ kButton1Down
Definition Buttons.h:17
@ kESC
Definition Buttons.h:22
@ kMouseEnter
Definition Buttons.h:23
Handle_t Atom_t
WM token.
Definition GuiTypes.h:38
EGEventType
Definition GuiTypes.h:60
@ kGKeyPress
Definition GuiTypes.h:61
@ kButtonRelease
Definition GuiTypes.h:61
@ kButtonPress
Definition GuiTypes.h:61
@ kEnterNotify
Definition GuiTypes.h:62
@ kOtherEvent
Definition GuiTypes.h:65
@ kKeyRelease
Definition GuiTypes.h:61
@ kLeaveNotify
Definition GuiTypes.h:62
ECursor
Definition GuiTypes.h:373
const Mask_t kButtonPressMask
Definition GuiTypes.h:162
@ kNotifyNormal
Definition GuiTypes.h:220
const Mask_t kExposureMask
Definition GuiTypes.h:166
Handle_t Window_t
Window handle.
Definition GuiTypes.h:29
const Mask_t kKeyReleaseMask
Definition GuiTypes.h:161
const Mask_t kAnyModifier
Definition GuiTypes.h:211
const Mask_t kKeyPressMask
Definition GuiTypes.h:160
const Mask_t kPointerMotionMask
Definition GuiTypes.h:164
const Mask_t kKeyShiftMask
Definition GuiTypes.h:196
@ kSunkenFrame
Definition GuiTypes.h:384
@ kDoubleBorder
Definition GuiTypes.h:386
@ kFixedWidth
Definition GuiTypes.h:388
@ kHorizontalFrame
Definition GuiTypes.h:383
@ kFixedSize
Definition GuiTypes.h:391
const Handle_t kNone
Definition GuiTypes.h:89
const Mask_t kLeaveWindowMask
Definition GuiTypes.h:169
const Mask_t kStructureNotifyMask
Definition GuiTypes.h:167
const Mask_t kButtonReleaseMask
Definition GuiTypes.h:163
const Mask_t kEnterWindowMask
Definition GuiTypes.h:168
@ kButton4
Definition GuiTypes.h:216
@ kButton2
Definition GuiTypes.h:215
@ kButton5
Definition GuiTypes.h:216
@ kButton3
Definition GuiTypes.h:215
@ kButton1
Definition GuiTypes.h:215
@ kAnyButton
Definition GuiTypes.h:215
R__EXTERN const char gHelpObjects[]
Definition HelpText.h:26
R__EXTERN const char gHelpPullDownMenus[]
Definition HelpText.h:24
R__EXTERN const char gHelpAbout[]
Definition HelpText.h:17
R__EXTERN const char gHelpGraphicsEditor[]
Definition HelpText.h:23
R__EXTERN const char gHelpCanvas[]
Definition HelpText.h:25
R__EXTERN const char gHelpBrowser[]
Definition HelpText.h:18
R__EXTERN const char gHelpPostscript[]
Definition HelpText.h:21
#define b(i)
Definition RSha256.hxx:100
#define f(i)
Definition RSha256.hxx:104
#define c(i)
Definition RSha256.hxx:101
#define h(i)
Definition RSha256.hxx:106
#define e(i)
Definition RSha256.hxx:103
cudaEvent_t event
long Longptr_t
Integer large enough to hold a pointer (platform-dependent)
Definition RtypesCore.h:90
unsigned long ULongptr_t
Unsigned integer large enough to hold a pointer (platform-dependent)
Definition RtypesCore.h:91
constexpr Bool_t kFALSE
Definition RtypesCore.h:109
constexpr Ssiz_t kNPOS
The equivalent of std::string::npos for the ROOT class TString.
Definition RtypesCore.h:132
constexpr Bool_t kTRUE
Definition RtypesCore.h:108
const char Option_t
Option string (const char)
Definition RtypesCore.h:81
R__EXTERN TApplication * gApplication
R__EXTERN TEnv * gEnv
Definition TEnv.h:126
constexpr Int_t kFatal
Definition TError.h:50
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:208
Int_t gErrorIgnoreLevel
errors with level below this value will be ignored. Default is kUnset.
Definition TError.cxx:33
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Definition TError.cxx:252
#define gClient
Definition TGClient.h:157
@ kFDOpen
@ kFDSave
@ kLHintsRight
Definition TGLayout.h:26
@ kLHintsExpandY
Definition TGLayout.h:31
@ kLHintsLeft
Definition TGLayout.h:24
@ kLHintsBottom
Definition TGLayout.h:29
@ kLHintsTop
Definition TGLayout.h:27
@ kLHintsExpandX
Definition TGLayout.h:30
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t mask
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void SetIconPixmap
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t cursor
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize wid
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t win
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void SetWMPosition
Option_t Option_t TPoint TPoint const char mode
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t Atom_t typelist
Option_t Option_t width
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t button
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char mx
char name[80]
Definition TGX11.cxx:142
R__EXTERN C unsigned int sleep(unsigned int seconds)
R__EXTERN void * gTQSender
Definition TQObject.h:46
#define gROOT
Definition TROOT.h:417
@ kFilePrint
@ kHelpOnCanvas
@ kFileSaveAs
@ kFileQuit
@ kHelpOnGraphicsEd
@ kFileNewCanvas
@ kHelpOnObjects
@ kHelpOnBrowser
@ kHelpOnMenus
@ kHelpOnPS
@ kHelpAbout
@ kFileOpen
static ToolBarData_t gToolBarData[]
static const char * gOpenTypes[]
ERootCanvasCommands
@ kOptionInterrupt
@ kToolLatex
@ kFitPanel
@ kToolsBuilder
@ kToolPLabel
@ kEditStyle
@ kOptionCanEdit
@ kOptionResizeOpaque
@ kEditClearCanvas
@ kToolPad
@ kFilePrint
@ kViewOpenGL
@ kEditRedo
@ kHelpOnCanvas
@ kToolDiamond
@ kToolCurlyLine
@ kViewFonts
@ kToolLine
@ kFileSaveAsPDF
@ kViewIconify
@ kFileCloseCanvas
@ kViewX3D
@ kFileSaveAs
@ kToolEllipse
@ kToolPsText
@ kToolModify
@ kFileSaveAsGIF
@ kFileQuit
@ kToolArrow
@ kToolArc
@ kToolsRecorder
@ kToolsBrowser
@ kOptionResizeCanvas
@ kToolPave
@ kHelpOnGraphicsEd
@ kFileNewCanvas
@ kOptionFitParams
@ kOptionRefresh
@ kHelpOnObjects
@ kEditCopy
@ kFileSaveAsEPS
@ kInspectRoot
@ kViewToolTips
@ kOptionMoveOpaque
@ kViewEditor
@ kHelpOnBrowser
@ kClassesTree
@ kToolPText
@ kViewToolbar
@ kOptionAutoExec
@ kHelpOnMenus
@ kEditUndo
@ kHelpOnPS
@ kFileSaveAsPNG
@ kViewMarkers
@ kEditClearPad
@ kToolCurlyArc
@ kEditCut
@ kFileSaveAsC
@ kViewColors
@ kToolGraph
@ kViewEventStatus
@ kFileSaveAsBMP
@ kFileSaveAsPS
@ kOptionStatistics
@ kFileSaveAsJPG
@ kOptionHistTitle
@ kFileSaveAsSVG
@ kFileSaveAsHTML
@ kFileSaveAsTEX
@ kHelpAbout
@ kToolCutG
@ kToolMarker
@ kFileSaveAsRoot
@ kFileOpen
@ kEditPaste
@ kOptionAutoResize
static const char * gSaveAsTypes[]
static ToolBarData_t gToolBarData1[]
static ToolBarData_t gToolBarData[]
static const char * gOpenTypes[]
char * StrDup(const char *str)
Duplicate the string str.
Definition TString.cxx:2639
R__EXTERN TStyle * gStyle
Definition TStyle.h:442
R__EXTERN TSystem * gSystem
Definition TSystem.h:582
#define gGLManager
Definition TVirtualGL.h:158
#define gPad
R__EXTERN Int_t(* gThreadXAR)(const char *xact, Int_t nb, void **ar, Int_t *iret)
#define gVirtualX
Definition TVirtualX.h:379
Int_t GET_MSG(Long_t val)
@ kCM_MENU
@ kC_COMMAND
@ kCM_BUTTON
Int_t GET_SUBMSG(Long_t val)
Bool_t ReturnFromRun() const
virtual void Terminate(Int_t status=0)
Terminate the application by call TSystem::Exit() unless application has been told to return from Run...
Using a TBrowser one can browse all ROOT objects.
Definition TBrowser.h:37
The concrete implementation of TBuffer for writing/reading to/from a ROOT file or socket.
Definition TBufferFile.h:47
void * ReadObjectAny(const TClass *cast) override
Read object from I/O buffer.
@ kRead
Definition TBuffer.h:73
void SetReadMode()
Set buffer in read mode.
Definition TBuffer.cxx:301
ABC describing GUI independent main window (with menubar, scrollbars and a drawing area).
Definition TCanvasImp.h:31
TCanvas * Canvas() const
Definition TCanvasImp.h:59
TCanvas * fCanvas
Definition TCanvasImp.h:35
friend class TCanvas
Definition TCanvasImp.h:32
The Canvas class.
Definition TCanvas.h:23
UInt_t GetWindowHeight() const
Definition TCanvas.h:167
virtual void ToggleAutoExec()
Toggle pad auto execution of list of TExecs.
Definition TCanvas.cxx:2450
virtual void ToggleToolTips()
Toggle tooltip display.
Definition TCanvas.cxx:2492
void Clear(Option_t *option="") override
Remove all primitives from the canvas.
Definition TCanvas.cxx:750
virtual void ToggleEventStatus()
Toggle event statusbar.
Definition TCanvas.cxx:2459
void SetSupportGL(Bool_t support)
Definition TCanvas.h:236
TPad * Pick(Int_t px, Int_t py, TObjLink *&pickobj) override
Search for an object at pixel position px,py.
Definition TCanvas.h:190
virtual void Resize(Option_t *option="")
Recompute canvas parameters following a X11 Resize.
Definition TCanvas.cxx:1688
void SaveSource(const char *filename="", Option_t *option="")
Save primitives in this canvas as a C++ macro file.
Definition TCanvas.cxx:1834
void SetCanvasImp(TCanvasImp *i)
Set canvas implementation If web-based implementation provided, some internal fields also initialized...
Definition TCanvas.cxx:2183
virtual void HandleInput(EEventType button, Int_t x, Int_t y)
Handle Input Events.
Definition TCanvas.cxx:1241
TVirtualPad * cd(Int_t subpadnumber=0) override
Set current canvas & pad.
Definition TCanvas.cxx:732
Bool_t GetShowEditor() const
Definition TCanvas.h:155
Bool_t GetAutoExec() const
Definition TCanvas.h:157
virtual void ToggleEditor()
Toggle editor.
Definition TCanvas.cxx:2481
TVirtualPad * GetSelectedPad() const override
Definition TCanvas.h:151
Bool_t GetShowToolTips() const
Definition TCanvas.h:156
void SetName(const char *name="") override
Set canvas name.
Definition TCanvas.cxx:2045
void Paint(Option_t *option="") override
Paint canvas.
Definition TCanvas.cxx:1563
void Update() override
Update canvas pad buffers.
Definition TCanvas.cxx:2519
Bool_t OpaqueMoving() const override
Definition TCanvas.h:187
void Flush()
Flush canvas buffers.
Definition TCanvas.cxx:1154
void MoveOpaque(Int_t set=1)
Set option to move objects/pads in a canvas.
Definition TCanvas.cxx:1555
Bool_t UseGL() const
Definition TCanvas.h:235
void ResizeOpaque(Int_t set=1)
Set option to resize objects/pads in a canvas.
Definition TCanvas.cxx:1781
virtual void ToggleToolBar()
Toggle toolbar.
Definition TCanvas.cxx:2470
Bool_t OpaqueResizing() const override
Definition TCanvas.h:188
Draw inheritance tree and their relations for a list of classes.
Definition TClassTree.h:22
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:84
TMethod * GetMethodAllAny(const char *method)
Return pointer to method without looking at parameters.
Definition TClass.cxx:4505
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Definition TClass.cxx:2999
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Draw the ROOT Color Wheel.
Definition TColorWheel.h:23
void Draw(Option_t *option="") override
Paint the color wheel.
Drag and drop data container.
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
Definition TEnv.cxx:511
virtual void SetValue(const char *name, const char *value, EEnvLevel level=kEnvChange, const char *type=nullptr)
Set the value of a resource or create a new resource.
Definition TEnv.cxx:753
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
Definition TFile.cxx:3802
A frame containing two scrollbars (a horizontal and a vertical) and a viewport.
Definition TGCanvas.h:192
virtual void SetContainer(TGFrame *f)
Definition TGCanvas.h:222
virtual void SetVsbPosition(Int_t newPos)
Set position of vertical scrollbar.
virtual Int_t GetVsbPosition() const
Get position of vertical scrollbar.
TGViewPort * GetViewPort() const
Definition TGCanvas.h:217
const TGWindow * GetDefaultRoot() const
Returns the root (i.e.
Definition TGClient.cxx:234
const TGWindow * GetRoot() const
Returns current root (i.e.
Definition TGClient.cxx:224
UInt_t GetDisplayHeight() const
Get display height.
Definition TGClient.cxx:275
The base class for composite widgets (menu bars, list boxes, etc.).
Definition TGFrame.h:289
TGDimension GetDefaultSize() const override
std::cout << fWidth << "x" << fHeight << std::endl;
Definition TGFrame.h:318
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1111
Int_t MustCleanup() const override
Definition TGFrame.h:362
void MapSubwindows() override
Map all sub windows that are part of the composite frame.
Definition TGFrame.cxx:1158
TGCompositeFrame(const TGCompositeFrame &)=delete
void Layout() override
Layout the elements of the composite frame.
Definition TGFrame.cxx:1251
virtual void ShowFrame(TGFrame *f)
Show sub frame.
Definition TGFrame.cxx:1198
void SetCleanup(Int_t mode=kLocalCleanup) override
Turn on automatic cleanup of child frames in dtor.
Definition TGFrame.cxx:1066
void SetEditable(Bool_t on=kTRUE) override
Switch ON/OFF edit mode.
Definition TGFrame.cxx:942
void SetEditDisabled(UInt_t on=1) override
Set edit disable flag for this frame and subframes.
Definition TGFrame.cxx:1016
void ChangeOptions(UInt_t options) override
Change composite frame options. Options is an OR of the EFrameTypes.
Definition TGFrame.cxx:1037
virtual void HideFrame(TGFrame *f)
Hide sub frame.
Definition TGFrame.cxx:1184
A frame with handles that allow it to be undocked (i.e.
void DockContainer(Int_t del=kTRUE)
Dock container back to TGDockableFrame.
void AddFrame(TGFrame *f, TGLayoutHints *hints) override
Add frame to dockable frame container. Frame and hints are NOT adopted.
void SetWindowName(const char *name) override
Set window name so it appear as title of the undock window.
void EnableHide(Bool_t onoff)
Enable hiding.
Bool_t IsUndocked() const
System file browser, used as TRootBrowser plug-in.
void Selected(char *)
A ROOT File has been selected in TGFileBrowser.
This class creates a file selection dialog.
char * fFilename
selected file name
Int_t fFileTypeIdx
selected file type, index in fFileTypes
const char ** fFileTypes
file types used to filter selectable files
char * fIniDir
on input: initial directory, on output: new directory
Bool_t fOverwrite
if true overwrite the file with existing name on save
void SetIniDir(const char *inidir)
Set directory name.
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
Definition TGFrame.cxx:333
void MoveResize(Int_t x, Int_t y, UInt_t w=0, UInt_t h=0) override
Move and/or resize the frame.
Definition TGFrame.cxx:623
virtual Bool_t HandleConfigureNotify(Event_t *event)
This event is generated when the frame is resized.
Definition TGFrame.cxx:437
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
Definition TGFrame.cxx:599
void Move(Int_t x, Int_t y) override
Move frame.
Definition TGFrame.cxx:587
virtual void DeleteWindow()
Delete window.
Definition TGFrame.cxx:270
virtual UInt_t GetOptions() const
Definition TGFrame.h:199
UInt_t GetHeight() const
Definition TGFrame.h:227
virtual void SetWidth(UInt_t w)
Definition TGFrame.h:248
void SetDNDTarget(Bool_t onoff)
Definition TGFrame.h:272
UInt_t GetWidth() const
Definition TGFrame.h:226
virtual void SetHeight(UInt_t h)
Definition TGFrame.h:249
A horizontal 3D line is a line that typically separates a toolbar from the menubar.
Definition TG3DLine.h:18
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
Defines top level windows that interact with the system Window Manager.
Definition TGFrame.h:399
Atom_t * fDNDTypeList
handles DND types
Definition TGFrame.h:415
virtual void SendCloseMessage()
Send close message to self.
Definition TGFrame.cxx:1737
void SetClassHints(const char *className, const char *resourceName)
Set the windows class and resource name.
Definition TGFrame.cxx:1851
void SetIconName(const char *name)
Set window icon name. This is typically done via the window manager.
Definition TGFrame.cxx:1794
void SetWindowName(const char *name=nullptr) override
Set window name. This is typically done via the window manager.
Definition TGFrame.cxx:1781
const char * GetWindowName() const
Definition TGFrame.h:478
The TGMenu.h header contains all different menu classes.
Definition TGMenu.h:282
virtual void AddPopup(TGHotString *s, TGPopupMenu *menu, TGLayoutHints *l, TGPopupMenu *before=nullptr)
Add popup menu to menu bar.
Definition TGMenu.cxx:414
TGClient * fClient
Connection to display server.
Definition TGObject.h:25
Handle_t GetId() const
Definition TGObject.h:41
Handle_t fId
X11/Win32 Window identifier.
Definition TGObject.h:24
This class creates a popup menu object.
Definition TGMenu.h:110
virtual void AddLabel(TGHotString *s, const TGPicture *p=nullptr, TGMenuEntry *before=nullptr)
Add a menu label to the menu.
Definition TGMenu.cxx:1092
virtual Bool_t IsEntryChecked(Int_t id)
Return true if menu item is checked.
Definition TGMenu.cxx:1842
virtual void AddPopup(TGHotString *s, TGPopupMenu *popup, TGMenuEntry *before=nullptr, const TGPicture *p=nullptr)
Add a (cascading) popup menu to a popup menu.
Definition TGMenu.cxx:1149
virtual void CheckEntry(Int_t id)
Check a menu entry (i.e. add a check mark in front of it).
Definition TGMenu.cxx:1779
virtual void DisableEntry(Int_t id)
Disable entry (disabled entries appear in a sunken relieve).
Definition TGMenu.cxx:1721
virtual void EnableEntry(Int_t id)
Enable entry. By default entries are enabled.
Definition TGMenu.cxx:1702
virtual void UnCheckEntry(Int_t id)
Uncheck menu entry (i.e. remove check mark).
Definition TGMenu.cxx:1804
virtual void Associate(const TGWindow *w)
Definition TGMenu.h:206
virtual void AddSeparator(TGMenuEntry *before=nullptr)
Add a menu separator to the menu.
Definition TGMenu.cxx:1057
virtual void AddEntry(TGHotString *s, Int_t id, void *ud=nullptr, const TGPicture *p=nullptr, TGMenuEntry *before=nullptr)
Add a menu entry.
Definition TGMenu.cxx:987
Provides a StatusBar widget.
Definition TGStatusBar.h:21
virtual void SetText(TGString *text, Int_t partidx=0)
Set text in partition partidx in status bar.
virtual void SetParts(Int_t npart)
Divide the status bar in npart equal sized parts.
A tab widget contains a set of composite frames each with a little tab with a name (like a set of fol...
Definition TGTab.h:46
TGTabElement * GetTabTab(Int_t tabIndex) const
Return the tab element of tab with index tabIndex.
Definition TGTab.cxx:660
virtual Bool_t SetTab(Int_t tabIndex, Bool_t emit=kTRUE)
Brings the composite frame with the index tabIndex to the front and generate the following event if t...
Definition TGTab.cxx:555
TGCompositeFrame * GetTabContainer(Int_t tabIndex) const
Return container of tab with index tabIndex.
Definition TGTab.cxx:611
A toolbar is a composite frame that contains TGPictureButtons.
Definition TGToolBar.h:33
virtual TGButton * AddButton(const TGWindow *w, ToolBarData_t *button, Int_t spacing=0)
Add button to toolbar.
Definition TGToolBar.cxx:91
void Cleanup() override
Cleanup and delete all objects contained in this composite frame.
A tooltip can be a one or multiple lines help text that is displayed in a window when the mouse curso...
Definition TGToolTip.h:24
void Hide()
Hide tool tip window.
void SetPosition(Int_t x, Int_t y)
Set popup position within specified frame (as specified in the ctor).
void SetText(const char *new_text)
Set new tool tip text.
void Reset()
Reset tool tip popup delay timer.
A vertical 3D line is a line that can be used to separate groups of widgets.
Definition TG3DLine.h:33
ROOT GUI Window base class.
Definition TGWindow.h:23
virtual const TGWindow * GetMainFrame() const
Returns top level main frame.
Definition TGWindow.cxx:153
const TGWindow * fParent
Parent window.
Definition TGWindow.h:28
@ kEditEnable
allow edit of this window
Definition TGWindow.h:56
@ kEditDisable
disable edit of this window
Definition TGWindow.h:57
const TGWindow * GetParent() const
Definition TGWindow.h:83
virtual Bool_t IsMapped()
Returns kTRUE if window is mapped on screen, kFALSE otherwise.
Definition TGWindow.cxx:296
const char * GetName() const override
Return unique name, used in SavePrimitive methods.
Definition TGWindow.cxx:337
UInt_t fEditDisabled
flags used for "guibuilding"
Definition TGWindow.h:32
static TGuiBuilder * Instance()
return an instance of TGuiBuilder object
An abstract interface to image processing library.
Definition TImage.h:30
virtual void SetEditable(Bool_t=kTRUE)
Definition TImage.h:240
static TImage * Open(const char *file, EImageFileTypes type=kUnknown)
Open a specified image file.
Definition TImage.cxx:123
virtual void Option_t *static TImage * Create()
Create an image.
Definition TImage.cxx:34
A doubly linked list.
Definition TList.h:38
TObject * FindObject(const char *name) const override
Find an object in this list using its name.
Definition TList.cxx:708
static void DisplayMarkerTypes()
Display the table of markers with their numbers.
Definition TMarker.cxx:100
Mother of all ROOT objects.
Definition TObject.h:42
virtual void Inspect() const
Dump contents of this object in a graphics canvas.
Definition TObject.cxx:569
static TClass * Class()
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition TObject.cxx:548
virtual TClass * IsA() const
Definition TObject.h:248
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition TObject.cxx:292
Implement TVirtualPadPainter which abstracts painting operations.
The most important graphics class in the ROOT system.
Definition TPad.h:32
Double_t GetAspectRatio() const override
Definition TPad.h:237
void Update() override
Update pad.
Definition TPad.cxx:2811
void Modified(Bool_t flag=true) override
Mark pad modified Will be repainted when TCanvas::Update() will be called next time.
Definition TPad.cxx:7314
Bool_t HasFixedAspectRatio() const override
Definition TPad.h:283
virtual void SetGLDevice(Int_t dev)
Definition TPad.h:384
void SaveAs(const char *filename="", Option_t *option="") const override
Save the pad content in a file.
Definition TPad.cxx:5768
TVirtualPad * cd(Int_t subpadnumber=0) override
Set Current pad.
Definition TPad.cxx:757
void Print(const char *filename="") const override
This method is equivalent to SaveAs("filename"). See TPad::SaveAs for details.
Definition TPad.cxx:4788
Longptr_t ExecPlugin(int nargs)
Int_t LoadPlugin()
Load the plugin library for this handler.
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:865
Bool_t Disconnect(const char *signal=nullptr, void *receiver=nullptr, const char *slot=nullptr)
Disconnects signal of this object from slot of receiver.
This class creates a ROOT object browser, constituted by three main tabs.
TGTab * GetTabLeft() const
void StartEmbedding(Int_t pos=kRight, Int_t subpos=-1) override
Start embedding external frame in the tab "pos" and tab element "subpos".
void StopEmbedding(const char *name=nullptr) override
TBrowserImp * GetActBrowser() const
TGFrame * GetActFrame() const
TGTab * GetTabRight() const
This class creates a main window with menubar, scrollbars and a drawing area.
Definition TRootCanvas.h:34
TGToolBar * fToolBar
icon button toolbar
Definition TRootCanvas.h:62
UInt_t GetCwidth() const
Return width of canvas container.
void AdjustSize()
Keep the same canvas size while docking/undocking toolbar.
Bool_t fAutoFit
when true canvas container keeps same size as canvas
Definition TRootCanvas.h:79
TGPopupMenu * fEditMenu
edit menu
Definition TRootCanvas.h:44
friend class TRootContainer
Definition TRootCanvas.h:36
void CreateEditor()
Create embedded editor.
TVirtualPadPainter * CreatePadPainter() override
Create pad painter instance.
Bool_t HasEditor() const override
Returns kTRUE if the editor is shown.
Bool_t HandleContainerKey(Event_t *ev)
Handle keyboard events in the canvas container.
UInt_t GetWindowGeometry(Int_t &x, Int_t &y, UInt_t &w, UInt_t &h) override
Gets the size and position of the window containing the canvas.
void Close() override
Called via TCanvasImp interface by TCanvas.
Bool_t HandleDNDDrop(TDNDData *data) override
Handle drop events.
void Iconify() override
void SetStatusText(const char *txt=nullptr, Int_t partidx=0) override
Set text in status bar.
TGLayoutHints * fMainFrameLayout
layout for main frame
Definition TRootCanvas.h:64
Bool_t HandleContainerButton(Event_t *ev)
Handle mouse button events in the canvas container.
Bool_t HandleContainerCrossing(Event_t *ev)
Handle enter/leave events. Only leave is activated at the moment.
UInt_t GetCheight() const
Return height of canvas container.
TGDockableFrame * fToolDock
dockable frame holding the toolbar
Definition TRootCanvas.h:71
void RaiseWindow() override
Put canvas window on top of the window stack.
void ShowEditor(Bool_t show=kTRUE) override
Show or hide side frame.
Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2) override
Handle menu and other command generated by the user.
void ReallyDelete() override
Really delete the canvas and this GUI.
void ShowMenuBar(Bool_t show=kTRUE) override
Show or hide menubar.
Atom_t HandleDNDEnter(Atom_t *typelist) override
Handle drag enter events.
void ShowStatusBar(Bool_t show=kTRUE) override
Show or hide statusbar.
TGHorizontal3DLine * fHorizontal1
toolbar separator
Definition TRootCanvas.h:67
TGLayoutHints * fEditorLayout
layout for editor frame
Definition TRootCanvas.h:59
TGPopupMenu * fToolsMenu
tools menu
Definition TRootCanvas.h:49
TGLayoutHints * fMenuBarItemLayout
layout hints for menu in menubar
Definition TRootCanvas.h:52
Int_t fCanvasID
index in fWindows array of TGX11
Definition TRootCanvas.h:78
const TGPicture * fIconPic
icon picture
Definition TRootCanvas.h:73
void SetCanvasSize(UInt_t w, UInt_t h) override
Set size of canvas container.
void SetWindowSize(UInt_t w, UInt_t h) override
Set size of canvas (units in pixels).
void PrintCanvas()
Print the canvas.
TRootCanvas(const TRootCanvas &)=delete
void ShowToolBar(Bool_t show=kTRUE) override
Show or hide toolbar.
Bool_t HasToolBar() const override
Returns kTRUE if the tool bar is shown.
void Activated(Int_t id)
Slot handling tab switching in the browser, to properly set the canvas and the model to the editor.
TGHorizontal3DLine * fToolBarSep
toolbar separator
Definition TRootCanvas.h:63
TGPopupMenu * fViewWithMenu
view with... cascade submenu
Definition TRootCanvas.h:47
TGPopupMenu * fEditClearMenu
clear cascade submenu
Definition TRootCanvas.h:45
void ShowToolTips(Bool_t show=kTRUE) override
Enable or disable tooltip info.
Bool_t HasToolTips() const override
Returns kTRUE if the tooltips are enabled.
TRootContainer * fCanvasContainer
container in canvas widget
Definition TRootCanvas.h:40
Bool_t fEmbedded
true if embedded in any other frame (e.g. in the browser)
Definition TRootCanvas.h:77
Bool_t HandleContainerDoubleClick(Event_t *ev)
Handle mouse button double click events in the canvas container.
TGLayoutHints * fHorizontal1Layout
layout hints for separator
Definition TRootCanvas.h:70
TGVertical3DLine * fVertical2
toolbar vertical separator
Definition TRootCanvas.h:66
TGLayoutHints * fMenuBarLayout
menubar layout hints
Definition TRootCanvas.h:51
void FitCanvas()
Fit canvas container to current window size.
Bool_t HandleContainerMotion(Event_t *ev)
Handle mouse motion event in the canvas container.
TGCanvas * fCanvasWindow
canvas widget
Definition TRootCanvas.h:39
TGLayoutHints * fMenuBarHelpLayout
layout hint for help menu in menubar
Definition TRootCanvas.h:53
TGPopupMenu * fViewMenu
view menu
Definition TRootCanvas.h:46
TGStatusBar * fStatusBar
statusbar widget
Definition TRootCanvas.h:55
TGPopupMenu * fOptionMenu
option menu
Definition TRootCanvas.h:48
TGLayoutHints * fDockLayout
layout hints for dockable frame widget
Definition TRootCanvas.h:72
TGPopupMenu * fHelpMenu
help menu
Definition TRootCanvas.h:50
void EventInfo(Int_t event, Int_t px, Int_t py, TObject *selected)
Display a tooltip with infos about the primitive below the cursor.
void CreateCanvas(const char *name)
Create the actual canvas.
TGLayoutHints * fVertical1Layout
layout hints for separator
Definition TRootCanvas.h:68
Bool_t HasStatusBar() const override
Returns kTRUE if the status bar is shown.
void SetCursor(ECursor cursor) override
Set cursor for the canvas.
Bool_t HandleContainerConfigure(Event_t *ev)
Handle configure (i.e. resize) event.
Bool_t HasMenuBar() const override
Returns kTRUE if the menu bar is shown.
TGCompositeFrame * fMainFrame
main frame containing canvas and side frame
Definition TRootCanvas.h:60
Int_t InitWindow() override
Called by TCanvas ctor to get window indetifier.
void UpdateViewWithMenu()
Update the "View With" submenu based on the currently selected pad content.
TGLayoutHints * fVertical2Layout
layout hints for separator
Definition TRootCanvas.h:69
TVirtualPadEditor * fEditor
pointer to currently loaded pad editor
Definition TRootCanvas.h:76
TGMenuBar * fMenuBar
menubar
Definition TRootCanvas.h:41
void SetWindowPosition(Int_t x, Int_t y) override
Set canvas position (units in pixels).
Bool_t HandleContainerExpose(Event_t *ev)
Handle expose events.
void UpdateDisplay(Int_t mode=0, Bool_t sleep=kFALSE) override
Update canvas display.
TGLayoutHints * fCanvasLayout
layout for canvas widget
Definition TRootCanvas.h:54
TGLayoutHints * fToolBarLayout
layout for toolbar widget
Definition TRootCanvas.h:61
Bool_t HandleDNDLeave() override
Handle drag leave events.
TGCompositeFrame * fEditorFrame
side frame for current pad editor
Definition TRootCanvas.h:58
~TRootCanvas() override
Delete ROOT basic canvas.
TGToolTip * fToolTip
tooltip for object info
Definition TRootCanvas.h:74
TGPopupMenu * fFileMenu
file menu
Definition TRootCanvas.h:42
TGPopupMenu * fFileSaveMenu
save cascade submenu
Definition TRootCanvas.h:43
Atom_t HandleDNDPosition(Int_t x, Int_t y, Atom_t action, Int_t xroot, Int_t yroot) override
Handle dragging position events.
void SetWindowTitle(const char *newTitle) override
Change title on window.
void CloseWindow() override
In case window is closed via WM we get here.
Int_t fButton
currently pressed button
Definition TRootCanvas.h:80
TGLayoutHints * fStatusBarLayout
layout hints for statusbar
Definition TRootCanvas.h:56
TGVertical3DLine * fVertical1
toolbar vertical separator
Definition TRootCanvas.h:65
Bool_t HandleCrossing(Event_t *ev) override
void SetEditable(Bool_t) override
Switch ON/OFF edit mode.
Bool_t HandleDoubleClick(Event_t *ev) override
TRootContainer(TRootCanvas *c, Window_t id, const TGWindow *parent)
Create a canvas container.
Bool_t HandleMotion(Event_t *ev) override
Bool_t HandleKey(Event_t *ev) override
Bool_t HandleConfigureNotify(Event_t *ev) override
This event is generated when the frame is resized.
Bool_t HandleExpose(Event_t *ev) override
void SavePrimitive(std::ostream &out, Option_t *="") override
Save a canvas container as a C++ statement(s) on output stream out.
TRootCanvas * fCanvas
Bool_t HandleButton(Event_t *ev) override
Directly handle scroll mouse buttons (4 and 5), only pass buttons 1, 2 and 3 on to the TCanvas.
A TRootHelpDialog is used to display help text (or any text in a dialog window).
void SetText(const char *helpText)
Set help text from helpText buffer in TGTextView.
void Popup()
Show help dialog.
Basic string class.
Definition TString.h:137
Ssiz_t Length() const
Definition TString.h:426
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
Definition TString.cxx:2325
const char * Data() const
Definition TString.h:385
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition TString.h:714
@ kLeading
Definition TString.h:283
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
Definition TString.h:633
Bool_t IsNull() const
Definition TString.h:423
TString & Remove(Ssiz_t pos)
Definition TString.h:695
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition TString.cxx:2460
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:642
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition TString.h:661
Int_t GetOptStat() const
Definition TStyle.h:247
void SetOptTitle(Int_t tit=1)
Definition TStyle.h:338
void SetOptStat(Int_t stat=1)
The type of information printed in the histogram statistics box can be selected via the parameter mod...
Definition TStyle.cxx:1641
Int_t GetOptTitle() const
Definition TStyle.h:248
Int_t GetOptFit() const
Definition TStyle.h:246
void SetOptFit(Int_t fit=1)
The type of information about fit parameters printed in the histogram statistics box can be selected ...
Definition TStyle.cxx:1594
virtual FILE * TempFileName(TString &base, const char *dir=nullptr, const char *suffix=nullptr)
Create a secure temporary file by appending a unique 6 letter string to base.
Definition TSystem.cxx:1521
virtual Int_t Exec(const char *shellcmd)
Execute a command.
Definition TSystem.cxx:656
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
Definition TSystem.cxx:1879
virtual Bool_t ChangeDirectory(const char *path)
Change directory.
Definition TSystem.cxx:877
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
Definition TSystem.cxx:440
virtual const char * WorkingDirectory()
Return working directory.
Definition TSystem.cxx:886
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
Definition TSystem.cxx:419
virtual int Unlink(const char *name)
Unlink, i.e.
Definition TSystem.cxx:1403
virtual const char * TempDirectory() const
Return a user configured or systemwide directory to create temporary files in.
Definition TSystem.cxx:1504
static void SingleShot(Int_t milliSec, const char *receiver_class, void *receiver, const char *method)
This static function calls a slot after a given time interval.
Definition TTimer.cxx:261
This class represents a WWW compatible URL.
Definition TUrl.h:33
const char * GetFile() const
Definition TUrl.h:69
Abstract base class used by ROOT graphics editor.
virtual TCanvas * GetCanvas() const =0
static TVirtualPadEditor * LoadEditor()
Static function returning a pointer to a new pad editor.
virtual void Hide()
static TVirtualPadEditor * GetPadEditor(Bool_t load=kTRUE)
Returns the pad editor dialog. Static method.
virtual void SetGlobal(Bool_t)
virtual void Show()
static void Terminate()
Close the global pad editor. Static method.
To make it possible to use GL for 2D graphic in a TPad/TCanvas.
small helper class to store/restore gPad context in TPad methods
Definition TVirtualPad.h:58
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition TVirtualPad.h:53
virtual TList * GetListOfPrimitives() const =0
virtual TVirtualPad * cd(Int_t subpadnumber=0)=0
virtual TVirtualViewer3D * GetViewer3D(Option_t *type="")=0
static TClass * Class()
virtual TCanvas * GetCanvas() const =0
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
int main()
Definition main.cpp:18
Int_t Nint(T x)
Round to nearest integer. Rounds half integers to the nearest even integer.
Definition TMath.h:706
Event structure.
Definition GuiTypes.h:175
const char * fPixmap
Definition TGToolBar.h:24
Window attributes that can be inquired.
Definition GuiTypes.h:115
TMarker m
Definition textangle.C:8