Hi Maxim, just FYI, we are going to rewrite TGText et al. classes completly. New itnerface will allow syntax highliting, paragraths, embedding other widgets (e.g. root canvas), undo/redo capability ... hopefully html rendering. Regards. Valeriy > Dear ROOT developers, > > I suppose, invocation of LongestLine() from > Bool_t TGText::InsText(TGLongPosition pos, const char *buffer) > is not a optimal way to determine length of a longest line. Comparison > with the length of the line to add is faster. If you agree, apply the > patch attached. Just type from the root/gui source directory > > patch -p1 < TGText.patch > > -- > Maxim Nikulin > -------------------------------------------------------------------------------- > Index: gui/inc/TGText.h > =================================================================== > RCS file: /user/cvs/root/gui/inc/TGText.h,v > retrieving revision 1.6 > diff -a -u -r1.6 TGText.h > --- gui/inc/TGText.h 28 May 2003 11:55:31 -0000 1.6 > +++ gui/inc/TGText.h 23 Sep 2004 08:37:22 -0000 > @@ -98,7 +98,7 @@ > char GetChar(TGLongPosition pos); > > Bool_t DelText(TGLongPosition start, TGLongPosition end); > - Bool_t InsText(TGLongPosition pos, const char *buf); > + Bool_t InsText(TGLongPosition const& pos, const char *buf); > Bool_t InsText(TGLongPosition ins_pos, TGText *src, TGLongPosition start_src, TGLongPosition end_src); > Bool_t AddText(TGText *text); > > Index: gui/src/TGText.cxx > =================================================================== > RCS file: /user/cvs/root/gui/src/TGText.cxx,v > retrieving revision 1.14 > diff -a -u -r1.14 TGText.cxx > --- gui/src/TGText.cxx 24 May 2004 11:45:08 -0000 1.14 > +++ gui/src/TGText.cxx 23 Sep 2004 08:37:23 -0000 > @@ -738,7 +738,7 @@ > } > > //______________________________________________________________________________ > -Bool_t TGText::InsText(TGLongPosition pos, const char *buffer) > +Bool_t TGText::InsText(TGLongPosition const& pos, const char *buffer) > { > // Insert single line at specified position. Return false in case position > // is out of bounds. > @@ -751,11 +751,16 @@ > fCurrent->fNext = new TGTextLine(buffer); > fCurrent->fNext->fPrev = fCurrent; > fRowCount++; > + if ((Long_t)fCurrent->fNext->fLength > fColCount) { > + fColCount = fCurrent->fNext->fLength; > + } > } else { > SetCurrentRow(pos.fY); > fCurrent->InsText(pos.fX, buffer); > + if ((Long_t)fCurrent->fLength > fColCount) { > + fColCount = fCurrent->fLength; > + } > } > - LongestLine(); > fIsSaved = kFALSE; > return kTRUE; > } >
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:09 MET