749N/ACopyright (c) 1989, 1994 X Consortium 749N/APermission is hereby granted, free of charge, to any person obtaining a copy 749N/Aof this software and associated documentation files (the "Software"), to deal 749N/Ain the Software without restriction, including without limitation the rights 749N/Ato use, copy, modify, merge, publish, distribute, sublicense, and/or sell 749N/Acopies of the Software, and to permit persons to whom the Software is 749N/Afurnished to do so, subject to the following conditions: 749N/AThe above copyright notice and this permission notice shall be included in 749N/Aall copies or substantial portions of the Software. 749N/ATHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 749N/AIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 749N/AFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 749N/AX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 749N/AAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 749N/ACONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 749N/AExcept as contained in this notice, the name of the X Consortium shall not be 749N/Aused in advertising or otherwise to promote the sale, use or other dealings 749N/Ain this Software without prior written authorization from the X Consortium. 749N/A "parameterError",
"textAction",
"XawError",
749N/A "Widget: %s Parameter: %s",
749N/A /* if it has more than one ESC char, I assume it is COMPOUND_TEXT. 749N/A If it has at least one hi bit set character, I pretend it is multibyte. */ 749N/A /* If we just asked for a XA_COMPOUND_TEXT and got a null 749N/A response, we'll ask again, this time for an XA_STRING. */ 749N/A /* Many programs, especially old terminal emulators, give us multibyte text 749N/Abut tell us it is COMPOUND_TEXT :( The following routine checks to see if the 749N/Astring is a legal multibyte string in our locale using a spooky heuristic :O 749N/Aand if it is we can only assume the sending client is using the same locale as 749N/Awe are, and convert it. I also warn the user that the other client is evil. */ 749N/A /* IS THE SELECTION IN MULTIBYTE FORMAT? */ 749N/A /* OR IN COMPOUND TEXT FORMAT? */ 749N/A /* Notify the user on strerr and in the insertion :) */ 749N/A fprintf(
stderr,
"Xaw Text Widget: An attempt was made to insert an illegal selection.\n" );
749N/A/************************************************************ 749N/A * Routines for Moving Around. 749N/A ************************************************************/ 749N/A/************************************************************ 749N/A ************************************************************/ 749N/A * If salt is True, the salt->contents stores CT string, 749N/A * its length is measured in bytes. 749N/A * Refer to _XawTextSaltAwaySelection(). 749N/A * by Li Yuhong, Mar. 20, 1991. 749N/A else /* *target == XA_LENGTH(d) */ 749N/A * Must walk the selection list in opposite order from UnsetSelection. 749N/A /* WARNING: the next line frees memory not allocated in Xaw. */ 749N/A /* Could be a serious bug. Someone look into it. */ 749N/A XStoreBuffer(XtDisplay(ctx), ptr, strlen(ptr), 1); 749N/A text.
ptr =
"";
/* These two lines needed to make legal TextBlock */ 749N/A * If no movement actually happened, then bump the count and try again. 749N/A * This causes the character position at the very beginning and end of 749N/A * a boundary to act correctly. 749N/A/************************************************************ 749N/A ************************************************************/ 749N/A/************************************************************ 749N/A *************************************************************/ 749N/A/************************************************************ 749N/A ************************************************************/ 749N/A /* Let the input method know focus has arrived. */ 749N/A /* Let the input method know focus has left.*/ 749N/A/* Function Name: AutoFill 749N/A * Description: Breaks the line at the previous word boundry when 749N/A * called inside InsertChar. 749N/A * Arguments: ctx - The text widget. 749N/A }
else {
/* == XawFmt8Bit */ 749N/A/* IfHexConvertHexElseReturnParam() - called by InsertString 749N/A * i18n requires the ability to specify multiple characters in a hexa- 749N/A * decimal string at once. Since Insert was already too long, I made 749N/A * this a seperate routine. 749N/A * A legal hex string in MBNF: '0' 'x' ( HEX-DIGIT HEX-DIGIT )+ '\0' 749N/A * WHEN: the passed param is a legal hex string 749N/A * RETURNS: a pointer to that converted, null terminated hex string; 749N/A * len_return holds the character count of conversion result 749N/A * WHEN: the passed param is not a legal hex string: 749N/A * RETURNS: the parameter passed; 749N/A * len_return holds the char count of param. 749N/A * NOTE: In neither case will there be strings to free. */ 749N/A char *p;
/* steps through param char by char */ 749N/A char c;
/* holds the character pointed to by p */ 749N/A int ind;
/* steps through hexval buffer char by char */ 749N/A /* reject if it doesn't begin with 0x and at least one more character. */ 749N/A /* Skip the 0x; go character by character shifting and adding. */ 749N/A if (c >=
'0' && c <=
'9')
749N/A else if (c >=
'a' && c <=
'f')
749N/A else if (c >=
'A' && c <=
'F')
749N/A /* If we didn't break in preceding line, it was a good hex char. */ 749N/A /* We quit the above loop becasue we hit a non hex. If that char is \0... */ 749N/A return(
hexval );
/* ...it was a legal hex string, so return it.*/ 749N/A /* Else, there were non-hex chars or odd digit count, so... */ 749N/A return(
param );
/* ...return the verbatim string. */ 749N/A/* InsertString() - action 749N/A * Mostly rewritten for R6 i18n. 749N/A * Each parameter, in turn, will be insert at the inputPos 749N/A * and the inputPos advances to the insertion's end. 749N/A * The exception is that parameters composed of the two 749N/A * characters 0x, followed only by an even number of 749N/A * hexadecimal digits will be converted to characters. */ 749N/A "insertString",
"textAction",
"XawError",
749N/A "insert-string()'s parameter contents not legal in this locale.",
749N/A /* Double check that the new input is legal: try to convert to MB. */ 749N/A "insertString",
"textAction",
"XawError",
749N/A "insert-string()'s parameter contents not legal in this locale.",
749N/A /* Advance insertPos to the end of the string we just inserted. */ 749N/A }
/* DO FOR EACH PARAMETER */ 749N/A/* DisplayCaret() - action 749N/A * The parameter list should contain one boolean value. If the 749N/A * argument is true, the cursor will be displayed. If false, not. 749N/A * The exception is that EnterNotify and LeaveNotify events may 749N/A * have a second argument, "always". If they do not, the cursor 749N/A * is only affected if the focus member of the event is true. */ 749N/A * The parameter list may contain either a number or the string 'Reset'. 749N/A * A number will multiply the current multiplication factor by that number. 749N/A * Many of the text widget actions will will perform n actions, where n is 749N/A * the multiplication factor. 749N/A * The string reset will reset the mutiplication factor to 1. */ 749N/A "Xaw Text Widget: multiply() takes exactly one argument.");
749N/A "must be a number greater than zero, or 'Reset'." );
749N/A/* StripOutOldCRs() - called from FormRegion 749N/A * removes CRs in widget ctx, from from to to. 749N/A * RETURNS: the new ending location (we may add some characters), 749N/A * or XawReplaceError if the widget can't be written to. */ 749N/A /* Initialize our TextBlock with two spaces. */ 749N/A * Remove all extra spaces. 749N/A/* InsertNewCRs() - called from FormRegion 749N/A * inserts new CRs for FormRegion, thus for FormParagraph action */ 749N/A/* FormRegion() - called by FormParagraph 749N/A * oversees the work of paragraph-forming a region 749N/A * RETURNS: XawEditDone if successful, or XawReplaceError. */ 749N/A /* insure that the insertion point is within legal bounds */ 749N/A/* FormParagraph() - action 749N/A * removes and reinserts CRs to maximize line length without clipping */ 749N/A/* TransposeCharacters() - action 749N/A * Swaps the character to the left of the mark 749N/A * with the character to the right of the mark. */ 749N/A /* Make sure we aren't at the very beginning or end of the buffer. */ 749N/A /* Retrieve text and swap the characters. */ 749N/A buf = (
char*)
wbuf;
/* so that it gets assigned and freed */ 749N/A }
else {
/* thus text.format == XawFmt8Bit */ 749N/A /* Store new text in source. */ 749N/A * This action performs no action, and allows the user or 749N/A * application programmer to unbind a translation. 749N/A * Note: If the parameter list contains the string "RingBell" then 749N/A * this action will ring the bell. 749N/A default:
/* Fall Through */ 749N/A * This reconnects to the input method. The user will typically call 749N/A * this action if/when connection has been severed, or when the app 749N/A * was started up before an IM was started up. 749N/A/* Action to bind special translations for text Dialogs. */ 749N/A/* Reconnect to Input Method */