74 fFont = GetDefaultFontStruct();
75 fNormGC = GetDefaultGC();
76 fSelGC = GetDefaultSelectedGC();
77 fSelbackGC = GetDefaultSelectedBackgroundGC();
79 fWhiteGC = *fClient->GetResourcePool()->GetDocumentBckgndGC();
80 fWhiteGC.SetGraphicsExposures(
kTRUE);
81 fWhiteGC.SetBackground(back);
82 fWhiteGC.SetForeground(back);
94 gVirtualX->GetFontProperties(fFont, fMaxAscent, fMaxDescent);
95 fScrollVal.fY = fMaxAscent + fMaxDescent;
96 fScrollVal.fX = fMaxWidth =
gVirtualX->TextWidth(fFont,
"@", 1);
102 fDNDTypeList =
new Atom_t[3];
106 gVirtualX->SetDNDAware(fId, fDNDTypeList);
109 gVirtualX->ClearWindow(fCanvas->GetId());
133 srcStart.
fX = srcStart.
fY = 0;
274 while (count < rows) {
276 if (
width > longest) {
291 pos2.
fX = pos2.
fY = 0;
301 if (!
fText->
Search(&pos, pos2,
string, direction, caseSensitive)) {
366 if (xCoord <= 0 || pos.
fY < 0 || width <= 0) {
369 if (xCoord > width) {
393 char *buffer, *travelBuffer;
403 if (len <= 0 || xCoord < 0) {
409 if (!buffer)
return 0;
410 travelBuffer = buffer;
411 charBuffer = *travelBuffer++;
414 while (viscoord - cw >= 0 && pos.
fX < len) {
417 charBuffer = *travelBuffer++;
455 if (!(fp = fopen(filename,
"r")))
471 if (!txtbuf || !txtbuf[0]) {
493 insPos.
fY = insPos.
fX = 0;
498 if (endPos.
fX == -1) {
542 Long_t xoffset, len, len1, len2;
554 while (pos.
fY <= line_count &&
578 while (buffer[i] !=
'\0') {
579 if (buffer[i] ==
'\t') {
582 while (buffer[j] == 16 && buffer[j] !=
'\0') {
645 buffer,
Int_t(len1));
655 buffer+len1,
Int_t(len2));
659 buffer+len1+len2,
Int_t(len-(len1+len2)));
720 static const Int_t kAcceleration[kAutoScrollFudge + 1] = {1, 1, 1, 1, 2, 3, 4, 6, 8, 12, 16};
747 if (y < kAutoScrollFudge) {
748 dy = kAutoScrollFudge -
y;
756 dy = kAcceleration[ady];
968 char *buffer, *temp_buffer;
969 Long_t len, prev_len, temp_len, count;
975 reply.
fTime =
event->fTime;
976 reply.
fUser[0] =
event->fUser[0];
977 reply.
fUser[1] =
event->fUser[1];
978 reply.
fUser[2] =
event->fUser[2];
979 reply.
fUser[3] =
event->fUser[3];
1000 buffer =
new char[len+1];
1001 prev_len = temp_len = 0;
1004 if (temp_len < 0)
break;
1006 strncpy(buffer+prev_len, temp_buffer, (
UInt_t)temp_len);
1008 buffer[prev_len+temp_len] = 10;
1009 prev_len += temp_len+1;
1011 prev_len += temp_len;
1012 delete [] temp_buffer;
1019 if (buffer[i] ==
'\t') {
1021 while (buffer[j] == 16 && buffer[j]) {
1025 strcpy(buffer+i+1, buffer+j);
1052 Int_t weirdcount = 0;
1060 infile = fopen(candidate,
"r");
1063 nchars = fread(buffer, 1, 512, infile);
1066 for (i = 0; i < nchars; i++) {
1067 if (buffer[i] & 128)
1069 if (buffer[i] ==
'\0')
1073 if ((nchars > 0) && ((weirdcount * 100 / nchars) > 30))
1093 "Overvrite",
"Do you want to replace existing text?",
1119 if (sfname.
Length() > 7) {
1148 for (
int i = 0; typelist[i] !=
kNone; ++i) {
1149 if (typelist[i] == rootObj)
1151 if (typelist[i] == uriObj)
1187 posStart.
fY = pos.
fY;
1245 posStart.
fY = pos.
fY;
1347 if (tcw < 0) tcw = 0;
1362 if (tch < 0) tch = 0;
1384 if (tch < 0) tch = 0;
1399 if (tcw < 0) tcw = 0;
1562 out <<
" TGTextView *";
1565 <<
");"<< std::endl;
1567 if (option && strstr(option,
"keep_names"))
1568 out <<
" " <<
GetName() <<
"->SetName(\"" <<
GetName() <<
"\");" << std::endl;
1583 txt->
Save(fn.Data());
1585 out <<
" " <<
GetName() <<
"->LoadFile(" << quote << fn.Data() << quote <<
");" << std::endl;
virtual Bool_t Search(const char *string, Bool_t direction, Bool_t caseSensitive)
Search for string in text.
virtual Bool_t HandleDoubleClick(Event_t *event)
handle double click
virtual const char * GetName() const
Returns name of object.
TList * GetListOfLines() const
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Bool_t Notify()
Notify when timer times out and reset the timer.
virtual void Clear(Option_t *="")
Clear text view widget.
virtual Long_t ReturnHeighestColHeight()
The concrete implementation of TBuffer for writing/reading to/from a ROOT file or socket...
virtual void Mark(Long_t xPos, Long_t yPos)
Mark a text region from xPos to yPos.
virtual void MoveResize(Int_t x, Int_t y, UInt_t w=0, UInt_t h=0)
Move and/or resize the frame.
virtual void UnMark()
Clear marked region.
TGRectangle fExposedRegion
void Reset()
Reset the timer.
const Int_t kAutoScrollFudge
virtual void SetVisibleStart(Int_t newTop, Int_t direction)
Scroll view in specified direction to make newTop the visible location.
virtual Bool_t LoadBuffer(const char *txtbuf)
Load text from a text buffer. Return false in case of failure.
Collectable string class.
Bool_t InsText(TGLongPosition pos, const char *buf)
Insert single line at specified position.
const Mask_t kKeyShiftMask
void Clear()
Clear text buffer.
TGLongPosition fMarkedEnd
virtual Bool_t HandleCrossing(Event_t *event)
Handle mouse crossing event.
const TGWindow * GetRoot() const
Returns current root (i.e.
image html pict1_TGaxis_012 png width
Define new text attributes for the label number "labNum".
This class represents a WWW compatible URL.
TString & ReplaceAll(const TString &s1, const TString &s2)
static TGGC * fgDefaultSelectedGC
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.
void SetForeground(Pixel_t v)
Set foreground color.
virtual void SetHsbPosition(Long_t newPos)
Set position of horizontal scrollbar.
virtual void SetSelectBack(Pixel_t p)
set selected text background color
virtual void SetForegroundColor(Pixel_t)
Set text color.
TGLongPosition fMarkedStart
static FontStruct_t GetDefaultFontStruct()
Return default font structure in use.
virtual void SetBackground(Pixel_t p)
set background color
virtual void AddLineFast(const char *string)
Add a line of text to the view widget.
TViewTimer(const TViewTimer &)
static const TGFont * fgDefaultFont
Class supporting a collection of lines with C++ code.
virtual Bool_t Copy()
Copy selected text to clipboard.
static Pixel_t fgWhitePixel
TGTextView(const TGTextView &)
virtual ~TGTextView()
Cleanup text view widget.
virtual void * ReadObjectAny(const TClass *cast)
Read object from I/O buffer.
virtual Bool_t HandleTimer(TTimer *t)
Handle scroll timer.
virtual Long_t ToObjYCoord(Long_t yCoord)
Convert y screen coordinate to line number.
virtual const char * UnixPathName(const char *unixpathname)
Convert from a Unix pathname to a local pathname.
virtual Bool_t HandleTimer(TTimer *)
Execute action in response of a timer timing out.
Bool_t LoadBuffer(const char *txtbuf)
Load a 0 terminated buffer. Lines will be split at ' '.
void SetBackground(Pixel_t v)
Set background color.
static const TGGC * fgDefaultSelectedBackgroundGC
virtual Long_t ReturnLongestLineWidth()
Return width of longest line.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
virtual void DataDropped(const char *fname)
void Init(Pixel_t bg)
Initialize a text view widget.
virtual Bool_t HandleDNDLeave()
Handle Drag Leave event.
virtual void AddLine(const char *string)
Add a line of text to the view widget.
TViewTimer * fScrollTimer
static const TGGC & GetDefaultSelectedGC()
Return selection graphics context in use.
virtual Bool_t HandleSelectionClear(Event_t *event)
Handle selection clear event.
virtual void SendMessage(const TGWindow *w, Long_t msg, Long_t parm1, Long_t parm2)
Send message (i.e.
virtual const TGWindow * GetMainFrame() const
Returns top level main frame.
virtual void ShowBottom()
Show bottom of the page.
virtual void VLayout()
Vertical layout of widgets (canvas, scrollbar).
virtual void Update()
update the whole window of text view
virtual void SetBackgroundColor(Pixel_t back)
Set background color (override from TGWindow base class).
char * GetLine(TGLongPosition pos, ULong_t length)
Return string at position pos.
virtual Bool_t LoadFile(const char *fname, long startpos=0, long length=-1)
Load a file in the text view widget.
static const TGGC & GetDefaultSelectedBackgroundGC()
Return graphics context for highlighted frame background.
const char * GetFileName() const
Bool_t Load(const char *fn, Long_t startpos=0, Long_t length=-1)
Load text from file fn.
virtual Bool_t HandleMotion(Event_t *event)
Handle mouse motion event in the text editor widget.
void SetFont(FontH_t v)
Set font.
virtual void Layout()
Layout the components of view.
R__EXTERN TSystem * gSystem
virtual void SetFont(FontStruct_t font)
Changes text entry font.
virtual Bool_t SelectAll()
Select all text in the viewer.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual void SetVsbPosition(Long_t newPos)
Set position of vertical scrollbar.
virtual const char * GetName() const
Return unique name, used in SavePrimitive methods.
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)...
virtual Bool_t HandleSelectionRequest(Event_t *event)
Handle request to send current clipboard contents to requestor window.
virtual Bool_t HandleDNDDrop(TDNDData *data)
Handle Drop event.
static TGGC * fgDefaultGC
void SetReadMode()
Set buffer in read mode.
virtual UInt_t GetDefaultWidth() const
Handles synchronous and a-synchronous timer events.
virtual Pixel_t GetBackground() const
virtual void AddText(TGText *text)
Add text to the view widget.
Bool_t Save(const char *fn)
Save text buffer to file fn.
virtual void SetSelectFore(Pixel_t p)
set selected text color
virtual void SetSBRange(Int_t direction)
Set the range for the kVertical or kHorizontal scrollbar.
Long_t GetLineLength(Long_t row)
Get length of specified line. Returns -1 if row does not exist.
virtual Long_t ReturnLineCount()
virtual UInt_t GetDefaultHeight() const
virtual Long_t ReturnLineLength(Long_t line)
virtual void SetWidth(UInt_t w)
TGLongPosition fScrollVal
virtual void Marked(Bool_t mark)
virtual void UpdateRegion(Int_t x, Int_t y, UInt_t w, UInt_t h)
update a part of view
virtual void HLayout()
Horizontal layout of widgets (canvas, scrollbar).
FontStruct_t GetFontStruct() const
virtual Bool_t IsMapped()
Returns kTRUE if window is mapped on screen, kFALSE otherwise.
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save a text edit widget as a C++ statement(s) on output stream out.
virtual void SetText(TGText *text)
Adopt a new text buffer. The text will be deleted by this object.
virtual void DataChanged()
Mother of all ROOT objects.
virtual Long_t ToScrXCoord(Long_t xCoord, Long_t line)
Convert column number in specified line to screen coordinate.
A TSystemFile describes an operating system file.
virtual void UnmapWindow()
Bool_t AddText(TGText *text)
Add another text buffer to this buffer.
RooCmdArg Layout(Double_t xmin, Double_t xmax=0.99, Double_t ymin=0.95)
virtual void SetHeight(UInt_t h)
virtual void AddTimer(TTimer *t)
Add timer to list of system timers.
virtual Long_t ToScrYCoord(Long_t yCoord)
Convert line number to screen coordinate.
static const TGGC & GetDefaultGC()
Return default graphics context in use.
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
virtual Atom_t HandleDNDPosition(Int_t x, Int_t y, Atom_t action, Int_t xroot, Int_t yroot)
Handle Drag position event.
virtual void ShowTop()
Show top of the page.
virtual void DrawRegion(Int_t x, Int_t y, UInt_t w, UInt_t h)
Draw lines in exposed region.
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
virtual void Clear(Option_t *="")
Clear view.
virtual Atom_t HandleDNDEnter(Atom_t *typelist)
Handle Drag Enter event.
const Int_t kAcceleration[kAutoScrollFudge+1]
const Mask_t kButton1Mask
Long_t GetLongestLine() const
static Bool_t IsTextFile(const char *candidate)
Returns true if given a text file Uses the specification given on p86 of the Camel book...
virtual Long_t ToObjXCoord(Long_t xCoord, Long_t line)
Convert x screen coordinate to column in specified line.
virtual void AdjustWidth()
Adjust widget width to longest line.
const char * Data() const
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event in text editor.
FontH_t GetFontHandle() const