CVS: tvision/classes tchdirdi.cc,1.11,1.11.2.1 tfiledia.cc,1.13,1.13.4.1 thistory.cc,1.5,1.5.4.1 tin
Brought to you by:
set
From: Salvador E. T. <se...@us...> - 2003-02-21 18:28:59
|
Update of /cvsroot/tvision/tvision/classes In directory sc8-pr-cvs1:/tmp/cvs-serv12296/classes Modified Files: Tag: r2_0_1u tchdirdi.cc tfiledia.cc thistory.cc tinputli.cc Log Message: * Modified: In my new structure class I avoid computing the length of the data member over and over. This makes some old code to break because it accesses the data member directly. So I moved these data members to the protected section and added members to handle this member in a better way. Index: tchdirdi.cc =================================================================== RCS file: /cvsroot/tvision/tvision/classes/tchdirdi.cc,v retrieving revision 1.11 retrieving revision 1.11.2.1 diff -C2 -d -r1.11 -r1.11.2.1 *** tchdirdi.cc 3 Jun 2002 19:02:44 -0000 1.11 --- tchdirdi.cc 21 Feb 2003 18:28:51 -0000 1.11.2.1 *************** *** 143,147 **** curDir[len-1] = EOS; #endif ! strcpy( dirInput->data, curDir ); dirInput->drawView(); dirList->select(); --- 143,147 ---- curDir[len-1] = EOS; #endif ! dirInput->setDataFromStr(curDir); dirInput->drawView(); dirList->select(); *************** *** 171,175 **** curDir[len-1] = EOS; #endif ! strcpy( dirInput->data, curDir ); dirInput->drawView(); } --- 171,175 ---- curDir[len-1] = EOS; #endif ! dirInput->setDataFromStr(curDir); dirInput->drawView(); } *************** *** 181,185 **** if ( command != cmOK ) return True; ! if( changeDir( dirInput->data ) != 0 ) { messageBox( _("Invalid directory"), mfError | mfOKButton ); --- 181,185 ---- if ( command != cmOK ) return True; ! if( changeDir( (const char *)dirInput->getData() ) != 0 ) { messageBox( _("Invalid directory"), mfError | mfOKButton ); Index: tfiledia.cc =================================================================== RCS file: /cvsroot/tvision/tvision/classes/tfiledia.cc,v retrieving revision 1.13 retrieving revision 1.13.4.1 diff -C2 -d -r1.13 -r1.13.4.1 *** tfiledia.cc 12 May 2000 02:29:09 -0000 1.13 --- tfiledia.cc 21 Feb 2003 18:28:53 -0000 1.13.4.1 *************** *** 62,66 **** fileName = new TFileInputLine( TRect( 3, 2, 31, 3 ), PATH_MAX ); ! strcpy( fileName->data, wildCard ); fileName->growMode=gfGrowHiX; insert( fileName ); --- 62,66 ---- fileName = new TFileInputLine( TRect( 3, 2, 31, 3 ), PATH_MAX ); ! fileName->setDataFromStr( wildCard ); fileName->growMode=gfGrowHiX; insert( fileName ); *************** *** 173,182 **** { char buf[PATH_MAX]; ! trim( buf, fileName->data ); if ( CLY_IsRelativePath( buf ) ) { strcpy( buf, directory ); ! trim( buf + strlen(buf), fileName->data ); } CLY_fexpand( buf ); --- 173,183 ---- { char buf[PATH_MAX]; + const char *file=(const char *)fileName->getData(); ! trim( buf, file ); if ( CLY_IsRelativePath( buf ) ) { strcpy( buf, directory ); ! trim( buf + strlen(buf), file ); } CLY_fexpand( buf ); Index: thistory.cc =================================================================== RCS file: /cvsroot/tvision/tvision/classes/thistory.cc,v retrieving revision 1.5 retrieving revision 1.5.4.1 diff -C2 -d -r1.5 -r1.5.4.1 *** thistory.cc 12 May 2000 02:29:10 -0000 1.5 --- thistory.cc 21 Feb 2003 18:28:53 -0000 1.5.4.1 *************** *** 75,79 **** { link->select(); ! historyAdd( historyId, link->data ); r = link->getBounds(); r.a.x--; --- 75,79 ---- { link->select(); ! historyAdd( historyId, (const char *)link->getData() ); r = link->getBounds(); r.a.x--; *************** *** 92,97 **** char rslt[256]; historyWindow->getSelection( rslt ); ! strncpy( link->data, rslt, link->maxLen ); ! link->data[link->maxLen] = EOS; link->selectAll( True ); link->drawView(); --- 92,96 ---- char rslt[256]; historyWindow->getSelection( rslt ); ! link->setDataFromStr( rslt ); link->selectAll( True ); link->drawView(); *************** *** 107,111 **** event.message.command == cmRecordHistory ) ! historyAdd( historyId, link->data ); } --- 106,110 ---- event.message.command == cmRecordHistory ) ! historyAdd( historyId, (const char *)link->getData() ); } Index: tinputli.cc =================================================================== RCS file: /cvsroot/tvision/tvision/classes/tinputli.cc,v retrieving revision 1.12.2.2 retrieving revision 1.12.2.3 diff -C2 -d -r1.12.2.2 -r1.12.2.3 *** tinputli.cc 21 Feb 2003 15:55:19 -0000 1.12.2.2 --- tinputli.cc 21 Feb 2003 18:28:54 -0000 1.12.2.3 *************** *** 64,74 **** TInputLineBase::TInputLineBase(const TRect& bounds, int aMaxLen) : TView(bounds), - maxLen(aMaxLen-1 ), curPos(0), firstPos(0), selStart(0), selEnd(0), ! dataLen(0), ! validator(NULL) { state|=sfCursorVis; --- 64,74 ---- TInputLineBase::TInputLineBase(const TRect& bounds, int aMaxLen) : TView(bounds), curPos(0), firstPos(0), selStart(0), selEnd(0), ! validator(NULL), ! maxLen(aMaxLen-1), ! dataLen(0) { state|=sfCursorVis; *************** *** 131,135 **** int l, r; TDrawBuffer b; ! uchar color=(state & sfFocused) ? getColor(2) : getColor(1); --- 131,135 ---- int l, r; TDrawBuffer b; ! uchar color=(state & sfFocused) ? getColor(2) : getColor(1); *************** *** 508,511 **** --- 508,514 ---- { selStart=0; + // This is here just for compatibility purposes + dataLen=strlen(data); + if (enable) curPos=selEnd=dataLen; *************** *** 520,524 **** void TInputLine::setData(void *rec) { ! uint32 ds=dataSize()-1; memcpy(data,rec,ds); data[ds]=EOS; --- 523,527 ---- void TInputLine::setData(void *rec) { ! unsigned ds=dataSize()-1; memcpy(data,rec,ds); data[ds]=EOS; *************** *** 534,537 **** --- 537,560 ---- dataLen=strlen16(data16); selectAll(True); + } + + void TInputLine::setDataFromStr(void *str) + { + unsigned ds=dataSize()-1, i; + char *s=(char *)str; + for (i=0; i<ds && *s; i++) + data[i]=s[i]; + data[i]=EOS; + dataLen=i; + } + + void TInputLineU16::setDataFromStr(void *str) + { + unsigned ds=(dataSize()-1)/2, i; + uint16 *s=(uint16 *)str; + for (i=0; i<ds && *s; i++) + data16[i]=s[i]; + data16[i]=EOS; + dataLen=i; } |