Lines Matching refs:src
227 MultiSrcObject src = (MultiSrcObject) new;
234 src->multi_src.changes = FALSE;
235 src->multi_src.allocated_string = FALSE;
237 file = InitStringOrFile(src, src->multi_src.type == XawAsciiFile);
238 LoadPieces(src, file, NULL);
241 src->text_src.text_format = XawFmtWide;
261 MultiSrcObject src = (MultiSrcObject) w;
263 MultiPiece * piece = FindPiece(src, pos, &start);
288 MultiSrcObject src = (MultiSrcObject) w;
330 if (src->text_src.edit_mode == XawtextRead)
333 start_piece = FindPiece(src, startPos, &start_first);
334 end_piece = FindPiece(src, endPos, &end_first);
346 RemovePiece(src, start_piece);
350 RemovePiece(src, temp_piece->prev);
360 RemovePiece(src, start_piece);
366 if ( src->multi_src.use_string_in_place &&
367 ((src->multi_src.length - (endPos - startPos)) <
368 (src->multi_src.piece_size - 1)) )
369 start_piece->text[src->multi_src.length - (endPos - startPos)] = (wchar_t)0;
373 src->multi_src.length += text.length -(endPos - startPos);
374 /*((TextWidget)src->object.parent)->text.lastPos = src->multi_src.length;*/
382 start_piece = FindPiece(src, startPos, &start_first);
391 if (src->multi_src.use_string_in_place) {
392 if (start_piece->used == (src->multi_src.piece_size - 1)) {
397 start_piece->used = src->multi_src.length =
398 src->multi_src.piece_size - 1;
399 /*((TextWidget)src->object.parent)->text.lastPos = src->multi_src.length;*/
402 start_piece->text[src->multi_src.length] = (wchar_t)0;
408 if (start_piece->used == src->multi_src.piece_size) {
409 BreakPiece(src, start_piece);
410 start_piece = FindPiece(src, startPos, &start_first);
413 fill = Min((int)(src->multi_src.piece_size - start_piece->used), length);
435 if (src->multi_src.use_string_in_place)
438 src->multi_src.changes = TRUE;
472 MultiSrcObject src = (MultiSrcObject) w;
480 return(src->multi_src.length);
487 if (position > src->multi_src.length)
488 position = src->multi_src.length;
492 if (position == src->multi_src.length)
493 return(src->multi_src.length);
503 piece = FindPiece(src, position, &first);
557 return(src->multi_src.length);
577 if (position >= src->multi_src.length)
578 return(src->multi_src.length);
601 MultiSrcObject src = (MultiSrcObject) w;
650 piece = FindPiece(src, position, &first);
713 MultiSrcObject src = (MultiSrcObject) new;
721 src->multi_src.use_string_in_place ) {
724 src->multi_src.use_string_in_place =
734 if ( string_set || (old_src->multi_src.type != src->multi_src.type) ) {
736 file = InitStringOrFile(src, string_set);
740 LoadPieces(src, NULL, src->multi_src.string);
742 LoadPieces(src, file, NULL);
749 if ( old_src->multi_src.multi_length != src->multi_src.multi_length )
750 src->multi_src.piece_size = src->multi_src.multi_length;
753 != src->multi_src.piece_size) ) {
758 LoadPieces( src, NULL, mb_string );
789 MultiSrcObject src = (MultiSrcObject) w;
792 if (src->multi_src.type == XawAsciiString) {
795 if (src->multi_src.use_string_in_place) {
797 src->multi_src.first_piece->text;
801 *((char **) args[i].value) = src->multi_src.string;
810 * Arguments: src - the Multi source Widget to free.
845 MultiSrcObject src = (MultiSrcObject) w;
847 /*if (src->multi_src.allocated_string&& src->multi_src.type != XawAsciiFile) {*/
848 /* ASSERT: src->multi_src.allocated_string -> we MUST free .string! */
849 if ( src->multi_src.allocated_string ) {
850 XtFree(src->multi_src.string);
851 src->multi_src.allocated_string = FALSE;
852 src->multi_src.string = NULL;
873 MultiSrcObject src = (MultiSrcObject) w;
882 if (src->multi_src.use_string_in_place)
885 if (src->multi_src.type == XawAsciiFile) {
887 if (!src->multi_src.changes) /* No changes to save. */
890 mb_string = StorePiecesInString( src );
893 if ( WriteToFile( mb_string, src->multi_src.string ) == FALSE ) {
898 src->multi_src.changes = FALSE;
913 mb_string = StorePiecesInString( src );
919 XtName( XtParent( (Widget) src ) ), NULL, NULL);
924 if (src->multi_src.allocated_string == TRUE)
925 XtFree(src->multi_src.string);
927 src->multi_src.allocated_string = TRUE;
929 src->multi_src.string = mb_string;
931 src->multi_src.changes = FALSE;
955 MultiSrcObject src = (MultiSrcObject) w;
959 mb_string = StorePiecesInString( src );
970 XtName( XtParent( (Widget) src ) ), NULL, NULL);
981 RemoveOldStringOrFile(src, checkString)
982 MultiSrcObject src;
985 FreeAllPieces(src);
987 if (checkString && src->multi_src.allocated_string) {
988 XtFree(src->multi_src.string);
989 src->multi_src.allocated_string = False;
990 src->multi_src.string = NULL;
1021 * Arguments: src - the multiSrc to gather data from
1027 StorePiecesInString(src)
1028 MultiSrcObject src;
1032 int char_count = src->multi_src.length;
1040 for (first = 0, piece = src->multi_src.first_piece ; piece != NULL;
1049 if ( src->multi_src.data_compression ) {
1050 FreeAllPieces( src );
1051 LoadPieces( src, NULL, (char *)wc_string );
1056 mb_string = _XawTextWCToMB( XtDisplayOfObject( (Widget)src ),
1067 * Arguments: src - the MultiSource.
1072 InitStringOrFile(src, newString)
1073 MultiSrcObject src;
1079 Display *d = XtDisplayOfObject((Widget)src);
1081 if (src->multi_src.type == XawAsciiString) {
1083 if (src->multi_src.string == NULL)
1084 src->multi_src.length = 0;
1086 else if (! src->multi_src.use_string_in_place) {
1088 String temp = XtNewString(src->multi_src.string);
1089 if ( src->multi_src.allocated_string )
1090 XtFree( src->multi_src.string );
1091 src->multi_src.allocated_string = True;
1092 src->multi_src.string = temp;
1094 length = strlen(src->multi_src.string);
1097 (void) _XawTextMBToWC(d, src->multi_src.string, &length);
1098 src->multi_src.length = (XawTextPosition) length;
1100 src->multi_src.length = strlen(src->multi_src.string);
1102 if (src->multi_src.length > src->multi_src.multi_length)
1103 src->multi_src.multi_length = src->multi_src.length;
1105 if (src->multi_src.multi_length == MAGIC_VALUE)
1106 src->multi_src.piece_size = src->multi_src.length;
1108 src->multi_src.piece_size = src->multi_src.multi_length + 1;
1111 /*((TextWidget)src->object.parent)->text.lastPos = src->multi_src.length;*/
1119 src->multi_src.is_tempfile = FALSE;
1121 switch (src->text_src.edit_mode) {
1123 if (src->multi_src.string == NULL)
1131 if (src->multi_src.string == NULL) {
1133 if ( src->multi_src.allocated_string )
1134 XtFree( src->multi_src.string );
1135 src->multi_src.allocated_string = False;
1136 src->multi_src.string = fileName;
1138 (void) tmpnam(src->multi_src.string);
1139 src->multi_src.is_tempfile = TRUE;
1154 if (newString || src->multi_src.is_tempfile) {
1155 if ( src->multi_src.allocated_string )
1156 XtFree( src->multi_src.string );
1157 src->multi_src.string = XtNewString(src->multi_src.string);
1158 src->multi_src.allocated_string = TRUE;
1161 if (!src->multi_src.is_tempfile) {
1162 if ((file = fopen(src->multi_src.string, open_mode)) != 0) {
1164 src->multi_src.length = ftell (file);
1170 params[0] = src->multi_src.string;
1172 XtAppWarningMsg(XtWidgetToApplicationContext((Widget)src),
1177 src->multi_src.length = 0;
1183 MB contents of string or the MB contents of src->multi_src.string and places
1186 CAUTION: You must have src->multi_src.length set to file length bytes
1187 when src->multi_src.type == XawAsciiFile. src->multi_src.length must be
1191 LoadPieces(src, file, string)
1192 MultiSrcObject src;
1196 Display *d = XtDisplayOfObject((Widget)src);
1208 int local_length = src->multi_src.length;
1213 * src->multi_src.length is currently string's * byte count,
1217 src->multi_src.length = (XawTextPosition) local_length;
1218 } else if (src->multi_src.type != XawAsciiFile) {
1223 local_length = src->multi_src.string ?
1224 strlen( src->multi_src.string ) : 0;
1225 local_str = _XawTextMBToWC( d, (char*)src->multi_src.string, &local_length );
1227 if (src->multi_src.length != 0) {
1229 XtMalloc((unsigned)(src->multi_src.length + 1) * sizeof(unsigned char));
1231 src->multi_src.length = fread (temp_mb_holder,
1233 (Size_t)src->multi_src.length, file);
1234 if (src->multi_src.length <= 0)
1235 XtAppErrorMsg( XtWidgetToApplicationContext ((Widget) src),
1238 local_length = src->multi_src.length;
1240 src->multi_src.length = local_length;
1248 params[0] = XtName(XtParent((Widget)src));
1249 params[1] = src->multi_src.string;
1252 XtAppWarningMsg( XtWidgetToApplicationContext((Widget)src),
1256 src->multi_src.length = sizeof err_text;
1257 local_length = src->multi_src.length;
1259 src->multi_src.length = local_length;
1263 temp_mb_holder[src->multi_src.length] = '\0';*/
1268 if (src->multi_src.use_string_in_place) {
1269 piece = AllocNewPiece(src, piece);
1270 piece->used = Min(src->multi_src.length, src->multi_src.piece_size);
1271 piece->text = (wchar_t*)src->multi_src.string;
1279 piece = AllocNewPiece(src, piece);
1281 piece->text = (wchar_t*)XtMalloc(src->multi_src.piece_size * bytes);
1282 piece->used = Min(left, src->multi_src.piece_size);
1297 * Arguments: src - The MultiSrc Widget.
1303 AllocNewPiece(src, prev)
1304 MultiSrcObject src;
1310 src->multi_src.first_piece = piece;
1327 * Arguments: src - The MultiSrc Widget.
1332 FreeAllPieces(src)
1333 MultiSrcObject src;
1335 MultiPiece * next, * first = src->multi_src.first_piece;
1342 RemovePiece(src, first);
1354 RemovePiece(src, piece)
1355 MultiSrcObject src;
1359 src->multi_src.first_piece = piece->next;
1366 if (!src->multi_src.use_string_in_place)
1374 * Arguments: src - The MultiSrc Widget.
1381 FindPiece(src, position, first)
1382 MultiSrcObject src;
1385 MultiPiece * old_piece, * piece = src->multi_src.first_piece;
1400 * Arguments: src - The MultiSrc Widget.
1405 #define HALF_PIECE (src->multi_src.piece_size/2)
1408 BreakPiece(src, piece)
1409 MultiSrcObject src;
1412 MultiPiece * new = AllocNewPiece(src, piece);
1414 new->text = (wchar_t*)XtMalloc(src->multi_src.piece_size * sizeof(wchar_t));
1416 src->multi_src.piece_size - HALF_PIECE);
1418 new->used = src->multi_src.piece_size - HALF_PIECE;