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 // //
25 // TGTextEditor //
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 // //
125 // Up Move cursor up. //
126 // Shift+Up Move cursor up and extend selection. //
127 // Down Move cursor down. //
128 // Shift+Down Move cursor down and extend selection. //
129 // Left Move cursor left. //
130 // Shift+Left Move cursor left and extend selection. //
131 // Right Move cursor right. //
132 // Shift+Right Move cursor right and extend selection. //
133 // Home Move cursor to begin of line. //
134 // Shift+Home Move cursor to begin of line and extend selection.//
135 // Ctrl+Home Move cursor to top of page. //
136 // End Move cursor to end of line. //
137 // Shift+End Move cursor to end of line and extend selection. //
138 // Ctrl+End Move cursor to end of page. //
139 // PgUp Move cursor up one page. //
140 // Shift+PgUp Move cursor up one page and extend selection. //
141 // PgDn Move cursor down one page. //
142 // Shift+PgDn Move cursor down one page and extend selection. //
143 // Delete Delete character after cursor, or text selection. //
144 // BackSpace Delete character before cursor, or text selection.//
145 // Ctrl+B Move cursor left. //
146 // Ctrl+D Delete character after cursor, or text selection. //
147 // Ctrl+E Move cursor to end of line. //
148 // Ctrl+H Delete character before cursor, or text selection.//
149 // Ctrl+K Delete characters from current position to the //
150 // end of line. //
151 // Ctrl+U Delete current line. //
152 // //
153 //Begin_Html
154 /*
155 <img src="gif/TGTextEditor.gif">
156 */
157 //End_Html
158 // //
159 //////////////////////////////////////////////////////////////////////////
160 
161 
162 #include "TROOT.h"
163 #include "TApplication.h"
164 #include "TSystem.h"
165 #include "TMacro.h"
166 #include "TInterpreter.h"
167 #include "TGMsgBox.h"
168 #include "TGFileDialog.h"
169 #include "TGFontDialog.h"
170 #include "TGTextEdit.h"
171 #include "TGMenu.h"
172 #include "TGStatusBar.h"
173 #include "KeySymbols.h"
174 #include "TGToolBar.h"
175 #include "TG3DLine.h"
176 #include "TGLabel.h"
177 #include "TGTextEntry.h"
178 #include "TGTextEditDialogs.h"
179 #include "TGTextEditor.h"
180 #include "TGComboBox.h"
181 #include "TObjString.h"
182 #include "TRootHelpDialog.h"
183 #include "HelpText.h"
184 #include "TVirtualX.h"
185 #ifdef WIN32
186 #include "TWin32SplashThread.h"
187 #endif
188 
189 const char *ed_filetypes[] = {
190  "ROOT Macros", "*.C",
191  "Source files", "*.cxx",
192  "Text files", "*.txt",
193  "All files", "*",
194  0, 0
195 };
196 
203 };
204 
206  { "ed_new.png", "New File", kFALSE, kM_FILE_NEW, 0 },
207  { "ed_open.png", "Open File", kFALSE, kM_FILE_OPEN, 0 },
208  { "ed_save.png", "Save File", kFALSE, kM_FILE_SAVE, 0 },
209  { "ed_saveas.png", "Save File As...", kFALSE, kM_FILE_SAVEAS, 0 },
210  { "", 0, 0, -1, 0 },
211  { "ed_print.png", "Print", kFALSE, kM_FILE_PRINT, 0 },
212  { "", 0, 0, -1, 0 },
213  { "ed_cut.png", "Cut selection", kFALSE, kM_EDIT_CUT, 0 },
214  { "ed_copy.png", "Copy selection", kFALSE, kM_EDIT_COPY, 0 },
215  { "ed_paste.png", "Paste selection", kFALSE, kM_EDIT_PASTE, 0 },
216  { "ed_delete.png", "Delete selection", kFALSE, kM_EDIT_DELETE, 0 },
217  { "", 0, 0, -1, 0 },
218  { "ed_find.png", "Find...", kFALSE, kM_SEARCH_FIND, 0 },
219  { "ed_findnext.png", "Find next", kFALSE, kM_SEARCH_FINDNEXT, 0 },
220  { "ed_goto.png", "Goto...", kFALSE, kM_SEARCH_GOTO, 0 },
221  { "", 0, 0, -1, 0 },
222  { "ed_compile.png", "Compile Macro", kFALSE, kM_TOOLS_COMPILE, 0 },
223  { "ed_execute.png", "Execute Macro", kFALSE, kM_TOOLS_EXECUTE, 0 },
224  { "ed_interrupt.png", "Interrupt", kFALSE, kM_TOOLS_INTERRUPT, 0 },
225  { "", 0, 0, -1, 0 },
226  { "ed_help.png", "Help Contents", kFALSE, kM_HELP_CONTENTS, 0 },
227  { "", 0, 0, -1, 0 },
228  { "ed_quit.png", "Close Editor", kFALSE, kM_FILE_EXIT, 0 },
229  { 0, 0, 0, 0, 0 }
230 };
231 
232 static char *gEPrinter = 0;
233 static char *gEPrintCommand = 0;
234 
236 
237 ////////////////////////////////////////////////////////////////////////////////
238 /// TGTextEditor constructor with file name as first argument.
239 
240 TGTextEditor::TGTextEditor(const char *filename, const TGWindow *p, UInt_t w,
241  UInt_t h) : TGMainFrame(p, w, h)
242 {
243  Build();
244  if (p && p != gClient->GetDefaultRoot()) {
245  // special case for TRootBrowser
246  // remove the command line combo box and its associated label
249  fLabel->UnmapWindow();
252  fToolBar->Layout();
253  }
254  if (filename) {
255  LoadFile(filename);
256  }
257  MapWindow();
258 }
259 
260 ////////////////////////////////////////////////////////////////////////////////
261 /// TGTextEditor constructor with pointer to a TMacro as first argument.
262 
264  TGMainFrame(p, w, h)
265 {
266  TString tmp;
267  Build();
268  if (p && p != gClient->GetDefaultRoot()) {
269  // special case for TRootBrowser
270  // remove the command line combo box and its associated label
272  fLabel->UnmapWindow();
275  fToolBar->Layout();
276  }
277  if (macro) {
278  fMacro = macro;
279  TIter next(macro->GetListOfLines());
280  TObjString *obj;
281  while ((obj = (TObjString*) next())) {
282  fTextEdit->AddLine(obj->GetName());
283  }
284  tmp.Form("TMacro : %s: %ld lines read.",
285  macro->GetName(), fTextEdit->ReturnLineCount());
286  fStatusBar->SetText(tmp.Data(), 0);
287  fFilename = macro->GetName();
288  fFilename += ".C";
289  tmp.Form("TMacro : %s - TGTextEditor", macro->GetName());
290  SetWindowName(tmp.Data());
291  }
292  MapWindow();
293 }
294 
295 ////////////////////////////////////////////////////////////////////////////////
296 /// TGTextEditor destructor.
297 
299 {
300  gApplication->Disconnect("Terminate(Int_t)");
301  if (fTimer) delete fTimer;
302  if (fMenuFile) delete fMenuFile;
303  if (fMenuEdit) delete fMenuEdit;
304  if (fMenuSearch) delete fMenuSearch;
305  if (fMenuTools) delete fMenuTools;
306  if (fMenuHelp) delete fMenuHelp;
307 }
308 
309 ////////////////////////////////////////////////////////////////////////////////
310 /// Delete TGTextEditor Window.
311 
313 {
314  gApplication->Disconnect("Terminate(Int_t)");
315  delete fTimer; fTimer = 0;
316  delete fMenuFile; fMenuFile = 0;
317  delete fMenuEdit; fMenuEdit = 0;
318  delete fMenuSearch; fMenuSearch = 0;
319  delete fMenuTools; fMenuTools = 0;
320  delete fMenuHelp; fMenuHelp = 0;
321  Cleanup();
323 }
324 
325 ////////////////////////////////////////////////////////////////////////////////
326 /// Build TGTextEditor widget.
327 
329 {
333 
335  fMenuFile->AddEntry("&New", kM_FILE_NEW);
337  fMenuFile->AddEntry("&Open...", kM_FILE_OPEN);
338  fMenuFile->AddEntry("&Close", kM_FILE_CLOSE);
339  fMenuFile->AddEntry("&Save", kM_FILE_SAVE);
340  fMenuFile->AddEntry("Save &As...", kM_FILE_SAVEAS);
342  fMenuFile->AddEntry("&Print...", kM_FILE_PRINT);
344  fMenuFile->AddEntry("E&xit", kM_FILE_EXIT);
345 
347  fMenuEdit->AddEntry("Cu&t\tCtrl+X", kM_EDIT_CUT);
348  fMenuEdit->AddEntry("&Copy\tCtrl+C", kM_EDIT_COPY);
349  fMenuEdit->AddEntry("&Paste\tCtrl+V", kM_EDIT_PASTE);
350  fMenuEdit->AddEntry("De&lete\tDel", kM_EDIT_DELETE);
352  fMenuEdit->AddEntry("Select &All\tCtrl+A", kM_EDIT_SELECTALL);
354  fMenuEdit->AddEntry("Set &Font", kM_EDIT_SELFONT);
355 
357  fMenuTools->AddEntry("&Compile Macro\tCtrl+F7", kM_TOOLS_COMPILE);
358  fMenuTools->AddEntry("&Execute Macro\tCtrl+F5", kM_TOOLS_EXECUTE);
359  fMenuTools->AddEntry("&Interrupt\tShift+F5", kM_TOOLS_INTERRUPT);
360 
365 
367  fMenuSearch->AddEntry("&Find...\tCtrl+F", kM_SEARCH_FIND);
368  fMenuSearch->AddEntry("Find &Next\tF3", kM_SEARCH_FINDNEXT);
370  fMenuSearch->AddEntry("&Goto Line...\tCtrl+L", kM_SEARCH_GOTO);
371 
373  fMenuHelp->AddEntry("&Help Topics\tF1", kM_HELP_CONTENTS);
375  fMenuHelp->AddEntry("&About...", kM_HELP_ABOUT);
376 
377  fMenuFile->Associate(this);
378  fMenuEdit->Associate(this);
379  fMenuSearch->Associate(this);
380  fMenuTools->Associate(this);
381  fMenuHelp->Associate(this);
382 
383  fMenuBar = new TGMenuBar(this, 1, 1, kHorizontalFrame);
390  kLHintsRight));
392 
393  //---- toolbar
394 
395  AddFrame(new TGHorizontal3DLine(this),
396  new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0,0,2,2));
397  Int_t i,spacing = 8;
398  fToolBar = new TGToolBar(this, 60, 20, kHorizontalFrame);
400  for (i = 0; fTbData[i].fPixmap; i++) {
401  if (strlen(fTbData[i].fPixmap) == 0) {
402  spacing = 8;
403  continue;
404  }
405  fToolBar->AddButton(this, &fTbData[i], spacing);
406  spacing = 0;
407  }
408  fComboCmd = new TGComboBox(fToolBar, "");
411  fCommand->Associate(this);
414  kLHintsRight, 5, 5, 1, 1));
415 
416  fToolBar->AddFrame(fLabel = new TGLabel(fToolBar, "Command :"),
417  new TGLayoutHints(kLHintsCenterY | kLHintsRight, 5, 5, 1, 1));
419  0, 0, 0, 0));
420  AddFrame(new TGHorizontal3DLine(this),
421  new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0,0,2,2));
422 
427 
428  fTextEdit = new TGTextEdit(this, 10, 10, 1);
429  if (gClient->GetStyle() < 2) {
430  Pixel_t pxl;
431  gClient->GetColorByName("#3399ff", pxl);
432  fTextEdit->SetSelectBack(pxl);
434  }
435  fTextEdit->Associate(this);
437 
438  Int_t parts[] = { 75, 25 };
439  fStatusBar = new TGStatusBar(this);
441  fStatusBar->SetParts(parts, 2);
443 
444  SetClassHints("ROOT", "TGTextEditor");
445  SetWindowName("Untitled - TGTextEditor");
446 
447  fMacro = 0;
448  fFilename = "Untitled";
450 
451  fTextEdit->SetFocus();
454  fTextEdit->Connect("DataChanged()", "TGTextEditor", this, "DataChanged()");
455  fTextEdit->Connect("Closed()", "TGTextEditor", this, "ClearText()");
456  fTextEdit->Connect("Opened()", "TGTextEditor", this, "ClearText()");
457  fTextEdit->Connect("DataDropped(char *)", "TGTextEditor", this, "DataDropped(char *)");
458  fTextEdit->MapWindow();
459 
460  MapSubwindows();
461  Resize(GetDefaultWidth() + 50, GetDefaultHeight() > 500 ? GetDefaultHeight() : 500);
462  Layout();
463 
464  gApplication->Connect("Terminate(Int_t)", "TGTextEditor", this, "ClearText()");
465  gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_F3), 0, kTRUE);
466 
469 
470  fTimer = new TTimer(this, 250);
471  fTimer->Reset();
472  fTimer->TurnOn();
473 
474  fExiting = kFALSE;
476 }
477 
478 ////////////////////////////////////////////////////////////////////////////////
479 /// Update file information when receiving the signal
480 /// DataDropped from TGTextEdit widget.
481 
482 void TGTextEditor::DataDropped(char *fname)
483 {
484  TString tmp;
485  fFilename = fname;
486  tmp.Form("%s: %ld lines read.", fname, fTextEdit->ReturnLineCount());
487  fStatusBar->SetText(tmp, 0);
488  tmp.Form("%s - TGTextEditor", fname);
489  SetWindowName(tmp.Data());
490 }
491 
492 ////////////////////////////////////////////////////////////////////////////////
493 /// Slot setting the fTextChanged flag to true when the text has been
494 /// modified in fTextEdit
495 
497 {
499 }
500 
501 ////////////////////////////////////////////////////////////////////////////////
502 /// Load a file into the editor. If fname is 0, a TGFileDialog will popup.
503 
504 void TGTextEditor::LoadFile(const char *fname)
505 {
506  TString tmp;
507  TGFileInfo fi;
509  switch (IsSaved()) {
510  case kMBCancel:
511  return;
512  case kMBYes:
513  if (!fFilename.CompareTo("Untitled"))
514  SaveFileAs();
515  else
517  if (fTextChanged) {
518  return;
519  }
520  break;
521  case kMBNo:
522  break;
523  default:
524  return;
525  }
526  if (fname == 0) {
527  new TGFileDialog(fClient->GetDefaultRoot(), this, kFDOpen, &fi);
528  if (fi.fFilename && strlen(fi.fFilename)) {
529  fname = fi.fFilename;
530  }
531  }
532  if (fname) {
533  if (!fTextEdit->LoadFile(fname)) {
534  tmp.Form("Error opening file \"%s\"", fname);
535  new TGMsgBox(fClient->GetRoot(), this, "TGTextEditor",
536  tmp.Data(), kMBIconExclamation, kMBOk);
537  } else {
538  fFilename = fname;
539  tmp.Form("%s: %ld lines read.", fname, fTextEdit->ReturnLineCount());
540  fStatusBar->SetText(tmp.Data(), 0);
541  tmp.Form("%s - TGTextEditor", fname);
542  SetWindowName(tmp.Data());
544  }
545  }
546  fTextEdit->Layout();
547 }
548 
549 ////////////////////////////////////////////////////////////////////////////////
550 /// Save the edited text in the file "fname".
551 
552 void TGTextEditor::SaveFile(const char *fname)
553 {
554  char *p;
555  TString tmp;
556 
557  if (!fTextEdit->SaveFile(fname)) {
558  tmp.Form("Error saving file \"%s\"", fname);
559  new TGMsgBox(fClient->GetRoot(), this, "TGTextEditor",
560  tmp.Data(), kMBIconExclamation, kMBOk);
561  return;
562  }
563  if ((p = (char *)strrchr(fname, '/')) == 0) {
564  p = (char *)fname;
565  } else {
566  ++p;
567  }
568  tmp.Form("%s: %ld lines written.", p, fTextEdit->ReturnLineCount());
569  fStatusBar->SetText(tmp.Data(), 0);
570 
571  tmp.Form("%s - TGTextEditor", p);
572  SetWindowName(tmp.Data());
574 }
575 
576 ////////////////////////////////////////////////////////////////////////////////
577 /// Save the edited text in a file selected with TGFileDialog.
578 /// Shouldn't we create a backup file?
579 
581 {
582  TString workdir = gSystem->WorkingDirectory();
583  static TString dir(".");
584  static Bool_t overwr = kFALSE;
585  TGFileInfo fi;
587  fi.SetIniDir(dir);
588  fi.fOverwrite = overwr;
589  new TGFileDialog(fClient->GetDefaultRoot(), this, kFDSave, &fi);
590  gSystem->ChangeDirectory(workdir.Data());
591  overwr = fi.fOverwrite;
592  if (fi.fFilename && strlen(fi.fFilename)) {
593  SaveFile(fi.fFilename);
594  fFilename = fi.fFilename;
595  return kTRUE;
596  }
597  return kFALSE;
598 }
599 
600 ////////////////////////////////////////////////////////////////////////////////
601 /// Check if file has to be saved in case of modifications.
602 
604 {
605  Int_t ret;
606  TString tmp;
607  Int_t opt = (kMBYes | kMBNo);
608 
609  tmp.Form("The text has been modified. Do you want to save the changes?");
610 
611  if (!fTextChanged) {
612  return kMBNo;
613  } else {
614  if (fParent == gClient->GetDefaultRoot())
615  opt |= kMBCancel;
616  new TGMsgBox(fClient->GetRoot(), this, "TGTextEditor",
617  tmp.Data(), kMBIconExclamation, opt, &ret);
618  return ret;
619  }
620 }
621 
622 ////////////////////////////////////////////////////////////////////////////////
623 /// Open the print dialog and send current buffer to printer.
624 
626 {
627  TString tmp;
628  Int_t ret = 0;
629  if (!gEPrinter) {
630  gEPrinter = StrDup("892_2_cor"); // use gEnv
631  gEPrintCommand = StrDup("xprint");
632  }
633  new TGPrintDialog(fClient->GetDefaultRoot(), this, 400, 150,
634  &gEPrinter, &gEPrintCommand, &ret);
635  if (ret) {
636  fTextEdit->Print();
637  tmp.Form("Printed: %s", fFilename.Data());
638  fStatusBar->SetText(tmp.Data(), 0);
639  }
640 }
641 
642 ////////////////////////////////////////////////////////////////////////////////
643 /// Close TGTextEditor window.
644 
646 {
647  Bool_t reallyClose = kFALSE;
648  if (fExiting) {
649  return;
650  }
651  fExiting = kTRUE;
652  switch (IsSaved()) {
653  case kMBYes:
654  if (!fFilename.CompareTo("Untitled"))
656  else
658  // close the editor only if the text has been saved and the
659  // TGTextEditor is not embedded in the ROOT browser
660  reallyClose = (!fTextChanged || (fParent != gClient->GetDefaultRoot()));
661  break;
662  case kMBCancel:
663  reallyClose = kFALSE;
664  break;
665  case kMBNo:
666  reallyClose = kTRUE;
667  break;
668  }
669  if (reallyClose) {
670  gApplication->Disconnect("Terminate(Int_t)");
672  }
673  fExiting = kFALSE;
674 }
675 
676 ////////////////////////////////////////////////////////////////////////////////
677 /// Keyboard event handler.
678 
680 {
681  char input[10];
682  UInt_t keysym;
683 
684  if (event->fType == kGKeyPress) {
685  gVirtualX->LookupString(event, input, sizeof(input), keysym);
686 
687  switch ((EKeySym)keysym) { // ignore these keys
688  case kKey_Shift:
689  case kKey_Control:
690  case kKey_Meta:
691  case kKey_Alt:
692  case kKey_CapsLock:
693  case kKey_NumLock:
694  case kKey_ScrollLock:
695  return kTRUE;
696  case kKey_F1:
698  kM_HELP_CONTENTS, 0);
699  return kTRUE;
700  case kKey_F3:
701  Search(kTRUE);
702  return kTRUE;
703  default:
704  break;
705  }
706  if (event->fState & kKeyControlMask) { // Ctrl key modifier pressed
707  switch((EKeySym)keysym) {
708  case kKey_F5:
709  ExecuteMacro();
710  return kTRUE;
711  case kKey_F7:
712  CompileMacro();
713  return kTRUE;
714  default:
715  break;
716  }
717  }
718  if (event->fState & kKeyShiftMask) { // Shift key modifier pressed
719  switch((EKeySym)keysym) {
720  case kKey_F5:
721  InterruptMacro();
722  return kTRUE;
723  default:
724  break;
725  }
726  }
727  }
728  return TGMainFrame::HandleKey(event);
729 }
730 
731 ////////////////////////////////////////////////////////////////////////////////
732 /// Clear text edit widget.
733 
735 {
736  fTextEdit->Clear();
737  fMacro = 0;
738  fFilename = "Untitled";
739  SetWindowName("Untitled - TGTextEditor");
740  fStatusBar->SetText("New File", 0);
742 }
743 
744 ////////////////////////////////////////////////////////////////////////////////
745 /// Invokes search dialog, or just search previous string if again is true.
746 
748 {
749  if (again) {
752  }
753  else {
755  }
756 }
757 
758 ////////////////////////////////////////////////////////////////////////////////
759 /// Invokes goto dialog, and go to the specified line.
760 
762 {
763  Long_t ret;
764 
765  new TGGotoDialog(fClient->GetDefaultRoot(), this, 400, 150, &ret);
766 
767  if (ret >= 0)
768  fTextEdit->Goto(ret-1);
769 }
770 
771 ////////////////////////////////////////////////////////////////////////////////
772 /// Save the edited text in a temporary macro, then compile it.
773 
775 {
776  if (fTextEdit->ReturnLineCount() < 3)
777  return;
778  if ((fMacro) || (!fFilename.CompareTo("Untitled"))) {
779  if (!SaveFileAs())
780  return;
781  }
782  char *tmpfile = gSystem->ConcatFileName(gSystem->TempDirectory(),
784  fTextEdit->SaveFile(tmpfile, kFALSE);
785  gSystem->CompileMacro(tmpfile);
786  gSystem->Unlink(tmpfile);
787  delete [] tmpfile;
788 }
789 
790 ////////////////////////////////////////////////////////////////////////////////
791 /// Save the edited text in a temporary macro, execute it, and then delete
792 /// the temporary file.
793 
795 {
796  if (fTextEdit->ReturnLineCount() < 3)
797  return;
798  if (fMacro) {
799  fMacro->Exec();
800  return;
801  }
802  if (fTextChanged) {
803  Int_t ret;
804  new TGMsgBox(fClient->GetRoot(), this, "TGTextEditor",
805  "The text has been modified. Do you want to save the changes?",
807  if (ret == kMBYes) {
808  if (!fFilename.CompareTo("Untitled"))
809  SaveFileAs();
810  else
813  }
814  if (ret == kMBCancel)
815  return;
816  }
817  if (!fFilename.CompareTo("Untitled")) {
818  //if (!SaveFileAs())
819  // return;
820  fFilename += ".C";
821  }
822  gInterpreter->SaveContext();
823  TString savdir = gSystem->WorkingDirectory();
824  TString tmpfile = gSystem->BaseName(fFilename.Data());
825  tmpfile += "_exec";
827  fTextEdit->SaveFile(tmpfile.Data(), kFALSE);
828  gROOT->SetExecutingMacro(kTRUE);
829  gROOT->Macro(tmpfile.Data());
830  gROOT->SetExecutingMacro(kFALSE);
831  if (gInterpreter->IsLoaded(tmpfile.Data()))
832  gInterpreter->UnloadFile(tmpfile.Data());
833  gSystem->Unlink(tmpfile.Data());
834  gSystem->ChangeDirectory(savdir.Data());
835  gInterpreter->Reset();
836 }
837 
838 ////////////////////////////////////////////////////////////////////////////////
839 /// Interrupt execution of a macro.
840 
842 {
843  gROOT->SetInterrupt(kTRUE);
844 }
845 
846 ////////////////////////////////////////////////////////////////////////////////
847 /// Display ROOT splash screen.
848 
850 {
851 #ifdef R__UNIX
852  TString rootx = TROOT::GetBinDir() + "/root -a &";
853  gSystem->Exec(rootx);
854 #else
855 #ifdef WIN32
857 #else
858  char str[32];
859  sprintf(str, "About ROOT %s...", gROOT->GetVersion());
860  TRootHelpDialog *hd = new TRootHelpDialog(this, str, 600, 400);
861  hd->SetText(gHelpAbout);
862  hd->Popup();
863 #endif
864 #endif
865 }
866 
867 ////////////////////////////////////////////////////////////////////////////////
868 /// Handle timer event.
869 
871 {
872  TString tmp;
873  if (t != fTimer) return kTRUE;
874  // check if some text is available in the clipboard
875  if ((gVirtualX->InheritsFrom("TGX11")) &&
876  (gVirtualX->GetPrimarySelectionOwner() == kNone)) {
879  }
880  else {
884  }
885  // check if text is selected in the editor
886  if (fTextEdit->IsMarked()) {
894  }
895  }
896  else {
904  }
905  }
906  // get cursor position
908  tmp.Form("Ln %ld, Ch %ld", pos.fY, pos.fX);
909  fStatusBar->SetText(tmp.Data(), 1);
910  fTimer->Reset();
911  return kTRUE;
912 }
913 
914 ////////////////////////////////////////////////////////////////////////////////
915 /// Handle menu and other command generated by the user.
916 
918 {
919  TRootHelpDialog *hd;
920 
921  switch(GET_MSG(msg)) {
922  case kC_COMMAND:
923  switch(GET_SUBMSG(msg)) {
924  case kCM_BUTTON:
925  case kCM_MENU:
926  switch (parm1) {
927  // "File" menu related events
928  case kM_FILE_NEW:
929  new TGTextEditor();
930  break;
931  case kM_FILE_OPEN:
932  LoadFile();
933  break;
934  case kM_FILE_CLOSE:
935  ClearText();
936  break;
937  case kM_FILE_SAVE:
938  if (!fFilename.CompareTo("Untitled"))
939  SaveFileAs();
940  else
942  break;
943  case kM_FILE_SAVEAS:
944  SaveFileAs();
945  break;
946  case kM_FILE_PRINT:
947  PrintText();
948  break;
949  case kM_FILE_EXIT:
950  CloseWindow();
951  break;
952 
953  // "Edit" menu related events
954  case kM_EDIT_CUT:
955  fTextEdit->Cut();
956  break;
957  case kM_EDIT_COPY:
958  fTextEdit->Copy();
959  break;
960  case kM_EDIT_PASTE:
961  fTextEdit->Paste();
962  break;
963  case kM_EDIT_DELETE:
964  fTextEdit->Delete();
965  break;
966  case kM_EDIT_SELECTALL:
967  fTextEdit->SelectAll();
968  if (fTextEdit->IsMarked()) {
976  }
977  }
978  break;
979  case kM_EDIT_SELFONT:
980  {
981  Int_t count;
982  TString fontname;
984  new TGFontDialog(fClient->GetRoot(), this, &prop);
985  if (prop.fName != "") {
986  fontname.Form("-*-%s-%s-%c-*-*-%d-*-*-*-*-*-*-*",
987  prop.fName.Data(),
988  prop.fBold ? "bold" : "medium",
989  prop.fItalic ? 'i' : 'r',
990  prop.fSize);
991  if (!gVirtualX->ListFonts(fontname, 10, count)) {
992  fontname.Form("-*-%s-%s-%c-*-*-%d-*-*-*-*-*-*-*",
993  prop.fName.Data(),
994  prop.fBold ? "bold" : "medium",
995  prop.fItalic ? 'o' : 'r',
996  prop.fSize);
997  }
998  TGFont *font = fClient->GetFont(fontname);
999  if (font) {
1000  FontStruct_t editorfont = font->GetFontStruct();
1001  fTextEdit->SetFont(editorfont);
1002  fTextEdit->Update();
1003  }
1004  }
1005  }
1006  break;
1007 
1008  // "Tools" menu related events
1009  case kM_TOOLS_COMPILE:
1010  CompileMacro();
1011  break;
1012  case kM_TOOLS_EXECUTE:
1013  ExecuteMacro();
1014  break;
1015  case kM_TOOLS_INTERRUPT:
1016  InterruptMacro();
1017  break;
1018 
1019  // "Search" menu related events
1020  case kM_SEARCH_FIND:
1021  Search(kFALSE);
1022  break;
1023  case kM_SEARCH_FINDNEXT:
1024  Search(kTRUE);
1025  break;
1026  case kM_SEARCH_GOTO:
1027  Goto();
1028  break;
1029 
1030  // "Help" menu related events
1031  case kM_HELP_CONTENTS:
1032  hd = new TRootHelpDialog(this, "Help on Editor...", 600, 400);
1033  hd->SetText(gHelpTextEditor);
1034  hd->Popup();
1035  break;
1036  case kM_HELP_ABOUT:
1037  About();
1038  break;
1039  }
1040  break;
1041  }
1042  break;
1043  case kC_TEXTENTRY:
1044  switch (GET_SUBMSG(msg)) {
1045  case kTE_ENTER:
1046  {
1047  // here copy the string from text buffer to return variable
1048  const char *string = fCommandBuf->GetString();
1049  if(strlen(string) > 1) {
1050  gROOT->ProcessLine(string);
1052  }
1053  }
1054  break;
1055  default:
1056  break;
1057  }
1058  break;
1059 
1060  default:
1061  break;
1062  }
1063  return kTRUE;
1064 }
kM_SEARCH_FINDNEXT
@ kM_SEARCH_FINDNEXT
Definition: TGTextEditor.cxx:200
TGComboBox.h
TRootHelpDialog::Popup
void Popup()
Show help dialog.
Definition: TRootHelpDialog.cxx:68
TGTextEditor::CloseWindow
virtual void CloseWindow()
Close TGTextEditor window.
Definition: TGTextEditor.cxx:645
Event_t::fType
EGEventType fType
Definition: GuiTypes.h:174
TGClient::GetDefaultRoot
const TGWindow * GetDefaultRoot() const
Returns the root (i.e.
Definition: TGClient.cxx:235
TSystem::Unlink
virtual int Unlink(const char *name)
Unlink, i.e.
Definition: TSystem.cxx:1379
TGTextEditor::fStatusBar
TGStatusBar * fStatusBar
Definition: TGTextEditor.h:44
kM_EDIT_SELFONT
@ kM_EDIT_SELFONT
Definition: TGTextEditor.cxx:202
Event_t::fState
UInt_t fState
Definition: GuiTypes.h:180
GET_MSG
Int_t GET_MSG(Long_t val)
Definition: WidgetMessageTypes.h:112
TGStatusBar::SetParts
virtual void SetParts(Int_t npart)
Divide the status bar in npart equal sized parts.
Definition: TGStatusBar.cxx:292
TGTextView::AddLine
virtual void AddLine(const char *string)
Add a line of text to the view widget.
Definition: TGTextView.cxx:228
TGTextEditor::SaveFile
void SaveFile(const char *fname)
Save the edited text in the file "fname".
Definition: TGTextEditor.cxx:552
TQObject::Disconnect
Bool_t Disconnect(const char *signal=0, void *receiver=0, const char *slot=0)
Disconnects signal of this object from slot of receiver.
Definition: TQObject.cxx:1022
TGTextEditor::fMenuHelp
TGPopupMenu * fMenuHelp
Definition: TGTextEditor.h:58
kM_EDIT_SELECTALL
@ kM_EDIT_SELECTALL
Definition: TGTextEditor.cxx:200
TGWindow
Definition: TGWindow.h:31
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
ToolBarData_t::fPixmap
const char * fPixmap
Definition: TGToolBar.h:33
TGMainFrame
Definition: TGFrame.h:444
TGTextEditor::fCommandBuf
TGTextBuffer * fCommandBuf
Definition: TGTextEditor.h:50
gHelpTextEditor
R__EXTERN const char gHelpTextEditor[]
Definition: HelpText.h:27
TGHorizontal3DLine
Definition: TG3DLine.h:29
TSystem::ChangeDirectory
virtual Bool_t ChangeDirectory(const char *path)
Change directory.
Definition: TSystem.cxx:861
kM_EDIT_PASTE
@ kM_EDIT_PASTE
Definition: TGTextEditor.cxx:199
kKey_F3
@ kKey_F3
Definition: KeySymbols.h:59
TSystem::BaseName
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
Definition: TSystem.cxx:933
kM_FILE_CLOSE
@ kM_FILE_CLOSE
Definition: TGTextEditor.cxx:198
gVirtualX
#define gVirtualX
Definition: TVirtualX.h:338
TGTextEditor::fMenuFile
TGPopupMenu * fMenuFile
Definition: TGTextEditor.h:54
TGTextEditor::SaveFileAs
Bool_t SaveFileAs()
Save the edited text in a file selected with TGFileDialog.
Definition: TGTextEditor.cxx:580
TGTextEdit::GetCurrentPos
TGLongPosition GetCurrentPos() const
Definition: TGTextEdit.h:122
TString::Data
const char * Data() const
Definition: TString.h:369
kM_FILE_SAVE
@ kM_FILE_SAVE
Definition: TGTextEditor.cxx:198
kLHintsTop
@ kLHintsTop
Definition: TGLayout.h:34
Pixel_t
ULong_t Pixel_t
Definition: GuiTypes.h:39
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
EKeySym
EKeySym
Definition: KeySymbols.h:25
TGTextEditDialogs.h
kKey_ScrollLock
@ kKey_ScrollLock
Definition: KeySymbols.h:55
TGPrintDialog
Definition: TGTextEditDialogs.h:89
TObjString.h
TGTextEditor::CompileMacro
void CompileMacro()
Save the edited text in a temporary macro, then compile it.
Definition: TGTextEditor.cxx:774
kMBCancel
@ kMBCancel
Definition: TGMsgBox.h:48
TGTextEditor::fTextChanged
Bool_t fTextChanged
Definition: TGTextEditor.h:60
kKey_Shift
@ kKey_Shift
Definition: KeySymbols.h:49
TGMsgBox
Definition: TGMsgBox.h:63
FontStruct_t
Handle_t FontStruct_t
Definition: GuiTypes.h:38
TGStatusBar.h
kLHintsLeft
@ kLHintsLeft
Definition: TGLayout.h:31
TGTextEditor::fCommand
TGTextEntry * fCommand
Definition: TGTextEditor.h:49
TGTextEditor::ClearText
void ClearText()
Clear text edit widget.
Definition: TGTextEditor.cxx:734
TGLabel
Definition: TGLabel.h:32
TGCompositeFrame::Cleanup
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
Definition: TGFrame.cxx:952
TGTextEdit::kM_FILE_OPEN
@ kM_FILE_OPEN
Definition: TGTextEdit.h:41
TGToolBar
Definition: TGToolBar.h:42
TGFrame::GetDefaultHeight
virtual UInt_t GetDefaultHeight() const
Definition: TGFrame.h:216
TGTextEditor::HandleTimer
virtual Bool_t HandleTimer(TTimer *t)
Handle timer event.
Definition: TGTextEditor.cxx:870
kButtonUp
@ kButtonUp
Definition: TGButton.h:53
gInterpreter
#define gInterpreter
Definition: TInterpreter.h:560
TGLongPosition::fY
Long_t fY
Definition: TGDimension.h:66
TGTextEditor::fMenuBarItemLayout
TGLayoutHints * fMenuBarItemLayout
Definition: TGTextEditor.h:52
kKey_NumLock
@ kKey_NumLock
Definition: KeySymbols.h:54
TGTextEdit::kM_FILE_NEW
@ kM_FILE_NEW
Definition: TGTextEdit.h:41
TGComboBox::GetTextEntry
virtual TGTextEntry * GetTextEntry() const
Definition: TGComboBox.h:131
TGTextEditor::fComboCmd
TGComboBox * fComboCmd
Definition: TGTextEditor.h:48
TGFileInfo::SetIniDir
void SetIniDir(const char *inidir)
Set directory name.
Definition: TGFileDialog.cxx:115
TGTextEdit::SetFocus
virtual void SetFocus()
Definition: TGTextEdit.h:119
kM_TOOLS_COMPILE
@ kM_TOOLS_COMPILE
Definition: TGTextEditor.cxx:201
HelpText.h
TGTextEdit.h
TMacro.h
TWin32SplashThread.h
TGTextEdit::Print
virtual void Print(Option_t *="") const
Send current buffer to printer.
Definition: TGTextEdit.cxx:476
kMBYes
@ kMBYes
Definition: TGMsgBox.h:42
TGTextEdit::Copy
virtual void Copy(TObject &) const
Copy this to obj.
Definition: TGTextEdit.h:70
kM_FILE_SAVEAS
@ kM_FILE_SAVEAS
Definition: TGTextEditor.cxx:198
TGMainFrame::SetWindowName
void SetWindowName(const char *name=0)
Set window name. This is typically done via the window manager.
Definition: TGFrame.cxx:1749
TGStatusBar::SetText
virtual void SetText(TGString *text, Int_t partidx=0)
Set text in partition partidx in status bar.
Definition: TGStatusBar.cxx:144
TGTextEditor::HandleKey
virtual Bool_t HandleKey(Event_t *event)
Keyboard event handler.
Definition: TGTextEditor.cxx:679
TVirtualX.h
TRootHelpDialog::SetText
void SetText(const char *helpText)
Set help text from helpText buffer in TGTextView.
Definition: TRootHelpDialog.cxx:76
ed_filetypes
const char * ed_filetypes[]
Definition: TGTextEditor.cxx:189
TGTextView::ReturnLineCount
virtual Long_t ReturnLineCount()
Definition: TGTextView.h:105
TGTextView::SetSelectFore
virtual void SetSelectFore(Pixel_t p)
set selected text color
Definition: TGTextView.cxx:187
TGTextEntry::GetBuffer
TGTextBuffer * GetBuffer() const
Definition: TGTextEntry.h:127
kM_TOOLS_INTERRUPT
@ kM_TOOLS_INTERRUPT
Definition: TGTextEditor.cxx:201
TGTextEditor::IsSaved
Int_t IsSaved()
Check if file has to be saved in case of modifications.
Definition: TGTextEditor.cxx:603
TGTextEditor::ProcessMessage
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Handle menu and other command generated by the user.
Definition: TGTextEditor.cxx:917
TGPopupMenu::DisableEntry
virtual void DisableEntry(Int_t id)
Disable entry (disabled entries appear in a sunken relieve).
Definition: TGMenu.cxx:1723
TString
Basic string class.
Definition: TString.h:136
kMBNo
@ kMBNo
Definition: TGMsgBox.h:43
TGTextEditor::fMenuEdit
TGPopupMenu * fMenuEdit
Definition: TGTextEditor.h:55
TWin32SplashThread
Definition: TWin32SplashThread.h:18
TGTextEditor::fMenuBar
TGMenuBar * fMenuBar
Definition: TGTextEditor.h:53
TGTextEditor.h
ETextEditorCommands
ETextEditorCommands
Definition: TGTextEditor.cxx:197
TObjString::GetName
const char * GetName() const
Returns name of object.
Definition: TObjString.h:38
TGToolBar.h
kM_HELP_ABOUT
@ kM_HELP_ABOUT
Definition: TGTextEditor.cxx:202
kM_SEARCH_FIND
@ kM_SEARCH_FIND
Definition: TGTextEditor.cxx:200
TGFontDialog::FontProp_t::fName
TString fName
Definition: TGFontDialog.h:40
TSystem::GetDirName
virtual TString GetDirName(const char *pathname)
Return the directory name in pathname.
Definition: TSystem.cxx:1030
TGFrame::MapWindow
virtual void MapWindow()
map window
Definition: TGFrame.h:229
bool
TSystem::WorkingDirectory
virtual const char * WorkingDirectory()
Return working directory.
Definition: TSystem.cxx:870
kLeaveWindowMask
const Mask_t kLeaveWindowMask
Definition: GuiTypes.h:167
TGPopupMenu::AddEntry
virtual void AddEntry(TGHotString *s, Int_t id, void *ud=0, const TGPicture *p=0, TGMenuEntry *before=0)
Add a menu entry.
Definition: TGMenu.cxx:989
TGTextEditor::InterruptMacro
void InterruptMacro()
Interrupt execution of a macro.
Definition: TGTextEditor.cxx:841
TGFileDialog.h
TGTextEditor::TGTextEditor
TGTextEditor(const char *filename=0, const TGWindow *p=0, UInt_t w=900, UInt_t h=600)
TGTextEditor constructor with file name as first argument.
Definition: TGTextEditor.cxx:240
TROOT.h
TGMenuBar::AddPopup
virtual void AddPopup(TGHotString *s, TGPopupMenu *menu, TGLayoutHints *l, TGPopupMenu *before=0)
Add popup menu to menu bar.
Definition: TGMenu.cxx:417
TGStatusBar
Definition: TGStatusBar.h:29
TGTextEditor::About
void About()
Display ROOT splash screen.
Definition: TGTextEditor.cxx:849
TObjString
Collectable string class.
Definition: TObjString.h:28
gClient
#define gClient
Definition: TGClient.h:166
kLHintsBottom
@ kLHintsBottom
Definition: TGLayout.h:36
TApplication.h
TGPopupMenu::EnableEntry
virtual void EnableEntry(Int_t id)
Enable entry. By default entries are enabled.
Definition: TGMenu.cxx:1704
TGFontDialog::FontProp_t::fSize
Int_t fSize
Definition: TGFontDialog.h:41
TGTextEditor::DataDropped
void DataDropped(char *fname)
Update file information when receiving the signal DataDropped from TGTextEdit widget.
Definition: TGTextEditor.cxx:482
TGFrame::AddInput
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
Definition: TGFrame.cxx:324
TGPopupMenu::AddSeparator
virtual void AddSeparator(TGMenuEntry *before=0)
Add a menu separator to the menu.
Definition: TGMenu.cxx:1059
gEPrinter
static char * gEPrinter
Definition: TGTextEditor.cxx:232
kNone
const Handle_t kNone
Definition: GuiTypes.h:87
TString::Form
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition: TString.cxx:2289
TGFrame::DeleteWindow
virtual void DeleteWindow()
Delete window.
Definition: TGFrame.cxx:261
TTimer
Handles synchronous and a-synchronous timer events.
Definition: TTimer.h:51
TGTextEdit
Definition: TGTextEdit.h:32
TGFileInfo::fOverwrite
Bool_t fOverwrite
Definition: TGFileDialog.h:65
TG3DLine.h
TGMainFrame::SetClassHints
void SetClassHints(const char *className, const char *resourceName)
Set the windows class and resource name.
Definition: TGFrame.cxx:1817
TGTextEditor::Build
virtual void Build()
Build TGTextEditor widget.
Definition: TGTextEditor.cxx:328
TSystem::CompileMacro
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:2868
TSystem.h
TGTextEditor::fMacro
TMacro * fMacro
Definition: TGTextEditor.h:62
kLHintsCenterY
@ kLHintsCenterY
Definition: TGLayout.h:35
TGTextEdit::Clear
virtual void Clear(Option_t *="")
Clear text edit widget.
Definition: TGTextEdit.cxx:375
TGTextEdit::SaveFile
virtual Bool_t SaveFile(const char *fname, Bool_t saveas=kFALSE)
Save file.
Definition: TGTextEdit.cxx:387
h
#define h(i)
Definition: RSha256.hxx:106
kGKeyPress
@ kGKeyPress
Definition: GuiTypes.h:59
TGTextEditor::LoadFile
void LoadFile(const char *fname=0)
Load a file into the editor. If fname is 0, a TGFileDialog will popup.
Definition: TGTextEditor.cxx:504
TGCompositeFrame::MapSubwindows
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
Definition: TGFrame.cxx:1149
TGWidget::Associate
virtual void Associate(const TGWindow *w)
Definition: TGWidget.h:84
TGFrame::Resize
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:590
kKey_F1
@ kKey_F1
Definition: KeySymbols.h:57
TGObject::fId
Handle_t fId
Definition: TGObject.h:36
kKey_Control
@ kKey_Control
Definition: KeySymbols.h:50
kM_FILE_NEW
@ kM_FILE_NEW
Definition: TGTextEditor.cxx:198
TGLongPosition::fX
Long_t fX
Definition: TGDimension.h:65
kMBIconExclamation
@ kMBIconExclamation
Definition: TGMsgBox.h:35
kKey_Meta
@ kKey_Meta
Definition: KeySymbols.h:51
TGFrame::SendMessage
virtual void SendMessage(const TGWindow *w, Long_t msg, Long_t parm1, Long_t parm2)
Send message (i.e.
Definition: TGFrame.cxx:630
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
TSystem::Exec
virtual Int_t Exec(const char *shellcmd)
Execute a command.
Definition: TSystem.cxx:654
kCM_BUTTON
@ kCM_BUTTON
Definition: WidgetMessageTypes.h:36
Long_t
long Long_t
Definition: RtypesCore.h:54
TGTextEditor::fMenuTools
TGPopupMenu * fMenuTools
Definition: TGTextEditor.h:57
kLHintsRight
@ kLHintsRight
Definition: TGLayout.h:33
TGFileInfo
Definition: TGFileDialog.h:54
TGLayoutHints
Definition: TGLayout.h:57
TRootHelpDialog.h
TGFontDialog::FontProp_t
Definition: TGFontDialog.h:39
TGTextEdit::Cut
virtual Bool_t Cut()
Cut text.
Definition: TGTextEdit.cxx:441
gApplication
R__EXTERN TApplication * gApplication
Definition: TApplication.h:166
StrDup
char * StrDup(const char *str)
Duplicate the string str.
Definition: TString.cxx:2490
kKey_F7
@ kKey_F7
Definition: KeySymbols.h:63
TGTextEditor::fLabel
TGLabel * fLabel
Definition: TGTextEditor.h:47
kM_FILE_OPEN
@ kM_FILE_OPEN
Definition: TGTextEditor.cxx:198
TGTextView::SetSelectBack
virtual void SetSelectBack(Pixel_t p)
set selected text background color
Definition: TGTextView.cxx:178
kTE_ENTER
@ kTE_ENTER
Definition: WidgetMessageTypes.h:52
kM_FILE_EXIT
@ kM_FILE_EXIT
Definition: TGTextEditor.cxx:199
TGTextEditor::ExecuteMacro
void ExecuteMacro()
Save the edited text in a temporary macro, execute it, and then delete the temporary file.
Definition: TGTextEditor.cxx:794
TGTextEditor::fExiting
Bool_t fExiting
Definition: TGTextEditor.h:59
kM_EDIT_CUT
@ kM_EDIT_CUT
Definition: TGTextEditor.cxx:199
TGPopupMenu::Associate
virtual void Associate(const TGWindow *w)
Definition: TGMenu.h:219
kLHintsExpandY
@ kLHintsExpandY
Definition: TGLayout.h:38
TMacro::Exec
virtual Long_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
TGTextView::IsMarked
Bool_t IsMarked() const
Definition: TGTextView.h:130
TGTextEditor::PrintText
void PrintText()
Open the print dialog and send current buffer to printer.
Definition: TGTextEditor.cxx:625
kM_TOOLS_EXECUTE
@ kM_TOOLS_EXECUTE
Definition: TGTextEditor.cxx:201
TGMainFrame::CloseWindow
virtual void CloseWindow()
Close and delete main frame.
Definition: TGFrame.cxx:1731
KeySymbols.h
kFDSave
@ kFDSave
Definition: TGFileDialog.h:39
kKey_Alt
@ kKey_Alt
Definition: KeySymbols.h:52
kM_EDIT_DELETE
@ kM_EDIT_DELETE
Definition: TGTextEditor.cxx:200
TGFontDialog
Definition: TGFontDialog.h:36
kFocusChangeMask
const Mask_t kFocusChangeMask
Definition: GuiTypes.h:168
TGCompositeFrame::RemoveFrame
virtual void RemoveFrame(TGFrame *f)
Remove frame from composite frame.
Definition: TGFrame.cxx:1134
TGTextEditor::fTimer
TTimer * fTimer
Definition: TGTextEditor.h:43
kKey_F5
@ kKey_F5
Definition: KeySymbols.h:61
kKeyPressMask
const Mask_t kKeyPressMask
Definition: GuiTypes.h:158
TMacro
Class supporting a collection of lines with C++ code.
Definition: TMacro.h:31
unsigned int
TGCompositeFrame::GetDefaultHeight
virtual UInt_t GetDefaultHeight() const
Definition: TGFrame.h:351
kMBOk
@ kMBOk
Definition: TGMsgBox.h:44
TGComboBox
Definition: TGComboBox.h:67
TGButton::SetState
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set button state.
Definition: TGButton.cxx:188
TGLongPosition
Definition: TGDimension.h:63
TGTextEdit::Delete
virtual void Delete(Option_t *="")
Delete selection.
Definition: TGTextEdit.cxx:531
TGTextEditor::fFilename
TString fFilename
Definition: TGTextEditor.h:61
TGTextEditor
Definition: TGTextEditor.h:39
TGGotoDialog
Definition: TGTextEditDialogs.h:120
kHorizontalFrame
@ kHorizontalFrame
Definition: GuiTypes.h:382
gSystem
R__EXTERN TSystem * gSystem
Definition: TSystem.h:559
kKeyControlMask
const Mask_t kKeyControlMask
Definition: GuiTypes.h:196
TGLabel.h
kC_TEXTENTRY
@ kC_TEXTENTRY
Definition: WidgetMessageTypes.h:50
TGFileInfo::fFileTypes
const char ** fFileTypes
Definition: TGFileDialog.h:63
TString::CompareTo
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.
Definition: TString.cxx:418
TQObject::Connect
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:864
TGTextEdit::Goto
virtual Bool_t Goto(Long_t line, Long_t column=0)
Goto the specified line.
Definition: TGTextEdit.cxx:737
TSystem::TempDirectory
virtual const char * TempDirectory() const
Return a user configured or systemwide directory to create temporary files in.
Definition: TSystem.cxx:1480
TGFrame::UnmapWindow
virtual void UnmapWindow()
unmap window
Definition: TGFrame.h:231
ToolBarData_t
Definition: TGToolBar.h:32
TGMsgBox.h
TGTextEditor::fTextEdit
TGTextEdit * fTextEdit
Definition: TGTextEditor.h:46
TGObject::fClient
TGClient * fClient
Definition: TGObject.h:37
TInterpreter.h
gHelpAbout
R__EXTERN const char gHelpAbout[]
Definition: HelpText.h:17
kC_COMMAND
@ kC_COMMAND
Definition: WidgetMessageTypes.h:33
TGFontDialog::FontProp_t::fItalic
Bool_t fItalic
Definition: TGFontDialog.h:45
TMacro::GetListOfLines
TList * GetListOfLines() const
Definition: TMacro.h:51
TGButton::GetState
virtual EButtonState GetState() const
Definition: TGButton.h:112
TGTextEntry.h
TGPopupMenu
Definition: TGMenu.h:123
Event_t
Definition: GuiTypes.h:173
GET_SUBMSG
Int_t GET_SUBMSG(Long_t val)
Definition: WidgetMessageTypes.h:113
TGToolBar::AddButton
virtual TGButton * AddButton(const TGWindow *w, ToolBarData_t *button, Int_t spacing=0)
Add button to toolbar.
Definition: TGToolBar.cxx:91
kDeepCleanup
@ kDeepCleanup
Definition: TGFrame.h:51
TGFrame::GetWhitePixel
static Pixel_t GetWhitePixel()
Get white pixel value.
Definition: TGFrame.cxx:694
TGClient::GetFont
TGFont * GetFont(const char *font, Bool_t fixedDefault=kTRUE)
Get a font from the font pool.
Definition: TGClient.cxx:349
TGFontDialog::FontProp_t::fBold
Bool_t fBold
Definition: TGFontDialog.h:44
TSystem::ConcatFileName
virtual char * ConcatFileName(const char *dir, const char *name)
Concatenate a directory and a file name. User must delete returned string.
Definition: TSystem.cxx:1069
TROOT::GetBinDir
static const TString & GetBinDir()
Get the binary directory in the installation. Static utility function.
Definition: TROOT.cxx:2912
TIter
Definition: TCollection.h:233
kLHintsExpandX
@ kLHintsExpandX
Definition: TGLayout.h:37
TGFont::GetFontStruct
FontStruct_t GetFontStruct() const
Definition: TGFont.h:193
kStructureNotifyMask
const Mask_t kStructureNotifyMask
Definition: GuiTypes.h:165
kKey_CapsLock
@ kKey_CapsLock
Definition: KeySymbols.h:53
TGTextEdit::GetMenu
TGPopupMenu * GetMenu() const
Definition: TGTextEdit.h:110
TGCompositeFrame::SetCleanup
virtual void SetCleanup(Int_t mode=kLocalCleanup)
Turn on automatic cleanup of child frames in dtor.
Definition: TGFrame.cxx:1057
TGTextView::Update
virtual void Update()
update the whole window of text view
Definition: TGTextView.cxx:261
gEPrintCommand
static char * gEPrintCommand
Definition: TGTextEditor.cxx:233
TGTextEditor::DataChanged
void DataChanged()
Slot setting the fTextChanged flag to true when the text has been modified in fTextEdit.
Definition: TGTextEditor.cxx:496
TNamed::GetName
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
TGMenuBar
Definition: TGMenu.h:304
TGTextEditor::fMenuBarLayout
TGLayoutHints * fMenuBarLayout
Definition: TGTextEditor.h:51
kEnterWindowMask
const Mask_t kEnterWindowMask
Definition: GuiTypes.h:166
TGCompositeFrame::GetDefaultWidth
virtual UInt_t GetDefaultWidth() const
Definition: TGFrame.h:349
TGTextView::Layout
virtual void Layout()
Layout the components of view.
Definition: TGTextView.cxx:1328
TGFont
Definition: TGFont.h:149
TTimer::TurnOn
virtual void TurnOn()
Add the timer to the system timer list.
Definition: TTimer.cxx:241
TGTextEditor::fMenuSearch
TGPopupMenu * fMenuSearch
Definition: TGTextEditor.h:56
TGTextEdit::Search
virtual Bool_t Search(const char *string, Bool_t direction=kTRUE, Bool_t caseSensitive=kFALSE)
Search for string in the specified direction.
Definition: TGTextEdit.cxx:633
TGClient::GetRoot
const TGWindow * GetRoot() const
Returns current root (i.e.
Definition: TGClient.cxx:225
TGTextView::SetFont
virtual void SetFont(FontStruct_t font)
Changes text entry font.
Definition: TGTextView.cxx:332
TGFontDialog.h
TGTextEditor::Search
void Search(Bool_t ret)
Invokes search dialog, or just search previous string if again is true.
Definition: TGTextEditor.cxx:747
TTimer::Reset
void Reset()
Reset the timer.
Definition: TTimer.cxx:157
TGTextView::SelectAll
virtual Bool_t SelectAll()
Select all text in the viewer.
Definition: TGTextView.cxx:516
TGCompositeFrame::AddFrame
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1102
TGMenu.h
kCM_MENU
@ kCM_MENU
Definition: WidgetMessageTypes.h:34
TGTextEdit::kM_SEARCH_FINDAGAIN
@ kM_SEARCH_FINDAGAIN
Definition: TGTextEdit.h:43
kM_EDIT_COPY
@ kM_EDIT_COPY
Definition: TGTextEditor.cxx:199
TGCompositeFrame::Layout
virtual void Layout()
Layout the elements of the composite frame.
Definition: TGFrame.cxx:1242
fTbData
ToolBarData_t fTbData[]
Definition: TGTextEditor.cxx:205
kM_FILE_PRINT
@ kM_FILE_PRINT
Definition: TGTextEditor.cxx:199
TGTextEditor::fToolBar
TGToolBar * fToolBar
Definition: TGTextEditor.h:45
TGTextEditor::Goto
void Goto()
Invokes goto dialog, and go to the specified line.
Definition: TGTextEditor.cxx:761
TGTextEdit::Paste
virtual Bool_t Paste()
Paste text into widget.
Definition: TGTextEdit.cxx:454
MK_MSG
Int_t MK_MSG(EWidgetMessageTypes msg, EWidgetMessageTypes submsg)
Definition: WidgetMessageTypes.h:110
kM_SEARCH_GOTO
@ kM_SEARCH_GOTO
Definition: TGTextEditor.cxx:201
TGWindow::fParent
const TGWindow * fParent
Definition: TGWindow.h:36
kM_HELP_CONTENTS
@ kM_HELP_CONTENTS
Definition: TGTextEditor.cxx:202
kKeyShiftMask
const Mask_t kKeyShiftMask
Definition: GuiTypes.h:194
kButtonDisabled
@ kButtonDisabled
Definition: TGButton.h:56
TGToolBar::GetButton
virtual TGButton * GetButton(Int_t id) const
Finds and returns a pointer to the button with the specified identifier id.
Definition: TGToolBar.cxx:156
TGTextBuffer::GetString
const char * GetString() const
Definition: TGTextBuffer.h:47
TGMainFrame::HandleKey
virtual Bool_t HandleKey(Event_t *event)
Handle keyboard events.
Definition: TGFrame.cxx:1567
TGTextView::LoadFile
virtual Bool_t LoadFile(const char *fname, long startpos=0, long length=-1)
Load a file in the text view widget.
Definition: TGTextView.cxx:453
TRootHelpDialog
Definition: TRootHelpDialog.h:31
gROOT
#define gROOT
Definition: TROOT.h:406
TGFileDialog
Definition: TGFileDialog.h:80
kFDOpen
@ kFDOpen
Definition: TGFileDialog.h:38
TGTextEditor::~TGTextEditor
virtual ~TGTextEditor()
TGTextEditor destructor.
Definition: TGTextEditor.cxx:298
int
TGComboBox::ReturnPressed
virtual void ReturnPressed()
Add new entry to combo box when return key pressed inside text entry ReturnPressed signal is emitted.
Definition: TGComboBox.cxx:656
TGFileInfo::fFilename
char * fFilename
Definition: TGFileDialog.h:61
TGTextEditor::DeleteWindow
virtual void DeleteWindow()
Delete TGTextEditor Window.
Definition: TGTextEditor.cxx:312