Logo ROOT  
Reference Guide
TGTextEditor.cxx
Go to the documentation of this file.
1// @(#)root/gui:$Id: ca18aae7f02ae8574b0c5414c78ede465425855d $
2// Author: Bertrand Bellenot 20/06/06
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 This source is based on Xclass95, a Win95-looking GUI toolkit.
14 Copyright (C) 1996, 1997 David Barth, Ricky Ralston, Hector Peraza.
15
16 Xclass95 is free software; you can redistribute it and/or
17 modify it under the terms of the GNU Library General Public
18 License as published by the Free Software Foundation; either
19 version 2 of the License, or (at your option) any later version.
20
21**************************************************************************/
22
23
24/** \class TGTextEditor
25 \ingroup guiwidgets
26
27 A simple text editor that uses the TGTextEdit widget.
28 It provides all functionalities of TGTextEdit as copy, paste, cut,
29 search, go to a given line number. In addition, it provides the
30 possibilities for compiling, executing or interrupting a running
31 macro.
32
33 This class can be used in following ways:
34 - with file name as argument:
35 new TGTextEditor("hsimple.C");
36 - with a TMacro* as argument:
37 TMacro *macro = new TMacro("hsimple.C");
38 new TGTextEditor(macro);
39
40### Basic Features:
41
42#### New Document
43
44 To create a new blank document, select File menu / New, or click
45 the New toolbar button. It will create a new instance of
46 TGTextEditor.
47
48#### Open/Save File
49
50 To open a file, select File menu / Open or click on the Open
51 toolbar button. This will bring up the standard File Dialog for
52 opening files.
53 If the current document has not been saved yet, you will be asked
54 either to save or abandon the changes.
55 To save the file using the same name, select File menu / Save or
56 the toolbar Save button. To change the file name use File menu /
57 Save As... or corresponding SaveAs button on the toolbar.
58
59#### Text Selection
60
61 You can move the cursor by simply clicking on the desired location
62 with the left mouse button. To highlight some text, press the mouse
63 and drag the mouse while holding the left button pressed.
64 To select a word, double-click on it;
65 to select the text line - triple-click on it;
66 to select all do quadruple-click.
67
68#### Cut, Copy, Paste
69
70 After selecting some text, you can cut or copy it to the clipboard.
71 A subsequent paste operation will insert the contents of the
72 clipboard at the current cursor location.
73
74#### Text Search
75
76 The editor uses a standard Search dialog. You can specify a forward
77 or backward search direction starting from the current cursor
78 location according to the selection made of a case sensitive mode
79 or not. The last search can be repeated by pressing F3.
80
81#### Text Font
82
83 You can change the text font by selecting Edit menu / Set Font.
84 The Font Dialog pops up and shows the Name, Style, and Size of any
85 available font. The selected font sample is shown in the preview
86 area.
87
88#### Executing Macros
89
90 You can execute the currently loaded macro in the editor by
91 selecting Tools menu / Execute Macro; by clicking on the
92 corresponding toolbar button, or by using Ctrl+F5 accelerator keys.
93 This is identical to the command ".x macro.C" in the root prompt
94 command line.
95
96#### Compiling Macros
97
98 The currently loaded macro can be compiled with ACLiC if you select
99 Tools menu / Compile Macro; by clicking on the corresponding
100 toolbar button, or by using Ctrl+F7 accelerator keys.
101 This is identical to the command ".L macro.C++" in the root prompt
102 command line.
103
104#### Interrupting a Running Macro
105
106 You can interrupt a running macro by selecting the Tools menu /
107 Interrupt; by clicking on the corresponding toolbar button, or by
108 using Shift+F5 accelerator keys.
109
110#### Interface to CINT Interpreter
111
112 Any command entered in the Command combo box will be passed to
113 the CINT interpreter. This combo box will keep the commands history
114 and will allow you to re-execute the same commands during an editor
115 session.
116
117#### Keyboard Bindings
118
119 The following table lists the keyboard shortcuts and accelerator
120 keys.
121
122| Key: | Action |
123|---------------|----------------|
124| Up | Move cursor up. |
125| Shift+Up | Move cursor up and extend selection. |
126| Down | Move cursor down. |
127| Shift+Down | Move cursor down and extend selection. |
128| Left | Move cursor left. |
129| Shift+Left | Move cursor left and extend selection. |
130| Right | Move cursor right. |
131| Shift+Right | Move cursor right and extend selection. |
132| Home | Move cursor to begin of line. |
133| Shift+Home | Move cursor to begin of line and extend selection. |
134| Ctrl+Home | Move cursor to top of page. |
135| End | Move cursor to end of line. |
136| Shift+End | Move cursor to end of line and extend selection. |
137| Ctrl+End | Move cursor to end of page. |
138| PgUp | Move cursor up one page. |
139| Shift+PgUp | Move cursor up one page and extend selection. |
140| PgDn | Move cursor down one page. |
141| Shift+PgDn | Move cursor down one page and extend selection. |
142| Delete | Delete character after cursor, or text selection. |
143| BackSpace | Delete character before cursor, or text selection. |
144| Ctrl+B | Move cursor left. |
145| Ctrl+D | Delete character after cursor, or text selection. |
146| Ctrl+E | Move cursor to end of line. |
147| Ctrl+H | Delete character before cursor, or text selection. |
148| Ctrl+K | Delete characters from current position to the end of line. |
149| Ctrl+U | Delete current line. |
150
151
152*/
153
154
155#include "TROOT.h"
156#include "TApplication.h"
157#include "TSystem.h"
158#include "TMacro.h"
159#include "TInterpreter.h"
160#include "TGMsgBox.h"
161#include "TGFileDialog.h"
162#include "TGFontDialog.h"
163#include "TGTextEdit.h"
164#include "TGMenu.h"
165#include "TGStatusBar.h"
166#include "KeySymbols.h"
167#include "TGToolBar.h"
168#include "TG3DLine.h"
169#include "TGLabel.h"
170#include "TGTextEntry.h"
171#include "TGTextEditDialogs.h"
172#include "TGTextEditor.h"
173#include "TGComboBox.h"
174#include "TObjString.h"
175#include "TRootHelpDialog.h"
176#include "HelpText.h"
177#include "TVirtualX.h"
178#ifdef WIN32
179#include "TWin32SplashThread.h"
180#endif
181
182const char *ed_filetypes[] = {
183 "ROOT Macros", "*.C",
184 "Source files", "*.cxx",
185 "Text files", "*.txt",
186 "All files", "*",
187 0, 0
188};
189
197
199 { "ed_new.png", "New File", kFALSE, kM_FILE_NEW, 0 },
200 { "ed_open.png", "Open File", kFALSE, kM_FILE_OPEN, 0 },
201 { "ed_save.png", "Save File", kFALSE, kM_FILE_SAVE, 0 },
202 { "ed_saveas.png", "Save File As...", kFALSE, kM_FILE_SAVEAS, 0 },
203 { "", 0, 0, -1, 0 },
204 { "ed_print.png", "Print", kFALSE, kM_FILE_PRINT, 0 },
205 { "", 0, 0, -1, 0 },
206 { "ed_cut.png", "Cut selection", kFALSE, kM_EDIT_CUT, 0 },
207 { "ed_copy.png", "Copy selection", kFALSE, kM_EDIT_COPY, 0 },
208 { "ed_paste.png", "Paste selection", kFALSE, kM_EDIT_PASTE, 0 },
209 { "ed_delete.png", "Delete selection", kFALSE, kM_EDIT_DELETE, 0 },
210 { "", 0, 0, -1, 0 },
211 { "ed_find.png", "Find...", kFALSE, kM_SEARCH_FIND, 0 },
212 { "ed_findnext.png", "Find next", kFALSE, kM_SEARCH_FINDNEXT, 0 },
213 { "ed_goto.png", "Goto...", kFALSE, kM_SEARCH_GOTO, 0 },
214 { "", 0, 0, -1, 0 },
215 { "ed_compile.png", "Compile Macro", kFALSE, kM_TOOLS_COMPILE, 0 },
216 { "ed_execute.png", "Execute Macro", kFALSE, kM_TOOLS_EXECUTE, 0 },
217 { "ed_interrupt.png", "Interrupt", kFALSE, kM_TOOLS_INTERRUPT, 0 },
218 { "", 0, 0, -1, 0 },
219 { "ed_help.png", "Help Contents", kFALSE, kM_HELP_CONTENTS, 0 },
220 { "", 0, 0, -1, 0 },
221 { "ed_quit.png", "Close Editor", kFALSE, kM_FILE_EXIT, 0 },
222 { 0, 0, 0, 0, 0 }
223};
224
225static char *gEPrinter = 0;
226static char *gEPrintCommand = 0;
227
229
230////////////////////////////////////////////////////////////////////////////////
231/// TGTextEditor constructor with file name as first argument.
232
234 UInt_t h) : TGMainFrame(p, w, h)
235{
236 Build();
237 if (p && p != gClient->GetDefaultRoot()) {
238 // special case for TRootBrowser
239 // remove the command line combo box and its associated label
245 fToolBar->Layout();
246 }
247 if (filename) {
249 }
250 MapWindow();
251}
252
253////////////////////////////////////////////////////////////////////////////////
254/// TGTextEditor constructor with pointer to a TMacro as first argument.
255
257 TGMainFrame(p, w, h)
258{
259 TString tmp;
260 Build();
261 if (p && p != gClient->GetDefaultRoot()) {
262 // special case for TRootBrowser
263 // remove the command line combo box and its associated label
268 fToolBar->Layout();
269 }
270 if (macro) {
271 fMacro = macro;
272 TIter next(macro->GetListOfLines());
273 TObjString *obj;
274 while ((obj = (TObjString*) next())) {
275 fTextEdit->AddLine(obj->GetName());
276 }
277 tmp.Form("TMacro : %s: %ld lines read.",
278 macro->GetName(), fTextEdit->ReturnLineCount());
279 fStatusBar->SetText(tmp.Data(), 0);
280 fFilename = macro->GetName();
281 fFilename += ".C";
282 tmp.Form("TMacro : %s - TGTextEditor", macro->GetName());
283 SetWindowName(tmp.Data());
284 }
285 MapWindow();
286}
287
288////////////////////////////////////////////////////////////////////////////////
289/// TGTextEditor destructor.
290
292{
293 gApplication->Disconnect("Terminate(Int_t)");
294 if (fTimer) delete fTimer;
295 if (fMenuFile) delete fMenuFile;
296 if (fMenuEdit) delete fMenuEdit;
297 if (fMenuSearch) delete fMenuSearch;
298 if (fMenuTools) delete fMenuTools;
299 if (fMenuHelp) delete fMenuHelp;
300}
301
302////////////////////////////////////////////////////////////////////////////////
303/// Delete TGTextEditor Window.
304
306{
307 gApplication->Disconnect("Terminate(Int_t)");
308 delete fTimer; fTimer = 0;
309 delete fMenuFile; fMenuFile = 0;
310 delete fMenuEdit; fMenuEdit = 0;
311 delete fMenuSearch; fMenuSearch = 0;
312 delete fMenuTools; fMenuTools = 0;
313 delete fMenuHelp; fMenuHelp = 0;
314 Cleanup();
316}
317
318////////////////////////////////////////////////////////////////////////////////
319/// Build TGTextEditor widget.
320
322{
326
330 fMenuFile->AddEntry("&Open...", kM_FILE_OPEN);
331 fMenuFile->AddEntry("&Close", kM_FILE_CLOSE);
333 fMenuFile->AddEntry("Save &As...", kM_FILE_SAVEAS);
335 fMenuFile->AddEntry("&Print...", kM_FILE_PRINT);
338
340 fMenuEdit->AddEntry("Cu&t\tCtrl+X", kM_EDIT_CUT);
341 fMenuEdit->AddEntry("&Copy\tCtrl+C", kM_EDIT_COPY);
342 fMenuEdit->AddEntry("&Paste\tCtrl+V", kM_EDIT_PASTE);
343 fMenuEdit->AddEntry("De&lete\tDel", kM_EDIT_DELETE);
345 fMenuEdit->AddEntry("Select &All\tCtrl+A", kM_EDIT_SELECTALL);
347 fMenuEdit->AddEntry("Set &Font", kM_EDIT_SELFONT);
348
350 fMenuTools->AddEntry("&Compile Macro\tCtrl+F7", kM_TOOLS_COMPILE);
351 fMenuTools->AddEntry("&Execute Macro\tCtrl+F5", kM_TOOLS_EXECUTE);
352 fMenuTools->AddEntry("&Interrupt\tShift+F5", kM_TOOLS_INTERRUPT);
353
358
360 fMenuSearch->AddEntry("&Find...\tCtrl+F", kM_SEARCH_FIND);
361 fMenuSearch->AddEntry("Find &Next\tF3", kM_SEARCH_FINDNEXT);
363 fMenuSearch->AddEntry("&Goto Line...\tCtrl+L", kM_SEARCH_GOTO);
364
366 fMenuHelp->AddEntry("&Help Topics\tF1", kM_HELP_CONTENTS);
368 fMenuHelp->AddEntry("&About...", kM_HELP_ABOUT);
369
370 fMenuFile->Associate(this);
371 fMenuEdit->Associate(this);
372 fMenuSearch->Associate(this);
373 fMenuTools->Associate(this);
374 fMenuHelp->Associate(this);
375
376 fMenuBar = new TGMenuBar(this, 1, 1, kHorizontalFrame);
383 kLHintsRight));
385
386 //---- toolbar
387
389 new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0,0,2,2));
390 Int_t i,spacing = 8;
391 fToolBar = new TGToolBar(this, 60, 20, kHorizontalFrame);
393 for (i = 0; fTbData[i].fPixmap; i++) {
394 if (strlen(fTbData[i].fPixmap) == 0) {
395 spacing = 8;
396 continue;
397 }
398 fToolBar->AddButton(this, &fTbData[i], spacing);
399 spacing = 0;
400 }
401 fComboCmd = new TGComboBox(fToolBar, "");
404 fCommand->Associate(this);
407 kLHintsRight, 5, 5, 1, 1));
408
409 fToolBar->AddFrame(fLabel = new TGLabel(fToolBar, "Command :"),
410 new TGLayoutHints(kLHintsCenterY | kLHintsRight, 5, 5, 1, 1));
412 0, 0, 0, 0));
414 new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0,0,2,2));
415
420
421 fTextEdit = new TGTextEdit(this, 10, 10, 1);
422 if (gClient->GetStyle() < 2) {
423 Pixel_t pxl;
424 gClient->GetColorByName("#3399ff", pxl);
427 }
428 fTextEdit->Associate(this);
430
431 Int_t parts[] = { 75, 25 };
432 fStatusBar = new TGStatusBar(this);
434 fStatusBar->SetParts(parts, 2);
436
437 SetClassHints("ROOT", "TGTextEditor");
438 SetWindowName("Untitled - TGTextEditor");
439
440 fMacro = 0;
441 fFilename = "Untitled";
443
447 fTextEdit->Connect("DataChanged()", "TGTextEditor", this, "DataChanged()");
448 fTextEdit->Connect("Closed()", "TGTextEditor", this, "ClearText()");
449 fTextEdit->Connect("Opened()", "TGTextEditor", this, "ClearText()");
450 fTextEdit->Connect("DataDropped(char *)", "TGTextEditor", this, "DataDropped(char *)");
452
454 Resize(GetDefaultWidth() + 50, GetDefaultHeight() > 500 ? GetDefaultHeight() : 500);
455 Layout();
456
457 gApplication->Connect("Terminate(Int_t)", "TGTextEditor", this, "ClearText()");
458 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_F3), 0, kTRUE);
459
462
463 fTimer = new TTimer(this, 250);
464 fTimer->Reset();
465 fTimer->TurnOn();
466
469}
470
471////////////////////////////////////////////////////////////////////////////////
472/// Update file information when receiving the signal
473/// DataDropped from TGTextEdit widget.
474
476{
477 TString tmp;
478 fFilename = fname;
479 tmp.Form("%s: %ld lines read.", fname, fTextEdit->ReturnLineCount());
480 fStatusBar->SetText(tmp, 0);
481 tmp.Form("%s - TGTextEditor", fname);
482 SetWindowName(tmp.Data());
483}
484
485////////////////////////////////////////////////////////////////////////////////
486/// Slot setting the fTextChanged flag to true when the text has been
487/// modified in fTextEdit
488
490{
492}
493
494////////////////////////////////////////////////////////////////////////////////
495/// Load a file into the editor. If fname is 0, a TGFileDialog will popup.
496
497void TGTextEditor::LoadFile(const char *fname)
498{
499 TString tmp;
500 TGFileInfo fi;
502 switch (IsSaved()) {
503 case kMBCancel:
504 return;
505 case kMBYes:
506 if (!fFilename.CompareTo("Untitled"))
507 SaveFileAs();
508 else
510 if (fTextChanged) {
511 return;
512 }
513 break;
514 case kMBNo:
515 break;
516 default:
517 return;
518 }
519 if (fname == 0) {
520 new TGFileDialog(fClient->GetDefaultRoot(), this, kFDOpen, &fi);
521 if (fi.fFilename && strlen(fi.fFilename)) {
522 fname = fi.fFilename;
523 }
524 }
525 if (fname) {
526 if (!fTextEdit->LoadFile(fname)) {
527 tmp.Form("Error opening file \"%s\"", fname);
528 new TGMsgBox(fClient->GetRoot(), this, "TGTextEditor",
530 } else {
531 fFilename = fname;
532 tmp.Form("%s: %ld lines read.", fname, fTextEdit->ReturnLineCount());
533 fStatusBar->SetText(tmp.Data(), 0);
534 tmp.Form("%s - TGTextEditor", fname);
535 SetWindowName(tmp.Data());
537 }
538 }
539 fTextEdit->Layout();
540}
541
542////////////////////////////////////////////////////////////////////////////////
543/// Save the edited text in the file "fname".
544
545void TGTextEditor::SaveFile(const char *fname)
546{
547 char *p;
548 TString tmp;
549
550 if (!fTextEdit->SaveFile(fname)) {
551 tmp.Form("Error saving file \"%s\"", fname);
552 new TGMsgBox(fClient->GetRoot(), this, "TGTextEditor",
554 return;
555 }
556 if ((p = (char *)strrchr(fname, '/')) == 0) {
557 p = (char *)fname;
558 } else {
559 ++p;
560 }
561 tmp.Form("%s: %ld lines written.", p, fTextEdit->ReturnLineCount());
562 fStatusBar->SetText(tmp.Data(), 0);
563
564 tmp.Form("%s - TGTextEditor", p);
565 SetWindowName(tmp.Data());
567}
568
569////////////////////////////////////////////////////////////////////////////////
570/// Save the edited text in a file selected with TGFileDialog.
571/// Shouldn't we create a backup file?
572
574{
575 TString workdir = gSystem->WorkingDirectory();
576 static TString dir(".");
577 static Bool_t overwr = kFALSE;
578 TGFileInfo fi;
580 fi.SetIniDir(dir);
581 fi.fOverwrite = overwr;
582 new TGFileDialog(fClient->GetDefaultRoot(), this, kFDSave, &fi);
583 gSystem->ChangeDirectory(workdir.Data());
584 overwr = fi.fOverwrite;
585 if (fi.fFilename && strlen(fi.fFilename)) {
587 fFilename = fi.fFilename;
588 return kTRUE;
589 }
590 return kFALSE;
591}
592
593////////////////////////////////////////////////////////////////////////////////
594/// Check if file has to be saved in case of modifications.
595
597{
598 Int_t ret;
599 TString tmp;
600 Int_t opt = (kMBYes | kMBNo);
601
602 tmp.Form("The text has been modified. Do you want to save the changes?");
603
604 if (!fTextChanged) {
605 return kMBNo;
606 } else {
607 if (fParent == gClient->GetDefaultRoot())
608 opt |= kMBCancel;
609 new TGMsgBox(fClient->GetRoot(), this, "TGTextEditor",
610 tmp.Data(), kMBIconExclamation, opt, &ret);
611 return ret;
612 }
613}
614
615////////////////////////////////////////////////////////////////////////////////
616/// Open the print dialog and send current buffer to printer.
617
619{
620 TString tmp;
621 Int_t ret = 0;
622 if (!gEPrinter) {
623 gEPrinter = StrDup("892_2_cor"); // use gEnv
624 gEPrintCommand = StrDup("xprint");
625 }
626 new TGPrintDialog(fClient->GetDefaultRoot(), this, 400, 150,
627 &gEPrinter, &gEPrintCommand, &ret);
628 if (ret) {
629 fTextEdit->Print();
630 tmp.Form("Printed: %s", fFilename.Data());
631 fStatusBar->SetText(tmp.Data(), 0);
632 }
633}
634
635////////////////////////////////////////////////////////////////////////////////
636/// Close TGTextEditor window.
637
639{
640 Bool_t reallyClose = kFALSE;
641 if (fExiting) {
642 return;
643 }
644 fExiting = kTRUE;
645 switch (IsSaved()) {
646 case kMBYes:
647 if (!fFilename.CompareTo("Untitled"))
649 else
651 // close the editor only if the text has been saved and the
652 // TGTextEditor is not embedded in the ROOT browser
653 reallyClose = (!fTextChanged || (fParent != gClient->GetDefaultRoot()));
654 break;
655 case kMBCancel:
656 reallyClose = kFALSE;
657 break;
658 case kMBNo:
659 reallyClose = kTRUE;
660 break;
661 }
662 if (reallyClose) {
663 gApplication->Disconnect("Terminate(Int_t)");
665 }
667}
668
669////////////////////////////////////////////////////////////////////////////////
670/// Keyboard event handler.
671
673{
674 char input[10];
675 UInt_t keysym;
676
677 if (event->fType == kGKeyPress) {
678 gVirtualX->LookupString(event, input, sizeof(input), keysym);
679
680 switch ((EKeySym)keysym) { // ignore these keys
681 case kKey_Shift:
682 case kKey_Control:
683 case kKey_Meta:
684 case kKey_Alt:
685 case kKey_CapsLock:
686 case kKey_NumLock:
687 case kKey_ScrollLock:
688 return kTRUE;
689 case kKey_F1:
692 return kTRUE;
693 case kKey_F3:
694 Search(kTRUE);
695 return kTRUE;
696 default:
697 break;
698 }
699 if (event->fState & kKeyControlMask) { // Ctrl key modifier pressed
700 switch((EKeySym)keysym) {
701 case kKey_F5:
702 ExecuteMacro();
703 return kTRUE;
704 case kKey_F7:
705 CompileMacro();
706 return kTRUE;
707 default:
708 break;
709 }
710 }
711 if (event->fState & kKeyShiftMask) { // Shift key modifier pressed
712 switch((EKeySym)keysym) {
713 case kKey_F5:
715 return kTRUE;
716 default:
717 break;
718 }
719 }
720 }
722}
723
724////////////////////////////////////////////////////////////////////////////////
725/// Clear text edit widget.
726
728{
729 fTextEdit->Clear();
730 fMacro = 0;
731 fFilename = "Untitled";
732 SetWindowName("Untitled - TGTextEditor");
733 fStatusBar->SetText("New File", 0);
735}
736
737////////////////////////////////////////////////////////////////////////////////
738/// Invokes search dialog, or just search previous string if again is true.
739
741{
742 if (again) {
745 }
746 else {
748 }
749}
750
751////////////////////////////////////////////////////////////////////////////////
752/// Invokes goto dialog, and go to the specified line.
753
755{
756 Long_t ret;
757
758 new TGGotoDialog(fClient->GetDefaultRoot(), this, 400, 150, &ret);
759
760 if (ret >= 0)
761 fTextEdit->Goto(ret-1);
762}
763
764////////////////////////////////////////////////////////////////////////////////
765/// Save the edited text in a temporary macro, then compile it.
766
768{
769 if (fTextEdit->ReturnLineCount() < 3)
770 return;
771 if ((fMacro) || (!fFilename.CompareTo("Untitled"))) {
772 if (!SaveFileAs())
773 return;
774 }
775 char *tmpfile = gSystem->ConcatFileName(gSystem->TempDirectory(),
777 fTextEdit->SaveFile(tmpfile, kFALSE);
778 gSystem->CompileMacro(tmpfile);
779 gSystem->Unlink(tmpfile);
780 delete [] tmpfile;
781}
782
783////////////////////////////////////////////////////////////////////////////////
784/// Save the edited text in a temporary macro, execute it, and then delete
785/// the temporary file.
786
788{
789 if (fTextEdit->ReturnLineCount() < 3)
790 return;
791 if (fMacro) {
792 fMacro->Exec();
793 return;
794 }
795 if (fTextChanged) {
796 Int_t ret;
797 new TGMsgBox(fClient->GetRoot(), this, "TGTextEditor",
798 "The text has been modified. Do you want to save the changes?",
800 if (ret == kMBYes) {
801 if (!fFilename.CompareTo("Untitled"))
802 SaveFileAs();
803 else
806 }
807 if (ret == kMBCancel)
808 return;
809 }
810 if (!fFilename.CompareTo("Untitled")) {
811 //if (!SaveFileAs())
812 // return;
813 fFilename += ".C";
814 }
815 gInterpreter->SaveContext();
816 TString savdir = gSystem->WorkingDirectory();
817 TString tmpfile = gSystem->BaseName(fFilename.Data());
818 tmpfile += "_exec";
820 fTextEdit->SaveFile(tmpfile.Data(), kFALSE);
821 gROOT->SetExecutingMacro(kTRUE);
822 gROOT->Macro(tmpfile.Data());
823 gROOT->SetExecutingMacro(kFALSE);
824 if (gInterpreter->IsLoaded(tmpfile.Data()))
825 gInterpreter->UnloadFile(tmpfile.Data());
826 gSystem->Unlink(tmpfile.Data());
827 gSystem->ChangeDirectory(savdir.Data());
828 gInterpreter->Reset();
829}
830
831////////////////////////////////////////////////////////////////////////////////
832/// Interrupt execution of a macro.
833
835{
836 gROOT->SetInterrupt(kTRUE);
837}
838
839////////////////////////////////////////////////////////////////////////////////
840/// Display ROOT splash screen.
841
843{
844#ifdef R__UNIX
845 TString rootx = TROOT::GetBinDir() + "/root -a &";
846 gSystem->Exec(rootx);
847#else
848#ifdef WIN32
850#else
851 char str[32];
852 sprintf(str, "About ROOT %s...", gROOT->GetVersion());
853 TRootHelpDialog *hd = new TRootHelpDialog(this, str, 600, 400);
854 hd->SetText(gHelpAbout);
855 hd->Popup();
856#endif
857#endif
858}
859
860////////////////////////////////////////////////////////////////////////////////
861/// Handle timer event.
862
864{
865 TString tmp;
866 if (t != fTimer) return kTRUE;
867 // check if some text is available in the clipboard
868 if ((gVirtualX->InheritsFrom("TGX11")) &&
869 (gVirtualX->GetPrimarySelectionOwner() == kNone)) {
872 }
873 else {
877 }
878 // check if text is selected in the editor
879 if (fTextEdit->IsMarked()) {
887 }
888 }
889 else {
897 }
898 }
899 // get cursor position
901 tmp.Form("Ln %ld, Ch %ld", pos.fY, pos.fX);
902 fStatusBar->SetText(tmp.Data(), 1);
903 fTimer->Reset();
904 return kTRUE;
905}
906
907////////////////////////////////////////////////////////////////////////////////
908/// Handle menu and other command generated by the user.
909
911{
912 TRootHelpDialog *hd;
913
914 switch(GET_MSG(msg)) {
915 case kC_COMMAND:
916 switch(GET_SUBMSG(msg)) {
917 case kCM_BUTTON:
918 case kCM_MENU:
919 switch (parm1) {
920 // "File" menu related events
921 case kM_FILE_NEW:
922 new TGTextEditor();
923 break;
924 case kM_FILE_OPEN:
925 LoadFile();
926 break;
927 case kM_FILE_CLOSE:
928 ClearText();
929 break;
930 case kM_FILE_SAVE:
931 if (!fFilename.CompareTo("Untitled"))
932 SaveFileAs();
933 else
935 break;
936 case kM_FILE_SAVEAS:
937 SaveFileAs();
938 break;
939 case kM_FILE_PRINT:
940 PrintText();
941 break;
942 case kM_FILE_EXIT:
943 CloseWindow();
944 break;
945
946 // "Edit" menu related events
947 case kM_EDIT_CUT:
948 fTextEdit->Cut();
949 break;
950 case kM_EDIT_COPY:
951 fTextEdit->Copy();
952 break;
953 case kM_EDIT_PASTE:
954 fTextEdit->Paste();
955 break;
956 case kM_EDIT_DELETE:
957 fTextEdit->Delete();
958 break;
961 if (fTextEdit->IsMarked()) {
969 }
970 }
971 break;
972 case kM_EDIT_SELFONT:
973 {
974 Int_t count;
977 new TGFontDialog(fClient->GetRoot(), this, &prop);
978 if (prop.fName != "") {
979 fontname.Form("-*-%s-%s-%c-*-*-%d-*-*-*-*-*-*-*",
980 prop.fName.Data(),
981 prop.fBold ? "bold" : "medium",
982 prop.fItalic ? 'i' : 'r',
983 prop.fSize);
984 if (!gVirtualX->ListFonts(fontname, 10, count)) {
985 fontname.Form("-*-%s-%s-%c-*-*-%d-*-*-*-*-*-*-*",
986 prop.fName.Data(),
987 prop.fBold ? "bold" : "medium",
988 prop.fItalic ? 'o' : 'r',
989 prop.fSize);
990 }
991 TGFont *font = fClient->GetFont(fontname);
992 if (font) {
993 FontStruct_t editorfont = font->GetFontStruct();
994 fTextEdit->SetFont(editorfont);
995 fTextEdit->Update();
996 }
997 }
998 }
999 break;
1000
1001 // "Tools" menu related events
1002 case kM_TOOLS_COMPILE:
1003 CompileMacro();
1004 break;
1005 case kM_TOOLS_EXECUTE:
1006 ExecuteMacro();
1007 break;
1008 case kM_TOOLS_INTERRUPT:
1010 break;
1011
1012 // "Search" menu related events
1013 case kM_SEARCH_FIND:
1014 Search(kFALSE);
1015 break;
1016 case kM_SEARCH_FINDNEXT:
1017 Search(kTRUE);
1018 break;
1019 case kM_SEARCH_GOTO:
1020 Goto();
1021 break;
1022
1023 // "Help" menu related events
1024 case kM_HELP_CONTENTS:
1025 hd = new TRootHelpDialog(this, "Help on Editor...", 600, 400);
1027 hd->Popup();
1028 break;
1029 case kM_HELP_ABOUT:
1030 About();
1031 break;
1032 }
1033 break;
1034 }
1035 break;
1036 case kC_TEXTENTRY:
1037 switch (GET_SUBMSG(msg)) {
1038 case kTE_ENTER:
1039 {
1040 // here copy the string from text buffer to return variable
1041 const char *string = fCommandBuf->GetString();
1042 if(strlen(string) > 1) {
1043 gROOT->ProcessLine(string);
1045 }
1046 }
1047 break;
1048 default:
1049 break;
1050 }
1051 break;
1052
1053 default:
1054 break;
1055 }
1056 return kTRUE;
1057}
@ kGKeyPress
Definition: GuiTypes.h:60
const Mask_t kFocusChangeMask
Definition: GuiTypes.h:169
const Mask_t kKeyPressMask
Definition: GuiTypes.h:159
const Mask_t kKeyShiftMask
Definition: GuiTypes.h:195
@ kHorizontalFrame
Definition: GuiTypes.h:382
const Handle_t kNone
Definition: GuiTypes.h:88
const Mask_t kKeyControlMask
Definition: GuiTypes.h:197
const Mask_t kLeaveWindowMask
Definition: GuiTypes.h:168
const Mask_t kStructureNotifyMask
Definition: GuiTypes.h:166
const Mask_t kEnterWindowMask
Definition: GuiTypes.h:167
ULong_t Pixel_t
Pixel value.
Definition: GuiTypes.h:40
Handle_t FontStruct_t
Pointer to font structure.
Definition: GuiTypes.h:39
R__EXTERN const char gHelpAbout[]
Definition: HelpText.h:17
R__EXTERN const char gHelpTextEditor[]
Definition: HelpText.h:27
EKeySym
Definition: KeySymbols.h:25
@ kKey_Meta
Definition: KeySymbols.h:51
@ kKey_F1
Definition: KeySymbols.h:57
@ kKey_CapsLock
Definition: KeySymbols.h:53
@ kKey_F5
Definition: KeySymbols.h:61
@ kKey_Alt
Definition: KeySymbols.h:52
@ kKey_ScrollLock
Definition: KeySymbols.h:55
@ kKey_F3
Definition: KeySymbols.h:59
@ kKey_Shift
Definition: KeySymbols.h:49
@ kKey_Control
Definition: KeySymbols.h:50
@ kKey_NumLock
Definition: KeySymbols.h:54
@ kKey_F7
Definition: KeySymbols.h:63
#define h(i)
Definition: RSha256.hxx:106
long Longptr_t
Definition: RtypesCore.h:82
const Bool_t kFALSE
Definition: RtypesCore.h:101
long Long_t
Definition: RtypesCore.h:54
const Bool_t kTRUE
Definition: RtypesCore.h:100
#define ClassImp(name)
Definition: Rtypes.h:375
R__EXTERN TApplication * gApplication
Definition: TApplication.h:165
@ kButtonDisabled
Definition: TGButton.h:56
@ kButtonUp
Definition: TGButton.h:53
#define gClient
Definition: TGClient.h:157
@ kFDOpen
Definition: TGFileDialog.h:21
@ kFDSave
Definition: TGFileDialog.h:22
@ kDeepCleanup
Definition: TGFrame.h:42
@ kLHintsRight
Definition: TGLayout.h:26
@ kLHintsExpandY
Definition: TGLayout.h:31
@ kLHintsLeft
Definition: TGLayout.h:24
@ kLHintsCenterY
Definition: TGLayout.h:28
@ kLHintsBottom
Definition: TGLayout.h:29
@ kLHintsTop
Definition: TGLayout.h:27
@ kLHintsExpandX
Definition: TGLayout.h:30
@ kMBNo
Definition: TGMsgBox.h:32
@ kMBYes
Definition: TGMsgBox.h:31
@ kMBCancel
Definition: TGMsgBox.h:37
@ kMBOk
Definition: TGMsgBox.h:33
@ kMBIconExclamation
Definition: TGMsgBox.h:24
static char * gEPrinter
static char * gEPrintCommand
ETextEditorCommands
@ kM_TOOLS_EXECUTE
@ kM_HELP_ABOUT
@ kM_EDIT_SELFONT
@ kM_FILE_EXIT
@ kM_FILE_NEW
@ kM_EDIT_PASTE
@ kM_EDIT_CUT
@ kM_FILE_PRINT
@ kM_EDIT_DELETE
@ kM_SEARCH_GOTO
@ kM_EDIT_COPY
@ kM_TOOLS_COMPILE
@ kM_FILE_OPEN
@ kM_TOOLS_INTERRUPT
@ kM_EDIT_SELECTALL
@ kM_FILE_SAVEAS
@ kM_FILE_SAVE
@ kM_HELP_CONTENTS
@ kM_FILE_CLOSE
@ kM_SEARCH_FINDNEXT
@ kM_SEARCH_FIND
const char * ed_filetypes[]
ToolBarData_t fTbData[]
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void input
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 filename
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 prop
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 fontname
#define gInterpreter
Definition: TInterpreter.h:564
#define gROOT
Definition: TROOT.h:404
char * StrDup(const char *str)
Duplicate the string str.
Definition: TString.cxx:2520
R__EXTERN TSystem * gSystem
Definition: TSystem.h:559
#define gVirtualX
Definition: TVirtualX.h:338
Int_t MK_MSG(EWidgetMessageTypes msg, EWidgetMessageTypes submsg)
Int_t GET_MSG(Long_t val)
@ kCM_MENU
@ kTE_ENTER
@ kC_COMMAND
@ kCM_BUTTON
@ kC_TEXTENTRY
Int_t GET_SUBMSG(Long_t val)
virtual EButtonState GetState() const
Definition: TGButton.h:112
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set button state.
Definition: TGButton.cxx:235
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
TGFont * GetFont(const char *font, Bool_t fixedDefault=kTRUE)
Get a font from the font pool.
Definition: TGClient.cxx:348
A combobox (also known as a drop down listbox) allows the selection of one item out of a list of item...
Definition: TGComboBox.h:47
virtual TGTextEntry * GetTextEntry() const
Definition: TGComboBox.h:111
virtual void ReturnPressed()
Add new entry to combo box when return key pressed inside text entry ReturnPressed signal is emitted.
Definition: TGComboBox.cxx:663
UInt_t GetDefaultWidth() const override
Definition: TGFrame.h:312
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1117
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
Definition: TGFrame.cxx:967
void MapSubwindows() override
Map all sub windows that are part of the composite frame.
Definition: TGFrame.cxx:1164
UInt_t GetDefaultHeight() const override
Definition: TGFrame.h:314
void Layout() override
Layout the elements of the composite frame.
Definition: TGFrame.cxx:1257
void SetCleanup(Int_t mode=kLocalCleanup) override
Turn on automatic cleanup of child frames in dtor.
Definition: TGFrame.cxx:1072
virtual void RemoveFrame(TGFrame *f)
Remove frame from composite frame.
Definition: TGFrame.cxx:1149
This class creates a file selection dialog.
Definition: TGFileDialog.h:65
char * fFilename
selected file name
Definition: TGFileDialog.h:46
const char ** fFileTypes
file types used to filter selectable files
Definition: TGFileDialog.h:48
Bool_t fOverwrite
if true overwrite the file with existing name on save
Definition: TGFileDialog.h:50
void SetIniDir(const char *inidir)
Set directory name.
Font selection dialog, allowing to select one in the list of available fonts in the system.
Definition: TGFontDialog.h:24
Encapsulate fonts used in the GUI system.
Definition: TGFont.h:140
FontStruct_t GetFontStruct() const
Definition: TGFont.h:184
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
Definition: TGFrame.cxx:339
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
Definition: TGFrame.cxx:605
static Pixel_t GetWhitePixel()
Get white pixel value.
Definition: TGFrame.cxx:709
virtual UInt_t GetDefaultHeight() const
Definition: TGFrame.h:191
void MapWindow() override
map window
Definition: TGFrame.h:204
virtual void DeleteWindow()
Delete window.
Definition: TGFrame.cxx:276
void UnmapWindow() override
unmap window
Definition: TGFrame.h:206
virtual void SendMessage(const TGWindow *w, Longptr_t msg, Longptr_t parm1, Longptr_t parm2)
Send message (i.e.
Definition: TGFrame.cxx:645
A horizontal 3D line is a line that typically separates a toolbar from the menubar.
Definition: TG3DLine.h:18
This class handles GUI labels.
Definition: TGLabel.h:24
This class describes layout hints used by the layout classes.
Definition: TGLayout.h:50
Long_t fX
x position
Definition: TGDimension.h:56
Long_t fY
y position
Definition: TGDimension.h:57
Defines top level windows that interact with the system Window Manager.
Definition: TGFrame.h:397
void SetClassHints(const char *className, const char *resourceName)
Set the windows class and resource name.
Definition: TGFrame.cxx:1858
virtual void CloseWindow()
Close and delete main frame.
Definition: TGFrame.cxx:1770
void SetWindowName(const char *name=nullptr) override
Set window name. This is typically done via the window manager.
Definition: TGFrame.cxx:1788
Bool_t HandleKey(Event_t *event) override
Handle keyboard events.
Definition: TGFrame.cxx:1606
The TGMenu.h header contains all different menu classes.
Definition: TGMenu.h:282
virtual void AddPopup(TGHotString *s, TGPopupMenu *menu, TGLayoutHints *l, TGPopupMenu *before=0)
Add popup menu to menu bar.
Definition: TGMenu.cxx:418
TGClient * fClient
Connection to display server.
Definition: TGObject.h:25
Handle_t fId
X11/Win32 Window identifier.
Definition: TGObject.h:24
This class creates a popup menu object.
Definition: TGMenu.h:110
virtual void DisableEntry(Int_t id)
Disable entry (disabled entries appear in a sunken relieve).
Definition: TGMenu.cxx:1724
virtual void EnableEntry(Int_t id)
Enable entry. By default entries are enabled.
Definition: TGMenu.cxx:1705
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:1060
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:990
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.
const char * GetString() const
Definition: TGTextBuffer.h:32
A TGTextEdit is a specialization of TGTextView.
Definition: TGTextEdit.h:22
@ kM_SEARCH_FINDAGAIN
Definition: TGTextEdit.h:33
@ kM_FILE_OPEN
Definition: TGTextEdit.h:31
virtual Bool_t Goto(Long_t line, Long_t column=0)
Goto the specified line.
Definition: TGTextEdit.cxx:744
TGPopupMenu * GetMenu() const
Definition: TGTextEdit.h:100
virtual Bool_t SaveFile(const char *fname, Bool_t saveas=kFALSE)
Save file.
Definition: TGTextEdit.cxx:394
void Delete(Option_t *="") override
Delete selection.
Definition: TGTextEdit.cxx:538
virtual Bool_t Cut()
Cut text.
Definition: TGTextEdit.cxx:448
TGLongPosition GetCurrentPos() const
Definition: TGTextEdit.h:112
void Clear(Option_t *="") override
Clear text edit widget.
Definition: TGTextEdit.cxx:382
void Copy(TObject &) const override
Copy this to obj.
Definition: TGTextEdit.h:60
void Print(Option_t *="") const override
Send current buffer to printer.
Definition: TGTextEdit.cxx:483
Bool_t Search(const char *string, Bool_t direction=kTRUE, Bool_t caseSensitive=kFALSE) override
Search for string in the specified direction.
Definition: TGTextEdit.cxx:640
virtual Bool_t Paste()
Paste text into widget.
Definition: TGTextEdit.cxx:461
virtual void SetFocus()
Definition: TGTextEdit.h:109
A simple text editor that uses the TGTextEdit widget.
Definition: TGTextEditor.h:33
TGStatusBar * fStatusBar
for file name, line and col number
Definition: TGTextEditor.h:38
Bool_t fTextChanged
true if text has changed
Definition: TGTextEditor.h:54
TGPopupMenu * fMenuTools
"Tools" menu entry
Definition: TGTextEditor.h:51
void DataChanged()
Slot setting the fTextChanged flag to true when the text has been modified in fTextEdit.
TString fFilename
name of the opened file
Definition: TGTextEditor.h:55
void InterruptMacro()
Interrupt execution of a macro.
void CloseWindow() override
Close TGTextEditor window.
Int_t IsSaved()
Check if file has to be saved in case of modifications.
void Search(Bool_t ret)
Invokes search dialog, or just search previous string if again is true.
TTimer * fTimer
for statusbar and toolbar update
Definition: TGTextEditor.h:37
TGPopupMenu * fMenuFile
"File" menu entry
Definition: TGTextEditor.h:48
TGLayoutHints * fMenuBarLayout
used for the menubar
Definition: TGTextEditor.h:45
TGTextEntry * fCommand
command text entry widget
Definition: TGTextEditor.h:43
TGLabel * fLabel
"command" label
Definition: TGTextEditor.h:41
void DataDropped(char *fname)
Update file information when receiving the signal DataDropped from TGTextEdit widget.
void CompileMacro()
Save the edited text in a temporary macro, then compile it.
Bool_t HandleKey(Event_t *event) override
Keyboard event handler.
void ClearText()
Clear text edit widget.
Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2) override
Handle menu and other command generated by the user.
virtual void Build()
Build TGTextEditor widget.
void Goto()
Invokes goto dialog, and go to the specified line.
void About()
Display ROOT splash screen.
void ExecuteMacro()
Save the edited text in a temporary macro, execute it, and then delete the temporary file.
Bool_t SaveFileAs()
Save the edited text in a file selected with TGFileDialog.
TMacro * fMacro
pointer on the opened macro
Definition: TGTextEditor.h:56
TGMenuBar * fMenuBar
editor's menu bar
Definition: TGTextEditor.h:47
TGTextEdit * fTextEdit
text edit widget
Definition: TGTextEditor.h:40
void PrintText()
Open the print dialog and send current buffer to printer.
TGTextEditor(const char *filename=0, const TGWindow *p=nullptr, UInt_t w=900, UInt_t h=600)
TGTextEditor constructor with file name as first argument.
TGLayoutHints * fMenuBarItemLayout
used for for menubar items
Definition: TGTextEditor.h:46
void SaveFile(const char *fname)
Save the edited text in the file "fname".
TGComboBox * fComboCmd
commands combobox
Definition: TGTextEditor.h:42
TGPopupMenu * fMenuEdit
"Edit" menu entry
Definition: TGTextEditor.h:49
TGPopupMenu * fMenuSearch
"Search" menu entry
Definition: TGTextEditor.h:50
virtual ~TGTextEditor()
TGTextEditor destructor.
TGTextBuffer * fCommandBuf
command text buffer
Definition: TGTextEditor.h:44
TGPopupMenu * fMenuHelp
"Help" menu entry
Definition: TGTextEditor.h:52
void DeleteWindow() override
Delete TGTextEditor Window.
void LoadFile(const char *fname=0)
Load a file into the editor. If fname is 0, a TGFileDialog will popup.
Bool_t HandleTimer(TTimer *t) override
Handle timer event.
TGToolBar * fToolBar
toolbar with common tool buttons
Definition: TGTextEditor.h:39
Bool_t fExiting
true if editor is closing
Definition: TGTextEditor.h:53
TGTextBuffer * GetBuffer() const
Definition: TGTextEntry.h:112
virtual void Update()
update the whole window of text view
Definition: TGTextView.cxx:262
virtual Bool_t LoadFile(const char *fname, long startpos=0, long length=-1)
Load a file in the text view widget.
Definition: TGTextView.cxx:454
void Layout() override
Layout the components of view.
Bool_t IsMarked() const
Definition: TGTextView.h:119
virtual void AddLine(const char *string)
Add a line of text to the view widget.
Definition: TGTextView.cxx:229
virtual Bool_t SelectAll()
Select all text in the viewer.
Definition: TGTextView.cxx:517
virtual void SetSelectBack(Pixel_t p)
set selected text background color
Definition: TGTextView.cxx:179
virtual Long_t ReturnLineCount()
Definition: TGTextView.h:94
virtual void SetFont(FontStruct_t font)
Changes text entry font.
Definition: TGTextView.cxx:333
virtual void SetSelectFore(Pixel_t p)
set selected text color
Definition: TGTextView.cxx:188
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:92
virtual TGButton * GetButton(Int_t id) const
Finds and returns a pointer to the button with the specified identifier id.
Definition: TGToolBar.cxx:157
virtual void Associate(const TGWindow *w)
Definition: TGWidget.h:72
ROOT GUI Window base class.
Definition: TGWindow.h:23
const TGWindow * fParent
Parent window.
Definition: TGWindow.h:28
Class supporting a collection of lines with C++ code.
Definition: TMacro.h:31
virtual Longptr_t Exec(const char *params=0, Int_t *error=0)
Execute this macro with params, if params is 0, default parameters (set via SetParams) are used.
Definition: TMacro.cxx:268
TList * GetListOfLines() const
Definition: TMacro.h:51
const char * GetName() const override
Returns name of object.
Definition: TNamed.h:47
Collectable string class.
Definition: TObjString.h:28
const char * GetName() const override
Returns name of object.
Definition: TObjString.h:38
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:869
Bool_t Disconnect(const char *signal=nullptr, void *receiver=nullptr, const char *slot=nullptr)
Disconnects signal of this object from slot of receiver.
Definition: TQObject.cxx:1027
static const TString & GetBinDir()
Get the binary directory in the installation. Static utility function.
Definition: TROOT.cxx:2905
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:136
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.
Definition: TString.cxx:447
const char * Data() const
Definition: TString.h:369
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition: TString.cxx:2319
virtual char * ConcatFileName(const char *dir, const char *name)
Concatenate a directory and a file name. User must delete returned string.
Definition: TSystem.cxx:1071
virtual Int_t Exec(const char *shellcmd)
Execute a command.
Definition: TSystem.cxx:656
virtual Bool_t ChangeDirectory(const char *path)
Change directory.
Definition: TSystem.cxx:863
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
Definition: TSystem.cxx:935
virtual int CompileMacro(const char *filename, Option_t *opt="", const char *library_name="", const char *build_dir="", UInt_t dirmode=0)
This method compiles and loads a shared library containing the code from the file "filename".
Definition: TSystem.cxx:2836
virtual const char * WorkingDirectory()
Return working directory.
Definition: TSystem.cxx:872
virtual TString GetDirName(const char *pathname)
Return the directory name in pathname.
Definition: TSystem.cxx:1032
virtual int Unlink(const char *name)
Unlink, i.e.
Definition: TSystem.cxx:1381
virtual const char * TempDirectory() const
Return a user configured or systemwide directory to create temporary files in.
Definition: TSystem.cxx:1482
Handles synchronous and a-synchronous timer events.
Definition: TTimer.h:51
virtual void TurnOn()
Add the timer to the system timer list.
Definition: TTimer.cxx:243
void Reset()
Reset the timer.
Definition: TTimer.cxx:159
Event structure.
Definition: GuiTypes.h:174
const char * fPixmap
Definition: TGToolBar.h:24