diff options
author | Kaleb Keithley <kaleb@freedesktop.org> | 2003-11-14 16:48:57 +0000 |
---|---|---|
committer | Kaleb Keithley <kaleb@freedesktop.org> | 2003-11-14 16:48:57 +0000 |
commit | 5b64274abaf585d108e65cb1dae497e74cad856e (patch) | |
tree | 602d4a70b9731fe873a020e8adcdd0b7923a805c | |
parent | 0bd1f9d8ccaf46397745779f5964f3b843186896 (diff) |
XFree86 4.3.0.1xf86-4_3_0_1PRE_xf86-4_3_0_1
-rw-r--r-- | BitEdit.c | 181 | ||||
-rw-r--r-- | Bitmap.c | 574 | ||||
-rw-r--r-- | Bitmap.h | 178 | ||||
-rw-r--r-- | BitmapP.h | 39 | ||||
-rw-r--r-- | CutPaste.c | 52 | ||||
-rw-r--r-- | Dialog.c | 38 | ||||
-rw-r--r-- | Dialog.h | 7 | ||||
-rw-r--r-- | Graphics.c | 317 | ||||
-rw-r--r-- | Handlers.c | 237 | ||||
-rw-r--r-- | ReqMach.c | 68 | ||||
-rw-r--r-- | Requests.h | 141 | ||||
-rw-r--r-- | atobm.c | 37 | ||||
-rw-r--r-- | bitmap.man | 8 | ||||
-rw-r--r-- | bmtoa.c | 40 |
14 files changed, 925 insertions, 992 deletions
@@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/bitmap/BitEdit.c,v 1.6 2001/12/26 21:39:34 paulo Exp $ */ /* * Author: Davor Matic, MIT X Consortium @@ -35,6 +36,7 @@ from The Open Group. #include <stdio.h> +#include <stdlib.h> #include <X11/Intrinsic.h> #include <X11/StringDefs.h> #include <X11/Xaw/Paned.h> @@ -46,6 +48,7 @@ from The Open Group. #include <X11/Xaw/SimpleMenu.h> #include <X11/Xaw/SmeLine.h> #include <X11/Xaw/SmeBSB.h> +#include <X11/Xmu/SysUtil.h> #include "Bitmap.h" #include <X11/bitmaps/xlogo16> @@ -230,55 +233,56 @@ static String filename = NULL, base_name = NULL, format; static char message[80]; -void FixMenu(); -void SwitchImage(); -void SwitchGrid(); -void SwitchDashed(); -void SwitchAxes(); -void SwitchStippled(); -void SwitchProportional(); -void SwitchZoom(); -void DoCut(); -void DoCopy(); -void DoPaste(); -void DoNew(); -void DoLoad(); -void DoInsert(); -void DoSave(); -void DoSaveAs(); -void DoResize(); -void DoRescale(); -void DoFilename(); -void DoBasename(); -void DoQuit(); +void FixMenu ( Widget w, XEvent *event, String *params, Cardinal *num_params ); +void SwitchImage ( void ); +void SwitchGrid( void ); +void SwitchDashed( void ); +void SwitchAxes( void ); +void SwitchStippled( void ); +void SwitchProportional( void ); +void SwitchZoom( void ); +void DoCut( void ); +void DoCopy( void ); +void DoPaste( void ); +void DoNew( void ); +void DoLoad( void ); +void DoInsert( void ); +void DoSave( void ); +void DoSaveAs( void ); +void DoResize( void ); +void DoRescale( void ); +void DoFilename( void ); +void DoBasename( void ); +void DoQuit ( Widget w, XEvent *event, String *params, Cardinal *num_params ); static XtActionsRec actions_table[] = { {"fix-menu", FixMenu}, - {"switch-image", SwitchImage}, - {"switch-grid", SwitchGrid}, - {"switch-dashed", SwitchDashed}, - {"switch-axes", SwitchAxes}, - {"switch-stippled", SwitchStippled}, - {"switch-proportional", SwitchProportional}, - {"switch-zoom", SwitchZoom}, - {"do-cut", DoCut}, - {"do-copy", DoCopy}, - {"do-paste", DoPaste}, - {"do-new", DoNew}, - {"do-load", DoLoad}, - {"do-insert", DoInsert}, - {"do-save", DoSave}, - {"do-save-as", DoSaveAs}, - {"do-resize", DoResize}, - {"do-rescale", DoRescale}, - {"do-filename", DoFilename}, - {"do-basename", DoBasename}, + {"switch-image", (XtActionProc)SwitchImage}, + {"switch-grid", (XtActionProc)SwitchGrid}, + {"switch-dashed", (XtActionProc)SwitchDashed}, + {"switch-axes", (XtActionProc)SwitchAxes}, + {"switch-stippled", (XtActionProc)SwitchStippled}, + {"switch-proportional", (XtActionProc)SwitchProportional}, + {"switch-zoom", (XtActionProc)SwitchZoom}, + {"do-cut", (XtActionProc)DoCut}, + {"do-copy", (XtActionProc)DoCopy}, + {"do-paste", (XtActionProc)DoPaste}, + {"do-new", (XtActionProc)DoNew}, + {"do-load", (XtActionProc)DoLoad}, + {"do-insert", (XtActionProc)DoInsert}, + {"do-save", (XtActionProc)DoSave}, + {"do-save-as", (XtActionProc)DoSaveAs}, + {"do-resize", (XtActionProc)DoResize}, + {"do-rescale", (XtActionProc)DoRescale}, + {"do-filename", (XtActionProc)DoFilename}, + {"do-basename", (XtActionProc)DoBasename}, {"do-quit", DoQuit} }; static Atom wm_delete_window; -void FixImage() +static void +FixImage(void) { Pixmap old_image, image; int n; @@ -302,7 +306,8 @@ void FixImage() XFreePixmap(XtDisplay(bitmap_widget), old_image); } -FixStatus() +static void +FixStatus(void) { int n; Arg wargs[2]; @@ -323,15 +328,15 @@ FixStatus() /*XtFree(str); */ } -void FixUp() +static void +FixUp(void) { FixImage(); FixStatus(); } -void FixEntry(w, id) - Widget w; - int *id; +static void +FixEntry(Widget w, int *id) { int n; Arg wargs[2]; @@ -394,11 +399,10 @@ void FixEntry(w, id) } /* ARGSUSED */ -void FixMenu(w, event, params, num_params) - Widget w; - XEvent *event; - String *params; - Cardinal *num_params; +void FixMenu(Widget w, + XEvent *event, + String *params, + Cardinal *num_params) { int i; @@ -411,9 +415,10 @@ void FixMenu(w, event, params, num_params) static int zero = 0; #define Plain (char *)&zero,sizeof(int) /* ARGSUSED */ -void TheCallback(w, clientData, callData) - Widget w; /* not used */ - XtPointer clientData, callData; +static void +TheCallback(Widget w, /* not used */ + XtPointer clientData, + XtPointer callData) { int *id = (int *)clientData; switch (*id) { @@ -497,21 +502,21 @@ void TheCallback(w, clientData, callData) case Clear: BWStoreToBuffer(bitmap_widget); BWClear(bitmap_widget); - BWChangeNotify(bitmap_widget, NULL, NULL); + BWChangeNotify(bitmap_widget); BWSetChanged(bitmap_widget); break; case Set: BWStoreToBuffer(bitmap_widget); BWSet(bitmap_widget); - BWChangeNotify(bitmap_widget, NULL, NULL); + BWChangeNotify(bitmap_widget); BWSetChanged(bitmap_widget); break; case Invert: BWStoreToBuffer(bitmap_widget); BWInvert(bitmap_widget); - BWChangeNotify(bitmap_widget, NULL, NULL); + BWChangeNotify(bitmap_widget); BWSetChanged(bitmap_widget); break; @@ -551,63 +556,63 @@ break; case Up: BWStoreToBuffer(bitmap_widget); BWUp(bitmap_widget); - BWChangeNotify(bitmap_widget, NULL, NULL); + BWChangeNotify(bitmap_widget); BWSetChanged(bitmap_widget); break; case Down: BWStoreToBuffer(bitmap_widget); BWDown(bitmap_widget); - BWChangeNotify(bitmap_widget, NULL, NULL); + BWChangeNotify(bitmap_widget); BWSetChanged(bitmap_widget); break; case Left: BWStoreToBuffer(bitmap_widget); BWLeft(bitmap_widget); - BWChangeNotify(bitmap_widget, NULL, NULL); + BWChangeNotify(bitmap_widget); BWSetChanged(bitmap_widget); break; case Right: BWStoreToBuffer(bitmap_widget); BWRight(bitmap_widget); - BWChangeNotify(bitmap_widget, NULL, NULL); + BWChangeNotify(bitmap_widget); BWSetChanged(bitmap_widget); break; case Fold: BWStoreToBuffer(bitmap_widget); BWFold(bitmap_widget); - BWChangeNotify(bitmap_widget, NULL, NULL); + BWChangeNotify(bitmap_widget); BWSetChanged(bitmap_widget); break; case FlipHoriz: BWStoreToBuffer(bitmap_widget); BWFlipHoriz(bitmap_widget); - BWChangeNotify(bitmap_widget, NULL, NULL); + BWChangeNotify(bitmap_widget); BWSetChanged(bitmap_widget); break; case FlipVert: BWStoreToBuffer(bitmap_widget); BWFlipVert(bitmap_widget); - BWChangeNotify(bitmap_widget, NULL, NULL); + BWChangeNotify(bitmap_widget); BWSetChanged(bitmap_widget); break; case RotateRight: BWStoreToBuffer(bitmap_widget); BWRotateRight(bitmap_widget); - BWChangeNotify(bitmap_widget, NULL, NULL); + BWChangeNotify(bitmap_widget); BWSetChanged(bitmap_widget); break; case RotateLeft: BWStoreToBuffer(bitmap_widget); BWRotateLeft(bitmap_widget); - BWChangeNotify(bitmap_widget, NULL, NULL); + BWChangeNotify(bitmap_widget); BWSetChanged(bitmap_widget); break; @@ -659,13 +664,13 @@ break; case ClearHotSpot: BWStoreToBuffer(bitmap_widget); BWClearHotSpot(bitmap_widget); - BWChangeNotify(bitmap_widget, NULL, NULL); + BWChangeNotify(bitmap_widget); BWSetChanged(bitmap_widget); break; case Undo: BWUndo(bitmap_widget); - BWChangeNotify(bitmap_widget, NULL, NULL); + BWChangeNotify(bitmap_widget); BWSetChanged(bitmap_widget); break; @@ -733,13 +738,13 @@ void SwitchZoom() { if (BWQueryZooming(bitmap_widget)) { BWZoomOut(bitmap_widget); - BWChangeNotify(bitmap_widget, NULL, NULL); + BWChangeNotify(bitmap_widget); } else { if (BWQueryMarked(bitmap_widget)) { BWStoreToBuffer(bitmap_widget); BWZoomMarked(bitmap_widget); - BWChangeNotify(bitmap_widget, NULL, NULL); + BWChangeNotify(bitmap_widget); } else { BWEngageRequest(bitmap_widget, ZoomInRequest, False, Plain); @@ -753,7 +758,7 @@ void DoCut() BWStoreToBuffer(bitmap_widget); BWClearMarked(bitmap_widget); BWUnmark(bitmap_widget); - BWChangeNotify(bitmap_widget, NULL, NULL); + BWChangeNotify(bitmap_widget); BWSetChanged(bitmap_widget); } @@ -779,7 +784,7 @@ void DoNew() BWStoreToBuffer(bitmap_widget); BWClear(bitmap_widget); BWClearHotSpot(bitmap_widget); - BWChangeNotify(bitmap_widget, NULL, NULL); + BWChangeNotify(bitmap_widget); BWClearChanged(bitmap_widget); BWUnmark(bitmap_widget); FixStatus(); @@ -796,7 +801,7 @@ void DoLoad() case Yes: if (BWWriteFile(bitmap_widget, filename, NULL) != BitmapSuccess) { - sprintf(message, "Can't write file: %s", filename); + XmuSnprintf(message, sizeof(message), "Can't write file: %s", filename); if (PopupDialog(error_dialog, message, NULL, NULL, XtGrabExclusive) == Retry) goto RetryLoadSave; @@ -812,13 +817,13 @@ void DoLoad() if (PopupDialog(input_dialog, "Load file:", filename, &filename, XtGrabExclusive) == Okay) { if (BWReadFile(bitmap_widget, filename, NULL) != BitmapSuccess) { - sprintf(message, "Can't read file: %s", filename); + XmuSnprintf(message, sizeof(message), "Can't read file: %s", filename); if (PopupDialog(error_dialog, message, NULL, NULL, XtGrabExclusive) == Retry) goto RetryLoad; } else { - BWChangeNotify(bitmap_widget, NULL, NULL); + BWChangeNotify(bitmap_widget); BWClearChanged(bitmap_widget); FixStatus(); } @@ -832,7 +837,7 @@ void DoInsert() if (PopupDialog(input_dialog, "Insert file:", filename, &filename, XtGrabExclusive) == Okay) { if (BWStoreFile(bitmap_widget, filename, NULL) != BitmapSuccess) { - sprintf(message, "Can't read file: %s", filename); + XmuSnprintf(message, sizeof(message), "Can't read file: %s", filename); if (PopupDialog(error_dialog, message, NULL, NULL, XtGrabExclusive) == Retry) goto RetryInsert; @@ -849,7 +854,7 @@ void DoSave() if (!strcmp(filename, "")) DoSaveAs(); else if (BWWriteFile(bitmap_widget, NULL, NULL) != BitmapSuccess) { - sprintf(message, "Can't write file: %s", filename); + XmuSnprintf(message, sizeof(message), "Can't write file: %s", filename); if (PopupDialog(error_dialog, message, NULL, NULL, XtGrabExclusive) == Retry) DoSaveAs(); @@ -866,7 +871,7 @@ void DoSaveAs() if (PopupDialog(input_dialog, "Save file:", filename, &filename, XtGrabExclusive) == Okay) { if (BWWriteFile(bitmap_widget, filename, NULL) != BitmapSuccess) { - sprintf(message, "Can't write file: %s", filename); + XmuSnprintf(message, sizeof(message), "Can't write file: %s", filename); if (PopupDialog(error_dialog, message, NULL, NULL, XtGrabExclusive) == Retry) goto RetrySave; @@ -887,12 +892,12 @@ void DoResize() format, &format, XtGrabExclusive) == Okay) { if (BWParseSize(format, &width, &height)) { BWResize(bitmap_widget, width, height); - BWChangeNotify(bitmap_widget, NULL, NULL); + BWChangeNotify(bitmap_widget); BWSetChanged(bitmap_widget); FixStatus(); } else { - sprintf(message, "Wrong format: %s", format); + XmuSnprintf(message, sizeof(message), "Wrong format: %s", format); if (PopupDialog(error_dialog, message, NULL, NULL, XtGrabExclusive) == Retry) goto RetryResize; @@ -910,12 +915,12 @@ void DoRescale() format, &format, XtGrabExclusive) == Okay) { if (BWParseSize(format, &width, &height)) { BWRescale(bitmap_widget, width, height); - BWChangeNotify(bitmap_widget, NULL, NULL); + BWChangeNotify(bitmap_widget); BWSetChanged(bitmap_widget); FixStatus(); } else { - sprintf(message, "Wrong format: %s", format); + XmuSnprintf(message, sizeof(message), "Wrong format: %s", format); if (PopupDialog(error_dialog, message, NULL, NULL, XtGrabExclusive) == Retry) goto RetryRescale; @@ -957,7 +962,7 @@ void DoQuit(w, event, params, num_params) /* ARGSUSED */ case Yes: if (BWWriteFile(bitmap_widget, filename, NULL) != BitmapSuccess) { - sprintf(message, "Can't write file: %s", filename); + XmuSnprintf(message, sizeof(message), "Can't write file: %s", filename); if (PopupDialog(error_dialog, message, NULL, NULL, XtGrabExclusive) == Retry) goto RetryQuit; @@ -972,14 +977,13 @@ void DoQuit(w, event, params, num_params) /* ARGSUSED */ exit(0); } -void main(argc, argv) - int argc; - char *argv[]; +int main(int argc, char *argv[]) { int i, n; Arg wargs[2]; Widget w; - Widget radio_group; XtPointer radio_data; + Widget radio_group = NULL; + XtPointer radio_data = NULL; top_widget = XtInitialize(NULL, "Bitmap", options, XtNumber(options), &argc, argv); @@ -1107,7 +1111,7 @@ void main(argc, argv) XtRealizeWidget(image_shell); - BWNotify(bitmap_widget, FixUp); + BWNotify(bitmap_widget, (XtActionProc)FixUp); FixStatus(); @@ -1119,4 +1123,5 @@ void main(argc, argv) BWEngageRequest(bitmap_widget, PointRequest, True, Plain); XtMainLoop(); + exit(0); } @@ -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); } @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/bitmap/Bitmap.h,v 1.5 2001/12/14 20:00:40 dawes Exp $ */ /* * Author: Davor Matic, MIT X Consortium @@ -71,7 +72,7 @@ from The Open Group. dashed Dashed Boolean True dashes Dashes Bitmap XtUnspecifiedPixmap stippled Stippled Boolean True - stipple Sripple Bitmap XtUnspecifiedPixmap + stipple Stipple Bitmap XtUnspecifiedPixmap proportional Proportional Boolean True axes Axes Boolean True button1Function Button1Function ButtonFunction Set @@ -177,89 +178,6 @@ from The Open Group. /* bitmap exports */ -extern Boolean BWEngageRequest(); -extern Boolean BWTreminateRequest(); - -extern void BWClearAll(); -extern void BWSetAll(); -extern void BWInvertAll(); -extern void BWUp(); -extern void BWDown(); -extern void BWLeft(); -extern void BWRight(); -extern void BWRotateRight(); -extern void BWRotateLeft(); -extern void BWSwitchGrid(); -extern void BWGrid(); -extern void BWSwitchDashed(); -extern void BWDashed(); -extern void BWSwitchAxes(); -extern void BWAxes(); -extern void BWDrawSquare(); -extern void BWDrawLine(); -extern void BWDrawRectangle(); -extern void BWDrawFilledRectangle(); -extern void BWDrawCircle(); -extern void BWDrawFilledCircle(); -extern void BWFloodFill(); -extern void BWMark(); -extern void BWMarkAll(); -extern void BWUnmark(); -extern void BWSelect(); -extern void BWUnmark(); -extern void BWStore(); -extern void BWStoreToBuffer(); -extern void BWUndo(); -extern void BWResize(); -extern void BWClip(); -extern void BWUnclip(); -extern void BWGrabSelection(); -extern void BWRequestSelection(); -extern void BWSetChanged(); -extern Boolean BWQueryChanged(); -extern int BWReadFile(); -extern int BWWriteFile(); -extern String BWUnparseStatus(); -extern String BWGetFilename(); -extern String BWGetBasename(); -extern void BWChangeBasename(); -extern void BWRemoveAllRequests(); -extern void BWClearHotSpot(); -extern Boolean BWQueryMarked(); -extern void BWFold(); -extern void BWClear(); -extern void BWSet(); -extern void BWInvert(); -extern void BWFlipHoriz(); -extern void BWFlipVert(); -extern void BWClearMarked(); -extern Boolean BWAddRequest(); -extern void BWChangeNotify(); -extern Pixmap BWGetUnzoomedPixmap(); -extern void BWClearChanged(); -extern Boolean BWQueryStored(); -extern Boolean BWQueryStippled(); -extern void BWSwitchStippled(); -extern void BWRedrawMark(); -extern Boolean BWQueryAxes(); -extern void BWHighlightAxes(); -extern void BWChangedFilename(); -extern String BWGetFilepath(); -extern void BWZoomOut(); -extern void BWZoomMarked(); -extern void BWRescale(); -extern Boolean BWQueryZooming(); -extern void BWRedrawGrid(); -extern void BWRedrawSquares(); -extern void BWRedrawHotSpot(); -extern Boolean BWQueryGrid(); -extern Boolean BWQueryDashed(); -extern Boolean BWQueryProportional(); -extern void BWSwitchProportional(); -extern void BWDrawGrid(); -extern void BWChangeFilename(); -extern Boolean BWParseSize(); - typedef struct _BWRequestRec BWRequestRec; typedef char *BWRequest; @@ -271,6 +189,98 @@ typedef struct _BitmapRec *BitmapWidget; extern WidgetClass bitmapWidgetClass; +extern Boolean BWEngageRequest(Widget w, BWRequest name, Boolean trap, + XtPointer call_data, Cardinal call_data_size); +extern Boolean BWTerminateRequest(Widget w, Boolean cont); + +extern void BWUp ( Widget w ); +extern void BWDown ( Widget w ); +extern void BWLeft ( Widget w ); +extern void BWRight ( Widget w ); +extern void BWRotateRight ( Widget w ); +extern void BWRotateLeft ( Widget w ); +extern void BWSwitchGrid ( Widget w ); +extern void BWGrid ( Widget w, Boolean _switch ); +extern void BWSwitchDashed ( Widget w ); +extern void BWDashed ( Widget w, Boolean _switch ); +extern void BWSwitchAxes ( Widget w ); +extern void BWAxes ( Widget w, Boolean _switch ); +extern void BWRedrawAxes( Widget w ); +extern void BWDrawLine ( Widget w, Position from_x, Position from_y, Position to_x, Position to_y, int value ); +extern void BWDrawRectangle ( Widget w, Position from_x, Position from_y, Position to_x, Position to_y, int value ); +extern void BWDrawFilledRectangle ( Widget w, Position from_x, Position from_y, Position to_x, Position to_y, int value ); +extern void BWDrawCircle ( Widget w, Position origin_x, Position origin_y, Position point_x, Position point_y, int value ); +extern void BWDrawFilledCircle ( Widget w, Position origin_x, Position origin_y, Position point_x, Position point_y, int value ); +extern void BWFloodFill ( Widget w, Position x, Position y, int value ); +extern void BWMark ( Widget w, Position from_x, Position from_y, Position to_x, Position to_y ); +extern void BWMarkAll ( Widget w ); +extern void BWUnmark ( Widget w ); +extern void BWSelect ( Widget w, Position from_x, Position from_y, Position to_x, Position to_y, Time btime ); +extern void BWStore ( Widget w ); +extern void BWStoreToBuffer ( Widget w ); +extern void BWUndo ( Widget w ); +extern void BWResize ( Widget w, Dimension width, Dimension height ); +extern void BWClip ( Widget w, Position x, Position y, Dimension width, Dimension height ); +extern void BWUnclip ( Widget w ); +extern void BWGrabSelection ( Widget w, Time btime ); +extern void BWRequestSelection ( Widget w, Time btime, Boolean wait ); +extern void BWSetChanged ( Widget w ); +extern Boolean BWQueryChanged ( Widget w ); +extern int BWReadFile ( Widget w, String filename, String basename ); +extern int BWWriteFile ( Widget w, String filename, String basename ); +extern String BWUnparseStatus ( Widget w ); +extern String BWGetFilename ( Widget w, String *str ); +extern String BWGetBasename ( Widget w, String *str ); +extern void BWChangeBasename ( Widget w, String str ); +extern void BWRemoveAllRequests ( Widget w ); +extern void BWClearHotSpot ( Widget w ); +extern Boolean BWQueryMarked ( Widget w ); +extern void BWFold ( Widget w ); +extern void BWClear ( Widget w ); +extern void BWSet ( Widget w ); +extern void BWInvert ( Widget w ); +extern void BWFlipHoriz ( Widget w ); +extern void BWFlipVert ( Widget w ); +extern void BWClearMarked ( Widget w ); +extern Boolean BWAddRequest ( Widget w, BWRequest name, Boolean trap, XtPointer call_data, Cardinal call_data_size ); +extern void BWChangeNotify ( Widget w ); +extern Pixmap BWGetUnzoomedPixmap ( Widget w ); +extern void BWClearChanged ( Widget w ); +extern Boolean BWQueryStored ( Widget w ); +extern Boolean BWQueryStippled ( Widget w ); +extern void BWSwitchStippled ( Widget w ); +extern void BWRedrawMark ( Widget w ); +extern Boolean BWQueryAxes ( Widget w ); +extern void BWHighlightAxes ( Widget w ); +extern String BWGetFilepath ( Widget w, String *str ); +extern void BWZoomOut ( Widget w ); +extern void BWZoomMarked ( Widget w ); +extern void BWRescale ( Widget w, Dimension width, Dimension height ); +extern Boolean BWQueryZooming ( Widget w ); +extern void BWRedrawGrid ( Widget w, Position x, Position y, Dimension width, Dimension height ); +extern void BWRedrawSquares ( Widget w, Position x, Position y, Dimension width, Dimension height ); +extern void BWRedrawHotSpot ( Widget w ); +extern void BWSetHotSpot(Widget w, Position x, Position y); +extern Boolean BWQueryGrid ( Widget w ); +extern Boolean BWQueryDashed ( Widget w ); +extern Boolean BWQueryProportional ( Widget w ); +extern void BWSwitchProportional ( Widget w ); +extern void BWDrawGrid ( Widget w, Position from_x, Position from_y, Position to_x, Position to_y ); +extern void BWChangeFilename ( Widget w, String str ); +extern Boolean BWParseSize ( String size, Dimension *width, Dimension *height ); +extern Boolean BWQuerySelection ( Widget w, Time btime ); +extern int BWStoreFile ( Widget w, String filename, String *basename ); +extern void BWNotify ( Widget w, XtActionProc proc ); +extern void BWTMark ( Widget w, XEvent *event, String *params, Cardinal *num_params ); +extern void BWTMarkAll ( Widget w, XEvent *event, String *params, Cardinal *num_params ); +extern void BWTUnmark ( Widget w, XEvent *event, String *params, Cardinal *num_params ); +extern void BWTPaste ( Widget w, XEvent *event, String *params, Cardinal *num_params ); +extern void BWDebug ( Widget w, XEvent *event, String *params, Cardinal *num_params ); +extern void BWAbort ( Widget w ); +extern Boolean BWRemoveRequest ( Widget w ); +extern void BWRedraw ( Widget w ); +extern Pixmap BWGetPixmap( Widget w ); + #endif /* _Bitmap_h */ @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/bitmap/BitmapP.h,v 1.4 2001/12/14 20:00:40 dawes Exp $ */ /* * Author: Davor Matic, MIT X Consortium @@ -36,7 +37,10 @@ from The Open Group. #ifndef _BitmapP_h #define _BitmapP_h +#define bit int + #include "Bitmap.h" +#include "Requests.h" #include <X11/Xaw/SimpleP.h> typedef struct { @@ -57,16 +61,20 @@ typedef struct _BitmapClassRec { extern BitmapClassRec bitmapClassRec; +typedef void (*EngageProc)(Widget, BWStatus *, XtPointer, int *); +typedef void (*TerminateProc)( Widget, BWStatus *, XtPointer); +typedef void (*RemoveProc)(Widget w, BWStatus *, XtPointer); + /**********/ struct _BWRequestRec { - char *name; - int status_size; - void (*engage)(); - XtPointer engage_client_data; - void (*terminate)(); - XtPointer terminate_client_data; - void (*remove)(); - XtPointer remove_client_data; + char *name; + int status_size; + EngageProc engage; + XtPointer engage_client_data; + TerminateProc terminate; + XtPointer terminate_client_data; + RemoveProc remove; + XtPointer remove_client_data; } ; typedef struct { @@ -117,7 +125,7 @@ typedef struct { /* private state */ String size; Position horizOffset, vertOffset; - void (*notify)(); + XtActionProc notify; BWRequestStack *request_stack; Cardinal cardinal, current; /*Boolean trapping;*/ @@ -188,7 +196,16 @@ typedef struct _BitmapRec { #define Value(BW, button) (BW->bitmap.button_function[button - 1]) #define CreateCleanData(length) XtCalloc(length, sizeof(char)) -XImage *CreateBitmapImage(); -void DestroyBitmapImage(); +XImage *CreateBitmapImage(BitmapWidget BW, char *data, Dimension width, Dimension height); +void DestroyBitmapImage(XImage **image); +void TransferImageData(XImage *source, XImage *destination); +void CopyImageData(XImage *source, XImage *destination, + Position from_x, Position from_y, + Position to_x, Position to_y, + Position at_x, Position at_y); +XImage *GetImage(BitmapWidget BW, Pixmap pixmap); +XImage *ConvertToBitmapImage(BitmapWidget BW, XImage *image); +XImage *ScaleBitmapImage(BitmapWidget BW, XImage *src, + double scale_x, double scale_y); #endif /* _BitmapP_h */ @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/bitmap/CutPaste.c,v 1.5 2002/02/18 21:43:17 herrb Exp $ */ /* * Author: Davor Matic, MIT X Consortium @@ -39,9 +40,6 @@ from The Open Group. #include <stdio.h> #include <math.h> -#ifndef abs -#define abs(x) (((x) > 0) ? (x) : -(x)) -#endif #define min(x, y) (((x) < (y)) ? (x) : (y)) #define max(x, y) (((x) > (y)) ? (x) : (y)) @@ -53,12 +51,9 @@ extern Boolean DEBUG; *****************************************************************************/ /* ARGSUSED */ -Boolean ConvertSelection(w, selection, target, type, val_ret, length, format) - Widget w; - Atom *selection, *target, *type; - XtPointer *val_ret; - unsigned long *length; - int *format; +static Boolean +ConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type, + XtPointer *val_ret, unsigned long *length, int *format) { XPointer *value = (XPointer *)val_ret; BitmapWidget BW = (BitmapWidget) w; @@ -111,9 +106,8 @@ Boolean ConvertSelection(w, selection, target, type, val_ret, length, format) } /* ARGSUSED */ -void LoseSelection(w, selection) - Widget w; - Atom *selection; +static void +LoseSelection(Widget w, Atom selection) { BitmapWidget BW = (BitmapWidget) w; @@ -125,9 +119,8 @@ void LoseSelection(w, selection) } /* ARGSUSED */ -void SelectionDone(w, selection, target) - Widget w; - Atom *selection, *target; +static void +SelectionDone(Widget w, Atom *selection, Atom *target) { /* Done Automatically ?!? @@ -139,30 +132,24 @@ void SelectionDone(w, selection, target) */ } -void BWGrabSelection(w, btime) - Widget w; - Time btime; +void +BWGrabSelection(Widget w, Time btime) { BitmapWidget BW = (BitmapWidget) w; BW->bitmap.selection.own = XtOwnSelection(w, XA_PRIMARY, btime, ConvertSelection, - LoseSelection, + (XtLoseSelectionProc)LoseSelection, SelectionDone); if (DEBUG && BW->bitmap.selection.own) fprintf(stderr, "Own the selection\n"); } -XImage *GetImage(); /* ARGSUSED */ -void SelectionCallback(w, cldat, selection, type, val, length, format) - Widget w; - XtPointer cldat; - Atom *selection, *type; - XtPointer val; - unsigned long *length; - int *format; +static void +SelectionCallback(Widget w, XtPointer cldat, Atom *selection, Atom *type, + XtPointer val, unsigned long *length, int *format) { XPointer value = (XPointer)val; BitmapWidget BW = (BitmapWidget) w; @@ -186,10 +173,8 @@ void SelectionCallback(w, cldat, selection, type, val, length, format) BW->bitmap.selection.limbo = FALSE; } -void BWRequestSelection(w, btime, wait) - Widget w; - Time btime; - Boolean wait; +void +BWRequestSelection(Widget w, Time btime, Boolean wait) { BitmapWidget BW = (BitmapWidget) w; @@ -212,9 +197,8 @@ void BWRequestSelection(w, btime, wait) /* ARGSUSED */ /* Returns true if there is a transferable selection */ -Boolean BWQuerySelection(w, btime) - Widget w; - Time btime; +Boolean +BWQuerySelection(Widget w, Time btime) { /* To be written. XA_TARGETS to be used. So far undefined ?!? */ @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/bitmap/Dialog.c,v 1.4 2001/12/14 20:00:40 dawes Exp $ */ /* * Author: Davor Matic, MIT X Consortium @@ -43,7 +44,9 @@ from The Open Group. #define min(x, y) (((x) < (y)) ? (x) : (y)) #define max(x, y) (((x) > (y)) ? (x) : (y)) -static void SetDialogButton(); + +static void SetDialogButton(Widget w, XEvent *event, + String *argv, Cardinal *argc); static XtActionsRec actions_table[] = { {"set-dialog-button", SetDialogButton}, @@ -62,9 +65,8 @@ static DialogButton dialog_buttons[] = { static unsigned long selected; /* ARGSUSED */ -static void SetSelected(w, clientData, callData) /* ARGSUSED */ - Widget w; - XtPointer clientData, callData; +static void +SetSelected(Widget w, XtPointer clientData, XtPointer callData) /* ARGSUSED */ { String name = (String)clientData; int i; @@ -75,11 +77,11 @@ static void SetSelected(w, clientData, callData) /* ARGSUSED */ } /* ARGSUSED */ -static void SetDialogButton(w, event, argv, argc) - Widget w; /* not used */ - XEvent *event; /* not used */ - String *argv; - Cardinal *argc; +static void +SetDialogButton(Widget w, /* not used */ + XEvent *event, /* not used */ + String *argv, + Cardinal *argc) { char button_name[80]; XtPointer dummy = NULL; @@ -93,10 +95,8 @@ static void SetDialogButton(w, event, argv, argc) static Boolean firstTime = True; -Dialog CreateDialog(top_widget, name, options) - Widget top_widget; - String name; - unsigned long options; +Dialog +CreateDialog(Widget top_widget, String name, unsigned long options) { int i; Dialog popup; @@ -128,9 +128,8 @@ Dialog CreateDialog(top_widget, name, options) return NULL; } -void PopdownDialog(popup, answer) - Dialog popup; - String *answer; +void +PopdownDialog(Dialog popup, String *answer) { if (answer) *answer = XawDialogGetValueString(popup->dialog_widget); @@ -138,10 +137,9 @@ void PopdownDialog(popup, answer) XtPopdown(popup->shell_widget); } -unsigned long PopupDialog(popup, message, suggestion, answer, grab) - Dialog popup; - String message, suggestion, *answer; - XtGrabKind grab; +unsigned long +PopupDialog(Dialog popup, String message, String suggestion, + String *answer, XtGrabKind grab) { Position popup_x, popup_y, top_x, top_y; Dimension popup_width, popup_height, top_width, top_height, border_width; @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/bitmap/Dialog.h,v 1.4 2001/12/14 20:00:40 dawes Exp $ */ /* * Author: Davor Matic, MIT X Consortium @@ -51,6 +52,6 @@ typedef struct { unsigned long flag; } DialogButton; -extern Dialog CreateDialog(); -extern unsigned long PopupDialog(); -extern void PopdownDialog(); +extern Dialog CreateDialog(Widget, String, unsigned long); +extern unsigned long PopupDialog(Dialog, String, String, String *, XtGrabKind); +extern void PopdownDialog(Dialog, String *); @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/bitmap/Graphics.c,v 1.6 2001/12/14 20:00:40 dawes Exp $ */ /* * Author: Davor Matic, MIT X Consortium @@ -35,6 +36,8 @@ from The Open Group. #include <X11/StringDefs.h> #include <X11/Xfuncs.h> #include "BitmapP.h" +#include "Bitmap.h" +#include "Requests.h" #include <stdio.h> #include <math.h> @@ -56,10 +59,9 @@ from The Open Group. ((bit)((*(image->data + (x) / 8 + (y) * image->bytes_per_line) &\ (1 << ((x) % 8))) ? 1 : 0)) - -bit BWGetBit(w, x, y) - Widget w; - Position x, y; +#if 0 +bit +BWGetBit(Widget w, Position x, Position y) { BitmapWidget BW = (BitmapWidget) w; @@ -68,7 +70,7 @@ bit BWGetBit(w, x, y) else return NotSet; } - +#endif #define InvertBit(image, x, y)\ (*(image->data + (x) / 8 + (y) * image->bytes_per_line) ^=\ @@ -90,9 +92,8 @@ bit BWGetBit(w, x, y) InWindowX(BW, x), InWindowY(BW, y),\ BW->bitmap.squareW, BW->bitmap.squareH) /* -void HighlightSquare(BW, x, y) - BitmapWidget BW; - Position x, y; +void +HighlightSquare(BitmapWidget BW, Position x, Position y) { XFillRectangle(XtDisplay(BW), XtWindow(BW), BW->bitmap.highlighting_gc, @@ -108,9 +109,8 @@ void HighlightSquare(BW, x, y) BW->bitmap.squareW, BW->bitmap.squareH) /* -void DrawSquare(BW, x, y) - BitmapWidget BW; - Position x, y; +void +DrawSquare(BitmapWidget BW, Position x, Position y) { XFillRectangle(XtDisplay(BW), XtWindow(BW), BW->bitmap.drawing_gc, @@ -126,10 +126,8 @@ void DrawSquare(BW, x, y) if (GetBit(BW->bitmap.image, x, y) != value)\ InvertPoint(BW, x, y) -void BWDrawPoint(w, x, y, value) - Widget w; - Position x, y; - bit value; +void +BWDrawPoint(Widget w, Position x, Position y, bit value) { BitmapWidget BW = (BitmapWidget) w; @@ -141,9 +139,8 @@ void BWDrawPoint(w, x, y, value) } } -XPoint *HotSpotShape(BW, x ,y) - BitmapWidget BW; - Position x, y; +static XPoint * +HotSpotShape(BitmapWidget BW, Position x, Position y) { static XPoint points[5]; @@ -169,11 +166,13 @@ XPoint *HotSpotShape(BW, x ,y) XFillPolygon(XtDisplay(BW), XtWindow(BW), BW->bitmap.highlighting_gc,\ HotSpotShape(BW, x, y), 5, Convex, CoordModeOrigin) +/* XImage *CreateBitmapImage(); void DestroyBitmapImage(); +*/ -void BWRedrawHotSpot(w) - Widget w; +void +BWRedrawHotSpot(Widget w) { BitmapWidget BW = (BitmapWidget) w; @@ -181,8 +180,8 @@ void BWRedrawHotSpot(w) DrawHotSpot(BW, BW->bitmap.hot.x, BW->bitmap.hot.y); } -void BWClearHotSpot(w) - Widget w; +void +BWClearHotSpot(Widget w) { BitmapWidget BW = (BitmapWidget) w; @@ -192,10 +191,8 @@ void BWClearHotSpot(w) } } -void BWDrawHotSpot(w, x, y, value) - Widget w; - Position x, y; - int value; +void +BWDrawHotSpot(Widget w, Position x, Position y, int value) { BitmapWidget BW = (BitmapWidget) w; @@ -219,9 +216,8 @@ void BWDrawHotSpot(w, x, y, value) } } -void BWSetHotSpot(w, x, y) - Widget w; - Position x, y; +void +BWSetHotSpot(Widget w, Position x, Position y) { if (QuerySet(x, y)) BWDrawHotSpot(w, x, y, Set); @@ -231,10 +227,10 @@ void BWSetHotSpot(w, x, y) /* high level procedures */ -void BWRedrawSquares(w, x, y, width, height) - Widget w; - register Position x, y; - Dimension width, height; +void +BWRedrawSquares(Widget w, + Position x, Position y, + Dimension width, Dimension height) { BitmapWidget BW = (BitmapWidget) w; Position from_x = InBitmapX(BW, x); @@ -254,10 +250,10 @@ void BWRedrawSquares(w, x, y, width, height) if (GetBit(BW->bitmap.image, x, y)) DrawSquare(BW, x, y); } -void BWDrawGrid(w, from_x, from_y, to_x, to_y) - Widget w; - Position from_x, from_y, - to_x, to_y; +void +BWDrawGrid(Widget w, + Position from_x, Position from_y, + Position to_x, Position to_y) { BitmapWidget BW = (BitmapWidget) w; int i; @@ -283,10 +279,10 @@ void BWDrawGrid(w, from_x, from_y, to_x, to_y) } -void BWRedrawGrid(w, x, y, width, height) - Widget w; - Position x, y; - Dimension width, height; +void +BWRedrawGrid(Widget w, + Position x, Position y, + Dimension width, Dimension height) { BitmapWidget BW = (BitmapWidget) w; Position from_x = InBitmapX(BW, x); @@ -298,11 +294,10 @@ void BWRedrawGrid(w, x, y, width, height) BWDrawGrid(w, from_x, from_y, to_x, to_y); } -void BWDrawLine(w, from_x, from_y, to_x, to_y, value) - Widget w; - Position from_x, from_y, - to_x, to_y; - int value; +void +BWDrawLine(Widget w, + Position from_x, Position from_y, + Position to_x, Position to_y, int value) { Position i; register double x, y; @@ -326,11 +321,10 @@ void BWDrawLine(w, from_x, from_y, to_x, to_y, value) BWDrawPoint(w, from_x, from_y, value); } -void BWBlindLine(w, from_x, from_y, to_x, to_y, value) - Widget w; - Position from_x, from_y, - to_x, to_y; - int value; +void +BWBlindLine(Widget w, + Position from_x, Position from_y, + Position to_x, Position to_y, int value) { Position i; register double x, y; @@ -356,11 +350,10 @@ void BWBlindLine(w, from_x, from_y, to_x, to_y, value) BWDrawPoint(w, from_x, from_y, value); } -void BWDrawRectangle(w, from_x, from_y, to_x, to_y, value) - Widget w; - Position from_x, from_y, - to_x, to_y; - int value; +void +BWDrawRectangle(Widget w, + Position from_x, Position from_y, + Position to_x, Position to_y, int value) { register Position i; Dimension delta, width, height; @@ -391,11 +384,10 @@ void BWDrawRectangle(w, from_x, from_y, to_x, to_y, value) to_x, to_y, value); } -void BWDrawFilledRectangle(w, from_x, from_y, to_x, to_y, value) - Widget w; - Position from_x, from_y, - to_x, to_y; - int value; +void +BWDrawFilledRectangle(Widget w, + Position from_x, Position from_y, + Position to_x, Position to_y, int value) { register Position x, y; @@ -407,11 +399,10 @@ void BWDrawFilledRectangle(w, from_x, from_y, to_x, to_y, value) BWDrawPoint(w, x, y, value); } -void BWDrawCircle(w, origin_x, origin_y, point_x, point_y, value) - Widget w; - Position origin_x, origin_y, - point_x, point_y; - int value; +void +BWDrawCircle(Widget w, + Position origin_x, Position origin_y, + Position point_x, Position point_y, int value) { register Position i, delta; Dimension dx, dy, half; @@ -445,11 +436,10 @@ void BWDrawCircle(w, origin_x, origin_y, point_x, point_y, value) } } -void BWDrawFilledCircle(w, origin_x, origin_y, point_x, point_y, value) - Widget w; - Position origin_x, origin_y, - point_x, point_y; - int value; +void +BWDrawFilledCircle(Widget w, + Position origin_x, Position origin_y, + Position point_x, Position point_y, int value) { register Position i, j, delta; Dimension dx, dy; @@ -479,10 +469,8 @@ void BWDrawFilledCircle(w, origin_x, origin_y, point_x, point_y, value) else InvertPoint(BW, x, y);} /* -void FloodLoop(BW, x, y, value) - BitmapWidget BW; - Position x, y; - int value; +static void +FloodLoop(BitmapWidget BW, Position x, Position y, int value) { if (QueryFlood(BW, x, y, value)) { Flood(BW, x, y, value); @@ -494,10 +482,8 @@ void FloodLoop(BW, x, y, value) } */ -void FloodLoop(BW, x, y, value) - BitmapWidget BW; - Position x, y; - int value; +static void +FloodLoop(BitmapWidget BW, Position x, Position y, int value) { Position save_x, save_y, x_left, x_right; @@ -581,10 +567,8 @@ void FloodLoop(BW, x, y, value) } } -void BWFloodFill(w, x, y, value) - Widget w; - Position x, y; - int value; +void +BWFloodFill(Widget w, Position x, Position y, int value) { BitmapWidget BW = (BitmapWidget) w; int pixel; @@ -604,12 +588,12 @@ void BWFloodFill(w, x, y, value) (BW->bitmap.hot.y == max(BW->bitmap.mark.from_y,\ min(BW->bitmap.hot.y, BW->bitmap.mark.to_y)))) -void BWUp(w) - Widget w; +void +BWUp(Widget w) { BitmapWidget BW = (BitmapWidget) w; register Position x, y; - bit first, up, down; + bit first, up, down=0; Position from_x, from_y, to_x, to_y; if (BWQueryMarked(w)) { @@ -650,12 +634,12 @@ void BWUp(w) } -void BWDown(w) - Widget w; +void +BWDown(Widget w) { BitmapWidget BW = (BitmapWidget) w; register Position x, y; - bit first, down, up; + bit first, down, up=0; Position from_x, from_y, to_x, to_y; if (BWQueryMarked(w)) { @@ -694,12 +678,12 @@ void BWDown(w) (BW->bitmap.hot.y + 1) % BW->bitmap.image->height); } -void BWLeft(w) - Widget w; +void +BWLeft(Widget w) { BitmapWidget BW = (BitmapWidget) w; register Position x, y; - bit first, left, right; + bit first, left, right=0; Position from_x, from_y, to_x, to_y; if (BWQueryMarked(w)) { @@ -739,12 +723,12 @@ void BWLeft(w) BW->bitmap.hot.y); } -void BWRight(w) - Widget w; +void +BWRight(Widget w) { BitmapWidget BW = (BitmapWidget) w; register Position x, y; - bit first, right, left; + bit first, right, left=0; Position from_x, from_y, to_x, to_y; if (BWQueryMarked(w)) { @@ -783,10 +767,10 @@ void BWRight(w) BW->bitmap.hot.y); } -void TransferImageData(); +/* void TransferImageData(); */ -void BWFold(w) - Widget w; +void +BWFold(Widget w) { BitmapWidget BW = (BitmapWidget) w; Position x, y, new_x, new_y; @@ -830,8 +814,8 @@ void BWFold(w) } -void BWClear(w) - Widget w; +void +BWClear(Widget w) { BitmapWidget BW = (BitmapWidget) w; register Position x, y; @@ -849,8 +833,8 @@ void BWClear(w) } -void BWSet(w) - Widget w; +void +BWSet(Widget w) { BitmapWidget BW = (BitmapWidget) w; register Position x, y; @@ -864,12 +848,12 @@ void BWSet(w) DrawSquare(BW, x, y); for (i = 0; i < length; i++) - BW->bitmap.image->data[i] = 255; + BW->bitmap.image->data[i] = (char)255; } -void BWRedraw(w) - Widget w; +void +BWRedraw(Widget w) { BitmapWidget BW = (BitmapWidget) w; @@ -878,8 +862,8 @@ void BWRedraw(w) True); } -void BWInvert(w) - Widget w; +void +BWInvert(Widget w) { BitmapWidget BW = (BitmapWidget) w; int i, length; @@ -896,8 +880,8 @@ void BWInvert(w) BW->bitmap.image->data[i] ^= 255; } -void BWFlipHoriz(w) - Widget w; +void +BWFlipHoriz(Widget w) { BitmapWidget BW = (BitmapWidget) w; register Position x, y; @@ -937,8 +921,8 @@ void BWFlipHoriz(w) BW->bitmap.image->height - 1 - BW->bitmap.hot.y); } -void BWFlipVert(w) - Widget w; +void +BWFlipVert(Widget w) { BitmapWidget BW = (BitmapWidget) w; register Position x, y; @@ -979,8 +963,8 @@ void BWFlipVert(w) } -void BWRotateRight(w) - Widget w; +void +BWRotateRight(Widget w) { BitmapWidget BW = (BitmapWidget) w; Position x, y, delta, shift, tmp; @@ -1061,8 +1045,8 @@ void BWRotateRight(w) } -void BWRotateLeft(w) - Widget w; +void +BWRotateLeft(Widget w) { BitmapWidget BW = (BitmapWidget) w; Position x, y,delta, shift, tmp; @@ -1143,9 +1127,11 @@ void BWRotateLeft(w) } -void CopyImageData(source, destination, from_x, from_y, to_x, to_y, at_x, at_y) - XImage *source, *destination; - Position from_x, from_y, to_x, to_y, at_x, at_y; +void +CopyImageData(XImage *source, XImage *destination, + Position from_x, Position from_y, + Position to_x, Position to_y, + Position at_x, Position at_y) { Position x, y, delta_x, delta_y; @@ -1160,9 +1146,8 @@ void CopyImageData(source, destination, from_x, from_y, to_x, to_y, at_x, at_y) ClearBit(destination, at_x + x, at_y + y); } -XImage *ConvertToBitmapImage(BW, image) - BitmapWidget BW; - XImage *image; +XImage * +ConvertToBitmapImage(BitmapWidget BW, XImage *image) { XImage *bitmap_image; char *data; @@ -1181,8 +1166,8 @@ XImage *ConvertToBitmapImage(BW, image) return bitmap_image; } -void TransferImageData(source, destination) - XImage *source, *destination; +void +TransferImageData(XImage *source, XImage *destination) { Position x, y; @@ -1192,8 +1177,8 @@ void TransferImageData(source, destination) InvertBit(destination, x, y); } -void BWStore(w) - Widget w; +void +BWStore(Widget w) { BitmapWidget BW = (BitmapWidget) w; Dimension width, height; @@ -1219,8 +1204,8 @@ void BWStore(w) } } -void BWClearMarked(w) - Widget w; +void +BWClearMarked(Widget w) { BitmapWidget BW = (BitmapWidget) w; @@ -1234,9 +1219,8 @@ void BWClearMarked(w) } -void BWDragMarked(w, at_x, at_y) - Widget w; - Position at_x, at_y; +void +BWDragMarked(Widget w, Position at_x, Position at_y) { BitmapWidget BW = (BitmapWidget) w; @@ -1248,9 +1232,8 @@ void BWDragMarked(w, at_x, at_y) Highlight); } -void BWDragStored(w, at_x, at_y) - Widget w; - Position at_x, at_y; +void +BWDragStored(Widget w, Position at_x, Position at_y) { BitmapWidget BW = (BitmapWidget) w; @@ -1262,11 +1245,9 @@ void BWDragStored(w, at_x, at_y) Highlight); } -void DrawImageData(BW, image, at_x, at_y, value) - BitmapWidget BW; - XImage *image; - Position at_x, at_y; - int value; +static void +DrawImageData(BitmapWidget BW, XImage *image, + Position at_x, Position at_y, int value) { Position x, y; Boolean C, S, I, H; @@ -1281,7 +1262,7 @@ void DrawImageData(BW, image, at_x, at_y, value) for (y = 0; y < image->height; y++) { A = GetBit(image, x, y); B = GetBit(BW->bitmap.image, at_x + x, at_y + y); - if (A & C | (A | B) & S | (A ^ B) & I | (A | B) & H) + if ((A & C) | ((A | B) & S) | ((A ^ B) & I) | ((A | B) & H)) value = (A & H) ? Highlight : Set; else value = Clear; @@ -1291,10 +1272,8 @@ void DrawImageData(BW, image, at_x, at_y, value) } } -void BWRestore(w, at_x, at_y, value) - Widget w; - Position at_x, at_y; - int value; +void +BWRestore(Widget w, Position at_x, Position at_y, int value) { BitmapWidget BW = (BitmapWidget) w; @@ -1304,10 +1283,8 @@ void BWRestore(w, at_x, at_y, value) } } -void BWCopy(w, at_x, at_y, value) - Widget w; - Position at_x, at_y; - int value; +void +BWCopy(Widget w, Position at_x, Position at_y, int value) { BitmapWidget BW = (BitmapWidget) w; XImage *storage; @@ -1334,12 +1311,10 @@ void BWCopy(w, at_x, at_y, value) } } -void BWMark(); +/* void BWMark(); */ -void BWMove(w, at_x, at_y, value) - Widget w; - Position at_x, at_y; - int value; +void +BWMove(Widget w, Position at_x, Position at_y, int value) { BitmapWidget BW = (BitmapWidget) w; XImage *storage; @@ -1375,8 +1350,8 @@ void BWMove(w, at_x, at_y, value) } } -void BWRedrawMark(w) - Widget w; +void +BWRedrawMark(Widget w) { BitmapWidget BW = (BitmapWidget) w; @@ -1390,8 +1365,8 @@ void BWRedrawMark(w) InWindowY(BW, BW->bitmap.mark.from_y)); } -void BWStoreToBuffer(w) - Widget w; +void +BWStoreToBuffer(Widget w) { BitmapWidget BW = (BitmapWidget) w; @@ -1402,8 +1377,8 @@ void BWStoreToBuffer(w) BW->bitmap.buffer_mark = BW->bitmap.mark; } -void BWUnmark(w) - Widget w; +void +BWUnmark(Widget w) { BitmapWidget BW = (BitmapWidget) w; @@ -1423,10 +1398,9 @@ void BWUnmark(w) } } -void BWMark(w, from_x, from_y, to_x, to_y) - Widget w; - Position from_x, from_y, - to_x, to_y; +void +BWMark(Widget w, Position from_x, Position from_y, + Position to_x, Position to_y) { BitmapWidget BW = (BitmapWidget) w; @@ -1466,16 +1440,16 @@ void BWMark(w, from_x, from_y, to_x, to_y) } } -void BWMarkAll(w) - Widget w; +void +BWMarkAll(Widget w) { BitmapWidget BW = (BitmapWidget) w; BWMark(w, 0, 0, BW->bitmap.image->width - 1, BW->bitmap.image->height - 1); } -void BWUndo(w) - Widget w; +void +BWUndo(Widget w) { BitmapWidget BW = (BitmapWidget) w; Position x, y; @@ -1505,8 +1479,8 @@ void BWUndo(w) } -void BWHighlightAxes(w) - Widget w; +void +BWHighlightAxes(Widget w) { BitmapWidget BW = (BitmapWidget) w; @@ -1541,10 +1515,9 @@ typedef struct { Dimension *width, *height; } Table; -XImage *ScaleBitmapImage(BW, src, scale_x, scale_y) - BitmapWidget BW; - XImage *src; - double scale_x, scale_y; +XImage * +ScaleBitmapImage(BitmapWidget BW, XImage *src, + double scale_x, double scale_y) { char *data; XImage *dst; @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/bitmap/Handlers.c,v 1.5 2002/02/18 21:43:17 herrb Exp $ */ /* * Author: Davor Matic, MIT X Consortium @@ -38,9 +39,6 @@ from The Open Group. #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)) @@ -57,11 +55,11 @@ extern Boolean DEBUG; (InBitmapY(BW, y) == (square_y))) -void DragOnePointHandler(w, client_data, event, cont) /* ARGSUSED */ - Widget w; - XtPointer client_data; - XEvent *event; - Boolean *cont; +static void +DragOnePointHandler(Widget w, + XtPointer client_data, + XEvent *event, + Boolean *cont) /* ARGSUSED */ { BWStatus *status = (BWStatus *)client_data; BitmapWidget BW = (BitmapWidget) w; @@ -81,7 +79,7 @@ void DragOnePointHandler(w, client_data, event, cont) /* ARGSUSED */ status->at_y = InBitmapY(BW, event->xbutton.y); status->success = status->draw ? True : False; if (status->draw) - (*status->draw)(w, + (*(DrawOnePointProc)status->draw)(w, status->at_x, status->at_y, status->value); } break; @@ -105,7 +103,7 @@ void DragOnePointHandler(w, client_data, event, cont) /* ARGSUSED */ status->at_x = InBitmapX(BW, event->xmotion.x); status->at_y = InBitmapY(BW, event->xmotion.y); if (status->draw) - (*status->draw)(w, + (*(DrawOnePointProc)status->draw)(w, status->at_x, status->at_y, status->value); } } @@ -114,11 +112,11 @@ void DragOnePointHandler(w, client_data, event, cont) /* ARGSUSED */ } } -void DragOnePointEngage(w, status, draw, state) - Widget w; - BWStatus *status; - void (*draw)(); - int *state; +void +DragOnePointEngage(Widget w, + BWStatus *status, + XtPointer draw, + int *state) { status->at_x = NotSet; @@ -133,14 +131,14 @@ void DragOnePointEngage(w, status, draw, state) } /* ARGSUSED */ -void DragOnePointTerminate(w, status, client_data) - Widget w; - BWStatus *status; - XtPointer client_data; +void +DragOnePointTerminate(Widget w, + BWStatus *status, + XtPointer draw) { if (status->success) { - BWChangeNotify(w, NULL, NULL); + BWChangeNotify(w); BWSetChanged(w); } @@ -150,11 +148,11 @@ void DragOnePointTerminate(w, status, client_data) } -void OnePointHandler(w, client_data, event, cont) /* ARGSUSED */ - Widget w; - XtPointer client_data; - XEvent *event; - Boolean *cont; +void +OnePointHandler(Widget w, + XtPointer client_data, + XEvent *event, + Boolean *cont) /* ARGSUSED */ { BWStatus *status = (BWStatus *)client_data; BitmapWidget BW = (BitmapWidget) w; @@ -169,7 +167,7 @@ void OnePointHandler(w, client_data, event, cont) /* ARGSUSED */ BWClip(w, event->xexpose.x, event->xexpose.y, event->xexpose.width, event->xexpose.height); if (status->draw) - (*status->draw)(w, + (*(DrawOnePointProc)status->draw)(w, status->at_x, status->at_y, Highlight); BWUnclip(w); @@ -184,7 +182,7 @@ void OnePointHandler(w, client_data, event, cont) /* ARGSUSED */ status->at_x = InBitmapX(BW, event->xbutton.x); status->at_y = InBitmapY(BW, event->xbutton.y); if (status->draw) - (*status->draw)(w, + (*(DrawOnePointProc)status->draw)(w, status->at_x, status->at_y, Highlight); } break; @@ -192,7 +190,7 @@ void OnePointHandler(w, client_data, event, cont) /* ARGSUSED */ case ButtonRelease: if (QuerySet(status->at_x, status->at_y)) { if (status->draw) - (*status->draw)(w, + (*(DrawOnePointProc)status->draw)(w, status->at_x, status->at_y, Highlight); status->value = Value(BW, event->xbutton.button); @@ -210,12 +208,12 @@ void OnePointHandler(w, client_data, event, cont) /* ARGSUSED */ if (!QueryInSquare(BW, event->xmotion.x, event->xmotion.y, status->at_x, status->at_y)) { if (status->draw) - (*status->draw)(w, + (*(DrawOnePointProc)status->draw)(w, status->at_x, status->at_y, Highlight); status->at_x = InBitmapX(BW, event->xmotion.x); status->at_y = InBitmapY(BW, event->xmotion.y); if (status->draw) - (*status->draw)(w, + (*(DrawOnePointProc)status->draw)(w, status->at_x, status->at_y, Highlight); } } @@ -223,11 +221,11 @@ void OnePointHandler(w, client_data, event, cont) /* ARGSUSED */ } } -void OnePointEngage(w, status, draw, state) - Widget w; - BWStatus *status; - void (*draw)(); - int *state; +void +OnePointEngage(Widget w, + BWStatus *status, + XtPointer draw, + int *state) { status->at_x = NotSet; status->at_y = NotSet; @@ -241,11 +239,12 @@ void OnePointEngage(w, status, draw, state) FALSE, OnePointHandler, (XtPointer)status); } -void OnePointImmediateEngage(w, status, draw, state) - Widget w; - BWStatus *status; - void (*draw)(); - int *state; +#if 0 +void +OnePointImmediateEngage(Widget w, + BWStatus *status, + XtPointer draw, + int *state) { status->at_x = 0; status->at_y = 0; @@ -254,7 +253,7 @@ void OnePointImmediateEngage(w, status, draw, state) status->state = *state; if (status->draw) - (*status->draw)(w, + (*(DrawOnePointProc)status->draw)(w, status->at_x, status->at_y, Highlight); XtAddEventHandler(w, @@ -262,25 +261,26 @@ void OnePointImmediateEngage(w, status, draw, state) ExposureMask | PointerMotionMask, FALSE, OnePointHandler, (XtPointer)status); } +#endif -void OnePointTerminate(w, status, draw) - Widget w; - BWStatus *status; - void (*draw)(); +void +OnePointTerminate(Widget w, + BWStatus *status, + XtPointer draw) { if (status->success && draw) { BWStoreToBuffer(w); - (*draw)(w, + (*(DrawOnePointProc)draw)(w, status->at_x, status->at_y, status->value); - BWChangeNotify(w, NULL, NULL); + BWChangeNotify(w); BWSetChanged(w); } else if (QuerySet(status->at_x, status->at_y)) if (status->draw) - (*status->draw)(w, + (*(DrawOnePointProc)status->draw)(w, status->at_x, status->at_y, Highlight); XtRemoveEventHandler(w, @@ -289,20 +289,20 @@ void OnePointTerminate(w, status, draw) FALSE, OnePointHandler, (XtPointer)status); } -void OnePointTerminateTransparent(w, status, draw) - Widget w; - BWStatus *status; - void (*draw)(); +void +OnePointTerminateTransparent(Widget w, + BWStatus *status, + XtPointer draw) { if (status->success && draw) - (*draw)(w, + (*(DrawOnePointProc)draw)(w, status->at_x, status->at_y, status->value); else if (QuerySet(status->at_x, status->at_y)) if (status->draw) - (*status->draw)(w, + (*(DrawOnePointProc)status->draw)(w, status->at_x, status->at_y, Highlight); XtRemoveEventHandler(w, @@ -313,11 +313,11 @@ void OnePointTerminateTransparent(w, status, draw) } -void TwoPointsHandler(w, client_data, event, cont) /* ARGSUSED */ - Widget w; - XtPointer client_data; - XEvent *event; - Boolean *cont; +void +TwoPointsHandler(Widget w, + XtPointer client_data, + XEvent *event, + Boolean *cont) /* ARGSUSED */ { BitmapWidget BW = (BitmapWidget) w; BWStatus *status = (BWStatus *)client_data; @@ -332,7 +332,7 @@ void TwoPointsHandler(w, client_data, event, cont) /* ARGSUSED */ BWClip(w, event->xexpose.x, event->xexpose.y, event->xexpose.width, event->xexpose.height); if (status->draw) - (*status->draw)(w, + (*(DrawTwoPointProc)status->draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, Highlight); BWUnclip(w); @@ -349,7 +349,7 @@ void TwoPointsHandler(w, client_data, event, cont) /* ARGSUSED */ status->to_x = InBitmapX(BW, event->xbutton.x); status->to_y = InBitmapY(BW, event->xbutton.y); if (status->draw) - (*status->draw)(w, + (*(DrawTwoPointProc)status->draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, Highlight); } @@ -358,7 +358,7 @@ void TwoPointsHandler(w, client_data, event, cont) /* ARGSUSED */ case ButtonRelease: if (QuerySet(status->from_x, status->from_y)) { if (status->draw) - (*status->draw)(w, + (*(DrawTwoPointProc)status->draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, Highlight); status->value = Value(BW, event->xbutton.button); @@ -377,13 +377,13 @@ void TwoPointsHandler(w, client_data, event, cont) /* ARGSUSED */ if (!QueryInSquare(BW, event->xmotion.x, event->xmotion.y, status->to_x, status->to_y)) { if (status->draw) - (*status->draw)(w, + (*(DrawTwoPointProc)status->draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, Highlight); status->to_x = InBitmapX(BW, event->xmotion.x); status->to_y = InBitmapY(BW, event->xmotion.y); if (status->draw) - (*status->draw)(w, + (*(DrawTwoPointProc)status->draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, Highlight); } @@ -392,7 +392,7 @@ void TwoPointsHandler(w, client_data, event, cont) /* ARGSUSED */ status->to_x = InBitmapX(BW, event->xmotion.x); status->to_y = InBitmapY(BW, event->xmotion.y); if (status->draw) - (*status->draw)(w, + (*(DrawTwoPointProc)status->draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, Highlight); } @@ -401,11 +401,11 @@ void TwoPointsHandler(w, client_data, event, cont) /* ARGSUSED */ } } -void TwoPointsEngage(w, status, draw, state) - Widget w; - BWStatus *status; - void (*draw)(); - int *state; +void +TwoPointsEngage(Widget w, + BWStatus *status, + XtPointer draw, + int *state) { status->from_x = NotSet; @@ -422,26 +422,26 @@ void TwoPointsEngage(w, status, draw, state) FALSE, TwoPointsHandler, (XtPointer)status); } -void TwoPointsTerminate(w, status, draw) - Widget w; - BWStatus *status; - void (*draw)(); +void +TwoPointsTerminate(Widget w, + BWStatus *status, + XtPointer draw) { if (status->success && draw) { BWStoreToBuffer(w); - (*draw)(w, + (*(DrawTwoPointProc)draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, status->value); - BWChangeNotify(w, NULL, NULL); + BWChangeNotify(w); BWSetChanged(w); } else if (QuerySet(status->from_x, status->from_y) && QuerySet(status->to_x, status->to_y)) if (status->draw) - (*status->draw)(w, + (*(DrawTwoPointProc)status->draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, Highlight); @@ -451,14 +451,14 @@ void TwoPointsTerminate(w, status, draw) FALSE, TwoPointsHandler, (XtPointer)status); } -void TwoPointsTerminateTransparent(w, status, draw) - Widget w; - BWStatus *status; - void (*draw)(); +void +TwoPointsTerminateTransparent(Widget w, + BWStatus *status, + XtPointer draw) { if (status->success && draw) - (*draw)(w, + (*(DrawTwoPointProc)draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, status->value); @@ -466,7 +466,7 @@ void TwoPointsTerminateTransparent(w, status, draw) if (QuerySet(status->from_x, status->from_y) && QuerySet(status->to_x, status->to_y)) if (status->draw) - (*status->draw)(w, + (*(DrawTwoPointProc)status->draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, Highlight); @@ -476,14 +476,14 @@ void TwoPointsTerminateTransparent(w, status, draw) FALSE, TwoPointsHandler, (XtPointer)status); } -void TwoPointsTerminateTimed(w, status, draw) - Widget w; - BWStatus *status; - void (*draw)(); +void +TwoPointsTerminateTimed(Widget w, + BWStatus *status, + XtPointer draw) { if (status->success && draw) - (*draw)(w, + (*(DrawTwoPointProc)draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, status->btime); @@ -491,7 +491,7 @@ void TwoPointsTerminateTimed(w, status, draw) if (QuerySet(status->from_x, status->from_y) && QuerySet(status->to_x, status->to_y)) if (status->draw) - (*status->draw)(w, + (*(DrawTwoPointProc)status->draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, Highlight); @@ -502,18 +502,19 @@ void TwoPointsTerminateTimed(w, status, draw) } /* ARGSUSED */ -void Interface(w, status, action) - Widget w; - XtPointer status; - void (*action)(); +void +Interface(Widget w, + BWStatus *status, + XtPointer action) { - (*action)(w); + (*(InterfaceProc)action)(w); } -void Paste(w, at_x, at_y, value) - Widget w; - Position at_x, at_y; - int value; +void +Paste(Widget w, + Position at_x, + Position at_y, + int value) { BitmapWidget BW = (BitmapWidget) w; BWStatus *my_status; @@ -546,7 +547,7 @@ void Paste(w, at_x, at_y, value) status->at_x = at_x; status->at_y = at_y; status->value = value; - (*status->draw) (w, at_x, at_y, Highlight); + (*(DrawOnePointProc)status->draw) (w, at_x, at_y, Highlight); } else { @@ -560,16 +561,16 @@ void Paste(w, at_x, at_y, value) status->from_x = status->to_x = at_x; status->from_y = status->to_y = at_y; status->value = value; - (*status->draw) (w, at_x, at_y, at_x, at_y, Highlight); + (*(DrawTwoPointProc)status->draw) (w, at_x, at_y, at_x, at_y, Highlight); } } -void DragTwoPointsHandler(w, client_data, event, cont) /* ARGSUSED */ - Widget w; - XtPointer client_data; - XEvent *event; - Boolean *cont; +void +DragTwoPointsHandler(Widget w, + XtPointer client_data, + XEvent *event, + Boolean *cont) /* ARGSUSED */ { BitmapWidget BW = (BitmapWidget) w; BWStatus *status = (BWStatus *)client_data; @@ -591,7 +592,7 @@ void DragTwoPointsHandler(w, client_data, event, cont) /* ARGSUSED */ status->to_y = InBitmapY(BW, event->xbutton.y); status->success = status->draw ? True : False; if (status->draw) - (*status->draw)(w, + (*(DrawTwoPointProc)status->draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, status->value); } @@ -621,7 +622,7 @@ void DragTwoPointsHandler(w, client_data, event, cont) /* ARGSUSED */ status->to_x = InBitmapX(BW, event->xmotion.x); status->to_y = InBitmapY(BW, event->xmotion.y); if (status->draw) - (*status->draw)(w, + (*(DrawTwoPointProc)status->draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, status->value); } @@ -631,11 +632,11 @@ void DragTwoPointsHandler(w, client_data, event, cont) /* ARGSUSED */ } } -void DragTwoPointsEngage(w, status, draw, state) - Widget w; - BWStatus *status; - void (*draw)(); - int *state; +void +DragTwoPointsEngage(Widget w, + BWStatus *status, + XtPointer draw, + int *state) { status->from_x = NotSet; @@ -651,21 +652,21 @@ void DragTwoPointsEngage(w, status, draw, state) FALSE, DragTwoPointsHandler, (XtPointer)status); } -void DragTwoPointsTerminate(w, status, draw) - Widget w; - BWStatus *status; - void (*draw)(); +void +DragTwoPointsTerminate(Widget w, + BWStatus *status, + XtPointer draw) { if (status->success && draw) { if ((status->from_x != status->to_x) || (status->from_y != status->to_y)) - (*draw)(w, + (*(DrawTwoPointProc)draw)(w, status->from_x, status->from_y, status->to_x, status->to_y, status->value); - BWChangeNotify(w, NULL, NULL); + BWChangeNotify(w); BWSetChanged(w); } @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/bitmap/ReqMach.c,v 1.5 2002/02/18 21:43:17 herrb Exp $ */ /* * Author: Davor Matic, MIT X Consortium @@ -40,13 +41,6 @@ from The Open Group. #include <stdio.h> #include <math.h> -#ifndef abs -#define abs(x) (((x) > 0) ? (x) : -(x)) -#endif -#define min(x, y) (((x) < (y)) ? (x) : (y)) -#define max(x, y) (((x) > (y)) ? (x) : (y)) - - extern Boolean DEBUG; /*****************************************************************************\ @@ -57,8 +51,8 @@ extern Boolean DEBUG; * Searches for a request record of a request specified by its name. * Returns a pointer to the record or NULL if the request was not found. */ -BWRequestRec *FindRequest(name) - BWRequest name; +static BWRequestRec * +FindRequest(BWRequest name) { int i; @@ -73,12 +67,9 @@ BWRequestRec *FindRequest(name) * Adds a request to the request stack and does proper initializations. * Returns TRUE if the request was found and FALSE otherwise. */ -Boolean BWAddRequest(w, name, trap, call_data, call_data_size) - Widget w; - BWRequest name; - Boolean trap; - XtPointer call_data; - Cardinal call_data_size; +Boolean +BWAddRequest(Widget w, BWRequest name, Boolean trap, + XtPointer call_data, Cardinal call_data_size) { BitmapWidget BW = (BitmapWidget) w; BWRequestRec *request; @@ -114,9 +105,8 @@ Boolean BWAddRequest(w, name, trap, call_data, call_data_size) * Engages the request designated by the current parameter. * Returnes TRUE if the request has an engage function and FALSE otherwise. */ -Boolean Engage(BW, current) - BitmapWidget BW; - Cardinal current; +static Boolean +Engage(BitmapWidget BW, Cardinal current) { BW->bitmap.current = current; @@ -136,15 +126,15 @@ Boolean Engage(BW, current) return False; } -Boolean BWTerminateRequest(); -Boolean BWRemoveRequest(); +/* Boolean BWTerminateRequest(); + Boolean BWRemoveRequest(); */ /* * Scans down the request stack removing all requests untill it finds * one to be trapped. */ -void TrappingLoop(BW) - BitmapWidget BW; +static void +TrappingLoop(BitmapWidget BW) { if (DEBUG) @@ -167,9 +157,8 @@ void TrappingLoop(BW) * Terimantes the current request and continues with next request if con = TRUE * Returnes TRUE if there is any number of requests left on the stack. */ -Boolean BWTerminateRequest(w, cont) - Widget w; - Boolean cont; +Boolean +BWTerminateRequest(Widget w, Boolean cont) { BitmapWidget BW = (BitmapWidget) w; @@ -180,8 +169,7 @@ Boolean BWTerminateRequest(w, cont) (*BW->bitmap.request_stack[BW->bitmap.current].request->terminate) (w, BW->bitmap.request_stack[BW->bitmap.current].status, - BW->bitmap.request_stack[BW->bitmap.current].request->terminate_client_data, - BW->bitmap.request_stack[BW->bitmap.current].call_data); + BW->bitmap.request_stack[BW->bitmap.current].request->terminate_client_data); if (cont) { if (BW->bitmap.current == BW->bitmap.cardinal) @@ -203,8 +191,8 @@ Boolean BWTerminateRequest(w, cont) /* * Simple interface to BWTerminateRequest that takes only a widget. */ -void BWAbort(w) - Widget w; +void +BWAbort(Widget w) { BWTerminateRequest(w, True); } @@ -214,8 +202,8 @@ void BWAbort(w) * it will terminate it. * Returns TRUE if the number of requests left on the stack != 0. */ -Boolean BWRemoveRequest(w) - Widget w; +Boolean +BWRemoveRequest(Widget w) { BitmapWidget BW = (BitmapWidget) w; @@ -229,8 +217,7 @@ Boolean BWRemoveRequest(w) (*BW->bitmap.request_stack[BW->bitmap.cardinal].request->remove) (w, BW->bitmap.request_stack[BW->bitmap.cardinal].status, - BW->bitmap.request_stack[BW->bitmap.cardinal].request->remove_client_data, - BW->bitmap.request_stack[BW->bitmap.cardinal].call_data); + BW->bitmap.request_stack[BW->bitmap.cardinal].request->remove_client_data); XtFree(BW->bitmap.request_stack[BW->bitmap.cardinal].status); XtFree(BW->bitmap.request_stack[BW->bitmap.cardinal].call_data); @@ -244,9 +231,9 @@ Boolean BWRemoveRequest(w) return False; } -void BWRemoveAllRequests(w) - Widget w; -{ /* SUPPRESS 530 */ +void +BWRemoveAllRequests(Widget w) +{ while (BWRemoveRequest(w)) {/* removes all requests from the stack */} } @@ -254,12 +241,9 @@ void BWRemoveAllRequests(w) * Adds the request to the stack and performs engaging ritual. * Returns TRUE if the request was found, FALSE otherwise. */ -Boolean BWEngageRequest(w, name, trap, call_data, call_data_size) - Widget w; - BWRequest name; - Boolean trap; - XtPointer call_data; - Cardinal call_data_size; +Boolean +BWEngageRequest(Widget w, BWRequest name, Boolean trap, + XtPointer call_data, Cardinal call_data_size) { BitmapWidget BW = (BitmapWidget) w; @@ -26,121 +26,62 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/bitmap/Requests.h,v 1.5 2001/12/14 20:00:41 dawes Exp $ */ /* * Author: Davor Matic, MIT X Consortium */ +#ifndef _Requests_h +#define _Requests_h + +typedef int (*DrawOnePointProc)(Widget, Position, Position, int); +typedef int (*DrawTwoPointProc)(Widget, Position, Position, + Position, Position, int); +typedef int (*InterfaceProc)(Widget); + typedef struct { Boolean success; Position at_x, at_y; Position from_x, from_y, to_x, to_y; - void (*draw)(); + XtPointer draw; int value; Time btime; int state; } BWStatus; -void OnePointEngage(); -void OnePointTerminate(); -void OnePointTerminateTransparent(); -void DragOnePointEngage(); -void DragOnePointTerminate(); -void TwoPointsEngage(); -void TwoPointsTerminate(); -void TwoPointsTerminateTransparent(); -void TwoPointsTerminateTimed(); -void DragTwoPointsEngage(); -void DragTwoPointsTerminate(); -void Interface(); -void Paste(); +extern void OnePointEngage ( Widget w, BWStatus *status, XtPointer draw, int *state ); +extern void OnePointTerminate ( Widget w, BWStatus *status, XtPointer draw ); +extern void OnePointTerminateTransparent ( Widget w, BWStatus *status, XtPointer draw ); +extern void DragOnePointEngage ( Widget w, BWStatus *status, XtPointer draw, int *state ); +extern void DragOnePointTerminate ( Widget w, BWStatus *status, XtPointer client_data ); +extern void TwoPointsEngage ( Widget w, BWStatus *status, XtPointer draw, int *state ); +extern void TwoPointsTerminate ( Widget w, BWStatus *status, XtPointer draw ); +extern void TwoPointsTerminateTransparent ( Widget w, BWStatus *status, XtPointer draw ); +extern void TwoPointsTerminateTimed ( Widget w, BWStatus *status, XtPointer draw ); +extern void DragTwoPointsEngage ( Widget w, BWStatus *status, XtPointer draw, int *state ); +extern void DragTwoPointsTerminate ( Widget w, BWStatus *status, XtPointer draw ); +extern void Interface ( Widget w, BWStatus *status, XtPointer action ); +extern void Paste ( Widget w, Position at_x, Position at_y, int value ); -void BWMark(); -void BWUnmark(); -void BWStore(); -void BWDragMarked(); -void BWDragStored(); -void BWRestore(); -void BWCopy(); -void BWMove(); -void BWDrawPoint(); -void BWDrawLine(); -void BWBlindLine(); -void BWDrawRectangle(); -void BWDrawFilledRectangle(); -void BWDrawCircle(); -void BWDrawFilledCircle(); -void BWFloodFill(); -void BWDrawHotSpot(); -void BWChangeNotify(); -void BWZoomIn(); +extern void BWDragMarked(Widget w, Position at_x, Position at_y); +extern void BWDragStored(Widget w, Position at_x, Position at_y); +extern void BWCopy(Widget w, Position at_x, Position at_y, int value); +extern void BWMove(Widget w, Position at_x, Position at_y, int value); +extern void BWRestore(Widget w, Position at_x, Position at_y, int value); +extern void BWDrawPoint(Widget w, Position x, Position y, bit value); +extern void BWBlindLine(Widget w, Position from_x, Position from_y, + Position to_x, Position to_y, int value); +extern void BWDrawHotSpot(Widget w, Position x, Position y, int value); +extern void BWZoomIn(Widget w, Position from_x, Position from_y, + Position to_x, Position to_y); -static BWRequestRec requests[] = /* SUPPRESS 592 */ -{ -{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}, -}; +extern void OnePointHandler(Widget w, XtPointer client_data, + XEvent *event, Boolean *cont); +extern void TwoPointsHandler(Widget w, XtPointer client_data, + XEvent *event, Boolean *cont); +extern void DragTwoPointsHandler(Widget w, XtPointer client_data, + XEvent *event, Boolean *cont); +#endif /* _Requests_h */ @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/bitmap/atobm.c,v 3.5 2001/12/14 20:00:41 dawes Exp $ */ /* * atobm - ascii to bitmap filter @@ -35,12 +36,15 @@ from The Open Group. #include <stdio.h> #include <ctype.h> #include <X11/Xos.h> - -extern char *malloc(), *calloc(); +#include <stdlib.h> char *ProgramName; -static void usage () +static void doit(FILE *fp, char *filename, char *chars, + int xhot, int yhot, char *name); + +static void +usage (void) { fprintf (stderr, "usage: %s [-options ...] [filename]\n\n", ProgramName); @@ -59,8 +63,8 @@ static void usage () } -char *cify_name (name) - char *name; +static char * +cify_name (char *name) { int length = name ? strlen (name) : 0; int i; @@ -72,8 +76,8 @@ char *cify_name (name) return name; } -char *StripName(name) - char *name; +static char * +StripName(char *name) { char *begin = strrchr(name, '/'); char *end, *result; @@ -88,9 +92,8 @@ char *StripName(name) return (result); } -main (argc, argv) - int argc; - char **argv; +int +main (int argc, char *argv[]) { int i; int xhot = -1, yhot = -1; @@ -160,12 +163,12 @@ main (argc, argv) } -doit (fp, filename, chars, xhot, yhot, name) - FILE *fp; - char *filename; - char *chars; - int xhot, yhot; - char *name; +static void +doit (FILE *fp, + char *filename, + char *chars, + int xhot, int yhot, + char *name) { int i, j; int last_character; @@ -182,7 +185,7 @@ doit (fp, filename, chars, xhot, yhot, name) int used; unsigned char *scanlines; struct _scan_list *next; - } *head = NULL, *slist; + } *head = NULL, *slist = NULL; static unsigned char masktable[] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }; int padded = 0; @@ -22,7 +22,10 @@ .\" not be used in advertising or otherwise to promote the sale, use or .\" other dealings in this Software without prior written authorization .\" from The Open Group. -.TH BITMAP 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/bitmap/bitmap.man,v 1.8 2002/10/12 16:06:44 herrb Exp $ +.\" +.TH BITMAP 1 __xorgversion__ .SH NAME bitmap, bmtoa, atobm \- bitmap editor and converter utilities for the X Window System .SH SYNOPSIS @@ -606,9 +609,8 @@ in the #ifdef COLOR section of the file you read with xrdb: This will cause bitmap to pick up the colors in the app-defaults color customization file: .sp 1 - <XRoot>/lib/X11/app-defaults/Bitmap-color + __apploaddir__/Bitmap-color .sp 1 -where <XRoot> refers to the root of the X11 install tree. .fi .SH BITMAP WIDGET Bitmap widget is a stand-alone widget for editing raster images. It @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/bitmap/bmtoa.c,v 3.7 2001/12/14 20:00:41 dawes Exp $ */ /* * bmtoa - bitmap to ascii filter @@ -39,13 +40,19 @@ from The Open Group. #include <X11/Xmu/Drawing.h> -extern char *malloc(); +#include <stdlib.h> +#include <unistd.h> +#ifndef HAS_MKSTEMP extern char *mktemp(); +#endif char *ProgramName; +static void print_scanline (unsigned int width, unsigned int height, + unsigned char *data, char *chars); -static void usage () +static void +usage (void) { fprintf (stderr, "usage: %s [-options ...] [filename]\n\n", ProgramName); @@ -57,7 +64,8 @@ static void usage () exit (1); } -static char *copy_stdin () +static char * +copy_stdin (void) { #ifdef WIN32 static char tmpfilename[] = "/temp/bmtoa.XXXXXX"; @@ -68,6 +76,7 @@ static char *copy_stdin () FILE *fp; int nread, nwritten; +#ifndef HAS_MKSTEMP if (mktemp (tmpfilename) == NULL) { fprintf (stderr, "%s: unable to genererate temporary file name for stdin.\n", @@ -75,6 +84,17 @@ static char *copy_stdin () exit (1); } fp = fopen (tmpfilename, "w"); +#else + int fd; + + if ((fd = mkstemp(tmpfilename)) < 0) { + fprintf (stderr, + "%s: unable to genererate temporary file name for stdin.\n", + ProgramName); + exit (1); + } + fp = fdopen(fd, "w"); +#endif while (1) { buf[0] = '\0'; nread = fread (buf, 1, sizeof buf, stdin); @@ -93,9 +113,8 @@ static char *copy_stdin () return tmpfilename; } -main (argc, argv) - int argc; - char **argv; +int +main (int argc, char *argv[]) { char *filename = NULL; int isstdin = 0; @@ -153,10 +172,11 @@ main (argc, argv) exit (0); } -print_scanline (width, height, data, chars) - unsigned int width, height; - unsigned char *data; - char *chars; +static void +print_scanline (unsigned int width, + unsigned int height, + unsigned char *data, + char *chars) { char *scanline = (char *) malloc (width + 1); unsigned char *dp = data; |