Logo ROOT  
Reference Guide
TGTextView.cxx
Go to the documentation of this file.
1 // @(#)root/gui:$Id: 1f399bfa44c1323de4c6fe38d6d7a83a4bdf2e32 $
2 // Author: Fons Rademakers 1/7/2000
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 // TGTextView //
26 // //
27 // A TGTextView is a text viewer widget. It is a specialization of //
28 // TGView. It uses the TGText class (which contains all text //
29 // manipulation code, i.e. loading a file in memory, changing, //
30 // removing lines, etc.). Use a TGTextView to view non-editable text. //
31 // For supported messages see TGView. //
32 // //
33 //////////////////////////////////////////////////////////////////////////
34 
35 #include "TGTextView.h"
36 #include "TGScrollBar.h"
37 #include "TGResourcePool.h"
38 #include "TSystem.h"
39 #include "TGDNDManager.h"
40 #include "TBufferFile.h"
41 #include "TSystemFile.h"
42 #include "TObjString.h"
43 #include "TMacro.h"
44 #include "TGMsgBox.h"
45 #include "TUrl.h"
46 #include "TVirtualX.h"
47 
48 #include <iostream>
49 
50 const TGFont *TGTextView::fgDefaultFont = nullptr;
51 TGGC *TGTextView::fgDefaultGC = nullptr;
54 
55 
56 ////////////////////////////////////////////////////////////////////////////////
57 /// Notify when timer times out and reset the timer.
58 
60 {
61  fView->HandleTimer(this);
62  Reset();
63  return kFALSE;
64 }
65 
67 
68 
69 ////////////////////////////////////////////////////////////////////////////////
70 /// Initialize a text view widget.
71 
73 {
74  // set in TGResourcePool via .rootrc
79 
82  fWhiteGC.SetBackground(back);
83  fWhiteGC.SetForeground(back);
84 
85  fMarkedFromX = 0;
86  fMarkedFromY = 0;
87  fReadOnly = kFALSE;
88  fIsMarked = kFALSE;
89 
90  fText = new TGText();
91  TGView::Clear();
92 
93  fClipText = new TGText();
94 
95  gVirtualX->GetFontProperties(fFont, fMaxAscent, fMaxDescent);
97  fScrollVal.fX = fMaxWidth = gVirtualX->TextWidth(fFont, "@", 1);
98 
99  fScrollTimer = new TViewTimer(this, 75);
101 
102  // define DND types
103  fDNDTypeList = new Atom_t[3];
104  fDNDTypeList[0] = gVirtualX->InternAtom("application/root", kFALSE);
105  fDNDTypeList[1] = gVirtualX->InternAtom("text/uri-list", kFALSE);
106  fDNDTypeList[2] = 0;
107  gVirtualX->SetDNDAware(fId, fDNDTypeList);
109 
110  gVirtualX->ClearWindow(fCanvas->GetId());
111  Layout();
112 }
113 
114 ////////////////////////////////////////////////////////////////////////////////
115 /// Create a text view widget.
116 
118  UInt_t sboptions, ULong_t back) :
119  TGView(parent, w, h, id, 3, 3, kSunkenFrame | kDoubleBorder, sboptions, back)
120 {
121  Init(back);
122 }
123 
124 ////////////////////////////////////////////////////////////////////////////////
125 /// Create a text view widget.
126 
128  Int_t id, UInt_t sboptions, ULong_t back) :
129  TGView(parent, w, h, id, 3, 3, kSunkenFrame | kDoubleBorder, sboptions, back)
130 {
131  Init(back);
132  TGLongPosition pos, srcStart, srcEnd;
133  pos.fX = pos.fY = 0;
134  srcStart.fX = srcStart.fY = 0;
135  srcEnd.fY = text->RowCount()-1;
136  srcEnd.fX = text->GetLineLength(srcEnd.fY)-1;
137  fText->InsText(pos, text, srcStart, srcEnd);
138 }
139 
140 ////////////////////////////////////////////////////////////////////////////////
141 /// Create a text view widget.
142 
144  const char *string, Int_t id, UInt_t sboptions,
145  ULong_t back) :
146  TGView(parent, w, h, id, 3, 3, kSunkenFrame | kDoubleBorder, sboptions, back)
147 {
148  Init(back);
149  TGLongPosition pos;
150  pos.fX = pos.fY = 0;
151  fText->InsText(pos, string);
152 }
153 
154 ////////////////////////////////////////////////////////////////////////////////
155 /// Cleanup text view widget.
156 
158 {
159  delete fScrollTimer;
160  delete fText;
161  delete fClipText;
162  delete [] fDNDTypeList;
163 }
164 
165 ////////////////////////////////////////////////////////////////////////////////
166 /// set background color
167 
169 {
173 }
174 
175 ////////////////////////////////////////////////////////////////////////////////
176 /// set selected text background color
177 
179 {
182 }
183 
184 ////////////////////////////////////////////////////////////////////////////////
185 /// set selected text color
186 
188 {
191 }
192 
193 ////////////////////////////////////////////////////////////////////////////////
194 /// Adopt a new text buffer. The text will be deleted by this object.
195 
197 {
198  Clear();
199  delete fText;
200  fText = text;
201  Layout();
202 }
203 
204 ////////////////////////////////////////////////////////////////////////////////
205 /// Add text to the view widget.
206 
208 {
210 
211  fText->AddText(text);
212  Layout();
213 
215 
216  if (h2 <= h1) {
217  return;
218  }
219 
220  if (h2 < fCanvas->GetHeight()) {
221  UpdateRegion(0, h1, fCanvas->GetWidth(), h2 - h1);
222  }
223 }
224 
225 ////////////////////////////////////////////////////////////////////////////////
226 /// Add a line of text to the view widget.
227 
228 void TGTextView::AddLine(const char *string)
229 {
231 
232  AddLineFast(string);
233  Layout();
234 
236 
237  if (h2 <= h1) {
238  return;
239  }
240  if (h2 < fCanvas->GetHeight()) {
241  UpdateRegion(0, h1, fCanvas->GetWidth(), h2 - h1);
242  }
243 }
244 
245 ////////////////////////////////////////////////////////////////////////////////
246 /// Add a line of text to the view widget.
247 /// Fast version. Use it if you are going to add
248 /// several lines, than call Update().
249 
250 void TGTextView::AddLineFast(const char *string)
251 {
252  TGLongPosition pos;
253  pos.fX = 0;
254  pos.fY = fText->RowCount();
255  fText->InsText(pos, string);
256 }
257 
258 ////////////////////////////////////////////////////////////////////////////////
259 /// update the whole window of text view
260 
262 {
263  Layout();
266 }
267 
268 ////////////////////////////////////////////////////////////////////////////////
269 /// Return width of longest line.
270 
272 {
273  Long_t count = 0, longest = 0, width;
274  Long_t rows = fText->RowCount();
275  while (count < rows) {
276  width = ToScrXCoord(fText->GetLineLength(count), count) + fVisible.fX;
277  if (width > longest) {
278  longest = width;
279  }
280  count++;
281  }
282  return longest;
283 }
284 
285 ////////////////////////////////////////////////////////////////////////////////
286 /// Search for string in text. If direction is true search forward.
287 /// Returns true if string is found.
288 
289 Bool_t TGTextView::Search(const char *string, Bool_t direction, Bool_t caseSensitive)
290 {
291  TGLongPosition pos, pos2;
292  pos2.fX = pos2.fY = 0;
293  if (fIsMarked) {
294  if (!direction) {
295  pos2.fX = fMarkedStart.fX;
296  pos2.fY = fMarkedStart.fY;
297  } else {
298  pos2.fX = fMarkedEnd.fX + 1;
299  pos2.fY = fMarkedEnd.fY;
300  }
301  }
302  if (!fText->Search(&pos, pos2, string, direction, caseSensitive)) {
303  return kFALSE;
304  }
305  UnMark();
306  fIsMarked = kTRUE;
307  fMarkedStart.fY = fMarkedEnd.fY = pos.fY;
308  fMarkedStart.fX = pos.fX;
309  fMarkedEnd.fX = fMarkedStart.fX + strlen(string) - 1;
310  pos.fY = ToObjYCoord(fVisible.fY);
311  if ((fMarkedStart.fY < pos.fY) ||
313  pos.fY = fMarkedStart.fY;
314  }
315  pos.fX = ToObjXCoord(fVisible.fX, pos.fY);
316  if ((fMarkedStart.fX < pos.fX) ||
318  pos.fX = fMarkedStart.fX;
319  }
320 
325 
326  return kTRUE;
327 }
328 
329 ////////////////////////////////////////////////////////////////////////////////
330 /// Changes text entry font.
331 
333 {
334  if (font != fFont) {
335  fFont = font;
336  fNormGC.SetFont(gVirtualX->GetFontHandle(fFont));
337  fSelGC.SetFont(gVirtualX->GetFontHandle(fFont));
338  fClient->NeedRedraw(this);
339  }
340 }
341 
342 ////////////////////////////////////////////////////////////////////////////////
343 /// Convert line number to screen coordinate.
344 
346 {
347  if (yCoord * (fMaxAscent + fMaxDescent) <= 0) {
348  return 0;
349  }
350  if (yCoord > fText->RowCount()) {
351  return fText->RowCount() * (fMaxAscent + fMaxDescent);
352  }
353  return yCoord * (fMaxAscent + fMaxDescent) - fVisible.fY;
354 }
355 
356 ////////////////////////////////////////////////////////////////////////////////
357 /// Convert column number in specified line to screen coordinate.
358 
360 {
361  TGLongPosition pos;
362  char *buffer;
363 
364  pos.fX = 0;
365  pos.fY = line;
367  if (xCoord <= 0 || pos.fY < 0 || width <= 0) {
368  return 0;
369  }
370  if (xCoord > width) {
371  xCoord = width;
372  }
373  buffer = fText->GetLine(pos, xCoord);
374  width = gVirtualX->TextWidth(fFont, buffer, (Int_t)xCoord) - fVisible.fX;
375  delete [] buffer;
376 
377  return width;
378 }
379 
380 ////////////////////////////////////////////////////////////////////////////////
381 /// Convert y screen coordinate to line number.
382 
384 {
385  return yCoord / (fMaxAscent + fMaxDescent);
386 }
387 
388 ////////////////////////////////////////////////////////////////////////////////
389 /// Convert x screen coordinate to column in specified line.
390 
392 {
393  TGLongPosition pos;
394  char *buffer, *travelBuffer;
395  char charBuffer;
396 
397  if (line < 0 || line >= fText->RowCount()) {
398  return 0;
399  }
400 
401  Long_t len = fText->GetLineLength(line);
402  pos.fX = 0;
403  pos.fY = line;
404  if (len <= 0 || xCoord < 0) {
405  return 0;
406  }
407 
408  Long_t viscoord = xCoord;
409  buffer = fText->GetLine(pos, len);
410  if (!buffer) return 0;
411  travelBuffer = buffer;
412  charBuffer = *travelBuffer++;
413  int cw = gVirtualX->TextWidth(fFont, &charBuffer, 1);
414 
415  while (viscoord - cw >= 0 && pos.fX < len) {
416  viscoord -= cw;
417  pos.fX++;
418  charBuffer = *travelBuffer++;
419  cw = gVirtualX->TextWidth(fFont, &charBuffer, 1);
420  }
421 
422  delete [] buffer;
423  return pos.fX;
424 }
425 
426 ////////////////////////////////////////////////////////////////////////////////
427 /// Clear text view widget.
428 
430 {
431  TGView::Clear();
432  fIsMarked = kFALSE;
433  fIsSaved = kTRUE;
435  fMarkedEnd.fX = fMarkedEnd.fY = 0;
436  fIsMarking = kFALSE;
437 
438  delete fText;
439  fText = new TGText();
440  fText->Clear();
442  Marked(kFALSE);
443  gVirtualX->ClearWindow(fCanvas->GetId());
445  DataChanged();
446  Layout();
447 }
448 
449 ////////////////////////////////////////////////////////////////////////////////
450 /// Load a file in the text view widget. Return false in case file does not
451 /// exist.
452 
453 Bool_t TGTextView::LoadFile(const char *filename, Long_t startpos, Long_t length)
454 {
455  FILE *fp;
456  if (!(fp = fopen(filename, "r")))
457  return kFALSE;
458  fclose(fp);
459 
460  ShowTop();
461  Clear();
462  fText->Load(filename, startpos, length);
463  Update();
464  return kTRUE;
465 }
466 
467 ////////////////////////////////////////////////////////////////////////////////
468 /// Load text from a text buffer. Return false in case of failure.
469 
470 Bool_t TGTextView::LoadBuffer(const char *txtbuf)
471 {
472  if (!txtbuf || !txtbuf[0]) {
473  return kFALSE;
474  }
475 
476  Clear();
477  fText->LoadBuffer(txtbuf);
478  Update();
479  return kTRUE;
480 }
481 
482 ////////////////////////////////////////////////////////////////////////////////
483 /// Copy selected text to clipboard.
484 
486 {
487  TGLongPosition insPos, startPos, endPos;
488 
489  if (!fIsMarked) {
490  return kFALSE;
491  }
492  delete fClipText;
493  fClipText = new TGText();
494  insPos.fY = insPos.fX = 0;
495  startPos.fX = fMarkedStart.fX;
496  startPos.fY = fMarkedStart.fY;
497  endPos.fX = fMarkedEnd.fX-1;
498  endPos.fY = fMarkedEnd.fY;
499  if (endPos.fX == -1) {
500  if (endPos.fY > 0) {
501  endPos.fY--;
502  }
503  endPos.fX = fText->GetLineLength(endPos.fY);
504  if (endPos.fX < 0) {
505  endPos.fX = 0;
506  }
507  }
508  fClipText->InsText(insPos, fText, startPos, endPos);
509  gVirtualX->SetPrimarySelectionOwner(fId);
510  return kTRUE;
511 }
512 
513 ////////////////////////////////////////////////////////////////////////////////
514 /// Select all text in the viewer.
515 
517 {
518  if (fText->RowCount() == 1 && fText->GetLineLength(0) == 0) {
519  return kFALSE;
520  }
521  fIsMarked = kTRUE;
522  fMarkedStart.fY = 0;
523  fMarkedStart.fX = 0;
524  fMarkedEnd.fY = fText->RowCount()-1;
526  if (fMarkedEnd.fX < 0) {
527  fMarkedEnd.fX = 0;
528  }
530  Copy();
531 
532  return kTRUE;
533 }
534 
535 ////////////////////////////////////////////////////////////////////////////////
536 /// Draw lines in exposed region.
537 
539 {
540  char *buffer;
541 
542  TGLongPosition pos;
543  Long_t xoffset, len, len1, len2;
544  Long_t line_count = fText->RowCount();
545  Rectangle_t rect;
546  rect.fX = x;
547  rect.fY = y;
548  pos.fY = ToObjYCoord(fVisible.fY + h);
549  rect.fHeight = UShort_t(h + ToScrYCoord(pos.fY + 1) - ToScrYCoord(pos.fY));
550  pos.fX = ToObjXCoord(fVisible.fX + w, pos.fY);
551  rect.fWidth = UShort_t(w + ToScrXCoord(pos.fX + 1, pos.fY) - ToScrXCoord(pos.fX, pos.fY));
552  Int_t yloc = rect.fY + (Int_t)fScrollVal.fY;
553  pos.fY = ToObjYCoord(fVisible.fY + rect.fY);
554 
555  while (pos.fY <= line_count &&
556  yloc - fScrollVal.fY <= (Int_t)fCanvas->GetHeight() &&
557  yloc <= rect.fY + rect.fHeight) {
558 
559  pos.fX = ToObjXCoord(fVisible.fX + rect.fX, pos.fY);
560  xoffset = ToScrXCoord(pos.fX, pos.fY);
561  len = fText->GetLineLength(pos.fY) - pos.fX;
562 
563  gVirtualX->ClearArea(fCanvas->GetId(), x, Int_t(ToScrYCoord(pos.fY)),
564  rect.fWidth, UInt_t(ToScrYCoord(pos.fY+1)-ToScrYCoord(pos.fY)));
565 
566 
567  if (len > 0) {
568  if (len > ToObjXCoord(fVisible.fX + rect.fX + rect.fWidth, pos.fY) - pos.fX) {
569  len = ToObjXCoord(fVisible.fX + rect.fX + rect.fWidth, pos.fY) - pos.fX + 1;
570  }
571  if (pos.fX == 0) {
572  xoffset = -fVisible.fX;
573  }
574  if (pos.fY >= ToObjYCoord(fVisible.fY)) {
575  buffer = fText->GetLine(pos, len);
576  if (!buffer) // skip next lines and continue the while() loop
577  continue;
578  Int_t i = 0;
579  while (buffer[i] != '\0') {
580  if (buffer[i] == '\t') {
581  buffer[i] = ' ';
582  Int_t j = i+1;
583  while (buffer[j] == 16 && buffer[j] != '\0') {
584  buffer[j++] = ' ';
585  }
586  }
587  i++;
588  }
589 
590  if (!fIsMarked ||
591  pos.fY < fMarkedStart.fY || pos.fY > fMarkedEnd.fY ||
592  (pos.fY == fMarkedStart.fY &&
593  fMarkedStart.fX >= pos.fX+len &&
595  (pos.fY == fMarkedEnd.fY &&
596  fMarkedEnd.fX < pos.fX &&
599  (fMarkedEnd.fX < pos.fX ||
600  fMarkedStart.fX > pos.fX+len))) {
601 
602  gVirtualX->DrawString(fCanvas->GetId(), fNormGC(), Int_t(xoffset),
603  Int_t(ToScrYCoord(pos.fY+1) - fMaxDescent),
604  buffer, Int_t(len));
605  } else {
606  if (pos.fY > fMarkedStart.fY && pos.fY < fMarkedEnd.fY) {
607  len1 = 0;
608  len2 = len;
609  } else {
610  if (fMarkedStart.fY == fMarkedEnd.fY) {
611  if (fMarkedStart.fX >= pos.fX &&
612  fMarkedStart.fX <= pos.fX + len) {
613  len1 = fMarkedStart.fX - pos.fX;
614  } else {
615  len1 = 0;
616  }
617  if (fMarkedEnd.fX >= pos.fX &&
618  fMarkedEnd.fX <= pos.fX + len) {
619  len2 = fMarkedEnd.fX - pos.fX - len1; // +1
620  } else {
621  len2 = len - len1;
622  }
623  } else {
624  if (pos.fY == fMarkedStart.fY) {
625  if (fMarkedStart.fX < pos.fX) {
626  len1 = 0;
627  len2 = len;
628  } else {
629  len1 = fMarkedStart.fX - pos.fX;
630  len2 = len - len1;
631  }
632  } else {
633  if (fMarkedEnd.fX > pos.fX+len) {
634  len1 = 0;
635  len2 = len;
636  } else {
637  len1 = 0 ;
638  len2 = fMarkedEnd.fX - pos.fX; // +1
639  }
640  }
641  }
642  }
643  gVirtualX->DrawString(fCanvas->GetId(), fNormGC(),
644  Int_t(ToScrXCoord(pos.fX, pos.fY)),
645  Int_t(ToScrYCoord(pos.fY+1) - fMaxDescent),
646  buffer, Int_t(len1));
647  gVirtualX->FillRectangle(fCanvas->GetId(), fSelbackGC(),
648  Int_t(ToScrXCoord(pos.fX+len1, pos.fY)),
649  Int_t(ToScrYCoord(pos.fY)),
650  UInt_t(ToScrXCoord(pos.fX+len1+len2, pos.fY) -
651  ToScrXCoord(pos.fX+len1, pos.fY)),
652  UInt_t(ToScrYCoord(pos.fY+1)-ToScrYCoord(pos.fY)));
653  gVirtualX->DrawString(fCanvas->GetId(), fSelGC(),
654  Int_t(ToScrXCoord(pos.fX+len1, pos.fY)),
655  Int_t(ToScrYCoord(pos.fY+1) - fMaxDescent),
656  buffer+len1, Int_t(len2));
657  gVirtualX->DrawString(fCanvas->GetId(), fNormGC(),
658  Int_t(ToScrXCoord(pos.fX+len1+len2, pos.fY)),
659  Int_t(ToScrYCoord(pos.fY+1) - fMaxDescent),
660  buffer+len1+len2, Int_t(len-(len1+len2)));
661  }
662  delete [] buffer;
663  }
664  }
665  pos.fY++;
666  yloc += Int_t(ToScrYCoord(pos.fY) - ToScrYCoord(pos.fY-1));
667  }
668 }
669 
670 ////////////////////////////////////////////////////////////////////////////////
671 /// Handle mouse crossing event.
672 
674 {
675  if (event->fWindow != fCanvas->GetId())
676  return kTRUE;
677 
678  fMousePos.fY = ToObjYCoord(fVisible.fY + event->fY);
679  if (ToScrYCoord(fMousePos.fY+1) >= (Int_t)fCanvas->GetHeight()) {
680  fMousePos.fY--;
681  }
684  fMousePos.fX--;
685  }
686  if ((event->fState & kButton1Mask) && fIsMarked && fIsMarking) {
687  if (event->fType == kLeaveNotify) {
688  if (event->fX < 0) {
689  fScrolling = 0;
690  return kFALSE;
691  }
692  if (event->fX >= (Int_t)fCanvas->GetWidth()) {
693  fScrolling = 1;
694  return kFALSE;
695  }
696  if (event->fY < 0) {
697  fScrolling = 2;
698  return kFALSE;
699  }
700  if (event->fY >= (Int_t)fCanvas->GetHeight()) {
701  fScrolling = 3;
702  return kFALSE;
703  }
704  } else {
705  fScrolling = -1;
707  }
708  } else {
709  fIsMarking = kFALSE;
710  }
711 
712  return kTRUE;
713 }
714 
715 ////////////////////////////////////////////////////////////////////////////////
716 /// Handle scroll timer.
717 
719 {
720  static const Int_t kAutoScrollFudge = 10;
721  static const Int_t kAcceleration[kAutoScrollFudge + 1] = {1, 1, 1, 1, 2, 3, 4, 6, 8, 12, 16};
722 
723  TGLongPosition size;
724  Window_t dum1, dum2;
725  Event_t ev;
726  ev.fType = kButtonPress;
727  Int_t x, y;
728  Int_t dy = 0;
729 
730  if (fMarkedStart.fY == fMarkedEnd.fY) {
731  return kFALSE;
732  }
733  if (fIsMarked && (fScrolling != -1)) {
734  // where cursor
735  gVirtualX->QueryPointer(fId, dum1, dum2, ev.fXRoot, ev.fYRoot, x, y, ev.fState);
736 
738 
739  if (fMousePos.fY >= ReturnLineCount()) {
740  fMousePos.fY = ReturnLineCount() - 1;
741  }
742  if (fMousePos.fY < 0) {
743  fMousePos.fY = 0;
744  }
745  if (ev.fState & kButton1Mask) {
746 
747  // Figure scroll amount y
748  if (y < kAutoScrollFudge) {
749  dy = kAutoScrollFudge - y;
750  } else if ((Int_t)fCanvas->GetHeight() - kAutoScrollFudge <= y) {
751  dy = fCanvas->GetHeight() - kAutoScrollFudge - y;
752  }
753  Int_t ady = TMath::Abs(dy) >> 3;
754 
755  if (dy) {
756  if (ady > kAutoScrollFudge) ady = kAutoScrollFudge;
757  dy = kAcceleration[ady];
758  } else {
759  dy = 1;
760  }
761 
762  if (y > (Int_t)fCanvas->GetHeight()) {
763  fScrolling = 3;
764  }
765  if (y < 0) {
766  fScrolling = 2;
767  }
768  } else {
769  fScrolling = -1;
770  }
771 
772  size.fY = ToObjYCoord(fVisible.fY + fCanvas->GetHeight()) - 1;
773  size.fX = ToObjXCoord(fVisible.fX + fCanvas->GetWidth(), fMousePos.fY) - 1;
774  switch (fScrolling) {
775  case -1:
776  break;
777  case 0:
778  if (fVisible.fX == 0) {
779  fScrolling = -1;
780  break;
781  } else {
784  }
785  break;
786  case 1:
788  fScrolling = -1;
789  break;
790  } else {
792  Mark(size.fX+1, fMousePos.fY);
793  }
794  break;
795  case 2:
796  if (fVisible.fY == 0) {
797  fScrolling = -1;
798  break;
799  } else {
802  }
803  break;
804  case 3:
806  fScrolling = -1;
807  break;
808  } else {
810  Mark(fMousePos.fX, size.fY + 1);
811  }
812  break;
813  default:
814  break;
815  }
816  }
817  return kTRUE;
818 }
819 
820 ////////////////////////////////////////////////////////////////////////////////
821 /// Handle mouse button event in text editor.
822 
824 {
825  if (event->fWindow != fCanvas->GetId()) {
826  return kFALSE;
827  }
828 
829  if (event->fCode == kButton1) {
830  if (event->fType == kButtonPress) {
831  if (fIsMarked) {
832  if (event->fState & kKeyShiftMask) {
833  fIsMarking = kTRUE;
834  HandleMotion(event);
835  return kTRUE;
836  }
837 
838  UnMark();
839  }
840  fIsMarked = kTRUE;
841  fIsMarking = kTRUE;
842  fMousePos.fY = ToObjYCoord(fVisible.fY + event->fY);
846  } else {
847  fScrolling = -1;
848  if ((fMarkedStart.fX == fMarkedEnd.fX) &&
849  (fMarkedStart.fY == fMarkedEnd.fY)) {
850  fIsMarked = kFALSE;
852  fWidgetId, kFALSE);
853  Marked(kFALSE);
854  } else {
856  fWidgetId, kTRUE);
857  Marked(kTRUE);
858  }
859  fIsMarking = kFALSE;
860  }
861  } else if (event->fCode == kButton4) {
862  // move three lines up
863  if (fVisible.fY > 0) {
864  Long_t amount = fVisible.fY / fScrollVal.fY - 3;
865  SetVsbPosition((amount >= 0) ? amount : 0);
866  //Mark(fMousePos.fX, fMarkedStart.fY - 3);
867  }
868  } else if (event->fCode == kButton5) {
869  // move three lines down
871  TGLongPosition size;
872  size.fY = ToObjYCoord(fVisible.fY + fCanvas->GetHeight()) - 1;
874  //Mark(fMousePos.fX, size.fY + 3);
875  }
876  } else if (event->fType == kButtonPress) {
877  if (event->fCode == kButton2) {
879  fWidgetId, (event->fYRoot << 16) | event->fXRoot);
880  UnMark();
881  } else if (event->fCode == kButton3) {
883  fWidgetId, (event->fYRoot << 16) | event->fXRoot);
884  }
885  }
886 
887  if (event->fType == kButtonRelease) {
888  if (event->fCode == kButton1) {
889  if (fIsMarked) {
890  Copy();
891  }
892  }
893  }
894 
895  return kTRUE;
896 }
897 
898 ////////////////////////////////////////////////////////////////////////////////
899 /// handle double click
900 
902 {
903  return kFALSE;
904 }
905 
906 ////////////////////////////////////////////////////////////////////////////////
907 /// Handle mouse motion event in the text editor widget.
908 
910 {
911  if ((ToObjYCoord(fVisible.fY+event->fY) == fMousePos.fY) &&
912  (ToObjXCoord(fVisible.fX+event->fX, ToObjYCoord(fVisible.fY + event->fY)) == fMousePos.fX)) {
913  return kTRUE;
914  }
915 
916  if (fScrolling != -1) {
917  return kTRUE;
918  }
919 
920  fMousePos.fY = ToObjYCoord(fVisible.fY + event->fY);
921  if (fMousePos.fY >= ReturnLineCount()) {
923  }
925 
928  }
929  if (event->fWindow != fCanvas->GetId()) {
930  return kTRUE;
931  }
932 
933  if (!fIsMarking) {
934  return kTRUE;
935  }
936  if (event->fX < 0) {
937  return kTRUE;
938  }
939  if (event->fX >= (Int_t)fCanvas->GetWidth()) {
940  return kTRUE;
941  }
942  if (event->fY < 0) {
943  return kTRUE;
944  }
945  if (event->fY >= (Int_t)fCanvas->GetHeight()) {
946  return kTRUE;
947  }
949  return kTRUE;
950 }
951 
952 ////////////////////////////////////////////////////////////////////////////////
953 /// Handle selection clear event.
954 
956 {
957  if (fIsMarked) {
958  UnMark();
959  }
960  return kTRUE;
961 }
962 
963 ////////////////////////////////////////////////////////////////////////////////
964 /// Handle request to send current clipboard contents to requestor window.
965 
967 {
968  Event_t reply;
969  char *buffer, *temp_buffer;
970  Long_t len, prev_len, temp_len, count;
971  TGLongPosition pos;
972  Atom_t targets[2];
973  Atom_t type;
974 
975  reply.fType = kSelectionNotify;
976  reply.fTime = event->fTime;
977  reply.fUser[0] = event->fUser[0]; // requestor
978  reply.fUser[1] = event->fUser[1]; // selection
979  reply.fUser[2] = event->fUser[2]; // target
980  reply.fUser[3] = event->fUser[3]; // property
981 
982  targets[0] = gVirtualX->InternAtom("TARGETS", kFALSE);
983  targets[1] = gVirtualX->InternAtom("XA_STRING", kFALSE);
984 
985  if ((Atom_t)event->fUser[2] == targets[0]) {
986  type = gVirtualX->InternAtom("XA_ATOM", kFALSE);
987  gVirtualX->ChangeProperty((Window_t) event->fUser[0], (Atom_t) event->fUser[3],
988  type, (UChar_t*) targets, (Int_t) 2);
989 
990  gVirtualX->SendEvent((Window_t)event->fUser[0], &reply);
991  return kTRUE;
992  }
993 
994  len = 0;
995  for (count = 0; count < fClipText->RowCount(); count++) {
996  len += fClipText->GetLineLength(count)+1;
997  }
998  len--; // remove \n for last line
999 
1000  pos.fY = pos.fX = 0;
1001  buffer = new char[len+1];
1002  prev_len = temp_len = 0;
1003  for (pos.fY = 0; pos.fY < fClipText->RowCount(); pos.fY++) {
1004  temp_len = fClipText->GetLineLength(pos.fY);
1005  if (temp_len < 0) break;
1006  temp_buffer = fClipText->GetLine(pos, temp_len);
1007  strncpy(buffer+prev_len, temp_buffer, (UInt_t)temp_len);
1008  if (pos.fY < fClipText->RowCount()-1) {
1009  buffer[prev_len+temp_len] = 10; // \n
1010  prev_len += temp_len+1;
1011  } else
1012  prev_len += temp_len;
1013  delete [] temp_buffer;
1014  }
1015  buffer[len] = '\0';
1016 
1017  // get rid of special tab fillers
1018  ULong_t i = 0;
1019  while (buffer[i]) {
1020  if (buffer[i] == '\t') {
1021  ULong_t j = i + 1;
1022  while (buffer[j] == 16 && buffer[j]) {
1023  j++;
1024  }
1025  // coverity[secure_coding]
1026  strcpy(buffer+i+1, buffer+j);
1027  len -= j - i - 1;
1028  }
1029  i++;
1030  }
1031 
1032  gVirtualX->ChangeProperty((Window_t) event->fUser[0], (Atom_t) event->fUser[3],
1033  (Atom_t) event->fUser[2], (UChar_t*) buffer,
1034  (Int_t) len);
1035 
1036  delete [] buffer;
1037 
1038  gVirtualX->SendEvent((Window_t)event->fUser[0], &reply);
1039 
1040  return kTRUE;
1041 }
1042 
1043 ////////////////////////////////////////////////////////////////////////////////
1044 /// Returns true if given a text file
1045 /// Uses the specification given on p86 of the Camel book
1046 /// - Text files have no NULLs in the first block
1047 /// - and less than 30% of characters with high bit set
1048 
1049 static Bool_t IsTextFile(const char *candidate)
1050 {
1051  Int_t i;
1052  Int_t nchars;
1053  Int_t weirdcount = 0;
1054  char buffer[512];
1055  FILE *infile;
1056  FileStat_t buf;
1057 
1058  if (gSystem->GetPathInfo(candidate, buf) || !(buf.fMode & kS_IFREG))
1059  return kFALSE;
1060 
1061  infile = fopen(candidate, "r");
1062  if (infile) {
1063  // Read a block
1064  nchars = fread(buffer, 1, 512, infile);
1065  fclose (infile);
1066  // Examine the block
1067  for (i = 0; i < nchars; i++) {
1068  if (buffer[i] & 128)
1069  weirdcount++;
1070  if (buffer[i] == '\0')
1071  // No NULLs in text files
1072  return kFALSE;
1073  }
1074  if ((nchars > 0) && ((weirdcount * 100 / nchars) > 30))
1075  return kFALSE;
1076  } else {
1077  // Couldn't open it. Not a text file then
1078  return kFALSE;
1079  }
1080  return kTRUE;
1081 }
1082 
1083 ////////////////////////////////////////////////////////////////////////////////
1084 /// Handle Drop event
1085 
1087 {
1088  static Atom_t rootObj = gVirtualX->InternAtom("application/root", kFALSE);
1089  static Atom_t uriObj = gVirtualX->InternAtom("text/uri-list", kFALSE);
1090 
1091  if (fText->RowCount() > 1) {
1092  Int_t ret;
1094  "Overvrite", "Do you want to replace existing text?",
1095  kMBIconExclamation, kMBYes | kMBNo, &ret);
1096  if (ret == kMBNo)
1097  return kTRUE;
1098  }
1099  if (data->fDataType == rootObj) {
1100  TBufferFile buf(TBuffer::kRead, data->fDataLength, (void *)data->fData);
1101  buf.SetReadMode();
1102  TObject *obj = (TObject *)buf.ReadObjectAny(TObject::Class());
1103  if (obj && obj->InheritsFrom("TMacro")) {
1104  TMacro *macro = (TMacro *)obj;
1105  TIter next(macro->GetListOfLines());
1106  TObjString *objs;
1107  while ((objs = (TObjString*) next())) {
1108  AddLine(objs->GetName());
1109  }
1110  }
1111  else if (obj && obj->InheritsFrom("TSystemFile")) {
1112  TSystemFile *sfile = (TSystemFile *)obj;
1113  LoadFile(sfile->GetName());
1114  DataDropped(sfile->GetName());
1115  }
1116  return kTRUE;
1117  }
1118  else if (data->fDataType == uriObj) {
1119  TString sfname((char *)data->fData);
1120  if (sfname.Length() > 7) {
1121  sfname.ReplaceAll("\r\n", "");
1122  TUrl uri(sfname.Data());
1123  if (IsTextFile(uri.GetFile())) {
1124  LoadFile(uri.GetFile());
1125  DataDropped(uri.GetFile());
1126  }
1127  }
1128  }
1129  return kFALSE;
1130 }
1131 
1132 ////////////////////////////////////////////////////////////////////////////////
1133 /// Handle Drag position event
1134 
1136  Int_t /*xroot*/, Int_t /*yroot*/)
1137 {
1138  return action;
1139 }
1140 
1141 ////////////////////////////////////////////////////////////////////////////////
1142 /// Handle Drag Enter event
1143 
1145 {
1146  static Atom_t rootObj = gVirtualX->InternAtom("application/root", kFALSE);
1147  static Atom_t uriObj = gVirtualX->InternAtom("text/uri-list", kFALSE);
1148  Atom_t ret = kNone;
1149  for (int i = 0; typelist[i] != kNone; ++i) {
1150  if (typelist[i] == rootObj)
1151  ret = rootObj;
1152  if (typelist[i] == uriObj)
1153  ret = uriObj;
1154  }
1155  return ret;
1156 }
1157 
1158 ////////////////////////////////////////////////////////////////////////////////
1159 /// Handle Drag Leave event
1160 
1162 {
1163  return kTRUE;
1164 }
1165 
1166 ////////////////////////////////////////////////////////////////////////////////
1167 /// Mark a text region from xPos to yPos.
1168 
1170 {
1171  TGLongPosition posStart, posEnd, pos;
1172 
1173  pos.fY = yPos;
1174  pos.fX = xPos;
1175  if (pos.fY > fText->RowCount()-1) {
1176  pos.fY = fText->RowCount()-1;
1177  }
1178  if (pos.fX > fText->GetLineLength(pos.fY)) {
1179  pos.fX = fText->GetLineLength(pos.fY);
1180  }
1181  if (pos.fY < fMarkedStart.fY) {
1182  posEnd.fY = fMarkedStart.fY;
1183  if (fMarkedFromY == 1 || fMarkedFromX == 1) {
1184  posEnd.fY = fMarkedEnd.fY;
1187  }
1188  posStart.fY = pos.fY;
1189  fMarkedStart.fY = pos.fY;
1190  fMarkedStart.fX = pos.fX;
1191  fMarkedFromY = 0;
1192  fMarkedFromX = 0;
1193  } else if (pos.fY > fMarkedEnd.fY) {
1194  posStart.fY = fMarkedEnd.fY;
1195  if (fMarkedFromY == 0 || fMarkedFromX == 0) {
1196  if (fMarkedStart.fY != fMarkedEnd.fY) {
1197  posStart.fY = fMarkedStart.fY;
1200  }
1201  }
1202  fMarkedEnd.fY = pos.fY;
1203  fMarkedEnd.fX = pos.fX; // -1
1204  fMarkedFromY = 1;
1205  fMarkedFromX = 1;
1206 
1207  posEnd.fY = fMarkedEnd.fY;
1208  } else {
1209  if (pos.fX <= fMarkedStart.fX && pos.fY == fMarkedStart.fY) {
1210  posEnd.fY = fMarkedStart.fY;
1211  if (fMarkedFromY == 1 || fMarkedFromX == 1) {
1212  posEnd.fY = fMarkedEnd.fY;
1215  }
1216  fMarkedStart.fX = pos.fX;
1217  fMarkedFromY = 0;
1218  fMarkedFromX = 0;
1219  posStart.fY = fMarkedStart.fY;
1220  } else {
1221  if (pos.fX > fMarkedEnd.fX && pos.fY == fMarkedEnd.fY) {
1222  posStart.fY = fMarkedEnd.fY;
1223  if (fMarkedFromY == 0 || fMarkedFromX == 0) {
1224  posStart.fY = fMarkedStart.fY;
1227  }
1228  fMarkedEnd.fX = pos.fX; // -1
1229  fMarkedFromY = 1;
1230  fMarkedFromX = 1;
1231  posEnd.fY = fMarkedEnd.fY;
1232  } else {
1233  if (fMarkedFromY == 0 || fMarkedFromX == 0) {
1234  posStart.fY = fMarkedStart.fY;
1235  fMarkedStart.fY = pos.fY;
1236  fMarkedStart.fX = pos.fX;
1237  posEnd.fY = fMarkedStart.fY;
1238  fMarkedFromX = 0;
1239  if (fMarkedStart.fY == fMarkedEnd.fY &&
1242  fMarkedEnd.fX = pos.fX; // -1
1243  fMarkedFromX = 1;
1244  }
1245  } else if (fMarkedFromX == 1 || fMarkedFromY == 1) {
1246  posStart.fY = pos.fY;
1247  posEnd.fY = fMarkedEnd.fY;
1248  fMarkedEnd.fY = pos.fY;
1249  fMarkedEnd.fX = pos.fX; // -1
1250  fMarkedFromY = 1;
1251  fMarkedFromX = 1;
1252  if (fMarkedEnd.fX == -1) {
1253  fMarkedEnd.fY = pos.fY-1;
1255  if (fMarkedEnd.fX < 0) {
1256  fMarkedEnd.fX = 0;
1257  }
1258  }
1259  fMarkedFromX = 1;
1260  if (fMarkedStart.fY == fMarkedEnd.fY &&
1263  fMarkedStart.fX = pos.fX;
1264  fMarkedFromX = 0;
1265  }
1266  }
1267  }
1268  }
1269  }
1270 
1271  if (fMarkedEnd.fX == -1) {
1272  if (fMarkedEnd.fY > 0) {
1273  fMarkedEnd.fY--;
1274  }
1276  if (fMarkedEnd.fX < 0) {
1277  fMarkedEnd.fX = 0;
1278  }
1279  }
1280  fIsMarked = kTRUE;
1281 
1282  Int_t yy = (Int_t)ToScrYCoord(posStart.fY);
1283  UInt_t hh = UInt_t(ToScrYCoord(posEnd.fY + 1) - ToScrYCoord(posStart.fY));
1284 
1285  DrawRegion(0, yy, fCanvas->GetWidth(), hh);
1286  return;
1287 }
1288 
1289 ////////////////////////////////////////////////////////////////////////////////
1290 /// Clear marked region.
1291 
1293 {
1294  if (!fIsMarked ||
1295  ((fMarkedEnd.fY == fMarkedStart.fY) &&
1296  (fMarkedEnd.fX == fMarkedStart.fX))) {
1297  return;
1298  }
1299  fIsMarked = kFALSE;
1300 
1302  UInt_t h = UInt_t(ToScrYCoord(fMarkedEnd.fY + 1) - y);
1303 
1304  // update marked region
1305  UpdateRegion(0, y, fCanvas->GetWidth(), h);
1306 }
1307 
1308 ////////////////////////////////////////////////////////////////////////////////
1309 /// Adjust widget width to longest line.
1310 
1312 {
1314  if (line <= 0) {
1315  return;
1316  }
1318  if (fVsb->IsMapped()) {
1319  size += fVsb->GetDefaultWidth();
1320  }
1321  size += (fBorderWidth << 1) + fXMargin+1;
1322  Resize((UInt_t)size, fHeight);
1323 }
1324 
1325 ////////////////////////////////////////////////////////////////////////////////
1326 /// Layout the components of view.
1327 
1329 {
1330  VLayout();
1331  HLayout();
1332 }
1333 
1334 ////////////////////////////////////////////////////////////////////////////////
1335 /// Horizontal layout of widgets (canvas, scrollbar).
1336 
1338 {
1339  if (!fHsb) return;
1340 
1341  Int_t tcw, tch;
1342  Long_t cols;
1343  tch = fHeight - (fBorderWidth << 1) - fYMargin-1;
1344  tcw = fWidth - (fBorderWidth << 1) - fXMargin-1;
1345 
1346  if (fVsb && fVsb->IsMapped()) {
1347  tcw -= fVsb->GetDefaultWidth();
1348  if (tcw < 0) tcw = 0;
1349  }
1350  fCanvas->SetHeight(tch);
1351  fCanvas->SetWidth(tcw);
1352  cols = ReturnLongestLineWidth();
1353  if (cols <= tcw) {
1354  if (fHsb && fHsb->IsMapped()) {
1356  fHsb->UnmapWindow();
1357  VLayout();
1358  }
1360  } else {
1361  if (fHsb) {
1362  tch -= fHsb->GetDefaultHeight();
1363  if (tch < 0) tch = 0;
1365  tcw+1+fBorderWidth, fHsb->GetDefaultHeight());
1366  fHsb->MapWindow();
1368  }
1370  }
1371 }
1372 
1373 ////////////////////////////////////////////////////////////////////////////////
1374 /// Vertical layout of widgets (canvas, scrollbar).
1375 
1377 {
1378  Int_t tcw, tch;
1379  Long_t lines;
1380 
1381  tch = fHeight - (fBorderWidth << 1) - fYMargin-1;
1382  tcw = fWidth - (fBorderWidth << 1) - fXMargin-1;
1383  if (fHsb && fHsb->IsMapped()) {
1384  tch -= fHsb->GetDefaultHeight();
1385  if (tch < 0) tch = 0;
1386  }
1387  fCanvas->SetHeight(tch);
1388  fCanvas->SetWidth(tcw);
1389  lines = ReturnHeighestColHeight();
1390  if (lines <= tch) {
1391  if (fVsb && fVsb->IsMapped()) {
1393  fVsb->UnmapWindow();
1394  HLayout();
1395  }
1397  } else {
1398  if (fVsb) {
1399  tcw -= fVsb->GetDefaultWidth();
1400  if (tcw < 0) tcw = 0;
1402  fVsb->GetDefaultWidth(), tch+1+fBorderWidth);
1403  fVsb->MapWindow();
1404  fVsb->SetRange(Int_t(lines/fScrollVal.fY), Int_t(tch/fScrollVal.fY));
1405  }
1407  }
1408 }
1409 
1410 ////////////////////////////////////////////////////////////////////////////////
1411 /// Set the range for the kVertical or kHorizontal scrollbar.
1412 
1414 {
1415  if (direction == kVertical) {
1416  if (!fVsb) {
1417  return;
1418  }
1420  if (fVsb->IsMapped()) {
1421  VLayout();
1422  } else {
1423  return;
1424  }
1425  }
1426  if (!fVsb->IsMapped()) {
1427  VLayout();
1428  }
1431  HLayout();
1432  } else {
1433  if (!fHsb) {
1434  return;
1435  }
1437  if (fHsb->IsMapped()) {
1438  HLayout();
1439  } else {
1440  return;
1441  }
1442  }
1443  if (!fHsb->IsMapped()) {
1444  HLayout();
1445  }
1448  VLayout();
1449  }
1450 }
1451 
1452 ////////////////////////////////////////////////////////////////////////////////
1453 /// Set position of horizontal scrollbar.
1454 
1456 {
1457  if (fHsb && fHsb->IsMapped()) {
1458  fHsb->SetPosition(Int_t(newPos));
1459  } else {
1461  }
1462 }
1463 
1464 ////////////////////////////////////////////////////////////////////////////////
1465 /// Set position of vertical scrollbar.
1466 
1468 {
1469  if (fVsb && fVsb->IsMapped()) {
1470  fVsb->SetPosition(Int_t(newPos));
1471  } else {
1473  }
1474 }
1475 
1476 ////////////////////////////////////////////////////////////////////////////////
1477 /// Return default font structure in use.
1478 
1480 {
1481  if (!fgDefaultFont) {
1482  fgDefaultFont = gClient->GetResourcePool()->GetDocumentFixedFont();
1483  }
1484  return fgDefaultFont->GetFontStruct();
1485 }
1486 
1487 ////////////////////////////////////////////////////////////////////////////////
1488 /// Show bottom of the page.
1489 
1491 {
1492  Int_t tch;
1493  Long_t lines, newPos;
1494 
1495  tch = fCanvas->GetHeight();
1496  lines = ReturnHeighestColHeight();
1497  if (lines > tch) {
1498  newPos = lines / fScrollVal.fY;
1499  SetVsbPosition(newPos);
1500  }
1501  Layout();
1502 }
1503 
1504 ////////////////////////////////////////////////////////////////////////////////
1505 /// Show top of the page.
1506 
1508 {
1509  SetVsbPosition(0);
1510  Layout();
1511 }
1512 
1513 ////////////////////////////////////////////////////////////////////////////////
1514 /// Set text color.
1515 
1517 {
1518  fNormGC.SetBackground(col);
1519  fNormGC.SetForeground(col);
1520 }
1521 
1522 ////////////////////////////////////////////////////////////////////////////////
1523 /// Return default graphics context in use.
1524 
1526 {
1527  if (!fgDefaultGC) {
1528  fgDefaultGC = new TGGC(*gClient->GetResourcePool()->GetFrameGC());
1530  }
1531  return *fgDefaultGC;
1532 }
1533 
1534 ////////////////////////////////////////////////////////////////////////////////
1535 /// Return selection graphics context in use.
1536 
1538 {
1539  if (!fgDefaultSelectedGC) {
1540  fgDefaultSelectedGC = new TGGC(*gClient->GetResourcePool()->GetSelectedGC());
1542  }
1543  return *fgDefaultSelectedGC;
1544 }
1545 
1546 ////////////////////////////////////////////////////////////////////////////////
1547 /// Return graphics context for highlighted frame background.
1548 
1550 {
1552  fgDefaultSelectedBackgroundGC = gClient->GetResourcePool()->GetSelectedBckgndGC();
1553  }
1555 }
1556 
1557 ////////////////////////////////////////////////////////////////////////////////
1558 /// Save a text edit widget as a C++ statement(s) on output stream out
1559 
1560 void TGTextView::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
1561 {
1562  char quote = '"';
1563  out << " TGTextView *";
1564  out << GetName() << " = new TGTextView(" << fParent->GetName()
1565  << "," << GetWidth() << "," << GetHeight()
1566  << ");"<< std::endl;
1567 
1568  if (option && strstr(option, "keep_names"))
1569  out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
1570 
1572  out << " " << GetName() << "->ChangeBackground(" << fCanvas->GetBackground() << ");" << std::endl;
1573  }
1574 
1575  TGText *txt = GetText();
1576  Bool_t fromfile = strlen(txt->GetFileName()) ? kTRUE : kFALSE;
1577  TString fn;
1578 
1579  if (fromfile) {
1580  const char *filename = txt->GetFileName();
1581  fn = gSystem->UnixPathName(filename);
1582  gSystem->ExpandPathName(fn);
1583  } else {
1584  fn = TString::Format("Txt%s", GetName()+5);
1585  txt->Save(fn.Data());
1586  }
1587  out << " " << GetName() << "->LoadFile(" << quote << fn.Data() << quote << ");" << std::endl;
1588 }
Event_t::fType
EGEventType fType
Definition: GuiTypes.h:174
kButton2
@ kButton2
Definition: GuiTypes.h:213
TSystem::GetPathInfo
int GetPathInfo(const char *path, Long_t *id, Long_t *size, Long_t *flags, Long_t *modtime)
Get info about a file: id, size, flags, modification time.
Definition: TSystem.cxx:1396
Event_t::fState
UInt_t fState
Definition: GuiTypes.h:180
TGTextView::AddLine
virtual void AddLine(const char *string)
Add a line of text to the view widget.
Definition: TGTextView.cxx:228
TGFrame::GetHeight
UInt_t GetHeight() const
Definition: TGFrame.h:250
TGVScrollBar::SetRange
virtual void SetRange(Int_t range, Int_t page_size)
Set range of vertical scrollbar.
Definition: TGScrollBar.cxx:884
Event_t::fY
Int_t fY
Definition: GuiTypes.h:177
TGTextView::ReturnLineLength
virtual Long_t ReturnLineLength(Long_t line)
Definition: TGTextView.h:103
Event_t::fX
Int_t fX
Definition: GuiTypes.h:177
TGWindow
Definition: TGWindow.h:31
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
TGTextView::fMaxDescent
Int_t fMaxDescent
Definition: TGTextView.h:40
kTXT_DATACHANGE
@ kTXT_DATACHANGE
Definition: WidgetMessageTypes.h:76
TDNDData::fDataLength
Int_t fDataLength
Definition: TGDNDManager.h:78
TViewTimer
Definition: TGTextView.h:156
TGView::fWhiteGC
TGGC fWhiteGC
Definition: TGView.h:66
TGView::fScrolling
Int_t fScrolling
Definition: TGView.h:58
TGFrame::SetBackgroundColor
virtual void SetBackgroundColor(Pixel_t back)
Set background color (override from TGWindow base class).
Definition: TGFrame.cxx:297
TGTextView::GetDefaultSelectedBackgroundGC
static const TGGC & GetDefaultSelectedBackgroundGC()
Return graphics context for highlighted frame background.
Definition: TGTextView.cxx:1549
kLeaveNotify
@ kLeaveNotify
Definition: GuiTypes.h:60
TBuffer::kRead
@ kRead
Definition: TBuffer.h:73
TGTextView::DataChanged
virtual void DataChanged()
Definition: TGTextView.h:146
UShort_t
unsigned short UShort_t
Definition: RtypesCore.h:40
TGTextView::fNormGC
TGGC fNormGC
Definition: TGTextView.h:42
gVirtualX
#define gVirtualX
Definition: TVirtualX.h:338
Rectangle_t
Definition: GuiTypes.h:360
TString::Data
const char * Data() const
Definition: TString.h:369
Pixel_t
ULong_t Pixel_t
Definition: GuiTypes.h:39
TGTextView::HandleSelectionRequest
virtual Bool_t HandleSelectionRequest(Event_t *event)
Handle request to send current clipboard contents to requestor window.
Definition: TGTextView.cxx:966
TGView::kVertical
@ kVertical
Definition: TGView.h:49
TGTextView::Marked
virtual void Marked(Bool_t mark)
Definition: TGTextView.h:148
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
TObjString.h
TGText::Search
Bool_t Search(TGLongPosition *foundPos, TGLongPosition start, const char *searchString, Bool_t direction, Bool_t caseSensitive)
Search for string searchString starting at the specified position going in forward (direction = true)...
Definition: TGText.cxx:1143
kC_TEXTVIEW
@ kC_TEXTVIEW
Definition: WidgetMessageTypes.h:74
FileStat_t
Definition: TSystem.h:124
TGFrame::fWidth
UInt_t fWidth
Definition: TGFrame.h:112
TGTextView::ToScrXCoord
virtual Long_t ToScrXCoord(Long_t xCoord, Long_t line)
Convert column number in specified line to screen coordinate.
Definition: TGTextView.cxx:359
TGText::InsText
Bool_t InsText(TGLongPosition pos, const char *buf)
Insert single line at specified position.
Definition: TGText.cxx:888
TGMsgBox
Definition: TGMsgBox.h:63
FontStruct_t
Handle_t FontStruct_t
Definition: GuiTypes.h:38
kAutoScrollFudge
const Int_t kAutoScrollFudge
Definition: TGCanvas.cxx:78
TGWindow::HandleTimer
virtual Bool_t HandleTimer(TTimer *)
Execute action in response of a timer timing out.
Definition: TGWindow.h:105
TGScrollBar::MoveResize
virtual void MoveResize(Int_t x, Int_t y, UInt_t w=0, UInt_t h=0)
Move and/or resize the frame.
Definition: TGScrollBar.h:136
TGFrame::GetDefaultHeight
virtual UInt_t GetDefaultHeight() const
Definition: TGFrame.h:216
TGTextView::SetText
virtual void SetText(TGText *text)
Adopt a new text buffer. The text will be deleted by this object.
Definition: TGTextView.cxx:196
kButton4
@ kButton4
Definition: GuiTypes.h:214
TGView::fScrollVal
TGLongPosition fScrollVal
Definition: TGView.h:54
TGView::fXMargin
UInt_t fXMargin
Definition: TGView.h:60
TGLongPosition::fY
Long_t fY
Definition: TGDimension.h:66
width
include TDocParser_001 C image html pict1_TDocParser_001 png width
Definition: TDocParser.cxx:121
TGTextView::HandleDNDPosition
virtual Atom_t HandleDNDPosition(Int_t x, Int_t y, Atom_t action, Int_t xroot, Int_t yroot)
Handle Drag position event.
Definition: TGTextView.cxx:1135
TGTextView::fgDefaultGC
static TGGC * fgDefaultGC
Definition: TGTextView.h:57
TGGC::SetGraphicsExposures
void SetGraphicsExposures(Bool_t v)
True if graphics exposure should be generated.
Definition: TGGC.cxx:432
Int_t
int Int_t
Definition: RtypesCore.h:45
TGVScrollBar::SetPosition
virtual void SetPosition(Int_t pos)
Set logical slider position of vertical scrollbar.
Definition: TGScrollBar.cxx:919
TGText::AddText
Bool_t AddText(TGText *text)
Add another text buffer to this buffer.
Definition: TGText.cxx:911
TGView::fVsb
TGVScrollBar * fVsb
Definition: TGView.h:64
TMacro.h
kMBYes
@ kMBYes
Definition: TGMsgBox.h:42
x
Double_t x[n]
Definition: legend1.C:17
TString::Length
Ssiz_t Length() const
Definition: TString.h:410
TGTextView::fIsMarked
Bool_t fIsMarked
Definition: TGTextView.h:47
TGFrame::fgWhitePixel
static Pixel_t fgWhitePixel
Definition: TGFrame.h:128
kButton1
@ kButton1
Definition: GuiTypes.h:213
TGText
Definition: TGText.h:67
TGTextView::fIsSaved
Bool_t fIsSaved
Definition: TGTextView.h:49
TVirtualX.h
TMath::Abs
Short_t Abs(Short_t d)
Definition: TMathBase.h:120
TGFrame::GetBackground
virtual Pixel_t GetBackground() const
Definition: TGFrame.h:217
TGView::fExposedRegion
TGRectangle fExposedRegion
Definition: TGView.h:56
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
TGClient::GetResourcePool
const TGResourcePool * GetResourcePool() const
Definition: TGClient.h:133
TGTextView::ToScrYCoord
virtual Long_t ToScrYCoord(Long_t yCoord)
Convert line number to screen coordinate.
Definition: TGTextView.cxx:345
TGTextView::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save a text edit widget as a C++ statement(s) on output stream out.
Definition: TGTextView.cxx:1560
TGTextView::fSelGC
TGGC fSelGC
Definition: TGTextView.h:43
TGTextView::SetSBRange
virtual void SetSBRange(Int_t direction)
Set the range for the kVertical or kHorizontal scrollbar.
Definition: TGTextView.cxx:1413
TString::Format
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition: TString.cxx:2311
TGDNDManager.h
TString
Definition: TString.h:136
kMBNo
@ kMBNo
Definition: TGMsgBox.h:43
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TGView::Clear
virtual void Clear(Option_t *="")
Clear view.
Definition: TGView.cxx:159
TGObject::GetId
Handle_t GetId() const
Definition: TGObject.h:47
TGView::fCanvas
TGViewFrame * fCanvas
Definition: TGView.h:62
kDoubleBorder
@ kDoubleBorder
Definition: GuiTypes.h:385
TGTextView::fMarkedFromY
Bool_t fMarkedFromY
Definition: TGTextView.h:46
TObject::InheritsFrom
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition: TObject.cxx:445
TGFrame::SetHeight
virtual void SetHeight(UInt_t h)
Definition: TGFrame.h:272
text
TText * text
Definition: entrylist_figure1.C:10
TObjString::GetName
const char * GetName() const
Returns name of object.
Definition: TObjString.h:44
TGTextView::DrawRegion
virtual void DrawRegion(Int_t x, Int_t y, UInt_t w, UInt_t h)
Draw lines in exposed region.
Definition: TGTextView.cxx:538
h1
TH1F * h1
Definition: legend1.C:5
TSystem::AddTimer
virtual void AddTimer(TTimer *t)
Add timer to list of system timers.
Definition: TSystem.cxx:472
Rectangle_t::fY
Short_t fY
Definition: GuiTypes.h:361
TGFrame::MapWindow
virtual void MapWindow()
map window
Definition: TGFrame.h:229
TGTextView::HLayout
virtual void HLayout()
Horizontal layout of widgets (canvas, scrollbar).
Definition: TGTextView.cxx:1337
bool
TString::ReplaceAll
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition: TString.h:692
TGFrame::GetWidth
UInt_t GetWidth() const
Definition: TGFrame.h:249
TGText::RowCount
Long_t RowCount() const
Definition: TGText.h:116
id
XFontStruct * id
Definition: TGX11.cxx:109
TGTextView::fMarkedFromX
Bool_t fMarkedFromX
Definition: TGTextView.h:45
TGTextView::HandleDNDEnter
virtual Atom_t HandleDNDEnter(Atom_t *typelist)
Handle Drag Enter event.
Definition: TGTextView.cxx:1144
kTXT_CLICK2
@ kTXT_CLICK2
Definition: WidgetMessageTypes.h:77
TObjString
Definition: TObjString.h:28
kAcceleration
const Int_t kAcceleration[kAutoScrollFudge+1]
Definition: TGCanvas.cxx:79
gClient
#define gClient
Definition: TGClient.h:166
TDNDData::fDataType
Atom_t fDataType
Definition: TGDNDManager.h:75
TGTextView::fFont
FontStruct_t fFont
Definition: TGTextView.h:38
Rectangle_t::fX
Short_t fX
Definition: GuiTypes.h:361
TGHScrollBar::SetRange
virtual void SetRange(Int_t range, Int_t page_size)
Set range of horizontal scrollbar.
Definition: TGScrollBar.cxx:624
TGTextView::fMaxAscent
Int_t fMaxAscent
Definition: TGTextView.h:39
kNone
const Handle_t kNone
Definition: GuiTypes.h:87
TGTextView::Search
virtual Bool_t Search(const char *string, Bool_t direction, Bool_t caseSensitive)
Search for string in text.
Definition: TGTextView.cxx:289
TGView::kHorizontal
@ kHorizontal
Definition: TGView.h:49
TGTextView::HandleDoubleClick
virtual Bool_t HandleDoubleClick(Event_t *event)
handle double click
Definition: TGTextView.cxx:901
TTimer
Definition: TTimer.h:51
Option_t
const typedef char Option_t
Definition: RtypesCore.h:66
kSunkenFrame
@ kSunkenFrame
Definition: GuiTypes.h:383
TGText::GetLongestLine
Long_t GetLongestLine() const
Definition: TGText.h:120
TBuffer::SetReadMode
void SetReadMode()
Set buffer in read mode.
Definition: TBuffer.cxx:302
TGTextView::fMaxWidth
Int_t fMaxWidth
Definition: TGTextView.h:41
TDNDData::fData
void * fData
Definition: TGDNDManager.h:77
TViewTimer::fView
TGView * fView
Definition: TGTextView.h:158
TSystem.h
TGTextView::SetHsbPosition
virtual void SetHsbPosition(Long_t newPos)
Set position of horizontal scrollbar.
Definition: TGTextView.cxx:1455
TSystemFile
Definition: TSystemFile.h:29
TGTextView::GetDefaultGC
static const TGGC & GetDefaultGC()
Return default graphics context in use.
Definition: TGTextView.cxx:1525
TGTextView::Clear
virtual void Clear(Option_t *="")
Clear text view widget.
Definition: TGTextView.cxx:429
h
#define h(i)
Definition: RSha256.hxx:124
TGWidget::fMsgWindow
const TGWindow * fMsgWindow
Definition: TGWidget.h:60
kButton3
@ kButton3
Definition: GuiTypes.h:213
TGWindow::GetName
virtual const char * GetName() const
Return unique name, used in SavePrimitive methods.
Definition: TGWindow.cxx:317
FileStat_t::fMode
Int_t fMode
Definition: TSystem.h:127
TGTextView::SetForegroundColor
virtual void SetForegroundColor(Pixel_t)
Set text color.
Definition: TGTextView.cxx:1516
TGTextView::fMarkedStart
TGLongPosition fMarkedStart
Definition: TGTextView.h:51
TGGC
Definition: TGGC.h:31
TGView::fYMargin
UInt_t fYMargin
Definition: TGView.h:61
TGTextView::ToObjXCoord
virtual Long_t ToObjXCoord(Long_t xCoord, Long_t line)
Convert x screen coordinate to column in specified line.
Definition: TGTextView.cxx:391
TGFrame::Resize
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:590
TGHScrollBar::SetPosition
virtual void SetPosition(Int_t pos)
Set logical slider position of horizontal scrollbar.
Definition: TGScrollBar.cxx:657
TGObject::fId
Handle_t fId
Definition: TGObject.h:36
TGTextView::ShowTop
virtual void ShowTop()
Show top of the page.
Definition: TGTextView.cxx:1507
Atom_t
Handle_t Atom_t
Definition: GuiTypes.h:36
TGText::Load
Bool_t Load(const char *fn, Long_t startpos=0, Long_t length=-1)
Load text from file fn.
Definition: TGText.cxx:431
TGLongPosition::fX
Long_t fX
Definition: TGDimension.h:65
kMBIconExclamation
@ kMBIconExclamation
Definition: TGMsgBox.h:41
Event_t::fCode
UInt_t fCode
Definition: GuiTypes.h:179
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
TGTextView::fgDefaultFont
static const TGFont * fgDefaultFont
Definition: TGTextView.h:56
TGTextView::HandleButton
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event in text editor.
Definition: TGTextView.cxx:823
TGView::fVisible
TGLongPosition fVisible
Definition: TGView.h:52
TGFrame::fBorderWidth
Int_t fBorderWidth
Definition: TGFrame.h:118
kButtonPress
@ kButtonPress
Definition: GuiTypes.h:59
Long_t
long Long_t
Definition: RtypesCore.h:54
TGTextView::fText
TGText * fText
Definition: TGTextView.h:36
TGTextView::LoadBuffer
virtual Bool_t LoadBuffer(const char *txtbuf)
Load text from a text buffer. Return false in case of failure.
Definition: TGTextView.cxx:470
TGFont::GetFontHandle
FontH_t GetFontHandle() const
Definition: TGFont.h:192
kButtonRelease
@ kButtonRelease
Definition: GuiTypes.h:59
TBufferFile::ReadObjectAny
void * ReadObjectAny(const TClass *cast) override
Read object from I/O buffer.
Definition: TBufferFile.cxx:2348
TGText::GetFileName
const char * GetFileName() const
Definition: TGText.h:98
TGTextView::~TGTextView
virtual ~TGTextView()
Cleanup text view widget.
Definition: TGTextView.cxx:157
TGText::GetLineLength
Long_t GetLineLength(Long_t row)
Get length of specified line. Returns -1 if row does not exist.
Definition: TGText.cxx:1043
kTXT_CLICK3
@ kTXT_CLICK3
Definition: WidgetMessageTypes.h:78
TGTextView::SetSelectBack
virtual void SetSelectBack(Pixel_t p)
set selected text background color
Definition: TGTextView.cxx:178
Window_t
Handle_t Window_t
Definition: GuiTypes.h:28
UInt_t
unsigned int UInt_t
Definition: RtypesCore.h:46
y
Double_t y[n]
Definition: legend1.C:17
TGTextView::ToObjYCoord
virtual Long_t ToObjYCoord(Long_t yCoord)
Convert y screen coordinate to line number.
Definition: TGTextView.cxx:383
TGTextView::AdjustWidth
virtual void AdjustWidth()
Adjust widget width to longest line.
Definition: TGTextView.cxx:1311
ULong_t
unsigned long ULong_t
Definition: RtypesCore.h:55
TDNDData
Definition: TGDNDManager.h:65
TSystem::ExpandPathName
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
Definition: TSystem.cxx:1272
Event_t::fXRoot
Int_t fXRoot
Definition: GuiTypes.h:178
TGText::Clear
void Clear()
Clear text buffer.
Definition: TGText.cxx:406
line
TLine * line
Definition: entrylistblock_figure1.C:235
Event_t::fWindow
Window_t fWindow
Definition: GuiTypes.h:175
TGTextView::Copy
virtual Bool_t Copy()
Copy selected text to clipboard.
Definition: TGTextView.cxx:485
TUrl
Definition: TUrl.h:33
Event_t::fYRoot
Int_t fYRoot
Definition: GuiTypes.h:178
TGView::fMousePos
TGLongPosition fMousePos
Definition: TGView.h:53
TGTextView::fMarkedEnd
TGLongPosition fMarkedEnd
Definition: TGTextView.h:52
TMacro
Definition: TMacro.h:31
unsigned int
TGView::SetVisibleStart
virtual void SetVisibleStart(Int_t newTop, Int_t direction)
Scroll view in specified direction to make newTop the visible location.
Definition: TGView.cxx:176
TGLongPosition
Definition: TGDimension.h:63
TUrl::GetFile
const char * GetFile() const
Definition: TUrl.h:69
TGTextView::fgDefaultSelectedGC
static TGGC * fgDefaultSelectedGC
Definition: TGTextView.h:58
TGTextView.h
gSystem
R__EXTERN TSystem * gSystem
Definition: TSystem.h:559
TGTextView::Mark
virtual void Mark(Long_t xPos, Long_t yPos)
Mark a text region from xPos to yPos.
Definition: TGTextView.cxx:1169
TGTextView::ReturnHeighestColHeight
virtual Long_t ReturnHeighestColHeight()
Definition: TGTextView.h:101
TGTextView::HandleTimer
virtual Bool_t HandleTimer(TTimer *t)
Handle scroll timer.
Definition: TGTextView.cxx:718
IsTextFile
static Bool_t IsTextFile(const char *candidate)
Returns true if given a text file Uses the specification given on p86 of the Camel book.
Definition: TGTextView.cxx:1049
TGWidget::fWidgetId
Int_t fWidgetId
Definition: TGWidget.h:58
TGTextView::GetText
TGText * GetText() const
Definition: TGTextView.h:126
TGClient::NeedRedraw
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition: TGClient.cxx:373
TGText::LoadBuffer
Bool_t LoadBuffer(const char *txtbuf)
Load a 0 terminated buffer. Lines will be split at ' '.
Definition: TGText.cxx:513
TGTextView::UnMark
virtual void UnMark()
Clear marked region.
Definition: TGTextView.cxx:1292
kButton1Mask
const Mask_t kButton1Mask
Definition: GuiTypes.h:202
TGFrame::UnmapWindow
virtual void UnmapWindow()
unmap window
Definition: TGFrame.h:231
Rectangle_t::fHeight
UShort_t fHeight
Definition: GuiTypes.h:362
kS_IFREG
@ kS_IFREG
Definition: TSystem.h:93
TGFrame::SetWidth
virtual void SetWidth(UInt_t w)
Definition: TGFrame.h:271
TSystem::UnixPathName
virtual const char * UnixPathName(const char *unixpathname)
Convert from a local pathname to a Unix pathname.
Definition: TSystem.cxx:1061
TGMsgBox.h
TGTextView::fClipText
TGText * fClipText
Definition: TGTextView.h:37
TGTextView::HandleSelectionClear
virtual Bool_t HandleSelectionClear(Event_t *event)
Handle selection clear event.
Definition: TGTextView.cxx:955
TGObject::fClient
TGClient * fClient
Definition: TGObject.h:37
TGTextView::HandleCrossing
virtual Bool_t HandleCrossing(Event_t *event)
Handle mouse crossing event.
Definition: TGTextView.cxx:673
TGFrame::MoveResize
virtual void MoveResize(Int_t x, Int_t y, UInt_t w=0, UInt_t h=0)
Move and/or resize the frame.
Definition: TGFrame.cxx:614
TGWindow::GetMainFrame
virtual const TGWindow * GetMainFrame() const
Returns top level main frame.
Definition: TGWindow.cxx:133
TGText::Save
Bool_t Save(const char *fn)
Save text buffer to file fn.
Definition: TGText.cxx:610
TViewTimer::Notify
Bool_t Notify()
Notify when timer times out and reset the timer.
Definition: TGTextView.cxx:59
TGTextView::VLayout
virtual void VLayout()
Vertical layout of widgets (canvas, scrollbar).
Definition: TGTextView.cxx:1376
UChar_t
unsigned char UChar_t
Definition: RtypesCore.h:38
TGGC::SetBackground
void SetBackground(Pixel_t v)
Set background color.
Definition: TGGC.cxx:288
TGGC::SetForeground
void SetForeground(Pixel_t v)
Set foreground color.
Definition: TGGC.cxx:277
Event_t::fTime
Time_t fTime
Definition: GuiTypes.h:176
TGResourcePool::GetDocumentBckgndGC
const TGGC * GetDocumentBckgndGC() const
Definition: TGResourcePool.h:150
TGTextView::ReturnLongestLineWidth
virtual Long_t ReturnLongestLineWidth()
Return width of longest line.
Definition: TGTextView.cxx:271
TMacro::GetListOfLines
TList * GetListOfLines() const
Definition: TMacro.h:51
Rectangle_t::fWidth
UShort_t fWidth
Definition: GuiTypes.h:362
TObject
Definition: TObject.h:37
TBufferFile.h
kSelectionNotify
@ kSelectionNotify
Definition: GuiTypes.h:62
TGTextView
Definition: TGTextView.h:33
TGTextView::fDNDTypeList
Atom_t * fDNDTypeList
Definition: TGTextView.h:54
TGFrame::SetDNDTarget
void SetDNDTarget(Bool_t onoff)
Definition: TGFrame.h:295
TGTextView::DataDropped
virtual void DataDropped(const char *fname)
Definition: TGTextView.h:147
TGTextView::AddLineFast
virtual void AddLineFast(const char *string)
Add a line of text to the view widget.
Definition: TGTextView.cxx:250
TGTextView::SetBackground
virtual void SetBackground(Pixel_t p)
set background color
Definition: TGTextView.cxx:168
Event_t
Definition: GuiTypes.h:173
TGTextView::fSelbackGC
TGGC fSelbackGC
Definition: TGTextView.h:44
TGTextView::GetDefaultFontStruct
static FontStruct_t GetDefaultFontStruct()
Return default font structure in use.
Definition: TGTextView.cxx:1479
kButton5
@ kButton5
Definition: GuiTypes.h:214
TGTextView::fIsMarking
Bool_t fIsMarking
Definition: TGTextView.h:48
TGTextView::fReadOnly
Bool_t fReadOnly
Definition: TGTextView.h:50
TGView::fHsb
TGHScrollBar * fHsb
Definition: TGView.h:63
TGTextView::Init
void Init(Pixel_t bg)
Initialize a text view widget.
Definition: TGTextView.cxx:72
TIter
Definition: TCollection.h:233
TGTextView::HandleMotion
virtual Bool_t HandleMotion(Event_t *event)
Handle mouse motion event in the text editor widget.
Definition: TGTextView.cxx:909
TGText::GetLine
char * GetLine(TGLongPosition pos, ULong_t length)
Return string at position pos.
Definition: TGText.cxx:997
TGTextView::HandleDNDLeave
virtual Bool_t HandleDNDLeave()
Handle Drag Leave event.
Definition: TGTextView.cxx:1161
TGTextView::fScrollTimer
TViewTimer * fScrollTimer
Definition: TGTextView.h:53
TGResourcePool.h
TGFont::GetFontStruct
FontStruct_t GetFontStruct() const
Definition: TGFont.h:193
TGTextView::ShowBottom
virtual void ShowBottom()
Show bottom of the page.
Definition: TGTextView.cxx:1490
TGRectangle::Empty
void Empty()
Definition: TGDimension.h:132
TGTextView::TGTextView
TGTextView(const TGTextView &)
TGFrame::fHeight
UInt_t fHeight
Definition: TGFrame.h:113
TGTextView::Update
virtual void Update()
update the whole window of text view
Definition: TGTextView.cxx:261
TNamed::GetName
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:53
type
int type
Definition: TGX11.cxx:121
TGTextView::fgDefaultSelectedBackgroundGC
static const TGGC * fgDefaultSelectedBackgroundGC
Definition: TGTextView.h:59
TGTextView::Layout
virtual void Layout()
Layout the components of view.
Definition: TGTextView.cxx:1328
TGFont
Definition: TGFont.h:149
Class
void Class()
Definition: Class.C:29
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
TTimer::Reset
void Reset()
Reset the timer.
Definition: TTimer.cxx:157
TGTextView::SetVsbPosition
virtual void SetVsbPosition(Long_t newPos)
Set position of vertical scrollbar.
Definition: TGTextView.cxx:1467
TGTextView::SelectAll
virtual Bool_t SelectAll()
Select all text in the viewer.
Definition: TGTextView.cxx:516
kTXT_ISMARKED
@ kTXT_ISMARKED
Definition: WidgetMessageTypes.h:75
TGView::UpdateRegion
virtual void UpdateRegion(Int_t x, Int_t y, UInt_t w, UInt_t h)
update a part of view
Definition: TGView.cxx:202
TGFrame::GetDefaultWidth
virtual UInt_t GetDefaultWidth() const
Definition: TGFrame.h:215
Event_t::fUser
Long_t fUser[5]
Definition: GuiTypes.h:186
TGScrollBar.h
TGTextView::GetDefaultSelectedGC
static const TGGC & GetDefaultSelectedGC()
Return selection graphics context in use.
Definition: TGTextView.cxx:1537
TBufferFile
Definition: TBufferFile.h:47
TGGC::SetFont
void SetFont(FontH_t v)
Set font.
Definition: TGGC.cxx:410
TUrl.h
TGView
Definition: TGView.h:43
MK_MSG
Int_t MK_MSG(EWidgetMessageTypes msg, EWidgetMessageTypes submsg)
Definition: WidgetMessageTypes.h:110
TGWindow::fParent
const TGWindow * fParent
Definition: TGWindow.h:36
kKeyShiftMask
const Mask_t kKeyShiftMask
Definition: GuiTypes.h:194
TGTextView::HandleDNDDrop
virtual Bool_t HandleDNDDrop(TDNDData *data)
Handle Drop event.
Definition: TGTextView.cxx:1086
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
TGTextView::AddText
virtual void AddText(TGText *text)
Add text to the view widget.
Definition: TGTextView.cxx:207
int
TSystemFile.h
TGWindow::IsMapped
virtual Bool_t IsMapped()
Returns kTRUE if window is mapped on screen, kFALSE otherwise.
Definition: TGWindow.cxx:276