diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/AsciiSink.c | 58 | ||||
-rw-r--r-- | src/AsciiSrc.c | 178 | ||||
-rw-r--r-- | src/AsciiText.c | 20 | ||||
-rw-r--r-- | src/Box.c | 20 | ||||
-rw-r--r-- | src/Command.c | 86 | ||||
-rw-r--r-- | src/Dialog.c | 24 | ||||
-rw-r--r-- | src/Form.c | 70 | ||||
-rw-r--r-- | src/Grip.c | 10 | ||||
-rw-r--r-- | src/Label.c | 26 | ||||
-rw-r--r-- | src/Layout.c | 102 | ||||
-rw-r--r-- | src/List.c | 90 | ||||
-rw-r--r-- | src/MenuButton.c | 18 | ||||
-rw-r--r-- | src/MultiSink.c | 66 | ||||
-rw-r--r-- | src/MultiSrc.c | 166 | ||||
-rw-r--r-- | src/Paned.c | 226 | ||||
-rw-r--r-- | src/Panner.c | 22 | ||||
-rw-r--r-- | src/Porthole.c | 8 | ||||
-rw-r--r-- | src/Repeater.c | 10 | ||||
-rw-r--r-- | src/Scrollbar.c | 134 | ||||
-rw-r--r-- | src/Simple.c | 28 | ||||
-rw-r--r-- | src/SimpleMenu.c | 186 | ||||
-rw-r--r-- | src/Sme.c | 34 | ||||
-rw-r--r-- | src/SmeBSB.c | 102 | ||||
-rw-r--r-- | src/SmeLine.c | 46 | ||||
-rw-r--r-- | src/SmeThreeD.c | 26 | ||||
-rw-r--r-- | src/StripChart.c | 76 | ||||
-rw-r--r-- | src/Text.c | 458 | ||||
-rw-r--r-- | src/TextAction.c | 240 | ||||
-rw-r--r-- | src/TextPop.c | 190 | ||||
-rw-r--r-- | src/TextSink.c | 82 | ||||
-rw-r--r-- | src/TextSrc.c | 66 | ||||
-rw-r--r-- | src/TextTr.c | 2 | ||||
-rw-r--r-- | src/ThreeD.c | 48 | ||||
-rw-r--r-- | src/Tip.c | 2 | ||||
-rw-r--r-- | src/Toggle.c | 60 | ||||
-rw-r--r-- | src/Tree.c | 98 | ||||
-rw-r--r-- | src/Vendor.c | 28 | ||||
-rw-r--r-- | src/Viewport.c | 62 | ||||
-rw-r--r-- | src/Xaw3dP.c | 2 | ||||
-rw-r--r-- | src/XawI18n.c | 2 | ||||
-rw-r--r-- | src/XawIm.c | 62 | ||||
-rw-r--r-- | src/XawInit.c | 6 | ||||
-rw-r--r-- | src/laygram.y | 24 | ||||
-rw-r--r-- | src/laylex.l | 6 |
44 files changed, 1635 insertions, 1635 deletions
diff --git a/src/AsciiSink.c b/src/AsciiSink.c index 3041c34..2f122b2 100644 --- a/src/AsciiSink.c +++ b/src/AsciiSink.c @@ -28,13 +28,13 @@ 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, +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 +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. +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 @@ -85,7 +85,7 @@ static XtResource resources[] = { #define SuperClass (&textSinkClassRec) AsciiSinkClassRec asciiSinkClassRec = { { -/* core_class fields */ +/* core_class fields */ /* superclass */ (WidgetClass) SuperClass, /* class_name */ "AsciiSink", /* widget_size */ sizeof(AsciiSinkRec), @@ -142,7 +142,7 @@ WidgetClass asciiSinkObjectClass = (WidgetClass)&asciiSinkClassRec; /* Utilities */ -static int +static int CharWidth (w, x, c) Widget w; int x; @@ -160,7 +160,7 @@ unsigned char c; x -= ((TextWidget) XtParent(w))->text.margin.left; if (x >= (int)XtParent(w)->core.width) return 0; - for (i = 0, tab = sink->text_sink.tabs ; + for (i = 0, tab = sink->text_sink.tabs ; i < sink->text_sink.tab_count ; i++, tab++) { if (x < *tab) { if (*tab < (int)XtParent(w)->core.width) @@ -216,20 +216,20 @@ int len; TextWidget ctx = (TextWidget) XtParent(w); Position max_x; - Dimension width = XTextWidth(sink->ascii_sink.font, (char *) buf, len); + Dimension width = XTextWidth(sink->ascii_sink.font, (char *) buf, len); max_x = (Position) ctx->core.width; if ( ((int) width) <= -x) /* Don't draw if we can't see it. */ return(width); - XDrawImageString(XtDisplay(ctx), XtWindow(ctx), gc, + XDrawImageString(XtDisplay(ctx), XtWindow(ctx), gc, (int) x, (int) y, (char *) buf, len); if ( (((Position) width + x) > max_x) && (ctx->text.margin.right != 0) ) { x = ctx->core.width - ctx->text.margin.right; width = ctx->text.margin.right; XFillRectangle(XtDisplay((Widget) ctx), XtWindow( (Widget) ctx), sink->ascii_sink.normgc, (int) x, - (int) y - sink->ascii_sink.font->ascent, + (int) y - sink->ascii_sink.font->ascent, (unsigned int) width, (unsigned int) (sink->ascii_sink.font->ascent + sink->ascii_sink.font->descent)); @@ -243,8 +243,8 @@ int len; /* * This function does not know about drawing more than one line of text. */ - -static void + +static void DisplayText(w, x, y, pos1, pos2, highlight) Widget w; Position x, y; @@ -358,7 +358,7 @@ XawTextInsertState state; sink->ascii_sink.cursor_y = y; GetCursorBounds(w, &rect); - if (state != sink->ascii_sink.laststate && XtIsRealized(text_widget)) + if (state != sink->ascii_sink.laststate && XtIsRealized(text_widget)) XCopyPlane(XtDisplay(text_widget), sink->ascii_sink.insertCursorOn, XtWindow(text_widget), sink->ascii_sink.xorgc, @@ -408,7 +408,7 @@ int *resHeight; /* Height required. */ static void -FindPosition(w, fromPos, fromx, width, stopAtWordBreak, +FindPosition(w, fromPos, fromx, width, stopAtWordBreak, resPos, resWidth, resHeight) Widget w; XawTextPosition fromPos; /* Starting position. */ @@ -485,27 +485,27 @@ static void GetGC(sink) AsciiSinkObject sink; { - XtGCMask valuemask = (GCFont | + XtGCMask valuemask = (GCFont | GCGraphicsExposures | GCForeground | GCBackground ); XGCValues values; values.font = sink->ascii_sink.font->fid; values.graphics_exposures = (Bool) FALSE; - + values.foreground = sink->text_sink.foreground; values.background = sink->text_sink.background; sink->ascii_sink.normgc = XtGetGC((Widget)sink, valuemask, &values); - + values.foreground = sink->text_sink.background; values.background = sink->text_sink.foreground; sink->ascii_sink.invgc = XtGetGC((Widget)sink, valuemask, &values); - + values.function = GXxor; values.background = (unsigned long) 0L; /* (pix ^ 0) = pix */ - values.foreground = (sink->text_sink.background ^ + values.foreground = (sink->text_sink.background ^ sink->text_sink.foreground); valuemask = GCGraphicsExposures | GCFunction | GCForeground | GCBackground; - + sink->ascii_sink.xorgc = XtGetGC((Widget)sink, valuemask, &values); } @@ -530,14 +530,14 @@ Cardinal *num_args; AsciiSinkObject sink = (AsciiSinkObject) new; GetGC(sink); - + sink->ascii_sink.insertCursorOn= CreateInsertCursor(XtScreenOfObject(new)); sink->ascii_sink.laststate = XawisOff; sink->ascii_sink.cursor_x = sink->ascii_sink.cursor_y = 0; } /* Function Name: Destroy - * Description: This function cleans up when the object is + * Description: This function cleans up when the object is * destroyed. * Arguments: w - the AsciiSink Object. * Returns: none. @@ -583,11 +583,11 @@ Cardinal *num_args; ((TextWidget)XtParent(new))->text.redisplay_needed = True; } else { if ( (w->ascii_sink.echo != old_w->ascii_sink.echo) || - (w->ascii_sink.display_nonprinting != + (w->ascii_sink.display_nonprinting != old_w->ascii_sink.display_nonprinting) ) ((TextWidget)XtParent(new))->text.redisplay_needed = True; } - + return False; } @@ -613,7 +613,7 @@ Dimension height; } /* Function Name: MaxHeight - * Description: Finds the Minium height that will contain a given number + * Description: Finds the Minium height that will contain a given number * lines. * Arguments: w - the AsciiSink Object. * lines - the number of lines. @@ -628,7 +628,7 @@ int lines; { AsciiSinkObject sink = (AsciiSinkObject) w; - return(lines * (sink->ascii_sink.font->ascent + + return(lines * (sink->ascii_sink.font->ascent + sink->ascii_sink.font->descent)); } @@ -657,9 +657,9 @@ short *tabs; */ XA_FIGURE_WIDTH = XInternAtom(XtDisplayOfObject(w), "FIGURE_WIDTH", FALSE); - if ( (XA_FIGURE_WIDTH != None) && + if ( (XA_FIGURE_WIDTH != None) && ( (!XGetFontProperty(font, XA_FIGURE_WIDTH, &figure_width)) || - (figure_width == 0)) ) + (figure_width == 0)) ) if (font->per_char && font->min_char_or_byte2 <= '$' && font->max_char_or_byte2 >= '$') figure_width = font->per_char['$' - font->min_char_or_byte2].width; @@ -679,7 +679,7 @@ short *tabs; sink->text_sink.tabs[i] = tabs[i] * figure_width; sink->text_sink.char_tabs[i] = tabs[i]; } - + sink->text_sink.tab_count = tab_count; #ifndef NO_TAB_FIX diff --git a/src/AsciiSrc.c b/src/AsciiSrc.c index 9a2a6e8..668cc8d 100644 --- a/src/AsciiSrc.c +++ b/src/AsciiSrc.c @@ -46,7 +46,7 @@ in this Software without prior written authorization from the X Consortium. #include <X11/Xmu/Misc.h> #include <X11/Xmu/CharSet.h> #ifdef XAW_INTERNATIONALIZATION -#include <X11/Xaw3d/MultiSrcP.h> +#include <X11/Xaw3d/MultiSrcP.h> #endif @@ -76,7 +76,7 @@ static XtResource resources[] = { offset(data_compression), XtRImmediate, (XtPointer) TRUE}, {XtNpieceSize, XtCPieceSize, XtRInt, sizeof (XawTextPosition), offset(piece_size), XtRImmediate, (XtPointer) BUFSIZ}, - {XtNcallback, XtCCallback, XtRCallback, sizeof(XtPointer), + {XtNcallback, XtCCallback, XtRCallback, sizeof(XtPointer), offset(callback), XtRCallback, (XtPointer)NULL}, {XtNuseStringInPlace, XtCUseStringInPlace, XtRBoolean, sizeof (Boolean), offset(use_string_in_place), XtRImmediate, (XtPointer) FALSE}, @@ -114,7 +114,7 @@ extern int errno; #define superclass (&textSrcClassRec) AsciiSrcClassRec asciiSrcClassRec = { { -/* core_class fields */ +/* core_class fields */ /* superclass */ (WidgetClass) superclass, /* class_name */ "AsciiSrc", /* widget_size */ sizeof(AsciiSrcRec), @@ -245,13 +245,13 @@ static XawTextPosition ReadText(w, pos, text, length) Widget w; XawTextPosition pos; -XawTextBlock *text; -int length; +XawTextBlock *text; +int length; { AsciiSrcObject src = (AsciiSrcObject) w; XawTextPosition count, start; Piece * piece = FindPiece(src, pos, &start); - + text->firstPos = pos; text->ptr = piece->text + (pos - start); count = piece->used - (pos - start); @@ -268,7 +268,7 @@ int length; */ /*ARGSUSED*/ -static int +static int ReplaceText (w, startPos, endPos, text) Widget w; XawTextPosition startPos, endPos; @@ -283,7 +283,7 @@ XawTextBlock *text; * Editing a read only source is not allowed. */ - if (src->text_src.edit_mode == XawtextRead) + if (src->text_src.edit_mode == XawtextRead) return(XawEditError); start_piece = FindPiece(src, startPos, &start_first); @@ -291,15 +291,15 @@ XawTextBlock *text; src->ascii_src.changes = TRUE; /* We have changed the buffer. */ -/* - * Remove Old Stuff. +/* + * Remove Old Stuff. */ if (start_piece != end_piece) { temp_piece = start_piece->next; /* - * If empty and not the only piece then remove it. + * If empty and not the only piece then remove it. */ if ( ((start_piece->used = startPos - start_first) == 0) && @@ -324,9 +324,9 @@ XawTextBlock *text; MyStrncpy(start_piece->text + (startPos - start_first), start_piece->text + (endPos - start_first), (int) (start_piece->used - (startPos - start_first)) ); - if ( src->ascii_src.use_string_in_place && - ((src->ascii_src.length - (endPos - startPos)) < - (src->ascii_src.piece_size - 1)) ) + if ( src->ascii_src.use_string_in_place && + ((src->ascii_src.length - (endPos - startPos)) < + (src->ascii_src.piece_size - 1)) ) start_piece->text[src->ascii_src.length - (endPos - startPos)] = '\0'; } } @@ -335,26 +335,26 @@ XawTextBlock *text; if ( text->length != 0) { - /* + /* * Put in the New Stuff. */ - + start_piece = FindPiece(src, startPos, &start_first); - + length = text->length; firstPos = text->firstPos; - + while (length > 0) { char * ptr; int fill; - + if (src->ascii_src.use_string_in_place) { if (start_piece->used == (src->ascii_src.piece_size - 1)) { /* * If we are in ascii string emulation mode. Then the * string is not allowed to grow. */ - start_piece->used = src->ascii_src.length = + start_piece->used = src->ascii_src.length = src->ascii_src.piece_size - 1; start_piece->text[src->ascii_src.length] = '\0'; return(XawEditError); @@ -368,12 +368,12 @@ XawTextBlock *text; } fill = Min((int)(src->ascii_src.piece_size - start_piece->used), length); - + ptr = start_piece->text + (startPos - start_first); - MyStrncpy(ptr + fill, ptr, + MyStrncpy(ptr + fill, ptr, (int) start_piece->used - (startPos - start_first)); strncpy(ptr, text->ptr + firstPos, fill); - + startPos += fill; firstPos += fill; start_piece->used += fill; @@ -384,7 +384,7 @@ XawTextBlock *text; if (src->ascii_src.use_string_in_place) start_piece->text[start_piece->used] = '\0'; - XtCallCallbacks(w, XtNcallback, NULL); /* Call callbacks, we have changed + XtCallCallbacks(w, XtNcallback, NULL); /* Call callbacks, we have changed the buffer. */ return(XawEditDone); @@ -399,16 +399,16 @@ XawTextBlock *text; * dir - direction to scan. * count - which occurance if this thing to search for. * include - whether or not to include the character found in - * the position that is returned. + * the position that is returned. * Returns: the position of the item found. * - * Note: While there are only 'n' characters in the file there are n+1 + * Note: While there are only 'n' characters in the file there are n+1 * possible cursor positions (one before the first character and * one after the last character. */ -static -XawTextPosition +static +XawTextPosition Scan (w, position, type, dir, count, include) Widget w; XawTextPosition position; @@ -450,17 +450,17 @@ Boolean include; piece = FindPiece(src, position, &first); /* - * If the buffer is empty then return 0. + * If the buffer is empty then return 0. */ - if ( piece->used == 0 ) return(0); + if ( piece->used == 0 ) return(0); ptr = (position - first) + piece->text; switch (type) { - case XawstEOL: - case XawstParagraph: - case XawstWhiteSpace: + case XawstEOL: + case XawstParagraph: + case XawstWhiteSpace: for ( ; count > 0 ; count-- ) { Boolean non_space = FALSE, first_eol = TRUE; /* CONSTCOND */ @@ -469,10 +469,10 @@ Boolean include; ptr += inc; position += inc; - + if (type == XawstWhiteSpace) { if (isspace(c)) { - if (non_space) + if (non_space) break; } else @@ -489,12 +489,12 @@ Boolean include; } } else - if ( c == '\n') + if ( c == '\n') break; else if ( !isspace(c) ) first_eol = TRUE; } - + if ( ptr < piece->text ) { piece = piece->prev; @@ -516,11 +516,11 @@ Boolean include; position -= inc; } break; - case XawstPositions: + case XawstPositions: position += count * inc; break; case XawstAll: /* handled in special code above */ - default: + default: break; } @@ -544,7 +544,7 @@ Boolean include; * Returns: the position of the item found. */ -static XawTextPosition +static XawTextPosition Search(w, position, dir, text) Widget w; XawTextPosition position; @@ -574,7 +574,7 @@ XawTextBlock * text; /* CONSTCOND */ while (TRUE) { - if (*ptr == ((dir == XawsdRight) ? *(buf + count) + if (*ptr == ((dir == XawsdRight) ? *(buf + count) : *(buf + text->length - count - 1)) ) { if (count == (text->length - 1)) break; @@ -591,7 +591,7 @@ XawTextBlock * text; ptr += inc; position += inc; - + while ( ptr < piece->text ) { piece = piece->prev; if (piece == NULL) { /* Begining of text. */ @@ -600,7 +600,7 @@ XawTextBlock * text; } ptr = piece->text + piece->used - 1; } - + while ( ptr >= (piece->text + piece->used) ) { piece = piece->next; if (piece == NULL) { /* End of text. */ @@ -638,20 +638,20 @@ Cardinal * num_args; FILE * file; int i; - if ( old_src->ascii_src.use_string_in_place != + if ( old_src->ascii_src.use_string_in_place != src->ascii_src.use_string_in_place ) { XtAppWarning( XtWidgetToApplicationContext(new), "AsciiSrc: The XtNuseStringInPlace resource may not be changed."); - src->ascii_src.use_string_in_place = + src->ascii_src.use_string_in_place = old_src->ascii_src.use_string_in_place; } - for (i = 0; i < *num_args ; i++ ) + for (i = 0; i < *num_args ; i++ ) if (streq(args[i].name, XtNstring)) { string_set = TRUE; break; } - + if ( string_set || (old_src->ascii_src.type != src->ascii_src.type) ) { RemoveOldStringOrFile(old_src, string_set); /* remove old info. */ file = InitStringOrFile(src, string_set); /* Init new info. */ @@ -662,10 +662,10 @@ Cardinal * num_args; total_reset = TRUE; } - if ( old_src->ascii_src.ascii_length != src->ascii_src.ascii_length ) + if ( old_src->ascii_src.ascii_length != src->ascii_src.ascii_length ) src->ascii_src.piece_size = src->ascii_src.ascii_length; - if ( !total_reset && + if ( !total_reset && (old_src->ascii_src.piece_size != src->ascii_src.piece_size) ) { String string = StorePiecesInString(old_src); FreeAllPieces(old_src); @@ -695,7 +695,7 @@ Cardinal * num_args; int i; if (src->ascii_src.type == XawAsciiString) { - for (i = 0; i < *num_args ; i++ ) + for (i = 0; i < *num_args ; i++ ) if (streq(args[i].name, XtNstring)) { if (src->ascii_src.use_string_in_place) { *((char **) args[i].value) = src->ascii_src.first_piece->text; @@ -707,7 +707,7 @@ Cardinal * num_args; break; } } -} +} /* Function Name: Destroy * Description: Destroys an ascii source (frees all data) @@ -715,7 +715,7 @@ Cardinal * num_args; * Returns: none. */ -static void +static void Destroy (w) Widget w; { @@ -724,7 +724,7 @@ Widget w; /************************************************************ * - * Public routines + * Public routines * ************************************************************/ @@ -809,7 +809,7 @@ Widget w; * to get the internal info into a readable string. */ - if (src->ascii_src.use_string_in_place) + if (src->ascii_src.use_string_in_place) return(TRUE); if (src->ascii_src.type == XawAsciiFile) { @@ -827,11 +827,11 @@ Widget w; XtFree(string); } else { - if (src->ascii_src.allocated_string == TRUE) + if (src->ascii_src.allocated_string == TRUE) XtFree(src->ascii_src.string); else src->ascii_src.allocated_string = TRUE; - + src->ascii_src.string = StorePiecesInString(src); } src->ascii_src.changes = FALSE; @@ -875,7 +875,7 @@ String name; NULL, NULL); } - string = StorePiecesInString(src); + string = StorePiecesInString(src); ret = WriteToFile(string, name); XtFree(string); @@ -888,7 +888,7 @@ String name; * Returns: a Boolean (see description). */ -Boolean +Boolean #if NeedFunctionPrototypes XawAsciiSourceChanged(Widget w) #else @@ -914,7 +914,7 @@ Widget w; return( True ); /* for gcc -Wall */ } - + /************************************************************ * * Private Functions. @@ -922,7 +922,7 @@ Widget w; ************************************************************/ static void -RemoveOldStringOrFile(src, checkString) +RemoveOldStringOrFile(src, checkString) AsciiSrcObject src; Boolean checkString; { @@ -948,12 +948,12 @@ WriteToFile(string, name) String string, name; { int fd; - + if ( ((fd = creat(name, 0666)) == -1 ) || (write(fd, string, sizeof(unsigned char) * strlen(string)) == -1) ) return(FALSE); - if ( close(fd) == -1 ) + if ( close(fd) == -1 ) return(FALSE); return(TRUE); @@ -973,20 +973,20 @@ AsciiSrcObject src; XawTextPosition first; Piece * piece; - string = XtMalloc((unsigned) sizeof(unsigned char) * + string = XtMalloc((unsigned) sizeof(unsigned char) * src->ascii_src.length + 1); - - for (first = 0, piece = src->ascii_src.first_piece ; piece != NULL; - first += piece->used, piece = piece->next) + + for (first = 0, piece = src->ascii_src.first_piece ; piece != NULL; + first += piece->used, piece = piece->next) strncpy(string + first, piece->text, piece->used); string[src->ascii_src.length] = '\0'; /* NULL terminate this sucker. */ /* - * This will refill all pieces to capacity. + * This will refill all pieces to capacity. */ - if (src->ascii_src.data_compression) { + if (src->ascii_src.data_compression) { FreeAllPieces(src); LoadPieces(src, NULL, string); } @@ -1026,19 +1026,19 @@ Boolean newString; if (src->ascii_src.length > src->ascii_src.ascii_length) src->ascii_src.ascii_length = src->ascii_src.length; - if (src->ascii_src.ascii_length == MAGIC_VALUE) + if (src->ascii_src.ascii_length == MAGIC_VALUE) src->ascii_src.piece_size = src->ascii_src.length; else src->ascii_src.piece_size = src->ascii_src.ascii_length + 1; } - + return(NULL); } /* * type is XawAsciiFile. */ - + src->ascii_src.is_tempfile = FALSE; switch (src->text_src.edit_mode) { @@ -1074,7 +1074,7 @@ Boolean newString; src->ascii_src.string = XtNewString(src->ascii_src.string); src->ascii_src.allocated_string = TRUE; } - + if (!src->ascii_src.is_tempfile) { if ((file = fopen(src->ascii_src.string, open_mode)) != 0) { (void) fseek(file, (Off_t)0, 2); @@ -1083,14 +1083,14 @@ Boolean newString; } else { String params[2]; Cardinal num_params = 2; - + params[0] = src->ascii_src.string; params[1] = strerror(errno); XtAppWarningMsg(XtWidgetToApplicationContext((Widget)src), "openError", "asciiSourceCreate", "XawWarning", "Cannot open file %s; %s", params, &num_params); } - } + } src->ascii_src.length = 0; return((FILE *)NULL); } @@ -1107,7 +1107,7 @@ char * string; if (string == NULL) { if (src->ascii_src.type == XawAsciiFile) { - local_str = XtMalloc((unsigned) (src->ascii_src.length + 1) + local_str = XtMalloc((unsigned) (src->ascii_src.length + 1) * sizeof(unsigned char)); if (src->ascii_src.length != 0) { fseek(file, (Off_t)0, 0); @@ -1176,7 +1176,7 @@ Piece * prev; piece->next = prev->next; prev->next = piece; } - + piece->prev = prev; return(piece); @@ -1188,7 +1188,7 @@ Piece * prev; * Returns: none. */ -static void +static void FreeAllPieces(src) AsciiSrcObject src; { @@ -1202,10 +1202,10 @@ AsciiSrcObject src; RemovePiece(src, first); } } - + /* Function Name: RemovePiece * Description: Removes a piece from the list. - * Arguments: + * Arguments: * piece - the piece to remove. * Returns: none. */ @@ -1249,12 +1249,12 @@ XawTextPosition position, *first; *first = temp; old_piece = piece; - if ((temp + piece->used) > position) + if ((temp + piece->used) > position) return(piece); } return(old_piece); /* if we run off the end the return the last piece */ } - + /* Function Name: MyStrncpy * Description: Just like string copy, but slower and will always * work on overlapping strings. @@ -1282,7 +1282,7 @@ int n; if (temp != buf) XtFree(temp); return s1; } - + /* Function Name: BreakPiece * Description: Breaks a full piece into two new pieces. * Arguments: src - The AsciiSrc Widget. @@ -1298,12 +1298,12 @@ AsciiSrcObject src; Piece * piece; { Piece * new = AllocNewPiece(src, piece); - + new->text = XtMalloc(src->ascii_src.piece_size * sizeof(unsigned char)); strncpy(new->text, piece->text + HALF_PIECE, src->ascii_src.piece_size - HALF_PIECE); piece->used = HALF_PIECE; - new->used = src->ascii_src.piece_size - HALF_PIECE; + new->used = src->ascii_src.piece_size - HALF_PIECE; } /* ARGSUSED */ @@ -1354,7 +1354,7 @@ XrmValuePtr toVal; * Compatability functions. * ************************************************************/ - + /* Function Name: AsciiStringSourceCreate * Description: Creates a string source. * Arguments: parent - the widget that will own this source. @@ -1389,7 +1389,7 @@ Cardinal num_args; * Chris D. Peterson 8/31/89. */ -void +void XawTextSetLastPos (w, lastPos) Widget w; XawTextPosition lastPos; @@ -1423,9 +1423,9 @@ Cardinal num_args; ascii_args = XtMergeArgLists(temp, ONE, args, num_args); num_args++; - for (i = 0; i < num_args; i++) - if (streq(ascii_args[i].name, XtNfile) || - streq(ascii_args[i].name, XtCFile)) + for (i = 0; i < num_args; i++) + if (streq(ascii_args[i].name, XtNfile) || + streq(ascii_args[i].name, XtCFile)) ascii_args[i].name = XtNstring; src = XtCreateWidget("genericAsciiDisk", asciiSrcObjectClass, parent, diff --git a/src/AsciiText.c b/src/AsciiText.c index 6a6be86..224ef8f 100644 --- a/src/AsciiText.c +++ b/src/AsciiText.c @@ -28,13 +28,13 @@ 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, +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 +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. +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 @@ -55,13 +55,13 @@ SOFTWARE. /* * AsciiText.c - Source code for AsciiText Widget. * - * This Widget is intended to be used as a simple front end to the + * This Widget is intended to be used as a simple front end to the * text widget with an ascii source and ascii sink attached to it. * * Date: June 29, 1989 * * By: Chris D. Peterson - * MIT X Consortium + * MIT X Consortium * kit@expo.lcs.mit.edu */ @@ -164,7 +164,7 @@ Cardinal *num_args; } else #endif - { + { w->text.source = XtCreateWidget( "textSource", asciiSrcObjectClass, new, args, *num_args ); @@ -175,9 +175,9 @@ Cardinal *num_args; if (w->core.height == DEFAULT_TEXT_HEIGHT) w->core.height = VMargins(w) + XawTextSinkMaxHeight(w->text.sink, 1); - for (i=0, tab=0 ; i < TAB_COUNT ; i++) + for (i=0, tab=0 ; i < TAB_COUNT ; i++) tabs[i] = (tab += 8); - + XawTextSinkSetTabs(w->text.sink, TAB_COUNT, tabs); XawTextDisableRedisplay(new); @@ -202,7 +202,7 @@ Cardinal *num_args; #endif } -static void +static void Destroy(w) Widget w; { @@ -28,13 +28,13 @@ 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, +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 +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. +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 @@ -47,9 +47,9 @@ SOFTWARE. ******************************************************************/ -/* +/* * Box.c - Box composite widget - * + * */ #include <X11/IntrinsicP.h> @@ -169,7 +169,7 @@ static void DoLayout(bbw, width, height, reply_width, reply_height, position) Dimension h_space; /* Local copy of bbw->box.h_space */ Widget widget; /* Current widget */ int num_mapped_children = 0; - + /* Box width and height */ h_space = bbw->box.h_space; @@ -181,11 +181,11 @@ static void DoLayout(bbw, width, height, reply_width, reply_height, position) w += h_space; if ( w > width ) width = w; h = bbw->box.v_space; - + /* Line width and height */ lh = 0; lw = h_space; - + for (i = 0; i < bbw->composite.num_children; i++) { widget = bbw->composite.children[i]; if (widget->core.managed) { @@ -317,7 +317,7 @@ static XtGeometryResult PreferredSize(widget, constraint, preferred) else return XtGeometryAlmost; } - + /* else gotta do it the long way... I have a preference for tall and narrow, so if my width is constrained, I'll accept it; otherwise, I'll compute the minimum diff --git a/src/Command.c b/src/Command.c index d62a909..c8afff7 100644 --- a/src/Command.c +++ b/src/Command.c @@ -28,13 +28,13 @@ 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, +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 +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. +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 @@ -78,8 +78,8 @@ static char defaultTranslations[] = <Btn1Up>: notify() unset() "; #define offset(field) XtOffsetOf(CommandRec, field) -static XtResource resources[] = { - {XtNcallback, XtCCallback, XtRCallback, sizeof(XtPointer), +static XtResource resources[] = { + {XtNcallback, XtCCallback, XtRCallback, sizeof(XtPointer), offset(command.callbacks), XtRCallback, (XtPointer)NULL}, {XtNhighlightThickness, XtCThickness, XtRDimension, sizeof(Dimension), offset(command.highlight_thickness), XtRImmediate, @@ -115,7 +115,7 @@ static XtActionsRec actionsList[] = { CommandClassRec commandClassRec = { { - (WidgetClass) SuperClass, /* superclass */ + (WidgetClass) SuperClass, /* superclass */ "Command", /* class_name */ sizeof(CommandRec), /* size */ ClassInitialize, /* class_initialize */ @@ -171,26 +171,26 @@ WidgetClass commandWidgetClass = (WidgetClass) &commandClassRec; * ****************************************************************/ -static GC +static GC Get_GC(cbw, fg, bg) CommandWidget cbw; Pixel fg, bg; { XGCValues values; - + values.foreground = fg; values.background = bg; values.font = cbw->label.font->fid; values.cap_style = CapProjecting; - + if (cbw->command.highlight_thickness > 1 ) values.line_width = cbw->command.highlight_thickness; - else + else values.line_width = 0; - + #ifdef XAW_INTERNATIONALIZATION if ( cbw->simple.international == True ) - return XtAllocateGC((Widget)cbw, 0, + return XtAllocateGC((Widget)cbw, 0, (GCForeground|GCBackground|GCLineWidth|GCCapStyle), &values, GCFont, 0 ); else @@ -202,7 +202,7 @@ Pixel fg, bg; /* ARGSUSED */ -static void +static void Initialize(request, new, args, num_args) Widget request, new; ArgList args; /* unused */ @@ -212,7 +212,7 @@ Cardinal *num_args; /* unused */ int shape_event_base, shape_error_base; if (cbw->command.shape_style != XawShapeRectangle - && !XShapeQueryExtension(XtDisplay(new), &shape_event_base, + && !XShapeQueryExtension(XtDisplay(new), &shape_event_base, &shape_error_base)) cbw->command.shape_style = XawShapeRectangle; if (cbw->command.highlight_thickness == DEFAULT_SHAPE_HIGHLIGHT) { @@ -228,9 +228,9 @@ Cardinal *num_args; /* unused */ } cbw->command.shadow_width = cbw->threeD.shadow_width; - cbw->command.normal_GC = Get_GC(cbw, cbw->label.foreground, + cbw->command.normal_GC = Get_GC(cbw, cbw->label.foreground, cbw->core.background_pixel); - cbw->command.inverse_GC = Get_GC(cbw, cbw->core.background_pixel, + cbw->command.inverse_GC = Get_GC(cbw, cbw->core.background_pixel, cbw->label.foreground); XtReleaseGC(new, cbw->label.normal_GC); cbw->label.normal_GC = cbw->command.normal_GC; @@ -239,7 +239,7 @@ Cardinal *num_args; /* unused */ cbw->command.highlighted = HighlightNone; } -static Region +static Region HighlightRegion(cbw) CommandWidget cbw; { @@ -278,7 +278,7 @@ CommandWidget cbw; ***************************/ /* ARGSUSED */ -static void +static void Set(w,event,params,num_params) Widget w; XEvent *event; @@ -316,7 +316,7 @@ Cardinal *num_params; } /* ARGSUSED */ -static void +static void Reset(w,event,params,num_params) Widget w; XEvent *event; @@ -333,19 +333,19 @@ Cardinal *num_params; /* unused */ } /* ARGSUSED */ -static void +static void Highlight(w,event,params,num_params) Widget w; XEvent *event; -String *params; -Cardinal *num_params; +String *params; +Cardinal *num_params; { CommandWidget cbw = (CommandWidget)w; - if ( *num_params == (Cardinal) 0) + if ( *num_params == (Cardinal) 0) cbw->command.highlighted = HighlightWhenUnset; else { - if ( *num_params != (Cardinal) 1) + if ( *num_params != (Cardinal) 1) XtWarning("Too many parameters passed to highlight action table."); switch (params[0][0]) { case 'A': @@ -363,7 +363,7 @@ Cardinal *num_params; } /* ARGSUSED */ -static void +static void Unhighlight(w,event,params,num_params) Widget w; XEvent *event; @@ -378,14 +378,14 @@ Cardinal *num_params; /* unused */ } /* ARGSUSED */ -static void +static void Notify(w,event,params,num_params) Widget w; XEvent *event; String *params; /* unused */ Cardinal *num_params; /* unused */ { - CommandWidget cbw = (CommandWidget)w; + CommandWidget cbw = (CommandWidget)w; /* check to be sure state is still Set so that user can cancel the action (e.g. by moving outside the window, in the default @@ -406,7 +406,7 @@ Cardinal *num_params; /* unused */ ************************/ /* ARGSUSED */ -static void +static void Redisplay(w, event, region) Widget w; XEvent *event; @@ -423,7 +423,7 @@ Region region; * Returns: none */ -static void +static void PaintCommandWidget(w, event, region, change) Widget w; XEvent *event; @@ -435,7 +435,7 @@ Boolean change; Boolean very_thick; GC norm_gc, rev_gc; Dimension s = cbw->threeD.shadow_width; - + very_thick = cbw->command.highlight_thickness > (Dimension)((Dimension) Min(cbw->core.width, cbw->core.height)/2); @@ -456,7 +456,7 @@ Boolean change; } /* - * If we are set then use the same colors as if we are not highlighted. + * If we are set then use the same colors as if we are not highlighted. */ if (cbw->command.set == (cbw->command.highlighted == HighlightNone)) { @@ -479,7 +479,7 @@ Boolean change; else { /* wide lines are centered on the path, so indent it */ int offset = cbw->command.highlight_thickness/2; - XDrawRectangle(XtDisplay(w),XtWindow(w), rev_gc, s + offset, s + offset, + XDrawRectangle(XtDisplay(w),XtWindow(w), rev_gc, s + offset, s + offset, cbw->core.width - cbw->command.highlight_thickness - 2 * s, cbw->core.height - cbw->command.highlight_thickness - 2 * s); } @@ -488,7 +488,7 @@ Boolean change; (*cwclass->threeD_class.shadowdraw) (w, event, region, cbw->threeD.relief, !cbw->command.set); } -static void +static void Destroy(w) Widget w; { @@ -506,7 +506,7 @@ Widget w; */ /* ARGSUSED */ -static Boolean +static Boolean SetValues (current, request, new, args, num_args) Widget current, request, new; ArgList args; @@ -522,12 +522,12 @@ Cardinal *num_args; cbw->command.highlighted = HighlightNone; redisplay = TRUE; } - + if ( (oldcbw->label.foreground != cbw->label.foreground) || (oldcbw->core.background_pixel != cbw->core.background_pixel) || - (oldcbw->command.highlight_thickness != + (oldcbw->command.highlight_thickness != cbw->command.highlight_thickness) || - (oldcbw->label.font != cbw->label.font) ) + (oldcbw->label.font != cbw->label.font) ) { if (oldcbw->label.normal_GC == oldcbw->command.normal_GC) /* Label has release one of these */ @@ -535,15 +535,15 @@ Cardinal *num_args; else XtReleaseGC(new, cbw->command.normal_GC); - cbw->command.normal_GC = Get_GC(cbw, cbw->label.foreground, + cbw->command.normal_GC = Get_GC(cbw, cbw->label.foreground, cbw->core.background_pixel); - cbw->command.inverse_GC = Get_GC(cbw, cbw->core.background_pixel, + cbw->command.inverse_GC = Get_GC(cbw, cbw->core.background_pixel, cbw->label.foreground); XtReleaseGC(new, cbw->label.normal_GC); cbw->label.normal_GC = (cbw->command.set ? cbw->command.inverse_GC : cbw->command.normal_GC); - + redisplay = True; } @@ -591,7 +591,7 @@ Boolean checkRectangular; Dimension corner_size = 0; if (cbw->command.shape_style == XawShapeRoundedRectangle) { - corner_size = (cbw->core.width < cbw->core.height) ? cbw->core.width + corner_size = (cbw->core.width < cbw->core.height) ? cbw->core.width : cbw->core.height; corner_size = (int) (corner_size * cbw->command.corner_round) / 100; } @@ -620,7 +620,7 @@ static void Realize(w, valueMask, attributes) static void Resize(w) Widget w; { - if (XtIsRealized(w)) + if (XtIsRealized(w)) ShapeButton( (CommandWidget) w, FALSE); (*commandWidgetClass->core_class.superclass->core_class.resize)(w); diff --git a/src/Dialog.c b/src/Dialog.c index 5de9612..2de2d09 100644 --- a/src/Dialog.c +++ b/src/Dialog.c @@ -28,13 +28,13 @@ 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, +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 +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. +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 @@ -58,7 +58,7 @@ SOFTWARE. #include <X11/Xaw3d/XawInit.h> #include <X11/Xaw3d/AsciiText.h> -#include <X11/Xaw3d/Command.h> +#include <X11/Xaw3d/Command.h> #include <X11/Xaw3d/Label.h> #include <X11/Xaw3d/DialogP.h> #include <X11/Xaw3d/Cardinals.h> @@ -182,7 +182,7 @@ Cardinal *num_args; XtSetArg( arglist[0], XtNheight, dw->dialog.iconW->core.height ); XtSetValues( dw->dialog.labelW, arglist, ONE ); } - if (dw->dialog.value != NULL) + if (dw->dialog.value != NULL) CreateDialogValueWidget( (Widget) dw); else dw->dialog.valueW = NULL; @@ -201,7 +201,7 @@ Cardinal *num_args; return; /* then just use defaults */ constraint->form.left = constraint->form.right = XtChainLeft; - if (dw->dialog.valueW == NULL) + if (dw->dialog.valueW == NULL) constraint->form.vert_base = dw->dialog.labelW; else constraint->form.vert_base = dw->dialog.valueW; @@ -297,7 +297,7 @@ Cardinal *in_num_args; * any subclasses will currently have to deal with the fact that * we're about to change our real size. */ - w->form.resize_in_layout = False; + w->form.resize_in_layout = False; CreateDialogValueWidget( (Widget) w); w->core.width = w->form.preferred_width; w->core.height = w->form.preferred_height; @@ -335,7 +335,7 @@ Cardinal * num_args; String s; DialogWidget src = (DialogWidget) w; int i; - + for (i=0; i < *num_args; i++) if (streq(args[i].name, XtNvalue)) { XtSetArg(a[0], XtNstring, &s); @@ -357,7 +357,7 @@ static void CreateDialogValueWidget(w) Widget w; { - DialogWidget dw = (DialogWidget) w; + DialogWidget dw = (DialogWidget) w; Arg arglist[10]; Cardinal num_args = 0; @@ -395,7 +395,7 @@ Widget w; } XtManageChild(dw->dialog.valueW); -/* +/* * Value widget gets the keyboard focus. */ @@ -421,7 +421,7 @@ XtPointer param; */ Widget button; - button = XtCreateManagedWidget( name, commandWidgetClass, dialog, + button = XtCreateManagedWidget( name, commandWidgetClass, dialog, (ArgList)NULL, (Cardinal)0 ); if (function != NULL) /* don't add NULL callback func. */ @@ -28,13 +28,13 @@ 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, +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 +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. +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 @@ -211,7 +211,7 @@ static void ClassInitialize() XtQChainBottom = XrmPermStringToQuark("chainbottom"); XtQRubber = XrmPermStringToQuark("rubber"); - XtAddConverter( XtRString, XtREdgeType, _CvtStringToEdgeType, + XtAddConverter( XtRString, XtREdgeType, _CvtStringToEdgeType, (XtConvertArgList)NULL, 0 ); XtSetTypeConverter (XtRString, XtRWidget, XmuNewCvtStringToWidget, parentCvtArgs, XtNumber(parentCvtArgs), XtCacheNone, @@ -222,7 +222,7 @@ static void ClassPartInitialize(class) WidgetClass class; { FormWidgetClass c = (FormWidgetClass)class; - FormWidgetClass super = (FormWidgetClass) + FormWidgetClass super = (FormWidgetClass) c->core_class.superclass; if (c->form_class.layout == XtInheritLayout) @@ -344,7 +344,7 @@ static Boolean Layout(fw, width, height, force_relayout) LayoutChild(*childP); - x = form->form.new_x + (*childP)->core.width + + x = form->form.new_x + (*childP)->core.width + ((*childP)->core.border_width << 1); if (x > (int)maxx) maxx = x; @@ -362,8 +362,8 @@ static Boolean Layout(fw, width, height, force_relayout) if (fw->form.resize_in_layout) { Boolean always_resize_children; - always_resize_children = - ChangeFormGeometry( (Widget) fw, FALSE, maxx, maxy, + always_resize_children = + ChangeFormGeometry( (Widget) fw, FALSE, maxx, maxy, (Dimension *)NULL, (Dimension *)NULL); fw->form.old_width = fw->core.width; @@ -391,7 +391,7 @@ static Boolean Layout(fw, width, height, force_relayout) * Returns: none. */ -static void ResizeChildren(w) +static void ResizeChildren(w) Widget w; { FormWidget fw = (FormWidget) w; @@ -402,18 +402,18 @@ Widget w; for (childP = children; childP - children < num_children; childP++) { FormConstraints form; - if (!XtIsManaged(*childP)) + if (!XtIsManaged(*childP)) continue; form = (FormConstraints)(*childP)->core.constraints; if (fw->form.no_refigure) { -/* +/* * I am changing the widget wrapper w/o modifing the window. This is * risky, but I can get away with it since I am the parent of this * widget, and he must ask me for any geometry changes. * * The window will be updated when no_refigure is set back to False. - */ + */ (*childP)->core.x = form->form.new_x; (*childP)->core.y = form->form.new_y; } @@ -458,14 +458,14 @@ static void LayoutChild(w) FormConstraints ref_form = (FormConstraints) ref->core.constraints; LayoutChild(ref); - form->form.new_x += (ref_form->form.new_x + + form->form.new_x += (ref_form->form.new_x + ref->core.width + (ref->core.border_width << 1)); } if ((ref = form->form.vert_base) != (Widget)NULL) { FormConstraints ref_form = (FormConstraints) ref->core.constraints; LayoutChild(ref); - form->form.new_y += (ref_form->form.new_y + + form->form.new_y += (ref_form->form.new_y + ref->core.height + (ref->core.border_width << 1)); } @@ -508,7 +508,7 @@ static void Resize(w) fw->core.width, form->form.left ); y = TransformCoord( (*childP)->core.y, fw->form.old_height, fw->core.height, form->form.top ); - + form->form.virtual_width = TransformCoord((Position)((*childP)->core.x + form->form.virtual_width @@ -516,20 +516,20 @@ static void Resize(w) fw->form.old_width, fw->core.width, form->form.right ) - (x + 2 * (*childP)->core.border_width); - + form->form.virtual_height = TransformCoord((Position)((*childP)->core.y + form->form.virtual_height + 2 * (*childP)->core.border_width), fw->form.old_height, fw->core.height, - form->form.bottom ) + form->form.bottom ) - ( y + 2 * (*childP)->core.border_width); - - width = (Dimension) + + width = (Dimension) (form->form.virtual_width < 1) ? 1 : form->form.virtual_width; height = (Dimension) (form->form.virtual_height < 1) ? 1 : form->form.virtual_height; - + XtConfigureWidget(*childP,x,y, (Dimension)width, (Dimension)height, (*childP)->core.border_width ); } @@ -561,7 +561,7 @@ static XtGeometryResult GeometryManager(w, request, reply) * then it is necessary to compute a new layout if ConstraintSetValues * allowed any constraint changes. */ - if (fw->form.needs_relayout) + if (fw->form.needs_relayout) (*((FormWidgetClass)fw->core.widget_class)->form_class.layout) (fw, 0, 0, True); return(XtGeometryNo); @@ -583,7 +583,7 @@ static XtGeometryResult GeometryManager(w, request, reply) * then it is necessary to compute a new layout if ConstraintSetValues * allowed any constraint changes. */ - if (fw->form.needs_relayout) + if (fw->form.needs_relayout) (*((FormWidgetClass)fw->core.widget_class)->form_class.layout) (fw, 0, 0, True); return(XtGeometryNo); @@ -617,12 +617,12 @@ static XtGeometryResult GeometryManager(w, request, reply) fw->form.resize_in_layout = TRUE; - always_resize_children = ChangeFormGeometry(w, TRUE, + always_resize_children = ChangeFormGeometry(w, TRUE, fw->form.preferred_width, fw->form.preferred_height, &ret_width, &ret_height); - if (always_resize_children || + if (always_resize_children || ((ret_width >= fw->form.preferred_width) && (ret_height >= fw->form.preferred_height))) { @@ -639,17 +639,17 @@ static XtGeometryResult GeometryManager(w, request, reply) form->form.virtual_width = w->core.width; /* reset virtual */ form->form.virtual_height = w->core.height; /* width and height. */ if (fw->form.no_refigure) { -/* +/* * I am changing the widget wrapper w/o modifing the window. This is * risky, but I can get away with it since I am the parent of this * widget, and he must ask me for any geometry changes. * * The window will be updated when no_refigure is set back to False. - */ + */ form->form.deferred_resize = True; ret_val = XtGeometryDone; } - else + else ret_val = XtGeometryYes; } else { @@ -702,7 +702,7 @@ static Boolean ConstraintSetValues(current, request, new, args, num_args) { FormConstraints cfc = (FormConstraints) current->core.constraints; FormConstraints nfc = (FormConstraints) new->core.constraints; - + if (cfc->form.top != nfc->form.top || cfc->form.bottom != nfc->form.bottom || cfc->form.left != nfc->form.left || @@ -742,7 +742,7 @@ static void ChangeManaged(w) /* * Reset virtual width and height for all children. */ - + for (children = childP = fw->composite.children ; childP - children < num_children; childP++) { child = *childP; @@ -756,7 +756,7 @@ static void ChangeManaged(w) * * Chris D. Peterson 2/9/89. */ - + if ( child->core.width != 1) form->form.virtual_width = (int) child->core.width; if ( child->core.height != 1) @@ -764,7 +764,7 @@ static void ChangeManaged(w) } } (*((FormWidgetClass)w->core.widget_class)->form_class.layout) - ((FormWidget) w, w->core.width, + ((FormWidget) w, w->core.width, w->core.height, TRUE); } @@ -774,7 +774,7 @@ static XtGeometryResult PreferredGeometry( widget, request, reply ) XtWidgetGeometry *request, *reply; { FormWidget w = (FormWidget)widget; - + reply->width = w->form.preferred_width; reply->height = w->form.preferred_height; reply->request_mode = CWWidth | CWHeight; @@ -796,7 +796,7 @@ static XtGeometryResult PreferredGeometry( widget, request, reply ) * **********************************************************************/ -/* +/* * Set or reset figuring (ignored if not realized) */ @@ -833,7 +833,7 @@ Boolean doit; */ XMoveResizeWindow(XtDisplay(w), XtWindow(w), - w->core.x, w->core.y, + w->core.x, w->core.y, w->core.width, w->core.height); if (form->form.deferred_resize && @@ -28,13 +28,13 @@ 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, +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 +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. +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 @@ -67,7 +67,7 @@ static XtResource resources[] = { XtDefaultForeground}, {XtNborderWidth, XtCBorderWidth, XtRDimension, sizeof(Dimension), XtOffsetOf(GripRec, core.border_width), XtRImmediate, (XtPointer)0}, - {XtNcallback, XtCCallback, XtRCallback, sizeof(XtPointer), + {XtNcallback, XtCCallback, XtRCallback, sizeof(XtPointer), XtOffsetOf(GripRec, grip.grip_action), XtRCallback, NULL}, }; diff --git a/src/Label.c b/src/Label.c index abc6fed..a1e5234 100644 --- a/src/Label.c +++ b/src/Label.c @@ -28,13 +28,13 @@ 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, +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 +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. +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 @@ -127,7 +127,7 @@ static XtGeometryResult QueryGeometry(); LabelClassRec labelClassRec = { { -/* core_class fields */ +/* core_class fields */ /* superclass */ (WidgetClass) &threeDClassRec, /* class_name */ "Label", /* widget_size */ sizeof(LabelRec), @@ -186,7 +186,7 @@ WidgetClass labelWidgetClass = (WidgetClass)&labelClassRec; static void ClassInitialize() { XawInitializeWidgetSet(); - XtAddConverter( XtRString, XtRJustify, XmuCvtStringToJustify, + XtAddConverter( XtRString, XtRJustify, XmuCvtStringToJustify, (XtConvertArgList)NULL, 0 ); } @@ -392,7 +392,7 @@ static void GetgrayGC(lw) values.font = lw->label.font->fid; values.fill_style = FillTiled; values.tile = XmuCreateStippledPixmap(XtScreen((Widget)lw), - lw->label.foreground, + lw->label.foreground, lw->core.background_pixel, lw->core.depth); values.graphics_exposures = False; @@ -408,7 +408,7 @@ static void GetgrayGC(lw) &values, GCFont, 0); else #endif - lw->label.gray_GC = XtGetGC((Widget)lw, + lw->label.gray_GC = XtGetGC((Widget)lw, (unsigned) GCForeground | GCBackground | GCFont | GCTile | GCFillStyle | GCGraphicsExposures, @@ -453,7 +453,7 @@ static void Initialize(request, new, args, num_args) if (!XtIsSubclass(new, commandWidgetClass)) lw->threeD.shadow_width = 0; - if (lw->label.label == NULL) + if (lw->label.label == NULL) lw->label.label = XtNewString(lw->core.name); else lw->label.label = XtNewString(lw->label.label); @@ -500,7 +500,7 @@ static void Redisplay(gw, event, region) Pixmap pm; GC gc; - /* + /* * Don't draw shadows if Command is going to redraw them. * The shadow draw method is region aware, but since 99% of * all labels don't have shadows, we'll check for a shadow @@ -600,7 +600,7 @@ static void Redisplay(gw, event, region) else XDrawString(XtDisplay(gw), XtWindow(gw), gc, w->label.label_x, y, label, (int)(nl - label)); - y += w->label.font->max_bounds.ascent + + y += w->label.font->max_bounds.ascent + w->label.font->max_bounds.descent; label = nl + 1; } @@ -851,10 +851,10 @@ static XtGeometryResult QueryGeometry(w, intended, preferred) LabelWidget lw = (LabelWidget)w; preferred->request_mode = CWWidth | CWHeight; - preferred->width = (lw->label.label_width + + preferred->width = (lw->label.label_width + 2 * lw->label.internal_width + LEFT_OFFSET(lw)); - preferred->height = lw->label.label_height + + preferred->height = lw->label.label_height + 2 * lw->label.internal_height; if ( ((intended->request_mode & (CWWidth | CWHeight)) == (CWWidth | CWHeight)) && diff --git a/src/Layout.c b/src/Layout.c index 1247ae7..69fcc7f 100644 --- a/src/Layout.c +++ b/src/Layout.c @@ -15,7 +15,7 @@ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. * 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 + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Author: Keith Packard, MIT X Consortium @@ -58,7 +58,7 @@ static int DBUG_level = 0; {fprintf(stderr," (%d) %s:",DBUG_level, DBUG_currentproc); \ fprintf(stderr,f,s);fprintf(stderr,"\n");} #else -# define DBUG_ENTER(s) +# define DBUG_ENTER(s) # define DBUG_VOID_RETURN return # define DBUG_PRINT(f,s) # define DBUG_RETURN(f,v) return(v) @@ -178,7 +178,7 @@ LayoutClassRec layoutClassRec = { NULL, /* extension */ }, #endif - { /* layout_class fields */ + { /* layout_class fields */ 0 } }; @@ -192,7 +192,7 @@ WidgetClass layoutWidgetClass = (WidgetClass) &layoutClassRec; /************************************************************ * - * Semi-public routines. + * Semi-public routines. * ************************************************************/ @@ -212,7 +212,7 @@ CvtStringToLayout (dpy, args, num_args, from, to, converter_data) XtPointer *converter_data; { static BoxPtr tmp; - + LayYYsetsource ((char *) from->addr); if (!to->addr) to->addr = (XtPointer)&tmp; LayYYsetdest ((BoxPtr *) to->addr); @@ -232,16 +232,16 @@ DisposeLayout (app, to, data, args, num_args) LayoutFreeLayout (* (LayoutPtr *) to->addr); } -static void +static void ClassInitialize() { XtSetTypeConverter ( XtRString, XtRLayout, CvtStringToLayout, - (XtConvertArgList)NULL, (Cardinal)0, XtCacheNone, + (XtConvertArgList)NULL, (Cardinal)0, XtCacheNone, DisposeLayout ); } #ifdef MOTIF -static void Redisplay ( gw, event, region ) +static void Redisplay ( gw, event, region ) Widget gw; XEvent *event; Region region; @@ -249,8 +249,8 @@ Region region; /* * If the Layout widget is visible, redraw gadgets. */ - - if ( XtIsRealized ( gw ) && gw->core.visible ) + + if ( XtIsRealized ( gw ) && gw->core.visible ) { _XmRedisplayGadgets ( gw, event, region ); } @@ -272,7 +272,7 @@ static XtGeometryResult GeometryManager(child, request, reply) changed = FALSE; bwChanged = FALSE; if (request->request_mode & CWBorderWidth && - request->border_width != child->core.border_width) + request->border_width != child->core.border_width) { p->naturalBw = bw; bw = request->border_width; @@ -317,7 +317,7 @@ static void ChangeManaged(gw) GetDesiredSize (*children); LayoutLayout ((LayoutWidget) w, TRUE); #ifdef MOTIF - _XmNavigChangeManaged ( gw ); + _XmNavigChangeManaged ( gw ); #endif DBUG_VOID_RETURN; } @@ -328,7 +328,7 @@ GetDesiredSize (child) { XtWidgetGeometry desired; SubInfoPtr p; - + XtQueryGeometry (child, (XtWidgetGeometry *) NULL, &desired); p = SubInfo (child); p->naturalBw = desired.border_width; @@ -351,7 +351,7 @@ Resize(gw) } /* ARGSUSED */ -static Boolean +static Boolean SetValues(gold, greq, gnew, args, num_args) Widget gold, greq, gnew; ArgList args; @@ -452,7 +452,7 @@ PrintDirection (dir) default: (void) printf ("Unknown layout direction %d\n", dir); break; - + } } @@ -470,17 +470,17 @@ PrintBox (box, level) int level; { BoxPtr child; - + TabTo (level); (void) printf ("%s", "< "); - (void) printf ("%s", " + "); + (void) printf ("%s", " + "); PrintGlue (box->params.stretch[LayoutHorizontal]); - (void) printf ("%s", " - "); + (void) printf ("%s", " - "); PrintGlue (box->params.shrink[LayoutHorizontal]); (void) printf ("%s", " * "); - (void) printf ("%s", " + "); + (void) printf ("%s", " + "); PrintGlue (box->params.stretch[LayoutVertical]); - (void) printf ("%s", " - "); + (void) printf ("%s", " - "); PrintGlue (box->params.shrink[LayoutVertical]); (void) printf ("%s", " >"); (void) printf (" size: %d x %d", box->size[0], box->size[1]); @@ -516,8 +516,8 @@ LookupVariable (child, quark) DBUG_PRINT("child = %p",child); while ((parent = child->parent)) { - for (box = parent->u.box.firstChild; - box != child; + for (box = parent->u.box.firstChild; + box != child; box = box->nextSibling) { if (box->type == VariableBox && box->u.variable.quark == quark) @@ -527,7 +527,7 @@ LookupVariable (child, quark) } DBUG_RETURN("failure -> %d",0); } - + static double Evaluate (l, box, expr, natural) LayoutWidget l; @@ -582,10 +582,10 @@ Evaluate (l, box, expr, natural) return 0; info = SubInfo (widget); return info->naturalSize[LayoutVertical]; - case Variable: + case Variable: { - /* in the original code there was no nexpr, - expr was overwritten by LookupVariable and + /* in the original code there was no nexpr, + expr was overwritten by LookupVariable and the expression "expr->u.variable" to obtain the variable name for the errormessage cause a segmentation violation */ @@ -640,7 +640,7 @@ DisposeExpr (expr) #define DoStretch(l, box, dir) \ CheckGlue (l, box, box->params.stretch[dir], (double) box->natural[dir]); - + #define DoShrink(l, box, dir) \ CheckGlue (l, box, box->params.shrink[dir], (double) box->natural[dir]) @@ -667,7 +667,7 @@ ComputeNaturalSizes (l, box, dir) box->natural[LayoutHorizontal] = 0; box->natural[LayoutVertical] = 0; } - else + else { info = SubInfo (w); box->natural[LayoutHorizontal] = info->naturalSize[LayoutHorizontal]; @@ -694,7 +694,7 @@ ComputeNaturalSizes (l, box, dir) ZeroGlue (box->params.stretch[thisDir]); box->params.shrink[!thisDir].order = 100000; box->params.stretch[!thisDir].order = 100000; - for (child = box->u.box.firstChild; child; child = child->nextSibling) + for (child = box->u.box.firstChild; child; child = child->nextSibling) { ComputeNaturalSizes (l, child, thisDir); /* @@ -747,9 +747,9 @@ ComputeNaturalSizes (l, box, dir) { int minSize; int largestMinSize; - + largestMinSize = 0; - for (child = box->u.box.firstChild; child; child = child->nextSibling) + for (child = box->u.box.firstChild; child; child = child->nextSibling) { if (child->params.shrink[!thisDir].order <= 0) { @@ -801,21 +801,21 @@ ComputeSizes (box) dir = box->u.box.dir; size = box->size[dir]; - + stretch = box->params.stretch[dir]; shrink = box->params.shrink[dir]; - + /* pick the correct adjustment parameters based on the change direction */ totalChange[0] = size - box->natural[dir]; shrinking = totalChange[0] < 0; - + totalChange[1] = 0; totalGlue[1].order = 100000; totalGlue[1].value = 0; maxGlue = 1; - if (shrinking) + if (shrinking) { totalGlue[0] = shrink; /* for first-order infinites, shrink it to zero and then @@ -824,9 +824,9 @@ ComputeSizes (box) if (shrink.order == 1) { totalSizes = 0; remainingGlue = 0; - for (child = box->u.box.firstChild; - child; - child = child->nextSibling) + for (child = box->u.box.firstChild; + child; + child = child->nextSibling) { switch (child->params.shrink[dir].order) { case 0: @@ -847,7 +847,7 @@ ComputeSizes (box) maxGlue = 2; } } - if (totalGlue[0].order <= 0 && + if (totalGlue[0].order <= 0 && totalChange[0] > totalGlue[0].value) { totalChange[0] = totalGlue[0].value; @@ -861,7 +861,7 @@ ComputeSizes (box) remainingGlue = totalGlue[0].value + totalGlue[1].value; remainingChange = totalChange[0] + totalChange[1]; happy = True; - for (child = box->u.box.firstChild; child; child = child->nextSibling) + for (child = box->u.box.firstChild; child; child = child->nextSibling) { /* never add glue or stretch to a VariableBox! */ if (child->type == VariableBox) continue; @@ -870,7 +870,7 @@ ComputeSizes (box) glue = &child->params.shrink[dir]; else glue = &child->params.stretch[dir]; - + child->size[dir] = child->natural[dir]; for (i = 0; i < maxGlue; i++) { @@ -880,8 +880,8 @@ ComputeSizes (box) if (remainingGlue <= 0) change = remainingChange; else - change = GluePart (glue->value, - totalGlue[i].value, + change = GluePart (glue->value, + totalGlue[i].value, totalChange[i]); child->size[dir] += change; remainingChange -= change; @@ -906,7 +906,7 @@ SetSizes (box, x, y) int bw; Widget w; SubInfoPtr info; - + switch (box->type) { case WidgetBox: w = box->u.widget.widget; @@ -920,7 +920,7 @@ SetSizes (box, x, y) width -= bw * 2; height -= bw * 2; /* Widgets which grow too small are placed off screen */ - if (width <= 0 || height <= 0) + if (width <= 0 || height <= 0) { width = 1; height = 1; @@ -928,13 +928,13 @@ SetSizes (box, x, y) x = -1; y = -1; } - XtConfigureWidget (w, x, y, - (Dimension)width, (Dimension)height, + XtConfigureWidget (w, x, y, + (Dimension)width, (Dimension)height, (Dimension)bw); } break; case BoxBox: - for (child = box->u.box.firstChild; child; child = child->nextSibling) + for (child = box->u.box.firstChild; child; child = child->nextSibling) { SetSizes (child, x, y); if (box->u.box.dir == LayoutHorizontal) @@ -954,7 +954,7 @@ LayoutFreeLayout (box) BoxPtr box; { BoxPtr child, next; - + switch (box->type) { case BoxBox: for (child = box->u.box.firstChild; child; child = next) @@ -968,7 +968,7 @@ LayoutFreeLayout (box) break; case WidgetBox: case VariableBox: - default: + default: break; } DisposeExpr (box->params.stretch[LayoutHorizontal].expr); @@ -988,7 +988,7 @@ LayoutGetNaturalSize (l, widthp, heightp) DBUG_ENTER("LayoutGetNaturalSize"); box = l->layout.layout; - if (box) + if (box) { ComputeNaturalSizes (l, box, LayoutHorizontal); *widthp = box->natural[LayoutHorizontal]; @@ -54,11 +54,11 @@ I also added the freedoms member of the list widget part. */ #define WidthFree( w ) !(((ListWidget)(w))->list.freedoms & WidthLock ) #define LongestFree( w ) !(((ListWidget)(w))->list.freedoms & LongestLock ) -/* +/* * Default Translation table. */ -static char defaultTranslations[] = +static char defaultTranslations[] = "<Btn1Down>: Set()\n\ <Btn1Up>: Notify()"; @@ -127,7 +127,7 @@ static XtActionsRec actions[] = { ListClassRec listClassRec = { { -/* core_class fields */ +/* core_class fields */ /* superclass */ (WidgetClass) &simpleClassRec, /* class_name */ "List", /* widget_size */ sizeof(ListRec), @@ -181,7 +181,7 @@ static void GetGCs(w) Widget w; { XGCValues values; - ListWidget lw = (ListWidget) w; + ListWidget lw = (ListWidget) w; values.foreground = lw->list.foreground; values.font = lw->list.font->fid; @@ -206,7 +206,7 @@ Widget w; lw->list.revgc = XtGetGC( w, (unsigned) GCForeground | GCFont, &values); - values.tile = XmuCreateStippledPixmap(XtScreen(w), + values.tile = XmuCreateStippledPixmap(XtScreen(w), lw->list.foreground, lw->core.background_pixel, lw->core.depth); @@ -355,7 +355,7 @@ Dimension width, height; */ /* ARGSUSED */ -static void +static void Initialize(junk, new, args, num_args) Widget junk, new; ArgList args; @@ -363,7 +363,7 @@ Cardinal *num_args; { ListWidget lw = (ListWidget) new; -/* +/* * Initialize all private resources. */ @@ -414,7 +414,7 @@ int *item; if (lw->list.vertical_cols) { one = lw->list.nrows * ((xloc - (int) lw->list.internal_width) / lw->list.col_width); - another = (yloc - (int) lw->list.internal_height) + another = (yloc - (int) lw->list.internal_height) / lw->list.row_height; /* If out of range, return minimum possible value. */ if (another >= lw->list.nrows) { @@ -423,15 +423,15 @@ int *item; } } else { - one = (lw->list.ncols * ((yloc - (int) lw->list.internal_height) + one = (lw->list.ncols * ((yloc - (int) lw->list.internal_height) / lw->list.row_height)) ; /* If in right margin handle things right. */ another = (xloc - (int) lw->list.internal_width) / lw->list.col_width; if (another >= lw->list.ncols) { - another = lw->list.ncols - 1; + another = lw->list.ncols - 1; ret_val = OUT_OF_RANGE; } - } + } if ((xloc < 0) || (yloc < 0)) ret_val = OUT_OF_RANGE; if (one < 0) one = 0; @@ -481,8 +481,8 @@ int ul, lr, item; ListWidget lw = (ListWidget) w; int mod_item; int things; - - if (item < ul || item > lr) + + if (item < ul || item > lr) return(FALSE); if (lw->list.vertical_cols) things = lw->list.nrows; @@ -552,7 +552,7 @@ GC gc; * columns, though, this prevents items from overwriting other items. */ static void ClipToShadowInteriorAndLongest(lw, gc_p, x) - ListWidget lw; + ListWidget lw; GC* gc_p; Dimension x; { @@ -607,7 +607,7 @@ int item; #ifdef XAW_INTERNATIONALIZATION if ( lw->simple.international == True ) - str_y = y + abs(ext->max_ink_extent.y); + str_y = y + abs(ext->max_ink_extent.y); else #endif str_y = y + lw->list.font->max_bounds.ascent; @@ -618,7 +618,7 @@ int item; HighlightBackground(w, x, y, lw->list.normgc); } else { - if (XtIsSensitive(w)) + if (XtIsSensitive(w)) gc = lw->list.normgc; else gc = lw->list.graygc; @@ -633,7 +633,7 @@ int item; lw->list.is_highlighted = item; } else { - if (XtIsSensitive(w)) + if (XtIsSensitive(w)) gc = lw->list.normgc; else gc = lw->list.graygc; @@ -664,7 +664,7 @@ int item; XSetClipMask( XtDisplay( w ), gc, None ); } - + /* Redisplay() * * Repaints the widget window on expose events. @@ -673,7 +673,7 @@ int item; * junk - not used, unless three-d patch enabled. */ /* ARGSUSED */ -static void +static void Redisplay(w, event, junk) Widget w; XEvent *event; @@ -690,7 +690,7 @@ Region junk; } else FindCornerItems(w, event, &ul_item, &lr_item); - + for (item = ul_item; (item <= lr_item && item < lw->list.nitems) ; item++) if (ItemInRectangle(w, ul_item, lr_item, item)) PaintItemName(w, item); @@ -705,14 +705,14 @@ Region junk; * intended - what the parent intends to do with us. * requested - what we want to happen. */ -static XtGeometryResult +static XtGeometryResult PreferredGeom(w, intended, requested) Widget w; XtWidgetGeometry *intended, *requested; { Dimension new_width, new_height; Boolean change, width_req, height_req; - + width_req = intended->request_mode & CWWidth; height_req = intended->request_mode & CWHeight; @@ -727,14 +727,14 @@ XtWidgetGeometry *intended, *requested; new_height = w->core.height; requested->request_mode = 0; - + /* * We only care about our height and width. */ if ( !width_req && !height_req) return(XtGeometryYes); - + change = Layout(w, !width_req, !height_req, &new_width, &new_height); requested->request_mode |= CWWidth; @@ -776,7 +776,7 @@ Resize(w) * width, height- the is the current width and height that we are going * we are going to layout the list widget to, * depending on xfree and yfree of course. - * + * * RETURNS: TRUE if width or height have been changed. */ static Boolean @@ -787,8 +787,8 @@ Dimension *width, *height; { ListWidget lw = (ListWidget) w; Boolean change = FALSE; - -/* + +/* * If force columns is set then always use number of columns specified * by default_cols. */ @@ -832,7 +832,7 @@ Dimension *width, *height; + 2 * lw->list.internal_height; change = TRUE; } -/* +/* * If the width is fixed then use it to determine the number of columns. * If the height is free to move (width still fixed) then resize the height * of the widget to fit the current list exactly. @@ -848,20 +848,20 @@ Dimension *width, *height; change = TRUE; } } -/* +/* * The last case is xfree and !yfree we use the height to determine * the number of rows and then set the width to just fit the resulting * number of columns. */ else if (!yfree) { /* xfree must be TRUE. */ - lw->list.nrows = (int)(*height - 2 * lw->list.internal_height) + lw->list.nrows = (int)(*height - 2 * lw->list.internal_height) / (int)lw->list.row_height; if (lw->list.nrows <= 0) lw->list.nrows = 1; lw->list.ncols = (( lw->list.nitems - 1 ) / lw->list.nrows) + 1; - *width = lw->list.ncols * lw->list.col_width + *width = lw->list.ncols * lw->list.col_width + 2 * lw->list.internal_width; change = TRUE; - } + } return(change); } @@ -884,9 +884,9 @@ Cardinal *num_params; int item, item_len; XawListReturnStruct ret_value; -/* - * Find item and if out of range then unhighlight and return. - * +/* + * Find item and if out of range then unhighlight and return. + * * If the current item is unhighlighted then the user has aborted the * notify, so unhighlight and return. */ @@ -902,13 +902,13 @@ Cardinal *num_params; if ( lw->list.paste ) /* if XtNpasteBuffer set then paste it. */ XStoreBytes(XtDisplay(w), lw->list.list[item], item_len); -/* +/* * Call Callback function. */ ret_value.string = lw->list.list[item]; ret_value.list_index = item; - + XtCallCallbacks( w, XtNcallback, (XtPointer) &ret_value); } @@ -955,7 +955,7 @@ Cardinal *num_params; * Set specified arguments into widget */ -static Boolean +static Boolean SetValues(current, request, new, args, num_args) Widget current, request, new; ArgList args; @@ -1065,10 +1065,10 @@ Cardinal *num_args; nl->list.highlight = NO_HIGHLIGHT; redraw = TRUE; } - + if (!XtIsRealized(current)) return(FALSE); - + return(redraw); } @@ -1077,7 +1077,7 @@ static void Destroy(w) { ListWidget lw = (ListWidget) w; XGCValues values; - + XGetGCValues(XtDisplay(w), lw->list.graygc, GCTile, &values); XmuReleaseStippledPixmap(XtScreen(w), values.tile); XtReleaseGC(w, lw->list.graygc); @@ -1188,12 +1188,12 @@ int item; #endif { ListWidget lw = ( ListWidget ) w; - + if (XtIsSensitive(w)) { lw->list.highlight = item; if (lw->list.is_highlighted != NO_HIGHLIGHT) PaintItemName(w, lw->list.is_highlighted); /* Unhighlight. */ - PaintItemName(w, item); /* HIGHLIGHT this one. */ + PaintItemName(w, item); /* HIGHLIGHT this one. */ } } @@ -1214,9 +1214,9 @@ Widget w; ListWidget lw = ( ListWidget ) w; XawListReturnStruct * ret_val; - ret_val = (XawListReturnStruct *) + ret_val = (XawListReturnStruct *) XtMalloc (sizeof (XawListReturnStruct));/* SPARE MALLOC OK */ - + ret_val->list_index = lw->list.highlight; if (ret_val->list_index == XAW_LIST_NONE) ret_val->string = ""; diff --git a/src/MenuButton.c b/src/MenuButton.c index f334451..aa26a7e 100644 --- a/src/MenuButton.c +++ b/src/MenuButton.c @@ -40,7 +40,7 @@ in this Software without prior written authorization from the X Consortium. * Date: May 2, 1989 * * By: Chris D. Peterson - * MIT X Consortium + * MIT X Consortium * kit@expo.lcs.mit.edu */ @@ -56,7 +56,7 @@ static void PopupMenu(); #define superclass ((CommandWidgetClass)&commandClassRec) -static char defaultTranslations[] = +static char defaultTranslations[] = "<EnterWindow>: highlight()\n\ <LeaveWindow>: reset()\n\ Any<BtnDown>: reset() PopupMenu()"; @@ -72,7 +72,7 @@ static char defaultTranslations[] = #define offset(field) XtOffsetOf(MenuButtonRec, field) static XtResource resources[] = { { - XtNmenuName, XtCMenuName, XtRString, sizeof(String), + XtNmenuName, XtCMenuName, XtRString, sizeof(String), offset(menu_button.menu_name), XtRString, (XtPointer)"menu"}, }; #undef offset @@ -84,7 +84,7 @@ static XtActionsRec actionsList[] = MenuButtonClassRec menuButtonClassRec = { { - (WidgetClass) superclass, /* superclass */ + (WidgetClass) superclass, /* superclass */ "MenuButton", /* class_name */ sizeof(MenuButtonRec), /* size */ ClassInitialize, /* class_initialize */ @@ -118,7 +118,7 @@ MenuButtonClassRec menuButtonClassRec = { NULL /* extension */ }, /* CoreClass fields initialization */ { - XtInheritChangeSensitive /* change_sensitive */ + XtInheritChangeSensitive /* change_sensitive */ }, /* SimpleClass fields initialization */ { XtInheritXaw3dShadowDraw, /* shadowdraw */ @@ -146,7 +146,7 @@ WidgetClass menuButtonWidgetClass = (WidgetClass) &menuButtonClassRec; static void ClassInitialize() { XawInitializeWidgetSet(); - XtRegisterGrabAction(PopupMenu, True, + XtRegisterGrabAction(PopupMenu, True, (unsigned int)(ButtonPressMask | ButtonReleaseMask), GrabModeAsync, GrabModeAsync); } @@ -169,7 +169,7 @@ Cardinal * num_params; temp = w; while(temp != NULL) { menu = XtNameToWidget(temp, mbw->menu_button.menu_name); - if (menu == NULL) + if (menu == NULL) temp = XtParent(temp); else break; @@ -184,7 +184,7 @@ Cardinal * num_params; } if (!XtIsRealized(menu)) XtRealizeWidget(menu); - + menu_width = menu->core.width + 2 * menu->core.border_width; button_height = w->core.height + 2 * w->core.border_width; menu_height = menu->core.height + 2 * menu->core.border_width; @@ -198,7 +198,7 @@ Cardinal * num_params; if (menu_x + menu_width > scr_width) menu_x = scr_width - menu_width; } - if (menu_x < 0) + if (menu_x < 0) menu_x = 0; if (menu_y >= 0) { diff --git a/src/MultiSink.c b/src/MultiSink.c index 8d91d94..f1c899c 100644 --- a/src/MultiSink.c +++ b/src/MultiSink.c @@ -52,13 +52,13 @@ 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, +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 +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. +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 @@ -110,7 +110,7 @@ static XtResource resources[] = { #define SuperClass (&textSinkClassRec) MultiSinkClassRec multiSinkClassRec = { - { /* core_class fields */ + { /* core_class fields */ /* superclass */ (WidgetClass) SuperClass, /* class_name */ "MultiSink", /* widget_size */ sizeof(MultiSinkRec), @@ -165,7 +165,7 @@ WidgetClass multiSinkObjectClass = (WidgetClass)&multiSinkClassRec; /* Utilities */ -static int +static int #if NeedFunctionPrototypes CharWidth ( Widget w, @@ -190,7 +190,7 @@ CharWidth (w, x, c) x -= ((TextWidget) XtParent(w))->text.margin.left; if (x >= (int)XtParent(w)->core.width) return 0; - for (i = 0, tab = sink->text_sink.tabs ; + for (i = 0, tab = sink->text_sink.tabs ; i < sink->text_sink.tab_count ; i++, tab++) { if (x < *tab) { if (*tab < (int)XtParent(w)->core.width) @@ -277,8 +277,8 @@ PaintText(w, gc, x, y, buf, len) /* * This function does not know about drawing more than one line of text. */ - -static void + +static void DisplayText(w, x, y, pos1, pos2, highlight) Widget w; Position x, y; @@ -389,7 +389,7 @@ InsertCursor (w, x, y, state) sink->multi_sink.cursor_y = y; GetCursorBounds(w, &rect); - if (state != sink->multi_sink.laststate && XtIsRealized(text_widget)) + if (state != sink->multi_sink.laststate && XtIsRealized(text_widget)) XCopyPlane(XtDisplay(text_widget), sink->multi_sink.insertCursorOn, XtWindow(text_widget), sink->multi_sink.xorgc, @@ -474,7 +474,7 @@ FindPosition(w, fromPos, fromx, width, stopAtWordBreak, resPos, resWidth, resHei c = ((wchar_t *)blk.ptr)[index - blk.firstPos]; *resWidth += CharWidth(w, fromx + *resWidth, c); - if ((c == _Xaw_atowc(XawSP) || c == _Xaw_atowc(XawTAB)) && + if ((c == _Xaw_atowc(XawSP) || c == _Xaw_atowc(XawTAB)) && *resWidth <= width) { whiteSpaceSeen = TRUE; whiteSpacePosition = index; @@ -522,22 +522,22 @@ GetGC(sink) XGCValues values; values.graphics_exposures = (Bool) FALSE; - + values.foreground = sink->text_sink.foreground; values.background = sink->text_sink.background; sink->multi_sink.normgc = XtAllocateGC( (Widget)sink, 0, valuemask, &values, GCFont, 0 ); - + values.foreground = sink->text_sink.background; values.background = sink->text_sink.foreground; sink->multi_sink.invgc = XtAllocateGC( (Widget)sink, 0, valuemask, &values, GCFont, 0 ); - + values.function = GXxor; values.background = (unsigned long) 0L; /* (pix ^ 0) = pix */ - values.foreground = (sink->text_sink.background ^ + values.foreground = (sink->text_sink.background ^ sink->text_sink.foreground); valuemask = GCGraphicsExposures | GCFunction | GCForeground | GCBackground; - + /* if this GC is not used for fontset rendering then AllocateGC aint needed. Dont hurt tho.*/ sink->multi_sink.xorgc = XtAllocateGC( (Widget)sink, 0, valuemask, &values, GCFont, 0 ); } @@ -563,14 +563,14 @@ Initialize(request, new, args, num_args) MultiSinkObject sink = (MultiSinkObject) new; GetGC(sink); - + sink->multi_sink.insertCursorOn= CreateInsertCursor(XtScreenOfObject(new)); sink->multi_sink.laststate = XawisOff; sink->multi_sink.cursor_x = sink->multi_sink.cursor_y = 0; } /* Function Name: Destroy - * Description: This function cleans up when the object is + * Description: This function cleans up when the object is * destroyed. * Arguments: w - the MultiSink Object. * Returns: none. @@ -626,11 +626,11 @@ SetValues(current, request, new, args, num_args) ((TextWidget)XtParent(new))->text.redisplay_needed = True; } else { if ( (w->multi_sink.echo != old_w->multi_sink.echo) || - (w->multi_sink.display_nonprinting != + (w->multi_sink.display_nonprinting != old_w->multi_sink.display_nonprinting) ) ((TextWidget)XtParent(new))->text.redisplay_needed = True; } - + return False; } @@ -657,7 +657,7 @@ MaxLines(w, height) } /* Function Name: MaxHeight - * Description: Finds the Minium height that will contain a given number + * Description: Finds the Minium height that will contain a given number * lines. * Arguments: w - the MultiSink Object. * lines - the number of lines. @@ -667,8 +667,8 @@ MaxLines(w, height) /* ARGSUSED */ static int #if NeedFunctionPrototypes -MaxHeight( - Widget w, +MaxHeight( + Widget w, int lines ) #else MaxHeight( w, lines ) @@ -679,7 +679,7 @@ MaxHeight( w, lines ) MultiSinkObject sink = (MultiSinkObject) w; XFontSetExtents *ext = XExtentsOfFontSet(sink->multi_sink.fontset); - return(lines * ext->max_logical_extent.height); + return(lines * ext->max_logical_extent.height); } /* Function Name: SetTabs @@ -690,11 +690,11 @@ MaxHeight( w, lines ) * Returns: none */ -static void +static void #if NeedFunctionPrototypes -SetTabs( - Widget w, - int tab_count, +SetTabs( + Widget w, + int tab_count, short* tabs ) #else SetTabs( w, tab_count, tabs ) @@ -727,9 +727,9 @@ SetTabs( w, tab_count, tabs ) */ XA_FIGURE_WIDTH = XInternAtom(XtDisplayOfObject(w), "FIGURE_WIDTH", FALSE); - if ( (XA_FIGURE_WIDTH != None) && + if ( (XA_FIGURE_WIDTH != None) && ( (!XGetFontProperty(font, XA_FIGURE_WIDTH, &figure_width)) || - (figure_width == 0)) ) + (figure_width == 0)) ) if (font->per_char && font->min_char_or_byte2 <= '$' && font->max_char_or_byte2 >= '$') figure_width = font->per_char['$' - font->min_char_or_byte2].width; @@ -749,7 +749,7 @@ SetTabs( w, tab_count, tabs ) sink->text_sink.tabs[i] = tabs[i] * figure_width; sink->text_sink.char_tabs[i] = tabs[i]; } - + sink->text_sink.tab_count = tab_count; #ifndef NO_TAB_FIX @@ -760,8 +760,8 @@ SetTabs( w, tab_count, tabs ) void #if NeedFunctionPrototypes _XawMultiSinkPosToXY( - Widget w, - XawTextPosition pos, + Widget w, + XawTextPosition pos, Position *x, Position *y ) #else diff --git a/src/MultiSrc.c b/src/MultiSrc.c index 19abeeb..4a655d0 100644 --- a/src/MultiSrc.c +++ b/src/MultiSrc.c @@ -95,7 +95,7 @@ static XtResource resources[] = { offset(data_compression), XtRImmediate, (XtPointer) FALSE}, {XtNpieceSize, XtCPieceSize, XtRInt, sizeof (XawTextPosition), offset(piece_size), XtRImmediate, (XtPointer) BUFSIZ}, - {XtNcallback, XtCCallback, XtRCallback, sizeof(XtPointer), + {XtNcallback, XtCCallback, XtRCallback, sizeof(XtPointer), offset(callback), XtRCallback, (XtPointer)NULL}, {XtNuseStringInPlace, XtCUseStringInPlace, XtRBoolean, sizeof (Boolean), offset(use_string_in_place), XtRImmediate, (XtPointer) FALSE}, @@ -123,7 +123,7 @@ static void (MyWStrncpy)(); extern char *tmpnam(); #ifdef X_NOT_STDC_ENV -extern int errno; +extern int errno; #endif #ifdef X_NOT_POSIX @@ -139,7 +139,7 @@ extern char *_XawTextWCToMB(); #define superclass (&textSrcClassRec) MultiSrcClassRec multiSrcClassRec = { - { /* object_class fields */ + { /* object_class fields */ /* superclass */ (WidgetClass) superclass, /* class_name */ "MultiSrc", /* widget_size */ sizeof(MultiSrcRec), @@ -254,13 +254,13 @@ static XawTextPosition ReadText(w, pos, text, length) Widget w; XawTextPosition pos; - XawTextBlock* text; - int length; + XawTextBlock* text; + int length; { MultiSrcObject src = (MultiSrcObject) w; XawTextPosition count, start; MultiPiece * piece = FindPiece(src, pos, &start); - + text->format = XawFmtWide; text->firstPos = pos; text->ptr = (char *)(piece->text + (pos - start)); @@ -278,7 +278,7 @@ ReadText(w, pos, text, length) */ /*ARGSUSED*/ -static int +static int ReplaceText( w, startPos, endPos, u_text_p) Widget w; XawTextPosition startPos, endPos; @@ -292,9 +292,9 @@ ReplaceText( w, startPos, endPos, u_text_p) Boolean local_artificial_block = False; XawTextBlock text; - /* STEP 1: The user handed me a text block called `u_text' that may be - * in either FMTWIDE or FMT8BIT (ie MB.) Later code needs the block - * `text' to hold FMTWIDE. So, this copies `u_text' to `text', and if + /* STEP 1: The user handed me a text block called `u_text' that may be + * in either FMTWIDE or FMT8BIT (ie MB.) Later code needs the block + * `text' to hold FMTWIDE. So, this copies `u_text' to `text', and if * `u_text' was MB, I knock it up to WIDE. */ if ( u_text_p->length == 0 ) /* if so, the block contents never ref'd. */ @@ -326,7 +326,7 @@ ReplaceText( w, startPos, endPos, u_text_p) /* STEP 2: some initialization... */ - if (src->text_src.edit_mode == XawtextRead) + if (src->text_src.edit_mode == XawtextRead) return(XawEditError); start_piece = FindPiece(src, startPos, &start_first); @@ -362,9 +362,9 @@ ReplaceText( w, startPos, endPos, u_text_p) MyWStrncpy(start_piece->text + (startPos - start_first), start_piece->text + (endPos - start_first), (int) (start_piece->used - (startPos - start_first)) ); - if ( src->multi_src.use_string_in_place && - ((src->multi_src.length - (endPos - startPos)) < - (src->multi_src.piece_size - 1)) ) + if ( src->multi_src.use_string_in_place && + ((src->multi_src.length - (endPos - startPos)) < + (src->multi_src.piece_size - 1)) ) start_piece->text[src->multi_src.length - (endPos - startPos)] = (wchar_t)0; } } @@ -379,14 +379,14 @@ ReplaceText( w, startPos, endPos, u_text_p) if ( text.length != 0) { start_piece = FindPiece(src, startPos, &start_first); - + length = text.length; firstPos = text.firstPos; - + while (length > 0) { wchar_t* ptr; int fill; - + if (src->multi_src.use_string_in_place) { if (start_piece->used == (src->multi_src.piece_size - 1)) { /* @@ -410,13 +410,13 @@ ReplaceText( w, startPos, endPos, u_text_p) } fill = Min((int)(src->multi_src.piece_size - start_piece->used), length); - + ptr = start_piece->text + (startPos - start_first); - MyWStrncpy(ptr + fill, ptr, + MyWStrncpy(ptr + fill, ptr, (int) start_piece->used - (startPos - start_first)); wptr =(wchar_t *)text.ptr; (void)wcsncpy(ptr, wptr + firstPos, fill); - + startPos += fill; firstPos += fill; start_piece->used += fill; @@ -450,16 +450,16 @@ ReplaceText( w, startPos, endPos, u_text_p) * dir - direction to scan. * count - which occurance if this thing to search for. * include - whether or not to include the character found in - * the position that is returned. + * the position that is returned. * Returns: the position of the item found. * - * Note: While there are only 'n' characters in the file there are n+1 + * Note: While there are only 'n' characters in the file there are n+1 * possible cursor positions (one before the first character and * one after the last character. */ -static -XawTextPosition +static +XawTextPosition Scan( w, position, type, dir, count, include ) Widget w; XawTextPosition position; @@ -506,9 +506,9 @@ Scan( w, position, type, dir, count, include ) ptr = (position - first) + piece->text; switch (type) { - case XawstEOL: - case XawstParagraph: - case XawstWhiteSpace: + case XawstEOL: + case XawstParagraph: + case XawstWhiteSpace: for ( ; count > 0 ; count-- ) { Boolean non_space = FALSE, first_eol = TRUE; /* CONSTCOND */ @@ -517,10 +517,10 @@ Scan( w, position, type, dir, count, include ) ptr += inc; position += inc; - + if (type == XawstWhiteSpace) { if (iswspace(c)) { - if (non_space) + if (non_space) break; } else @@ -542,7 +542,7 @@ Scan( w, position, type, dir, count, include ) else if ( !iswspace(c) ) first_eol = TRUE; } - + if ( ptr < piece->text ) { piece = piece->prev; @@ -564,7 +564,7 @@ Scan( w, position, type, dir, count, include ) position -= inc; } break; - case XawstPositions: + case XawstPositions: position += count * inc; break; case XawstAll: /* handled in special code above */ @@ -592,7 +592,7 @@ Scan( w, position, type, dir, count, include ) * Returns: the position of the item found. */ -static XawTextPosition +static XawTextPosition Search(w, position, dir, text ) Widget w; XawTextPosition position; @@ -653,7 +653,7 @@ Search(w, position, dir, text ) /* CONSTCOND */ while (TRUE) { - if (*ptr == ((dir == XawsdRight) ? *(buf + count) + if (*ptr == ((dir == XawsdRight) ? *(buf + count) : *(buf + wtarget_len - count - 1)) ) { if (count == (text->length - 1)) break; @@ -670,7 +670,7 @@ Search(w, position, dir, text ) ptr += inc; position += inc; - + while ( ptr < piece->text ) { piece = piece->prev; if (piece == NULL) { /* Begining of text. */ @@ -679,7 +679,7 @@ Search(w, position, dir, text ) } ptr = piece->text + piece->used - 1; } - + while ( ptr >= (piece->text + piece->used) ) { piece = piece->next; if (piece == NULL) { /* End of text. */ @@ -718,20 +718,20 @@ SetValues(current, request, new, args, num_args) FILE * file; int i; - if ( old_src->multi_src.use_string_in_place != + if ( old_src->multi_src.use_string_in_place != src->multi_src.use_string_in_place ) { XtAppWarning( app_con, "MultiSrc: The XtNuseStringInPlace resources may not be changed."); - src->multi_src.use_string_in_place = + src->multi_src.use_string_in_place = old_src->multi_src.use_string_in_place; } - for (i = 0; i < *num_args ; i++ ) + for (i = 0; i < *num_args ; i++ ) if (streq(args[i].name, XtNstring)) { string_set = TRUE; break; } - + if ( string_set || (old_src->multi_src.type != src->multi_src.type) ) { RemoveOldStringOrFile(old_src, string_set); file = InitStringOrFile(src, string_set); @@ -747,7 +747,7 @@ SetValues(current, request, new, args, num_args) total_reset = TRUE; } - if ( old_src->multi_src.multi_length != src->multi_src.multi_length ) + if ( old_src->multi_src.multi_length != src->multi_src.multi_length ) src->multi_src.piece_size = src->multi_src.multi_length; if ( !total_reset && (old_src->multi_src.piece_size @@ -791,7 +791,7 @@ GetValuesHook(w, args, num_args) int i; if (src->multi_src.type == XawAsciiString) { - for (i = 0; i < *num_args ; i++ ) + for (i = 0; i < *num_args ; i++ ) if (streq(args[i].name, XtNstring)) { if (src->multi_src.use_string_in_place) { *((char **) args[i].value) = (char *) @@ -804,7 +804,7 @@ GetValuesHook(w, args, num_args) break; } } -} +} /* Function Name: Destroy * Description: Destroys an multi source (frees all data) @@ -812,7 +812,7 @@ GetValuesHook(w, args, num_args) * Returns: none. */ -static void +static void Destroy (w) Widget w; { @@ -821,7 +821,7 @@ Destroy (w) /************************************************************ * - * Public routines + * Public routines * ************************************************************/ @@ -880,7 +880,7 @@ _XawMultiSave(w) * to get the internal info into a readable string. */ - if (src->multi_src.use_string_in_place) + if (src->multi_src.use_string_in_place) return(TRUE); if (src->multi_src.type == XawAsciiFile) { @@ -922,11 +922,11 @@ _XawMultiSave(w) } /* assert: mb_string holds good characters so the buffer is fine */ - if (src->multi_src.allocated_string == TRUE) + if (src->multi_src.allocated_string == TRUE) XtFree(src->multi_src.string); else src->multi_src.allocated_string = TRUE; - + src->multi_src.string = mb_string; } src->multi_src.changes = FALSE; @@ -945,7 +945,7 @@ _XawMultiSave(w) Boolean #if NeedFunctionPrototypes _XawMultiSaveAsFile( - Widget w, + Widget w, _Xconst char* name) #else _XawMultiSaveAsFile(w, name) @@ -957,7 +957,7 @@ _XawMultiSaveAsFile(w, name) String mb_string; Boolean ret; - mb_string = StorePiecesInString( src ); + mb_string = StorePiecesInString( src ); if ( mb_string != 0 ) { ret = WriteToFile( mb_string, name ); @@ -979,7 +979,7 @@ _XawMultiSaveAsFile(w, name) ************************************************************/ static void -RemoveOldStringOrFile(src, checkString) +RemoveOldStringOrFile(src, checkString) MultiSrcObject src; Boolean checkString; { @@ -1005,12 +1005,12 @@ WriteToFile(string, name) String string, name; { int fd; - + if ( ((fd = creat(name, 0666)) == -1 ) || (write(fd, string, sizeof(unsigned char) * strlen(string)) == -1) ) return(FALSE); - if ( close(fd) == -1 ) + if ( close(fd) == -1 ) return(FALSE); return(TRUE); @@ -1103,12 +1103,12 @@ InitStringOrFile(src, newString) if (src->multi_src.length > src->multi_src.multi_length) src->multi_src.multi_length = src->multi_src.length; - if (src->multi_src.multi_length == MAGIC_VALUE) + if (src->multi_src.multi_length == MAGIC_VALUE) src->multi_src.piece_size = src->multi_src.length; else src->multi_src.piece_size = src->multi_src.multi_length + 1; } - + /*((TextWidget)src->object.parent)->text.lastPos = src->multi_src.length;*/ return(NULL); } @@ -1116,7 +1116,7 @@ InitStringOrFile(src, newString) /* * type is XawAsciiFile. */ - + src->multi_src.is_tempfile = FALSE; switch (src->text_src.edit_mode) { @@ -1157,7 +1157,7 @@ InitStringOrFile(src, newString) src->multi_src.string = XtNewString(src->multi_src.string); src->multi_src.allocated_string = TRUE; } - + if (!src->multi_src.is_tempfile) { if ((file = fopen(src->multi_src.string, open_mode)) != 0) { (void) fseek(file, (Off_t)0, 2); @@ -1166,14 +1166,14 @@ InitStringOrFile(src, newString) } else { String params[2]; Cardinal num_params = 2; - + params[0] = src->multi_src.string; params[1] = strerror(errno); XtAppWarningMsg(XtWidgetToApplicationContext((Widget)src), "openError", "multiSourceCreate", "XawWarning", "Cannot open file %s; %s", params, &num_params); } - } + } src->multi_src.length = 0; return((FILE *)NULL); #undef StrLen @@ -1182,8 +1182,8 @@ InitStringOrFile(src, newString) /* LoadPieces: This routine takes either the MB contents of open file `file' or the MB contents of string or the MB contents of src->multi_src.string and places them in Pieces in WC format. - -CAUTION: You must have src->multi_src.length set to file length bytes + +CAUTION: You must have src->multi_src.length set to file length bytes when src->multi_src.type == XawAsciiFile. src->multi_src.length must be the length of the parameter string if string is non-NULL. */ @@ -1200,38 +1200,38 @@ LoadPieces(src, file, string) int bytes = sizeof(wchar_t); char* temp_mb_holder = NULL; - /* - * This is tricky - the _XawTextMBtoWC converter uses its 3rd arg - * in as MB length, out as WC length. We want local_length to be - * WC count. + /* + * This is tricky - the _XawTextMBtoWC converter uses its 3rd arg + * in as MB length, out as WC length. We want local_length to be + * WC count. */ int local_length = src->multi_src.length; if (string != NULL) { - /* - * ASSERT: IF our caller passed a non-null string, THEN - * src->multi_src.length is currently string's * byte count, + /* + * ASSERT: IF our caller passed a non-null string, THEN + * src->multi_src.length is currently string's * byte count, * AND string is in a MB format. */ local_str = _XawTextMBToWC(d, (char *)string, &local_length); src->multi_src.length = (XawTextPosition) local_length; } else if (src->multi_src.type != XawAsciiFile) { - /* - * here, we are not changing the contents, just reloading, + /* + * here, we are not changing the contents, just reloading, * so don't change len... */ - local_length = src->multi_src.string ? + local_length = src->multi_src.string ? strlen( src->multi_src.string ) : 0; local_str = _XawTextMBToWC( d, (char*)src->multi_src.string, &local_length ); } else { if (src->multi_src.length != 0) { - temp_mb_holder = + temp_mb_holder = XtMalloc((unsigned)(src->multi_src.length + 1) * sizeof(unsigned char)); fseek(file, (Off_t)0, 0); - src->multi_src.length = fread (temp_mb_holder, - (Size_t)sizeof(unsigned char), + src->multi_src.length = fread (temp_mb_holder, + (Size_t)sizeof(unsigned char), (Size_t)src->multi_src.length, file); - if (src->multi_src.length <= 0) + if (src->multi_src.length <= 0) XtAppErrorMsg( XtWidgetToApplicationContext ((Widget) src), "readError", "multiSource", "XawError", "fread returned error.", NULL, NULL); @@ -1242,7 +1242,7 @@ LoadPieces(src, file, string) if ( local_str == 0 ) { String params[2]; Cardinal num_params; - static char err_text[] = + static char err_text[] = "<<< FILE CONTENTS NOT REPRESENTABLE IN THIS LOCALE >>>"; params[0] = XtName(XtParent((Widget)src)); @@ -1316,7 +1316,7 @@ AllocNewPiece(src, prev) piece->next = prev->next; prev->next = piece; } - + piece->prev = prev; return(piece); @@ -1328,7 +1328,7 @@ AllocNewPiece(src, prev) * Returns: none. */ -static void +static void FreeAllPieces(src) MultiSrcObject src; { @@ -1342,10 +1342,10 @@ FreeAllPieces(src) RemovePiece(src, first); } } - + /* Function Name: RemovePiece * Description: Removes a piece from the list. - * Arguments: + * Arguments: * piece - the piece to remove. * Returns: none. */ @@ -1389,12 +1389,12 @@ FindPiece(src, position, first) *first = temp; old_piece = piece; - if ((temp + piece->used) > position) + if ((temp + piece->used) > position) return(piece); } return(old_piece); /* if we run off the end the return the last piece */ } - + /* Function Name: BreakPiece * Description: Breaks a full piece into two new pieces. * Arguments: src - The MultiSrc Widget. @@ -1410,12 +1410,12 @@ BreakPiece(src, piece) MultiPiece* piece; { MultiPiece * new = AllocNewPiece(src, piece); - + new->text = (wchar_t*)XtMalloc(src->multi_src.piece_size * sizeof(wchar_t)); (void) wcsncpy(new->text, piece->text + HALF_PIECE, src->multi_src.piece_size - HALF_PIECE); piece->used = HALF_PIECE; - new->used = src->multi_src.piece_size - HALF_PIECE; + new->used = src->multi_src.piece_size - HALF_PIECE; } /* Convert string "XawAsciiString" and "XawAsciiFile" to quarks. */ diff --git a/src/Paned.c b/src/Paned.c index 361f4df..107355d 100644 --- a/src/Paned.c +++ b/src/Paned.c @@ -28,13 +28,13 @@ 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, +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 +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. +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 @@ -71,10 +71,10 @@ SOFTWARE. /* I don't know why Paned.c calls _XawImCallVendorShellExtResize, but... */ #ifdef XAW_INTERNATIONALIZATION -#include <X11/Xaw3d/XawImP.h> +#include <X11/Xaw3d/XawImP.h> #endif -typedef enum {UpLeftPane = 'U', LowRightPane = 'L', +typedef enum {UpLeftPane = 'U', LowRightPane = 'L', ThisBorderOnly = 'T', AnyPane = 'A' } Direction; #define NO_INDEX -100 @@ -115,7 +115,7 @@ static char defGripTranslations[] = static XtResource resources[] = { {XtNinternalBorderColor, XtCBorderColor, XtRPixel, sizeof(Pixel), - offset(internal_bp), XtRString, + offset(internal_bp), XtRString, (XtPointer) XtDefaultForeground}, {XtNinternalBorderWidth, XtCBorderWidth, XtRDimension, sizeof(Dimension), offset(internal_bw), XtRImmediate, (XtPointer) 1}, @@ -171,7 +171,7 @@ static XtResource subresources[] = { {XtNmax, XtCMax, XtRDimension, sizeof(Dimension), offset(max), XtRImmediate, (XtPointer) ~0}, {XtNpreferredPaneSize, XtCPreferredPaneSize, XtRDimension, - sizeof(Dimension), offset(preferred_size), + sizeof(Dimension), offset(preferred_size), XtRImmediate, (XtPointer) PANED_ASK_CHILD}, {XtNresizeToPreferred, XtCBoolean, XtRBoolean, sizeof(Boolean), offset(resize_to_pref), XtRImmediate, (XtPointer) FALSE}, @@ -385,14 +385,14 @@ Boolean vert; * 3) widget not its prefered height && * this change will bring it closer && * The user has not resized this pane. - * + * * If no widgets are found that fits all the rules then * rule #3 is broken. * If there are still no widgets found than * rule #2 is broken. * Rule #1 is never broken. * If no widgets are found then NULL is returned. - * + * * Arguments: pw - the paned widget. * paneindex - the index of the current pane. * dir - direction to search first. @@ -422,7 +422,7 @@ Boolean shrink; /* CONSTCOND */ while(TRUE) { Pane pane = PaneInfo(*childP); - + if ( (rules < 3 || SatisfiesRule3(pane, shrink)) && (rules < 2 || SatisfiesRule2(pane)) && (SatisfiesRule1(pane, shrink)) && @@ -441,7 +441,7 @@ Boolean shrink; * If we have come to and edge then reduce the rule set, and try again. * If we are reduced the rules to none, then return NULL. */ - + if ( (childP - pw->composite.children < 0) || (childP - pw->composite.children >= pw->paned.num_panes) ) { if (--rules < 1) /* less strict rules. */ @@ -466,7 +466,7 @@ Boolean shrink; return( (shrink && (pane->size != pane->min)) || (!shrink && (pane->size != pane->max)) ); } - + /* Function Name: StatisfiesRule2 * Description: check for to see if this pane satisfies rule 2. * Arguments: pane - the pane to check. @@ -479,7 +479,7 @@ Pane pane; { return(!pane->skip_adjust || pane->paned_adjusted_me); } - + /* Function Name: StatisfiesRule3 * Description: check for to see if this pane satisfies rule 3. * Arguments: pane - the pane to check. @@ -504,7 +504,7 @@ Boolean shrink; * Arguments: pw - the paned widget. * paneindex - the number of the pane border we are moving. * dir - the pane to move (either UpLeftPane or LowRightPane). - * sizeused - current amount of space used. + * sizeused - current amount of space used. * THIS VALUE IS USED AND RETURNED. * Returns: none. */ @@ -534,7 +534,7 @@ Direction dir; GetPaneStack(pw, shrink, &pane, &start_size); if (pane == NULL) { pane = ChoosePaneToResize(pw, paneindex, dir, shrink); - if (pane == NULL) + if (pane == NULL) return; /* no one to resize, give up. */ rule3_ok = SatisfiesRule3(pane, shrink); @@ -590,7 +590,7 @@ Direction dir; * last child. */ -static void +static void RefigureLocations(pw, paneindex, dir) PanedWidget pw; int paneindex; @@ -615,10 +615,10 @@ Direction dir; } sizeused -= (int) pw->paned.internal_bw; - if ( (dir != ThisBorderOnly) && (sizeused != pane_size) ) + if ( (dir != ThisBorderOnly) && (sizeused != pane_size) ) LoopAndRefigureChildren(pw, paneindex, dir, &sizeused); -/* +/* * If we still are not the right size, then tell the pane that * wanted to resize that it can't. */ @@ -633,7 +633,7 @@ Direction dir; AssignMin(pane->size, (int) pane->max); sizeused += pane->size - old; } - + /* * It is possible that the panes will not fit inside the vpaned widget, but * we have tried out best. @@ -653,7 +653,7 @@ Direction dir; * Returns: none. */ -static void +static void CommitNewLocations(pw) PanedWidget pw; { @@ -675,7 +675,7 @@ PanedWidget pw; changes.x = pw->core.width - pw->paned.grip_indent - grip->core.width - grip->core.border_width*2; changes.y = (*childP)->core.y + (*childP)->core.height - - grip->core.height/2 - grip->core.border_width + + grip->core.height/2 - grip->core.border_width + pw->paned.internal_bw/2; } } @@ -687,7 +687,7 @@ PanedWidget pw; if (HasGrip(*childP)) { /* Move and Display the Grip */ changes.x = (*childP)->core.x + (*childP)->core.width - - grip->core.width/2 - grip->core.border_width + + grip->core.width/2 - grip->core.border_width + pw->paned.internal_bw/2; changes.y = pw->core.height - pw->paned.grip_indent - grip->core.height - grip->core.border_width*2; @@ -695,7 +695,7 @@ PanedWidget pw; } /* - * This should match XtMoveWidget, except that we're also insuring the + * This should match XtMoveWidget, except that we're also insuring the * grip is Raised in the same request. */ @@ -725,7 +725,7 @@ PanedWidget pw; * NOTE: This is the resize Procedure for the Paned widget. */ -static void +static void RefigureLocationsAndCommit(w) Widget w; { @@ -753,8 +753,8 @@ GC gc; int on_loc, off_loc; unsigned int on_size, off_size; { - if (IsVert(pw)) - XFillRectangle(XtDisplay(pw), XtWindow(pw), gc, + if (IsVert(pw)) + XFillRectangle(XtDisplay(pw), XtWindow(pw), gc, off_loc, on_loc, off_size, on_size); else XFillRectangle(XtDisplay(pw), XtWindow(pw), gc, @@ -785,7 +785,7 @@ GC gc; if (pw->core.background_pixel == pw->paned.internal_bp) return; - off_loc = 0; + off_loc = 0; off_size = (unsigned int) PaneSize( (Widget) pw, !IsVert(pw) ); on_size = (unsigned int) pw->paned.internal_bw; @@ -797,7 +797,7 @@ GC gc; } } -/* +/* * This allows good reuse of code, as well as descriptive function names. */ @@ -829,7 +829,7 @@ Boolean erase; ForAllPanes(pw, childP) { pane = PaneInfo(*childP); if ( erase || (pane->olddelta != pane->delta) ) { - on_size = pw->paned.internal_bw; + on_size = pw->paned.internal_bw; if (!erase) { on_loc = PaneInfo(*childP)->olddelta - (int) on_size; @@ -847,7 +847,7 @@ Boolean erase; } } -/* +/* * This allows good reuse of code, as well as descriptive function names. */ @@ -870,24 +870,24 @@ XEvent *event; switch (event->xany.type) { case ButtonPress: - case ButtonRelease: + case ButtonRelease: x = event->xbutton.x_root; y = event->xbutton.y_root; break; case KeyPress: - case KeyRelease: + case KeyRelease: x = event->xkey.x_root; y = event->xkey.y_root; break; - case MotionNotify: + case MotionNotify: x = event->xmotion.x_root; y = event->xmotion.y_root; break; - default: + default: x = pw->paned.start_loc; y = pw->paned.start_loc; } - if (IsVert(pw)) + if (IsVert(pw)) return(y); return(x); } @@ -922,9 +922,9 @@ Direction dir; if (XtIsRealized(grip)) { if ( IsVert(pw) ) { - if (dir == UpLeftPane) + if (dir == UpLeftPane) cursor = pw->paned.adjust_upper_cursor; - else if (dir == LowRightPane) + else if (dir == LowRightPane) cursor = pw->paned.adjust_lower_cursor; else { if ( pw->paned.adjust_this_cursor == None) @@ -934,9 +934,9 @@ Direction dir; } } else { - if (dir == UpLeftPane) + if (dir == UpLeftPane) cursor = pw->paned.adjust_left_cursor; - else if (dir == LowRightPane) + else if (dir == LowRightPane) cursor = pw->paned.adjust_right_cursor; else { if (pw->paned.adjust_this_cursor == None) @@ -945,17 +945,17 @@ Direction dir; cursor = pw->paned.adjust_this_cursor; } } - + XDefineCursor(XtDisplay(grip), XtWindow(grip), cursor); } EraseInternalBorders(pw); - ForAllPanes(pw, childP) + ForAllPanes(pw, childP) PaneInfo(*childP)->olddelta = -99; } /* Function Name: MoveGripAdjustment - * Description: This routine moves all panes around when a grip is moved. + * Description: This routine moves all panes around when a grip is moved. * Arguments: pw - the paned widget. * grip - the grip that we are moving. * dir - the direction the pane we are interested is w.r.t the @@ -975,10 +975,10 @@ int loc; diff = loc - pw->paned.start_loc; - if (pw->paned.whichadd) + if (pw->paned.whichadd) add_size = PaneSize(pw->paned.whichadd, IsVert(pw) ) + diff; - if (pw->paned.whichsub) + if (pw->paned.whichsub) sub_size = PaneSize(pw->paned.whichsub, IsVert(pw) ) - diff; /* @@ -991,7 +991,7 @@ int loc; AssignMax(add_size, (int) PaneInfo(pw->paned.whichadd)->min); AssignMin(add_size, (int) PaneInfo(pw->paned.whichadd)->max); - if (add_size != old_add_size) + if (add_size != old_add_size) sub_size += old_add_size - add_size; old_sub_size = sub_size; @@ -1021,9 +1021,9 @@ PanedWidget pw; EraseTrackLines(pw); CommitNewLocations(pw); DrawInternalBorders(pw); - + /* - * Since the user selected this size then use it as the preferred size. + * Since the user selected this size then use it as the preferred size. */ if (pw->paned.whichadd) { @@ -1080,10 +1080,10 @@ XtPointer junk, callData; case 'S': /* Start adjustment */ pw->paned.resize_children_to_pref = FALSE; StartGripAdjustment(pw, grip, direction); - pw->paned.start_loc = loc; + pw->paned.start_loc = loc; break; - case 'M': + case 'M': MoveGripAdjustment(pw, grip, direction, loc); break; @@ -1118,14 +1118,14 @@ PanedWidget pw; /* * We only keep track of the first unmanaged pane. */ - if (unmanagedP == NULL) + if (unmanagedP == NULL) unmanagedP = childP; } else { /* must be a managed pane */ /* - * If an earlier widget was not a managed pane, then swap + * If an earlier widget was not a managed pane, then swap */ - if (unmanagedP != NULL) { + if (unmanagedP != NULL) { Widget child = *unmanagedP; *unmanagedP = *childP; *childP = child; @@ -1143,7 +1143,7 @@ PanedWidget pw; * Returns: none. */ -static void +static void ManageAndUnmanageGrips(pw) PanedWidget pw; { @@ -1155,13 +1155,13 @@ PanedWidget pw; managedP = managed_grips = (WidgetList) XtMalloc(alloc_size); unmanagedP = unmanaged_grips = (WidgetList) XtMalloc(alloc_size); - ForAllChildren(pw, childP) + ForAllChildren(pw, childP) if (IsPane(*childP) && HasGrip(*childP)) - if ( XtIsManaged(*childP) ) + if ( XtIsManaged(*childP) ) *managedP++ = PaneInfo(*childP)->grip; else *unmanagedP++ = PaneInfo(*childP)->grip; - + if (managedP != managed_grips) { *unmanagedP++ = *--managedP; /* Last grip is never managed */ XtManageChildren( managed_grips, (Cardinal)(managedP - managed_grips) ); @@ -1189,7 +1189,7 @@ Widget child; Arg arglist[2]; Cardinal num_args = 0; Cursor cursor; - + XtSetArg(arglist[num_args], XtNtranslations, pw->paned.grip_translations); num_args++; if ( (cursor = pw->paned.grip_cursor) == None ) @@ -1202,8 +1202,8 @@ Widget child; num_args++; PaneInfo(child)->grip = XtCreateWidget("grip", gripWidgetClass, (Widget)pw, arglist, num_args); - - XtAddCallback(PaneInfo(child)->grip, XtNcallback, + + XtAddCallback(PaneInfo(child)->grip, XtNcallback, HandleGrip, (XtPointer) child); } @@ -1222,18 +1222,18 @@ Widget w; XGCValues values; /* - * Draw pane borders in internal border color. + * Draw pane borders in internal border color. */ - values.foreground = pw->paned.internal_bp; + values.foreground = pw->paned.internal_bp; valuemask = GCForeground; pw->paned.normgc = XtGetGC(w, valuemask, &values); /* - * Erase pane borders with background color. + * Erase pane borders with background color. */ - values.foreground = pw->core.background_pixel; + values.foreground = pw->core.background_pixel; valuemask = GCForeground; pw->paned.invgc = XtGetGC(w, valuemask, &values); @@ -1243,7 +1243,7 @@ Widget w; values.function = GXinvert; values.plane_mask = pw->paned.internal_bp ^ pw->core.background_pixel; - values.subwindow_mode = IncludeInferiors; + values.subwindow_mode = IncludeInferiors; valuemask = GCPlaneMask | GCFunction | GCSubwindowMode; pw->paned.flipgc = XtGetGC(w, valuemask, &values); } @@ -1268,7 +1268,7 @@ Dimension off_size; (PaneInfo(*childP)->size == 0) || (PaneInfo(*childP)->resize_to_pref) ) { - if (PaneInfo(*childP)->preferred_size != PANED_ASK_CHILD) + if (PaneInfo(*childP)->preferred_size != PANED_ASK_CHILD) PaneInfo(*childP)->wp_size=PaneInfo(*childP)->preferred_size; else { if( vert ) { @@ -1280,13 +1280,13 @@ Dimension off_size; request.height = off_size; } - if ((XtQueryGeometry( *childP, &request, &reply ) + if ((XtQueryGeometry( *childP, &request, &reply ) == XtGeometryAlmost) && (reply.request_mode = (vert ? CWHeight : CWWidth))) PaneInfo(*childP)->wp_size = GetRequestInfo(&reply, vert); else PaneInfo(*childP)->wp_size = PaneSize(*childP, vert); - } + } PaneInfo(*childP)->size = PaneInfo(*childP)->wp_size; } @@ -1307,7 +1307,7 @@ PanedWidget pw; ForAllPanes(pw, childP) { Arg arglist[1]; Cursor cursor; - + if ( (cursor = pw->paned.grip_cursor) == None ) if ( IsVert(pw) ) cursor = pw->paned.v_grip_cursor; @@ -1320,7 +1320,7 @@ PanedWidget pw; } } } - + /************************************************************ * * Stack Manipulation routines (Private). @@ -1354,7 +1354,7 @@ Pane pane; * shrink - TRUE if we want to shrink this pane, * FALSE otherwise. * ** RETURNED ** pane - the pane that we are popping. - * ** RETURNED ** start_size - the size that this pane started at. + * ** RETURNED ** start_size - the size that this pane started at. * Returns: none. */ @@ -1365,8 +1365,8 @@ Boolean shrink; Pane * pane; int * start_size; { - if (pw->paned.stack == NULL) { - *pane = NULL; + if (pw->paned.stack == NULL) { + *pane = NULL; return; } @@ -1412,7 +1412,7 @@ PanedWidget pw; /************************************************************ * - * Semi-public routines. + * Semi-public routines. * ************************************************************/ @@ -1422,7 +1422,7 @@ PanedWidget pw; * Returns: none. */ -static void +static void ClassInitialize() { XawInitializeWidgetSet(); @@ -1431,8 +1431,8 @@ ClassInitialize() } /* The Geometry Manager only allows changes after Realize if - * allow_resize is True in the constraints record. - * + * allow_resize is True in the constraints record. + * * For vertically paned widgets: * * It only allows height changes, but offers the requested height @@ -1487,18 +1487,18 @@ XtWidgetGeometry *request, *reply; * a different on_size; */ - if (result != XtGeometryNo) - if (vert) + if (result != XtGeometryNo) + if (vert) pw->core.height = on_size; - else + else pw->core.width = on_size; - + RefigureLocations(pw, PaneIndex(w), AnyPane); -/* +/* * Set up reply struct and reset core on_size. */ - + if (vert) { pw->core.height = old_paned_size; reply->height = pane->size; @@ -1508,7 +1508,7 @@ XtWidgetGeometry *request, *reply; pw->core.width = old_paned_size; reply->height = off_size; reply->width = pane->size; - } + } /* * IF either of the following is true. @@ -1516,14 +1516,14 @@ XtWidgetGeometry *request, *reply; * o There was a "off_size" request and the new "off_size" is different * from that requested. * o There was no "off_size" request and the new "off_size" is different - * + * * o The "on_size" we will allow is different from that requested. - * + * * THEN: set almost */ if ( !((vert ? CWWidth : CWHeight) & mask)) - if (vert) + if (vert) request->width = w->core.width; else request->height = w->core.height; @@ -1539,8 +1539,8 @@ XtWidgetGeometry *request, *reply; if (almost) return XtGeometryAlmost; } else { - AdjustPanedSize(pw, PaneSize((Widget) pw, !vert), - (XtGeometryResult *)NULL, + AdjustPanedSize(pw, PaneSize((Widget) pw, !vert), + (XtGeometryResult *)NULL, (Dimension *)NULL, (Dimension *)NULL); CommitNewLocations( pw ); /* layout already refigured. */ } @@ -1563,7 +1563,7 @@ Cardinal *num_args; pw->paned.num_panes = 0; } -static void +static void Realize(w, valueMask, attributes) Widget w; Mask *valueMask; @@ -1592,7 +1592,7 @@ XSetWindowAttributes *attributes; pw->paned.resize_children_to_pref = FALSE; } /* Realize */ -static void +static void ReleaseGCs(w) Widget w; { @@ -1601,7 +1601,7 @@ Widget w; XtReleaseGC( w, pw->paned.normgc ); XtReleaseGC( w, pw->paned.invgc ); XtReleaseGC( w, pw->paned.flipgc ); -} +} static void InsertChild(w) Widget w; @@ -1618,7 +1618,7 @@ Widget w; if ( pane->show_grip == TRUE ) { CreateGrip(w); - if (pane->min == PANED_GRIP_SIZE) + if (pane->min == PANED_GRIP_SIZE) pane->min = PaneSize(pane->grip, IsVert((PanedWidget) XtParent(w))); } else { @@ -1636,7 +1636,7 @@ static void DeleteChild(w) Widget w; { /* remove the subwidget info and destroy the grip */ - + if ( IsPane(w) && HasGrip(w) ) XtDestroyWidget(PaneInfo(w)->grip); /* delete the child widget in the composite children list with the */ @@ -1668,10 +1668,10 @@ static void ChangeManaged(w) ManageAndUnmanageGrips(pw); pw->paned.recursively_called = False; - ResortChildren(pw); + ResortChildren(pw); pw->paned.num_panes = 0; - ForAllChildren(pw, childP) + ForAllChildren(pw, childP) if ( IsPane(*childP) ) if ( XtIsManaged(*childP) ) { Pane pane = PaneInfo(*childP); @@ -1686,15 +1686,15 @@ static void ChangeManaged(w) SetChildrenPrefSizes( (PanedWidget) w, size); /* - * ForAllPanes can now be used. + * ForAllPanes can now be used. */ - if ( PaneSize((Widget) pw, vert) == 0 ) - AdjustPanedSize(pw, size, (XtGeometryResult *)NULL, + if ( PaneSize((Widget) pw, vert) == 0 ) + AdjustPanedSize(pw, size, (XtGeometryResult *)NULL, (Dimension *)NULL, (Dimension *)NULL); - if (XtIsRealized( (Widget) pw)) - RefigureLocationsAndCommit( (Widget) pw); + if (XtIsRealized( (Widget) pw)) + RefigureLocationsAndCommit( (Widget) pw); } /* ChangeManaged */ @@ -1724,7 +1724,7 @@ Region region; /* unused. */ } /* ARGSUSED */ -static Boolean +static Boolean SetValues(old, request, new, args, num_args) Widget old, request, new; ArgList args; @@ -1749,7 +1749,7 @@ Cardinal *num_args; (old_pw->paned.h_grip_cursor != new_pw->paned.h_grip_cursor) ) { ChangeAllGripCursors(new_pw); } - + if ( IsVert(old_pw) != IsVert(new_pw)) { /* * We are fooling the paned widget into thinking that is needs to @@ -1770,12 +1770,12 @@ Cardinal *num_args; if (old_pw->paned.internal_bw != new_pw->paned.internal_bw) { AdjustPanedSize( new_pw, PaneSize(new, !IsVert(old_pw)), - (XtGeometryResult *)NULL, + (XtGeometryResult *)NULL, (Dimension *)NULL, (Dimension *)NULL); RefigureLocationsAndCommit(new); return(TRUE); /* We have done a full configuration, return.*/ } - + if ( (old_pw->paned.grip_indent != new_pw->paned.grip_indent) && (XtIsRealized(new)) ) { CommitNewLocations(new_pw); @@ -1787,7 +1787,7 @@ Cardinal *num_args; /* ARGSUSED */ -static Boolean +static Boolean PaneSetValues(old, request, new, args, num_args) Widget old, request, new; ArgList args; @@ -1828,7 +1828,7 @@ Cardinal *num_args; /************************************************************ * - * Public routines. + * Public routines. * ************************************************************/ @@ -1839,7 +1839,7 @@ Cardinal *num_args; * Returns: none. */ -void +void #if NeedFunctionPrototypes XawPanedSetMinMax(Widget widget, int min, int max) #else @@ -1862,7 +1862,7 @@ int min, max; * Returns: none. */ -void +void #if NeedFunctionPrototypes XawPanedGetMinMax(Widget widget, int *min, int *max) #else @@ -1878,14 +1878,14 @@ int *min, *max; } /* Function Name: XawPanedSetRefigureMode - * Description: Allows a flag to be set the will inhibit + * Description: Allows a flag to be set the will inhibit * the paned widgets relayout routine. * Arguments: w - the paned widget. * mode - if FALSE then inhibit refigure. * Returns: none. */ -void +void #if NeedFunctionPrototypes XawPanedSetRefigureMode(Widget w, #if NeedWidePrototypes @@ -1909,7 +1909,7 @@ Boolean mode; * Returns: the number of panes in the paned widget. */ -int +int #if NeedFunctionPrototypes XawPanedGetNumSub(Widget w) #else @@ -1927,7 +1927,7 @@ Widget w; * Returns: none. */ -void +void #if NeedFunctionPrototypes XawPanedAllowResize(Widget widget, #if NeedWidePrototypes diff --git a/src/Panner.c b/src/Panner.c index fce1781..d6d8808 100644 --- a/src/Panner.c +++ b/src/Panner.c @@ -44,7 +44,7 @@ extern double atof(char *); #if XtVersion >= 11006 -static char defaultTranslations[] = +static char defaultTranslations[] = "<Btn1Down>: start() \n\ <Btn1Motion>: move() \n\ <Btn1Up>: notify() stop() \n\ @@ -65,7 +65,7 @@ static char defaultTranslations[] = <Key>Home: page(0,0) \n\ :<Key>KP_Home: page(0,0)"; #else -static char defaultTranslations[] = +static char defaultTranslations[] = "<Btn1Down>: start() \n\ <Btn1Motion>: move() \n\ <Btn1Up>: notify() stop() \n\ @@ -111,7 +111,7 @@ static XtResource resources[] = { poff(default_scale), XtRImmediate, (XtPointer) PANNER_DEFAULT_SCALE }, { XtNrubberBand, XtCRubberBand, XtRBoolean, sizeof(Boolean), poff(rubber_band), XtRImmediate, (XtPointer) FALSE }, - { XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), + { XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), poff(foreground), XtRString, (XtPointer) XtDefaultBackground }, { XtNinternalSpace, XtCInternalSpace, XtRDimension, sizeof(Dimension), poff(internal_border), XtRImmediate, (XtPointer) 4 }, @@ -502,7 +502,7 @@ static int parse_page_string (s, pagesize, canvassize, relative) XmuLocatePixmapFile (pw->core.screen, pw->panner.stipple_name, \ pw->panner.shadow_color, pw->core.background_pixel, \ pw->core.depth, NULL, 0, NULL, NULL, NULL, NULL) - + #define PIXMAP_OKAY(pm) ((pm) != None && (pm) != XtUnspecifiedPixmap) @@ -604,9 +604,9 @@ static void Redisplay (gw, event, region) int kx = pw->panner.knob_x + pad, ky = pw->panner.knob_y + pad; pw->panner.tmp.showing = FALSE; - XClearArea (XtDisplay(pw), XtWindow(pw), - (int) pw->panner.last_x - ((int) lw) + pad, - (int) pw->panner.last_y - ((int) lw) + pad, + XClearArea (XtDisplay(pw), XtWindow(pw), + (int) pw->panner.last_x - ((int) lw) + pad, + (int) pw->panner.last_y - ((int) lw) + pad, (unsigned int) (pw->panner.knob_width + extra), (unsigned int) (pw->panner.knob_height + extra), False); @@ -619,7 +619,7 @@ static void Redisplay (gw, event, region) if (lw) { XDrawRectangle (dpy, w, pw->panner.shadow_gc, kx, ky, - (unsigned int) (pw->panner.knob_width - 1), + (unsigned int) (pw->panner.knob_width - 1), (unsigned int) (pw->panner.knob_height - 1)); } @@ -909,14 +909,14 @@ static void ActionNotify (gw, event, params, num_params) pw->panner.vaspect + 0.5); if (!pw->panner.allow_off) { Position tmp; - + if (pw->panner.slider_x > - (tmp = (((Position) pw->panner.canvas_width) - + (tmp = (((Position) pw->panner.canvas_width) - ((Position) pw->panner.slider_width)))) pw->panner.slider_x = tmp; if (pw->panner.slider_x < 0) pw->panner.slider_x = 0; if (pw->panner.slider_y > - (tmp = (((Position) pw->panner.canvas_height) - + (tmp = (((Position) pw->panner.canvas_height) - ((Position) pw->panner.slider_height)))) pw->panner.slider_y = tmp; if (pw->panner.slider_y < 0) pw->panner.slider_y = 0; diff --git a/src/Porthole.c b/src/Porthole.c index 7840827..904e0f2 100644 --- a/src/Porthole.c +++ b/src/Porthole.c @@ -23,7 +23,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. * * Author: Jim Fulton, MIT X Consortium - * + * * This widget is a trivial clipping widget. It is typically used with a * panner or scrollbar to navigate. */ @@ -230,7 +230,7 @@ static void Resize (gw) Position x, y; Dimension width, height; - layout_child (pw, child, (XtWidgetGeometry *)NULL, + layout_child (pw, child, (XtWidgetGeometry *)NULL, &x, &y, &width, &height); XtConfigureWidget (child, x, y, width, height, (Dimension) 0); } @@ -262,7 +262,7 @@ static XtGeometryResult QueryGeometry (gw, intended, preferred) else return XtGeometryAlmost; #undef SIZEONLY - } + } return XtGeometryNo; } @@ -355,7 +355,7 @@ static void ChangeManaged (gw) (void) XtMakeGeometryRequest (gw, &retgeom, (XtWidgetGeometry *)NULL); } } - + XtResizeWidget (child, Max (child->core.width, pw->core.width), Max (child->core.height, pw->core.height), 0); diff --git a/src/Repeater.c b/src/Repeater.c index f752ae7..7634f08 100644 --- a/src/Repeater.c +++ b/src/Repeater.c @@ -23,7 +23,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. * * Author: Jim Fulton, MIT X Consortium - * + * * This widget is used for press-and-hold style buttons. */ @@ -52,7 +52,7 @@ static void tic(); /* clock timeout */ /* * Translations to give user interface of press-notify...-release_or_leave */ -static char defaultTranslations[] = +static char defaultTranslations[] = "<EnterWindow>: highlight() \n\ <LeaveWindow>: unhighlight() \n\ <Btn1Down>: set() start() \n\ @@ -228,7 +228,7 @@ static Boolean SetValues (gcur, greq, gnew, args, num_args) Boolean redisplay = FALSE; if (cur->repeater.minimum_delay != new->repeater.minimum_delay) { - if (new->repeater.next_delay < new->repeater.minimum_delay) + if (new->repeater.next_delay < new->repeater.minimum_delay) new->repeater.next_delay = new->repeater.minimum_delay; } @@ -251,7 +251,7 @@ static void ActionStart (gw, event, params, num_params) RepeaterWidget rw = (RepeaterWidget) gw; CLEAR_TIMEOUT (rw); - if (rw->repeater.start_callbacks) + if (rw->repeater.start_callbacks) XtCallCallbackList (gw, rw->repeater.start_callbacks, (XtPointer)NULL); DO_CALLBACK (rw); @@ -270,7 +270,7 @@ static void ActionStop (gw, event, params, num_params) RepeaterWidget rw = (RepeaterWidget) gw; CLEAR_TIMEOUT ((RepeaterWidget) gw); - if (rw->repeater.stop_callbacks) + if (rw->repeater.stop_callbacks) XtCallCallbackList (gw, rw->repeater.stop_callbacks, (XtPointer)NULL); } diff --git a/src/Scrollbar.c b/src/Scrollbar.c index 95ef5e5..3351c3e 100644 --- a/src/Scrollbar.c +++ b/src/Scrollbar.c @@ -241,10 +241,10 @@ static void ClassInitialize() #define MARGIN(sbw) (sbw)->threeD.shadow_width #endif -/* - The original Xaw Scrollbar's FillArea *really* relied on the fact that the +/* + The original Xaw Scrollbar's FillArea *really* relied on the fact that the server was going to clip at the window boundaries; so the logic was really - rather sloppy. To avoid drawing over the shadows and the arrows requires + rather sloppy. To avoid drawing over the shadows and the arrows requires some extra care... Hope I didn't make any mistakes. */ static void FillArea (sbw, top, bottom, fill) @@ -256,9 +256,9 @@ static void FillArea (sbw, top, bottom, fill) int sw, margin, floor; int lx, ly, lw, lh; - if (bottom <= 0 || bottom <= top) + if (bottom <= 0 || bottom <= top) return; - if ((sw = sbw->threeD.shadow_width) < 0) + if ((sw = sbw->threeD.shadow_width) < 0) sw = 0; margin = MARGIN (sbw); floor = sbw->scrollbar.length - margin; @@ -278,12 +278,12 @@ static void FillArea (sbw, top, bottom, fill) } if (lh <= 0 || lw <= 0) return; if (fill) { - XFillRectangle(XtDisplay((Widget) sbw), XtWindow((Widget) sbw), - sbw->scrollbar.gc, + XFillRectangle(XtDisplay((Widget) sbw), XtWindow((Widget) sbw), + sbw->scrollbar.gc, lx, ly, (unsigned int) lw, (unsigned int) lh); } else { - XClearArea (XtDisplay((Widget) sbw), XtWindow((Widget) sbw), - lx, ly, (unsigned int) lw, (unsigned int) lh, + XClearArea (XtDisplay((Widget) sbw), XtWindow((Widget) sbw), + lx, ly, (unsigned int) lw, (unsigned int) lh, FALSE); } } @@ -294,21 +294,21 @@ static void FillArea (sbw, top, bottom, fill) static void PaintThumb (sbw, event) ScrollbarWidget sbw; - XEvent *event; + XEvent *event; { Dimension s = sbw->threeD.shadow_width; Position oldtop = sbw->scrollbar.topLoc; Position oldbot = oldtop + sbw->scrollbar.shownLength; Dimension margin = MARGIN (sbw); Dimension tzl = sbw->scrollbar.length - margin - margin; - Position newtop, newbot; + Position newtop, newbot; Position floor = sbw->scrollbar.length - margin; newtop = margin + (int)(tzl * sbw->scrollbar.top); newbot = newtop + (int)(tzl * sbw->scrollbar.shown); if (sbw->scrollbar.shown < 1.) newbot++; if (newbot < newtop + (int)sbw->scrollbar.min_thumb + - 2 * (int)sbw->threeD.shadow_width) + 2 * (int)sbw->threeD.shadow_width) newbot = newtop + sbw->scrollbar.min_thumb + 2 * sbw->threeD.shadow_width; if ( newbot >= floor ) { @@ -321,31 +321,31 @@ static void PaintThumb (sbw, event) if (XtIsRealized ((Widget) sbw)) { /* 3D thumb wanted ? */ - if (s) + if (s) { if (newtop < oldtop) FillArea(sbw, oldtop, oldtop + s, 0); if (newtop > oldtop) FillArea(sbw, oldtop, MIN(newtop, oldbot), 0); if (newbot < oldbot) FillArea(sbw, MAX(newbot, oldtop), oldbot, 0); if (newbot > oldbot) FillArea(sbw, oldbot - s, oldbot, 0); - if (sbw->scrollbar.orientation == XtorientHorizontal) + if (sbw->scrollbar.orientation == XtorientHorizontal) { _ShadowSurroundedBox((Widget)sbw, (ThreeDWidget)sbw, newtop, s, newbot, sbw->core.height - s, sbw->threeD.relief, TRUE); } - else + else { _ShadowSurroundedBox((Widget)sbw, (ThreeDWidget)sbw, s, newtop, sbw->core.width - s, newbot, sbw->threeD.relief, TRUE); } } - else + else { - /* - Note to Mitch: FillArea is (now) correctly implemented to - not draw over shadows or the arrows. Therefore setting clipmasks + /* + Note to Mitch: FillArea is (now) correctly implemented to + not draw over shadows or the arrows. Therefore setting clipmasks doesn't seem to be necessary. Correct me if I'm wrong! */ if (newtop < oldtop) FillArea(sbw, newtop, MIN(newbot, oldtop), 1); @@ -375,7 +375,7 @@ static void PaintArrows (sbw) Window win = XtWindow (sbw); GC top = sbw->threeD.top_shadow_GC; GC bot = sbw->threeD.bot_shadow_GC; - + if (XtIsRealized ((Widget) sbw)) { /* 3D arrows? @@ -426,7 +426,7 @@ static void PaintArrows (sbw) pt[0].x = 0; pt[0].y = tm1; pt[1].x = t; pt[1].y = tm1; pt[2].x = t2; pt[2].y = 0; - + pt[3].x = 0; pt[3].y = lp1; pt[4].x = t; pt[4].y = lp1; pt[5].x = t2; pt[5].y = l; @@ -442,12 +442,12 @@ static void PaintArrows (sbw) } } /* draw the up/left arrow */ - XFillPolygon (dpy, win, sbw->scrollbar.gc, - pt, 3, + XFillPolygon (dpy, win, sbw->scrollbar.gc, + pt, 3, Convex, CoordModeOrigin); /* draw the down/right arrow */ - XFillPolygon (dpy, win, sbw->scrollbar.gc, - pt+3, 3, + XFillPolygon (dpy, win, sbw->scrollbar.gc, + pt+3, 3, Convex, CoordModeOrigin); } } @@ -473,7 +473,7 @@ static void Destroy (w) /* Function Name: CreateGC * Description: Creates the GC. * Arguments: w - the scrollbar widget. - * Returns: none. + * Returns: none. */ static void CreateGC (w) @@ -485,7 +485,7 @@ static void CreateGC (w) unsigned int depth = 1; if (sbw->scrollbar.thumb == XtUnspecifiedPixmap) { - sbw->scrollbar.thumb = XmuCreateStippledPixmap (XtScreen(w), + sbw->scrollbar.thumb = XmuCreateStippledPixmap (XtScreen(w), (Pixel) 1, (Pixel) 0, depth); } else if (sbw->scrollbar.thumb != None) { Window root; @@ -580,10 +580,10 @@ static void Realize (w, valueMask, attributes) XtVaSetValues (w, XtNcursor, sbw->scrollbar.inactiveCursor, NULL); #endif - /* - * The Simple widget actually stuffs the value in the valuemask. + /* + * The Simple widget actually stuffs the value in the valuemask. */ - + (*scrollbarWidgetClass->core_class.superclass->core_class.realize) (w, valueMask, attributes); } @@ -666,7 +666,7 @@ static void Redisplay (w, event, region) XRectInRegion (region, x, y, width, height) != RectangleOut) { /* Forces entire thumb to be painted. */ sbw->scrollbar.topLoc = -(sbw->scrollbar.length + 1); - PaintThumb (sbw, event); + PaintThumb (sbw, event); } #ifdef XAW_ARROW_SCROLLBARS /* we'd like to be region aware here!!!! */ @@ -687,23 +687,23 @@ static Boolean CompareEvents (oldEvent, newEvent) switch (newEvent->type) { case MotionNotify: - Check(xmotion.state); + Check(xmotion.state); break; case ButtonPress: case ButtonRelease: Check(xbutton.state); - Check(xbutton.button); + Check(xbutton.button); break; case KeyPress: case KeyRelease: Check(xkey.state); - Check(xkey.keycode); + Check(xkey.keycode); break; case EnterNotify: case LeaveNotify: Check(xcrossing.mode); Check(xcrossing.detail); - Check(xcrossing.state); + Check(xcrossing.state); break; } #undef Check @@ -752,23 +752,23 @@ static void ExtractPosition (event, x, y) { switch( event->type ) { case MotionNotify: - *x = event->xmotion.x; - *y = event->xmotion.y; + *x = event->xmotion.x; + *y = event->xmotion.y; break; case ButtonPress: case ButtonRelease: - *x = event->xbutton.x; - *y = event->xbutton.y; + *x = event->xbutton.x; + *y = event->xbutton.y; break; case KeyPress: case KeyRelease: - *x = event->xkey.x; - *y = event->xkey.y; + *x = event->xkey.x; + *y = event->xkey.y; break; case EnterNotify: case LeaveNotify: - *x = event->xcrossing.x; - *y = event->xcrossing.y; + *x = event->xcrossing.x; + *y = event->xcrossing.y; break; default: *x = 0; *y = 0; @@ -812,7 +812,7 @@ static void RepeatNotify (client_data, idp) if (sbw->scrollbar.scroll_mode == 1) call_data = -call_data; XtCallCallbacks((Widget)sbw, XtNscrollProc, (XtPointer) call_data); - sbw->scrollbar.timer_id = + sbw->scrollbar.timer_id = XtAppAddTimeOut(XtWidgetToApplicationContext((Widget)sbw), (unsigned long) 150, RepeatNotify, @@ -832,7 +832,7 @@ static void StartScroll (w, event, params, num_params ) char direction; if (sbw->scrollbar.direction != 0) return; /* if we're already scrolling */ - if (*num_params > 0) + if (*num_params > 0) direction = *params[0]; else direction = 'C'; @@ -841,24 +841,24 @@ static void StartScroll (w, event, params, num_params ) switch (direction) { case 'B': - case 'b': + case 'b': cursor = (sbw->scrollbar.orientation == XtorientVertical) ? sbw->scrollbar.downCursor - : sbw->scrollbar.rightCursor; + : sbw->scrollbar.rightCursor; break; case 'F': case 'f': cursor = (sbw->scrollbar.orientation == XtorientVertical) ? sbw->scrollbar.upCursor - : sbw->scrollbar.leftCursor; + : sbw->scrollbar.leftCursor; break; case 'C': case 'c': cursor = (sbw->scrollbar.orientation == XtorientVertical) ? sbw->scrollbar.rightCursor - : sbw->scrollbar.upCursor; + : sbw->scrollbar.upCursor; break; - default: + default: return; /* invalid invocation */ } XtVaSetValues (w, XtNcursor, cursor, NULL); @@ -880,7 +880,7 @@ static int InRange(num, small, big) #endif /* - * Same as above, but for floating numbers. + * Same as above, but for floating numbers. */ static float FloatInRange(num, small, big) @@ -894,15 +894,15 @@ static float FloatInRange(num, small, big) static void NotifyScroll (w, event, params, num_params) Widget w; XEvent *event; - String *params; - Cardinal *num_params; + String *params; + Cardinal *num_params; { ScrollbarWidget sbw = (ScrollbarWidget) w; int call_data; Position x, y; if (sbw->scrollbar.scroll_mode == 2 /* if scroll continuous */ - || LookAhead (w, event)) + || LookAhead (w, event)) return; ExtractPosition (event, &x, &y); @@ -912,7 +912,7 @@ static void NotifyScroll (w, event, params, num_params) call_data = -MAX (A_FEW_PIXELS, sbw->scrollbar.length / 20); XtCallCallbacks (w, XtNscrollProc, (XtPointer)(call_data)); /* establish autoscroll */ - sbw->scrollbar.timer_id = + sbw->scrollbar.timer_id = XtAppAddTimeOut (XtWidgetToApplicationContext (w), (unsigned long) 300, RepeatNotify, (XtPointer)w); sbw->scrollbar.scroll_mode = 1; @@ -922,7 +922,7 @@ static void NotifyScroll (w, event, params, num_params) XtCallCallbacks (w, XtNscrollProc, (XtPointer)(call_data)); /* establish autoscroll */ sbw->scrollbar.timer_id = - XtAppAddTimeOut (XtWidgetToApplicationContext (w), + XtAppAddTimeOut (XtWidgetToApplicationContext (w), (unsigned long) 300, RepeatNotify, (XtPointer)w); sbw->scrollbar.scroll_mode = 3; } else if (PICKLENGTH (sbw, x, y) < sbw->scrollbar.topLoc) { @@ -933,7 +933,7 @@ static void NotifyScroll (w, event, params, num_params) /* handle zone "below" the thumb */ call_data = sbw->scrollbar.length; XtCallCallbacks (w, XtNscrollProc, (XtPointer)(call_data)); - } else + } else { /* handle the thumb in the motion notify action */ } @@ -953,7 +953,7 @@ static void NotifyScroll (w, event, params, num_params) if (sbw->scrollbar.direction == 0) return; /* if no StartScroll */ if (LookAhead (w, event)) return; - if (*num_params > 0) + if (*num_params > 0) style = *params[0]; else style = 'P'; @@ -962,23 +962,23 @@ static void NotifyScroll (w, event, params, num_params) case 'P': /* Proportional */ case 'p': ExtractPosition (event, &x, &y); - call_data = - InRange (PICKLENGTH (sbw, x, y), 0, (int) sbw->scrollbar.length); + call_data = + InRange (PICKLENGTH (sbw, x, y), 0, (int) sbw->scrollbar.length); break; case 'F': /* FullLength */ - case 'f': - call_data = sbw->scrollbar.length; + case 'f': + call_data = sbw->scrollbar.length; break; } switch (sbw->scrollbar.direction) { case 'B': - case 'b': + case 'b': call_data = -call_data; /* fall through */ case 'F': - case 'f': + case 'f': XtCallCallbacks (w, XtNscrollProc, (XtPointer)call_data); break; @@ -1125,14 +1125,14 @@ static void NotifyThumb (w, event, params, num_params ) /************************************************************ * - * Public routines. + * Public routines. * ************************************************************/ /* Set the scroll bar to the given location. */ #if NeedFunctionPrototypes -void XawScrollbarSetThumb (Widget w, +void XawScrollbarSetThumb (Widget w, #if NeedWidePrototypes double top, double shown) #else @@ -1147,7 +1147,7 @@ void XawScrollbarSetThumb (w, top, shown) ScrollbarWidget sbw = (ScrollbarWidget) w; #ifdef WIERD - fprintf(stderr,"< XawScrollbarSetThumb w=%p, top=%f, shown=%f\n", + fprintf(stderr,"< XawScrollbarSetThumb w=%p, top=%f, shown=%f\n", w,top,shown); #endif diff --git a/src/Simple.c b/src/Simple.c index 05585b8..6a70ffe 100644 --- a/src/Simple.c +++ b/src/Simple.c @@ -28,13 +28,13 @@ 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, +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 +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. +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 @@ -125,7 +125,7 @@ static void ClassInitialize() {XtWidgetBaseOffset, (XtPointer) XtOffsetOf(WidgetRec, core.screen), sizeof(Screen *)}, {XtResourceString, (XtPointer) XtNpointerColor, sizeof(Pixel)}, - {XtResourceString, (XtPointer) XtNpointerColorBackground, + {XtResourceString, (XtPointer) XtNpointerColorBackground, sizeof(Pixel)}, {XtWidgetBaseOffset, (XtPointer) XtOffsetOf(WidgetRec, core.colormap), sizeof(Colormap)} @@ -133,7 +133,7 @@ static void ClassInitialize() XawInitializeWidgetSet(); XtSetTypeConverter( XtRString, XtRColorCursor, XmuCvtStringToColorCursor, - convertArg, XtNumber(convertArg), + convertArg, XtNumber(convertArg), XtCacheByDisplay, (XtDestructor)NULL); } @@ -170,7 +170,7 @@ static void Realize(w, valueMask, attributes) if (((SimpleWidget)w)->simple.insensitive_border == None) ((SimpleWidget)w)->simple.insensitive_border = XmuCreateStippledPixmap(XtScreen(w), - w->core.border_pixel, + w->core.border_pixel, w->core.background_pixel, w->core.depth); border_pixmap = w->core.border_pixmap; @@ -206,7 +206,7 @@ Widget w; SimpleWidget simple = (SimpleWidget) w; XrmValue from, to; Cursor cursor; - + if (simple->simple.cursor_name == NULL) return; @@ -217,9 +217,9 @@ Widget w; to.addr = (XPointer) &cursor; if (XtConvertAndStore(w, XtRString, &from, XtRColorCursor, &to)) { - if ( cursor != None) + if ( cursor != None) simple->simple.cursor = cursor; - } + } else { XtAppErrorMsg(XtWidgetToApplicationContext(w), "convertFailed","ConvertCursor","XawError", @@ -251,7 +251,7 @@ static Boolean SetValues(current, request, new, args, num_args) if (s_old->simple.cursor != s_new->simple.cursor) { new_cursor = TRUE; } - + /* * We are not handling the string cursor_name correctly here. */ @@ -266,7 +266,7 @@ static Boolean SetValues(current, request, new, args, num_args) if (new_cursor && XtIsRealized(new)) XDefineCursor(XtDisplay(new), XtWindow(new), s_new->simple.cursor); - return False; + return False; } @@ -279,13 +279,13 @@ static Boolean ChangeSensitive(w) XSetWindowBorderPixmap( XtDisplay(w), XtWindow(w), w->core.border_pixmap ); else - XSetWindowBorder( XtDisplay(w), XtWindow(w), + XSetWindowBorder( XtDisplay(w), XtWindow(w), w->core.border_pixel ); else { if (((SimpleWidget)w)->simple.insensitive_border == None) ((SimpleWidget)w)->simple.insensitive_border = XmuCreateStippledPixmap(XtScreen(w), - w->core.border_pixel, + w->core.border_pixel, w->core.background_pixel, w->core.depth); XSetWindowBorderPixmap( XtDisplay(w), XtWindow(w), diff --git a/src/SimpleMenu.c b/src/SimpleMenu.c index 7d177c1..e1b9169 100644 --- a/src/SimpleMenu.c +++ b/src/SimpleMenu.c @@ -29,7 +29,7 @@ in this Software without prior written authorization from the X Consortium. * Date: April 3, 1989 * * By: Chris D. Peterson - * MIT X Consortium + * MIT X Consortium * kit@expo.lcs.mit.edu */ @@ -53,7 +53,7 @@ in this Software without prior written authorization from the X Consortium. #define offset(field) XtOffsetOf(SimpleMenuRec, simple_menu.field) -static XtResource resources[] = { +static XtResource resources[] = { /* * Label Resources. @@ -93,21 +93,21 @@ static XtResource resources[] = { {XtNpopupOnEntry, XtCPopupOnEntry, XtRWidget, sizeof(Widget), offset(popup_entry), XtRWidget, NULL}, {XtNbackingStore, XtCBackingStore, XtRBackingStore, sizeof (int), - offset(backing_store), + offset(backing_store), XtRImmediate, (XtPointer) (Always + WhenMapped + NotUseful)}, {XtNjumpScroll, XtCJumpScroll, XtRInt, sizeof(int), offset(jump_val), XtRImmediate, (XtPointer)1}, -}; +}; #undef offset static char defaultTranslations[] = "<EnterWindow>: highlight() \n\ <LeaveWindow>: unhighlight() \n\ <BtnMotion>: highlight() \n\ - <BtnUp>: notify() unhighlight() popdown()"; + <BtnUp>: notify() unhighlight() popdown()"; /* - * Semi Public function definitions. + * Semi Public function definitions. */ static void Redisplay(), Realize(), Resize(), ChangeManaged(); @@ -123,7 +123,7 @@ static void PopupCB(), PopupSubMenu(), PopdownSubMenu(); static void Highlight(), Unhighlight(), Notify(), PositionMenuAction(); static void Popdown(); -/* +/* * Private Function Definitions. */ @@ -142,7 +142,7 @@ static XtActionsRec actionsList[] = {"unhighlight", Unhighlight}, {"popdown", Popdown} }; - + static CompositeClassExtensionRec extension_rec = { /* next_extension */ NULL, /* record_type */ NULLQUARK, @@ -152,7 +152,7 @@ static CompositeClassExtensionRec extension_rec = { }; #define superclass (&overrideShellClassRec) - + SimpleMenuClassRec simpleMenuClassRec = { { /* superclass */ (WidgetClass) superclass, @@ -169,7 +169,7 @@ SimpleMenuClassRec simpleMenuClassRec = { /* resources */ resources, /* resource_count */ XtNumber(resources), /* xrm_class */ NULLQUARK, - /* compress_motion */ TRUE, + /* compress_motion */ TRUE, /* compress_exposure */ TRUE, /* compress_enterleave*/ TRUE, /* visible_interest */ FALSE, @@ -178,8 +178,8 @@ SimpleMenuClassRec simpleMenuClassRec = { /* expose */ Redisplay, /* set_values */ SetValues, /* set_values_hook */ SetValuesHook, - /* set_values_almost */ XtInheritSetValuesAlmost, - /* get_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, /* accept_focus */ NULL, /* intrinsics version */ XtVersion, /* callback offsets */ NULL, @@ -237,7 +237,7 @@ ClassInitialize() /* Function Name: ClassInitialize * Description: Class Part Initialize routine, called for every - * subclass. Makes sure that the subclasses pick up + * subclass. Makes sure that the subclasses pick up * the extension record. * Arguments: wc - the widget class of the subclass. * Returns: none. @@ -288,7 +288,7 @@ Cardinal *num_args; XtAddCallback(new, XtNpopupCallback, PopupCB, NULL); - if (smw->simple_menu.label_class == NULL) + if (smw->simple_menu.label_class == NULL) smw->simple_menu.label_class = smeBSBObjectClass; if (smw->simple_menu.label_string != NULL) @@ -322,7 +322,7 @@ Cardinal *num_args; * Description: Redisplays the contents of the widget. * Arguments: w - the simple menu widget. * event - the X event that caused this redisplay. - * region - the region the needs to be repainted. + * region - the region the needs to be repainted. * Returns: none. */ @@ -383,7 +383,7 @@ Region region; point[1].y = s + SMW_ARROW_SIZE; point[2].x = (*entry)->rectangle.width / 2 + SMW_ARROW_SIZE / 2; point[2].y = s + SMW_ARROW_SIZE; - XFillPolygon(XtDisplay(w), smw->core.window, + XFillPolygon(XtDisplay(w), smw->core.window, tdw->threeD.bot_shadow_GC, point, 3, Convex, CoordModeOrigin); @@ -420,7 +420,7 @@ Region region; } /* - if (region != NULL) + if (region != NULL) switch (XRectInRegion(region, (int)(*entry)->rectangle.x, (int)(*entry)->rectangle.y, (unsigned int)(*entry)->rectangle.width, @@ -472,7 +472,7 @@ XSetWindowAttributes * attrs; else *mask &= ~CWBackingStore; - /* check if the menu is too big */ + /* check if the menu is too big */ if (smw->core.height >= HeightOfScreen(XtScreen(w))) { smw->simple_menu.too_tall = TRUE; smw->core.height = HeightOfScreen(XtScreen(w)); @@ -525,9 +525,9 @@ Cardinal *num_args; SimpleMenuWidget smw_old = (SimpleMenuWidget) current; SimpleMenuWidget smw_new = (SimpleMenuWidget) new; Boolean ret_val = FALSE, layout = FALSE; - + if (!XtIsRealized(current)) return(FALSE); - + if (!smw_new->simple_menu.recursive_set_values) { if (smw_new->core.width != smw_old->core.width) { smw_new->simple_menu.menu_width = (smw_new->core.width != 0); @@ -542,25 +542,25 @@ Cardinal *num_args; if (smw_old->simple_menu.cursor != smw_new->simple_menu.cursor) XDefineCursor(XtDisplay(new), XtWindow(new), smw_new->simple_menu.cursor); - - if (smw_old->simple_menu.label_string !=smw_new->simple_menu.label_string) + + if (smw_old->simple_menu.label_string !=smw_new->simple_menu.label_string) if (smw_new->simple_menu.label_string == NULL) /* Destroy. */ XtDestroyWidget((Widget) smw_old->simple_menu.label); else if (smw_old->simple_menu.label_string == NULL) /* Create. */ CreateLabel(new); else { /* Change. */ Arg arglist[1]; - + XtSetArg(arglist[0], XtNlabel, smw_new->simple_menu.label_string); XtSetValues((Widget) smw_new->simple_menu.label, arglist, ONE); } - + if (smw_old->simple_menu.label_class != smw_new->simple_menu.label_class) XtAppWarning(XtWidgetToApplicationContext(new), "No Dynamic class change of the SimpleMenu Label."); - + if ((smw_old->simple_menu.top_margin != smw_new->simple_menu.top_margin) || - (smw_old->simple_menu.bottom_margin != + (smw_old->simple_menu.bottom_margin != smw_new->simple_menu.bottom_margin) /* filler................. */ ) { layout = TRUE; ret_val = TRUE; @@ -591,7 +591,7 @@ Cardinal *num_args; * Returns: none */ -/* +/* * If the user actually passed a width and height to the widget * then this MUST be used, rather than our newly calculated width and * height. @@ -605,10 +605,10 @@ Cardinal *num_args; { Cardinal i; Dimension width, height; - + width = w->core.width; height = w->core.height; - + for ( i = 0 ; i < *num_args ; i++) { if ( streq(arglist[i].name, XtNwidth) ) width = (Dimension) arglist[i].value; @@ -671,7 +671,7 @@ XtWidgetGeometry * request, * reply; if ( mode & XtCWQueryOnly ) { entry->rectangle.width = old_width; - entry->rectangle.height = old_height; + entry->rectangle.height = old_height; } else { /* Actually perform the layout */ @@ -681,11 +681,11 @@ XtWidgetGeometry * request, * reply; } else { entry->rectangle.width = old_width; - entry->rectangle.height = old_height; + entry->rectangle.height = old_height; if ( ((reply->width == request->width) && !(mode & CWHeight)) || ((reply->height == request->height) && !(mode & CWWidth)) || - ((reply->width == request->width) && + ((reply->width == request->width) && (reply->height == request->height)) ) answer = XtGeometryNo; else { @@ -716,10 +716,10 @@ Widget w; /************************************************************ * * Global Action Routines. - * + * * These actions routines will be added to the application's - * global action list. - * + * global action list. + * ************************************************************/ /* Function Name: PositionMenuAction @@ -738,7 +738,7 @@ Widget w; XEvent * event; String * params; Cardinal * num_params; -{ +{ Widget menu; XPoint loc; @@ -758,7 +758,7 @@ Cardinal * num_params; XtAppWarning(XtWidgetToApplicationContext(w), error_buf); return; } - + switch (event->type) { case ButtonPress: case ButtonRelease: @@ -781,12 +781,12 @@ Cardinal * num_params; PositionMenu(menu, (XPoint *)NULL); break; } -} +} /************************************************************ * * Widget Action Routines. - * + * ************************************************************/ /* Function Name: Unhighlight @@ -804,13 +804,13 @@ Widget w; XEvent * event; String * params; Cardinal * num_params; -{ +{ SimpleMenuWidget smw = (SimpleMenuWidget) w; SimpleMenuWidget sub = (SimpleMenuWidget) smw->simple_menu.sub_menu; SmeObject entry = smw->simple_menu.entry_set; SmeObjectClass class; int old_pos; - + if (entry == NULL || entry == GetEventEntry(w, event)) { smw->simple_menu.entry_set = NULL; PopdownSubMenu(smw); @@ -832,7 +832,7 @@ Cardinal * num_params; /* backup, then restore, original entry position */ old_pos = entry->rectangle.y; entry->rectangle.y -= smw->simple_menu.first_y; - + (class->sme_class.unhighlight) ((Widget) entry); entry->rectangle.y = old_pos; @@ -858,9 +858,9 @@ Cardinal * num_params; SmeObject entry; SmeObjectClass class; int old_pos; - + if (!XtIsSensitive(w)) return; - + entry = GetEventEntry(w, event); if (entry == smw->simple_menu.entry_set) return; @@ -882,7 +882,7 @@ Cardinal * num_params; /* backup, then restore, original entry position */ old_pos = entry->rectangle.y; entry->rectangle.y -= smw->simple_menu.first_y; - + (class->sme_class.highlight) ((Widget) entry); if (XtIsSubclass((Widget)entry, smeBSBObjectClass)) PopupSubMenu(smw); @@ -910,9 +910,9 @@ Cardinal * num_params; SimpleMenuWidget smw = (SimpleMenuWidget) w; SmeObject entry = smw->simple_menu.entry_set; SmeObjectClass class; - + if ( (entry == NULL) || !XtIsSensitive((Widget) entry ) ) return; - + class = (SmeObjectClass) entry->object.widget_class; (class->sme_class.notify)( (Widget) entry ); } @@ -922,7 +922,7 @@ Cardinal * num_params; * Public Functions. * ************************************************************/ - + /* Function Name: XawSimpleMenuAddGlobalActions * Description: adds the global actions to the simple menu widget. * Arguments: app_con - the appcontext. @@ -939,9 +939,9 @@ XtAppContext app_con; { XtInitializeWidgetClass(simpleMenuWidgetClass); XmuCallInitializers( app_con ); -} +} + - /* Function Name: XawSimpleMenuGetActiveEntry * Description: Gets the currently active (set) entry. * Arguments: w - the smw widget. @@ -959,7 +959,7 @@ Widget w; SimpleMenuWidget smw = (SimpleMenuWidget) w; return( (Widget) smw->simple_menu.entry_set); -} +} /* Function Name: XawSimpleMenuClearActiveEntry * Description: Unsets the currently active (set) entry. @@ -978,7 +978,7 @@ Widget w; SimpleMenuWidget smw = (SimpleMenuWidget) w; smw->simple_menu.entry_set = NULL; -} +} /************************************************************ * @@ -990,7 +990,7 @@ Widget w; * Description: Creates a the menu label. * Arguments: w - the smw widget. * Returns: none. - * + * * Creates the label object and makes sure it is the first child in * in the list. */ @@ -1009,7 +1009,7 @@ Widget w; char error_buf[BUFSIZ]; (void) sprintf(error_buf, "Xaw Simple Menu Widget: %s or %s, %s", - "label string is NULL", "label already exists", + "label string is NULL", "label already exists", "no label is being created."); XtAppWarning(XtWidgetToApplicationContext(w), error_buf); return; @@ -1017,8 +1017,8 @@ Widget w; XtSetArg(args[0], XtNlabel, smw->simple_menu.label_string); XtSetArg(args[1], XtNjustify, XtJustifyCenter); - smw->simple_menu.label = (SmeObject) - XtCreateManagedWidget("menuLabel", + smw->simple_menu.label = (SmeObject) + XtCreateManagedWidget("menuLabel", smw->simple_menu.label_class, w, args, TWO); @@ -1035,7 +1035,7 @@ Widget w; /* Function Name: Layout * Description: lays the menu entries out all nice and neat. * Arguments: w - See below (+++) - * width_ret, height_ret - The returned width and + * width_ret, height_ret - The returned width and * height values. * Returns: none. * @@ -1088,7 +1088,7 @@ Dimension *width_ret, *height_ret; { if (!XtIsManaged((Widget)*entry)) continue; - if (smw->simple_menu.row_height != 0 && + if (smw->simple_menu.row_height != 0 && *entry != smw->simple_menu.label) (*entry)->rectangle.height = smw->simple_menu.row_height; @@ -1105,7 +1105,7 @@ Dimension *width_ret, *height_ret; height = smw->simple_menu.row_height * smw->composite.num_children; height += tdw->threeD.shadow_width * 2; } - + if (smw->simple_menu.menu_width) width = smw->core.width; else if (allow_change_size) @@ -1120,7 +1120,7 @@ Dimension *width_ret, *height_ret; if (do_layout) { ForAllChildren(smw, entry) - if (XtIsManaged((Widget)*entry)) + if (XtIsManaged((Widget)*entry)) (*entry)->rectangle.width = width; if (allow_change_size) @@ -1132,7 +1132,7 @@ Dimension *width_ret, *height_ret; if (height != 0) *height_ret = height; } } - + /* Function Name: AddPositionAction * Description: Adds the XawPositionSimpleMenu action to the global * action list for this appcon. @@ -1161,13 +1161,13 @@ XPointer data; * Returns: the menu widget or NULL. */ -static Widget +static Widget FindMenu(widget, name) Widget widget; String name; { Widget w, menu; - + for ( w = widget ; w != NULL ; w = XtParent(w) ) if ( (menu = XtNameToWidget(w, name)) != NULL ) return(menu); @@ -1189,14 +1189,14 @@ XPoint * location; SimpleMenuWidget smw = (SimpleMenuWidget) w; SmeObject entry; XPoint t_point; - + if (location == NULL) { Window junk1, junk2; int root_x, root_y, junkX, junkY; unsigned int junkM; - + location = &t_point; - if (XQueryPointer(XtDisplay(w), XtWindow(w), &junk1, &junk2, + if (XQueryPointer(XtDisplay(w), XtWindow(w), &junk1, &junk2, &root_x, &root_y, &junkX, &junkY, &junkM) == FALSE) { char error_buf[BUFSIZ]; (void) sprintf(error_buf, "%s %s", "Xaw Simple Menu Widget:", @@ -1207,15 +1207,15 @@ XPoint * location; location->x = (short) root_x; location->y = (short) root_y; } - + /* * The width will not be correct unless it is realized. */ - + XtRealizeWidget(w); - + location->x -= (Position) w->core.width/2; - + if (smw->simple_menu.popup_entry == NULL) entry = smw->simple_menu.label; else @@ -1232,7 +1232,7 @@ XPoint * location; * to be fully visable if menu_on_screen is TRUE. * Arguments: w - the simple menu widget. * x, y - the current location of the widget. - * Returns: none + * Returns: none */ static void @@ -1242,19 +1242,19 @@ Position x, y; { SimpleMenuWidget smw = (SimpleMenuWidget) w; Arg arglist[2]; - + if (smw->simple_menu.menu_on_screen) { int width = w->core.width + 2 * w->core.border_width; int height = w->core.height + 2 * w->core.border_width; - + if (x >= 0) { int scr_width = WidthOfScreen(XtScreen(w)); if (x + width > scr_width) x = scr_width - width; } - if (x < 0) + if (x < 0) x = 0; - + if (y >= 0) { int scr_height = HeightOfScreen(XtScreen(w)); if (y + height > scr_height) @@ -1263,7 +1263,7 @@ Position x, y; if (y < 0) y = 0; } - + XtSetArg(arglist[0], XtNx, x); XtSetArg(arglist[1], XtNy, y); XtSetValues(w, arglist, TWO); @@ -1284,15 +1284,15 @@ Widget w; XtPointer junk, garbage; { SimpleMenuWidget smw = (SimpleMenuWidget) w; - + /* * The event mask here is what is currently in the MIT implementation. * There really needs to be a way to get the value of the mask out * of the toolkit (CDP 5/26/89). */ - + XChangeActivePointerGrab(XtDisplay(w), ButtonPressMask|ButtonReleaseMask, - smw->simple_menu.cursor, + smw->simple_menu.cursor, XtLastTimestampProcessed(XtDisplay(w))); } @@ -1310,7 +1310,7 @@ Widget w; Dimension width, height; { SimpleMenuWidget smw = (SimpleMenuWidget) w; - + if ( !smw->simple_menu.recursive_set_values ) { if ( (smw->core.width != width) || (smw->core.height != height) ) { Arg arglist[2]; @@ -1399,18 +1399,18 @@ Widget w, w_ent; SimpleMenuWidget smw = (SimpleMenuWidget) w; Dimension width, widest = (Dimension) 0; SmeObject * entry; - - if ( smw->simple_menu.menu_width ) + + if ( smw->simple_menu.menu_width ) return(smw->core.width); ForAllChildren(smw, entry) { XtWidgetGeometry preferred; if (!XtIsManaged( (Widget) *entry)) continue; - + if (*entry != cur_entry) { XtQueryGeometry((Widget) *entry, (XtWidgetGeometry *)NULL, &preferred); - + if (preferred.request_mode & CWWidth) width = preferred.width; else @@ -1418,11 +1418,11 @@ Widget w, w_ent; } else width = (*entry)->rectangle.width; - + if ( width > widest ) widest = width; } - + return(widest); } @@ -1440,20 +1440,20 @@ Widget w; ThreeDWidget tdw = (ThreeDWidget) smw->simple_menu.threeD; SmeObject * entry; Dimension height; - + if (smw->simple_menu.menu_height) return(smw->core.height); height = smw->simple_menu.top_margin + smw->simple_menu.bottom_margin; height += tdw->threeD.shadow_width * 2; - + if (smw->simple_menu.row_height == 0) { - ForAllChildren(smw, entry) - if (XtIsManaged ((Widget) *entry)) + ForAllChildren(smw, entry) + if (XtIsManaged ((Widget) *entry)) height += (*entry)->rectangle.height; - } else + } else height += smw->simple_menu.row_height * smw->composite.num_children; - + return(height); } @@ -1580,7 +1580,7 @@ SimpleMenuWidget smw; popleft = (smw->simple_menu.state & SMW_POPLEFT) != 0; - if (popleft) + if (popleft) XtTranslateCoords((Widget)smw, -(int)XtWidth(menu), XtY(entry) - XtBorderWidth(menu), &menu_x, &menu_y); else @@ -29,7 +29,7 @@ in this Software without prior written authorization from the X Consortium. * Date: September 26, 1989 * * By: Chris D. Peterson - * MIT X Consortium + * MIT X Consortium * kit@expo.lcs.mit.edu */ @@ -49,11 +49,11 @@ static XtResource resources[] = { {XtNinternational, XtCInternational, XtRBoolean, sizeof(Boolean), offset(international), XtRImmediate, (XtPointer) FALSE}, #endif -}; +}; #undef offset /* - * Semi Public function definitions. + * Semi Public function definitions. */ static void Unhighlight(), Highlight(), Notify(), ClassPartInitialize(); @@ -78,7 +78,7 @@ SmeClassRec smeClassRec = { /* resources */ resources, /* resource_count */ XtNumber(resources), /* xrm_class */ NULLQUARK, - /* compress_motion */ FALSE, + /* compress_motion */ FALSE, /* compress_exposure */ FALSE, /* compress_enterleave*/ FALSE, /* visible_interest */ FALSE, @@ -87,8 +87,8 @@ SmeClassRec smeClassRec = { /* expose */ NULL, /* set_values */ NULL, /* set_values_hook */ NULL, - /* set_values_almost */ XtInheritSetValuesAlmost, - /* get_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, /* accept_focus */ NULL, /* intrinsics version */ XtVersion, /* callback offsets */ NULL, @@ -98,11 +98,11 @@ SmeClassRec smeClassRec = { /* extension */ NULL },{ /* Simple Menu Entry Fields */ - + /* highlight */ Highlight, /* unhighlight */ Unhighlight, - /* notify */ Notify, - /* extension */ NULL + /* notify */ Notify, + /* extension */ NULL } }; @@ -129,18 +129,18 @@ WidgetClass class; m_ent = (SmeObjectClass) class; superC = (SmeObjectClass) m_ent->rect_class.superclass; -/* +/* * We don't need to check for null super since we'll get to TextSink * eventually. */ - if (m_ent->sme_class.highlight == XtInheritHighlight) + if (m_ent->sme_class.highlight == XtInheritHighlight) m_ent->sme_class.highlight = superC->sme_class.highlight; if (m_ent->sme_class.unhighlight == XtInheritUnhighlight) m_ent->sme_class.unhighlight = superC->sme_class.unhighlight; - if (m_ent->sme_class.notify == XtInheritNotify) + if (m_ent->sme_class.notify == XtInheritNotify) m_ent->sme_class.notify = superC->sme_class.notify; } @@ -150,7 +150,7 @@ WidgetClass class; * new - the new widget with both resource and non * resource values. * Returns: none. - * + * * MENU ENTRIES CANNOT HAVE BORDERS. */ @@ -201,7 +201,7 @@ Widget w; */ static void -Notify(w) +Notify(w) Widget w; { XtCallCallbacks(w, XtNcallback, (XtPointer)NULL); @@ -214,12 +214,12 @@ Widget w; * Returns: A Geometry Result. * * See the Intrinsics manual for details on what this function is for. - * + * * I just return the height and a width of 1. */ static XtGeometryResult -QueryGeometry(w, intended, return_val) +QueryGeometry(w, intended, return_val) Widget w; XtWidgetGeometry *intended, *return_val; { @@ -235,7 +235,7 @@ XtWidgetGeometry *intended, *return_val; return_val->request_mode |= CWWidth; return_val->width = width; mode = return_val->request_mode; - + if ( (mode & CWWidth) && (width == entry->rectangle.width) ) return(XtGeometryNo); return(XtGeometryAlmost); diff --git a/src/SmeBSB.c b/src/SmeBSB.c index e7f1cc3..84ef291 100644 --- a/src/SmeBSB.c +++ b/src/SmeBSB.c @@ -34,7 +34,7 @@ in this Software without prior written authorization from the X Consortium. * Date: September 26, 1989 * * By: Chris D. Peterson - * MIT X Consortium + * MIT X Consortium * kit@expo.lcs.mit.edu */ @@ -86,11 +86,11 @@ static XtResource resources[] = { offset(menu_name), XtRImmediate, (XtPointer) NULL}, {XtNunderline, XtCIndex, XtRInt, sizeof(int), offset(underline), XtRImmediate, (XtPointer) -1}, -}; +}; #undef offset /* - * Semi Public function definitions. + * Semi Public function definitions. */ static void Redisplay(), Destroy(), Initialize(); @@ -99,13 +99,13 @@ static void ClassInitialize(); static Boolean SetValues(); static XtGeometryResult QueryGeometry(); -/* +/* * Private Function Definitions. */ static void GetDefaultSize(), DrawBitmaps(), GetBitmapInfo(); static void CreateGCs(), DestroyGCs(), FlipColors(); - + #define superclass (&smeThreeDClassRec) SmeBSBClassRec smeBSBClassRec = { { @@ -123,7 +123,7 @@ SmeBSBClassRec smeBSBClassRec = { /* resources */ resources, /* resource_count */ XtNumber(resources), /* xrm_class */ NULLQUARK, - /* compress_motion */ FALSE, + /* compress_motion */ FALSE, /* compress_exposure */ FALSE, /* compress_enterleave*/ FALSE, /* visible_interest */ FALSE, @@ -132,8 +132,8 @@ SmeBSBClassRec smeBSBClassRec = { /* expose */ Redisplay, /* set_values */ SetValues, /* set_values_hook */ NULL, - /* set_values_almost */ XtInheritSetValuesAlmost, - /* get_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, /* accept_focus */ NULL, /* intrinsics version */ XtVersion, /* callback offsets */ NULL, @@ -145,13 +145,13 @@ SmeBSBClassRec smeBSBClassRec = { /* SimpleMenuClass Fields */ /* highlight */ Highlight, /* unhighlight */ Unhighlight, - /* notify */ XtInheritNotify, + /* notify */ XtInheritNotify, /* extension */ NULL }, { /* ThreeDClass Fields */ /* shadowdraw */ XtInheritXawSme3dShadowDraw }, { - /* BSBClass Fields */ + /* BSBClass Fields */ /* extension */ NULL } }; @@ -165,16 +165,16 @@ WidgetClass smeBSBObjectClass = (WidgetClass) &smeBSBClassRec; ************************************************************/ /* Function Name: ClassInitialize - * Description: Initializes the SmeBSBObject. + * Description: Initializes the SmeBSBObject. * Arguments: none. * Returns: none. */ -static void +static void ClassInitialize() { XawInitializeWidgetSet(); - XtAddConverter( XtRString, XtRJustify, XmuCvtStringToJustify, + XtAddConverter( XtRString, XtRJustify, XmuCvtStringToJustify, (XtConvertArgList)NULL, (Cardinal)0 ); } @@ -195,7 +195,7 @@ Cardinal *num_args; { SmeBSBObject entry = (SmeBSBObject) new; - if (entry->sme_bsb.label == NULL) + if (entry->sme_bsb.label == NULL) entry->sme_bsb.label = XtName(new); else entry->sme_bsb.label = XtNewString( entry->sme_bsb.label ); @@ -237,7 +237,7 @@ Widget w; * Description: Redisplays the contents of the widget. * Arguments: w - the simple menu widget. * event - the X event that caused this redisplay. - * region - the region the needs to be repainted. + * region - the region the needs to be repainted. * Returns: none. */ @@ -257,7 +257,7 @@ Region region; XFontSetExtents *ext = XExtentsOfFontSet(entry->sme_bsb.fontset); #endif - entry->sme_bsb.set_values_area_cleared = FALSE; + entry->sme_bsb.set_values_area_cleared = FALSE; #ifdef XAW_INTERNATIONALIZATION if ( entry->sme.international == True ) { fontset_ascent = abs(ext->max_ink_extent.y); @@ -273,7 +273,7 @@ Region region; if (XtIsSensitive(w) && XtIsSensitive( XtParent(w) ) ) { if ( w == XawSimpleMenuGetActiveEntry(XtParent(w)) ) { - XFillRectangle(XtDisplayOfObject(w), XtWindowOfObject(w), + XFillRectangle(XtDisplayOfObject(w), XtWindowOfObject(w), entry->sme_bsb.norm_gc, s, y_loc + s, (unsigned int) entry->rectangle.width - 2 * s, (unsigned int) entry->rectangle.height - 2 * s); @@ -284,7 +284,7 @@ Region region; } else gc = entry->sme_bsb.norm_gray_gc; - + if (entry->sme_bsb.label != NULL) { int x_loc = entry->sme_bsb.left_margin; int len = strlen(entry->sme_bsb.label); @@ -325,7 +325,7 @@ Region region; #ifdef XAW_INTERNATIONALIZATION if ( entry->sme.international==True ) { - y_loc += ((int)entry->rectangle.height - + y_loc += ((int)entry->rectangle.height - (fontset_ascent + fontset_descent)) / 2 + fontset_ascent; XmbDrawString(XtDisplayOfObject(w), XtWindowOfObject(w), @@ -334,9 +334,9 @@ Region region; else #endif { - y_loc += ((int)entry->rectangle.height - + y_loc += ((int)entry->rectangle.height - (font_ascent + font_descent)) / 2 + font_ascent; - + XDrawString(XtDisplayOfObject(w), XtWindowOfObject(w), gc, x_loc + s, y_loc, label, len); } @@ -382,7 +382,7 @@ Cardinal *num_args; if (old_entry->sme_bsb.label != XtName( new ) ) XtFree( (char *) old_entry->sme_bsb.label ); - if (entry->sme_bsb.label != XtName(new) ) + if (entry->sme_bsb.label != XtName(new) ) entry->sme_bsb.label = XtNewString( entry->sme_bsb.label ); ret_val = TRUE; @@ -450,7 +450,7 @@ Cardinal *num_args; #endif if (ret_val) { - GetDefaultSize(new, + GetDefaultSize(new, &(entry->rectangle.width), &(entry->rectangle.height)); entry->sme_bsb.set_values_area_cleared = TRUE; @@ -467,12 +467,12 @@ Cardinal *num_args; * Returns: A Geometry Result. * * See the Intrinsics manual for details on what this function is for. - * + * * I just return the height and width of the label plus the margins. */ static XtGeometryResult -QueryGeometry(w, intended, return_val) +QueryGeometry(w, intended, return_val) Widget w; XtWidgetGeometry *intended, *return_val; { @@ -499,7 +499,7 @@ XtWidgetGeometry *intended, *return_val; if (ret_val == XtGeometryAlmost) { mode = return_val->request_mode; - + if ( ((mode & CWWidth) && (width == entry->rectangle.width)) && ((mode & CWHeight) && (height == entry->rectangle.height)) ) return(XtGeometryNo); @@ -510,7 +510,7 @@ XtWidgetGeometry *intended, *return_val; return(ret_val); } - + /* * FlipColors() used to be called directly, but it's blind * state toggling caused re-unhighlighting problems. @@ -551,7 +551,7 @@ Widget w; */ static void -GetDefaultSize(w, width, height) +GetDefaultSize(w, width, height) Widget w; Dimension * width, * height; { @@ -562,7 +562,7 @@ Dimension * width, * height; if ( entry->sme.international == True ) { XFontSetExtents *ext = XExtentsOfFontSet(entry->sme_bsb.fontset); - if (entry->sme_bsb.label == NULL) + if (entry->sme_bsb.label == NULL) *width = 0; else *width = XmbTextEscapement(entry->sme_bsb.fontset, entry->sme_bsb.label, @@ -573,7 +573,7 @@ Dimension * width, * height; else #endif { - if (entry->sme_bsb.label == NULL) + if (entry->sme_bsb.label == NULL) *width = 0; else *width = XTextWidth(entry->sme_bsb.font, entry->sme_bsb.label, @@ -611,8 +611,8 @@ GC gc; int x_loc, y_loc; SmeBSBObject entry = (SmeBSBObject) w; Pixmap pm; - - if ( (entry->sme_bsb.left_bitmap == None) && + + if ( (entry->sme_bsb.left_bitmap == None) && (entry->sme_bsb.right_bitmap == None) ) return; /* @@ -643,12 +643,12 @@ GC gc; if (entry->sme_bsb.left_depth == 1) XCopyPlane(XtDisplayOfObject(w), pm, - XtWindowOfObject(w), gc, 0, 0, + XtWindowOfObject(w), gc, 0, 0, entry->sme_bsb.left_bitmap_width, entry->sme_bsb.left_bitmap_height, x_loc, y_loc, 1); else XCopyArea (XtDisplayOfObject(w), pm, - XtWindowOfObject(w), gc, 0, 0, + XtWindowOfObject(w), gc, 0, 0, entry->sme_bsb.left_bitmap_width, entry->sme_bsb.left_bitmap_height, x_loc, y_loc); } @@ -681,12 +681,12 @@ GC gc; if (entry->sme_bsb.right_depth == 1) XCopyPlane(XtDisplayOfObject(w), pm, - XtWindowOfObject(w), gc, 0, 0, + XtWindowOfObject(w), gc, 0, 0, entry->sme_bsb.right_bitmap_width, entry->sme_bsb.right_bitmap_height, x_loc, y_loc, 1); else XCopyArea (XtDisplayOfObject(w), pm, - XtWindowOfObject(w), gc, 0, 0, + XtWindowOfObject(w), gc, 0, 0, entry->sme_bsb.right_bitmap_width, entry->sme_bsb.right_bitmap_height, x_loc, y_loc); } @@ -705,17 +705,17 @@ GetBitmapInfo(w, is_left) Widget w; Boolean is_left; { - SmeBSBObject entry = (SmeBSBObject) w; + SmeBSBObject entry = (SmeBSBObject) w; Window root; int x, y; unsigned int width, height, bw; char buf[BUFSIZ]; - + if (is_left) { width = height = 0; if (entry->sme_bsb.left_bitmap != None) { - if (!XGetGeometry(XtDisplayOfObject(w), + if (!XGetGeometry(XtDisplayOfObject(w), entry->sme_bsb.left_bitmap, &root, &x, &y, &width, &height, &bw, &entry->sme_bsb.left_depth)) { (void) sprintf(buf, "Xaw SmeBSB Object: %s %s \"%s\".", @@ -726,7 +726,7 @@ Boolean is_left; } #ifdef NEVER if (entry->sme_bsb.left_depth != 1) { - (void) sprintf(buf, "Xaw SmeBSB Object: %s \"%s\" %s.", + (void) sprintf(buf, "Xaw SmeBSB Object: %s \"%s\" %s.", "Left Bitmap of entry", XtName(w), "is not one bit deep"); XtAppError(XtWidgetToApplicationContext(w), buf); @@ -734,7 +734,7 @@ Boolean is_left; #endif } - entry->sme_bsb.left_bitmap_width = (Dimension) width; + entry->sme_bsb.left_bitmap_width = (Dimension) width; entry->sme_bsb.left_bitmap_height = (Dimension) height; } else { width = height = 0; @@ -751,7 +751,7 @@ Boolean is_left; } #ifdef NEVER if (entry->sme_bsb.right_depth != 1) { - (void) sprintf(buf, "Xaw SmeBSB Object: %s \"%s\" %s.", + (void) sprintf(buf, "Xaw SmeBSB Object: %s \"%s\" %s.", "Right Bitmap of entry", XtName(w), "is not one bit deep"); XtAppError(XtWidgetToApplicationContext(w), buf); @@ -759,10 +759,10 @@ Boolean is_left; #endif } - entry->sme_bsb.right_bitmap_width = (Dimension) width; + entry->sme_bsb.right_bitmap_width = (Dimension) width; entry->sme_bsb.right_bitmap_height = (Dimension) height; } -} +} /* Function Name: CreateGCs * Description: Creates all gc's for the simple menu widget. @@ -774,13 +774,13 @@ static void CreateGCs(w) Widget w; { - SmeBSBObject entry = (SmeBSBObject) w; + SmeBSBObject entry = (SmeBSBObject) w; XGCValues values; XtGCMask mask; #ifdef XAW_INTERNATIONALIZATION XtGCMask mask_i18n; #endif - + values.foreground = XtParent(w)->core.background_pixel; values.background = entry->sme_bsb.foreground; values.font = entry->sme_bsb.font->fid; @@ -793,7 +793,7 @@ Widget w; else #endif entry->sme_bsb.rev_gc = XtGetGC(w, mask, &values); - + values.foreground = entry->sme_bsb.foreground; values.background = XtParent(w)->core.background_pixel; #ifdef XAW_INTERNATIONALIZATION @@ -804,7 +804,7 @@ Widget w; entry->sme_bsb.norm_gc = XtGetGC(w, mask, &values); values.fill_style = FillTiled; - values.tile = XmuCreateStippledPixmap(XtScreenOfObject(w), + values.tile = XmuCreateStippledPixmap(XtScreenOfObject(w), entry->sme_bsb.foreground, XtParent(w)->core.background_pixel, XtParent(w)->core.depth); @@ -834,7 +834,7 @@ static void DestroyGCs(w) Widget w; { - SmeBSBObject entry = (SmeBSBObject) w; + SmeBSBObject entry = (SmeBSBObject) w; XtReleaseGC(w, entry->sme_bsb.norm_gc); XtReleaseGC(w, entry->sme_bsb.norm_gray_gc); @@ -848,7 +848,7 @@ Widget w; * Returns: none. */ -static void +static void FlipColors(w) Widget w; { @@ -867,7 +867,7 @@ Widget w; (*oclass->sme_threeD_class.shadowdraw) (w); } else XFillRectangle(XtDisplayOfObject(w), XtWindowOfObject(w), - entry->sme_bsb.invert_gc, + entry->sme_bsb.invert_gc, s, (int) entry->rectangle.y, (unsigned int) entry->rectangle.width - 2 * s, (unsigned int) entry->rectangle.height); diff --git a/src/SmeLine.c b/src/SmeLine.c index 943c5f1..161f690 100644 --- a/src/SmeLine.c +++ b/src/SmeLine.c @@ -31,7 +31,7 @@ in this Software without prior written authorization from the X Consortium. * Date: September 26, 1989 * * By: Chris D. Peterson - * MIT X Consortium + * MIT X Consortium * kit@expo.lcs.mit.edu */ @@ -53,11 +53,11 @@ static XtResource resources[] = { offset(stipple), XtRImmediate, (XtPointer) XtUnspecifiedPixmap}, {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), offset(foreground), XtRString, XtDefaultForeground}, -}; +}; #undef offset /* - * Function definitions. + * Function definitions. */ static void Redisplay(), Initialize(); @@ -84,7 +84,7 @@ SmeLineClassRec smeLineClassRec = { /* resources */ resources, /* resource_count */ XtNumber(resources), /* xrm_class */ NULLQUARK, - /* compress_motion */ FALSE, + /* compress_motion */ FALSE, /* compress_exposure */ FALSE, /* compress_enterleave*/ FALSE, /* visible_interest */ FALSE, @@ -93,8 +93,8 @@ SmeLineClassRec smeLineClassRec = { /* expose */ Redisplay, /* set_values */ SetValues, /* set_values_hook */ NULL, - /* set_values_almost */ XtInheritSetValuesAlmost, - /* get_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, /* accept_focus */ NULL, /* intrinsics version */ XtVersion, /* callback offsets */ NULL, @@ -104,14 +104,14 @@ SmeLineClassRec smeLineClassRec = { /* extension */ NULL },{ /* Menu Entry Fields */ - + /* highlight */ XtInheritHighlight, /* unhighlight */ XtInheritUnhighlight, - /* notify */ XtInheritNotify, - /* extension */ NULL + /* notify */ XtInheritNotify, + /* extension */ NULL },{ /* Line Menu Entry Fields */ - /* extension */ NULL + /* extension */ NULL } }; @@ -162,17 +162,17 @@ Widget w; SmeLineObject entry = (SmeLineObject) w; XGCValues values; XtGCMask mask = GCForeground | GCGraphicsExposures | GCLineWidth ; - + values.foreground = entry->sme_line.foreground; values.graphics_exposures = FALSE; values.line_width = entry->sme_line.line_width; - + if (entry->sme_line.stipple != XtUnspecifiedPixmap) { values.stipple = entry->sme_line.stipple; - values.fill_style = FillStippled; + values.fill_style = FillStippled; mask |= GCStipple | GCFillStyle; - - entry->sme_line.gc = XCreateGC(XtDisplayOfObject(w), + + entry->sme_line.gc = XCreateGC(XtDisplayOfObject(w), RootWindowOfScreen(XtScreenOfObject(w)), mask, &values); } @@ -192,7 +192,7 @@ Widget w; { SmeLineObject entry = (SmeLineObject) w; - if (entry->sme_line.stipple != XtUnspecifiedPixmap) + if (entry->sme_line.stipple != XtUnspecifiedPixmap) XFreeGC(XtDisplayOfObject(w), entry->sme_line.gc); else XtReleaseGC(w, entry->sme_line.gc); @@ -216,14 +216,14 @@ Region region; SimpleMenuWidget smw = (SimpleMenuWidget) XtParent (w); ThreeDWidget tdw = (ThreeDWidget) smw->simple_menu.threeD; Dimension s = tdw->threeD.shadow_width; - int y = entry->rectangle.y + + int y = entry->rectangle.y + (int)(entry->rectangle.height - entry->sme_line.line_width) / 2; - if (entry->sme_line.stipple != XtUnspecifiedPixmap) + if (entry->sme_line.stipple != XtUnspecifiedPixmap) XSetTSOrigin(XtDisplayOfObject(w), entry->sme_line.gc, 0, y); XFillRectangle(XtDisplayOfObject(w), XtWindowOfObject(w), - entry->sme_line.gc, + entry->sme_line.gc, s, y, (unsigned int) entry->rectangle.width - 2 * s, (unsigned int) entry->sme_line.line_width ); } @@ -245,7 +245,7 @@ Cardinal *num_args; { SmeLineObject entry = (SmeLineObject) new; SmeLineObject old_entry = (SmeLineObject) current; - + if ( (entry->sme_line.line_width != old_entry->sme_line.line_width) && (entry->sme_line.stipple != old_entry->sme_line.stipple) ) { DestroyGC(current); @@ -262,12 +262,12 @@ Cardinal *num_args; * Returns: A Geometry Result. * * See the Intrinsics manual for details on what this function is for. - * + * * I just return the height and a width of 1. */ static XtGeometryResult -QueryGeometry(w, intended, return_val) +QueryGeometry(w, intended, return_val) Widget w; XtWidgetGeometry *intended, *return_val; { @@ -283,7 +283,7 @@ XtWidgetGeometry *intended, *return_val; return_val->request_mode |= CWWidth; return_val->width = width; mode = return_val->request_mode; - + if ( (mode & CWWidth) && (width == entry->rectangle.width) ) return(XtGeometryNo); return(XtGeometryAlmost); diff --git a/src/SmeThreeD.c b/src/SmeThreeD.c index 9950f5f..2cce75f 100644 --- a/src/SmeThreeD.c +++ b/src/SmeThreeD.c @@ -5,13 +5,13 @@ Copyright 1992, 1993 by Kaleb Keithley All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +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 names of Digital, MIT, or Kaleb -Keithley not be used in advertising or publicity pertaining to distribution -of the software without specific, written prior permission. +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital, MIT, or Kaleb +Keithley 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 @@ -234,7 +234,7 @@ static void AllocTopShadowPixmap (new) if (parent->core.background_pixel == WhitePixelOfScreen (scn) || parent->core.background_pixel == BlackPixelOfScreen (scn)) { pm_data = mtshadowpm_bits; - } else + } else #endif pm_data = shadowpm_bits; @@ -405,7 +405,7 @@ static void ClassPartInitialize (wc) WidgetClass wc; { SmeThreeDClassRec *tdwc = (SmeThreeDClassRec *) wc; - SmeThreeDClassRec *super = + SmeThreeDClassRec *super = (SmeThreeDClassRec *) tdwc->rect_class.superclass; if (tdwc->sme_threeD_class.shadowdraw == XtInheritXawSme3dShadowDraw) @@ -464,7 +464,7 @@ static Boolean SetValues (gcurrent, grequest, gnew, args, num_args) Boolean alloc_bot_pixmap = FALSE; #if 0 - (*threeDWidgetClass->core_class.superclass->core_class.set_values) + (*threeDWidgetClass->core_class.superclass->core_class.set_values) (gcurrent, grequest, gnew, NULL, 0); #endif if (new->sme_threeD.shadow_width != current->sme_threeD.shadow_width) @@ -534,7 +534,7 @@ static Boolean SetValues (gcurrent, grequest, gnew, args, num_args) } /* ARGSUSED */ -static void +static void _XawSme3dDrawShadows(gw) Widget gw; { @@ -545,13 +545,13 @@ _XawSme3dDrawShadows(gw) Dimension ps = tdw->threeD.shadow_width; XPoint pt[6]; - /* - * draw the shadows using the core part width and height, + /* + * draw the shadows using the core part width and height, * and the threeD part shadow_width. * * no point to do anything if the shadow_width is 0 or the * widget has not been realized. - */ + */ if (s > 0 && XtIsRealized(gw)) { Dimension h = tdo->rectangle.height; diff --git a/src/StripChart.c b/src/StripChart.c index 6c78197..ade2db0 100644 --- a/src/StripChart.c +++ b/src/StripChart.c @@ -28,13 +28,13 @@ 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, +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 +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. +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 @@ -178,10 +178,10 @@ DestroyGC(w, which) StripChartWidget w; unsigned int which; { - if (which & FOREGROUND) + if (which & FOREGROUND) XtReleaseGC((Widget) w, w->strip_chart.fgGC); - if (which & HIGHLIGHT) + if (which & HIGHLIGHT) XtReleaseGC((Widget) w, w->strip_chart.hiGC); } @@ -194,9 +194,9 @@ static void Initialize (greq, gnew, args, num_args) StripChartWidget w = (StripChartWidget)gnew; if (w->strip_chart.update > 0) - w->strip_chart.interval_id = + w->strip_chart.interval_id = XtAppAddTimeOut( XtWidgetToApplicationContext(gnew), - (unsigned long) w->strip_chart.update * MS_PER_SEC, + (unsigned long) w->strip_chart.update * MS_PER_SEC, draw_it, (XtPointer) gnew); CreateGC(w, (unsigned int) ALL_GCS); @@ -206,7 +206,7 @@ static void Initialize (greq, gnew, args, num_args) w->strip_chart.points = NULL; SetPoints((Widget)w); } - + static void Destroy (gw) Widget gw; { @@ -220,7 +220,7 @@ static void Destroy (gw) } /* - * NOTE: This function really needs to recieve graphics exposure + * NOTE: This function really needs to recieve graphics exposure * events, but since this is not easily supported until R4 I am * going to hold off until then. */ @@ -254,7 +254,7 @@ static void Redisplay(gw, event, region) } /* ARGSUSED */ -static void +static void draw_it(client_data, id) XtPointer client_data; XtIntervalId *id; /* unused */ @@ -263,7 +263,7 @@ XtIntervalId *id; /* unused */ StripChartWidgetClass swclass = (StripChartWidgetClass) XtClass ((Widget) w); Dimension s = w->threeD.shadow_width; double value; - + if (w->strip_chart.update > 0) w->strip_chart.interval_id = XtAppAddTimeOut(XtWidgetToApplicationContext( (Widget) w), @@ -280,19 +280,19 @@ XtIntervalId *id; /* unused */ XtCallCallbacks( (Widget)w, XtNgetValue, (XtPointer)&value ); - /* - * Keep w->strip_chart.max_value up to date, and if this data - * point is off the graph, change the scale to make it fit. + /* + * Keep w->strip_chart.max_value up to date, and if this data + * point is off the graph, change the scale to make it fit. */ - + if (value > w->strip_chart.max_value) { w->strip_chart.max_value = value; - if (XtIsRealized((Widget)w) && + if (XtIsRealized((Widget)w) && w->strip_chart.max_value > w->strip_chart.scale) { XClearWindow(XtDisplay ((Widget) w), XtWindow ((Widget) w)); w->strip_chart.interval = repaint_window((Widget)w, 0, (int) w->core.width - 2 * s); - (*swclass->threeD_class.shadowdraw) ((Widget) w, - (XEvent *)0, (Region)0, + (*swclass->threeD_class.shadowdraw) ((Widget) w, + (XEvent *)0, (Region)0, w->threeD.relief, FALSE); } } @@ -303,8 +303,8 @@ XtIntervalId *id; /* unused */ - (int)(( w->core.height - 2 * s) * value) / w->strip_chart.scale); XFillRectangle(XtDisplay((Widget) w), XtWindow((Widget) w), w->strip_chart.fgGC, - w->strip_chart.interval + s, - y + s, (unsigned int) 1, + w->strip_chart.interval + s, + y + s, (unsigned int) 1, (w->core.height - 2 * s) - y); /* * Fill in the graph lines we just painted over. @@ -332,7 +332,7 @@ XtIntervalId *id; /* unused */ * largest data point. */ -static int +static int repaint_window(gw, left, width) Widget gw; int left, width; @@ -379,10 +379,10 @@ int left, width; /* Draw data point lines. */ for (i = left; i < width; i++) { int y = (int) (( w->core.height - 2 * s) - - (int)(( w->core.height - 2 * s) * w->strip_chart.valuedata[i]) / + (int)(( w->core.height - 2 * s) * w->strip_chart.valuedata[i]) / w->strip_chart.scale); - XFillRectangle(dpy, win, w->strip_chart.fgGC, + XFillRectangle(dpy, win, w->strip_chart.fgGC, i + s, y + s, (unsigned int) 1, (unsigned int) (w->core.height - 2 * s - y )); } @@ -390,7 +390,7 @@ int left, width; /* Draw graph reference lines */ for (i = 1; i < w->strip_chart.scale; i++) { j = i * ((w->core.height - 2 * s) / w->strip_chart.scale); - XDrawLine(dpy, win, w->strip_chart.hiGC, + XDrawLine(dpy, win, w->strip_chart.hiGC, left + s, j + s, scalewidth + s, j + s); } } @@ -424,20 +424,20 @@ Boolean blit; if (j < 0) j = 0; } - (void) memmove((char *)(w->strip_chart.valuedata), + (void) memmove((char *)(w->strip_chart.valuedata), (char *)(w->strip_chart.valuedata + next - j), j * sizeof(double)); next = w->strip_chart.interval = j; - + /* - * Since we just lost some data, recompute the - * w->strip_chart.max_value. + * Since we just lost some data, recompute the + * w->strip_chart.max_value. */ old_max = w->strip_chart.max_value; w->strip_chart.max_value = 0.0; for (i = 0; i < next; i++) { - if (w->strip_chart.valuedata[i] > w->strip_chart.max_value) + if (w->strip_chart.valuedata[i] > w->strip_chart.max_value) w->strip_chart.max_value = w->strip_chart.valuedata[i]; } @@ -450,14 +450,14 @@ Boolean blit; } XCopyArea(XtDisplay((Widget)w), XtWindow((Widget)w), XtWindow((Widget)w), - w->strip_chart.hiGC, + w->strip_chart.hiGC, (int) ((w->strip_chart.jump_val == DEFAULT_JUMP) ? (j + s) : (w->strip_chart.jump_val + s)), s, (unsigned int) j, (unsigned int) ( w->core.height - 2 * s), s, s); - XClearArea(XtDisplay((Widget)w), XtWindow((Widget)w), - (int) j + s, s, + XClearArea(XtDisplay((Widget)w), XtWindow((Widget)w), + (int) j + s, s, (unsigned int) ((w->strip_chart.jump_val == DEFAULT_JUMP) ? j : w->strip_chart.jump_val), (unsigned int) ( w->core.height - 2 * s), @@ -468,7 +468,7 @@ Boolean blit; for (i = 1; i < w->strip_chart.scale; i++) { j = i * ((w->core.height - 2 * s) / w->strip_chart.scale); XDrawLine(XtDisplay((Widget) w), XtWindow( (Widget) w), - w->strip_chart.hiGC, + w->strip_chart.hiGC, left, j + s, ((int)w->core.width - s - 1), j + s); } return; @@ -497,17 +497,17 @@ static Boolean SetValues (current, request, new, args, num_args) if ( w->strip_chart.min_scale > (int) ((w->strip_chart.max_value) + 1) ) ret_val = TRUE; - + if ( w->strip_chart.fgpixel != old->strip_chart.fgpixel ) { new_gc |= FOREGROUND; ret_val = True; } - + if ( w->strip_chart.hipixel != old->strip_chart.hipixel ) { new_gc |= HIGHLIGHT; ret_val = True; } - + DestroyGC(old, new_gc); CreateGC(w, new_gc); @@ -538,7 +538,7 @@ Widget widget; w->strip_chart.points = NULL; return; } - + size = sizeof(XPoint) * (w->strip_chart.scale - 1); points = (XPoint *) XtRealloc( (XtPointer) w->strip_chart.points, size); @@ -28,13 +28,13 @@ 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, +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 +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. +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 @@ -110,7 +110,7 @@ unsigned long XawFmtWide = 0L; * Defined in Text.c */ static void UnrealizeScrollbars(); -static void VScroll(), VJump(), HScroll(), HJump(), ClearWindow(); +static void VScroll(), VJump(), HScroll(), HJump(), ClearWindow(); static void DisplayTextWindow(), ModifySelection(), PushCopyQueue(); static void UpdateTextInLine(), UpdateTextInRectangle(), PopCopyQueue(); static void FlushUpdate(); @@ -145,7 +145,7 @@ static XtResource resources[] = { offset(simple.cursor), XtRString, "xterm"}, {XtNheight, XtCHeight, XtRDimension, sizeof(Dimension), offset(core.height), XtRDimension, (XtPointer)&defHeight}, - {XtNdisplayPosition, XtCTextPosition, XtRInt, sizeof(XawTextPosition), + {XtNdisplayPosition, XtCTextPosition, XtRInt, sizeof(XawTextPosition), offset(text.lt.top), XtRImmediate, (XtPointer)0}, {XtNinsertPosition, XtCTextPosition, XtRInt, sizeof(XawTextPosition), offset(text.insertPos), XtRImmediate,(XtPointer)0}, @@ -182,7 +182,7 @@ static XtResource resources[] = { #undef offset /* ARGSUSED */ -static void +static void CvtStringToScrollMode(args, num_args, fromVal, toVal) XrmValuePtr args; /* unused */ Cardinal *num_args; /* unused */ @@ -194,7 +194,7 @@ XrmValuePtr toVal; XrmQuark q; char lowerName[40]; static Boolean inited = FALSE; - + if ( !inited ) { QScrollNever = XrmPermStringToQuark(XtEtextScrollNever); QScrollWhenNeeded = XrmPermStringToQuark(XtEtextScrollWhenNeeded); @@ -223,7 +223,7 @@ XrmValuePtr toVal; } /* ARGSUSED */ -static void +static void CvtStringToWrapMode(args, num_args, fromVal, toVal) XrmValuePtr args; /* unused */ Cardinal *num_args; /* unused */ @@ -235,7 +235,7 @@ XrmValuePtr toVal; XrmQuark q; char lowerName[BUFSIZ]; static Boolean inited = FALSE; - + if ( !inited ) { QWrapNever = XrmPermStringToQuark(XtEtextWrapNever); QWrapLine = XrmPermStringToQuark(XtEtextWrapLine); @@ -264,7 +264,7 @@ XrmValuePtr toVal; } /* ARGSUSED */ -static void +static void CvtStringToResizeMode(args, num_args, fromVal, toVal) XrmValuePtr args; /* unused */ Cardinal *num_args; /* unused */ @@ -276,7 +276,7 @@ XrmValuePtr toVal; XrmQuark q; char lowerName[40]; static Boolean inited = FALSE; - + if ( !inited ) { QResizeNever = XrmPermStringToQuark(XtEtextResizeNever); QResizeWidth = XrmPermStringToQuark(XtEtextResizeWidth); @@ -306,7 +306,7 @@ XrmValuePtr toVal; toVal->addr = NULL; } -static void +static void ClassInitialize() { int len1 = strlen (_XawDefaultTextTranslations1); @@ -325,12 +325,12 @@ ClassInitialize() XawInitializeWidgetSet(); -/* +/* * Set the number of actions. */ textClassRec.core_class.num_actions = _XawTextActionsTableCount; - + (void) strcpy( cp, _XawDefaultTextTranslations1); cp += len1; (void) strcpy( cp, _XawDefaultTextTranslations2); cp += len2; (void) strcpy( cp, _XawDefaultTextTranslations3); cp += len3; @@ -374,7 +374,7 @@ TextWidget ctx; top = ctx->core.height - (hbar->core.height + hbar->core.border_width + s / 2); - XtMoveWidget( hbar, left, top); + XtMoveWidget( hbar, left, top); } /* Function Name: PositionVScrollBar. @@ -402,7 +402,7 @@ TextWidget ctx; XtMoveWidget( vbar, pos, pos); } -static void +static void CreateVScrollBar(ctx) TextWidget ctx; { @@ -454,8 +454,8 @@ TextWidget ctx; ctx->text.vbar = NULL; PositionHScrollBar(ctx); } - -static void + +static void CreateHScrollBar(ctx) TextWidget ctx; { @@ -510,7 +510,7 @@ TextWidget ctx; } /* ARGSUSED */ -static void +static void Initialize(request, new, args, num_args) Widget request, new; ArgList args; /* unused */ @@ -535,7 +535,7 @@ Cardinal *num_args; /* unused */ ctx->text.lt.lines = 0; ctx->text.lt.info = NULL; memset(&(ctx->text.origSel), 0, sizeof(XawTextSelection)); - memset(&(ctx->text.s), 0, sizeof(XawTextSelection)); + memset(&(ctx->text.s), 0, sizeof(XawTextSelection)); ctx->text.s.type = XawselectPosition; ctx->text.salt = NULL; ctx->text.hbar = ctx->text.vbar = (Widget) NULL; @@ -548,7 +548,7 @@ Cardinal *num_args; /* unused */ ctx->text.updateFrom = (XawTextPosition *) XtMalloc((unsigned) ONE); ctx->text.updateTo = (XawTextPosition *) XtMalloc((unsigned) ONE); ctx->text.numranges = ctx->text.maxranges = 0; - ctx->text.gc = DefaultGCOfScreen(XtScreen(ctx)); + ctx->text.gc = DefaultGCOfScreen(XtScreen(ctx)); ctx->text.hasfocus = FALSE; ctx->text.margin = ctx->text.r_margin; /* Strucure copy. */ ctx->text.update_disabled = FALSE; @@ -564,7 +564,7 @@ Cardinal *num_args; /* unused */ ctx->core.height += XawTextSinkMaxHeight(ctx->text.sink, 1); } - if (ctx->text.scroll_vert != XawtextScrollNever) + if (ctx->text.scroll_vert != XawtextScrollNever) if ( (ctx->text.resize == XawtextResizeHeight) || (ctx->text.resize == XawtextResizeBoth) ) { (void) sprintf(error_buf, "Xaw Text Widget %s:\n %s %s.", ctx->core.name, @@ -576,7 +576,7 @@ Cardinal *num_args; /* unused */ else if (ctx->text.scroll_vert == XawtextScrollAlways) CreateVScrollBar(ctx); - if (ctx->text.scroll_horiz != XawtextScrollNever) + if (ctx->text.scroll_horiz != XawtextScrollNever) if (ctx->text.wrap != XawtextWrapNever) { (void) sprintf(error_buf, "Xaw Text Widget %s:\n %s %s.", ctx->core.name, "Horizontal scrolling not allowed with wrapping active.\n", @@ -596,7 +596,7 @@ Cardinal *num_args; /* unused */ CreateHScrollBar(ctx); } -static void +static void Realize( w, valueMask, attributes ) Widget w; Mask *valueMask; @@ -607,7 +607,7 @@ XSetWindowAttributes *attributes; (*textClassRec.core_class.superclass->core_class.realize) (w, valueMask, attributes); - + if (ctx->text.hbar != NULL) { /* Put up Hbar -- Must be first. */ XtRealizeWidget(ctx->text.hbar); XtMapWidget(ctx->text.hbar); @@ -630,7 +630,7 @@ XtPointer client; /* unused */ XtPointer call; /* unused */ { TextWidget ctx = (TextWidget) widget; - + if (ctx->text.hbar) XtUnrealizeWidget(ctx->text.hbar); if (ctx->text.vbar) @@ -679,7 +679,7 @@ Display *d; * position is immediately preceded by an eol graphic, then the insert cursor * is displayed at the beginning of the next line. */ -static void +static void InsertCursor (w, state) Widget w; XawTextInsertState state; @@ -687,7 +687,7 @@ XawTextInsertState state; TextWidget ctx = (TextWidget)w; Position x, y; int line; - + if (ctx->text.lt.lines < 1) return; if ( LineAndXYForPosition(ctx, ctx->text.insertPos, &line, &x, &y) ) { @@ -717,7 +717,7 @@ XawTextInsertState state; /* * 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. + * updates. */ void @@ -738,9 +738,9 @@ XawTextPosition left, right; if (ctx->text.numranges > ctx->text.maxranges) { ctx->text.maxranges = ctx->text.numranges; i = ctx->text.maxranges * sizeof(XawTextPosition); - ctx->text.updateFrom = (XawTextPosition *) + ctx->text.updateFrom = (XawTextPosition *) XtRealloc((char *)ctx->text.updateFrom, (unsigned) i); - ctx->text.updateTo = (XawTextPosition *) + ctx->text.updateTo = (XawTextPosition *) XtRealloc((char *)ctx->text.updateTo, (unsigned) i); } ctx->text.updateFrom[ctx->text.numranges - 1] = left; @@ -766,7 +766,7 @@ XawTextPosition left, right; if (_XawTextFormat(ctx) == XawFmt8Bit) bytes = sizeof(unsigned char); #ifdef XAW_INTERNATIONALIZATION - else if (_XawTextFormat(ctx) == XawFmtWide) + else if (_XawTextFormat(ctx) == XawFmtWide) bytes = sizeof(wchar_t); #endif else /* if there is another fomat, add here */ @@ -782,9 +782,9 @@ XawTextPosition left, right; tempResult += text.length * bytes; } - if (bytes == sizeof(wchar_t)) + if (bytes == sizeof(wchar_t)) *((wchar_t*)tempResult) = (wchar_t)0; - else + else *tempResult = '\0'; return(result); } @@ -811,7 +811,7 @@ XawTextPosition left, right; n = wcslen(ws); for (j = 0, i = 0; j < n; j++) { wc = ws[j]; - if (XwcTextEscapement (sink->multi_sink.fontset, &wc, 1) || + if (XwcTextEscapement (sink->multi_sink.fontset, &wc, 1) || (wc == _Xaw_atowc(XawTAB)) || (wc == _Xaw_atowc(XawLF)) || (wc == _Xaw_atowc(XawESC))) ws[i++] = wc; } @@ -839,7 +839,7 @@ XawTextPosition left, right; } -/* +/* * This routine maps an x and y position in a window that is displaying text * into the corresponding position in the source. * @@ -857,7 +857,7 @@ Position x,y; XawTextPosition position; if (ctx->text.lt.lines == 0) return 0; - + for (line = 0; line < ctx->text.lt.lines - 1; line++) { if (y <= ctx->text.lt.info[line + 1].y) break; @@ -865,7 +865,7 @@ Position x,y; position = ctx->text.lt.info[line].position; if (position >= ctx->text.lastPos) return(ctx->text.lastPos); - fromx = (int) ctx->text.margin.left; + fromx = (int) ctx->text.margin.left; XawTextSinkFindPosition( ctx->text.sink, position, fromx, x - fromx, FALSE, &position, &width, &height); if (position > ctx->text.lastPos) return(ctx->text.lastPos); @@ -882,13 +882,13 @@ Position x,y; * NOTE: It is illegal to call this routine unless there is a valid line table! */ -static int +static int LineForPosition (ctx, position) TextWidget ctx; XawTextPosition position; { int line; - + for (line = 0; line < ctx->text.lt.lines; line++) if (position < ctx->text.lt.info[line + 1].position) break; @@ -936,7 +936,7 @@ Position *x, *y; * x offset, y offset, line length, etc.). */ -void +void #if NeedFunctionPrototypes _XawTextBuildLineTable ( TextWidget ctx, @@ -950,7 +950,7 @@ _XawTextBuildLineTable (ctx, position, force_rebuild) #endif { Dimension height = 0; - int lines = 0; + int lines = 0; Cardinal size; if ((int)ctx->core.height > VMargins(ctx)) { @@ -979,7 +979,7 @@ _XawTextBuildLineTable (ctx, position, force_rebuild) static XawTextPosition _BuildLineTable(ctx, position, min_pos, line) TextWidget ctx; -XawTextPosition position, min_pos; +XawTextPosition position, min_pos; int line; { XawTextLineTableEntry * lt = ctx->text.lt.info + line; @@ -992,7 +992,7 @@ int line; (ctx->text.resize == XawtextResizeBoth) ) || (ctx->text.wrap == XawtextWrapNever) ) width = BIGNUM; - else + else width = Max(0, ((int)ctx->core.width - (int)HMargins(ctx))); y = ( (line == 0) ? ctx->text.margin.top : lt->y ); @@ -1001,14 +1001,14 @@ int line; while ( TRUE ) { lt->y = y; lt->position = position; - + XawTextSinkFindPosition( ctx->text.sink, position, ctx->text.margin.left, width, ctx->text.wrap == XawtextWrapWord, &endPos, &realW, &realH); lt->textWidth = realW; y += realH; - if (ctx->text.wrap == XawtextWrapNever) + if (ctx->text.wrap == XawtextWrapNever) endPos = SrcScan(src, position, XawstEOL, XawsdRight, 1, TRUE); if ( endPos == ctx->text.lastPos) { /* We have reached the end. */ @@ -1031,14 +1031,14 @@ int line; * 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 + * 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. */ - for ( count = 0; count < 2 ; count++) + for ( count = 0; count < 2 ; count++) if (line++ < ctx->text.lt.lines) { /* make sure not to run of the end. */ (++lt)->y = (count == 0) ? y : ctx->core.height - 2 * ((ThreeDWidget)ctx->text.threeD)->threeD.shadow_width; @@ -1075,7 +1075,7 @@ TextWidget ctx; for (i = 0, widest = 1 ; i < lt->lines ; i++) if (widest < lt->info[i].textWidth) widest = lt->info[i].textWidth; - + return(widest); } @@ -1094,13 +1094,13 @@ TextWidget ctx; last = ctx->text.lt.info[ctx->text.lt.lines].position; if ( ctx->text.lt.info[ctx->text.lt.lines].position < ctx->text.lastPos ) last /= (float) ctx->text.lastPos; - else + else last = 1.0; if (ctx->text.scroll_vert == XawtextScrollWhenNeeded) { int line; XawTextPosition last_pos; - Position y = ctx->core.height - ctx->text.margin.bottom; + Position y = ctx->core.height - ctx->text.margin.bottom; if (ctx->text.hbar != NULL) y -= (ctx->text.hbar->core.height + @@ -1111,13 +1111,13 @@ TextWidget ctx; if ( (y < ctx->text.lt.info[line + 1].y) || ((last - first) < 1.0) ) CreateVScrollBar(ctx); - else + else DestroyVScrollBar(ctx); } - - if (ctx->text.vbar != NULL) + + if (ctx->text.vbar != NULL) XawScrollbarSetThumb(ctx->text.vbar, first, last - first); - + if ( (ctx->text.vbar == NULL) != temp) { _XawTextNeedsUpdating(ctx, zeroPosition, ctx->text.lastPos); if (ctx->text.vbar == NULL) @@ -1137,7 +1137,7 @@ TextWidget ctx; * displayed in the window. */ -void +void _XawTextSetScrollBars(ctx) TextWidget ctx; { @@ -1145,18 +1145,18 @@ TextWidget ctx; Boolean temp = (ctx->text.hbar == NULL); Boolean vtemp = (ctx->text.vbar == NULL); int s = ((ThreeDWidget)ctx->text.threeD)->threeD.shadow_width; - + CheckVBarScrolling(ctx); if (ctx->text.scroll_horiz == XawtextScrollNever) return; - if (ctx->text.vbar != NULL) + if (ctx->text.vbar != NULL) widest = (int)(ctx->core.width - ctx->text.vbar->core.width - 2 * s - ctx->text.vbar->core.border_width); else widest = ctx->core.width - 2 * s; widest /= (last = GetWidestLine(ctx)); - if (ctx->text.scroll_horiz == XawtextScrollWhenNeeded) + if (ctx->text.scroll_horiz == XawtextScrollWhenNeeded) if (widest < 1.0) CreateHScrollBar(ctx); else @@ -1167,11 +1167,11 @@ TextWidget ctx; CheckVBarScrolling(ctx); /* Recheck need for vbar, now that we added or removed the hbar.*/ } - + if (ctx->text.hbar != NULL) { first = ctx->text.r_margin.left - ctx->text.margin.left; first /= last; - XawScrollbarSetThumb(ctx->text.hbar, first, widest); + XawScrollbarSetThumb(ctx->text.hbar, first, widest); } if (((ctx->text.hbar == NULL) && (ctx->text.margin.left != @@ -1179,7 +1179,7 @@ TextWidget ctx; (ctx->text.vbar == NULL) != vtemp) { ctx->text.margin.left = ctx->text.r_margin.left; - _XawTextNeedsUpdating(ctx, zeroPosition, ctx->text.lastPos); + _XawTextNeedsUpdating(ctx, zeroPosition, ctx->text.lastPos); FlushUpdate(ctx); } } @@ -1193,7 +1193,7 @@ TextWidget ctx; void _XawTextVScroll(ctx, n) TextWidget ctx; -int n; +int n; { XawTextPosition top, target; int y; @@ -1201,7 +1201,7 @@ int n; XawTextLineTable * lt = &(ctx->text.lt); int s = ((ThreeDWidget)ctx->text.threeD)->threeD.shadow_width; - if (abs(n) > ctx->text.lt.lines) + if (abs(n) > ctx->text.lt.lines) n = (n > 0) ? ctx->text.lt.lines : -ctx->text.lt.lines; if (n == 0) return; @@ -1222,18 +1222,18 @@ int n; s, ctx->text.margin.top); PushCopyQueue(ctx, 0, (int) -y); - SinkClearToBG(ctx->text.sink, + SinkClearToBG(ctx->text.sink, (Position) s, (Position) (ctx->text.margin.top + ctx->core.height - y - s), (Dimension) ctx->core.width - 2 * s, (Dimension) ctx->core.height - 2 * s); if (n < lt->lines) n++; /* update descenders at bottom */ - _XawTextNeedsUpdating(ctx, lt->info[lt->lines - n].position, + _XawTextNeedsUpdating(ctx, lt->info[lt->lines - n].position, ctx->text.lastPos); _XawTextSetScrollBars(ctx); } - } + } else { XawTextPosition updateTo; unsigned int height, clear_height; @@ -1258,16 +1258,16 @@ int n; clear_height = 0; if ( updateTo == target ) { - XCopyArea(XtDisplay(ctx), XtWindow(ctx), XtWindow(ctx), ctx->text.gc, + XCopyArea(XtDisplay(ctx), XtWindow(ctx), XtWindow(ctx), ctx->text.gc, s, ctx->text.margin.top, (int) ctx->core.width - 2 * s, height, s, y); PushCopyQueue(ctx, 0, (int) y); SinkClearToBG(ctx->text.sink, (Position) s, ctx->text.margin.top, (Dimension) ctx->core.width - 2 * s, (Dimension) clear_height); - + _XawTextNeedsUpdating(ctx, lt->info[0].position, updateTo); _XawTextSetScrollBars(ctx); - } + } else if (lt->top != target) DisplayTextWindow((Widget)ctx); } @@ -1282,7 +1282,7 @@ int n; } /*ARGSUSED*/ -static void +static void HScroll(w, closure, callData) Widget w; XtPointer closure; /* TextWidget */ @@ -1302,7 +1302,7 @@ XtPointer callData; /* #pixels */ ctx->text.margin.left = ctx->text.r_margin.left; pixels = old_left - ctx->text.margin.left; } - + if (pixels > 0) { rect.width = (unsigned short) pixels + ctx->text.margin.right; rect.x = (short) ctx->core.width - (short) rect.width; @@ -1343,21 +1343,21 @@ XtPointer callData; /* #pixels */ t_rect.width = ctx->text.margin.right; t_rect.y = rect.y; t_rect.height = rect.height - 2 * s; - + SinkClearToBG(ctx->text.sink, (Position) t_rect.x, (Position) t_rect.y, (Dimension) t_rect.width, (Dimension) t_rect.height); - + UpdateTextInRectangle(ctx, &t_rect); } -/* +/* * Put in the text that just became visible. */ if ( pixels != 0 ) { SinkClearToBG(ctx->text.sink, (Position) rect.x, (Position) rect.y, (Dimension) rect.width, (Dimension) rect.height); - + UpdateTextInRectangle(ctx, &rect); } _XawTextExecuteUpdate(ctx); @@ -1365,7 +1365,7 @@ XtPointer callData; /* #pixels */ } /*ARGSUSED*/ -static void +static void HJump(w, closure, callData) Widget w; XtPointer closure, callData; /* closure = TextWidget, callData = percent. */ @@ -1386,7 +1386,7 @@ XtPointer closure, callData; /* closure = TextWidget, callData = percent. */ } _XawTextPrepareToUpdate(ctx); ctx->text.margin.left = new_left; - if (XtIsRealized((Widget) ctx)) DisplayTextWindow((Widget) ctx); + if (XtIsRealized((Widget) ctx)) DisplayTextWindow((Widget) ctx); _XawTextExecuteUpdate(ctx); } @@ -1405,7 +1405,7 @@ TextWidget ctx; int line; Position left, right; { - XawTextPosition pos1, pos2; + XawTextPosition pos1, pos2; int width, height, local_left, local_width; XawTextLineTableEntry * lt = ctx->text.lt.info + line; @@ -1415,15 +1415,15 @@ Position left, right; local_width = left - ctx->text.margin.left; XawTextSinkFindPosition(ctx->text.sink, lt->position, - (int) ctx->text.margin.left, + (int) ctx->text.margin.left, local_width, FALSE, &pos1, &width, &height); - if (right >= (Position) lt->textWidth - ctx->text.margin.left) + if (right >= (Position) lt->textWidth - ctx->text.margin.left) if ( (IsValidLine(ctx, line + 1)) && (ctx->text.lt.info[line + 1].position <= ctx->text.lastPos) ) - pos2 = SrcScan( ctx->text.source, (lt + 1)->position, XawstPositions, + pos2 = SrcScan( ctx->text.source, (lt + 1)->position, XawstPositions, XawsdLeft, 1, TRUE); - else + else pos2 = GETLASTPOS; else { XawTextPosition t_pos; @@ -1432,7 +1432,7 @@ Position left, right; local_width = right - local_left; XawTextSinkFindPosition(ctx->text.sink, pos1, local_left, local_width, FALSE, &pos2, &width, &height); - + t_pos = SrcScan( ctx->text.source, pos2, XawstPositions, XawsdRight, 1, TRUE); if (t_pos < (lt + 1)->position) @@ -1448,7 +1448,7 @@ Position left, right; */ /*ARGSUSED*/ -static void +static void VScroll(w, closure, callData) Widget w; XtPointer closure; /* TextWidget */ @@ -1462,7 +1462,7 @@ XtPointer callData; /* #pixels */ height = 1; nlines = (int) (lines * (int) ctx->text.lt.lines) / height; #ifdef XAW_ARROW_SCROLLBARS - if (nlines == 0 && lines != 0) + if (nlines == 0 && lines != 0) nlines = lines > 0 ? 1 : -1; #endif _XawTextPrepareToUpdate(ctx); @@ -1483,7 +1483,7 @@ XtPointer callData; /* #pixels */ */ /*ARGSUSED*/ -static void +static void VJump(w, closure, callData) Widget w; XtPointer closure, callData; /* closuer = TextWidget, callData = percent. */ @@ -1510,7 +1510,7 @@ XtPointer closure, callData; /* closuer = TextWidget, callData = percent. */ else { XawTextPosition new_bot; _XawTextBuildLineTable(ctx, position, FALSE); - new_bot = IsValidLine(ctx, lt->lines-1) ? lt->info[lt->lines-1].position + new_bot = IsValidLine(ctx, lt->lines-1) ? lt->info[lt->lines-1].position : ctx->text.lastPos; if ((old_top >= lt->top) && (old_top <= new_bot)) { @@ -1519,7 +1519,7 @@ XtPointer closure, callData; /* closuer = TextWidget, callData = percent. */ _XawTextBuildLineTable(ctx, old_top, FALSE); _XawTextVScroll(ctx, -line); } - else + else DisplayTextWindow( (Widget) ctx); } _XawTextExecuteUpdate(ctx); @@ -1539,7 +1539,7 @@ XawTextSelection *s; return False; } -static Boolean +static Boolean ConvertSelection(w, selection, target, type, value, length, format) Widget w; Atom *selection, *target, *type; @@ -1560,13 +1560,13 @@ int *format; Atom* targetP, * std_targets; unsigned long std_length; - if ( SrcCvtSel(src, selection, target, type, value, length, format) ) + if ( SrcCvtSel(src, selection, target, type, value, length, format) ) return True; - XmuConvertStandardSelection(w, ctx->text.time, selection, + XmuConvertStandardSelection(w, ctx->text.time, selection, target, type, (XPointer*)&std_targets, &std_length, format); - + *value = XtMalloc((unsigned) sizeof(Atom)*(std_length + 7)); targetP = *(Atom**)value; *length = std_length + 6; @@ -1590,7 +1590,7 @@ int *format; *format = 32; return True; } - + if ( SrcCvtSel(src, selection, target, type, value, length, format) ) return True; @@ -1618,8 +1618,8 @@ int *format; } else { *type = *target; } - /* - * If salt is True, the salt->contents stores CT string, + /* + * If salt is True, the salt->contents stores CT string, * its length is measured in bytes. * Refer to _XawTextSaltAwaySelection(). * @@ -1680,13 +1680,13 @@ int *format; if ( (*target == XA_LIST_LENGTH(d)) || (*target == XA_LENGTH(d)) ) { long * temp; - + temp = (long *) XtMalloc( (unsigned) sizeof(long) ); if (*target == XA_LIST_LENGTH(d)) *temp = 1L; else /* *target == XA_LENGTH(d) */ *temp = (long) (s->right - s->left); - + *value = (XPointer) temp; *type = XA_INTEGER; *length = 1L; @@ -1696,7 +1696,7 @@ int *format; if (*target == XA_CHARACTER_POSITION(d)) { long * temp; - + temp = (long *) XtMalloc( (unsigned)( 2 * sizeof(long) ) ); temp[0] = (long) (s->left + 1); temp[1] = s->right; @@ -1709,7 +1709,7 @@ int *format; if (*target == XA_DELETE(d)) { void _XawTextZapSelection(); /* From TextAction.c */ - + if (!salt) _XawTextZapSelection( ctx, (XEvent *) NULL, TRUE); *value = NULL; @@ -1722,7 +1722,7 @@ int *format; if (XmuConvertStandardSelection(w, ctx->text.time, selection, target, type, (XPointer *)value, length, format)) return True; - + /* else */ return False; } @@ -1751,7 +1751,7 @@ Atom atom; return(NOT_A_CUT_BUFFER); } -static void +static void LoseSelection(w, selection) Widget w; Atom *selection; @@ -1765,7 +1765,7 @@ Atom *selection; atomP = ctx->text.s.selections; for (i = 0 ; i < ctx->text.s.atom_count; i++, atomP++) - if ( (*selection == *atomP) || + if ( (*selection == *atomP) || (GetCutBufferNumber(*atomP) != NOT_A_CUT_BUFFER) )/* is a cut buffer */ *atomP = (Atom)0; @@ -1785,10 +1785,10 @@ Atom *selection; ctx->text.s.selections[ctx->text.s.atom_count-1] == 0) ctx->text.s.atom_count--; } - + if (ctx->text.s.atom_count == 0) ModifySelection(ctx, ctx->text.insertPos, ctx->text.insertPos); - + if (ctx->text.old_insert >= 0) /* Update in progress. */ _XawTextExecuteUpdate(ctx); @@ -1800,17 +1800,17 @@ Atom *selection; for (i = 0 ; i < salt->s.atom_count; i++, atomP++) if (*selection == *atomP) *atomP = (Atom)0; - + while (salt->s.atom_count && salt->s.selections[salt->s.atom_count-1] == 0) { salt->s.atom_count--; } - + /* * Must walk the selection list in opposite order from UnsetSelection. */ - + atomP = salt->s.selections; for (i = 0 ; i < salt->s.atom_count; i++, atomP++) if (*atomP == (Atom)0) @@ -1894,7 +1894,7 @@ int num_atoms; salt->s.atom_count = j; } -static void +static void _SetSelection(ctx, left, right, selections, count) TextWidget ctx; XawTextPosition left, right; @@ -1902,7 +1902,7 @@ Atom *selections; Cardinal count; { XawTextPosition pos; - + if (left < ctx->text.s.left) { pos = Min(right, ctx->text.s.left); _XawTextNeedsUpdating(ctx, left, pos); @@ -1919,7 +1919,7 @@ Cardinal count; pos = Max(left, ctx->text.s.right); _XawTextNeedsUpdating(ctx, pos, right); } - + ctx->text.s.left = left; ctx->text.s.right = right; @@ -1929,7 +1929,7 @@ Cardinal count; if (left < right) { Widget w = (Widget) ctx; int buffer; - + while (count) { Atom selection = selections[--count]; @@ -1939,7 +1939,7 @@ Cardinal count; unsigned int amount, max_len = MAX_CUT_LEN(XtDisplay(w)); unsigned long len; - tptr= ptr= (unsigned char *) _XawTextGetSTRING(ctx, ctx->text.s.left, + tptr= ptr= (unsigned char *) _XawTextGetSTRING(ctx, ctx->text.s.left, ctx->text.s.right); #ifdef XAW_INTERNATIONALIZATION if (_XawTextFormat(ctx) == XawFmtWide) { @@ -1955,28 +1955,28 @@ Cardinal count; } XtFree((char *)ptr); tptr = ptr = textprop.value; - } + } #endif if (buffer == 0) { _CreateCutBuffers(XtDisplay(w)); XRotateBuffers(XtDisplay(w), 1); } amount = Min ( (len = strlen((char *)ptr)), max_len); - XChangeProperty(XtDisplay(w), RootWindow(XtDisplay(w), 0), selection, + XChangeProperty(XtDisplay(w), RootWindow(XtDisplay(w), 0), selection, XA_STRING, 8, PropModeReplace, ptr, amount); while (len > max_len) { len -= max_len; tptr += max_len; amount = Min (len, max_len); - XChangeProperty(XtDisplay(w), RootWindow(XtDisplay(w), 0), - selection, XA_STRING, 8, PropModeAppend, + XChangeProperty(XtDisplay(w), RootWindow(XtDisplay(w), 0), + selection, XA_STRING, 8, PropModeAppend, tptr, amount); } XtFree ((char *)ptr); } else /* This is a real selection */ - XtOwnSelection(w, selection, ctx->text.time, ConvertSelection, + XtOwnSelection(w, selection, ctx->text.time, ConvertSelection, LoseSelection, (XtSelectionDoneProc)NULL); } } @@ -1992,7 +1992,7 @@ Cardinal count; * NOTE: It is illegal to call this routine unless there is a valid line table! */ -int +int _XawTextReplace (ctx, pos1, pos2, text) TextWidget ctx; XawTextPosition pos1, pos2; @@ -2008,7 +2008,7 @@ XawTextBlock *text; ctx->text.update_disabled = True; /* No redisplay during replacement. */ /* - * The insertPos may not always be set to the right spot in XawtextAppend + * The insertPos may not always be set to the right spot in XawtextAppend */ XtSetArg(args[0], XtNeditType, &edit_mode); @@ -2056,27 +2056,27 @@ XawTextBlock *text; ctx->text.updateTo[i] += delta; } } - - /* + + /* * 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) { XawTextLineTableEntry *lineP; i = LineForPosition(ctx, pos1) + 1; for (lineP = ctx->text.lt.info + i; i <= ctx->text.lt.lines; i++, lineP++) lineP->position += delta; } - + /* * 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. */ - + if (IsPositionVisible(ctx, updateFrom)) { - updateTo = _BuildLineTable(ctx, + updateTo = _BuildLineTable(ctx, ctx->text.lt.info[line1].position, pos1, line1); _XawTextNeedsUpdating(ctx, updateFrom, updateTo); } @@ -2087,14 +2087,14 @@ XawTextBlock *text; /* * This routine will display text between two arbitrary source positions. - * In the event that this span contains highlighted text for the selection, + * 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! + * is a valid line table! */ -static void +static void DisplayText(w, pos1, pos2) Widget w; XawTextPosition pos1, pos2; @@ -2111,10 +2111,10 @@ XawTextPosition pos1, pos2; if ( (pos1 >= pos2) || !LineAndXYForPosition(ctx, pos1, &line, &x, &y) ) return; /* line not visible, or pos1 >= pos2. */ - for ( startPos = pos1, i = line; IsValidLine(ctx, i) && + for ( startPos = pos1, i = line; IsValidLine(ctx, i) && (i < ctx->text.lt.lines) ; i++) { - + if ( (endPos = ctx->text.lt.info[i + 1].position) > pos2 ) { clear_eol = ((endPos = pos2) >= lastPos); done_painting = (!clear_eol || ctx->text.single_char); @@ -2133,7 +2133,7 @@ XawTextPosition pos1, pos2; if ( (x == (Position) ctx->text.margin.left) && (x > 0) ) { SinkClearToBG (ctx->text.sink, - (Position) s, y, + (Position) s, y, (Dimension) ctx->text.margin.left, (Dimension)height); _ShadowSurroundedBox((Widget)ctx, (ThreeDWidget)ctx->text.threeD, 0, 0, ctx->core.width, ctx->core.height, @@ -2141,7 +2141,7 @@ XawTextPosition pos1, pos2; False); } - if ( (startPos >= ctx->text.s.right) || (endPos <= ctx->text.s.left) ) + if ( (startPos >= ctx->text.s.right) || (endPos <= ctx->text.s.left) ) XawTextSinkDisplayText(ctx->text.sink, x, y, startPos, endPos, FALSE); else if ((startPos >= ctx->text.s.left) && (endPos <= ctx->text.s.right)) XawTextSinkDisplayText(ctx->text.sink, x, y, startPos, endPos, TRUE); @@ -2156,7 +2156,7 @@ XawTextPosition pos1, pos2; if (clear_eol) { Position myx = ctx->text.lt.info[i].textWidth + ctx->text.margin.left; - SinkClearToBG(ctx->text.sink, + SinkClearToBG(ctx->text.sink, (Position) myx, (Position) y, w->core.width - myx/* - 2 * s*/, (Dimension) height); @@ -2170,7 +2170,7 @@ XawTextPosition pos1, pos2; * 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. @@ -2178,8 +2178,8 @@ XawTextPosition pos1, pos2; if (done_painting) { y += height; - SinkClearToBG(ctx->text.sink, - (Position) ctx->text.margin.left, (Position) y, + SinkClearToBG(ctx->text.sink, + (Position) ctx->text.margin.left, (Position) y, w->core.width - ctx->text.margin.left/* - 2 * s*/, (Dimension) Min(height, ctx->core.height - 2 * s - y)); _ShadowSurroundedBox((Widget)ctx, (ThreeDWidget)ctx->text.threeD, @@ -2210,7 +2210,7 @@ XawTextPosition pos1, pos2; * multi-click selection user interfaces.] */ -static void +static void DoSelection (ctx, pos, time, motion) TextWidget ctx; XawTextPosition pos; @@ -2233,25 +2233,25 @@ Boolean motion; newType = *(ctx->text.sarray); else { newType = *(sarray + 1); - if (newType == XawselectNull) + if (newType == XawselectNull) newType = *(ctx->text.sarray); } - } + } else /* single-click event */ newType = *(ctx->text.sarray); ctx->text.lasttime = time; } switch (newType) { - case XawselectPosition: + case XawselectPosition: newLeft = newRight = pos; break; - case XawselectChar: + case XawselectChar: newLeft = pos; newRight = SrcScan(src, pos, XawstPositions, XawsdRight, 1, FALSE); break; - case XawselectWord: - case XawselectParagraph: + case XawselectWord: + case XawselectParagraph: { XawTextScanType stype; @@ -2264,14 +2264,14 @@ Boolean motion; * 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. */ newRight = SrcScan(ctx->text.source, pos, stype, XawsdRight, 1, FALSE); newRight =SrcScan(ctx->text.source, newRight,stype,XawsdLeft,1, FALSE); - if (pos != newRight) + if (pos != newRight) newLeft = SrcScan(ctx->text.source, pos, stype, XawsdLeft, 1, FALSE); else newLeft = pos; @@ -2285,11 +2285,11 @@ Boolean motion; } } break; - case XawselectLine: + case XawselectLine: newLeft = SrcScan(src, pos, XawstEOL, XawsdLeft, 1, FALSE); newRight = SrcScan(src, pos, XawstEOL, XawsdRight, 1, FALSE); break; - case XawselectAll: + case XawselectAll: newLeft = SrcScan(src, pos, XawstAll, XawsdLeft, 1, FALSE); newRight = SrcScan(src, pos, XawstAll, XawsdRight, 1, FALSE); break; @@ -2304,7 +2304,7 @@ Boolean motion; ModifySelection(ctx, newLeft, newRight); if (pos - ctx->text.s.left < ctx->text.s.right - pos) ctx->text.insertPos = newLeft; - else + else ctx->text.insertPos = newRight; ctx->text.s.type = newType; } @@ -2328,7 +2328,7 @@ Boolean motion; * end you are extending!). */ -static void +static void ExtendSelection (ctx, pos, motion) TextWidget ctx; XawTextPosition pos; @@ -2338,12 +2338,12 @@ Boolean motion; if (!motion) { /* setup for extending selection */ if (ctx->text.s.left == ctx->text.s.right) /* no current selection. */ - ctx->text.s.left = ctx->text.s.right = ctx->text.insertPos; + ctx->text.s.left = ctx->text.s.right = ctx->text.insertPos; else { ctx->text.origSel.left = ctx->text.s.left; ctx->text.origSel.right = ctx->text.s.right; } - + ctx->text.origSel.type = ctx->text.s.type; if (pos >= ctx->text.s.left + ((ctx->text.s.right - ctx->text.s.left) / 2)) @@ -2361,7 +2361,7 @@ Boolean motion; dir = ctx->text.extendDir; switch (ctx->text.s.type) { - case XawselectWord: + case XawselectWord: case XawselectParagraph: { XawTextPosition left_pos, right_pos; @@ -2376,14 +2376,14 @@ Boolean motion; * 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. */ right_pos = SrcScan(ctx->text.source, pos, stype, XawsdRight, 1, FALSE); right_pos =SrcScan(ctx->text.source, right_pos,stype,XawsdLeft,1, FALSE); - if (pos != right_pos) + if (pos != right_pos) left_pos = SrcScan(ctx->text.source, pos, stype, XawsdLeft, 1, FALSE); else left_pos = pos; @@ -2399,13 +2399,13 @@ Boolean motion; case XawselectLine: pos = SrcScan(ctx->text.source, pos, XawstEOL, dir, 1, dir == XawsdRight); break; - case XawselectAll: + case XawselectAll: pos = ctx->text.insertPos; case XawselectPosition: /* fall through. */ default: break; } - + if (dir == XawsdRight) ModifySelection(ctx, ctx->text.s.left, pos); else @@ -2427,8 +2427,8 @@ Widget w; if (XtIsRealized(w)) { - SinkClearToBG(ctx->text.sink, - (Position) s, (Position) s, + SinkClearToBG(ctx->text.sink, + (Position) s, (Position) s, w->core.width - 2 * s, w->core.height - 2 * s); /* note to self: _ShadowSurroundedBox() hack might be needed here */ } @@ -2451,7 +2451,7 @@ TextWidget ctx; _XawTextVScroll(ctx, scroll_by); DisplayTextWindow( (Widget) ctx); } - + /* * Internal redisplay entire window. * Legal to call only if widget is realized. @@ -2486,13 +2486,13 @@ TextWidget ctx; (ctx->text.resize == XawtextResizeBoth) ) { XawTextLineTableEntry *lt; rbox.width = 0; - for (lt = ctx->text.lt.info; + for (lt = ctx->text.lt.info; IsValidLine(ctx, line) && (line < ctx->text.lt.lines); line++, lt++) { if ((int)(lt->textWidth + ctx->text.margin.left) > (int)rbox.width) rbox.width = lt->textWidth + ctx->text.margin.left; } - + rbox.width += ctx->text.margin.right; if (rbox.width > ctx->core.width) { /* Only get wider. */ rbox.request_mode = CWWidth; @@ -2509,19 +2509,19 @@ TextWidget ctx; line = LineForPosition(ctx, ctx->text.lastPos); else line = ctx->text.lt.lines; - + if ( (line + 1) == ctx->text.lt.lines ) return; - + old_height = ctx->core.height; rbox.request_mode = CWHeight; rbox.height = XawTextSinkMaxHeight(ctx->text.sink, line + 1) + VMargins(ctx); - + if ((int)rbox.height < old_height) return; /* It will only get taller. */ if (XtMakeGeometryRequest(w, &rbox, &return_geom) == XtGeometryAlmost) if (XtMakeGeometryRequest(w, &return_geom, (XtWidgetGeometry*)NULL) != XtGeometryYes) return; - + _XawTextBuildLineTable(ctx, ctx->text.lt.top, TRUE); } @@ -2597,7 +2597,7 @@ ModifySelection(ctx, left, right) TextWidget ctx; XawTextPosition left, right; { - if (left == right) + if (left == right) ctx->text.insertPos = left; _SetSelection( ctx, left, right, (Atom*) NULL, ZERO ); } @@ -2608,11 +2608,11 @@ XawTextPosition left, right; * multi-click selection user interfaces from the outside. */ -void +void _XawTextAlterSelection (ctx, mode, action, params, num_params) TextWidget ctx; XawTextSelectionMode mode; /* {XawsmTextSelect, XawsmTextExtend} */ -XawTextSelectionAction action; /* {XawactionStart, +XawTextSelectionAction action; /* {XawactionStart, XawactionAdjust, XawactionEnd} */ String *params; Cardinal *num_params; @@ -2624,7 +2624,7 @@ Cardinal *num_params; * This flag is used by TextPop.c:DoReplace() to determine if the selection * is okay to use, or if it has been modified. */ - + if (ctx->text.search != NULL) ctx->text.search->selection_changed = TRUE; @@ -2636,7 +2636,7 @@ Cardinal *num_params; else /* mode == XawsmTextExtend */ ExtendSelection (ctx, position, flag); - if (action == XawactionEnd) + if (action == XawactionEnd) _XawTextSetSelection(ctx, ctx->text.s.left, ctx->text.s.right, params, *num_params); } @@ -2675,7 +2675,7 @@ XRectangle * rect; for (line = 0;( (line < ctx->text.lt.lines) && IsValidLine(ctx, line) && (info->y < bottom)); line++, info++) - if ( (info + 1)->y >= y ) + if ( (info + 1)->y >= y ) UpdateTextInLine(ctx, line, x, right); } @@ -2695,7 +2695,7 @@ Region region; /* Unused. */ TextWidget ctx = (TextWidget) w; XRectangle expose, cursor; Boolean need_to_draw; - + if (event->type == Expose) { expose.x = event->xexpose.x; expose.y = event->xexpose.y; @@ -2707,17 +2707,17 @@ Region region; /* Unused. */ expose.y = event->xgraphicsexpose.y; expose.width = event->xgraphicsexpose.width; expose.height = event->xgraphicsexpose.height; - } + } else { /* No Expose */ - PopCopyQueue(ctx); + PopCopyQueue(ctx); return; /* no more processing necessary. */ } need_to_draw = TranslateExposeRegion(ctx, &expose); if ((event->type == GraphicsExpose) && (event->xgraphicsexpose.count == 0)) - PopCopyQueue(ctx); + PopCopyQueue(ctx); - if (!need_to_draw) + if (!need_to_draw) return; /* don't draw if we don't need to. */ _XawTextPrepareToUpdate(ctx); @@ -2757,7 +2757,7 @@ TextWidget ctx; * ranges where possible. */ -static +static void FlushUpdate(ctx) TextWidget ctx; { @@ -2795,8 +2795,8 @@ TextWidget ctx; /* * 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 + * 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. */ @@ -2813,20 +2813,20 @@ TextWidget ctx; /* * Find out the bottom the visable window, and make sure that the - * cursor does not go past the end of this space. + * 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. + * This makes sure that the cursor does not go past the end of the + * visable window. */ x = ctx->core.width; y = ctx->core.height - ctx->text.margin.bottom; if (ctx->text.hbar != NULL) y -= ctx->text.hbar->core.height + 2 * ctx->text.hbar->core.border_width; - + max_pos = PositionForXY (ctx, x, y); lines = LineForPosition(ctx, max_pos) + 1; /* number of visable lines. */ - + if ( (ctx->text.insertPos >= ctx->text.lt.top) && (ctx->text.insertPos < max_pos)) return; @@ -2845,7 +2845,7 @@ TextWidget ctx; first = SrcScan(ctx->text.source, first, XawstEOL, XawsdLeft, 1, TRUE); - if ( - number > lines ) + if ( - number > lines ) break; number--; @@ -2853,17 +2853,17 @@ TextWidget ctx; if (first <= top) { /* If we found the proper number of lines. */ - + /* Back up to just before the last CR. */ - + first = SrcScan(ctx->text.source, first, XawstPositions, XawsdRight, 1, TRUE); - + /* Check to make sure the cursor is visable. */ - + if (first <= top) number++; - + lines = number; } else @@ -2873,17 +2873,17 @@ TextWidget ctx; top = SrcScan(ctx->text.source, ctx->text.insertPos, XawstEOL, XawsdLeft, lines, FALSE); - if (top < max_pos) + if (top < max_pos) lines = LineForPosition(ctx, top); - else + else no_scroll = TRUE; } if (no_scroll) { - _XawTextBuildLineTable(ctx, top, FALSE); + _XawTextBuildLineTable(ctx, top, FALSE); DisplayTextWindow((Widget)ctx); } - else + else _XawTextVScroll(ctx, lines); _XawTextSetScrollBars(ctx); @@ -2897,7 +2897,7 @@ void _XawTextExecuteUpdate(ctx) TextWidget ctx; { - if ( ctx->text.update_disabled || (ctx->text.old_insert < 0) ) + if ( ctx->text.update_disabled || (ctx->text.old_insert < 0) ) return; if((ctx->text.old_insert != ctx->text.insertPos) || (ctx->text.showposition)) @@ -2908,7 +2908,7 @@ TextWidget ctx; } -static void +static void TextDestroy(w) Widget w; { @@ -2926,7 +2926,7 @@ Widget w; /* * by the time we are managed (and get this far) we had better - * have both a source and a sink + * have both a source and a sink */ static void @@ -2947,7 +2947,7 @@ Widget w; */ /*ARGSUSED*/ -static Boolean +static Boolean SetValues(current, request, new, args, num_args) Widget current, request, new; ArgList args; @@ -2970,9 +2970,9 @@ Cardinal *num_args; newtw->text.vbar->core.border_width; redisplay = TRUE; } - + if (oldtw->text.scroll_vert != newtw->text.scroll_vert) { - if (newtw->text.scroll_vert == XawtextScrollNever) + if (newtw->text.scroll_vert == XawtextScrollNever) DestroyVScrollBar(newtw); else if (newtw->text.scroll_vert == XawtextScrollAlways) CreateVScrollBar(newtw); @@ -2986,9 +2986,9 @@ Cardinal *num_args; newtw->text.hbar->core.border_width; redisplay = TRUE; } - + if (oldtw->text.scroll_horiz != newtw->text.scroll_horiz) { - if (newtw->text.scroll_horiz == XawtextScrollNever) + if (newtw->text.scroll_horiz == XawtextScrollNever) DestroyHScrollBar(newtw); else if (newtw->text.scroll_horiz == XawtextScrollAlways) CreateHScrollBar(newtw); @@ -3034,7 +3034,7 @@ static Boolean ChangeSensitive(w) (*(&simpleClassRec)->simple_class.change_sensitive)(w); - XtSetArg(args[0], XtNancestorSensitive, + XtSetArg(args[0], XtNancestorSensitive, (tw->core.ancestor_sensitive && tw->core.sensitive)); if (tw->text.vbar) XtSetValues(tw->text.vbar, args, ONE); @@ -3078,7 +3078,7 @@ XawTextPosition pos; } /************************************************************ - * + * * Routines for handling the copy area expose queue. * ************************************************************/ @@ -3200,7 +3200,7 @@ XRectangle * expose; if (width <= 0) return(FALSE); /* no need to draw outside the window. */ - + expose->x = x; expose->y = y; expose->width = width; @@ -3212,10 +3212,10 @@ XRectangle * expose; void #if NeedFunctionPrototypes -_XawTextPosToXY( - Widget w, - XawTextPosition pos, - Position* x, +_XawTextPosToXY( + Widget w, + XawTextPosition pos, + Position* x, Position* y ) #else _XawTextPosToXY( w, pos, x, y ) @@ -3247,7 +3247,7 @@ Widget w; #endif { if (!XtIsRealized(w)) return; - + _XawTextPrepareToUpdate( (TextWidget) w); DisplayTextWindow(w); _XawTextExecuteUpdate( (TextWidget) w); @@ -3279,7 +3279,7 @@ XawTextPosition* left,* right; } -void +void #if NeedFunctionPrototypes XawTextSetSource(Widget w, Widget source, XawTextPosition startPos) #else @@ -3295,7 +3295,7 @@ XawTextPosition startPos; ctx->text.s.left = ctx->text.s.right = 0; ctx->text.insertPos = startPos; ctx->text.lastPos = GETLASTPOS; - + _XawTextBuildLineTable(ctx, ctx->text.lt.top, TRUE); XawTextDisplay(w); } @@ -3307,7 +3307,7 @@ XawTextPosition startPos; * will be repainted properly. */ -int +int #if NeedFunctionPrototypes XawTextReplace(Widget w, XawTextPosition startPos, XawTextPosition endPos, XawTextBlock *text) @@ -3336,11 +3336,11 @@ XawTextBlock *text; _XawTextCheckResize(ctx); _XawTextExecuteUpdate(ctx); _XawTextSetScrollBars(ctx); - + return result; } -XawTextPosition +XawTextPosition #if NeedFunctionPrototypes XawTextTopPosition(Widget w) #else @@ -3351,7 +3351,7 @@ Widget w; return( ((TextWidget) w)->text.lt.top ); } -void +void #if NeedFunctionPrototypes XawTextSetInsertionPoint(Widget w, XawTextPosition position) #else @@ -3384,7 +3384,7 @@ Widget w; * NOTE: Must walk the selection list in opposite order from LoseSelection. */ -void +void #if NeedFunctionPrototypes XawTextUnsetSelection(Widget w) #else @@ -3402,7 +3402,7 @@ Widget w; */ if (GetCutBufferNumber(sel) == NOT_A_CUT_BUFFER) XtDisownSelection(w, sel, ctx->text.time); - LoseSelection(w, &sel); /* In case this is a cut buffer, or + LoseSelection(w, &sel); /* In case this is a cut buffer, or XtDisownSelection failed to call us. */ } } @@ -3418,14 +3418,14 @@ XawTextPosition left, right; #endif { TextWidget ctx = (TextWidget) w; - + _XawTextPrepareToUpdate(ctx); _XawTextSetSelection(ctx, FindGoodPosition(ctx, left), FindGoodPosition(ctx, right), (String*)NULL, ZERO); _XawTextExecuteUpdate(ctx); } -void +void #if NeedFunctionPrototypes XawTextInvalidate(Widget w, XawTextPosition from, XawTextPosition to) #else @@ -3458,7 +3458,7 @@ Widget w; _XawTextPrepareToUpdate( (TextWidget) w); } -void +void #if NeedFunctionPrototypes XawTextEnableRedisplay(Widget w) #else @@ -3475,9 +3475,9 @@ Widget w; lastPos = ctx->text.lastPos = GETLASTPOS; ctx->text.lt.top = FindGoodPosition(ctx, ctx->text.lt.top); ctx->text.insertPos = FindGoodPosition(ctx, ctx->text.insertPos); - if ( (ctx->text.s.left > lastPos) || (ctx->text.s.right > lastPos) ) + if ( (ctx->text.s.left > lastPos) || (ctx->text.s.right > lastPos) ) ctx->text.s.left = ctx->text.s.right = 0; - + _XawTextBuildLineTable(ctx, ctx->text.lt.top, TRUE); if (XtIsRealized(w)) DisplayTextWindow(w); @@ -3525,10 +3525,10 @@ Boolean display_caret; /* Function Name: XawTextSearch(w, dir, text). * Description: searches for the given text block. * Arguments: w - The text widget. - * dir - The direction to search. + * 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 + * Returns: The position of the text found, or XawTextSearchError on * an error. */ @@ -3542,7 +3542,7 @@ XawTextSearch(Widget w, #endif XawTextBlock *text) #else -XawTextSearch(w, dir, text) +XawTextSearch(w, dir, text) Widget w; XawTextScanDirection dir; XawTextBlock * text; @@ -3552,7 +3552,7 @@ XawTextBlock * text; return(SrcSearch(ctx->text.source, ctx->text.insertPos, dir, text)); } - + TextClassRec textClassRec = { { /* core fields */ /* superclass */ (WidgetClass) &simpleClassRec, diff --git a/src/TextAction.c b/src/TextAction.c index 82abd4e..287c0bd 100644 --- a/src/TextAction.c +++ b/src/TextAction.c @@ -73,17 +73,17 @@ void _XawTextPrepareToUpdate(); int _XawTextReplace(); static void ParameterError(w, param) - Widget w; + Widget w; String param; { String params[2]; Cardinal num_params = 2; params[0] = XtName(w); params[1] = param; - + XtAppWarningMsg( XtWidgetToApplicationContext(w), "parameterError", "textAction", "XawError", - "Widget: %s Parameter: %s", + "Widget: %s Parameter: %s", params, &num_params); XBell( XtDisplay( w ), 50 ); } @@ -185,7 +185,7 @@ static int ProbablyMB(s) static void GetSelection(); /* ARGSUSED */ -static void +static void _SelectionReceived(w, client_data, selection, type, value, length, format) Widget w; XtPointer client_data; @@ -196,7 +196,7 @@ int* format; { TextWidget ctx = (TextWidget)w; XawTextBlock text; - + if (*type == 0 /*XT_CONVERT_FAIL*/ || *length == 0) { struct _SelectionList* list = (struct _SelectionList*)client_data; if (list != NULL) { @@ -279,7 +279,7 @@ we are, and convert it. I also warn the user that the other client is evil. */ XBell(XtDisplay(ctx), 0); return; } - ctx->text.insertPos = SrcScan(ctx->text.source, ctx->text.insertPos, + ctx->text.insertPos = SrcScan(ctx->text.source, ctx->text.insertPos, XawstPositions, XawsdRight, text.length, TRUE); _XawTextSetScrollBars(ctx); @@ -288,7 +288,7 @@ we are, and convert it. I also warn the user that the other client is evil. */ XFree(value); /* the selection value should be freed with XFree */ } -static void +static void GetSelection(w, time, params, num_params) Widget w; Time time; @@ -337,7 +337,7 @@ Cardinal num_params; } } -static void +static void InsertSelection(w, event, params, num_params) Widget w; XEvent* event; @@ -370,7 +370,7 @@ Boolean include; } /*ARGSUSED*/ -static void +static void MoveForwardChar(w, event, p, n) Widget w; XEvent* event; @@ -381,7 +381,7 @@ Cardinal* n; } /*ARGSUSED*/ -static void +static void MoveBackwardChar(w, event, p, n) Widget w; XEvent* event; @@ -392,7 +392,7 @@ Cardinal* n; } /*ARGSUSED*/ -static void +static void MoveForwardWord(w, event, p, n) Widget w; XEvent* event; @@ -403,7 +403,7 @@ Cardinal* n; } /*ARGSUSED*/ -static void +static void MoveBackwardWord(w, event, p, n) Widget w; XEvent* event; @@ -434,7 +434,7 @@ Cardinal* n; } /*ARGSUSED*/ -static void +static void MoveToLineEnd(w, event, p, n) Widget w; XEvent* event; @@ -445,7 +445,7 @@ Cardinal* n; } /*ARGSUSED*/ -static void +static void MoveToLineStart(w, event, p, n) Widget w; XEvent* event; @@ -483,7 +483,7 @@ XawTextScanDirection dir; FindPos(ctx->text.sink, new, ctx->text.margin.left, from_left, FALSE, &(ctx->text.insertPos), &garbage, &garbage); - + if (ctx->text.insertPos > next_line) ctx->text.insertPos = next_line; @@ -491,7 +491,7 @@ XawTextScanDirection dir; } /*ARGSUSED*/ -static void +static void MoveNextLine(w, event, p, n) Widget w; XEvent* event; @@ -502,7 +502,7 @@ Cardinal* n; } /*ARGSUSED*/ -static void +static void MovePreviousLine(w, event, p, n) Widget w; XEvent* event; @@ -524,7 +524,7 @@ Cardinal* n; } /*ARGSUSED*/ -static void +static void MoveEndOfFile(w, event, p, n) Widget w; XEvent* event; @@ -534,7 +534,7 @@ Cardinal* n; Move((TextWidget) w, event, XawsdRight, XawstAll, TRUE); } -static void +static void Scroll(ctx, event, dir) TextWidget ctx; XEvent* event; @@ -551,7 +551,7 @@ XawTextScanDirection dir; } /*ARGSUSED*/ -static void +static void ScrollOneLineUp(w, event, p, n) Widget w; XEvent* event; @@ -562,7 +562,7 @@ Cardinal* n; } /*ARGSUSED*/ -static void +static void ScrollOneLineDown(w, event, p, n) Widget w; XEvent* event; @@ -572,7 +572,7 @@ Cardinal* n; Scroll( (TextWidget) w, event, XawsdRight); } -static void +static void MovePage(ctx, event, dir) TextWidget ctx; XEvent* event; @@ -590,7 +590,7 @@ XawTextScanDirection dir; } /*ARGSUSED*/ -static void +static void MoveNextPage(w, event, p, n) Widget w; XEvent* event; @@ -601,7 +601,7 @@ Cardinal* n; } /*ARGSUSED*/ -static void +static void MovePreviousPage(w, event, p, n) Widget w; XEvent* event; @@ -633,7 +633,7 @@ MatchSelection(selection, s) #define SrcCvtSel XawTextSourceConvertSelection -static Boolean +static Boolean ConvertSelection(w, selection, target, type, value, length, format) Widget w; Atom *selection, *target, *type; @@ -653,13 +653,13 @@ ConvertSelection(w, selection, target, type, value, length, format) Atom* targetP, * std_targets; unsigned long std_length; - if ( SrcCvtSel(src, selection, target, type, value, length, format) ) + if ( SrcCvtSel(src, selection, target, type, value, length, format) ) return True; - XmuConvertStandardSelection(w, ctx->text.time, selection, + XmuConvertStandardSelection(w, ctx->text.time, selection, target, type, (XPointer*)&std_targets, &std_length, format); - + *value = XtMalloc((unsigned) sizeof(Atom)*(std_length + 7)); targetP = *(Atom**)value; @@ -684,7 +684,7 @@ ConvertSelection(w, selection, target, type, value, length, format) *format = 32; return True; } - + if ( SrcCvtSel(src, selection, target, type, value, length, format) ) return True; @@ -707,8 +707,8 @@ ConvertSelection(w, selection, target, type, value, length, format) } else { *type = *target; } - /* - * If salt is True, the salt->contents stores CT string, + /* + * If salt is True, the salt->contents stores CT string, * its length is measured in bytes. * Refer to _XawTextSaltAwaySelection(). * @@ -769,13 +769,13 @@ ConvertSelection(w, selection, target, type, value, length, format) if ( (*target == XA_LIST_LENGTH(d)) || (*target == XA_LENGTH(d)) ) { long * temp; - + temp = (long *) XtMalloc(sizeof(long)); if (*target == XA_LIST_LENGTH(d)) *temp = 1L; else /* *target == XA_LENGTH(d) */ *temp = (long) (s->right - s->left); - + *value = (XPointer) temp; *type = XA_INTEGER; *length = 1L; @@ -785,7 +785,7 @@ ConvertSelection(w, selection, target, type, value, length, format) if (*target == XA_CHARACTER_POSITION(d)) { long * temp; - + temp = (long *) XtMalloc(2 * sizeof(long)); temp[0] = (long) (s->left + 1); temp[1] = s->right; @@ -798,7 +798,7 @@ ConvertSelection(w, selection, target, type, value, length, format) if (*target == XA_DELETE(d)) { void _XawTextZapSelection(); /* From TextAction.c */ - + if (!salt) _XawTextZapSelection( ctx, (XEvent *) NULL, TRUE); *value = NULL; @@ -811,12 +811,12 @@ ConvertSelection(w, selection, target, type, value, length, format) if (XmuConvertStandardSelection(w, ctx->text.time, selection, target, type, (XPointer *)value, length, format)) return True; - + /* else */ return False; } -static void +static void LoseSelection(w, selection) Widget w; Atom* selection; @@ -834,17 +834,17 @@ LoseSelection(w, selection) for (i = 0 ; i < salt->s.atom_count; i++, atomP++) if (*selection == *atomP) *atomP = (Atom)0; - + while (salt->s.atom_count && salt->s.selections[salt->s.atom_count-1] == 0) { salt->s.atom_count--; } - + /* * Must walk the selection list in opposite order from UnsetSelection. */ - + atomP = salt->s.selections; for (i = 0 ; i < salt->s.atom_count; i++, atomP++) if (*atomP == (Atom)0) @@ -872,14 +872,14 @@ LoseSelection(w, selection) } } -static void +static void _DeleteOrKill(ctx, from, to, kill) TextWidget ctx; XawTextPosition from, to; Boolean kill; { XawTextBlock text; - + if (kill && from < to) { XawTextSelectionSalt *salt; Atom selection = XInternAtom(XtDisplay(ctx), "SECONDARY", False); @@ -935,7 +935,7 @@ Boolean kill; return; } ctx->text.insertPos = from; - ctx->text.showposition = TRUE; + ctx->text.showposition = TRUE; } static void @@ -947,15 +947,15 @@ XawTextScanType type; Boolean include, kill; { XawTextPosition from, to; - + StartAction(ctx, event); to = SrcScan(ctx->text.source, ctx->text.insertPos, type, dir, ctx->text.mult, include); /* - * If no movement actually happened, then bump the count and try again. - * This causes the character position at the very beginning and end of - * a boundary to act correctly. + * If no movement actually happened, then bump the count and try again. + * This causes the character position at the very beginning and end of + * a boundary to act correctly. */ if (to == ctx->text.insertPos) @@ -966,7 +966,7 @@ Boolean include, kill; from = to; to = ctx->text.insertPos; } - else + else from = ctx->text.insertPos; _DeleteOrKill(ctx, from, to, kill); @@ -975,7 +975,7 @@ Boolean include, kill; } /*ARGSUSED*/ -static void +static void DeleteForwardChar(w, event, p, n) Widget w; XEvent* event; @@ -997,7 +997,7 @@ Cardinal* n; } /*ARGSUSED*/ -static void +static void DeleteForwardWord(w, event, p, n) Widget w; XEvent* event; @@ -1009,7 +1009,7 @@ Cardinal* n; } /*ARGSUSED*/ -static void +static void DeleteBackwardWord(w, event, p, n) Widget w; XEvent* event; @@ -1021,19 +1021,19 @@ Cardinal* n; } /*ARGSUSED*/ -static void +static void KillForwardWord(w, event, p, n) Widget w; XEvent* event; String* p; Cardinal* n; { - DeleteOrKill((TextWidget) w, event, + DeleteOrKill((TextWidget) w, event, XawsdRight, XawstWhiteSpace, FALSE, TRUE); } /*ARGSUSED*/ -static void +static void KillBackwardWord(w, event, p, n) Widget w; XEvent* event; @@ -1056,10 +1056,10 @@ Cardinal* n; XawTextPosition end_of_line; StartAction(ctx, event); - end_of_line = SrcScan(ctx->text.source, ctx->text.insertPos, XawstEOL, + end_of_line = SrcScan(ctx->text.source, ctx->text.insertPos, XawstEOL, XawsdRight, ctx->text.mult, FALSE); if (end_of_line == ctx->text.insertPos) - end_of_line = SrcScan(ctx->text.source, ctx->text.insertPos, XawstEOL, + end_of_line = SrcScan(ctx->text.source, ctx->text.insertPos, XawstEOL, XawsdRight, ctx->text.mult, TRUE); _DeleteOrKill(ctx, ctx->text.insertPos, end_of_line, TRUE); @@ -1068,7 +1068,7 @@ Cardinal* n; } /*ARGSUSED*/ -static void +static void KillToEndOfParagraph(w, event, p, n) Widget w; XEvent* event; @@ -1078,7 +1078,7 @@ Cardinal* n; DeleteOrKill((TextWidget) w, event, XawsdRight, XawstParagraph, FALSE, TRUE); } -void +void _XawTextZapSelection(ctx, event, kill) TextWidget ctx; XEvent* event; @@ -1091,7 +1091,7 @@ Boolean kill; } /*ARGSUSED*/ -static void +static void KillCurrentSelection(w, event, p, n) Widget w; XEvent* event; @@ -1102,7 +1102,7 @@ Cardinal* n; } /*ARGSUSED*/ -static void +static void DeleteCurrentSelection(w, event, p, n) Widget w; XEvent* event; @@ -1118,7 +1118,7 @@ Cardinal* n; * ************************************************************/ -static int +static int InsertNewLineAndBackupInternal(ctx) TextWidget ctx; { @@ -1149,7 +1149,7 @@ TextWidget ctx; XBell( XtDisplay(ctx), 50); error = XawEditError; } - else + else ctx->text.showposition = TRUE; XtFree( text.ptr ); @@ -1157,7 +1157,7 @@ TextWidget ctx; } /*ARGSUSED*/ -static void +static void InsertNewLineAndBackup(w, event, p, n) Widget w; XEvent* event; @@ -1178,7 +1178,7 @@ LocalInsertNewLine(ctx, event) StartAction(ctx, event); if (InsertNewLineAndBackupInternal(ctx) == XawEditError) return(XawEditError); - ctx->text.insertPos = SrcScan(ctx->text.source, ctx->text.insertPos, + ctx->text.insertPos = SrcScan(ctx->text.source, ctx->text.insertPos, XawstPositions, XawsdRight, ctx->text.mult, TRUE); _XawTextSetScrollBars(ctx); EndAction(ctx); @@ -1197,7 +1197,7 @@ Cardinal* n; } /*ARGSUSED*/ -static void +static void InsertNewLineAndIndent(w, event, p, n) Widget w; XEvent *event; @@ -1211,7 +1211,7 @@ Cardinal *n; String line_to_ip; StartAction(ctx, event); - pos1 = SrcScan(ctx->text.source, ctx->text.insertPos, + pos1 = SrcScan(ctx->text.source, ctx->text.insertPos, XawstEOL, XawsdLeft, 1, FALSE); line_to_ip = _XawTextGetText(ctx, pos1, ctx->text.insertPos); @@ -1239,9 +1239,9 @@ Cardinal *n; { char *ptr; length = strlen(line_to_ip); - /* The current line + \0 and LF will be copied to this + /* The current line + \0 and LF will be copied to this buffer. Before my fix, only length + 1 bytes were - allocated, causing on machine with non-wasteful + allocated, causing on machine with non-wasteful malloc implementation segmentation violations by overwriting the bypte after the allocated area @@ -1280,7 +1280,7 @@ Cardinal *n; * *************************************************************/ -static void +static void SelectWord(w, event, params, num_params) Widget w; XEvent* event; @@ -1291,14 +1291,14 @@ Cardinal* num_params; XawTextPosition l, r; StartAction(ctx, event); - l = SrcScan(ctx->text.source, ctx->text.insertPos, + l = SrcScan(ctx->text.source, ctx->text.insertPos, XawstWhiteSpace, XawsdLeft, 1, FALSE); r = SrcScan(ctx->text.source, l, XawstWhiteSpace, XawsdRight, 1, FALSE); _XawTextSetSelection(ctx, l, r, params, *num_params); EndAction(ctx); } -static void +static void SelectAll(w, event, params, num_params) Widget w; XEvent* event; @@ -1326,74 +1326,74 @@ Cardinal* num_params; /* unused */ _XawTextAlterSelection(ctx, mode, action, params, num_params); EndAction(ctx); } - + /* ARGSUSED */ -static void +static void SelectStart(w, event, params, num_params) Widget w; XEvent* event; String* params; /* unused */ Cardinal* num_params; /* unused */ { - ModifySelection((TextWidget) w, event, + ModifySelection((TextWidget) w, event, XawsmTextSelect, XawactionStart, params, num_params); } /* ARGSUSED */ -static void +static void SelectAdjust(w, event, params, num_params) Widget w; XEvent* event; String* params; /* unused */ Cardinal* num_params; /* unused */ { - ModifySelection((TextWidget) w, event, + ModifySelection((TextWidget) w, event, XawsmTextSelect, XawactionAdjust, params, num_params); } -static void +static void SelectEnd(w, event, params, num_params) Widget w; XEvent* event; String* params; Cardinal* num_params; { - ModifySelection((TextWidget) w, event, + ModifySelection((TextWidget) w, event, XawsmTextSelect, XawactionEnd, params, num_params); } /* ARGSUSED */ -static void +static void ExtendStart(w, event, params, num_params) Widget w; XEvent* event; String* params; /* unused */ Cardinal* num_params; /* unused */ { - ModifySelection((TextWidget) w, event, + ModifySelection((TextWidget) w, event, XawsmTextExtend, XawactionStart, params, num_params); } /* ARGSUSED */ -static void +static void ExtendAdjust(w, event, params, num_params) Widget w; XEvent* event; String* params; /* unused */ Cardinal* num_params; /* unused */ { - ModifySelection((TextWidget) w, event, + ModifySelection((TextWidget) w, event, XawsmTextExtend, XawactionAdjust, params, num_params); } -static void +static void ExtendEnd(w, event, params, num_params) Widget w; XEvent* event; String* params; Cardinal* num_params; { - ModifySelection((TextWidget) w, event, + ModifySelection((TextWidget) w, event, XawsmTextExtend, XawactionEnd, params, num_params); } @@ -1427,7 +1427,7 @@ Cardinal* num_params; ************************************************************/ /* ARGSUSED */ -static void +static void RedrawDisplay(w, event, p, n) Widget w; XEvent* event; @@ -1455,7 +1455,7 @@ Cardinal* n; #endif if ( event->xfocus.detail == NotifyPointer ) return; - ctx->text.hasfocus = TRUE; + ctx->text.hasfocus = TRUE; } /*ARGSUSED*/ @@ -1542,10 +1542,10 @@ TextWidget ctx; x = ctx->text.margin.left; XawTextSinkFindPosition( ctx->text.sink,ctx->text.lt.info[line_num].position, x, max_width, TRUE, &ret_pos, &width, &height); - + if ( ret_pos >= ctx->text.insertPos ) return; - + text.format = XawFmt8Bit; #ifdef XAW_INTERNATIONALIZATION if (_XawTextFormat(ctx) == XawFmtWide) { @@ -1611,7 +1611,7 @@ Cardinal* n; text.firstPos = 0; StartAction(ctx, event); - + error = _XawTextReplace(ctx, ctx->text.insertPos,ctx->text.insertPos, &text); if (error == XawEditDone) { @@ -1619,7 +1619,7 @@ Cardinal* n; XawstPositions, XawsdRight, text.length, TRUE); AutoFill(ctx); } - else + else XBell(XtDisplay(ctx), 50); XtFree(text.ptr); @@ -1646,7 +1646,7 @@ Cardinal* n; * * NOTE: In neither case will there be strings to free. */ -static char* +static char* IfHexConvertHexElseReturnParam(param, len_return) char* param; int* len_return; @@ -1722,7 +1722,7 @@ IfHexConvertHexElseReturnParam(param, len_return) * hexadecimal digits will be converted to characters. */ /*ARGSUSED*/ -static void +static void InsertString(w, event, params, num_params) Widget w; XEvent* event; @@ -1762,7 +1762,7 @@ Cardinal* num_params; /* Double check that the new input is legal: try to convert to MB. */ - temp_len = text.length; /* _XawTextWCToMB's 3rd arg is in_out */ + temp_len = text.length; /* _XawTextWCToMB's 3rd arg is in_out */ if ( _XawTextWCToMB( XtDisplay(w), (wchar_t*)text.ptr, &temp_len ) == NULL ) { XtAppWarningMsg( app_con, "insertString", "textAction", "XawError", @@ -1774,7 +1774,7 @@ Cardinal* num_params; } /* convert to WC */ #endif - if ( _XawTextReplace( ctx, ctx->text.insertPos, + if ( _XawTextReplace( ctx, ctx->text.insertPos, ctx->text.insertPos, &text ) ) { XBell( XtDisplay( ctx ), 50 ); EndAction( ctx ); @@ -1792,7 +1792,7 @@ Cardinal* num_params; /* DisplayCaret() - action - * + * * The parameter list should contain one boolean value. If the * argument is true, the cursor will be displayed. If false, not. * @@ -1800,7 +1800,7 @@ Cardinal* num_params; * have a second argument, "always". If they do not, the cursor * is only affected if the focus member of the event is true. */ -static void +static void DisplayCaret(w, event, params, num_params) Widget w; XEvent* event; /* CrossingNotify special-cased */ @@ -1832,9 +1832,9 @@ Cardinal* num_params; /* 0, 1 or 2 */ /* 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. @@ -1842,7 +1842,7 @@ Cardinal* num_params; /* 0, 1 or 2 */ * The string reset will reset the mutiplication factor to 1. */ /* ARGSUSED */ -static void +static void Multiply(w, event, params, num_params) Widget w; XEvent* event; @@ -1853,7 +1853,7 @@ Cardinal* num_params; int mult; if (*num_params != 1) { - XtAppError( XtWidgetToApplicationContext( w ), + XtAppError( XtWidgetToApplicationContext( w ), "Xaw Text Widget: multiply() takes exactly one argument."); XBell( XtDisplay( w ), 0 ); return; @@ -1910,7 +1910,7 @@ XawTextPosition from, to; text.ptr = (char*) wc_two_spaces; } #endif - + /* Strip out CR's. */ eop_begin = eop_end = startPos = endPos = from; @@ -1953,10 +1953,10 @@ XawTextPosition from, to; text.length++; /* Put in two spaces. */ /* - * Remove all extra spaces. + * Remove all extra spaces. */ - for (i = 1 ; i < len; i++) + for (i = 1 ; i < len; i++) #ifdef XAW_INTERNATIONALIZATION if (text.format == XawFmtWide) { if ( !iswspace(((wchar_t*)buf)[i]) || ((periodPos + i) >= to) ) { @@ -1967,7 +1967,7 @@ XawTextPosition from, to; if ( !isspace(buf[i]) || ((periodPos + i) >= to) ) { break; } - + XtFree(buf); to -= (i - text.length - 1); @@ -2013,18 +2013,18 @@ XawTextPosition from, to; startPos = from; /* CONSTCOND */ while (TRUE) { - XawTextSinkFindPosition( ctx->text.sink, startPos, + XawTextSinkFindPosition( ctx->text.sink, startPos, (int) ctx->text.margin.left, - (int) (ctx->core.width - HMargins(ctx)), + (int) (ctx->core.width - HMargins(ctx)), TRUE, &eol, &width, &height); if (eol >= to) break; eol = SrcScan(ctx->text.source, eol, XawstPositions, XawsdLeft, 1, TRUE); space= SrcScan(ctx->text.source, eol, XawstWhiteSpace,XawsdRight,1, TRUE); - + startPos = endPos = eol; - if (eol == space) + if (eol == space) return; len = (int) (space - eol); @@ -2043,18 +2043,18 @@ XawTextPosition from, to; endPos = SrcScan(ctx->text.source, endPos, XawstPositions, XawsdRight, i, TRUE); XtFree(buf); - + if (_XawTextReplace(ctx, startPos, endPos, &text)) return; startPos = SrcScan(ctx->text.source, startPos, XawstPositions, XawsdRight, 1, TRUE); } -} +} /* FormRegion() - called by FormParagraph - * + * * oversees the work of paragraph-forming a region * * RETURNS: XawEditDone if successful, or XawReplaceError. */ @@ -2085,7 +2085,7 @@ XawTextPosition from, to; * removes and reinserts CRs to maximize line length without clipping */ /* ARGSUSED */ -static void +static void FormParagraph(w, event, params, num_params) Widget w; XEvent* event; @@ -2113,9 +2113,9 @@ Cardinal* num_params; * * Swaps the character to the left of the mark * with the character to the right of the mark. */ - + /* ARGSUSED */ -static void +static void TransposeCharacters(w, event, params, num_params) Widget w; XEvent* event; @@ -2132,9 +2132,9 @@ Cardinal* num_params; /* Get bounds. */ - start = SrcScan( ctx->text.source, ctx->text.insertPos, XawstPositions, + start = SrcScan( ctx->text.source, ctx->text.insertPos, XawstPositions, XawsdLeft, 1, TRUE ); - end = SrcScan( ctx->text.source, ctx->text.insertPos, XawstPositions, + end = SrcScan( ctx->text.source, ctx->text.insertPos, XawstPositions, XawsdRight, ctx->text.mult, TRUE ); /* Make sure we aren't at the very beginning or end of the buffer. */ @@ -2151,7 +2151,7 @@ Cardinal* num_params; text.format = _XawTextFormat(ctx); /* Retrieve text and swap the characters. */ - + #ifdef XAW_INTERNATIONALIZATION if ( text.format == XawFmtWide) { wchar_t wc; @@ -2180,7 +2180,7 @@ Cardinal* num_params; text.ptr = buf; /* Store new text in source. */ - + if (_XawTextReplace (ctx, start, end, &text)) /* Unable to edit, complain. */ XBell(XtDisplay(w), 0); XtFree((char *) buf); @@ -2215,7 +2215,7 @@ Cardinal* num_params; break; } } - + /* Reconnect() - action * This reconnects to the input method. The user will typically call * this action if/when connection has been severed, or when the app @@ -2234,7 +2234,7 @@ Reconnect( w, event, params, num_params ) _XawImReconnect( w ); } #endif - + XtActionsRec _XawTextActionsTable[] = { diff --git a/src/TextPop.c b/src/TextPop.c index b1ed6a1..9977bd4 100644 --- a/src/TextPop.c +++ b/src/TextPop.c @@ -32,13 +32,13 @@ in this Software without prior written authorization from the X Consortium. * * FileInsert, Search, and Replace. * - * There is also a section at the end for utility functions + * There is also a section at the end for utility functions * used by all more than one of these dialogs. * * The following functions are the only non-static ones defined * in this module. They are located at the begining of the * section that contains this dialog box that uses them. - * + * * void _XawTextInsertFileAction(w, event, params, num_params); * void _XawTextDoSearchAction(w, event, params, num_params); * void _XawTextDoReplaceAction(w, event, params, num_params); @@ -49,7 +49,7 @@ in this Software without prior written authorization from the X Consortium. #include "Xaw3dP.h" #include <X11/IntrinsicP.h> #include <X11/StringDefs.h> -#include <X11/Shell.h> +#include <X11/Shell.h> #include <X11/Xaw3d/TextP.h> #include <X11/Xaw3d/AsciiText.h> #include <X11/Xaw3d/Cardinals.h> @@ -97,7 +97,7 @@ static void AddSearchChildren(); static char radio_trans_string[] = "<Btn1Down>,<Btn1Up>: set() notify()"; -static char search_text_trans[] = +static char search_text_trans[] = "~Shift<Key>Return: DoSearchAction(Popdown) \n\ Shift<Key>Return: DoSearchAction() SetField(Replace) \n\ Ctrl<Key>q,<Key>Tab: insert-char() \n\ @@ -105,7 +105,7 @@ static char search_text_trans[] = <Btn1Down>: select-start() SetField(Search) \n\ <Key>Tab: DoSearchAction() SetField(Replace)"; -static char rep_text_trans[] = +static char rep_text_trans[] = "~Shift<Key>Return: DoReplaceAction(Popdown) \n\ Shift<Key>Return: SetField(Search) \n\ Ctrl<Key>q,<Key>Tab: insert-char() \n\ @@ -114,22 +114,22 @@ static char rep_text_trans[] = <Key>Tab: SetField(Search)"; /************************************************************ - * - * This section of the file contains all the functions that + * + * This section of the file contains all the functions that * the file insert dialog box uses. * ************************************************************/ /* Function Name: _XawTextInsertFileAction - * Description: Action routine that can be bound to dialog box's + * Description: Action routine that can be bound to dialog box's * Text Widget that will insert a file into the main * Text Widget. - * Arguments: (Standard Action Routine args) + * Arguments: (Standard Action Routine args) * Returns: none. */ /* ARGSUSED */ -void +void _XawTextInsertFileAction(w, event, params, num_params) Widget w; XEvent *event; @@ -155,7 +155,7 @@ Cardinal * num_params; * file to insert. */ -void +void _XawTextInsertFile(w, event, params, num_params) Widget w; XEvent *event; @@ -169,17 +169,17 @@ Cardinal * num_params; XtSetArg(args[0], XtNeditType,&edit_mode); XtGetValues(ctx->text.source, args, ONE); - + if (edit_mode != XawtextEdit) { XBell(XtDisplay(w), 0); return; } - if (*num_params == 0) + if (*num_params == 0) ptr = ""; - else + else ptr = params[0]; - + if (!ctx->text.file_insert) { ctx->text.file_insert = CreateDialog(w, ptr, "insertFile", AddInsertFileChildren); @@ -201,7 +201,7 @@ Cardinal * num_params; */ /* ARGSUSED */ -static void +static void PopdownFileInsert(w, closure, call_data) Widget w; /* The Dialog Button Pressed. */ XtPointer closure; /* Text Widget. */ @@ -210,7 +210,7 @@ XtPointer call_data; /* unused */ TextWidget ctx = (TextWidget) closure; XtPopdown( ctx->text.file_insert ); - (void) SetResourceByName( ctx->text.file_insert, LABEL_NAME, + (void) SetResourceByName( ctx->text.file_insert, LABEL_NAME, XtNlabel, (XtArgVal) INSERT_FILE); } @@ -224,7 +224,7 @@ XtPointer call_data; /* unused */ */ /* ARGSUSED */ -static void +static void DoInsert(w, closure, call_data) Widget w; /* The Dialog Button Pressed. */ XtPointer closure; /* Text Widget */ @@ -236,10 +236,10 @@ XtPointer call_data; /* unused */ (void) sprintf(buf, "%s.%s", FORM_NAME, TEXT_NAME); if ( (temp_widget = XtNameToWidget(ctx->text.file_insert, buf)) == NULL ) { - (void) strcpy(msg, + (void) strcpy(msg, "*** Error: Could not get text widget from file insert popup"); } - else + else if (InsertFileNamed( (Widget) ctx, GetString( temp_widget ))) { PopdownFileInsert(w, closure, call_data); return; @@ -247,7 +247,7 @@ XtPointer call_data; /* unused */ else (void) sprintf( msg, "*** Error: %s ***", strerror(errno)); - (void)SetResourceByName(ctx->text.file_insert, + (void)SetResourceByName(ctx->text.file_insert, LABEL_NAME, XtNlabel, (XtArgVal) msg); XBell(XtDisplay(w), 0); } @@ -269,7 +269,7 @@ char *str; XawTextBlock text; XawTextPosition pos; - if ( (str == NULL) || (strlen(str) == 0) || + if ( (str == NULL) || (strlen(str) == 0) || ((file = fopen(str, "r")) == NULL)) return(FALSE); @@ -336,9 +336,9 @@ char * ptr; XtSetArg(args[num_args], XtNright, XtChainLeft); num_args++; XtSetArg(args[num_args], XtNresizable, TRUE ); num_args++; XtSetArg(args[num_args], XtNborderWidth, 0 ); num_args++; - label = XtCreateManagedWidget (LABEL_NAME, labelWidgetClass, form, + label = XtCreateManagedWidget (LABEL_NAME, labelWidgetClass, form, args, num_args); - + num_args = 0; XtSetArg(args[num_args], XtNfromVert, label); num_args++; XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++; @@ -382,28 +382,28 @@ char * ptr; } /************************************************************ - * - * This section of the file contains all the functions that + * + * This section of the file contains all the functions that * the search dialog box uses. * ************************************************************/ /* Function Name: _XawTextDoSearchAction - * Description: Action routine that can be bound to dialog box's - * Text Widget that will search for a string in the main + * Description: Action routine that can be bound to dialog box's + * Text Widget that will search for a string in the main * Text Widget. - * Arguments: (Standard Action Routine args) + * Arguments: (Standard Action Routine args) * Returns: none. * * Note: - * + * * If the search was sucessful and the argument popdown is passed to - * this action routine then the widget will automatically popdown the + * this action routine then the widget will automatically popdown the * search widget. */ /* ARGSUSED */ -void +void _XawTextDoSearchAction(w, event, params, num_params) Widget w; XEvent *event; @@ -416,20 +416,20 @@ Cardinal * num_params; if ( (*num_params == 1) && ((params[0][0] == 'p') || (params[0][0] == 'P')) ) popdown = TRUE; - + if (DoSearch(tw->text.search) && popdown) PopdownSearch(w, (XtPointer) tw->text.search, (XtPointer)NULL); } /* Function Name: _XawTextPopdownSearchAction - * Description: Action routine that can be bound to dialog box's + * Description: Action routine that can be bound to dialog box's * Text Widget that will popdown the search widget. - * Arguments: (Standard Action Routine args) + * Arguments: (Standard Action Routine args) * Returns: none. */ /* ARGSUSED */ -void +void _XawTextPopdownSearchAction(w, event, params, num_params) Widget w; XEvent *event; @@ -450,11 +450,11 @@ Cardinal * num_params; */ /* ARGSUSED */ -static void +static void PopdownSearch(w, closure, call_data) -Widget w; -XtPointer closure; -XtPointer call_data; +Widget w; +XtPointer closure; +XtPointer call_data; { struct SearchAndReplace * search = (struct SearchAndReplace *) closure; @@ -467,14 +467,14 @@ XtPointer call_data; * Arguments: w - *** NOT USED **. * closure - a pointer to the search info. * call_data - *** NOT USED ***. - * Returns: + * Returns: */ /* ARGSUSED */ -static void +static void SearchButton(w, closure, call_data) -Widget w; -XtPointer closure; +Widget w; +XtPointer closure; XtPointer call_data; { (void) DoSearch( (struct SearchAndReplace *) closure ); @@ -502,7 +502,7 @@ XtPointer call_data; #define SEARCH_HEADER ("Text Widget - Search():") -void +void _XawTextSearch(w, event, params, num_params) Widget w; XEvent *event; @@ -523,8 +523,8 @@ Cardinal * num_params; #endif if ( (*num_params < 1) || (*num_params > 2) ) { - (void) sprintf(buf, "%s %s\n%s", SEARCH_HEADER, - "This action must have only", + (void) sprintf(buf, "%s %s\n%s", SEARCH_HEADER, + "This action must have only", "one or two parameters"); XtAppWarning(XtWidgetToApplicationContext(w), buf); return; @@ -552,7 +552,7 @@ Cardinal * num_params; dir = XawsdRight; break; default: - (void) sprintf(buf, "%s %s\n%s", SEARCH_HEADER, + (void) sprintf(buf, "%s %s\n%s", SEARCH_HEADER, "The first parameter must be", "Either 'backward' or 'forward'"); XtAppWarning(XtWidgetToApplicationContext(w), buf); @@ -583,8 +583,8 @@ Cardinal * num_params; * Description: This function initializes the search widget and * is called each time the search widget is poped up. * Arguments: search - the search widget structure. - * dir - direction to search. - * replace_active - state of the sensitivity for the + * dir - direction to search. + * replace_active - state of the sensitivity for the * replace button. * Returns: none. */ @@ -610,7 +610,7 @@ Boolean replace_active; default: break; } -} +} /* Function Name: AddSearchChildren * Description: Adds all children to the Search Dialog Widget. @@ -647,8 +647,8 @@ char * ptr; XtSetArg(args[num_args], XtNborderWidth, 0 ); num_args++; search->label2 = XtCreateManagedWidget("label2", labelWidgetClass, form, args, num_args); - -/* + +/* * We need to add R_OFFSET to the radio_data, because the value zero (0) * has special meaning. */ @@ -726,7 +726,7 @@ char * ptr; r_text = XtCreateManagedWidget("replaceText", asciiTextWidgetClass, form, args, num_args); search->rep_text = r_text; - + num_args = 0; XtSetArg(args[num_args], XtNlabel, "Search"); num_args++; XtSetArg(args[num_args], XtNfromVert, r_text); num_args++; @@ -823,51 +823,51 @@ struct SearchAndReplace * search; #endif text.length = strlen(text.ptr); text.firstPos = 0; - + dir = (XawTextScanDirection)(int) ((XPointer)XawToggleGetCurrent(search->left_toggle) - R_OFFSET); - + pos = XawTextSearch( tw, dir, &text); - /* The Raw string in find.ptr may be WC I can't use here, so I re - call + /* The Raw string in find.ptr may be WC I can't use here, so I re - call GetString to get a tame version. */ - if (pos == XawTextSearchError) + if (pos == XawTextSearchError) (void) sprintf( msg, "Could not find string ``%s''.", GetString( search->search_text ) ); else { if (dir == XawsdRight) XawTextSetInsertionPoint( tw, pos + text.length); else XawTextSetInsertionPoint( tw, pos); - + XawTextSetSelection( tw, pos, pos + text.length); search->selection_changed = FALSE; /* selection is good. */ return(TRUE); } - + XawTextUnsetSelection(tw); SetSearchLabels(search, msg, "", TRUE); return(FALSE); } /************************************************************ - * - * This section of the file contains all the functions that + * + * This section of the file contains all the functions that * the replace dialog box uses. * ************************************************************/ /* Function Name: _XawTextDoReplaceAction - * Description: Action routine that can be bound to dialog box's - * Text Widget that will replace a string in the main + * Description: Action routine that can be bound to dialog box's + * Text Widget that will replace a string in the main * Text Widget. - * Arguments: (Standard Action Routine args) + * Arguments: (Standard Action Routine args) * Returns: none. */ /* ARGSUSED */ -void +void _XawTextDoReplaceAction(w, event, params, num_params) Widget w; XEvent *event; @@ -896,7 +896,7 @@ Cardinal * num_params; */ /* ARGSUSED */ -static void +static void DoReplaceOne(w, closure, call_data) Widget w; /* The Button Pressed. */ XtPointer closure; /* Text Widget. */ @@ -916,7 +916,7 @@ XtPointer call_data; /* unused */ */ /* ARGSUSED */ -static void +static void DoReplaceAll(w, closure, call_data) Widget w; /* The Button Pressed. */ XtPointer closure; /* Text Widget. */ @@ -931,7 +931,7 @@ XtPointer call_data; /* unused */ * Arguments: tw - the Text Widget to replce the string in. * once_only - If TRUE then only replace the first one found. * other replace all of them. - * show_current - If true then leave the selection on the + * show_current - If true then leave the selection on the * string that was just replaced, otherwise * move it onto the next one. * Returns: none. @@ -969,19 +969,19 @@ Boolean once_only, show_current; else #endif replace.length = strlen(replace.ptr); - + dir = (XawTextScanDirection)(int) ((XPointer)XawToggleGetCurrent(search->left_toggle) - R_OFFSET); /* CONSTCOND */ while (TRUE) { if (count != 0) { new_pos = XawTextSearch( tw, dir, &find); - + if (new_pos == XawTextSearchError) { if (count == 0) { char msg[BUFSIZ]; - /* The Raw string in find.ptr may be WC I can't use here, + /* The Raw string in find.ptr may be WC I can't use here, so I call GetString to get a tame version.*/ (void) sprintf( msg, "%s %s %s", "*** Error: Could not find string ``", @@ -1003,24 +1003,24 @@ Boolean once_only, show_current; "", TRUE); return(FALSE); } - if (pos == end_pos) + if (pos == end_pos) return(FALSE); } if (XawTextReplace(tw, pos, end_pos, &replace) != XawEditDone) { char msg[BUFSIZ]; - + (void) sprintf( msg, "'%s' with '%s'. ***", find.ptr, replace.ptr); SetSearchLabels(search, "*** Error while replacing", msg, TRUE); return(FALSE); - } + } if (dir == XawsdRight) XawTextSetInsertionPoint( tw, pos + replace.length); else XawTextSetInsertionPoint( tw, pos); - if (once_only) + if (once_only) if (show_current) break; else { @@ -1054,12 +1054,12 @@ Boolean bell; { (void) SetResource( search->label1, XtNlabel, (XtArgVal) msg1); (void) SetResource( search->label2, XtNlabel, (XtArgVal) msg2); - if (bell) + if (bell) XBell(XtDisplay(search->search_popup), 0); } /************************************************************ - * + * * This section of the file contains utility routines used by * other functions in this file. * @@ -1067,14 +1067,14 @@ Boolean bell; /* Function Name: _XawTextSetField - * Description: Action routine that can be bound to dialog box's + * Description: Action routine that can be bound to dialog box's * Text Widget that will send input to the field specified. - * Arguments: (Standard Action Routine args) + * Arguments: (Standard Action Routine args) * Returns: none. */ /* ARGSUSED */ -void +void _XawTextSetField(w, event, params, num_params) Widget w; XEvent *event; @@ -1128,8 +1128,8 @@ Widget new, old; return; } - XtSetKeyboardFocus(XtParent(new), new); - + XtSetKeyboardFocus(XtParent(new), new); + XtSetArg(args[0], XtNborderColor, &old_border); XtSetArg(args[1], XtNbackground, &old_bg); XtGetValues(new, args, TWO); @@ -1187,7 +1187,7 @@ char * res_name; XtArgVal value; { Arg args[1]; - + XtSetArg(args[0], res_name, value); XtSetValues( w, args, ONE ); } @@ -1195,7 +1195,7 @@ XtArgVal value; /* Function Name: GetString{Raw} * Description: Gets the value for the string in the popup. * Arguments: text - the text widget whose string we will get. - * + * * GetString returns the string as a MB. * GetStringRaw returns the exact buffer contents suitable for a search. * @@ -1245,7 +1245,7 @@ XEvent *event; Cardinal num_args; Dimension width, height, b_width; Position x = 0, y = 0, max_x, max_y; - + if (event != NULL) { switch (event->type) { case ButtonPress: @@ -1262,7 +1262,7 @@ XEvent *event; return; } } - + num_args = 0; XtSetArg(args[num_args], XtNwidth, &width); num_args++; XtSetArg(args[num_args], XtNheight, &height); num_args++; @@ -1279,7 +1279,7 @@ XEvent *event; y -= ( (Position) height/2 ); if (y < 0) y = 0; if ( y > (max_y = (Position) (XtScreen(w)->height - height)) ) y = max_y; - + num_args = 0; XtSetArg(args[num_args], XtNx, x); num_args++; XtSetArg(args[num_args], XtNy, y); num_args++; @@ -1293,7 +1293,7 @@ XEvent *event; * name - name of the dialog. * func - function to create the children of the dialog. * Returns: the popup shell of the dialog. - * + * * NOTE: * * The function argument is passed the following arguements. @@ -1318,9 +1318,9 @@ void (*func)(); XtSetArg(args[num_args], XtNgeometry, NULL); num_args++; XtSetArg(args[num_args], XtNallowShellResize, TRUE); num_args++; XtSetArg(args[num_args], XtNtransientFor, GetShell(parent)); num_args++; - popup = XtCreatePopupShell(name, transientShellWidgetClass, + popup = XtCreatePopupShell(name, transientShellWidgetClass, parent, args, num_args); - + form = XtCreateManagedWidget(FORM_NAME, formWidgetClass, popup, (ArgList)NULL, ZERO); XtManageChild (form); @@ -1336,14 +1336,14 @@ void (*func)(); * Returns: The shell widget among the ancestors of w that is the * fewest levels up in the widget hierarchy. */ - + static Widget GetShell(w) Widget w; { while ((w != NULL) && !XtIsShell(w)) w = XtParent(w); - + return (w); } @@ -1372,7 +1372,7 @@ static void WMProtocols(w, event, params, num_params) wm_delete_window = XInternAtom(XtDisplay(w), WM_DELETE_WINDOW, True); wm_protocols = XInternAtom(XtDisplay(w), "WM_PROTOCOLS", True); - /* Respond to a recognized WM protocol request iff + /* Respond to a recognized WM protocol request iff * event type is ClientMessage and no parameters are passed, or * event type is ClientMessage and event data is matched to parameters, or * event type isn't ClientMessage and parameters make a request. @@ -1383,7 +1383,7 @@ static void WMProtocols(w, event, params, num_params) event->xclient.message_type == wm_protocols && event->xclient.data.l[0] == wm_delete_window && (*num_params == 0 || DO_DELETE_WINDOW)) - || + || (event->type != ClientMessage && DO_DELETE_WINDOW)) { #undef DO_DELETE_WINDOW diff --git a/src/TextSink.c b/src/TextSink.c index 1efa531..d7211f1 100644 --- a/src/TextSink.c +++ b/src/TextSink.c @@ -60,16 +60,16 @@ static void FindDistance(), Resolve(), SetTabs(), GetCursorBounds(); #define offset(field) XtOffsetOf(TextSinkRec, text_sink.field) static XtResource resources[] = { {XtNforeground, XtCForeground, XtRPixel, sizeof (Pixel), - offset(foreground), XtRString, XtDefaultForeground}, + offset(foreground), XtRString, XtDefaultForeground}, {XtNbackground, XtCBackground, XtRPixel, sizeof (Pixel), - offset(background), XtRString, XtDefaultBackground}, + offset(background), XtRString, XtDefaultBackground}, }; #undef offset #define SuperClass (&objectClassRec) TextSinkClassRec textSinkClassRec = { { -/* core_class fields */ +/* core_class fields */ /* superclass */ (WidgetClass) SuperClass, /* class_name */ "TextSink", /* widget_size */ sizeof(TextSinkRec), @@ -129,44 +129,44 @@ WidgetClass wc; t_src = (TextSinkObjectClass) wc; superC = (TextSinkObjectClass) t_src->object_class.superclass; -/* +/* * We don't need to check for null super since we'll get to TextSink * eventually. */ - if (t_src->text_sink_class.DisplayText == XtInheritDisplayText) + if (t_src->text_sink_class.DisplayText == XtInheritDisplayText) t_src->text_sink_class.DisplayText = superC->text_sink_class.DisplayText; - if (t_src->text_sink_class.InsertCursor == XtInheritInsertCursor) + if (t_src->text_sink_class.InsertCursor == XtInheritInsertCursor) t_src->text_sink_class.InsertCursor = superC->text_sink_class.InsertCursor; - if (t_src->text_sink_class.ClearToBackground== XtInheritClearToBackground) - t_src->text_sink_class.ClearToBackground = + if (t_src->text_sink_class.ClearToBackground== XtInheritClearToBackground) + t_src->text_sink_class.ClearToBackground = superC->text_sink_class.ClearToBackground; - if (t_src->text_sink_class.FindPosition == XtInheritFindPosition) - t_src->text_sink_class.FindPosition = + if (t_src->text_sink_class.FindPosition == XtInheritFindPosition) + t_src->text_sink_class.FindPosition = superC->text_sink_class.FindPosition; - if (t_src->text_sink_class.FindDistance == XtInheritFindDistance) - t_src->text_sink_class.FindDistance = + if (t_src->text_sink_class.FindDistance == XtInheritFindDistance) + t_src->text_sink_class.FindDistance = superC->text_sink_class.FindDistance; - if (t_src->text_sink_class.Resolve == XtInheritResolve) + if (t_src->text_sink_class.Resolve == XtInheritResolve) t_src->text_sink_class.Resolve = superC->text_sink_class.Resolve; - if (t_src->text_sink_class.MaxLines == XtInheritMaxLines) + if (t_src->text_sink_class.MaxLines == XtInheritMaxLines) t_src->text_sink_class.MaxLines = superC->text_sink_class.MaxLines; - if (t_src->text_sink_class.MaxHeight == XtInheritMaxHeight) + if (t_src->text_sink_class.MaxHeight == XtInheritMaxHeight) t_src->text_sink_class.MaxHeight = superC->text_sink_class.MaxHeight; - if (t_src->text_sink_class.SetTabs == XtInheritSetTabs) + if (t_src->text_sink_class.SetTabs == XtInheritSetTabs) t_src->text_sink_class.SetTabs = superC->text_sink_class.SetTabs; - if (t_src->text_sink_class.GetCursorBounds == XtInheritGetCursorBounds) - t_src->text_sink_class.GetCursorBounds = + if (t_src->text_sink_class.GetCursorBounds == XtInheritGetCursorBounds) + t_src->text_sink_class.GetCursorBounds = superC->text_sink_class.GetCursorBounds; } @@ -193,7 +193,7 @@ Cardinal *num_args; } /* Function Name: Destroy - * Description: This function cleans up when the object is + * Description: This function cleans up when the object is * destroyed. * Arguments: w - the TextSink Object. * Returns: none. @@ -240,7 +240,7 @@ Cardinal *num_args; ************************************************************/ /* Function Name: DisplayText - * Description: Stub function that in subclasses will display text. + * Description: Stub function that in subclasses will display text. * Arguments: w - the TextSink Object. * x, y - location to start drawing text. * pos1, pos2 - location of starting and ending points @@ -300,7 +300,7 @@ Widget w; Position x, y; Dimension width, height; { -/* +/* * Don't clear in height or width are zero. * XClearArea() has special semantic for these values. */ @@ -325,14 +325,14 @@ Dimension width, height; /* ARGSUSED */ static void -FindPosition(w, fromPos, fromx, width, stopAtWordBreak, +FindPosition(w, fromPos, fromx, width, stopAtWordBreak, resPos, resWidth, resHeight) Widget w; -XawTextPosition fromPos; -int fromx, width; -Boolean stopAtWordBreak; -XawTextPosition *resPos; -int *resWidth, *resHeight; +XawTextPosition fromPos; +int fromx, width; +Boolean stopAtWordBreak; +XawTextPosition *resPos; +int *resWidth, *resHeight; { *resPos = fromPos; *resHeight = *resWidth = 0; @@ -410,7 +410,7 @@ Dimension height; } /* Function Name: MaxHeight - * Description: Finds the Minium height that will contain a given number + * Description: Finds the Minium height that will contain a given number * lines. * Arguments: w - the TextSink Object. * lines - the number of lines. @@ -467,7 +467,7 @@ XRectangle * rect; /* Function Name: XawTextSinkDisplayText - * Description: Stub function that in subclasses will display text. + * Description: Stub function that in subclasses will display text. * Arguments: w - the TextSink Object. * x, y - location to start drawing text. * pos1, pos2 - location of starting and ending points @@ -527,7 +527,7 @@ XawTextSinkInsertCursor(Widget w, #else Position x, Position y, XawTextInsertState state) #endif -#else +#else XawTextSinkInsertCursor(w, x, y, state) Widget w; Position x, y; @@ -535,7 +535,7 @@ XawTextInsertState state; #endif { TextSinkObjectClass class = (TextSinkObjectClass) w->core.widget_class; - + (*class->text_sink_class.InsertCursor)(w, x, y, state); } @@ -558,7 +558,7 @@ XawTextSinkClearToBackground (Widget w, #if NeedWidePrototypes int x, int y, int width, int height) #else - Position x, Position y, + Position x, Position y, Dimension width, Dimension height) #endif #else @@ -598,20 +598,20 @@ XawTextSinkFindPosition(Widget w, XawTextPosition fromPos, int fromx, #endif XawTextPosition *resPos, int *resWidth, int *resHeight) #else -XawTextSinkFindPosition(w, fromPos, fromx, width, stopAtWordBreak, +XawTextSinkFindPosition(w, fromPos, fromx, width, stopAtWordBreak, resPos, resWidth, resHeight) Widget w; -XawTextPosition fromPos; -int fromx, width; -Boolean stopAtWordBreak; -XawTextPosition *resPos; +XawTextPosition fromPos; +int fromx, width; +Boolean stopAtWordBreak; +XawTextPosition *resPos; int *resWidth, *resHeight; #endif { TextSinkObjectClass class = (TextSinkObjectClass) w->core.widget_class; (*class->text_sink_class.FindPosition)(w, fromPos, fromx, width, - stopAtWordBreak, + stopAtWordBreak, resPos, resWidth, resHeight); } @@ -631,7 +631,7 @@ int *resWidth, *resHeight; void #if NeedFunctionPrototypes XawTextSinkFindDistance (Widget w, XawTextPosition fromPos, int fromx, - XawTextPosition toPos, int *resWidth, + XawTextPosition toPos, int *resWidth, XawTextPosition *resPos, int *resHeight) #else XawTextSinkFindDistance (w, fromPos, fromx, toPos, resWidth, resPos, resHeight) @@ -703,7 +703,7 @@ Dimension height; } /* Function Name: XawTextSinkMaxHeight - * Description: Finds the Minimum height that will contain a given number + * Description: Finds the Minimum height that will contain a given number * lines. * Arguments: w - the TextSink Object. * lines - the number of lines. @@ -754,7 +754,7 @@ int tab_count, *tabs; XtFree((char *)char_tabs); } } - + /* Function Name: XawTextSinkGetCursorBounds * Description: Finds the bounding box for the insert curor (caret). * Arguments: w - the TextSinkObject. diff --git a/src/TextSrc.c b/src/TextSrc.c index 8dd74e2..10bb845 100644 --- a/src/TextSrc.c +++ b/src/TextSrc.c @@ -59,7 +59,7 @@ in this Software without prior written authorization from the X Consortium. #define offset(field) XtOffsetOf(TextSrcRec, textSrc.field) static XtResource resources[] = { - {XtNeditType, XtCEditType, XtREditMode, sizeof(XawTextEditType), + {XtNeditType, XtCEditType, XtREditMode, sizeof(XawTextEditType), offset(edit_mode), XtRString, "read"}, }; @@ -72,7 +72,7 @@ static int Replace(); #define SuperClass (&objectClassRec) TextSrcClassRec textSrcClassRec = { { -/* core_class fields */ +/* core_class fields */ /* superclass */ (WidgetClass) SuperClass, /* class_name */ "TextSrc", /* widget_size */ sizeof(TextSrcRec), @@ -119,7 +119,7 @@ TextSrcClassRec textSrcClassRec = { WidgetClass textSrcObjectClass = (WidgetClass)&textSrcClassRec; -static void +static void ClassInitialize () { XawInitializeWidgetSet (); @@ -136,26 +136,26 @@ WidgetClass wc; t_src = (TextSrcObjectClass) wc; superC = (TextSrcObjectClass) t_src->object_class.superclass; -/* +/* * We don't need to check for null super since we'll get to TextSrc * eventually. */ - if (t_src->textSrc_class.Read == XtInheritRead) + if (t_src->textSrc_class.Read == XtInheritRead) t_src->textSrc_class.Read = superC->textSrc_class.Read; - if (t_src->textSrc_class.Replace == XtInheritReplace) + if (t_src->textSrc_class.Replace == XtInheritReplace) t_src->textSrc_class.Replace = superC->textSrc_class.Replace; - if (t_src->textSrc_class.Scan == XtInheritScan) + if (t_src->textSrc_class.Scan == XtInheritScan) t_src->textSrc_class.Scan = superC->textSrc_class.Scan; - if (t_src->textSrc_class.Search == XtInheritSearch) + if (t_src->textSrc_class.Search == XtInheritSearch) t_src->textSrc_class.Search = superC->textSrc_class.Search; - if (t_src->textSrc_class.SetSelection == XtInheritSetSelection) + if (t_src->textSrc_class.SetSelection == XtInheritSetSelection) t_src->textSrc_class.SetSelection = superC->textSrc_class.SetSelection; - if (t_src->textSrc_class.ConvertSelection == XtInheritConvertSelection) + if (t_src->textSrc_class.ConvertSelection == XtInheritConvertSelection) t_src->textSrc_class.ConvertSelection = superC->textSrc_class.ConvertSelection; } @@ -180,10 +180,10 @@ static XawTextPosition Read(w, pos, text, length) Widget w; XawTextPosition pos; -XawTextBlock *text; -int length; +XawTextBlock *text; +int length; { - XtAppError(XtWidgetToApplicationContext(w), + XtAppError(XtWidgetToApplicationContext(w), "TextSrc Object: No read function is defined."); return( (XawTextPosition) 0 ); /* for gcc -Wall and lint */ @@ -198,7 +198,7 @@ int length; */ /*ARGSUSED*/ -static int +static int Replace (w, startPos, endPos, text) Widget w; XawTextPosition startPos, endPos; @@ -216,14 +216,14 @@ XawTextBlock *text; * dir - direction to scan. * count - which occurance if this thing to search for. * include - whether or not to include the character found in - * the position that is returned. + * the position that is returned. * Returns: EXITS WITH AN ERROR MESSAGE. * */ /* ARGSUSED */ -static -XawTextPosition +static +XawTextPosition Scan (w, position, type, dir, count, include) Widget w; XawTextPosition position; @@ -232,7 +232,7 @@ XawTextScanDirection dir; int count; Boolean include; { - XtAppError(XtWidgetToApplicationContext(w), + XtAppError(XtWidgetToApplicationContext(w), "TextSrc Object: No SCAN function is defined."); return( (XawTextPosition) 0 ); /* for gcc -Wall and lint */ @@ -248,7 +248,7 @@ Boolean include; */ /* ARGSUSED */ -static XawTextPosition +static XawTextPosition Search(w, position, dir, text) Widget w; XawTextPosition position; @@ -302,7 +302,7 @@ Atom selection; /* ARGSUSED */ -static void +static void CvtStringToEditMode(args, num_args, fromVal, toVal) XrmValuePtr args; /* unused */ Cardinal *num_args; /* unused */ @@ -314,7 +314,7 @@ XrmValuePtr toVal; XrmQuark q; char lowerName[40]; static Boolean inited = FALSE; - + if ( !inited ) { QRead = XrmPermStringToQuark(XtEtextRead); QAppend = XrmPermStringToQuark(XtEtextAppend); @@ -367,7 +367,7 @@ XawTextSourceRead(Widget w, XawTextPosition pos, XawTextBlock *text, XawTextSourceRead(w, pos, text, length) Widget w; XawTextPosition pos; -XawTextBlock *text; +XawTextBlock *text; int length; #endif { @@ -392,7 +392,7 @@ int length; /*ARGSUSED*/ int #if NeedFunctionPrototypes -XawTextSourceReplace (Widget w, XawTextPosition startPos, +XawTextSourceReplace (Widget w, XawTextPosition startPos, XawTextPosition endPos, XawTextBlock *text) #else XawTextSourceReplace (w, startPos, endPos, text) @@ -420,7 +420,7 @@ XawTextBlock *text; * dir - direction to scan. * count - which occurance if this thing to search for. * include - whether or not to include the character found in - * the position that is returned. + * the position that is returned. * Returns: The position of the text. * */ @@ -469,7 +469,7 @@ Boolean include; * XawTextSearchError. */ -XawTextPosition +XawTextPosition #if NeedFunctionPrototypes XawTextSourceSearch(Widget w, XawTextPosition position, #if NeedWidePrototypes @@ -510,11 +510,11 @@ XawTextBlock * text; Boolean #if NeedFunctionPrototypes -XawTextSourceConvertSelection(Widget w, Atom *selection, Atom *target, +XawTextSourceConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type, XtPointer *value, unsigned long *length, int *format) #else -XawTextSourceConvertSelection(w, selection, +XawTextSourceConvertSelection(w, selection, target, type, value, length, format) Widget w; Atom * selection, * target, * type; @@ -544,7 +544,7 @@ int * format; void #if NeedFunctionPrototypes -XawTextSourceSetSelection(Widget w, XawTextPosition left, +XawTextSourceSetSelection(Widget w, XawTextPosition left, XawTextPosition right, Atom selection) #else XawTextSourceSetSelection(w, left, right, selection) @@ -570,9 +570,9 @@ Atom selection; ********************************************************************/ /* - * TextFormat(): - * returns the format of text: FMT8BIT or FMTWIDE. - * + * TextFormat(): + * returns the format of text: FMT8BIT or FMTWIDE. + * */ XrmQuark #if NeedFunctionPrototypes @@ -594,7 +594,7 @@ _XawTextFormat(tw) * wstr - source wchar string. * len_in_out - lengh of string. * As In, length of source wchar string, measured in wchar. - * As Out, length of returned string. + * As Out, length of returned string. */ @@ -621,7 +621,7 @@ _XawTextWCToMB( d, wstr, len_in_out ) /* _XawTextMBToWC(): * convert the string to internal processing codeset WC. * The caller is responsible for freeing both the source and ret string. - * + * * str - source string. * len_in_out - lengh of string. * As In, it is length of source string. diff --git a/src/TextTr.c b/src/TextTr.c index 6ad32d1..8ca7adc 100644 --- a/src/TextTr.c +++ b/src/TextTr.c @@ -38,7 +38,7 @@ so I am adding one more translation: <Key>Kanji: reconnect-im() The Japanese user typically hits their Kanji key when they want to do -input. This merely makes sure the input is connected. +input. This merely makes sure the input is connected. */ char *_XawDefaultTextTranslations1 = diff --git a/src/ThreeD.c b/src/ThreeD.c index e137e82..331d2f0 100644 --- a/src/ThreeD.c +++ b/src/ThreeD.c @@ -5,13 +5,13 @@ Copyright 1992 by Kaleb Keithley All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +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 names of Digital, MIT, or Kaleb -Keithley not be used in advertising or publicity pertaining to distribution -of the software without specific, written prior permission. +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital, MIT, or Kaleb +Keithley 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 @@ -220,13 +220,13 @@ static void AllocTopShadowPixmap (new) tdw->core.background_pixel == BlackPixelOfScreen (scn)) { pm_data = mtshadowpm_bits; pm_size = mtshadowpm_size; - } else + } else #endif { pm_data = shadowpm_bits; pm_size = shadowpm_size; } - + create_pixmap = TRUE; } else { pm_size = 0; /* keep gcc happy */ @@ -277,7 +277,7 @@ static void AllocBotShadowPixmap (new) tdw->core.background_pixel == BlackPixelOfScreen (scn)) { pm_data = mbshadowpm_bits; pm_size = mbshadowpm_size; - } else + } else #endif { pm_data = shadowpm_bits; @@ -427,7 +427,7 @@ static void _CvtStringToRelief(args, num_args, fromVal, toVal) if (q == XtQReliefSunken) { relief = XtReliefSunken; done(&relief, XtRelief); - } + } if (q == XtQReliefRidge) { relief = XtReliefRidge; done(&relief, XtRelief); @@ -450,7 +450,7 @@ static void ClassInitialize() XtQReliefRidge = XrmPermStringToQuark("ridge"); XtQReliefGroove = XrmPermStringToQuark("groove"); - XtAddConverter( XtRString, XtRRelief, _CvtStringToRelief, + XtAddConverter( XtRString, XtRRelief, _CvtStringToRelief, (XtConvertArgList)NULL, 0 ); } @@ -482,8 +482,8 @@ static void Initialize (request, new, args, num_args) AllocBotShadowPixmap (new); } else { if (tdw->threeD.top_shadow_pixel == tdw->threeD.bot_shadow_pixel) { - /* - Eeek. We're probably going to XQueryColor() twice + /* + Eeek. We're probably going to XQueryColor() twice for each widget. Necessary because you can set the top and bottom shadows independent of each other in SetValues. Some cacheing would certainly help... @@ -502,7 +502,7 @@ static void Realize (gw, valueMask, attrs) XtValueMask *valueMask; XSetWindowAttributes *attrs; { - /* + /* * This is necessary because Simple doesn't have a realize method * XtInheritRealize in the ThreeD class record doesn't work. This * daisychains through Simple to the Core class realize method @@ -548,7 +548,7 @@ static Boolean SetValues (gcurrent, grequest, gnew, args, num_args) Boolean alloc_top_pxmap = FALSE; Boolean alloc_bot_pxmap = FALSE; - (*threeDWidgetClass->core_class.superclass->core_class.set_values) + (*threeDWidgetClass->core_class.superclass->core_class.set_values) (gcurrent, grequest, gnew, NULL, 0); if (new->threeD.relief != current->threeD.relief) redisplay = TRUE; @@ -631,12 +631,12 @@ _Xaw3dDrawShadows (gw, event, region, relief, out) ThreeDWidget tdw = (ThreeDWidget) gw; Dimension s = tdw->threeD.shadow_width; - /* - * Draw the shadows using the core part width and height, + /* + * Draw the shadows using the core part width and height, * and the threeD part relief and shadow_width. * No point to do anything if the shadow_width is 0 or the * widget has not been realized. - */ + */ if ((s > 0) && XtIsRealized (gw)) { Dimension h = tdw->core.height; Dimension w = tdw->core.width; @@ -678,10 +678,10 @@ _Xaw3dDrawShadows (gw, event, region, relief, out) (XRectInRegion (region, wms, 0, s, h) != RectangleOut)) { pt[0].x = 0; pt[0].y = h; pt[1].x = w; pt[1].y = h; - pt[2].x = w; pt[2].y = 0; + pt[2].x = w; pt[2].y = 0; pt[3].x = wms; pt[3].y = s; pt[4].x = wms; pt[4].y = hms; - pt[5].x = s; pt[5].y = hms; + pt[5].x = s; pt[5].y = hms; XFillPolygon (dpy, win, (relief == XtReliefRaised) ? bot : top, pt, 6, Complex, CoordModeOrigin); @@ -711,10 +711,10 @@ _Xaw3dDrawShadows (gw, event, region, relief, out) (XRectInRegion (region, wms, 0, s, h) != RectangleOut)) { pt[0].x = 0; pt[0].y = h; pt[1].x = w; pt[1].y = h; - pt[2].x = w; pt[2].y = 0; + pt[2].x = w; pt[2].y = 0; pt[3].x = wms; pt[3].y = s; pt[4].x = wms; pt[4].y = hms; - pt[5].x = s; pt[5].y = hms; + pt[5].x = s; pt[5].y = hms; XFillPolygon (dpy, win, (relief == XtReliefRidge) ? realbot : realtop, pt, 6, Complex, CoordModeOrigin); @@ -741,10 +741,10 @@ _Xaw3dDrawShadows (gw, event, region, relief, out) (XRectInRegion (region, wms, 0, s, h) != RectangleOut)) { pt[0].x = s; pt[0].y = hms; pt[1].x = wms; pt[1].y = hms; - pt[2].x = wms; pt[2].y = s; + pt[2].x = wms; pt[2].y = s; pt[3].x = wms - s; pt[3].y = s * 2; pt[4].x = wms - s; pt[4].y = hms - s; - pt[5].x = s * 2; pt[5].y = hms - s; + pt[5].x = s * 2; pt[5].y = hms - s; XFillPolygon (dpy, win, (relief == XtReliefRidge) ? top : bot, pt, 6, Complex, CoordModeOrigin); @@ -370,7 +370,7 @@ Region region; XDrawString(XtDisplay(w), XtWindow(w), gc, tip->tip.internal_width, y, label, (int)(nl - label)); - y += tip->tip.font->max_bounds.ascent + + y += tip->tip.font->max_bounds.ascent + tip->tip.font->max_bounds.descent; label = nl + 1; } diff --git a/src/Toggle.c b/src/Toggle.c index 6e5fb6a..5db692a 100644 --- a/src/Toggle.c +++ b/src/Toggle.c @@ -29,9 +29,9 @@ in this Software without prior written authorization from the X Consortium. * Toggle.c - Toggle button widget * * Author: Chris D. Peterson - * MIT X Consortium + * MIT X Consortium * kit@expo.lcs.mit.edu - * + * * Date: January 12, 1989 * */ @@ -53,7 +53,7 @@ in this Software without prior written authorization from the X Consortium. /* Private Data */ -/* +/* * The order of toggle and notify are important, as the state has * to be set when we call the notify proc. */ @@ -65,12 +65,12 @@ static char defaultTranslations[] = #define offset(field) XtOffsetOf(ToggleRec, field) -static XtResource resources[] = { - {XtNstate, XtCState, XtRBoolean, sizeof(Boolean), +static XtResource resources[] = { + {XtNstate, XtCState, XtRBoolean, sizeof(Boolean), offset(command.set), XtRString, "off"}, - {XtNradioGroup, XtCWidget, XtRWidget, sizeof(Widget), + {XtNradioGroup, XtCWidget, XtRWidget, sizeof(Widget), offset(toggle.widget), XtRWidget, (XtPointer) NULL }, - {XtNradioData, XtCRadioData, XtRPointer, sizeof(XtPointer), + {XtNradioData, XtCRadioData, XtRPointer, sizeof(XtPointer), offset(toggle.radio_data), XtRPointer, (XtPointer) NULL }, }; @@ -98,7 +98,7 @@ static XtActionsRec actionsList[] = ToggleClassRec toggleClassRec = { { - (WidgetClass) SuperClass, /* superclass */ + (WidgetClass) SuperClass, /* superclass */ "Toggle", /* class_name */ sizeof(ToggleRec), /* size */ ClassInit, /* class_initialize */ @@ -132,7 +132,7 @@ ToggleClassRec toggleClassRec = { NULL /* extension */ }, /* CoreClass fields initialization */ { - XtInheritChangeSensitive /* change_sensitive */ + XtInheritChangeSensitive /* change_sensitive */ }, /* SimpleClass fields initialization */ { XtInheritXaw3dShadowDraw /* shadowdraw */ @@ -175,8 +175,8 @@ ClassInit() XtSetTypeConverter(XtRString, XtRWidget, XmuNewCvtStringToWidget, parentCvtArgs, XtNumber(parentCvtArgs), XtCacheNone, (XtDestructor)NULL); -/* - * Find the set and unset actions in the command widget's action table. +/* + * Find the set and unset actions in the command widget's action table. */ XtGetActionList(commandWidgetClass, &actions, &num_actions); @@ -184,7 +184,7 @@ ClassInit() for (i = 0 ; i < num_actions ; i++) { if (streq(actions[i].string, "set")) class->toggle_class.Set = actions[i].proc; - if (streq(actions[i].string, "unset")) + if (streq(actions[i].string, "unset")) class->toggle_class.Unset = actions[i].proc; if ( (class->toggle_class.Set != NULL) && @@ -192,7 +192,7 @@ ClassInit() XtFree((char *) actions); return; } - } + } /* We should never get here. */ XtError("Aborting, due to errors resolving bindings in the Toggle widget."); @@ -209,25 +209,25 @@ static void Initialize(request, new, args, num_args) tw->toggle.radio_group = NULL; - if (tw->toggle.radio_data == NULL) + if (tw->toggle.radio_data == NULL) tw->toggle.radio_data = (XtPointer) new->core.name; if (tw->toggle.widget != NULL) { - if ( GetRadioGroup(tw->toggle.widget) == NULL) + if ( GetRadioGroup(tw->toggle.widget) == NULL) CreateRadioGroup(new, tw->toggle.widget); else AddToRadioGroup( GetRadioGroup(tw->toggle.widget), new); - } + } XtAddCallback(new, XtNdestroyCallback, ToggleDestroy, (XtPointer)NULL); /* - * Command widget assumes that the widget is unset, so we only + * Command widget assumes that the widget is unset, so we only * have to handle the case where it needs to be set. * * If this widget is in a radio group then it may cause another * widget to be unset, thus calling the notify proceedure. * - * I want to set the toggle if the user set the state to "On" in + * I want to set the toggle if the user set the state to "On" in * the resource group, reguardless of what my ancestors did. */ @@ -242,7 +242,7 @@ static void Initialize(request, new, args, num_args) ************************************************************/ /* ARGSUSED */ -static void +static void ToggleSet(w,event,params,num_params) Widget w; XEvent *event; @@ -256,7 +256,7 @@ Cardinal *num_params; /* unused */ } /* ARGSUSED */ -static void +static void Toggle(w,event,params,num_params) Widget w; XEvent *event; @@ -266,9 +266,9 @@ Cardinal *num_params; /* unused */ ToggleWidget tw = (ToggleWidget)w; ToggleWidgetClass class = (ToggleWidgetClass) w->core.widget_class; - if (tw->command.set) + if (tw->command.set) class->toggle_class.Unset(w, event, NULL, 0); - else + else ToggleSet(w, event, params, num_params); } @@ -292,7 +292,7 @@ Cardinal *num_params; /* unused */ ***********************************************************/ /* ARGSUSED */ -static Boolean +static Boolean SetValues (current, request, new, args, num_args) Widget current, request, new; ArgList args; @@ -333,7 +333,7 @@ XtPointer junk, garbage; /************************************************************ * - * Below are all the private procedures that handle + * Below are all the private procedures that handle * radio toggle buttons. * ************************************************************/ @@ -359,7 +359,7 @@ Widget w; * Description: Creates a radio group. give two widgets. * Arguments: w1, w2 - the toggle widgets to add to the radio group. * Returns: none. - * + * * NOTE: A pointer to the group is added to each widget's radio_group * field. */ @@ -468,7 +468,7 @@ Widget w; * Public Routines * ************************************************************/ - + /* Function Name: XawToggleChangeRadioGroup * Description: Allows a toggle widget to change radio groups. * Arguments: w - The toggle widget to change groups. @@ -490,7 +490,7 @@ Widget w, radio_group; RemoveFromRadioGroup(w); /* - * If the toggle that we are about to add is set then we will + * If the toggle that we are about to add is set then we will * unset all toggles in the new radio group. */ @@ -550,7 +550,7 @@ XtPointer radio_data; #endif { RadioGroup * group; - ToggleWidget local_tog; + ToggleWidget local_tog; /* Special case of no radio group. */ @@ -565,7 +565,7 @@ XtPointer radio_data; } /* - * find top of radio_roup + * find top of radio_roup */ for ( ; group->prev != NULL ; group = group->prev); @@ -586,7 +586,7 @@ XtPointer radio_data; group = group->next; } } - + /* Function Name: XawToggleUnsetCurrent * Description: Unsets all Toggles in the radio_group specified. * Arguments: radio_group - any toggle widget in the toggle group. @@ -29,7 +29,7 @@ in this Software without prior written authorization from the X Consortium. * purpose and without fee is hereby granted, provided that the above * copyright notice appear in all copies and that both the copyright notice * and this permission notice appear in supporting documentation. - * + * * Prentice Hall and the authors disclaim all warranties with regard * to this software, including all implied warranties of merchantability and * fitness. In no event shall Prentice Hall or the authors be liable @@ -37,12 +37,12 @@ in this Software without prior written authorization from the X Consortium. * 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. - * + * * Authors: Jim Fulton, MIT X Consortium, * based on a version by Douglas Young, Prentice Hall - * + * * This widget is based on the Tree widget described on pages 397-419 of - * Douglas Young's book "The X Window System, Programming and Applications + * Douglas Young's book "The X Window System, Programming and Applications * with Xt OSF/Motif Edition." The layout code has been rewritten to use * additional blank space to make the structure of the graph easier to see * as well as to support vertical trees. @@ -118,31 +118,31 @@ TreeClassRec treeClassRec = { sizeof(TreeRec), /* widget_size */ ClassInitialize, /* class_init */ NULL, /* class_part_init */ - FALSE, /* class_inited */ + FALSE, /* class_inited */ Initialize, /* initialize */ - NULL, /* initialize_hook */ + NULL, /* initialize_hook */ XtInheritRealize, /* realize */ NULL, /* actions */ - 0, /* num_actions */ + 0, /* num_actions */ resources, /* resources */ XtNumber(resources), /* num_resources */ NULLQUARK, /* xrm_class */ - TRUE, /* compress_motion */ - TRUE, /* compress_exposure */ - TRUE, /* compress_enterleave*/ + TRUE, /* compress_motion */ + TRUE, /* compress_exposure */ + TRUE, /* compress_enterleave*/ TRUE, /* visible_interest */ Destroy, /* destroy */ NULL, /* resize */ Redisplay, /* expose */ SetValues, /* set_values */ - NULL, /* set_values_hook */ + NULL, /* set_values_hook */ XtInheritSetValuesAlmost, /* set_values_almost */ - NULL, /* get_values_hook */ + NULL, /* get_values_hook */ NULL, /* accept_focus */ - XtVersion, /* version */ + XtVersion, /* version */ NULL, /* callback_private */ NULL, /* tm_table */ - QueryGeometry, /* query_geometry */ + QueryGeometry, /* query_geometry */ NULL, /* display_accelerator*/ NULL, /* extension */ }, @@ -150,11 +150,11 @@ TreeClassRec treeClassRec = { /* composite_class fields */ GeometryManager, /* geometry_manager */ ChangeManaged, /* change_managed */ - XtInheritInsertChild, /* insert_child */ - XtInheritDeleteChild, /* delete_child */ + XtInheritInsertChild, /* insert_child */ + XtInheritDeleteChild, /* delete_child */ NULL, /* extension */ }, - { + { /* constraint_class fields */ treeConstraintResources, /* subresources */ XtNumber(treeConstraintResources), /* subresource_count */ @@ -166,7 +166,7 @@ TreeClassRec treeClassRec = { }, { /* Tree class fields */ - 0, /* ignore */ + 0, /* ignore */ } }; @@ -228,28 +228,28 @@ static void insert_node (parent, node) TreeConstraints pc; TreeConstraints nc = TREE_CONSTRAINT(node); int nindex; - + nc->tree.parent = parent; if (parent == NULL) return; /* - * If there isn't more room in the children array, + * If there isn't more room in the children array, * allocate additional space. - */ + */ pc = TREE_CONSTRAINT(parent); nindex = pc->tree.n_children; - + if (pc->tree.n_children == pc->tree.max_children) { pc->tree.max_children += (pc->tree.max_children / 2) + 2; - pc->tree.children = (WidgetList) XtRealloc ((char *)pc->tree.children, + pc->tree.children = (WidgetList) XtRealloc ((char *)pc->tree.children, (unsigned int) ((pc->tree.max_children) * sizeof(Widget))); - } + } /* - * Add the sub_node in the next available slot and + * Add the sub_node in the next available slot and * increment the counter. */ pc->tree.children[nindex] = node; @@ -265,8 +265,8 @@ static void delete_node (parent, node) /* * Make sure the parent exists. */ - if (!parent) return; - + if (!parent) return; + pc = TREE_CONSTRAINT(parent); /* @@ -279,14 +279,14 @@ static void delete_node (parent, node) /* * Decrement the number of children - */ + */ pc->tree.n_children--; /* * Fill in the gap left by the sub_node. * Zero the last slot for good luck. */ - for (i = pos; i < pc->tree.n_children; i++) + for (i = pos; i < pc->tree.n_children; i++) pc->tree.children[i] = pc->tree.children[i+1]; pc->tree.children[pc->tree.n_children]=0; @@ -330,7 +330,7 @@ static void Initialize (grequest, gnew, args, num_args) Arg arglist[2]; /* - * Make sure the widget's width and height are + * Make sure the widget's width and height are * greater than zero. */ if (request->core.width <= 0) new->core.width = 5; @@ -368,14 +368,14 @@ static void Initialize (grequest, gnew, args, num_args) */ new->tree.largest = NULL; new->tree.n_largest = 0; - initialize_dimensions (&new->tree.largest, &new->tree.n_largest, + initialize_dimensions (&new->tree.largest, &new->tree.n_largest, TREE_INITIAL_DEPTH); /* * make sure that our gravity is one of the acceptable values */ check_gravity (new, WestGravity); -} +} /* ARGSUSED */ @@ -393,21 +393,21 @@ static void ConstraintInitialize (request, new, args, num_args) tc->tree.n_children = 0; tc->tree.max_children = 0; tc->tree.children = (Widget *) NULL; - tc->tree.x = tc->tree.y = 0; + tc->tree.x = tc->tree.y = 0; tc->tree.bbsubwidth = 0; tc->tree.bbsubheight = 0; /* - * If this widget has a super-node, add it to that - * widget' sub-nodes list. Otherwise make it a sub-node of + * If this widget has a super-node, add it to that + * widget' sub-nodes list. Otherwise make it a sub-node of * the tree_root widget. */ if (tc->tree.parent) insert_node (tc->tree.parent, new); else if (tw->tree.tree_root) insert_node (tw->tree.tree_root, new); -} +} /* ARGSUSED */ @@ -428,7 +428,7 @@ static Boolean SetValues (gcurrent, grequest, gnew, args, num_args) new->tree.line_width != current->tree.line_width) { XtReleaseGC (gnew, new->tree.gc); new->tree.gc = get_tree_gc (new); - redraw = TRUE; + redraw = TRUE; } /* @@ -480,7 +480,7 @@ static Boolean ConstraintSetValues (current, request, new, args, num_args) insert_node(newc->tree.parent, new); /* - * If the Tree widget has been realized, + * If the Tree widget has been realized, * compute new layout. */ if (XtIsRealized((Widget)tw)) @@ -490,18 +490,18 @@ static Boolean ConstraintSetValues (current, request, new, args, num_args) } -static void ConstraintDestroy (w) +static void ConstraintDestroy (w) Widget w; -{ +{ TreeConstraints tc = TREE_CONSTRAINT(w); TreeWidget tw = (TreeWidget) XtParent(w); int i; - /* + /* * Remove the widget from its parent's sub-nodes list and * make all this widget's sub-nodes sub-nodes of the parent. */ - + if (tw->tree.tree_root == w) { if (tc->tree.n_children > 0) tw->tree.tree_root = tc->tree.children[0]; @@ -728,8 +728,8 @@ static void compute_bounding_box_subtree (tree, w, depth) if (tc->tree.n_children == 0) return; /* - * Figure the size of the opposite dimension (vertical if tree is - * horizontal, else vice versa). The other dimension will be set + * Figure the size of the opposite dimension (vertical if tree is + * horizontal, else vice versa). The other dimension will be set * in the second pass once we know the maximum dimensions. */ newwidth = 0; @@ -737,7 +737,7 @@ static void compute_bounding_box_subtree (tree, w, depth) for (i = 0; i < tc->tree.n_children; i++) { Widget child = tc->tree.children[i]; TreeConstraints cc = TREE_CONSTRAINT(child); - + compute_bounding_box_subtree (tree, child, depth + 1); if (horiz) { @@ -775,7 +775,7 @@ static void set_positions (tw, w, level) int level; { int i; - + if (w) { TreeConstraints tc = TREE_CONSTRAINT(w); @@ -900,9 +900,9 @@ static void arrange_subtree (tree, w, depth, x, y) if (horiz) { tc->tree.x = x; adjusted = firstcc->tree.y + - ((lastcc->tree.y + (Position) child->core.height + + ((lastcc->tree.y + (Position) child->core.height + (Position) child->core.border_width * 2 - - firstcc->tree.y - (Position) w->core.height - + firstcc->tree.y - (Position) w->core.height - (Position) w->core.border_width * 2 + 1) / 2); if (adjusted > tc->tree.y) tc->tree.y = adjusted; } else { @@ -960,7 +960,7 @@ static void layout_tree (tw, insetvalues) tw->tree.maxwidth = tw->tree.maxheight = 0; for (i = 0, dp = tw->tree.largest; i < tw->tree.n_largest; i++, dp++) *dp = 0; - initialize_dimensions (&tw->tree.largest, &tw->tree.n_largest, + initialize_dimensions (&tw->tree.largest, &tw->tree.n_largest, tw->tree.n_largest); compute_bounding_box_subtree (tw, tw->tree.tree_root, 0); diff --git a/src/Vendor.c b/src/Vendor.c index 84f14a5..6a32146 100644 --- a/src/Vendor.c +++ b/src/Vendor.c @@ -28,13 +28,13 @@ 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, +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 +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. +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 @@ -131,7 +131,7 @@ externaldef(vendorshellclassrec) VendorShellClassRec vendorShellClassRec = { #endif /* Class init'ed ? */ FALSE, /* initialize */ XawVendorShellInitialize, - /* initialize_hook */ NULL, + /* initialize_hook */ NULL, /* realize */ Realize, /* actions */ NULL, /* num_actions */ 0, @@ -150,8 +150,8 @@ externaldef(vendorshellclassrec) VendorShellClassRec vendorShellClassRec = { #endif /* expose */ NULL, /* set_values */ XawVendorShellSetValues, - /* set_values_hook */ NULL, - /* set_values_almost */ XtInheritSetValuesAlmost, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, /* get_values_hook */ NULL, /* accept_focus */ NULL, /* intrinsics version */ XtVersion, @@ -220,7 +220,7 @@ externaldef(vendorshellextclassrec) XawVendorShellExtClassRec /* class_part_initialize*/ NULL, /* Class init'ed ? */ FALSE, /* initialize */ XawVendorShellExtInitialize, - /* initialize_hook */ NULL, + /* initialize_hook */ NULL, /* pad */ NULL, /* pad */ NULL, /* pad */ 0, @@ -235,8 +235,8 @@ externaldef(vendorshellextclassrec) XawVendorShellExtClassRec /* pad */ NULL, /* pad */ NULL, /* set_values */ XawVendorShellExtSetValues, - /* set_values_hook */ NULL, - /* pad */ NULL, + /* set_values_hook */ NULL, + /* pad */ NULL, /* get_values_hook */ NULL, /* pad */ NULL, /* version */ XtVersion, @@ -390,7 +390,7 @@ static void XawVendorShellClassInitialize() }; #endif - XtAddConverter(XtRString, XtRCursor, XmuCvtStringToCursor, + XtAddConverter(XtRString, XtRCursor, XmuCvtStringToCursor, screenConvertArg, XtNumber(screenConvertArg)); #ifdef XAW_MULTIPLANE_PIXMAPS @@ -414,9 +414,9 @@ static void XawVendorShellClassPartInit(class) CompositeClassExtension ext; VendorShellWidgetClass vsclass = (VendorShellWidgetClass) class; - if ((ext = (CompositeClassExtension) + if ((ext = (CompositeClassExtension) XtGetClassExtension (class, - XtOffsetOf(CompositeClassRec, + XtOffsetOf(CompositeClassRec, composite_class.extension), NULLQUARK, 1L, (Cardinal) 0)) == NULL) { ext = (CompositeClassExtension) XtNew (CompositeClassExtensionRec); @@ -571,7 +571,7 @@ static XtGeometryResult GeometryManager( wid, request, reply ) * so, whatever the WM sized us to (if the Shell requested * only one of the two) is now the correct child size */ - + wid->core.width = shell->core.width; wid->core.height = shell->core.height; if (request->request_mode & CWBorderWidth) { diff --git a/src/Viewport.c b/src/Viewport.c index 607c461..0f5c553 100644 --- a/src/Viewport.c +++ b/src/Viewport.c @@ -28,13 +28,13 @@ 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, +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 +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. +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 @@ -212,7 +212,7 @@ static void Initialize(request, new, args, num_args) w->form.default_spacing = 0; /* Reset the default spacing to 0 pixels. */ -/* +/* * Initialize all widget pointers to NULL. */ @@ -244,7 +244,7 @@ static void Initialize(request, new, args, num_args) XtSetValues((Widget)w, threeD_args, arg_cnt); } -/* +/* * Create Clip Widget. */ @@ -261,12 +261,12 @@ static void Initialize(request, new, args, num_args) w->viewport.clip = XtCreateManagedWidget("clip", widgetClass, new, clip_args, arg_cnt); - if (!w->viewport.forcebars) + if (!w->viewport.forcebars) return; /* If we are not forcing the bars then we are done. */ - if (w->viewport.allowhoriz) + if (w->viewport.allowhoriz) (void) CreateScrollbar(w, True); - if (w->viewport.allowvert) + if (w->viewport.allowvert) (void) CreateScrollbar(w, False); h_bar = w->viewport.horiz_bar; @@ -283,7 +283,7 @@ static void Initialize(request, new, args, num_args) ((int)w->core.width > (int)(h_bar->core.width + h_bar->core.border_width + pad)) ) clip_width -= h_bar->core.width + h_bar->core.border_width + pad; - + if ( (v_bar != NULL) && ((int)w->core.height > (int)(v_bar->core.height + v_bar->core.border_width + pad)) ) @@ -345,7 +345,7 @@ static Boolean SetValues(current, request, new, args, num_args) (w->viewport.allowvert != cw->viewport.allowvert) || (w->viewport.allowhoriz != cw->viewport.allowhoriz) || (w->viewport.useright != cw->viewport.useright) || - (w->viewport.usebottom != cw->viewport.usebottom) ) + (w->viewport.usebottom != cw->viewport.usebottom) ) { (*w->core.widget_class->core_class.resize)(new); /* Recompute layout.*/ } @@ -394,7 +394,7 @@ static void ChangeManaged(widget) (Position)0, (Position)0 ); if (child->core.mapped_when_managed) XtMapWidget( child ); -#else +#else w->core.window = XtWindow(w->viewport.clip); XtRealizeWidget( child ); w->core.window = window; @@ -537,7 +537,7 @@ static void ComputeLayout(widget, query, destroy_scrollbars) if (w->viewport.forcebars) { needsvert = w->viewport.allowvert; needshoriz = w->viewport.allowhoriz; - ComputeWithForceBars(widget, query, &intended, + ComputeWithForceBars(widget, query, &intended, &clip_width, &clip_height); } else { @@ -555,21 +555,21 @@ static void ComputeLayout(widget, query, destroy_scrollbars) * child's preferences are not acceptable. */ - if (!w->viewport.allowhoriz) + if (!w->viewport.allowhoriz) intended.request_mode |= CWWidth; #ifdef PREP_CHILD_TO_CLIP - if ((int)child->core.width < clip_width) + if ((int)child->core.width < clip_width) intended.width = clip_width; else #endif intended.width = child->core.width; - if (!w->viewport.allowvert) + if (!w->viewport.allowvert) intended.request_mode |= CWHeight; #ifdef PREP_CHILD_TO_CLIP - if ((int)child->core.height < clip_height) + if ((int)child->core.height < clip_height) intended.height = clip_height; else #endif @@ -791,7 +791,7 @@ int *clip_width, *clip_height; if (sw) pad = 2; if (w->viewport.allowvert) { - if (w->viewport.vert_bar == NULL) + if (w->viewport.vert_bar == NULL) w->viewport.vert_bar = CreateScrollbar(w, False); *clip_width -= w->viewport.vert_bar->core.width + @@ -799,7 +799,7 @@ int *clip_width, *clip_height; } if (w->viewport.allowhoriz) { - if (w->viewport.horiz_bar == NULL) + if (w->viewport.horiz_bar == NULL) w->viewport.horiz_bar = CreateScrollbar(w, True); *clip_height -= w->viewport.horiz_bar->core.height + @@ -819,9 +819,9 @@ int *clip_width, *clip_height; } if ( query ) { - if ( (w->viewport.allowvert || w->viewport.allowhoriz) ) { + if ( (w->viewport.allowvert || w->viewport.allowhoriz) ) { XtQueryGeometry( child, intended, &preferred ); - + if ( !(intended->request_mode & CWWidth) ) if ( preferred.request_mode & CWWidth ) intended->width = preferred.width; @@ -926,13 +926,13 @@ TestSmaller(w, request, reply_return) if (request->width < w->core.width || request->height < w->core.height) return XtMakeGeometryRequest((Widget)w, request, reply_return); else - return XtGeometryYes; + return XtGeometryYes; } static XtGeometryResult GeometryRequestPlusScrollbar(w, horizontal, request, reply_return) Boolean horizontal; - ViewportWidget w; + ViewportWidget w; XtWidgetGeometry *request, *reply_return; { Widget bar; @@ -954,11 +954,11 @@ GeometryRequestPlusScrollbar(w, horizontal, request, reply_return) #define WidthChange() (request->width != w->core.width) #define HeightChange() (request->height != w->core.height) -static XtGeometryResult +static XtGeometryResult QueryGeometry(w, request, reply_return) ViewportWidget w; XtWidgetGeometry *request, *reply_return; -{ - if (w->viewport.allowhoriz && w->viewport.allowvert) +{ + if (w->viewport.allowhoriz && w->viewport.allowvert) return TestSmaller(w, request, reply_return); else if (w->viewport.allowhoriz && !w->viewport.allowvert) { @@ -980,7 +980,7 @@ QueryGeometry(w, request, reply_return) return GeometryRequestPlusScrollbar(w, False, request, reply_return); else /* !WidthChange() && !HeightChange() */ return XtGeometryYes; - } + } else /* (!w->viewport.allowhoriz && !w->viewport.allowvert) */ return XtMakeGeometryRequest((Widget) w, request, reply_return); } @@ -1029,7 +1029,7 @@ static XtGeometryResult GeometryManager(child, request, reply) if (rWidth && w->core.width != request->width) { if (w->viewport.allowhoriz && request->width > w->core.width) { /* horizontal scrollbar will be needed so possibly reduce height */ - Widget bar; + Widget bar; if ((bar = w->viewport.horiz_bar) == (Widget)NULL) bar = CreateScrollbar( w, True ); height_remaining -= bar->core.height + @@ -1151,12 +1151,12 @@ XawViewportSetLocation (gw, xoff, yoff) if (xoff > 1.0) /* scroll to right */ x = child->core.width; - else if (xoff < 0.0) /* if the offset is < 0.0 nothing */ + else if (xoff < 0.0) /* if the offset is < 0.0 nothing */ x = child->core.x; else x = (Position) (((float) child->core.width) * xoff); - if (yoff > 1.0) + if (yoff > 1.0) y = child->core.height; else if (yoff < 0.0) y = child->core.y; @@ -1183,7 +1183,7 @@ XawViewportSetCoordinates (gw, x, y) ViewportWidget w = (ViewportWidget) gw; Widget child = w->viewport.child; - if (x > (int)child->core.width) + if (x > (int)child->core.width) x = child->core.width; else if (x < 0) x = child->core.x; diff --git a/src/Xaw3dP.c b/src/Xaw3dP.c index b3b26f7..d31dc11 100644 --- a/src/Xaw3dP.c +++ b/src/Xaw3dP.c @@ -53,7 +53,7 @@ Screen *scn; { XColor exact; - (void)XAllocNamedColor(dpy, DefaultColormapOfScreen(scn), + (void)XAllocNamedColor(dpy, DefaultColormapOfScreen(scn), "gray", &Gray, &exact); /* Blindflug */ } diff --git a/src/XawI18n.c b/src/XawI18n.c index 0a8bc30..10a83fd 100644 --- a/src/XawI18n.c +++ b/src/XawI18n.c @@ -18,7 +18,7 @@ * OMRON, NTT SOFTWARE, AND NTT, DISCLAIM ALL WARRANTIES WITH REGARD * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL OMRON, NTT SOFTWARE, OR NTT BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * 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. diff --git a/src/XawIm.c b/src/XawIm.c index 0fa1c16..bda3209 100644 --- a/src/XawIm.c +++ b/src/XawIm.c @@ -17,12 +17,12 @@ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. + * SOFTWARE. * * Author: Seiji Kuwari OMRON Corporation * kuwa@omron.co.jp * kuwa%omron.co.jp@uunet.uu.net - */ + */ /* @@ -91,16 +91,16 @@ in this Software without prior written authorization from the X Consortium. * Forward reference prototypes * *****************************************************/ - -static XawIcTableList CurrentSharedIcTable( + +static XawIcTableList CurrentSharedIcTable( #if NeedFunctionPrototypes - XawVendorShellExtPart* /* ve */ + XawVendorShellExtPart* /* ve */ #endif ); -static void DestroyIC( +static void DestroyIC( #if NeedFunctionPrototypes - Widget /* w */, + Widget /* w */, XawVendorShellExtPart* /* ve */ #endif ); @@ -444,7 +444,7 @@ static void OpenIM(ve) } if (XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL) || !xim_styles) { - XtAppWarning(XtWidgetToApplicationContext(ve->parent), + XtAppWarning(XtWidgetToApplicationContext(ve->parent), "input method doesn't support any style"); XCloseIM(xim); return; @@ -575,7 +575,7 @@ static XawIcTableList CreateIcTable( w, ve ) } static Boolean RegisterToVendorShell( w, ve ) - Widget w; + Widget w; XawVendorShellExtPart * ve; { XawIcTableList table; @@ -745,7 +745,7 @@ static void CreateIC( w, ve ) if (IsSharedIC(ve)) SetICValuesShared(w, ve, p, FALSE); XFlush(XtDisplay(w)); - + if (p->input_style & (XIMPreeditArea|XIMPreeditPosition|XIMStatusArea)) { if (p->flg & CIFontSet) { SetVaArg( &pe_a[pe_cnt], (XPointer) XNFontSet); pe_cnt++; @@ -1368,13 +1368,13 @@ static void Destroy( w, ve ) return; XtFree( (char*) ve->im.resources ); - if (extContext != (XContext)NULL && - !XFindContext (XtDisplay (w), (Window)w, + if (extContext != (XContext)NULL && + !XFindContext (XtDisplay (w), (Window)w, extContext, (XPointer*)&contextData)) XtFree( (char*) contextData ); - if (errContext != (XContext)NULL && - !XFindContext (XDisplayOfIM( ve->im.xim ), (Window) ve->im.xim, + if (errContext != (XContext)NULL && + !XFindContext (XDisplayOfIM( ve->im.xim ), (Window) ve->im.xim, errContext, (XPointer*) &contextErrData)) XtFree( (char*) contextErrData ); } @@ -1388,7 +1388,7 @@ static void Destroy( w, ve ) void #if NeedFunctionPrototypes -_XawImResizeVendorShell( +_XawImResizeVendorShell( Widget w ) #else _XawImResizeVendorShell( w ) @@ -1405,7 +1405,7 @@ _XawImResizeVendorShell( w ) Dimension #if NeedFunctionPrototypes -_XawImGetShellHeight( +_XawImGetShellHeight( Widget w ) #else _XawImGetShellHeight( w ) @@ -1423,7 +1423,7 @@ _XawImGetShellHeight( w ) void #if NeedFunctionPrototypes -_XawImRealize( +_XawImRealize( Widget w ) #else _XawImRealize( w ) @@ -1443,8 +1443,8 @@ _XawImRealize( w ) void #if NeedFunctionPrototypes -_XawImInitialize( - Widget w, +_XawImInitialize( + Widget w, Widget ext ) #else _XawImInitialize( w, ext ) @@ -1463,7 +1463,7 @@ _XawImInitialize( w, ext ) void #if NeedFunctionPrototypes -_XawImReconnect( +_XawImReconnect( Widget inwidg ) #else _XawImReconnect( inwidg ) @@ -1517,9 +1517,9 @@ _XawImUnregister(inwidg) void #if NeedFunctionPrototypes -_XawImSetValues( - Widget inwidg, - ArgList args, +_XawImSetValues( + Widget inwidg, + ArgList args, Cardinal num_args ) #else _XawImSetValues( inwidg, args, num_args ) @@ -1562,8 +1562,8 @@ _XawImVASetValues( inwidg, va_alist ) void #if NeedFunctionPrototypes _XawImSetFocusValues( - Widget inwidg, - ArgList args, + Widget inwidg, + ArgList args, Cardinal num_args) #else _XawImSetFocusValues(inwidg, args, num_args) @@ -1617,12 +1617,12 @@ _XawImUnsetFocus(inwidg) int #if NeedFunctionPrototypes -_XawImWcLookupString( - Widget inwidg, +_XawImWcLookupString( + Widget inwidg, XKeyPressedEvent *event, - wchar_t* buffer_return, + wchar_t* buffer_return, int bytes_buffer, - KeySym *keysym_return, + KeySym *keysym_return, Status *status_return) #else _XawImWcLookupString( inwidg, event, buffer_return, bytes_buffer, @@ -1699,8 +1699,8 @@ _XawImCallVendorShellExtResize( w ) void #if NeedFunctionPrototypes -_XawImDestroy( - Widget w, +_XawImDestroy( + Widget w, Widget ext ) #else _XawImDestroy( w, ext ) diff --git a/src/XawInit.c b/src/XawInit.c index aabfdd3..d5bed7a 100644 --- a/src/XawInit.c +++ b/src/XawInit.c @@ -21,10 +21,10 @@ 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. - * - * + * + * * XawInitializeWidgetSet - * + * * This routine forces a reference to vendor shell so that the one in this * widget is installed. Any other cross-widget set initialization should be * done here as well. All Athena widgets should include "XawInit.h" and diff --git a/src/laygram.y b/src/laygram.y index c209b64..b17dc17 100644 --- a/src/laygram.y +++ b/src/laygram.y @@ -29,7 +29,7 @@ static LayoutPtr *dest; %type <pval> bothparams oneparams %type <gval> glue opStretch opShrink %type <lval> orientation -%type <eval> signedExpr simpleExpr expr +%type <eval> signedExpr simpleExpr expr %token OC CC OA CA OP CP %token <qval> NAME @@ -93,9 +93,9 @@ compositebox : orientation OC boxes CC box->type = BoxBox; box->u.box.dir = $1; box->u.box.firstChild = $3; - for (child = $3; child; child = child->nextSibling) + for (child = $3; child; child = child->nextSibling) { - if (child->type == GlueBox) + if (child->type == GlueBox) { child->params.stretch[!$1].expr = 0; child->params.shrink[!$1].expr = 0; @@ -110,7 +110,7 @@ compositebox : orientation OC boxes CC } ; boxes : box boxes - { + { $1->nextSibling = $2; $$ = $1; } @@ -118,9 +118,9 @@ boxes : box boxes { $$ = $1; } ; bothparams : OA opStretch opShrink TIMES opStretch opShrink CA - { + { BoxParamsPtr p = New(BoxParamsRec); - + p->stretch[LayoutHorizontal] = $2; p->shrink[LayoutHorizontal] = $3; p->stretch[LayoutVertical] = $5; @@ -128,9 +128,9 @@ bothparams : OA opStretch opShrink TIMES opStretch opShrink CA $$ = p; } | - { + { BoxParamsPtr p = New(BoxParamsRec); - + ZeroGlue (p->stretch[LayoutHorizontal]); ZeroGlue (p->shrink[LayoutHorizontal]); ZeroGlue (p->stretch[LayoutVertical]); @@ -139,9 +139,9 @@ bothparams : OA opStretch opShrink TIMES opStretch opShrink CA } ; oneparams : OA opStretch opShrink CA - { + { BoxParamsPtr p = New(BoxParamsRec); - + p->stretch[LayoutHorizontal] = $2; p->shrink[LayoutHorizontal] = $3; p->stretch[LayoutVertical] = $2; @@ -149,9 +149,9 @@ oneparams : OA opStretch opShrink CA $$ = p; } | - { + { BoxParamsPtr p = New(BoxParamsRec); - + ZeroGlue (p->stretch[LayoutHorizontal]); ZeroGlue (p->shrink[LayoutHorizontal]); ZeroGlue (p->stretch[LayoutVertical]); diff --git a/src/laylex.l b/src/laylex.l index 7de4f2d..c7dced9 100644 --- a/src/laylex.l +++ b/src/laylex.l @@ -49,7 +49,7 @@ inff* { yylval.ival = count(yytext, 'f'); return INFINITY; } %[ \t\n]*of { yylval.oval = Percent; return PERCENTOF; } width return WIDTH; height return HEIGHT; -\\[a-zA-Z_][a-zA-Z0-9_]* { +\\[a-zA-Z_][a-zA-Z0-9_]* { #ifdef FLEX_SCANNER yytext[yyleng] = '\0'; #else @@ -59,7 +59,7 @@ height return HEIGHT; return NAME; } -[a-zA-Z_][a-zA-Z0-9_]* { +[a-zA-Z_][a-zA-Z0-9_]* { #ifdef FLEX_SCANNER yytext[yyleng] = '\0'; #else @@ -96,7 +96,7 @@ yyerror(s) char *s; { char *t; - + fprintf (stderr, "%s\n", s); t = yysource - 50; if (t < yysourcebase) |