[Plib-cvs] plib/src/pui pu.h,1.129,1.130 puLargeInput.cxx,1.39,1.40
Brought to you by:
sjbaker
From: Sebastian U. <ud...@us...> - 2002-09-17 22:42:17
|
Update of /cvsroot/plib/plib/src/pui In directory usw-pr-cvs1:/tmp/cvs-serv30972 Modified Files: pu.h puLargeInput.cxx Log Message: John F. Fay: puLargeInput is a child of puGroup again Index: pu.h =================================================================== RCS file: /cvsroot/plib/plib/src/pui/pu.h,v retrieving revision 1.129 retrieving revision 1.130 diff -u -d -r1.129 -r1.130 --- pu.h 15 Sep 2002 01:00:23 -0000 1.129 +++ pu.h 17 Sep 2002 22:42:12 -0000 1.130 @@ -327,11 +327,7 @@ #define PUSTRING_MAX 80 /* With many memory managers, allocating powers of two is more efficient */ -// wk: This was 64. But in the viewer example, compiled as debug build with MSVC -// when you choose a file with a path/file name length more than 64, there will be -// a crash. Obviously, the right thing to do would be to find the real cause -// for this and fix it, but I could not find it and we need to release... -#define PUSTRING_INITIAL 128 +#define PUSTRING_INITIAL 64 extern puColour _puDefaultColourTable[] ; [...94 lines suppressed...] + int new_data_len = 1 ; + if ( valid_data ) new_data_len += strlen ( valid_data ) ; + if ( data ) new_data_len += strlen ( data ) ; + char *new_data = new char [ new_data_len ] ; + strcpy ( new_data, "\0" ) ; + if ( valid_data ) strcat ( new_data, valid_data ) ; + if ( data ) strcat ( new_data, data ) ; + delete [] valid_data ; + valid_data = new_data ; + } + + int isValidCharacter ( char c ) const + { + if ( valid_data != NULL ) + return ( strchr ( valid_data, c ) != NULL ) ? 1 : 0 ; + else + return 1 ; } void invokeDownCallback ( void ) Index: puLargeInput.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puLargeInput.cxx,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- puLargeInput.cxx 15 Sep 2002 01:00:23 -0000 1.39 +++ puLargeInput.cxx 17 Sep 2002 22:42:12 -0000 1.40 @@ -24,7 +24,7 @@ #include "puLocal.h" -UL_RTTI_DEF1(puLargeInput,puInput) +UL_RTTI_DEF1(puLargeInput,puGroup) // Callbacks from the internal widgets @@ -34,24 +34,37 @@ float val = ((puRange *)slider)->getMaxValue () - slider->getFloatValue () ; [...444 lines suppressed...] + strncpy ( p, getStringValue (), cursor_position ) ; p[cursor_position] = '\0' ; strcat ( p, puGetPasteBuffer () ) ; - strcat ( p, getText() + cursor_position ) ; + strcat ( p, getStringValue() + cursor_position ) ; temp_cursor += strlen ( puGetPasteBuffer () ) ; - setText ( p ) ; + setValue ( p ) ; setCursor ( temp_cursor ) ; delete [] p ; } @@ -1163,7 +1202,7 @@ } } - setText ( p ) ; + setValue ( p ) ; setCursor ( temp_cursor + 1 ) ; delete [] p ; |