62 fView->HandleTimer(
this);
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);
151 fText->InsText(pos,
string);
170 fCanvas->SetBackgroundColor(p);
254 pos.fY =
fText->RowCount();
255 fText->InsText(pos,
string);
273 Long_t count = 0, longest = 0, width;
275 while (count < rows) {
277 if (width > longest) {
292 pos2.
fX = pos2.
fY = 0;
302 if (!
fText->Search(&pos, pos2,
string, direction, caseSensitive)) {
350 if (yCoord >
fText->RowCount()) {
367 if (xCoord <= 0 || pos.fY < 0 || width <= 0) {
370 if (xCoord > width) {
373 buffer =
fText->GetLine(pos, xCoord);
394 char *buffer, *travelBuffer;
404 if (len <= 0 || xCoord < 0) {
409 buffer =
fText->GetLine(pos, len);
410 if (!buffer)
return 0;
411 travelBuffer = buffer;
412 charBuffer = *travelBuffer++;
415 while (viscoord - cw >= 0 && pos.fX < len) {
418 charBuffer = *travelBuffer++;
456 if (!(fp = fopen(filename,
"r")))
462 fText->Load(filename, startpos, length);
472 if (!txtbuf || !txtbuf[0]) {
477 fText->LoadBuffer(txtbuf);
494 insPos.
fY = insPos.
fX = 0;
499 if (endPos.
fX == -1) {
503 endPos.
fX =
fText->GetLineLength(endPos.
fY);
518 if (
fText->RowCount() == 1 &&
fText->GetLineLength(0) == 0) {
543 Long_t xoffset, len, len1, len2;
555 while (pos.fY <= line_count &&
561 len =
fText->GetLineLength(pos.fY) - pos.fX;
575 buffer =
fText->GetLine(pos, len);
579 while (buffer[i] !=
'\0') {
580 if (buffer[i] ==
'\t') {
583 while (buffer[j] == 16 && buffer[j] !=
'\0') {
646 buffer,
Int_t(len1));
656 buffer+len1,
Int_t(len2));
660 buffer+len1+len2,
Int_t(len-(len1+len2)));
721 static const Int_t kAcceleration[
kAutoScrollFudge + 1] = {1, 1, 1, 1, 2, 3, 4, 6, 8, 12, 16};
753 Int_t ady = std::abs(dy) >> 3;
969 char *buffer, *temp_buffer;
970 Long_t len, prev_len, temp_len, count;
976 reply.
fTime =
event->fTime;
977 reply.
fUser[0] =
event->fUser[0];
978 reply.
fUser[1] =
event->fUser[1];
979 reply.
fUser[2] =
event->fUser[2];
980 reply.
fUser[3] =
event->fUser[3];
995 for (count = 0; count <
fClipText->RowCount(); count++) {
996 len +=
fClipText->GetLineLength(count)+1;
1000 pos.fY = pos.fX = 0;
1001 buffer =
new char[len+1];
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);
1009 buffer[prev_len+temp_len] = 10;
1010 prev_len += temp_len+1;
1012 prev_len += temp_len;
1013 delete [] temp_buffer;
1020 if (buffer[i] ==
'\t') {
1022 while (buffer[j] == 16 && buffer[j]) {
1026 strcpy(buffer+i+1, buffer+j);
1053 Int_t weirdcount = 0;
1061 infile = fopen(candidate,
"r");
1064 nchars = fread(buffer, 1, 512, infile);
1067 for (i = 0; i < nchars; i++) {
1068 if (buffer[i] & 128)
1070 if (buffer[i] ==
'\0')
1074 if ((nchars > 0) && ((weirdcount * 100 / nchars) > 30))
1091 if (
fText->RowCount() > 1) {
1094 "Overwrite",
"Do you want to replace existing text?",
1099 if (data->fDataType == rootObj) {
1118 else if (data->fDataType == uriObj) {
1119 TString sfname((
char *)data->fData);
1120 if (sfname.
Length() > 7) {
1149 for (
int i = 0; typelist[i] !=
kNone; ++i) {
1150 if (typelist[i] == rootObj)
1152 if (typelist[i] == uriObj)
1175 if (pos.fY >
fText->RowCount()-1) {
1176 pos.fY =
fText->RowCount()-1;
1178 if (pos.fX >
fText->GetLineLength(pos.fY)) {
1179 pos.fX =
fText->GetLineLength(pos.fY);
1188 posStart.
fY = pos.fY;
1246 posStart.
fY = pos.fY;
1318 if (
fVsb->IsMapped()) {
1347 tcw -=
fVsb->GetDefaultWidth();
1348 if (tcw < 0) tcw = 0;
1356 fHsb->UnmapWindow();
1362 tch -=
fHsb->GetDefaultHeight();
1363 if (tch < 0) tch = 0;
1384 tch -=
fHsb->GetDefaultHeight();
1385 if (tch < 0) tch = 0;
1393 fVsb->UnmapWindow();
1399 tcw -=
fVsb->GetDefaultWidth();
1400 if (tcw < 0) tcw = 0;
1420 if (
fVsb->IsMapped()) {
1426 if (!
fVsb->IsMapped()) {
1437 if (
fHsb->IsMapped()) {
1443 if (!
fHsb->IsMapped()) {
1562 out <<
" TGTextView *" <<
GetName() <<
" = new TGTextView(" <<
fParent->GetName()
1566 if (option && strstr(option,
"keep_names"))
1567 out <<
" " <<
GetName() <<
"->SetName(\"" <<
GetName() <<
"\");\n";
1570 out <<
" " <<
GetName() <<
"->ChangeBackground(" <<
fCanvas->GetBackground() <<
");\n";
1579 fn =
gSystem->UnixPathName(filename);
const Mask_t kButton1Mask
const Mask_t kKeyShiftMask
Handle_t FontStruct_t
Pointer to font structure.
ULong_t Pixel_t
Pixel value.
Handle_t Window_t
Window handle.
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
unsigned short UShort_t
Unsigned Short integer 2 bytes (unsigned short).
int Int_t
Signed integer 4 bytes (int).
unsigned char UChar_t
Unsigned Character 1 byte (unsigned char).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
unsigned long ULong_t
Unsigned long integer 4 bytes (unsigned long). Size depends on architecture.
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
bool Bool_t
Boolean (0=false, 1=true) (bool).
const char Option_t
Option string (const char).
const Int_t kAutoScrollFudge
const Int_t kAcceleration[kAutoScrollFudge+1]
static Bool_t IsTextFile(const char *candidate)
Returns true if given a text file Uses the specification given on p86 of the Camel book.
static Bool_t IsTextFile(const char *candidate)
Returns true if given a text file Uses the specification given on p86 of the Camel book.
The concrete implementation of TBuffer for writing/reading to/from a ROOT file or socket.
void * ReadObjectAny(const TClass *cast) override
Read object from I/O buffer.
void SetReadMode()
Set buffer in read mode.
Drag and drop data container.
Encapsulate fonts used in the GUI system.
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
UInt_t fHeight
frame height
Int_t fBorderWidth
frame border width
virtual void SendMessage(const TGWindow *w, Longptr_t msg, Longptr_t parm1, Longptr_t parm2)
Send message (i.e.
void SetDNDTarget(Bool_t onoff)
static Pixel_t fgWhitePixel
Encapsulate a graphics context used in the low level graphics.
TGClient * fClient
Connection to display server.
Handle_t fId
X11/Win32 Window identifier.
Bool_t HandleDNDLeave() override
Handle Drag Leave event.
virtual Long_t ReturnLineLength(Long_t line)
virtual void AdjustWidth()
Adjust widget width to longest line.
virtual Bool_t Search(const char *string, Bool_t direction, Bool_t caseSensitive)
Search for string in text.
Int_t fMaxDescent
maximum descent in font
virtual void Update()
update the whole window of text view
TGGC fNormGC
graphics context for drawing text
Int_t fMaxAscent
maximum ascent in font
Bool_t fReadOnly
text cannot be edited
TGText * fText
text buffer
virtual void UnMark()
Clear marked region.
virtual Long_t ToObjXCoord(Long_t xCoord, Long_t line)
Convert x screen coordinate to column in specified line.
virtual void SetHsbPosition(Long_t newPos)
Set position of horizontal scrollbar.
virtual Bool_t LoadFile(const char *fname, long startpos=0, long length=-1)
Load a file in the text view widget.
virtual void Mark(Long_t xPos, Long_t yPos)
Mark a text region from xPos to yPos.
~TGTextView() override
Cleanup text view widget.
void DrawRegion(Int_t x, Int_t y, UInt_t w, UInt_t h) override
Draw lines in exposed region.
static TGGC * fgDefaultSelectedGC
virtual Long_t ToScrYCoord(Long_t yCoord)
Convert line number to screen coordinate.
virtual Long_t ReturnLongestLineWidth()
Return width of longest line.
Bool_t HandleCrossing(Event_t *event) override
Handle mouse crossing event.
Int_t fMaxWidth
maximum width of character in font
TGText * fClipText
clipboard text buffer
virtual Bool_t LoadBuffer(const char *txtbuf)
Load text from a text buffer. Return false in case of failure.
void Layout() override
Layout the components of view.
FontStruct_t fFont
text font
virtual void DataDropped(const char *fname)
void Init(Pixel_t bg)
Initialize a text view widget.
Bool_t fIsSaved
true is content is saved
static const TGGC & GetDefaultSelectedGC()
Return selection graphics context in use.
static const TGGC & GetDefaultGC()
Return default graphics context in use.
Bool_t fIsMarking
true if in marking mode
Bool_t HandleTimer(TTimer *t) override
Handle scroll timer.
Bool_t HandleSelectionClear(Event_t *event) override
Handle selection clear event.
Atom_t HandleDNDPosition(Int_t x, Int_t y, Atom_t action, Int_t xroot, Int_t yroot) override
Handle Drag position event.
virtual void AddLine(const char *string)
Add a line of text to the view widget.
Bool_t fIsMarked
true if text is marked/selected
Bool_t HandleMotion(Event_t *event) override
Handle mouse motion event in the text editor widget.
TGGC fSelbackGC
graphics context for drawing marked background
virtual void HLayout()
Horizontal layout of widgets (canvas, scrollbar).
TGGC fSelGC
graphics context for drawing marked text
Atom_t HandleDNDEnter(Atom_t *typelist) override
Handle Drag Enter event.
TViewTimer * fScrollTimer
scrollbar timer
Bool_t HandleDoubleClick(Event_t *event) override
handle double click
static const TGGC & GetDefaultSelectedBackgroundGC()
Return graphics context for highlighted frame background.
virtual Bool_t SelectAll()
Select all text in the viewer.
void SetForegroundColor(Pixel_t) override
Set text color.
Atom_t * fDNDTypeList
handles DND types
virtual void SetSelectBack(Pixel_t p)
set selected text background color
static TGGC * fgDefaultGC
virtual void SetVsbPosition(Long_t newPos)
Set position of vertical scrollbar.
TGLongPosition fMarkedEnd
end position of marked text
virtual Long_t ToScrXCoord(Long_t xCoord, Long_t line)
Convert column number in specified line to screen coordinate.
virtual void VLayout()
Vertical layout of widgets (canvas, scrollbar).
virtual void Marked(Bool_t mark)
static const TGFont * fgDefaultFont
virtual void DataChanged()
Bool_t fMarkedFromY
true if text is marker from y
void SavePrimitive(std::ostream &out, Option_t *="") override
Save a text edit widget as a C++ statement(s) on output stream out.
virtual Long_t ReturnLineCount()
virtual Bool_t Copy()
Copy selected text to clipboard.
TGTextView(const TGTextView &)=delete
Bool_t HandleSelectionRequest(Event_t *event) override
Handle request to send current clipboard contents to requestor window.
static FontStruct_t GetDefaultFontStruct()
Return default font structure in use.
Bool_t HandleButton(Event_t *event) override
Handle mouse button event in text editor.
virtual Long_t ReturnHeighestColHeight()
virtual void AddLineFast(const char *string)
Add a line of text to the view widget.
Bool_t HandleDNDDrop(TDNDData *data) override
Handle Drop event.
virtual void SetFont(FontStruct_t font)
Changes text entry font.
virtual void SetBackground(Pixel_t p)
set background color
virtual void ShowBottom()
Show bottom of the page.
virtual void SetSBRange(Int_t direction)
Set the range for the kVertical or kHorizontal scrollbar.
TGLongPosition fMarkedStart
start position of marked text
virtual void SetText(TGText *text)
Adopt a new text buffer. The text will be deleted by this object.
Bool_t fMarkedFromX
true if text is marked from x
virtual void ShowTop()
Show top of the page.
virtual void AddText(TGText *text)
Add text to the view widget.
virtual void SetSelectFore(Pixel_t p)
set selected text color
virtual Long_t ToObjYCoord(Long_t yCoord)
Convert y screen coordinate to line number.
void Clear(Option_t *="") override
Clear text view widget.
static const TGGC * fgDefaultSelectedBackgroundGC
A TGText is a multi line text buffer.
Bool_t Save(const char *fn)
Save text buffer to file fn.
const char * GetFileName() const
TGHScrollBar * fHsb
horizontal scrollbar
TGVScrollBar * fVsb
vertical scrollbar
TGLongPosition fMousePos
position of mouse
TGLongPosition fVisible
position of visible region
TGView(const TGView &)=delete
virtual void SetVisibleStart(Int_t newTop, Int_t direction)
Scroll view in specified direction to make newTop the visible location.
Int_t fScrolling
scrolling direction
TGLongPosition fScrollVal
scroll value
TGViewFrame * fCanvas
frame containing the text
void Clear(Option_t *="") override
Clear view.
virtual void UpdateRegion(Int_t x, Int_t y, UInt_t w, UInt_t h)
update a part of view
TGGC fWhiteGC
graphics context used for scrolling generates GraphicsExposure events
TGRectangle fExposedRegion
exposed area
ROOT GUI Window base class.
virtual const TGWindow * GetMainFrame() const
Returns top level main frame.
const TGWindow * fParent
Parent window.
const char * GetName() const override
Return unique name, used in SavePrimitive methods.
Class supporting a collection of lines with C++ code.
TList * GetListOfLines() const
const char * GetName() const override
Returns name of object.
Collectable string class.
const char * GetName() const override
Returns name of object.
Mother of all ROOT objects.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
TString & ReplaceSpecialCppChars()
Find special characters which are typically used in printf() calls and replace them by appropriate es...
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
A TSystemFile describes an operating system file.
Handles synchronous and a-synchronous timer events.
void Reset()
Reset the timer.
This class represents a WWW compatible URL.
const char * GetFile() const
Bool_t Notify() override
Notify when timer times out and reset the timer.
EGEventType fType
of event (see EGEventType)
Int_t fY
pointer x, y coordinates in event window
Window_t fWindow
window reported event is relative to
UInt_t fState
key or button mask
Int_t fYRoot
coordinates relative to root
Time_t fTime
time event event occurred in ms
UInt_t fCode
key or button code
Longptr_t fUser[5]
5 longs can be used by client message events NOTE: only [0], [1] and [2] may be used.
Rectangle structure (maps to the X11 XRectangle structure).