diff options
Diffstat (limited to 'Bitmap.c')
-rw-r--r-- | Bitmap.c | 574 |
1 files changed, 284 insertions, 290 deletions
@@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/bitmap/Bitmap.c,v 1.6 2002/02/18 21:43:17 herrb Exp $ */ /* * Author: Davor Matic, MIT X Consortium @@ -36,17 +37,16 @@ from The Open Group. #include <X11/Xaw/XawInit.h> #include <X11/Xmu/CharSet.h> #include <X11/Xmu/Drawing.h> +#include <X11/Xmu/SysUtil.h> #include <X11/Xatom.h> #include <X11/Xfuncs.h> #include <X11/Xos.h> #include "BitmapP.h" +#include "Bitmap.h" #include <stdio.h> #include <math.h> -#ifndef abs -#define abs(x) ((((int)(x)) > 0) ? (x) : -(x)) -#endif #define min(x, y) ((((int)(x)) < (int)(y)) ? (x) : (y)) #define max(x, y) ((((int)(x)) > (int)(y)) ? (x) : (y)) @@ -120,54 +120,32 @@ static XtResource resources[] = { }; #undef Offset -void BWDebug(); -void BWChangeNotify(); -void BWSetChanged(); -void BWAbort(); -void BWUp(); -void BWDown(); -void BWLeft(); -void BWRight(); -void BWFold(); -void BWFlipHoriz(); -void BWFlipVert(); -void BWRotateRight(); -void BWRotateLeft(); -void BWSet(); -void BWClear(); -void BWInvert(); -void BWUndo(); -void BWRedraw(); -void BWTMark(); -void BWTMarkAll(); -void BWTUnmark(); -void BWTPaste(); static XtActionsRec actions[] = { -{"mark", BWTMark}, -{"mark-all", BWTMarkAll}, -{"unmark", BWTUnmark}, -{"paste", BWTPaste}, -{"bw-debug", BWDebug}, -{"abort", BWAbort}, -{"store-to-buffer", BWStoreToBuffer}, -{"change-notify", BWChangeNotify}, -{"set-changed", BWSetChanged}, -{"up", BWUp}, -{"down", BWDown}, -{"left", BWLeft}, -{"right", BWRight}, -{"fold", BWFold}, -{"flip-horiz", BWFlipHoriz}, -{"flip-vert", BWFlipVert}, -{"rotate-right", BWRotateRight}, -{"rotate-left", BWRotateLeft}, -{"set", BWSet}, -{"clear", BWClear}, -{"invert", BWInvert}, -{"undo", BWUndo}, -{"redraw", BWRedraw}, +{"mark", (XtActionProc)BWTMark}, +{"mark-all", (XtActionProc)BWTMarkAll}, +{"unmark", (XtActionProc)BWTUnmark}, +{"paste", (XtActionProc)BWTPaste}, +{"bw-debug", (XtActionProc)BWDebug}, +{"abort", (XtActionProc)BWAbort}, +{"store-to-buffer", (XtActionProc)BWStoreToBuffer}, +{"change-notify", (XtActionProc)BWChangeNotify}, +{"set-changed", (XtActionProc)BWSetChanged}, +{"up", (XtActionProc)BWUp}, +{"down", (XtActionProc)BWDown}, +{"left", (XtActionProc)BWLeft}, +{"right", (XtActionProc)BWRight}, +{"fold", (XtActionProc)BWFold}, +{"flip-horiz", (XtActionProc)BWFlipHoriz}, +{"flip-vert", (XtActionProc)BWFlipVert}, +{"rotate-right", (XtActionProc)BWRotateRight}, +{"rotate-left", (XtActionProc)BWRotateLeft}, +{"set", (XtActionProc)BWSet}, +{"clear", (XtActionProc)BWClear}, +{"invert", (XtActionProc)BWInvert}, +{"undo", (XtActionProc)BWUndo}, +{"redraw", (XtActionProc)BWRedraw}, }; static char translations1[] = @@ -258,12 +236,85 @@ Atom targets[] = { #include "Requests.h" -static void ClassInitialize(); -static void Initialize(); -static void Redisplay(); -static void Resize(); -static void Destroy(); -static Boolean SetValues(); + +static BWRequestRec requests[] = +{ +{MarkRequest, sizeof(BWStatus), + TwoPointsEngage, (XtPointer) BWDrawRectangle, + TwoPointsTerminateTimed, (XtPointer) BWSelect, + NULL, (XtPointer) NULL}, +{RestoreRequest, sizeof(BWStatus), + OnePointEngage, (XtPointer) BWDragStored, + OnePointTerminate, (XtPointer) BWRestore, + NULL, (XtPointer) NULL}, +{ImmediateCopyRequest, sizeof(BWStatus), + OnePointEngage, (XtPointer) BWDragMarked, + OnePointTerminate, (XtPointer) BWCopy, + NULL, (XtPointer) NULL}, +{ImmediateMoveRequest, sizeof(BWStatus), + OnePointEngage, (XtPointer) BWDragMarked, + OnePointTerminate, (XtPointer) BWMove, + NULL, (XtPointer) NULL}, +{CopyRequest, sizeof(BWStatus), + DragOnePointEngage, (XtPointer) Paste, + DragOnePointTerminate, (XtPointer) ImmediateCopyRequest, + Interface, (XtPointer) BWUnmark}, +{MoveRequest, sizeof(BWStatus), + DragOnePointEngage, (XtPointer) Paste, + DragOnePointTerminate, (XtPointer) ImmediateMoveRequest, + Interface, (XtPointer) BWUnmark}, +{PointRequest, sizeof(BWStatus), + DragOnePointEngage, (XtPointer) BWDrawPoint, + DragOnePointTerminate, (XtPointer) BWDrawPoint, + NULL, (XtPointer) NULL}, +{CurveRequest, sizeof(BWStatus), + DragTwoPointsEngage, (XtPointer) BWBlindLine, + DragTwoPointsTerminate, (XtPointer) BWBlindLine, + NULL, (XtPointer) NULL}, +{LineRequest, sizeof(BWStatus), + TwoPointsEngage, (XtPointer) BWDrawLine, + TwoPointsTerminate, (XtPointer) BWDrawLine, + NULL, (XtPointer) NULL}, +{RectangleRequest, sizeof(BWStatus), + TwoPointsEngage, (XtPointer) BWDrawRectangle, + TwoPointsTerminate, (XtPointer) BWDrawRectangle, + NULL, (XtPointer) NULL}, +{FilledRectangleRequest, sizeof(BWStatus), + TwoPointsEngage, (XtPointer) BWDrawRectangle, + TwoPointsTerminate, (XtPointer) BWDrawFilledRectangle, + NULL, (XtPointer) NULL}, +{CircleRequest, sizeof(BWStatus), + TwoPointsEngage, (XtPointer) BWDrawCircle, + TwoPointsTerminate, (XtPointer) BWDrawCircle, + NULL, (XtPointer) NULL}, +{FilledCircleRequest, sizeof(BWStatus), + TwoPointsEngage, (XtPointer) BWDrawCircle, + TwoPointsTerminate, (XtPointer) BWDrawFilledCircle, + NULL, (XtPointer) NULL}, +{FloodFillRequest, sizeof(BWStatus), + OnePointEngage, (XtPointer) NULL, + OnePointTerminate, (XtPointer) BWFloodFill, + NULL, (XtPointer) NULL}, +{HotSpotRequest, sizeof(BWStatus), + OnePointEngage, (XtPointer) BWDrawHotSpot, + OnePointTerminate, (XtPointer) BWDrawHotSpot, + NULL, (XtPointer) NULL}, +{ZoomInRequest, sizeof(BWStatus), + TwoPointsEngage, (XtPointer) BWDrawRectangle, + TwoPointsTerminate, (XtPointer) BWZoomIn, + NULL, (XtPointer) NULL}, +}; + +static void ClassInitialize(void); +static void Initialize(Widget wrequest, Widget wnew, + ArgList argv, Cardinal *argc); +static void Redisplay(Widget w, XEvent *event, Region region); +static void Resize(Widget w); +static void Destroy(Widget w); +static void Refresh(BitmapWidget BW, Position x, Position y, + Dimension width, Dimension height); +static Boolean SetValues(Widget old, Widget request, Widget new, + ArgList args, Cardinal *num_args); BitmapClassRec bitmapClassRec = { { /* core fields */ @@ -315,25 +366,22 @@ WidgetClass bitmapWidgetClass = (WidgetClass) &bitmapClassRec; /* ARGSUSED */ -void BWDebug(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +void +BWDebug(Widget w, XEvent *event, String *params, Cardinal *num_params) { DEBUG ^= True; } -Pixmap BWGetPixmap(w) - Widget w; +Pixmap +BWGetPixmap(Widget w) { BitmapWidget BW = (BitmapWidget) w; return GetPixmap(BW, BW->bitmap.zoom.image); } -Pixmap BWGetUnzoomedPixmap(w) - Widget w; +Pixmap +BWGetUnzoomedPixmap(Widget w) { BitmapWidget BW = (BitmapWidget) w; GC gc; @@ -378,13 +426,9 @@ Pixmap BWGetUnzoomedPixmap(w) return(pix); } -XImage *CreateBitmapImage(); - -XImage *ConvertToBitmapImage(); -XImage *GetImage(BW, pixmap) - BitmapWidget BW; - Pixmap pixmap; +XImage * +GetImage(BitmapWidget BW, Pixmap pixmap) { Window root; int x, y; @@ -402,10 +446,9 @@ XImage *GetImage(BW, pixmap) return image; } -XImage *CreateBitmapImage(BW, data, width, height) - BitmapWidget BW; - char *data; - Dimension width, height; +XImage * +CreateBitmapImage(BitmapWidget BW, char *data, + Dimension width, Dimension height) { XImage *image = XCreateImage(XtDisplay(BW), DefaultVisual(XtDisplay(BW), @@ -429,8 +472,8 @@ XImage *CreateBitmapImage(BW, data, width, height) return image; } -void DestroyBitmapImage(image) - XImage **image; +void +DestroyBitmapImage(XImage **image) { /*XDestroyImage(*image);*/ if (image) { @@ -443,83 +486,75 @@ void DestroyBitmapImage(image) } } -XImage *BWGetImage(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +#if 0 +XImage * +BWGetImage(Widget w, XEvent *event, String *params, Cardinal *num_params) { BitmapWidget BW = (BitmapWidget) w; return BW->bitmap.image; } +#endif -void BWChangeNotify(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +void +BWChangeNotify(Widget w) { BitmapWidget BW = (BitmapWidget) w; if (BW->bitmap.notify) - (*BW->bitmap.notify)(w, event, params, num_params); + (*BW->bitmap.notify)(w, NULL, NULL, NULL); } -void BWNotify(w, proc) /* ARGSUSED */ - Widget w; - void (*proc)(); +void +BWNotify(Widget w, XtActionProc proc) { BitmapWidget BW = (BitmapWidget) w; BW->bitmap.notify = proc; } -void BWSetChanged(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +void +BWSetChanged(Widget w) { BitmapWidget BW = (BitmapWidget) w; BW->bitmap.changed = True; } -Boolean BWQueryChanged(w) - Widget w; +Boolean +BWQueryChanged(Widget w) { BitmapWidget BW = (BitmapWidget) w; return BW->bitmap.changed; } -void BWClearChanged(w) - Widget w; +void +BWClearChanged(Widget w) { BitmapWidget BW = (BitmapWidget) w; BW->bitmap.changed = False; } -Boolean BWQueryStored(w) - Widget w; +Boolean +BWQueryStored(Widget w) { BitmapWidget BW = (BitmapWidget) w; return (BW->bitmap.storage != NULL); } -Boolean BWQueryStippled(w) - Widget w; +Boolean +BWQueryStippled(Widget w) { BitmapWidget BW = (BitmapWidget) w; return BW->bitmap.stippled; } -void RedrawStippled(BW) - BitmapWidget(BW); +static void +RedrawStippled(BitmapWidget BW) { XExposeEvent event; @@ -541,8 +576,8 @@ void RedrawStippled(BW) BW->bitmap.stipple_change_expose_event = False; } -void BWSwitchStippled(w) - Widget w; +void +BWSwitchStippled(Widget w) { BitmapWidget BW = (BitmapWidget) w; @@ -555,27 +590,25 @@ void BWSwitchStippled(w) RedrawStippled(BW); } -void BWSelect(w, from_x, from_y, to_x, to_y, btime) - Widget w; - Position from_x, from_y, - to_x, to_y; - Time btime; +void +BWSelect(Widget w, Position from_x, Position from_y, + Position to_x, Position to_y, Time btime) { BWMark(w, from_x, from_y, to_x, to_y); BWGrabSelection(w, btime); } -Boolean BWQueryAxes(w) - Widget w; +Boolean +BWQueryAxes(Widget w) { BitmapWidget BW = (BitmapWidget) w; return BW->bitmap.axes; } -void BWSwitchAxes(w) - Widget w; +void +BWSwitchAxes(Widget w) { BitmapWidget BW = (BitmapWidget) w; @@ -583,9 +616,8 @@ void BWSwitchAxes(w) BWHighlightAxes(w); } -void BWAxes(w, _switch) - Widget w; - Boolean _switch; +void +BWAxes(Widget w, Boolean _switch) { BitmapWidget BW = (BitmapWidget) w; @@ -593,8 +625,8 @@ void BWAxes(w, _switch) BWSwitchAxes(w); } -void BWRedrawAxes(w) - Widget w; +void +BWRedrawAxes(Widget w) { BitmapWidget BW = (BitmapWidget) w; @@ -602,21 +634,20 @@ void BWRedrawAxes(w) BWHighlightAxes(w); } -void BWPutImage(w, display, drawable, gc, x, y) - BitmapWidget w; - Display *display; - Drawable drawable; - GC gc; - Position x, y; +#if 0 +void +BWPutImage(BitmapWidget w, Display *display, Drawable drawable, GC gc, + Position x, Position y) { BitmapWidget BW = (BitmapWidget) w; XPutImage(display, drawable, gc, BW->bitmap.image, 0, 0, x, y, BW->bitmap.image->width, BW->bitmap.image->height); } +#endif -String StripFilename(filename) - String filename; +static String +StripFilename(String filename) { char *begin = strrchr(filename, '/'); char *end, *result; @@ -635,12 +666,10 @@ String StripFilename(filename) return (NULL); } -int XmuWriteBitmapDataToFile (filename, basename, - width, height, datap, x_hot, y_hot) - String filename, basename; - int width, height; - char *datap; - int x_hot, y_hot; +static int +XmuWriteBitmapDataToFile(String filename, String basename, + int width, int height, char *datap, + int x_hot, int y_hot) { FILE *file; int i, data_length; @@ -687,13 +716,13 @@ int XmuWriteBitmapDataToFile (filename, basename, */ /* ARGSUSED */ -static void CvtStringToButtonFunction(args, num_args, from_val, to_val) - XrmValuePtr args; /* not used */ - Cardinal *num_args; /* not used */ - XrmValuePtr from_val; - XrmValuePtr to_val; +static void +CvtStringToButtonFunction(XrmValuePtr args, /* not used */ + Cardinal *num_args, /* not used */ + XrmValuePtr from_val, + XrmValuePtr to_val) { - static button_function; + static int button_function; char lower_name[80]; XmuCopyISOLatin1Lowered (lower_name, (char*)from_val->addr); @@ -726,9 +755,8 @@ static void CvtStringToButtonFunction(args, num_args, from_val, to_val) } -void Refresh(); - -static void ClassInitialize() +static void +ClassInitialize(void) { char *tm_table = XtMalloc(strlen(translations1) + strlen(translations2) + 1); strcpy(tm_table, translations1); @@ -741,8 +769,8 @@ static void ClassInitialize() DEBUG = False; } -static void SetSizeFromSizeResource(bw) - BitmapWidget bw; +static void +SetSizeFromSizeResource(BitmapWidget bw) { if (BWParseSize(bw->bitmap.size, &bw->bitmap.width, @@ -755,13 +783,10 @@ static void SetSizeFromSizeResource(bw) } } -void TransferImageData(); /* ARGSUSED */ -static void Initialize(wrequest, wnew, argv, argc) - Widget wrequest, wnew; - ArgList argv; - Cardinal *argc; +static void +Initialize(Widget wrequest, Widget wnew, ArgList argv, Cardinal *argc) { BitmapWidget new = (BitmapWidget) wnew; @@ -915,14 +940,13 @@ static void Initialize(wrequest, wnew, argv, argc) new->bitmap.basename = XtNewString(new->bitmap.basename); } - Resize(new); + Resize((Widget)new); } /* returns False if the format is wrong */ -Boolean BWParseSize(size, width, height) - String size; - Dimension *width, *height; +Boolean +BWParseSize(String size, Dimension *width, Dimension *height) { int x, y; unsigned int w, h; @@ -940,16 +964,16 @@ Boolean BWParseSize(size, width, height) } -Boolean BWQueryMarked(w) - Widget w; +Boolean +BWQueryMarked(Widget w) { BitmapWidget BW = (BitmapWidget) w; return QuerySet(BW->bitmap.mark.from_x, BW->bitmap.mark.from_y); } -void FixMark(BW) - BitmapWidget BW; +static void +FixMark(BitmapWidget BW) { if (QuerySet(BW->bitmap.mark.from_x, BW->bitmap.mark.from_y)) { BW->bitmap.mark.from_x = min(BW->bitmap.mark.from_x, @@ -971,9 +995,8 @@ void FixMark(BW) } /* ARGSUSED */ -int BWStoreFile(w, filename, basename) - Widget w; - String filename, *basename; +int +BWStoreFile(Widget w, String filename, String *basename) { BitmapWidget BW = (BitmapWidget) w; int status; @@ -997,12 +1020,12 @@ int BWStoreFile(w, filename, basename) return status; } -String BWUnparseStatus(w) - Widget w; +String +BWUnparseStatus(Widget w) { BitmapWidget BW = (BitmapWidget) w; - sprintf(BW->bitmap.status, + XmuSnprintf(BW->bitmap.status, sizeof(BW->bitmap.status), "Filename: %s Basename: %s Size: %dx%d", (strcmp(BW->bitmap.filename, "") ? BW->bitmap.filename : "<none>"), (strcmp(BW->bitmap.basename, "") ? BW->bitmap.basename : "<none>"), @@ -1011,9 +1034,8 @@ String BWUnparseStatus(w) return BW->bitmap.status; } -void BWChangeFilename(w, str) - Widget w; - String str; +void +BWChangeFilename(Widget w, String str) { BitmapWidget BW = (BitmapWidget) w; @@ -1023,9 +1045,8 @@ void BWChangeFilename(w, str) } } -void BWChangeBasename(w, str) - Widget w; - String str; +void +BWChangeBasename(Widget w, String str) { BitmapWidget BW = (BitmapWidget) w; @@ -1036,9 +1057,8 @@ void BWChangeBasename(w, str) } -int BWReadFile(w, filename, basename) /* ARGSUSED */ - Widget w; - String filename, basename; +int +BWReadFile(Widget w, String filename, String basename) /* ARGSUSED */ { BitmapWidget BW = (BitmapWidget) w; int status; @@ -1083,7 +1103,7 @@ int BWReadFile(w, filename, basename) /* ARGSUSED */ BWUnmark(w); - Resize(BW); + Resize((Widget)BW); if (BW->core.visible) { XClearArea(XtDisplay(BW), XtWindow(BW), @@ -1100,9 +1120,9 @@ int BWReadFile(w, filename, basename) /* ARGSUSED */ return status; } -void BWSetImage(w, image) - Widget w; - XImage *image; +#if 0 +void +BWSetImage(Widget w, XImage *image) { BitmapWidget BW = (BitmapWidget) w; XImage *buffer; @@ -1123,7 +1143,7 @@ void BWSetImage(w, image) BW->bitmap.width = image->width; BW->bitmap.height = image->height; - Resize(BW); + Resize((Widget)BW); if (BW->core.visible) { XClearArea(XtDisplay(BW), XtWindow(BW), @@ -1132,10 +1152,10 @@ void BWSetImage(w, image) True); } } +#endif -int BWWriteFile(w, filename, basename) - Widget w; - String filename, basename; +int +BWWriteFile(Widget w, String filename, String basename) { BitmapWidget BW = (BitmapWidget) w; char *data; @@ -1198,9 +1218,8 @@ int BWWriteFile(w, filename, basename) return status; } -String BWGetFilename(w, str) - Widget w; - String *str; +String +BWGetFilename(Widget w, String *str) { BitmapWidget BW = (BitmapWidget) w; @@ -1209,9 +1228,8 @@ String BWGetFilename(w, str) return *str; } -String BWGetFilepath(w, str) - Widget w; - String *str; +String +BWGetFilepath(Widget w, String *str) { BitmapWidget BW = (BitmapWidget) w; String end; @@ -1228,9 +1246,8 @@ String BWGetFilepath(w, str) } -String BWGetBasename(w, str) - Widget w; - String *str; +String +BWGetBasename(Widget w, String *str) { BitmapWidget BW = (BitmapWidget) w; @@ -1239,15 +1256,15 @@ String BWGetBasename(w, str) return *str; } -void FixHotSpot(BW) - BitmapWidget BW; +static void +FixHotSpot(BitmapWidget BW) { if (!QueryInBitmap(BW, BW->bitmap.hot.x, BW->bitmap.hot.y)) BW->bitmap.hot.x = BW->bitmap.hot.y = NotSet; } -void ZoomOut(BW) - BitmapWidget BW; +static void +ZoomOut(BitmapWidget BW) { CopyImageData(BW->bitmap.image, BW->bitmap.zoom.image, 0, 0, @@ -1280,15 +1297,15 @@ void ZoomOut(BW) BW->bitmap.zooming = False; } -void BWZoomOut(w) - Widget w; +void +BWZoomOut(Widget w) { BitmapWidget BW = (BitmapWidget) w; if (BW->bitmap.zooming) { ZoomOut(BW); - Resize(BW); + Resize((Widget)BW); if (BW->core.visible) XClearArea(XtDisplay(BW), XtWindow(BW), 0, 0, @@ -1297,10 +1314,9 @@ void BWZoomOut(w) } } -void BWZoomIn(); -void BWZoomMarked(w) - Widget w; +void +BWZoomMarked(Widget w) { BitmapWidget BW = (BitmapWidget) w; @@ -1309,10 +1325,10 @@ void BWZoomMarked(w) BW->bitmap.mark.to_x, BW->bitmap.mark.to_y); } -void BWZoomIn(w, from_x, from_y, to_x, to_y) - Widget w; - Position from_x, from_y, - to_x, to_y; +void +BWZoomIn(Widget w, + Position from_x, Position from_y, + Position to_x, Position to_y) { BitmapWidget BW = (BitmapWidget) w; XImage *image, *buffer; @@ -1366,7 +1382,7 @@ void BWZoomIn(w, from_x, from_y, to_x, to_y) FixHotSpot(BW); - Resize(BW); + Resize((Widget)BW); if (BW->core.visible) XClearArea(XtDisplay(BW), XtWindow(BW), 0, 0, @@ -1374,11 +1390,9 @@ void BWZoomIn(w, from_x, from_y, to_x, to_y) True); } -XImage *ScaleBitmapImage(); -void BWRescale(w, width, height) - Widget w; - Dimension width, height; +void +BWRescale(Widget w, Dimension width, Dimension height) { BitmapWidget BW = (BitmapWidget) w; XImage *image, *buffer; @@ -1409,7 +1423,7 @@ void BWRescale(w, width, height) FixHotSpot(BW); FixMark(BW); - Resize(BW); + Resize((Widget)BW); if (BW->core.visible) XClearArea(XtDisplay(BW), XtWindow(BW), 0, 0, @@ -1417,8 +1431,8 @@ void BWRescale(w, width, height) True); } -Boolean BWQueryZooming(w) - Widget w; +Boolean +BWQueryZooming(Widget w) { BitmapWidget BW = (BitmapWidget) w; @@ -1426,9 +1440,8 @@ Boolean BWQueryZooming(w) } -static void ResizeGrid(BW, width, height) - BitmapWidget BW; - Dimension width, height; +static void +ResizeGrid(BitmapWidget BW, Dimension width, Dimension height) { XImage *image, *buffer; char *image_data, *buffer_data; @@ -1457,15 +1470,14 @@ static void ResizeGrid(BW, width, height) FixMark(BW); } -void BWResize(w, width, height) - Widget w; - Dimension width, height; +void +BWResize(Widget w, Dimension width, Dimension height) { BitmapWidget BW = (BitmapWidget) w; ResizeGrid(BW, width, height); - Resize(BW); + Resize((Widget)BW); if (BW->core.visible) XClearArea(XtDisplay(BW), XtWindow(BW), 0, 0, @@ -1473,8 +1485,8 @@ void BWResize(w, width, height) True); } -static void Destroy(w) - Widget w; +static void +Destroy(Widget w) { BitmapWidget BW = (BitmapWidget) w; @@ -1489,8 +1501,8 @@ static void Destroy(w) } -static void Resize(w) - Widget w; +static void +Resize(Widget w) { BitmapWidget BW = (BitmapWidget) w; @@ -1522,10 +1534,8 @@ static void Resize(w) } /* ARGSUSED */ -static void Redisplay(w, event, region) - Widget w; - XEvent *event; - Region region; +static void +Redisplay(Widget w, XEvent *event, Region region) { BitmapWidget BW = (BitmapWidget) w; @@ -1538,10 +1548,8 @@ static void Redisplay(w, event, region) event->xexpose.width, event->xexpose.height); } -void BWClip(w, x, y, width, height) - Widget w; - Position x, y; - Dimension width, height; +void +BWClip(Widget w, Position x, Position y, Dimension width, Dimension height) { Position from_x, from_y, to_x, to_y; @@ -1585,8 +1593,8 @@ void BWClip(w, x, y, width, height) Unsorted); } -void BWUnclip(w) - Widget w; +void +BWUnclip(Widget w) { BitmapWidget BW = (BitmapWidget) w; XRectangle rectangle; @@ -1617,10 +1625,9 @@ void BWUnclip(w) Unsorted); } -void Refresh(BW, x, y, width, height) - BitmapWidget BW; - Position x, y; - Dimension width, height; +static void +Refresh(BitmapWidget BW, Position x, Position y, + Dimension width, Dimension height) { XRectangle rectangle; @@ -1660,16 +1667,16 @@ void Refresh(BW, x, y, width, height) BWUnclip((Widget) BW); } -Boolean BWQueryGrid(w) - Widget w; +Boolean +BWQueryGrid(Widget w) { BitmapWidget BW = (BitmapWidget) w; return BW->bitmap.grid; } -void BWSwitchGrid(w) - Widget w; +void +BWSwitchGrid(Widget w) { BitmapWidget BW = (BitmapWidget) w; BW->bitmap.grid ^= TRUE; @@ -1678,9 +1685,8 @@ void BWSwitchGrid(w) BW->bitmap.image->width - 1, BW->bitmap.image->height - 1); } -void BWGrid(w, _switch) - Widget w; - Boolean _switch; +void +BWGrid(Widget w, Boolean _switch) { BitmapWidget BW = (BitmapWidget) w; @@ -1688,16 +1694,16 @@ void BWGrid(w, _switch) BWSwitchGrid(w); } -Boolean BWQueryDashed(w) - Widget w; +Boolean +BWQueryDashed(Widget w) { BitmapWidget BW = (BitmapWidget) w; return (BW->bitmap.dashed); } -void BWSwitchDashed(w) - Widget w; +void +BWSwitchDashed(Widget w) { BitmapWidget BW = (BitmapWidget) w; XRectangle rectangle; @@ -1736,9 +1742,8 @@ void BWSwitchDashed(w) BWRedrawGrid(w, 0, 0, BW->bitmap.width - 1, BW->bitmap.height - 1); } -void BWDashed(w, _switch) - Widget w; - Boolean _switch; +void +BWDashed(Widget w, Boolean _switch) { BitmapWidget BW = (BitmapWidget) w; @@ -1746,10 +1751,9 @@ void BWDashed(w, _switch) BWSwitchDashed(w); } -static Boolean SetValues(old, request, new, args, num_args) /* ARGSUSED */ - Widget old, request, new; - ArgList args; - Cardinal *num_args; +static Boolean +SetValues(Widget old, Widget request, Widget new, + ArgList args, Cardinal *num_args) /* ARGSUSED */ { BitmapWidget oldbw = (BitmapWidget) old; BitmapWidget newbw = (BitmapWidget) new; @@ -1774,23 +1778,25 @@ static Boolean SetValues(old, request, new, args, num_args) /* ARGSUSED */ resize = True; if (NE(bitmap.filename) || NE(bitmap.basename) || NE(bitmap.size)) - BWChangeNotify(old, NULL, NULL, NULL); + BWChangeNotify(old); - if (NE(bitmap.filename)) + if (NE(bitmap.filename)) { if (newbw->bitmap.filename) { XtFree(oldbw->bitmap.filename); newbw->bitmap.filename = XtNewString(newbw->bitmap.filename); } else newbw->bitmap.filename = oldbw->bitmap.filename; + } - if (NE(bitmap.basename)) + if (NE(bitmap.basename)) { if (newbw->bitmap.basename) { XtFree(oldbw->bitmap.basename); newbw->bitmap.basename = XtNewString(newbw->bitmap.basename); } else newbw->bitmap.basename = oldbw->bitmap.basename; + } if (NE(bitmap.size)) { Dimension width, height; @@ -1855,29 +1861,29 @@ static Boolean SetValues(old, request, new, args, num_args) /* ARGSUSED */ RedrawStippled(newbw); } - if (resize) Resize(newbw); + if (resize) Resize((Widget)newbw); return (redisplay || resize); #undef NE } -Boolean BWQueryProportional(w) - Widget w; +Boolean +BWQueryProportional(Widget w) { BitmapWidget BW = (BitmapWidget) w; return (BW->bitmap.proportional); } -void BWSwitchProportional(w) - Widget w; +void +BWSwitchProportional(Widget w) { BitmapWidget BW = (BitmapWidget) w; BW->bitmap.proportional ^= True; - Resize(BW); + Resize((Widget)BW); if (BW->core.visible) XClearArea(XtDisplay(BW), XtWindow(BW), 0, 0, @@ -1885,22 +1891,19 @@ void BWSwitchProportional(w) True); } -void BWProportional(w, _switch) - Widget w; - Boolean _switch; +#if 0 +void +BWProportional(Widget w, Boolean _switch) { BitmapWidget BW = (BitmapWidget) w; if (BW->bitmap.proportional != _switch) BWSwitchProportional(w); } +#endif - -void BWTPaste(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +void +BWTPaste(Widget w, XEvent *event, String *params, Cardinal *num_params) { BitmapWidget BW = (BitmapWidget) w; @@ -1914,14 +1917,11 @@ void BWTPaste(w, event, params, num_params) OnePointHandler(w, (BWStatus*) BW->bitmap.request_stack[BW->bitmap.current].status, - event); + event, NULL); } -void BWTMark(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +void +BWTMark(Widget w, XEvent *event, String *params, Cardinal *num_params) { BitmapWidget BW = (BitmapWidget) w; @@ -1929,26 +1929,20 @@ void BWTMark(w, event, params, num_params) (char *)&(event->xbutton.state), sizeof(int)); TwoPointsHandler(w, (BWStatus*) BW->bitmap.request_stack[BW->bitmap.current].status, - event); + event, NULL); } -void BWTMarkAll(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +void +BWTMarkAll(Widget w, XEvent *event, String *params, Cardinal *num_params) { BWMarkAll(w); BWGrabSelection(w, event->xkey.time); } -void BWTUnmark(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +void +BWTUnmark(Widget w, XEvent *event, String *params, Cardinal *num_params) { BWUnmark(w); } |