/* $XConsortium: Text.c /main/198 1995/08/17 09:37:40 kaleb $ */
/***********************************************************
Copyright (c) 1987, 1988, 1994 X Consortium
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
#include "XawI18n.h"
#include <stdio.h>
#include <stdlib.h>
#include "TextP.h"
#include <ctype.h> /* for isprint() */
#ifndef MAX_LEN_CT
#endif
unsigned long FMT8BIT = 0L;
unsigned long XawFmt8Bit = 0L;
unsigned long XawFmtWide = 0L;
/*
* Compute a the maximum length of a cut buffer that we can pass at any
* time. The 64 allows for the overhead of the Change Property request.
*/
/*
* Defined in Text.c
*/
static void UnrealizeScrollbars();
static void FlushUpdate();
void _XawTextAlterSelection(), _XawTextExecuteUpdate();
void _XawTextSetScrollBars(), _XawTextPrepareToUpdate();
/****************************************************************
*
* Full class record constant
*
****************************************************************/
};
extern char *_XawDefaultTextTranslations1, *_XawDefaultTextTranslations2,
};
/* ARGSUSED */
static void
{
XrmQuark q;
if ( !inited ) {
}
q = XrmStringToQuark(lowerName);
else {
return;
}
return;
}
}
/* ARGSUSED */
static void
{
XrmQuark q;
if ( !inited ) {
}
q = XrmStringToQuark(lowerName);
else {
return;
}
return;
}
}
/* ARGSUSED */
static void
{
XrmQuark q;
if ( !inited ) {
}
q = XrmStringToQuark(lowerName);
else {
return;
}
return;
}
}
static void
{
if (!XawFmt8Bit)
if (!XawFmtWide)
/*
* Set the number of actions.
*/
}
/* Function Name: PositionHScrollBar.
* Description: Positions the Horizontal scrollbar.
* Arguments: ctx - the text widget.
* Returns: none
*/
static void
{
}
/* Function Name: PositionVScrollBar.
* Description: Positions the Vertical scrollbar.
* Arguments: ctx - the text widget.
* Returns: none.
*/
static void
{
}
static void
{
}
}
/* Function Name: DestroyVScrollBar
* Description: Removes a vertical ScrollBar.
* Arguments: ctx - the parent text widget.
* Returns: none.
*/
static void
{
}
static void
{
}
}
/* Function Name: DestroyHScrollBar
* Description: Removes a horizontal ScrollBar.
* Arguments: ctx - the parent text widget.
* Returns: none.
*/
static void
{
/*
ctx->text.r_margin.bottom -= hbar->core.height + hbar->core.border_width;
ctx->text.margin.bottom = ctx->text.r_margin.bottom;
*/
}
Widget w;
char* dir;
char* desc;
{
char* fmt = "Xaw Text Widget \"%s\": %s scrolling not allowed with %s.\n%s scrolling has been DEACTIVATED.";
char* errorp;
int len;
if ((len = strlen (fmt) + strlen (w->core.name) + 2 * strlen (dir) + strlen (desc)) < sizeof error_buf)
else
} else
}
/* ARGSUSED */
static void
{
}
}
}
}
}
static void
Widget w;
{
void _XawTextCheckResize();
(w, valueMask, attributes);
}
}
}
/*ARGSUSED*/
{
}
/* Utility routines for support of Text */
static void
Display *d;
{
static struct _DisplayRec {
PropModeAppend, NULL, 0 );
Create( XA_CUT_BUFFER0 );
Create( XA_CUT_BUFFER1 );
Create( XA_CUT_BUFFER2 );
Create( XA_CUT_BUFFER3 );
Create( XA_CUT_BUFFER4 );
Create( XA_CUT_BUFFER5 );
Create( XA_CUT_BUFFER6 );
Create( XA_CUT_BUFFER7 );
}
/*
* Procedure to manage insert cursor visibility for editable text. It uses
* the value of ctx->insertPos and an implicit argument. In the event that
* position is immediately preceded by an eol graphic, then the insert cursor
* is displayed at the beginning of the next line.
*/
static void
Widget w;
{
Position x, y;
int line;
else
}
/* Keep Input Method up to speed */
}
}
/*
* Procedure to register a span of text that is no longer valid on the display
* It is used to avoid a number of small, and potentially overlapping, screen
* updates.
*/
void
{
int i;
return;
}
}
}
}
}
/*
* Procedure to read a span of text in Ascii form. This is purely a hack and
* we probably need to add a function to sources to provide this functionality.
* [note: this is really a private procedure but is used in multiple modules].
*/
char *
{
int bytes;
bytes = sizeof(unsigned char);
else /* if there is another fomat, add here */
bytes = 1;
/* leave space for ZERO */
break;
}
else
*tempResult = '\0';
return(result);
}
/* Like _XawTextGetText, but enforces ICCCM STRING type encoding. This
routine is currently used to put just the ASCII chars in the selection into a
cut buffer. */
char *
{
unsigned char *s;
unsigned char c;
long i, j, n;
/* allow ESC in accordance with ICCCM */
for (j = 0, i = 0; j < n; j++) {
}
return (char *)ws;
} else {
/* only HT and NL control chars are allowed, strip out others */
n = strlen((char *)s);
i = 0;
for (j = 0; j < n; j++) {
c = s[j];
if (((c >= 0x20) && c <= 0x7f) ||
s[i] = c;
i++;
}
}
s[i] = 0;
return (char *)s;
}
}
/*
* This routine maps an x and y position in a window that is displaying text
* into the corresponding position in the source.
*
* NOTE: it is illegal to call this routine unless there is a valid line table!
*/
/*** figure out what line it is on ***/
static XawTextPosition
Position x,y;
{
break;
}
return(position);
}
/*
* This routine maps a source position in to the corresponding line number
* of the text that is displayed in the window.
*
* NOTE: It is illegal to call this routine unless there is a valid line table!
*/
static int
{
int line;
break;
return(line);
}
/*
* This routine maps a source position into the corresponding line number
* and the x, y coordinates of the text that is displayed in the window.
*
* NOTE: It is illegal to call this routine unless there is a valid line table!
*/
static Boolean
int *line;
Position *x, *y;
{
*line = 0;
*x += realW;
}
return(visible);
}
/*
* This routine builds a line table. It does this by starting at the
* specified position and measuring text to determine the staring position
* of each line to be displayed. It also determines and saves in the
* linetable all the required metrics for displaying a given line (e.g.
* x offset, y offset, line length, etc.).
*/
void
#else
#endif
{
int lines = 0;
}
}
}
}
/*
* This assumes that the line table does not change size.
*/
static XawTextPosition
int line;
{
Position y;
else
/* CONSTCOND */
while ( TRUE ) {
lt->y = y;
y += realH;
break;
}
++lt;
++line;
return(position);
}
/*
* If we are at the end of the buffer put two special lines in the table.
*
* a) Both have position > text.lastPos and lt->textWidth = 0.
* b) The first has a real height, and the second has a height that
* is the rest of the screen.
*
* I could fill in the rest of the table with valid heights and a large
* lastPos, but this method keeps the number of fill regions down to a
* minimum.
*
* One valid entry is needed at the end of the table so that the cursor
* does not jump off the bottom of the window.
*/
}
return(endPos);
}
/* Function Name: GetWidestLine
* Description: Returns the width (in pixels) of the widest line that
* is currently visable.
* Arguments: ctx - the text widget.
* Returns: the width of the widest line.
*
* NOTE: This function requires a valid line table.
*/
static Dimension
{
int i;
return(widest);
}
static void
{
else
last = 1.0;
int line;
else
}
}
}
}
/*
* This routine is used by Text to notify an associated scrollbar of the
* correct metrics (position and shown fraction) for the text being currently
* displayed in the window.
*/
void
{
else
if (widest < 1.0)
else
or removed the hbar.*/
}
}
{
}
}
/*
* The routine will scroll the displayed text by lines. If the arg is
* positive, move up; otherwise, move down. [note: this is really a private
* procedure but is used in multiple modules].
*/
void
int n;
{
int y;
if (n == 0) return;
if (n > 0) {
if ( IsValidLine(ctx, n) )
else
else {
PushCopyQueue(ctx, 0, (int) -y);
(Position) 0,
}
}
else {
n = -n;
else
height = 0;
else
clear_height = 0;
PushCopyQueue(ctx, 0, (int) y);
}
}
}
/*ARGSUSED*/
static void
Widget w;
{
}
if (pixels > 0) {
0, (int) rect.y);
}
else if (pixels < 0) {
rect.x = 0;
/*
* Redraw the line overflow marks.
*/
}
/*
* Put in the text that just became visible.
*/
if ( pixels != 0 ) {
}
}
/*ARGSUSED*/
static void
Widget w;
{
return;
}
}
/* Function Name: UpdateTextInLine
* Description: Updates some text in a given line.
* Arguments: ctx - the text widget.
* line - the line number (in the line table) of this line.
* left, right - left and right pixel offsets of the
* area to update.
* Returns: none.
*/
static void
int line;
{
return; /* no need to update. */
else
pos2 = GETLASTPOS;
else {
}
}
/*
* The routine will scroll the displayed text by pixels. If the calldata is
* positive, move up; otherwise, move down.
*/
/*ARGSUSED*/
static void
Widget w;
{
if (height < 1)
height = 1;
}
/*
* The routine "thumbs" the displayed text. Thumbing means reposition the
* displayed view of the source to a new position determined by a fraction
* of the way from beginning to end. Ideally, this should be determined by
* the number of displayable lines in the source. This routine does it as a
* fraction of the first position and last position and then normalizes to
* the start of the line containing the position.
*
* BUG/deficiency: The normalize to line portion of this routine will
* cause thumbing to always position to the start of the source.
*/
/*ARGSUSED*/
static void
Widget w;
{
else
int line = 0;
}
else {
int line = 0;
}
else
}
}
static Boolean
XawTextSelection *s;
{
int count;
return True;
return False;
}
static Boolean
Widget w;
unsigned long *length;
int *format;
{
XawTextSelection *s;
if (*target == XA_TARGETS(d)) {
unsigned long std_length;
return True;
&std_length, format);
*targetP++ = XA_COMPOUND_TEXT(d);
*targetP++ = XA_LIST_LENGTH(d);
*targetP++ = XA_CHARACTER_POSITION(d);
if (edit_mode == XawtextEdit) {
(*length)++;
}
XtFree((char*)std_targets);
*format = 32;
return True;
}
return True;
else
{
break;
if (!salt)
return False;
s = &salt->s;
}
*target == XA_COMPOUND_TEXT(d)) {
*type = XA_COMPOUND_TEXT(d);
else
} else {
}
/*
* If salt is True, the salt->contents stores CT string,
* its length is measured in bytes.
* Refer to _XawTextSaltAwaySelection().
*
* by Li Yuhong, Mar. 20, 1991.
*/
if (!salt) {
< Success) {
return False;
}
} else {
}
} else {
}
int count;
< Success) {
return False;
}
return False;
}
}
*format = 8;
return True;
}
long * temp;
if (*target == XA_LIST_LENGTH(d))
*temp = 1L;
else /* *target == XA_LENGTH(d) */
*type = XA_INTEGER;
*length = 1L;
*format = 32;
return True;
}
if (*target == XA_CHARACTER_POSITION(d)) {
long * temp;
*length = 2L;
*format = 32;
return True;
}
void _XawTextZapSelection(); /* From TextAction.c */
if (!salt)
*length = 0;
*format = 32;
return True;
}
return True;
/* else */
return False;
}
/* Function Name: GetCutBuffferNumber
* Description: Returns the number of the cut buffer.
* Arguments: atom - the atom to check.
* Returns: the number of the cut buffer representing this atom or
* NOT_A_CUT_BUFFER.
*/
static int
{
if (atom == XA_CUT_BUFFER0) return(0);
return(NOT_A_CUT_BUFFER);
}
static void
Widget w;
{
int i;
/*
* Must walk the selection list in opposite order from UnsetSelection.
*/
}
prevSalt = 0;
{
while (salt->s.atom_count &&
{
salt->s.atom_count--;
}
/*
* Must walk the selection list in opposite order from UnsetSelection.
*/
{
while (salt->s.atom_count &&
salt->s.atom_count--;
}
if (salt->s.atom_count == 0)
{
if (prevSalt)
else
}
else
}
}
void
int num_atoms;
{
int i, j;
for (i = 0; i < num_atoms; i++)
if (num_atoms == 0)
return;
salt = (XawTextSelectionSalt *)
XtMalloc( (unsigned) sizeof(XawTextSelectionSalt) );
if (!salt)
return;
if (!salt->s.selections)
{
return;
}
return;
}
} else
j = 0;
for (i = 0; i < num_atoms; i++)
{
{
}
}
salt->s.atom_count = j;
}
static void
{
}
}
}
}
int buffer;
while (count) {
/*
* If this is a cut buffer.
*/
unsigned long len;
/*
* Only XA_STRING(Latin 1) is allowed in CUT_BUFFER,
* so we get it from wchar string, then free the wchar string.
*/
return;
}
}
if (buffer == 0) {
}
}
}
else /* This is a real selection */
}
}
else
}
/*
* This internal routine deletes the text from pos1 to pos2 in a source and
* then inserts, at pos1, the text that was passed. As a side effect it
* "invalidates" that portion of the displayed text (if any).
*
* NOTE: It is illegal to call this routine unless there is a valid line table!
*/
int
{
long delta;
/*
* The insertPos may not always be set to the right spot in XawtextAppend
*/
return( XawEditError );
}
}
return(error);
}
return(0); /* Things are fine. */
}
}
}
/*
* fixup all current line table entries to reflect edit.
* %%% it is not legal to do arithmetic on positions.
* using Scan would be more proper.
*/
if (delta != 0) {
}
/*
* Now process the line table and fixup in case edits caused
* changes in line breaks. If we are breaking on word boundaries,
* this code checks for moving words to and from lines.
*/
}
return(0); /* Things are fine. */
}
/*
* This routine will display text between two arbitrary source positions.
* In the event that this span contains highlighted text for the selection,
* only that portion will be displayed highlighted.
*
* NOTE: it is illegal to call this routine unless there
* is a valid line table!
*/
static void
Widget w;
{
Position x, y;
return; /* line not visible, or pos1 >= pos2. */
}
else {
}
(Position) 0, y,
else {
}
}
if (clear_eol) {
/*
* We only get here if single character is true, and we need
* to clear to the end of the screen. We know that since there
* was only one character deleted that this is the same
* as clearing an extra line, so we do this, and are done.
*
* This a performance hack, and a pretty gross one, but it works.
*
* Chris Peterson 11/13/89.
*/
if (done_painting) {
y += height;
break; /* set single_char to FALSE and return. */
}
}
if ( done_painting
break;
}
}
/*
* This routine implements multi-click selection in a hardwired manner.
* It supports multi-click entity cycling (char, word, line, file) and mouse
* motion adjustment of the selected entitie (i.e. select a word then, with
* button still down, adjust wich word you really meant by moving the mouse).
* [NOTE: This routine is to be replaced by a set of procedures that
* will allows clients to implements a wide class of draw through and
* multi-click selection user interfaces.]
*/
static void
{
if (motion)
else {
if (*sarray == XawselectNull)
else {
if (newType == XawselectNull)
}
}
else /* single-click event */
}
switch (newType) {
case XawselectPosition:
break;
case XawselectChar:
break;
case XawselectWord:
case XawselectParagraph:
{
if (newType == XawselectWord)
else
/*
* Somewhat complicated, but basically I treat the space between
* two objects as another object. The object that I am currently
* in then becomes the end of the selection.
*
* Chris Peterson - 4/19/90.
*/
else
}
}
break;
case XawselectLine:
break;
case XawselectAll:
break;
default:
"Text Widget: empty selection array.");
return;
}
else
}
if (!motion) { /* setup so we can freely mix select extend calls*/
else
}
}
/*
* This routine implements extension of the currently selected text in
* the "current" mode (i.e. char word, line, etc.). It worries about
* extending from either end of the selection and handles the case when you
* cross through the "center" of the current selection (e.g. switch which
* end you are extending!).
*/
static void
{
if (!motion) { /* setup for extending selection */
else {
}
else
}
else /* check for change in extend direction */
}
case XawselectWord:
case XawselectParagraph:
{
else
/*
* Somewhat complicated, but basically I treat the space between
* two objects as another object. The object that I am currently
* in then becomes the end of the selection.
*
* Chris Peterson - 4/19/90.
*/
else
else /* dir == XawsdRight */
}
break;
case XawselectLine:
break;
case XawselectAll:
case XawselectPosition: /* fall through. */
default:
break;
}
if (dir == XawsdRight)
else
}
/*
* Clear the window to background color.
*/
static void
ClearWindow (w)
Widget w;
{
if (XtIsRealized(w))
}
/* Function Name: _XawTextClearAndCenterDisplay
* Description: Redraws the display with the cursor in insert point
* centered vertically.
* Arguments: ctx - the text widget.
* Returns: none.
*/
void
{
}
/*
* Internal redisplay entire window.
* Legal to call only if widget is realized.
*/
static void
Widget w;
{
ClearWindow(w);
}
/*
* This routine checks to see if the window should be resized (grown or
* shrunk) when text to be painted overflows to the right or
* the bottom of the window. It is used by the keyboard input routine.
*/
void
{
}
}
}
return;
else
return;
}
/*
* Converts (params, num_params) to a list of atoms & caches the
* list in the TextWidget instance.
*/
Atom*
{
int n;
}
}
/* Function Name: SetSelection
* Description: Sets the current selection.
* Arguments: ctx - the text widget.
* defaultSel - the default selection.
* l, r - the left and right ends of the selection.
* list, nelems - the selection list (as strings).
* Returns: none.
*
* is unset.
*/
void
XawTextPosition l, r;
{
return;
if (nelems == 0) {
list = &defaultSel;
nelems = 1;
}
}
/* Function Name: ModifySelection
* Description: Modifies the current selection.
* Arguments: ctx - the text widget.
* left, right - the left and right ends of the selection.
* Returns: none.
*
* is unset.
*/
static void
{
}
/*
* This routine is used to perform various selection functions. The goal is
* to be able to specify all the more popular forms of draw-through and
* multi-click selection user interfaces from the outside.
*/
void
XawactionAdjust, XawactionEnd} */
{
/*
* This flag is used by TextPop.c:DoReplace() to determine if the selection
* is okay to use, or if it has been modified.
*/
if (mode == XawsmTextSelect)
else /* mode == XawsmTextExtend */
if (action == XawactionEnd)
params, *num_params);
}
/* Function Name: RectanglesOverlap
* Description: Returns TRUE if two rectangles overlap.
* Arguments: rect1, rect2 - the two rectangles to check.
* Returns: TRUE iff these rectangles overlap.
*/
static Boolean
{
}
/* Function Name: UpdateTextInRectangle.
* Description: Updates the text in a rectangle.
* Arguments: ctx - the text widget.
* rect - the rectangle to update.
* Returns: none.
*/
static void
XRectangle * rect;
{
if ( (info + 1)->y >= y )
}
/*
* This routine processes all "expose region" XEvents. In general, its job
* is to the best job at minimal re-paint of the text, displayed in the
* window, that it can.
*/
/* ARGSUSED */
static void
Widget w;
{
}
}
else { /* No Expose */
return; /* no more processing necessary. */
}
if (!need_to_draw)
return; /* don't draw if we don't need to. */
}
}
/*
* This routine does all setup required to syncronize batched screen updates
*/
void
{
}
}
/*
* This is a private utility routine used by _XawTextExecuteUpdate. It
* processes all the outstanding update requests and merges update
* ranges where possible.
*/
static
{
int i, w;
return;
}
w = 0;
w = i;
}
}
}
}
}
}
/*
* This is a private utility routine used by _XawTextExecuteUpdate. This
* routine worries about edits causing new data or the insertion point becoming
* invisible (off the screen, or under the horiz. scrollbar). Currently
* it always makes it visible by scrolling. It probably needs
* generalization to allow more options.
*/
void
{
return;
/*
* Find out the bottom the visable window, and make sure that the
* cursor does not go past the end of this space.
*
* This makes sure that the cursor does not go past the end of the
* visable window.
*/
return;
/* count the number of lines we have to scroll */
number = 0;
break;
number--;
}
of lines. */
/* Back up to just before the last CR. */
/* Check to make sure the cursor is visable. */
number++;
}
else
}
else { /* We need to Scroll up */
else
}
if (no_scroll) {
}
else
}
/*
* This routine causes all batched screen updates to be performed
*/
void
{
return;
}
static void
TextDestroy(w)
Widget w;
{
}
/*
* by the time we are managed (and get this far) we had better
* have both a source and a sink
*/
static void
Resize(w)
Widget w;
{
}
/*
* This routine allow the application program to Set attributes.
*/
/*ARGSUSED*/
static Boolean
{
}
}
}
}
{
}
}
if (redisplay)
return redisplay;
}
/* invoked by the Simple widget's SetValues */
Widget w; /* the new widget */
{
return False;
}
/* Function Name: GetValuesHook
* Description: This is a get values hook routine that gets the
* values in the text source and sink.
* Arguments: w - the Text Widget.
* args - the argument list.
* num_args - the number of args.
* Returns: none.
*/
static void
Widget w;
{
}
/* Function Name: FindGoodPosition
* Description: Returns a valid position given any postition
* Arguments: pos - any position.
* Returns: a position between (0 and lastPos);
*/
static XawTextPosition
{
if (pos < 0) return(0);
}
/************************************************************
*
* Routines for handling the copy area expose queue.
*
************************************************************/
/* Function Name: PushCopyQueue
* Description: Pushes a value onto the copy queue.
* Arguments: ctx - the text widget.
* h, v - amount of offset in the horiz and vert directions.
* Returns: none
*/
static void
int h, v;
{
offsets->h = h;
offsets->v = v;
else {
}
}
/* Function Name: PopCopyQueue
* Description: Pops the top value off of the copy queue.
* Arguments: ctx - the text widget.
* Returns: none.
*/
static void
{
(void) printf( "Xaw Text widget %s: empty copy queue\n",
else {
}
}
/* Function Name: TranslateExposeRegion
* Description: Translates the expose that came into
* the cordinates that now exist in the Text widget.
* Arguments: ctx - the text widget.
* expose - a Rectangle, who's region currently
* contains the expose event location.
* this region will be returned containing
* the new rectangle.
* Returns: True if there is drawing that needs to be done.
*/
static Boolean
XRectangle * expose;
{
int value;
/*
* Skip over the first one, this has already been taken into account.
*/
return(TRUE);
x = expose->x;
y = expose->y;
while (offsets) {
x += offsets->h;
y += offsets->v;
}
/*
* remove that area of the region that is now outside the window.
*/
if (y < 0) {
height += y;
y = 0;
}
if (value > 0)
if (height <= 0)
return(FALSE); /* no need to draw outside the window. */
/*
* and now in the horiz direction...
*/
if (x < 0) {
width += x;
x = 0;
}
if (value > 0)
if (width <= 0)
return(FALSE); /* no need to draw outside the window. */
expose->x = x;
expose->y = y;
return(TRUE);
}
/* Li wrote this so the IM can find a given text position's screen position. */
void
Widget w,
Position* x,
Position* y )
#else
_XawTextPosToXY( w, pos, x, y )
Widget w;
Position *x, *y;
#endif
{
int line;
}
/*******************************************************************
The following routines provide procedural interfaces to Text window state
setting and getting. They need to be redone so than the args code can use
them. I suggest we create a complete set that takes the context as an
argument and then have the public version lookup the context and call the
internal one. The major value of this set is that they have actual application
clients and therefore the functionality provided is required for any future
version of Text.
********************************************************************/
void
#else
XawTextDisplay (w)
Widget w;
#endif
{
if (!XtIsRealized(w)) return;
_XawTextExecuteUpdate( (TextWidget) w);
}
void
#else
Widget w;
#endif
{
}
void
#else
Widget w;
#endif
{
}
void
#else
#endif
{
XawTextDisplay(w);
}
/*
* This public routine deletes the text from startPos to endPos in a source and
* then inserts, at startPos, the text that was passed. As a side effect it
* "invalidates" that portion of the displayed text (if any), so that things
* will be repainted properly.
*/
int
#else
Widget w;
#endif
{
int result;
}
}
return result;
}
#else
Widget w;
#endif
{
}
void
#else
Widget w;
#endif
{
}
#else
Widget w;
#endif
{
}
/*
* NOTE: Must walk the selection list in opposite order from LoseSelection.
*/
void
#else
Widget w;
#endif
{
/*
* As selections are lost the atom_count will decrement.
*/
XtDisownSelection failed to call us. */
}
}
}
void
#else
Widget w;
#endif
{
}
void
#else
Widget w;
#endif
{
}
/*ARGSUSED*/
void
#else
Widget w;
#endif
{
}
void
#else
Widget w;
#endif
{
if (XtIsRealized(w))
}
#else
Widget w;
#endif
{
}
void
/* Boolean */ int display_caret)
#else
#endif
#else
Widget w;
#endif
{
if (XtIsRealized(w)) {
}
else
}
/* Function Name: XawTextSearch(w, dir, text).
* Description: searches for the given text block.
* Arguments: w - The text widget.
* dir - The direction to search.
* text - The text block containing info about the string
* to search for.
* Returns: The position of the text found, or XawTextSearchError on
* an error.
*/
/* XawTextScanDirection */ int dir,
#else
#endif
#else
Widget w;
XawTextBlock * text;
#endif
{
}
{ /* core fields */
/* class_name */ "Text",
/* widget_size */ sizeof(TextRec),
/* class_initialize */ ClassInitialize,
/* class_part_init */ NULL,
/* class_inited */ FALSE,
/* initialize */ Initialize,
/* initialize_hook */ NULL,
/* realize */ Realize,
/* actions */ _XawTextActionsTable,
/* num_actions */ 0, /* Set in ClassInitialize. */
/* resources */ resources,
/* xrm_class */ NULLQUARK,
/* compress_motion */ TRUE,
/* compress_enterleave*/ TRUE,
/* visible_interest */ FALSE,
/* destroy */ TextDestroy,
/* resize */ Resize,
/* expose */ ProcessExposeRegion,
/* set_values */ SetValues,
/* set_values_hook */ NULL,
/* set_values_almost*/ XtInheritSetValuesAlmost,
/* get_values_hook */ GetValuesHook,
/* accept_focus */ NULL,
/* version */ XtVersion,
/* callback_private */ NULL,
/* query_geometry */ XtInheritQueryGeometry,
/* display_accelerator*/ XtInheritDisplayAccelerator,
/* extension */ NULL
},
{ /* Simple fields */
/* change_sensitive */ ChangeSensitive
},
{ /* text fields */
/* empty */ 0
}
};