summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2011-10-14 21:25:06 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2011-10-14 21:25:06 -0700
commita8ee8e937e8d939522f18fa5723afea084221467 (patch)
tree46430bb72fdb1d680d50031a9a744737f7ac7d9a
parent64eacd3665306283d126d0df7cf63a071e576c38 (diff)
Strip trailing whitespace
Performed with: find * -type f | xargs perl -i -p -e 's{[ \t]+$}{}' git diff -w & git diff -b show no diffs from this change Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--BitEdit.c234
-rw-r--r--Bitmap.c590
-rw-r--r--Bitmap.h6
-rw-r--r--BitmapP.h16
-rw-r--r--CutPaste.c40
-rw-r--r--Dialog.c52
-rw-r--r--Graphics.c468
-rw-r--r--Handlers.c302
-rw-r--r--Makefile.am6
-rw-r--r--ReqMach.c68
-rw-r--r--Requests.h10
-rw-r--r--app-defaults/Bitmap6
-rw-r--r--app-defaults/Bitmap-nocase6
-rw-r--r--atobm.c24
-rw-r--r--bmtoa.c14
-rw-r--r--configure.ac4
16 files changed, 923 insertions, 923 deletions
diff --git a/BitEdit.c b/BitEdit.c
index 7be6a7a..64c2e56 100644
--- a/BitEdit.c
+++ b/BitEdit.c
@@ -208,14 +208,14 @@ static ButtonRec buttons[] = {
#include "Dialog.h"
-static Widget
- top_widget,
+static Widget
+ top_widget,
parent_widget,
formy_widget,
fileMenu_widget,
editMenu_widget,
status_widget,
- pane_widget,
+ pane_widget,
form_widget,
bitmap_widget,
image_shell,
@@ -278,7 +278,7 @@ static XtActionsRec actions_table[] = {
static Atom wm_delete_window;
-static void
+static void
FixImage(void)
{
Pixmap old_image, image;
@@ -286,14 +286,14 @@ FixImage(void)
Arg wargs[2];
if (!image_visible) return;
-
+
n=0;
XtSetArg(wargs[n], XtNbitmap, &old_image); n++;
XtGetValues(normal_image_widget, wargs, n);
-
-
+
+
image = BWGetUnzoomedPixmap(bitmap_widget);
-
+
n=0;
XtSetArg(wargs[n], XtNbitmap, image); n++;
XtSetValues(normal_image_widget, wargs, n);
@@ -303,7 +303,7 @@ FixImage(void)
XFreePixmap(XtDisplay(bitmap_widget), old_image);
}
-static void
+static void
FixStatus(void)
{
int n;
@@ -325,14 +325,14 @@ FixStatus(void)
/*XtFree(str); */
}
-static void
+static void
FixUp(void)
{
FixImage();
FixStatus();
}
-static void
+static void
FixEntry(Widget w, int *id)
{
int n;
@@ -340,41 +340,41 @@ FixEntry(Widget w, int *id)
Time dummy = 0;
n = 0;
-
+
switch (*id) {
-
+
case Image:
- XtSetArg(wargs[n], XtNleftBitmap,
+ XtSetArg(wargs[n], XtNleftBitmap,
image_visible ? check_mark : None); n++;
break;
-
+
case Grid:
- XtSetArg(wargs[n], XtNleftBitmap,
+ XtSetArg(wargs[n], XtNleftBitmap,
BWQueryGrid(bitmap_widget) ? check_mark : None); n++;
break;
-
+
case Dashed:
- XtSetArg(wargs[n], XtNleftBitmap,
+ XtSetArg(wargs[n], XtNleftBitmap,
BWQueryDashed(bitmap_widget) ? check_mark : None); n++;
break;
-
+
case Axes:
- XtSetArg(wargs[n], XtNleftBitmap,
+ XtSetArg(wargs[n], XtNleftBitmap,
BWQueryAxes(bitmap_widget) ? check_mark : None); n++;
break;
-
+
case Stippled:
- XtSetArg(wargs[n], XtNleftBitmap,
+ XtSetArg(wargs[n], XtNleftBitmap,
BWQueryStippled(bitmap_widget) ? check_mark : None); n++;
break;
-
+
case Proportional:
- XtSetArg(wargs[n], XtNleftBitmap,
+ XtSetArg(wargs[n], XtNleftBitmap,
BWQueryProportional(bitmap_widget) ? check_mark : None); n++;
break;
-
+
case Zoom:
- XtSetArg(wargs[n], XtNleftBitmap,
+ XtSetArg(wargs[n], XtNleftBitmap,
BWQueryZooming(bitmap_widget) ? check_mark : None); n++;
break;
@@ -384,27 +384,27 @@ FixEntry(Widget w, int *id)
break;
case Paste:
- XtSetArg(wargs[n], XtNsensitive,
+ XtSetArg(wargs[n], XtNsensitive,
BWQuerySelection(bitmap_widget, dummy)); n++;
break;
default:
return;
}
-
+
XtSetValues(w, wargs, n);
}
/* ARGSUSED */
-void FixMenu(Widget w,
- XEvent *event,
- String *params,
+void FixMenu(Widget w,
+ XEvent *event,
+ String *params,
Cardinal *num_params)
{
int i;
btime = event->xbutton.time;
-
+
for (i = 0; i < XtNumber(edit_menu); i++)
FixEntry(edit_menu[i].widget, &edit_menu[i].id);
}
@@ -412,14 +412,14 @@ void FixMenu(Widget w,
static int zero = 0;
#define Plain (char *)&zero,sizeof(int)
/* ARGSUSED */
-static void
+static void
TheCallback(Widget w, /* not used */
- XtPointer clientData,
+ XtPointer clientData,
XtPointer callData)
{
int *id = (int *)clientData;
switch (*id) {
-
+
case New:
DoNew();
break;
@@ -427,19 +427,19 @@ TheCallback(Widget w, /* not used */
case Load:
DoLoad();
break;
-
+
case Insert:
DoInsert();
break;
-
+
case Save:
DoSave();
break;
-
+
case SaveAs:
DoSaveAs();
break;
-
+
case Resize:
DoResize();
break;
@@ -455,7 +455,7 @@ TheCallback(Widget w, /* not used */
case Basename:
DoBasename();
break;
-
+
case Image:
SwitchImage();
break;
@@ -463,53 +463,53 @@ TheCallback(Widget w, /* not used */
case Grid:
SwitchGrid();
break;
-
+
case Dashed:
SwitchDashed();
break;
case Axes:
SwitchAxes();
- break;
+ break;
case Stippled:
SwitchStippled();
break;
-
+
case Proportional:
SwitchProportional();
break;
-
+
case Zoom:
SwitchZoom();
break;
-
+
case Cut:
DoCut();
break;
-
+
case Copy:
DoCopy();
break;
-
+
case Paste:
DoPaste();
break;
-
+
case Clear:
BWStoreToBuffer(bitmap_widget);
BWClear(bitmap_widget);
BWChangeNotify(bitmap_widget);
BWSetChanged(bitmap_widget);
break;
-
+
case Set:
BWStoreToBuffer(bitmap_widget);
BWSet(bitmap_widget);
BWChangeNotify(bitmap_widget);
BWSetChanged(bitmap_widget);
break;
-
+
case Invert:
BWStoreToBuffer(bitmap_widget);
BWInvert(bitmap_widget);
@@ -537,7 +537,7 @@ break;
BWAddRequest(bitmap_widget, CopyRequest, True, Plain);
}
break;
-
+
case MoveImm:
BWRemoveAllRequests(bitmap_widget);
if (BWQueryMarked(bitmap_widget)) {
@@ -549,70 +549,70 @@ break;
BWAddRequest(bitmap_widget, MoveRequest, True, Plain);
}
break;
-
+
case Up:
BWStoreToBuffer(bitmap_widget);
BWUp(bitmap_widget);
BWChangeNotify(bitmap_widget);
BWSetChanged(bitmap_widget);
break;
-
+
case Down:
BWStoreToBuffer(bitmap_widget);
BWDown(bitmap_widget);
BWChangeNotify(bitmap_widget);
BWSetChanged(bitmap_widget);
break;
-
+
case Left:
BWStoreToBuffer(bitmap_widget);
BWLeft(bitmap_widget);
BWChangeNotify(bitmap_widget);
BWSetChanged(bitmap_widget);
break;
-
+
case Right:
BWStoreToBuffer(bitmap_widget);
BWRight(bitmap_widget);
BWChangeNotify(bitmap_widget);
BWSetChanged(bitmap_widget);
break;
-
+
case Fold:
BWStoreToBuffer(bitmap_widget);
BWFold(bitmap_widget);
BWChangeNotify(bitmap_widget);
BWSetChanged(bitmap_widget);
break;
-
+
case FlipHoriz:
BWStoreToBuffer(bitmap_widget);
BWFlipHoriz(bitmap_widget);
BWChangeNotify(bitmap_widget);
BWSetChanged(bitmap_widget);
break;
-
+
case FlipVert:
BWStoreToBuffer(bitmap_widget);
BWFlipVert(bitmap_widget);
BWChangeNotify(bitmap_widget);
BWSetChanged(bitmap_widget);
break;
-
+
case RotateRight:
BWStoreToBuffer(bitmap_widget);
BWRotateRight(bitmap_widget);
BWChangeNotify(bitmap_widget);
BWSetChanged(bitmap_widget);
break;
-
+
case RotateLeft:
BWStoreToBuffer(bitmap_widget);
BWRotateLeft(bitmap_widget);
BWChangeNotify(bitmap_widget);
BWSetChanged(bitmap_widget);
break;
-
+
case Point:
BWRemoveAllRequests(bitmap_widget);
BWEngageRequest(bitmap_widget, PointRequest, True, Plain);
@@ -622,42 +622,42 @@ break;
BWRemoveAllRequests(bitmap_widget);
BWEngageRequest(bitmap_widget, CurveRequest, True, Plain);
break;
-
+
case Line:
BWRemoveAllRequests(bitmap_widget);
BWEngageRequest(bitmap_widget, LineRequest, True, Plain);
break;
-
+
case Rectangle:
BWRemoveAllRequests(bitmap_widget);
BWEngageRequest(bitmap_widget, RectangleRequest, True, Plain);
break;
-
+
case FilledRectangle:
BWRemoveAllRequests(bitmap_widget);
BWEngageRequest(bitmap_widget, FilledRectangleRequest, True, Plain);
break;
-
+
case Circle:
BWRemoveAllRequests(bitmap_widget);
BWEngageRequest(bitmap_widget, CircleRequest, True, Plain);
break;
-
+
case FilledCircle:
BWRemoveAllRequests(bitmap_widget);
BWEngageRequest(bitmap_widget, FilledCircleRequest, True, Plain);
break;
-
+
case FloodFill:
BWRemoveAllRequests(bitmap_widget);
BWEngageRequest(bitmap_widget, FloodFillRequest, True, Plain);
break;
-
+
case SetHotSpot:
BWRemoveAllRequests(bitmap_widget);
BWEngageRequest(bitmap_widget, HotSpotRequest, True, Plain);
break;
-
+
case ClearHotSpot:
BWStoreToBuffer(bitmap_widget);
BWClearHotSpot(bitmap_widget);
@@ -669,11 +669,11 @@ break;
BWUndo(bitmap_widget);
BWChangeNotify(bitmap_widget);
BWSetChanged(bitmap_widget);
- break;
+ break;
case Quit:
DoQuit(bitmap_widget, NULL, NULL, NULL);
- break;
+ break;
} /* don't add anything below this line */
}
@@ -689,17 +689,17 @@ void SwitchImage(void)
Position image_x, image_y;
int n;
Arg wargs[3];
-
+
XtTranslateCoords(bitmap_widget,
10, 10, &image_x, &image_y);
-
+
n = 0;
XtSetArg(wargs[n], XtNx, image_x); n++;
XtSetArg(wargs[n], XtNy, image_y); n++;
XtSetValues(image_shell, wargs, n);
-
+
image_visible = True;
-
+
FixImage();
XtPopup(image_shell, XtGrabNone);
FixImage();
@@ -723,7 +723,7 @@ void SwitchAxes(void)
void SwitchStippled(void)
{
- BWSwitchStippled(bitmap_widget);
+ BWSwitchStippled(bitmap_widget);
}
void SwitchProportional(void)
@@ -767,7 +767,7 @@ void DoCopy(void)
void DoPaste(void)
{
- BWRequestSelection(bitmap_widget, btime, TRUE);
+ BWRequestSelection(bitmap_widget, btime, TRUE);
BWEngageRequest(bitmap_widget, RestoreRequest, False, Plain);
}
@@ -804,7 +804,7 @@ void DoLoad(void)
goto RetryLoadSave;
}
break;
-
+
case Cancel:
return;
}
@@ -848,12 +848,12 @@ void DoInsert(void)
void DoSave(void)
{
BWGetFilename(bitmap_widget, &filename);
- if (!strcmp(filename, ""))
+ if (!strcmp(filename, ""))
DoSaveAs();
else if (BWWriteFile(bitmap_widget, NULL, NULL) != BitmapSuccess) {
snprintf(message, sizeof(message), "Can't write file: %s", filename);
if (PopupDialog(error_dialog, message,
- NULL, NULL, XtGrabExclusive) == Retry)
+ NULL, NULL, XtGrabExclusive) == Retry)
DoSaveAs();
}
else {
@@ -936,7 +936,7 @@ void DoFilename(void)
}
void DoBasename(void)
-{
+{
BWGetBasename(bitmap_widget, &base_name);
if (PopupDialog(input_dialog, "Change basename:",
base_name, &base_name, XtGrabExclusive) == Okay) {
@@ -953,16 +953,16 @@ void DoQuit(Widget w, XEvent *event, String *params, Cardinal *num_params)
switch (PopupDialog(qsave_dialog, "Save file before quitting?",
filename, &filename, XtGrabExclusive)) {
case Yes:
- if (BWWriteFile(bitmap_widget, filename, NULL)
+ if (BWWriteFile(bitmap_widget, filename, NULL)
!= BitmapSuccess) {
snprintf(message, sizeof(message), "Can't write file: %s", filename);
- if (PopupDialog(error_dialog, message,
- NULL, NULL, XtGrabExclusive) == Retry)
+ if (PopupDialog(error_dialog, message,
+ NULL, NULL, XtGrabExclusive) == Retry)
goto RetryQuit;
else return;
}
break;
-
+
case Cancel:
return;
}
@@ -975,10 +975,10 @@ int main(int argc, char *argv[])
int i, n;
Arg wargs[2];
Widget w;
- Widget radio_group = NULL;
+ Widget radio_group = NULL;
XtPointer radio_data = NULL;
-
- top_widget = XtInitialize(NULL, "Bitmap",
+
+ top_widget = XtInitialize(NULL, "Bitmap",
options, XtNumber(options), &argc, argv);
if (argc > 2) {
@@ -988,8 +988,8 @@ int main(int argc, char *argv[])
check_mark = XCreateBitmapFromData(XtDisplay(top_widget),
RootWindowOfScreen(XtScreen(top_widget)),
- (char *) xlogo16_bits,
- xlogo16_width,
+ (char *) xlogo16_bits,
+ xlogo16_width,
xlogo16_height);
XtAddActions(actions_table, XtNumber(actions_table));
@@ -1003,45 +1003,45 @@ int main(int argc, char *argv[])
formy_widget = XtCreateManagedWidget("formy", formWidgetClass,
parent_widget, NULL, 0);
- fileMenu_widget = XtCreatePopupShell("fileMenu",
- simpleMenuWidgetClass,
+ fileMenu_widget = XtCreatePopupShell("fileMenu",
+ simpleMenuWidgetClass,
formy_widget, NULL, 0);
-
+
(void) XtCreateManagedWidget("fileButton",
- menuButtonWidgetClass,
+ menuButtonWidgetClass,
formy_widget, NULL, 0);
for (i = 0; i < XtNumber(file_menu); i++) {
- w = XtCreateManagedWidget(file_menu[i].name,
- (file_menu[i].trap ?
+ w = XtCreateManagedWidget(file_menu[i].name,
+ (file_menu[i].trap ?
smeBSBObjectClass : smeLineObjectClass),
fileMenu_widget, NULL, 0),
XtAddCallback(w,
XtNcallback,
TheCallback,
(XtPointer)&file_menu[i].id);
-
+
file_menu[i].widget = w;
}
-
- editMenu_widget = XtCreatePopupShell("editMenu",
- simpleMenuWidgetClass,
+
+ editMenu_widget = XtCreatePopupShell("editMenu",
+ simpleMenuWidgetClass,
formy_widget, NULL, 0);
-
- (void) XtCreateManagedWidget("editButton",
- menuButtonWidgetClass,
+
+ (void) XtCreateManagedWidget("editButton",
+ menuButtonWidgetClass,
formy_widget, NULL, 0);
for (i = 0; i < XtNumber(edit_menu); i++) {
- w = XtCreateManagedWidget(edit_menu[i].name,
- (edit_menu[i].trap ?
+ w = XtCreateManagedWidget(edit_menu[i].name,
+ (edit_menu[i].trap ?
smeBSBObjectClass : smeLineObjectClass),
editMenu_widget, NULL, 0),
XtAddCallback(w,
XtNcallback,
TheCallback,
(XtPointer)&edit_menu[i].id);
-
+
edit_menu[i].widget = w;
}
@@ -1051,12 +1051,12 @@ int main(int argc, char *argv[])
pane_widget = XtCreateManagedWidget("pane", panedWidgetClass,
parent_widget, NULL, 0);
- form_widget = XtCreateManagedWidget("form", formWidgetClass,
+ form_widget = XtCreateManagedWidget("form", formWidgetClass,
pane_widget, NULL, 0);
-
+
for (i = 0; i < XtNumber(buttons); i++) {
- w = XtCreateManagedWidget(buttons[i].name,
- (buttons[i].trap ?
+ w = XtCreateManagedWidget(buttons[i].name,
+ (buttons[i].trap ?
toggleWidgetClass : commandWidgetClass),
form_widget, NULL, 0);
@@ -1076,33 +1076,33 @@ int main(int argc, char *argv[])
pane_widget, NULL, 0);
XtRealizeWidget(top_widget);
if (argc > 1)
- if (BWReadFile(bitmap_widget, argv[1], NULL))
+ if (BWReadFile(bitmap_widget, argv[1], NULL))
wm_delete_window = XInternAtom(XtDisplay(top_widget), "WM_DELETE_WINDOW",
False);
(void) XSetWMProtocols (XtDisplay(top_widget), XtWindow(top_widget),
&wm_delete_window, 1);
-
+
image_shell = XtCreatePopupShell("image", transientShellWidgetClass,
top_widget, NULL, 0);
box_widget = XtCreateManagedWidget("box", boxWidgetClass,
image_shell, NULL, 0);
- normal_image_widget = XtCreateManagedWidget("normalImage",
+ normal_image_widget = XtCreateManagedWidget("normalImage",
labelWidgetClass,
box_widget, NULL, 0);
- inverted_image_widget = XtCreateManagedWidget("invertedImage",
+ inverted_image_widget = XtCreateManagedWidget("invertedImage",
labelWidgetClass,
box_widget, NULL, 0);
-
+
n=0;
XtSetArg(wargs[n], XtNbitmap, BWGetUnzoomedPixmap(bitmap_widget)); n++;
XtSetValues(normal_image_widget, wargs, n);
XtSetValues(inverted_image_widget, wargs, n);
-
+
XtRealizeWidget(image_shell);
BWNotify(bitmap_widget, (XtActionProc)FixUp);
@@ -1110,7 +1110,7 @@ int main(int argc, char *argv[])
FixStatus();
input_dialog = CreateDialog(top_widget, "input", Okay | Cancel);
- error_dialog = CreateDialog(top_widget, "error", Abort | Retry);
+ error_dialog = CreateDialog(top_widget, "error", Abort | Retry);
qsave_dialog = CreateDialog(top_widget, "qsave", Yes | No | Cancel);
XawToggleSetCurrent(radio_group, radio_data);
diff --git a/Bitmap.c b/Bitmap.c
index e8db7be..8171bef 100644
--- a/Bitmap.c
+++ b/Bitmap.c
@@ -40,7 +40,7 @@ from The Open Group.
#include <X11/Xos.h>
#include "BitmapP.h"
#include "Bitmap.h"
-
+
#include <stdio.h>
#include <math.h>
@@ -234,7 +234,7 @@ static Atom targets[] = {
#include "Requests.h"
-static BWRequestRec requests[] =
+static BWRequestRec requests[] =
{
{MarkRequest, sizeof(BWStatus),
TwoPointsEngage, (XtPointer) BWDrawRectangle,
@@ -268,24 +268,24 @@ static BWRequestRec requests[] =
DragTwoPointsEngage, (XtPointer) BWBlindLine,
DragTwoPointsTerminate, (XtPointer) BWBlindLine,
NULL, (XtPointer) NULL},
-{LineRequest, sizeof(BWStatus),
- TwoPointsEngage, (XtPointer) BWDrawLine,
+{LineRequest, sizeof(BWStatus),
+ TwoPointsEngage, (XtPointer) BWDrawLine,
TwoPointsTerminate, (XtPointer) BWDrawLine,
NULL, (XtPointer) NULL},
-{RectangleRequest, sizeof(BWStatus),
+{RectangleRequest, sizeof(BWStatus),
TwoPointsEngage, (XtPointer) BWDrawRectangle,
TwoPointsTerminate, (XtPointer) BWDrawRectangle,
NULL, (XtPointer) NULL},
-{FilledRectangleRequest, sizeof(BWStatus),
+{FilledRectangleRequest, sizeof(BWStatus),
TwoPointsEngage, (XtPointer) BWDrawRectangle,
TwoPointsTerminate, (XtPointer) BWDrawFilledRectangle,
NULL, (XtPointer) NULL},
-{CircleRequest, sizeof(BWStatus),
+{CircleRequest, sizeof(BWStatus),
TwoPointsEngage, (XtPointer) BWDrawCircle,
TwoPointsTerminate, (XtPointer) BWDrawCircle,
NULL, (XtPointer) NULL},
-{FilledCircleRequest, sizeof(BWStatus),
- TwoPointsEngage, (XtPointer) BWDrawCircle,
+{FilledCircleRequest, sizeof(BWStatus),
+ TwoPointsEngage, (XtPointer) BWDrawCircle,
TwoPointsTerminate, (XtPointer) BWDrawFilledCircle,
NULL, (XtPointer) NULL},
{FloodFillRequest, sizeof(BWStatus),
@@ -303,16 +303,16 @@ static BWRequestRec requests[] =
};
static void ClassInitialize(void);
-static void Initialize(Widget wrequest, Widget wnew,
+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,
+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 */
/* superclass */ (WidgetClass) &simpleClassRec,
@@ -348,7 +348,7 @@ BitmapClassRec bitmapClassRec = {
/* display_accelerator */ XtInheritDisplayAccelerator,
/* extension */ NULL,
},
- {
+ {
/* empty */ XtInheritChangeSensitive,
},
{
@@ -358,65 +358,65 @@ BitmapClassRec bitmapClassRec = {
/* num_requests */ XtNumber(requests),
}
};
-
+
WidgetClass bitmapWidgetClass = (WidgetClass) &bitmapClassRec;
-
+
/* ARGSUSED */
-void
+void
BWDebug(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
DEBUG ^= True;
}
-Pixmap
-BWGetPixmap(Widget w)
+Pixmap
+BWGetPixmap(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
-
+
return GetPixmap(BW, BW->bitmap.zoom.image);
}
-Pixmap
+Pixmap
BWGetUnzoomedPixmap(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
GC gc;
Pixmap pix;
-
- if (BW->bitmap.zooming) {
- pix = XCreatePixmap(XtDisplay(w), XtWindow(w),
- BW->bitmap.zoom.image->width,
+
+ if (BW->bitmap.zooming) {
+ pix = XCreatePixmap(XtDisplay(w), XtWindow(w),
+ BW->bitmap.zoom.image->width,
BW->bitmap.zoom.image->height, 1);
- if (!(gc = XCreateGC(XtDisplay(w), pix,
+ if (!(gc = XCreateGC(XtDisplay(w), pix,
(unsigned long) 0, (XGCValues *) 0)))
return (Pixmap) None;
-
- XPutImage(XtDisplay(w), pix, gc,
- BW->bitmap.zoom.image,
- 0, 0, 0, 0,
- BW->bitmap.zoom.image->width,
+
+ XPutImage(XtDisplay(w), pix, gc,
+ BW->bitmap.zoom.image,
+ 0, 0, 0, 0,
+ BW->bitmap.zoom.image->width,
BW->bitmap.zoom.image->height);
- XPutImage(XtDisplay(w), pix, gc,
- BW->bitmap.image,
- 0, 0,
+ XPutImage(XtDisplay(w), pix, gc,
+ BW->bitmap.image,
+ 0, 0,
BW->bitmap.zoom.at_x,
BW->bitmap.zoom.at_y,
- BW->bitmap.image->width,
+ BW->bitmap.image->width,
BW->bitmap.image->height);
}
else {
- pix = XCreatePixmap(XtDisplay(w), XtWindow(w),
- BW->bitmap.image->width,
+ pix = XCreatePixmap(XtDisplay(w), XtWindow(w),
+ BW->bitmap.image->width,
BW->bitmap.image->height, 1);
- if (! (gc = XCreateGC(XtDisplay(w), pix,
+ if (! (gc = XCreateGC(XtDisplay(w), pix,
(unsigned long) 0, (XGCValues *) 0)))
return (Pixmap) None;
-
- XPutImage(XtDisplay(w), pix, gc,
- BW->bitmap.image,
+
+ XPutImage(XtDisplay(w), pix, gc,
+ BW->bitmap.image,
0, 0, 0, 0,
- BW->bitmap.image->width,
+ BW->bitmap.image->width,
BW->bitmap.image->height);
}
XFreeGC(XtDisplay(w), gc);
@@ -444,13 +444,13 @@ GetImage(BitmapWidget BW, Pixmap pixmap)
}
XImage *
-CreateBitmapImage(BitmapWidget BW, char *data,
+CreateBitmapImage(BitmapWidget BW, char *data,
Dimension width, Dimension height)
{
XImage *image = XCreateImage(XtDisplay(BW),
- DefaultVisual(XtDisplay(BW),
+ DefaultVisual(XtDisplay(BW),
DefaultScreen(XtDisplay(BW))),
- 1, XYBitmap, 0,
+ 1, XYBitmap, 0,
data, width, height,
8, ((int)width + 7) / 8);
@@ -469,7 +469,7 @@ CreateBitmapImage(BitmapWidget BW, char *data,
return image;
}
-void
+void
DestroyBitmapImage(XImage **image)
{
/*XDestroyImage(*image);*/
@@ -493,7 +493,7 @@ BWGetImage(Widget w, XEvent *event, String *params, Cardinal *num_params)
}
#endif
-void
+void
BWChangeNotify(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -502,7 +502,7 @@ BWChangeNotify(Widget w)
(*BW->bitmap.notify)(w, NULL, NULL, NULL);
}
-void
+void
BWNotify(Widget w, XtActionProc proc)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -510,39 +510,39 @@ BWNotify(Widget w, XtActionProc proc)
BW->bitmap.notify = proc;
}
-void
+void
BWSetChanged(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
-
+
BW->bitmap.changed = True;
}
-Boolean
+Boolean
BWQueryChanged(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
-
+
return BW->bitmap.changed;
}
-void
+void
BWClearChanged(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
-
+
BW->bitmap.changed = False;
}
-Boolean
+Boolean
BWQueryStored(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
-
+
return (BW->bitmap.storage != NULL);
}
-Boolean
+Boolean
BWQueryStippled(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -550,11 +550,11 @@ BWQueryStippled(Widget w)
return BW->bitmap.stippled;
}
-static void
+static void
RedrawStippled(BitmapWidget BW)
{
XExposeEvent event;
-
+
event.type = Expose;
event.display = XtDisplay((Widget)BW);
event.window = XtWindow((Widget)BW);
@@ -563,17 +563,17 @@ RedrawStippled(BitmapWidget BW)
event.width = BW->core.width;
event.height = BW->core.height;
event.count = 0;
-
+
BWRedrawMark((Widget)BW);
-
- BW->bitmap.stipple_change_expose_event = True;
-
+
+ BW->bitmap.stipple_change_expose_event = True;
+
XtDispatchEvent((XEvent *)&event);
-
+
BW->bitmap.stipple_change_expose_event = False;
}
-void
+void
BWSwitchStippled(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -584,11 +584,11 @@ BWSwitchStippled(Widget w)
XSetFillStyle(XtDisplay(BW), BW->bitmap.highlighting_gc,
(BW->bitmap.stippled ? FillStippled : FillSolid));
- RedrawStippled(BW);
+ RedrawStippled(BW);
}
-void
-BWSelect(Widget w, Position from_x, Position from_y,
+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);
@@ -596,7 +596,7 @@ BWSelect(Widget w, Position from_x, Position from_y,
BWGrabSelection(w, btime);
}
-Boolean
+Boolean
BWQueryAxes(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -604,7 +604,7 @@ BWQueryAxes(Widget w)
return BW->bitmap.axes;
}
-void
+void
BWSwitchAxes(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -613,27 +613,27 @@ BWSwitchAxes(Widget w)
BWHighlightAxes(w);
}
-void
+void
BWAxes(Widget w, Boolean _switch)
{
BitmapWidget BW = (BitmapWidget) w;
-
+
if (BW->bitmap.axes != _switch)
BWSwitchAxes(w);
}
-void
+void
BWRedrawAxes(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
-
+
if (BW->bitmap.axes)
BWHighlightAxes(w);
}
#if 0
-void
-BWPutImage(BitmapWidget w, Display *display, Drawable drawable, GC gc,
+void
+BWPutImage(BitmapWidget w, Display *display, Drawable drawable, GC gc,
Position x, Position y)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -643,14 +643,14 @@ BWPutImage(BitmapWidget w, Display *display, Drawable drawable, GC gc,
}
#endif
-static String
+static String
StripFilename(_Xconst _XtString filename)
{
const char *begin = strrchr(filename, '/');
const char *end;
char *result;
int length;
-
+
if (filename) {
begin = (begin ? begin + 1 : filename);
end = strchr(begin, '.'); /* change to strrchr to allow longer names */
@@ -664,27 +664,27 @@ StripFilename(_Xconst _XtString filename)
return (NULL);
}
-static int
+static int
XmuWriteBitmapDataToFile(_Xconst _XtString filename,
_Xconst _XtString basename,
- int width, int height, char *datap,
+ int width, int height, char *datap,
int x_hot, int y_hot)
{
FILE *file;
int i, data_length;
-
+
data_length = Length(width, height);
-
- if(!filename || !strcmp(filename, "") || !strcmp(filename, "-")) {
+
+ if(!filename || !strcmp(filename, "") || !strcmp(filename, "-")) {
file = stdout;
filename = "dummy";
}
else
file = fopen(filename, "w+");
-
+
if (!basename || !strcmp(basename, "") || !strcmp(basename, "-"))
basename = StripFilename(filename);
-
+
if (file) {
fprintf(file, "#define %s_width %d\n", basename, width);
fprintf(file, "#define %s_height %d\n", basename, height);
@@ -700,13 +700,13 @@ XmuWriteBitmapDataToFile(_Xconst _XtString filename,
fprintf(file, "0x%02x", (unsigned char) datap[i]);
}
fprintf(file, "};\n");
-
+
if (file != stdout)
fclose(file);
return BitmapSuccess;
}
-
+
return 1;
}
@@ -715,24 +715,24 @@ XmuWriteBitmapDataToFile(_Xconst _XtString filename,
*/
/* ARGSUSED */
-static void
+static void
CvtStringToButtonFunction(XrmValuePtr args, /* not used */
Cardinal *num_args, /* not used */
- XrmValuePtr from_val,
+ XrmValuePtr from_val,
XrmValuePtr to_val)
{
static int button_function;
char lower_name[80];
-
+
XmuCopyISOLatin1Lowered (lower_name, (char*)from_val->addr);
-
+
if (!strcmp(lower_name, XtClear)) {
button_function = Clear;
to_val->addr = (XPointer) &button_function;
to_val->size = sizeof(button_function);
return;
}
-
+
if (!strcmp(lower_name, XtSet)) {
button_function = Set;
to_val->addr = (XPointer) &button_function;
@@ -746,15 +746,15 @@ CvtStringToButtonFunction(XrmValuePtr args, /* not used */
to_val->size = sizeof(button_function);
return;
}
-
+
XtStringConversionWarning(from_val->addr, XtRButtonFunction);
button_function = Clear;
to_val->addr = (XPointer) &button_function;
to_val->size = sizeof(button_function);
-
+
}
-static void
+static void
ClassInitialize(void)
{
char *tm_table = XtMalloc(strlen(translations1) + strlen(translations2) + 1);
@@ -768,10 +768,10 @@ ClassInitialize(void)
DEBUG = False;
}
-static void
+static void
SetSizeFromSizeResource(BitmapWidget bw)
{
- if (BWParseSize(bw->bitmap.size,
+ if (BWParseSize(bw->bitmap.size,
&bw->bitmap.width,
&bw->bitmap.height)
==
@@ -784,7 +784,7 @@ SetSizeFromSizeResource(BitmapWidget bw)
/* ARGSUSED */
-static void
+static void
Initialize(Widget wrequest, Widget wnew, ArgList argv, Cardinal *argc)
{
BitmapWidget new = (BitmapWidget) wnew;
@@ -812,14 +812,14 @@ Initialize(Widget wrequest, Widget wnew, ArgList argv, Cardinal *argc)
SetSizeFromSizeResource(new);
- new->core.width = new->bitmap.width * new->bitmap.squareW +
+ new->core.width = new->bitmap.width * new->bitmap.squareW +
2 * new->bitmap.margin;
- new->core.height = new->bitmap.height * new->bitmap.squareH +
+ new->core.height = new->bitmap.height * new->bitmap.squareH +
2 * new->bitmap.margin;
-
+
new->bitmap.hot.x = new->bitmap.hot.y = NotSet;
new->bitmap.buffer_hot.x = new->bitmap.buffer_hot.y = NotSet;
-
+
new->bitmap.mark.from_x = new->bitmap.mark.from_y = NotSet;
new->bitmap.mark.to_x = new->bitmap.mark.to_y = NotSet;
new->bitmap.buffer_mark.from_x = new->bitmap.buffer_mark.from_y = NotSet;
@@ -830,8 +830,8 @@ Initialize(Widget wrequest, Widget wnew, ArgList argv, Cardinal *argc)
values.foreground ^= values.background;
values.function = GXxor;
mask = GCForeground | GCBackground | GCFunction;
- new->bitmap.drawing_gc = XCreateGC(XtDisplay(new),
- RootWindow(XtDisplay(new),
+ new->bitmap.drawing_gc = XCreateGC(XtDisplay(new),
+ RootWindow(XtDisplay(new),
DefaultScreen(XtDisplay(new))),
mask, &values);
@@ -847,9 +847,9 @@ Initialize(Widget wrequest, Widget wnew, ArgList argv, Cardinal *argc)
}
values.fill_style = (new->bitmap.stippled ? FillStippled : FillSolid);
- new->bitmap.highlighting_gc = XCreateGC(XtDisplay(new),
- RootWindow(XtDisplay(new),
- DefaultScreen(XtDisplay(new))),
+ new->bitmap.highlighting_gc = XCreateGC(XtDisplay(new),
+ RootWindow(XtDisplay(new),
+ DefaultScreen(XtDisplay(new))),
mask, &values);
@@ -864,8 +864,8 @@ Initialize(Widget wrequest, Widget wnew, ArgList argv, Cardinal *argc)
}
values.fill_style = (new->bitmap.dashed ? FillStippled : FillSolid);
- new->bitmap.frame_gc = XCreateGC(XtDisplay(new),
- RootWindow(XtDisplay(new),
+ new->bitmap.frame_gc = XCreateGC(XtDisplay(new),
+ RootWindow(XtDisplay(new),
DefaultScreen(XtDisplay(new))),
mask, &values);
@@ -873,23 +873,23 @@ Initialize(Widget wrequest, Widget wnew, ArgList argv, Cardinal *argc)
values.background = new->core.background_pixel;
values.foreground ^= values.background;
mask = GCForeground | GCBackground | GCFunction;
- new->bitmap.axes_gc = XCreateGC(XtDisplay(new),
- RootWindow(XtDisplay(new),
+ new->bitmap.axes_gc = XCreateGC(XtDisplay(new),
+ RootWindow(XtDisplay(new),
DefaultScreen(XtDisplay(new))),
mask, &values);
- image_data = CreateCleanData(Length(new->bitmap.width,
+ image_data = CreateCleanData(Length(new->bitmap.width,
new->bitmap.height));
- buffer_data = CreateCleanData(Length(new->bitmap.width,
+ buffer_data = CreateCleanData(Length(new->bitmap.width,
new->bitmap.height));
new->bitmap.storage = NULL;
-
- new->bitmap.image = CreateBitmapImage(new,
+
+ new->bitmap.image = CreateBitmapImage(new,
image_data,
new->bitmap.width,
new->bitmap.height);
- new->bitmap.buffer = CreateBitmapImage(new,
+ new->bitmap.buffer = CreateBitmapImage(new,
buffer_data,
new->bitmap.width,
new->bitmap.height);
@@ -902,36 +902,36 @@ Initialize(Widget wrequest, Widget wnew, ArgList argv, Cardinal *argc)
char *buffer_data;
unsigned int width, height;
int x_hot, y_hot;
-
- status = XmuReadBitmapDataFromFile(new->bitmap.filename,
+
+ status = XmuReadBitmapDataFromFile(new->bitmap.filename,
&width, &height, &image_data,
&x_hot, &y_hot);
if (status == BitmapSuccess) {
-
+
buffer_data = CreateCleanData(Length(width, height));
-
+
image = CreateBitmapImage(new, (char *)image_data, width, height);
buffer = CreateBitmapImage(new, buffer_data, width, height);
-
+
TransferImageData(new->bitmap.image, buffer);
-
+
DestroyBitmapImage(&new->bitmap.image);
DestroyBitmapImage(&new->bitmap.buffer);
-
+
new->bitmap.image = image;
new->bitmap.buffer = buffer;
new->bitmap.width = width;
new->bitmap.height = height;
-
+
new->bitmap.hot.x = x_hot;
new->bitmap.hot.y = y_hot;
-
+
new->bitmap.changed = False;
new->bitmap.zooming = False;
}
new->bitmap.filename = XtNewString(new->bitmap.filename);
-
+
if (!strcmp(new->bitmap.basename, "")) {
new->bitmap.basename = StripFilename(new->bitmap.filename);
}
@@ -944,7 +944,7 @@ Initialize(Widget wrequest, Widget wnew, ArgList argv, Cardinal *argc)
/* returns False if the format is wrong */
-Boolean
+Boolean
BWParseSize(String size, Dimension *width, Dimension *height)
{
int x, y;
@@ -963,7 +963,7 @@ BWParseSize(String size, Dimension *width, Dimension *height)
}
-Boolean
+Boolean
BWQueryMarked(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -971,30 +971,30 @@ BWQueryMarked(Widget w)
return QuerySet(BW->bitmap.mark.from_x, BW->bitmap.mark.from_y);
}
-static void
+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,
+ BW->bitmap.mark.from_x = min(BW->bitmap.mark.from_x,
BW->bitmap.image->width);
- BW->bitmap.mark.from_y = min(BW->bitmap.mark.from_y,
+ BW->bitmap.mark.from_y = min(BW->bitmap.mark.from_y,
BW->bitmap.image->height);
- BW->bitmap.mark.to_x = min(BW->bitmap.mark.to_x,
+ BW->bitmap.mark.to_x = min(BW->bitmap.mark.to_x,
BW->bitmap.image->width);
- BW->bitmap.mark.to_y = min(BW->bitmap.mark.to_y,
+ BW->bitmap.mark.to_y = min(BW->bitmap.mark.to_y,
BW->bitmap.image->height);
-
+
if((BW->bitmap.mark.from_x == BW->bitmap.mark.from_y) &&
(BW->bitmap.mark.to_x == BW->bitmap.mark.to_y))
- BW->bitmap.mark.from_x =
+ BW->bitmap.mark.from_x =
BW->bitmap.mark.from_y =
- BW->bitmap.mark.to_x =
+ BW->bitmap.mark.to_x =
BW->bitmap.mark.to_y = NotSet;
}
}
/* ARGSUSED */
-int
+int
BWStoreFile(Widget w, _Xconst _XtString filename, _Xconst _XtString *basename)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -1002,28 +1002,28 @@ BWStoreFile(Widget w, _Xconst _XtString filename, _Xconst _XtString *basename)
unsigned char *storage_data;
unsigned int width, height;
int x_hot, y_hot;
-
+
status = XmuReadBitmapDataFromFile(filename, &width, &height,
&storage_data, &x_hot, &y_hot);
if (status == BitmapSuccess) {
DestroyBitmapImage(&BW->bitmap.storage);
-
+
BW->bitmap.storage = CreateBitmapImage(BW, (char *)storage_data, width, height);
return BitmapSuccess;
}
else
XtWarning(" read file failed. BitmapWidget");
-
+
return status;
}
-String
+String
BWUnparseStatus(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
-
+
snprintf(BW->bitmap.status, sizeof(BW->bitmap.status),
"Filename: %s Basename: %s Size: %dx%d",
(strcmp(BW->bitmap.filename, "") ? BW->bitmap.filename : "<none>"),
@@ -1033,22 +1033,22 @@ BWUnparseStatus(Widget w)
return BW->bitmap.status;
}
-void
+void
BWChangeFilename(Widget w, _Xconst _XtString str)
{
BitmapWidget BW = (BitmapWidget) w;
-
+
if (str) {
XtFree(BW->bitmap.filename);
BW->bitmap.filename = XtNewString( str);
}
}
-void
+void
BWChangeBasename(Widget w, _Xconst _XtString str)
{
BitmapWidget BW = (BitmapWidget) w;
-
+
if (str) {
XtFree(BW->bitmap.basename);
BW->bitmap.basename = XtNewString(str);
@@ -1056,7 +1056,7 @@ BWChangeBasename(Widget w, _Xconst _XtString str)
}
-int
+int
BWReadFile(Widget w, _Xconst _XtString filename, _Xconst _XtString basename) /* ARGSUSED */
{
BitmapWidget BW = (BitmapWidget) w;
@@ -1066,94 +1066,94 @@ BWReadFile(Widget w, _Xconst _XtString filename, _Xconst _XtString basename) /*
char *buffer_data;
unsigned int width, height;
int x_hot, y_hot;
-
+
if (!filename)
filename = BW->bitmap.filename;
status = XmuReadBitmapDataFromFile(filename, &width, &height, &image_data,
&x_hot, &y_hot);
if (status == BitmapSuccess) {
-
+
buffer_data = CreateCleanData(Length(width, height));
-
+
image = CreateBitmapImage(BW, (char *)image_data, width, height);
buffer = CreateBitmapImage(BW, buffer_data, width, height);
-
+
TransferImageData(BW->bitmap.image, buffer);
-
+
DestroyBitmapImage(&BW->bitmap.image);
DestroyBitmapImage(&BW->bitmap.buffer);
-
+
BW->bitmap.image = image;
BW->bitmap.buffer = buffer;
BW->bitmap.width = width;
BW->bitmap.height = height;
-
+
BW->bitmap.hot.x = x_hot;
BW->bitmap.hot.y = y_hot;
-
+
BW->bitmap.changed = False;
BW->bitmap.zooming = False;
-
+
XtFree(BW->bitmap.filename);
BW->bitmap.filename = XtNewString(filename);
XtFree(BW->bitmap.basename);
BW->bitmap.basename= XtNewString(StripFilename(filename));
BWUnmark(w);
-
+
Resize((Widget)BW);
if (BW->core.visible) {
XClearArea(XtDisplay(BW), XtWindow(BW),
- 0, 0,
+ 0, 0,
BW->core.width, BW->core.height,
True);
}
-
+
return BitmapSuccess;
}
else
XtWarning(" read file failed. BitmapWidget");
-
+
return status;
}
#if 0
-void
+void
BWSetImage(Widget w, XImage *image)
{
BitmapWidget BW = (BitmapWidget) w;
XImage *buffer;
char *buffer_data;
-
+
buffer_data = CreateCleanData(Length(image->width, image->height));
- buffer = CreateBitmapImage(BW, buffer_data,
- (Dimension) image->width,
+ buffer = CreateBitmapImage(BW, buffer_data,
+ (Dimension) image->width,
(Dimension) image->height);
-
+
TransferImageData(BW->bitmap.image, buffer);
-
+
DestroyBitmapImage(&BW->bitmap.image);
DestroyBitmapImage(&BW->bitmap.buffer);
-
+
BW->bitmap.image = image;
BW->bitmap.buffer = buffer;
BW->bitmap.width = image->width;
BW->bitmap.height = image->height;
-
+
Resize((Widget)BW);
-
+
if (BW->core.visible) {
XClearArea(XtDisplay(BW), XtWindow(BW),
- 0, 0,
+ 0, 0,
BW->core.width, BW->core.height,
- True);
+ True);
}
}
#endif
-int
+int
BWWriteFile(Widget w, _Xconst _XtString filename, _Xconst _XtString basename)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -1161,22 +1161,22 @@ BWWriteFile(Widget w, _Xconst _XtString filename, _Xconst _XtString basename)
XImage *image;
XPoint hot;
int status;
-
+
if (BW->bitmap.zooming) {
- data = XtMalloc(Length(BW->bitmap.zoom.image->width,
+ data = XtMalloc(Length(BW->bitmap.zoom.image->width,
BW->bitmap.zoom.image->height));
- memmove( data, BW->bitmap.zoom.image->data,
- Length(BW->bitmap.zoom.image->width,
+ memmove( data, BW->bitmap.zoom.image->data,
+ Length(BW->bitmap.zoom.image->width,
BW->bitmap.zoom.image->height));
image = CreateBitmapImage(BW, data,
(Dimension) BW->bitmap.zoom.image->width,
(Dimension) BW->bitmap.zoom.image->height);
- CopyImageData(BW->bitmap.image, image,
- 0, 0,
+ CopyImageData(BW->bitmap.image, image,
+ 0, 0,
BW->bitmap.image->width - 1,
BW->bitmap.image->height - 1,
BW->bitmap.zoom.at_x, BW->bitmap.zoom.at_y);
-
+
if (QuerySet(BW->bitmap.hot.x, BW->bitmap.hot.y)) {
hot.x = BW->bitmap.hot.x + BW->bitmap.zoom.at_x;
hot.y = BW->bitmap.hot.y + BW->bitmap.zoom.at_y;
@@ -1188,7 +1188,7 @@ BWWriteFile(Widget w, _Xconst _XtString filename, _Xconst _XtString basename)
image = BW->bitmap.image;
hot = BW->bitmap.hot;
}
-
+
if (!filename) filename = BW->bitmap.filename;
else {
XtFree(BW->bitmap.filename);
@@ -1210,24 +1210,24 @@ BWWriteFile(Widget w, _Xconst _XtString filename, _Xconst _XtString basename)
hot.x, hot.y);
if (BW->bitmap.zooming)
DestroyBitmapImage(&image);
-
+
if (status == BitmapSuccess)
BW->bitmap.changed = False;
-
+
return status;
}
-String
+String
BWGetFilename(Widget w, String *str)
{
BitmapWidget BW = (BitmapWidget) w;
-
+
*str = XtNewString(BW->bitmap.filename);
return *str;
}
-String
+String
BWGetFilepath(Widget w, String *str)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -1238,42 +1238,42 @@ BWGetFilepath(Widget w, String *str)
if (end)
*(end + 1) = '\0';
- else
+ else
**str = '\0';
return *str;
}
-String
+String
BWGetBasename(Widget w, String *str)
{
BitmapWidget BW = (BitmapWidget) w;
-
+
*str = XtNewString(BW->bitmap.basename);
return *str;
}
-static void
+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;
}
-static void
+static void
ZoomOut(BitmapWidget BW)
{
- CopyImageData(BW->bitmap.image, BW->bitmap.zoom.image,
- 0, 0,
+ CopyImageData(BW->bitmap.image, BW->bitmap.zoom.image,
+ 0, 0,
BW->bitmap.image->width - 1,
BW->bitmap.image->height - 1,
BW->bitmap.zoom.at_x, BW->bitmap.zoom.at_y);
-
+
DestroyBitmapImage(&BW->bitmap.image);
DestroyBitmapImage(&BW->bitmap.buffer);
-
+
BW->bitmap.image = BW->bitmap.zoom.image;
BW->bitmap.buffer = BW->bitmap.zoom.buffer;
BW->bitmap.width = BW->bitmap.image->width;
@@ -1288,62 +1288,62 @@ ZoomOut(BitmapWidget BW)
}
else
BW->bitmap.hot = BW->bitmap.zoom.hot;
-
+
BW->bitmap.mark.from_x = NotSet;
BW->bitmap.mark.from_y = NotSet;
BW->bitmap.mark.to_x = NotSet;
BW->bitmap.mark.to_y = NotSet;
BW->bitmap.zooming = False;
-}
+}
-void
+void
BWZoomOut(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
-
+
if (BW->bitmap.zooming) {
ZoomOut(BW);
-
+
Resize((Widget)BW);
if (BW->core.visible)
XClearArea(XtDisplay(BW), XtWindow(BW),
- 0, 0,
+ 0, 0,
BW->core.width, BW->core.height,
True);
}
}
-void
+void
BWZoomMarked(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
- BWZoomIn(w,
+ BWZoomIn(w,
BW->bitmap.mark.from_x, BW->bitmap.mark.from_y,
BW->bitmap.mark.to_x, BW->bitmap.mark.to_y);
}
-void
-BWZoomIn(Widget w,
- Position from_x, Position from_y,
+void
+BWZoomIn(Widget w,
+ Position from_x, Position from_y,
Position to_x, Position to_y)
{
BitmapWidget BW = (BitmapWidget) w;
- XImage *image, *buffer;
+ XImage *image, *buffer;
Dimension width, height;
char *image_data, *buffer_data;
-
+
if (BW->bitmap.zooming)
ZoomOut(BW);
-
+
QuerySwap(from_x, to_x);
QuerySwap(from_y, to_y);
from_x = max(0, from_x);
from_y = max(0, from_y);
to_x = min(BW->bitmap.width - 1, to_x);
to_y = min(BW->bitmap.height - 1, to_y);
-
+
width = to_x - from_x + 1;
height = to_y - from_y + 1;
@@ -1355,7 +1355,7 @@ BWZoomIn(Widget w,
CopyImageData(BW->bitmap.image, image, from_x, from_y, to_x, to_y, 0, 0);
CopyImageData(BW->bitmap.buffer, buffer, from_x, from_y, to_x, to_y, 0, 0);
-
+
BW->bitmap.zoom.image = BW->bitmap.image;
BW->bitmap.zoom.buffer = BW->bitmap.buffer;
BW->bitmap.zoom.at_x = from_x;
@@ -1384,13 +1384,13 @@ BWZoomIn(Widget w,
Resize((Widget)BW);
if (BW->core.visible)
XClearArea(XtDisplay(BW), XtWindow(BW),
- 0, 0,
+ 0, 0,
BW->core.width, BW->core.height,
True);
}
-void
+void
BWRescale(Widget w, Dimension width, Dimension height)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -1399,38 +1399,38 @@ BWRescale(Widget w, Dimension width, Dimension height)
if (BW->bitmap.zooming)
ZoomOut(BW);
-
- image = ScaleBitmapImage(BW, BW->bitmap.image,
+
+ image = ScaleBitmapImage(BW, BW->bitmap.image,
(double) width / (double) BW->bitmap.image->width,
(double) height / (double) BW->bitmap.image->height);
buffer_data = CreateCleanData(Length(image->width, image->height));
- buffer = CreateBitmapImage(BW, buffer_data,
- (Dimension) image->width,
+ buffer = CreateBitmapImage(BW, buffer_data,
+ (Dimension) image->width,
(Dimension) image->height);
-
+
TransferImageData(BW->bitmap.buffer, buffer);
DestroyBitmapImage(&BW->bitmap.image);
DestroyBitmapImage(&BW->bitmap.buffer);
-
+
BW->bitmap.image = image;
BW->bitmap.buffer = buffer;
BW->bitmap.width = image->width;
BW->bitmap.height = image->height;
-
+
FixHotSpot(BW);
FixMark(BW);
Resize((Widget)BW);
if (BW->core.visible)
XClearArea(XtDisplay(BW), XtWindow(BW),
- 0, 0,
+ 0, 0,
BW->core.width, BW->core.height,
True);
}
-Boolean
+Boolean
BWQueryZooming(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -1439,37 +1439,37 @@ BWQueryZooming(Widget w)
}
-static void
+static void
ResizeGrid(BitmapWidget BW, Dimension width, Dimension height)
{
XImage *image, *buffer;
char *image_data, *buffer_data;
-
+
if (BW->bitmap.zooming)
ZoomOut(BW);
-
+
image_data = CreateCleanData(Length(width, height));
buffer_data = CreateCleanData(Length(width, height));
-
+
image = CreateBitmapImage(BW, image_data, width, height);
buffer = CreateBitmapImage(BW, buffer_data, width, height);
-
+
TransferImageData(BW->bitmap.image, image);
TransferImageData(BW->bitmap.buffer, buffer);
-
+
DestroyBitmapImage(&BW->bitmap.image);
DestroyBitmapImage(&BW->bitmap.buffer);
-
+
BW->bitmap.image = image;
BW->bitmap.buffer = buffer;
BW->bitmap.width = width;
BW->bitmap.height = height;
-
+
FixHotSpot(BW);
FixMark(BW);
}
-void
+void
BWResize(Widget w, Dimension width, Dimension height)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -1479,12 +1479,12 @@ BWResize(Widget w, Dimension width, Dimension height)
Resize((Widget)BW);
if (BW->core.visible)
XClearArea(XtDisplay(BW), XtWindow(BW),
- 0, 0,
+ 0, 0,
BW->core.width, BW->core.height,
True);
}
-static void
+static void
Destroy(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -1500,16 +1500,16 @@ Destroy(Widget w)
}
-static void
+static void
Resize(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
Dimension squareW, squareH;
- squareW = max(1, ((int)BW->core.width - 2 * (int)BW->bitmap.margin) /
+ squareW = max(1, ((int)BW->core.width - 2 * (int)BW->bitmap.margin) /
(int)BW->bitmap.width);
- squareH = max(1, ((int)BW->core.height - 2 * (int)BW->bitmap.margin) /
+ squareH = max(1, ((int)BW->core.height - 2 * (int)BW->bitmap.margin) /
(int)BW->bitmap.height);
if (BW->bitmap.proportional)
@@ -1518,22 +1518,22 @@ Resize(Widget w)
BW->bitmap.squareW = squareW;
BW->bitmap.squareH = squareH;
}
-
- BW->bitmap.horizOffset = max((Position)BW->bitmap.margin,
- (Position)(BW->core.width -
- BW->bitmap.width *
+
+ BW->bitmap.horizOffset = max((Position)BW->bitmap.margin,
+ (Position)(BW->core.width -
+ BW->bitmap.width *
BW->bitmap.squareW) / 2);
- BW->bitmap.vertOffset = max((Position)BW->bitmap.margin,
- (Position)(BW->core.height -
- BW->bitmap.height *
+ BW->bitmap.vertOffset = max((Position)BW->bitmap.margin,
+ (Position)(BW->core.height -
+ BW->bitmap.height *
BW->bitmap.squareH) / 2);
- BW->bitmap.grid &= ((BW->bitmap.squareW > BW->bitmap.grid_tolerance) &&
+ BW->bitmap.grid &= ((BW->bitmap.squareW > BW->bitmap.grid_tolerance) &&
(BW->bitmap.squareH > BW->bitmap.grid_tolerance));
}
/* ARGSUSED */
-static void
+static void
Redisplay(Widget w, XEvent *event, Region region)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -1542,19 +1542,19 @@ Redisplay(Widget w, XEvent *event, Region region)
&&
BW->core.visible)
if (BW->bitmap.stipple_change_expose_event == False)
- Refresh(BW,
+ Refresh(BW,
event->xexpose.x, event->xexpose.y,
event->xexpose.width, event->xexpose.height);
}
-void
+void
BWClip(Widget w, Position x, Position y, Dimension width, Dimension height)
{
Position from_x, from_y,
to_x, to_y;
BitmapWidget BW = (BitmapWidget) w;
XRectangle rectangle;
-
+
from_x = InBitmapX(BW, x);
from_y = InBitmapY(BW, y);
to_x = InBitmapX(BW, x + width);
@@ -1592,12 +1592,12 @@ BWClip(Widget w, Position x, Position y, Dimension width, Dimension height)
Unsorted);
}
-void
+void
BWUnclip(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
XRectangle rectangle;
-
+
rectangle.x = InWindowX(BW, 0);
rectangle.y = InWindowY(BW, 0);
rectangle.width = InWindowX(BW, BW->bitmap.width) - InWindowX(BW, 0);
@@ -1624,8 +1624,8 @@ BWUnclip(Widget w)
Unsorted);
}
-static void
-Refresh(BitmapWidget BW, Position x, Position y,
+static void
+Refresh(BitmapWidget BW, Position x, Position y,
Dimension width, Dimension height)
{
XRectangle rectangle;
@@ -1636,7 +1636,7 @@ Refresh(BitmapWidget BW, Position x, Position y,
InWindowX(BW, InBitmapX(BW, x + width)+1)) - rectangle.x;
rectangle.height = max(y + height,
InWindowY(BW, InBitmapY(BW, y + height)+1)) - rectangle.y;
-
+
XClearArea(XtDisplay(BW), XtWindow(BW),
rectangle.x, rectangle.y,
rectangle.width, rectangle.height,
@@ -1651,7 +1651,7 @@ Refresh(BitmapWidget BW, Position x, Position y,
XDrawRectangle(XtDisplay(BW), XtWindow(BW),
BW->bitmap.frame_gc,
InWindowX(BW, 0) - 1, InWindowY(BW, 0) - 1,
- InWindowX(BW, BW->bitmap.width) - InWindowX(BW, 0) + 1,
+ InWindowX(BW, BW->bitmap.width) - InWindowX(BW, 0) + 1,
InWindowY(BW, BW->bitmap.height) - InWindowY(BW, 0) + 1);
BWClip((Widget) BW, x, y, width, height);
@@ -1666,7 +1666,7 @@ Refresh(BitmapWidget BW, Position x, Position y,
BWUnclip((Widget) BW);
}
-Boolean
+Boolean
BWQueryGrid(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -1674,7 +1674,7 @@ BWQueryGrid(Widget w)
return BW->bitmap.grid;
}
-void
+void
BWSwitchGrid(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -1684,16 +1684,16 @@ BWSwitchGrid(Widget w)
BW->bitmap.image->width - 1, BW->bitmap.image->height - 1);
}
-void
+void
BWGrid(Widget w, Boolean _switch)
{
BitmapWidget BW = (BitmapWidget) w;
-
+
if (BW->bitmap.grid != _switch)
BWSwitchGrid(w);
}
-Boolean
+Boolean
BWQueryDashed(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -1701,7 +1701,7 @@ BWQueryDashed(Widget w)
return (BW->bitmap.dashed);
}
-void
+void
BWSwitchDashed(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -1723,35 +1723,35 @@ BWSwitchDashed(Widget w)
XDrawRectangle(XtDisplay(BW), XtWindow(BW),
BW->bitmap.frame_gc,
InWindowX(BW, 0) - 1, InWindowY(BW, 0) - 1,
- InWindowX(BW, BW->bitmap.width) - InWindowX(BW, 0) + 1,
+ InWindowX(BW, BW->bitmap.width) - InWindowX(BW, 0) + 1,
InWindowY(BW, BW->bitmap.height) - InWindowY(BW, 0) + 1);
-
+
BW->bitmap.dashed ^= True;
XSetFillStyle(XtDisplay(BW), BW->bitmap.frame_gc,
(BW->bitmap.dashed ? FillStippled : FillSolid));
-
+
XDrawRectangle(XtDisplay(BW), XtWindow(BW),
BW->bitmap.frame_gc,
InWindowX(BW, 0) - 1, InWindowY(BW, 0) - 1,
- InWindowX(BW, BW->bitmap.width) - InWindowX(BW, 0) + 1,
+ InWindowX(BW, BW->bitmap.width) - InWindowX(BW, 0) + 1,
InWindowY(BW, BW->bitmap.height) - InWindowY(BW, 0) + 1);
BWUnclip(w);
-
+
BWRedrawGrid(w, 0, 0, BW->bitmap.width - 1, BW->bitmap.height - 1);
}
-void
+void
BWDashed(Widget w, Boolean _switch)
{
BitmapWidget BW = (BitmapWidget) w;
-
+
if (BW->bitmap.dashed != _switch)
BWSwitchDashed(w);
}
-static Boolean
-SetValues(Widget old, Widget request, Widget new,
+static Boolean
+SetValues(Widget old, Widget request, Widget new,
ArgList args, Cardinal *num_args) /* ARGSUSED */
{
BitmapWidget oldbw = (BitmapWidget) old;
@@ -1784,7 +1784,7 @@ SetValues(Widget old, Widget request, Widget new,
XtFree(oldbw->bitmap.filename);
newbw->bitmap.filename = XtNewString(newbw->bitmap.filename);
}
- else
+ else
newbw->bitmap.filename = oldbw->bitmap.filename;
}
@@ -1793,20 +1793,20 @@ SetValues(Widget old, Widget request, Widget new,
XtFree(oldbw->bitmap.basename);
newbw->bitmap.basename = XtNewString(newbw->bitmap.basename);
}
- else
+ else
newbw->bitmap.basename = oldbw->bitmap.basename;
}
-
+
if (NE(bitmap.size)) {
Dimension width, height;
-
- if (BWParseSize(newbw->bitmap.size, &width, &height)) {
+
+ if (BWParseSize(newbw->bitmap.size, &width, &height)) {
ResizeGrid(newbw, width, height);
resize = True;
}
}
-
- if (NE(bitmap.margin) ||
+
+ if (NE(bitmap.margin) ||
NE(bitmap.grid_tolerance) ||
NE(bitmap.squareW) ||
NE(bitmap.squareH) ||
@@ -1816,21 +1816,21 @@ SetValues(Widget old, Widget request, Widget new,
if (NE(bitmap.hot.x) || NE(bitmap.hot.y))
BWSetHotSpot(old, newbw->bitmap.hot.x, newbw->bitmap.hot.y);
-
+
if (NE(bitmap.foreground_pixel) || NE(core.background_pixel)) {
- XSetForeground(XtDisplay(new),
+ XSetForeground(XtDisplay(new),
newbw->bitmap.drawing_gc,
- newbw->bitmap.foreground_pixel
- ^
+ newbw->bitmap.foreground_pixel
+ ^
newbw->core.background_pixel);
redisplay = True;
}
if (NE(bitmap.frame_pixel) || NE(core.background_pixel)) {
- XSetForeground(XtDisplay(new),
+ XSetForeground(XtDisplay(new),
newbw->bitmap.frame_gc,
newbw->bitmap.frame_pixel
- ^
+ ^
newbw->core.background_pixel);
redisplay = True;
}
@@ -1844,14 +1844,14 @@ SetValues(Widget old, Widget request, Widget new,
if (NE(bitmap.highlight_pixel) || NE(core.background_pixel)) {
RedrawStippled(newbw);
- XSetForeground(XtDisplay(new),
+ XSetForeground(XtDisplay(new),
newbw->bitmap.highlighting_gc,
newbw->bitmap.highlight_pixel
- ^
+ ^
newbw->core.background_pixel);
RedrawStippled(newbw);
}
-
+
if (NE(bitmap.stipple)) {
RedrawStippled(newbw);
XSetStipple(XtDisplay(new),
@@ -1859,7 +1859,7 @@ SetValues(Widget old, Widget request, Widget new,
newbw->bitmap.stipple);
RedrawStippled(newbw);
}
-
+
if (resize) Resize((Widget)newbw);
return (redisplay || resize);
@@ -1867,7 +1867,7 @@ SetValues(Widget old, Widget request, Widget new,
#undef NE
}
-Boolean
+Boolean
BWQueryProportional(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -1875,7 +1875,7 @@ BWQueryProportional(Widget w)
return (BW->bitmap.proportional);
}
-void
+void
BWSwitchProportional(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -1885,13 +1885,13 @@ BWSwitchProportional(Widget w)
Resize((Widget)BW);
if (BW->core.visible)
XClearArea(XtDisplay(BW), XtWindow(BW),
- 0, 0,
+ 0, 0,
BW->core.width, BW->core.height,
True);
}
#if 0
-void
+void
BWProportional(Widget w, Boolean _switch)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -1901,7 +1901,7 @@ BWProportional(Widget w, Boolean _switch)
}
#endif
-void
+void
BWTPaste(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -1910,16 +1910,16 @@ BWTPaste(Widget w, XEvent *event, String *params, Cardinal *num_params)
if (!BWQueryStored(w))
return;
-
- BWEngageRequest(w, RestoreRequest, False,
+
+ BWEngageRequest(w, RestoreRequest, False,
(char *)&(event->xbutton.state), sizeof(int));
-
+
OnePointHandler(w,
(BWStatus*) BW->bitmap.request_stack[BW->bitmap.current].status,
event, NULL);
}
-void
+void
BWTMark(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -1932,7 +1932,7 @@ BWTMark(Widget w, XEvent *event, String *params, Cardinal *num_params)
}
-void
+void
BWTMarkAll(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
BWMarkAll(w);
@@ -1940,7 +1940,7 @@ BWTMarkAll(Widget w, XEvent *event, String *params, Cardinal *num_params)
BWGrabSelection(w, event->xkey.time);
}
-void
+void
BWTUnmark(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
BWUnmark(w);
diff --git a/Bitmap.h b/Bitmap.h
index 73c3939..611f0e0 100644
--- a/Bitmap.h
+++ b/Bitmap.h
@@ -45,7 +45,7 @@ from The Open Group.
/* Resources:
Name Class RepType Default Value
- ---- ----- ------- -------------
+ ---- ----- ------- -------------
background Background Pixel XtDefaultBackground
foreground Foredround Pixel XtDefaultForeground
highlight Highlight Pixel XtDefaultForeground
@@ -73,7 +73,7 @@ from The Open Group.
stipple Stipple Bitmap XtUnspecifiedPixmap
proportional Proportional Boolean True
axes Axes Boolean True
- button1Function Button1Function ButtonFunction Set
+ button1Function Button1Function ButtonFunction Set
button2Function Button2Function ButtonFunction Invert
button3Function Button3Function ButtonFunction Clear
button4Function Button4Function ButtonFunction Invert
@@ -187,7 +187,7 @@ typedef struct _BitmapRec *BitmapWidget;
extern WidgetClass bitmapWidgetClass;
-extern Boolean BWEngageRequest(Widget w, BWRequest name, Boolean trap,
+extern Boolean BWEngageRequest(Widget w, BWRequest name, Boolean trap,
XtPointer call_data, Cardinal call_data_size);
extern Boolean BWTerminateRequest(Widget w, Boolean cont);
diff --git a/BitmapP.h b/BitmapP.h
index 7957f23..08e4c65 100644
--- a/BitmapP.h
+++ b/BitmapP.h
@@ -47,7 +47,7 @@ typedef struct {
BWRequestRec *requests;
Cardinal num_requests;
BWRequestRec *request[100];
-
+
} BitmapClassPart;
/* Full class record declaration */
@@ -160,18 +160,18 @@ typedef struct _BitmapRec {
(Position)(min((Position)((Dimension)(max(BW->bitmap.horizOffset,x) -\
BW->bitmap.horizOffset) /\
BW->bitmap.squareW), BW->bitmap.width - 1))
-
+
#define InBitmapY(BW, y)\
(Position)(min((Position)((Dimension)(max(BW->bitmap.vertOffset, y) -\
BW->bitmap.vertOffset) /\
BW->bitmap.squareH), BW->bitmap.height - 1))
-
+
#define InWindowX(BW, x)\
(Position) (BW->bitmap.horizOffset + ((x) * BW->bitmap.squareW))
#define InWindowY(BW, y)\
(Position) (BW->bitmap.vertOffset + ((y) * BW->bitmap.squareH))
-
+
#define GetPixmap(BW, image)\
XCreateBitmapFromData(XtDisplay(BW), XtWindow(BW),\
image->data, image->width, image->height)
@@ -197,13 +197,13 @@ typedef struct _BitmapRec {
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,
+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,
+XImage *ScaleBitmapImage(BitmapWidget BW, XImage *src,
double scale_x, double scale_y);
extern Boolean DEBUG;
diff --git a/CutPaste.c b/CutPaste.c
index 3a200ee..49d6f9c 100644
--- a/CutPaste.c
+++ b/CutPaste.c
@@ -34,7 +34,7 @@ from The Open Group.
#include <X11/StringDefs.h>
#include <X11/Xatom.h>
#include "BitmapP.h"
-
+
#include <stdio.h>
#include <math.h>
@@ -48,8 +48,8 @@ from The Open Group.
*****************************************************************************/
/* ARGSUSED */
-static Boolean
-ConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type,
+static Boolean
+ConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type,
XtPointer *val_ret, unsigned long *length, int *format)
{
XPointer *value = (XPointer *)val_ret;
@@ -58,7 +58,7 @@ ConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type,
char *data;
XImage *image;
Dimension width, height;
-
+
switch (*target) {
/* XA_TARGETS undefined ?!?
@@ -79,7 +79,7 @@ ConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type,
height = BW->bitmap.mark.to_y - BW->bitmap.mark.from_y + 1;
data = CreateCleanData(Length(width, height));
image = CreateBitmapImage(BW, data, width, height);
- CopyImageData(BW->bitmap.image, image,
+ CopyImageData(BW->bitmap.image, image,
BW->bitmap.mark.from_x, BW->bitmap.mark.from_y,
BW->bitmap.mark.to_x, BW->bitmap.mark.to_y, 0, 0);
pixmap = (Pixmap *) XtMalloc(sizeof(Pixmap));
@@ -103,7 +103,7 @@ ConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type,
}
/* ARGSUSED */
-static void
+static void
LoseSelection(Widget w, Atom selection)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -116,12 +116,12 @@ LoseSelection(Widget w, Atom selection)
}
/* ARGSUSED */
-static void
+static void
SelectionDone(Widget w, Atom *selection, Atom *target)
{
/* Done Automatically ?!?
- BitmapWidget BW = (BitmapWidget) w;
+ BitmapWidget BW = (BitmapWidget) w;
if (*target != XA_TARGETS)
XtFree(BW->bitmap.value);
@@ -129,14 +129,14 @@ SelectionDone(Widget w, Atom *selection, Atom *target)
*/
}
-void
+void
BWGrabSelection(Widget w, Time btime)
{
BitmapWidget BW = (BitmapWidget) w;
BW->bitmap.selection.own = XtOwnSelection(w, XA_PRIMARY, btime,
- ConvertSelection,
- (XtLoseSelectionProc)LoseSelection,
+ ConvertSelection,
+ (XtLoseSelectionProc)LoseSelection,
SelectionDone);
if (DEBUG && BW->bitmap.selection.own)
fprintf(stderr, "Own the selection\n");
@@ -144,8 +144,8 @@ BWGrabSelection(Widget w, Time btime)
/* ARGSUSED */
-static void
-SelectionCallback(Widget w, XtPointer cldat, Atom *selection, Atom *type,
+static void
+SelectionCallback(Widget w, XtPointer cldat, Atom *selection, Atom *type,
XtPointer val, unsigned long *length, int *format)
{
XPointer value = (XPointer)val;
@@ -153,7 +153,7 @@ SelectionCallback(Widget w, XtPointer cldat, Atom *selection, Atom *type,
Pixmap *pixmap;
switch (*type) {
-
+
case XA_BITMAP:
case XA_PIXMAP:
DestroyBitmapImage(&BW->bitmap.storage);
@@ -161,7 +161,7 @@ SelectionCallback(Widget w, XtPointer cldat, Atom *selection, Atom *type,
BW->bitmap.storage = GetImage(BW, *pixmap);
XFree((char *)pixmap);
break;
-
+
default:
XtWarning(" selection request failed. BitmapWidget");
break;
@@ -170,19 +170,19 @@ SelectionCallback(Widget w, XtPointer cldat, Atom *selection, Atom *type,
BW->bitmap.selection.limbo = FALSE;
}
-void
+void
BWRequestSelection(Widget w, Time btime, Boolean wait)
{
BitmapWidget BW = (BitmapWidget) w;
-
+
if (BW->bitmap.selection.own)
BWStore(w);
else {
XtGetSelectionValue(w, XA_PRIMARY, XA_PIXMAP,
SelectionCallback, NULL, btime);
-
+
BW->bitmap.selection.limbo = TRUE;
-
+
if (wait)
while (BW->bitmap.selection.limbo) {
XEvent event;
@@ -194,7 +194,7 @@ BWRequestSelection(Widget w, Time btime, Boolean wait)
/* ARGSUSED */
/* Returns true if there is a transferable selection */
-Boolean
+Boolean
BWQuerySelection(Widget w, Time btime)
{
/* To be written. XA_TARGETS to be used. So far undefined ?!? */
diff --git a/Dialog.c b/Dialog.c
index 3cd525a..e2e3ac2 100644
--- a/Dialog.c
+++ b/Dialog.c
@@ -36,14 +36,14 @@ from The Open Group.
#include <X11/Xaw/Dialog.h>
#include <X11/Xaw/Command.h>
#include <X11/Xmu/CharSet.h>
-
+
#include "Dialog.h"
#define min(x, y) (((x) < (y)) ? (x) : (y))
#define max(x, y) (((x) > (y)) ? (x) : (y))
-static void SetDialogButton(Widget w, XEvent *event,
+static void SetDialogButton(Widget w, XEvent *event,
String *argv, Cardinal *argc);
static XtActionsRec actions_table[] = {
@@ -63,22 +63,22 @@ static DialogButton dialog_buttons[] = {
static unsigned long selected;
/* ARGSUSED */
-static void
+static void
SetSelected(Widget w, XtPointer clientData, XtPointer callData) /* ARGSUSED */
{
String name = (String)clientData;
int i;
-
- for (i = 0; i < XtNumber(dialog_buttons); i++)
- if (!strcmp(dialog_buttons[i].name, name))
+
+ for (i = 0; i < XtNumber(dialog_buttons); i++)
+ if (!strcmp(dialog_buttons[i].name, name))
selected |= dialog_buttons[i].flag;
}
/* ARGSUSED */
-static void
+static void
SetDialogButton(Widget w, /* not used */
XEvent *event, /* not used */
- String *argv,
+ String *argv,
Cardinal *argc)
{
char button_name[80];
@@ -93,7 +93,7 @@ SetDialogButton(Widget w, /* not used */
static Boolean firstTime = True;
-Dialog
+Dialog
CreateDialog(Widget top_widget, String name, unsigned long options)
{
int i;
@@ -107,17 +107,17 @@ CreateDialog(Widget top_widget, String name, unsigned long options)
firstTime = False;
}
popup->top_widget = top_widget;
- popup->shell_widget = XtCreatePopupShell(name,
- transientShellWidgetClass,
+ popup->shell_widget = XtCreatePopupShell(name,
+ transientShellWidgetClass,
top_widget, NULL, 0);
- popup->dialog_widget = XtCreateManagedWidget("dialog",
+ popup->dialog_widget = XtCreateManagedWidget("dialog",
dialogWidgetClass,
- popup->shell_widget,
+ popup->shell_widget,
NULL, 0);
for (i = 0; i < XtNumber(dialog_buttons); i++)
if (options & dialog_buttons[i].flag)
- XawDialogAddButton(popup->dialog_widget,
- dialog_buttons[i].name,
+ XawDialogAddButton(popup->dialog_widget,
+ dialog_buttons[i].name,
SetSelected, dialog_buttons[i].name);
popup->options = options;
return popup;
@@ -126,17 +126,17 @@ CreateDialog(Widget top_widget, String name, unsigned long options)
return NULL;
}
-void
+void
PopdownDialog(Dialog popup, String *answer)
{
if (answer)
*answer = XawDialogGetValueString(popup->dialog_widget);
-
+
XtPopdown(popup->shell_widget);
}
-unsigned long
-PopupDialog(Dialog popup, String message, String suggestion,
+unsigned long
+PopupDialog(Dialog popup, String message, String suggestion,
String *answer, XtGrabKind grab)
{
Position popup_x, popup_y, top_x, top_y;
@@ -164,14 +164,14 @@ PopupDialog(Dialog popup, String message, String suggestion,
XtSetArg(wargs[n], XtNborderWidth, &border_width); n++;
XtGetValues(popup->shell_widget, wargs, n);
- popup_x = max(0,
- min(top_x + ((Position)top_width - (Position)popup_width) / 2,
- (Position)DisplayWidth(XtDisplay(popup->shell_widget),
+ popup_x = max(0,
+ min(top_x + ((Position)top_width - (Position)popup_width) / 2,
+ (Position)DisplayWidth(XtDisplay(popup->shell_widget),
DefaultScreen(XtDisplay(popup->shell_widget))) -
(Position)popup_width - 2 * (Position)border_width));
- popup_y = max(0,
+ popup_y = max(0,
min(top_y + ((Position)top_height - (Position)popup_height) / 2,
- (Position)DisplayHeight(XtDisplay(popup->shell_widget),
+ (Position)DisplayHeight(XtDisplay(popup->shell_widget),
DefaultScreen(XtDisplay(popup->shell_widget))) -
(Position)popup_height - 2 * (Position)border_width));
n = 0;
@@ -182,9 +182,9 @@ PopupDialog(Dialog popup, String message, String suggestion,
selected = None;
XtPopup(popup->shell_widget, grab);
- XWarpPointer(XtDisplay(popup->shell_widget),
+ XWarpPointer(XtDisplay(popup->shell_widget),
XtWindow(popup->top_widget),
- XtWindow(popup->shell_widget),
+ XtWindow(popup->shell_widget),
0, 0, top_width, top_height,
popup_width / 2, popup_height / 2);
diff --git a/Graphics.c b/Graphics.c
index f09c41b..b3ec1bc 100644
--- a/Graphics.c
+++ b/Graphics.c
@@ -36,7 +36,7 @@ from The Open Group.
#include "BitmapP.h"
#include "Bitmap.h"
#include "Requests.h"
-
+
#include <stdio.h>
#include <math.h>
@@ -58,11 +58,11 @@ from The Open Group.
(1 << ((x) % 8))) ? 1 : 0))
#if 0
-bit
+bit
BWGetBit(Widget w, Position x, Position y)
{
BitmapWidget BW = (BitmapWidget) w;
-
+
if (QueryInBitmap(BW, x, y))
return GetBit(BW->bitmap.image, x, y);
else
@@ -90,7 +90,7 @@ BWGetBit(Widget w, Position x, Position y)
InWindowX(BW, x), InWindowY(BW, y),\
BW->bitmap.squareW, BW->bitmap.squareH)
/*
-void
+void
HighlightSquare(BitmapWidget BW, Position x, Position y)
{
XFillRectangle(XtDisplay(BW), XtWindow(BW),
@@ -104,10 +104,10 @@ HighlightSquare(BitmapWidget BW, Position x, Position y)
XFillRectangle(XtDisplay(BW), XtWindow(BW),\
BW->bitmap.drawing_gc,\
InWindowX(BW, x), InWindowY(BW, y),\
- BW->bitmap.squareW, BW->bitmap.squareH)
+ BW->bitmap.squareW, BW->bitmap.squareH)
/*
-void
+void
DrawSquare(BitmapWidget BW, Position x, Position y)
{
XFillRectangle(XtDisplay(BW), XtWindow(BW),
@@ -124,11 +124,11 @@ DrawSquare(BitmapWidget BW, Position x, Position y)
if (GetBit(BW->bitmap.image, x, y) != value)\
InvertPoint(BW, x, y)
-void
+void
BWDrawPoint(Widget w, Position x, Position y, bit value)
{
BitmapWidget BW = (BitmapWidget) w;
-
+
if (QueryInBitmap(BW, x, y)) {
if (value == Highlight)
HighlightSquare(BW, x, y);
@@ -141,7 +141,7 @@ static XPoint *
HotSpotShape(BitmapWidget BW, Position x, Position y)
{
static XPoint points[5];
-
+
points[0].x = InWindowX(BW, x);
points[0].y = InWindowY(BW, y + 1.0/2);
points[1].x = InWindowX(BW, x + 1.0/2);
@@ -152,7 +152,7 @@ HotSpotShape(BitmapWidget BW, Position x, Position y)
points[3].y = InWindowY(BW, y);
points[4].x = InWindowX(BW, x);
points[4].y = InWindowY(BW, y + 1.0/2);
-
+
return points;
}
@@ -169,7 +169,7 @@ XImage *CreateBitmapImage();
void DestroyBitmapImage();
*/
-void
+void
BWRedrawHotSpot(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -178,22 +178,22 @@ BWRedrawHotSpot(Widget w)
DrawHotSpot(BW, BW->bitmap.hot.x, BW->bitmap.hot.y);
}
-void
+void
BWClearHotSpot(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
-
+
if (QuerySet(BW->bitmap.hot.x, BW->bitmap.hot.y)) {
DrawHotSpot(BW, BW->bitmap.hot.x, BW->bitmap.hot.y);
BW->bitmap.hot.x = BW->bitmap.hot.y = NotSet;
}
}
-void
+void
BWDrawHotSpot(Widget w, Position x, Position y, int value)
{
BitmapWidget BW = (BitmapWidget) w;
-
+
if (QueryInBitmap(BW, x, y)) {
if (QuerySet(BW->bitmap.hot.x, BW->bitmap.hot.y) &&
((BW->bitmap.hot.x == x) && (BW->bitmap.hot.y == y))) {
@@ -208,13 +208,13 @@ BWDrawHotSpot(Widget w, Position x, Position y, int value)
BW->bitmap.hot.x = x;
BW->bitmap.hot.y = y;
}
-
+
if (value == Highlight)
- HighlightHotSpot(BW, x, y);
+ HighlightHotSpot(BW, x, y);
}
}
-void
+void
BWSetHotSpot(Widget w, Position x, Position y)
{
if (QuerySet(x, y))
@@ -225,9 +225,9 @@ BWSetHotSpot(Widget w, Position x, Position y)
/* high level procedures */
-void
-BWRedrawSquares(Widget w,
- Position x, Position y,
+void
+BWRedrawSquares(Widget w,
+ Position x, Position y,
Dimension width, Dimension height)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -242,44 +242,44 @@ BWRedrawSquares(Widget w,
from_y = max(0, from_y);
to_x = min(BW->bitmap.image->width - 1, to_x);
to_y = min(BW->bitmap.image->height - 1, to_y);
-
+
for (x = from_x; x <= to_x; x++)
for (y = from_y; y <= to_y; y++)
if (GetBit(BW->bitmap.image, x, y)) DrawSquare(BW, x, y);
}
-void
-BWDrawGrid(Widget w,
- Position from_x, Position from_y,
+void
+BWDrawGrid(Widget w,
+ Position from_x, Position from_y,
Position to_x, Position to_y)
{
BitmapWidget BW = (BitmapWidget) w;
int i;
-
+
QuerySwap(from_x, to_x);
QuerySwap(from_y, to_y);
from_x = max(0, from_x);
from_y = max(0, from_y);
to_x = min(BW->bitmap.image->width - 1, to_x);
to_y = min(BW->bitmap.image->height - 1, to_y);
-
+
for(i = from_x + (from_x == 0); i <= to_x; i++)
- XDrawLine(XtDisplay(BW), XtWindow(BW),
+ XDrawLine(XtDisplay(BW), XtWindow(BW),
BW->bitmap.frame_gc,
InWindowX(BW, i), InWindowY(BW, from_y),
InWindowX(BW, i), InWindowY(BW, to_y + 1));
-
+
for(i = from_y + (from_y == 0); i <= to_y; i++)
- XDrawLine(XtDisplay(BW), XtWindow(BW),
+ XDrawLine(XtDisplay(BW), XtWindow(BW),
BW->bitmap.frame_gc,
InWindowX(BW, from_x), InWindowY(BW, i),
InWindowX(BW, to_x + 1), InWindowY(BW, i));
}
-void
-BWRedrawGrid(Widget w,
- Position x, Position y,
+void
+BWRedrawGrid(Widget w,
+ Position x, Position y,
Dimension width, Dimension height)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -292,9 +292,9 @@ BWRedrawGrid(Widget w,
BWDrawGrid(w, from_x, from_y, to_x, to_y);
}
-void
-BWDrawLine(Widget w,
- Position from_x, Position from_y,
+void
+BWDrawLine(Widget w,
+ Position from_x, Position from_y,
Position to_x, Position to_y, int value)
{
Position i;
@@ -319,9 +319,9 @@ BWDrawLine(Widget w,
BWDrawPoint(w, from_x, from_y, value);
}
-void
-BWBlindLine(Widget w,
- Position from_x, Position from_y,
+void
+BWBlindLine(Widget w,
+ Position from_x, Position from_y,
Position to_x, Position to_y, int value)
{
Position i;
@@ -348,22 +348,22 @@ BWBlindLine(Widget w,
BWDrawPoint(w, from_x, from_y, value);
}
-void
-BWDrawRectangle(Widget w,
- Position from_x, Position from_y,
+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;
-
+
QuerySwap(from_x, to_x);
QuerySwap(from_y, to_y);
-
+
width = to_x - from_x;
height = to_y - from_y;
delta = max(width, height);
-
+
if (!QueryZero(width, height)) {
for (i = 0; (int)i < (int)delta; i++) {
if ((int)i < (int)width) {
@@ -377,35 +377,35 @@ BWDrawRectangle(Widget w,
}
}
else
- BWDrawLine(w,
- from_x, from_y,
+ BWDrawLine(w,
+ from_x, from_y,
to_x, to_y, value);
}
-
-void
-BWDrawFilledRectangle(Widget w,
- Position from_x, Position from_y,
+
+void
+BWDrawFilledRectangle(Widget w,
+ Position from_x, Position from_y,
Position to_x, Position to_y, int value)
{
register Position x, y;
QuerySwap(from_x, to_x);
QuerySwap(from_y, to_y);
-
+
for (x = from_x; x <= to_x; x++)
for (y = from_y; y <= to_y; y++)
BWDrawPoint(w, x, y, value);
}
-void
-BWDrawCircle(Widget w,
- Position origin_x, Position origin_y,
+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;
double radius;
-
+
dx = abs(point_x - origin_x);
dy = abs(point_y - origin_y);
radius = sqrt((double) ((int)dx * (int)dx + (int)dy * (int)dy));
@@ -434,19 +434,19 @@ BWDrawCircle(Widget w,
}
}
-void
-BWDrawFilledCircle(Widget w,
- Position origin_x, Position origin_y,
+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;
double radius;
-
+
dx = abs(point_x - origin_x);
dy = abs(point_y - origin_y);
radius = sqrt((double) ((int)dx * (int)dx + (int)dy * (int)dy));
- for(j = origin_x - (Position) floor(radius);
+ for(j = origin_x - (Position) floor(radius);
j <= origin_x + (Position) floor(radius); j++)
BWDrawPoint(w, j, origin_y, value);
for(i = 1; i <= (Position) floor(radius); i++) {
@@ -467,7 +467,7 @@ BWDrawFilledCircle(Widget w,
else InvertPoint(BW, x, y);}
/*
-static void
+static void
FloodLoop(BitmapWidget BW, Position x, Position y, int value)
{
if (QueryFlood(BW, x, y, value)) {
@@ -480,12 +480,12 @@ FloodLoop(BitmapWidget BW, Position x, Position y, int value)
}
*/
-static void
+static void
FloodLoop(BitmapWidget BW, Position x, Position y, int value)
{
Position save_x, save_y, x_left, x_right;
-
- if (QueryFlood(BW, x, y, value))
+
+ if (QueryFlood(BW, x, y, value))
Flood(BW, x, y, value)
@@ -511,28 +511,28 @@ FloodLoop(BitmapWidget BW, Position x, Position y, int value)
x = x_left;
y = save_y;
y++;
-
+
while (x <= x_right) {
Boolean flag = False;
Position x_enter;
-
+
while (QueryFlood(BW, x, y, value) && (x <= x_right)) {
flag = True;
x++;
}
-
+
if (flag) {
if ((x == x_right) && QueryFlood(BW, x, y, value))
FloodLoop(BW, x, y, value);
else
FloodLoop(BW, x - 1, y, value);
}
-
+
x_enter = x;
-
+
while (!QueryFlood(BW, x, y, value) && (x < x_right))
x++;
-
+
if (x == x_enter) x++;
}
@@ -543,29 +543,29 @@ FloodLoop(BitmapWidget BW, Position x, Position y, int value)
while (x <= x_right) {
Boolean flag = False;
Position x_enter;
-
+
while (QueryFlood(BW, x, y, value) && (x <= x_right)) {
flag = True;
x++;
}
-
+
if (flag) {
if ((x == x_right) && QueryFlood(BW, x, y, value))
FloodLoop(BW, x, y, value);
else
FloodLoop(BW, x - 1, y, value);
}
-
+
x_enter = x;
-
+
while (!QueryFlood(BW, x, y, value) && (x < x_right))
x++;
-
+
if (x == x_enter) x++;
}
}
-void
+void
BWFloodFill(Widget w, Position x, Position y, int value)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -576,7 +576,7 @@ BWFloodFill(Widget w, Position x, Position y, int value)
if (value == Invert)
FloodLoop(BW, x, y, (pixel ? Clear : Set));
else if (value != pixel)
- FloodLoop(BW, x, y, value);
+ FloodLoop(BW, x, y, value);
}
#define QueryHotInMark(BW)\
@@ -586,7 +586,7 @@ BWFloodFill(Widget w, Position x, Position y, int value)
(BW->bitmap.hot.y == max(BW->bitmap.mark.from_y,\
min(BW->bitmap.hot.y, BW->bitmap.mark.to_y))))
-void
+void
BWUp(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -609,12 +609,12 @@ BWUp(Widget w)
if ((to_y - from_y) == 0)
return;
-
+
for(x = from_x; x <= to_x; x++) {
first = up = GetBit(BW->bitmap.image, x, to_y);
for(y = to_y - 1; y >= from_y; y--) {
down = GetBit(BW->bitmap.image, x, y);
- if (up != down)
+ if (up != down)
InvertPoint(BW, x, y);
up =down;
}
@@ -627,12 +627,12 @@ BWUp(Widget w)
!BWQueryMarked(w))
BWSetHotSpot(w,
BW->bitmap.hot.x,
- (BW->bitmap.hot.y - 1 + BW->bitmap.image->height) %
+ (BW->bitmap.hot.y - 1 + BW->bitmap.image->height) %
BW->bitmap.image->height);
}
-void
+void
BWDown(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -664,10 +664,10 @@ BWDown(Widget w)
InvertPoint(BW, x, y);
down = up;
}
- if(first != up)
+ if(first != up)
InvertPoint(BW, x, from_y);
}
-
+
if (QuerySet(BW->bitmap.hot.x, BW->bitmap.hot.y)
&&
!BWQueryMarked(w))
@@ -676,14 +676,14 @@ BWDown(Widget w)
(BW->bitmap.hot.y + 1) % BW->bitmap.image->height);
}
-void
+void
BWLeft(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
register Position x, y;
bit first, left, right=0;
Position from_x, from_y, to_x, to_y;
-
+
if (BWQueryMarked(w)) {
from_x = BW->bitmap.mark.from_x;
from_y = BW->bitmap.mark.from_y;
@@ -699,7 +699,7 @@ BWLeft(Widget w)
if ((to_x - from_x) == 0)
return;
-
+
for(y = from_y; y <= to_y; y++) {
first = left = GetBit(BW->bitmap.image, to_x, y);
for(x = to_x - 1; x >= from_x; x--) {
@@ -711,24 +711,24 @@ BWLeft(Widget w)
if(first != right)
InvertPoint(BW, to_x, y);
}
-
+
if (QuerySet(BW->bitmap.hot.x, BW->bitmap.hot.y)
&&
!BWQueryMarked(w))
BWSetHotSpot(w,
- (BW->bitmap.hot.x - 1 + BW->bitmap.image->width) %
+ (BW->bitmap.hot.x - 1 + BW->bitmap.image->width) %
BW->bitmap.image->width,
BW->bitmap.hot.y);
}
-void
+void
BWRight(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
register Position x, y;
bit first, right, left=0;
Position from_x, from_y, to_x, to_y;
-
+
if (BWQueryMarked(w)) {
from_x = BW->bitmap.mark.from_x;
from_y = BW->bitmap.mark.from_y;
@@ -741,10 +741,10 @@ BWRight(Widget w)
to_x = BW->bitmap.width - 1;
to_y = BW->bitmap.height - 1;
}
-
+
if ((to_x - from_x) == 0)
return;
-
+
for(y = from_y; y <= to_y; y++) {
first = right = GetBit(BW->bitmap.image, from_x, y);
for(x = from_x + 1; x <= to_x; x++) {
@@ -767,7 +767,7 @@ BWRight(Widget w)
/* void TransferImageData(); */
-void
+void
BWFold(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -775,12 +775,12 @@ BWFold(Widget w)
Dimension horiz, vert;
char *storage_data;
XImage *storage;
-
- storage_data = CreateCleanData(Length(BW->bitmap.image->width,
+
+ storage_data = CreateCleanData(Length(BW->bitmap.image->width,
BW->bitmap.image->height));
- storage = CreateBitmapImage(BW, storage_data,
- (Dimension) BW->bitmap.image->width,
+ storage = CreateBitmapImage(BW, storage_data,
+ (Dimension) BW->bitmap.image->width,
(Dimension) BW->bitmap.image->height);
TransferImageData(BW->bitmap.image, storage);
@@ -788,21 +788,21 @@ BWFold(Widget w)
BW->bitmap.fold ^= True;
horiz = (BW->bitmap.image->width + BW->bitmap.fold) / 2;
vert = (BW->bitmap.image->height + BW->bitmap.fold) / 2;
-
+
for (x = 0; x < BW->bitmap.image->width; x++)
for (y = 0; y < BW->bitmap.image->height; y++) {
new_x = (int)(x + horiz) % (int)BW->bitmap.image->width;
new_y = (int)(y + vert) % (int)BW->bitmap.image->height;
- if(GetBit(BW->bitmap.image, new_x, new_y) !=
+ if(GetBit(BW->bitmap.image, new_x, new_y) !=
GetBit(storage, x, y))
InvertPoint(BW, new_x, new_y);
}
-
+
DestroyBitmapImage(&storage);
if (QuerySet(BW->bitmap.hot.x, BW->bitmap.hot.y))
- BWSetHotSpot(w,
- (Position)
+ BWSetHotSpot(w,
+ (Position)
((int)(BW->bitmap.hot.x+horiz)
%(int)BW->bitmap.image->width),
(Position)
@@ -812,7 +812,7 @@ BWFold(Widget w)
}
-void
+void
BWClear(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -825,32 +825,32 @@ BWClear(Widget w)
for (y = 0; y < BW->bitmap.image->height; y++)
if (GetBit(BW->bitmap.image, x, y))
DrawSquare(BW, x, y);
-
+
for (i = 0; i < length; i++)
BW->bitmap.image->data[i] = 0;
}
-void
+void
BWSet(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
register Position x, y;
int i, length;
-
+
length = Length(BW->bitmap.image->width, BW->bitmap.image->height);
-
+
for (x = 0; x < BW->bitmap.image->width; x++)
for (y = 0; y < BW->bitmap.image->height; y++)
if (!GetBit(BW->bitmap.image, x, y))
DrawSquare(BW, x, y);
-
+
for (i = 0; i < length; i++)
BW->bitmap.image->data[i] = (char)255;
}
-
-void
+
+void
BWRedraw(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -860,7 +860,7 @@ BWRedraw(Widget w)
True);
}
-void
+void
BWInvert(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -873,19 +873,19 @@ BWInvert(Widget w)
InWindowX(BW, 0), InWindowY(BW, 0),
InWindowX(BW, BW->bitmap.image->width) - InWindowX(BW, 0),
InWindowY(BW, BW->bitmap.image->height) - InWindowY(BW, 0));
-
+
for (i = 0; i < length; i++)
BW->bitmap.image->data[i] ^= 255;
}
-void
+void
BWFlipHoriz(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
register Position x, y;
Position from_x, from_y, to_x, to_y;
float half;
-
+
if (BWQueryMarked(w)) {
from_x = BW->bitmap.mark.from_x;
from_y = BW->bitmap.mark.from_y;
@@ -899,18 +899,18 @@ BWFlipHoriz(Widget w)
to_y = BW->bitmap.height - 1;
}
half = (float) (to_y - from_y) / 2.0 + 0.5;
-
+
if (half == 0.0)
return;
-
- for (x = from_x; x <= to_x; x++)
+
+ for (x = from_x; x <= to_x; x++)
for (y = 0; y < half; y++)
- if (GetBit(BW->bitmap.image, x, from_y + y) !=
+ if (GetBit(BW->bitmap.image, x, from_y + y) !=
GetBit(BW->bitmap.image, x, to_y - y)) {
InvertPoint(BW, x, from_y + y);
InvertPoint(BW, x, to_y - y);
}
-
+
if (QuerySet(BW->bitmap.hot.x, BW->bitmap.hot.y)
&&
!BWQueryMarked(w))
@@ -919,14 +919,14 @@ BWFlipHoriz(Widget w)
BW->bitmap.image->height - 1 - BW->bitmap.hot.y);
}
-void
+void
BWFlipVert(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
register Position x, y;
Position from_x, from_y, to_x, to_y;
float half;
-
+
if (BWQueryMarked(w)) {
from_x = BW->bitmap.mark.from_x;
from_y = BW->bitmap.mark.from_y;
@@ -946,12 +946,12 @@ BWFlipVert(Widget w)
for (y = from_y; y <= to_y; y++)
for (x = 0; x < half; x++)
- if (GetBit(BW->bitmap.image, from_x + x, y) !=
+ if (GetBit(BW->bitmap.image, from_x + x, y) !=
GetBit(BW->bitmap.image, to_x - x, y)) {
InvertPoint(BW, from_x + x, y);
InvertPoint(BW, to_x - x, y);
}
-
+
if (QuerySet(BW->bitmap.hot.x, BW->bitmap.hot.y)
&&
!BWQueryMarked(w))
@@ -961,7 +961,7 @@ BWFlipVert(Widget w)
}
-void
+void
BWRotateRight(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -970,7 +970,7 @@ BWRotateRight(Widget w)
XPoint hot;
bit quad1, quad2, quad3, quad4;
Position from_x, from_y, to_x, to_y;
-
+
if (BWQueryMarked(w)) {
from_x = BW->bitmap.mark.from_x;
from_y = BW->bitmap.mark.from_y;
@@ -988,41 +988,41 @@ BWRotateRight(Widget w)
half_height = floor((to_y - from_y ) / 2.0 + 0.5);
shift = min((Position)(to_x - from_x), (Position)(to_y - from_y )) % 2;
delta = min((Position) half_width, (Position) half_height) - shift;
-
+
for (x = 0; x <= delta; x++) {
for (y = 1 - shift; y <= delta; y++) {
- quad1 = GetBit(BW->bitmap.image,
- from_x + (Position)half_width + x,
+ quad1 = GetBit(BW->bitmap.image,
+ from_x + (Position)half_width + x,
from_y + (Position)half_height + y);
- quad2 = GetBit(BW->bitmap.image,
- from_x + (Position)half_width + y,
+ quad2 = GetBit(BW->bitmap.image,
+ from_x + (Position)half_width + y,
from_y + (Position)half_height - shift - x);
- quad3 = GetBit(BW->bitmap.image,
- from_x + (Position)half_width - shift - x,
+ quad3 = GetBit(BW->bitmap.image,
+ from_x + (Position)half_width - shift - x,
from_y + (Position)half_height - shift - y);
- quad4 = GetBit(BW->bitmap.image,
- from_x + (Position)half_width - shift - y,
+ quad4 = GetBit(BW->bitmap.image,
+ from_x + (Position)half_width - shift - y,
from_y + (Position)half_height + x);
if (quad1 != quad2)
- InvertPoint(BW,
- from_x + (Position)half_width + x,
+ InvertPoint(BW,
+ from_x + (Position)half_width + x,
from_y + (Position)half_height + y);
if (quad2 != quad3)
- InvertPoint(BW,
- from_x + (Position)half_width + y,
+ InvertPoint(BW,
+ from_x + (Position)half_width + y,
from_y + (Position)half_height - shift - x);
if (quad3 != quad4)
- InvertPoint(BW,
+ InvertPoint(BW,
from_x + (Position)half_width - shift - x,
from_y + (Position)half_height - shift - y);
if (quad4 != quad1)
- InvertPoint(BW,
- from_x + (Position)half_width - shift - y,
+ InvertPoint(BW,
+ from_x + (Position)half_width - shift - y,
from_y + (Position)half_height + x);
}
}
-
+
if (QuerySet(BW->bitmap.hot.x, BW->bitmap.hot.y)
&&
!BWQueryMarked(w)) {
@@ -1040,10 +1040,10 @@ BWRotateRight(Widget w)
if (QueryInBitmap(BW, hot.x, hot.y))
BWSetHotSpot(w, hot.x, hot.y);
}
-
+
}
-void
+void
BWRotateLeft(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -1052,7 +1052,7 @@ BWRotateLeft(Widget w)
XPoint hot;
bit quad1, quad2, quad3, quad4;
Position from_x, from_y, to_x, to_y;
-
+
if (BWQueryMarked(w)) {
from_x = BW->bitmap.mark.from_x;
from_y = BW->bitmap.mark.from_y;
@@ -1070,41 +1070,41 @@ BWRotateLeft(Widget w)
half_height = floor((to_y - from_y ) / 2.0 + 0.5);
shift = min((Position)(to_x - from_x), (Position)(to_y - from_y )) % 2;
delta = min((Position) half_width, (Position) half_height) - shift;
-
+
for (x = 0; x <= delta; x++) {
for (y = 1 - shift; y <= delta; y++) {
- quad1 = GetBit(BW->bitmap.image,
- from_x + (Position)half_width + x,
+ quad1 = GetBit(BW->bitmap.image,
+ from_x + (Position)half_width + x,
from_y + (Position)half_height + y);
- quad2 = GetBit(BW->bitmap.image,
- from_x + (Position)half_width + y,
+ quad2 = GetBit(BW->bitmap.image,
+ from_x + (Position)half_width + y,
from_y + (Position)half_height - shift - x);
- quad3 = GetBit(BW->bitmap.image,
- from_x + (Position)half_width - shift - x,
+ quad3 = GetBit(BW->bitmap.image,
+ from_x + (Position)half_width - shift - x,
from_y + (Position)half_height - shift - y);
- quad4 = GetBit(BW->bitmap.image,
- from_x + (Position)half_width - shift - y,
+ quad4 = GetBit(BW->bitmap.image,
+ from_x + (Position)half_width - shift - y,
from_y + (Position)half_height + x);
if (quad1 != quad4)
- InvertPoint(BW,
- from_x + (Position)half_width + x,
+ InvertPoint(BW,
+ from_x + (Position)half_width + x,
from_y + (Position)half_height + y);
if (quad2 != quad1)
- InvertPoint(BW,
- from_x + (Position)half_width + y,
+ InvertPoint(BW,
+ from_x + (Position)half_width + y,
from_y + (Position)half_height - shift - x);
if (quad3 != quad2)
- InvertPoint(BW,
+ InvertPoint(BW,
from_x + (Position)half_width - shift - x,
from_y + (Position)half_height - shift - y);
if (quad4 != quad3)
- InvertPoint(BW,
- from_x + (Position)half_width - shift - y,
+ InvertPoint(BW,
+ from_x + (Position)half_width - shift - y,
from_y + (Position)half_height + x);
}
}
-
+
if (QuerySet(BW->bitmap.hot.x, BW->bitmap.hot.y)
&&
!BWQueryMarked(w)) {
@@ -1125,17 +1125,17 @@ BWRotateLeft(Widget w)
}
-void
-CopyImageData(XImage *source, XImage *destination,
- Position from_x, Position from_y,
- Position to_x, Position to_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;
-
+
delta_x = to_x - from_x + 1;
delta_y = to_y - from_y + 1;
-
+
for (x = 0; x < delta_x; x++)
for (y = 0; y < delta_y; y++)
if (GetBit(source, from_x + x, from_y + y))
@@ -1143,17 +1143,17 @@ CopyImageData(XImage *source, XImage *destination,
else
ClearBit(destination, at_x + x, at_y + y);
}
-
+
XImage *
ConvertToBitmapImage(BitmapWidget BW, XImage *image)
{
XImage *bitmap_image;
char *data;
Position x, y;
-
+
data = CreateCleanData(Length(image->width, image->height));
- bitmap_image = CreateBitmapImage(BW, data,
- (Dimension) image->width,
+ bitmap_image = CreateBitmapImage(BW, data,
+ (Dimension) image->width,
(Dimension) image->height);
for (x = 0; x < min(image->width, bitmap_image->width); x++)
@@ -1164,18 +1164,18 @@ ConvertToBitmapImage(BitmapWidget BW, XImage *image)
return bitmap_image;
}
-void
+void
TransferImageData(XImage *source, XImage *destination)
{
Position x, y;
-
+
for (x = 0; x < min(source->width, destination->width); x++)
for (y = 0; y < min(source->height, destination->height); y++)
if (GetBit(source, x, y) != GetBit(destination, x, y))
InvertBit(destination, x, y);
}
-void
+void
BWStore(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -1188,7 +1188,7 @@ BWStore(Widget w)
width = BW->bitmap.mark.to_x - BW->bitmap.mark.from_x + 1;
height = BW->bitmap.mark.to_y - BW->bitmap.mark.from_y + 1;
-
+
storage_data = CreateCleanData(Length(width, height));
BW->bitmap.storage = CreateBitmapImage(BW,
@@ -1202,11 +1202,11 @@ BWStore(Widget w)
}
}
-void
+void
BWClearMarked(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
-
+
if (QuerySet(BW->bitmap.mark.from_x, BW->bitmap.mark.from_y))
BWDrawFilledRectangle(w,
BW->bitmap.mark.from_x,
@@ -1217,34 +1217,34 @@ BWClearMarked(Widget w)
}
-void
+void
BWDragMarked(Widget w, Position at_x, Position at_y)
{
BitmapWidget BW = (BitmapWidget) w;
if (QuerySet(BW->bitmap.mark.from_x, BW->bitmap.mark.from_y))
- BWDrawRectangle(w,
- at_x, at_y,
+ BWDrawRectangle(w,
+ at_x, at_y,
at_x + BW->bitmap.mark.to_x - BW->bitmap.mark.from_x,
at_y + BW->bitmap.mark.to_y - BW->bitmap.mark.from_y,
Highlight);
}
-void
+void
BWDragStored(Widget w, Position at_x, Position at_y)
{
BitmapWidget BW = (BitmapWidget) w;
-
+
if (BW->bitmap.storage)
- BWDrawRectangle(w,
+ BWDrawRectangle(w,
at_x, at_y,
at_x + BW->bitmap.storage->width - 1,
at_y + BW->bitmap.storage->height - 1,
Highlight);
}
-static void
-DrawImageData(BitmapWidget BW, XImage *image,
+static void
+DrawImageData(BitmapWidget BW, XImage *image,
Position at_x, Position at_y, int value)
{
Position x, y;
@@ -1256,7 +1256,7 @@ DrawImageData(BitmapWidget BW, XImage *image,
I = value == Invert;
H = value == Highlight;
- for (x = 0; x < image->width; x++)
+ for (x = 0; x < image->width; x++)
for (y = 0; y < image->height; y++) {
A = GetBit(image, x, y);
B = GetBit(BW->bitmap.image, at_x + x, at_y + y);
@@ -1264,24 +1264,24 @@ DrawImageData(BitmapWidget BW, XImage *image,
value = (A & H) ? Highlight : Set;
else
value = Clear;
- BWDrawPoint((Widget) BW,
- at_x + x, at_y + y,
+ BWDrawPoint((Widget) BW,
+ at_x + x, at_y + y,
value);
}
}
-void
+void
BWRestore(Widget w, Position at_x, Position at_y, int value)
{
BitmapWidget BW = (BitmapWidget) w;
-
+
if (BW->bitmap.storage) {
DrawImageData(BW, BW->bitmap.storage, at_x, at_y, value);
/*DestroyBitmapImage(&BW->bitmap.storage);*/
}
}
-void
+void
BWCopy(Widget w, Position at_x, Position at_y, int value)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -1293,7 +1293,7 @@ BWCopy(Widget w, Position at_x, Position at_y, int value)
width = BW->bitmap.mark.to_x - BW->bitmap.mark.from_x + 1;
height = BW->bitmap.mark.to_y - BW->bitmap.mark.from_y + 1;
-
+
storage_data = CreateCleanData(Length(width, height));
storage = CreateBitmapImage(BW, storage_data, width, height);
@@ -1311,7 +1311,7 @@ BWCopy(Widget w, Position at_x, Position at_y, int value)
/* void BWMark(); */
-void
+void
BWMove(Widget w, Position at_x, Position at_y, int value)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -1323,7 +1323,7 @@ BWMove(Widget w, Position at_x, Position at_y, int value)
width = BW->bitmap.mark.to_x - BW->bitmap.mark.from_x + 1;
height = BW->bitmap.mark.to_y - BW->bitmap.mark.from_y + 1;
-
+
storage_data = CreateCleanData(Length(width, height));
storage = CreateBitmapImage(BW, storage_data, width, height);
@@ -1348,34 +1348,34 @@ BWMove(Widget w, Position at_x, Position at_y, int value)
}
}
-void
+void
BWRedrawMark(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
-
- if (QuerySet(BW->bitmap.mark.from_x, BW->bitmap.mark.from_y))
+
+ if (QuerySet(BW->bitmap.mark.from_x, BW->bitmap.mark.from_y))
XFillRectangle(XtDisplay(BW), XtWindow(BW), BW->bitmap.highlighting_gc,
- InWindowX(BW, BW->bitmap.mark.from_x),
- InWindowY(BW, BW->bitmap.mark.from_y),
- InWindowX(BW, BW->bitmap.mark.to_x + 1) -
+ InWindowX(BW, BW->bitmap.mark.from_x),
+ InWindowY(BW, BW->bitmap.mark.from_y),
+ InWindowX(BW, BW->bitmap.mark.to_x + 1) -
InWindowX(BW, BW->bitmap.mark.from_x),
InWindowY(BW, BW->bitmap.mark.to_y + 1) -
InWindowY(BW, BW->bitmap.mark.from_y));
}
-void
+void
BWStoreToBuffer(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
-
- memmove( BW->bitmap.buffer->data, BW->bitmap.image->data,
+
+ memmove( BW->bitmap.buffer->data, BW->bitmap.image->data,
Length(BW->bitmap.image->width, BW->bitmap.image->height));
BW->bitmap.buffer_hot = BW->bitmap.hot;
BW->bitmap.buffer_mark = BW->bitmap.mark;
}
-void
+void
BWUnmark(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -1384,26 +1384,26 @@ BWUnmark(Widget w)
if (QuerySet(BW->bitmap.mark.from_x, BW->bitmap.mark.from_y)) {
XFillRectangle(XtDisplay(BW), XtWindow(BW), BW->bitmap.highlighting_gc,
- InWindowX(BW, BW->bitmap.mark.from_x),
- InWindowY(BW, BW->bitmap.mark.from_y),
- InWindowX(BW, BW->bitmap.mark.to_x + 1) -
+ InWindowX(BW, BW->bitmap.mark.from_x),
+ InWindowY(BW, BW->bitmap.mark.from_y),
+ InWindowX(BW, BW->bitmap.mark.to_x + 1) -
InWindowX(BW, BW->bitmap.mark.from_x),
InWindowY(BW, BW->bitmap.mark.to_y + 1) -
InWindowY(BW, BW->bitmap.mark.from_y));
-
+
BW->bitmap.mark.from_x = BW->bitmap.mark.from_y = NotSet;
BW->bitmap.mark.to_x = BW->bitmap.mark.to_y = NotSet;
}
}
-void
-BWMark(Widget w, Position from_x, Position from_y,
+void
+BWMark(Widget w, Position from_x, Position from_y,
Position to_x, Position to_y)
{
BitmapWidget BW = (BitmapWidget) w;
BWUnmark(w);
-
+
if (QuerySet(from_x, from_y)) {
if ((from_x == to_x) && (from_y == to_y)) {
/*
@@ -1421,24 +1421,24 @@ BWMark(Widget w, Position from_x, Position from_y,
from_y = max(0, from_y);
to_x = min(BW->bitmap.image->width - 1, to_x);
to_y = min(BW->bitmap.image->height - 1, to_y);
-
+
BW->bitmap.mark.from_x = from_x;
BW->bitmap.mark.from_y = from_y;
BW->bitmap.mark.to_x = to_x;
BW->bitmap.mark.to_y = to_y;
}
-
+
XFillRectangle(XtDisplay(BW), XtWindow(BW), BW->bitmap.highlighting_gc,
InWindowX(BW, BW->bitmap.mark.from_x),
- InWindowY(BW, BW->bitmap.mark.from_y),
+ InWindowY(BW, BW->bitmap.mark.from_y),
InWindowX(BW, BW->bitmap.mark.to_x + 1) -
InWindowX(BW, BW->bitmap.mark.from_x),
- InWindowY(BW, BW->bitmap.mark.to_y +1) -
+ InWindowY(BW, BW->bitmap.mark.to_y +1) -
InWindowY(BW, BW->bitmap.mark.from_y));
}
}
-void
+void
BWMarkAll(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -1446,7 +1446,7 @@ BWMarkAll(Widget w)
BWMark(w, 0, 0, BW->bitmap.image->width - 1, BW->bitmap.image->height - 1);
}
-void
+void
BWUndo(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
@@ -1454,21 +1454,21 @@ BWUndo(Widget w)
char *tmp_data;
XPoint tmp_hot;
BWArea tmp_mark;
-
+
tmp_data = BW->bitmap.image->data;
BW->bitmap.image->data = BW->bitmap.buffer->data;
BW->bitmap.buffer->data = tmp_data;
tmp_hot = BW->bitmap.hot;
tmp_mark = BW->bitmap.mark;
-
+
for (x = 0; x < BW->bitmap.image->width; x++)
for (y = 0; y < BW->bitmap.image->height; y++)
if (GetBit(BW->bitmap.image, x, y) != GetBit(BW->bitmap.buffer, x, y))
DrawSquare(BW, x, y);
BWSetHotSpot(w, BW->bitmap.buffer_hot.x, BW->bitmap.buffer_hot.y);
-/*
+/*
BWMark(w, BW->bitmap.buffer_mark.from_x, BW->bitmap.buffer_mark.from_y,
BW->bitmap.buffer_mark.to_x, BW->bitmap.buffer_mark.to_y);
*/
@@ -1477,21 +1477,21 @@ BWUndo(Widget w)
}
-void
+void
BWHighlightAxes(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
XDrawLine(XtDisplay(BW), XtWindow(BW),
BW->bitmap.axes_gc,
- InWindowX(BW, 0),
+ InWindowX(BW, 0),
InWindowY(BW, 0),
InWindowX(BW, BW->bitmap.width),
InWindowY(BW, BW->bitmap.height));
XDrawLine(XtDisplay(BW), XtWindow(BW),
BW->bitmap.axes_gc,
InWindowX(BW, BW->bitmap.width),
- InWindowY(BW, 0),
+ InWindowY(BW, 0),
InWindowX(BW, 0),
InWindowY(BW, BW->bitmap.height));
XDrawLine(XtDisplay(BW), XtWindow(BW),
@@ -1507,19 +1507,19 @@ BWHighlightAxes(Widget w)
InWindowX(BW, (float)BW->bitmap.width / 2.0),
InWindowY(BW, BW->bitmap.height));
}
-
+
typedef struct {
Position *x, *y;
Dimension *width, *height;
} Table;
XImage *
-ScaleBitmapImage(BitmapWidget BW, XImage *src,
+ScaleBitmapImage(BitmapWidget BW, XImage *src,
double scale_x, double scale_y)
{
char *data;
XImage *dst;
- Table table;
+ Table table;
Position x, y, w, h;
Dimension width, height;
bit pixel;
@@ -1541,7 +1541,7 @@ ScaleBitmapImage(BitmapWidget BW, XImage *src,
table.y = (Position *) XtMalloc(sizeof(Position) * src->height);
table.width = (Dimension *) XtMalloc(sizeof(Dimension) * src->width);
table.height = (Dimension *) XtMalloc(sizeof(Dimension) * src->height);
-
+
for (x = 0; x < src->width; x++) {
table.x[x] = rint(scale_x * x);
table.width[x] = rint(scale_x * (x + 1)) - rint(scale_x * x);
@@ -1550,14 +1550,14 @@ ScaleBitmapImage(BitmapWidget BW, XImage *src,
table.y[y] = rint(scale_y * y);
table.height[y] = rint(scale_y * (y + 1)) - rint(scale_y * y);
}
-
+
for (x = 0; x < src->width; x++)
for (y = 0; y < src->height; y++) {
pixel = GetBit(src, x, y);
for (w = 0; (int)w < (int)table.width[x]; w++)
for (h = 0; (int)h < (int)table.height[y]; h++)
- if (pixel) SetBit(dst,
- table.x[x] + w,
+ if (pixel) SetBit(dst,
+ table.x[x] + w,
table.y[y] + h);
}
@@ -1566,7 +1566,7 @@ ScaleBitmapImage(BitmapWidget BW, XImage *src,
XtFree((char *)table.width);
XtFree((char *)table.height);
}
-
+
return (dst);
}
diff --git a/Handlers.c b/Handlers.c
index 9137e0f..4763451 100644
--- a/Handlers.c
+++ b/Handlers.c
@@ -33,7 +33,7 @@ from The Open Group.
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
#include "BitmapP.h"
-
+
#include <stdio.h>
#include <math.h>
@@ -52,10 +52,10 @@ from The Open Group.
(InBitmapY(BW, y) == (square_y)))
-static void
-DragOnePointHandler(Widget w,
- XtPointer client_data,
- XEvent *event,
+static void
+DragOnePointHandler(Widget w,
+ XtPointer client_data,
+ XEvent *event,
Boolean *cont) /* ARGSUSED */
{
BWStatus *status = (BWStatus *)client_data;
@@ -65,7 +65,7 @@ DragOnePointHandler(Widget w,
fprintf(stderr, "D1PH ");
switch (event->type) {
-
+
case ButtonPress:
if (event->xbutton.state != status->state) return;
if (!QuerySet(status->at_x, status->at_y)) {
@@ -80,7 +80,7 @@ DragOnePointHandler(Widget w,
status->at_x, status->at_y, status->value);
}
break;
-
+
case ButtonRelease:
if (QuerySet(status->at_x, status->at_y)) {
status->value = Value(BW, event->xbutton.button);
@@ -89,7 +89,7 @@ DragOnePointHandler(Widget w,
status->at_y = InBitmapY(BW, event->xbutton.y);
status->success = status->draw ? True : False;
/* SUPPRESS 701 */
- BWTerminateRequest(w, TRUE);
+ BWTerminateRequest(w, TRUE);
}
break;
@@ -109,56 +109,56 @@ DragOnePointHandler(Widget w,
}
}
-void
-DragOnePointEngage(Widget w,
- BWStatus *status,
- XtPointer draw,
+void
+DragOnePointEngage(Widget w,
+ BWStatus *status,
+ XtPointer draw,
int *state)
{
-
+
status->at_x = NotSet;
status->at_y = NotSet;
status->draw = draw;
status->success = False;
status->state = *state;
-
+
XtAddEventHandler(w,
ButtonPressMask | ButtonReleaseMask | PointerMotionMask,
FALSE, DragOnePointHandler, (XtPointer)status);
}
/* ARGSUSED */
-void
-DragOnePointTerminate(Widget w,
- BWStatus *status,
+void
+DragOnePointTerminate(Widget w,
+ BWStatus *status,
XtPointer draw)
{
-
+
if (status->success) {
BWChangeNotify(w);
BWSetChanged(w);
}
-
+
XtRemoveEventHandler(w,
ButtonPressMask | ButtonReleaseMask | PointerMotionMask,
FALSE, DragOnePointHandler, (XtPointer)status);
-
+
}
-void
-OnePointHandler(Widget w,
- XtPointer client_data,
- XEvent *event,
+void
+OnePointHandler(Widget w,
+ XtPointer client_data,
+ XEvent *event,
Boolean *cont) /* ARGSUSED */
{
BWStatus *status = (BWStatus *)client_data;
BitmapWidget BW = (BitmapWidget) w;
-
+
if (DEBUG)
fprintf(stderr, "1PH ");
switch (event->type) {
-
+
case Expose:
if (QuerySet(status->at_x, status->at_y)) {
BWClip(w, event->xexpose.x, event->xexpose.y,
@@ -166,11 +166,11 @@ OnePointHandler(Widget w,
if (status->draw)
(*(DrawOnePointProc)status->draw)(w,
status->at_x, status->at_y, Highlight);
-
+
BWUnclip(w);
}
break;
-
+
case ButtonPress:
if (event->xbutton.state != status->state) return;
if (!QuerySet(status->at_x, status->at_y)) {
@@ -183,23 +183,23 @@ OnePointHandler(Widget w,
status->at_x, status->at_y, Highlight);
}
break;
-
+
case ButtonRelease:
if (QuerySet(status->at_x, status->at_y)) {
if (status->draw)
(*(DrawOnePointProc)status->draw)(w,
status->at_x, status->at_y, Highlight);
-
+
status->value = Value(BW, event->xbutton.button);
status->btime = event->xbutton.time;
status->at_x = InBitmapX(BW, event->xbutton.x);
status->at_y = InBitmapY(BW, event->xbutton.y);
status->success = True;
-
+
BWTerminateRequest(w, TRUE);
}
break;
-
+
case MotionNotify:
if (QuerySet(status->at_x, status->at_y)) {
if (!QueryInSquare(BW, event->xmotion.x, event->xmotion.y,
@@ -213,15 +213,15 @@ OnePointHandler(Widget w,
(*(DrawOnePointProc)status->draw)(w,
status->at_x, status->at_y, Highlight);
}
- }
+ }
break;
}
}
-void
-OnePointEngage(Widget w,
- BWStatus *status,
- XtPointer draw,
+void
+OnePointEngage(Widget w,
+ BWStatus *status,
+ XtPointer draw,
int *state)
{
status->at_x = NotSet;
@@ -231,16 +231,16 @@ OnePointEngage(Widget w,
status->state = *state;
XtAddEventHandler(w,
- ButtonPressMask | ButtonReleaseMask |
+ ButtonPressMask | ButtonReleaseMask |
ExposureMask | PointerMotionMask,
FALSE, OnePointHandler, (XtPointer)status);
}
#if 0
-void
-OnePointImmediateEngage(Widget w,
- BWStatus *status,
- XtPointer draw,
+void
+OnePointImmediateEngage(Widget w,
+ BWStatus *status,
+ XtPointer draw,
int *state)
{
status->at_x = 0;
@@ -248,24 +248,24 @@ OnePointImmediateEngage(Widget w,
status->draw = draw;
status->success = False;
status->state = *state;
-
+
if (status->draw)
(*(DrawOnePointProc)status->draw)(w,
status->at_x, status->at_y, Highlight);
-
+
XtAddEventHandler(w,
- ButtonPressMask | ButtonReleaseMask |
+ ButtonPressMask | ButtonReleaseMask |
ExposureMask | PointerMotionMask,
FALSE, OnePointHandler, (XtPointer)status);
}
#endif
-void
-OnePointTerminate(Widget w,
- BWStatus *status,
+void
+OnePointTerminate(Widget w,
+ BWStatus *status,
XtPointer draw)
{
-
+
if (status->success && draw) {
BWStoreToBuffer(w);
(*(DrawOnePointProc)draw)(w,
@@ -273,25 +273,25 @@ OnePointTerminate(Widget w,
status->value);
BWChangeNotify(w);
BWSetChanged(w);
- }
+ }
else
if (QuerySet(status->at_x, status->at_y))
if (status->draw)
(*(DrawOnePointProc)status->draw)(w,
status->at_x, status->at_y, Highlight);
-
+
XtRemoveEventHandler(w,
- ButtonPressMask | ButtonReleaseMask |
+ ButtonPressMask | ButtonReleaseMask |
ExposureMask | PointerMotionMask,
FALSE, OnePointHandler, (XtPointer)status);
}
-void
-OnePointTerminateTransparent(Widget w,
- BWStatus *status,
+void
+OnePointTerminateTransparent(Widget w,
+ BWStatus *status,
XtPointer draw)
{
-
+
if (status->success && draw)
(*(DrawOnePointProc)draw)(w,
status->at_x, status->at_y,
@@ -301,41 +301,41 @@ OnePointTerminateTransparent(Widget w,
if (status->draw)
(*(DrawOnePointProc)status->draw)(w,
status->at_x, status->at_y, Highlight);
-
+
XtRemoveEventHandler(w,
- ButtonPressMask | ButtonReleaseMask |
+ ButtonPressMask | ButtonReleaseMask |
ExposureMask | PointerMotionMask,
FALSE, OnePointHandler, (XtPointer)status);
-
+
}
-void
-TwoPointsHandler(Widget w,
- XtPointer client_data,
- XEvent *event,
+void
+TwoPointsHandler(Widget w,
+ XtPointer client_data,
+ XEvent *event,
Boolean *cont) /* ARGSUSED */
{
BitmapWidget BW = (BitmapWidget) w;
BWStatus *status = (BWStatus *)client_data;
if (DEBUG)
fprintf(stderr, "2PH ");
-
+
switch (event->type) {
-
+
case Expose:
- if (QuerySet(status->from_x, status->from_y) &&
+ if (QuerySet(status->from_x, status->from_y) &&
QuerySet(status->to_x, status->to_y)) {
BWClip(w, event->xexpose.x, event->xexpose.y,
event->xexpose.width, event->xexpose.height);
if (status->draw)
(*(DrawTwoPointProc)status->draw)(w,
- status->from_x, status->from_y,
+ status->from_x, status->from_y,
status->to_x, status->to_y, Highlight);
BWUnclip(w);
}
break;
-
+
case ButtonPress:
if (event->xbutton.state != status->state) return;
if (!QuerySet(status->from_x, status->from_y)) {
@@ -347,27 +347,27 @@ TwoPointsHandler(Widget w,
status->to_y = InBitmapY(BW, event->xbutton.y);
if (status->draw)
(*(DrawTwoPointProc)status->draw)(w,
- status->from_x, status->from_y,
+ status->from_x, status->from_y,
status->to_x, status->to_y, Highlight);
}
break;
-
+
case ButtonRelease:
if (QuerySet(status->from_x, status->from_y)) {
if (status->draw)
(*(DrawTwoPointProc)status->draw)(w,
- status->from_x, status->from_y,
+ status->from_x, status->from_y,
status->to_x, status->to_y, Highlight);
status->value = Value(BW, event->xbutton.button);
- status->btime = event->xbutton.time;
+ status->btime = event->xbutton.time;
status->to_x = InBitmapX(BW, event->xbutton.x);
status->to_y = InBitmapY(BW, event->xbutton.y);
status->success = True;
-
+
BWTerminateRequest(w, TRUE);
}
break;
-
+
case MotionNotify:
if (QuerySet(status->from_x, status->from_y)) {
if (QuerySet(status->to_x, status->to_y)) {
@@ -375,13 +375,13 @@ TwoPointsHandler(Widget w,
status->to_x, status->to_y)) {
if (status->draw)
(*(DrawTwoPointProc)status->draw)(w,
- status->from_x, status->from_y,
+ 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)
(*(DrawTwoPointProc)status->draw)(w,
- status->from_x, status->from_y,
+ status->from_x, status->from_y,
status->to_x, status->to_y, Highlight);
}
}
@@ -390,7 +390,7 @@ TwoPointsHandler(Widget w,
status->to_y = InBitmapY(BW, event->xmotion.y);
if (status->draw)
(*(DrawTwoPointProc)status->draw)(w,
- status->from_x, status->from_y,
+ status->from_x, status->from_y,
status->to_x, status->to_y, Highlight);
}
}
@@ -398,13 +398,13 @@ TwoPointsHandler(Widget w,
}
}
-void
-TwoPointsEngage(Widget w,
- BWStatus *status,
- XtPointer draw,
+void
+TwoPointsEngage(Widget w,
+ BWStatus *status,
+ XtPointer draw,
int *state)
{
-
+
status->from_x = NotSet;
status->from_y = NotSet;
status->to_x = NotSet;
@@ -414,17 +414,17 @@ TwoPointsEngage(Widget w,
status->state = *state;
XtAddEventHandler(w,
- ButtonPressMask | ButtonReleaseMask |
+ ButtonPressMask | ButtonReleaseMask |
ExposureMask | PointerMotionMask,
FALSE, TwoPointsHandler, (XtPointer)status);
}
-void
-TwoPointsTerminate(Widget w,
- BWStatus *status,
+void
+TwoPointsTerminate(Widget w,
+ BWStatus *status,
XtPointer draw)
{
-
+
if (status->success && draw) {
BWStoreToBuffer(w);
(*(DrawTwoPointProc)draw)(w,
@@ -435,126 +435,126 @@ TwoPointsTerminate(Widget w,
BWSetChanged(w);
}
else
- if (QuerySet(status->from_x, status->from_y) &&
+ if (QuerySet(status->from_x, status->from_y) &&
QuerySet(status->to_x, status->to_y))
if (status->draw)
(*(DrawTwoPointProc)status->draw)(w,
- status->from_x, status->from_y,
+ status->from_x, status->from_y,
status->to_x, status->to_y, Highlight);
-
+
XtRemoveEventHandler(w,
- ButtonPressMask | ButtonReleaseMask |
+ ButtonPressMask | ButtonReleaseMask |
ExposureMask | PointerMotionMask,
FALSE, TwoPointsHandler, (XtPointer)status);
}
-void
-TwoPointsTerminateTransparent(Widget w,
- BWStatus *status,
+void
+TwoPointsTerminateTransparent(Widget w,
+ BWStatus *status,
XtPointer draw)
{
-
+
if (status->success && draw)
(*(DrawTwoPointProc)draw)(w,
status->from_x, status->from_y,
status->to_x, status->to_y,
status->value);
else
- if (QuerySet(status->from_x, status->from_y) &&
+ if (QuerySet(status->from_x, status->from_y) &&
QuerySet(status->to_x, status->to_y))
if (status->draw)
(*(DrawTwoPointProc)status->draw)(w,
- status->from_x, status->from_y,
+ status->from_x, status->from_y,
status->to_x, status->to_y, Highlight);
-
+
XtRemoveEventHandler(w,
- ButtonPressMask | ButtonReleaseMask |
+ ButtonPressMask | ButtonReleaseMask |
ExposureMask | PointerMotionMask,
FALSE, TwoPointsHandler, (XtPointer)status);
}
-void
-TwoPointsTerminateTimed(Widget w,
- BWStatus *status,
+void
+TwoPointsTerminateTimed(Widget w,
+ BWStatus *status,
XtPointer draw)
{
-
+
if (status->success && draw)
(*(DrawTwoPointProc)draw)(w,
status->from_x, status->from_y,
status->to_x, status->to_y,
status->btime);
else
- if (QuerySet(status->from_x, status->from_y) &&
+ if (QuerySet(status->from_x, status->from_y) &&
QuerySet(status->to_x, status->to_y))
if (status->draw)
(*(DrawTwoPointProc)status->draw)(w,
- status->from_x, status->from_y,
+ status->from_x, status->from_y,
status->to_x, status->to_y, Highlight);
-
+
XtRemoveEventHandler(w,
- ButtonPressMask | ButtonReleaseMask |
+ ButtonPressMask | ButtonReleaseMask |
ExposureMask | PointerMotionMask,
FALSE, TwoPointsHandler, (XtPointer)status);
}
/* ARGSUSED */
-void
-Interface(Widget w,
- BWStatus *status,
+void
+Interface(Widget w,
+ BWStatus *status,
XtPointer action)
{
(*(InterfaceProc)action)(w);
}
-void
-Paste(Widget w,
- Position at_x,
- Position at_y,
+void
+Paste(Widget w,
+ Position at_x,
+ Position at_y,
int value)
{
BitmapWidget BW = (BitmapWidget) w;
BWStatus *my_status;
BWRequest request;
- my_status = (BWStatus *)
+ my_status = (BWStatus *)
BW->bitmap.request_stack[BW->bitmap.current].status;
my_status->draw = NULL;
request = (BWRequest)
BW->bitmap.request_stack[BW->bitmap.current].request->terminate_client_data;
-
+
BWTerminateRequest(w, FALSE);
-
+
if ((at_x == max(BW->bitmap.mark.from_x, min(at_x, BW->bitmap.mark.to_x)))
&&
(at_y == max(BW->bitmap.mark.from_y, min(at_y, BW->bitmap.mark.to_y)))) {
-
+
BWStatus *status;
-
+
if (DEBUG)
fprintf(stderr, "Prepaste request: %s\n", request);
-
+
BWEngageRequest(w, request, False, (char *)&(my_status->state), sizeof(int));
-
- status = (BWStatus *)
+
+ status = (BWStatus *)
BW->bitmap.request_stack[BW->bitmap.current].status;
-
+
status->at_x = at_x;
status->at_y = at_y;
status->value = value;
- (*(DrawOnePointProc)status->draw) (w, at_x, at_y, Highlight);
+ (*(DrawOnePointProc)status->draw) (w, at_x, at_y, Highlight);
}
else {
BWStatus *status;
-
+
BWEngageRequest(w, MarkRequest, False, (char *)&(my_status->state), sizeof(int));
-
- status = (BWStatus *)
+
+ status = (BWStatus *)
BW->bitmap.request_stack[BW->bitmap.current].status;
-
+
status->from_x = status->to_x = at_x;
status->from_y = status->to_y = at_y;
status->value = value;
@@ -563,10 +563,10 @@ Paste(Widget w,
}
-void
-DragTwoPointsHandler(Widget w,
- XtPointer client_data,
- XEvent *event,
+void
+DragTwoPointsHandler(Widget w,
+ XtPointer client_data,
+ XEvent *event,
Boolean *cont) /* ARGSUSED */
{
BitmapWidget BW = (BitmapWidget) w;
@@ -576,7 +576,7 @@ DragTwoPointsHandler(Widget w,
fprintf(stderr, "D2PH ");
switch (event->type) {
-
+
case ButtonPress:
if (event->xbutton.state != status->state) return;
if (!QuerySet(status->from_x, status->from_y)) {
@@ -590,25 +590,25 @@ DragTwoPointsHandler(Widget w,
status->success = status->draw ? True : False;
if (status->draw)
(*(DrawTwoPointProc)status->draw)(w,
- status->from_x, status->from_y,
+ status->from_x, status->from_y,
status->to_x, status->to_y, status->value);
}
break;
-
+
case ButtonRelease:
if (QuerySet(status->from_x, status->from_y)) {
status->value = Value(BW, event->xbutton.button);
- status->btime = event->xbutton.time;
+ status->btime = event->xbutton.time;
status->from_x = status->to_x;
status->from_y = status->to_y;
status->to_x = InBitmapX(BW, event->xbutton.x);
status->to_y = InBitmapY(BW, event->xbutton.y);
status->success = True;
-
+
BWTerminateRequest(w, TRUE);
}
break;
-
+
case MotionNotify:
if (QuerySet(status->from_x, status->from_y)) {
if (QuerySet(status->to_x, status->to_y)) {
@@ -620,7 +620,7 @@ DragTwoPointsHandler(Widget w,
status->to_y = InBitmapY(BW, event->xmotion.y);
if (status->draw)
(*(DrawTwoPointProc)status->draw)(w,
- status->from_x, status->from_y,
+ status->from_x, status->from_y,
status->to_x, status->to_y, status->value);
}
}
@@ -629,13 +629,13 @@ DragTwoPointsHandler(Widget w,
}
}
-void
-DragTwoPointsEngage(Widget w,
- BWStatus *status,
- XtPointer draw,
+void
+DragTwoPointsEngage(Widget w,
+ BWStatus *status,
+ XtPointer draw,
int *state)
{
-
+
status->from_x = NotSet;
status->from_y = NotSet;
status->to_x = NotSet;
@@ -649,15 +649,15 @@ DragTwoPointsEngage(Widget w,
FALSE, DragTwoPointsHandler, (XtPointer)status);
}
-void
-DragTwoPointsTerminate(Widget w,
- BWStatus *status,
+void
+DragTwoPointsTerminate(Widget w,
+ BWStatus *status,
XtPointer draw)
{
-
+
if (status->success && draw) {
- if ((status->from_x != status->to_x)
- ||
+ if ((status->from_x != status->to_x)
+ ||
(status->from_y != status->to_y))
(*(DrawTwoPointProc)draw)(w,
status->from_x, status->from_y,
@@ -666,7 +666,7 @@ DragTwoPointsTerminate(Widget w,
BWChangeNotify(w);
BWSetChanged(w);
}
-
+
XtRemoveEventHandler(w,
ButtonPressMask | ButtonReleaseMask | PointerMotionMask,
FALSE, DragTwoPointsHandler, (XtPointer)status);
diff --git a/Makefile.am b/Makefile.am
index 99ee6f9..7a5ca35 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,6 @@
-#
+#
# Copyright 2005 Red Hat, Inc.
-#
+#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
@@ -10,7 +10,7 @@
# specific, written prior permission. Red Hat makes no
# representations about the suitability of this software for any purpose. It
# is provided "as is" without express or implied warranty.
-#
+#
# RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
# EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
diff --git a/ReqMach.c b/ReqMach.c
index d781b74..4ba1a76 100644
--- a/ReqMach.c
+++ b/ReqMach.c
@@ -35,13 +35,13 @@ from The Open Group.
#include <X11/Xfuncs.h>
#include <X11/Xos.h>
#include "BitmapP.h"
-
+
#include <stdio.h>
#include <math.h>
/*****************************************************************************\
- * Request Machine: stacks up and handles requests from application calls. *
+ * Request Machine: stacks up and handles requests from application calls. *
\*****************************************************************************/
/*
@@ -56,7 +56,7 @@ FindRequest(BWRequest name)
for (i = 0; i < bitmapClassRec.bitmap_class.num_requests; i++)
if (!strcmp(name, bitmapClassRec.bitmap_class.requests[i].name))
return &bitmapClassRec.bitmap_class.requests[i];
-
+
return NULL;
}
@@ -64,13 +64,13 @@ FindRequest(BWRequest name)
* Adds a request to the request stack and does proper initializations.
* Returns TRUE if the request was found and FALSE otherwise.
*/
-Boolean
-BWAddRequest(Widget w, BWRequest name, Boolean trap,
+Boolean
+BWAddRequest(Widget w, BWRequest name, Boolean trap,
XtPointer call_data, Cardinal call_data_size)
{
BitmapWidget BW = (BitmapWidget) w;
BWRequestRec *request;
-
+
request = FindRequest(name);
if(request) {
if (DEBUG)
@@ -79,15 +79,15 @@ BWAddRequest(Widget w, BWRequest name, Boolean trap,
BW->bitmap.request_stack = (BWRequestStack *)
XtRealloc((char *)BW->bitmap.request_stack,
(++BW->bitmap.cardinal + 1) * sizeof(BWRequestStack));
-
+
BW->bitmap.request_stack[BW->bitmap.cardinal].request = request;
- BW->bitmap.request_stack[BW->bitmap.cardinal].status =
+ BW->bitmap.request_stack[BW->bitmap.cardinal].status =
XtMalloc(request->status_size);
BW->bitmap.request_stack[BW->bitmap.cardinal].trap = trap;
- BW->bitmap.request_stack[BW->bitmap.cardinal].call_data =
+ BW->bitmap.request_stack[BW->bitmap.cardinal].call_data =
XtMalloc(call_data_size);
memmove( BW->bitmap.request_stack[BW->bitmap.cardinal].call_data,
- call_data,
+ call_data,
call_data_size);
return True;
@@ -102,15 +102,15 @@ BWAddRequest(Widget w, BWRequest name, Boolean trap,
* Engages the request designated by the current parameter.
* Returnes TRUE if the request has an engage function and FALSE otherwise.
*/
-static Boolean
+static Boolean
Engage(BitmapWidget BW, Cardinal current)
{
BW->bitmap.current = current;
-
+
if (DEBUG)
- fprintf(stderr, "Request: %s\n",
+ fprintf(stderr, "Request: %s\n",
BW->bitmap.request_stack[current].request->name);
-
+
if (BW->bitmap.request_stack[current].request->engage) {
(*BW->bitmap.request_stack[current].request->engage)
((Widget) BW,
@@ -127,17 +127,17 @@ Engage(BitmapWidget BW, Cardinal current)
Boolean BWRemoveRequest(); */
/*
- * Scans down the request stack removing all requests untill it finds
+ * Scans down the request stack removing all requests untill it finds
* one to be trapped.
*/
-static void
+static void
TrappingLoop(BitmapWidget BW)
{
if (DEBUG)
fprintf(stderr, "Scanning... Current: %d\n", BW->bitmap.current);
- if ((BW->bitmap.current > 0)
- &&
+ if ((BW->bitmap.current > 0)
+ &&
(!BW->bitmap.request_stack[BW->bitmap.current--].trap)) {
BWRemoveRequest((Widget) BW);
TrappingLoop(BW);
@@ -154,11 +154,11 @@ TrappingLoop(BitmapWidget 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
+Boolean
BWTerminateRequest(Widget w, Boolean cont)
{
BitmapWidget BW = (BitmapWidget) w;
-
+
if (BW->bitmap.current > 0) {
if (DEBUG)
fprintf(stderr, "Terminating... Current: %d\n", BW->bitmap.current);
@@ -167,7 +167,7 @@ BWTerminateRequest(Widget w, Boolean cont)
(w,
BW->bitmap.request_stack[BW->bitmap.current].status,
BW->bitmap.request_stack[BW->bitmap.current].request->terminate_client_data);
-
+
if (cont) {
if (BW->bitmap.current == BW->bitmap.cardinal)
TrappingLoop(BW);
@@ -181,14 +181,14 @@ BWTerminateRequest(Widget w, Boolean cont)
else
BW->bitmap.current = 0;
}
-
+
return BW->bitmap.current;
}
/*
* Simple interface to BWTerminateRequest that takes only a widget.
*/
-void
+void
BWAbort(Widget w)
{
BWTerminateRequest(w, True);
@@ -199,36 +199,36 @@ BWAbort(Widget w)
* it will terminate it.
* Returns TRUE if the number of requests left on the stack != 0.
*/
-Boolean
+Boolean
BWRemoveRequest(Widget w)
{
BitmapWidget BW = (BitmapWidget) w;
-
+
if (BW->bitmap.cardinal > 0) {
if (DEBUG)
fprintf(stderr, "Removing... Cardinal: %d\n", BW->bitmap.cardinal);
if (BW->bitmap.current == BW->bitmap.cardinal)
BWTerminateRequest(w, False);
-
+
if (BW->bitmap.request_stack[BW->bitmap.cardinal].request->remove)
(*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);
-
+
XtFree(BW->bitmap.request_stack[BW->bitmap.cardinal].status);
XtFree(BW->bitmap.request_stack[BW->bitmap.cardinal].call_data);
BW->bitmap.request_stack = (BWRequestStack *)
XtRealloc((char *)BW->bitmap.request_stack,
(--BW->bitmap.cardinal + 1) * sizeof(BWRequestStack));
-
+
return True;
}
- else
+ else
return False;
}
-void
+void
BWRemoveAllRequests(Widget w)
{
while (BWRemoveRequest(w)) {/* removes all requests from the stack */}
@@ -238,19 +238,19 @@ BWRemoveAllRequests(Widget w)
* Adds the request to the stack and performs engaging ritual.
* Returns TRUE if the request was found, FALSE otherwise.
*/
-Boolean
-BWEngageRequest(Widget w, BWRequest name, Boolean trap,
+Boolean
+BWEngageRequest(Widget w, BWRequest name, Boolean trap,
XtPointer call_data, Cardinal call_data_size)
{
BitmapWidget BW = (BitmapWidget) w;
-
+
if (BWAddRequest(w, name, trap, call_data, call_data_size)) {
BWTerminateRequest(w, False);
if (DEBUG)
fprintf(stderr, "Engaging... Cardinal: %d\n", BW->bitmap.cardinal);
if (!Engage(BW, BW->bitmap.cardinal))
BWTerminateRequest(w, True);
-
+
return True;
}
else
diff --git a/Requests.h b/Requests.h
index c4457e2..111942f 100644
--- a/Requests.h
+++ b/Requests.h
@@ -69,17 +69,17 @@ 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,
+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,
+extern void BWZoomIn(Widget w, Position from_x, Position from_y,
Position to_x, Position to_y);
-extern void OnePointHandler(Widget w, XtPointer client_data,
+extern void OnePointHandler(Widget w, XtPointer client_data,
XEvent *event, Boolean *cont);
-extern void TwoPointsHandler(Widget w, XtPointer client_data,
+extern void TwoPointsHandler(Widget w, XtPointer client_data,
XEvent *event, Boolean *cont);
-extern void DragTwoPointsHandler(Widget w, XtPointer client_data,
+extern void DragTwoPointsHandler(Widget w, XtPointer client_data,
XEvent *event, Boolean *cont);
#endif /* _Requests_h */
diff --git a/app-defaults/Bitmap b/app-defaults/Bitmap
index f9cc220..e55fce0 100644
--- a/app-defaults/Bitmap
+++ b/app-defaults/Bitmap
@@ -101,11 +101,11 @@
*SmeBSB.HorizontalMargins: 32
*fileMenu.new.label: New (Ctrl-N)...
-*fileMenu.load.label: Load (Ctrl-F)...
-*fileMenu.insert.label: Insert (Ctrl-I)...
+*fileMenu.load.label: Load (Ctrl-F)...
+*fileMenu.insert.label: Insert (Ctrl-I)...
*fileMenu.save.label: Save (Ctrl-S)
*fileMenu.saveAs.label: Save As (Ctrl-W)...
-*fileMenu.resize.label: Resize (Ctrl-R)...
+*fileMenu.resize.label: Resize (Ctrl-R)...
*fileMenu.rescale.label: Rescale (Ctrl-X)...
*fileMenu.filename.label: Filename (Ctrl-E)...
*fileMenu.basename.label: Basename (Ctrl-B)...
diff --git a/app-defaults/Bitmap-nocase b/app-defaults/Bitmap-nocase
index 4b35387..bcd4c4c 100644
--- a/app-defaults/Bitmap-nocase
+++ b/app-defaults/Bitmap-nocase
@@ -104,11 +104,11 @@
*SmeBSB.HorizontalMargins: 32
*fileMenu.new.label: New (Ctrl-N)...
-*fileMenu.load.label: Load (Ctrl-F)...
-*fileMenu.insert.label: Insert (Ctrl-I)...
+*fileMenu.load.label: Load (Ctrl-F)...
+*fileMenu.insert.label: Insert (Ctrl-I)...
*fileMenu.save.label: Save (Ctrl-S)
*fileMenu.saveAs.label: Save As (Ctrl-W)...
-*fileMenu.resize.label: Resize (Ctrl-R)...
+*fileMenu.resize.label: Resize (Ctrl-R)...
*fileMenu.rescale.label: Rescale (Ctrl-X)...
*fileMenu.filename.label: Filename (Ctrl-E)...
*fileMenu.basename.label: Basename (Ctrl-B)...
diff --git a/atobm.c b/atobm.c
index ec41944..9963209 100644
--- a/atobm.c
+++ b/atobm.c
@@ -38,21 +38,21 @@ from The Open Group.
static char *ProgramName;
-static void doit(FILE *fp, char *filename, char *chars,
+static void doit(FILE *fp, char *filename, char *chars,
int xhot, int yhot, char *name);
-static void
+static void
usage (void)
{
fprintf (stderr, "usage: %s [-options ...] [filename]\n\n",
ProgramName);
- fprintf (stderr,
+ fprintf (stderr,
"where options include:\n");
- fprintf (stderr,
+ fprintf (stderr,
" -chars cc chars to use for 0 and 1 bits, respectively\n");
- fprintf (stderr,
+ fprintf (stderr,
" -name variable name to use in bitmap file\n");
- fprintf (stderr,
+ fprintf (stderr,
" -xhot number x position of hotspot\n");
fprintf (stderr,
" -yhot number y position of hotspot\n");
@@ -162,10 +162,10 @@ main (int argc, char *argv[])
static void
-doit (FILE *fp,
- char *filename,
- char *chars,
- int xhot, int yhot,
+doit (FILE *fp,
+ char *filename,
+ char *chars,
+ int xhot, int yhot,
char *name)
{
int i, j;
@@ -187,7 +187,7 @@ doit (FILE *fp,
static unsigned char masktable[] = {
0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 };
int padded = 0;
-
+
#define NTOALLOC 16
#define NewSList() \
slist = (struct _scan_list *) calloc (1, sizeof *slist); \
@@ -204,7 +204,7 @@ doit (FILE *fp,
return; \
} \
slist->used = 0; \
- slist->next = NULL;
+ slist->next = NULL;
while (1) {
buf[0] = '\0';
diff --git a/bmtoa.c b/bmtoa.c
index 2918469..985b04a 100644
--- a/bmtoa.c
+++ b/bmtoa.c
@@ -50,15 +50,15 @@ extern char *mktemp();
static char *ProgramName;
-static void print_scanline (unsigned int width, unsigned int height,
+static void print_scanline (unsigned int width, unsigned int height,
unsigned char *data, char *chars);
-static void
+static void
usage (void)
{
fprintf (stderr, "usage: %s [-options ...] [filename]\n\n",
ProgramName);
- fprintf (stderr,
+ fprintf (stderr,
"where options include:\n");
fprintf (stderr,
" -chars cc chars to use for 0 and 1 bits, respectively\n");
@@ -116,7 +116,7 @@ copy_stdin (void)
}
int
-main (int argc, char *argv[])
+main (int argc, char *argv[])
{
char *filename = NULL;
int isstdin = 0;
@@ -175,9 +175,9 @@ main (int argc, char *argv[])
}
static void
-print_scanline (unsigned int width,
- unsigned int height,
- unsigned char *data,
+print_scanline (unsigned int width,
+ unsigned int height,
+ unsigned char *data,
char *chars)
{
unsigned char *dp = data;
diff --git a/configure.ac b/configure.ac
index e2ef3ce..ecb71ce 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
dnl Copyright 2005 Red Hat, Inc.
-dnl
+dnl
dnl Permission to use, copy, modify, distribute, and sell this software and its
dnl documentation for any purpose is hereby granted without fee, provided that
dnl the above copyright notice appear in all copies and that both that
@@ -10,7 +10,7 @@ dnl advertising or publicity pertaining to distribution of the software without
dnl specific, written prior permission. Red Hat makes no
dnl representations about the suitability of this software for any purpose. It
dnl is provided "as is" without express or implied warranty.
-dnl
+dnl
dnl RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
dnl EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR