tx->text.mult = 1;
return;
}
if (params[0][0] == '-') {
ctx->text.mult = 32767;
return;
}
else if (mult == 32767) {
mult = ctx->text.mult = - (params[0][0] - '0');
return;
}
else {
mult = mult * 10 + params[0][0] - '0';
ctx->text.mult = ctx->text.mult * 10 + params[0][0] - '0';
}
if (mult != ctx->text.mult || mult >= 32767) { /* checks for overflow */
XBell(XtDisplay(w), 0);
ctx->text.mult = 1;
ctx->text.numeric = False;
return;
}
}
else
InsertChar(w, event, params, num_params);
}
/*ARGSUSED*/
static void
KeyboardReset(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
TextWidget ctx = (TextWidget)w;
ctx->text.numeric = False;
ctx->text.mult = 1;
(void)_XawTextSrcToggleUndo((TextSrcObject)ctx->text.source);
if (ctx->text.kill_ring_ptr) {
--ctx->text.kill_ring_ptr->refcount;
ctx->text.kill_ring_ptr = NULL;
}
ctx->text.kill_ring = 0;
XBell(XtDisplay(w), 0);
}
#endif /* OLDXAW */
/* Multiply() - action
*
* The parameter list may contain either a number or the string 'Reset'.
*
* A number will multiply the current multiplication factor by that number.
* Many of the text widget actions will will perform n actions, where n is
* the multiplication factor.
*
* The string reset will reset the mutiplication factor to 1. */
/*ARGSUSED*/
static void
Multiply(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
TextWidget ctx = (TextWidget)w;
int mult;
if (*num_params != 1) {
XtAppError(XtWidgetToApplicationContext(w),
"Xaw Text Widget: multiply() takes exactly one argument.");
XBell(XtDisplay(w), 0);
return;
}
if ((params[0][0] == 'r') || (params[0][0] == 'R')) {
XBell(XtDisplay(w), 0);
#ifndef OLDXAW
ctx->text.numeric = False;
#endif
ctx->text.mult = 1;
return;
}
#ifndef OLDXAW
if (params[0][0] == 's' || params[0][0] == 'S') {
ctx->text.numeric = True;
ctx->text.mult = 0;
return;
}
else
#endif
if ((mult = atoi(params[0])) == 0) {
char buf[BUFSIZ];
XmuSnprintf(buf, sizeof(buf),
"%s %s", "Xaw Text Widget: multiply() argument",
"must be a number greater than zero, or 'Reset'.");
XtAppError(XtWidgetToApplicationContext(w), buf);
XBell(XtDisplay(w), 50);
return;
}
ctx->text.mult *= mult;
}
/* StripOutOldCRs() - called from FormRegion
*
* removes CRs in widget ctx, from from to to.
*
* RETURNS: the new ending location (we may add some characters),
* or XawReplaceError if the widget can't be written to. */
static XawTextPosition
StripOutOldCRs(TextWidget ctx, XawTextPosition from, XawTextPosition to,
XawTextPosition *pos, int num_pos)
{
XawTextPosition startPos, endPos, eop_begin, eop_end, temp;
Widget src = ctx->text.source;
XawTextBlock text;
char *buf;
static wchar_t wc_two_spaces[3];
int idx;
/* Initialize our TextBlock with two spaces. */
text.firstPos = 0;
text.format = _XawTextFormat(ctx);
if (text.format == XawFmt8Bit)
text.ptr= " ";
else {
wc_two_spaces[0]