aboutsummaryrefslogtreecommitdiff
path: root/generic
diff options
context:
space:
mode:
authorlecoanet2005-04-13 14:07:59 +0000
committerlecoanet2005-04-13 14:07:59 +0000
commit46ea8bc12e435b7ca6593bc43498ef6aae3e261a (patch)
tree999a9e3b04ec40156befba0c189c83d07aac4cfa /generic
parent970957ef4d39e8558410347852b709cf8fd15e87 (diff)
downloadtkzinc-46ea8bc12e435b7ca6593bc43498ef6aae3e261a.zip
tkzinc-46ea8bc12e435b7ca6593bc43498ef6aae3e261a.tar.gz
tkzinc-46ea8bc12e435b7ca6593bc43498ef6aae3e261a.tar.bz2
tkzinc-46ea8bc12e435b7ca6593bc43498ef6aae3e261a.tar.xz
Expanded the tabs into spaces to make the indenting independant of
the editing environment (emacs vs vi for example).
Diffstat (limited to 'generic')
-rw-r--r--generic/Arc.c674
-rw-r--r--generic/Attrs.c384
-rw-r--r--generic/Attrs.h212
-rw-r--r--generic/Color.c424
-rw-r--r--generic/Color.h64
-rw-r--r--generic/Curve.c1422
-rw-r--r--generic/Draw.c1142
-rw-r--r--generic/Draw.h52
-rw-r--r--generic/Field.c1240
-rw-r--r--generic/Field.h28
-rw-r--r--generic/Geo.c1150
-rw-r--r--generic/Geo.h380
-rw-r--r--generic/Group.c722
-rw-r--r--generic/Group.h4
-rw-r--r--generic/Icon.c372
-rw-r--r--generic/Image.c708
-rw-r--r--generic/Image.h32
-rw-r--r--generic/Item.c1956
-rw-r--r--generic/Item.h350
-rw-r--r--generic/List.c244
-rw-r--r--generic/List.h66
-rw-r--r--generic/Map.c942
-rw-r--r--generic/MapInfo.c1410
-rw-r--r--generic/MapInfo.h38
-rw-r--r--generic/OverlapMan.c538
-rw-r--r--generic/OverlapMan.h54
-rw-r--r--generic/PostScript.c394
-rw-r--r--generic/PostScript.h6
-rw-r--r--generic/Rectangle.c424
-rw-r--r--generic/Reticle.c280
-rw-r--r--generic/Tabular.c232
-rw-r--r--generic/Text.c858
-rw-r--r--generic/Track.c1110
-rw-r--r--generic/Track.h18
-rw-r--r--generic/Transfo.c288
-rw-r--r--generic/Transfo.h94
-rw-r--r--generic/Triangles.c310
-rw-r--r--generic/Types.h48
-rw-r--r--generic/WidgetInfo.h330
-rw-r--r--generic/Window.c240
-rw-r--r--generic/perfos.c38
-rw-r--r--generic/perfos.h4
-rw-r--r--generic/tkZinc.c6084
-rw-r--r--generic/tkZinc.h94
44 files changed, 12730 insertions, 12730 deletions
diff --git a/generic/Arc.c b/generic/Arc.c
index 25f4e7b..9373d58 100644
--- a/generic/Arc.c
+++ b/generic/Arc.c
@@ -1,8 +1,8 @@
/*
* Arc.c -- Implementation of Arc item.
*
- * Authors : Patrick Lecoanet.
- * Creation date : Wed Mar 30 16:24:09 1994
+ * Authors : Patrick Lecoanet.
+ * Creation date : Wed Mar 30 16:24:09 1994
*
* $Id$
*/
@@ -43,13 +43,13 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ "
/*
* Bit offset of flags.
*/
-#define FILLED_BIT 1<<0 /* If the arc is filled with color/pattern */
-#define CLOSED_BIT 1<<1 /* If the arc outline is closed */
-#define PIE_SLICE_BIT 1<<2 /* If the arc is closed as a pie slice or a chord */
+#define FILLED_BIT 1<<0 /* If the arc is filled with color/pattern */
+#define CLOSED_BIT 1<<1 /* If the arc outline is closed */
+#define PIE_SLICE_BIT 1<<2 /* If the arc is closed as a pie slice or a chord */
-#define FIRST_END_OK 1<<3
-#define LAST_END_OK 1<<4
-#define USING_POLY_BIT 1<<5
+#define FIRST_END_OK 1<<3
+#define LAST_END_OK 1<<4
+#define USING_POLY_BIT 1<<5
static double Pick(ZnItem item, ZnPick ps);
@@ -63,31 +63,31 @@ static double Pick(ZnItem item, ZnPick ps);
**********************************************************************************
*/
typedef struct _ArcItemStruct {
- ZnItemStruct header;
+ ZnItemStruct header;
/* Public data */
- ZnPoint coords[2];
- int start_angle;
- int angle_extent;
- ZnImage line_pattern;
- ZnGradient *fill_color;
- ZnGradient *line_color;
- ZnDim line_width;
- ZnLineStyle line_style;
- ZnLineEnd first_end;
- ZnLineEnd last_end;
- ZnImage tile;
+ ZnPoint coords[2];
+ int start_angle;
+ int angle_extent;
+ ZnImage line_pattern;
+ ZnGradient *fill_color;
+ ZnGradient *line_color;
+ ZnDim line_width;
+ ZnLineStyle line_style;
+ ZnLineEnd first_end;
+ ZnLineEnd last_end;
+ ZnImage tile;
unsigned short flags;
/* Private data */
- ZnPoint orig;
- ZnPoint corner;
- ZnList render_shape;
- ZnPoint *grad_geo;
+ ZnPoint orig;
+ ZnPoint corner;
+ ZnList render_shape;
+ ZnPoint *grad_geo;
} ArcItemStruct, *ArcItem;
-static ZnAttrConfig arc_attrs[] = {
+static ZnAttrConfig arc_attrs[] = {
{ ZN_CONFIG_BOOL, "-closed", NULL,
Tk_Offset(ArcItemStruct, flags), CLOSED_BIT, ZN_COORDS_FLAG, False },
{ ZN_CONFIG_BOOL, "-composealpha", NULL,
@@ -150,14 +150,14 @@ static ZnAttrConfig arc_attrs[] = {
**********************************************************************************
*/
static int
-Init(ZnItem item,
- int *argc,
- Tcl_Obj *CONST *args[])
+Init(ZnItem item,
+ int *argc,
+ Tcl_Obj *CONST *args[])
{
- ZnWInfo *wi = item->wi;
- ArcItem arc = (ArcItem) item;
- unsigned int num_points;
- ZnPoint *points;
+ ZnWInfo *wi = item->wi;
+ ArcItem arc = (ArcItem) item;
+ unsigned int num_points;
+ ZnPoint *points;
/* Init attributes */
SET(item->flags, ZN_VISIBLE_BIT);
@@ -186,7 +186,7 @@ Init(ZnItem item,
return TCL_ERROR;
}
if (ZnParseCoordList(wi, (*args)[0], &points,
- NULL, &num_points, NULL) == TCL_ERROR) {
+ NULL, &num_points, NULL) == TCL_ERROR) {
return TCL_ERROR;
}
if (num_points != 2) {
@@ -213,9 +213,9 @@ Init(ZnItem item,
**********************************************************************************
*/
static void
-Clone(ZnItem item)
+Clone(ZnItem item)
{
- ArcItem arc = (ArcItem) item;
+ ArcItem arc = (ArcItem) item;
if (arc->tile != ZnUnspecifiedImage) {
arc->tile = ZnGetImageByValue(arc->tile, ZnUpdateItemImage, item);
@@ -246,9 +246,9 @@ Clone(ZnItem item)
**********************************************************************************
*/
static void
-Destroy(ZnItem item)
+Destroy(ZnItem item)
{
- ArcItem arc = (ArcItem) item;
+ ArcItem arc = (ArcItem) item;
if (arc->render_shape) {
ZnListFree(arc->render_shape);
@@ -284,17 +284,17 @@ Destroy(ZnItem item)
**********************************************************************************
*/
static void
-SetRenderFlags(ArcItem arc)
+SetRenderFlags(ArcItem arc)
{
ASSIGN(arc->flags, FIRST_END_OK,
- (arc->first_end != NULL) && ISCLEAR(arc->flags, CLOSED_BIT) &&
- ISCLEAR(arc->flags, FILLED_BIT) && arc->line_width
- /*&& ISCLEAR(arc->flags, RELIEF_OK)*/);
+ (arc->first_end != NULL) && ISCLEAR(arc->flags, CLOSED_BIT) &&
+ ISCLEAR(arc->flags, FILLED_BIT) && arc->line_width
+ /*&& ISCLEAR(arc->flags, RELIEF_OK)*/);
ASSIGN(arc->flags, LAST_END_OK,
- (arc->last_end != NULL) && ISCLEAR(arc->flags, CLOSED_BIT) &&
- ISCLEAR(arc->flags, FILLED_BIT) && arc->line_width
- /*&& ISCLEAR(arc->flags, RELIEF_OK)*/);
+ (arc->last_end != NULL) && ISCLEAR(arc->flags, CLOSED_BIT) &&
+ ISCLEAR(arc->flags, FILLED_BIT) && arc->line_width
+ /*&& ISCLEAR(arc->flags, RELIEF_OK)*/);
}
@@ -306,13 +306,13 @@ SetRenderFlags(ArcItem arc)
**********************************************************************************
*/
static int
-Configure(ZnItem item,
- int argc,
- Tcl_Obj *CONST argv[],
- int *flags)
+Configure(ZnItem item,
+ int argc,
+ Tcl_Obj *CONST argv[],
+ int *flags)
{
- ArcItem arc = (ArcItem) item;
- int status = TCL_OK;
+ ArcItem arc = (ArcItem) item;
+ int status = TCL_OK;
status = ZnConfigureAttributes(item->wi, item, item, arc_attrs, argc, argv, flags);
if (arc->start_angle < 0) {
@@ -333,9 +333,9 @@ Configure(ZnItem item,
**********************************************************************************
*/
static int
-Query(ZnItem item,
- int argc,
- Tcl_Obj *CONST argv[])
+Query(ZnItem item,
+ int argc,
+ Tcl_Obj *CONST argv[])
{
if (ZnQueryAttribute(item->wi->interp, item, arc_attrs, argv[0]) == TCL_ERROR) {
return TCL_ERROR;
@@ -353,12 +353,12 @@ Query(ZnItem item,
**********************************************************************************
*/
static void
-UpdateRenderShape(ArcItem arc)
+UpdateRenderShape(ArcItem arc)
{
- ZnPoint *p_list, p, p2, o, o2;
- ZnReal width, height, d;
- int num_p, i, quality;
- ZnTransfo *t = ((ZnItem) arc)->wi->current_transfo;
+ ZnPoint *p_list, p, p2, o, o2;
+ ZnReal width, height, d;
+ int num_p, i, quality;
+ ZnTransfo *t = ((ZnItem) arc)->wi->current_transfo;
if (!arc->render_shape) {
arc->render_shape = ZnListNew(8, sizeof(ZnPoint));
@@ -370,11 +370,11 @@ UpdateRenderShape(ArcItem arc)
d = MAX(width, height);
quality = ZN_CIRCLE_COARSE;
p_list = ZnGetCirclePoints(ISCLEAR(arc->flags, PIE_SLICE_BIT) ? 1 : 2,
- quality,
- ZnDegRad(arc->start_angle),
- ZnDegRad(arc->angle_extent),
- &num_p,
- arc->render_shape);
+ quality,
+ ZnDegRad(arc->start_angle),
+ ZnDegRad(arc->angle_extent),
+ &num_p,
+ arc->render_shape);
/*
* Adapt the number of arc points to the radius of the arc.
@@ -396,11 +396,11 @@ UpdateRenderShape(ArcItem arc)
if (quality != ZN_CIRCLE_COARSE) {
p_list = ZnGetCirclePoints(ISCLEAR(arc->flags, PIE_SLICE_BIT) ? 1 : 2,
- quality,
- ZnDegRad(arc->start_angle),
- ZnDegRad(arc->angle_extent),
- &num_p,
- arc->render_shape);
+ quality,
+ ZnDegRad(arc->start_angle),
+ ZnDegRad(arc->angle_extent),
+ &num_p,
+ arc->render_shape);
}
for (i = 0; i < num_p; i++, p_list++) {
@@ -411,15 +411,15 @@ UpdateRenderShape(ArcItem arc)
}
static void
-ComputeCoordinates(ZnItem item,
- ZnBool force)
+ComputeCoordinates(ZnItem item,
+ ZnBool force)
{
- ZnWInfo *wi = item->wi;
- ArcItem arc = (ArcItem) item;
- ZnReal angle, tmp;
- unsigned int num_p;
- ZnPoint *p_list;
- ZnPoint end_points[ZN_LINE_END_POINTS];
+ ZnWInfo *wi = item->wi;
+ ArcItem arc = (ArcItem) item;
+ ZnReal angle, tmp;
+ unsigned int num_p;
+ ZnPoint *p_list;
+ ZnPoint end_points[ZN_LINE_END_POINTS];
ZnResetBBox(&item->item_bounding_box);
/*
@@ -454,12 +454,12 @@ ComputeCoordinates(ZnItem item,
*/
if (ISSET(arc->flags, FIRST_END_OK)) {
ZnGetLineEnd(p_list, p_list+1, arc->line_width, CapRound,
- arc->first_end, end_points);
+ arc->first_end, end_points);
ZnAddPointsToBBox(&item->item_bounding_box, end_points, ZN_LINE_END_POINTS);
}
if (ISSET(arc->flags, LAST_END_OK)) {
ZnGetLineEnd(&p_list[num_p-1], &p_list[num_p-2], arc->line_width, CapRound,
- arc->last_end, end_points);
+ arc->last_end, end_points);
ZnAddPointsToBBox(&item->item_bounding_box, end_points, ZN_LINE_END_POINTS);
}
@@ -469,26 +469,26 @@ ComputeCoordinates(ZnItem item,
ZnPoint p[4];
if (!arc->grad_geo) {
- arc->grad_geo = ZnMalloc(6*sizeof(ZnPoint));
+ arc->grad_geo = ZnMalloc(6*sizeof(ZnPoint));
}
if (arc->fill_color->type == ZN_AXIAL_GRADIENT) {
- p[0] = arc->coords[0];
- p[2] = arc->coords[1];
- p[1].x = p[2].x;
- p[1].y = p[0].y;
- p[3].x = p[0].x;
- p[3].y = p[2].y;
- ZnPolyContour1(&shape, p, 4, False);
+ p[0] = arc->coords[0];
+ p[2] = arc->coords[1];
+ p[1].x = p[2].x;
+ p[1].y = p[0].y;
+ p[3].x = p[0].x;
+ p[3].y = p[2].y;
+ ZnPolyContour1(&shape, p, 4, False);
}
else {
- ZnPolyContour1(&shape, arc->coords, 2, False);
+ ZnPolyContour1(&shape, arc->coords, 2, False);
}
ZnComputeGradient(arc->fill_color, wi, &shape, arc->grad_geo);
}
else {
if (arc->grad_geo) {
- ZnFree(arc->grad_geo);
- arc->grad_geo = NULL;
+ ZnFree(arc->grad_geo);
+ arc->grad_geo = NULL;
}
}
#endif
@@ -496,9 +496,9 @@ ComputeCoordinates(ZnItem item,
}
/*
- ******* ******** **********
+ ******* ******** **********
* This part is for X drawn arcs: full extent, not rotated.
- ******* ******** **********
+ ******* ******** **********
*/
CLEAR(arc->flags, USING_POLY_BIT);
ZnTransformPoint(wi->current_transfo, &arc->coords[0], &arc->orig);
@@ -519,24 +519,24 @@ ComputeCoordinates(ZnItem item,
**********************************************************************************
*
* ToArea --
- * Tell if the object is entirely outside (-1),
- * entirely inside (1) or in between (0).
+ * Tell if the object is entirely outside (-1),
+ * entirely inside (1) or in between (0).
*
**********************************************************************************
*/
static int
-ToArea(ZnItem item,
- ZnToArea ta)
+ToArea(ZnItem item,
+ ZnToArea ta)
{
- ArcItem arc = (ArcItem) item;
- ZnPoint *points;
- ZnPoint pts[20]; /* Should be at least ZN_LINE_END_POINTS large */
- ZnPoint center;
- ZnBBox *area = ta->area;
- unsigned int num_points;
- int result=-1, result2;
- ZnReal lw = arc->line_width;
- ZnReal width, height;
+ ArcItem arc = (ArcItem) item;
+ ZnPoint *points;
+ ZnPoint pts[20]; /* Should be at least ZN_LINE_END_POINTS large */
+ ZnPoint center;
+ ZnBBox *area = ta->area;
+ unsigned int num_points;
+ int result=-1, result2;
+ ZnReal lw = arc->line_width;
+ ZnReal width, height;
if (ISSET(arc->flags, USING_POLY_BIT)) {
if (ISSET(arc->flags, FILLED_BIT) || (arc->line_width)) {
@@ -544,48 +544,48 @@ ToArea(ZnItem item,
num_points = ZnListSize(arc->render_shape);
if (ISSET(arc->flags, FILLED_BIT)) {
- result = ZnPolygonInBBox(points, num_points, area, NULL);
- if (result == 0) {
- return 0;
- }
+ result = ZnPolygonInBBox(points, num_points, area, NULL);
+ if (result == 0) {
+ return 0;
+ }
}
if (arc->line_width > 0) {
- result2 = ZnPolylineInBBox(points, num_points, arc->line_width,
- CapRound, JoinRound, area);
- if (ISCLEAR(arc->flags, FILLED_BIT)) {
- if (result2 == 0) {
- return 0;
- }
- result = result2;
- }
- else if (result2 != result) {
- return 0;
- }
- if (ISSET(arc->flags, CLOSED_BIT) && ISSET(arc->flags, PIE_SLICE_BIT)) {
- pts[0] = points[num_points-1];
- pts[1] = points[0];
- if (ZnPolylineInBBox(pts, 2, arc->line_width,
- CapRound, JoinRound, area) != result) {
- return 0;
- }
- }
- /*
- * Check line ends.
- */
- if (ISSET(arc->flags, FIRST_END_OK)) {
- ZnGetLineEnd(&points[0], &points[1], arc->line_width, CapRound,
- arc->first_end, pts);
- if (ZnPolygonInBBox(pts, ZN_LINE_END_POINTS, area, NULL) != result) {
- return 0;
- }
- }
- if (ISSET(arc->flags, LAST_END_OK)) {
- ZnGetLineEnd(&points[num_points-1], &points[num_points-2], arc->line_width,
- CapRound, arc->last_end, pts);
- if (ZnPolygonInBBox(pts, ZN_LINE_END_POINTS, area, NULL) != result) {
- return 0;
- }
- }
+ result2 = ZnPolylineInBBox(points, num_points, arc->line_width,
+ CapRound, JoinRound, area);
+ if (ISCLEAR(arc->flags, FILLED_BIT)) {
+ if (result2 == 0) {
+ return 0;
+ }
+ result = result2;
+ }
+ else if (result2 != result) {
+ return 0;
+ }
+ if (ISSET(arc->flags, CLOSED_BIT) && ISSET(arc->flags, PIE_SLICE_BIT)) {
+ pts[0] = points[num_points-1];
+ pts[1] = points[0];
+ if (ZnPolylineInBBox(pts, 2, arc->line_width,
+ CapRound, JoinRound, area) != result) {
+ return 0;
+ }
+ }
+ /*
+ * Check line ends.
+ */
+ if (ISSET(arc->flags, FIRST_END_OK)) {
+ ZnGetLineEnd(&points[0], &points[1], arc->line_width, CapRound,
+ arc->first_end, pts);
+ if (ZnPolygonInBBox(pts, ZN_LINE_END_POINTS, area, NULL) != result) {
+ return 0;
+ }
+ }
+ if (ISSET(arc->flags, LAST_END_OK)) {
+ ZnGetLineEnd(&points[num_points-1], &points[num_points-2], arc->line_width,
+ CapRound, arc->last_end, pts);
+ if (ZnPolygonInBBox(pts, ZN_LINE_END_POINTS, area, NULL) != result) {
+ return 0;
+ }
+ }
}
return result;
}
@@ -595,10 +595,10 @@ ToArea(ZnItem item,
}
/*
- ******* ******** **********
+ ******* ******** **********
* The rest of this code deal with non rotated, full extent *
- * arcs. It has been stolen from tkRectOval.c *
- ******* ******** **********
+ * arcs. It has been stolen from tkRectOval.c *
+ ******* ******** **********
*/
/*
* Transform both the arc and the rectangle so that the arc's oval
@@ -631,7 +631,7 @@ ToArea(ZnItem item,
y_delta2 = (area->corner.y - center.y) / height;
y_delta2 *= y_delta2;
if (((x_delta1 + y_delta1) < 1.0) && ((x_delta1 + y_delta2) < 1.0) &&
- ((x_delta2 + y_delta1) < 1.0) && ((x_delta2 + y_delta2) < 1.0)) {
+ ((x_delta2 + y_delta1) < 1.0) && ((x_delta2 + y_delta2) < 1.0)) {
return -1;
}
}
@@ -648,15 +648,15 @@ ToArea(ZnItem item,
**********************************************************************************
*/
static void
-Draw(ZnItem item)
+Draw(ZnItem item)
{
- ZnWInfo *wi = item->wi;
- ArcItem arc = (ArcItem) item;
- XGCValues values;
- unsigned int width=0, height=0;
- ZnPoint *p=NULL;
- XPoint *xp=NULL;
- unsigned int num_points=0, i;
+ ZnWInfo *wi = item->wi;
+ ArcItem arc = (ArcItem) item;
+ XGCValues values;
+ unsigned int width=0, height=0;
+ ZnPoint *p=NULL;
+ XPoint *xp=NULL;
+ unsigned int num_points=0, i;
if (ISCLEAR(arc->flags, FILLED_BIT) && !arc->line_width) {
return;
@@ -683,22 +683,22 @@ Draw(ZnItem item)
values.arc_mode = ISSET(arc->flags, PIE_SLICE_BIT) ? ArcPieSlice : ArcChord;
if (arc->tile != ZnUnspecifiedImage) {
if (!ZnImageIsBitmap(arc->tile)) { /* Fill tiled */
- values.fill_style = FillTiled;
- values.tile = ZnImagePixmap(arc->tile, wi->win);
- values.ts_x_origin = (int) item->item_bounding_box.orig.x;
- values.ts_y_origin = (int) item->item_bounding_box.orig.y;
- XChangeGC(wi->dpy, wi->gc,
- GCTileStipXOrigin|GCTileStipYOrigin|GCFillStyle|GCTile|GCArcMode,
- &values);
+ values.fill_style = FillTiled;
+ values.tile = ZnImagePixmap(arc->tile, wi->win);
+ values.ts_x_origin = (int) item->item_bounding_box.orig.x;
+ values.ts_y_origin = (int) item->item_bounding_box.orig.y;
+ XChangeGC(wi->dpy, wi->gc,
+ GCTileStipXOrigin|GCTileStipYOrigin|GCFillStyle|GCTile|GCArcMode,
+ &values);
}
else { /* Fill stippled */
- values.fill_style = FillStippled;
- values.stipple = ZnImagePixmap(arc->tile, wi->win);
- values.ts_x_origin = (int) item->item_bounding_box.orig.x;
- values.ts_y_origin = (int) item->item_bounding_box.orig.y;
- XChangeGC(wi->dpy, wi->gc,
- GCTileStipXOrigin|GCTileStipYOrigin|GCFillStyle|GCStipple|GCForeground|GCArcMode,
- &values);
+ values.fill_style = FillStippled;
+ values.stipple = ZnImagePixmap(arc->tile, wi->win);
+ values.ts_x_origin = (int) item->item_bounding_box.orig.x;
+ values.ts_y_origin = (int) item->item_bounding_box.orig.y;
+ XChangeGC(wi->dpy, wi->gc,
+ GCTileStipXOrigin|GCTileStipYOrigin|GCFillStyle|GCStipple|GCForeground|GCArcMode,
+ &values);
}
}
else { /* Fill solid */
@@ -708,15 +708,15 @@ Draw(ZnItem item)
if (ISSET(arc->flags, USING_POLY_BIT)) {
XFillPolygon(wi->dpy, wi->draw_buffer, wi->gc,
- xp, (int) num_points, Nonconvex, CoordModeOrigin);
+ xp, (int) num_points, Nonconvex, CoordModeOrigin);
}
else {
XFillArc(wi->dpy, wi->draw_buffer, wi->gc,
- (int) arc->orig.x,
- (int) arc->orig.y,
- (unsigned int) width,
- (unsigned int) height,
- -arc->start_angle*64, -arc->angle_extent*64);
+ (int) arc->orig.x,
+ (int) arc->orig.y,
+ (unsigned int) width,
+ (unsigned int) height,
+ -arc->start_angle*64, -arc->angle_extent*64);
}
}
@@ -735,55 +735,55 @@ Draw(ZnItem item)
if (arc->line_pattern == ZnUnspecifiedImage) {
values.fill_style = FillSolid;
XChangeGC(wi->dpy, wi->gc,
- GCFillStyle|GCLineWidth|GCCapStyle|GCJoinStyle|GCForeground, &values);
+ GCFillStyle|GCLineWidth|GCCapStyle|GCJoinStyle|GCForeground, &values);
}
else {
values.fill_style = FillStippled;
values.stipple = ZnImagePixmap(arc->line_pattern, wi->win);
XChangeGC(wi->dpy, wi->gc,
- GCFillStyle|GCStipple|GCLineWidth|GCCapStyle|GCJoinStyle|GCForeground,
- &values);
+ GCFillStyle|GCStipple|GCLineWidth|GCCapStyle|GCJoinStyle|GCForeground,
+ &values);
}
if (ISSET(arc->flags, USING_POLY_BIT)) {
if (ISCLEAR(arc->flags, CLOSED_BIT) && arc->angle_extent != 360) {
- num_points--;
- if (ISSET(arc->flags, PIE_SLICE_BIT)) {
- num_points--;
- }
+ num_points--;
+ if (ISSET(arc->flags, PIE_SLICE_BIT)) {
+ num_points--;
+ }
}
XDrawLines(wi->dpy, wi->draw_buffer, wi->gc,
- xp, (int) num_points, CoordModeOrigin);
+ xp, (int) num_points, CoordModeOrigin);
if (ISSET(arc->flags, FIRST_END_OK)) {
- p = (ZnPoint *) ZnListArray(arc->render_shape);
- ZnGetLineEnd(p, p+1, arc->line_width, CapRound,
- arc->first_end, end_points);
- for (i = 0; i < ZN_LINE_END_POINTS; i++) {
- xap[i].x = (short) end_points[i].x;
- xap[i].y = (short) end_points[i].y;
- }
- XFillPolygon(wi->dpy, wi->draw_buffer, wi->gc, xap, ZN_LINE_END_POINTS,
- Nonconvex, CoordModeOrigin);
+ p = (ZnPoint *) ZnListArray(arc->render_shape);
+ ZnGetLineEnd(p, p+1, arc->line_width, CapRound,
+ arc->first_end, end_points);
+ for (i = 0; i < ZN_LINE_END_POINTS; i++) {
+ xap[i].x = (short) end_points[i].x;
+ xap[i].y = (short) end_points[i].y;
+ }
+ XFillPolygon(wi->dpy, wi->draw_buffer, wi->gc, xap, ZN_LINE_END_POINTS,
+ Nonconvex, CoordModeOrigin);
}
if (ISSET(arc->flags, LAST_END_OK)) {
- p = (ZnPoint *) ZnListArray(arc->render_shape);
- num_points = ZnListSize(arc->render_shape);
- ZnGetLineEnd(&p[num_points-1], &p[num_points-2], arc->line_width,
- CapRound, arc->last_end, end_points);
- for (i = 0; i < ZN_LINE_END_POINTS; i++) {
- xap[i].x = (short) end_points[i].x;
- xap[i].y = (short) end_points[i].y;
- }
- XFillPolygon(wi->dpy, wi->draw_buffer, wi->gc, xap, ZN_LINE_END_POINTS,
- Nonconvex, CoordModeOrigin);
+ p = (ZnPoint *) ZnListArray(arc->render_shape);
+ num_points = ZnListSize(arc->render_shape);
+ ZnGetLineEnd(&p[num_points-1], &p[num_points-2], arc->line_width,
+ CapRound, arc->last_end, end_points);
+ for (i = 0; i < ZN_LINE_END_POINTS; i++) {
+ xap[i].x = (short) end_points[i].x;
+ xap[i].y = (short) end_points[i].y;
+ }
+ XFillPolygon(wi->dpy, wi->draw_buffer, wi->gc, xap, ZN_LINE_END_POINTS,
+ Nonconvex, CoordModeOrigin);
}
}
else {
XDrawArc(wi->dpy, wi->draw_buffer, wi->gc,
- (int) arc->orig.x,
- (int) arc->orig.y,
- (unsigned int) width,
- (unsigned int) height,
- -arc->start_angle*64, -arc->angle_extent*64);
+ (int) arc->orig.x,
+ (int) arc->orig.y,
+ (unsigned int) width,
+ (unsigned int) height,
+ -arc->start_angle*64, -arc->angle_extent*64);
}
}
}
@@ -800,11 +800,11 @@ Draw(ZnItem item)
static void
ArcRenderCB(void *closure)
{
- ZnItem item = (ZnItem) closure;
- ArcItem arc = (ArcItem) item;
- int num_points=0, i;
- ZnPoint *p=NULL;
- ZnPoint center;
+ ZnItem item = (ZnItem) closure;
+ ArcItem arc = (ArcItem) item;
+ int num_points=0, i;
+ ZnPoint *p=NULL;
+ ZnPoint center;
center.x = (item->item_bounding_box.corner.x + item->item_bounding_box.orig.x) / 2.0;
center.y = (item->item_bounding_box.corner.y + item->item_bounding_box.orig.y) / 2.0;
@@ -821,12 +821,12 @@ ArcRenderCB(void *closure)
#ifdef GL
static void
-Render(ZnItem item)
+Render(ZnItem item)
{
- ZnWInfo *wi = item->wi;
- ArcItem arc = (ArcItem) item;
- unsigned int num_points=0;
- ZnPoint *p=NULL;
+ ZnWInfo *wi = item->wi;
+ ArcItem arc = (ArcItem) item;
+ unsigned int num_points=0;
+ ZnPoint *p=NULL;
if (ISCLEAR(arc->flags, FILLED_BIT) && !arc->line_width) {
return;
@@ -842,23 +842,23 @@ Render(ZnItem item)
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
if (!ZnGradientFlat(arc->fill_color)) {
- ZnPoly poly;
-
- ZnPolyContour1(&poly, ZnListArray(arc->render_shape),
- ZnListSize(arc->render_shape), False);
- ZnRenderGradient(wi, arc->fill_color, ArcRenderCB, arc,
- arc->grad_geo, &poly);
+ ZnPoly poly;
+
+ ZnPolyContour1(&poly, ZnListArray(arc->render_shape),
+ ZnListSize(arc->render_shape), False);
+ ZnRenderGradient(wi, arc->fill_color, ArcRenderCB, arc,
+ arc->grad_geo, &poly);
}
else if (arc->tile != ZnUnspecifiedImage) { /* Fill tiled/stippled */
- ZnRenderTile(wi, arc->tile, arc->fill_color, ArcRenderCB, arc,
- (ZnPoint *) &item->item_bounding_box);
+ ZnRenderTile(wi, arc->tile, arc->fill_color, ArcRenderCB, arc,
+ (ZnPoint *) &item->item_bounding_box);
}
else {
- unsigned short alpha;
- XColor *color = ZnGetGradientColor(arc->fill_color, 0.0, &alpha);
- alpha = ZnComposeAlpha(alpha, wi->alpha);
- glColor4us(color->red, color->green, color->blue, alpha);
- ArcRenderCB(arc);
+ unsigned short alpha;
+ XColor *color = ZnGetGradientColor(arc->fill_color, 0.0, &alpha);
+ alpha = ZnComposeAlpha(alpha, wi->alpha);
+ glColor4us(color->red, color->green, color->blue, alpha);
+ ArcRenderCB(arc);
}
}
@@ -866,23 +866,23 @@ Render(ZnItem item)
* Draw the arc.
*/
if (arc->line_width) {
- ZnLineEnd first = ISSET(arc->flags, FIRST_END_OK) ? arc->first_end : NULL;
- ZnLineEnd last = ISSET(arc->flags, LAST_END_OK) ? arc->last_end : NULL;
- ZnBool closed = ISSET(arc->flags, CLOSED_BIT);
+ ZnLineEnd first = ISSET(arc->flags, FIRST_END_OK) ? arc->first_end : NULL;
+ ZnLineEnd last = ISSET(arc->flags, LAST_END_OK) ? arc->last_end : NULL;
+ ZnBool closed = ISSET(arc->flags, CLOSED_BIT);
p = ZnListArray(arc->render_shape);
num_points = ZnListSize(arc->render_shape);
if (!closed) {
- if (arc->angle_extent != 360) {
- num_points--;
- if (ISSET(arc->flags, PIE_SLICE_BIT)) {
- num_points--;
- }
- }
+ if (arc->angle_extent != 360) {
+ num_points--;
+ if (ISSET(arc->flags, PIE_SLICE_BIT)) {
+ num_points--;
+ }
+ }
}
ZnRenderPolyline(wi, p, num_points, arc->line_width,
- arc->line_style, CapRound, JoinRound, first, last,
- arc->line_color);
+ arc->line_style, CapRound, JoinRound, first, last,
+ arc->line_color);
}
#ifdef GL_LIST
glEndList();
@@ -893,7 +893,7 @@ Render(ZnItem item)
}
#else
static void
-Render(ZnItem item)
+Render(ZnItem item)
{
}
#endif
@@ -907,11 +907,11 @@ Render(ZnItem item)
**********************************************************************************
*/
static ZnBool
-IsSensitive(ZnItem item,
- int item_part)
+IsSensitive(ZnItem item,
+ int item_part)
{
return (ISSET(item->flags, ZN_SENSITIVE_BIT) &&
- item->parent->class->IsSensitive(item->parent, ZN_NO_PART));
+ item->parent->class->IsSensitive(item->parent, ZN_NO_PART));
}
@@ -923,16 +923,16 @@ IsSensitive(ZnItem item,
**********************************************************************************
*/
static ZnReal
-Pick(ZnItem item,
- ZnPick ps)
+Pick(ZnItem item,
+ ZnPick ps)
{
- ArcItem arc = (ArcItem) item;
- double dist = 1e40, new_dist;
- ZnPoint center;
- ZnPoint *points, *p = ps->point;
- ZnPoint end_points[ZN_LINE_END_POINTS];
- unsigned int num_points;
- ZnDim lw = arc->line_width;
+ ArcItem arc = (ArcItem) item;
+ double dist = 1e40, new_dist;
+ ZnPoint center;
+ ZnPoint *points, *p = ps->point;
+ ZnPoint end_points[ZN_LINE_END_POINTS];
+ unsigned int num_points;
+ ZnDim lw = arc->line_width;
if (ISCLEAR(arc->flags, FILLED_BIT) && ! arc->line_width) {
return dist;
@@ -944,63 +944,63 @@ Pick(ZnItem item,
if (ISSET(arc->flags, FILLED_BIT)) {
dist = ZnPolygonToPointDist(points, num_points, p);
if (dist <= 0.0) {
- return 0.0;
+ return 0.0;
}
}
if (arc->line_width > 0) {
if (ISCLEAR(arc->flags, CLOSED_BIT) && arc->angle_extent != 360) {
- num_points--;
- if (ISSET(arc->flags, PIE_SLICE_BIT)) {
- num_points--;
- }
+ num_points--;
+ if (ISSET(arc->flags, PIE_SLICE_BIT)) {
+ num_points--;
+ }
}
new_dist = ZnPolylineToPointDist(points, num_points, arc->line_width,
- CapRound, JoinRound, p);
+ CapRound, JoinRound, p);
if (new_dist < dist) {
- dist = new_dist;
+ dist = new_dist;
}
if (dist <= 0.0) {
- return 0.0;
+ return 0.0;
}
/*
* Check line ends.
*/
if (ISSET(arc->flags, FIRST_END_OK)) {
- ZnGetLineEnd(&points[0], &points[1], arc->line_width, CapRound,
- arc->first_end, end_points);
- new_dist = ZnPolygonToPointDist(end_points, ZN_LINE_END_POINTS, p);
- if (new_dist < dist) {
- dist = new_dist;
- }
- if (dist <= 0.0) {
- return 0.0;
- }
+ ZnGetLineEnd(&points[0], &points[1], arc->line_width, CapRound,
+ arc->first_end, end_points);
+ new_dist = ZnPolygonToPointDist(end_points, ZN_LINE_END_POINTS, p);
+ if (new_dist < dist) {
+ dist = new_dist;
+ }
+ if (dist <= 0.0) {
+ return 0.0;
+ }
}
if (ISSET(arc->flags, LAST_END_OK)) {
- ZnGetLineEnd(&points[num_points-1], &points[num_points-2], arc->line_width,
- CapRound, arc->last_end, end_points);
- new_dist = ZnPolygonToPointDist(end_points, ZN_LINE_END_POINTS, p);
- if (new_dist < dist) {
- dist = new_dist;
- }
- if (dist <= 0.0) {
- return 0.0;
- }
+ ZnGetLineEnd(&points[num_points-1], &points[num_points-2], arc->line_width,
+ CapRound, arc->last_end, end_points);
+ new_dist = ZnPolygonToPointDist(end_points, ZN_LINE_END_POINTS, p);
+ if (new_dist < dist) {
+ dist = new_dist;
+ }
+ if (dist <= 0.0) {
+ return 0.0;
+ }
}
}
return dist;
}
/*
- ******* ******** **********
+ ******* ******** **********
* The rest of this code deal with non rotated full extent arcs. *
- ******* ******** **********
+ ******* ******** **********
*/
center.x = (arc->orig.x + arc->corner.x) / 2.0;
center.y = (arc->orig.y + arc->corner.y) / 2.0;
dist = ZnOvalToPointDist(&center, arc->corner.x - arc->orig.x,
- arc->corner.y - arc->orig.y, lw, p);
+ arc->corner.y - arc->orig.y, lw, p);
if (dist < 0.0) {
if (ISSET(arc->flags, FILLED_BIT)) {
dist = 0.0;
@@ -1016,26 +1016,26 @@ Pick(ZnItem item,
**********************************************************************************
*
* GetClipVertices --
- * Get the clipping shape.
- * Never ever call ZnTriFree on the tristrip returned by GetClipVertices.
+ * Get the clipping shape.
+ * Never ever call ZnTriFree on the tristrip returned by GetClipVertices.
*
**********************************************************************************
*/
static void
-UpdateRenderShapeX(ArcItem arc)
+UpdateRenderShapeX(ArcItem arc)
{
- ZnReal ox, oy, width_2, height_2;
- int i, num_p;
- ZnPoint *p_list;
+ ZnReal ox, oy, width_2, height_2;
+ int i, num_p;
+ ZnPoint *p_list;
if (!arc->render_shape) {
arc->render_shape = ZnListNew(8, sizeof(ZnPoint));
}
p_list = ZnGetCirclePoints(ISCLEAR(arc->flags, PIE_SLICE_BIT) ? 1 : 2,
- ZN_CIRCLE_FINE,
- ZnDegRad(arc->start_angle),
- ZnDegRad(arc->angle_extent),
- &num_p, arc->render_shape);
+ ZN_CIRCLE_FINE,
+ ZnDegRad(arc->start_angle),
+ ZnDegRad(arc->angle_extent),
+ &num_p, arc->render_shape);
ox = (arc->corner.x + arc->orig.x) / 2.0;
oy = (arc->corner.y + arc->orig.y) / 2.0;
width_2 = (arc->corner.x - arc->orig.x) / 2.0;
@@ -1047,11 +1047,11 @@ UpdateRenderShapeX(ArcItem arc)
}
static ZnBool
-GetClipVertices(ZnItem item,
- ZnTriStrip *tristrip)
+GetClipVertices(ZnItem item,
+ ZnTriStrip *tristrip)
{
- ArcItem arc = (ArcItem) item;
- ZnPoint center;
+ ArcItem arc = (ArcItem) item;
+ ZnPoint center;
if (ISCLEAR(arc->flags, USING_POLY_BIT) || !arc->render_shape) {
UpdateRenderShapeX(arc);
@@ -1065,7 +1065,7 @@ GetClipVertices(ZnItem item,
ZnListAdd(ZnWorkPoints, &center, ZnListTail);
ZnListAppend(ZnWorkPoints, arc->render_shape);
ZnTriStrip1(tristrip, ZnListArray(ZnWorkPoints),
- ZnListSize(ZnWorkPoints), True);
+ ZnListSize(ZnWorkPoints), True);
return False;
}
@@ -1075,23 +1075,23 @@ GetClipVertices(ZnItem item,
**********************************************************************************
*
* GetContours --
- * Get the external contour(s).
- * Never ever call ZnPolyFree on the tristrip returned by GetContours.
+ * Get the external contour(s).
+ * Never ever call ZnPolyFree on the tristrip returned by GetContours.
*
**********************************************************************************
*/
static ZnBool
-GetContours(ZnItem item,
- ZnPoly *poly)
+GetContours(ZnItem item,
+ ZnPoly *poly)
{
- ArcItem arc = (ArcItem) item;
+ ArcItem arc = (ArcItem) item;
if (ISCLEAR(arc->flags, USING_POLY_BIT) || !arc->render_shape) {
UpdateRenderShapeX(arc);
}
ZnPolyContour1(poly, ZnListArray(arc->render_shape),
- ZnListSize(arc->render_shape), True);
+ ZnListSize(arc->render_shape), True);
poly->contour1.controls = NULL;
return False;
@@ -1102,30 +1102,30 @@ GetContours(ZnItem item,
**********************************************************************************
*
* Coords --
- * Return or edit the item vertices.
+ * Return or edit the item vertices.
*
**********************************************************************************
*/
static int
-Coords(ZnItem item,
- int contour,
- int index,
- int cmd,
- ZnPoint **pts,
- char **controls,
- unsigned int *num_pts)
+Coords(ZnItem item,
+ int contour,
+ int index,
+ int cmd,
+ ZnPoint **pts,
+ char **controls,
+ unsigned int *num_pts)
{
- ArcItem arc = (ArcItem) item;
+ ArcItem arc = (ArcItem) item;
if ((cmd == ZN_COORDS_ADD) || (cmd == ZN_COORDS_ADD_LAST) || (cmd == ZN_COORDS_REMOVE)) {
Tcl_AppendResult(item->wi->interp,
- " arcs can't add or remove vertices", NULL);
+ " arcs can't add or remove vertices", NULL);
return TCL_ERROR;
}
else if (cmd == ZN_COORDS_REPLACE_ALL) {
if (*num_pts != 2) {
Tcl_AppendResult(item->wi->interp,
- " coords command need 2 points on arcs", NULL);
+ " coords command need 2 points on arcs", NULL);
return TCL_ERROR;
}
arc->coords[0] = (*pts)[0];
@@ -1135,7 +1135,7 @@ Coords(ZnItem item,
else if (cmd == ZN_COORDS_REPLACE) {
if (*num_pts < 1) {
Tcl_AppendResult(item->wi->interp,
- " coords command need at least 1 point", NULL);
+ " coords command need at least 1 point", NULL);
return TCL_ERROR;
}
if (index < 0) {
@@ -1144,7 +1144,7 @@ Coords(ZnItem item,
if ((index < 0) || (index > 1)) {
range_err:
Tcl_AppendResult(item->wi->interp,
- " incorrect coord index, should be between -2 and 1", NULL);
+ " incorrect coord index, should be between -2 and 1", NULL);
return TCL_ERROR;
}
arc->coords[index] = (*pts)[0];
@@ -1176,16 +1176,16 @@ Coords(ZnItem item,
**********************************************************************************
*/
static void
-GetAnchor(ZnItem item,
- Tk_Anchor anchor,
- ZnPoint *p)
+GetAnchor(ZnItem item,
+ Tk_Anchor anchor,
+ ZnPoint *p)
{
ZnBBox *bbox = &item->item_bounding_box;
ZnOrigin2Anchor(&bbox->orig,
- bbox->corner.x - bbox->orig.x,
- bbox->corner.y - bbox->orig.y,
- anchor, p);
+ bbox->corner.x - bbox->orig.x,
+ bbox->corner.y - bbox->orig.y,
+ anchor, p);
}
/*
@@ -1196,8 +1196,8 @@ GetAnchor(ZnItem item,
**********************************************************************************
*/
static void
-PostScript(ZnItem item,
- ZnBool prepass)
+PostScript(ZnItem item,
+ ZnBool prepass)
{
}
@@ -1213,33 +1213,33 @@ static ZnItemClassStruct ARC_ITEM_CLASS = {
"arc",
sizeof(ArcItemStruct),
arc_attrs,
- 0, /* num_parts */
- 0, /* flags */
+ 0, /* num_parts */
+ 0, /* flags */
-1,
Init,
Clone,
Destroy,
Configure,
Query,
- NULL, /* GetFieldSet */
+ NULL, /* GetFieldSet */
GetAnchor,
GetClipVertices,
GetContours,
Coords,
- NULL, /* InsertChars */
- NULL, /* DeleteChars */
- NULL, /* Cursor */
- NULL, /* Index */
- NULL, /* Part */
- NULL, /* Selection */
- NULL, /* Contour */
+ NULL, /* InsertChars */
+ NULL, /* DeleteChars */
+ NULL, /* Cursor */
+ NULL, /* Index */
+ NULL, /* Part */
+ NULL, /* Selection */
+ NULL, /* Contour */
ComputeCoordinates,
ToArea,
Draw,
Render,
IsSensitive,
Pick,
- NULL, /* PickVertex */
+ NULL, /* PickVertex */
PostScript
};
diff --git a/generic/Attrs.c b/generic/Attrs.c
index 62857b9..dc62f1f 100644
--- a/generic/Attrs.c
+++ b/generic/Attrs.c
@@ -1,8 +1,8 @@
/*
* Attrs.c -- Various attributes manipulation routines.
*
- * Authors : Patrick Lecoanet.
- * Creation date : Fri Dec 31 10:03:34 1999
+ * Authors : Patrick Lecoanet.
+ * Creation date : Fri Dec 31 10:03:34 1999
*
* $Id$
*/
@@ -49,22 +49,22 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ "
*
****************************************************************
*/
-#define RELIEF_FLAT_SPEC "flat"
-#define RELIEF_RAISED_SPEC "raised"
-#define RELIEF_SUNKEN_SPEC "sunken"
-#define RELIEF_GROOVE_SPEC "groove"
-#define RELIEF_RIDGE_SPEC "ridge"
+#define RELIEF_FLAT_SPEC "flat"
+#define RELIEF_RAISED_SPEC "raised"
+#define RELIEF_SUNKEN_SPEC "sunken"
+#define RELIEF_GROOVE_SPEC "groove"
+#define RELIEF_RIDGE_SPEC "ridge"
#define RELIEF_ROUND_RAISED_SPEC "roundraised"
#define RELIEF_ROUND_SUNKEN_SPEC "roundsunken"
#define RELIEF_ROUND_GROOVE_SPEC "roundgroove"
-#define RELIEF_ROUND_RIDGE_SPEC "roundridge"
+#define RELIEF_ROUND_RIDGE_SPEC "roundridge"
#define RELIEF_SUNKEN_RULE_SPEC "sunkenrule"
-#define RELIEF_RAISED_RULE_SPEC "raisedrule"
+#define RELIEF_RAISED_RULE_SPEC "raisedrule"
int
-ZnGetRelief(ZnWInfo *wi,
- char *name,
- ZnReliefStyle *relief)
+ZnGetRelief(ZnWInfo *wi,
+ char *name,
+ ZnReliefStyle *relief)
{
size_t length;
@@ -104,18 +104,18 @@ ZnGetRelief(ZnWInfo *wi,
}
else {
Tcl_AppendResult(wi->interp, "bad relief \"", name, "\": must be ",
- RELIEF_FLAT_SPEC, ", ",
- RELIEF_RAISED_SPEC, ", ",
- RELIEF_SUNKEN_SPEC, ", ",
- RELIEF_GROOVE_SPEC, ", ",
- RELIEF_RIDGE_SPEC, ", ",
- RELIEF_ROUND_RAISED_SPEC, ", ",
- RELIEF_ROUND_SUNKEN_SPEC, ", ",
- RELIEF_ROUND_GROOVE_SPEC, ", ",
- RELIEF_ROUND_RIDGE_SPEC, ", ",
- RELIEF_SUNKEN_RULE_SPEC, ", ",
- RELIEF_RAISED_RULE_SPEC,
- NULL);
+ RELIEF_FLAT_SPEC, ", ",
+ RELIEF_RAISED_SPEC, ", ",
+ RELIEF_SUNKEN_SPEC, ", ",
+ RELIEF_GROOVE_SPEC, ", ",
+ RELIEF_RIDGE_SPEC, ", ",
+ RELIEF_ROUND_RAISED_SPEC, ", ",
+ RELIEF_ROUND_SUNKEN_SPEC, ", ",
+ RELIEF_ROUND_GROOVE_SPEC, ", ",
+ RELIEF_ROUND_RIDGE_SPEC, ", ",
+ RELIEF_SUNKEN_RULE_SPEC, ", ",
+ RELIEF_RAISED_RULE_SPEC,
+ NULL);
return TCL_ERROR;
}
if (!wi->render) {
@@ -163,39 +163,39 @@ ZnNameOfRelief(ZnReliefStyle relief)
*
****************************************************************
*/
-#define BORDER_LEFT_SPEC "left"
-#define BORDER_RIGHT_SPEC "right"
-#define BORDER_TOP_SPEC "top"
-#define BORDER_BOTTOM_SPEC "bottom"
-#define BORDER_CONTOUR_SPEC "contour"
-#define BORDER_COUNTER_OBLIQUE_SPEC "counteroblique"
-#define BORDER_OBLIQUE_SPEC "oblique"
-#define NO_BORDER_SPEC "noborder"
+#define BORDER_LEFT_SPEC "left"
+#define BORDER_RIGHT_SPEC "right"
+#define BORDER_TOP_SPEC "top"
+#define BORDER_BOTTOM_SPEC "bottom"
+#define BORDER_CONTOUR_SPEC "contour"
+#define BORDER_COUNTER_OBLIQUE_SPEC "counteroblique"
+#define BORDER_OBLIQUE_SPEC "oblique"
+#define NO_BORDER_SPEC "noborder"
int
-ZnGetBorder(ZnWInfo *wi,
- Tcl_Obj *name,
- ZnBorder *border)
+ZnGetBorder(ZnWInfo *wi,
+ Tcl_Obj *name,
+ ZnBorder *border)
{
unsigned int j, len, largc;
Tcl_Obj **largv;
- char *str;
+ char *str;
*border = ZN_NO_BORDER;
if (Tcl_ListObjGetElements(wi->interp, name,
- &largc, &largv) == TCL_ERROR) {
+ &largc, &largv) == TCL_ERROR) {
border_error:
Tcl_AppendResult(wi->interp, "bad line shape \"", Tcl_GetString(name),
- "\": must be a list of ",
- BORDER_LEFT_SPEC, ", ",
- BORDER_RIGHT_SPEC, ", ",
- BORDER_TOP_SPEC, ", ",
- BORDER_BOTTOM_SPEC, ", ",
- BORDER_COUNTER_OBLIQUE_SPEC, ", ",
- BORDER_OBLIQUE_SPEC, " or ",
- BORDER_CONTOUR_SPEC, ", ",
- NO_BORDER_SPEC, " alone",
- NULL);
+ "\": must be a list of ",
+ BORDER_LEFT_SPEC, ", ",
+ BORDER_RIGHT_SPEC, ", ",
+ BORDER_TOP_SPEC, ", ",
+ BORDER_BOTTOM_SPEC, ", ",
+ BORDER_COUNTER_OBLIQUE_SPEC, ", ",
+ BORDER_OBLIQUE_SPEC, " or ",
+ BORDER_CONTOUR_SPEC, ", ",
+ NO_BORDER_SPEC, " alone",
+ NULL);
return TCL_ERROR;
}
for (j = 0; j < largc; j++) {
@@ -238,7 +238,7 @@ ZnGetBorder(ZnWInfo *wi,
*/
void
ZnNameOfBorder(ZnBorder border,
- char *name)
+ char *name)
{
if (border == ZN_NO_BORDER) {
strcpy(name, NO_BORDER_SPEC);
@@ -254,19 +254,19 @@ ZnNameOfBorder(ZnBorder border,
}
if (border & ZN_RIGHT_BORDER) {
if (name[0] != 0) {
- strcat(name, " ");
+ strcat(name, " ");
}
strcat(name, BORDER_RIGHT_SPEC);
}
if (border & ZN_TOP_BORDER) {
if (name[0] != 0) {
- strcat(name, " ");
+ strcat(name, " ");
}
strcat(name, BORDER_TOP_SPEC);
}
if (border & ZN_BOTTOM_BORDER) {
if (name[0] != 0) {
- strcat(name, " ");
+ strcat(name, " ");
}
strcat(name, BORDER_BOTTOM_SPEC);
}
@@ -292,18 +292,18 @@ ZnNameOfBorder(ZnBorder border,
*
****************************************************************
*/
-#define STRAIGHT_SPEC "straight"
-#define RIGHT_LIGHTNING_SPEC "rightlightning"
-#define LEFT_LIGHTNING_SPEC "leftlightning"
-#define RIGHT_CORNER_SPEC "rightcorner"
-#define LEFT_CORNER_SPEC "leftcorner"
+#define STRAIGHT_SPEC "straight"
+#define RIGHT_LIGHTNING_SPEC "rightlightning"
+#define LEFT_LIGHTNING_SPEC "leftlightning"
+#define RIGHT_CORNER_SPEC "rightcorner"
+#define LEFT_CORNER_SPEC "leftcorner"
#define DOUBLE_RIGHT_CORNER_SPEC "doublerightcorner"
-#define DOUBLE_LEFT_CORNER_SPEC "doubleleftcorner"
+#define DOUBLE_LEFT_CORNER_SPEC "doubleleftcorner"
int
-ZnGetLineShape(ZnWInfo *wi,
- char *name,
- ZnLineShape *line_shape)
+ZnGetLineShape(ZnWInfo *wi,
+ char *name,
+ ZnLineShape *line_shape)
{
unsigned int len;
@@ -331,14 +331,14 @@ ZnGetLineShape(ZnWInfo *wi,
}
else {
Tcl_AppendResult(wi->interp, "bad line shape \"", name, "\": must be ",
- STRAIGHT_SPEC, ", ",
- RIGHT_LIGHTNING_SPEC, ", ",
- LEFT_LIGHTNING_SPEC, ", ",
- RIGHT_CORNER_SPEC, ", ",
- LEFT_CORNER_SPEC, ", ",
- DOUBLE_RIGHT_CORNER_SPEC, ", ",
- DOUBLE_LEFT_CORNER_SPEC,
- NULL);
+ STRAIGHT_SPEC, ", ",
+ RIGHT_LIGHTNING_SPEC, ", ",
+ LEFT_LIGHTNING_SPEC, ", ",
+ RIGHT_CORNER_SPEC, ", ",
+ LEFT_CORNER_SPEC, ", ",
+ DOUBLE_RIGHT_CORNER_SPEC, ", ",
+ DOUBLE_LEFT_CORNER_SPEC,
+ NULL);
return TCL_ERROR;
}
return TCL_OK;
@@ -374,15 +374,15 @@ ZnNameOfLineShape(ZnLineShape line_shape)
*
****************************************************************
*/
-#define SIMPLE_SPEC "simple"
-#define DASHED_SPEC "dashed"
-#define DOTTED_SPEC "dotted"
-#define MIXED_SPEC "mixed"
+#define SIMPLE_SPEC "simple"
+#define DASHED_SPEC "dashed"
+#define DOTTED_SPEC "dotted"
+#define MIXED_SPEC "mixed"
int
-ZnGetLineStyle(ZnWInfo *wi,
- char *name,
- ZnLineStyle *line_style)
+ZnGetLineStyle(ZnWInfo *wi,
+ char *name,
+ ZnLineStyle *line_style)
{
unsigned int len;
@@ -397,12 +397,12 @@ ZnGetLineStyle(ZnWInfo *wi,
*line_style = ZN_LINE_DOTTED;
else {
Tcl_AppendResult(wi->interp, "bad line style \"", name, "\": must be ",
- SIMPLE_SPEC, ", ",
- DASHED_SPEC, ", ",
- DOTTED_SPEC, ", ",
- MIXED_SPEC,
- NULL);
- return TCL_ERROR;
+ SIMPLE_SPEC, ", ",
+ DASHED_SPEC, ", ",
+ DOTTED_SPEC, ", ",
+ MIXED_SPEC,
+ NULL);
+ return TCL_ERROR;
}
return TCL_OK;
}
@@ -445,12 +445,12 @@ ZnNameOfLineStyle(ZnLineStyle line_style)
****************************************************************
*/
int
-ZnGetLeaderAnchors(ZnWInfo *wi,
- char *name,
- ZnLeaderAnchors *leader_anchors)
+ZnGetLeaderAnchors(ZnWInfo *wi,
+ char *name,
+ ZnLeaderAnchors *leader_anchors)
{
- int anchors[4];
- int index, num_tok, anchor_index=0;
+ int anchors[4];
+ int index, num_tok, anchor_index=0;
*leader_anchors = NULL;
while (*name && (*name == ' ')) {
@@ -462,29 +462,29 @@ ZnGetLeaderAnchors(ZnWInfo *wi,
num_tok = sscanf(name, "|%d%n", &anchors[anchor_index], &index);
if (num_tok != 1) {
la_error:
- Tcl_AppendResult(wi->interp, " incorrect leader anchors \"",
- name, "\"", NULL);
- return TCL_ERROR;
+ Tcl_AppendResult(wi->interp, " incorrect leader anchors \"",
+ name, "\"", NULL);
+ return TCL_ERROR;
}
anchors[anchor_index+1] = -1;
break;
case '%':
num_tok = sscanf(name, "%%%dx%d%n", &anchors[anchor_index],
- &anchors[anchor_index+1], &index);
+ &anchors[anchor_index+1], &index);
if (num_tok != 2) {
- goto la_error;
+ goto la_error;
}
if (anchors[anchor_index] < 0) {
- anchors[anchor_index] = 0;
+ anchors[anchor_index] = 0;
}
if (anchors[anchor_index] > 100) {
- anchors[anchor_index] = 100;
+ anchors[anchor_index] = 100;
}
if (anchors[anchor_index+1] < 0) {
- anchors[anchor_index+1] = 0;
+ anchors[anchor_index+1] = 0;
}
if (anchors[anchor_index+1] > 100) {
- anchors[anchor_index+1] = 100;
+ anchors[anchor_index+1] = 100;
}
break;
default:
@@ -517,9 +517,9 @@ ZnGetLeaderAnchors(ZnWInfo *wi,
*/
void
ZnNameOfLeaderAnchors(ZnLeaderAnchors leader_anchors,
- char *name)
+ char *name)
{
- unsigned int count;
+ unsigned int count;
if (!leader_anchors) {
strcpy(name, "%50x50");
@@ -530,7 +530,7 @@ ZnNameOfLeaderAnchors(ZnLeaderAnchors leader_anchors,
}
else {
count = sprintf(name, "%%%dx%d", leader_anchors->left_x,
- leader_anchors->left_y);
+ leader_anchors->left_y);
}
name += count;
if (leader_anchors->right_y < 0) {
@@ -549,8 +549,8 @@ ZnNameOfLeaderAnchors(ZnLeaderAnchors leader_anchors,
*
******************************************************************
*/
-static Tcl_HashTable format_cache;
-static ZnBool format_inited = False;
+static Tcl_HashTable format_cache;
+static ZnBool format_inited = False;
static char
@@ -572,7 +572,7 @@ CharToAttach(int attach)
}
static char
-CharToDim(int dim)
+CharToDim(int dim)
{
switch (dim) {
case 'f':
@@ -594,7 +594,7 @@ CharToDim(int dim)
* optional and take default values when omitted. The spaces can appear
* between blocks but not inside.
*
- * [ WidthxHeight ] [ field0Spec ][ field1Spec ]...[ fieldnSpec ]
+ * [ WidthxHeight ] [ field0Spec ][ field1Spec ]...[ fieldnSpec ]
*
* Width and Height set the size of the clipping box surrounding
* the label. If it is not specified, there will be no clipping.
@@ -602,7 +602,7 @@ CharToDim(int dim)
* field (0).
*
* fieldSpec is:
- * sChar fieldWidth sChar fieldHeight [pChar fieldX pChar fieldY].
+ * sChar fieldWidth sChar fieldHeight [pChar fieldX pChar fieldY].
*
* Each field description refers to the field of same index in the field
* array.
@@ -623,21 +623,21 @@ CharToDim(int dim)
*
*/
ZnLabelFormat
-ZnLFCreate(Tcl_Interp *interp,
- char *format_str,
- unsigned int num_fields)
+ZnLFCreate(Tcl_Interp *interp,
+ char *format_str,
+ unsigned int num_fields)
{
- ZnList fields;
- Tcl_HashEntry *entry;
+ ZnList fields;
+ Tcl_HashEntry *entry;
ZnFieldFormatStruct field_struct;
- ZnFieldFormat field_array;
- ZnLabelFormat format;
- int width, height;
- ZnDim c_width=0.0, c_height=0.0;
- int index, num_tok, num_ffs, new;
- unsigned int field_index=0;
- char *ptr = format_str, *next_ptr;
- char x_char, y_char;
+ ZnFieldFormat field_array;
+ ZnLabelFormat format;
+ int width, height;
+ ZnDim c_width=0.0, c_height=0.0;
+ int index, num_tok, num_ffs, new;
+ unsigned int field_index=0;
+ char *ptr = format_str, *next_ptr;
+ char x_char, y_char;
if (!format_inited) {
Tcl_InitHashTable(&format_cache, TCL_STRING_KEYS);
@@ -652,7 +652,7 @@ ZnLFCreate(Tcl_Interp *interp,
}
else {
Tcl_AppendResult(interp, "too many fields in label format: \"",
- format_str, "\"", NULL);
+ format_str, "\"", NULL);
return NULL;
}
}
@@ -674,7 +674,7 @@ ZnLFCreate(Tcl_Interp *interp,
if ((ptr == next_ptr) || (*next_ptr != 'x')) {
lf_error_syn:
Tcl_AppendResult(interp, "invalid label format specification \"",
- ptr, "\"", NULL);
+ ptr, "\"", NULL);
lf_error:
Tcl_DeleteHashEntry(entry);
ZnListFree(fields);
@@ -716,7 +716,7 @@ ZnLFCreate(Tcl_Interp *interp,
if ((*ptr == 'x') || (*ptr == 'f') || (*ptr == 'i') ||
(*ptr == 'a') || (*ptr == 'l')) {
num_tok = sscanf(ptr, "%c%d%c%d%n", &x_char, &width,
- &y_char, &height, &index);
+ &y_char, &height, &index);
if (num_tok != 4) {
goto lf_error_syn;
}
@@ -731,11 +731,11 @@ ZnLFCreate(Tcl_Interp *interp,
ptr += index;
if ((*ptr == '>') || (*ptr == '<') || (*ptr == '+') ||
- (*ptr == '^') || (*ptr == '$')) {
+ (*ptr == '^') || (*ptr == '$')) {
num_tok = sscanf(ptr, "%c%d%c%d%n", &x_char, &field_struct.x_spec,
- &y_char, &field_struct.y_spec, &index);
+ &y_char, &field_struct.y_spec, &index);
if (num_tok != 4) {
- goto lf_error_syn;
+ goto lf_error_syn;
}
field_struct.x_attach = CharToAttach(x_char);
field_struct.y_attach = CharToAttach(y_char);
@@ -745,12 +745,12 @@ ZnLFCreate(Tcl_Interp *interp,
else if (!*ptr || (field_index != 0)) {
/* An incomplete field spec is an error if there are several fields. */
Tcl_AppendResult(interp, "incomplete field in label format: \"",
- ptr-index, "\"", NULL);
- goto lf_error;
+ ptr-index, "\"", NULL);
+ goto lf_error;
}
if (field_index >= num_fields) {
Tcl_AppendResult(interp, "too many fields in label format: \"",
- format_str, "\"", NULL);
+ format_str, "\"", NULL);
goto lf_error;
}
field_struct.width_spec = (short) width;
@@ -768,7 +768,7 @@ ZnLFCreate(Tcl_Interp *interp,
num_ffs = ZnListSize(fields);
format = (ZnLabelFormat) ZnMalloc(sizeof(ZnLabelFormatStruct) +
- (num_ffs-1) * sizeof(ZnFieldFormatStruct));
+ (num_ffs-1) * sizeof(ZnFieldFormatStruct));
format->clip_width = (short) c_width;
format->clip_height = (short) c_height;
format->num_fields = num_ffs;
@@ -784,7 +784,7 @@ ZnLFCreate(Tcl_Interp *interp,
ZnLabelFormat
-ZnLFDuplicate(ZnLabelFormat lf)
+ZnLFDuplicate(ZnLabelFormat lf)
{
lf->ref_count++;
return lf;
@@ -792,7 +792,7 @@ ZnLFDuplicate(ZnLabelFormat lf)
void
-ZnLFDelete(ZnLabelFormat lf)
+ZnLFDelete(ZnLabelFormat lf)
{
lf->ref_count--;
if (lf->ref_count == 0) {
@@ -803,15 +803,15 @@ ZnLFDelete(ZnLabelFormat lf)
char *
-ZnLFGetString(ZnLabelFormat lf)
+ZnLFGetString(ZnLabelFormat lf)
{
return Tcl_GetHashKey(&format_cache, lf->entry);
#if 0
- ZnFieldFormat ff;
- char *ptr;
- char x_char, y_char, w_char, h_char;
- unsigned int i, count;
+ ZnFieldFormat ff;
+ char *ptr;
+ char x_char, y_char, w_char, h_char;
+ unsigned int i, count;
ptr = str;
if ((lf->clip_width != 0) || (lf->clip_height != 0)) {
@@ -839,8 +839,8 @@ ZnLFGetString(ZnLabelFormat lf)
w_char = DimToChar(ff->x_dim);
h_char = DimToChar(ff->y_dim);
count = sprintf(ptr, "%c%d%c%d%c%d%c%d",
- w_char, ff->width_spec, h_char, ff->height_spec,
- x_char, ff->x_spec, y_char, ff->y_spec);
+ w_char, ff->width_spec, h_char, ff->height_spec,
+ x_char, ff->x_spec, y_char, ff->y_spec);
ptr += count;
}
*ptr = 0;
@@ -853,9 +853,9 @@ ZnLFGetString(ZnLabelFormat lf)
* set to zero, it means that there is no clipbox.
*/
ZnBool
-ZnLFGetClipBox(ZnLabelFormat lf,
- ZnDim *w,
- ZnDim *h)
+ZnLFGetClipBox(ZnLabelFormat lf,
+ ZnDim *w,
+ ZnDim *h)
{
if ((lf->clip_width == 0) && (lf->clip_height == 0)) {
return False;
@@ -869,18 +869,18 @@ ZnLFGetClipBox(ZnLabelFormat lf,
void
-ZnLFGetField(ZnLabelFormat lf,
- unsigned int field,
- char *x_attach,
- char *y_attach,
- char *x_dim,
- char *y_dim,
- int *x_spec,
- int *y_spec,
- short *width_spec,
- short *height_spec)
+ZnLFGetField(ZnLabelFormat lf,
+ unsigned int field,
+ char *x_attach,
+ char *y_attach,
+ char *x_dim,
+ char *y_dim,
+ int *x_spec,
+ int *y_spec,
+ short *width_spec,
+ short *height_spec)
{
- ZnFieldFormat fptr;
+ ZnFieldFormat fptr;
fptr = &lf->fields[field];
*x_attach = fptr->x_attach;
@@ -901,18 +901,18 @@ ZnLFGetField(ZnLabelFormat lf,
*
****************************************************************
*/
-static Tcl_HashTable line_end_cache;
-static ZnBool line_end_inited = False;
+static Tcl_HashTable line_end_cache;
+static ZnBool line_end_inited = False;
ZnLineEnd
-ZnLineEndCreate(Tcl_Interp *interp,
- char *line_end_str)
+ZnLineEndCreate(Tcl_Interp *interp,
+ char *line_end_str)
{
- Tcl_HashEntry *entry;
- ZnLineEnd le;
- int new, argc;
- ZnReal a, b, c;
+ Tcl_HashEntry *entry;
+ ZnLineEnd le;
+ int new, argc;
+ ZnReal a, b, c;
if (!line_end_inited) {
Tcl_InitHashTable(&line_end_cache, TCL_STRING_KEYS);
@@ -939,21 +939,21 @@ ZnLineEndCreate(Tcl_Interp *interp,
}
else {
Tcl_AppendResult(interp, "incorrect line end spec: \"",
- line_end_str, "\", should be: shapeA shapeB shapeC", NULL);
+ line_end_str, "\", should be: shapeA shapeB shapeC", NULL);
return NULL;
}
}
char *
-ZnLineEndGetString(ZnLineEnd le)
+ZnLineEndGetString(ZnLineEnd le)
{
return Tcl_GetHashKey(&line_end_cache, le->entry);
}
void
-ZnLineEndDelete(ZnLineEnd le)
+ZnLineEndDelete(ZnLineEnd le)
{
le->ref_count--;
if (le->ref_count == 0) {
@@ -964,7 +964,7 @@ ZnLineEndDelete(ZnLineEnd le)
ZnLineEnd
-ZnLineEndDuplicate(ZnLineEnd le)
+ZnLineEndDuplicate(ZnLineEnd le)
{
le->ref_count++;
return le;
@@ -979,16 +979,16 @@ ZnLineEndDuplicate(ZnLineEnd le)
*
******************************************************************
*/
-#define FILL_RULE_ODD_SPEC "odd"
-#define FILL_RULE_NON_ZERO_SPEC "nonzero"
-#define FILL_RULE_POSITIVE_SPEC "positive"
-#define FILL_RULE_NEGATIVE_SPEC "negative"
+#define FILL_RULE_ODD_SPEC "odd"
+#define FILL_RULE_NON_ZERO_SPEC "nonzero"
+#define FILL_RULE_POSITIVE_SPEC "positive"
+#define FILL_RULE_NEGATIVE_SPEC "negative"
#define FILL_RULE_ABS_GEQ_2_SPEC "abs_geq_2"
int
-ZnGetFillRule(ZnWInfo *wi,
- char *name,
- ZnFillRule *fill_rule)
+ZnGetFillRule(ZnWInfo *wi,
+ char *name,
+ ZnFillRule *fill_rule)
{
unsigned int len;
@@ -1010,12 +1010,12 @@ ZnGetFillRule(ZnWInfo *wi,
}
else {
Tcl_AppendResult(wi->interp, "bad fill rule \"", name, "\": must be ",
- FILL_RULE_ODD_SPEC, ", ",
- FILL_RULE_NON_ZERO_SPEC, ", ",
- FILL_RULE_POSITIVE_SPEC, ", ",
- FILL_RULE_NEGATIVE_SPEC, ", ",
- FILL_RULE_ABS_GEQ_2_SPEC,
- NULL);
+ FILL_RULE_ODD_SPEC, ", ",
+ FILL_RULE_NON_ZERO_SPEC, ", ",
+ FILL_RULE_POSITIVE_SPEC, ", ",
+ FILL_RULE_NEGATIVE_SPEC, ", ",
+ FILL_RULE_ABS_GEQ_2_SPEC,
+ NULL);
return TCL_ERROR;
}
return TCL_OK;
@@ -1049,9 +1049,9 @@ ZnNameOfFillRule(ZnFillRule fill_rule)
******************************************************************
*/
int
-ZnGetAutoAlign(ZnWInfo *wi,
- char *name,
- ZnAutoAlign *aa)
+ZnGetAutoAlign(ZnWInfo *wi,
+ char *name,
+ ZnAutoAlign *aa)
{
int j;
@@ -1064,25 +1064,25 @@ ZnGetAutoAlign(ZnWInfo *wi,
switch(name[j]) {
case 'l':
case 'L':
- aa->align[j] = TK_JUSTIFY_LEFT;
- break;
+ aa->align[j] = TK_JUSTIFY_LEFT;
+ break;
case 'c':
case 'C':
- aa->align[j] = TK_JUSTIFY_CENTER;
- break;
+ aa->align[j] = TK_JUSTIFY_CENTER;
+ break;
case 'r':
case 'R':
- aa->align[j] = TK_JUSTIFY_RIGHT;
- break;
+ aa->align[j] = TK_JUSTIFY_RIGHT;
+ break;
default:
- goto aa_error;
+ goto aa_error;
}
}
}
else {
aa_error:
Tcl_AppendResult(wi->interp, "invalid auto alignment specification \"", name,
- "\" should be - or a triple of lcr", NULL);
+ "\" should be - or a triple of lcr", NULL);
return TCL_ERROR;
}
return TCL_OK;
@@ -1094,7 +1094,7 @@ ZnGetAutoAlign(ZnWInfo *wi,
*/
void
ZnNameOfAutoAlign(ZnAutoAlign *aa,
- char *name)
+ char *name)
{
unsigned int i;
@@ -1106,14 +1106,14 @@ ZnNameOfAutoAlign(ZnAutoAlign *aa,
for (i = 0; i < 3; i++) {
switch (aa->align[i]) {
case TK_JUSTIFY_LEFT:
- strcat(name, "l");
- break;
+ strcat(name, "l");
+ break;
case TK_JUSTIFY_CENTER:
- strcat(name, "c");
- break;
+ strcat(name, "c");
+ break;
case TK_JUSTIFY_RIGHT:
- strcat(name, "r");
- break;
+ strcat(name, "r");
+ break;
}
}
}
diff --git a/generic/Attrs.h b/generic/Attrs.h
index 2c12835..93bfb64 100644
--- a/generic/Attrs.h
+++ b/generic/Attrs.h
@@ -1,8 +1,8 @@
/*
* Attrs.h -- Header for the attribute manipulation routines.
*
- * Authors : Patrick Lecoanet.
- * Creation date : Fri Dec 31 10:06:37 1999
+ * Authors : Patrick Lecoanet.
+ * Creation date : Fri Dec 31 10:06:37 1999
*
* $Id$
*/
@@ -43,12 +43,12 @@ struct _ZnWInfo;
/*
* Type and constant values for line styles.
*/
-typedef unsigned char ZnLineStyle;
+typedef unsigned char ZnLineStyle;
-#define ZN_LINE_SIMPLE 0
-#define ZN_LINE_DASHED 1
-#define ZN_LINE_MIXED 2
-#define ZN_LINE_DOTTED 3
+#define ZN_LINE_SIMPLE 0
+#define ZN_LINE_DASHED 1
+#define ZN_LINE_MIXED 2
+#define ZN_LINE_DOTTED 3
int ZnGetLineStyle(struct _ZnWInfo *wi, char *name, ZnLineStyle *line_style);
char *ZnNameOfLineStyle(ZnLineStyle line_style);
@@ -57,15 +57,15 @@ char *ZnNameOfLineStyle(ZnLineStyle line_style);
/*
* Type and constant values for line shapes.
*/
-typedef unsigned char ZnLineShape;
+typedef unsigned char ZnLineShape;
-#define ZN_LINE_STRAIGHT 0
-#define ZN_LINE_LEFT_LIGHTNING 1
-#define ZN_LINE_LEFT_CORNER 2
-#define ZN_LINE_DOUBLE_LEFT_CORNER 3
-#define ZN_LINE_RIGHT_LIGHTNING 4
-#define ZN_LINE_RIGHT_CORNER 5
-#define ZN_LINE_DOUBLE_RIGHT_CORNER 6
+#define ZN_LINE_STRAIGHT 0
+#define ZN_LINE_LEFT_LIGHTNING 1
+#define ZN_LINE_LEFT_CORNER 2
+#define ZN_LINE_DOUBLE_LEFT_CORNER 3
+#define ZN_LINE_RIGHT_LIGHTNING 4
+#define ZN_LINE_RIGHT_CORNER 5
+#define ZN_LINE_DOUBLE_RIGHT_CORNER 6
int ZnGetLineShape(struct _ZnWInfo *wi, char *name, ZnLineShape *line_shape);
char *ZnNameOfLineShape(ZnLineShape line_shape);
@@ -74,28 +74,28 @@ char *ZnNameOfLineShape(ZnLineShape line_shape);
/*
* Type and constant values for relief styles.
*/
-typedef unsigned char ZnReliefStyle;
-#define ZN_RELIEF_FLAT 0
-#define ZN_RELIEF_RAISED 1
-#define ZN_RELIEF_SUNKEN 2
-#define ZN_RELIEF_GROOVE (ZN_RELIEF_TWO_FACES|ZN_RELIEF_SUNKEN)
-#define ZN_RELIEF_RIDGE (ZN_RELIEF_TWO_FACES|ZN_RELIEF_RAISED)
-#define ZN_RELIEF_ROUND_SUNKEN (ZN_RELIEF_ROUND|ZN_RELIEF_SUNKEN)
-#define ZN_RELIEF_ROUND_RAISED (ZN_RELIEF_ROUND|ZN_RELIEF_RAISED)
-#define ZN_RELIEF_ROUND_GROOVE (ZN_RELIEF_ROUND|ZN_RELIEF_TWO_FACES|ZN_RELIEF_SUNKEN)
-#define ZN_RELIEF_ROUND_RIDGE (ZN_RELIEF_ROUND|ZN_RELIEF_TWO_FACES|ZN_RELIEF_RAISED)
-#define ZN_RELIEF_SUNKEN_RULE (ZN_RELIEF_ROUND|ZN_RELIEF_TWO_FACES|ZN_RELIEF_SUNKEN|ZN_RELIEF_RULE)
-#define ZN_RELIEF_RAISED_RULE (ZN_RELIEF_ROUND|ZN_RELIEF_TWO_FACES|ZN_RELIEF_RAISED|ZN_RELIEF_RULE)
-#define ZN_RELIEF_ROUND 0x80
-#define ZN_RELIEF_TWO_FACES 0x40
-#define ZN_RELIEF_RULE 0x20
-#define ZN_RELIEF_MASK 0x3
+typedef unsigned char ZnReliefStyle;
+#define ZN_RELIEF_FLAT 0
+#define ZN_RELIEF_RAISED 1
+#define ZN_RELIEF_SUNKEN 2
+#define ZN_RELIEF_GROOVE (ZN_RELIEF_TWO_FACES|ZN_RELIEF_SUNKEN)
+#define ZN_RELIEF_RIDGE (ZN_RELIEF_TWO_FACES|ZN_RELIEF_RAISED)
+#define ZN_RELIEF_ROUND_SUNKEN (ZN_RELIEF_ROUND|ZN_RELIEF_SUNKEN)
+#define ZN_RELIEF_ROUND_RAISED (ZN_RELIEF_ROUND|ZN_RELIEF_RAISED)
+#define ZN_RELIEF_ROUND_GROOVE (ZN_RELIEF_ROUND|ZN_RELIEF_TWO_FACES|ZN_RELIEF_SUNKEN)
+#define ZN_RELIEF_ROUND_RIDGE (ZN_RELIEF_ROUND|ZN_RELIEF_TWO_FACES|ZN_RELIEF_RAISED)
+#define ZN_RELIEF_SUNKEN_RULE (ZN_RELIEF_ROUND|ZN_RELIEF_TWO_FACES|ZN_RELIEF_SUNKEN|ZN_RELIEF_RULE)
+#define ZN_RELIEF_RAISED_RULE (ZN_RELIEF_ROUND|ZN_RELIEF_TWO_FACES|ZN_RELIEF_RAISED|ZN_RELIEF_RULE)
+#define ZN_RELIEF_ROUND 0x80
+#define ZN_RELIEF_TWO_FACES 0x40
+#define ZN_RELIEF_RULE 0x20
+#define ZN_RELIEF_MASK 0x3
/*
* Number of steps for relief drawing. This translate in
* RELIEF_STEPS*2+1 color shades in the color gradient.
*/
-#define ZN_RELIEF_STEPS 6
+#define ZN_RELIEF_STEPS 6
int ZnGetRelief(struct _ZnWInfo *wi, char *name, ZnReliefStyle *relief);
char *ZnNameOfRelief(ZnReliefStyle relief);
@@ -104,15 +104,15 @@ char *ZnNameOfRelief(ZnReliefStyle relief);
/*
* Type and constant values for borders.
*/
-typedef unsigned char ZnBorder;
-#define ZN_NO_BORDER 0
-#define ZN_LEFT_BORDER 1
-#define ZN_RIGHT_BORDER 2
-#define ZN_TOP_BORDER 4
-#define ZN_BOTTOM_BORDER 8
-#define ZN_CONTOUR_BORDER (ZN_LEFT_BORDER|ZN_RIGHT_BORDER|ZN_TOP_BORDER|ZN_BOTTOM_BORDER)
-#define ZN_COUNTER_OBLIQUE 16
-#define ZN_OBLIQUE 32
+typedef unsigned char ZnBorder;
+#define ZN_NO_BORDER 0
+#define ZN_LEFT_BORDER 1
+#define ZN_RIGHT_BORDER 2
+#define ZN_TOP_BORDER 4
+#define ZN_BOTTOM_BORDER 8
+#define ZN_CONTOUR_BORDER (ZN_LEFT_BORDER|ZN_RIGHT_BORDER|ZN_TOP_BORDER|ZN_BOTTOM_BORDER)
+#define ZN_COUNTER_OBLIQUE 16
+#define ZN_OBLIQUE 32
void ZnNameOfBorder(ZnBorder border, char *str);
int ZnGetBorder(struct _ZnWInfo *wi, Tcl_Obj *name, ZnBorder *border);
@@ -122,10 +122,10 @@ int ZnGetBorder(struct _ZnWInfo *wi, Tcl_Obj *name, ZnBorder *border);
* Type for leader anchors.
*/
typedef struct {
- int left_x; /* left leader anchor field or percent of bbox */
- int right_x; /* right leader anchor field or percent of bbox */
- short left_y; /* left leader percent of bbox or < 0 if field */
- short right_y; /* right leader percent of bbox or < 0 if field */
+ int left_x; /* left leader anchor field or percent of bbox */
+ int right_x; /* right leader anchor field or percent of bbox */
+ short left_y; /* left leader percent of bbox or < 0 if field */
+ short right_y; /* right leader percent of bbox or < 0 if field */
} ZnLeaderAnchorsStruct, *ZnLeaderAnchors;
int ZnGetLeaderAnchors(struct _ZnWInfo *wi, char *name, ZnLeaderAnchors *leader_anchors);
@@ -136,12 +136,12 @@ void ZnNameOfLeaderAnchors(ZnLeaderAnchors leader_anchors, char *name);
* Type and constant values for automatic alignments.
*/
typedef struct {
- ZnBool automatic;
- Tk_Justify align[3];
+ ZnBool automatic;
+ Tk_Justify align[3];
} ZnAutoAlign;
-#define ZN_AA_LEFT 0
-#define ZN_AA_CENTER 1
-#define ZN_AA_RIGHT 2
+#define ZN_AA_LEFT 0
+#define ZN_AA_CENTER 1
+#define ZN_AA_RIGHT 2
int ZnGetAutoAlign(struct _ZnWInfo *wi, char *name, ZnAutoAlign *aa);
void ZnNameOfAutoAlign(ZnAutoAlign *aa, char *name);
@@ -154,92 +154,92 @@ void ZnNameOfAutoAlign(ZnAutoAlign *aa, char *name);
/*
* field flags.
*/
-#define ZN_LF_ATTACH_PIXEL 0
-#define ZN_LF_ATTACH_FWD 1
-#define ZN_LF_ATTACH_BWD 2
-#define ZN_LF_ATTACH_LEFT 3 /* Align left on left or top on top */
-#define ZN_LF_ATTACH_RIGHT 4 /* Align right on right or bottom on bottom */
-
-#define ZN_LF_DIM_PIXEL 0
-#define ZN_LF_DIM_FONT 1
-#define ZN_LF_DIM_ICON 2
-#define ZN_LF_DIM_AUTO 3
-#define ZN_LF_DIM_LABEL 4
+#define ZN_LF_ATTACH_PIXEL 0
+#define ZN_LF_ATTACH_FWD 1
+#define ZN_LF_ATTACH_BWD 2
+#define ZN_LF_ATTACH_LEFT 3 /* Align left on left or top on top */
+#define ZN_LF_ATTACH_RIGHT 4 /* Align right on right or bottom on bottom */
+
+#define ZN_LF_DIM_PIXEL 0
+#define ZN_LF_DIM_FONT 1
+#define ZN_LF_DIM_ICON 2
+#define ZN_LF_DIM_AUTO 3
+#define ZN_LF_DIM_LABEL 4
typedef struct {
- int x_spec;
- int y_spec;
- short width_spec;
- short height_spec;
- char x_attach;
- char y_attach;
- char x_dim;
- char y_dim;
+ int x_spec;
+ int y_spec;
+ short width_spec;
+ short height_spec;
+ char x_attach;
+ char y_attach;
+ char x_dim;
+ char y_dim;
} ZnFieldFormatStruct, *ZnFieldFormat;
typedef struct {
- short clip_width;
- short clip_height;
- unsigned int num_fields;
- Tcl_HashEntry *entry;
- unsigned int ref_count;
+ short clip_width;
+ short clip_height;
+ unsigned int num_fields;
+ Tcl_HashEntry *entry;
+ unsigned int ref_count;
ZnFieldFormatStruct fields[1];
} ZnLabelFormatStruct, *ZnLabelFormat;
ZnLabelFormat
-ZnLFCreate(Tcl_Interp * /* interp */,
- char * /* format_str */,
- unsigned int /* num_fields */);
+ZnLFCreate(Tcl_Interp * /* interp */,
+ char * /* format_str */,
+ unsigned int /* num_fields */);
ZnLabelFormat
-ZnLFDuplicate(ZnLabelFormat /* label_format */);
+ZnLFDuplicate(ZnLabelFormat /* label_format */);
void
-ZnLFDelete(ZnLabelFormat /* label_format */);
+ZnLFDelete(ZnLabelFormat /* label_format */);
char *
-ZnLFGetString(ZnLabelFormat /* label_format */);
+ZnLFGetString(ZnLabelFormat /* label_format */);
ZnBool
-ZnLFGetClipBox(ZnLabelFormat /* label_format */,
- ZnDim * /* width */,
- ZnDim * /* height */);
-#define ZnLFNumFields(lf) ((lf)->num_fields)
+ZnLFGetClipBox(ZnLabelFormat /* label_format */,
+ ZnDim * /* width */,
+ ZnDim * /* height */);
+#define ZnLFNumFields(lf) ((lf)->num_fields)
void
-ZnLFGetField(ZnLabelFormat /* label_format */,
- unsigned int /* field */,
- char * /* x_attach */,
- char * /* y_attach */,
- char * /* x_dim */,
- char * /* y_dim */,
- int * /* x_spec */,
- int * /* y_spec */,
- short * /* width_spec */,
- short * /* height_spec */);
+ZnLFGetField(ZnLabelFormat /* label_format */,
+ unsigned int /* field */,
+ char * /* x_attach */,
+ char * /* y_attach */,
+ char * /* x_dim */,
+ char * /* y_dim */,
+ int * /* x_spec */,
+ int * /* y_spec */,
+ short * /* width_spec */,
+ short * /* height_spec */);
/*
* Line Ends.
*/
typedef struct {
- ZnReal shape_a;
- ZnReal shape_b;
- ZnReal shape_c;
- Tcl_HashEntry *entry;
- unsigned int ref_count;
+ ZnReal shape_a;
+ ZnReal shape_b;
+ ZnReal shape_c;
+ Tcl_HashEntry *entry;
+ unsigned int ref_count;
} ZnLineEndStruct, *ZnLineEnd;
ZnLineEnd
-ZnLineEndCreate(Tcl_Interp *interp,
- char *line_end_str);
+ZnLineEndCreate(Tcl_Interp *interp,
+ char *line_end_str);
ZnLineEnd
-ZnLineEndDuplicate(ZnLineEnd le);
+ZnLineEndDuplicate(ZnLineEnd le);
void
-ZnLineEndDelete(ZnLineEnd le);
+ZnLineEndDelete(ZnLineEnd le);
char *
-ZnLineEndGetString(ZnLineEnd le);
+ZnLineEndGetString(ZnLineEnd le);
/*
* Type and protypes for fill rules.
*/
-typedef unsigned int ZnFillRule;
+typedef unsigned int ZnFillRule;
char *ZnNameOfFillRule(ZnFillRule fill_rule);
int ZnGetFillRule(struct _ZnWInfo *wi, char *name, ZnFillRule *fill_rule);
@@ -249,4 +249,4 @@ int ZnGetFillRule(struct _ZnWInfo *wi, char *name, ZnFillRule *fill_rule);
}
#endif
-#endif /* _Attrs_h */
+#endif /* _Attrs_h */
diff --git a/generic/Color.c b/generic/Color.c
index 236b6db..53f798b 100644
--- a/generic/Color.c
+++ b/generic/Color.c
@@ -1,8 +1,8 @@
/*
* Color.c -- Color management module.
*
- * Authors : Patrick Lecoanet.
- * Creation date : Thu Dec 16 15:41:53 1999
+ * Authors : Patrick Lecoanet.
+ * Creation date : Thu Dec 16 15:41:53 1999
*
* $Id$
*/
@@ -62,8 +62,8 @@
*/
static Tcl_HashTable gradient_table;
-static int initialized = 0; /* 0 means static structures haven't been
- * initialized yet. */
+static int initialized = 0; /* 0 means static structures haven't been
+ * initialized yet. */
/*
@@ -71,13 +71,13 @@ static int initialized = 0; /* 0 means static structures haven't been
*
* ColorInit --
*
- * Initialize the structure used for color management.
+ * Initialize the structure used for color management.
*
* Results:
- * None.
+ * None.
*
* Side effects:
- * Read the code.
+ * Read the code.
*
*----------------------------------------------------------------------
*/
@@ -98,11 +98,11 @@ ColorInit()
*----------------------------------------------------------------------
*/
XColor *
-ZnGetGradientColor(ZnGradient *grad,
- ZnReal position,
- unsigned short *alpha)
+ZnGetGradientColor(ZnGradient *grad,
+ ZnReal position,
+ unsigned short *alpha)
{
- int index, min, max;
+ int index, min, max;
XColor *shade=NULL;
if ((grad->num_actual_colors == 1) || (position <= 0.0)) {
@@ -124,10 +124,10 @@ ZnGetGradientColor(ZnGradient *grad,
while (max - min != 1) {
/*printf("color index %d, min: %d, max: %d\n", index, min, max);*/
if (grad->actual_colors[index].position < position) {
- min = index;
+ min = index;
}
else {
- max = index;
+ max = index;
}
index = (max + min) / 2;
}
@@ -142,9 +142,9 @@ ZnGetGradientColor(ZnGradient *grad,
void
ZnInterpGradientColor(ZnGradient *grad,
- ZnReal position,
- XColor *color,
- unsigned short *alpha)
+ ZnReal position,
+ XColor *color,
+ unsigned short *alpha)
{
int index, min, max;
ZnGradientColor *gc1, *gc2;
@@ -165,10 +165,10 @@ ZnInterpGradientColor(ZnGradient *grad,
while (max - min != 1) {
/*printf("color index %d, min: %d, max: %d\n", index, min, max);*/
if (grad->actual_colors[index].position < position) {
- min = index;
+ min = index;
}
else {
- max = index;
+ max = index;
}
index = (max + min) / 2;
}
@@ -179,24 +179,24 @@ ZnInterpGradientColor(ZnGradient *grad,
if (rel_pos > gc1->control) {
rel_pos = (rel_pos - gc1->control) * 100.0 / (100.0 - gc1->control);
color->red = gc1->mid_rgb->red +
- (unsigned short) ((gc2->rgb->red - gc1->mid_rgb->red) * rel_pos / 100.0);
+ (unsigned short) ((gc2->rgb->red - gc1->mid_rgb->red) * rel_pos / 100.0);
color->green = gc1->mid_rgb->green +
- (unsigned short) ((gc2->rgb->green - gc1->mid_rgb->green) * rel_pos / 100.0);
+ (unsigned short) ((gc2->rgb->green - gc1->mid_rgb->green) * rel_pos / 100.0);
color->blue = gc1->mid_rgb->blue +
- (unsigned short) ((gc2->rgb->blue - gc1->mid_rgb->blue) * rel_pos / 100.0);
+ (unsigned short) ((gc2->rgb->blue - gc1->mid_rgb->blue) * rel_pos / 100.0);
*alpha = gc1->mid_alpha +
- (unsigned short) ((gc2->alpha - gc1->mid_alpha) * rel_pos / 100.0);
+ (unsigned short) ((gc2->alpha - gc1->mid_alpha) * rel_pos / 100.0);
}
else {
rel_pos = rel_pos * 100.0 / gc1->control;
color->red = gc1->rgb->red +
- (unsigned short) ((gc1->mid_rgb->red - gc1->rgb->red) * rel_pos / 100.0);
+ (unsigned short) ((gc1->mid_rgb->red - gc1->rgb->red) * rel_pos / 100.0);
color->green = gc1->rgb->green +
- (unsigned short) ((gc1->mid_rgb->green - gc1->rgb->green) * rel_pos / 100.0);
+ (unsigned short) ((gc1->mid_rgb->green - gc1->rgb->green) * rel_pos / 100.0);
color->blue = gc1->rgb->blue +
- (unsigned short) ((gc1->mid_rgb->blue - gc1->rgb->blue) * rel_pos / 100.0);
+ (unsigned short) ((gc1->mid_rgb->blue - gc1->rgb->blue) * rel_pos / 100.0);
*alpha = gc1->alpha +
- (unsigned short) ((gc1->mid_alpha - gc1->alpha) * rel_pos / 100.0);
+ (unsigned short) ((gc1->mid_alpha - gc1->alpha) * rel_pos / 100.0);
}
}
}
@@ -207,13 +207,13 @@ ZnInterpGradientColor(ZnGradient *grad,
*
* ZnGradientFlat --
*
- * Returns true if the gradient is defined by a single
- * color.
+ * Returns true if the gradient is defined by a single
+ * color.
*
*--------------------------------------------------------------
*/
ZnBool
-ZnGradientFlat(ZnGradient *grad)
+ZnGradientFlat(ZnGradient *grad)
{
return (grad->num_actual_colors == 1);
}
@@ -224,38 +224,38 @@ ZnGradientFlat(ZnGradient *grad)
*
* ZnGetReliefGradient --
*
- * Create a data structure containing a range of colors
- * used to display a 3D border. Name contains the base
- * color for the border. This is a slight variation on
- * the syntax of a gradient that make life easier in this
- * simple case.
+ * Create a data structure containing a range of colors
+ * used to display a 3D border. Name contains the base
+ * color for the border. This is a slight variation on
+ * the syntax of a gradient that make life easier in this
+ * simple case.
*
* Results:
- * The return value is a token for a data structure
- * describing a gradient. This token may be passed
- * to the drawing routines.
- * If an error prevented the gradient from being created
- * then NULL is returned and an error message will be
- * left in interp.
+ * The return value is a token for a data structure
+ * describing a gradient. This token may be passed
+ * to the drawing routines.
+ * If an error prevented the gradient from being created
+ * then NULL is returned and an error message will be
+ * left in interp.
*
* Side effects:
- * Data structures, etc. are allocated.
- * It is the caller's responsibility to eventually call
- * ZnFreeGradient to release the resources.
+ * Data structures, etc. are allocated.
+ * It is the caller's responsibility to eventually call
+ * ZnFreeGradient to release the resources.
*
*--------------------------------------------------------------
*/
ZnGradient *
-ZnGetReliefGradient(Tcl_Interp *interp,
- Tk_Window tkwin,
- Tk_Uid name,
- unsigned short alpha)
+ZnGetReliefGradient(Tcl_Interp *interp,
+ Tk_Window tkwin,
+ Tk_Uid name,
+ unsigned short alpha)
{
XColor *base, light_color, dark_color, color;
- char color_name[COLOR_NAME_SIZE];
- char buffer[COLOR_NAME_SIZE*(3+2*ZN_RELIEF_STEPS)];
- int j, tmp1, tmp2;
- int red_range, green_range, blue_range;
+ char color_name[COLOR_NAME_SIZE];
+ char buffer[COLOR_NAME_SIZE*(3+2*ZN_RELIEF_STEPS)];
+ int j, tmp1, tmp2;
+ int red_range, green_range, blue_range;
base = Tk_GetColor(interp, tkwin, name);
/*
@@ -309,7 +309,7 @@ ZnGetReliefGradient(Tcl_Interp *interp,
buffer[0] = 0;
sprintf(color_name, "#%02x%02x%02x;%d|",
- dark_color.red/256, dark_color.green/256, dark_color.blue/256, alpha);
+ dark_color.red/256, dark_color.green/256, dark_color.blue/256, alpha);
red_range = (int) base->red - (int) dark_color.red;
green_range = (int) base->green - (int) dark_color.green;
blue_range = (int) base->blue - (int) dark_color.blue;
@@ -319,11 +319,11 @@ ZnGetReliefGradient(Tcl_Interp *interp,
color.green = (int) dark_color.green + green_range * j/ZN_RELIEF_STEPS;
color.blue = (int) dark_color.blue + blue_range * j/ZN_RELIEF_STEPS;
sprintf(color_name, "#%02x%02x%02x;%d %d|",
- color.red/256, color.green/256, color.blue/256, alpha, 50/ZN_RELIEF_STEPS*j);
+ color.red/256, color.green/256, color.blue/256, alpha, 50/ZN_RELIEF_STEPS*j);
strcat(buffer, color_name);
}
sprintf(color_name, "#%02x%02x%02x;%d 50|",
- base->red/256, base->green/256, base->blue/256, alpha);
+ base->red/256, base->green/256, base->blue/256, alpha);
strcat(buffer, color_name);
red_range = (int) light_color.red - (int) base->red;
green_range = (int) light_color.green - (int) base->green;
@@ -333,11 +333,11 @@ ZnGetReliefGradient(Tcl_Interp *interp,
color.green = (int) base->green + green_range * j/ZN_RELIEF_STEPS;
color.blue = (int) base->blue + blue_range * j/ZN_RELIEF_STEPS;
sprintf(color_name, "#%02x%02x%02x;%d %d|",
- color.red/256, color.green/256, color.blue/256, alpha, 50+50/ZN_RELIEF_STEPS*j);
+ color.red/256, color.green/256, color.blue/256, alpha, 50+50/ZN_RELIEF_STEPS*j);
strcat(buffer, color_name);
}
sprintf(color_name, "#%02x%02x%02x;%d",
- light_color.red/256, light_color.green/256, light_color.blue/256, alpha);
+ light_color.red/256, light_color.green/256, light_color.blue/256, alpha);
strcat(buffer, color_name);
/*printf("gradient relief: %s \n", buffer);*/
@@ -351,22 +351,22 @@ ZnGetReliefGradient(Tcl_Interp *interp,
* ZnNameGradient
* ZnDeleteGradientName --
*
- * Save a gradient under a name or suppress the gradient
- * name binding. The save function returns false if the
- * name is already in use.
+ * Save a gradient under a name or suppress the gradient
+ * name binding. The save function returns false if the
+ * name is already in use.
*
*--------------------------------------------------------------
*/
ZnBool
-ZnNameGradient(Tcl_Interp *interp,
- Tk_Window tkwin,
- char *grad_descr,
- char *name)
+ZnNameGradient(Tcl_Interp *interp,
+ Tk_Window tkwin,
+ char *grad_descr,
+ char *name)
{
- Tcl_HashEntry *hash;
- int new;
- ZnGradient *grad;
- XColor color;
+ Tcl_HashEntry *hash;
+ int new;
+ ZnGradient *grad;
+ XColor color;
/*
* First try to find if the name interfere with a color name,
@@ -376,20 +376,20 @@ ZnNameGradient(Tcl_Interp *interp,
*/
if (XParseColor(Tk_Display(tkwin), Tk_Colormap(tkwin), name, &color)) {
Tcl_AppendResult(interp, "gradient name \"", name,
- "\", is a color name", NULL);
+ "\", is a color name", NULL);
return False;
}
grad = ZnGetGradient(interp, tkwin, grad_descr);
if (!grad) {
Tcl_AppendResult(interp, "gradient specification \"", grad_descr,
- "\", is invalid", NULL);
+ "\", is invalid", NULL);
return False;
}
hash = Tcl_CreateHashEntry(&gradient_table, Tk_GetUid(name), &new);
if (!new) {
ZnFreeGradient(grad);
Tcl_AppendResult(interp, "gradient name \"", name,
- "\", is already in use", NULL);
+ "\", is already in use", NULL);
return False;
}
else {
@@ -400,7 +400,7 @@ ZnNameGradient(Tcl_Interp *interp,
}
ZnBool
-ZnGradientNameExists(char *name)
+ZnGradientNameExists(char *name)
{
if (!initialized) {
return False;
@@ -409,9 +409,9 @@ ZnGradientNameExists(char *name)
}
void
-ZnDeleteGradientName(char *name)
+ZnDeleteGradientName(char *name)
{
- Tcl_HashEntry *hash;
+ Tcl_HashEntry *hash;
if (!initialized) {
return;
@@ -425,17 +425,17 @@ ZnDeleteGradientName(char *name)
}
static void
-InterpolateGradientColor(Tk_Window tkwin,
- ZnGradientColor *gc1, /* First color */
- ZnGradientColor *gc2, /* Next color */
- ZnGradientColor *gc_interp,/* New interpolated color */
- ZnGradientColor *gc_adjust,/* Adjusted first color.
- * Needed if interested in
- * the range color1 interp
- * color. */
- int interp_pos,
- int min_pos,
- int span)
+InterpolateGradientColor(Tk_Window tkwin,
+ ZnGradientColor *gc1, /* First color */
+ ZnGradientColor *gc2, /* Next color */
+ ZnGradientColor *gc_interp,/* New interpolated color */
+ ZnGradientColor *gc_adjust,/* Adjusted first color.
+ * Needed if interested in
+ * the range color1 interp
+ * color. */
+ int interp_pos,
+ int min_pos,
+ int span)
{
ZnReal pos1, pos2, ipos, interp_rel_pos, tmp;
XColor rgb;
@@ -509,15 +509,15 @@ InterpolateGradientColor(Tk_Window tkwin,
static void
-ReduceGradient(Tk_Window tkwin,
- ZnGradient *grad)
+ReduceGradient(Tk_Window tkwin,
+ ZnGradient *grad)
{
ZnReal dx, dy, len, angle;
ZnTransfo t;
ZnPoint pbbox[4], pgrad[4];
ZnReal maxx, minx, span, start_in_new, end_in_new;
- int minx100, maxx100, span100;
- int i, j, first_color, last_color;
+ int minx100, maxx100, span100;
+ int i, j, first_color, last_color;
ZnBool interpolate_first, interpolate_last;
dx = grad->e.x - grad->p.x;
@@ -585,12 +585,12 @@ ReduceGradient(Tk_Window tkwin,
if (end_in_new < 0.0) {
grad->actual_colors[0].alpha = grad->colors_in[0].alpha;
grad->actual_colors[0].rgb = Tk_GetColorByValue(tkwin,
- grad->colors_in[0].rgb);
+ grad->colors_in[0].rgb);
}
else {
grad->actual_colors[0].alpha = grad->colors_in[grad->num_colors_in].alpha;
grad->actual_colors[0].rgb = Tk_GetColorByValue(tkwin,
- grad->colors_in[grad->num_colors_in].rgb);
+ grad->colors_in[grad->num_colors_in].rgb);
}
}
@@ -609,7 +609,7 @@ ReduceGradient(Tk_Window tkwin,
*/
first_color = 1;
while ((first_color < (int) grad->num_colors_in) &&
- (grad->colors_in[first_color].position < minx100)) {
+ (grad->colors_in[first_color].position < minx100)) {
first_color++;
grad->num_actual_colors--;
}
@@ -637,7 +637,7 @@ ReduceGradient(Tk_Window tkwin,
*/
last_color = grad->num_colors_in-2;
while ((last_color >= 0) &&
- (grad->colors_in[last_color].position > maxx100)) {
+ (grad->colors_in[last_color].position > maxx100)) {
last_color--;
grad->num_actual_colors--;
}
@@ -658,11 +658,11 @@ ReduceGradient(Tk_Window tkwin,
j = 0;
if (interpolate_first) {
InterpolateGradientColor(tkwin,
- &grad->colors_in[first_color-1],
- &grad->colors_in[first_color],
- &grad->actual_colors[j],
- NULL,
- minx100, minx100, span100);
+ &grad->colors_in[first_color-1],
+ &grad->colors_in[first_color],
+ &grad->actual_colors[j],
+ NULL,
+ minx100, minx100, span100);
j++;
}
else if ((first_color == 0) && (grad->type != ZN_RADIAL_GRADIENT)) {
@@ -693,11 +693,11 @@ ReduceGradient(Tk_Window tkwin,
if (interpolate_last) {
InterpolateGradientColor(tkwin,
- &grad->colors_in[last_color],
- &grad->colors_in[last_color+1],
- &grad->actual_colors[j],
- &grad->actual_colors[j-1],
- maxx100, minx100, span100);
+ &grad->colors_in[last_color],
+ &grad->colors_in[last_color+1],
+ &grad->actual_colors[j],
+ &grad->actual_colors[j-1],
+ maxx100, minx100, span100);
}
else if (last_color == ((int) grad->num_colors_in)-1) {
i = grad->num_colors_in-1;
@@ -718,65 +718,65 @@ ReduceGradient(Tk_Window tkwin,
*
* ZnGetGradient --
*
- * Create a data structure containing a range of colors
- * used to display a gradient.
+ * Create a data structure containing a range of colors
+ * used to display a gradient.
*
- * The gradient should have the following syntax:
+ * The gradient should have the following syntax:
*
- * gradient := [graddesc|]color[|....|color]
- * where the | are real characters not meta-syntax.
+ * gradient := [graddesc|]color[|....|color]
+ * where the | are real characters not meta-syntax.
*
- * graddesc := =type args
- * where type := axial | radial | path
+ * graddesc := =type args
+ * where type := axial | radial | path
*
- * If type = axial
- * args := angle (0..360) | xs ys xe ye (reals)
+ * If type = axial
+ * args := angle (0..360) | xs ys xe ye (reals)
*
* The first form define the axial gradiant by its slope.
* With this syntax the gradient fits the whole shape.
- * This is a backward compatible syntax.
- * The second form specifies a vector which will be used
- * to draw the gradient. The vector defines both the angle
- * and the gradient area. Parts of the shape that lie before
- * the vector origin are filled with the first color and
- * parts that lie after the vector end are filled with the
- * last color.
+ * This is a backward compatible syntax.
+ * The second form specifies a vector which will be used
+ * to draw the gradient. The vector defines both the angle
+ * and the gradient area. Parts of the shape that lie before
+ * the vector origin are filled with the first color and
+ * parts that lie after the vector end are filled with the
+ * last color.
*
- * If type = radial or path
- * args := xs ys [xe ye] (reals)
+ * If type = radial or path
+ * args := xs ys [xe ye] (reals)
*
- * The vector specified by the 4 coordinates defines the
- * gradient area. Parts of the shape that lie before
- * the vector origin are filled with the first color and
- * parts that lie after the vector end are filled with the
- * last color. The vector end may be omitted, in such case
- * the gradient fits exactly the whole shape to be filled,
- * this is backward compatible with older gradients.
- *
- * color := colorvalue | colorvalue position |
- * colorvalue control position
- * where position and control are in (0..100)
+ * The vector specified by the 4 coordinates defines the
+ * gradient area. Parts of the shape that lie before
+ * the vector origin are filled with the first color and
+ * parts that lie after the vector end are filled with the
+ * last color. The vector end may be omitted, in such case
+ * the gradient fits exactly the whole shape to be filled,
+ * this is backward compatible with older gradients.
+ *
+ * color := colorvalue | colorvalue position |
+ * colorvalue control position
+ * where position and control are in (0..100)
*
- * colorvalue := (colorname | #rgb | cievalue)[;alpha]
- * where alpha is in (0..100)
+ * colorvalue := (colorname | #rgb | cievalue)[;alpha]
+ * where alpha is in (0..100)
*
* Results:
- * The return value is a token for a data structure
- * describing a gradient. This token may be passed
- * to the drawing routines.
- * If an error prevented the gradient from being created
- * then NULL is returned and an error message will be
- * left in interp.
+ * The return value is a token for a data structure
+ * describing a gradient. This token may be passed
+ * to the drawing routines.
+ * If an error prevented the gradient from being created
+ * then NULL is returned and an error message will be
+ * left in interp.
*
* Side effects:
- * Data structures, etc. are allocated.
- * It is the caller's responsibility to eventually call
- * ZnFreeGradient to release the resources.
+ * Data structures, etc. are allocated.
+ * It is the caller's responsibility to eventually call
+ * ZnFreeGradient to release the resources.
*
*--------------------------------------------------------------
*/
ZnGradient *
-ZnGetGradientByValue(ZnGradient *grad)
+ZnGetGradientByValue(ZnGradient *grad)
{
grad->ref_count++;
return grad;
@@ -785,12 +785,12 @@ ZnGetGradientByValue(ZnGradient *grad)
static int
ParseRealList(const char *str,
- const char *stop,
- ZnReal *list,
- int max)
+ const char *stop,
+ ZnReal *list,
+ int max)
{
- int num;
- char *end;
+ int num;
+ char *end;
num = 0;
while ((num < max) && (str != stop)) {
@@ -808,24 +808,24 @@ ParseRealList(const char *str,
}
ZnGradient *
-ZnGetGradient(Tcl_Interp *interp,
- Tk_Window tkwin,
- Tk_Uid desc)
+ZnGetGradient(Tcl_Interp *interp,
+ Tk_Window tkwin,
+ Tk_Uid desc)
{
#define SEGMENT_SIZE 64
- Tcl_HashEntry *hash;
- ZnGradient *grad;
- unsigned int i, j, nspace, num_colors;
- unsigned int size, num_coords=0;
- char type;
- char const *scan_ptr, *next_ptr, *str_ptr;
- ZnReal angle, position, control;
- ZnReal coords[4];
- char *color_ptr, *end, segment[SEGMENT_SIZE];
+ Tcl_HashEntry *hash;
+ ZnGradient *grad;
+ unsigned int i, j, nspace, num_colors;
+ unsigned int size, num_coords=0;
+ char type;
+ char const *scan_ptr, *next_ptr, *str_ptr;
+ ZnReal angle, position, control;
+ ZnReal coords[4];
+ char *color_ptr, *end, segment[SEGMENT_SIZE];
ZnGradientColor *first, *last;
- XColor color;
- int new, red_range, green_range, blue_range;
- ZnBool simple;
+ XColor color;
+ int new, red_range, green_range, blue_range;
+ ZnBool simple;
/* printf("ZnGetGradient : %s\n", desc);*/
if (!desc || !*desc) {
@@ -876,7 +876,7 @@ ZnGetGradient(Tcl_Interp *interp,
}
if (num_colors == 0) {
Tcl_AppendResult(interp, "gradient should have at least one color \"",
- desc, "\",", NULL);
+ desc, "\",", NULL);
grad_err1:
Tcl_DeleteHashEntry(hash);
/*printf("ZnGetGradient error : %s\n", desc);*/
@@ -899,9 +899,9 @@ ZnGetGradient(Tcl_Interp *interp,
num_coords = ParseRealList(scan_ptr, next_ptr, coords, 4);
if ((num_coords != 1) && (num_coords != 4)) {
grad_err3:
- Tcl_AppendResult(interp, "invalid gradient parameter \"",
- desc, "\",", NULL);
- goto grad_err1;
+ Tcl_AppendResult(interp, "invalid gradient parameter \"",
+ desc, "\",", NULL);
+ goto grad_err1;
}
angle = (int) coords[0];
}
@@ -910,28 +910,28 @@ ZnGetGradient(Tcl_Interp *interp,
type = ZN_CONICAL_GRADIENT;
num_coords = ParseRealList(scan_ptr, next_ptr, coords, 4);
if ((num_coords < 1) && (num_coords > 4)) {
- goto grad_err3;
+ goto grad_err3;
}
angle = (int) coords[0];
}
else if (((*scan_ptr == 'r') && (strncmp(scan_ptr, "radial", 6) == 0)) ||
- ((*scan_ptr == 'p') && (strncmp(scan_ptr, "path", 4) == 0))) {
+ ((*scan_ptr == 'p') && (strncmp(scan_ptr, "path", 4) == 0))) {
if (*scan_ptr == 'r') {
- type = ZN_RADIAL_GRADIENT;
- scan_ptr += 6;
+ type = ZN_RADIAL_GRADIENT;
+ scan_ptr += 6;
}
else {
- type = ZN_PATH_GRADIENT;
- scan_ptr += 4;
+ type = ZN_PATH_GRADIENT;
+ scan_ptr += 4;
}
num_coords = ParseRealList(scan_ptr, next_ptr, coords, 4);
if ((num_coords != 2) && (num_coords != 4)) {
- goto grad_err3;
+ goto grad_err3;
}
}
else {
Tcl_AppendResult(interp, "invalid gradient type \"",
- desc, "\",", NULL);
+ desc, "\",", NULL);
goto grad_err1;
}
scan_ptr = next_ptr + 1;
@@ -941,7 +941,7 @@ ZnGetGradient(Tcl_Interp *interp,
* Create the gradient structure.
*/
grad = (ZnGradient *) ZnMalloc(sizeof(ZnGradient) +
- sizeof(ZnGradientColor)*(num_colors-1));
+ sizeof(ZnGradientColor)*(num_colors-1));
grad->ref_count = 1;
simple = True;
grad->num_colors_in = num_colors;
@@ -952,7 +952,7 @@ ZnGetGradient(Tcl_Interp *interp,
switch (type) {
case ZN_AXIAL_GRADIENT:
if ((num_coords == 4) &&
- ((coords[0] != coords[2]) || (coords[1] != coords[3]))) {
+ ((coords[0] != coords[2]) || (coords[1] != coords[3]))) {
grad->p.x = coords[0];
grad->p.y = coords[1];
simple = False;
@@ -965,7 +965,7 @@ ZnGetGradient(Tcl_Interp *interp,
break;
case ZN_CONICAL_GRADIENT:
if ((num_coords == 4) &&
- ((coords[0] != coords[2]) || (coords[1] != coords[3]))) {
+ ((coords[0] != coords[2]) || (coords[1] != coords[3]))) {
grad->p.x = coords[0];
grad->p.y = coords[1];
simple = False;
@@ -989,7 +989,7 @@ ZnGetGradient(Tcl_Interp *interp,
grad->p.x = coords[0];
grad->p.y = coords[1];
if ((num_coords == 4) &&
- ((coords[0] != coords[2]) || (coords[1] != coords[3]))) {
+ ((coords[0] != coords[2]) || (coords[1] != coords[3]))) {
simple = False;
grad->e.x = coords[2];
grad->e.y = coords[3];
@@ -1008,7 +1008,7 @@ ZnGetGradient(Tcl_Interp *interp,
/*
* Try to parse the color name.
*/
- nspace = strspn(scan_ptr, " \t");
+ nspace = strspn(scan_ptr, " \t");
scan_ptr += nspace;
str_ptr = strpbrk(scan_ptr, " \t|");
if (str_ptr) {
@@ -1019,10 +1019,10 @@ ZnGetGradient(Tcl_Interp *interp,
}
if (size > (SEGMENT_SIZE-1)) {
Tcl_AppendResult(interp, "color name too long in gradient \"",
- desc, "\",", NULL);
+ desc, "\",", NULL);
grad_err2:
for (j = 0; j < i; j++) {
- Tk_FreeColor(grad->colors_in[j].rgb);
+ Tk_FreeColor(grad->colors_in[j].rgb);
}
ZnFree(grad);
goto grad_err1;
@@ -1044,14 +1044,14 @@ ZnGetGradient(Tcl_Interp *interp,
*/
control = strtod(scan_ptr, &end);
if (end != scan_ptr) {
- grad->colors_in[i].control = (int) control;
- scan_ptr = end;
+ grad->colors_in[i].control = (int) control;
+ scan_ptr = end;
}
}
nspace = strspn(scan_ptr, " \t");
if ((scan_ptr[nspace] != 0) && (scan_ptr+nspace != next_ptr)) {
Tcl_AppendResult(interp, "incorrect color description in gradient \"",
- desc, "\",", NULL);
+ desc, "\",", NULL);
goto grad_err2;
}
@@ -1062,7 +1062,7 @@ ZnGetGradient(Tcl_Interp *interp,
grad->colors_in[i].rgb = Tk_GetColor(interp, tkwin, Tk_GetUid(segment));
if (grad->colors_in[i].rgb == NULL) {
Tcl_AppendResult(interp, "incorrect color value in gradient \"",
- desc, "\",", NULL);
+ desc, "\",", NULL);
goto grad_err2;
}
if (color_ptr) {
@@ -1076,10 +1076,10 @@ ZnGetGradient(Tcl_Interp *interp,
grad->colors_in[i].position = 100;
}
if ((i > 0) &&
- ((grad->colors_in[i].position > 100) ||
- (grad->colors_in[i].position < grad->colors_in[i-1].position))) {
+ ((grad->colors_in[i].position > 100) ||
+ (grad->colors_in[i].position < grad->colors_in[i-1].position))) {
Tcl_AppendResult(interp, "incorrect color position in gradient \"",
- desc, "\",", NULL);
+ desc, "\",", NULL);
goto grad_err2;
}
if (grad->colors_in[i].control > 100) {
@@ -1139,20 +1139,20 @@ ZnGetGradient(Tcl_Interp *interp,
*
* ZnNameOfGradient --
*
- * Given a gradient, return a textual string identifying
- * the gradient.
+ * Given a gradient, return a textual string identifying
+ * the gradient.
*
* Results:
- * The return value is the string that was used to create
- * the gradient.
+ * The return value is the string that was used to create
+ * the gradient.
*
* Side effects:
- * None.
+ * None.
*
*--------------------------------------------------------------
*/
char *
-ZnNameOfGradient(ZnGradient *grad)
+ZnNameOfGradient(ZnGradient *grad)
{
return (char *) grad->hash->key.words;
}
@@ -1163,23 +1163,23 @@ ZnNameOfGradient(ZnGradient *grad)
*
* ZnFreeGradient --
*
- * This procedure is called when a gradient is no longer
- * needed. It frees the resources associated with the
- * gradient. After this call, the caller should never
- * again use the gradient.
+ * This procedure is called when a gradient is no longer
+ * needed. It frees the resources associated with the
+ * gradient. After this call, the caller should never
+ * again use the gradient.
*
* Results:
- * None.
+ * None.
*
* Side effects:
- * Resources are freed.
+ * Resources are freed.
*
*--------------------------------------------------------------
*/
void
-ZnFreeGradient(ZnGradient *grad)
+ZnFreeGradient(ZnGradient *grad)
{
- unsigned int i;
+ unsigned int i;
grad->ref_count--;
if (grad->ref_count == 0) {
@@ -1187,15 +1187,15 @@ ZnFreeGradient(ZnGradient *grad)
for (i = 0; i < grad->num_colors_in; i++) {
Tk_FreeColor(grad->colors_in[i].rgb);
if (grad->colors_in[i].mid_rgb) {
- Tk_FreeColor(grad->colors_in[i].mid_rgb);
+ Tk_FreeColor(grad->colors_in[i].mid_rgb);
}
}
if (grad->actual_colors != grad->colors_in) {
for (i = 0; i < grad->num_actual_colors; i++) {
- Tk_FreeColor(grad->actual_colors[i].rgb);
- if (grad->actual_colors[i].mid_rgb) {
- Tk_FreeColor(grad->actual_colors[i].mid_rgb);
- }
+ Tk_FreeColor(grad->actual_colors[i].rgb);
+ if (grad->actual_colors[i].mid_rgb) {
+ Tk_FreeColor(grad->actual_colors[i].mid_rgb);
+ }
}
ZnFree(grad->actual_colors);
}
@@ -1209,14 +1209,14 @@ ZnFreeGradient(ZnGradient *grad)
*
* ZnComposeAlpha --
*
- * This procedure takes two alpha values in percent and
- * returns the composite value between 0 and 65535.
+ * This procedure takes two alpha values in percent and
+ * returns the composite value between 0 and 65535.
*
*--------------------------------------------------------------
*/
int
-ZnComposeAlpha(unsigned short alpha1,
- unsigned short alpha2)
+ZnComposeAlpha(unsigned short alpha1,
+ unsigned short alpha2)
{
return (alpha1*alpha2/100)*65535/100;
}
diff --git a/generic/Color.h b/generic/Color.h
index 16c0ca2..7842760 100644
--- a/generic/Color.h
+++ b/generic/Color.h
@@ -1,8 +1,8 @@
/*
* Color.h -- Header for color routines.
*
- * Authors : Patrick Lecoanet.
- * Creation date : Thu Dec 16 15:41:04 1999
+ * Authors : Patrick Lecoanet.
+ * Creation date : Thu Dec 16 15:41:04 1999
*
* $Id$
*/
@@ -38,37 +38,37 @@
/*
* Types of gradients.
*/
-#define ZN_AXIAL_GRADIENT 0
-#define ZN_RADIAL_GRADIENT 1
-#define ZN_PATH_GRADIENT 2
-#define ZN_CONICAL_GRADIENT 3
+#define ZN_AXIAL_GRADIENT 0
+#define ZN_RADIAL_GRADIENT 1
+#define ZN_PATH_GRADIENT 2
+#define ZN_CONICAL_GRADIENT 3
typedef struct _ZnGradientColor {
- unsigned char position; /* Color starting position along the gradient axis.
- * This is in percent of the gradient total size. */
- unsigned char control; /* Middle-shade position in percent of this color
- * size along the gradient axis. */
- unsigned char alpha; /* The color alpha channel in percent */
- unsigned char mid_alpha;
- XColor *rgb; /* The actual color description */
- XColor *mid_rgb;
+ unsigned char position; /* Color starting position along the gradient axis.
+ * This is in percent of the gradient total size. */
+ unsigned char control; /* Middle-shade position in percent of this color
+ * size along the gradient axis. */
+ unsigned char alpha; /* The color alpha channel in percent */
+ unsigned char mid_alpha;
+ XColor *rgb; /* The actual color description */
+ XColor *mid_rgb;
} ZnGradientColor;
typedef struct _ZnGradient {
- int ref_count;
- Tcl_HashEntry *hash;
- char type; /* Either ZN_AXIAL_GRADIENT, ZN_RADIAL_GRADIENT or
- * ZN_PATH_GRADIENT. */
- int angle; /* Angle for an axial gradient (Degrees). */
- ZnPoint p; /* Start for an axial/radial/path gradiant. In
- * percent of the bbox. */
- ZnPoint e; /* End of the axial/radial gradiant in percent
- * of bbox. */
- unsigned int num_actual_colors;/* Number of adjusted colors */
+ int ref_count;
+ Tcl_HashEntry *hash;
+ char type; /* Either ZN_AXIAL_GRADIENT, ZN_RADIAL_GRADIENT or
+ * ZN_PATH_GRADIENT. */
+ int angle; /* Angle for an axial gradient (Degrees). */
+ ZnPoint p; /* Start for an axial/radial/path gradiant. In
+ * percent of the bbox. */
+ ZnPoint e; /* End of the axial/radial gradiant in percent
+ * of bbox. */
+ unsigned int num_actual_colors;/* Number of adjusted colors */
ZnGradientColor *actual_colors;/* Actual adjusted gradient color spec. May
- * be the same array as color_spec. */
- unsigned int num_colors_in; /* Number of colors in gradient spec. */
- ZnGradientColor colors_in[1]; /* Gradient color spec */
+ * be the same array as color_spec. */
+ unsigned int num_colors_in; /* Number of colors in gradient spec. */
+ ZnGradientColor colors_in[1]; /* Gradient color spec */
} ZnGradient;
@@ -76,21 +76,21 @@ typedef struct _ZnGradient {
ZnPixel(ZnGetGradientColor(gradient, position, NULL))
ZnGradient *ZnGetGradient(Tcl_Interp *interp, Tk_Window tkwin,
- Tk_Uid name);
+ Tk_Uid name);
ZnGradient *ZnGetGradientByValue(ZnGradient *gradient);
ZnGradient *ZnGetReliefGradient(Tcl_Interp *interp, Tk_Window tkwin,
- Tk_Uid name, unsigned short alpha);
+ Tk_Uid name, unsigned short alpha);
ZnBool ZnGradientFlat(ZnGradient *grad);
XColor *ZnGetGradientColor(ZnGradient *gradient, ZnReal position,
- unsigned short *alpha);
+ unsigned short *alpha);
void ZnInterpGradientColor(ZnGradient *gradient, ZnReal position,
- XColor *color, unsigned short *alpha);
+ XColor *color, unsigned short *alpha);
char *ZnNameOfGradient(ZnGradient *gradient);
void ZnFreeGradient(ZnGradient *gradient);
void ZnDeleteGradientName(char *name);
ZnBool ZnGradientNameExists(char *name);
ZnBool ZnNameGradient(Tcl_Interp *interp, Tk_Window tkwin,
- char *grad_descr, char *name);
+ char *grad_descr, char *name);
int ZnComposeAlpha(unsigned short alpha1, unsigned short alpha2);
#endif /* _Color_h */
diff --git a/generic/Curve.c b/generic/Curve.c
index 0b61722..261f242 100644
--- a/generic/Curve.c
+++ b/generic/Curve.c
@@ -1,8 +1,8 @@
/*
* Curve.c -- Implementation of curve item.
*
- * Authors : Patrick Lecoanet.
- * Creation date : Fri Mar 25 15:32:17 1994
+ * Authors : Patrick Lecoanet.
+ * Creation date : Fri Mar 25 15:32:17 1994
*
* $Id$
*/
@@ -46,16 +46,16 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ "
/*
* Bit offset of flags.
*/
-#define FILLED_BIT 1<<0 /* If the item is filled with color/pattern */
-#define MARKED_BIT 1<<1 /* If the vertices are marked by a symbol */
-#define CLOSED_BIT 1<<2 /* If the outline should be closed automatically */
-#define SMOOTH_RELIEF_BIT 1<<3 /* If the relief should be continuous (arc) or discrete (angle) */
+#define FILLED_BIT 1<<0 /* If the item is filled with color/pattern */
+#define MARKED_BIT 1<<1 /* If the vertices are marked by a symbol */
+#define CLOSED_BIT 1<<2 /* If the outline should be closed automatically */
+#define SMOOTH_RELIEF_BIT 1<<3 /* If the relief should be continuous (arc) or discrete (angle) */
-#define FIRST_END_OK 1<<6
-#define LAST_END_OK 1<<7
-#define FILLED_OK 1<<8
-#define RELIEF_OK 1<<10
-#define MARKER_OK 1<<12
+#define FIRST_END_OK 1<<6
+#define LAST_END_OK 1<<7
+#define FILLED_OK 1<<8
+#define RELIEF_OK 1<<10
+#define MARKER_OK 1<<12
/*
@@ -66,34 +66,34 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ "
**********************************************************************************
*/
typedef struct _CurveItemStruct {
- ZnItemStruct header;
+ ZnItemStruct header;
/* Public data */
- ZnPoly shape;
+ ZnPoly shape;
unsigned short flags;
- ZnImage marker;
- ZnLineEnd first_end; /* These two are considered only if relief is flat */
- ZnLineEnd last_end;
- ZnLineStyle line_style; /* This is considered only if relief is flat */
- int cap_style;
- int join_style;
- ZnReliefStyle relief;
- ZnDim line_width; /* If 0 the path is not drawn, if <2 relief is flat */
- ZnGradient *fill_color;
- ZnImage line_pattern;
- ZnGradient *line_color;
- ZnGradient *marker_color;
- int fill_rule;
- ZnImage tile;
+ ZnImage marker;
+ ZnLineEnd first_end; /* These two are considered only if relief is flat */
+ ZnLineEnd last_end;
+ ZnLineStyle line_style; /* This is considered only if relief is flat */
+ int cap_style;
+ int join_style;
+ ZnReliefStyle relief;
+ ZnDim line_width; /* If 0 the path is not drawn, if <2 relief is flat */
+ ZnGradient *fill_color;
+ ZnImage line_pattern;
+ ZnGradient *line_color;
+ ZnGradient *marker_color;
+ int fill_rule;
+ ZnImage tile;
/* Private data */
- ZnPoly outlines;
- ZnGradient *gradient;
- ZnTriStrip tristrip;
- ZnPoint *grad_geo;
+ ZnPoly outlines;
+ ZnGradient *gradient;
+ ZnTriStrip tristrip;
+ ZnPoint *grad_geo;
} CurveItemStruct, *CurveItem;
-static ZnAttrConfig cv_attrs[] = {
+static ZnAttrConfig cv_attrs[] = {
{ ZN_CONFIG_CAP_STYLE, "-capstyle", NULL,
Tk_Offset(CurveItemStruct, cap_style), 0,
ZN_COORDS_FLAG, False },
@@ -168,15 +168,15 @@ static ZnAttrConfig cv_attrs[] = {
**********************************************************************************
*/
static int
-Init(ZnItem item,
- int *argc,
- Tcl_Obj *CONST *args[])
+Init(ZnItem item,
+ int *argc,
+ Tcl_Obj *CONST *args[])
{
- ZnWInfo *wi = item->wi;
- CurveItem cv = (CurveItem) item;
- unsigned int i, num_points, count;
- ZnPoint *p, *points;
- char *controls;
+ ZnWInfo *wi = item->wi;
+ CurveItem cv = (CurveItem) item;
+ unsigned int i, num_points, count;
+ ZnPoint *p, *points;
+ char *controls;
cv->outlines.num_contours = 0;
cv->outlines.contours = NULL;
@@ -201,7 +201,7 @@ Init(ZnItem item,
return TCL_ERROR;
}
if (ZnParseCoordList(wi, (*args)[0], &points,
- &controls, &num_points, NULL) == TCL_ERROR) {
+ &controls, &num_points, NULL) == TCL_ERROR) {
return TCL_ERROR;
}
@@ -216,25 +216,25 @@ Init(ZnItem item,
if (controls) {
count = 0;
if ((controls[0]) || (controls[num_points-1])) {
- goto contr_err;
+ goto contr_err;
}
for (i = 1; i < num_points-1; i++) {
- switch (controls[i]) {
- case 'c':
- count++;
- if (count > 2) {
- goto contr_err;
- }
- break;
- case 0:
- count = 0;
- break;
- default:
- contr_err:
- ZnFree(controls);
- Tcl_AppendResult(wi->interp, " curve coords expected", NULL);
- return TCL_ERROR;
- }
+ switch (controls[i]) {
+ case 'c':
+ count++;
+ if (count > 2) {
+ goto contr_err;
+ }
+ break;
+ case 0:
+ count = 0;
+ break;
+ default:
+ contr_err:
+ ZnFree(controls);
+ Tcl_AppendResult(wi->interp, " curve coords expected", NULL);
+ return TCL_ERROR;
+ }
}
}
/*
@@ -284,11 +284,11 @@ Init(ZnItem item,
**********************************************************************************
*/
static void
-Clone(ZnItem item)
+Clone(ZnItem item)
{
- CurveItem cv = (CurveItem) item;
- unsigned int i;
- ZnContour *conts;
+ CurveItem cv = (CurveItem) item;
+ unsigned int i;
+ ZnContour *conts;
if (cv->shape.num_contours) {
@@ -301,12 +301,12 @@ Clone(ZnItem item)
cv->shape.contours[i].cw = conts[i].cw;
cv->shape.contours[i].points = ZnMalloc(conts[i].num_points*sizeof(ZnPoint));
memcpy(cv->shape.contours[i].points, conts[i].points,
- conts[i].num_points*sizeof(ZnPoint));
+ conts[i].num_points*sizeof(ZnPoint));
cv->shape.contours[i].controls = NULL;
if (conts[i].controls) {
- cv->shape.contours[i].controls = ZnMalloc(conts[i].num_points*sizeof(char));
- memcpy(cv->shape.contours[i].controls, conts[i].controls,
- conts[i].num_points*sizeof(char));
+ cv->shape.contours[i].controls = ZnMalloc(conts[i].num_points*sizeof(char));
+ memcpy(cv->shape.contours[i].controls, conts[i].controls,
+ conts[i].num_points*sizeof(char));
}
}
}
@@ -348,10 +348,10 @@ Clone(ZnItem item)
**********************************************************************************
*/
static void
-Destroy(ZnItem item)
+Destroy(ZnItem item)
{
- CurveItem cv = (CurveItem) item;
- unsigned int i;
+ CurveItem cv = (CurveItem) item;
+ unsigned int i;
/*
* Need to free the control array here, it is only known
@@ -410,32 +410,32 @@ Destroy(ZnItem item)
**********************************************************************************
*/
static void
-SetRenderFlags(CurveItem cv)
+SetRenderFlags(CurveItem cv)
{
ASSIGN(cv->flags, FILLED_OK,
- ISSET(cv->flags, FILLED_BIT) && (cv->shape.num_contours >= 1));
+ ISSET(cv->flags, FILLED_BIT) && (cv->shape.num_contours >= 1));
ASSIGN(cv->flags, RELIEF_OK,
- (cv->relief != ZN_RELIEF_FLAT) &&
- (cv->shape.num_contours >= 1) &&
- (cv->line_width > 1));
+ (cv->relief != ZN_RELIEF_FLAT) &&
+ (cv->shape.num_contours >= 1) &&
+ (cv->line_width > 1));
ASSIGN(cv->flags, MARKER_OK,
- (cv->marker != ZnUnspecifiedImage) &&
- ISCLEAR(cv->flags, RELIEF_OK));
+ (cv->marker != ZnUnspecifiedImage) &&
+ ISCLEAR(cv->flags, RELIEF_OK));
ASSIGN(cv->flags, FIRST_END_OK,
- (cv->first_end != NULL) &&
- (cv->shape.num_contours == 1) && (cv->shape.contours[0].num_points > 1) &&
- ISCLEAR(cv->flags, FILLED_BIT) && cv->line_width &&
- ISCLEAR(cv->flags, RELIEF_OK) &&
- ISCLEAR(cv->flags, CLOSED_BIT));
+ (cv->first_end != NULL) &&
+ (cv->shape.num_contours == 1) && (cv->shape.contours[0].num_points > 1) &&
+ ISCLEAR(cv->flags, FILLED_BIT) && cv->line_width &&
+ ISCLEAR(cv->flags, RELIEF_OK) &&
+ ISCLEAR(cv->flags, CLOSED_BIT));
ASSIGN(cv->flags, LAST_END_OK,
- (cv->last_end != NULL) &&
- (cv->shape.num_contours == 1) && (cv->shape.contours[0].num_points > 1) &&
- ISCLEAR(cv->flags, FILLED_BIT) && cv->line_width &&
- ISCLEAR(cv->flags, RELIEF_OK) &&
- ISCLEAR(cv->flags, CLOSED_BIT));
+ (cv->last_end != NULL) &&
+ (cv->shape.num_contours == 1) && (cv->shape.contours[0].num_points > 1) &&
+ ISCLEAR(cv->flags, FILLED_BIT) && cv->line_width &&
+ ISCLEAR(cv->flags, RELIEF_OK) &&
+ ISCLEAR(cv->flags, CLOSED_BIT));
}
@@ -447,15 +447,15 @@ SetRenderFlags(CurveItem cv)
**********************************************************************************
*/
static int
-Configure(ZnItem item,
- int argc,
- Tcl_Obj *CONST argv[],
- int *flags)
+Configure(ZnItem item,
+ int argc,
+ Tcl_Obj *CONST argv[],
+ int *flags)
{
- ZnWInfo *wi = item->wi;
- CurveItem cv = (CurveItem) item;
- int status = TCL_OK;
- XColor *color;
+ ZnWInfo *wi = item->wi;
+ CurveItem cv = (CurveItem) item;
+ int status = TCL_OK;
+ XColor *color;
unsigned short alpha;
status = ZnConfigureAttributes(wi, item, item, cv_attrs, argc, argv, flags);
@@ -468,7 +468,7 @@ Configure(ZnItem item,
if ((cv->relief != ZN_RELIEF_FLAT) && !cv->gradient) {
color = ZnGetGradientColor(cv->line_color, 51.0, &alpha);
cv->gradient = ZnGetReliefGradient(wi->interp, wi->win,
- Tk_NameOfColor(color), alpha);
+ Tk_NameOfColor(color), alpha);
if (cv->gradient == NULL) {
status = TCL_ERROR;
}
@@ -486,9 +486,9 @@ Configure(ZnItem item,
**********************************************************************************
*/
static int
-Query(ZnItem item,
- int argc,
- Tcl_Obj *CONST argv[])
+Query(ZnItem item,
+ int argc,
+ Tcl_Obj *CONST argv[])
{
if (ZnQueryAttribute(item->wi->interp, item, cv_attrs, argv[0]) == TCL_ERROR) {
return TCL_ERROR;
@@ -498,14 +498,14 @@ Query(ZnItem item,
}
static void
-UpdateTristrip(CurveItem cv,
- ZnPoly *poly,
- ZnBool revert)
+UpdateTristrip(CurveItem cv,
+ ZnPoly *poly,
+ ZnBool revert)
{
- ZnCombineData *cdata, *cnext;
- GLdouble v[3];
- unsigned int j, k;
- int i;
+ ZnCombineData *cdata, *cnext;
+ GLdouble v[3];
+ unsigned int j, k;
+ int i;
//printf("UpdateTristrips sur %d\n", ((ZnItem) cv)->id);
gluTessProperty(ZnTesselator.tess, GLU_TESS_WINDING_RULE, (GLdouble) cv->fill_rule);
@@ -520,39 +520,39 @@ UpdateTristrip(CurveItem cv,
*/
if (!revert) {
for (j = 0; j < poly->num_contours; j++){
- gluTessBeginContour(ZnTesselator.tess);
- //printf("Début contour %d num_points %d\n", j, poly->contours[j].num_points);
- for (k = 0; k < poly->contours[j].num_points; k++) {
- /*printf("%g@%g ", poly->contours[j].points[k].x, poly->contours[j].points[k].y);*/
- v[0] = poly->contours[j].points[k].x;
- v[1] = poly->contours[j].points[k].y;
- v[2] = 0;
- gluTessVertex(ZnTesselator.tess, v, &poly->contours[j].points[k]);
- }
- //printf("\n");
- gluTessEndContour(ZnTesselator.tess);
+ gluTessBeginContour(ZnTesselator.tess);
+ //printf("Début contour %d num_points %d\n", j, poly->contours[j].num_points);
+ for (k = 0; k < poly->contours[j].num_points; k++) {
+ /*printf("%g@%g ", poly->contours[j].points[k].x, poly->contours[j].points[k].y);*/
+ v[0] = poly->contours[j].points[k].x;
+ v[1] = poly->contours[j].points[k].y;
+ v[2] = 0;
+ gluTessVertex(ZnTesselator.tess, v, &poly->contours[j].points[k]);
+ }
+ //printf("\n");
+ gluTessEndContour(ZnTesselator.tess);
}
}
else {
for (j = 0; j < poly->num_contours; j++){
- gluTessBeginContour(ZnTesselator.tess);
- //printf("revert Début contour %d num_points %d\n", j, poly->contours[j].num_points);
- for (i = (int) (poly->contours[j].num_points-1); i >= 0; i--) {
- /*printf("%g@%g ", poly->contours[j].points[i].x, poly->contours[j].points[i].y);*/
- v[0] = poly->contours[j].points[i].x;
- v[1] = poly->contours[j].points[i].y;
- v[2] = 0;
- gluTessVertex(ZnTesselator.tess, v, &poly->contours[j].points[i]);
- }
- //printf("\n");
- gluTessEndContour(ZnTesselator.tess);
+ gluTessBeginContour(ZnTesselator.tess);
+ //printf("revert Début contour %d num_points %d\n", j, poly->contours[j].num_points);
+ for (i = (int) (poly->contours[j].num_points-1); i >= 0; i--) {
+ /*printf("%g@%g ", poly->contours[j].points[i].x, poly->contours[j].points[i].y);*/
+ v[0] = poly->contours[j].points[i].x;
+ v[1] = poly->contours[j].points[i].y;
+ v[2] = 0;
+ gluTessVertex(ZnTesselator.tess, v, &poly->contours[j].points[i]);
+ }
+ //printf("\n");
+ gluTessEndContour(ZnTesselator.tess);
}
}
gluTessEndPolygon(ZnTesselator.tess);
cdata = ZnTesselator.combine_list;
- //printf("Combine length: %d\n", ZnTesselator.combine_length);
+ //printf("Combine length: %d\n", ZnTesselator.combine_length);
while (cdata) {
- ZnTesselator.combine_length--;
+ ZnTesselator.combine_length--;
cnext = cdata->next;
ZnFree(cdata);
cdata = cnext;
@@ -563,14 +563,14 @@ UpdateTristrip(CurveItem cv,
}
static void
-UpdateOutlines(CurveItem cv,
- ZnPoly *poly,
- ZnBool revert)
+UpdateOutlines(CurveItem cv,
+ ZnPoly *poly,
+ ZnBool revert)
{
- ZnCombineData *cdata, *cnext;
- GLdouble v[3];
- unsigned int j, k;
- int i;
+ ZnCombineData *cdata, *cnext;
+ GLdouble v[3];
+ unsigned int j, k;
+ int i;
//printf("UpdateOutlines sur %d\n", ((ZnItem) cv)->id);
gluTessProperty(ZnTesselator.tess, GLU_TESS_WINDING_RULE, (GLdouble) cv->fill_rule);
@@ -586,32 +586,32 @@ UpdateOutlines(CurveItem cv,
*/
if (!revert) {
for (j = 0; j < poly->num_contours; j++){
- gluTessBeginContour(ZnTesselator.tess);
- for (k = 0; k < poly->contours[j].num_points; k++) {
- v[0] = poly->contours[j].points[k].x;
- v[1] = poly->contours[j].points[k].y;
- v[2] = 0;
- gluTessVertex(ZnTesselator.tess, v, &poly->contours[j].points[k]);
- }
- gluTessEndContour(ZnTesselator.tess);
+ gluTessBeginContour(ZnTesselator.tess);
+ for (k = 0; k < poly->contours[j].num_points; k++) {
+ v[0] = poly->contours[j].points[k].x;
+ v[1] = poly->contours[j].points[k].y;
+ v[2] = 0;
+ gluTessVertex(ZnTesselator.tess, v, &poly->contours[j].points[k]);
+ }
+ gluTessEndContour(ZnTesselator.tess);
}
}
else {
for (j = 0; j < poly->num_contours; j++){
- gluTessBeginContour(ZnTesselator.tess);
- for (i = (int) (poly->contours[j].num_points-1); i >= 0; i--) {
- v[0] = poly->contours[j].points[i].x;
- v[1] = poly->contours[j].points[i].y;
- v[2] = 0;
- gluTessVertex(ZnTesselator.tess, v, &poly->contours[j].points[i]);
- }
- gluTessEndContour(ZnTesselator.tess);
+ gluTessBeginContour(ZnTesselator.tess);
+ for (i = (int) (poly->contours[j].num_points-1); i >= 0; i--) {
+ v[0] = poly->contours[j].points[i].x;
+ v[1] = poly->contours[j].points[i].y;
+ v[2] = 0;
+ gluTessVertex(ZnTesselator.tess, v, &poly->contours[j].points[i]);
+ }
+ gluTessEndContour(ZnTesselator.tess);
}
}
gluTessEndPolygon(ZnTesselator.tess);
cdata = ZnTesselator.combine_list;
while (cdata) {
- ZnTesselator.combine_length--;
+ ZnTesselator.combine_length--;
cnext = cdata->next;
ZnFree(cdata);
cdata = cnext;
@@ -630,20 +630,20 @@ UpdateOutlines(CurveItem cv,
**********************************************************************************
*/
static void
-ComputeCoordinates(ZnItem item,
- ZnBool force)
+ComputeCoordinates(ZnItem item,
+ ZnBool force)
{
- ZnWInfo *wi = item->wi;
- CurveItem cv = (CurveItem) item;
- unsigned int i, j;
- ZnPoint end_points[ZN_LINE_END_POINTS];
- ZnPoint *points;
- unsigned int num_points, num_contours, segment_start;
- ZnBBox bbox;
- ZnDim lw;
- ZnContour *c1, *c2;
- ZnPoly dev;
- ZnBool revert;
+ ZnWInfo *wi = item->wi;
+ CurveItem cv = (CurveItem) item;
+ unsigned int i, j;
+ ZnPoint end_points[ZN_LINE_END_POINTS];
+ ZnPoint *points;
+ unsigned int num_points, num_contours, segment_start;
+ ZnBBox bbox;
+ ZnDim lw;
+ ZnContour *c1, *c2;
+ ZnPoly dev;
+ ZnBool revert;
ZnResetBBox(&item->item_bounding_box);
@@ -683,11 +683,11 @@ ComputeCoordinates(ZnItem item,
* closed by the tesselator.
*/
if ((num_contours == 1) &&
- (c1->num_points > 2) &&
- ISSET(cv->flags, CLOSED_BIT) &&
- ((c1->points[0].x != c1->points[c1->num_points-1].x) ||
- (c1->points[0].y != c1->points[c1->num_points-1].y)) &&
- (c1->num_points > 2)) {
+ (c1->num_points > 2) &&
+ ISSET(cv->flags, CLOSED_BIT) &&
+ ((c1->points[0].x != c1->points[c1->num_points-1].x) ||
+ (c1->points[0].y != c1->points[c1->num_points-1].y)) &&
+ (c1->num_points > 2)) {
c2->num_points++;
}
c2->points = ZnMalloc((c2->num_points)*sizeof(ZnPoint));
@@ -705,23 +705,23 @@ ComputeCoordinates(ZnItem item,
ZnListAdd(ZnWorkPoints, &c2->points[0], ZnListTail);
/*printf("moveto %g@%g\n", c2->points[0].x, c2->points[0].y);*/
for (j = 1; j < c1->num_points; j++) {
- if (!c1->controls[j]) {
- if (segment_start != j-1) {
- /* traitement bezier */
- /*printf("arcto %g@%g %g@%g %g@%g\n",
- c2->points[segment_start+1].x, c2->points[segment_start+1].y,
- c2->points[j-1].x, c2->points[j-1].y,
- c2->points[j].x, c2->points[j].y);*/
- ZnGetBezierPoints(&c2->points[segment_start],
- &c2->points[segment_start+1], &c2->points[j-1],
- &c2->points[j], ZnWorkPoints, 0.5);
- }
- else {
- /*printf("lineto %g@%g\n", c2->points[j].x, c2->points[j].y);*/
- ZnListAdd(ZnWorkPoints, &c2->points[j], ZnListTail);
- }
- segment_start = j;
- }
+ if (!c1->controls[j]) {
+ if (segment_start != j-1) {
+ /* traitement bezier */
+ /*printf("arcto %g@%g %g@%g %g@%g\n",
+ c2->points[segment_start+1].x, c2->points[segment_start+1].y,
+ c2->points[j-1].x, c2->points[j-1].y,
+ c2->points[j].x, c2->points[j].y);*/
+ ZnGetBezierPoints(&c2->points[segment_start],
+ &c2->points[segment_start+1], &c2->points[j-1],
+ &c2->points[j], ZnWorkPoints, 0.5);
+ }
+ else {
+ /*printf("lineto %g@%g\n", c2->points[j].x, c2->points[j].y);*/
+ ZnListAdd(ZnWorkPoints, &c2->points[j], ZnListTail);
+ }
+ segment_start = j;
+ }
}
/*
* Must test if the last point is a control and the contour
@@ -729,9 +729,9 @@ ComputeCoordinates(ZnItem item,
* multiple contours).
*/
if (c1->controls[c1->num_points-1]) {
- ZnGetBezierPoints(&c2->points[segment_start],
- &c2->points[segment_start+1], &c2->points[c1->num_points-1],
- &c2->points[0], ZnWorkPoints, 0.5);
+ ZnGetBezierPoints(&c2->points[segment_start],
+ &c2->points[segment_start+1], &c2->points[c1->num_points-1],
+ &c2->points[0], ZnWorkPoints, 0.5);
}
/*
@@ -740,12 +740,12 @@ ComputeCoordinates(ZnItem item,
*/
num_points =ZnListSize(ZnWorkPoints);
if (c2->num_points != c1->num_points) {
- num_points++;
+ num_points++;
}
c2->points = ZnRealloc(c2->points, num_points*sizeof(ZnPoint));
memcpy(c2->points, ZnListArray(ZnWorkPoints), num_points*sizeof(ZnPoint));
if (c2->num_points != c1->num_points) {
- c2->points[num_points-1] = c2->points[0];
+ c2->points[num_points-1] = c2->points[0];
}
c2->num_points = num_points;
}
@@ -760,29 +760,29 @@ ComputeCoordinates(ZnItem item,
if (cv->shape.contours[0].num_points > 2) {
UpdateTristrip(cv, &dev, revert);
/*if (!cv->tristrip.num_strips) {
- int kk;
- ZnPrintTransfo(wi->current_transfo);
- printf("id: %d, NumCont: %d, NumPoints: %d, Original: %d, Resultat: %d, NumTri: %d\n",
- item->id, num_contours,cv->shape.contours[0].num_points,
- cv->shape.contours[0].cw, cw_dev_contour1, cv->tristrip.num_strips);
- for (kk = 0; kk < cv->shape.contours[0].num_points; kk++) {
- printf("%g@%g ", cv->shape.contours[0].points[kk].x,
- cv->shape.contours[0].points[kk].y);
- }
- printf("\n");
- }*/
+ int kk;
+ ZnPrintTransfo(wi->current_transfo);
+ printf("id: %d, NumCont: %d, NumPoints: %d, Original: %d, Resultat: %d, NumTri: %d\n",
+ item->id, num_contours,cv->shape.contours[0].num_points,
+ cv->shape.contours[0].cw, cw_dev_contour1, cv->tristrip.num_strips);
+ for (kk = 0; kk < cv->shape.contours[0].num_points; kk++) {
+ printf("%g@%g ", cv->shape.contours[0].points[kk].x,
+ cv->shape.contours[0].points[kk].y);
+ }
+ printf("\n");
+ }*/
}
ZnPolyContour1(&cv->outlines, dev.contours[0].points, dev.contours[0].num_points,
- cv->shape.contours[0].cw);
+ cv->shape.contours[0].cw);
}
else {
UpdateTristrip(cv, &dev, revert);
/*if (!cv->tristrip.num_strips) {
ZnPrintTransfo(wi->current_transfo);
printf("id: %d, NumCont: %d, NumPoints: %d, Original: %d, Resultat: %d, NumTri: %d\n",
- item->id, num_contours,cv->shape.contours[0].num_points,
- cv->shape.contours[0].cw, cw_dev_contour1, cv->tristrip.num_strips);
- }*/
+ item->id, num_contours,cv->shape.contours[0].num_points,
+ cv->shape.contours[0].cw, cw_dev_contour1, cv->tristrip.num_strips);
+ }*/
UpdateOutlines(cv, &dev, revert);
ZnPolyFree(&dev);
}
@@ -821,34 +821,34 @@ ComputeCoordinates(ZnItem item,
c2 = cv->outlines.contours;
for (j = 0; j < num_contours; j++, c2++) {
if (c2->cw) {
- continue;
+ continue;
}
if (cv->join_style == JoinMiter) {
- ZnPoint miter_i, miter_o;
- for (i = c2->num_points-1, points = c2->points; i >= 3; i--, points++) {
- ZnGetMiterPoints(points, points+1, points+2, lw, &miter_i, &miter_o);
- ZnAddPointToBBox(&item->item_bounding_box, miter_i.x, miter_i.y);
- ZnAddPointToBBox(&item->item_bounding_box, miter_o.x, miter_o.y);
- }
+ ZnPoint miter_i, miter_o;
+ for (i = c2->num_points-1, points = c2->points; i >= 3; i--, points++) {
+ ZnGetMiterPoints(points, points+1, points+2, lw, &miter_i, &miter_o);
+ ZnAddPointToBBox(&item->item_bounding_box, miter_i.x, miter_i.y);
+ ZnAddPointToBBox(&item->item_bounding_box, miter_o.x, miter_o.y);
+ }
}
/*
* Add the markers.
*/
if (ISSET(cv->flags, MARKER_OK)) {
- int w, h;
- ZnBBox bbox;
-
- ZnSizeOfImage(cv->marker, &w, &h);
- w = w/2 + 2;
- h = h/2 + 2;
- num_points = c2->num_points;
- for (i = 0, points = c2->points; i < num_points; i++, points++) {
- bbox.orig.x = points->x - w;
- bbox.orig.y = points->y - h;
- bbox.corner.x = points->x + w;
- bbox.corner.y = points->y + h;
- ZnAddBBoxToBBox(&item->item_bounding_box, &bbox);
- }
+ int w, h;
+ ZnBBox bbox;
+
+ ZnSizeOfImage(cv->marker, &w, &h);
+ w = w/2 + 2;
+ h = h/2 + 2;
+ num_points = c2->num_points;
+ for (i = 0, points = c2->points; i < num_points; i++, points++) {
+ bbox.orig.x = points->x - w;
+ bbox.orig.y = points->y - h;
+ bbox.corner.x = points->x + w;
+ bbox.corner.y = points->y + h;
+ ZnAddBBoxToBBox(&item->item_bounding_box, &bbox);
+ }
}
/*
* Process arrows.
@@ -856,14 +856,14 @@ ComputeCoordinates(ZnItem item,
num_points = c2->num_points;
points = c2->points;
if (ISSET(cv->flags, FIRST_END_OK)) {
- ZnGetLineEnd(&points[0], &points[1], lw, cv->cap_style,
- cv->first_end, end_points);
- ZnAddPointsToBBox(&item->item_bounding_box, end_points, ZN_LINE_END_POINTS);
+ ZnGetLineEnd(&points[0], &points[1], lw, cv->cap_style,
+ cv->first_end, end_points);
+ ZnAddPointsToBBox(&item->item_bounding_box, end_points, ZN_LINE_END_POINTS);
}
if (ISSET(cv->flags, LAST_END_OK)) {
- ZnGetLineEnd(&points[num_points-1], &points[num_points-2],
- lw, cv->cap_style, cv->last_end, end_points);
- ZnAddPointsToBBox(&item->item_bounding_box, end_points, ZN_LINE_END_POINTS);
+ ZnGetLineEnd(&points[num_points-1], &points[num_points-2],
+ lw, cv->cap_style, cv->last_end, end_points);
+ ZnAddPointsToBBox(&item->item_bounding_box, end_points, ZN_LINE_END_POINTS);
}
}
@@ -899,23 +899,23 @@ ComputeCoordinates(ZnItem item,
**********************************************************************************
*
* ToArea --
- * Tell if the object is entirely outside (-1),
- * entirely inside (1) or in between (0).
+ * Tell if the object is entirely outside (-1),
+ * entirely inside (1) or in between (0).
*
**********************************************************************************
*/
static int
-ToArea(ZnItem item,
- ZnToArea ta)
+ToArea(ZnItem item,
+ ZnToArea ta)
{
- CurveItem cv = (CurveItem) item;
- ZnBBox bbox, *area = ta->area;
- ZnPoint *points;
- ZnPoint triangle[3];
- ZnPoint end_points[ZN_LINE_END_POINTS];
- unsigned int i, j, num_points, stop;
- int width, height, result=-1, result2;
- ZnBool first_done = False;
+ CurveItem cv = (CurveItem) item;
+ ZnBBox bbox, *area = ta->area;
+ ZnPoint *points;
+ ZnPoint triangle[3];
+ ZnPoint end_points[ZN_LINE_END_POINTS];
+ unsigned int i, j, num_points, stop;
+ int width, height, result=-1, result2;
+ ZnBool first_done = False;
if (cv->outlines.num_contours == 0) {
return -1;
@@ -930,31 +930,31 @@ ToArea(ZnItem item,
j = 0;
stop = num_points-2;
if (cv->tristrip.strips[i].fan) {
- triangle[0] = points[0];
- j++;
- points++;
- stop++;
+ triangle[0] = points[0];
+ j++;
+ points++;
+ stop++;
}
for (; j < stop; j++, points++) {
- if (cv->tristrip.strips[i].fan) {
- triangle[1] = points[0];
- triangle[2] = points[1];
- }
- else {
- triangle[0] = points[0];
- triangle[1] = points[1];
- triangle[2] = points[2];
- }
- if (!first_done) {
- first_done = True;
- result = ZnPolygonInBBox(triangle, 3, area, NULL);
- }
- else {
- result2 = ZnPolygonInBBox(triangle, 3, area, NULL);
- if (result2 != result) {
- return 0;
- }
- }
+ if (cv->tristrip.strips[i].fan) {
+ triangle[1] = points[0];
+ triangle[2] = points[1];
+ }
+ else {
+ triangle[0] = points[0];
+ triangle[1] = points[1];
+ triangle[2] = points[2];
+ }
+ if (!first_done) {
+ first_done = True;
+ result = ZnPolygonInBBox(triangle, 3, area, NULL);
+ }
+ else {
+ result2 = ZnPolygonInBBox(triangle, 3, area, NULL);
+ if (result2 != result) {
+ return 0;
+ }
+ }
}
}
}
@@ -965,29 +965,29 @@ ToArea(ZnItem item,
num_points = cv->outlines.contours[i].num_points;
points = cv->outlines.contours[i].points;
if (!first_done) {
- first_done = True;
- if (ISCLEAR(cv->flags, RELIEF_OK)) {
- result = ZnPolylineInBBox(points, num_points,
- cv->line_width, cv->cap_style, cv->join_style, area);
- }
- else {
- result = ZnPolygonReliefInBBox(points, num_points, cv->line_width, area);
- }
- if (result == 0) {
- return 0;
- }
+ first_done = True;
+ if (ISCLEAR(cv->flags, RELIEF_OK)) {
+ result = ZnPolylineInBBox(points, num_points,
+ cv->line_width, cv->cap_style, cv->join_style, area);
+ }
+ else {
+ result = ZnPolygonReliefInBBox(points, num_points, cv->line_width, area);
+ }
+ if (result == 0) {
+ return 0;
+ }
}
else {
- if (ISCLEAR(cv->flags, RELIEF_OK)) {
- result2 = ZnPolylineInBBox(points, num_points,
- cv->line_width, cv->cap_style, cv->join_style, area);
- }
- else {
- result2 = ZnPolygonReliefInBBox(points, num_points, cv->line_width, area);
- }
- if (result2 != result) {
- return 0;
- }
+ if (ISCLEAR(cv->flags, RELIEF_OK)) {
+ result2 = ZnPolylineInBBox(points, num_points,
+ cv->line_width, cv->cap_style, cv->join_style, area);
+ }
+ else {
+ result2 = ZnPolygonReliefInBBox(points, num_points, cv->line_width, area);
+ }
+ if (result2 != result) {
+ return 0;
+ }
}
}
@@ -998,16 +998,16 @@ ToArea(ZnItem item,
num_points = cv->outlines.contours[0].num_points;
if (ISSET(cv->flags, FIRST_END_OK)) {
ZnGetLineEnd(&points[0], &points[1], cv->line_width, cv->cap_style,
- cv->first_end, end_points);
+ cv->first_end, end_points);
if (ZnPolygonInBBox(end_points, ZN_LINE_END_POINTS, area, NULL) != result) {
- return 0;
+ return 0;
}
}
if (ISSET(cv->flags, LAST_END_OK)) {
ZnGetLineEnd(&points[num_points-1], &points[num_points-2], cv->line_width,
- cv->cap_style, cv->last_end, end_points);
+ cv->cap_style, cv->last_end, end_points);
if (ZnPolygonInBBox(end_points, ZN_LINE_END_POINTS, area, NULL) != result) {
- return 0;
+ return 0;
}
}
}
@@ -1021,22 +1021,22 @@ ToArea(ZnItem item,
num_points = cv->outlines.contours[i].num_points;
if (ISSET(cv->flags, FIRST_END_OK)) {
- num_points--;
- points++;
+ num_points--;
+ points++;
}
if (ISSET(cv->flags, LAST_END_OK)) {
- num_points--;
+ num_points--;
}
ZnSizeOfImage(cv->marker, &width, &height);
for (; num_points > 0; num_points--, points++) {
- bbox.orig.x = points->x - (width+1)/2;
- bbox.orig.y = points->y - (height+1)/2;
- bbox.corner.x = bbox.orig.x + width;
- bbox.corner.y = bbox.orig.y + height;
- if (ZnBBoxInBBox(&bbox, area) != result) {
- return 0;
- }
+ bbox.orig.x = points->x - (width+1)/2;
+ bbox.orig.y = points->y - (height+1)/2;
+ bbox.corner.x = bbox.orig.x + width;
+ bbox.corner.y = bbox.orig.y + height;
+ if (ZnBBoxInBBox(&bbox, area) != result) {
+ return 0;
+ }
}
}
}
@@ -1053,15 +1053,15 @@ ToArea(ZnItem item,
**********************************************************************************
*/
static void
-Draw(ZnItem item)
+Draw(ZnItem item)
{
- ZnWInfo *wi = item->wi;
- CurveItem cv = (CurveItem) item;
- XGCValues values;
- unsigned int i, j, num_points=0;
- unsigned int gc_mask;
- ZnPoint *points=NULL;
- XPoint *xpoints=NULL;
+ ZnWInfo *wi = item->wi;
+ CurveItem cv = (CurveItem) item;
+ XGCValues values;
+ unsigned int i, j, num_points=0;
+ unsigned int gc_mask;
+ ZnPoint *points=NULL;
+ XPoint *xpoints=NULL;
if ((cv->outlines.num_contours == 0) ||
(ISCLEAR(cv->flags, FILLED_OK) &&
@@ -1078,18 +1078,18 @@ Draw(ZnItem item)
gc_mask = GCFillStyle;
if (cv->tile != ZnUnspecifiedImage) {
if (!ZnImageIsBitmap(cv->tile)) { /* Fill tiled */
- values.fill_style = FillTiled;
- values.tile = ZnImagePixmap(cv->tile, wi->win);
- values.ts_x_origin = ZnNearestInt(item->item_bounding_box.orig.x);
- values.ts_y_origin = ZnNearestInt(item->item_bounding_box.orig.y);
- gc_mask |= GCTileStipXOrigin|GCTileStipYOrigin|GCTile;
+ values.fill_style = FillTiled;
+ values.tile = ZnImagePixmap(cv->tile, wi->win);
+ values.ts_x_origin = ZnNearestInt(item->item_bounding_box.orig.x);
+ values.ts_y_origin = ZnNearestInt(item->item_bounding_box.orig.y);
+ gc_mask |= GCTileStipXOrigin|GCTileStipYOrigin|GCTile;
}
else { /* Fill stippled */
- values.fill_style = FillStippled;
- values.stipple = ZnImagePixmap(cv->tile, wi->win);
- values.ts_x_origin = ZnNearestInt(item->item_bounding_box.orig.x);
- values.ts_y_origin = ZnNearestInt(item->item_bounding_box.orig.y);
- gc_mask |= GCTileStipXOrigin|GCTileStipYOrigin|GCStipple|GCForeground;
+ values.fill_style = FillStippled;
+ values.stipple = ZnImagePixmap(cv->tile, wi->win);
+ values.ts_x_origin = ZnNearestInt(item->item_bounding_box.orig.x);
+ values.ts_y_origin = ZnNearestInt(item->item_bounding_box.orig.y);
+ gc_mask |= GCTileStipXOrigin|GCTileStipYOrigin|GCStipple|GCForeground;
}
}
else { /* Fill solid */
@@ -1103,30 +1103,30 @@ Draw(ZnItem item)
num_points = cv->tristrip.strips[i].num_points;
points = cv->tristrip.strips[i].points;
if (cv->tristrip.strips[i].fan) {
- XPoint xpoints[3];
- xpoints[0].x = ZnNearestInt(points[0].x);
- xpoints[0].y = ZnNearestInt(points[0].y);
- xpoints[1].x = ZnNearestInt(points[1].x);
- xpoints[1].y = ZnNearestInt(points[1].y);
- for (j = 2; j < num_points; j++) {
- xpoints[2].x = ZnNearestInt(points[j].x);
- xpoints[2].y = ZnNearestInt(points[j].y);
- XFillPolygon(wi->dpy, wi->draw_buffer, wi->gc,
- xpoints, 3, Convex, CoordModeOrigin);
- xpoints[1] = xpoints[2];
- }
+ XPoint xpoints[3];
+ xpoints[0].x = ZnNearestInt(points[0].x);
+ xpoints[0].y = ZnNearestInt(points[0].y);
+ xpoints[1].x = ZnNearestInt(points[1].x);
+ xpoints[1].y = ZnNearestInt(points[1].y);
+ for (j = 2; j < num_points; j++) {
+ xpoints[2].x = ZnNearestInt(points[j].x);
+ xpoints[2].y = ZnNearestInt(points[j].y);
+ XFillPolygon(wi->dpy, wi->draw_buffer, wi->gc,
+ xpoints, 3, Convex, CoordModeOrigin);
+ xpoints[1] = xpoints[2];
+ }
}
else {
- ZnListAssertSize(ZnWorkXPoints, num_points);
- xpoints = ZnListArray(ZnWorkXPoints);
- for (j = 0; j < num_points; j++) {
- xpoints[j].x = ZnNearestInt(points[j].x);
- xpoints[j].y = ZnNearestInt(points[j].y);
- }
- for (j = 0; j < num_points-2; j++) {
- XFillPolygon(wi->dpy, wi->draw_buffer, wi->gc,
- &xpoints[j], 3, Convex, CoordModeOrigin);
- }
+ ZnListAssertSize(ZnWorkXPoints, num_points);
+ xpoints = ZnListArray(ZnWorkXPoints);
+ for (j = 0; j < num_points; j++) {
+ xpoints[j].x = ZnNearestInt(points[j].x);
+ xpoints[j].y = ZnNearestInt(points[j].y);
+ }
+ for (j = 0; j < num_points-2; j++) {
+ XFillPolygon(wi->dpy, wi->draw_buffer, wi->gc,
+ &xpoints[j], 3, Convex, CoordModeOrigin);
+ }
}
}
}
@@ -1135,22 +1135,22 @@ Draw(ZnItem item)
* Draw the lines between points
*/
if (cv->line_width) {
- ZnPoint end_points[ZN_LINE_END_POINTS];
- XPoint xp[ZN_LINE_END_POINTS];
+ ZnPoint end_points[ZN_LINE_END_POINTS];
+ XPoint xp[ZN_LINE_END_POINTS];
/*
* Drawing with relief disables: ends, line style and line pattern.
*/
if (ISSET(cv->flags, RELIEF_OK)) {
for (j = 0; j < cv->outlines.num_contours; j++) {
- num_points = cv->outlines.contours[j].num_points;
- points = cv->outlines.contours[j].points;
- /*printf("Draw: item %d, num_points %d %g@%g %g@%g, cw %d i/o %d\n",
- item->id,
- num_points, points[0].x, points[0].y,
- points[num_points-1].x, points[num_points-1].y,
- cv->outlines.contours[j].cw);*/
- ZnDrawPolygonRelief(wi, cv->relief, cv->gradient, points, num_points, cv->line_width);
+ num_points = cv->outlines.contours[j].num_points;
+ points = cv->outlines.contours[j].points;
+ /*printf("Draw: item %d, num_points %d %g@%g %g@%g, cw %d i/o %d\n",
+ item->id,
+ num_points, points[0].x, points[0].y,
+ points[num_points-1].x, points[num_points-1].y,
+ cv->outlines.contours[j].cw);*/
+ ZnDrawPolygonRelief(wi, cv->relief, cv->gradient, points, num_points, cv->line_width);
}
}
else {
@@ -1160,48 +1160,48 @@ Draw(ZnItem item)
values.join_style = cv->join_style;
values.cap_style = cv->cap_style;
if (cv->line_pattern == ZnUnspecifiedImage) {
- values.fill_style = FillSolid;
- XChangeGC(wi->dpy, wi->gc,
- GCFillStyle|GCLineWidth|GCJoinStyle|GCCapStyle|GCForeground, &values);
+ values.fill_style = FillSolid;
+ XChangeGC(wi->dpy, wi->gc,
+ GCFillStyle|GCLineWidth|GCJoinStyle|GCCapStyle|GCForeground, &values);
}
else {
- values.fill_style = FillStippled;
- values.stipple = ZnImagePixmap(cv->line_pattern, wi->win);
- XChangeGC(wi->dpy, wi->gc,
- GCFillStyle|GCStipple|GCLineWidth|GCJoinStyle|GCCapStyle|GCForeground,
- &values);
+ values.fill_style = FillStippled;
+ values.stipple = ZnImagePixmap(cv->line_pattern, wi->win);
+ XChangeGC(wi->dpy, wi->gc,
+ GCFillStyle|GCStipple|GCLineWidth|GCJoinStyle|GCCapStyle|GCForeground,
+ &values);
}
for (j = 0; j < cv->outlines.num_contours; j++) {
- num_points = cv->outlines.contours[j].num_points;
- points = cv->outlines.contours[j].points;
- ZnListAssertSize(ZnWorkXPoints, num_points);
- xpoints = ZnListArray(ZnWorkXPoints);
- for (i = 0; i < num_points; i++) {
- xpoints[i].x = ZnNearestInt(points[i].x);
- xpoints[i].y = ZnNearestInt(points[i].y);
- }
- XDrawLines(wi->dpy, wi->draw_buffer, wi->gc,
- xpoints, (int) num_points, CoordModeOrigin);
+ num_points = cv->outlines.contours[j].num_points;
+ points = cv->outlines.contours[j].points;
+ ZnListAssertSize(ZnWorkXPoints, num_points);
+ xpoints = ZnListArray(ZnWorkXPoints);
+ for (i = 0; i < num_points; i++) {
+ xpoints[i].x = ZnNearestInt(points[i].x);
+ xpoints[i].y = ZnNearestInt(points[i].y);
+ }
+ XDrawLines(wi->dpy, wi->draw_buffer, wi->gc,
+ xpoints, (int) num_points, CoordModeOrigin);
}
if (ISSET(cv->flags, FIRST_END_OK)) {
- ZnGetLineEnd(&points[0], &points[1], cv->line_width, cv->cap_style,
- cv->first_end, end_points);
- for (i = 0; i < ZN_LINE_END_POINTS; i++) {
- xp[i].x = (short) end_points[i].x;
- xp[i].y = (short) end_points[i].y;
- }
- XFillPolygon(wi->dpy, wi->draw_buffer, wi->gc, xp, ZN_LINE_END_POINTS,
- Nonconvex, CoordModeOrigin);
+ ZnGetLineEnd(&points[0], &points[1], cv->line_width, cv->cap_style,
+ cv->first_end, end_points);
+ for (i = 0; i < ZN_LINE_END_POINTS; i++) {
+ xp[i].x = (short) end_points[i].x;
+ xp[i].y = (short) end_points[i].y;
+ }
+ XFillPolygon(wi->dpy, wi->draw_buffer, wi->gc, xp, ZN_LINE_END_POINTS,
+ Nonconvex, CoordModeOrigin);
}
if (ISSET(cv->flags, LAST_END_OK)) {
- ZnGetLineEnd(&points[num_points-1], &points[num_points-2], cv->line_width,
- cv->cap_style, cv->last_end, end_points);
- for (i = 0; i < ZN_LINE_END_POINTS; i++) {
- xp[i].x = (short) end_points[i].x;
- xp[i].y = (short) end_points[i].y;
- }
- XFillPolygon(wi->dpy, wi->draw_buffer, wi->gc, xp, ZN_LINE_END_POINTS,
- Nonconvex, CoordModeOrigin);
+ ZnGetLineEnd(&points[num_points-1], &points[num_points-2], cv->line_width,
+ cv->cap_style, cv->last_end, end_points);
+ for (i = 0; i < ZN_LINE_END_POINTS; i++) {
+ xp[i].x = (short) end_points[i].x;
+ xp[i].y = (short) end_points[i].y;
+ }
+ XFillPolygon(wi->dpy, wi->draw_buffer, wi->gc, xp, ZN_LINE_END_POINTS,
+ Nonconvex, CoordModeOrigin);
}
}
}
@@ -1212,7 +1212,7 @@ Draw(ZnItem item)
*/
if (ISSET(cv->flags, MARKER_OK)) {
unsigned int h_width, h_height, width, height;
- int tmp_x, tmp_y;
+ int tmp_x, tmp_y;
ZnSizeOfImage(cv->marker, &width, &height);
h_width = (width+1)/2;
@@ -1227,25 +1227,25 @@ Draw(ZnItem item)
ZnListAssertSize(ZnWorkXPoints, num_points);
xpoints = (XPoint *) ZnListArray(ZnWorkXPoints);
for (i = 0; i < num_points; i++) {
- xpoints[i].x = (short) ZnNearestInt(points[i].x);
- xpoints[i].y = (short) ZnNearestInt(points[i].y);
+ xpoints[i].x = (short) ZnNearestInt(points[i].x);
+ xpoints[i].y = (short) ZnNearestInt(points[i].y);
}
if (ISSET(cv->flags, FIRST_END_OK)) {
- num_points--;
- points++;
+ num_points--;
+ points++;
}
if (ISSET(cv->flags, LAST_END_OK)) {
- num_points--;
+ num_points--;
}
for (; num_points > 0; num_points--, points++) {
- tmp_x = ((int) points->x) - h_width;
- tmp_y = ((int) points->y) - h_height;
- values.ts_x_origin = tmp_x;
- values.ts_y_origin = tmp_y;
- XChangeGC(wi->dpy, wi->gc,
- GCTileStipXOrigin|GCTileStipYOrigin|GCForeground, &values);
- XFillRectangle(wi->dpy, wi->draw_buffer, wi->gc,
- tmp_x, tmp_y, width, height);
+ tmp_x = ((int) points->x) - h_width;
+ tmp_y = ((int) points->y) - h_height;
+ values.ts_x_origin = tmp_x;
+ values.ts_y_origin = tmp_y;
+ XChangeGC(wi->dpy, wi->gc,
+ GCTileStipXOrigin|GCTileStipYOrigin|GCForeground, &values);
+ XFillRectangle(wi->dpy, wi->draw_buffer, wi->gc,
+ tmp_x, tmp_y, width, height);
}
}
}
@@ -1261,11 +1261,11 @@ Draw(ZnItem item)
*/
#ifdef GL
static void
-CurveRenderCB(void *closure)
+CurveRenderCB(void *closure)
{
- CurveItem cv = (CurveItem) closure;
- unsigned int i, j, num_points;
- ZnPoint *points;
+ CurveItem cv = (CurveItem) closure;
+ unsigned int i, j, num_points;
+ ZnPoint *points;
for (i = 0; i < cv->tristrip.num_strips; i++) {
num_points = cv->tristrip.strips[i].num_points;
@@ -1286,12 +1286,12 @@ CurveRenderCB(void *closure)
#ifdef GL
static void
-Render(ZnItem item)
+Render(ZnItem item)
{
- ZnWInfo *wi = item->wi;
- CurveItem cv = (CurveItem) item;
- unsigned int j, num_points;
- ZnPoint *points;
+ ZnWInfo *wi = item->wi;
+ CurveItem cv = (CurveItem) item;
+ unsigned int j, num_points;
+ ZnPoint *points;
if ((cv->outlines.num_contours == 0) ||
(ISCLEAR(cv->flags, FILLED_OK) &&
@@ -1311,19 +1311,19 @@ Render(ZnItem item)
if (ISSET(cv->flags, FILLED_OK)) {
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
if (!ZnGradientFlat(cv->fill_color)) {
- ZnRenderGradient(wi, cv->fill_color, CurveRenderCB, cv, cv->grad_geo,
- &cv->outlines);
+ ZnRenderGradient(wi, cv->fill_color, CurveRenderCB, cv, cv->grad_geo,
+ &cv->outlines);
}
else if (cv->tile != ZnUnspecifiedImage) { /* Fill tiled/stippled */
- ZnRenderTile(wi, cv->tile, cv->fill_color, CurveRenderCB, cv,
- (ZnPoint *) &item->item_bounding_box);
+ ZnRenderTile(wi, cv->tile, cv->fill_color, CurveRenderCB, cv,
+ (ZnPoint *) &item->item_bounding_box);
}
else {
- unsigned short alpha;
- XColor *color = ZnGetGradientColor(cv->fill_color, 0.0, &alpha);
- alpha = ZnComposeAlpha(alpha, wi->alpha);
- glColor4us(color->red, color->green, color->blue, alpha);
- CurveRenderCB(cv);
+ unsigned short alpha;
+ XColor *color = ZnGetGradientColor(cv->fill_color, 0.0, &alpha);
+ alpha = ZnComposeAlpha(alpha, wi->alpha);
+ glColor4us(color->red, color->green, color->blue, alpha);
+ CurveRenderCB(cv);
}
}
@@ -1335,30 +1335,30 @@ Render(ZnItem item)
* Drawing with relief disables: ends, line style and line pattern.
*/
if (ISSET(cv->flags, RELIEF_OK)) {
- for (j = 0; j < cv->outlines.num_contours; j++) {
- num_points = cv->outlines.contours[j].num_points;
- points = cv->outlines.contours[j].points;
- /*printf("Render: item %d, num_points %d %g@%g %g@%g, cw %d i/o %d\n",
- item->id,
- num_points, points[0].x, points[0].y,
- points[num_points-1].x, points[num_points-1].y,
- cv->outlines.contours[j].cw);*/
- ZnRenderPolygonRelief(wi, cv->relief, cv->gradient,
- ISSET(cv->flags, SMOOTH_RELIEF_BIT),
- points, num_points, cv->line_width);
- }
+ for (j = 0; j < cv->outlines.num_contours; j++) {
+ num_points = cv->outlines.contours[j].num_points;
+ points = cv->outlines.contours[j].points;
+ /*printf("Render: item %d, num_points %d %g@%g %g@%g, cw %d i/o %d\n",
+ item->id,
+ num_points, points[0].x, points[0].y,
+ points[num_points-1].x, points[num_points-1].y,
+ cv->outlines.contours[j].cw);*/
+ ZnRenderPolygonRelief(wi, cv->relief, cv->gradient,
+ ISSET(cv->flags, SMOOTH_RELIEF_BIT),
+ points, num_points, cv->line_width);
+ }
}
else {
- ZnLineEnd first = ISSET(cv->flags, FIRST_END_OK) ? cv->first_end : NULL;
- ZnLineEnd last = ISSET(cv->flags, LAST_END_OK) ? cv->last_end : NULL;
-
- for (j = 0; j < cv->outlines.num_contours; j++) {
- ZnRenderPolyline(wi,
- cv->outlines.contours[j].points,
- cv->outlines.contours[j].num_points,
- cv->line_width, cv->line_style, cv->cap_style,
- cv->join_style, first, last, cv->line_color);
- }
+ ZnLineEnd first = ISSET(cv->flags, FIRST_END_OK) ? cv->first_end : NULL;
+ ZnLineEnd last = ISSET(cv->flags, LAST_END_OK) ? cv->last_end : NULL;
+
+ for (j = 0; j < cv->outlines.num_contours; j++) {
+ ZnRenderPolyline(wi,
+ cv->outlines.contours[j].points,
+ cv->outlines.contours[j].num_points,
+ cv->line_width, cv->line_style, cv->cap_style,
+ cv->join_style, first, last, cv->line_color);
+ }
}
}
@@ -1367,28 +1367,28 @@ Render(ZnItem item)
* if last point join first point suppress markers at end points.
*/
if (ISSET(cv->flags, MARKER_OK)) {
- int i_width, i_height;
- ZnReal r_width, r_height;
- ZnPoint ptmp;
+ int i_width, i_height;
+ ZnReal r_width, r_height;
+ ZnPoint ptmp;
ZnSizeOfImage(cv->marker, &i_width, &i_height);
r_width = (i_width+1.0)/2.0;
r_height = (i_height+1.0)/2.0;
for (j = 0; j < cv->outlines.num_contours; j++) {
- num_points = cv->outlines.contours[j].num_points;
- points = cv->outlines.contours[j].points;
- if (ISSET(cv->flags, FIRST_END_OK)) {
- num_points--;
- points++;
- }
- if (ISSET(cv->flags, LAST_END_OK)) {
- num_points--;
- }
- for (; num_points > 0; num_points--, points++) {
- ptmp.x = points->x - r_width;
- ptmp.y = points->y - r_height;
- ZnRenderIcon(wi, cv->marker, cv->marker_color, &ptmp, True);
- }
+ num_points = cv->outlines.contours[j].num_points;
+ points = cv->outlines.contours[j].points;
+ if (ISSET(cv->flags, FIRST_END_OK)) {
+ num_points--;
+ points++;
+ }
+ if (ISSET(cv->flags, LAST_END_OK)) {
+ num_points--;
+ }
+ for (; num_points > 0; num_points--, points++) {
+ ptmp.x = points->x - r_width;
+ ptmp.y = points->y - r_height;
+ ZnRenderIcon(wi, cv->marker, cv->marker_color, &ptmp, True);
+ }
}
}
#ifdef GL_LIST
@@ -1400,7 +1400,7 @@ Render(ZnItem item)
}
#else
static void
-Render(ZnItem item)
+Render(ZnItem item)
{
}
#endif
@@ -1414,11 +1414,11 @@ Render(ZnItem item)
**********************************************************************************
*/
static ZnBool
-IsSensitive(ZnItem item,
- int item_part)
+IsSensitive(ZnItem item,
+ int item_part)
{
return (ISSET(item->flags, ZN_SENSITIVE_BIT) &&
- item->parent->class->IsSensitive(item->parent, ZN_NO_PART));
+ item->parent->class->IsSensitive(item->parent, ZN_NO_PART));
}
@@ -1430,17 +1430,17 @@ IsSensitive(ZnItem item,
**********************************************************************************
*/
static double
-Pick(ZnItem item,
- ZnPick ps)
+Pick(ZnItem item,
+ ZnPick ps)
{
- CurveItem cv = (CurveItem) item;
- ZnBBox bbox;
- double dist=1.0e40, new_dist;
- ZnPoint *points, *p = ps->point;
- ZnPoint end_points[ZN_LINE_END_POINTS];
- ZnPoint triangle[3];
- unsigned int num_points, i, j, stop;
- int width, height;
+ CurveItem cv = (CurveItem) item;
+ ZnBBox bbox;
+ double dist=1.0e40, new_dist;
+ ZnPoint *points, *p = ps->point;
+ ZnPoint end_points[ZN_LINE_END_POINTS];
+ ZnPoint triangle[3];
+ unsigned int num_points, i, j, stop;
+ int width, height;
if (cv->outlines.num_contours == 0) {
return dist;
@@ -1454,28 +1454,28 @@ Pick(ZnItem item,
j = 0;
stop = num_points-2;
if (cv->tristrip.strips[i].fan) {
- triangle[0] = points[0];
- j++;
- points++;
- stop++;
+ triangle[0] = points[0];
+ j++;
+ points++;
+ stop++;
}
for (; j < stop; j++, points++) {
- if (cv->tristrip.strips[i].fan) {
- triangle[1] = points[0];
- triangle[2] = points[1];
- }
- else {
- triangle[0] = points[0];
- triangle[1] = points[1];
- triangle[2] = points[2];
- }
- new_dist = ZnPolygonToPointDist(triangle, 3, p);
- if (new_dist < dist) {
- dist = new_dist;
- }
- if (dist <= 0.0) {
- return 0.0;
- }
+ if (cv->tristrip.strips[i].fan) {
+ triangle[1] = points[0];
+ triangle[2] = points[1];
+ }
+ else {
+ triangle[0] = points[0];
+ triangle[1] = points[1];
+ triangle[2] = points[2];
+ }
+ new_dist = ZnPolygonToPointDist(triangle, 3, p);
+ if (new_dist < dist) {
+ dist = new_dist;
+ }
+ if (dist <= 0.0) {
+ return 0.0;
+ }
}
}
}
@@ -1488,25 +1488,25 @@ Pick(ZnItem item,
points = cv->outlines.contours[i].points;
num_points = cv->outlines.contours[i].num_points;
if (ISCLEAR(cv->flags, RELIEF_OK)) {
- new_dist = ZnPolylineToPointDist(points, num_points,
- cv->line_width, cv->cap_style, cv->join_style, p);
- if (new_dist < dist) {
- dist = new_dist;
- }
- if (dist <= 0.0) {
- /*printf("dist %g\n", dist);*/
- return 0.0;
- }
+ new_dist = ZnPolylineToPointDist(points, num_points,
+ cv->line_width, cv->cap_style, cv->join_style, p);
+ if (new_dist < dist) {
+ dist = new_dist;
+ }
+ if (dist <= 0.0) {
+ /*printf("dist %g\n", dist);*/
+ return 0.0;
+ }
}
else {
- new_dist = ZnPolygonReliefToPointDist(points, num_points, cv->line_width, p);
- if (new_dist < dist) {
- dist = new_dist;
- }
- if (dist <= 0.0) {
- /*printf("dist %g\n", dist);*/
- return 0.0;
- }
+ new_dist = ZnPolygonReliefToPointDist(points, num_points, cv->line_width, p);
+ if (new_dist < dist) {
+ dist = new_dist;
+ }
+ if (dist <= 0.0) {
+ /*printf("dist %g\n", dist);*/
+ return 0.0;
+ }
}
}
}
@@ -1521,7 +1521,7 @@ Pick(ZnItem item,
*/
if (ISSET(cv->flags, FIRST_END_OK)) {
ZnGetLineEnd(&points[0], &points[1], cv->line_width, cv->cap_style,
- cv->first_end, end_points);
+ cv->first_end, end_points);
new_dist = ZnPolygonToPointDist(end_points, ZN_LINE_END_POINTS, p);
if (new_dist < dist) {
dist = new_dist;
@@ -1533,7 +1533,7 @@ Pick(ZnItem item,
}
if (ISSET(cv->flags, LAST_END_OK)) {
ZnGetLineEnd(&points[num_points-1], &points[num_points-2], cv->line_width,
- cv->cap_style, cv->last_end, end_points);
+ cv->cap_style, cv->last_end, end_points);
new_dist = ZnPolygonToPointDist(end_points, ZN_LINE_END_POINTS, p);
if (new_dist < dist) {
dist = new_dist;
@@ -1553,27 +1553,27 @@ Pick(ZnItem item,
num_points = cv->outlines.contours[i].num_points;
if (ISSET(cv->flags, FIRST_END_OK)) {
- num_points--;
- points++;
+ num_points--;
+ points++;
}
if (ISSET(cv->flags, LAST_END_OK)) {
- num_points--;
+ num_points--;
}
ZnSizeOfImage(cv->marker, &width, &height);
for (; num_points > 0; num_points--, points++) {
- bbox.orig.x = points->x - (width+1)/2;
- bbox.orig.y = points->y - (height+1)/2;
- bbox.corner.x = bbox.orig.x + width;
- bbox.corner.y = bbox.orig.y + height;
- new_dist = ZnRectangleToPointDist(&bbox, p);
- if (new_dist < dist) {
- dist = new_dist;
- }
- if (dist <= 0.0) {
- /*printf("dist %g\n", dist);*/
- return 0.0;
- }
+ bbox.orig.x = points->x - (width+1)/2;
+ bbox.orig.y = points->y - (height+1)/2;
+ bbox.corner.x = bbox.orig.x + width;
+ bbox.corner.y = bbox.orig.y + height;
+ new_dist = ZnRectangleToPointDist(&bbox, p);
+ if (new_dist < dist) {
+ dist = new_dist;
+ }
+ if (dist <= 0.0) {
+ /*printf("dist %g\n", dist);*/
+ return 0.0;
+ }
}
}
}
@@ -1591,8 +1591,8 @@ Pick(ZnItem item,
**********************************************************************************
*/
static void
-PostScript(ZnItem item,
- ZnBool prepass)
+PostScript(ZnItem item,
+ ZnBool prepass)
{
}
@@ -1601,24 +1601,24 @@ PostScript(ZnItem item,
**********************************************************************************
*
* GetClipVertices --
- * Get the clipping shape.
- * Never ever call ZnTriFree on the tristrip returned by GetClipVertices.
+ * Get the clipping shape.
+ * Never ever call ZnTriFree on the tristrip returned by GetClipVertices.
*
**********************************************************************************
*/
static ZnBool
-GetClipVertices(ZnItem item,
- ZnTriStrip *tristrip)
+GetClipVertices(ZnItem item,
+ ZnTriStrip *tristrip)
{
- CurveItem cv = (CurveItem) item;
+ CurveItem cv = (CurveItem) item;
tristrip->num_strips = 0;
if (cv->tristrip.num_strips == 1) {
ZnTriStrip1(tristrip,
- cv->tristrip.strips[0].points,
- cv->tristrip.strips[0].num_points,
- cv->tristrip.strips[0].fan);
+ cv->tristrip.strips[0].points,
+ cv->tristrip.strips[0].num_points,
+ cv->tristrip.strips[0].fan);
}
else if (cv->tristrip.num_strips > 1) {
tristrip->num_strips = cv->tristrip.num_strips;
@@ -1633,21 +1633,21 @@ GetClipVertices(ZnItem item,
**********************************************************************************
*
* GetContours --
- * Get the external contour(s).
- * Never ever call ZnPolyFree on the poly returned by GetContours.
+ * Get the external contour(s).
+ * Never ever call ZnPolyFree on the poly returned by GetContours.
*
**********************************************************************************
*/
static ZnBool
-GetContours(ZnItem item,
- ZnPoly *poly)
+GetContours(ZnItem item,
+ ZnPoly *poly)
{
- CurveItem cv = (CurveItem) item;
+ CurveItem cv = (CurveItem) item;
if (cv->outlines.num_contours == 1) {
ZnPolyContour1(poly, cv->outlines.contours[0].points,
- cv->outlines.contours[0].num_points,
- cv->outlines.contours[0].cw);
+ cv->outlines.contours[0].num_points,
+ cv->outlines.contours[0].cw);
}
else if (cv->outlines.num_contours > 1) {
poly->num_contours = cv->outlines.num_contours;
@@ -1662,23 +1662,23 @@ GetContours(ZnItem item,
**********************************************************************************
*
* Coords --
- * Return or edit the item vertices.
+ * Return or edit the item vertices.
*
**********************************************************************************
*/
static int
-Coords(ZnItem item,
- int contour,
- int index,
- int cmd,
- ZnPoint **pts,
- char **controls,
- unsigned int *num_pts)
+Coords(ZnItem item,
+ int contour,
+ int index,
+ int cmd,
+ ZnPoint **pts,
+ char **controls,
+ unsigned int *num_pts)
{
- CurveItem cv = (CurveItem) item;
- unsigned int j, num_controls;
- int i;
- ZnContour *c=NULL;
+ CurveItem cv = (CurveItem) item;
+ unsigned int j, num_controls;
+ int i;
+ ZnContour *c=NULL;
/*printf("contour %d, num_pts %d, index %d, cmd %d\n",
contour, *num_pts, index, cmd);*/
@@ -1697,7 +1697,7 @@ Coords(ZnItem item,
}
if ((contour < 0) || ((unsigned int) contour >= cv->shape.num_contours)) {
Tcl_AppendResult(item->wi->interp,
- " curve contour index out of range", NULL);
+ " curve contour index out of range", NULL);
return TCL_ERROR;
}
if (cv->shape.num_contours != 0) {
@@ -1713,79 +1713,79 @@ Coords(ZnItem item,
* is also legal, resulting in the contour being removed.
*/
if (*num_pts) {
- if (c->points) {
- ZnFree(c->points);
- }
- c->points = ZnMalloc(*num_pts*sizeof(ZnPoint));
- c->num_points = *num_pts;
- memcpy(c->points, *pts, *num_pts*sizeof(ZnPoint));
- if (c->controls) {
- ZnFree(c->controls);
- c->controls = NULL;
- }
- if (*controls) {
- c->controls = ZnMalloc(*num_pts*sizeof(char));
- memcpy(c->controls, *controls, *num_pts*sizeof(char));
- }
+ if (c->points) {
+ ZnFree(c->points);
+ }
+ c->points = ZnMalloc(*num_pts*sizeof(ZnPoint));
+ c->num_points = *num_pts;
+ memcpy(c->points, *pts, *num_pts*sizeof(ZnPoint));
+ if (c->controls) {
+ ZnFree(c->controls);
+ c->controls = NULL;
+ }
+ if (*controls) {
+ c->controls = ZnMalloc(*num_pts*sizeof(char));
+ memcpy(c->controls, *controls, *num_pts*sizeof(char));
+ }
}
}
else {
if (*num_pts == 0) {
- Tcl_AppendResult(item->wi->interp,
- " coords replace command need at least 1 point on curves", NULL);
- return TCL_ERROR;
+ Tcl_AppendResult(item->wi->interp,
+ " coords replace command need at least 1 point on curves", NULL);
+ return TCL_ERROR;
}
if (index < 0) {
- index += c->num_points;
+ index += c->num_points;
}
if ((index < 0) || ((unsigned int) index >= c->num_points)) {
range_err:
- Tcl_AppendResult(item->wi->interp, " coord index out of range", NULL);
- return TCL_ERROR;
+ Tcl_AppendResult(item->wi->interp, " coord index out of range", NULL);
+ return TCL_ERROR;
}
/*printf("--->%g@%g\n", (*pts)[0].x, (*pts)[0].y);*/
c->points[index] = (*pts)[0];
if (!c->controls && *controls && (*controls)[0]) {
- c->controls = ZnMalloc(c->num_points*sizeof(char));
- memset(c->controls, 0, c->num_points*sizeof(char));
+ c->controls = ZnMalloc(c->num_points*sizeof(char));
+ memset(c->controls, 0, c->num_points*sizeof(char));
}
if (c->controls) {
- if (!*controls) {
- c->controls[index] = 0;
- }
- else {
- if ((*controls)[0]) {
- /* Check if the edit is allowable, there should be
- * no more than 2 consecutive control points. The first
- * point must not be a control and the last one can
- * be one only if the curve is closed.
- */
- num_controls = 0;
- if (!index) {
- control_first:
- Tcl_AppendResult(item->wi->interp, " the first point must not be a control", NULL);
- return TCL_ERROR;
- }
- else if ((unsigned int) index == c->num_points-1) {
- if (ISCLEAR(cv->flags, CLOSED_BIT) &&
- (cv->shape.num_contours == 1)) {
- control_last:
- Tcl_AppendResult(item->wi->interp, " the last point must not be a control", NULL);
- return TCL_ERROR;
- }
- }
- else {
- for (i = index-1; c->controls[i] && (i >= 0); i--, num_controls++);
- }
- for (j = index+1; c->controls[j] && (j < c->num_points); j++, num_controls++);
- if (num_controls > 1) {
- control_err:
- Tcl_AppendResult(item->wi->interp, " too many consecutive control points in a curve", NULL);
- return TCL_ERROR;
- }
- }
- c->controls[index] = (*controls)[0];
- }
+ if (!*controls) {
+ c->controls[index] = 0;
+ }
+ else {
+ if ((*controls)[0]) {
+ /* Check if the edit is allowable, there should be
+ * no more than 2 consecutive control points. The first
+ * point must not be a control and the last one can
+ * be one only if the curve is closed.
+ */
+ num_controls = 0;
+ if (!index) {
+ control_first:
+ Tcl_AppendResult(item->wi->interp, " the first point must not be a control", NULL);
+ return TCL_ERROR;
+ }
+ else if ((unsigned int) index == c->num_points-1) {
+ if (ISCLEAR(cv->flags, CLOSED_BIT) &&
+ (cv->shape.num_contours == 1)) {
+ control_last:
+ Tcl_AppendResult(item->wi->interp, " the last point must not be a control", NULL);
+ return TCL_ERROR;
+ }
+ }
+ else {
+ for (i = index-1; c->controls[i] && (i >= 0); i--, num_controls++);
+ }
+ for (j = index+1; c->controls[j] && (j < c->num_points); j++, num_controls++);
+ if (num_controls > 1) {
+ control_err:
+ Tcl_AppendResult(item->wi->interp, " too many consecutive control points in a curve", NULL);
+ return TCL_ERROR;
+ }
+ }
+ c->controls[index] = (*controls)[0];
+ }
}
}
ZnITEM.Invalidate(item, ZN_COORDS_FLAG);
@@ -1798,25 +1798,25 @@ Coords(ZnItem item,
*num_pts = c->num_points;
*pts = c->points;
if (c->controls) {
- *controls = c->controls;
+ *controls = c->controls;
}
}
else {
/* Special case for an empty contour. */
if (c->num_points == 0) {
- *num_pts = 0;
- return TCL_OK;
+ *num_pts = 0;
+ return TCL_OK;
}
if (index < 0) {
- index += c->num_points;
+ index += c->num_points;
}
if ((index < 0) || ((unsigned int) index >= c->num_points)) {
- goto range_err;
+ goto range_err;
}
*num_pts = 1;
*pts = &c->points[index];
if (c->controls) {
- *controls = &c->controls[index];
+ *controls = &c->controls[index];
}
}
}
@@ -1843,50 +1843,50 @@ Coords(ZnItem item,
* be one only if the curve is closed.
*/
if ((index == 0) && (*controls)[0]) {
- goto control_first;
+ goto control_first;
}
else if (((unsigned int) index == (c->num_points-1)) &&
- (*controls)[*num_pts-1] &&
- ISCLEAR(cv->flags, CLOSED_BIT) &&
- (cv->shape.num_contours == 1)) {
- goto control_last;
+ (*controls)[*num_pts-1] &&
+ ISCLEAR(cv->flags, CLOSED_BIT) &&
+ (cv->shape.num_contours == 1)) {
+ goto control_last;
}
num_controls = 0;
if (c->controls) {
- if (index) {
- for (i = index-1; c->controls[i] && (i >= 0); i--, num_controls++);
- }
+ if (index) {
+ for (i = index-1; c->controls[i] && (i >= 0); i--, num_controls++);
+ }
}
/*printf("******* num controls: %d\n", num_controls);*/
for (j = 0; j < *num_pts; j++) {
- if (!(*controls)[j]) {
- num_controls = 0;
- }
- else {
- num_controls++;
- if (num_controls > 2) {
- goto control_err;
- }
- }
+ if (!(*controls)[j]) {
+ num_controls = 0;
+ }
+ else {
+ num_controls++;
+ if (num_controls > 2) {
+ goto control_err;
+ }
+ }
}
/*printf("******* num controls(2): %d\n", num_controls);*/
if (c->controls) {
- for (j = index; c->controls[j] && (j < c->num_points); j++, num_controls++);
+ for (j = index; c->controls[j] && (j < c->num_points); j++, num_controls++);
}
/*printf("******* num controls(3): %d\n", num_controls);*/
if (num_controls > 2) {
- goto control_err;
+ goto control_err;
}
}
c->points = ZnRealloc(c->points, (c->num_points+*num_pts)*sizeof(ZnPoint));
if (*controls || c->controls) {
if (c->controls) {
- c->controls = ZnRealloc(c->controls, (c->num_points+*num_pts)*sizeof(char));
+ c->controls = ZnRealloc(c->controls, (c->num_points+*num_pts)*sizeof(char));
}
else {
- c->controls = ZnMalloc((c->num_points+*num_pts)*sizeof(char));
- memset(c->controls, 0, (c->num_points+*num_pts)*sizeof(char));
+ c->controls = ZnMalloc((c->num_points+*num_pts)*sizeof(char));
+ memset(c->controls, 0, (c->num_points+*num_pts)*sizeof(char));
}
}
/*
@@ -1895,13 +1895,13 @@ Coords(ZnItem item,
for (i = c->num_points-1; i >= index; i--) {
c->points[i+*num_pts] = c->points[i];
if (c->controls) {
- c->controls[i+*num_pts] = c->controls[i];
+ c->controls[i+*num_pts] = c->controls[i];
}
}
for (j = 0; j < *num_pts; j++, index++) {
c->points[index] = (*pts)[j];
if (c->controls) {
- c->controls[index] = (*controls)?(*controls)[j]:0;
+ c->controls[index] = (*controls)?(*controls)[j]:0;
}
}
c->num_points += *num_pts;
@@ -1925,17 +1925,17 @@ Coords(ZnItem item,
for (num_controls = 0, i = index-1; !c->controls[i]; i--, num_controls++);
for (i = index+1; !c->controls[i]; i++, num_controls++);
if (num_controls > 2) {
- goto control_err;
+ goto control_err;
}
}
c->num_points--;
if ((c->num_points != 0) && ((unsigned int) index != c->num_points)) {
for (j = index; j < c->num_points; j++) {
- c->points[j] = c->points[j+1];
- if (c->controls) {
- c->controls[j] = c->controls[j+1];
- }
+ c->points[j] = c->points[j+1];
+ if (c->controls) {
+ c->controls[j] = c->controls[j+1];
+ }
}
}
c->points = ZnRealloc(c->points, (c->num_points)*sizeof(ZnPoint));
@@ -1953,19 +1953,19 @@ Coords(ZnItem item,
**********************************************************************************
*
* Contour --
- * Perform geometric operations on curve contours.
+ * Perform geometric operations on curve contours.
*
**********************************************************************************
*/
static int
-Contour(ZnItem item,
- int cmd,
- int index,
- ZnPoly *poly)
+Contour(ZnItem item,
+ int cmd,
+ int index,
+ ZnPoly *poly)
{
- CurveItem cv = (CurveItem) item;
- unsigned int j, num_contours;
- int i;
+ CurveItem cv = (CurveItem) item;
+ unsigned int j, num_contours;
+ int i;
switch (cmd) {
case ZN_CONTOUR_ADD:
@@ -2005,11 +2005,11 @@ Contour(ZnItem item,
cv->shape.contours[index].points = poly->contours[j].points;
cv->shape.contours[index].controls = NULL;
if (poly->contours[j].controls) {
- /*
- * The controls array in poly is shared, duplicate it
- * to keep a locally owned copy.
- */
- cv->shape.contours[index].controls = poly->contours[j].controls;
+ /*
+ * The controls array in poly is shared, duplicate it
+ * to keep a locally owned copy.
+ */
+ cv->shape.contours[index].controls = poly->contours[j].controls;
}
}
cv->shape.num_contours = num_contours;
@@ -2032,10 +2032,10 @@ Contour(ZnItem item,
else {
ZnFree(cv->shape.contours[index].points);
if (cv->shape.contours[index].controls) {
- ZnFree(cv->shape.contours[index].controls);
+ ZnFree(cv->shape.contours[index].controls);
}
for (j = index; j < cv->shape.num_contours; j++) {
- cv->shape.contours[j] = cv->shape.contours[j+1];
+ cv->shape.contours[j] = cv->shape.contours[j+1];
}
}
ZnITEM.Invalidate(item, ZN_COORDS_FLAG);
@@ -2050,24 +2050,24 @@ Contour(ZnItem item,
**********************************************************************************
*
* PickVertex --
- * Return in 'vertex' the vertex closest to p and in 'o_vertex' the
- * opposite vertex on the closest edge, if such an edge exists or -1
- * in the other case.
+ * Return in 'vertex' the vertex closest to p and in 'o_vertex' the
+ * opposite vertex on the closest edge, if such an edge exists or -1
+ * in the other case.
*
**********************************************************************************
*/
static void
-PickVertex(ZnItem item,
- ZnPoint *p,
- int *contour,
- int *vertex,
- int *o_vertex)
+PickVertex(ZnItem item,
+ ZnPoint *p,
+ int *contour,
+ int *vertex,
+ int *o_vertex)
{
- CurveItem cv = (CurveItem) item;
- unsigned int i, j, k, num_points;
- ZnPoint *points, po;
- ZnReal dist=1.0e40, new_dist, dist2;
- ZnTransfo t, inv;
+ CurveItem cv = (CurveItem) item;
+ unsigned int i, j, k, num_points;
+ ZnPoint *points, po;
+ ZnReal dist=1.0e40, new_dist, dist2;
+ ZnTransfo t, inv;
*contour = *vertex = *o_vertex = -1;
@@ -2089,28 +2089,28 @@ PickVertex(ZnItem item,
points = cv->shape.contours[i].points;
num_points = cv->shape.contours[i].num_points;
for (j = 0; j < num_points; j++) {
- new_dist = hypot(points[j].x - po.x, points[j].y - po.y);
- if (new_dist < dist) {
- dist = new_dist;
- *contour = i;
- *vertex = j;
- }
+ new_dist = hypot(points[j].x - po.x, points[j].y - po.y);
+ if (new_dist < dist) {
+ dist = new_dist;
+ *contour = i;
+ *vertex = j;
+ }
}
/*
* If the closest vertex is in the current contour update
* the opposite vertex.
*/
if (i == (unsigned int) *contour) {
- j = (*vertex+1) % num_points;
- new_dist = ZnLineToPointDist(&points[*vertex], &points[j], &po, NULL);
- k = ((unsigned int)(*vertex-1)) % num_points;
- dist2 = ZnLineToPointDist(&points[*vertex], &points[k], &po, NULL);
- if (dist2 < new_dist) {
- *o_vertex = k;
- }
- else {
- *o_vertex = j;
- }
+ j = (*vertex+1) % num_points;
+ new_dist = ZnLineToPointDist(&points[*vertex], &points[j], &po, NULL);
+ k = ((unsigned int)(*vertex-1)) % num_points;
+ dist2 = ZnLineToPointDist(&points[*vertex], &points[k], &po, NULL);
+ if (dist2 < new_dist) {
+ *o_vertex = k;
+ }
+ else {
+ *o_vertex = j;
+ }
}
}
}
@@ -2124,16 +2124,16 @@ PickVertex(ZnItem item,
**********************************************************************************
*/
static void
-GetAnchor(ZnItem item,
- Tk_Anchor anchor,
- ZnPoint *p)
+GetAnchor(ZnItem item,
+ Tk_Anchor anchor,
+ ZnPoint *p)
{
ZnBBox *bbox = &item->item_bounding_box;
ZnOrigin2Anchor(&bbox->orig,
- bbox->corner.x - bbox->orig.x,
- bbox->corner.y - bbox->orig.y,
- anchor, p);
+ bbox->corner.x - bbox->orig.x,
+ bbox->corner.y - bbox->orig.y,
+ anchor, p);
}
@@ -2148,25 +2148,25 @@ static ZnItemClassStruct CURVE_ITEM_CLASS = {
"curve",
sizeof(CurveItemStruct),
cv_attrs,
- 0, /* num_parts */
- 0, /* flags */
+ 0, /* num_parts */
+ 0, /* flags */
-1,
Init,
Clone,
Destroy,
Configure,
Query,
- NULL, /* GetFieldSet */
+ NULL, /* GetFieldSet */
GetAnchor,
GetClipVertices,
GetContours,
Coords,
- NULL, /* InsertChars */
- NULL, /* DeleteChars */
- NULL, /* Cursor */
- NULL, /* Index */
- NULL, /* Part */
- NULL, /* Selection */
+ NULL, /* InsertChars */
+ NULL, /* DeleteChars */
+ NULL, /* Cursor */
+ NULL, /* Index */
+ NULL, /* Part */
+ NULL, /* Selection */
Contour,
ComputeCoordinates,
ToArea,
@@ -2174,7 +2174,7 @@ static ZnItemClassStruct CURVE_ITEM_CLASS = {
Render,
IsSensitive,
Pick,
- PickVertex, /* PickVertex */
+ PickVertex, /* PickVertex */
PostScript
};
diff --git a/generic/Draw.c b/generic/Draw.c
index d466c3b..e94c8c1 100644
--- a/generic/Draw.c
+++ b/generic/Draw.c
@@ -1,8 +1,8 @@
/*
* Draw.c -- Implementation of common drawing routines.
*
- * Authors : Patrick Lecoanet.
- * Creation date : Sat Dec 10 12:51:30 1994
+ * Authors : Patrick Lecoanet.
+ * Creation date : Sat Dec 10 12:51:30 1994
*
* $Id$
*/
@@ -48,28 +48,28 @@
#include <stdarg.h>
-#define POLYGON_RELIEF_DRAW 0
-#define POLYGON_RELIEF_RENDER 1
-#define POLYGON_RELIEF_DIST 2
-#define POLYGON_RELIEF_BBOX 3
-#define POLYGON_RELIEF_IN_BBOX 4
+#define POLYGON_RELIEF_DRAW 0
+#define POLYGON_RELIEF_RENDER 1
+#define POLYGON_RELIEF_DIST 2
+#define POLYGON_RELIEF_BBOX 3
+#define POLYGON_RELIEF_IN_BBOX 4
-#define TOP_CONTRAST 13
-#define BOTTOM_CONTRAST 6
-#define MAX_INTENSITY 65535
+#define TOP_CONTRAST 13
+#define BOTTOM_CONTRAST 6
+#define MAX_INTENSITY 65535
-#define ARROW_SHAPE_B 10.0
-#define ARROW_SHAPE_C 5.0
-#define OPEN_ARROW_SHAPE_A 4.0
-#define CLOSED_ARROW_SHAPE_A ARROW_SHAPE_B
+#define ARROW_SHAPE_B 10.0
+#define ARROW_SHAPE_C 5.0
+#define OPEN_ARROW_SHAPE_A 4.0
+#define CLOSED_ARROW_SHAPE_A ARROW_SHAPE_B
-#define LIGHTNING_SHAPE_A_RATIO 10.0
-#define LIGHTNING_SHAPE_B_RATIO 8.0
+#define LIGHTNING_SHAPE_A_RATIO 10.0
+#define LIGHTNING_SHAPE_B_RATIO 8.0
-#define LIGHTNING_POINTS 4
-#define CORNER_POINTS 3
-#define DOUBLE_CORNER_POINTS 4
-#define STRAIGHT_POINTS 2
+#define LIGHTNING_POINTS 4
+#define CORNER_POINTS 3
+#define DOUBLE_CORNER_POINTS 4
+#define STRAIGHT_POINTS 2
/*
@@ -80,8 +80,8 @@
**********************************************************************************
*/
void
-ZnSetLineStyle(ZnWInfo *wi,
- ZnLineStyle line_style)
+ZnSetLineStyle(ZnWInfo *wi,
+ ZnLineStyle line_style)
{
if (wi->render) {
#ifdef GL
@@ -104,10 +104,10 @@ ZnSetLineStyle(ZnWInfo *wi,
#endif
}
else {
- XGCValues values;
- static const char dashed[] = { 8 };
- static const char dotted[] = { 2, 5 };
- static const char mixed[] = { 8, 5, 2, 5 };
+ XGCValues values;
+ static const char dashed[] = { 8 };
+ static const char dotted[] = { 2, 5 };
+ static const char mixed[] = { 8, 5, 2, 5 };
values.line_style = LineOnOffDash;
switch (line_style) {
@@ -133,8 +133,8 @@ ZnSetLineStyle(ZnWInfo *wi,
**********************************************************************************
*
* ZnLineShapePoints --
- * Compute the points describing the given line shape between point p1 and p2.
- * If bbox is non null, it is filled with the bounding box of the shape.
+ * Compute the points describing the given line shape between point p1 and p2.
+ * If bbox is non null, it is filled with the bounding box of the shape.
*
* For the time being this procedure handles straight lines, right and left
* lightnings, right and left corners, right and left double corners..
@@ -167,26 +167,26 @@ ZnSetLineStyle(ZnWInfo *wi,
**********************************************************************************
*/
void
-ZnLineShapePoints(ZnPoint *p1,
- ZnPoint *p2,
- ZnDim line_width,
- ZnLineShape shape,
- ZnBBox *bbox,
- ZnList to_points)
+ZnLineShapePoints(ZnPoint *p1,
+ ZnPoint *p2,
+ ZnDim line_width,
+ ZnLineShape shape,
+ ZnBBox *bbox,
+ ZnList to_points)
{
- ZnPoint *points;
- unsigned int num_points, i;
+ ZnPoint *points;
+ unsigned int num_points, i;
/*
* Compute all line points according to shape.
*/
if ((shape == ZN_LINE_LEFT_LIGHTNING) ||
(shape == ZN_LINE_RIGHT_LIGHTNING)) {
- double alpha, theta;
- double length, length2;
- double shape_a, shape_b;
- double dx, dy;
- double temp;
+ double alpha, theta;
+ double length, length2;
+ double shape_a, shape_b;
+ double dx, dy;
+ double temp;
num_points = LIGHTNING_POINTS;
ZnListAssertSize(to_points, num_points);
@@ -218,7 +218,7 @@ ZnLineShapePoints(ZnPoint *p1,
points[2].y = dy + temp;
}
else if (shape == ZN_LINE_LEFT_CORNER ||
- shape == ZN_LINE_RIGHT_CORNER) {
+ shape == ZN_LINE_RIGHT_CORNER) {
num_points = CORNER_POINTS;
ZnListAssertSize(to_points, num_points);
points = (ZnPoint *) ZnListArray(to_points);
@@ -236,8 +236,8 @@ ZnLineShapePoints(ZnPoint *p1,
}
}
else if (shape == ZN_LINE_DOUBLE_LEFT_CORNER ||
- shape == ZN_LINE_DOUBLE_RIGHT_CORNER) {
- int dx, dy;
+ shape == ZN_LINE_DOUBLE_RIGHT_CORNER) {
+ int dx, dy;
num_points = DOUBLE_CORNER_POINTS;
ZnListAssertSize(to_points, num_points);
@@ -294,26 +294,26 @@ ZnLineShapePoints(ZnPoint *p1,
**********************************************************************************
*
* ZnDrawLineShape --
- * Draw a line given the points describing its path. It is designed to work
- * with GetLineShape albeit it does fairly trivial things. In the future some
- * shapes might need cooperation between the two and the clients will be ready
- * for that.
+ * Draw a line given the points describing its path. It is designed to work
+ * with GetLineShape albeit it does fairly trivial things. In the future some
+ * shapes might need cooperation between the two and the clients will be ready
+ * for that.
*
*
**********************************************************************************
*/
void
-ZnDrawLineShape(ZnWInfo *wi,
- ZnPoint *p,
- unsigned int num_p,
- ZnLineStyle line_style,
- int foreground_pixel,
- ZnDim line_width,
- ZnLineShape shape)
+ZnDrawLineShape(ZnWInfo *wi,
+ ZnPoint *p,
+ unsigned int num_p,
+ ZnLineStyle line_style,
+ int foreground_pixel,
+ ZnDim line_width,
+ ZnLineShape shape)
{
- XPoint *xpoints;
- unsigned int i;
- XGCValues values;
+ XPoint *xpoints;
+ unsigned int i;
+ XGCValues values;
/*
* Setup GC.
@@ -325,7 +325,7 @@ ZnDrawLineShape(ZnWInfo *wi,
values.join_style = JoinRound;
values.cap_style = CapRound;
XChangeGC(wi->dpy, wi->gc,
- GCFillStyle|GCLineWidth|GCJoinStyle|GCCapStyle|GCForeground, &values);
+ GCFillStyle|GCLineWidth|GCJoinStyle|GCCapStyle|GCForeground, &values);
ZnListAssertSize(ZnWorkXPoints, num_p);
xpoints = (XPoint *) ZnListArray(ZnWorkXPoints);
for (i = 0; i < num_p; i++) {
@@ -340,9 +340,9 @@ ZnDrawLineShape(ZnWInfo *wi,
**********************************************************************************
*
* ZnGetLineEnd --
- * Compute the points describing the given line end style at point p1 for
- * the line p1,p2. Point p1 is adjusted to fit the line end.
- * If bbox is non null, it is filled with the bounding box of the end.
+ * Compute the points describing the given line end style at point p1 for
+ * the line p1,p2. Point p1 is adjusted to fit the line end.
+ * If bbox is non null, it is filled with the bounding box of the end.
*
* For the time being this procedure handles open/filled arrows.
*
@@ -365,17 +365,17 @@ ZnDrawLineShape(ZnWInfo *wi,
**********************************************************************************
*/
void
-ZnGetLineEnd(ZnPoint *p1,
- ZnPoint *p2,
- ZnDim line_width,
- int cap_style,
- ZnLineEnd end_style,
- ZnPoint *points)
+ZnGetLineEnd(ZnPoint *p1,
+ ZnPoint *p2,
+ ZnDim line_width,
+ int cap_style,
+ ZnLineEnd end_style,
+ ZnPoint *points)
{
- ZnReal dx, dy, length, temp, backup;
- ZnReal frac_height, sin_theta, cos_theta;
- ZnReal vert_x, vert_y;
- ZnReal shape_a, shape_b, shape_c;
+ ZnReal dx, dy, length, temp, backup;
+ ZnReal frac_height, sin_theta, cos_theta;
+ ZnReal vert_x, vert_y;
+ ZnReal shape_a, shape_b, shape_c;
if (end_style != NULL) {
shape_a = end_style->shape_a + 0.001;
@@ -420,15 +420,15 @@ ZnGetLineEnd(ZnPoint *p1,
}
static ZnReal
-SegmentPosInRelief(ZnReal x1,
- ZnReal y1,
- ZnReal x2,
- ZnReal y2,
- ZnReliefStyle relief,
- int light_angle)
+SegmentPosInRelief(ZnReal x1,
+ ZnReal y1,
+ ZnReal x2,
+ ZnReal y2,
+ ZnReliefStyle relief,
+ int light_angle)
{
- ZnReal angle, angle_step, origin, position;
- int num_colors, color_index;
+ ZnReal angle, angle_step, origin, position;
+ int num_colors, color_index;
num_colors = ZN_RELIEF_STEPS*2+1;
angle_step = M_PI / (num_colors-1);
@@ -443,7 +443,7 @@ SegmentPosInRelief(ZnReal x1,
}
while (angle > 2*M_PI) {
angle -= 2*M_PI;
- }
+ }
color_index = (int) (angle/angle_step);
if (color_index > num_colors-1) {
@@ -460,10 +460,10 @@ SegmentPosInRelief(ZnReal x1,
}
position = 100*color_index/num_colors;
/*printf("position %g, angle %g(%g), origin %g\n",
- position,
- RadianToDegrees(angle),
- angle,
- RadianToDegrees(origin));*/
+ position,
+ RadianToDegrees(angle),
+ angle,
+ RadianToDegrees(origin));*/
return position;
}
@@ -472,30 +472,30 @@ SegmentPosInRelief(ZnReal x1,
* ReliefPixelOfSegment --
*/
static XColor *
-ReliefColorOfSegment(ZnReal x1,
- ZnReal y1,
- ZnReal x2,
- ZnReal y2,
- ZnReliefStyle relief,
- ZnGradient *gradient,
- int light_angle)
+ReliefColorOfSegment(ZnReal x1,
+ ZnReal y1,
+ ZnReal x2,
+ ZnReal y2,
+ ZnReliefStyle relief,
+ ZnGradient *gradient,
+ int light_angle)
{
return ZnGetGradientColor(gradient,
- SegmentPosInRelief(x1, y1, x2, y2, relief, light_angle),
- NULL);
+ SegmentPosInRelief(x1, y1, x2, y2, relief, light_angle),
+ NULL);
}
static int
-ReliefPixelOfSegment(ZnReal x1,
- ZnReal y1,
- ZnReal x2,
- ZnReal y2,
- ZnReliefStyle relief,
- ZnGradient *gradient,
- int light_angle)
+ReliefPixelOfSegment(ZnReal x1,
+ ZnReal y1,
+ ZnReal x2,
+ ZnReal y2,
+ ZnReliefStyle relief,
+ ZnGradient *gradient,
+ int light_angle)
{
return ZnGetGradientPixel(gradient,
- SegmentPosInRelief(x1, y1, x2, y2, relief, light_angle));
+ SegmentPosInRelief(x1, y1, x2, y2, relief, light_angle));
}
@@ -503,18 +503,18 @@ ReliefPixelOfSegment(ZnReal x1,
**********************************************************************************
*
* ZnDrawRectangleRelief --
- * Draw the bevels inside bbox.
+ * Draw the bevels inside bbox.
*
**********************************************************************************
*/
void
-ZnDrawRectangleRelief(ZnWInfo *wi,
- ZnReliefStyle relief,
- ZnGradient *gradient,
- XRectangle *bbox,
- ZnDim line_width)
+ZnDrawRectangleRelief(ZnWInfo *wi,
+ ZnReliefStyle relief,
+ ZnGradient *gradient,
+ XRectangle *bbox,
+ ZnDim line_width)
{
- XPoint bevel[4];
+ XPoint bevel[4];
/*
* If we haven't enough space to draw, exit.
@@ -528,23 +528,23 @@ ZnDrawRectangleRelief(ZnWInfo *wi,
* half the width of the original one.
*/
if ((relief == ZN_RELIEF_RIDGE) || (relief == ZN_RELIEF_GROOVE)) {
- ZnDim new_line_width;
+ ZnDim new_line_width;
unsigned int offset;
- XRectangle internal_bbox;
+ XRectangle internal_bbox;
new_line_width = line_width/2.0;
offset = (unsigned) (line_width - new_line_width);
ZnDrawRectangleRelief(wi,
- (ZnReliefStyle) ((relief==ZN_RELIEF_GROOVE)?ZN_RELIEF_SUNKEN:ZN_RELIEF_RAISED),
- gradient, bbox, new_line_width);
+ (ZnReliefStyle) ((relief==ZN_RELIEF_GROOVE)?ZN_RELIEF_SUNKEN:ZN_RELIEF_RAISED),
+ gradient, bbox, new_line_width);
internal_bbox = *bbox;
internal_bbox.x += offset;
internal_bbox.y += offset;
internal_bbox.width -= offset*2;
internal_bbox.height -= offset*2;
ZnDrawRectangleRelief(wi,
- (ZnReliefStyle) ((relief==ZN_RELIEF_GROOVE)?ZN_RELIEF_RAISED:ZN_RELIEF_SUNKEN),
- gradient, &internal_bbox, new_line_width);
+ (ZnReliefStyle) ((relief==ZN_RELIEF_GROOVE)?ZN_RELIEF_RAISED:ZN_RELIEF_SUNKEN),
+ gradient, &internal_bbox, new_line_width);
return;
}
@@ -557,9 +557,9 @@ ZnDrawRectangleRelief(ZnWInfo *wi,
bevel[2].x = bevel[1].x - (short) line_width;
bevel[3].x = bevel[0].x + (short) line_width;
XSetForeground(wi->dpy, wi->gc,
- ReliefPixelOfSegment((ZnReal) bevel[1].x, (ZnReal) bevel[1].y,
- (ZnReal) bevel[0].x, (ZnReal) bevel[0].y,
- relief, gradient, wi->light_angle));
+ ReliefPixelOfSegment((ZnReal) bevel[1].x, (ZnReal) bevel[1].y,
+ (ZnReal) bevel[0].x, (ZnReal) bevel[0].y,
+ relief, gradient, wi->light_angle));
XFillPolygon(wi->dpy, wi->draw_buffer, wi->gc, bevel, 4, Convex, CoordModeOrigin);
bevel[0] = bevel[1];
@@ -567,9 +567,9 @@ ZnDrawRectangleRelief(ZnWInfo *wi,
bevel[1].y += bbox->height;
bevel[2].y = bevel[1].y - (short) line_width;
XSetForeground(wi->dpy, wi->gc,
- ReliefPixelOfSegment((ZnReal) bevel[1].x, (ZnReal) bevel[1].y,
- (ZnReal) bevel[0].x, (ZnReal) bevel[0].y,
- relief, gradient, wi->light_angle));
+ ReliefPixelOfSegment((ZnReal) bevel[1].x, (ZnReal) bevel[1].y,
+ (ZnReal) bevel[0].x, (ZnReal) bevel[0].y,
+ relief, gradient, wi->light_angle));
XFillPolygon(wi->dpy, wi->draw_buffer, wi->gc, bevel, 4, Convex, CoordModeOrigin);
bevel[0] = bevel[1];
@@ -577,9 +577,9 @@ ZnDrawRectangleRelief(ZnWInfo *wi,
bevel[1].x -= bbox->width;
bevel[2].x = bevel[1].x + (short) line_width;
XSetForeground(wi->dpy, wi->gc,
- ReliefPixelOfSegment((ZnReal) bevel[1].x, (ZnReal) bevel[1].y,
- (ZnReal) bevel[0].x, (ZnReal) bevel[0].y,
- relief, gradient, wi->light_angle));
+ ReliefPixelOfSegment((ZnReal) bevel[1].x, (ZnReal) bevel[1].y,
+ (ZnReal) bevel[0].x, (ZnReal) bevel[0].y,
+ relief, gradient, wi->light_angle));
XFillPolygon(wi->dpy, wi->draw_buffer, wi->gc, bevel, 4, Convex, CoordModeOrigin);
bevel[0] = bevel[1];
@@ -589,44 +589,44 @@ ZnDrawRectangleRelief(ZnWInfo *wi,
bevel[2].x = bevel[3].x;
bevel[2].y = bbox->y + (short) line_width;
XSetForeground(wi->dpy, wi->gc,
- ReliefPixelOfSegment((ZnReal) bevel[1].x, (ZnReal) bevel[1].y,
- (ZnReal) bevel[0].x, (ZnReal) bevel[0].y,
- relief, gradient, wi->light_angle));
+ ReliefPixelOfSegment((ZnReal) bevel[1].x, (ZnReal) bevel[1].y,
+ (ZnReal) bevel[0].x, (ZnReal) bevel[0].y,
+ relief, gradient, wi->light_angle));
XFillPolygon(wi->dpy, wi->draw_buffer, wi->gc, bevel, 4, Convex, CoordModeOrigin);
}
typedef struct {
- ZnWInfo *wi;
- ZnPoint *pp;
- ZnPoint *p0;
- ZnPoint *p1;
- double dist;
- ZnBBox *bbox;
- ZnReliefStyle relief;
- ZnGradient *gradient;
+ ZnWInfo *wi;
+ ZnPoint *pp;
+ ZnPoint *p0;
+ ZnPoint *p1;
+ double dist;
+ ZnBBox *bbox;
+ ZnReliefStyle relief;
+ ZnGradient *gradient;
unsigned short alpha;
- ZnBool smooth;
- int result;
- int count;
- ZnBool toggle;
+ ZnBool smooth;
+ int result;
+ int count;
+ ZnBool toggle;
} PolygonData;
static void
-DoPolygon(ZnPoint *p,
- unsigned int num_points,
- ZnDim line_width,
- ZnBool (*cb)(ZnPoint *bevels, PolygonData *pd),
- PolygonData *pd)
+DoPolygon(ZnPoint *p,
+ unsigned int num_points,
+ ZnDim line_width,
+ ZnBool (*cb)(ZnPoint *bevels, PolygonData *pd),
+ PolygonData *pd)
{
- int i;
- unsigned int processed_points;
- ZnPoint *p1, *p11=NULL, *p2;
- ZnPoint pp1, pp2, new_pp1, new_pp2;
- ZnPoint perp, c, shift1, shift2;
- ZnPoint bevel_points[4];
- ZnBool folded, closed, colinear;
- ZnReal dx, dy;
+ int i;
+ unsigned int processed_points;
+ ZnPoint *p1, *p11=NULL, *p2;
+ ZnPoint pp1, pp2, new_pp1, new_pp2;
+ ZnPoint perp, c, shift1, shift2;
+ ZnPoint bevel_points[4];
+ ZnBool folded, closed, colinear;
+ ZnReal dx, dy;
if (num_points < 2) {
return;
@@ -653,7 +653,7 @@ DoPolygon(ZnPoint *p,
*
* bevel[1] /
* * /
- * | /
+ * | /
* | /
* pp1 * * p[i-1]
* | | bevel[0]
@@ -741,7 +741,7 @@ DoPolygon(ZnPoint *p,
ZnIntersectLines(p1, &perp, &pp1, &pp2, &bevel_points[2]);
}
else if (processed_points >= 1) {
- ZnReal dotp, dist, odx, ody;
+ ZnReal dotp, dist, odx, ody;
/*
* The dot product of the two faces tell if the are
@@ -752,42 +752,42 @@ DoPolygon(ZnPoint *p,
dotp = odx*dx + ody*dy;
dist = ZnLineToPointDist(p11, p2, p1, NULL);
if ((dist < 4.0) && (dotp <= 0)) {
- perp.x = p1->x + (p2->y - p1->y);
- perp.y = p1->y - (p2->x - p1->x);
- ZnIntersectLines(p1, &perp, &new_pp1, &new_pp2, &bevel_points[2]);
- colinear = True;
+ perp.x = p1->x + (p2->y - p1->y);
+ perp.y = p1->y - (p2->x - p1->x);
+ ZnIntersectLines(p1, &perp, &new_pp1, &new_pp2, &bevel_points[2]);
+ colinear = True;
}
else {
- folded = !ZnIntersectLines(&new_pp1, &new_pp2, &pp1, &pp2, &bevel_points[2]);
- /*printf("new_pp1 %g@%g, new_pp2 %g@%g, pp1 %g@%g, pp2 %g@%g, inter %g@%g\n",
- new_pp1.x, new_pp1.y, new_pp2.x, new_pp2.y,
- pp1.x, pp1.y, pp2.x, pp2.y,
- bevel_points[2].x, bevel_points[2].y);*/
- folded = folded && (dotp < 0);
- if (folded) {
- /*printf("DoPolygonRelief: folded edges detected, %g@%g, %g@%g, %g@%g, %g@%g\n",
- pp1.x, pp1.y, pp2.x, pp2.y, new_pp1.x, new_pp1.y,
- new_pp2.x, new_pp2.y);*/
- perp.x = p1->x + (p2->y - p1->y);
- perp.y = p1->y - (p2->x - p1->x);
- ZnIntersectLines(p1, &perp, &pp1, &pp2, &bevel_points[2]);
- ZnIntersectLines(p1, &perp, &new_pp1, &new_pp2, &c);
- ZnShiftLine(p1, &perp, line_width, &shift1, &shift2);
- ZnIntersectLines(p1, p2, &shift1, &shift2, &bevel_points[3]);
- }
+ folded = !ZnIntersectLines(&new_pp1, &new_pp2, &pp1, &pp2, &bevel_points[2]);
+ /*printf("new_pp1 %g@%g, new_pp2 %g@%g, pp1 %g@%g, pp2 %g@%g, inter %g@%g\n",
+ new_pp1.x, new_pp1.y, new_pp2.x, new_pp2.y,
+ pp1.x, pp1.y, pp2.x, pp2.y,
+ bevel_points[2].x, bevel_points[2].y);*/
+ folded = folded && (dotp < 0);
+ if (folded) {
+ /*printf("DoPolygonRelief: folded edges detected, %g@%g, %g@%g, %g@%g, %g@%g\n",
+ pp1.x, pp1.y, pp2.x, pp2.y, new_pp1.x, new_pp1.y,
+ new_pp2.x, new_pp2.y);*/
+ perp.x = p1->x + (p2->y - p1->y);
+ perp.y = p1->y - (p2->x - p1->x);
+ ZnIntersectLines(p1, &perp, &pp1, &pp2, &bevel_points[2]);
+ ZnIntersectLines(p1, &perp, &new_pp1, &new_pp2, &c);
+ ZnShiftLine(p1, &perp, line_width, &shift1, &shift2);
+ ZnIntersectLines(p1, p2, &shift1, &shift2, &bevel_points[3]);
+ }
}
}
if ((processed_points >= 2) || (!closed && (processed_points == 1))) {
if ((processed_points == num_points-1) && !closed) {
- pd->p0 = pd->p1 = NULL;
+ pd->p0 = pd->p1 = NULL;
}
else {
- pd->p0 = p1;
- pd->p1 = p2;
+ pd->p0 = p1;
+ pd->p1 = p2;
}
if ((*cb)(bevel_points, pd)) {
- return;
+ return;
}
}
@@ -812,15 +812,15 @@ DoPolygon(ZnPoint *p,
**********************************************************************************
*
* ZnGetPolygonReliefBBox --
- * Returns the bevelled polygon bounding box.
+ * Returns the bevelled polygon bounding box.
*
**********************************************************************************
*/
static ZnBool
-PolygonBBoxCB(ZnPoint *bevels,
- PolygonData *pd)
+PolygonBBoxCB(ZnPoint *bevels,
+ PolygonData *pd)
{
- int i;
+ int i;
for (i = 0; i < 4; i++) {
ZnAddPointToBBox(pd->bbox, bevels[i].x, bevels[i].y);
@@ -829,12 +829,12 @@ PolygonBBoxCB(ZnPoint *bevels,
}
void
-ZnGetPolygonReliefBBox(ZnPoint *points,
- unsigned int num_points,
- ZnDim line_width,
- ZnBBox *bbox)
+ZnGetPolygonReliefBBox(ZnPoint *points,
+ unsigned int num_points,
+ ZnDim line_width,
+ ZnBBox *bbox)
{
- PolygonData pd;
+ PolygonData pd;
pd.bbox = bbox;
ZnResetBBox(bbox);
@@ -846,14 +846,14 @@ ZnGetPolygonReliefBBox(ZnPoint *points,
**********************************************************************************
*
* ZnPolygonReliefInBBox --
- * Returns (-1) if the relief is entirely outside the bbox, (1) if it is
- * entirely inside or (0) if in between
+ * Returns (-1) if the relief is entirely outside the bbox, (1) if it is
+ * entirely inside or (0) if in between
*
**********************************************************************************
*/
static ZnBool
-PolygonInBBoxCB(ZnPoint *bevels,
- PolygonData *pd)
+PolygonInBBoxCB(ZnPoint *bevels,
+ PolygonData *pd)
{
if (pd->count == 0) {
pd->count++;
@@ -872,12 +872,12 @@ PolygonInBBoxCB(ZnPoint *bevels,
}
int
-ZnPolygonReliefInBBox(ZnPoint *points,
- unsigned int num_points,
- ZnDim line_width,
- ZnBBox *area)
+ZnPolygonReliefInBBox(ZnPoint *points,
+ unsigned int num_points,
+ ZnDim line_width,
+ ZnBBox *area)
{
- PolygonData pd;
+ PolygonData pd;
pd.bbox = area;
pd.count = 0;
@@ -892,16 +892,16 @@ ZnPolygonReliefInBBox(ZnPoint *points,
**********************************************************************************
*
* ZnPolygonReliefToPointDist --
- * Returns the distance between the given point and
- * the bevelled polygon.
+ * Returns the distance between the given point and
+ * the bevelled polygon.
*
**********************************************************************************
*/
static ZnBool
-PolygonDistCB(ZnPoint *bevels,
- PolygonData *pd)
+PolygonDistCB(ZnPoint *bevels,
+ PolygonData *pd)
{
- double new_dist;
+ double new_dist;
new_dist = ZnPolygonToPointDist(bevels, 4, pd->pp);
if (new_dist < 0.0) {
@@ -914,12 +914,12 @@ PolygonDistCB(ZnPoint *bevels,
}
double
-ZnPolygonReliefToPointDist(ZnPoint *points,
- unsigned int num_points,
- ZnDim line_width,
- ZnPoint *pp)
+ZnPolygonReliefToPointDist(ZnPoint *points,
+ unsigned int num_points,
+ ZnDim line_width,
+ ZnPoint *pp)
{
- PolygonData pd;
+ PolygonData pd;
pd.dist = 1.0e40;
pd.pp = pp;
@@ -933,47 +933,47 @@ ZnPolygonReliefToPointDist(ZnPoint *points,
**********************************************************************************
*
* ZnDrawPolygonRelief --
- * Draw the bevels around path.
+ * Draw the bevels around path.
*
**********************************************************************************
*/
static ZnBool
-PolygonDrawCB(ZnPoint *bevels,
- PolygonData *pd)
+PolygonDrawCB(ZnPoint *bevels,
+ PolygonData *pd)
{
- ZnWInfo *wi = pd->wi;
- XPoint bevel_xpoints[5];
- XGCValues values;
- int j;
+ ZnWInfo *wi = pd->wi;
+ XPoint bevel_xpoints[5];
+ XGCValues values;
+ int j;
values.foreground = ReliefPixelOfSegment(bevels[0].x, bevels[0].y,
- bevels[3].x, bevels[3].y,
- pd->relief, pd->gradient,
- pd->wi->light_angle);
+ bevels[3].x, bevels[3].y,
+ pd->relief, pd->gradient,
+ pd->wi->light_angle);
values.fill_style = FillSolid;
XChangeGC(wi->dpy, wi->gc, GCFillStyle|GCForeground, &values);
-
+
for (j = 0; j < 4; j++) {
bevel_xpoints[j].x = ZnNearestInt(bevels[j].x);
bevel_xpoints[j].y = ZnNearestInt(bevels[j].y);
}
XFillPolygon(wi->dpy, wi->draw_buffer, wi->gc, bevel_xpoints, 4,
- Convex, CoordModeOrigin);
+ Convex, CoordModeOrigin);
return 0;
}
void
-ZnDrawPolygonRelief(ZnWInfo *wi,
- ZnReliefStyle relief,
- ZnGradient *gradient,
- ZnPoint *points,
- unsigned int num_points,
- ZnDim line_width)
+ZnDrawPolygonRelief(ZnWInfo *wi,
+ ZnReliefStyle relief,
+ ZnGradient *gradient,
+ ZnPoint *points,
+ unsigned int num_points,
+ ZnDim line_width)
{
- PolygonData pd;
+ PolygonData pd;
pd.wi = wi;
pd.gradient = gradient;
@@ -998,21 +998,21 @@ ZnDrawPolygonRelief(ZnWInfo *wi,
**********************************************************************************
*
* ZnRenderPolygonRelief --
- * Draw the bevels around path using alpha enabled rendering.
+ * Draw the bevels around path using alpha enabled rendering.
*
**********************************************************************************
*/
#ifdef GL
static ZnBool
-PolygonRenderCB(ZnPoint *bevels,
- PolygonData *pd)
+PolygonRenderCB(ZnPoint *bevels,
+ PolygonData *pd)
{
- int i;
- ZnPoint p[6];
- XColor *c[8];
- XColor *color = ZnGetGradientColor(pd->gradient, 51.0, NULL);
- ZnReliefStyle relief, int_relief;
- ZnBool two_faces, round, rule;
+ int i;
+ ZnPoint p[6];
+ XColor *c[8];
+ XColor *color = ZnGetGradientColor(pd->gradient, 51.0, NULL);
+ ZnReliefStyle relief, int_relief;
+ ZnBool two_faces, round, rule;
rule = pd->relief & ZN_RELIEF_RULE;
round = pd->relief & ZN_RELIEF_ROUND;
@@ -1036,29 +1036,29 @@ PolygonRenderCB(ZnPoint *bevels,
int_relief = ZN_RELIEF_SUNKEN;
}
c[0]=c[1]=c[2]=c[3] = ReliefColorOfSegment(bevels[0].x, bevels[0].y,
- bevels[3].x, bevels[3].y,
- relief, pd->gradient,
- pd->wi->light_angle);
+ bevels[3].x, bevels[3].y,
+ relief, pd->gradient,
+ pd->wi->light_angle);
c[4]=c[5]=c[6]=c[7] = ReliefColorOfSegment(bevels[0].x, bevels[0].y,
- bevels[3].x, bevels[3].y,
- int_relief, pd->gradient,
- pd->wi->light_angle);
+ bevels[3].x, bevels[3].y,
+ int_relief, pd->gradient,
+ pd->wi->light_angle);
if (pd->smooth && pd->p0) {
c[2]=c[3] = ReliefColorOfSegment(pd->p0->x, pd->p0->y,
- pd->p1->x, pd->p1->y,
- relief, pd->gradient,
- pd->wi->light_angle);
+ pd->p1->x, pd->p1->y,
+ relief, pd->gradient,
+ pd->wi->light_angle);
c[6]=c[7] = ReliefColorOfSegment(pd->p0->x, pd->p0->y,
- pd->p1->x, pd->p1->y,
- int_relief, pd->gradient,
- pd->wi->light_angle);
+ pd->p1->x, pd->p1->y,
+ int_relief, pd->gradient,
+ pd->wi->light_angle);
}
if (round) {
if (!rule) {
- c[0]=c[3]=c[5]=c[6]=color;
+ c[0]=c[3]=c[5]=c[6]=color;
}
else {
- c[1]=c[2]=c[4]=c[7]=color;
+ c[1]=c[2]=c[4]=c[7]=color;
}
}
glBegin(GL_QUADS);
@@ -1089,14 +1089,14 @@ PolygonRenderCB(ZnPoint *bevels,
}
else { /* Single face */
c[0]=c[1]=c[2]=c[3] = ReliefColorOfSegment(bevels[0].x, bevels[0].y,
- bevels[3].x, bevels[3].y,
- relief, pd->gradient,
- pd->wi->light_angle);
+ bevels[3].x, bevels[3].y,
+ relief, pd->gradient,
+ pd->wi->light_angle);
if (pd->smooth && pd->p0) {
c[2]=c[3] = ReliefColorOfSegment(pd->p0->x, pd->p0->y,
- pd->p1->x, pd->p1->y,
- relief, pd->gradient,
- pd->wi->light_angle);
+ pd->p1->x, pd->p1->y,
+ relief, pd->gradient,
+ pd->wi->light_angle);
}
if (round) {
c[1]=c[2] = color;
@@ -1117,22 +1117,22 @@ PolygonRenderCB(ZnPoint *bevels,
}
void
-ZnRenderPolygonRelief(ZnWInfo *wi,
- ZnReliefStyle relief,
- ZnGradient *gradient,
- ZnBool smooth,
- ZnPoint *points,
- unsigned int num_points,
- ZnDim line_width)
+ZnRenderPolygonRelief(ZnWInfo *wi,
+ ZnReliefStyle relief,
+ ZnGradient *gradient,
+ ZnBool smooth,
+ ZnPoint *points,
+ unsigned int num_points,
+ ZnDim line_width)
{
- PolygonData pd;
+ PolygonData pd;
pd.wi = wi;
pd.gradient = gradient;
ZnGetGradientColor(gradient, 0.0, &pd.alpha);
pd.alpha = ZnComposeAlpha(pd.alpha, wi->alpha);
pd.smooth = smooth;
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
pd.relief = relief;
pd.count = 0;
@@ -1140,23 +1140,23 @@ ZnRenderPolygonRelief(ZnWInfo *wi,
}
void
-ZnRenderPolyline(ZnWInfo *wi,
- ZnPoint *points,
- unsigned int num_points,
- ZnDim line_width,
- ZnLineStyle line_style,
- int cap_style,
- int join_style,
- ZnLineEnd first_end,
- ZnLineEnd last_end,
- ZnGradient *gradient)
+ZnRenderPolyline(ZnWInfo *wi,
+ ZnPoint *points,
+ unsigned int num_points,
+ ZnDim line_width,
+ ZnLineStyle line_style,
+ int cap_style,
+ int join_style,
+ ZnLineEnd first_end,
+ ZnLineEnd last_end,
+ ZnGradient *gradient)
{
- int num_clips = ZnListSize(wi->clip_stack);
- ZnPoint end_points[ZN_LINE_END_POINTS];
- ZnBool need_rcaps, thin, closed, transparent;
- int pass, num_passes, i, k, m;
- ZnPoint c1, c2;
- XColor *color;
+ int num_clips = ZnListSize(wi->clip_stack);
+ ZnPoint end_points[ZN_LINE_END_POINTS];
+ ZnBool need_rcaps, thin, closed, transparent;
+ int pass, num_passes, i, k, m;
+ ZnPoint c1, c2;
+ XColor *color;
unsigned short alpha;
ZnGLContextEntry *ce = ZnGetGLContext(wi->dpy);
@@ -1169,7 +1169,7 @@ ZnRenderPolyline(ZnWInfo *wi,
* The caps can be either round or butt (but not projecting).
*/
thin = ((line_width <= ce->max_line_width) &&
- (line_width <= ce->max_point_width));
+ (line_width <= ce->max_point_width));
closed = (points->x == points[num_points-1].x) && (points->y == points[num_points-1].y);
color = ZnGetGradientColor(gradient, 0.0, &alpha);
alpha = ZnComposeAlpha(alpha, wi->alpha);
@@ -1210,46 +1210,46 @@ ZnRenderPolyline(ZnWInfo *wi,
for (pass = 0; pass < num_passes; pass++) {
if (transparent) {
if (pass == 0) {
- ZnGlStartClip(num_clips, True);
+ ZnGlStartClip(num_clips, True);
}
else {
- ZnGlRestoreStencil(num_clips, False);
+ ZnGlRestoreStencil(num_clips, False);
}
}
if (first_end) {
ZnGetLineEnd(&points[0], &points[1], line_width, cap_style,
- first_end, end_points);
+ first_end, end_points);
glBegin(GL_TRIANGLE_FAN);
for (m = 0; m < ZN_LINE_END_POINTS; m++) {
- glVertex2d(end_points[m].x, end_points[m].y);
+ glVertex2d(end_points[m].x, end_points[m].y);
}
glEnd();
}
if (last_end) {
ZnGetLineEnd(&points[num_points-1], &points[num_points-2],
- line_width, cap_style, last_end, end_points);
+ line_width, cap_style, last_end, end_points);
glBegin(GL_TRIANGLE_FAN);
for (m = 0; m < ZN_LINE_END_POINTS; m++) {
- glVertex2d(end_points[m].x, end_points[m].y);
+ glVertex2d(end_points[m].x, end_points[m].y);
}
glEnd();
}
if (thin) {
glBegin(GL_LINE_STRIP);
for (i = 0; i < (int) num_points; i++) {
- glVertex2d(points[i].x, points[i].y);
+ glVertex2d(points[i].x, points[i].y);
}
glEnd();
}
else {
glBegin(GL_QUADS);
for (i = 0; i < (int) num_points-1; i++) {
- ZnGetButtPoints(&points[i+1], &points[i], line_width, False, &c1, &c2);
- glVertex2d(c1.x, c1.y);
- glVertex2d(c2.x, c2.y);
- ZnGetButtPoints(&points[i], &points[i+1], line_width, False, &c1, &c2);
- glVertex2d(c1.x, c1.y);
- glVertex2d(c2.x, c2.y);
+ ZnGetButtPoints(&points[i+1], &points[i], line_width, False, &c1, &c2);
+ glVertex2d(c1.x, c1.y);
+ glVertex2d(c2.x, c2.y);
+ ZnGetButtPoints(&points[i], &points[i+1], line_width, False, &c1, &c2);
+ glVertex2d(c1.x, c1.y);
+ glVertex2d(c2.x, c2.y);
}
glEnd();
}
@@ -1277,24 +1277,24 @@ ZnRenderPolyline(ZnWInfo *wi,
if (thin) {
glBegin(GL_POINTS);
for ( ; i < k; i++) {
- glVertex2d(points[i].x, points[i].y);
+ glVertex2d(points[i].x, points[i].y);
}
glEnd();
}
else {
- int num_cpoints;
- ZnReal lw_2 = line_width / 2.0;
- ZnPoint *cpoints = ZnGetCirclePoints(3, ZN_CIRCLE_COARSE,
- 0.0, 2*M_PI, &num_cpoints, NULL);
+ int num_cpoints;
+ ZnReal lw_2 = line_width / 2.0;
+ ZnPoint *cpoints = ZnGetCirclePoints(3, ZN_CIRCLE_COARSE,
+ 0.0, 2*M_PI, &num_cpoints, NULL);
for ( ; i < k; i++) {
- glBegin(GL_TRIANGLE_FAN);
- glVertex2d(points[i].x, points[i].y);
- for (m = 0; m < num_cpoints; m++) {
- glVertex2d(points[i].x + cpoints[m].x*lw_2,
- points[i].y + cpoints[m].y*lw_2);
- }
- glEnd();
+ glBegin(GL_TRIANGLE_FAN);
+ glVertex2d(points[i].x, points[i].y);
+ for (m = 0; m < num_cpoints; m++) {
+ glVertex2d(points[i].x + cpoints[m].x*lw_2,
+ points[i].y + cpoints[m].y*lw_2);
+ }
+ glEnd();
}
}
}
@@ -1307,14 +1307,14 @@ ZnRenderPolyline(ZnWInfo *wi,
void
-ZnRenderIcon(ZnWInfo *wi,
- ZnImage image,
- ZnGradient *gradient,
- ZnPoint *origin,
- ZnBool modulate)
+ZnRenderIcon(ZnWInfo *wi,
+ ZnImage image,
+ ZnGradient *gradient,
+ ZnPoint *origin,
+ ZnBool modulate)
{
- ZnPoint p[4];
- int width, height;
+ ZnPoint p[4];
+ int width, height;
ZnSizeOfImage(image, &width, &height);
p[0] = *origin;
@@ -1329,16 +1329,16 @@ ZnRenderIcon(ZnWInfo *wi,
void
-ZnRenderImage(ZnWInfo *wi,
- ZnImage image,
- ZnGradient *gradient,
- ZnPoint *quad,
- ZnBool modulate)
+ZnRenderImage(ZnWInfo *wi,
+ ZnImage image,
+ ZnGradient *gradient,
+ ZnPoint *quad,
+ ZnBool modulate)
{
- XColor *color;
+ XColor *color;
unsigned short alpha;
- ZnReal t, s;
- GLuint texobj;
+ ZnReal t, s;
+ GLuint texobj;
color = ZnGetGradientColor(gradient, 0.0, &alpha);
alpha = ZnComposeAlpha(alpha, wi->alpha);
@@ -1367,18 +1367,18 @@ ZnRenderImage(ZnWInfo *wi,
}
void
-ZnRenderTile(ZnWInfo *wi,
- ZnImage tile,
- ZnGradient *gradient,
- void (*cb)(void *),
- void *closure,
- ZnPoint *quad) /* Right now it's a ZnBBox */
+ZnRenderTile(ZnWInfo *wi,
+ ZnImage tile,
+ ZnGradient *gradient,
+ void (*cb)(void *),
+ void *closure,
+ ZnPoint *quad) /* Right now it's a ZnBBox */
{
- ZnReal x, y, nx, ny, lx, ly, s, t, tiles, tilet;
- int width, height, num_clips = ZnListSize(wi->clip_stack);
+ ZnReal x, y, nx, ny, lx, ly, s, t, tiles, tilet;
+ int width, height, num_clips = ZnListSize(wi->clip_stack);
unsigned short alpha;
- GLuint texobj;
- XColor *color;
+ GLuint texobj;
+ XColor *color;
if (gradient) {
color = ZnGetGradientColor(gradient, 0.0, &alpha);
@@ -1433,8 +1433,8 @@ ZnRenderTile(ZnWInfo *wi,
s = 1.0;
nx = x + width;
if (nx > lx) {
- nx = lx;
- s = (lx - x) / (ZnReal) width;
+ nx = lx;
+ s = (lx - x) / (ZnReal) width;
}
s *= tiles;
glTexCoord2d(0.0, 0.0);
@@ -1461,16 +1461,16 @@ ZnRenderTile(ZnWInfo *wi,
static void
-ComputeAxialGradient(ZnWInfo *wi,
- ZnPoly *shape,
- ZnReal angle,
- ZnPoint *grad_geo)
+ComputeAxialGradient(ZnWInfo *wi,
+ ZnPoly *shape,
+ ZnReal angle,
+ ZnPoint *grad_geo)
{
- ZnTransfo *transfo1, *transfo2;
- ZnContour *c;
- ZnBBox bbox;
- ZnPoint *points, p[4];
- unsigned int i;
+ ZnTransfo *transfo1, *transfo2;
+ ZnContour *c;
+ ZnBBox bbox;
+ ZnPoint *points, p[4];
+ unsigned int i;
transfo1 = ZnTransfoNew();
transfo2 = ZnTransfoNew();
@@ -1502,20 +1502,20 @@ ComputeAxialGradient(ZnWInfo *wi,
}
static void
-ComputeCircularGradient(ZnWInfo *wi,
- ZnPoly *shape,
- ZnBool oval,
- ZnPoint *focal_pp, /* in percent of bbox */
- ZnReal angle,
- ZnPoint *grad_geo)
+ComputeCircularGradient(ZnWInfo *wi,
+ ZnPoly *shape,
+ ZnBool oval,
+ ZnPoint *focal_pp, /* in percent of bbox */
+ ZnReal angle,
+ ZnPoint *grad_geo)
{
- ZnReal dist, new, x, y, ff;
- ZnBBox bbox;
- ZnContour *c;
- ZnPoint offset, radius, focal_point;
- ZnPoint *points;
- ZnTransfo t1;
- unsigned int i, j;
+ ZnReal dist, new, x, y, ff;
+ ZnBBox bbox;
+ ZnContour *c;
+ ZnPoint offset, radius, focal_point;
+ ZnPoint *points;
+ ZnTransfo t1;
+ unsigned int i, j;
/*
* Compute the shape bbox (which should be in the item space).
@@ -1579,12 +1579,12 @@ ComputeCircularGradient(ZnWInfo *wi,
c = shape->contours;
for (j = 0; j < shape->num_contours; j++, c++) {
for (i = 0, points = c->points; i < c->num_points; i++, points++) {
- x = points->x - focal_point.x;
- y = points->y - focal_point.y;
- new = x*x+y*y;
- if (new > dist) {
- dist = new;
- }
+ x = points->x - focal_point.x;
+ y = points->y - focal_point.y;
+ new = x*x+y*y;
+ if (new > dist) {
+ dist = new;
+ }
}
}
}
@@ -1609,15 +1609,15 @@ ComputeCircularGradient(ZnWInfo *wi,
}
static void
-ComputePathGradient(ZnWInfo *wi,
- ZnPoly *shape,
- ZnPoint *focal_pp, /* in percent of the bbox */
- ZnPoint *grad_geo)
+ComputePathGradient(ZnWInfo *wi,
+ ZnPoly *shape,
+ ZnPoint *focal_pp, /* in percent of the bbox */
+ ZnPoint *grad_geo)
{
- ZnBBox bbox;
- ZnContour *c;
- ZnPoint focal_point;
- unsigned int j;
+ ZnBBox bbox;
+ ZnContour *c;
+ ZnPoint focal_point;
+ unsigned int j;
/*
* Compute the shape bbox (which should be in the item space).
@@ -1640,10 +1640,10 @@ ComputePathGradient(ZnWInfo *wi,
}
void
-ZnComputeGradient(ZnGradient *grad,
- ZnWInfo *wi,
- ZnPoly *shape,
- ZnPoint *grad_geo)
+ZnComputeGradient(ZnGradient *grad,
+ ZnWInfo *wi,
+ ZnPoly *shape,
+ ZnPoint *grad_geo)
{
switch (grad->type) {
case ZN_AXIAL_GRADIENT:
@@ -1660,30 +1660,30 @@ ZnComputeGradient(ZnGradient *grad,
}
void
-ZnRenderGradient(ZnWInfo *wi,
- ZnGradient *gradient, /* The gradient to be drawn (static
- * parameters). */
- void (*cb)(void *), /* A callback called to clip the shape
- * containing the gradient. */
- void *closure, /* The callback parameter. */
- ZnPoint *quad, /* The gradient geometric parameters
- * (dynamic). */
- ZnPoly *poly /* Used only by ZN_PATH_GRADIENT */
- )
+ZnRenderGradient(ZnWInfo *wi,
+ ZnGradient *gradient, /* The gradient to be drawn (static
+ * parameters). */
+ void (*cb)(void *), /* A callback called to clip the shape
+ * containing the gradient. */
+ void *closure, /* The callback parameter. */
+ ZnPoint *quad, /* The gradient geometric parameters
+ * (dynamic). */
+ ZnPoly *poly /* Used only by ZN_PATH_GRADIENT */
+ )
{
unsigned short alpha, alpha2;
- int angle;
- unsigned int i, j;
- int type = gradient->type;
- XColor *color;
- ZnPoint dposa, dposb, dposc, dposd;
- ZnPoint p, dcontrol;
- ZnReal npos, pos, control;
- unsigned int num_clips = ZnListSize(wi->clip_stack);
- ZnPoint iquad[4];
+ int angle;
+ unsigned int i, j;
+ int type = gradient->type;
+ XColor *color;
+ ZnPoint dposa, dposb, dposc, dposd;
+ ZnPoint p, dcontrol;
+ ZnReal npos, pos, control;
+ unsigned int num_clips = ZnListSize(wi->clip_stack);
+ ZnPoint iquad[4];
if (!cb && (type == ZN_AXIAL_GRADIENT)) { /* Render an aligned
- * axial gradient in the quad */
+ * axial gradient in the quad */
angle = gradient->angle;
/*
* Adjust the quad for 90 180 and 270 degrees axial
@@ -1751,36 +1751,36 @@ ZnRenderGradient(ZnWInfo *wi,
glVertex2d(p.x, p.y);
if ((control != 50.0) && (i != gradient->num_actual_colors-1)) {
- color = gradient->actual_colors[i].mid_rgb;
- alpha = ZnComposeAlpha(gradient->actual_colors[i].mid_alpha, wi->alpha);
- glColor4us(color->red, color->green, color->blue, alpha);
-
- npos = gradient->actual_colors[i+1].position;
- dposc.x = (quad[1].x - quad[0].x)*npos/100.0;
- dposc.y = (quad[1].y - quad[0].y)*npos/100.0;
- dcontrol.x = (dposc.x - dposa.x)*control/100.0;
- dcontrol.y = (dposc.y - dposa.y)*control/100.0;
- p.x = quad[0].x + dposa.x + dcontrol.x;
- p.y = quad[0].y + dposa.y + dcontrol.y;
- glVertex2d(p.x, p.y);
-
- dposd.x = (quad[2].x - quad[3].x)*npos/100.0;
- dposd.y = (quad[2].y - quad[3].y)*npos/100.0;
- dcontrol.x = (dposd.x - dposb.x)*control/100.0;
- dcontrol.y = (dposd.y - dposb.y)*control/100.0;
- p.x = quad[3].x + dposb.x + dcontrol.x;
- p.y = quad[3].y + dposb.y + dcontrol.y;
- glVertex2d(p.x, p.y);
+ color = gradient->actual_colors[i].mid_rgb;
+ alpha = ZnComposeAlpha(gradient->actual_colors[i].mid_alpha, wi->alpha);
+ glColor4us(color->red, color->green, color->blue, alpha);
+
+ npos = gradient->actual_colors[i+1].position;
+ dposc.x = (quad[1].x - quad[0].x)*npos/100.0;
+ dposc.y = (quad[1].y - quad[0].y)*npos/100.0;
+ dcontrol.x = (dposc.x - dposa.x)*control/100.0;
+ dcontrol.y = (dposc.y - dposa.y)*control/100.0;
+ p.x = quad[0].x + dposa.x + dcontrol.x;
+ p.y = quad[0].y + dposa.y + dcontrol.y;
+ glVertex2d(p.x, p.y);
+
+ dposd.x = (quad[2].x - quad[3].x)*npos/100.0;
+ dposd.y = (quad[2].y - quad[3].y)*npos/100.0;
+ dcontrol.x = (dposd.x - dposb.x)*control/100.0;
+ dcontrol.y = (dposd.y - dposb.y)*control/100.0;
+ p.x = quad[3].x + dposb.x + dcontrol.x;
+ p.y = quad[3].y + dposb.y + dcontrol.y;
+ glVertex2d(p.x, p.y);
}
}
glEnd();
}
else if (type == ZN_RADIAL_GRADIENT) {
- ZnReal x, y, position, position2, position3;
+ ZnReal x, y, position, position2, position3;
unsigned int num_p;
- ZnPoint *genarc, *tarc, p, focalp;
- XColor *color2;
+ ZnPoint *genarc, *tarc, p, focalp;
+ XColor *color2;
genarc = ZnGetCirclePoints(3, ZN_CIRCLE_FINE, 0.0, 2*M_PI, &num_p, NULL);
ZnListAssertSize(ZnWorkPoints, num_p);
@@ -1796,37 +1796,37 @@ ZnRenderGradient(ZnWInfo *wi,
for (j = 1; j < gradient->num_actual_colors; j++) {
position2 = gradient->actual_colors[j].position/100.0;
if ((control != 50) && (j != gradient->num_actual_colors-1)) {
- glBegin(GL_QUAD_STRIP);
- color2 = gradient->actual_colors[j-1].mid_rgb;
- alpha2 = ZnComposeAlpha(gradient->actual_colors[j-1].mid_alpha, wi->alpha);
- position3 = position + (position2-position)*control/100.0;
- for (i = 0; i < num_p; i++) {
- x = focalp.x + (tarc[i].x-focalp.x) * position;
- y = focalp.y + (tarc[i].y-focalp.y) * position;
- glColor4us(color->red, color->green, color->blue, alpha);
- glVertex2d(x, y);
- x = focalp.x + (tarc[i].x-focalp.x) * position3;
- y = focalp.y + (tarc[i].y-focalp.y) * position3;
- glColor4us(color2->red, color2->green, color2->blue, alpha);
- glVertex2d(x, y);
- }
- position = position3;
- color = color2;
- alpha = alpha2;
- glEnd();
+ glBegin(GL_QUAD_STRIP);
+ color2 = gradient->actual_colors[j-1].mid_rgb;
+ alpha2 = ZnComposeAlpha(gradient->actual_colors[j-1].mid_alpha, wi->alpha);
+ position3 = position + (position2-position)*control/100.0;
+ for (i = 0; i < num_p; i++) {
+ x = focalp.x + (tarc[i].x-focalp.x) * position;
+ y = focalp.y + (tarc[i].y-focalp.y) * position;
+ glColor4us(color->red, color->green, color->blue, alpha);
+ glVertex2d(x, y);
+ x = focalp.x + (tarc[i].x-focalp.x) * position3;
+ y = focalp.y + (tarc[i].y-focalp.y) * position3;
+ glColor4us(color2->red, color2->green, color2->blue, alpha);
+ glVertex2d(x, y);
+ }
+ position = position3;
+ color = color2;
+ alpha = alpha2;
+ glEnd();
}
glBegin(GL_QUAD_STRIP);
color2 = gradient->actual_colors[j].rgb;
alpha2 = ZnComposeAlpha(gradient->actual_colors[j].alpha, wi->alpha);
for (i = 0; i < num_p; i++) {
- x = focalp.x + (tarc[i].x-focalp.x) * position;
- y = focalp.y + (tarc[i].y-focalp.y) * position;
- glColor4us(color->red, color->green, color->blue, alpha);
- glVertex2d(x, y);
- x = focalp.x + (tarc[i].x-focalp.x) * position2;
- y = focalp.y + (tarc[i].y-focalp.y) * position2;
- glColor4us(color2->red, color2->green, color2->blue, alpha2);
- glVertex2d(x, y);
+ x = focalp.x + (tarc[i].x-focalp.x) * position;
+ y = focalp.y + (tarc[i].y-focalp.y) * position;
+ glColor4us(color->red, color->green, color->blue, alpha);
+ glVertex2d(x, y);
+ x = focalp.x + (tarc[i].x-focalp.x) * position2;
+ y = focalp.y + (tarc[i].y-focalp.y) * position2;
+ glColor4us(color2->red, color2->green, color2->blue, alpha2);
+ glVertex2d(x, y);
}
glEnd();
position = position2;
@@ -1836,70 +1836,70 @@ ZnRenderGradient(ZnWInfo *wi,
}
}
else if (type == ZN_PATH_GRADIENT) {
- ZnPoint p, pp, p2, pp2, p3, pp3;
+ ZnPoint p, pp, p2, pp2, p3, pp3;
unsigned int num_p, k, ii;
- ZnPoint *points;
- ZnReal position;
+ ZnPoint *points;
+ ZnReal position;
for (k = 0; k < poly->num_contours; k++) {
/*if (poly->contours[k].cw) {
- continue;
- }*/
+ continue;
+ }*/
points = poly->contours[k].points;
num_p = poly->contours[k].num_points;
for (i = 0; i < num_p; i++) {
- if (i == num_p-1) {
- ii = 0;
- }
- else {
- ii = i+1;
- }
-
- glBegin(GL_QUAD_STRIP);
- p.x = p.y = pp.x = pp.y = 0;
- control = gradient->actual_colors[0].control;
- position = gradient->actual_colors[0].position;
- alpha = ZnComposeAlpha(gradient->actual_colors[0].alpha, wi->alpha);
- color = gradient->actual_colors[0].rgb;
- glColor4us(color->red, color->green, color->blue, alpha);
- glVertex2d(quad[0].x+p.x, quad[0].y+p.y);
- glVertex2d(quad[0].x+pp.x, quad[0].y+pp.y);
- for (j = 0; j < gradient->num_actual_colors-1; j++) {
- position = gradient->actual_colors[j+1].position;
- p2.x = (points[i].x-quad[0].x)*position/100.0;
- p2.y = (points[i].y-quad[0].y)*position/100.0;
- pp2.x = (points[ii].x-quad[0].x)*position/100.0;
- pp2.y = (points[ii].y-quad[0].y)*position/100.0;
- if (control != 50) {
- color = gradient->actual_colors[j].mid_rgb;
- alpha = ZnComposeAlpha(gradient->actual_colors[j].mid_alpha, wi->alpha);
- p3.x = p.x+(p2.x-p.x)*control/100.0;
- p3.y = p.y+(p2.y-p.y)*control/100.0;
- pp3.x = pp.x+(pp2.x-pp.x)*control/100.0;
- pp3.y = pp.y+(pp2.y-pp.y)*control/100.0;
- glColor4us(color->red, color->green, color->blue, alpha);
- glVertex2d(quad[0].x+p3.x, quad[0].y+p3.y);
- glVertex2d(quad[0].x+pp3.x, quad[0].y+pp3.y);
- }
- control = gradient->actual_colors[j+1].control;
- alpha = ZnComposeAlpha(gradient->actual_colors[j+1].alpha, wi->alpha);
- color = gradient->actual_colors[j+1].rgb;
- p = p2;
- pp = pp2;
- glColor4us(color->red, color->green, color->blue, alpha);
- glVertex2d(quad[0].x+p.x, quad[0].y+p.y);
- glVertex2d(quad[0].x+pp.x, quad[0].y+pp.y);
- }
- glEnd();
+ if (i == num_p-1) {
+ ii = 0;
+ }
+ else {
+ ii = i+1;
+ }
+
+ glBegin(GL_QUAD_STRIP);
+ p.x = p.y = pp.x = pp.y = 0;
+ control = gradient->actual_colors[0].control;
+ position = gradient->actual_colors[0].position;
+ alpha = ZnComposeAlpha(gradient->actual_colors[0].alpha, wi->alpha);
+ color = gradient->actual_colors[0].rgb;
+ glColor4us(color->red, color->green, color->blue, alpha);
+ glVertex2d(quad[0].x+p.x, quad[0].y+p.y);
+ glVertex2d(quad[0].x+pp.x, quad[0].y+pp.y);
+ for (j = 0; j < gradient->num_actual_colors-1; j++) {
+ position = gradient->actual_colors[j+1].position;
+ p2.x = (points[i].x-quad[0].x)*position/100.0;
+ p2.y = (points[i].y-quad[0].y)*position/100.0;
+ pp2.x = (points[ii].x-quad[0].x)*position/100.0;
+ pp2.y = (points[ii].y-quad[0].y)*position/100.0;
+ if (control != 50) {
+ color = gradient->actual_colors[j].mid_rgb;
+ alpha = ZnComposeAlpha(gradient->actual_colors[j].mid_alpha, wi->alpha);
+ p3.x = p.x+(p2.x-p.x)*control/100.0;
+ p3.y = p.y+(p2.y-p.y)*control/100.0;
+ pp3.x = pp.x+(pp2.x-pp.x)*control/100.0;
+ pp3.y = pp.y+(pp2.y-pp.y)*control/100.0;
+ glColor4us(color->red, color->green, color->blue, alpha);
+ glVertex2d(quad[0].x+p3.x, quad[0].y+p3.y);
+ glVertex2d(quad[0].x+pp3.x, quad[0].y+pp3.y);
+ }
+ control = gradient->actual_colors[j+1].control;
+ alpha = ZnComposeAlpha(gradient->actual_colors[j+1].alpha, wi->alpha);
+ color = gradient->actual_colors[j+1].rgb;
+ p = p2;
+ pp = pp2;
+ glColor4us(color->red, color->green, color->blue, alpha);
+ glVertex2d(quad[0].x+p.x, quad[0].y+p.y);
+ glVertex2d(quad[0].x+pp.x, quad[0].y+pp.y);
+ }
+ glEnd();
}
}
}
else if (type == ZN_CONICAL_GRADIENT) {
- ZnReal position;
+ ZnReal position;
unsigned int num_p;
- ZnPoint *genarc, *tarc, p, focalp;
- XColor col;
+ ZnPoint *genarc, *tarc, p, focalp;
+ XColor col;
genarc = ZnGetCirclePoints(3, ZN_CIRCLE_FINEST, 0.0, 2*M_PI, &num_p, NULL);
ZnListAssertSize(ZnWorkPoints, num_p);
@@ -1915,7 +1915,7 @@ ZnRenderGradient(ZnWInfo *wi,
alpha = ZnComposeAlpha(alpha, wi->alpha);
/*printf("position: %g --> color: %d %d %d, alpha: %d\n",
- position, col.red, col.green, col.blue, alpha);*/
+ position, col.red, col.green, col.blue, alpha);*/
glColor4us(col.red, col.green, col.blue, alpha);
glVertex2d(tarc[i].x, tarc[i].y);
@@ -1934,11 +1934,11 @@ ZnRenderGradient(ZnWInfo *wi,
void
-ZnRenderHollowDot(ZnWInfo *wi,
- ZnPoint *p,
- ZnReal size)
+ZnRenderHollowDot(ZnWInfo *wi,
+ ZnPoint *p,
+ ZnReal size)
{
- int num_clips = ZnListSize(wi->clip_stack);
+ int num_clips = ZnListSize(wi->clip_stack);
ZnGlStartClip(num_clips, False);
@@ -1967,8 +1967,8 @@ ZnRenderHollowDot(ZnWInfo *wi,
#ifdef GL
void
-ZnRenderGlyph(ZnTexFontInfo *tfi,
- int c)
+ZnRenderGlyph(ZnTexFontInfo *tfi,
+ int c)
{
ZnTexGVI *tgvi;
@@ -1977,9 +1977,9 @@ ZnRenderGlyph(ZnTexFontInfo *tfi,
return;
}
/*printf("%c --> x0,y0: %d %d, tx0,ty0: %g %g, x1,y1: %d %d, tx1,ty1: %g %g, advance: %g\n",
- c, tgvi->v0x, tgvi->v0y, tgvi->t0x, tgvi->t0y,
- tgvi->v1x, tgvi->v1y, tgvi->t1x, tgvi->t1y,
- tgvi->advance);*/
+ c, tgvi->v0x, tgvi->v0y, tgvi->t0x, tgvi->t0y,
+ tgvi->v1x, tgvi->v1y, tgvi->t1x, tgvi->t1y,
+ tgvi->advance);*/
glBegin(GL_QUADS);
glTexCoord2f(tgvi->t0x, tgvi->t0y); glVertex2s(tgvi->v0x, tgvi->v0y);
glTexCoord2f(tgvi->t0x, tgvi->t1y); glVertex2s(tgvi->v0x, tgvi->v1y);
@@ -1991,9 +1991,9 @@ ZnRenderGlyph(ZnTexFontInfo *tfi,
#ifdef PTK_800
void
-ZnRenderString(ZnTexFontInfo *tfi,
- unsigned char *string,
- unsigned int len)
+ZnRenderString(ZnTexFontInfo *tfi,
+ unsigned char *string,
+ unsigned int len)
{
while (len) {
ZnRenderGlyph(tfi, *string);
@@ -2003,12 +2003,12 @@ ZnRenderString(ZnTexFontInfo *tfi,
}
#else
void
-ZnRenderString(ZnTexFontInfo *tfi,
- unsigned char *string,
- unsigned int len)
+ZnRenderString(ZnTexFontInfo *tfi,
+ unsigned char *string,
+ unsigned int len)
{
- unsigned int clen;
- Tcl_UniChar c;
+ unsigned int clen;
+ Tcl_UniChar c;
while (len) {
clen = Tcl_UtfToUniChar(string, &c);
@@ -2026,37 +2026,37 @@ ZnRenderString(ZnTexFontInfo *tfi,
**********************************************************************************
*
* RenderTriangle --
- * This routine maps an image onto a triangle.
- * Image coordinates are chosen for each vertex of the triangle.
- * A simple affine tex mapping is used as in Zinc there is no way
- * to specify perspective deformation. No filtering is attempted
- * on the output pixels.
+ * This routine maps an image onto a triangle.
+ * Image coordinates are chosen for each vertex of the triangle.
+ * A simple affine tex mapping is used as in Zinc there is no way
+ * to specify perspective deformation. No filtering is attempted
+ * on the output pixels.
*
- * In the comments below u and v are image coordinates and x and
- * y are triangle coordinates.
- * RenderAffineScanline is an helper function that draws a whole
- * scan line to the image with linear interpolation.
+ * In the comments below u and v are image coordinates and x and
+ * y are triangle coordinates.
+ * RenderAffineScanline is an helper function that draws a whole
+ * scan line to the image with linear interpolation.
*
**********************************************************************************
*/
static void
-RenderAffineScanline(XImage *image,
- XImage *mapped_image,
- ZnReal x1,
- ZnReal x2,
- ZnReal u1,
- ZnReal u2,
- ZnReal v1,
- ZnReal v2,
- int y)
+RenderAffineScanline(XImage *image,
+ XImage *mapped_image,
+ ZnReal x1,
+ ZnReal x2,
+ ZnReal u1,
+ ZnReal u2,
+ ZnReal v1,
+ ZnReal v2,
+ int y)
{
- ZnReal du, dv, width;
- int intx1, intx2, intu, intv;
- int i;
+ ZnReal du, dv, width;
+ int intx1, intx2, intu, intv;
+ int i;
/* Revert span ends if needed */
if (x2 < x1) {
- ZnReal tmp;
+ ZnReal tmp;
tmp = x1; x1 = x2; x2 = tmp;
tmp = u1; u1 = u2; u2 = tmp;
tmp = v1; v1 = v2; v2 = tmp;
@@ -2085,22 +2085,22 @@ RenderAffineScanline(XImage *image,
}
static void
-RenderTriangle(XImage *image,
- XImage *mapped_image,
- ZnPoint *tri,
- ZnPoint *im_coords)
+RenderTriangle(XImage *image,
+ XImage *mapped_image,
+ ZnPoint *tri,
+ ZnPoint *im_coords)
{
- ZnReal dx_A, dx_B; /* Interpolation factor in x / y */
- ZnReal du_A, du_B; /* in u / y */
- ZnReal dv_A, dv_B; /* in v / y */
- ZnReal x1, x2; /* Span in x */
- ZnReal u1, u2; /* Span in u */
- ZnReal v1, v2; /* Span in v */
- int height_A; /* Scan line # from top top vertex A */
- int height_B; /* Scan line # from top top vertex B */
- int y; /* Current scan line */
- int top, a, b; /* Top triangle vertex and other two */
- int i;
+ ZnReal dx_A, dx_B; /* Interpolation factor in x / y */
+ ZnReal du_A, du_B; /* in u / y */
+ ZnReal dv_A, dv_B; /* in v / y */
+ ZnReal x1, x2; /* Span in x */
+ ZnReal u1, u2; /* Span in u */
+ ZnReal v1, v2; /* Span in v */
+ int height_A; /* Scan line # from top top vertex A */
+ int height_B; /* Scan line # from top top vertex B */
+ int y; /* Current scan line */
+ int top, a, b; /* Top triangle vertex and other two */
+ int i;
/* Find top vertex and deduce the others. */
top = 0;
@@ -2160,16 +2160,16 @@ RenderTriangle(XImage *image,
* encountered a vertex (A or B) and we are starting conversion
* along a new edge. Update the parameters before proceeding. */
if (!height_A) {
- int na = (a+1)%3;
+ int na = (a+1)%3;
height_A = ZnNearestInt(tri[na].y - tri[a].y);
if (height_A) {
- dx_A = (tri[na].x - tri[a].x) / height_A;
- du_A = (im_coords[na].x - im_coords[a].x) / height_A;
- dv_A = (im_coords[na].y - im_coords[a].y) / height_A;
+ dx_A = (tri[na].x - tri[a].x) / height_A;
+ du_A = (im_coords[na].x - im_coords[a].x) / height_A;
+ dv_A = (im_coords[na].y - im_coords[a].y) / height_A;
}
else {
- dx_A = du_A = dv_A = 0;
+ dx_A = du_A = dv_A = 0;
}
x1 = tri[a].x;
u1 = im_coords[a].x;
@@ -2180,18 +2180,18 @@ RenderTriangle(XImage *image,
}
if (!height_B) {
- int nb = b - 1;
+ int nb = b - 1;
if (nb < 0)
- nb = 2;
+ nb = 2;
height_B = ZnNearestInt(tri[nb].y - tri[b].y);
if (height_B) {
- dx_B = (tri[nb].x - tri[b].x) / height_B;
- du_B = (im_coords[nb].x - im_coords[b].x) / height_B;
- dv_B = (im_coords[nb].y - im_coords[b].y) / height_B;
+ dx_B = (tri[nb].x - tri[b].x) / height_B;
+ du_B = (im_coords[nb].x - im_coords[b].x) / height_B;
+ dv_B = (im_coords[nb].y - im_coords[b].y) / height_B;
}
else {
- dx_B = du_B = dv_B = 0;
+ dx_B = du_B = dv_B = 0;
}
x2 = tri[b].x;
u2 = im_coords[b].x;
@@ -2208,29 +2208,29 @@ RenderTriangle(XImage *image,
**********************************************************************************
*
* MapImage --
- * This procedure maps an image on a parallelogram given in poly.
- * The given parallelogram should fit in the destination image.
- * The parallelogram vertices must be ordered as for a triangle
- * strip:
+ * This procedure maps an image on a parallelogram given in poly.
+ * The given parallelogram should fit in the destination image.
+ * The parallelogram vertices must be ordered as for a triangle
+ * strip:
*
* v0 ------------ v2
* | |
* | |
* v1 ------------ v3
*
- * The mapping is done by a simple affine mapping of the image on the
- * two triangles obtained by cutting the parallelogram along the diogonal
- * from the second vertex to the third vertex.
+ * The mapping is done by a simple affine mapping of the image on the
+ * two triangles obtained by cutting the parallelogram along the diogonal
+ * from the second vertex to the third vertex.
*
**********************************************************************************
*/
void
-ZnMapImage(XImage *image,
- XImage *mapped_image,
- ZnPoint *poly)
+ZnMapImage(XImage *image,
+ XImage *mapped_image,
+ ZnPoint *poly)
{
- ZnPoint triangle[3];
- ZnPoint im_coords[3];
+ ZnPoint triangle[3];
+ ZnPoint im_coords[3];
triangle[0] = poly[0];
triangle[1] = poly[1];
diff --git a/generic/Draw.h b/generic/Draw.h
index 0ba10b2..805d506 100644
--- a/generic/Draw.h
+++ b/generic/Draw.h
@@ -1,8 +1,8 @@
/*
* Draw.h -- Header for common drawing routines.
*
- * Authors : Patrick Lecoanet.
- * Creation date : Sat Dec 10 12:51:30 1994
+ * Authors : Patrick Lecoanet.
+ * Creation date : Sat Dec 10 12:51:30 1994
*
* $Id$
*/
@@ -37,7 +37,7 @@
#include "Image.h"
-#define ZN_LINE_SHAPE_POINTS 4 /* Maximum of all *_SHAPE_POINTS */
+#define ZN_LINE_SHAPE_POINTS 4 /* Maximum of all *_SHAPE_POINTS */
struct _ZnWInfo;
@@ -79,45 +79,45 @@ struct _ZnWInfo;
void ZnSetLineStyle(struct _ZnWInfo *wi, ZnLineStyle line_style);
void ZnLineShapePoints(ZnPoint *p1, ZnPoint *p2, ZnDim line_width,
- ZnLineShape shape, ZnBBox *bbox, ZnList to_points);
+ ZnLineShape shape, ZnBBox *bbox, ZnList to_points);
void ZnDrawLineShape(struct _ZnWInfo *wi, ZnPoint *points, unsigned int num_points,
- ZnLineStyle line_style, int foreground_pixel,
- ZnDim line_width, ZnLineShape shape);
+ ZnLineStyle line_style, int foreground_pixel,
+ ZnDim line_width, ZnLineShape shape);
void
ZnGetLineEnd(ZnPoint *p1, ZnPoint *p2, ZnDim line_width,
- int cap_style, ZnLineEnd end_style, ZnPoint *points);
+ int cap_style, ZnLineEnd end_style, ZnPoint *points);
int ZnPolygonReliefInBBox(ZnPoint *points, unsigned int num_points,
- ZnDim line_width, ZnBBox *bbox);
+ ZnDim line_width, ZnBBox *bbox);
void ZnGetPolygonReliefBBox(ZnPoint *points, unsigned int num_points,
- ZnDim line_width, ZnBBox *bbox);
+ ZnDim line_width, ZnBBox *bbox);
double ZnPolygonReliefToPointDist(ZnPoint *points, unsigned int num_points,
- ZnDim line_width, ZnPoint *pp);
+ ZnDim line_width, ZnPoint *pp);
void ZnDrawRectangleRelief(struct _ZnWInfo *wi,
- ZnReliefStyle relief, ZnGradient *gradient,
- XRectangle *bbox, ZnDim line_width);
+ ZnReliefStyle relief, ZnGradient *gradient,
+ XRectangle *bbox, ZnDim line_width);
void ZnDrawPolygonRelief(struct _ZnWInfo *wi, ZnReliefStyle relief,
- ZnGradient *gradient, ZnPoint *points,
- unsigned int num_points, ZnDim line_width);
+ ZnGradient *gradient, ZnPoint *points,
+ unsigned int num_points, ZnDim line_width);
#ifdef GL
void ZnRenderPolygonRelief(struct _ZnWInfo *wi, ZnReliefStyle relief,
- ZnGradient *gradient, ZnBool smooth,
- ZnPoint *points, unsigned int num_points, ZnDim line_width);
+ ZnGradient *gradient, ZnBool smooth,
+ ZnPoint *points, unsigned int num_points, ZnDim line_width);
void ZnRenderPolyline(struct _ZnWInfo *wi, ZnPoint *points, unsigned int num_points,
- ZnDim line_width, ZnLineStyle line_style, int cap_style,
- int join_style, ZnLineEnd first_end, ZnLineEnd last_end,
- ZnGradient *gradient);
+ ZnDim line_width, ZnLineStyle line_style, int cap_style,
+ int join_style, ZnLineEnd first_end, ZnLineEnd last_end,
+ ZnGradient *gradient);
void ZnComputeGradient(ZnGradient *grad, struct _ZnWInfo *wi, ZnPoly *shape,
- ZnPoint *grad_geo);
+ ZnPoint *grad_geo);
void ZnRenderGradient(struct _ZnWInfo *wi, ZnGradient *gradient,
- void (*cb)(void *), void *closure, ZnPoint *quad,
- ZnPoly *poly);
+ void (*cb)(void *), void *closure, ZnPoint *quad,
+ ZnPoly *poly);
void ZnRenderTile(struct _ZnWInfo *wi, ZnImage tile, ZnGradient *gradient,
- void (*cb)(void *), void *closure, ZnPoint *quad);
+ void (*cb)(void *), void *closure, ZnPoint *quad);
void ZnRenderIcon(struct _ZnWInfo *wi, ZnImage image, ZnGradient *gradient,
- ZnPoint *origin, ZnBool modulate);
+ ZnPoint *origin, ZnBool modulate);
void ZnRenderImage(struct _ZnWInfo *wi, ZnImage image, ZnGradient *gradient,
- ZnPoint *quad, ZnBool modulate);
+ ZnPoint *quad, ZnBool modulate);
void RenderHollowDot(struct _ZnWInfo *wi, ZnPoint *p, ZnReal size);
void ZnRenderGlyph(ZnTexFontInfo *tfi, int c);
@@ -127,4 +127,4 @@ void ZnRenderString(ZnTexFontInfo *tfi, unsigned char *str, unsigned int len);
void ZnMapImage(XImage *image, XImage *mapped_image, ZnPoint *poly);
-#endif /* _Draw_h */
+#endif /* _Draw_h */
diff --git a/generic/Field.c b/generic/Field.c
index 5ff53e0..9519d67 100644
--- a/generic/Field.c
+++ b/generic/Field.c
@@ -1,8 +1,8 @@
/*
* Field.c -- Implementation of fields.
*
- * Authors : Patrick Lecoanet.
- * Creation date :
+ * Authors : Patrick Lecoanet.
+ * Creation date :
*
* $Id$
*/
@@ -42,11 +42,11 @@ static const char rcsid[] = "$Id$";
static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ " $";
-#define FIELD_SENSITIVE_BIT 1
-#define FIELD_VISIBLE_BIT 2
-#define FILLED_BIT 4
-#define TEXT_ON_TOP_BIT 8
-#define CACHE_OK 16
+#define FIELD_SENSITIVE_BIT 1
+#define FIELD_VISIBLE_BIT 2
+#define FILLED_BIT 4
+#define TEXT_ON_TOP_BIT 8
+#define CACHE_OK 16
/*
@@ -54,30 +54,30 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ "
*/
typedef struct _FieldStruct {
/* Public data */
- ZnGradient *color;
- ZnGradient *fill_color;
- ZnGradient *border_color;
- char *text;
- ZnImage image;
- ZnImage tile;
- Tk_Font font;
+ ZnGradient *color;
+ ZnGradient *fill_color;
+ ZnGradient *border_color;
+ char *text;
+ ZnImage image;
+ ZnImage tile;
+ Tk_Font font;
unsigned short flags;
- ZnBorder border_edges;
- Tk_Justify alignment;
- ZnReliefStyle relief;
- ZnDim relief_thickness;
- ZnAutoAlign auto_alignment;
+ ZnBorder border_edges;
+ Tk_Justify alignment;
+ ZnReliefStyle relief;
+ ZnDim relief_thickness;
+ ZnAutoAlign auto_alignment;
/* Private data */
- ZnGradient *gradient;
- ZnPoint *grad_geo;
- short orig_x;
- short orig_y;
- short corner_x;
- short corner_y;
- int insert_index;
+ ZnGradient *gradient;
+ ZnPoint *grad_geo;
+ short orig_x;
+ short orig_y;
+ short corner_x;
+ short corner_y;
+ int insert_index;
#ifdef GL
- ZnTexFontInfo *tfi;
+ ZnTexFontInfo *tfi;
#endif
} FieldStruct, *Field;
@@ -87,7 +87,7 @@ typedef struct _FieldStruct {
* -filled attributes set the ZN_COORDS_FLAG to update
* the leader that might protude if not clipped by the text.
*/
-ZnAttrConfig field_attrs[] = {
+ZnAttrConfig field_attrs[] = {
{ ZN_CONFIG_ALIGNMENT, "-alignment", NULL,
Tk_Offset(FieldStruct, alignment), 0, ZN_DRAW_FLAG, False },
{ ZN_CONFIG_AUTO_ALIGNMENT, "-autoalignment", NULL,
@@ -128,7 +128,7 @@ ZnAttrConfig field_attrs[] = {
{ ZN_CONFIG_END, NULL, NULL, 0, 0, 0, False }
};
-static void GetLabelBBox(ZnFieldSet field_set, ZnDim *w, ZnDim *h);
+static void GetLabelBBox(ZnFieldSet field_set, ZnDim *w, ZnDim *h);
@@ -136,23 +136,23 @@ static void GetLabelBBox(ZnFieldSet field_set, ZnDim *w, ZnDim *h);
**********************************************************************************
*
* ComputeFieldAttachment --
- * Compute the location/size of the field, computing attachments if any.
+ * Compute the location/size of the field, computing attachments if any.
*
**********************************************************************************
*/
static void
-ComputeFieldAttachment(ZnFieldSet field_set,
- unsigned int field,
- ZnBBox *field_bbox)
+ComputeFieldAttachment(ZnFieldSet field_set,
+ unsigned int field,
+ ZnBBox *field_bbox)
{
- ZnBBox ref_bbox;
- ZnDim real_width, real_height;
- unsigned int ref_field, num_fields;
- char x_attach, y_attach, x_dim, y_dim;
- short width_spec, height_spec;
- int x_spec, y_spec, icon_width=0, icon_height=0;
- Field fptr;
+ ZnBBox ref_bbox;
+ ZnDim real_width, real_height;
+ unsigned int ref_field, num_fields;
+ char x_attach, y_attach, x_dim, y_dim;
+ short width_spec, height_spec;
+ int x_spec, y_spec, icon_width=0, icon_height=0;
+ Field fptr;
Tk_FontMetrics fm;
/*printf("ComputeFieldAttachment in\n");*/
@@ -178,8 +178,8 @@ ComputeFieldAttachment(ZnFieldSet field_set,
num_fields = ZnLFNumFields(field_set->label_format);
ZnLFGetField(field_set->label_format, field,
- &x_attach, &y_attach, &x_dim, &y_dim,
- &x_spec, &y_spec, &width_spec, &height_spec);
+ &x_attach, &y_attach, &x_dim, &y_dim,
+ &x_spec, &y_spec, &width_spec, &height_spec);
/*
* First try to compute the field size which may be a factor
@@ -200,29 +200,29 @@ ComputeFieldAttachment(ZnFieldSet field_set,
break;
case ZN_LF_DIM_AUTO:
{
- int len = 0;
- ZnDim text_width;
+ int len = 0;
+ ZnDim text_width;
if (fptr->text) {
- len = strlen(fptr->text);
+ len = strlen(fptr->text);
}
real_width = 0.0;
if (fptr->image != ZnUnspecifiedImage) {
- real_width = (ZnDim) icon_width;
+ real_width = (ZnDim) icon_width;
}
if (len) {
- /*
- * The 4 extra pixels are needed for border and padding.
- */
- text_width = (ZnDim) Tk_TextWidth(fptr->font, fptr->text, len) + 4;
- real_width = text_width < real_width ? real_width : text_width;
+ /*
+ * The 4 extra pixels are needed for border and padding.
+ */
+ text_width = (ZnDim) Tk_TextWidth(fptr->font, fptr->text, len) + 4;
+ real_width = text_width < real_width ? real_width : text_width;
}
real_width += (ZnDim) width_spec;
break;
}
case ZN_LF_DIM_LABEL:
{
- ZnDim lh;
+ ZnDim lh;
GetLabelBBox(field_set, &real_width, &lh);
break;
@@ -246,23 +246,23 @@ ComputeFieldAttachment(ZnFieldSet field_set,
break;
case ZN_LF_DIM_AUTO:
{
- ZnDim text_height;
+ ZnDim text_height;
real_height = 0.0;
if (fptr->image != ZnUnspecifiedImage) {
- real_height = (ZnDim) icon_height;
+ real_height = (ZnDim) icon_height;
}
if (fptr->text && strlen(fptr->text)) {
- Tk_GetFontMetrics(fptr->font, &fm);
- text_height = (ZnDim) (fm.ascent + fm.descent);
- real_height = text_height < real_height ? real_height : text_height;
+ Tk_GetFontMetrics(fptr->font, &fm);
+ text_height = (ZnDim) (fm.ascent + fm.descent);
+ real_height = text_height < real_height ? real_height : text_height;
}
real_height += (ZnDim) height_spec;
break;
}
case ZN_LF_DIM_LABEL:
{
- ZnDim lw;
+ ZnDim lw;
GetLabelBBox(field_set, &lw, &real_height);
break;
@@ -300,43 +300,43 @@ ComputeFieldAttachment(ZnFieldSet field_set,
ref_field = x_spec;
field_bbox->orig.x = field_bbox->corner.x = 0;
if (ref_field >= num_fields) {
- ZnWarning ("Attached (x) to an inexistant field geometry\n");
+ ZnWarning ("Attached (x) to an inexistant field geometry\n");
}
else {
- ComputeFieldAttachment(field_set, ref_field, &ref_bbox);
- switch (x_attach) {
- case ZN_LF_ATTACH_FWD:
- if (ISSET(field_set->fields[ref_field].flags, FIELD_VISIBLE_BIT)) {
- field_bbox->orig.x = ref_bbox.corner.x;
- }
- else {
- field_bbox->orig.x = ref_bbox.orig.x;
- }
- field_bbox->corner.x = field_bbox->orig.x + real_width;
- break;
- case ZN_LF_ATTACH_BWD:
- if (ISSET(field_set->fields[ref_field].flags, FIELD_VISIBLE_BIT)) {
- field_bbox->corner.x = ref_bbox.orig.x;
- }
- else {
- field_bbox->corner.x = ref_bbox.corner.x;
- }
- field_bbox->orig.x = field_bbox->corner.x - real_width;
- break;
- case ZN_LF_ATTACH_LEFT:
- field_bbox->orig.x = ref_bbox.orig.x;
- field_bbox->corner.x = field_bbox->orig.x + real_width;
- break;
- case ZN_LF_ATTACH_RIGHT:
- if (ISSET(field_set->fields[ref_field].flags, FIELD_VISIBLE_BIT)) {
- field_bbox->corner.x = ref_bbox.corner.x;
- }
- else {
- field_bbox->corner.x = ref_bbox.orig.x;
- }
- field_bbox->orig.x = field_bbox->corner.x - real_width;
- break;
- }
+ ComputeFieldAttachment(field_set, ref_field, &ref_bbox);
+ switch (x_attach) {
+ case ZN_LF_ATTACH_FWD:
+ if (ISSET(field_set->fields[ref_field].flags, FIELD_VISIBLE_BIT)) {
+ field_bbox->orig.x = ref_bbox.corner.x;
+ }
+ else {
+ field_bbox->orig.x = ref_bbox.orig.x;
+ }
+ field_bbox->corner.x = field_bbox->orig.x + real_width;
+ break;
+ case ZN_LF_ATTACH_BWD:
+ if (ISSET(field_set->fields[ref_field].flags, FIELD_VISIBLE_BIT)) {
+ field_bbox->corner.x = ref_bbox.orig.x;
+ }
+ else {
+ field_bbox->corner.x = ref_bbox.corner.x;
+ }
+ field_bbox->orig.x = field_bbox->corner.x - real_width;
+ break;
+ case ZN_LF_ATTACH_LEFT:
+ field_bbox->orig.x = ref_bbox.orig.x;
+ field_bbox->corner.x = field_bbox->orig.x + real_width;
+ break;
+ case ZN_LF_ATTACH_RIGHT:
+ if (ISSET(field_set->fields[ref_field].flags, FIELD_VISIBLE_BIT)) {
+ field_bbox->corner.x = ref_bbox.corner.x;
+ }
+ else {
+ field_bbox->corner.x = ref_bbox.orig.x;
+ }
+ field_bbox->orig.x = field_bbox->corner.x - real_width;
+ break;
+ }
}
}
/*printf("field %d, x = %g\n", field, field_bbox->orig.x);*/
@@ -354,43 +354,43 @@ ComputeFieldAttachment(ZnFieldSet field_set,
ref_field = y_spec;
field_bbox->orig.y = field_bbox->corner.y = 0;
if (ref_field >= num_fields) {
- ZnWarning ("Attached (y) to an inexistant field geometry\n");
+ ZnWarning ("Attached (y) to an inexistant field geometry\n");
}
else {
- ComputeFieldAttachment(field_set, ref_field, &ref_bbox);
- switch (y_attach) {
- case ZN_LF_ATTACH_FWD:
- if (ISSET(field_set->fields[ref_field].flags, FIELD_VISIBLE_BIT)) {
- field_bbox->orig.y = ref_bbox.corner.y;
- }
- else {
- field_bbox->orig.y = ref_bbox.orig.y;
- }
- field_bbox->corner.y = field_bbox->orig.y + real_height;
- break;
- case ZN_LF_ATTACH_BWD:
- if (ISSET(field_set->fields[ref_field].flags, FIELD_VISIBLE_BIT)) {
- field_bbox->corner.y = ref_bbox.orig.y;
- }
- else {
- field_bbox->corner.y = ref_bbox.corner.y;
- }
- field_bbox->orig.y = field_bbox->corner.y - real_height;
- break;
- case ZN_LF_ATTACH_LEFT:
- field_bbox->orig.y = ref_bbox.orig.y;
- field_bbox->corner.y = field_bbox->orig.y + real_height;
- break;
- case ZN_LF_ATTACH_RIGHT:
- if (ISSET(field_set->fields[ref_field].flags, FIELD_VISIBLE_BIT)) {
- field_bbox->corner.y = ref_bbox.corner.y;
- }
- else {
- field_bbox->corner.y = ref_bbox.orig.y;
- }
- field_bbox->orig.y = field_bbox->corner.y - real_height;
- break;
- }
+ ComputeFieldAttachment(field_set, ref_field, &ref_bbox);
+ switch (y_attach) {
+ case ZN_LF_ATTACH_FWD:
+ if (ISSET(field_set->fields[ref_field].flags, FIELD_VISIBLE_BIT)) {
+ field_bbox->orig.y = ref_bbox.corner.y;
+ }
+ else {
+ field_bbox->orig.y = ref_bbox.orig.y;
+ }
+ field_bbox->corner.y = field_bbox->orig.y + real_height;
+ break;
+ case ZN_LF_ATTACH_BWD:
+ if (ISSET(field_set->fields[ref_field].flags, FIELD_VISIBLE_BIT)) {
+ field_bbox->corner.y = ref_bbox.orig.y;
+ }
+ else {
+ field_bbox->corner.y = ref_bbox.corner.y;
+ }
+ field_bbox->orig.y = field_bbox->corner.y - real_height;
+ break;
+ case ZN_LF_ATTACH_LEFT:
+ field_bbox->orig.y = ref_bbox.orig.y;
+ field_bbox->corner.y = field_bbox->orig.y + real_height;
+ break;
+ case ZN_LF_ATTACH_RIGHT:
+ if (ISSET(field_set->fields[ref_field].flags, FIELD_VISIBLE_BIT)) {
+ field_bbox->corner.y = ref_bbox.corner.y;
+ }
+ else {
+ field_bbox->corner.y = ref_bbox.orig.y;
+ }
+ field_bbox->orig.y = field_bbox->corner.y - real_height;
+ break;
+ }
}
}
/*printf("field %d, y = %g\n", field, field_bbox->orig.y);*/
@@ -410,21 +410,21 @@ ComputeFieldAttachment(ZnFieldSet field_set,
**********************************************************************************
*
* ClearFieldCache --
- * Reset the geometric cache of all fields depending on a given field (or
- * of all fields if the field is < 0). Clear also the label bounding box
- * cache if some action has been taken on a field.
+ * Reset the geometric cache of all fields depending on a given field (or
+ * of all fields if the field is < 0). Clear also the label bounding box
+ * cache if some action has been taken on a field.
*
**********************************************************************************
*/
static void
-ClearFieldCache(ZnFieldSet field_set,
- int field)
+ClearFieldCache(ZnFieldSet field_set,
+ int field)
{
- unsigned int i, num_fields;
- ZnBool clear_bbox;
- int x_spec, y_spec;
- char x_attach, y_attach, x_dim, y_dim;
- short width_spec, height_spec;
+ unsigned int i, num_fields;
+ ZnBool clear_bbox;
+ int x_spec, y_spec;
+ char x_attach, y_attach, x_dim, y_dim;
+ short width_spec, height_spec;
if (!field_set->num_fields) {
return;
@@ -446,31 +446,31 @@ ClearFieldCache(ZnFieldSet field_set,
return;
}
ZnLFGetField(field_set->label_format, (unsigned int) field,
- &x_attach, &y_attach, &x_dim, &y_dim,
- &x_spec, &y_spec, &width_spec, &height_spec);
+ &x_attach, &y_attach, &x_dim, &y_dim,
+ &x_spec, &y_spec, &width_spec, &height_spec);
if ((x_dim != ZN_LF_DIM_PIXEL) || (y_dim != ZN_LF_DIM_PIXEL)) {
CLEAR(field_set->fields[field].flags, CACHE_OK);
clear_bbox = True;
}
for (i = 0; i < num_fields; i++) {
ZnLFGetField(field_set->label_format, i,
- &x_attach, &y_attach, &x_dim, &y_dim,
- &x_spec, &y_spec, &width_spec, &height_spec);
+ &x_attach, &y_attach, &x_dim, &y_dim,
+ &x_spec, &y_spec, &width_spec, &height_spec);
if ((x_attach == ZN_LF_ATTACH_PIXEL) && (y_attach == ZN_LF_ATTACH_PIXEL)) {
continue;
}
if (x_attach != ZN_LF_ATTACH_PIXEL) {
if ((x_spec == field) && ISSET(field_set->fields[i].flags, CACHE_OK)) {
- CLEAR(field_set->fields[i].flags, CACHE_OK);
- ClearFieldCache(field_set, (int) i);
- clear_bbox = True;
+ CLEAR(field_set->fields[i].flags, CACHE_OK);
+ ClearFieldCache(field_set, (int) i);
+ clear_bbox = True;
}
}
if (y_attach != ZN_LF_ATTACH_PIXEL) {
if ((y_spec == field) && ISSET(field_set->fields[i].flags, CACHE_OK)) {
- CLEAR(field_set->fields[i].flags, CACHE_OK);
- ClearFieldCache(field_set, (int) i);
- clear_bbox = True;
+ CLEAR(field_set->fields[i].flags, CACHE_OK);
+ ClearFieldCache(field_set, (int) i);
+ clear_bbox = True;
}
}
}
@@ -489,14 +489,14 @@ ClearFieldCache(ZnFieldSet field_set,
**********************************************************************************
*/
static void
-GetLabelBBox(ZnFieldSet field_set,
- ZnDim *w,
- ZnDim *h)
+GetLabelBBox(ZnFieldSet field_set,
+ ZnDim *w,
+ ZnDim *h)
{
- ZnBBox bbox, tmp_bbox;
- ZnLabelFormat lf;
- unsigned int i, num_fields;
- ZnDim clip_w, clip_h;
+ ZnBBox bbox, tmp_bbox;
+ ZnLabelFormat lf;
+ unsigned int i, num_fields;
+ ZnDim clip_w, clip_h;
/*printf("GetLabelBBox in\n");*/
if ((field_set->label_width >= 0.0) && (field_set->label_height >= 0.0)) {
@@ -525,7 +525,7 @@ GetLabelBBox(ZnFieldSet field_set,
field_set->label_height = bbox.corner.y;
/*printf("GetLabelBBox size before clipping; w = %g, h = %g\n",
- field_set->label_width, field_set->label_height);*/
+ field_set->label_width, field_set->label_height);*/
if (ZnLFGetClipBox(lf, &clip_w, &clip_h)) {
if (clip_w < field_set->label_width) {
field_set->label_width = clip_w;
@@ -545,17 +545,17 @@ GetLabelBBox(ZnFieldSet field_set,
**********************************************************************************
*
* GetFieldBBox --
- * Compute the location of the field described
- * by the field entry index in the item current LabelFormat.
+ * Compute the location of the field described
+ * by the field entry index in the item current LabelFormat.
*
**********************************************************************************
*/
static void
-GetFieldBBox(ZnFieldSet field_set,
- unsigned int index,
- ZnBBox *field_bbox)
+GetFieldBBox(ZnFieldSet field_set,
+ unsigned int index,
+ ZnBBox *field_bbox)
{
- ZnReal ox, oy;
+ ZnReal ox, oy;
/*printf("GetFieldBBox in\n");*/
if (field_set->label_format) {
@@ -578,20 +578,20 @@ GetFieldBBox(ZnFieldSet field_set,
**********************************************************************************
*
* ComputeFieldTextLocation --
- * Compute the position of the text in a field. This is a position
- * that we can give to XDrawText. The position is deduced from the
- * field bounding box passed in bbox.
- * Return also the text bounding box.
+ * Compute the position of the text in a field. This is a position
+ * that we can give to XDrawText. The position is deduced from the
+ * field bounding box passed in bbox.
+ * Return also the text bounding box.
*
**********************************************************************************
*/
static void
-ComputeFieldTextLocation(Field fptr,
- ZnBBox *bbox,
- ZnPoint *pos,
- ZnBBox *text_bbox)
+ComputeFieldTextLocation(Field fptr,
+ ZnBBox *bbox,
+ ZnPoint *pos,
+ ZnBBox *text_bbox)
{
- ZnDim w, h;
+ ZnDim w, h;
Tk_FontMetrics fm;
Tk_GetFontMetrics(fptr->font, &fm);
@@ -624,30 +624,30 @@ ComputeFieldTextLocation(Field fptr,
**********************************************************************************
*
* LeaderToLabel --
- * Compute the segment part of segment <start, end> that lies
- * outside the fields of item.
+ * Compute the segment part of segment <start, end> that lies
+ * outside the fields of item.
*
**********************************************************************************
*/
static void
-LeaderToLabel(ZnFieldSet field_set,
- ZnPoint *start,
- ZnPoint *end)
+LeaderToLabel(ZnFieldSet field_set,
+ ZnPoint *start,
+ ZnPoint *end)
{
- int b_num;
- ZnPoint delta, inf, sup;
- ZnPos xt=0, yu=0, yw=0, xv=0;
- Field fptr;
- unsigned int i;
- ZnBBox field_bbox;
-
- /* Intersection points : */
- /* T |xt / delta_y U |x1 V |y1 W |yw / delta_x */
- /* |y2 |yu / delta_x |xv / delta_y |x2 */
- /* */
- /* y = ax + b; */
- /* a = delta_y / delta_x */
- /* b = (y * delta_x - x * delta_y) / delta_x */
+ int b_num;
+ ZnPoint delta, inf, sup;
+ ZnPos xt=0, yu=0, yw=0, xv=0;
+ Field fptr;
+ unsigned int i;
+ ZnBBox field_bbox;
+
+ /* Intersection points : */
+ /* T |xt / delta_y U |x1 V |y1 W |yw / delta_x */
+ /* |y2 |yu / delta_x |xv / delta_y |x2 */
+ /* */
+ /* y = ax + b; */
+ /* a = delta_y / delta_x */
+ /* b = (y * delta_x - x * delta_y) / delta_x */
delta.x = start->x - end->x;
delta.y = start->y - end->y;
@@ -660,11 +660,11 @@ LeaderToLabel(ZnFieldSet field_set,
* its own, don't clip.
*/
if (ISCLEAR(fptr->flags, FIELD_VISIBLE_BIT) ||
- (!fptr->text &&
- ISCLEAR(fptr->flags, FILLED_BIT) &&
- (fptr->border_edges == ZN_NO_BORDER) &&
- (fptr->relief == ZN_RELIEF_FLAT) &&
- (fptr->image == ZnUnspecifiedImage))) {
+ (!fptr->text &&
+ ISCLEAR(fptr->flags, FILLED_BIT) &&
+ (fptr->border_edges == ZN_NO_BORDER) &&
+ (fptr->relief == ZN_RELIEF_FLAT) &&
+ (fptr->image == ZnUnspecifiedImage))) {
continue;
}
@@ -678,12 +678,12 @@ LeaderToLabel(ZnFieldSet field_set,
* important when there are leading and trailing spaces.
*/
if (fptr->text &&
- ISCLEAR(fptr->flags, FILLED_BIT) &&
- (fptr->border_edges == ZN_NO_BORDER) &&
- (fptr->relief == ZN_RELIEF_FLAT) &&
- (fptr->image == ZnUnspecifiedImage)) {
+ ISCLEAR(fptr->flags, FILLED_BIT) &&
+ (fptr->border_edges == ZN_NO_BORDER) &&
+ (fptr->relief == ZN_RELIEF_FLAT) &&
+ (fptr->image == ZnUnspecifiedImage)) {
ZnBBox text_bbox;
- ZnPoint text_pos; /* dummy */
+ ZnPoint text_pos; /* dummy */
int space_width;
int scan_forw, scan_back;
space_width = Tk_TextWidth(fptr->font, " ", 1);
@@ -694,7 +694,7 @@ LeaderToLabel(ZnFieldSet field_set,
*
* PLC: IMHO, this is to compensate for exotic fonts like 'symbolesATC'.
* I am not planning to port this to Tk for two reasons:
- * 1/ Current positions are no longer implemented as characters
+ * 1/ Current positions are no longer implemented as characters
* and 2/ Tk does not give access (easily) to lbearings and rbearings.
* This patch has been contributed by Phidias team. I don't know the
* problem it was meant to solve.
@@ -706,23 +706,23 @@ LeaderToLabel(ZnFieldSet field_set,
*/
scan_forw = 0;
while (fptr->text[scan_forw] == ' ') {
- /* leading spaces */
- text_bbox.orig.x += space_width;
- scan_forw++;
+ /* leading spaces */
+ text_bbox.orig.x += space_width;
+ scan_forw++;
}
/*
* Empty text.
*/
if (!fptr->text || (fptr->text[scan_forw] == 0)) {
- continue;
+ continue;
}
scan_back = strlen(fptr->text)-1;
while ((fptr->text[scan_back] == ' ') && (scan_back > scan_forw)) {
- /* trailing spaces */
- text_bbox.corner.x -= space_width;
- scan_back--;
+ /* trailing spaces */
+ text_bbox.corner.x -= space_width;
+ scan_back--;
}
field_bbox = text_bbox;
@@ -733,7 +733,7 @@ LeaderToLabel(ZnFieldSet field_set,
}
if ((start->x >= field_bbox.orig.x) && (start->x < field_bbox.corner.x) &&
- (start->y >= field_bbox.orig.y) && (start->y < field_bbox.corner.y)) {
+ (start->y >= field_bbox.orig.y) && (start->y < field_bbox.corner.y)) {
end->x = start->x;
end->y = start->y;
}
@@ -753,46 +753,46 @@ LeaderToLabel(ZnFieldSet field_set,
if (delta.x) {
if ((yu >= field_bbox.orig.y) && (yu <= field_bbox.corner.y) &&
- (field_bbox.orig.x >= inf.x) && (field_bbox.orig.x <= sup.x) &&
- (yu >= inf.y) && (yu <= sup.y)) {
- end->x = field_bbox.orig.x;
- end->y = yu;
- inf.x = MIN(start->x, end->x);
- sup.x = MAX(start->x, end->x);
- inf.y = MIN(start->y, end->y);
- sup.y = MAX(start->y, end->y);
+ (field_bbox.orig.x >= inf.x) && (field_bbox.orig.x <= sup.x) &&
+ (yu >= inf.y) && (yu <= sup.y)) {
+ end->x = field_bbox.orig.x;
+ end->y = yu;
+ inf.x = MIN(start->x, end->x);
+ sup.x = MAX(start->x, end->x);
+ inf.y = MIN(start->y, end->y);
+ sup.y = MAX(start->y, end->y);
}
if ((yw >= field_bbox.orig.y) && (yw <= field_bbox.corner.y) &&
- (field_bbox.corner.x >= inf.x) && (field_bbox.corner.x <= sup.x) &&
- (yw >= inf.y) && (yw <= sup.y)) {
- end->x = field_bbox.corner.x;
- end->y = yw;
- inf.x = MIN(start->x, end->x);
- sup.x = MAX(start->x, end->x);
- inf.y = MIN(start->y, end->y);
- sup.y = MAX(start->y, end->y);
+ (field_bbox.corner.x >= inf.x) && (field_bbox.corner.x <= sup.x) &&
+ (yw >= inf.y) && (yw <= sup.y)) {
+ end->x = field_bbox.corner.x;
+ end->y = yw;
+ inf.x = MIN(start->x, end->x);
+ sup.x = MAX(start->x, end->x);
+ inf.y = MIN(start->y, end->y);
+ sup.y = MAX(start->y, end->y);
}
}
if (delta.y) {
if ((xt >= field_bbox.orig.x) && (xt <= field_bbox.corner.x) &&
- (xt >= inf.x) && (xt <= sup.x) &&
- (field_bbox.corner.y >= inf.y) && (field_bbox.corner.y <= sup.y)) {
- end->x = xt;
- end->y = field_bbox.corner.y;
- inf.x = MIN(start->x, end->x);
- sup.x = MAX(start->x, end->x);
- inf.y = MIN(start->y, end->y);
- sup.y = MAX(start->y, end->y);
+ (xt >= inf.x) && (xt <= sup.x) &&
+ (field_bbox.corner.y >= inf.y) && (field_bbox.corner.y <= sup.y)) {
+ end->x = xt;
+ end->y = field_bbox.corner.y;
+ inf.x = MIN(start->x, end->x);
+ sup.x = MAX(start->x, end->x);
+ inf.y = MIN(start->y, end->y);
+ sup.y = MAX(start->y, end->y);
}
if ((xv >= field_bbox.orig.x) && (xv <= field_bbox.corner.x) &&
- (xv >= inf.x) && (xv <= sup.x) &&
- (field_bbox.orig.y >= inf.y) && (field_bbox.orig.y <= sup.y)) {
- end->x = xv;
- end->y = field_bbox.orig.y;
- inf.x = MIN(start->x, end->x);
- sup.x = MAX(start->x, end->x);
- inf.y = MIN(start->y, end->y);
- sup.y = MAX(start->y, end->y);
+ (xv >= inf.x) && (xv <= sup.x) &&
+ (field_bbox.orig.y >= inf.y) && (field_bbox.orig.y <= sup.y)) {
+ end->x = xv;
+ end->y = field_bbox.orig.y;
+ inf.x = MIN(start->x, end->x);
+ sup.x = MAX(start->x, end->x);
+ inf.y = MIN(start->y, end->y);
+ sup.y = MAX(start->y, end->y);
}
}
}
@@ -804,17 +804,17 @@ LeaderToLabel(ZnFieldSet field_set,
*
* InitFields --
*
- * Perform the init of each field in a ZnFieldSet. The number of such
- * fields must have been inited before calling this fun.
+ * Perform the init of each field in a ZnFieldSet. The number of such
+ * fields must have been inited before calling this fun.
*
**********************************************************************************
*/
static void
-InitFields(ZnFieldSet field_set)
+InitFields(ZnFieldSet field_set)
{
- ZnWInfo *wi = field_set->item->wi;
- Field field;
- unsigned int i, num_fields;
+ ZnWInfo *wi = field_set->item->wi;
+ Field field;
+ unsigned int i, num_fields;
/*printf("size of a field = %d\n", sizeof(FieldStruct));*/
@@ -865,12 +865,12 @@ InitFields(ZnFieldSet field_set)
**********************************************************************************
*/
static void
-CloneFields(ZnFieldSet field_set)
+CloneFields(ZnFieldSet field_set)
{
- ZnWInfo *wi = field_set->item->wi;
- Field field, fields_ret;
- unsigned int i, num_fields;
- char *text;
+ ZnWInfo *wi = field_set->item->wi;
+ Field field, fields_ret;
+ unsigned int i, num_fields;
+ char *text;
num_fields = field_set->num_fields;
if (!num_fields) {
@@ -924,21 +924,21 @@ CloneFields(ZnFieldSet field_set)
**********************************************************************************
*/
static int
-ConfigureField(ZnFieldSet fs,
- int field,
- int argc,
- Tcl_Obj *CONST argv[],
- int *flags)
+ConfigureField(ZnFieldSet fs,
+ int field,
+ int argc,
+ Tcl_Obj *CONST argv[],
+ int *flags)
{
- unsigned int i;
- Field fptr;
- ZnBBox bbox;
- ZnWInfo *wi = fs->item->wi;
- XColor *color;
+ unsigned int i;
+ Field fptr;
+ ZnBBox bbox;
+ ZnWInfo *wi = fs->item->wi;
+ XColor *color;
unsigned short alpha;
- int old_num_chars, num_chars;
+ int old_num_chars, num_chars;
#ifdef GL
- Tk_Font old_font;
+ Tk_Font old_font;
#endif
if ((field < 0) || ((unsigned int) field >= fs->num_fields)) {
@@ -956,7 +956,7 @@ ConfigureField(ZnFieldSet fs,
}
if (ZnConfigureAttributes(wi, fs->item, fptr, field_attrs,
- argc, argv, flags) == TCL_ERROR) {
+ argc, argv, flags) == TCL_ERROR) {
return TCL_ERROR;
}
@@ -972,15 +972,15 @@ ConfigureField(ZnFieldSet fs,
*/
if ((fs->item == ti->sel_item) && (field == ti->sel_field)) {
if (ti->sel_last > num_chars) {
- ti->sel_last = num_chars;
+ ti->sel_last = num_chars;
}
if (ti->sel_first >= ti->sel_last) {
- ti->sel_item = ZN_NO_ITEM;
- ti->sel_field = ZN_NO_PART;
+ ti->sel_item = ZN_NO_ITEM;
+ ti->sel_field = ZN_NO_PART;
}
if ((ti->anchor_item == fs->item) && (ti->anchor_field == field) &&
- (ti->sel_anchor > num_chars)) {
- ti->sel_anchor = num_chars;
+ (ti->sel_anchor > num_chars)) {
+ ti->sel_anchor = num_chars;
}
}
if (fptr->insert_index > num_chars) {
@@ -1012,7 +1012,7 @@ ConfigureField(ZnFieldSet fs,
if ((fptr->relief != ZN_RELIEF_FLAT) && !fptr->gradient) {
color = ZnGetGradientColor(fptr->border_color, 51.0, &alpha);
fptr->gradient = ZnGetReliefGradient(wi->interp, wi->win,
- Tk_NameOfColor(color), alpha);
+ Tk_NameOfColor(color), alpha);
if (fptr->gradient == NULL) {
return TCL_ERROR;
}
@@ -1026,9 +1026,9 @@ ConfigureField(ZnFieldSet fs,
fs->label_format && ISSET(*flags, ZN_DRAW_FLAG)) {
for (i = 0; i < ZnLFNumFields(fs->label_format); i++) {
if (i == (unsigned int) field) {
- GetFieldBBox(fs, i, &bbox);
- ZnDamage(wi, &bbox);
- break;
+ GetFieldBBox(fs, i, &bbox);
+ ZnDamage(wi, &bbox);
+ break;
}
}
}
@@ -1045,10 +1045,10 @@ ConfigureField(ZnFieldSet fs,
**********************************************************************************
*/
static int
-QueryField(ZnFieldSet fs,
- int field,
- int argc,
- Tcl_Obj *CONST argv[])
+QueryField(ZnFieldSet fs,
+ int field,
+ int argc,
+ Tcl_Obj *CONST argv[])
{
if ((field < 0) || ((unsigned int) field >= fs->num_fields)) {
Tcl_AppendResult(fs->item->wi->interp, "invalid field index \"", NULL);
@@ -1056,7 +1056,7 @@ QueryField(ZnFieldSet fs,
}
if (ZnQueryAttribute(fs->item->wi->interp, &fs->fields[field], field_attrs,
- argv[0]) == TCL_ERROR) {
+ argv[0]) == TCL_ERROR) {
return TCL_ERROR;
}
@@ -1072,10 +1072,10 @@ QueryField(ZnFieldSet fs,
**********************************************************************************
*/
static void
-FreeFields(ZnFieldSet field_set)
+FreeFields(ZnFieldSet field_set)
{
- unsigned int i, num_fields;
- Field field;
+ unsigned int i, num_fields;
+ Field field;
if (field_set->label_format) {
ZnLFDelete(field_set->label_format);
@@ -1126,22 +1126,22 @@ FreeFields(ZnFieldSet field_set)
* FieldDeleteChars,
* FieldCursor,
* FieldSelection --
- * These functions implement text edition in fields. The behavior
+ * These functions implement text edition in fields. The behavior
* is the same as for Text items.
*
**********************************************************************************
*/
static int
-FieldPointToChar(ZnFieldSet fs,
- unsigned int field,
- int x,
- int y)
+FieldPointToChar(ZnFieldSet fs,
+ unsigned int field,
+ int x,
+ int y)
{
- Field fptr;
- int byte_index;
- ZnBBox f_bbox, t_bbox;
- ZnPoint t_orig;
- unsigned int num_bytes, n, dummy;
+ Field fptr;
+ int byte_index;
+ ZnBBox f_bbox, t_bbox;
+ ZnPoint t_orig;
+ unsigned int num_bytes, n, dummy;
fptr = &fs->fields[field];
num_bytes = 0;
@@ -1181,7 +1181,7 @@ FieldPointToChar(ZnFieldSet fs,
goto convrt;
}
n = Tk_MeasureChars(fptr->font, fptr->text, num_bytes,
- x + 2 - (int) t_bbox.orig.x, TK_PARTIAL_OK, &dummy);
+ x + 2 - (int) t_bbox.orig.x, TK_PARTIAL_OK, &dummy);
byte_index = n - 1;
goto convrt;
}
@@ -1195,9 +1195,9 @@ FieldPointToChar(ZnFieldSet fs,
}
static int
-WordMoveFromIndex(char *text,
- int index,
- int fwd)
+WordMoveFromIndex(char *text,
+ int index,
+ int fwd)
{
char const *strp;
@@ -1227,18 +1227,18 @@ WordMoveFromIndex(char *text,
}
static int
-FieldIndex(ZnFieldSet fs,
- int field,
- Tcl_Obj *index_spec,
- int *index)
+FieldIndex(ZnFieldSet fs,
+ int field,
+ Tcl_Obj *index_spec,
+ int *index)
{
- Field fptr;
- ZnWInfo *wi = fs->item->wi;
- ZnTextInfo *ti = &wi->text_info;
- unsigned int length;
- int c, x, y;
- double tmp;
- char *end, *p;
+ Field fptr;
+ ZnWInfo *wi = fs->item->wi;
+ ZnTextInfo *ti = &wi->text_info;
+ unsigned int length;
+ int c, x, y;
+ double tmp;
+ char *end, *p;
if ((field < 0) || ((unsigned int) field >= fs->num_fields)) {
*index = 0;
@@ -1276,7 +1276,7 @@ FieldIndex(ZnFieldSet fs,
*index = fptr->insert_index;
}
else if ((c == 's') && (strncmp(p, "sel.first", length) == 0) &&
- (length >= 5)) {
+ (length >= 5)) {
if ((ti->sel_item != fs->item) || (ti->sel_field != field)) {
sel_err:
Tcl_AppendResult(wi->interp, "selection isn't in field", (char *) NULL);
@@ -1285,7 +1285,7 @@ FieldIndex(ZnFieldSet fs,
*index = ti->sel_first;
}
else if ((c == 's') && (strncmp(p, "sel.last", length) == 0) &&
- (length >= 5)) {
+ (length >= 5)) {
if ((ti->sel_item != fs->item) || (ti->sel_field != field)) {
goto sel_err;
}
@@ -1313,7 +1313,7 @@ FieldIndex(ZnFieldSet fs,
*index = FieldPointToChar(fs, (unsigned int) field, x, y);
}
else if (Tcl_GetIntFromObj(wi->interp, index_spec, index) == TCL_OK) {
- int num_chars = fptr->text ? Tcl_NumUtfChars(fptr->text, (int) strlen(fptr->text)) : 0;
+ int num_chars = fptr->text ? Tcl_NumUtfChars(fptr->text, (int) strlen(fptr->text)) : 0;
if (*index < 0){
*index = 0;
}
@@ -1331,16 +1331,16 @@ FieldIndex(ZnFieldSet fs,
}
static ZnBool
-FieldInsertChars(ZnFieldSet fs,
- int field,
- int *index,
- char *chars)
+FieldInsertChars(ZnFieldSet fs,
+ int field,
+ int *index,
+ char *chars)
{
- Field fptr;
- ZnTextInfo *ti = &fs->item->wi->text_info;
- int num_chars, num_bytes, chars_added;
- unsigned int byte_index, bytes_added = strlen(chars);
- char *new;
+ Field fptr;
+ ZnTextInfo *ti = &fs->item->wi->text_info;
+ int num_chars, num_bytes, chars_added;
+ unsigned int byte_index, bytes_added = strlen(chars);
+ char *new;
if ((field < 0) || ((unsigned int) field >= fs->num_fields)) {
return False;
@@ -1393,7 +1393,7 @@ FieldInsertChars(ZnFieldSet fs,
ti->sel_last += chars_added;
}
if ((ti->anchor_item == fs->item) && (ti->anchor_field == field) &&
- (ti->sel_anchor >= *index)) {
+ (ti->sel_anchor >= *index)) {
ti->sel_anchor += chars_added;
}
}
@@ -1406,16 +1406,16 @@ FieldInsertChars(ZnFieldSet fs,
}
static ZnBool
-FieldDeleteChars(ZnFieldSet fs,
- int field,
- int *first,
- int *last)
+FieldDeleteChars(ZnFieldSet fs,
+ int field,
+ int *first,
+ int *last)
{
- Field fptr;
- ZnTextInfo *ti = &fs->item->wi->text_info;
- unsigned int char_count, byte_count;
- unsigned int num_bytes, num_chars, first_offset;
- char *new;
+ Field fptr;
+ ZnTextInfo *ti = &fs->item->wi->text_info;
+ unsigned int char_count, byte_count;
+ unsigned int num_bytes, num_chars, first_offset;
+ char *new;
if ((field < 0) || ((unsigned int) field >= fs->num_fields)) {
return False;
@@ -1471,23 +1471,23 @@ FieldDeleteChars(ZnFieldSet fs,
if (ti->sel_first > *first) {
ti->sel_first -= char_count;
if (ti->sel_first < *first) {
- ti->sel_first = *first;
+ ti->sel_first = *first;
}
}
if (ti->sel_last >= *first) {
ti->sel_last -= char_count;
if (ti->sel_last < *first - 1) {
- ti->sel_last = *first - 1;
+ ti->sel_last = *first - 1;
}
}
if (ti->sel_first > ti->sel_last) {
ti->sel_item = ZN_NO_ITEM;
}
if ((ti->anchor_item == fs->item) && (ti->anchor_field == field) &&
- (ti->sel_anchor > *first)) {
+ (ti->sel_anchor > *first)) {
ti->sel_anchor -= char_count;
if (ti->sel_anchor < *first) {
- ti->sel_anchor = *first;
+ ti->sel_anchor = *first;
}
}
}
@@ -1500,12 +1500,12 @@ FieldDeleteChars(ZnFieldSet fs,
}
static void
-FieldCursor(ZnFieldSet fs,
- int field,
- int index)
+FieldCursor(ZnFieldSet fs,
+ int field,
+ int index)
{
- Field fptr;
- int num_chars;
+ Field fptr;
+ int num_chars;
if ((field < 0) || ((unsigned int) field >= fs->num_fields)) {
return;
@@ -1529,15 +1529,15 @@ FieldCursor(ZnFieldSet fs,
}
static int
-FieldSelection(ZnFieldSet fs,
- int field,
- int offset,
- char *chars,
- int max_bytes)
+FieldSelection(ZnFieldSet fs,
+ int field,
+ int offset,
+ char *chars,
+ int max_bytes)
{
- Field fptr;
- int count;
- char const *sel_first, *sel_last;
+ Field fptr;
+ int count;
+ char const *sel_first, *sel_last;
ZnTextInfo *ti;
if ((field < 0) || ((unsigned int) field >= fs->num_fields)) {
@@ -1575,17 +1575,17 @@ FieldSelection(ZnFieldSet fs,
**********************************************************************************
*
* ComputeFieldImageLocation --
- * Compute the bounding box of the pixmap in a field. The position is
- * deduced from the field bounding box passed in bbox.
+ * Compute the bounding box of the pixmap in a field. The position is
+ * deduced from the field bounding box passed in bbox.
*
**********************************************************************************
*/
static void
-ComputeFieldImageLocation(Field fptr,
- ZnBBox *bbox,
- ZnBBox *pm_bbox)
+ComputeFieldImageLocation(Field fptr,
+ ZnBBox *bbox,
+ ZnBBox *pm_bbox)
{
- int width, height;
+ int width, height;
ZnSizeOfImage(fptr->image, &width, &height);
pm_bbox->orig.y = (bbox->orig.y + bbox->corner.y - height) / 2;
@@ -1614,24 +1614,24 @@ ComputeFieldImageLocation(Field fptr,
**********************************************************************************
*/
static void
-FieldsEngine(ZnFieldSet field_set,
- void (*cb)())
+FieldsEngine(ZnFieldSet field_set,
+ void (*cb)())
{
- ZnWInfo *wi = field_set->item->wi;
- /*int i; This one *NEED* to be an int */
- unsigned int i, num_fields, num_chars;
- Field fptr;
- ZnTextInfo *ti = &wi->text_info;
- ZnBBox lclip_bbox, fclip_bbox, bbox, *global_clip_box;
- ZnBBox tmp_bbox, text_bbox, pm_bbox;
- ZnPoint pts[2];
- ZnTriStrip tristrip;
- ZnPoint text_pos;
- ZnBool restore = False;
- ZnDim lwidth, lheight;
- ZnReal val;
- int cursor;
- int sel_start, sel_stop;
+ ZnWInfo *wi = field_set->item->wi;
+ /*int i; This one *NEED* to be an int */
+ unsigned int i, num_fields, num_chars;
+ Field fptr;
+ ZnTextInfo *ti = &wi->text_info;
+ ZnBBox lclip_bbox, fclip_bbox, bbox, *global_clip_box;
+ ZnBBox tmp_bbox, text_bbox, pm_bbox;
+ ZnPoint pts[2];
+ ZnTriStrip tristrip;
+ ZnPoint text_pos;
+ ZnBool restore = False;
+ ZnDim lwidth, lheight;
+ ZnReal val;
+ int cursor;
+ int sel_start, sel_stop;
if (!field_set->num_fields) {
return;
@@ -1648,7 +1648,7 @@ FieldsEngine(ZnFieldSet field_set,
if (!wi->render) {
ZnIntersectBBox(global_clip_box, &bbox, &lclip_bbox);
if (ZnIsEmptyBBox(&lclip_bbox)) {
- return;
+ return;
}
}
else {
@@ -1660,16 +1660,16 @@ FieldsEngine(ZnFieldSet field_set,
fptr = &field_set->fields[i];
if (ISCLEAR(fptr->flags, FIELD_VISIBLE_BIT)) {
- continue;
+ continue;
}
GetFieldBBox(field_set, i, &bbox);
ZnIntersectBBox(&lclip_bbox, &bbox, &fclip_bbox);
if (ZnIsEmptyBBox(&fclip_bbox)) {
- continue;
+ continue;
}
- /* we must call XSetClipRectangles only if it's required */
+ /* we must call XSetClipRectangles only if it's required */
val = fclip_bbox.orig.x - bbox.orig.x;
restore = val > 0;
val = fclip_bbox.orig.y - bbox.orig.y;
@@ -1680,74 +1680,74 @@ FieldsEngine(ZnFieldSet field_set,
restore |= val < 0;
cursor = ((field_set->item == wi->focus_item) &&
- ((unsigned int) wi->focus_field == i) &&
- ISSET(wi->flags, ZN_GOT_FOCUS) && ti->cursor_on) ? 0 : -1;
+ ((unsigned int) wi->focus_field == i) &&
+ ISSET(wi->flags, ZN_GOT_FOCUS) && ti->cursor_on) ? 0 : -1;
sel_start = -1, sel_stop = -1;
ComputeFieldTextLocation(fptr, &bbox, &text_pos, &text_bbox);
if (fptr->text) {
- if (cursor != -1) {
- cursor = Tk_TextWidth(fptr->font, fptr->text,
- Tcl_UtfAtIndex(fptr->text,
- fptr->insert_index)-fptr->text);
- }
- num_chars = Tcl_NumUtfChars(fptr->text, (int) strlen(fptr->text));
- if (num_chars) {
- if ((field_set->item == ti->sel_item) && ((unsigned int) ti->sel_field == i) &&
- (ti->sel_last >= 0) && (ti->sel_first <= (int) num_chars)) {
- sel_start = Tk_TextWidth(fptr->font, fptr->text,
- Tcl_UtfAtIndex(fptr->text,
- ti->sel_first)-fptr->text);
- sel_stop = Tk_TextWidth(fptr->font, fptr->text,
- Tcl_UtfAtIndex(fptr->text,
- ti->sel_last)-fptr->text);
- }
-
- ZnIntersectBBox(&fclip_bbox, &text_bbox, &tmp_bbox);
-
- val = tmp_bbox.orig.x - text_bbox.orig.x;
- restore |= val > 0;
- val = tmp_bbox.orig.y - text_bbox.orig.y;
- restore |= val > 0;
- val = tmp_bbox.corner.x - text_bbox.corner.x;
- restore |= val < 0;
- val = tmp_bbox.corner.y - text_bbox.corner.y;
- restore |= val < 0;
- }
+ if (cursor != -1) {
+ cursor = Tk_TextWidth(fptr->font, fptr->text,
+ Tcl_UtfAtIndex(fptr->text,
+ fptr->insert_index)-fptr->text);
+ }
+ num_chars = Tcl_NumUtfChars(fptr->text, (int) strlen(fptr->text));
+ if (num_chars) {
+ if ((field_set->item == ti->sel_item) && ((unsigned int) ti->sel_field == i) &&
+ (ti->sel_last >= 0) && (ti->sel_first <= (int) num_chars)) {
+ sel_start = Tk_TextWidth(fptr->font, fptr->text,
+ Tcl_UtfAtIndex(fptr->text,
+ ti->sel_first)-fptr->text);
+ sel_stop = Tk_TextWidth(fptr->font, fptr->text,
+ Tcl_UtfAtIndex(fptr->text,
+ ti->sel_last)-fptr->text);
+ }
+
+ ZnIntersectBBox(&fclip_bbox, &text_bbox, &tmp_bbox);
+
+ val = tmp_bbox.orig.x - text_bbox.orig.x;
+ restore |= val > 0;
+ val = tmp_bbox.orig.y - text_bbox.orig.y;
+ restore |= val > 0;
+ val = tmp_bbox.corner.x - text_bbox.corner.x;
+ restore |= val < 0;
+ val = tmp_bbox.corner.y - text_bbox.corner.y;
+ restore |= val < 0;
+ }
}
if (fptr->image != ZnUnspecifiedImage) {
- ComputeFieldImageLocation(fptr, &bbox, &pm_bbox);
-
- ZnIntersectBBox(&fclip_bbox, &pm_bbox, &tmp_bbox);
-
- val = tmp_bbox.orig.x - pm_bbox.orig.x;
- restore |= val > 0;
- val = tmp_bbox.orig.y - pm_bbox.orig.y;
- restore |= val > 0;
- val = tmp_bbox.corner.x - pm_bbox.corner.x;
- restore |= val < 0;
- val = tmp_bbox.corner.y - pm_bbox.corner.y;
- restore |= val < 0;
+ ComputeFieldImageLocation(fptr, &bbox, &pm_bbox);
+
+ ZnIntersectBBox(&fclip_bbox, &pm_bbox, &tmp_bbox);
+
+ val = tmp_bbox.orig.x - pm_bbox.orig.x;
+ restore |= val > 0;
+ val = tmp_bbox.orig.y - pm_bbox.orig.y;
+ restore |= val > 0;
+ val = tmp_bbox.corner.x - pm_bbox.corner.x;
+ restore |= val < 0;
+ val = tmp_bbox.corner.y - pm_bbox.corner.y;
+ restore |= val < 0;
}
/*restore = True;*/
if (restore) {
- /* we must clip. */
- /*printf("clip: %d\n", i);*/
- pts[0] = fclip_bbox.orig;
- pts[1] = fclip_bbox.corner;
- ZnTriStrip1(&tristrip, pts, 2, False);
- ZnPushClip(wi, &tristrip, True, True);
+ /* we must clip. */
+ /*printf("clip: %d\n", i);*/
+ pts[0] = fclip_bbox.orig;
+ pts[1] = fclip_bbox.corner;
+ ZnTriStrip1(&tristrip, pts, 2, False);
+ ZnPushClip(wi, &tristrip, True, True);
}
(*cb)(wi, fptr, &bbox, &pm_bbox,
- &text_pos, &text_bbox, cursor, sel_start, sel_stop);
+ &text_pos, &text_bbox, cursor, sel_start, sel_stop);
if (restore) {
- /* Restore the previous clip. */
- ZnPopClip(wi, True);
- restore = False;
+ /* Restore the previous clip. */
+ ZnPopClip(wi, True);
+ restore = False;
}
}
}
@@ -1762,25 +1762,25 @@ FieldsEngine(ZnFieldSet field_set,
**********************************************************************************
*/
static void
-DrawField(ZnWInfo *wi,
- Field fptr,
- ZnBBox *bbox,
- ZnBBox *pm_bbox,
- ZnPoint *text_pos,
- ZnBBox *text_bbox,
- int cursor,
- int sel_start,
- int sel_stop)
+DrawField(ZnWInfo *wi,
+ Field fptr,
+ ZnBBox *bbox,
+ ZnBBox *pm_bbox,
+ ZnPoint *text_pos,
+ ZnBBox *text_bbox,
+ int cursor,
+ int sel_start,
+ int sel_stop)
{
- ZnTextInfo *ti = &wi->text_info;
- XGCValues values;
- XRectangle r;
- int j, xs, num_bytes;
- int pw, ph, fw, fh;
- TkRegion clip_region;
- ZnBool simple;
- Pixmap pixmap;
- TkRegion photo_region, clip;
+ ZnTextInfo *ti = &wi->text_info;
+ XGCValues values;
+ XRectangle r;
+ int j, xs, num_bytes;
+ int pw, ph, fw, fh;
+ TkRegion clip_region;
+ ZnBool simple;
+ Pixmap pixmap;
+ TkRegion photo_region, clip;
ZnBBox2XRect(bbox, &r);
@@ -1792,22 +1792,22 @@ DrawField(ZnWInfo *wi,
if (fptr->tile != ZnUnspecifiedImage) {
if (!ZnImageIsBitmap(fptr->tile)) { /* Fill tiled */
- values.fill_style = FillTiled;
- values.tile = ZnImagePixmap(fptr->tile, wi->win);
- values.ts_x_origin = (int) bbox->orig.x;
- values.ts_y_origin = (int) bbox->orig.y;
- XChangeGC(wi->dpy, wi->gc,
- GCTileStipXOrigin|GCTileStipYOrigin|GCFillStyle|GCTile,
- &values);
+ values.fill_style = FillTiled;
+ values.tile = ZnImagePixmap(fptr->tile, wi->win);
+ values.ts_x_origin = (int) bbox->orig.x;
+ values.ts_y_origin = (int) bbox->orig.y;
+ XChangeGC(wi->dpy, wi->gc,
+ GCTileStipXOrigin|GCTileStipYOrigin|GCFillStyle|GCTile,
+ &values);
}
else { /* Fill stippled */
- values.fill_style = FillStippled;
- values.stipple = ZnImagePixmap(fptr->tile, wi->win);
- values.ts_x_origin = (int) bbox->orig.x;
- values.ts_y_origin = (int) bbox->orig.y;
- XChangeGC(wi->dpy, wi->gc,
- GCTileStipXOrigin|GCTileStipYOrigin|GCFillStyle|GCStipple|GCForeground,
- &values);
+ values.fill_style = FillStippled;
+ values.stipple = ZnImagePixmap(fptr->tile, wi->win);
+ values.ts_x_origin = (int) bbox->orig.x;
+ values.ts_y_origin = (int) bbox->orig.y;
+ XChangeGC(wi->dpy, wi->gc,
+ GCTileStipXOrigin|GCTileStipYOrigin|GCFillStyle|GCStipple|GCForeground,
+ &values);
}
}
else { /* Fill solid */
@@ -1823,49 +1823,49 @@ DrawField(ZnWInfo *wi,
*/
for (j = 0; j < 2; j++) {
if ((j == 0 && ISSET(fptr->flags, TEXT_ON_TOP_BIT)) ||
- (j == 1 && ISCLEAR(fptr->flags, TEXT_ON_TOP_BIT))) {
+ (j == 1 && ISCLEAR(fptr->flags, TEXT_ON_TOP_BIT))) {
/*
* Draw the image.
*/
if (fptr->image != ZnUnspecifiedImage) {
- pw = ZnNearestInt(pm_bbox->corner.x - pm_bbox->orig.x);
- ph = ZnNearestInt(pm_bbox->corner.y - pm_bbox->orig.y);
- fw = ZnNearestInt(bbox->corner.x - bbox->orig.x);
- fh = ZnNearestInt(bbox->corner.y - bbox->orig.y);
-
- pixmap = ZnImagePixmap(fptr->image, wi->win);
- photo_region = ZnImageRegion(fptr->image);
- ZnCurrentClip(wi, &clip_region, NULL, &simple);
- clip = TkCreateRegion();
- /*
- * ZnImageRegion may fail: perl/Tk 800.24 doesn't support
- * some internal TkPhoto functions.
- * This is a workaround using a rectangular region based
- * on the image size.
- */
- if (photo_region == NULL) {
- XRectangle rect;
- rect.x = rect.y = 0;
- rect.width = pw;
- rect.height = ph;
- TkUnionRectWithRegion(&rect, clip, clip);
- }
- else {
- ZnUnionRegion(clip, photo_region, clip);
- }
- ZnOffsetRegion(clip, (int) pm_bbox->orig.x, (int) pm_bbox->orig.y);
- TkIntersectRegion(clip_region, clip, clip);
- TkSetRegion(wi->dpy, wi->gc, clip);
- XCopyArea(wi->dpy, pixmap, wi->draw_buffer, wi->gc,
- (int) ZnNearestInt(bbox->orig.x-pm_bbox->orig.x),
- (int) ZnNearestInt(bbox->orig.y-pm_bbox->orig.y),
- (unsigned int) MIN(pw, fw),
- (unsigned int) MIN(ph, fh),
- (int) MAX(bbox->orig.x, pm_bbox->orig.x),
- (int) MAX(bbox->orig.y, pm_bbox->orig.y));
-
- TkSetRegion(wi->dpy, wi->gc, clip_region);
- TkDestroyRegion(clip);
+ pw = ZnNearestInt(pm_bbox->corner.x - pm_bbox->orig.x);
+ ph = ZnNearestInt(pm_bbox->corner.y - pm_bbox->orig.y);
+ fw = ZnNearestInt(bbox->corner.x - bbox->orig.x);
+ fh = ZnNearestInt(bbox->corner.y - bbox->orig.y);
+
+ pixmap = ZnImagePixmap(fptr->image, wi->win);
+ photo_region = ZnImageRegion(fptr->image);
+ ZnCurrentClip(wi, &clip_region, NULL, &simple);
+ clip = TkCreateRegion();
+ /*
+ * ZnImageRegion may fail: perl/Tk 800.24 doesn't support
+ * some internal TkPhoto functions.
+ * This is a workaround using a rectangular region based
+ * on the image size.
+ */
+ if (photo_region == NULL) {
+ XRectangle rect;
+ rect.x = rect.y = 0;
+ rect.width = pw;
+ rect.height = ph;
+ TkUnionRectWithRegion(&rect, clip, clip);
+ }
+ else {
+ ZnUnionRegion(clip, photo_region, clip);
+ }
+ ZnOffsetRegion(clip, (int) pm_bbox->orig.x, (int) pm_bbox->orig.y);
+ TkIntersectRegion(clip_region, clip, clip);
+ TkSetRegion(wi->dpy, wi->gc, clip);
+ XCopyArea(wi->dpy, pixmap, wi->draw_buffer, wi->gc,
+ (int) ZnNearestInt(bbox->orig.x-pm_bbox->orig.x),
+ (int) ZnNearestInt(bbox->orig.y-pm_bbox->orig.y),
+ (unsigned int) MIN(pw, fw),
+ (unsigned int) MIN(ph, fh),
+ (int) MAX(bbox->orig.x, pm_bbox->orig.x),
+ (int) MAX(bbox->orig.y, pm_bbox->orig.y));
+
+ TkSetRegion(wi->dpy, wi->gc, clip_region);
+ TkDestroyRegion(clip);
}
}
else if (fptr->text) {
@@ -1874,22 +1874,22 @@ DrawField(ZnWInfo *wi,
*/
num_bytes = strlen(fptr->text);
if (num_bytes) {
- if (sel_start >= 0) {
- values.foreground = ZnGetGradientPixel(ti->sel_color, 0.0);
- values.fill_style = FillSolid;
- XChangeGC(wi->dpy, wi->gc, GCForeground|GCFillStyle, &values);
- XFillRectangle(wi->dpy, wi->draw_buffer, wi->gc,
- (int) (text_bbox->orig.x+sel_start),
- (int) text_bbox->orig.y,
- (unsigned int) (sel_stop-sel_start),
- (unsigned int) (text_bbox->corner.y-text_bbox->orig.y));
- }
- values.foreground = ZnGetGradientPixel(fptr->color, 0.0);
- values.fill_style = FillSolid;
- values.font = Tk_FontId(fptr->font);
- XChangeGC(wi->dpy, wi->gc, GCForeground | GCFillStyle | GCFont, &values);
- Tk_DrawChars(wi->dpy, wi->draw_buffer, wi->gc, fptr->font,
- fptr->text, num_bytes, (int) text_pos->x, (int) text_pos->y);
+ if (sel_start >= 0) {
+ values.foreground = ZnGetGradientPixel(ti->sel_color, 0.0);
+ values.fill_style = FillSolid;
+ XChangeGC(wi->dpy, wi->gc, GCForeground|GCFillStyle, &values);
+ XFillRectangle(wi->dpy, wi->draw_buffer, wi->gc,
+ (int) (text_bbox->orig.x+sel_start),
+ (int) text_bbox->orig.y,
+ (unsigned int) (sel_stop-sel_start),
+ (unsigned int) (text_bbox->corner.y-text_bbox->orig.y));
+ }
+ values.foreground = ZnGetGradientPixel(fptr->color, 0.0);
+ values.fill_style = FillSolid;
+ values.font = Tk_FontId(fptr->font);
+ XChangeGC(wi->dpy, wi->gc, GCForeground | GCFillStyle | GCFont, &values);
+ Tk_DrawChars(wi->dpy, wi->draw_buffer, wi->gc, fptr->font,
+ fptr->text, num_bytes, (int) text_pos->x, (int) text_pos->y);
}
}
}
@@ -1900,8 +1900,8 @@ DrawField(ZnWInfo *wi,
XChangeGC(wi->dpy, wi->gc, GCForeground|GCLineWidth|GCFillStyle, &values);
xs = (int) text_bbox->orig.x + cursor;
XDrawLine(wi->dpy, wi->draw_buffer, wi->gc,
- xs, (int) text_bbox->orig.y,
- xs, (int) text_bbox->corner.y);
+ xs, (int) text_bbox->orig.y,
+ xs, (int) text_bbox->corner.y);
}
/*
@@ -1909,7 +1909,7 @@ DrawField(ZnWInfo *wi,
*/
if ((fptr->relief != ZN_RELIEF_FLAT) && (fptr->relief_thickness > 1)) {
ZnDrawRectangleRelief(wi, fptr->relief, fptr->gradient,
- &r, fptr->relief_thickness);
+ &r, fptr->relief_thickness);
}
/*
@@ -1921,39 +1921,39 @@ DrawField(ZnWInfo *wi,
values.line_style = LineSolid;
values.fill_style = FillSolid;
XChangeGC(wi->dpy, wi->gc,
- GCForeground | GCLineWidth | GCLineStyle | GCFillStyle, &values);
+ GCForeground | GCLineWidth | GCLineStyle | GCFillStyle, &values);
if (fptr->border_edges & ZN_LEFT_BORDER) {
XDrawLine(wi->dpy, wi->draw_buffer, wi->gc, r.x, r.y,
- r.x, r.y + r.height - 1);
+ r.x, r.y + r.height - 1);
}
if (fptr->border_edges & ZN_RIGHT_BORDER) {
XDrawLine(wi->dpy, wi->draw_buffer, wi->gc,
- r.x + r.width - 1, r.y,
- r.x + r.width - 1, r.y + r.height - 1);
+ r.x + r.width - 1, r.y,
+ r.x + r.width - 1, r.y + r.height - 1);
}
if (fptr->border_edges & ZN_TOP_BORDER) {
XDrawLine(wi->dpy, wi->draw_buffer, wi->gc,
- r.x, r.y, r.x + r.width - 1, r.y);
+ r.x, r.y, r.x + r.width - 1, r.y);
}
if (fptr->border_edges & ZN_BOTTOM_BORDER) {
XDrawLine(wi->dpy, wi->draw_buffer, wi->gc,
- r.x, r.y + r.height - 1,
- r.x + r.width - 1, r.y + r.height - 1);
+ r.x, r.y + r.height - 1,
+ r.x + r.width - 1, r.y + r.height - 1);
}
if (fptr->border_edges & ZN_OBLIQUE) {
XDrawLine(wi->dpy, wi->draw_buffer, wi->gc,
- r.x, r.y, r.x + r.width - 1, r.y + r.height - 1);
+ r.x, r.y, r.x + r.width - 1, r.y + r.height - 1);
}
if (fptr->border_edges & ZN_COUNTER_OBLIQUE) {
XDrawLine(wi->dpy, wi->draw_buffer, wi->gc,
- r.x, r.y + r.height - 1,
- r.x + r.width - 1, r.y);
+ r.x, r.y + r.height - 1,
+ r.x + r.width - 1, r.y);
}
}
}
static void
-DrawFields(ZnFieldSet field_set)
+DrawFields(ZnFieldSet field_set)
{
FieldsEngine(field_set, DrawField);
}
@@ -1981,21 +1981,21 @@ FieldRenderCB(void *closure)
}
static void
-RenderField(ZnWInfo *wi,
- Field fptr,
- ZnBBox *bbox,
- ZnBBox *pm_bbox,
- ZnPoint *text_pos,
- ZnBBox *text_bbox,
- int cursor,
- int sel_start,
- int sel_stop)
+RenderField(ZnWInfo *wi,
+ Field fptr,
+ ZnBBox *bbox,
+ ZnBBox *pm_bbox,
+ ZnPoint *text_pos,
+ ZnBBox *text_bbox,
+ int cursor,
+ int sel_start,
+ int sel_stop)
{
unsigned short alpha;
- unsigned int j, num_bytes;
- XColor *color;
- ZnReal xs;
- ZnTextInfo *ti = &wi->text_info;
+ unsigned int j, num_bytes;
+ XColor *color;
+ ZnReal xs;
+ ZnTextInfo *ti = &wi->text_info;
/*
* Draw the background.
@@ -2004,24 +2004,24 @@ RenderField(ZnWInfo *wi,
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
if (!ZnGradientFlat(fptr->fill_color)) {
#if 0 /* TODO_GL Faire le dégradé dans le fond des champs. */
- int type = fptr->fill_color->type;
- ZnBool fast = (type == ZN_AXIAL_GRADIENT) && !fptr->grad_geo;
+ int type = fptr->fill_color->type;
+ ZnBool fast = (type == ZN_AXIAL_GRADIENT) && !fptr->grad_geo;
RenderGradient(wi, fptr->fill_color,
- fast ? NULL : FieldRenderCB,
- bbox, fast ? (ZnPoint *) bbox : fptr->grad_geo);
+ fast ? NULL : FieldRenderCB,
+ bbox, fast ? (ZnPoint *) bbox : fptr->grad_geo);
#endif
}
else {
if (fptr->tile != ZnUnspecifiedImage) { /* Fill tiled/stippled */
- ZnRenderTile(wi, fptr->tile, fptr->fill_color, FieldRenderCB, bbox,
- (ZnPoint *) bbox);
+ ZnRenderTile(wi, fptr->tile, fptr->fill_color, FieldRenderCB, bbox,
+ (ZnPoint *) bbox);
}
else { /* Fill solid */
- color = ZnGetGradientColor(fptr->fill_color, 0.0, &alpha);
- alpha = ZnComposeAlpha(alpha, wi->alpha);
- glColor4us(color->red, color->green, color->blue, alpha);
- FieldRenderCB(bbox);
+ color = ZnGetGradientColor(fptr->fill_color, 0.0, &alpha);
+ alpha = ZnComposeAlpha(alpha, wi->alpha);
+ glColor4us(color->red, color->green, color->blue, alpha);
+ FieldRenderCB(bbox);
}
}
}
@@ -2032,13 +2032,13 @@ RenderField(ZnWInfo *wi,
*/
for (j = 0; j < 2; j++) {
if ((j == 0 && ISSET(fptr->flags, TEXT_ON_TOP_BIT)) ||
- (j == 1 && ISCLEAR(fptr->flags, TEXT_ON_TOP_BIT))) {
+ (j == 1 && ISCLEAR(fptr->flags, TEXT_ON_TOP_BIT))) {
/*
* Draw the image.
*/
if (fptr->image != ZnUnspecifiedImage) {
- ZnRenderIcon(wi, fptr->image, fptr->fill_color,
- &pm_bbox->orig, False);
+ ZnRenderIcon(wi, fptr->image, fptr->fill_color,
+ &pm_bbox->orig, False);
}
}
else if (fptr->text) {
@@ -2047,29 +2047,29 @@ RenderField(ZnWInfo *wi,
*/
num_bytes = strlen(fptr->text);
if (num_bytes) {
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
- if (sel_start >= 0) {
- color = ZnGetGradientColor(ti->sel_color, 0.0, &alpha);
- alpha = ZnComposeAlpha(alpha, wi->alpha);
- glColor4us(color->red, color->green, color->blue, alpha);
- glBegin(GL_QUADS);
- glVertex2d(text_bbox->orig.x+sel_start, text_bbox->orig.y);
- glVertex2d(text_bbox->orig.x+sel_stop, text_bbox->orig.y);
- glVertex2d(text_bbox->orig.x+sel_stop, text_bbox->corner.y);
- glVertex2d(text_bbox->orig.x+sel_start, text_bbox->corner.y);
- glEnd();
- }
- glEnable(GL_TEXTURE_2D);
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
- color = ZnGetGradientColor(fptr->color, 0.0, &alpha);
- alpha = ZnComposeAlpha(alpha, wi->alpha);
- glColor4us(color->red, color->green, color->blue, alpha);
- glBindTexture(GL_TEXTURE_2D, ZnTexFontTex(fptr->tfi));
- glPushMatrix();
- glTranslated(text_pos->x, text_pos->y, 0.0);
- ZnRenderString(fptr->tfi, fptr->text, num_bytes);
- glPopMatrix();
- glDisable(GL_TEXTURE_2D);
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+ if (sel_start >= 0) {
+ color = ZnGetGradientColor(ti->sel_color, 0.0, &alpha);
+ alpha = ZnComposeAlpha(alpha, wi->alpha);
+ glColor4us(color->red, color->green, color->blue, alpha);
+ glBegin(GL_QUADS);
+ glVertex2d(text_bbox->orig.x+sel_start, text_bbox->orig.y);
+ glVertex2d(text_bbox->orig.x+sel_stop, text_bbox->orig.y);
+ glVertex2d(text_bbox->orig.x+sel_stop, text_bbox->corner.y);
+ glVertex2d(text_bbox->orig.x+sel_start, text_bbox->corner.y);
+ glEnd();
+ }
+ glEnable(GL_TEXTURE_2D);
+ glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+ color = ZnGetGradientColor(fptr->color, 0.0, &alpha);
+ alpha = ZnComposeAlpha(alpha, wi->alpha);
+ glColor4us(color->red, color->green, color->blue, alpha);
+ glBindTexture(GL_TEXTURE_2D, ZnTexFontTex(fptr->tfi));
+ glPushMatrix();
+ glTranslated(text_pos->x, text_pos->y, 0.0);
+ ZnRenderString(fptr->tfi, fptr->text, num_bytes);
+ glPopMatrix();
+ glDisable(GL_TEXTURE_2D);
}
}
if (cursor >= 0) {
@@ -2101,7 +2101,7 @@ RenderField(ZnWInfo *wi,
p[3].y = p[0].y;
p[4] = p[0];
ZnRenderPolygonRelief(wi, fptr->relief, fptr->gradient,
- False, p, 5, fptr->relief_thickness);
+ False, p, 5, fptr->relief_thickness);
}
/*
@@ -2144,7 +2144,7 @@ RenderField(ZnWInfo *wi,
#endif
static void
-RenderFields(ZnFieldSet field_set)
+RenderFields(ZnFieldSet field_set)
{
#ifdef GL
/* glDisable(GL_LINE_SMOOTH);*/
@@ -2162,8 +2162,8 @@ RenderFields(ZnFieldSet field_set)
**********************************************************************************
*/
static ZnBool
-IsFieldSensitive(ZnFieldSet field_set,
- int part)
+IsFieldSensitive(ZnFieldSet field_set,
+ int part)
{
if ((part >= 0) && ((unsigned int) part < field_set->num_fields)) {
return ISSET(field_set->fields[part].flags, FIELD_SENSITIVE_BIT);
@@ -2178,26 +2178,26 @@ IsFieldSensitive(ZnFieldSet field_set,
**********************************************************************************
*
* FieldsPick --
- * Return the first field that contains <x, y>.
- * A field is selected if <x, y> is over a non transparent area.
- * Such areas are : a solid filled background, a text, an icon.
- * This does *NOT* do with *GLOBAL* visible and sensitive.
- * But we need to take into account local field visible and
- * sensitive as they modifiy local transparency. Local means
- * within a single item.
+ * Return the first field that contains <x, y>.
+ * A field is selected if <x, y> is over a non transparent area.
+ * Such areas are : a solid filled background, a text, an icon.
+ * This does *NOT* do with *GLOBAL* visible and sensitive.
+ * But we need to take into account local field visible and
+ * sensitive as they modifiy local transparency. Local means
+ * within a single item.
*
**********************************************************************************
*/
static double
-FieldsPick(ZnFieldSet field_set,
- ZnPoint *p,
- int *part)
+FieldsPick(ZnFieldSet field_set,
+ ZnPoint *p,
+ int *part)
{
- Field fptr;
- ZnBBox bbox;
- unsigned int best_field = 0;
- int i;
- ZnReal new_dist, dist = 1e40;
+ Field fptr;
+ ZnBBox bbox;
+ unsigned int best_field = 0;
+ int i;
+ ZnReal new_dist, dist = 1e40;
if (!field_set->num_fields) {
return dist;
@@ -2208,20 +2208,20 @@ FieldsPick(ZnFieldSet field_set,
fptr = &field_set->fields[i];
if (ISCLEAR(fptr->flags, FIELD_VISIBLE_BIT) &&
- ISCLEAR(fptr->flags, FIELD_SENSITIVE_BIT)) {
- continue;
+ ISCLEAR(fptr->flags, FIELD_SENSITIVE_BIT)) {
+ continue;
}
GetFieldBBox(field_set, (unsigned int) i, &bbox);
new_dist = ZnRectangleToPointDist(&bbox, p);
if (new_dist < dist) {
- dist = new_dist;
- best_field = i;
+ dist = new_dist;
+ best_field = i;
}
if (dist <= 0.0) {
- dist = 0.0;
- break;
+ dist = 0.0;
+ break;
}
}
}
@@ -2235,20 +2235,20 @@ FieldsPick(ZnFieldSet field_set,
**********************************************************************************
*
* FieldsToArea --
- * Return -1 if no field is in the given area, 1 if they are
- * all in it or 0 if there is some overlap. The function consider
- * only fields that are either sensible or visible.
+ * Return -1 if no field is in the given area, 1 if they are
+ * all in it or 0 if there is some overlap. The function consider
+ * only fields that are either sensible or visible.
*
**********************************************************************************
*/
static int
-FieldsToArea(ZnFieldSet field_set,
- ZnBBox *area)
+FieldsToArea(ZnFieldSet field_set,
+ ZnBBox *area)
{
- Field fptr;
- ZnBBox bbox;
- int i, inside = -1;
- ZnBool first_done = False;
+ Field fptr;
+ ZnBBox bbox;
+ int i, inside = -1;
+ ZnBool first_done = False;
if (!field_set->num_fields) {
return inside;
@@ -2258,7 +2258,7 @@ FieldsToArea(ZnFieldSet field_set,
fptr = &field_set->fields[i];
if (ISCLEAR(fptr->flags, FIELD_VISIBLE_BIT) &&
- ISCLEAR(fptr->flags, FIELD_SENSITIVE_BIT)) {
+ ISCLEAR(fptr->flags, FIELD_SENSITIVE_BIT)) {
continue;
}
@@ -2267,12 +2267,12 @@ FieldsToArea(ZnFieldSet field_set,
first_done = True;
inside = ZnBBoxInBBox(&bbox, area);
if (inside == 0) {
- return 0;
+ return 0;
}
}
else {
if (ZnBBoxInBBox(&bbox, area) != inside) {
- return 0;
+ return 0;
}
}
}
@@ -2289,11 +2289,11 @@ FieldsToArea(ZnFieldSet field_set,
**********************************************************************************
*/
static void
-SetFieldsAutoAlign(ZnFieldSet fs,
- int alignment)
+SetFieldsAutoAlign(ZnFieldSet fs,
+ int alignment)
{
- unsigned int i;
- Field field;
+ unsigned int i;
+ Field field;
if (!fs->num_fields) {
return;
@@ -2302,15 +2302,15 @@ SetFieldsAutoAlign(ZnFieldSet fs,
for (i = 0; i < fs->num_fields; i++) {
field = &fs->fields[i];
if (field->auto_alignment.automatic) {
- field->alignment = field->auto_alignment.align[alignment];
+ field->alignment = field->auto_alignment.align[alignment];
}
}
}
}
static char *
-GetFieldStruct(ZnFieldSet fs,
- int field)
+GetFieldStruct(ZnFieldSet fs,
+ int field)
{
if ((unsigned int) field >= fs->num_fields) {
return NULL;
@@ -2320,7 +2320,7 @@ GetFieldStruct(ZnFieldSet fs,
static unsigned int
-NumFields(ZnFieldSet fs)
+NumFields(ZnFieldSet fs)
{
return fs->num_fields;
}
diff --git a/generic/Field.h b/generic/Field.h
index 9d80e73..20d0040 100644
--- a/generic/Field.h
+++ b/generic/Field.h
@@ -1,8 +1,8 @@
/*
* Field.h -- Header for field item parts.
*
- * Authors : Patrick Lecoanet.
- * Creation date :
+ * Authors : Patrick Lecoanet.
+ * Creation date :
*
* $Id$
*/
@@ -50,19 +50,19 @@ struct _ZnAttrConfig;
*
*/
typedef struct _ZnFieldSetStruct {
- struct _ZnItemStruct *item;
- ZnLabelFormat label_format;
- unsigned int num_fields;
- struct _FieldStruct *fields;
- ZnDim label_width; /* Describe the label size. Access these */
- ZnDim label_height; /* 2 only with GetLabelBBox. -1 means
- * not up to date. */
- ZnPoint label_pos; /* Describe the label origin. */
+ struct _ZnItemStruct *item;
+ ZnLabelFormat label_format;
+ unsigned int num_fields;
+ struct _FieldStruct *fields;
+ ZnDim label_width; /* Describe the label size. Access these */
+ ZnDim label_height; /* 2 only with GetLabelBBox. -1 means
+ * not up to date. */
+ ZnPoint label_pos; /* Describe the label origin. */
} ZnFieldSetStruct, *ZnFieldSet;
extern struct _ZnFIELD {
- struct _ZnAttrConfig *attr_desc;
+ struct _ZnAttrConfig *attr_desc;
void (*InitFields)(ZnFieldSet fs);
void (*CloneFields)(ZnFieldSet fs);
@@ -77,14 +77,14 @@ extern struct _ZnFIELD {
int (*FieldIndex)(ZnFieldSet fs, int field, Tcl_Obj *index_spec, int *index);
ZnBool (*FieldInsertChars)(ZnFieldSet fs, int field, int *index, char *chars);
ZnBool (*FieldDeleteChars)(ZnFieldSet fs, int field,
- int *first, int *last);
+ int *first, int *last);
void (*FieldCursor)(ZnFieldSet fs, int field, int index);
int (*FieldSelection)(ZnFieldSet fs, int field, int offset,
- char *chars, int max_chars);
+ char *chars, int max_chars);
void (*LeaderToLabel)(ZnFieldSet fs, ZnPoint *start, ZnPoint *end);
void (*GetLabelBBox)(ZnFieldSet fs, ZnDim *w, ZnDim *h);
void (*GetFieldBBox)(ZnFieldSet fs, unsigned int index,
- ZnBBox *field_bbox);
+ ZnBBox *field_bbox);
void (*SetFieldsAutoAlign)(ZnFieldSet fs, int alignment);
void (*ClearFieldCache)(ZnFieldSet fs, int field);
char *(*GetFieldStruct)(ZnFieldSet fs, int field);
diff --git a/generic/Geo.c b/generic/Geo.c
index 8ee530a..52ac268 100644
--- a/generic/Geo.c
+++ b/generic/Geo.c
@@ -1,8 +1,8 @@
/*
* Geo.c -- Implementation of common geometric routines.
*
- * Authors : Patrick Lecoanet.
- * Creation date :
+ * Authors : Patrick Lecoanet.
+ * Creation date :
*
* $Id$
*/
@@ -42,17 +42,17 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ "
void
-ZnPolyInit(ZnPoly *poly)
+ZnPolyInit(ZnPoly *poly)
{
poly->num_contours = 0;
poly->contours = NULL;
}
void
-ZnPolyContour1(ZnPoly *poly,
- ZnPoint *pts,
- unsigned int num_pts,
- ZnBool cw)
+ZnPolyContour1(ZnPoly *poly,
+ ZnPoint *pts,
+ unsigned int num_pts,
+ ZnBool cw)
{
poly->num_contours = 1;
poly->contours = &poly->contour1;
@@ -63,13 +63,13 @@ ZnPolyContour1(ZnPoly *poly,
}
void
-ZnPolySet(ZnPoly *poly1,
- ZnPoly *poly2)
+ZnPolySet(ZnPoly *poly1,
+ ZnPoly *poly2)
{
ZnPolyFree(poly1);
if (poly2->num_contours == 1) {
ZnPolyContour1(poly1, poly2->contours[0].points, poly2->contours[0].num_points,
- poly2->contours[0].cw);
+ poly2->contours[0].cw);
if (poly2->contours != &poly2->contour1) {
ZnFree(poly2->contours);
}
@@ -81,14 +81,14 @@ ZnPolySet(ZnPoly *poly1,
}
void
-ZnPolyFree(ZnPoly *poly)
+ZnPolyFree(ZnPoly *poly)
{
if (poly->num_contours) {
unsigned int i;
for (i = 0; i < poly->num_contours; i++) {
ZnFree(poly->contours[i].points);
/* if (poly->contours[i].controls) {
- ZnFree(poly->contours[i].controls);
+ ZnFree(poly->contours[i].controls);
}*/
}
if (poly->contours != &poly->contour1) {
@@ -100,10 +100,10 @@ ZnPolyFree(ZnPoly *poly)
}
void
-ZnTriStrip1(ZnTriStrip *tristrip,
- ZnPoint *pts,
- unsigned int num_pts,
- ZnBool fan)
+ZnTriStrip1(ZnTriStrip *tristrip,
+ ZnPoint *pts,
+ unsigned int num_pts,
+ ZnBool fan)
{
tristrip->num_strips = 1;
tristrip->strips = &tristrip->strip1;
@@ -113,7 +113,7 @@ ZnTriStrip1(ZnTriStrip *tristrip,
}
void
-ZnTriFree(ZnTriStrip *tristrip)
+ZnTriFree(ZnTriStrip *tristrip)
{
if (tristrip->num_strips) {
unsigned int i;
@@ -133,11 +133,11 @@ ZnTriFree(ZnTriStrip *tristrip)
* by position, anchor, width and height.
*/
void
-ZnAnchor2Origin(ZnPoint *position,
- ZnDim width,
- ZnDim height,
- Tk_Anchor anchor,
- ZnPoint *origin)
+ZnAnchor2Origin(ZnPoint *position,
+ ZnDim width,
+ ZnDim height,
+ Tk_Anchor anchor,
+ ZnPoint *origin)
{
switch (anchor) {
case TK_ANCHOR_CENTER:
@@ -184,11 +184,11 @@ ZnAnchor2Origin(ZnPoint *position,
* height and the anchor.
*/
void
-ZnOrigin2Anchor(ZnPoint *origin,
- ZnDim width,
- ZnDim height,
- Tk_Anchor anchor,
- ZnPoint *position)
+ZnOrigin2Anchor(ZnPoint *origin,
+ ZnDim width,
+ ZnDim height,
+ Tk_Anchor anchor,
+ ZnPoint *position)
{
switch (anchor) {
case TK_ANCHOR_CENTER:
@@ -240,9 +240,9 @@ ZnOrigin2Anchor(ZnPoint *origin,
* v1 ------------ v3
*/
void
-ZnRectOrigin2Anchor(ZnPoint *rect,
- Tk_Anchor anchor,
- ZnPoint *position)
+ZnRectOrigin2Anchor(ZnPoint *rect,
+ Tk_Anchor anchor,
+ ZnPoint *position)
{
switch (anchor) {
case TK_ANCHOR_CENTER:
@@ -281,8 +281,8 @@ ZnRectOrigin2Anchor(ZnPoint *rect,
}
void
-ZnBBox2XRect(ZnBBox *bbox,
- XRectangle *r)
+ZnBBox2XRect(ZnBBox *bbox,
+ XRectangle *r)
{
r->x = ZnNearestInt(bbox->orig.x);
r->y = ZnNearestInt(bbox->orig.y);
@@ -292,11 +292,11 @@ ZnBBox2XRect(ZnBBox *bbox,
void
-ZnGetStringBBox(char *str,
- Tk_Font font,
- ZnPos x,
- ZnPos y,
- ZnBBox *str_bbox)
+ZnGetStringBBox(char *str,
+ Tk_Font font,
+ ZnPos x,
+ ZnPos y,
+ ZnBBox *str_bbox)
{
Tk_FontMetrics fm;
@@ -318,7 +318,7 @@ ZnResetBBox(ZnBBox *bbox)
void
ZnCopyBBox(ZnBBox *bbox_from,
- ZnBBox *bbox_to)
+ ZnBBox *bbox_to)
{
bbox_to->orig = bbox_from->orig;
bbox_to->corner = bbox_from->corner;
@@ -327,8 +327,8 @@ ZnCopyBBox(ZnBBox *bbox_from,
void
ZnIntersectBBox(ZnBBox *bbox1,
- ZnBBox *bbox2,
- ZnBBox *bbox_inter)
+ ZnBBox *bbox2,
+ ZnBBox *bbox_inter)
{
if ((bbox1->corner.x < bbox2->orig.x) ||
(bbox1->corner.y < bbox2->orig.y) ||
@@ -354,7 +354,7 @@ ZnIsEmptyBBox(ZnBBox *bbox)
void
ZnAddBBoxToBBox(ZnBBox *bbox,
- ZnBBox *bbox2)
+ ZnBBox *bbox2)
{
if (ZnIsEmptyBBox(bbox2)) {
return;
@@ -372,9 +372,9 @@ ZnAddBBoxToBBox(ZnBBox *bbox,
void
-ZnAddPointToBBox(ZnBBox *bbox,
- ZnPos px,
- ZnPos py)
+ZnAddPointToBBox(ZnBBox *bbox,
+ ZnPos px,
+ ZnPos py)
{
if (ZnIsEmptyBBox(bbox)) {
bbox->orig.x = px;
@@ -392,9 +392,9 @@ ZnAddPointToBBox(ZnBBox *bbox,
void
-ZnAddPointsToBBox(ZnBBox *bbox,
- ZnPoint *points,
- unsigned int num_points)
+ZnAddPointsToBBox(ZnBBox *bbox,
+ ZnPoint *points,
+ unsigned int num_points)
{
ZnReal x1, y1, x2, y2, cur;
@@ -445,25 +445,25 @@ ZnAddPointsToBBox(ZnBBox *bbox,
void
-ZnAddStringToBBox(ZnBBox *bbox,
- char *str,
- Tk_Font font,
- ZnPos cx,
- ZnPos cy)
+ZnAddStringToBBox(ZnBBox *bbox,
+ char *str,
+ Tk_Font font,
+ ZnPos cx,
+ ZnPos cy)
{
- ZnBBox str_bbox;
+ ZnBBox str_bbox;
ZnGetStringBBox(str, font, cx, cy, &str_bbox);
ZnAddBBoxToBBox(bbox, &str_bbox);
}
ZnBool
-ZnPointInBBox(ZnBBox *bbox,
- ZnPos x,
- ZnPos y)
+ZnPointInBBox(ZnBBox *bbox,
+ ZnPos x,
+ ZnPos y)
{
return ((x >= bbox->orig.x) && (x < bbox->corner.x) &&
- (y >= bbox->orig.y) && (y < bbox->corner.y));
+ (y >= bbox->orig.y) && (y < bbox->corner.y));
}
@@ -473,8 +473,8 @@ ZnPointInBBox(ZnBBox *bbox,
* 1 if it is entirely inside and 0 otherwise.
*/
int
-ZnBBoxInBBox(ZnBBox *bbox1,
- ZnBBox *bbox2)
+ZnBBoxInBBox(ZnBBox *bbox1,
+ ZnBBox *bbox2)
{
if ((bbox1->corner.x <= bbox2->orig.x) ||
(bbox1->orig.x >= bbox2->corner.x) ||
@@ -497,9 +497,9 @@ ZnBBoxInBBox(ZnBBox *bbox1,
* if it is entirely inside and 0 otherwise.
*/
int
-ZnLineInBBox(ZnPoint *p1,
- ZnPoint *p2,
- ZnBBox *bbox)
+ZnLineInBBox(ZnPoint *p1,
+ ZnPoint *p2,
+ ZnBBox *bbox)
{
ZnBool p1_inside = ZnPointInBBox(bbox, p1->x, p1->y);
ZnBool p2_inside = ZnPointInBBox(bbox, p2->x, p2->y);
@@ -518,25 +518,25 @@ ZnLineInBBox(ZnPoint *p1,
/* Vertical line */
if (p1->x == p2->x) {
if (((p1->y >= bbox->orig.y) ^ (p2->y >= bbox->orig.y)) &&
- (p1->x >= bbox->orig.x) &&
- (p1->x <= bbox->corner.x)) {
+ (p1->x >= bbox->orig.x) &&
+ (p1->x <= bbox->corner.x)) {
return 0;
}
}
/* Horizontal line */
else if (p1->y == p2->y) {
if (((p1->x >= bbox->orig.x) ^ (p2->x >= bbox->orig.x)) &&
- (p1->y >= bbox->orig.y) &&
- (p1->y <= bbox->corner.y)) {
+ (p1->y >= bbox->orig.y) &&
+ (p1->y <= bbox->corner.y)) {
return 0;
}
}
/* Diagonal, do it the hard way. */
else {
- ZnReal slope = (p2->y - p1->y) / (p2->x - p1->x);
- ZnDim low, high, x, y;
- ZnDim bbox_width = bbox->corner.x - bbox->orig.x;
- ZnDim bbox_height = bbox->corner.y - bbox->orig.y;
+ ZnReal slope = (p2->y - p1->y) / (p2->x - p1->x);
+ ZnDim low, high, x, y;
+ ZnDim bbox_width = bbox->corner.x - bbox->orig.x;
+ ZnDim bbox_height = bbox->corner.y - bbox->orig.y;
/* Check against left edge */
if (p1->x < p2->x) {
@@ -550,15 +550,15 @@ ZnLineInBBox(ZnPoint *p1,
y = p1->y + (bbox->orig.x - p1->x) * slope;
if ((bbox->orig.x >= low) && (bbox->orig.x <= high) &&
- (y >= bbox->orig.y) && (y <= bbox->corner.y))
+ (y >= bbox->orig.y) && (y <= bbox->corner.y))
return 0;
/* Check against right edge */
y += bbox_width * slope;
if ((y >= bbox->orig.y) && (y <= bbox->corner.y) &&
- (bbox->corner.x >= low) && (bbox->corner.x <= high))
+ (bbox->corner.x >= low) && (bbox->corner.x <= high))
return 0;
-
+
/* Check against bottom edge */
if (p1->y < p2->y) {
low = p1->y;
@@ -571,13 +571,13 @@ ZnLineInBBox(ZnPoint *p1,
x = p1->x + (bbox->orig.y - p1->y) / slope;
if ((x >= bbox->orig.x) && (x <= bbox->corner.x) &&
- (bbox->orig.y >= low) && (bbox->orig.y <= high))
+ (bbox->orig.y >= low) && (bbox->orig.y <= high))
return 0;
/* Check against top edge */
x += bbox_height / slope;
if ((x >= bbox->orig.x) && (x <= bbox->corner.x) &&
- (bbox->corner.y >= low) && (bbox->corner.y <= high))
+ (bbox->corner.y >= low) && (bbox->corner.y <= high))
return 0;
}
@@ -586,12 +586,12 @@ ZnLineInBBox(ZnPoint *p1,
ZnBool
-ZnTestCCW(ZnPoint *points,
- unsigned int num_points)
+ZnTestCCW(ZnPoint *points,
+ unsigned int num_points)
{
- ZnPoint *p, *p_p=NULL, *p_n=NULL, min;
- ZnReal xprod;
- unsigned int i, min_index;
+ ZnPoint *p, *p_p=NULL, *p_n=NULL, min;
+ ZnReal xprod;
+ unsigned int i, min_index;
if (num_points < 3) {
return True;
@@ -606,7 +606,7 @@ ZnTestCCW(ZnPoint *points,
min_index = 0;
for (i = 1, p++; i < num_points; i++, p++) {
if ((p->y < min.y) ||
- ((p->y == min.y) && (p->x > min.x))) {
+ ((p->y == min.y) && (p->x > min.x))) {
min_index = i;
min = *p;
}
@@ -643,29 +643,29 @@ ZnTestCCW(ZnPoint *points,
/*
* ZnShiftLine --
- * Given two points describing a line and a distance, return
- * to points describing a line parallel to it at the given distance.
- * When looking the line from p1 to p2 the new line will be dist away
- * on its left. Negative values are allowed for dist, resulting in a line
- * on the right.
+ * Given two points describing a line and a distance, return
+ * to points describing a line parallel to it at the given distance.
+ * When looking the line from p1 to p2 the new line will be dist away
+ * on its left. Negative values are allowed for dist, resulting in a line
+ * on the right.
*/
void
-ZnShiftLine(ZnPoint *p1,
- ZnPoint *p2,
- ZnReal dist,
- ZnPoint *p3,
- ZnPoint *p4)
+ZnShiftLine(ZnPoint *p1,
+ ZnPoint *p2,
+ ZnReal dist,
+ ZnPoint *p3,
+ ZnPoint *p4)
{
- static int shift_table[129];
- ZnBool dx_neg, dy_neg;
- int dx, dy;
+ static int shift_table[129];
+ ZnBool dx_neg, dy_neg;
+ int dx, dy;
/*
* Initialize the conversion table.
*/
if (shift_table[0] == 0) {
- int i;
- ZnReal tangent, cosine;
+ int i;
+ ZnReal tangent, cosine;
for (i = 0; i <= 128; i++) {
tangent = i/128.0;
@@ -718,16 +718,16 @@ ZnShiftLine(ZnPoint *p1,
/*
* IntersectLines --
- * Given two lines described by two points, compute their intersection.
- * The function returns True if the lines are not parallel and False
- * otherwise.
+ * Given two lines described by two points, compute their intersection.
+ * The function returns True if the lines are not parallel and False
+ * otherwise.
*/
ZnBool
-ZnIntersectLines(ZnPoint *a1,
- ZnPoint *a2,
- ZnPoint *b1,
- ZnPoint *b2,
- ZnPoint *pi)
+ZnIntersectLines(ZnPoint *a1,
+ ZnPoint *a2,
+ ZnPoint *b1,
+ ZnPoint *b2,
+ ZnPoint *pi)
{
ZnReal dxadyb, dxbdya, dxadxb, dyadyb, p, q;
@@ -772,20 +772,20 @@ ZnIntersectLines(ZnPoint *a1,
/*
* InsetPolygon --
- * Inset the given polygon by the given amount. The
+ * Inset the given polygon by the given amount. The
* value can be negative, in this case the polygon will
* be outset.
*/
/**** A FINIR ****/
void
-ZnInsetPolygon(ZnPoint *p,
- unsigned int num_points,
- ZnDim inset)
+ZnInsetPolygon(ZnPoint *p,
+ unsigned int num_points,
+ ZnDim inset)
{
- ZnPoint *p1, *p2;
- ZnPoint new_p1, new_p2;
- /* ZnPoint shift1, shift2;*/
- unsigned int i, processed_points;
+ ZnPoint *p1, *p2;
+ ZnPoint new_p1, new_p2;
+ /* ZnPoint shift1, shift2;*/
+ unsigned int i, processed_points;
processed_points = 0;
@@ -822,16 +822,16 @@ ZnInsetPolygon(ZnPoint *p,
* end is located around p2.
*/
void
-ZnGetButtPoints(ZnPoint *p1,
- ZnPoint *p2,
- ZnDim width,
- ZnBool projecting,
- ZnPoint *c1,
- ZnPoint *c2)
-{
- ZnReal w_2 = width/2.0;
- ZnDim length = hypot(p2->x - p1->x, p2->y - p1->y);
- ZnReal delta_x, delta_y;
+ZnGetButtPoints(ZnPoint *p1,
+ ZnPoint *p2,
+ ZnDim width,
+ ZnBool projecting,
+ ZnPoint *c1,
+ ZnPoint *c2)
+{
+ ZnReal w_2 = width/2.0;
+ ZnDim length = hypot(p2->x - p1->x, p2->y - p1->y);
+ ZnReal delta_x, delta_y;
if (length == 0.0) {
c1->x = c2->x = p2->x;
@@ -867,24 +867,24 @@ ZnGetButtPoints(ZnPoint *p1,
* Hmmm, the switch has been done but not the rounding ;-)
*/
ZnBool
-ZnGetMiterPoints(ZnPoint *p1,
- ZnPoint *p2,
- ZnPoint *p3,
- ZnDim width,
- ZnPoint *c1,
- ZnPoint *c2)
-{
- static ZnReal deg11 = (11.0*2.0*M_PI)/360.0;
- ZnReal theta1; /* angle of p2-p1 segment. */
- ZnReal theta2; /* angle of p2-p3 segment. */
- ZnReal theta; /* angle of the joint */
- ZnReal theta3; /* angle of bisector of the joint toward
- * the external point of the joint. */
- ZnReal dist; /* distance of the external points
- * of the corner from the mid point
- * p2. */
- ZnReal delta_x, delta_y; /* projection of (dist,theta3) on x
- * and y. */
+ZnGetMiterPoints(ZnPoint *p1,
+ ZnPoint *p2,
+ ZnPoint *p3,
+ ZnDim width,
+ ZnPoint *c1,
+ ZnPoint *c2)
+{
+ static ZnReal deg11 = (11.0*2.0*M_PI)/360.0;
+ ZnReal theta1; /* angle of p2-p1 segment. */
+ ZnReal theta2; /* angle of p2-p3 segment. */
+ ZnReal theta; /* angle of the joint */
+ ZnReal theta3; /* angle of bisector of the joint toward
+ * the external point of the joint. */
+ ZnReal dist; /* distance of the external points
+ * of the corner from the mid point
+ * p2. */
+ ZnReal delta_x, delta_y; /* projection of (dist,theta3) on x
+ * and y. */
if (p2->y == p1->y) {
theta1 = (p2->x < p1->x) ? 0.0 : M_PI;
@@ -950,17 +950,17 @@ ZnGetMiterPoints(ZnPoint *p1,
* can be: CapRound, CapButt, CapProjecting.
*/
int
-ZnPolylineInBBox(ZnPoint *points,
- unsigned int num_points,
- ZnDim width,
- int cap_style,
- int join_style,
- ZnBBox *bbox)
-{
- unsigned int count;
- int inside = -1;
- ZnBool do_miter_as_bevel;
- ZnPoint poly[4];
+ZnPolylineInBBox(ZnPoint *points,
+ unsigned int num_points,
+ ZnDim width,
+ int cap_style,
+ int join_style,
+ ZnBBox *bbox)
+{
+ unsigned int count;
+ int inside = -1;
+ ZnBool do_miter_as_bevel;
+ ZnPoint poly[4];
/*
* If the first point is inside the area, change inside
@@ -985,9 +985,9 @@ ZnPolylineInBBox(ZnPoint *points,
* around every joint if JoinRound.
*/
if (((cap_style == CapRound) && (count == num_points)) ||
- ((join_style == JoinRound) && (count != num_points))) {
+ ((join_style == JoinRound) && (count != num_points))) {
if (ZnOvalInBBox(points, width, width, bbox) != inside) {
- return 0;
+ return 0;
}
}
/*
@@ -1000,7 +1000,7 @@ ZnPolylineInBBox(ZnPoint *points,
*/
if (count == num_points) {
ZnGetButtPoints(&points[1], points, width,
- cap_style == CapProjecting, poly, &poly[1]);
+ cap_style == CapProjecting, poly, &poly[1]);
}
/*
* Here we are at a joint starting a new edge. If the
@@ -1022,10 +1022,10 @@ ZnPolylineInBBox(ZnPoint *points,
* poly[2].
*/
if ((join_style == JoinBevel) || do_miter_as_bevel) {
- if (ZnPolygonInBBox(poly, 4, bbox, NULL) != inside) {
- return 0;
- }
- do_miter_as_bevel = False;
+ if (ZnPolygonInBBox(poly, 4, bbox, NULL) != inside) {
+ return 0;
+ }
+ do_miter_as_bevel = False;
}
}
@@ -1034,13 +1034,13 @@ ZnPolylineInBBox(ZnPoint *points,
*/
if (count == 2) {
ZnGetButtPoints(points, &points[1], width, cap_style == CapProjecting,
- &poly[2], &poly[3]);
+ &poly[2], &poly[3]);
}
else if (join_style == JoinMiter) {
if (ZnGetMiterPoints(points, &points[1], &points[2], width,
- &poly[2], &poly[3]) == False) {
- do_miter_as_bevel = True;
- ZnGetButtPoints(points, &points[1], width, 0, &poly[2], &poly[3]);
+ &poly[2], &poly[3]) == False) {
+ do_miter_as_bevel = True;
+ ZnGetButtPoints(points, &points[1], width, 0, &poly[2], &poly[3]);
}
}
else {
@@ -1073,14 +1073,14 @@ ZnPolylineInBBox(ZnPoint *points,
* polygon or not.
*/
int
-ZnPolygonInBBox(ZnPoint *points,
- unsigned int num_points,
- ZnBBox *bbox,
- ZnBool *area_enclosed)
+ZnPolygonInBBox(ZnPoint *points,
+ unsigned int num_points,
+ ZnBBox *bbox,
+ ZnBool *area_enclosed)
{
- int inside, count;
- ZnPoint *p, *head, *first, *second;
- ZnBool closed;
+ int inside, count;
+ ZnPoint *p, *head, *first, *second;
+ ZnBool closed;
if (area_enclosed) {
*area_enclosed = False;
@@ -1134,8 +1134,8 @@ ZnPolygonInBBox(ZnPoint *points,
}
/*printf("PolygonInBBox, np = %d, x = %g, y = %g, dist = %g\n",
- num_points, bbox->orig.x, bbox->orig.y,
- PolygonToPointDist(points, num_points, &bbox->orig));*/
+ num_points, bbox->orig.x, bbox->orig.y,
+ PolygonToPointDist(points, num_points, &bbox->orig));*/
if (ZnPolygonToPointDist(points, num_points, &bbox->orig) <= 0.0) {
if (area_enclosed) {
*area_enclosed = True;
@@ -1153,14 +1153,14 @@ ZnPolygonInBBox(ZnPoint *points,
* if it is entirely inside and 0 otherwise.
*/
int
-ZnOvalInBBox(ZnPoint *center,
- ZnDim width,
- ZnDim height,
- ZnBBox *bbox)
-{
- ZnPoint origin, corner;
- ZnDim w_2, h_2;
- ZnReal delta_x, delta_y;
+ZnOvalInBBox(ZnPoint *center,
+ ZnDim width,
+ ZnDim height,
+ ZnBBox *bbox)
+{
+ ZnPoint origin, corner;
+ ZnDim w_2, h_2;
+ ZnReal delta_x, delta_y;
w_2 = (width+1)/2;
h_2 = (height+1)/2;
@@ -1259,12 +1259,12 @@ ZnOvalInBBox(ZnPoint *center,
* the result needs precision.
*/
ZnBool
-ZnPointInAngle(int start_angle,
- int angle_extent,
- ZnPoint *p)
+ZnPointInAngle(int start_angle,
+ int angle_extent,
+ ZnPoint *p)
{
ZnReal point_angle;
- int angle_diff;
+ int angle_diff;
if ((p->x == 0) && (p->y == 0)) {
point_angle = 0.0;
@@ -1277,25 +1277,25 @@ ZnPointInAngle(int start_angle,
angle_diff += 360;
}
return ((angle_diff <= angle_extent) ||
- ((angle_extent < 0) && ((angle_diff - 360) >= angle_extent)));
+ ((angle_extent < 0) && ((angle_diff - 360) >= angle_extent)));
}
/*
* PointPolarToCartesian --
- * Convert a point in polar coordinates (rho, theta)
- * in a reference system described by angle heading
- * (angles running clockwise) to a point in cartesian
- * coordinates (delta_x, delta_y).
+ * Convert a point in polar coordinates (rho, theta)
+ * in a reference system described by angle heading
+ * (angles running clockwise) to a point in cartesian
+ * coordinates (delta_x, delta_y).
*
*/
void
-ZnPointPolarToCartesian(ZnReal heading,
- ZnReal rho,
- ZnReal theta,
- ZnReal *delta_x,
- ZnReal *delta_y)
+ZnPointPolarToCartesian(ZnReal heading,
+ ZnReal rho,
+ ZnReal theta,
+ ZnReal *delta_x,
+ ZnReal *delta_y)
{
- ZnReal to_angle;
+ ZnReal to_angle;
/* Compute angle in trigonometric system */
/* to_angle = ZnDegRad(theta) + heading - M_PI_2;*/
@@ -1309,8 +1309,8 @@ ZnPointPolarToCartesian(ZnReal heading,
* Return a vector angle given its projections
*/
ZnReal
-ZnProjectionToAngle(ZnReal dx,
- ZnReal dy)
+ZnProjectionToAngle(ZnReal dx,
+ ZnReal dy)
{
if (dx == 0) {
if (dy < 0) {
@@ -1342,16 +1342,16 @@ ZnProjectionToAngle(ZnReal dx,
* This arc is origin centered.
*/
ZnBool
-ZnHorizLineToArc(ZnReal x1,
- ZnReal x2,
- ZnReal y,
- ZnReal rx,
- ZnReal ry,
- int start_angle,
- int angle_extent)
-{
- ZnReal tmp, x;
- ZnPoint t;
+ZnHorizLineToArc(ZnReal x1,
+ ZnReal x2,
+ ZnReal y,
+ ZnReal rx,
+ ZnReal ry,
+ int start_angle,
+ int angle_extent)
+{
+ ZnReal tmp, x;
+ ZnPoint t;
/*
* Compute the x-coordinate of one possible intersection point
@@ -1390,16 +1390,16 @@ ZnHorizLineToArc(ZnReal x1,
* This arc is origin centered.
*/
ZnBool
-ZnVertLineToArc(ZnReal x,
- ZnReal y1,
- ZnReal y2,
- ZnReal rx,
- ZnReal ry,
- int start_angle,
- int angle_extent)
-{
- ZnReal tmp, y;
- ZnPoint t;
+ZnVertLineToArc(ZnReal x,
+ ZnReal y1,
+ ZnReal y2,
+ ZnReal rx,
+ ZnReal ry,
+ int start_angle,
+ int angle_extent)
+{
+ ZnReal tmp, y;
+ ZnPoint t;
/*
* Compute the y-coordinate of one possible intersection point
@@ -1435,11 +1435,11 @@ ZnVertLineToArc(ZnReal x,
* the rectangle.
*/
ZnDim
-ZnRectangleToPointDist(ZnBBox *bbox,
- ZnPoint *p)
+ZnRectangleToPointDist(ZnBBox *bbox,
+ ZnPoint *p)
{
- ZnDim new_dist, dist;
- ZnPoint p1, p2;
+ ZnDim new_dist, dist;
+ ZnPoint p1, p2;
p1.x = bbox->orig.x;
p1.y = p2.y = bbox->orig.y;
@@ -1484,13 +1484,13 @@ ZnRectangleToPointDist(ZnBBox *bbox,
* described by <xl1,yl1>, <xl2,yl2>..
*/
ZnDim
-ZnLineToPointDist(ZnPoint *p1,
- ZnPoint *p2,
- ZnPoint *p,
- ZnPoint *closest)
+ZnLineToPointDist(ZnPoint *p1,
+ ZnPoint *p2,
+ ZnPoint *p,
+ ZnPoint *closest)
{
- ZnReal x, y;
- ZnReal x_int, y_int;
+ ZnReal x, y;
+ ZnReal x_int, y_int;
/*
* First compute the closest point on the line. This is done
@@ -1532,7 +1532,7 @@ ZnLineToPointDist(ZnPoint *p1,
* on the segment.
*/
else {
- ZnReal a1, a2, b1, b2;
+ ZnReal a1, a2, b1, b2;
a1 = (p2->y - p1->y) / (p2->x - p1->x);
b1 = p1->y - a1*p1->x;
@@ -1545,22 +1545,22 @@ ZnLineToPointDist(ZnPoint *p1,
if (p1->x > p2->x) {
if (x > p1->x) {
- x = p1->x;
- y = p1->y;
+ x = p1->x;
+ y = p1->y;
}
else if (x < p2->x) {
- x = p2->x;
- y = p2->y;
+ x = p2->x;
+ y = p2->y;
}
}
else {
if (x > p2->x) {
- x = p2->x;
- y = p2->y;
+ x = p2->x;
+ y = p2->y;
}
else if (x < p1->x) {
- x = p1->x;
- y = p1->y;
+ x = p1->x;
+ y = p1->y;
}
}
}
@@ -1581,16 +1581,16 @@ ZnLineToPointDist(ZnPoint *p1,
* inside return values are negative.
*/
ZnDim
-ZnPolygonToPointDist(ZnPoint *points,
- unsigned int num_points,
- ZnPoint *p)
+ZnPolygonToPointDist(ZnPoint *points,
+ unsigned int num_points,
+ ZnPoint *p)
{
- ZnDim best_distance, dist;
- int intersections;
- int x_int, y_int;
- ZnPoint *first_point;
- ZnReal x, y;
- ZnPoint p1, p2;
+ ZnDim best_distance, dist;
+ int intersections;
+ int x_int, y_int;
+ ZnPoint *first_point;
+ ZnReal x, y;
+ ZnPoint p1, p2;
/*
* The algorithm iterates through all the edges of the polygon
@@ -1634,12 +1634,12 @@ ZnPolygonToPointDist(ZnPoint *points,
if (p1.x == p2.x) {
x = p1.x;
if (p1.y >= p2.y) {
- y_int = (int) MIN(p1.y, p->y);
- y_int = (int) MAX(y_int, p2.y);
+ y_int = (int) MIN(p1.y, p->y);
+ y_int = (int) MAX(y_int, p2.y);
}
else {
- y_int = (int) MIN(p2.y, p->y);
- y_int = (int) MAX(y_int, p1.y);
+ y_int = (int) MIN(p2.y, p->y);
+ y_int = (int) MAX(y_int, p1.y);
}
y = y_int;
}
@@ -1648,25 +1648,25 @@ ZnPolygonToPointDist(ZnPoint *points,
else if (p1.y == p2.y) {
y = p1.y;
if (p1.x >= p2.x) {
- x_int = (int) MIN(p1.x, p->x);
- x_int = (int) MAX(x_int, p2.x);
- if ((p->y < y) && (p->x < p1.x) && (p->x >= p2.x)) {
- intersections++;
- }
+ x_int = (int) MIN(p1.x, p->x);
+ x_int = (int) MAX(x_int, p2.x);
+ if ((p->y < y) && (p->x < p1.x) && (p->x >= p2.x)) {
+ intersections++;
+ }
}
else {
- x_int = (int) MIN(p2.x, p->x);
- x_int = (int) MAX(x_int, p1.x);
- if ((p->y < y) && (p->x < p2.x) && (p->x >= p1.x)) {
- intersections++;
- }
+ x_int = (int) MIN(p2.x, p->x);
+ x_int = (int) MAX(x_int, p1.x);
+ if ((p->y < y) && (p->x < p2.x) && (p->x >= p1.x)) {
+ intersections++;
+ }
}
x = x_int;
}
/* Other */
else {
- ZnReal a1, b1, a2, b2;
+ ZnReal a1, b1, a2, b2;
a1 = (p2.y - p1.y) / (p2.x - p1.x);
b1 = p1.y - a1 * p1.x;
@@ -1678,30 +1678,30 @@ ZnPolygonToPointDist(ZnPoint *points,
y = a1 * x + b1;
if (p1.x > p2.x) {
- if (x > p1.x) {
- x = p1.x;
- y = p1.y;
- }
- else if (x < p2.x) {
- x = p2.x;
- y = p2.y;
- }
+ if (x > p1.x) {
+ x = p1.x;
+ y = p1.y;
+ }
+ else if (x < p2.x) {
+ x = p2.x;
+ y = p2.y;
+ }
}
else {
- if (x > p2.x) {
- x = p2.x;
- y = p2.y;
- }
- else if (x < p1.x) {
- x = p1.x;
- y = p1.y;
- }
+ if (x > p2.x) {
+ x = p2.x;
+ y = p2.y;
+ }
+ else if (x < p1.x) {
+ x = p1.x;
+ y = p1.y;
+ }
}
- if (((a1 * p->x + b1) > p->y) && /* True if point is lower */
- (p->x >= MIN(p1.x, p2.x)) &&
- (p->x < MAX(p1.x, p2.x))) {
- intersections++;
+ if (((a1 * p->x + b1) > p->y) && /* True if point is lower */
+ (p->x >= MIN(p1.x, p2.x)) &&
+ (p->x < MAX(p1.x, p2.x))) {
+ intersections++;
}
}
@@ -1738,32 +1738,32 @@ ZnPolygonToPointDist(ZnPoint *points,
* in the process.
*/
ZnDim
-ZnPolylineToPointDist(ZnPoint *points,
- unsigned int num_points,
- ZnDim width,
- int cap_style,
- int join_style,
- ZnPoint *p)
-{
- ZnBool miter2bevel = False;
- unsigned int count;
- ZnPoint *ptr;
- ZnPoint outline[5];
- ZnDim dist, best_dist, h_width;
+ZnPolylineToPointDist(ZnPoint *points,
+ unsigned int num_points,
+ ZnDim width,
+ int cap_style,
+ int join_style,
+ ZnPoint *p)
+{
+ ZnBool miter2bevel = False;
+ unsigned int count;
+ ZnPoint *ptr;
+ ZnPoint outline[5];
+ ZnDim dist, best_dist, h_width;
best_dist = 1.0e36;
h_width = width/2.0;
for (count = num_points, ptr = points; count >= 2; count--, ptr++) {
if (((cap_style == CapRound) && (count == num_points)) ||
- ((join_style == JoinRound) && (count != num_points))) {
+ ((join_style == JoinRound) && (count != num_points))) {
dist = hypot(ptr->x - p->x, ptr->y - p->y) - h_width;
if (dist <= 0.0) {
- best_dist = 0.0;
- goto done;
+ best_dist = 0.0;
+ goto done;
}
else if (dist < best_dist) {
- best_dist = dist;
+ best_dist = dist;
}
}
/*
@@ -1783,39 +1783,39 @@ ZnPolylineToPointDist(ZnPoint *points,
* that fills the joint.
*/
if ((join_style == JoinBevel) || miter2bevel) {
- outline[4] = outline[0];
- dist = ZnPolygonToPointDist(outline, 5, p);
- if (dist <= 0.0) {
- best_dist = 0.0;
- goto done;
- }
- else if (dist < best_dist) {
- best_dist = dist;
- }
- miter2bevel = False;
+ outline[4] = outline[0];
+ dist = ZnPolygonToPointDist(outline, 5, p);
+ if (dist <= 0.0) {
+ best_dist = 0.0;
+ goto done;
+ }
+ else if (dist < best_dist) {
+ best_dist = dist;
+ }
+ miter2bevel = False;
}
}
if (count == 2) {
ZnGetButtPoints(ptr, &ptr[1], width, cap_style==CapProjecting,
- &outline[2], &outline[3]);
+ &outline[2], &outline[3]);
}
else if (join_style == JoinMiter) {
if (ZnGetMiterPoints(ptr, &ptr[1], &ptr[2], width,
- &outline[2], &outline[3]) == False) {
- miter2bevel = True;
- ZnGetButtPoints(ptr, &ptr[1], width, 0, &outline[2], &outline[3]);
+ &outline[2], &outline[3]) == False) {
+ miter2bevel = True;
+ ZnGetButtPoints(ptr, &ptr[1], width, 0, &outline[2], &outline[3]);
}
/*printf("2=%g+%g, 3=%g+%g\n",
- outline[2].x, outline[2].y, outline[3].x, outline[3].y);*/
+ outline[2].x, outline[2].y, outline[3].x, outline[3].y);*/
}
else {
ZnGetButtPoints(ptr, &ptr[1], width, 0, &outline[2], &outline[3]);
}
outline[4] = outline[0];
/*printf("0=%g+%g, 1=%g+%g, 2=%g+%g, 3=%g+%g, 4=%g+%g\n",
- outline[0].x, outline[0].y, outline[1].x, outline[1].y,
- outline[2].x, outline[2].y, outline[3].x, outline[3].y,
- outline[4].x, outline[4].y);*/
+ outline[0].x, outline[0].y, outline[1].x, outline[1].y,
+ outline[2].x, outline[2].y, outline[3].x, outline[3].y,
+ outline[4].x, outline[4].y);*/
dist = ZnPolygonToPointDist(outline, 5, p);
if (dist <= 0.0) {
best_dist = 0.0;
@@ -1853,17 +1853,17 @@ ZnPolylineToPointDist(ZnPoint *points,
* if the point is inside.
*/
ZnDim
-ZnOvalToPointDist(ZnPoint *center,
- ZnDim width,
- ZnDim height,
- ZnDim line_width,
- ZnPoint *p)
+ZnOvalToPointDist(ZnPoint *center,
+ ZnDim width,
+ ZnDim height,
+ ZnDim line_width,
+ ZnPoint *p)
{
ZnReal x_delta, y_delta;
- /* ZnReal x_diameter, y_diameter;*/
- ZnDim scaled_distance;
- ZnDim distance_to_outline;
- ZnDim distance_to_center;
+ /* ZnReal x_diameter, y_diameter;*/
+ ZnDim scaled_distance;
+ ZnDim distance_to_outline;
+ ZnDim distance_to_center;
/*
* Compute the distance from the point given to the center
@@ -1875,7 +1875,7 @@ ZnOvalToPointDist(ZnPoint *center,
y_delta = p->y - center->y;
distance_to_center = hypot(x_delta, y_delta);
scaled_distance = hypot(x_delta / ((width + line_width) / 2.0),
- y_delta / ((height + line_width) / 2.0));
+ y_delta / ((height + line_width) / 2.0));
/*
* If the scaled distance is greater than 1.0 the point is outside
@@ -1916,10 +1916,10 @@ ZnOvalToPointDist(ZnPoint *center,
static int bezier_basis[][4] =
{
- { -1, 3, -3, 1},
- { 3, -6, 3, 0},
- { -3, 3, 0, 0},
- { 1, 0, 0, 0}
+ { -1, 3, -3, 1},
+ { 3, -6, 3, 0},
+ { -3, 3, 0, 0},
+ { 1, 0, 0, 0}
};
/*
@@ -1927,19 +1927,19 @@ static int bezier_basis[][4] =
*
* Arc2Param --
*
- * Given a Bezier curve describing an arc and an angle return the parameter
- * value for the intersection point between the arc and the ray at angle.
+ * Given a Bezier curve describing an arc and an angle return the parameter
+ * value for the intersection point between the arc and the ray at angle.
*
**********************************************************************************
*/
#define EVAL(coeff, t) (((coeff[0]*t + coeff[1])*t + coeff[2]) * t + coeff[3])
static ZnReal
-Arc2Param(ZnPoint *controls,
- ZnReal angle)
+Arc2Param(ZnPoint *controls,
+ ZnReal angle)
{
- ZnReal coeff_x[4], coeff_y[4];
- ZnReal min_angle, min_t, max_angle, max_t, cur_angle, cur_t;
- int i, j, depth = 0;
+ ZnReal coeff_x[4], coeff_y[4];
+ ZnReal min_angle, min_t, max_angle, max_t, cur_angle, cur_t;
+ int i, j, depth = 0;
/* assume angle >= 0 */
while (angle > M_PI) {
@@ -1993,19 +1993,19 @@ Arc2Param(ZnPoint *controls,
*
* BezierSubdivide --
*
- * Subdivide a Bezier curve given by controls at parameter t. Return
- * in controls, the first or the last part depending on boolean first.
+ * Subdivide a Bezier curve given by controls at parameter t. Return
+ * in controls, the first or the last part depending on boolean first.
*
**********************************************************************************
*/
static void
-BezierSubdivide(ZnPoint *controls,
- ZnReal t,
- ZnBool first)
+BezierSubdivide(ZnPoint *controls,
+ ZnReal t,
+ ZnBool first)
{
- ZnReal s = 1.0 - t;
- ZnPoint r[7];
- ZnPoint a;
+ ZnReal s = 1.0 - t;
+ ZnPoint r[7];
+ ZnPoint a;
r[0] = controls[0];
r[6] = controls[3];
@@ -2035,22 +2035,22 @@ BezierSubdivide(ZnPoint *controls,
**********************************************************************************
*
* ZnGetBezierPoints --
- * Use recursive subdivision to approximate the curve. The subdivision stops
- * when the error is under eps.
- * This algorithm is adaptive, meaning that it computes the minimum number
- * of segments needed to render each curve part.
+ * Use recursive subdivision to approximate the curve. The subdivision stops
+ * when the error is under eps.
+ * This algorithm is adaptive, meaning that it computes the minimum number
+ * of segments needed to render each curve part.
*
**********************************************************************************
*/
void
-ZnGetBezierPoints(ZnPoint *p1,
- ZnPoint *c1,
- ZnPoint *c2,
- ZnPoint *p2,
- ZnList to_points,
- ZnReal eps)
+ZnGetBezierPoints(ZnPoint *p1,
+ ZnPoint *c1,
+ ZnPoint *c2,
+ ZnPoint *p2,
+ ZnList to_points,
+ ZnReal eps)
{
- ZnReal dist;
+ ZnReal dist;
dist = ZnLineToPointDist(p1, p2, c1, NULL);
if ((dist < eps) && ((c1->x != c2->x) || (c1->y != c2->y))) {
@@ -2058,7 +2058,7 @@ ZnGetBezierPoints(ZnPoint *p1,
}
if (dist > eps) {
- ZnPoint mid_segm, new_c1, new_c2;
+ ZnPoint mid_segm, new_c1, new_c2;
/*
* Subdivide the curve at t = 0.5
* and compute each new curve.
@@ -2091,22 +2091,22 @@ ZnGetBezierPoints(ZnPoint *p1,
**********************************************************************************
*
* ZnGetBezierPath --
- * Compute in to_points a new set of points describing a Bezier path based
- * on the control points given in from_points.
- * If more than four points are given, the algorithm iterate over the
- * set using the last point of a segment as the first point of the next.
- * If 3 points are left, they are interpreted as a Bezier segment with
- * coincident internal control points. If 2 points are left a straight
- * is emitted.
+ * Compute in to_points a new set of points describing a Bezier path based
+ * on the control points given in from_points.
+ * If more than four points are given, the algorithm iterate over the
+ * set using the last point of a segment as the first point of the next.
+ * If 3 points are left, they are interpreted as a Bezier segment with
+ * coincident internal control points. If 2 points are left a straight
+ * is emitted.
*
**********************************************************************************
*/
void
-ZnGetBezierPath(ZnList from_points,
- ZnList to_points)
+ZnGetBezierPath(ZnList from_points,
+ ZnList to_points)
{
- ZnPoint *fp;
- int num_fp, i;
+ ZnPoint *fp;
+ int num_fp, i;
fp = ZnListArray(from_points);
num_fp = ZnListSize(from_points);
@@ -2121,11 +2121,11 @@ ZnGetBezierPath(ZnList from_points,
if (i < (num_fp-3)) {
ZnGetBezierPoints(fp, fp+1, fp+2, fp+3, to_points, 1.0);
if (i < (num_fp-4)) {
- fp += 3;
- i += 3;
+ fp += 3;
+ i += 3;
}
else {
- break;
+ break;
}
}
else if (i == (num_fp-3)) {
@@ -2144,24 +2144,24 @@ ZnGetBezierPath(ZnList from_points,
**********************************************************************************
*
* ZnGetCirclePoints --
- * Return a pointer to an array of points describing a
- * circle arc of radius 1.0. The arc is described by start_angle,
- * end_angle and the type: 0 for arc, 1 for chord, 2 for pie slice,
- * 3 for a full circle (in which case start_angle and end_angle are
- * not used.
- * The number of points is returned in num_points. If type is not 3,
- * point_list must not be NULL. If not NULL, it is filled with the
- * computed points.
+ * Return a pointer to an array of points describing a
+ * circle arc of radius 1.0. The arc is described by start_angle,
+ * end_angle and the type: 0 for arc, 1 for chord, 2 for pie slice,
+ * 3 for a full circle (in which case start_angle and end_angle are
+ * not used.
+ * The number of points is returned in num_points. If type is not 3,
+ * point_list must not be NULL. If not NULL, it is filled with the
+ * computed points.
*
**********************************************************************************
*/
ZnPoint *
-ZnGetCirclePoints(int type,
- int quality,
- ZnReal start_angle,
- ZnReal angle_extent,
- unsigned int *num_points,
- ZnList point_list)
+ZnGetCirclePoints(int type,
+ int quality,
+ ZnReal start_angle,
+ ZnReal angle_extent,
+ unsigned int *num_points,
+ ZnList point_list)
{
static ZnPoint genarc_finest[] = { /* 128 */
{1.0, 0.0},
@@ -2440,11 +2440,11 @@ ZnGetCirclePoints(int type,
{0.809017043478, -0.587785184709},
{1.0, 0.0}
};
- unsigned int num_p, i;
- ZnPoint *p, *p_from;
- ZnPoint center_p = { 0.0, 0.0 };
- ZnPoint start_p, wp;
- ZnReal iangle, end_angle=0;
+ unsigned int num_p, i;
+ ZnPoint *p, *p_from;
+ ZnPoint center_p = { 0.0, 0.0 };
+ ZnPoint start_p, wp;
+ ZnReal iangle, end_angle=0;
switch (quality) {
case ZN_CIRCLE_COARSE:
@@ -2503,7 +2503,7 @@ ZnGetCirclePoints(int type,
ZnListAssertSize(point_list, num_p);
p = ZnListArray(point_list);
for (i = 0; i < num_p; i++, p++, p_from++) {
- *p = *p_from;
+ *p = *p_from;
}
}
else {
@@ -2514,30 +2514,30 @@ ZnGetCirclePoints(int type,
ZnListAdd(point_list, &start_p, ZnListTail);
i = (unsigned int) (start_angle / iangle);
if ((i * iangle) < start_angle) {
- i++;
+ i++;
}
while (1) {
- if (start_angle + iangle <= end_angle) {
- if (i == num_p-1) {
- i = 0;
- }
- ZnListAdd(point_list, &p_from[i], ZnListTail);
- start_angle += iangle;
- i++;
- }
- else {
- wp.x = cos(end_angle);
- wp.y = sin(end_angle);
- ZnListAdd(point_list, &wp, ZnListTail);
- break;
- }
+ if (start_angle + iangle <= end_angle) {
+ if (i == num_p-1) {
+ i = 0;
+ }
+ ZnListAdd(point_list, &p_from[i], ZnListTail);
+ start_angle += iangle;
+ i++;
+ }
+ else {
+ wp.x = cos(end_angle);
+ wp.y = sin(end_angle);
+ ZnListAdd(point_list, &wp, ZnListTail);
+ break;
+ }
}
if (type == 1) {
- ZnListAdd(point_list, &start_p, ZnListTail);
+ ZnListAdd(point_list, &start_p, ZnListTail);
}
else if (type == 2) {
- ZnListAdd(point_list, &center_p, ZnListTail);
- ZnListAdd(point_list, &start_p, ZnListTail);
+ ZnListAdd(point_list, &center_p, ZnListTail);
+ ZnListAdd(point_list, &start_p, ZnListTail);
}
}
p = ZnListArray(point_list);
@@ -2552,12 +2552,12 @@ ZnGetCirclePoints(int type,
**********************************************************************************
*
* ZnGetArcPath --
- * Compute in to_points a set of Bezier control points describing an arc
- * path given the start angle, the stop angle and the type: 0 for arc,
- * 1 for chord, 2 for pie slice.
- * To obtain the actual polygonal shape, the client should use GetBezierPath
- * on the returned controls (after applying transform). The returned arc
- * is circular and centered on 0,0.
+ * Compute in to_points a set of Bezier control points describing an arc
+ * path given the start angle, the stop angle and the type: 0 for arc,
+ * 1 for chord, 2 for pie slice.
+ * To obtain the actual polygonal shape, the client should use GetBezierPath
+ * on the returned controls (after applying transform). The returned arc
+ * is circular and centered on 0,0.
*
**********************************************************************************
*/
@@ -2566,14 +2566,14 @@ static ZnReal arc_nodes_y[4] = { 0.0, 1.0, 0.0, -1.0 };
static ZnReal arc_controls_x[8] = { 1.0, 0.55197, -0.55197, -1.0, -1.0, -0.55197, 0.55197, 1.0 };
static ZnReal arc_controls_y[8] = { 0.55197, 1.0, 1.0, 0.55197, -0.55197, -1.0, -1.0, -0.55197 };
void
-ZnGetArcPath(ZnReal start_angle,
- ZnReal end_angle,
- int type,
- ZnList to_points)
-{
- int start_quad, end_quad, quadrant;
- ZnPoint center_p = { 0.0, 0.0 };
- ZnPoint start_p = center_p;
+ZnGetArcPath(ZnReal start_angle,
+ ZnReal end_angle,
+ int type,
+ ZnList to_points)
+{
+ int start_quad, end_quad, quadrant;
+ ZnPoint center_p = { 0.0, 0.0 };
+ ZnPoint start_p = center_p;
/*
* make sure the output vector is empty.
@@ -2618,7 +2618,7 @@ ZnGetArcPath(ZnReal start_angle,
controls[3].x = arc_nodes_x[(quadrant + 1) % 4];
controls[3].y = arc_nodes_y[(quadrant + 1) % 4];
- if (quadrant == start_quad) {
+ if (quadrant == start_quad) {
t = Arc2Param(controls, start_angle);
BezierSubdivide(controls, t, False);
/*
@@ -2631,7 +2631,7 @@ ZnGetArcPath(ZnReal start_angle,
if (quadrant == end_quad) {
t = Arc2Param(controls, end_angle);
if (!t) {
- break;
+ break;
}
BezierSubdivide(controls, t, True);
}
@@ -2660,19 +2660,19 @@ ZnGetArcPath(ZnReal start_angle,
**********************************************************************************
*
* SmoothPathWithBezier --
- * Compute in to_points a new set of points describing a smoothed path based
- * on the path given in from_points. The algorithm use Bezier cubic curves.
+ * Compute in to_points a new set of points describing a smoothed path based
+ * on the path given in from_points. The algorithm use Bezier cubic curves.
*
**********************************************************************************
*/
void
-ZnSmoothPathWithBezier(ZnPoint *fp,
- unsigned int num_fp,
- ZnList to_points)
+ZnSmoothPathWithBezier(ZnPoint *fp,
+ unsigned int num_fp,
+ ZnList to_points)
{
- ZnBool closed;
- ZnPoint s[4];
- unsigned int i;
+ ZnBool closed;
+ ZnPoint s[4];
+ unsigned int i;
/*
* make sure the output vector is empty
@@ -2741,7 +2741,7 @@ ZnSmoothPathWithBezier(ZnPoint *fp,
* Bezier curve.
*/
if (((fp[0].x == fp[1].x) && (fp[0].y == fp[1].y)) ||
- ((fp[1].x == fp[2].x) && (fp[1].y == fp[2].y))) {
+ ((fp[1].x == fp[2].x) && (fp[1].y == fp[2].y))) {
ZnListAdd(to_points, &s[3], ZnListTail);
}
else {
@@ -2755,17 +2755,17 @@ ZnSmoothPathWithBezier(ZnPoint *fp,
**********************************************************************************
*
* FitBezier --
- * Fit a Bezier curve to a (sub)set of digitized points.
+ * Fit a Bezier curve to a (sub)set of digitized points.
*
- * From: An Algorithm for Automatically Fitting Digitized Curves
- * by Philip J. Schneider in "Graphics Gems", Academic Press, 1990
+ * From: An Algorithm for Automatically Fitting Digitized Curves
+ * by Philip J. Schneider in "Graphics Gems", Academic Press, 1990
*
**********************************************************************************
*/
static ZnReal
-V2DistanceBetween2Points(ZnPoint *a,
- ZnPoint *b)
+V2DistanceBetween2Points(ZnPoint *a,
+ ZnPoint *b)
{
ZnReal dx = a->x - b->x;
ZnReal dy = a->y - b->y;
@@ -2773,20 +2773,20 @@ V2DistanceBetween2Points(ZnPoint *a,
}
static ZnReal
-V2SquaredLength(ZnPoint *a)
-{
+V2SquaredLength(ZnPoint *a)
+{
return (a->x * a->x)+(a->y * a->y);
}
static ZnReal
-V2Length(ZnPoint *a)
+V2Length(ZnPoint *a)
{
return sqrt(V2SquaredLength(a));
}
-
+
static ZnPoint *
-V2Scale(ZnPoint *v,
- ZnReal newlen)
+V2Scale(ZnPoint *v,
+ ZnReal newlen)
{
ZnReal len = V2Length(v);
if (len != 0.0) {
@@ -2814,25 +2814,25 @@ V2Normalize(ZnPoint *v)
return v;
}
static ZnPoint *
-V2Add(ZnPoint *a,
- ZnPoint *b,
- ZnPoint *c)
+V2Add(ZnPoint *a,
+ ZnPoint *b,
+ ZnPoint *c)
{
c->x = a->x + b->x;
c->y = a->y + b->y;
return c;
}
-
+
static ZnReal
-V2Dot(ZnPoint *a,
- ZnPoint *b)
+V2Dot(ZnPoint *a,
+ ZnPoint *b)
{
return (a->x*b->x) + (a->y*b->y);
}
static ZnPoint
-V2AddII(ZnPoint a,
- ZnPoint b)
+V2AddII(ZnPoint a,
+ ZnPoint b)
{
ZnPoint c;
c.x = a.x + b.x;
@@ -2841,8 +2841,8 @@ V2AddII(ZnPoint a,
}
static ZnPoint
-V2ScaleIII(ZnPoint v,
- ZnReal s)
+V2ScaleIII(ZnPoint v,
+ ZnReal s)
{
ZnPoint result;
result.x = v.x * s;
@@ -2851,8 +2851,8 @@ V2ScaleIII(ZnPoint v,
}
static ZnPoint
-V2SubII(ZnPoint a,
- ZnPoint b)
+V2SubII(ZnPoint a,
+ ZnPoint b)
{
ZnPoint c;
c.x = a.x - b.x;
@@ -2864,44 +2864,44 @@ V2SubII(ZnPoint a,
* B0, B1, B2, B3, Bezier multipliers.
*/
static ZnReal
-B0(ZnReal u)
+B0(ZnReal u)
{
ZnReal tmp = 1.0 - u;
return tmp * tmp * tmp;
}
static ZnReal
-B1(ZnReal u)
+B1(ZnReal u)
{
ZnReal tmp = 1.0 - u;
return 3 * u * (tmp * tmp);
}
static ZnReal
-B2(ZnReal u)
+B2(ZnReal u)
{
ZnReal tmp = 1.0 - u;
return 3 * u * u * tmp;
}
static ZnReal
-B3(ZnReal u)
+B3(ZnReal u)
{
return u * u * u;
}
/*
* ChordLengthParameterize --
- * Assign parameter values to digitized points
- * using relative distances between points.
+ * Assign parameter values to digitized points
+ * using relative distances between points.
*/
static ZnReal *
-ChordLengthParameterize(ZnPoint *d,
- unsigned int first,
- unsigned int last)
+ChordLengthParameterize(ZnPoint *d,
+ unsigned int first,
+ unsigned int last)
{
- unsigned int i;
- ZnReal *u;
+ unsigned int i;
+ ZnReal *u;
u = (ZnReal *) ZnMalloc((unsigned) (last-first+1) * sizeof(ZnReal));
@@ -2919,26 +2919,26 @@ ChordLengthParameterize(ZnPoint *d,
/*
* Bezier --
- * Evaluate a Bezier curve at a particular parameter value
+ * Evaluate a Bezier curve at a particular parameter value
*
*/
static ZnPoint
-BezierII(int degree,
- ZnPoint *V,
- ZnReal t)
+BezierII(int degree,
+ ZnPoint *V,
+ ZnReal t)
{
- int i, j;
- ZnPoint Q; /* Point on curve at parameter t */
- ZnPoint *Vtemp; /* Local copy of control points */
+ int i, j;
+ ZnPoint Q; /* Point on curve at parameter t */
+ ZnPoint *Vtemp; /* Local copy of control points */
- /* Copy array */
+ /* Copy array */
Vtemp = (ZnPoint *) ZnMalloc((unsigned)((degree+1) * sizeof (ZnPoint)));
for (i = 0; i <= degree; i++) {
Vtemp[i] = V[i];
}
/* Triangle computation */
- for (i = 1; i <= degree; i++) {
+ for (i = 1; i <= degree; i++) {
for (j = 0; j <= degree-i; j++) {
Vtemp[j].x = (1.0 - t) * Vtemp[j].x + t * Vtemp[j+1].x;
Vtemp[j].y = (1.0 - t) * Vtemp[j].y + t * Vtemp[j+1].y;
@@ -2952,23 +2952,23 @@ BezierII(int degree,
/*
* NewtonRaphsonRootFind --
- * Use Newton-Raphson iteration to find better root.
+ * Use Newton-Raphson iteration to find better root.
*/
static ZnReal
-NewtonRaphsonRootFind(ZnPoint *Q,
- ZnPoint P,
- ZnReal u)
-{
- ZnReal numerator, denominator;
- ZnPoint Q1[3], Q2[2]; /* Q' and Q'' */
- ZnPoint Q_u, Q1_u, Q2_u; /*u evaluated at Q, Q', & Q'' */
- ZnReal uPrime; /* Improved u */
- unsigned int i;
+NewtonRaphsonRootFind(ZnPoint *Q,
+ ZnPoint P,
+ ZnReal u)
+{
+ ZnReal numerator, denominator;
+ ZnPoint Q1[3], Q2[2]; /* Q' and Q'' */
+ ZnPoint Q_u, Q1_u, Q2_u; /*u evaluated at Q, Q', & Q'' */
+ ZnReal uPrime; /* Improved u */
+ unsigned int i;
- /* Compute Q(u) */
+ /* Compute Q(u) */
Q_u = BezierII(3, Q, u);
- /* Generate control vertices for Q' */
+ /* Generate control vertices for Q' */
for (i = 0; i <= 2; i++) {
Q1[i].x = (Q[i+1].x - Q[i].x) * 3.0;
Q1[i].y = (Q[i+1].y - Q[i].y) * 3.0;
@@ -2980,7 +2980,7 @@ NewtonRaphsonRootFind(ZnPoint *Q,
Q2[i].y = (Q1[i+1].y - Q1[i].y) * 2.0;
}
- /* Compute Q'(u) and Q''(u) */
+ /* Compute Q'(u) and Q''(u) */
Q1_u = BezierII(2, Q1, u);
Q2_u = BezierII(1, Q2, u);
@@ -2996,19 +2996,19 @@ NewtonRaphsonRootFind(ZnPoint *Q,
/*
* Reparameterize --
- * Given set of points and their parameterization, try to find
- * a better parameterization.
+ * Given set of points and their parameterization, try to find
+ * a better parameterization.
*/
static ZnReal *
-Reparameterize(ZnPoint *d,
- unsigned int first,
- unsigned int last,
- ZnReal *u,
- ZnPoint *bezCurve)
+Reparameterize(ZnPoint *d,
+ unsigned int first,
+ unsigned int last,
+ ZnReal *u,
+ ZnPoint *bezCurve)
{
- unsigned int nPts = last-first+1;
- unsigned int i;
- ZnReal *uPrime; /* New parameter values */
+ unsigned int nPts = last-first+1;
+ unsigned int i;
+ ZnReal *uPrime; /* New parameter values */
uPrime = (ZnReal *) ZnMalloc(nPts * sizeof(ZnReal));
for (i = first; i <= last; i++) {
@@ -3019,36 +3019,36 @@ Reparameterize(ZnPoint *d,
/*
* GenerateBezier --
- * Use least-squares method to find Bezier control
- * points for region.
+ * Use least-squares method to find Bezier control
+ * points for region.
*/
static void
-GenerateBezier(ZnPoint *d,
- unsigned int first,
- unsigned int last,
- ZnReal *uPrime,
- ZnPoint tHat1,
- ZnPoint tHat2,
- ZnPoint *bez_curve)
-{
- unsigned int i;
- ZnPoint *A0, *A1; /* Precomputed rhs for eqn */
- unsigned int num_points; /* Number of pts in sub-curve */
- ZnReal C[2][2]; /* Matrix C */
- ZnReal X[2]; /* Matrix X */
- ZnReal det_C0_C1; /* Determinants of matrices */
- ZnReal det_C0_X, det_X_C1;
- ZnReal alpha_l; /* Alpha values, left and right */
- ZnReal alpha_r;
- ZnPoint tmp; /* Utility variable */
+GenerateBezier(ZnPoint *d,
+ unsigned int first,
+ unsigned int last,
+ ZnReal *uPrime,
+ ZnPoint tHat1,
+ ZnPoint tHat2,
+ ZnPoint *bez_curve)
+{
+ unsigned int i;
+ ZnPoint *A0, *A1; /* Precomputed rhs for eqn */
+ unsigned int num_points; /* Number of pts in sub-curve */
+ ZnReal C[2][2]; /* Matrix C */
+ ZnReal X[2]; /* Matrix X */
+ ZnReal det_C0_C1; /* Determinants of matrices */
+ ZnReal det_C0_X, det_X_C1;
+ ZnReal alpha_l; /* Alpha values, left and right */
+ ZnReal alpha_r;
+ ZnPoint tmp; /* Utility variable */
num_points = last - first + 1;
A0 = (ZnPoint *) ZnMalloc(num_points * sizeof(ZnPoint));
A1 = (ZnPoint *) ZnMalloc(num_points * sizeof(ZnPoint));
- /* Compute the A's */
+ /* Compute the A's */
for (i = 0; i < num_points; i++) {
- ZnPoint v1, v2;
+ ZnPoint v1, v2;
v1 = tHat1;
v2 = tHat2;
V2Scale(&v1, B1(uPrime[i]));
@@ -3057,7 +3057,7 @@ GenerateBezier(ZnPoint *d,
A1[i] = v2;
}
- /* Create the C and X matrices */
+ /* Create the C and X matrices */
C[0][0] = 0.0;
C[0][1] = 0.0;
C[1][0] = 0.0;
@@ -3072,21 +3072,21 @@ GenerateBezier(ZnPoint *d,
C[1][1] += V2Dot(&A1[i], &A1[i]);
tmp = V2SubII(d[first + i],
- V2AddII(V2ScaleIII(d[first], B0(uPrime[i])),
- V2AddII(V2ScaleIII(d[first], B1(uPrime[i])),
- V2AddII(V2ScaleIII(d[last], B2(uPrime[i])),
- V2ScaleIII(d[last], B3(uPrime[i]))))));
+ V2AddII(V2ScaleIII(d[first], B0(uPrime[i])),
+ V2AddII(V2ScaleIII(d[first], B1(uPrime[i])),
+ V2AddII(V2ScaleIII(d[last], B2(uPrime[i])),
+ V2ScaleIII(d[last], B3(uPrime[i]))))));
X[0] += V2Dot(&A0[i], &tmp);
X[1] += V2Dot(&A1[i], &tmp);
}
- /* Compute the determinants of C and X */
+ /* Compute the determinants of C and X */
det_C0_C1 = C[0][0] * C[1][1] - C[1][0] * C[0][1];
det_C0_X = C[0][0] * X[1] - C[0][1] * X[0];
det_X_C1 = X[0] * C[1][1] - X[1] * C[0][1];
- /* Finally, derive alpha values */
+ /* Finally, derive alpha values */
if (det_C0_C1 == 0.0) {
det_C0_C1 = (C[0][0] * C[1][1]) * 10e-12;
}
@@ -3118,22 +3118,22 @@ GenerateBezier(ZnPoint *d,
/*
* ComputeMaxError --
- * Find the maximum squared distance of digitized points
- * to fitted curve.
+ * Find the maximum squared distance of digitized points
+ * to fitted curve.
*/
static ZnReal
-ComputeMaxError(ZnPoint *d,
- unsigned int first,
- unsigned int last,
- ZnPoint *bez_curve,
- ZnReal *u,
- unsigned int *splitPoint)
-{
- unsigned int i;
- ZnReal maxDist; /* Maximum error */
- ZnReal dist; /* Current error */
- ZnPoint P; /* Point on curve */
- ZnPoint v; /* Vector from point to curve */
+ComputeMaxError(ZnPoint *d,
+ unsigned int first,
+ unsigned int last,
+ ZnPoint *bez_curve,
+ ZnReal *u,
+ unsigned int *splitPoint)
+{
+ unsigned int i;
+ ZnReal maxDist; /* Maximum error */
+ ZnReal dist; /* Current error */
+ ZnPoint P; /* Point on curve */
+ ZnPoint v; /* Vector from point to curve */
*splitPoint = (last - first + 1)/2;
maxDist = 0.0;
@@ -3153,12 +3153,12 @@ ComputeMaxError(ZnPoint *d,
* ComputeLeftTangent,
* ComputeRightTangent,
* ComputeCenterTangent --
- * Approximate unit tangents at endpoints and
- * center of digitized curve.
+ * Approximate unit tangents at endpoints and
+ * center of digitized curve.
*/
static ZnPoint
-ComputeLeftTangent(ZnPoint *d,
- unsigned int end)
+ComputeLeftTangent(ZnPoint *d,
+ unsigned int end)
{
ZnPoint tHat1;
tHat1 = V2SubII(d[end+1], d[end]);
@@ -3167,8 +3167,8 @@ ComputeLeftTangent(ZnPoint *d,
}
static ZnPoint
-ComputeRightTangent(ZnPoint *d,
- unsigned int end)
+ComputeRightTangent(ZnPoint *d,
+ unsigned int end)
{
ZnPoint tHat2;
tHat2 = V2SubII(d[end-1], d[end]);
@@ -3178,10 +3178,10 @@ ComputeRightTangent(ZnPoint *d,
static ZnPoint
-ComputeCenterTangent(ZnPoint *d,
- unsigned int center)
+ComputeCenterTangent(ZnPoint *d,
+ unsigned int center)
{
- ZnPoint V1, V2, tHatCenter;
+ ZnPoint V1, V2, tHatCenter;
V1 = V2SubII(d[center-1], d[center]);
V2 = V2SubII(d[center], d[center+1]);
@@ -3192,24 +3192,24 @@ ComputeCenterTangent(ZnPoint *d,
}
static void
-FitCubic(ZnPoint *d,
- unsigned int first,
- unsigned int last,
- ZnPoint tHat1,
- ZnPoint tHat2,
- ZnReal error,
- ZnList controls)
-{
- ZnPoint *bez_curve; /* Control points of fitted Bezier curve*/
- ZnReal *u; /* Parameter values for point */
- ZnReal *uPrime; /* Improved parameter values */
- ZnReal max_err; /* Maximum fitting error */
- unsigned int splitPoint; /* Point to split point set at */
- unsigned int num_points; /* Number of points in subset */
- ZnReal iteration_err; /* Error below which you try iterating */
- unsigned int max_iter = 4; /* Max times to try iterating */
- ZnPoint tHatCenter; /* Unit tangent vector at splitPoint */
- unsigned int i;
+FitCubic(ZnPoint *d,
+ unsigned int first,
+ unsigned int last,
+ ZnPoint tHat1,
+ ZnPoint tHat2,
+ ZnReal error,
+ ZnList controls)
+{
+ ZnPoint *bez_curve; /* Control points of fitted Bezier curve*/
+ ZnReal *u; /* Parameter values for point */
+ ZnReal *uPrime; /* Improved parameter values */
+ ZnReal max_err; /* Maximum fitting error */
+ unsigned int splitPoint; /* Point to split point set at */
+ unsigned int num_points; /* Number of points in subset */
+ ZnReal iteration_err; /* Error below which you try iterating */
+ unsigned int max_iter = 4; /* Max times to try iterating */
+ ZnPoint tHatCenter; /* Unit tangent vector at splitPoint */
+ unsigned int i;
iteration_err = error * error;
num_points = last - first + 1;
@@ -3247,10 +3247,10 @@ FitCubic(ZnPoint *d,
uPrime = Reparameterize(d, first, last, u, bez_curve);
GenerateBezier(d, first, last, uPrime, tHat1, tHat2, bez_curve);
max_err = ComputeMaxError(d, first, last,
- bez_curve, uPrime, &splitPoint);
+ bez_curve, uPrime, &splitPoint);
if (max_err < error) {
- ZnFree(u);
- return;
+ ZnFree(u);
+ return;
}
ZnFree(u);
u = uPrime;
@@ -3267,12 +3267,12 @@ FitCubic(ZnPoint *d,
}
void
-ZnFitBezier(ZnPoint *pts,
- unsigned int num_points,
- ZnReal error,
- ZnList controls)
+ZnFitBezier(ZnPoint *pts,
+ unsigned int num_points,
+ ZnReal error,
+ ZnList controls)
{
- ZnPoint tHat1, tHat2; /* Unit tangent vectors at endpoints */
+ ZnPoint tHat1, tHat2; /* Unit tangent vectors at endpoints */
tHat1 = ComputeLeftTangent(pts, 0);
tHat2 = ComputeRightTangent(pts, num_points-1);
diff --git a/generic/Geo.h b/generic/Geo.h
index 1e3ac90..a833141 100644
--- a/generic/Geo.h
+++ b/generic/Geo.h
@@ -1,8 +1,8 @@
/*
* Geo.h -- Header for common geometric routines.
*
- * Authors : Patrick Lecoanet.
- * Creation date :
+ * Authors : Patrick Lecoanet.
+ * Creation date :
*
* $Id$
*/
@@ -39,18 +39,18 @@
#ifndef M_PI
-#define M_PI 3.14159265358979323846264338327
+#define M_PI 3.14159265358979323846264338327
#endif
#ifndef M_PI_2
-#define M_PI_2 1.57079632679489661923
+#define M_PI_2 1.57079632679489661923
#endif
#ifndef M_PI_4
-#define M_PI_4 0.78539816339744830962
+#define M_PI_4 0.78539816339744830962
#endif
-#define PRECISION_LIMIT 1.0e-10
-#define X_PRECISION_LIMIT 5.0e-2
-#define ZN_LINE_END_POINTS 6
+#define PRECISION_LIMIT 1.0e-10
+#define X_PRECISION_LIMIT 5.0e-2
+#define ZN_LINE_END_POINTS 6
/*
* Constants used to specify circle approximation quality.
@@ -69,11 +69,11 @@
* points has doubles.
*/
typedef struct {
- double x, y;
+ double x, y;
} ZnPoint;
typedef struct {
- double x, y, w, h;
+ double x, y, w, h;
} ZnRect;
/*
@@ -87,14 +87,14 @@ typedef struct {
* always axes aligned.
*/
typedef struct {
- ZnPoint orig, corner;
+ ZnPoint orig, corner;
} ZnBBox;
typedef struct {
- unsigned int num_points;
- ZnPoint *points;
- char *controls;
- ZnBool cw;
+ unsigned int num_points;
+ ZnPoint *points;
+ char *controls;
+ ZnBool cw;
} ZnContour;
/*
@@ -102,9 +102,9 @@ typedef struct {
* without having to alloc the contours array.
*/
typedef struct {
- unsigned int num_contours;
- ZnContour *contours;
- ZnContour contour1;
+ unsigned int num_contours;
+ ZnContour *contours;
+ ZnContour contour1;
} ZnPoly;
/*
@@ -116,30 +116,30 @@ typedef enum {
} ZnContourCmd;
typedef struct {
- unsigned int num_points;
- ZnPoint *points;
- ZnBool fan; /* When using a fan, all contour vertices must be
- * included to describe the contour as a polygon
- * (clipping code use that to speed up region
- * rendering) and the center must be the first
- * vertex. */
+ unsigned int num_points;
+ ZnPoint *points;
+ ZnBool fan; /* When using a fan, all contour vertices must be
+ * included to describe the contour as a polygon
+ * (clipping code use that to speed up region
+ * rendering) and the center must be the first
+ * vertex. */
} ZnStrip;
typedef struct {
- unsigned int num_strips;
- ZnStrip *strips;
- ZnStrip strip1;
+ unsigned int num_strips;
+ ZnStrip *strips;
+ ZnStrip strip1;
} ZnTriStrip;
#ifndef MIN
-#define MIN(a, b) ((a) <= (b) ? (a) : (b))
+#define MIN(a, b) ((a) <= (b) ? (a) : (b))
#endif
#ifndef MAX
-#define MAX(a, b) ((a) >= (b) ? (a) : (b))
+#define MAX(a, b) ((a) >= (b) ? (a) : (b))
#endif
#ifndef ABS
-#define ABS(a) ((a) < 0 ? -(a) : (a))
+#define ABS(a) ((a) < 0 ? -(a) : (a))
#endif
#define ZnDegRad(angle) \
@@ -153,243 +153,243 @@ typedef struct {
(((int) ((d) + (((d) > 0) ? 0.5 : -0.5))))
void
-ZnPolyInit(ZnPoly *poly);
+ZnPolyInit(ZnPoly *poly);
void
-ZnPolyContour1(ZnPoly *poly,
- ZnPoint *pts,
- unsigned int num_pts,
- ZnBool cw);
+ZnPolyContour1(ZnPoly *poly,
+ ZnPoint *pts,
+ unsigned int num_pts,
+ ZnBool cw);
void
-ZnPolySet(ZnPoly *poly1,
- ZnPoly *poly2);
+ZnPolySet(ZnPoly *poly1,
+ ZnPoly *poly2);
void
-ZnPolyFree(ZnPoly *poly);
+ZnPolyFree(ZnPoly *poly);
void
-ZnTriStrip1(ZnTriStrip *tristrip,
- ZnPoint *pts,
- unsigned int num_pts,
- ZnBool fan);
+ZnTriStrip1(ZnTriStrip *tristrip,
+ ZnPoint *pts,
+ unsigned int num_pts,
+ ZnBool fan);
void
-ZnTriFree(ZnTriStrip *tristrip);
+ZnTriFree(ZnTriStrip *tristrip);
void
-ZnAnchor2Origin(ZnPoint *position,
- ZnDim width,
- ZnDim height,
- Tk_Anchor anchor,
- ZnPoint *origin);
+ZnAnchor2Origin(ZnPoint *position,
+ ZnDim width,
+ ZnDim height,
+ Tk_Anchor anchor,
+ ZnPoint *origin);
void
-ZnOrigin2Anchor(ZnPoint *origin,
- ZnDim width,
- ZnDim height,
- Tk_Anchor anchor,
- ZnPoint *position);
+ZnOrigin2Anchor(ZnPoint *origin,
+ ZnDim width,
+ ZnDim height,
+ Tk_Anchor anchor,
+ ZnPoint *position);
void ZnRectOrigin2Anchor(ZnPoint *rect, Tk_Anchor anchor, ZnPoint *position);
void
-ZnBBox2XRect(ZnBBox *bbox,
- XRectangle *rect);
+ZnBBox2XRect(ZnBBox *bbox,
+ XRectangle *rect);
void
-ZnGetStringBBox(char *str,
- Tk_Font font,
- ZnPos x,
- ZnPos y,
- ZnBBox *str_bbox);
+ZnGetStringBBox(char *str,
+ Tk_Font font,
+ ZnPos x,
+ ZnPos y,
+ ZnBBox *str_bbox);
void
ZnResetBBox(ZnBBox *bbox);
void
ZnCopyBBox(ZnBBox *bbox_from,
- ZnBBox *bbox_to);
+ ZnBBox *bbox_to);
void
ZnIntersectBBox(ZnBBox *bbox1,
- ZnBBox *bbox2,
- ZnBBox *bbox_inter);
+ ZnBBox *bbox2,
+ ZnBBox *bbox_inter);
ZnBool
ZnIsEmptyBBox(ZnBBox *bbox);
void
ZnAddBBoxToBBox(ZnBBox *bbox,
- ZnBBox *bbox2);
+ ZnBBox *bbox2);
void
-ZnAddPointToBBox(ZnBBox *bbox,
- ZnPos px,
- ZnPos py);
+ZnAddPointToBBox(ZnBBox *bbox,
+ ZnPos px,
+ ZnPos py);
void
ZnAddPointsToBBox(ZnBBox *bbox,
- ZnPoint *points,
- unsigned int num_points);
+ ZnPoint *points,
+ unsigned int num_points);
void
-ZnAddStringToBBox(ZnBBox *bbox,
- char *str,
- Tk_Font font,
- ZnPos cx,
- ZnPos cy);
+ZnAddStringToBBox(ZnBBox *bbox,
+ char *str,
+ Tk_Font font,
+ ZnPos cx,
+ ZnPos cy);
ZnBool
-ZnPointInBBox(ZnBBox *bbox,
- ZnPos x,
- ZnPos y);
+ZnPointInBBox(ZnBBox *bbox,
+ ZnPos x,
+ ZnPos y);
int
-ZnLineInBBox(ZnPoint *p1,
- ZnPoint *p2,
- ZnBBox *bbox);
+ZnLineInBBox(ZnPoint *p1,
+ ZnPoint *p2,
+ ZnBBox *bbox);
int
-ZnBBoxInBBox(ZnBBox *bbox1,
- ZnBBox *bbox2);
+ZnBBoxInBBox(ZnBBox *bbox1,
+ ZnBBox *bbox2);
int
-ZnPolylineInBBox(ZnPoint *points,
- unsigned int num_points,
- ZnDim width,
- int cap_style,
- int join_style,
- ZnBBox *bbox);
+ZnPolylineInBBox(ZnPoint *points,
+ unsigned int num_points,
+ ZnDim width,
+ int cap_style,
+ int join_style,
+ ZnBBox *bbox);
int
-ZnPolygonInBBox(ZnPoint *points,
- unsigned int num_points,
- ZnBBox *bbox,
- ZnBool *area_enclosed);
+ZnPolygonInBBox(ZnPoint *points,
+ unsigned int num_points,
+ ZnBBox *bbox,
+ ZnBool *area_enclosed);
int
-ZnOvalInBBox(ZnPoint *center,
- ZnDim width,
- ZnDim height,
- ZnBBox *bbox);
+ZnOvalInBBox(ZnPoint *center,
+ ZnDim width,
+ ZnDim height,
+ ZnBBox *bbox);
ZnBool
-ZnHorizLineToArc(ZnReal x1,
- ZnReal x2,
- ZnReal y,
- ZnReal rx,
- ZnReal ry,
- int start_angle,
- int angle_extent);
+ZnHorizLineToArc(ZnReal x1,
+ ZnReal x2,
+ ZnReal y,
+ ZnReal rx,
+ ZnReal ry,
+ int start_angle,
+ int angle_extent);
ZnBool
-ZnVertLineToArc(ZnReal x,
- ZnReal y1,
- ZnReal y2,
- ZnReal rx,
- ZnReal ry,
- int start_angle,
- int angle_extent);
+ZnVertLineToArc(ZnReal x,
+ ZnReal y1,
+ ZnReal y2,
+ ZnReal rx,
+ ZnReal ry,
+ int start_angle,
+ int angle_extent);
ZnBool
-ZnPointInAngle(int start_angle,
- int angle_extent,
- ZnPoint *p);
+ZnPointInAngle(int start_angle,
+ int angle_extent,
+ ZnPoint *p);
void
-ZnPointPolarToCartesian(ZnReal heading,
- ZnReal rho,
- ZnReal theta,
- ZnReal *delta_x,
- ZnReal *delta_y);
+ZnPointPolarToCartesian(ZnReal heading,
+ ZnReal rho,
+ ZnReal theta,
+ ZnReal *delta_x,
+ ZnReal *delta_y);
ZnReal
-ZnProjectionToAngle(ZnReal dx,
- ZnReal dy);
+ZnProjectionToAngle(ZnReal dx,
+ ZnReal dy);
ZnDim
-ZnRectangleToPointDist(ZnBBox *bbox,
- ZnPoint *p);
+ZnRectangleToPointDist(ZnBBox *bbox,
+ ZnPoint *p);
ZnDim ZnLineToPointDist(ZnPoint *p1, ZnPoint *p2, ZnPoint *p, ZnPoint *closest);
ZnDim
-ZnPolygonToPointDist(ZnPoint *points,
- unsigned int num_points,
- ZnPoint *p);
+ZnPolygonToPointDist(ZnPoint *points,
+ unsigned int num_points,
+ ZnPoint *p);
ZnDim
-ZnPolylineToPointDist(ZnPoint *points,
- unsigned int num_points,
- ZnDim width,
- int cap_style,
- int join_style,
- ZnPoint *p);
+ZnPolylineToPointDist(ZnPoint *points,
+ unsigned int num_points,
+ ZnDim width,
+ int cap_style,
+ int join_style,
+ ZnPoint *p);
ZnDim
-ZnOvalToPointDist(ZnPoint *center,
- ZnDim width,
- ZnDim height,
- ZnDim line_width,
- ZnPoint *p);
+ZnOvalToPointDist(ZnPoint *center,
+ ZnDim width,
+ ZnDim height,
+ ZnDim line_width,
+ ZnPoint *p);
void
-ZnGetButtPoints(ZnPoint *p1,
- ZnPoint *p2,
- ZnDim width,
- ZnBool projecting,
- ZnPoint *c1,
- ZnPoint *c2);
+ZnGetButtPoints(ZnPoint *p1,
+ ZnPoint *p2,
+ ZnDim width,
+ ZnBool projecting,
+ ZnPoint *c1,
+ ZnPoint *c2);
ZnBool
-ZnGetMiterPoints(ZnPoint *p1,
- ZnPoint *p2,
- ZnPoint *p3,
- ZnDim width,
- ZnPoint *c1,
- ZnPoint *c2);
+ZnGetMiterPoints(ZnPoint *p1,
+ ZnPoint *p2,
+ ZnPoint *p3,
+ ZnDim width,
+ ZnPoint *c1,
+ ZnPoint *c2);
ZnBool
-ZnIntersectLines(ZnPoint *a1,
- ZnPoint *a2,
- ZnPoint *b1,
- ZnPoint *b2,
- ZnPoint *pi);
+ZnIntersectLines(ZnPoint *a1,
+ ZnPoint *a2,
+ ZnPoint *b1,
+ ZnPoint *b2,
+ ZnPoint *pi);
void
-ZnShiftLine(ZnPoint *p1,
- ZnPoint *p2,
- ZnDim dist,
- ZnPoint *p3,
- ZnPoint *p4);
+ZnShiftLine(ZnPoint *p1,
+ ZnPoint *p2,
+ ZnDim dist,
+ ZnPoint *p3,
+ ZnPoint *p4);
void
-ZnInsetPolygon(ZnPoint *p,
- unsigned int num_points,
- ZnDim inset);
+ZnInsetPolygon(ZnPoint *p,
+ unsigned int num_points,
+ ZnDim inset);
void
-ZnSmoothPathWithBezier(ZnPoint *from_points,
- unsigned int num_points,
- ZnList to_points);
+ZnSmoothPathWithBezier(ZnPoint *from_points,
+ unsigned int num_points,
+ ZnList to_points);
void
-ZnGetBezierPoints(ZnPoint *p1,
- ZnPoint *c1,
- ZnPoint *c2,
- ZnPoint *p2,
- ZnList to_points,
- double eps);
+ZnGetBezierPoints(ZnPoint *p1,
+ ZnPoint *c1,
+ ZnPoint *c2,
+ ZnPoint *p2,
+ ZnList to_points,
+ double eps);
void
-ZnGetBezierPath(ZnList from_points,
- ZnList to_points);
+ZnGetBezierPath(ZnList from_points,
+ ZnList to_points);
ZnPoint *
-ZnGetCirclePoints(int type,
- int quality,
- ZnReal start_angle,
- ZnReal angle_extent,
- unsigned int *num_points,
- ZnList point_list);
+ZnGetCirclePoints(int type,
+ int quality,
+ ZnReal start_angle,
+ ZnReal angle_extent,
+ unsigned int *num_points,
+ ZnList point_list);
void
-ZnGetArcPath(ZnReal start_angle,
- ZnReal end_angle,
- int type,
- ZnList to_points);
+ZnGetArcPath(ZnReal start_angle,
+ ZnReal end_angle,
+ int type,
+ ZnList to_points);
void
-ZnFitBezier(ZnPoint *pts,
- unsigned int num_points,
- ZnReal error,
- ZnList controls);
+ZnFitBezier(ZnPoint *pts,
+ unsigned int num_points,
+ ZnReal error,
+ ZnList controls);
ZnBool
-ZnTestCCW(ZnPoint *p,
- unsigned int num_points);
+ZnTestCCW(ZnPoint *p,
+ unsigned int num_points);
-#endif /* _Geo_h */
+#endif /* _Geo_h */
diff --git a/generic/Group.c b/generic/Group.c
index 1bb7d41..460532d 100644
--- a/generic/Group.c
+++ b/generic/Group.c
@@ -1,8 +1,8 @@
/*
* Group.c -- Implementation of Group item.
*
- * Authors : Patrick Lecoanet.
- * Creation date : Wed Jun 23 10:09:20 1999
+ * Authors : Patrick Lecoanet.
+ * Creation date : Wed Jun 23 10:09:20 1999
*
* $Id$
*/
@@ -47,27 +47,27 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ "
* Group item special record.
*/
typedef struct _GroupItemStruct {
- ZnItemStruct header;
+ ZnItemStruct header;
/* Public data */
- ZnItem clip;
- unsigned char alpha;
+ ZnItem clip;
+ unsigned char alpha;
/* Private data */
- ZnItem head; /* Doubly linked list of all items. */
- ZnItem tail;
- ZnList dependents; /* List of dependent items. */
+ ZnItem head; /* Doubly linked list of all items. */
+ ZnItem tail;
+ ZnList dependents; /* List of dependent items. */
#ifdef ATC
/* Overlap manager variables.
* These variables are valid *only* if the overlap
* manager is active. */
- ZnBool call_om; /* Tell if there is a need to call the */
- /* overlap manager. */
+ ZnBool call_om; /* Tell if there is a need to call the */
+ /* overlap manager. */
#endif
} GroupItemStruct, *GroupItem;
-#define ATOMIC_BIT (1<<ZN_PRIVATE_FLAGS_OFFSET)
+#define ATOMIC_BIT (1<<ZN_PRIVATE_FLAGS_OFFSET)
/*
@@ -77,7 +77,7 @@ typedef struct _GroupItemStruct {
*
**********************************************************************************
*/
-static ZnAttrConfig group_attrs[] = {
+static ZnAttrConfig group_attrs[] = {
{ ZN_CONFIG_ALPHA, "-alpha", NULL,
Tk_Offset(GroupItemStruct, alpha), 0, ZN_DRAW_FLAG, False },
{ ZN_CONFIG_BOOL, "-atomic", NULL,
@@ -119,11 +119,11 @@ static ZnAttrConfig group_attrs[] = {
**********************************************************************************
*/
static int
-Init(ZnItem item,
- int *argc,
- Tcl_Obj *CONST *args[])
+Init(ZnItem item,
+ int *argc,
+ Tcl_Obj *CONST *args[])
{
- GroupItem group = (GroupItem) item;
+ GroupItem group = (GroupItem) item;
group->head = ZN_NO_ITEM;
group->tail = ZN_NO_ITEM;
@@ -153,15 +153,15 @@ Init(ZnItem item,
**********************************************************************************
*/
static void
-Clone(ZnItem item)
+Clone(ZnItem item)
{
- GroupItem group = (GroupItem) item;
- ZnList dependents;
- ZnItem connected, current_item, new_item;
- ZnItem *items;
- Tcl_HashTable mapping;
- Tcl_HashEntry *entry;
- int new, num_items, i;
+ GroupItem group = (GroupItem) item;
+ ZnList dependents;
+ ZnItem connected, current_item, new_item;
+ ZnItem *items;
+ Tcl_HashTable mapping;
+ Tcl_HashEntry *entry;
+ int new, num_items, i;
if (item == item->wi->top_group) {
/* Do not try to clone the top group */
@@ -210,22 +210,22 @@ Clone(ZnItem item)
for (i = 0; i < num_items; i++, items++) {
entry = Tcl_FindHashEntry(&mapping, (char *) *items);
if (entry == NULL) {
- ZnWarning("Can't find item correspondance in Group Clone\n");
- abort();
+ ZnWarning("Can't find item correspondance in Group Clone\n");
+ abort();
}
else {
- current_item = (ZnItem) Tcl_GetHashValue(entry);
+ current_item = (ZnItem) Tcl_GetHashValue(entry);
}
entry = Tcl_FindHashEntry(&mapping, (char *) current_item->connected_item);
if (entry == NULL) {
- ZnWarning("Can't found item correspondance in Group Clone\n");
- abort();
+ ZnWarning("Can't found item correspondance in Group Clone\n");
+ abort();
}
else {
- /*printf("item %d correspond to ", current_item->connected_item->id);*/
- current_item->connected_item = (ZnItem) Tcl_GetHashValue(entry);
- /*printf("%d\n", current_item->connected_item->id);*/
- ZnInsertDependentItem(current_item);
+ /*printf("item %d correspond to ", current_item->connected_item->id);*/
+ current_item->connected_item = (ZnItem) Tcl_GetHashValue(entry);
+ /*printf("%d\n", current_item->connected_item->id);*/
+ ZnInsertDependentItem(current_item);
}
}
Tcl_DeleteHashTable(&mapping);
@@ -241,10 +241,10 @@ Clone(ZnItem item)
**********************************************************************************
*/
static void
-Destroy(ZnItem item)
+Destroy(ZnItem item)
{
- GroupItem group = (GroupItem) item;
- ZnItem current_item, next_item;
+ GroupItem group = (GroupItem) item;
+ ZnItem current_item, next_item;
current_item = group->head;
while (current_item != ZN_NO_ITEM) {
@@ -267,18 +267,18 @@ Destroy(ZnItem item)
*/
#if defined(SHAPE) && !defined(_WIN32)
static void
-SetXShape(ZnItem grp)
+SetXShape(ZnItem grp)
{
- ZnWInfo *wi = grp->wi;
- ZnItem clip = ((GroupItem) grp)->clip;
- unsigned int i, j, num_pts, max_num_pts;
- ZnPos min_x, min_y, max_x, max_y;
- ZnTriStrip tristrip;
- ZnPoint *p;
- ZnBool simple;
- ZnDim width, height;
- XPoint xpts[3], *xp2, *xpts2;
- TkRegion reg, reg_op, reg_to;
+ ZnWInfo *wi = grp->wi;
+ ZnItem clip = ((GroupItem) grp)->clip;
+ unsigned int i, j, num_pts, max_num_pts;
+ ZnPos min_x, min_y, max_x, max_y;
+ ZnTriStrip tristrip;
+ ZnPoint *p;
+ ZnBool simple;
+ ZnDim width, height;
+ XPoint xpts[3], *xp2, *xpts2;
+ TkRegion reg, reg_op, reg_to;
if (ISCLEAR(wi->flags, ZN_HAS_X_SHAPE)) {
return;
@@ -290,9 +290,9 @@ SetXShape(ZnItem grp)
* changed wi->full_reshape while resetting wi->reshape).
*/
XShapeCombineMask(wi->dpy, Tk_WindowId(wi->win), ShapeBounding,
- 0, 0, None, ShapeSet);
+ 0, 0, None, ShapeSet);
XShapeCombineMask(wi->dpy, wi->real_top, ShapeBounding,
- 0, 0, None, ShapeSet);
+ 0, 0, None, ShapeSet);
}
else {
/*
@@ -307,9 +307,9 @@ SetXShape(ZnItem grp)
* active and reset the mask only in this case (need a flag in wi).
*/
XShapeCombineMask(wi->dpy, Tk_WindowId(wi->win), ShapeBounding,
- 0, 0, None, ShapeSet);
+ 0, 0, None, ShapeSet);
XShapeCombineMask(wi->dpy, wi->real_top, ShapeBounding,
- 0, 0, None, ShapeSet);
+ 0, 0, None, ShapeSet);
}
else {
/*
@@ -323,30 +323,30 @@ SetXShape(ZnItem grp)
max_y = min_y = tristrip.strips[0].points[0].y;
max_num_pts = tristrip.strips[0].num_points;
for (j = 0; j < tristrip.num_strips; j++) {
- p = tristrip.strips[j].points;
- num_pts = tristrip.strips[j].num_points;
- if (num_pts > max_num_pts) {
- max_num_pts = num_pts;
- }
- for (i = 0; i < num_pts; p++, i++) {
- if (p->x < min_x) {
- min_x = p->x;
- }
- if (p->y < min_y) {
- min_y = p->y;
- }
- if (p->x > max_x) {
- max_x = p->x;
- }
- if (p->y > max_y) {
- max_y = p->y;
- }
- }
+ p = tristrip.strips[j].points;
+ num_pts = tristrip.strips[j].num_points;
+ if (num_pts > max_num_pts) {
+ max_num_pts = num_pts;
+ }
+ for (i = 0; i < num_pts; p++, i++) {
+ if (p->x < min_x) {
+ min_x = p->x;
+ }
+ if (p->y < min_y) {
+ min_y = p->y;
+ }
+ if (p->x > max_x) {
+ max_x = p->x;
+ }
+ if (p->y > max_y) {
+ max_y = p->y;
+ }
+ }
}
max_x -= min_x;
max_y -= min_y;
XShapeCombineMask(wi->dpy, wi->full_reshape?Tk_WindowId(wi->win):wi->real_top,
- ShapeBounding, 0, 0, None, ShapeSet);
+ ShapeBounding, 0, 0, None, ShapeSet);
reg = TkCreateRegion();
/*
@@ -357,62 +357,62 @@ SetXShape(ZnItem grp)
width = wi->width;
height = wi->height;
for (j = 0; j < tristrip.num_strips; j++) {
- p = tristrip.strips[j].points;
- num_pts = tristrip.strips[j].num_points;
-
- /*
- * In case of a fan we benefit from the fact that
- * ALL the contour vertices are included in
- * the tristrip, so we can use the corresponding
- * polygon instead of going through all the triangles.
- */
- if (tristrip.strips[j].fan) {
- /* Skip the center */
- p++;
- num_pts--;
- xp2 = xpts2 = ZnMalloc(num_pts*sizeof(XPoint));
- for (i = 0 ; i < num_pts; i++, p++, xp2++) {
- xp2->x = (short) ((p->x - min_x) * width / max_x);
- xp2->y = (short) ((p->y - min_y) * height / max_y);
- }
- reg_op = ZnPolygonRegion(xpts2, num_pts, EvenOddRule);
- reg_to = TkCreateRegion();
- ZnUnionRegion(reg, reg_op, reg_to);
- TkDestroyRegion(reg);
- TkDestroyRegion(reg_op);
- reg = reg_to;
- ZnFree(xpts2);
- }
- else {
- xpts[0].x = (short) ((p->x - min_x) * width / max_x);
- xpts[0].y = (short) ((p->y - min_y) * height / max_y);
- p++;
- xpts[1].x = (short) ((p->x - min_x) * width / max_x);
- xpts[1].y = (short) ((p->y - min_y) * height / max_y);
- p++;
- for (i = 2 ; i < num_pts; i++, p++) {
- xpts[2].x = (short) ((p->x - min_x) * width / max_x);
- xpts[2].y = (short) ((p->y - min_y) * height / max_y);
- reg_op = ZnPolygonRegion(xpts, 3, EvenOddRule);
- reg_to = TkCreateRegion();
- ZnUnionRegion(reg, reg_op, reg_to);
- TkDestroyRegion(reg);
- TkDestroyRegion(reg_op);
- reg = reg_to;
- xpts[0] = xpts[1];
- xpts[1] = xpts[2];
- }
- }
+ p = tristrip.strips[j].points;
+ num_pts = tristrip.strips[j].num_points;
+
+ /*
+ * In case of a fan we benefit from the fact that
+ * ALL the contour vertices are included in
+ * the tristrip, so we can use the corresponding
+ * polygon instead of going through all the triangles.
+ */
+ if (tristrip.strips[j].fan) {
+ /* Skip the center */
+ p++;
+ num_pts--;
+ xp2 = xpts2 = ZnMalloc(num_pts*sizeof(XPoint));
+ for (i = 0 ; i < num_pts; i++, p++, xp2++) {
+ xp2->x = (short) ((p->x - min_x) * width / max_x);
+ xp2->y = (short) ((p->y - min_y) * height / max_y);
+ }
+ reg_op = ZnPolygonRegion(xpts2, num_pts, EvenOddRule);
+ reg_to = TkCreateRegion();
+ ZnUnionRegion(reg, reg_op, reg_to);
+ TkDestroyRegion(reg);
+ TkDestroyRegion(reg_op);
+ reg = reg_to;
+ ZnFree(xpts2);
+ }
+ else {
+ xpts[0].x = (short) ((p->x - min_x) * width / max_x);
+ xpts[0].y = (short) ((p->y - min_y) * height / max_y);
+ p++;
+ xpts[1].x = (short) ((p->x - min_x) * width / max_x);
+ xpts[1].y = (short) ((p->y - min_y) * height / max_y);
+ p++;
+ for (i = 2 ; i < num_pts; i++, p++) {
+ xpts[2].x = (short) ((p->x - min_x) * width / max_x);
+ xpts[2].y = (short) ((p->y - min_y) * height / max_y);
+ reg_op = ZnPolygonRegion(xpts, 3, EvenOddRule);
+ reg_to = TkCreateRegion();
+ ZnUnionRegion(reg, reg_op, reg_to);
+ TkDestroyRegion(reg);
+ TkDestroyRegion(reg_op);
+ reg = reg_to;
+ xpts[0] = xpts[1];
+ xpts[1] = xpts[2];
+ }
+ }
}
XShapeCombineRegion(wi->dpy, wi->full_reshape?wi->real_top:Tk_WindowId(wi->win),
- ShapeBounding, 0, 0, (Region) reg, ShapeSet);
+ ShapeBounding, 0, 0, (Region) reg, ShapeSet);
TkDestroyRegion(reg);
}
}
}
#else
static void
-SetXShape(ZnItem grp)
+SetXShape(ZnItem grp)
{
}
#endif
@@ -426,13 +426,13 @@ SetXShape(ZnItem grp)
**********************************************************************************
*/
static int
-Configure(ZnItem item,
- int argc,
- Tcl_Obj *CONST argv[],
- int *flags)
+Configure(ZnItem item,
+ int argc,
+ Tcl_Obj *CONST argv[],
+ int *flags)
{
- GroupItem group = (GroupItem) item;
- ZnWInfo *wi = item->wi;
+ GroupItem group = (GroupItem) item;
+ ZnWInfo *wi = item->wi;
if (ZnConfigureAttributes(wi, item, item, group_attrs, argc, argv, flags) == TCL_ERROR) {
return TCL_ERROR;
@@ -444,10 +444,10 @@ Configure(ZnItem item,
*/
if (ISSET(*flags, ZN_ITEM_FLAG)) {
if (group->clip &&
- (!group->clip->class->GetClipVertices || (group->clip->parent != item))) {
+ (!group->clip->class->GetClipVertices || (group->clip->parent != item))) {
group->clip = ZN_NO_ITEM;
Tcl_AppendResult(wi->interp,
- " clip item must be a child of the group", NULL);
+ " clip item must be a child of the group", NULL);
return TCL_ERROR;
}
if (!group->clip && (item == wi->top_group)) {
@@ -467,9 +467,9 @@ Configure(ZnItem item,
**********************************************************************************
*/
static int
-Query(ZnItem item,
- int argc,
- Tcl_Obj *CONST argv[])
+Query(ZnItem item,
+ int argc,
+ Tcl_Obj *CONST argv[])
{
if (ZnQueryAttribute(item->wi->interp, item, group_attrs, argv[0]) == TCL_ERROR) {
return TCL_ERROR;
@@ -483,20 +483,20 @@ Query(ZnItem item,
**********************************************************************************
*
* PushClip --
- * Save the current clip shape and current clipbox if needed.
- * Intersect the previous shape and the local to obtain the
- * new current shape. Use this shape to compute the current
- * clipbox and if set_gc is True compute the current region.
+ * Save the current clip shape and current clipbox if needed.
+ * Intersect the previous shape and the local to obtain the
+ * new current shape. Use this shape to compute the current
+ * clipbox and if set_gc is True compute the current region.
*
**********************************************************************************
*/
static void
-PushClip(GroupItem group,
- ZnBool set_gc)
+PushClip(GroupItem group,
+ ZnBool set_gc)
{
- ZnWInfo *wi = ((ZnItem) group)->wi;
- ZnTriStrip tristrip;
- ZnBool simple;
+ ZnWInfo *wi = ((ZnItem) group)->wi;
+ ZnTriStrip tristrip;
+ ZnBool simple;
if ((group->clip != ZN_NO_ITEM) &&
((((ZnItem) group) != wi->top_group)
@@ -517,15 +517,15 @@ PushClip(GroupItem group,
**********************************************************************************
*
* PopClip --
- * Re-install the previous clip shape if any (stack can be empty).
+ * Re-install the previous clip shape if any (stack can be empty).
*
**********************************************************************************
*/
static void
-PopClip(GroupItem group,
- ZnBool set_gc)
+PopClip(GroupItem group,
+ ZnBool set_gc)
{
- ZnWInfo *wi = ((ZnItem) group)->wi;
+ ZnWInfo *wi = ((ZnItem) group)->wi;
if ((group->clip != ZN_NO_ITEM) &&
((((ZnItem) group) != wi->top_group)
@@ -543,13 +543,13 @@ PopClip(GroupItem group,
**********************************************************************************
*
* PushTransform --
- * Save the current transform then concatenate the item transform to
- * form the new current transform.
+ * Save the current transform then concatenate the item transform to
+ * form the new current transform.
*
**********************************************************************************
*/
static void
-PushTransform(ZnItem item)
+PushTransform(ZnItem item)
{
ZnPoint *pos;
@@ -568,8 +568,8 @@ PushTransform(ZnItem item)
}
ZnPushTransform(item->wi, item->transfo, pos,
- ISSET(item->flags, ZN_COMPOSE_SCALE_BIT),
- ISSET(item->flags, ZN_COMPOSE_ROTATION_BIT));
+ ISSET(item->flags, ZN_COMPOSE_SCALE_BIT),
+ ISSET(item->flags, ZN_COMPOSE_ROTATION_BIT));
/*printf("Pushing transfo for item: %d\n;", item->id);
ZnPrintTransfo(wi->current_transfo);*/
}
@@ -579,12 +579,12 @@ PushTransform(ZnItem item)
**********************************************************************************
*
* PopTransform --
- * Restore the previously saved transform from the stack.
+ * Restore the previously saved transform from the stack.
*
**********************************************************************************
*/
static void
-PopTransform(ZnItem item)
+PopTransform(ZnItem item)
{
ZnPoint *pos;
@@ -612,19 +612,19 @@ PopTransform(ZnItem item)
**********************************************************************************
*
* ComputeCoordinates --
- * Compute the geometrical elements of a group. First of all save the current
- * transform and combine it with the item transform. Then call the item
- * ComputeCoordinates method.
- * For regular child items (not groups) some of the code of the item
- * itself is factored out in CallRegularCC.
+ * Compute the geometrical elements of a group. First of all save the current
+ * transform and combine it with the item transform. Then call the item
+ * ComputeCoordinates method.
+ * For regular child items (not groups) some of the code of the item
+ * itself is factored out in CallRegularCC.
*
**********************************************************************************
*/
static void
-CallRegularCC(ZnItem item)
+CallRegularCC(ZnItem item)
{
- ZnWInfo *wi = item->wi;
- /*ZnBBox *clip_box;*/
+ ZnWInfo *wi = item->wi;
+ /*ZnBBox *clip_box;*/
/*
* Do some generic pre-work in behalf of the (regular) children.
@@ -694,14 +694,14 @@ CallRegularCC(ZnItem item)
}
static void
-ComputeCoordinates(ZnItem item,
- ZnBool force)
+ComputeCoordinates(ZnItem item,
+ ZnBool force)
{
- GroupItem group = (GroupItem) item;
- ZnItem current_item;
- ZnItem *deps;
- int num_deps, i;
- ZnBBox *clip_box;
+ GroupItem group = (GroupItem) item;
+ ZnItem current_item;
+ ZnItem *deps;
+ int num_deps, i;
+ ZnBBox *clip_box;
PushTransform(item);
/* printf("Group.c\n");
@@ -727,13 +727,13 @@ ComputeCoordinates(ZnItem item,
* clipbox (i.e the clipbox of the group's parent).
*/
if (force ||
- ISSET(group->clip->inv_flags, ZN_COORDS_FLAG) ||
- ISSET(group->clip->inv_flags, ZN_TRANSFO_FLAG)) {
+ ISSET(group->clip->inv_flags, ZN_COORDS_FLAG) ||
+ ISSET(group->clip->inv_flags, ZN_TRANSFO_FLAG)) {
/*printf("calling cc on clip item %d for group %d\n",
- group->clip->id, item->id);*/
+ group->clip->id, item->id);*/
CallRegularCC(group->clip);
if (item == item->wi->top_group) {
- SetXShape(item);
+ SetXShape(item);
}
/*
* If the clip item has changed we need to compute
@@ -753,19 +753,19 @@ ComputeCoordinates(ZnItem item,
* be updated later.
*/
if ((current_item == group->clip) ||
- (current_item->connected_item != ZN_NO_ITEM)) {
+ (current_item->connected_item != ZN_NO_ITEM)) {
continue;
}
if (force ||
- ISSET(current_item->inv_flags, ZN_COORDS_FLAG) ||
- ISSET(current_item->inv_flags, ZN_TRANSFO_FLAG)) {
+ ISSET(current_item->inv_flags, ZN_COORDS_FLAG) ||
+ ISSET(current_item->inv_flags, ZN_TRANSFO_FLAG)) {
if (current_item->class != ZnGroup) {
- /*printf("calling cc on item %d\n", current_item->id);*/
- CallRegularCC(current_item);
+ /*printf("calling cc on item %d\n", current_item->id);*/
+ CallRegularCC(current_item);
}
else {
- /*printf("calling cc on group %d\n", current_item->id);*/
- current_item->class->ComputeCoordinates(current_item, force);
+ /*printf("calling cc on group %d\n", current_item->id);*/
+ current_item->class->ComputeCoordinates(current_item, force);
}
}
}
@@ -780,11 +780,11 @@ ComputeCoordinates(ZnItem item,
for (i = 0; i < num_deps; i++) {
current_item = deps[i];
if (force ||
- ISSET(current_item->inv_flags, ZN_COORDS_FLAG) ||
- ISSET(current_item->inv_flags, ZN_TRANSFO_FLAG) ||
- ISSET(current_item->connected_item->flags, ZN_UPDATE_DEPENDENT_BIT)) {
- /*printf("Updating dependent: %d\n", current_item->id);*/
- CallRegularCC(current_item);
+ ISSET(current_item->inv_flags, ZN_COORDS_FLAG) ||
+ ISSET(current_item->inv_flags, ZN_TRANSFO_FLAG) ||
+ ISSET(current_item->connected_item->flags, ZN_UPDATE_DEPENDENT_BIT)) {
+ /*printf("Updating dependent: %d\n", current_item->id);*/
+ CallRegularCC(current_item);
}
}
/*
@@ -823,21 +823,21 @@ ComputeCoordinates(ZnItem item,
**********************************************************************************
*
* ToArea --
- * Tell if the object is entirely outside (-1),
- * entirely inside (1) or in between (0).
+ * Tell if the object is entirely outside (-1),
+ * entirely inside (1) or in between (0).
*
**********************************************************************************
*/
static int
-ToArea(ZnItem item,
- ZnToArea ta)
+ToArea(ZnItem item,
+ ZnToArea ta)
{
- GroupItem group = (GroupItem) item;
- ZnItem current_item;
- ZnBBox enclosing, inter;
- int result = -1;
- ZnBool outside, inside;
- ZnBool atomic, report, empty = True;
+ GroupItem group = (GroupItem) item;
+ ZnItem current_item;
+ ZnBBox enclosing, inter;
+ int result = -1;
+ ZnBool outside, inside;
+ ZnBool atomic, report, empty = True;
PushTransform(item);
@@ -849,15 +849,15 @@ ToArea(ZnItem item,
if ((ta->in_group != ZN_NO_ITEM) && (ta->in_group != item)) {
/* No, try the subgroups. */
for (current_item = group->head;
- current_item != ZN_NO_ITEM;
- current_item = current_item->next) {
+ current_item != ZN_NO_ITEM;
+ current_item = current_item->next) {
if (current_item->class != ZnGroup) {
- continue;
+ continue;
}
result = current_item->class->ToArea(current_item, ta);
if (ta->in_group == ZN_NO_ITEM) {
- /* The target group has been found, return its result. */
- goto out;
+ /* The target group has been found, return its result. */
+ goto out;
}
}
/* No group found in this subtree. */
@@ -902,7 +902,7 @@ ToArea(ZnItem item,
current_item != ZN_NO_ITEM;
current_item = current_item->next) {
if (ISCLEAR(current_item->flags, ZN_VISIBLE_BIT) &&
- ISCLEAR(current_item->flags, ZN_SENSITIVE_BIT)) {
+ ISCLEAR(current_item->flags, ZN_SENSITIVE_BIT)) {
continue;
}
/*printf("visible&sensitive %d\n", current_item?current_item->id:0);*/
@@ -913,13 +913,13 @@ ToArea(ZnItem item,
/*printf("bbox test passed %d\n", current_item?current_item->id:0);*/
if ((current_item->class != ZnGroup) || atomic || ta->recursive || ISSET(current_item->flags, ATOMIC_BIT)) {
if (current_item->class != ZnGroup) {
- /*printf("testing %d\n", current_item?current_item->id:0);*/
- PushTransform(current_item);
- result = current_item->class->ToArea(current_item, ta);
- PopTransform(current_item);
+ /*printf("testing %d\n", current_item?current_item->id:0);*/
+ PushTransform(current_item);
+ result = current_item->class->ToArea(current_item, ta);
+ PopTransform(current_item);
}
else {
- result = current_item->class->ToArea(current_item, ta);
+ result = current_item->class->ToArea(current_item, ta);
}
outside &= (result == -1);
inside &= (result == 1);
@@ -934,16 +934,16 @@ ToArea(ZnItem item,
* the most stringent conditions are met.
*/
if (atomic) {
- if (!ta->enclosed && (result >= 0)) {
- result = 0;
- goto out;
- } else if (ta->enclosed && (result == 0)) {
- goto out;
- }
+ if (!ta->enclosed && (result >= 0)) {
+ result = 0;
+ goto out;
+ } else if (ta->enclosed && (result == 0)) {
+ goto out;
+ }
}
if (!ta->report && (result >= ta->enclosed)) {
- /*printf("Doing %d\n", current_item?current_item->id:0);*/
- ZnDoItem(item->wi->interp, current_item, ZN_NO_PART, ta->tag_uid);
+ /*printf("Doing %d\n", current_item?current_item->id:0);*/
+ ZnDoItem(item->wi->interp, current_item, ZN_NO_PART, ta->tag_uid);
}
}
}
@@ -961,10 +961,10 @@ ToArea(ZnItem item,
}
else if (ta->report) { /* Need to report matching children to ancestor */
if (outside && inside) {
- result = 0;
+ result = 0;
}
else {
- result = outside ? -1 : 1;
+ result = outside ? -1 : 1;
}
}
else {
@@ -987,12 +987,12 @@ ToArea(ZnItem item,
**********************************************************************************
*/
static void
-Draw(ZnItem item)
+Draw(ZnItem item)
{
- GroupItem group = (GroupItem) item;
- ZnWInfo *wi = item->wi;
- ZnItem current_item;
- ZnBBox bbox, old_damaged_area, *clip_box;
+ GroupItem group = (GroupItem) item;
+ ZnWInfo *wi = item->wi;
+ ZnItem current_item;
+ ZnBBox bbox, old_damaged_area, *clip_box;
PushTransform(item);
PushClip(group, True);
@@ -1009,29 +1009,29 @@ Draw(ZnItem item)
if (ISSET(current_item->flags, ZN_VISIBLE_BIT)) {
ZnIntersectBBox(&wi->damaged_area, &current_item->item_bounding_box, &bbox);
if (!ZnIsEmptyBBox(&bbox)) {
- if (current_item->class != ZnGroup) {
- PushTransform(current_item);
- }
- current_item->class->Draw(current_item);
- if (wi->draw_bboxes) {
- XGCValues values;
- values.foreground = ZnGetGradientPixel(wi->bbox_color, 0.0);
- values.fill_style = FillSolid;
- values.line_width = 1;
- values.line_style = (current_item->class==ZnGroup)?LineOnOffDash:LineSolid;
- XChangeGC(wi->dpy, wi->gc, GCForeground|GCLineStyle|GCLineWidth|GCFillStyle,
- &values);
- XDrawRectangle(wi->dpy, wi->draw_buffer, wi->gc,
- (int) current_item->item_bounding_box.orig.x,
- (int) current_item->item_bounding_box.orig.y,
- (unsigned int) (current_item->item_bounding_box.corner.x -
- current_item->item_bounding_box.orig.x),
- (unsigned int) (current_item->item_bounding_box.corner.y -
- current_item->item_bounding_box.orig.y));
- }
- if (current_item->class != ZnGroup) {
- PopTransform(current_item);
- }
+ if (current_item->class != ZnGroup) {
+ PushTransform(current_item);
+ }
+ current_item->class->Draw(current_item);
+ if (wi->draw_bboxes) {
+ XGCValues values;
+ values.foreground = ZnGetGradientPixel(wi->bbox_color, 0.0);
+ values.fill_style = FillSolid;
+ values.line_width = 1;
+ values.line_style = (current_item->class==ZnGroup)?LineOnOffDash:LineSolid;
+ XChangeGC(wi->dpy, wi->gc, GCForeground|GCLineStyle|GCLineWidth|GCFillStyle,
+ &values);
+ XDrawRectangle(wi->dpy, wi->draw_buffer, wi->gc,
+ (int) current_item->item_bounding_box.orig.x,
+ (int) current_item->item_bounding_box.orig.y,
+ (unsigned int) (current_item->item_bounding_box.corner.x -
+ current_item->item_bounding_box.orig.x),
+ (unsigned int) (current_item->item_bounding_box.corner.y -
+ current_item->item_bounding_box.orig.y));
+ }
+ if (current_item->class != ZnGroup) {
+ PopTransform(current_item);
+ }
}
}
current_item = current_item->previous;
@@ -1054,17 +1054,17 @@ Draw(ZnItem item)
*/
#ifdef GL
static void
-Render(ZnItem item)
+Render(ZnItem item)
{
- GroupItem group = (GroupItem) item;
- ZnItem current_item;
- ZnWInfo *wi = item->wi;
+ GroupItem group = (GroupItem) item;
+ ZnItem current_item;
+ ZnWInfo *wi = item->wi;
#ifdef GL_DAMAGE
- ZnBBox *clip_box;
- ZnBBox bbox, old_damaged_area;
+ ZnBBox *clip_box;
+ ZnBBox bbox, old_damaged_area;
#endif
- unsigned char save_alpha = wi->alpha;
- unsigned char save_alpha2;
+ unsigned char save_alpha = wi->alpha;
+ unsigned char save_alpha2;
if (ISSET(item->flags, ZN_COMPOSE_ALPHA_BIT)) {
wi->alpha = wi->alpha * group->alpha / 100;
@@ -1093,17 +1093,17 @@ Render(ZnItem item)
ZnIntersectBBox(&wi->damaged_area, &current_item->item_bounding_box, &bbox);
if (!ZnIsEmptyBBox(&bbox) || ISSET(wi->flags, ZN_CONFIGURE_EVENT)) {
#endif
- if (current_item->class != ZnGroup) {
- PushTransform(current_item);
- if (ISCLEAR(current_item->flags, ZN_COMPOSE_ALPHA_BIT)) {
- wi->alpha = 100;
- }
- }
- current_item->class->Render(current_item);
- if (current_item->class != ZnGroup) {
- PopTransform(current_item);
- wi->alpha = save_alpha2;
- }
+ if (current_item->class != ZnGroup) {
+ PushTransform(current_item);
+ if (ISCLEAR(current_item->flags, ZN_COMPOSE_ALPHA_BIT)) {
+ wi->alpha = 100;
+ }
+ }
+ current_item->class->Render(current_item);
+ if (current_item->class != ZnGroup) {
+ PopTransform(current_item);
+ wi->alpha = save_alpha2;
+ }
#ifdef GL_DAMAGE
}
#endif
@@ -1124,7 +1124,7 @@ Render(ZnItem item)
}
#else
static void
-Render(ZnItem item)
+Render(ZnItem item)
{
}
#endif
@@ -1138,11 +1138,11 @@ Render(ZnItem item)
**********************************************************************************
*/
static ZnBool
-IsSensitive(ZnItem item,
- int item_part)
+IsSensitive(ZnItem item,
+ int item_part)
{
- ZnBool sensitive = ISSET(item->flags, ZN_SENSITIVE_BIT);
- ZnItem parent = item->parent;
+ ZnBool sensitive = ISSET(item->flags, ZN_SENSITIVE_BIT);
+ ZnItem parent = item->parent;
while (sensitive && (parent != ZN_NO_ITEM)) {
sensitive &= ISSET(parent->flags, ZN_SENSITIVE_BIT);
@@ -1156,36 +1156,36 @@ IsSensitive(ZnItem item,
**********************************************************************************
*
* Pick --
- * Given a point an an aperture, find the topmost group item/part
- * that is (a) within the pick_aperture
- * (b) the top most
- * (c) has either its sensibility or its visibility set.
+ * Given a point an an aperture, find the topmost group item/part
+ * that is (a) within the pick_aperture
+ * (b) the top most
+ * (c) has either its sensibility or its visibility set.
*
* Results:
- * The return value is the distance of the picked item/part if one
- * has been found or a really big distance if not. a_item and a_part
- * are set to point the picked item/part or to ZN_NO_ITEM/ZN_NO_PART.
- * If the group is ATOMIC, a_item points the group instead of the
- * actual item.
+ * The return value is the distance of the picked item/part if one
+ * has been found or a really big distance if not. a_item and a_part
+ * are set to point the picked item/part or to ZN_NO_ITEM/ZN_NO_PART.
+ * If the group is ATOMIC, a_item points the group instead of the
+ * actual item.
*
* Side effects:
- * None.
+ * None.
*
**********************************************************************************
*/
static double
-Pick(ZnItem item,
- ZnPick ps)
+Pick(ZnItem item,
+ ZnPick ps)
{
- GroupItem group = (GroupItem) item;
- ZnItem p_item=ZN_NO_ITEM, current_item;
- ZnWInfo *wi = item->wi;
- int p_part=0, aperture = ps->aperture;
- double dist, best = 1e10;
- ZnBBox bbox, inter, *clip_box;
- ZnPoint *p = ps->point;
- ZnBool atomic;
- TkRegion reg;
+ GroupItem group = (GroupItem) item;
+ ZnItem p_item=ZN_NO_ITEM, current_item;
+ ZnWInfo *wi = item->wi;
+ int p_part=0, aperture = ps->aperture;
+ double dist, best = 1e10;
+ ZnBBox bbox, inter, *clip_box;
+ ZnPoint *p = ps->point;
+ ZnBool atomic;
+ TkRegion reg;
ps->a_item= ZN_NO_ITEM;
ps->a_part = ZN_NO_PART;
@@ -1203,15 +1203,15 @@ Pick(ZnItem item,
if ((ps->in_group != ZN_NO_ITEM) && (ps->in_group != item)) {
/* No, try the subgroups. */
for (current_item = group->head;
- current_item != ZN_NO_ITEM;
- current_item = current_item->next) {
+ current_item != ZN_NO_ITEM;
+ current_item = current_item->next) {
if (current_item->class != ZnGroup) {
- continue;
+ continue;
}
best = current_item->class->Pick(current_item, ps);
if (ps->in_group == ZN_NO_ITEM) {
- /* The target group has been found, return its result. */
- goto out;
+ /* The target group has been found, return its result. */
+ goto out;
}
}
/* No group found in this subtree. */
@@ -1253,7 +1253,7 @@ Pick(ZnItem item,
* This is _not_ a bug do _not_ modify the test below.
*/
if (ISCLEAR(current_item->flags, ZN_SENSITIVE_BIT) &&
- ISCLEAR(current_item->flags, ZN_VISIBLE_BIT)) {
+ ISCLEAR(current_item->flags, ZN_VISIBLE_BIT)) {
continue;
}
ZnIntersectBBox(&bbox, &current_item->item_bounding_box, &inter);
@@ -1312,29 +1312,29 @@ Pick(ZnItem item,
**********************************************************************************
*
* Coords --
- * Return or edit the group translation (can be also interpreted as the
- * position of the group origin in the group's parent).
+ * Return or edit the group translation (can be also interpreted as the
+ * position of the group origin in the group's parent).
*
**********************************************************************************
*/
static int
-Coords(ZnItem item,
- int contour,
- int index,
- int cmd,
- ZnPoint **pts,
- char **controls,
- unsigned int *num_pts)
+Coords(ZnItem item,
+ int contour,
+ int index,
+ int cmd,
+ ZnPoint **pts,
+ char **controls,
+ unsigned int *num_pts)
{
if ((cmd == ZN_COORDS_ADD) || (cmd == ZN_COORDS_ADD_LAST) || (cmd == ZN_COORDS_REMOVE)) {
Tcl_AppendResult(item->wi->interp,
- " can't add or remove vertices in groups", NULL);
+ " can't add or remove vertices in groups", NULL);
return TCL_ERROR;
}
else if ((cmd == ZN_COORDS_REPLACE) || (cmd == ZN_COORDS_REPLACE_ALL)) {
if (*num_pts == 0) {
Tcl_AppendResult(item->wi->interp,
- " coords command need 1 point on groups", NULL);
+ " coords command need 1 point on groups", NULL);
return TCL_ERROR;
}
if (!item->transfo && ((*pts)[0].x == 0.0) && ((*pts)[0].y == 0.0)) {
@@ -1347,7 +1347,7 @@ Coords(ZnItem item,
ZnITEM.Invalidate(item, ZN_TRANSFO_FLAG);
}
else if ((cmd == ZN_COORDS_READ) || (cmd == ZN_COORDS_READ_ALL)) {
- ZnPoint *p;
+ ZnPoint *p;
ZnListAssertSize(ZnWorkPoints, 1);
p = (ZnPoint *) ZnListArray(ZnWorkPoints);
@@ -1367,15 +1367,15 @@ Coords(ZnItem item,
**********************************************************************************
*/
static void
-PostScript(ZnItem item,
- ZnBool prepass)
+PostScript(ZnItem item,
+ ZnBool prepass)
{
}
ZnItem
-ZnGroupHead(ZnItem group)
+ZnGroupHead(ZnItem group)
{
if (group->class != ZnGroup) {
return ZN_NO_ITEM;
@@ -1384,7 +1384,7 @@ ZnGroupHead(ZnItem group)
}
ZnItem
-ZnGroupTail(ZnItem group)
+ZnGroupTail(ZnItem group)
{
if (group->class != ZnGroup) {
return ZN_NO_ITEM;
@@ -1394,7 +1394,7 @@ ZnGroupTail(ZnItem group)
#ifdef ATC
ZnBool
-ZnGroupCallOm(ZnItem group)
+ZnGroupCallOm(ZnItem group)
{
if (group->class != ZnGroup) {
return False;
@@ -1403,8 +1403,8 @@ ZnGroupCallOm(ZnItem group)
}
void
-ZnGroupSetCallOm(ZnItem group,
- ZnBool set)
+ZnGroupSetCallOm(ZnItem group,
+ ZnBool set)
{
if (group->class != ZnGroup) {
return;
@@ -1413,21 +1413,21 @@ ZnGroupSetCallOm(ZnItem group,
}
#else
ZnBool
-ZnGroupCallOm(ZnItem group)
+ZnGroupCallOm(ZnItem group)
{
return False;
}
void
-ZnGroupSetCallOm(ZnItem group,
- ZnBool set)
+ZnGroupSetCallOm(ZnItem group,
+ ZnBool set)
{
return;
}
#endif
ZnBool
-ZnGroupAtomic(ZnItem group)
+ZnGroupAtomic(ZnItem group)
{
if (group->class != ZnGroup) {
return True;
@@ -1436,8 +1436,8 @@ ZnGroupAtomic(ZnItem group)
}
void
-ZnGroupRemoveClip(ZnItem group,
- ZnItem clip)
+ZnGroupRemoveClip(ZnItem group,
+ ZnItem clip)
{
GroupItem grp = (GroupItem) group;
@@ -1456,9 +1456,9 @@ ZnGroupRemoveClip(ZnItem group,
**********************************************************************************
*/
void
-ZnInsertDependentItem(ZnItem item)
+ZnInsertDependentItem(ZnItem item)
{
- GroupItem group = (GroupItem) item->parent;
+ GroupItem group = (GroupItem) item->parent;
if (!group) {
return;
@@ -1478,11 +1478,11 @@ ZnInsertDependentItem(ZnItem item)
**********************************************************************************
*/
void
-ZnExtractDependentItem(ZnItem item)
+ZnExtractDependentItem(ZnItem item)
{
- GroupItem group = (GroupItem) item->parent;
- unsigned int index, num_items;
- ZnItem *deps;
+ GroupItem group = (GroupItem) item->parent;
+ unsigned int index, num_items;
+ ZnItem *deps;
if (!group || !group->dependents) {
return;
@@ -1493,9 +1493,9 @@ ZnExtractDependentItem(ZnItem item)
if (deps[index]->id == item->id) {
ZnListDelete(group->dependents, index);
if (ZnListSize(group->dependents) == 0) {
- ZnListFree(group->dependents);
- group->dependents = NULL;
- break;
+ ZnListFree(group->dependents);
+ group->dependents = NULL;
+ break;
}
}
}
@@ -1506,18 +1506,18 @@ ZnExtractDependentItem(ZnItem item)
**********************************************************************************
*
* ZnDisconnectDependentItems --
- *
+ *
*
**********************************************************************************
*/
void
-ZnDisconnectDependentItems(ZnItem item)
+ZnDisconnectDependentItems(ZnItem item)
{
- ZnItem current_item;
- GroupItem group = (GroupItem) item->parent;
- ZnItem *deps;
- unsigned int num_deps;
- int i;
+ ZnItem current_item;
+ GroupItem group = (GroupItem) item->parent;
+ ZnItem *deps;
+ unsigned int num_deps;
+ int i;
if (!group || !group->dependents) {
return;
@@ -1548,9 +1548,9 @@ ZnDisconnectDependentItems(ZnItem item)
**********************************************************************************
*/
void
-ZnGroupExtractItem(ZnItem item)
+ZnGroupExtractItem(ZnItem item)
{
- GroupItem group;
+ GroupItem group;
if (!item->parent) {
return;
@@ -1587,12 +1587,12 @@ ZnGroupExtractItem(ZnItem item)
**********************************************************************************
*/
void
-ZnGroupInsertItem(ZnItem group,
- ZnItem item,
- ZnItem mark_item,
- ZnBool before)
+ZnGroupInsertItem(ZnItem group,
+ ZnItem item,
+ ZnItem mark_item,
+ ZnBool before)
{
- GroupItem grp = (GroupItem) group;
+ GroupItem grp = (GroupItem) group;
/*
* Empty list, add the first item.
@@ -1620,7 +1620,7 @@ ZnGroupInsertItem(ZnItem group,
else {
mark_item = grp->head;
while ((mark_item != ZN_NO_ITEM) &&
- (mark_item->priority > item->priority)) {
+ (mark_item->priority > item->priority)) {
mark_item = mark_item->next;
}
before = True;
@@ -1655,10 +1655,10 @@ ZnGroupInsertItem(ZnItem group,
item->previous = mark_item;
item->next = mark_item->next;
if (item->next == ZN_NO_ITEM) {
- grp->tail = item;
+ grp->tail = item;
}
else {
- item->next->previous = item;
+ item->next->previous = item;
}
mark_item->next = item;
}
@@ -1675,16 +1675,16 @@ ZnGroupInsertItem(ZnItem group,
**********************************************************************************
*/
static void
-GetAnchor(ZnItem item,
- Tk_Anchor anchor,
- ZnPoint *p)
+GetAnchor(ZnItem item,
+ Tk_Anchor anchor,
+ ZnPoint *p)
{
ZnBBox *bbox = &item->item_bounding_box;
ZnOrigin2Anchor(&bbox->orig,
- bbox->corner.x - bbox->orig.x,
- bbox->corner.y - bbox->orig.y,
- anchor, p);
+ bbox->corner.x - bbox->orig.x,
+ bbox->corner.y - bbox->orig.y,
+ anchor, p);
}
@@ -1699,33 +1699,33 @@ static ZnItemClassStruct GROUP_ITEM_CLASS = {
"group",
sizeof(GroupItemStruct),
group_attrs,
- 0, /* num_parts */
- ZN_CLASS_ONE_COORD, /* flags */
+ 0, /* num_parts */
+ ZN_CLASS_ONE_COORD, /* flags */
-1,
Init,
Clone,
Destroy,
Configure,
Query,
- NULL, /* GetFieldSet */
+ NULL, /* GetFieldSet */
GetAnchor,
- NULL, /* GetClipVertices */
- NULL, /* GetContours */
+ NULL, /* GetClipVertices */
+ NULL, /* GetContours */
Coords,
- NULL, /* InsertChars */
- NULL, /* DeleteChars */
- NULL, /* Cursor */
- NULL, /* Index */
- NULL, /* Part */
- NULL, /* Selection */
- NULL, /* Contour */
+ NULL, /* InsertChars */
+ NULL, /* DeleteChars */
+ NULL, /* Cursor */
+ NULL, /* Index */
+ NULL, /* Part */
+ NULL, /* Selection */
+ NULL, /* Contour */
ComputeCoordinates,
ToArea,
Draw,
Render,
IsSensitive,
Pick,
- NULL, /* PickVertex */
+ NULL, /* PickVertex */
PostScript
};
diff --git a/generic/Group.h b/generic/Group.h
index a31e06f..d72aa48 100644
--- a/generic/Group.h
+++ b/generic/Group.h
@@ -1,8 +1,8 @@
/*
* Group.h -- Header for Group items.
*
- * Authors : Patrick Lecoanet.
- * Creation date :
+ * Authors : Patrick Lecoanet.
+ * Creation date :
*
* $Id$
*/
diff --git a/generic/Icon.c b/generic/Icon.c
index e6f8971..805fdd9 100644
--- a/generic/Icon.c
+++ b/generic/Icon.c
@@ -1,8 +1,8 @@
/*
* Icon.c -- Implementation of Icon item.
*
- * Authors : Patrick LECOANET
- * Creation date : Sat Mar 25 13:53:39 1995
+ * Authors : Patrick LECOANET
+ * Creation date : Sat Mar 25 13:53:39 1995
*/
/*
@@ -46,22 +46,22 @@ static const char compile_id[] = "$Compile: " __FILE__ " " __DATE__ " " __TIME__
**********************************************************************************
*/
typedef struct _IconItemStruct {
- ZnItemStruct header;
+ ZnItemStruct header;
/* Public data */
- ZnPoint pos;
- ZnImage image;
- Tk_Anchor anchor;
- Tk_Anchor connection_anchor;
- ZnGradient *color; /* Used only if the image is a bitmap (in GL alpha part
- * is always meaningful). */
+ ZnPoint pos;
+ ZnImage image;
+ Tk_Anchor anchor;
+ Tk_Anchor connection_anchor;
+ ZnGradient *color; /* Used only if the image is a bitmap (in GL alpha part
+ * is always meaningful). */
/* Private data */
- ZnPoint dev[4];
+ ZnPoint dev[4];
} IconItemStruct, *IconItem;
-static ZnAttrConfig icon_attrs[] = {
+static ZnAttrConfig icon_attrs[] = {
{ ZN_CONFIG_ANCHOR, "-anchor", NULL,
Tk_Offset(IconItemStruct, anchor), 0, ZN_COORDS_FLAG, False },
{ ZN_CONFIG_GRADIENT, "-color", NULL,
@@ -111,12 +111,12 @@ static ZnAttrConfig icon_attrs[] = {
**********************************************************************************
*/
static int
-Init(ZnItem item,
- int *argc,
- Tcl_Obj *CONST *args[])
+Init(ZnItem item,
+ int *argc,
+ Tcl_Obj *CONST *args[])
{
- ZnWInfo *wi = item->wi;
- IconItem icon = (IconItem) item;
+ ZnWInfo *wi = item->wi;
+ IconItem icon = (IconItem) item;
/*printf("size of an icon(header) = %d(%d)\n",
sizeof(IconItemStruct), sizeof(ZnItemStruct));*/
@@ -147,9 +147,9 @@ Init(ZnItem item,
**********************************************************************************
*/
static void
-Clone(ZnItem item)
+Clone(ZnItem item)
{
- IconItem icon = (IconItem) item;
+ IconItem icon = (IconItem) item;
if (icon->image != ZnUnspecifiedImage) {
icon->image = ZnGetImageByValue(icon->image, ZnUpdateItemImage, item);
@@ -166,9 +166,9 @@ Clone(ZnItem item)
**********************************************************************************
*/
static void
-Destroy(ZnItem item)
+Destroy(ZnItem item)
{
- IconItem icon = (IconItem) item;
+ IconItem icon = (IconItem) item;
if (icon->image != ZnUnspecifiedImage) {
ZnFreeImage(icon->image, ZnUpdateItemImage, item);
@@ -186,16 +186,16 @@ Destroy(ZnItem item)
**********************************************************************************
*/
static int
-Configure(ZnItem item,
- int argc,
- Tcl_Obj *CONST argv[],
- int *flags)
+Configure(ZnItem item,
+ int argc,
+ Tcl_Obj *CONST argv[],
+ int *flags)
{
- ZnItem old_connected;
+ ZnItem old_connected;
old_connected = item->connected_item;
if (ZnConfigureAttributes(item->wi, item, item, icon_attrs,
- argc, argv, flags) == TCL_ERROR) {
+ argc, argv, flags) == TCL_ERROR) {
return TCL_ERROR;
}
@@ -205,8 +205,8 @@ Configure(ZnItem item,
* to the old one.
*/
if ((item->connected_item == ZN_NO_ITEM) ||
- (ISSET(item->connected_item->class->flags, ZN_CLASS_HAS_ANCHORS) &&
- (item->parent == item->connected_item->parent))) {
+ (ISSET(item->connected_item->class->flags, ZN_CLASS_HAS_ANCHORS) &&
+ (item->parent == item->connected_item->parent))) {
ZnITEM.UpdateItemDependency(item, old_connected);
}
else {
@@ -226,9 +226,9 @@ Configure(ZnItem item,
**********************************************************************************
*/
static int
-Query(ZnItem item,
- int argc,
- Tcl_Obj *CONST argv[])
+Query(ZnItem item,
+ int argc,
+ Tcl_Obj *CONST argv[])
{
if (ZnQueryAttribute(item->wi->interp, item, icon_attrs, argv[0]) == TCL_ERROR) {
return TCL_ERROR;
@@ -246,13 +246,13 @@ Query(ZnItem item,
**********************************************************************************
*/
static void
-ComputeCoordinates(ZnItem item,
- ZnBool force)
+ComputeCoordinates(ZnItem item,
+ ZnBool force)
{
- ZnWInfo *wi = item->wi;
- IconItem icon = (IconItem) item;
- int width, height, i;
- ZnPoint pos, quad[4];
+ ZnWInfo *wi = item->wi;
+ IconItem icon = (IconItem) item;
+ int width, height, i;
+ ZnPoint pos, quad[4];
ZnResetBBox(&item->item_bounding_box);
@@ -276,7 +276,7 @@ ComputeCoordinates(ZnItem item,
ZnTransfo t;
item->connected_item->class->GetAnchor(item->connected_item,
- icon->connection_anchor, quad);
+ icon->connection_anchor, quad);
ZnTransfoInvert(wi->current_transfo, &t);
ZnTransformPoint(&t, quad, &pos);
}
@@ -313,16 +313,16 @@ ComputeCoordinates(ZnItem item,
**********************************************************************************
*
* ToArea --
- * Tell if the object is entirely outside (-1),
- * entirely inside (1) or in between (0).
+ * Tell if the object is entirely outside (-1),
+ * entirely inside (1) or in between (0).
*
**********************************************************************************
*/
static int
-ToArea(ZnItem item,
- ZnToArea ta)
+ToArea(ZnItem item,
+ ZnToArea ta)
{
- IconItem icon = (IconItem) item;
+ IconItem icon = (IconItem) item;
if (icon->image == ZnUnspecifiedImage) {
return -1;
@@ -340,17 +340,17 @@ ToArea(ZnItem item,
**********************************************************************************
*/
static void
-Draw(ZnItem item)
+Draw(ZnItem item)
{
- ZnWInfo *wi = item->wi;
- IconItem icon = (IconItem) item;
- XGCValues values;
- unsigned int gc_mask = 0;
- int w, h;
- ZnBBox box, inter, *clip_box;
- TkRegion clip_region, photo_region, clip;
- ZnBool simple;
- Pixmap pixmap;
+ ZnWInfo *wi = item->wi;
+ IconItem icon = (IconItem) item;
+ XGCValues values;
+ unsigned int gc_mask = 0;
+ int w, h;
+ ZnBBox box, inter, *clip_box;
+ TkRegion clip_region, photo_region, clip;
+ ZnBool simple;
+ Pixmap pixmap;
if (icon->image == ZnUnspecifiedImage) {
return;
@@ -379,65 +379,65 @@ Draw(ZnItem item)
* on the image size.
*/
if (photo_region == NULL) {
- XRectangle rect;
- rect.x = rect.y = 0;
- rect.width = w;
- rect.height = h;
- TkUnionRectWithRegion(&rect, clip, clip);
+ XRectangle rect;
+ rect.x = rect.y = 0;
+ rect.width = w;
+ rect.height = h;
+ TkUnionRectWithRegion(&rect, clip, clip);
}
else {
- ZnUnionRegion(clip, photo_region, clip);
+ ZnUnionRegion(clip, photo_region, clip);
}
ZnOffsetRegion(clip, (int) icon->dev->x, (int) icon->dev->y);
TkIntersectRegion(clip_region, clip, clip);
TkSetRegion(wi->dpy, wi->gc, clip);
XCopyArea(wi->dpy, pixmap, wi->draw_buffer, wi->gc,
- (int) (box.orig.x-icon->dev->x),
- (int) (box.orig.y-icon->dev->y),
- (unsigned int) (box.corner.x-box.orig.x),
- (unsigned int) (box.corner.y-box.orig.y),
- (int) box.orig.x,
- (int) box.orig.y);
+ (int) (box.orig.x-icon->dev->x),
+ (int) (box.orig.y-icon->dev->y),
+ (unsigned int) (box.corner.x-box.orig.x),
+ (unsigned int) (box.corner.y-box.orig.y),
+ (int) box.orig.x,
+ (int) box.orig.y);
values.clip_x_origin = values.clip_y_origin = 0;
XChangeGC(wi->dpy, wi->gc, GCClipXOrigin|GCClipYOrigin, &values);
TkSetRegion(wi->dpy, wi->gc, clip_region);
TkDestroyRegion(clip);
}
else {
- ZnPoint box[4];
- int i;
- XImage *dest_im, *src_im;
- XImage *dest_mask, *src_mask;
- Pixmap drw, mask;
+ ZnPoint box[4];
+ int i;
+ XImage *dest_im, *src_im;
+ XImage *dest_mask, *src_mask;
+ Pixmap drw, mask;
unsigned int dest_im_width, dest_im_height;
unsigned int max_width, max_height;
- GC gc, mask_gc;
- TkRegion current_clip;
- ZnBBox *current_clip_box;
+ GC gc, mask_gc;
+ TkRegion current_clip;
+ ZnBBox *current_clip_box;
dest_im_width = (unsigned int) (item->item_bounding_box.corner.x -
- item->item_bounding_box.orig.x);
+ item->item_bounding_box.orig.x);
max_width = MAX(dest_im_width, (unsigned int) w);
dest_im_height = (unsigned int) (item->item_bounding_box.corner.y -
- item->item_bounding_box.orig.y);
+ item->item_bounding_box.orig.y);
max_height = MAX(dest_im_height, (unsigned int) h);
mask = Tk_GetPixmap(wi->dpy, wi->draw_buffer, max_width, max_height, 1);
drw = Tk_GetPixmap(wi->dpy, wi->draw_buffer, max_width, max_height,
- Tk_Depth(wi->win));
+ Tk_Depth(wi->win));
mask_gc = XCreateGC(wi->dpy, mask, 0, NULL);
gc = XCreateGC(wi->dpy, drw, 0, NULL);
dest_mask = XCreateImage(wi->dpy, Tk_Visual(wi->win), 1,
- XYPixmap, 0, NULL, dest_im_width, dest_im_height,
- 8, 0);
+ XYPixmap, 0, NULL, dest_im_width, dest_im_height,
+ 8, 0);
dest_mask->data = ZnMalloc(dest_mask->bytes_per_line * dest_mask->height);
memset(dest_mask->data, 0, dest_mask->bytes_per_line * dest_mask->height);
XSetForeground(wi->dpy, mask_gc, 0);
XFillRectangle(wi->dpy, mask, mask_gc, 0, 0, max_width, max_height);
dest_im = XCreateImage(wi->dpy, Tk_Visual(wi->win), Tk_Depth(wi->win),
- ZPixmap, 0, NULL, dest_im_width, dest_im_height,
- 32, 0);
+ ZPixmap, 0, NULL, dest_im_width, dest_im_height,
+ 32, 0);
dest_im->data = ZnMalloc(dest_im->bytes_per_line * dest_im->height);
memset(dest_im->data, 0, dest_im->bytes_per_line * dest_im->height);
@@ -451,14 +451,14 @@ Draw(ZnItem item)
* on the image size.
*/
if (photo_region == NULL) {
- XRectangle rect;
- rect.x = rect.y = 0;
- rect.width = w;
- rect.height = h;
- TkUnionRectWithRegion(&rect, clip, clip);
+ XRectangle rect;
+ rect.x = rect.y = 0;
+ rect.width = w;
+ rect.height = h;
+ TkUnionRectWithRegion(&rect, clip, clip);
}
else {
- ZnUnionRegion(clip, photo_region, clip);
+ ZnUnionRegion(clip, photo_region, clip);
}
XSetForeground(wi->dpy, mask_gc, 1);
TkSetRegion(wi->dpy, mask_gc, clip);
@@ -472,10 +472,10 @@ Draw(ZnItem item)
box[2] = icon->dev[3];
box[3] = icon->dev[2];
for (i = 0; i < 4; i++) {
- box[i].x -= item->item_bounding_box.orig.x;
- box[i].y -= item->item_bounding_box.orig.y;
- box[i].x = ZnNearestInt(box[i].x);
- box[i].y = ZnNearestInt(box[i].y);
+ box[i].x -= item->item_bounding_box.orig.x;
+ box[i].y -= item->item_bounding_box.orig.y;
+ box[i].x = ZnNearestInt(box[i].x);
+ box[i].y = ZnNearestInt(box[i].y);
}
ZnMapImage(src_mask, dest_mask, box);
@@ -484,20 +484,20 @@ Draw(ZnItem item)
ZnCurrentClip(wi, &current_clip, &current_clip_box, NULL);
TkSetRegion(wi->dpy, mask_gc, current_clip);
XSetClipOrigin(wi->dpy, mask_gc,
- (int) -item->item_bounding_box.orig.x, (int) -item->item_bounding_box.orig.y);
+ (int) -item->item_bounding_box.orig.x, (int) -item->item_bounding_box.orig.y);
TkPutImage(NULL, 0,wi->dpy, mask, mask_gc, dest_mask,
- 0, 0, 0, 0, dest_im_width, dest_im_height);
+ 0, 0, 0, 0, dest_im_width, dest_im_height);
TkPutImage(NULL, 0, wi->dpy, drw, gc, dest_im,
- 0, 0, 0, 0, dest_im_width, dest_im_height);
+ 0, 0, 0, 0, dest_im_width, dest_im_height);
XSetClipMask(wi->dpy, gc, mask);
XSetClipOrigin(wi->dpy, gc,
- (int) item->item_bounding_box.orig.x,
- (int) item->item_bounding_box.orig.y);
+ (int) item->item_bounding_box.orig.x,
+ (int) item->item_bounding_box.orig.y);
XCopyArea(wi->dpy, drw, wi->draw_buffer, gc,
- 0, 0, dest_im_width, dest_im_height,
- (int) item->item_bounding_box.orig.x,
- (int) item->item_bounding_box.orig.y);
+ 0, 0, dest_im_width, dest_im_height,
+ (int) item->item_bounding_box.orig.x,
+ (int) item->item_bounding_box.orig.y);
XFreeGC(wi->dpy, gc);
XFreeGC(wi->dpy, mask_gc);
@@ -522,8 +522,8 @@ Draw(ZnItem item)
if (ZnTransfoIsTranslation(item->wi->current_transfo)) {
ZnCurrentClip(wi, NULL, &clip_box, &simple);
if (simple) {
- ZnIntersectBBox(&box, clip_box, &inter);
- box = inter;
+ ZnIntersectBBox(&box, clip_box, &inter);
+ box = inter;
}
values.fill_style = FillStippled;
values.stipple = pixmap;
@@ -533,25 +533,25 @@ Draw(ZnItem item)
gc_mask |= GCFillStyle|GCStipple|GCTileStipXOrigin|GCTileStipYOrigin|GCForeground;
XChangeGC(wi->dpy, wi->gc, gc_mask, &values);
XFillRectangle(wi->dpy, wi->draw_buffer, wi->gc,
- (int) box.orig.x,
- (int) box.orig.y,
- (unsigned int) (box.corner.x-box.orig.x),
- (unsigned int) (box.corner.y-box.orig.y));
+ (int) box.orig.x,
+ (int) box.orig.y,
+ (unsigned int) (box.corner.x-box.orig.x),
+ (unsigned int) (box.corner.y-box.orig.y));
}
else {
- ZnPoint box[4];
- int i;
- XImage *dest_im, *src_im;
- Pixmap drw;
+ ZnPoint box[4];
+ int i;
+ XImage *dest_im, *src_im;
+ Pixmap drw;
unsigned int dest_im_width, dest_im_height;
unsigned int max_width, max_height;
- GC gc;
+ GC gc;
dest_im_width = (unsigned int) (item->item_bounding_box.corner.x -
- item->item_bounding_box.orig.x);
+ item->item_bounding_box.orig.x);
max_width = MAX(dest_im_width, (unsigned int) w);
dest_im_height = (unsigned int) (item->item_bounding_box.corner.y -
- item->item_bounding_box.orig.y);
+ item->item_bounding_box.orig.y);
max_height = MAX(dest_im_height, (unsigned int) h);
drw = Tk_GetPixmap(wi->dpy, wi->draw_buffer, max_width, max_height, 1);
@@ -559,8 +559,8 @@ Draw(ZnItem item)
XSetForeground(wi->dpy, gc, 0);
XFillRectangle(wi->dpy, drw, gc, 0, 0, max_width, max_height);
dest_im = XCreateImage(wi->dpy, Tk_Visual(wi->win), 1,
- XYPixmap, 0, NULL, dest_im_width, dest_im_height,
- 8, 0);
+ XYPixmap, 0, NULL, dest_im_width, dest_im_height,
+ 8, 0);
dest_im->data = ZnMalloc(dest_im->bytes_per_line * dest_im->height);
memset(dest_im->data, 0, dest_im->bytes_per_line * dest_im->height);
@@ -580,16 +580,16 @@ Draw(ZnItem item)
box[2] = icon->dev[3];
box[3] = icon->dev[2];
for (i = 0; i < 4; i++) {
- box[i].x -= item->item_bounding_box.orig.x;
- box[i].y -= item->item_bounding_box.orig.y;
- box[i].x = ZnNearestInt(box[i].x);
- box[i].y = ZnNearestInt(box[i].y);
+ box[i].x -= item->item_bounding_box.orig.x;
+ box[i].y -= item->item_bounding_box.orig.y;
+ box[i].x = ZnNearestInt(box[i].x);
+ box[i].y = ZnNearestInt(box[i].y);
}
ZnMapImage(src_im, dest_im, box);
TkPutImage(NULL, 0,wi->dpy, drw, gc, dest_im,
- 0, 0, 0, 0, dest_im_width, dest_im_height);
+ 0, 0, 0, 0, dest_im_width, dest_im_height);
values.foreground = ZnGetGradientPixel(icon->color, 0.0);
values.stipple = drw;
@@ -597,12 +597,12 @@ Draw(ZnItem item)
values.ts_y_origin = (int) item->item_bounding_box.orig.y;
values.fill_style = FillStippled;
XChangeGC(wi->dpy, wi->gc,
- GCFillStyle|GCStipple|GCTileStipXOrigin|GCTileStipYOrigin|GCForeground,
- &values);
+ GCFillStyle|GCStipple|GCTileStipXOrigin|GCTileStipYOrigin|GCForeground,
+ &values);
XFillRectangle(wi->dpy, wi->draw_buffer, wi->gc,
- (int) item->item_bounding_box.orig.x,
- (int) item->item_bounding_box.orig.y,
- (int) dest_im_width, (int) dest_im_height);
+ (int) item->item_bounding_box.orig.x,
+ (int) item->item_bounding_box.orig.y,
+ (int) dest_im_width, (int) dest_im_height);
XFreeGC(wi->dpy, gc);
Tk_FreePixmap(wi->dpy, drw);
@@ -622,19 +622,19 @@ Draw(ZnItem item)
*/
#ifdef GL
static void
-Render(ZnItem item)
+Render(ZnItem item)
{
- ZnWInfo *wi = item->wi;
- IconItem icon = (IconItem) item;
+ ZnWInfo *wi = item->wi;
+ IconItem icon = (IconItem) item;
if (icon->image != ZnUnspecifiedImage) {
ZnRenderImage(wi, icon->image, icon->color, icon->dev,
- ZnImageIsBitmap(icon->image));
+ ZnImageIsBitmap(icon->image));
}
}
#else
static void
-Render(ZnItem item)
+Render(ZnItem item)
{
}
#endif
@@ -648,11 +648,11 @@ Render(ZnItem item)
**********************************************************************************
*/
static ZnBool
-IsSensitive(ZnItem item,
- int item_part)
+IsSensitive(ZnItem item,
+ int item_part)
{
return (ISSET(item->flags, ZN_SENSITIVE_BIT) &&
- item->parent->class->IsSensitive(item->parent, ZN_NO_PART));
+ item->parent->class->IsSensitive(item->parent, ZN_NO_PART));
}
@@ -664,17 +664,17 @@ IsSensitive(ZnItem item,
**********************************************************************************
*/
static double
-Pick(ZnItem item,
- ZnPick ps)
+Pick(ZnItem item,
+ ZnPick ps)
{
- IconItem icon = (IconItem) item;
- ZnWInfo *wi = item->wi;
- double dist;
- double off_dist = MAX(1, wi->pick_aperture+1);
- int x, y, width, height;
- ZnPoint p;
- ZnBBox bbox;
- ZnTransfo t;
+ IconItem icon = (IconItem) item;
+ ZnWInfo *wi = item->wi;
+ double dist;
+ double off_dist = MAX(1, wi->pick_aperture+1);
+ int x, y, width, height;
+ ZnPoint p;
+ ZnBBox bbox;
+ ZnTransfo t;
if (icon->image == ZnUnspecifiedImage) {
return 1.0e40;
@@ -705,17 +705,17 @@ Pick(ZnItem item,
dist = 0.0;
if (icon->image != ZnUnspecifiedImage) {
if (ZnPointInImage(icon->image, x, y)) {
- /*
- * The point is actually on the image shape.
- */
- return dist;
+ /*
+ * The point is actually on the image shape.
+ */
+ return dist;
}
else {
- /*
- * The point is not on the shape but still
- * inside the image's bounding box.
- */
- return off_dist;
+ /*
+ * The point is not on the shape but still
+ * inside the image's bounding box.
+ */
+ return off_dist;
}
}
else {
@@ -738,8 +738,8 @@ Pick(ZnItem item,
**********************************************************************************
*/
static void
-PostScript(ZnItem item,
- ZnBool prepass)
+PostScript(ZnItem item,
+ ZnBool prepass)
{
}
@@ -752,11 +752,11 @@ PostScript(ZnItem item,
**********************************************************************************
*/
static void
-GetAnchor(ZnItem item,
- Tk_Anchor anchor,
- ZnPoint *p)
+GetAnchor(ZnItem item,
+ Tk_Anchor anchor,
+ ZnPoint *p)
{
- IconItem icon = (IconItem) item;
+ IconItem icon = (IconItem) item;
if (icon->image == ZnUnspecifiedImage) {
*p = *icon->dev;
@@ -776,17 +776,17 @@ GetAnchor(ZnItem item,
**********************************************************************************
*
* GetClipVertices --
- * Get the clipping shape.
- * Never ever call ZnTriFree on the tristrip returned by GetClipVertices.
+ * Get the clipping shape.
+ * Never ever call ZnTriFree on the tristrip returned by GetClipVertices.
*
**********************************************************************************
*/
static ZnBool
-GetClipVertices(ZnItem item,
- ZnTriStrip *tristrip)
+GetClipVertices(ZnItem item,
+ ZnTriStrip *tristrip)
{
- IconItem icon = (IconItem) item;
- ZnPoint *points;
+ IconItem icon = (IconItem) item;
+ ZnPoint *points;
ZnListAssertSize(ZnWorkPoints, 4);
points = ZnListArray(ZnWorkPoints);
@@ -804,32 +804,32 @@ GetClipVertices(ZnItem item,
**********************************************************************************
*
* Coords --
- * Return or edit the item origin. This doesn't take care of
- * the possible attachment. The change will be effective at the
- * end of the attachment.
+ * Return or edit the item origin. This doesn't take care of
+ * the possible attachment. The change will be effective at the
+ * end of the attachment.
*
**********************************************************************************
*/
static int
-Coords(ZnItem item,
- int contour,
- int index,
- int cmd,
- ZnPoint **pts,
- char **controls,
- unsigned int *num_pts)
+Coords(ZnItem item,
+ int contour,
+ int index,
+ int cmd,
+ ZnPoint **pts,
+ char **controls,
+ unsigned int *num_pts)
{
- IconItem icon = (IconItem) item;
+ IconItem icon = (IconItem) item;
if ((cmd == ZN_COORDS_ADD) || (cmd == ZN_COORDS_ADD_LAST) || (cmd == ZN_COORDS_REMOVE)) {
Tcl_AppendResult(item->wi->interp,
- " icons can't add or remove vertices", NULL);
+ " icons can't add or remove vertices", NULL);
return TCL_ERROR;
}
else if ((cmd == ZN_COORDS_REPLACE) || (cmd == ZN_COORDS_REPLACE_ALL)) {
if (*num_pts == 0) {
Tcl_AppendResult(item->wi->interp,
- " coords command need 1 point on icons", NULL);
+ " coords command need 1 point on icons", NULL);
return TCL_ERROR;
}
icon->pos = (*pts)[0];
@@ -854,7 +854,7 @@ static ZnItemClassStruct ICON_ITEM_CLASS = {
"icon",
sizeof(IconItemStruct),
icon_attrs,
- 0, /* num_parts */
+ 0, /* num_parts */
ZN_CLASS_HAS_ANCHORS|ZN_CLASS_ONE_COORD, /* flags */
Tk_Offset(IconItemStruct, pos),
Init,
@@ -862,25 +862,25 @@ static ZnItemClassStruct ICON_ITEM_CLASS = {
Destroy,
Configure,
Query,
- NULL, /* GetFieldSet */
+ NULL, /* GetFieldSet */
GetAnchor,
GetClipVertices,
- NULL, /* GetContours */
+ NULL, /* GetContours */
Coords,
- NULL, /* InsertChars */
- NULL, /* DeleteChars */
- NULL, /* Cursor */
- NULL, /* Index */
- NULL, /* Part */
- NULL, /* Selection */
- NULL, /* Contour */
+ NULL, /* InsertChars */
+ NULL, /* DeleteChars */
+ NULL, /* Cursor */
+ NULL, /* Index */
+ NULL, /* Part */
+ NULL, /* Selection */
+ NULL, /* Contour */
ComputeCoordinates,
ToArea,
Draw,
Render,
IsSensitive,
Pick,
- NULL, /* PickVertex */
+ NULL, /* PickVertex */
PostScript
};
diff --git a/generic/Image.c b/generic/Image.c
index ae4ff9e..ff5afd2 100644
--- a/generic/Image.c
+++ b/generic/Image.c
@@ -1,8 +1,8 @@
/*
* Image.c -- Image support routines.
*
- * Authors : Patrick LECOANET
- * Creation date : Wed Dec 8 11:04:44 1999
+ * Authors : Patrick LECOANET
+ * Creation date : Wed Dec 8 11:04:44 1999
*/
/*
@@ -44,65 +44,65 @@ static const char rcsid[] = "$Id$";
static const char compile_id[] = "$Compile: " __FILE__ " " __DATE__ " " __TIME__ " $";
-static int images_inited = 0;
-static Tcl_HashTable images;
+static int images_inited = 0;
+static Tcl_HashTable images;
#ifdef GL
-static Tcl_HashTable font_textures;
+static Tcl_HashTable font_textures;
#endif
typedef struct _ClientStruct {
- void (*inv_proc)(void *cd);
- void *client_data;
+ void (*inv_proc)(void *cd);
+ void *client_data;
int refcount;
} ClientStruct;
typedef struct _ImageStruct {
union {
- Pixmap pixmap;
+ Pixmap pixmap;
#ifdef GL
- GLuint texobj;
+ GLuint texobj;
#endif
} i;
- Display *dpy;
- Screen *screen;
+ Display *dpy;
+ Screen *screen;
struct _ImageBits *bits;
/* Bookkeeping */
- ZnBool for_gl;
- int refcount;
- ZnList clients;
- struct _ImageStruct *next;
+ ZnBool for_gl;
+ int refcount;
+ ZnList clients;
+ struct _ImageStruct *next;
} ImageStruct, *Image;
typedef struct _ImageBits {
- unsigned char *bpixels; /* Needed for bitmaps. Set to NULL if the image
- * is not a bitmap. */
- int rowstride;
+ unsigned char *bpixels; /* Needed for bitmaps. Set to NULL if the image
+ * is not a bitmap. */
+ int rowstride;
#ifdef GL
- ZnReal t; /* Texture parameters for the image. */
- ZnReal s;
- int t_width; /* Texture size used for this image. */
- int t_height;
- unsigned char *t_bits; /* Can be NULL if texture is not used (no GL
- * rendering active on this image). */
+ ZnReal t; /* Texture parameters for the image. */
+ ZnReal s;
+ int t_width; /* Texture size used for this image. */
+ int t_height;
+ unsigned char *t_bits; /* Can be NULL if texture is not used (no GL
+ * rendering active on this image). */
#endif
/* Bookeeping */
- Display *dpy; /* The tkimage below comes from this display. */
- Tcl_Interp *interp; /* The interp that created the tkimage below. */
- Tk_Image tkimage; /* Keep this handle to be informed of changes */
+ Display *dpy; /* The tkimage below comes from this display. */
+ Tcl_Interp *interp; /* The interp that created the tkimage below. */
+ Tk_Image tkimage; /* Keep this handle to be informed of changes */
Tk_PhotoHandle tkphoto;
- TkRegion valid_region;
- int width;
- int height;
- int depth;
- Tcl_HashEntry *hash; /* From this it is easy to get the image/bitmap
- * name. */
- Image images; /* Linked list of widget/display dependant
- * specializations of this image. If NULL, the
- * image has no specialization and can be freed. */
+ TkRegion valid_region;
+ int width;
+ int height;
+ int depth;
+ Tcl_HashEntry *hash; /* From this it is easy to get the image/bitmap
+ * name. */
+ Image images; /* Linked list of widget/display dependant
+ * specializations of this image. If NULL, the
+ * image has no specialization and can be freed. */
} ImageBits;
@@ -131,19 +131,19 @@ To2Power(int a)
**********************************************************************************
*/
static void
-InvalidateImage(ClientData client_data,
- int x,
- int y,
- int width,
- int height,
- int image_width,
- int image_height)
+InvalidateImage(ClientData client_data,
+ int x,
+ int y,
+ int width,
+ int height,
+ int image_width,
+ int image_height)
{
ImageBits *bits = (ImageBits *) client_data;
- Image this;
- int num_cs, count, i;
+ Image this;
+ int num_cs, count, i;
ClientStruct *cs;
- char *image_name;
+ char *image_name;
/* printf("Invalidation, bits: %d, %d %d %d %d %d %d\n",
client_data, x, y, width, height, image_width, image_height);*/
@@ -181,28 +181,28 @@ InvalidateImage(ClientData client_data,
#ifdef GL
if (this->for_gl) {
if (this->i.texobj) {
- ZnGLContextEntry *ce;
- ce = ZnGLMakeCurrent(this->dpy, 0);
- glDeleteTextures(1, &this->i.texobj);
- ZnGLReleaseContext(ce);
- this->i.texobj = 0;
+ ZnGLContextEntry *ce;
+ ce = ZnGLMakeCurrent(this->dpy, 0);
+ glDeleteTextures(1, &this->i.texobj);
+ ZnGLReleaseContext(ce);
+ this->i.texobj = 0;
}
}
else {
#endif
if (this->i.pixmap != None) {
- Tk_FreePixmap(this->dpy, this->i.pixmap);
- this->i.pixmap = None;
+ Tk_FreePixmap(this->dpy, this->i.pixmap);
+ this->i.pixmap = None;
}
#ifdef GL
}
#endif
-
+
num_cs = ZnListSize(this->clients);
cs = ZnListArray(this->clients);
for (i = 0; i < num_cs; i++, cs++) {
if (cs->inv_proc) {
- (*cs->inv_proc)(cs->client_data);
+ (*cs->inv_proc)(cs->client_data);
}
}
count += num_cs;
@@ -213,18 +213,18 @@ InvalidateImage(ClientData client_data,
}
ZnImage
-ZnGetImage(ZnWInfo *wi,
- Tk_Uid image_name,
- void (*inv_proc)(void *cd),
- void *client_data)
+ZnGetImage(ZnWInfo *wi,
+ Tk_Uid image_name,
+ void (*inv_proc)(void *cd),
+ void *client_data)
{
- Tcl_HashEntry *entry;
- int new, num_cs, i;
- ImageBits *bits;
- ZnBool for_gl = wi->render>0;
- Image image;
- Tk_ImageType *type;
- ClientStruct cs, *cs_ptr;
+ Tcl_HashEntry *entry;
+ int new, num_cs, i;
+ ImageBits *bits;
+ ZnBool for_gl = wi->render>0;
+ Image image;
+ Tk_ImageType *type;
+ ClientStruct cs, *cs_ptr;
/*printf("ZnGetImage: %s\n", image_name);*/
if (!images_inited) {
@@ -260,32 +260,32 @@ ZnGetImage(ZnWInfo *wi,
* This doesn't seem to be a Tk image, try to load
* a Tk bitmap.
*/
- Pixmap pmap;
- XImage *mask;
- int x, y;
+ Pixmap pmap;
+ XImage *mask;
+ int x, y;
unsigned char *line;
pmap = Tk_GetBitmap(wi->interp, wi->win, image_name);
if (pmap == None) {
- ZnWarning("unknown bitmap/image \"");
- goto im_error;
+ ZnWarning("unknown bitmap/image \"");
+ goto im_error;
}
Tk_SizeOfBitmap(wi->dpy, pmap, &bits->width, &bits->height);
mask = XGetImage(wi->dpy, pmap, 0, 0, (unsigned int) bits->width,
- (unsigned int) bits->height, 1L, XYPixmap);
+ (unsigned int) bits->height, 1L, XYPixmap);
bits->depth = 1;
bits->rowstride = mask->bytes_per_line;
bits->bpixels = ZnMalloc((unsigned int) (bits->height * bits->rowstride));
memset(bits->bpixels, 0, (unsigned int) (bits->height * bits->rowstride));
line = bits->bpixels;
for (y = 0; y < bits->height; y++) {
- for (x = 0; x < bits->width; x++) {
- if (XGetPixel(mask, x, y)) {
- line[x >> 3] |= 0x80 >> (x & 7);
- }
- }
- line += bits->rowstride;
+ for (x = 0; x < bits->width; x++) {
+ if (XGetPixel(mask, x, y)) {
+ line[x >> 3] |= 0x80 >> (x & 7);
+ }
+ }
+ line += bits->rowstride;
}
XDestroyImage(mask);
Tk_FreeBitmap(wi->dpy, pmap);
@@ -296,27 +296,27 @@ ZnGetImage(ZnWInfo *wi,
bits->tkphoto = Tk_FindPhoto(wi->interp, image_name);
Tk_PhotoGetSize(bits->tkphoto, &bits->width, &bits->height);
if ((bits->width == 0) || (bits->height == 0)) {
- ZnWarning("bogus photo image \"");
- goto im_error;
+ ZnWarning("bogus photo image \"");
+ goto im_error;
}
bits->depth = Tk_Depth(wi->win);
bits->tkimage = Tk_GetImage(wi->interp, wi->win, image_name,
- InvalidateImage, (ClientData) bits);
+ InvalidateImage, (ClientData) bits);
}
else { /* Other image types */
bits->depth = Tk_Depth(wi->win);
bits->tkimage = Tk_GetImage(wi->interp, wi->win, image_name,
- InvalidateImage, (ClientData) bits);
+ InvalidateImage, (ClientData) bits);
Tk_SizeOfImage(bits->tkimage, &bits->width, &bits->height);
if ((bits->width == 0) || (bits->height == 0)) {
- ZnWarning("bogus ");
- ZnWarning(type->name);
- ZnWarning(" image \"");
+ ZnWarning("bogus ");
+ ZnWarning(type->name);
+ ZnWarning(" image \"");
im_error:
- ZnWarning(image_name);
- ZnWarning("\"\n");
- ZnFree(bits);
- return ZnUnspecifiedImage;
+ ZnWarning(image_name);
+ ZnWarning("\"\n");
+ ZnFree(bits);
+ return ZnUnspecifiedImage;
}
}
@@ -331,27 +331,27 @@ ZnGetImage(ZnWInfo *wi,
for (image = bits->images; image != NULL; image = image->next) {
if (image->for_gl == for_gl) {
if ((for_gl && (image->dpy == wi->dpy)) ||
- (!for_gl && (image->screen == wi->screen))) {
- if (!ZnImageIsBitmap(image)) {
- cs_ptr = ZnListArray(image->clients);
- num_cs = ZnListSize(image->clients);
- for (i = 0; i < num_cs; i++, cs_ptr++) {
- if ((cs_ptr->inv_proc == inv_proc) &&
- (cs_ptr->client_data == client_data)) {
- cs_ptr->refcount++;
- return image;
- }
- }
- /* Add a new client reference to call back.
- */
- cs.inv_proc = inv_proc;
- cs.client_data = client_data;
- cs.refcount = 1;
- ZnListAdd(image->clients, &cs, ZnListTail);
- return image;
- }
- image->refcount++;
- return image;
+ (!for_gl && (image->screen == wi->screen))) {
+ if (!ZnImageIsBitmap(image)) {
+ cs_ptr = ZnListArray(image->clients);
+ num_cs = ZnListSize(image->clients);
+ for (i = 0; i < num_cs; i++, cs_ptr++) {
+ if ((cs_ptr->inv_proc == inv_proc) &&
+ (cs_ptr->client_data == client_data)) {
+ cs_ptr->refcount++;
+ return image;
+ }
+ }
+ /* Add a new client reference to call back.
+ */
+ cs.inv_proc = inv_proc;
+ cs.client_data = client_data;
+ cs.refcount = 1;
+ ZnListAdd(image->clients, &cs, ZnListTail);
+ return image;
+ }
+ image->refcount++;
+ return image;
}
}
}
@@ -388,7 +388,7 @@ ZnGetImage(ZnWInfo *wi,
else {
image->i.pixmap = None;
/* image->i.pixmap = Tk_GetBitmap(wi->interp, wi->win, image_name);
- printf("pmap: %d\n", image->i.pixmap);*/
+ printf("pmap: %d\n", image->i.pixmap);*/
}
image->next = bits->images;
bits->images = image;
@@ -405,13 +405,13 @@ ZnGetImage(ZnWInfo *wi,
**********************************************************************************
*/
ZnImage
-ZnGetImageByValue(ZnImage image,
- void (*inv_proc)(void *cd),
- void *client_data)
+ZnGetImageByValue(ZnImage image,
+ void (*inv_proc)(void *cd),
+ void *client_data)
{
- Image this = (Image) image;
- ClientStruct cs, *cs_ptr;
- int i, num_cs;
+ Image this = (Image) image;
+ ClientStruct cs, *cs_ptr;
+ int i, num_cs;
/*printf("ZnGetImageByValue: %s\n", ZnNameOfImage(image));*/
if (!ZnImageIsBitmap(image)) {
@@ -419,9 +419,9 @@ ZnGetImageByValue(ZnImage image,
num_cs = ZnListSize(this->clients);
for (i = 0; i < num_cs; i++, cs_ptr++) {
if ((cs_ptr->inv_proc == inv_proc) &&
- (cs_ptr->client_data == client_data)) {
- cs_ptr->refcount++;
- return image;
+ (cs_ptr->client_data == client_data)) {
+ cs_ptr->refcount++;
+ return image;
}
}
cs.inv_proc = inv_proc;
@@ -444,7 +444,7 @@ ZnGetImageByValue(ZnImage image,
**********************************************************************************
*/
ZnBool
-ZnImageIsBitmap(ZnImage image)
+ZnImageIsBitmap(ZnImage image)
{
return (((Image) image)->bits->bpixels != NULL);
}
@@ -457,14 +457,14 @@ ZnImageIsBitmap(ZnImage image)
**********************************************************************************
*/
void
-ZnFreeImage(ZnImage image,
- void (*inv_proc)(void *cd),
- void *client_data)
+ZnFreeImage(ZnImage image,
+ void (*inv_proc)(void *cd),
+ void *client_data)
{
- Image prev, scan, this = ((Image) image);
- ImageBits *bits = this->bits;
- ClientStruct *cs_ptr;
- int i, num_cs, rm_image;
+ Image prev, scan, this = ((Image) image);
+ ImageBits *bits = this->bits;
+ ClientStruct *cs_ptr;
+ int i, num_cs, rm_image;
/*printf("ZnFreeImage: %s\n", ZnNameOfImage(image));*/
/*
@@ -481,12 +481,12 @@ ZnFreeImage(ZnImage image,
num_cs = ZnListSize(this->clients);
for (i = 0; i < num_cs; i++, cs_ptr++) {
if ((cs_ptr->inv_proc == inv_proc) &&
- (cs_ptr->client_data == client_data)) {
- cs_ptr->refcount--;
- if (cs_ptr->refcount == 0) {
- ZnListDelete(this->clients, i);
- }
- break;
+ (cs_ptr->client_data == client_data)) {
+ cs_ptr->refcount--;
+ if (cs_ptr->refcount == 0) {
+ ZnListDelete(this->clients, i);
+ }
+ break;
}
}
rm_image = ZnListSize(this->clients)==0;
@@ -515,7 +515,7 @@ ZnFreeImage(ZnImage image,
ZnGLContextEntry *ce;
ce = ZnGLMakeCurrent(this->dpy, 0);
/* printf("%d Liberation de la texture %d pour l'image %s\n",
- wi, this->i.texobj, ZnNameOfImage(image));*/
+ wi, this->i.texobj, ZnNameOfImage(image));*/
glDeleteTextures(1, &this->i.texobj);
this->i.texobj = 0;
ZnGLReleaseContext(ce);
@@ -573,7 +573,7 @@ ZnFreeImage(ZnImage image,
**********************************************************************************
*/
char *
-ZnNameOfImage(ZnImage image)
+ZnNameOfImage(ZnImage image)
{
return Tcl_GetHashKey(&images, ((Image) image)->bits->hash);
}
@@ -587,11 +587,11 @@ ZnNameOfImage(ZnImage image)
**********************************************************************************
*/
void
-ZnSizeOfImage(ZnImage image,
- int *width,
- int *height)
+ZnSizeOfImage(ZnImage image,
+ int *width,
+ int *height)
{
- Image this = (Image) image;
+ Image this = (Image) image;
*width = this->bits->width;
*height = this->bits->height;
@@ -606,16 +606,16 @@ ZnSizeOfImage(ZnImage image,
**********************************************************************************
*/
Pixmap
-ZnImagePixmap(ZnImage image,
- Tk_Window win)
+ZnImagePixmap(ZnImage image,
+ Tk_Window win)
{
- Image this = (Image) image;
- ImageBits *bits = this->bits;
+ Image this = (Image) image;
+ ImageBits *bits = this->bits;
/*printf("ZnImagePixmap: %s\n", ZnNameOfImage(image));*/
if (this->for_gl) {
fprintf(stderr,
- "Bogus use of an image, it was created for GL and used in an X11 context\n");
+ "Bogus use of an image, it was created for GL and used in an X11 context\n");
return None;
}
@@ -633,19 +633,19 @@ ZnImagePixmap(ZnImage image,
* instance on the right display.
*/
if (bits->dpy == this->dpy) {
- tkimage = bits->tkimage;
+ tkimage = bits->tkimage;
}
else {
- /* Create a temporary tkimage to draw the pixmap. */
- tkimage = Tk_GetImage(bits->interp, win, ZnNameOfImage(image), NULL, NULL);
+ /* Create a temporary tkimage to draw the pixmap. */
+ tkimage = Tk_GetImage(bits->interp, win, ZnNameOfImage(image), NULL, NULL);
}
this->i.pixmap = Tk_GetPixmap(this->dpy, Tk_WindowId(win),
- bits->width, bits->height, bits->depth);
+ bits->width, bits->height, bits->depth);
Tk_RedrawImage(tkimage, 0, 0, bits->width, bits->height, this->i.pixmap, 0, 0);
if (tkimage != bits->tkimage) {
- Tk_FreeImage(tkimage);
+ Tk_FreeImage(tkimage);
}
}
}
@@ -659,19 +659,19 @@ ZnImagePixmap(ZnImage image,
*
* ZnPointInImage --
*
- * Return whether the given point is inside the image.
+ * Return whether the given point is inside the image.
*
**********************************************************************************
*/
ZnBool
-ZnPointInImage(ZnImage image,
- int x,
- int y)
+ZnPointInImage(ZnImage image,
+ int x,
+ int y)
{
if (ZnImageIsBitmap(image)) {
ImageBits *bits = ((Image) image)->bits;
if ((x < 0) || (y < 0) ||
- (x >= bits->width) || (y >= bits->height)) {
+ (x >= bits->width) || (y >= bits->height)) {
return False;
}
return ZnGetBitmapPixel(bits->bpixels, bits->rowstride, x, y);
@@ -687,19 +687,19 @@ ZnPointInImage(ZnImage image,
*
* ZnImageRegion --
*
- * Only defined for Tk images (including Tk images defined from bitmaps).
+ * Only defined for Tk images (including Tk images defined from bitmaps).
*
**********************************************************************************
*/
static void
-BuildImageRegion(Display *dpy,
- ImageBits *bits)
+BuildImageRegion(Display *dpy,
+ ImageBits *bits)
{
- Pixmap pmap;
- int x, y, end;
- GC gc;
- XImage *im1, *im2;
- XRectangle rect;
+ Pixmap pmap;
+ int x, y, end;
+ GC gc;
+ XImage *im1, *im2;
+ XRectangle rect;
/*printf("BuildImageRegion: %s\n", ZnNameOfImage(bits->images));*/
pmap = Tk_GetPixmap(dpy, DefaultRootWindow(dpy), bits->width, bits->height, bits->depth);
@@ -722,22 +722,22 @@ BuildImageRegion(Display *dpy,
x = 0;
while (x < bits->width) {
while ((x < bits->width) &&
- (XGetPixel(im1, x, y) != XGetPixel(im2, x, y))) {
- /* Search the first non-transparent pixel */
- x++;
+ (XGetPixel(im1, x, y) != XGetPixel(im2, x, y))) {
+ /* Search the first non-transparent pixel */
+ x++;
}
end = x;
while ((end < bits->width) &&
- (XGetPixel(im1, end, y) == XGetPixel(im2, end, y))) {
- /* Search the first transparent pixel */
- end++;
+ (XGetPixel(im1, end, y) == XGetPixel(im2, end, y))) {
+ /* Search the first transparent pixel */
+ end++;
}
if (end > x) {
- rect.x = x;
- rect.y = y;
- rect.width = end - x;
- rect.height = 1;
- TkUnionRectWithRegion(&rect, bits->valid_region, bits->valid_region);
+ rect.x = x;
+ rect.y = y;
+ rect.width = end - x;
+ rect.height = 1;
+ TkUnionRectWithRegion(&rect, bits->valid_region, bits->valid_region);
}
x = end;
}
@@ -748,14 +748,14 @@ BuildImageRegion(Display *dpy,
}
TkRegion
-ZnImageRegion(ZnImage image)
+ZnImageRegion(ZnImage image)
{
if (ZnImageIsBitmap(image)) {
return NULL;
}
else {
- Image this = (Image) image;
- ImageBits *bits = this->bits;
+ Image this = (Image) image;
+ ImageBits *bits = this->bits;
#ifdef PTK
if (!bits->valid_region) {
BuildImageRegion(this->dpy, bits);
@@ -767,7 +767,7 @@ ZnImageRegion(ZnImage image)
}
else {
if (!bits->valid_region) {
- BuildImageRegion(this->dpy, bits);
+ BuildImageRegion(this->dpy, bits);
}
return bits->valid_region;
}
@@ -791,19 +791,19 @@ ZnImageRegion(ZnImage image)
*/
static void
From5r6g5b(unsigned char *data,
- int width,
- int height,
- int bytes_per_line,
- unsigned char *t_bits,
- int t_width,
- int t_height,
- TkRegion valid_region)
+ int width,
+ int height,
+ int bytes_per_line,
+ unsigned char *t_bits,
+ int t_width,
+ int t_height,
+ TkRegion valid_region)
{
- int x, y;
- int rowstride = t_width * 4;
- unsigned char *obptr;
- unsigned char *bptr, *bp2;
- unsigned char alpha;
+ int x, y;
+ int rowstride = t_width * 4;
+ unsigned char *obptr;
+ unsigned char *bptr, *bp2;
+ unsigned char alpha;
unsigned short temp;
bptr = t_bits;
@@ -825,7 +825,7 @@ From5r6g5b(unsigned char *data,
bp2++;
*bp2 = (temp >> 3) & 0xfc; /* v */
bp2++;
- *bp2 = (temp << 3); /* b */
+ *bp2 = (temp << 3); /* b */
bp2++;
*bp2 = alpha;
bp2++;
@@ -852,19 +852,19 @@ From5r6g5b(unsigned char *data,
static void
From8r8g8b(unsigned char *data,
- int width,
- int height,
- int bytes_per_line,
- unsigned char *t_bits,
- int t_width,
- int t_height,
- TkRegion valid_region)
+ int width,
+ int height,
+ int bytes_per_line,
+ unsigned char *t_bits,
+ int t_width,
+ int t_height,
+ TkRegion valid_region)
{
- int x, y;
- int rowstride = t_width * 4;
- unsigned char *obptr;
- unsigned char *bptr, *bp2;
- unsigned char alpha;
+ int x, y;
+ int rowstride = t_width * 4;
+ unsigned char *obptr;
+ unsigned char *bptr, *bp2;
+ unsigned char alpha;
bptr = t_bits;
@@ -908,13 +908,13 @@ From8r8g8b(unsigned char *data,
}
static void
-GatherImageTexels(Display *dpy,
- ImageBits *bits)
+GatherImageTexels(Display *dpy,
+ ImageBits *bits)
{
- Pixmap pmap;
- XImage *im;
- TkRegion valid_region;
- int t_size;
+ Pixmap pmap;
+ XImage *im;
+ TkRegion valid_region;
+ int t_size;
/*printf("GatherImageTexels: %s\n", ZnNameOfImage(bits->images));*/
valid_region = ZnImageRegion(bits->images);
@@ -923,32 +923,32 @@ GatherImageTexels(Display *dpy,
bits->t_bits = ZnMalloc(t_size);
pmap = Tk_GetPixmap(dpy, DefaultRootWindow(dpy),
- bits->width, bits->height, bits->depth);
+ bits->width, bits->height, bits->depth);
Tk_RedrawImage(bits->tkimage, 0, 0, bits->width, bits->height, pmap, 0, 0);
im = XGetImage(dpy, pmap, 0, 0, bits->width, bits->height, ~0L, ZPixmap);
Tk_FreePixmap(dpy, pmap);
if (bits->depth == 16) {
From5r6g5b(im->data, bits->width, bits->height, im->bytes_per_line,
- bits->t_bits, bits->t_width, bits->t_height, valid_region);
+ bits->t_bits, bits->t_width, bits->t_height, valid_region);
}
else if ((bits->depth == 24) || (bits->depth == 32)) {
From8r8g8b(im->data, bits->width, bits->height, im->bytes_per_line,
- bits->t_bits, bits->t_width, bits->t_height, valid_region);
+ bits->t_bits, bits->t_width, bits->t_height, valid_region);
}
XDestroyImage(im);
}
GLuint
-ZnImageTex(ZnImage image,
- ZnReal *t,
- ZnReal *s)
+ZnImageTex(ZnImage image,
+ ZnReal *t,
+ ZnReal *s)
{
- Image this = (Image) image;
- ImageBits *bits = this->bits;
- ZnBool is_bmap = ZnImageIsBitmap(image);
- unsigned int t_size, width, height;
+ Image this = (Image) image;
+ ImageBits *bits = this->bits;
+ ZnBool is_bmap = ZnImageIsBitmap(image);
+ unsigned int t_size, width, height;
if (!this->for_gl) {
fprintf(stderr, "Bogus use of an image, it was created for X11 and used in a GL context\n");
@@ -975,13 +975,13 @@ ZnImageTex(ZnImage image,
ostart = bits->bpixels;
dstart = bits->t_bits;
for (i = 0; i < height; i++) {
- d = dstart;
- o = ostart;
- for (j = 0; j < width; j++) {
- *d++ = ZnGetBitmapPixel(bits->bpixels, bits->rowstride, j, i) ? 255 : 0;
- }
- ostart += bits->rowstride;
- dstart += bits->t_width;
+ d = dstart;
+ o = ostart;
+ for (j = 0; j < width; j++) {
+ *d++ = ZnGetBitmapPixel(bits->bpixels, bits->rowstride, j, i) ? 255 : 0;
+ }
+ ostart += bits->rowstride;
+ dstart += bits->t_width;
}
}
@@ -989,9 +989,9 @@ ZnImageTex(ZnImage image,
* This is a photo: use the photo API, it is simple.
*/
else if (bits->tkphoto) {
- unsigned int x, y, t_stride;
- unsigned char *obptr, *bptr, *bp2, *pixels;
- int green_off, blue_off, alpha_off;
+ unsigned int x, y, t_stride;
+ unsigned char *obptr, *bptr, *bp2, *pixels;
+ int green_off, blue_off, alpha_off;
Tk_PhotoImageBlock block;
t_stride = bits->t_width * 4;
@@ -1007,34 +1007,34 @@ ZnImageTex(ZnImage image,
alpha_off = block.offset[3] - block.offset[0];
#endif
/*printf("width %d, height: %d redoff: %d, greenoff: %d, blueoff: %d, alphaoff: %d\n",
- block.width, block.height, block.offset[0], green_off,
- blue_off, alpha_off);*/
+ block.width, block.height, block.offset[0], green_off,
+ blue_off, alpha_off);*/
pixels = block.pixelPtr;
bptr = bits->t_bits;
for (y = 0; y < height; y++) {
- bp2 = bptr;
- obptr = pixels;
- for (x = 0; x < width; x++) {
- *bp2++ = obptr[0]; /* r */
- *bp2++ = obptr[green_off]; /* g */
- *bp2++ = obptr[blue_off]; /* b */
- *bp2++ = obptr[alpha_off]; /* alpha */
- obptr += block.pixelSize;
- }
- /*for (x = width; x < t_width; x++) {
- *bp2 = 0; bp2++;
- *bp2 = 0; bp2++;
- *bp2 = 0; bp2++;
- *bp2 = 0; bp2++;
- }*/
- bptr += t_stride;
- pixels += block.pitch;
+ bp2 = bptr;
+ obptr = pixels;
+ for (x = 0; x < width; x++) {
+ *bp2++ = obptr[0]; /* r */
+ *bp2++ = obptr[green_off]; /* g */
+ *bp2++ = obptr[blue_off]; /* b */
+ *bp2++ = obptr[alpha_off]; /* alpha */
+ obptr += block.pixelSize;
+ }
+ /*for (x = width; x < t_width; x++) {
+ *bp2 = 0; bp2++;
+ *bp2 = 0; bp2++;
+ *bp2 = 0; bp2++;
+ *bp2 = 0; bp2++;
+ }*/
+ bptr += t_stride;
+ pixels += block.pitch;
}
/*for (y = height; y < t_height; y++) {
- memset(bptr, 0, t_stride);
- bptr += t_stride;
- }*/
+ memset(bptr, 0, t_stride);
+ bptr += t_stride;
+ }*/
}
/*
@@ -1059,13 +1059,13 @@ ZnImageTex(ZnImage image,
glGetError();
if (is_bmap) {
glTexImage2D(GL_TEXTURE_2D, 0, GL_INTENSITY4,
- this->bits->t_width, this->bits->t_height,
- 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, this->bits->t_bits);
+ this->bits->t_width, this->bits->t_height,
+ 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, this->bits->t_bits);
}
else {
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
- this->bits->t_width, this->bits->t_height,
- 0, GL_RGBA, GL_UNSIGNED_BYTE, this->bits->t_bits);
+ this->bits->t_width, this->bits->t_height,
+ 0, GL_RGBA, GL_UNSIGNED_BYTE, this->bits->t_bits);
}
if (glGetError() != GL_NO_ERROR) {
ZnWarning("Can't allocate the texture for image ");
@@ -1088,34 +1088,34 @@ ZnImageTex(ZnImage image,
typedef struct _TexFontInfo {
struct _TexFont *txf;
- GLuint texobj;
- Display *dpy;
- unsigned int refcount;
+ GLuint texobj;
+ Display *dpy;
+ unsigned int refcount;
struct _TexFontInfo *next;
} TexFontInfo;
typedef struct {
- short width;
+ short width;
} PerGlyphInfo, *PerGlyphInfoPtr;
typedef struct _TexFont {
- TexFontInfo *tfi;
- Tk_Font tkfont;
- unsigned int tex_width;
- unsigned int tex_height;
- int ascent;
- int descent;
- unsigned int max_char_width;
+ TexFontInfo *tfi;
+ Tk_Font tkfont;
+ unsigned int tex_width;
+ unsigned int tex_height;
+ int ascent;
+ int descent;
+ unsigned int max_char_width;
unsigned char *teximage;
- unsigned int num_glyphs;
- PerGlyphInfo *glyph;
- ZnTexGVI *tgvi;
- Tcl_HashEntry *hash;
+ unsigned int num_glyphs;
+ PerGlyphInfo *glyph;
+ ZnTexGVI *tgvi;
+ Tcl_HashEntry *hash;
} TexFont;
typedef struct _DeferredGLGlyphs {
- ZnWInfo *wi;
- TexFont *txf;
+ ZnWInfo *wi;
+ TexFont *txf;
} DeferredGLGlyphsStruct;
ZnList DeferredGLGlyphs;
@@ -1129,26 +1129,26 @@ ZnList DeferredGLGlyphs;
static void
-SuckGlyphsFromServer(ZnWInfo *wi,
- TexFont *txf)
+SuckGlyphsFromServer(ZnWInfo *wi,
+ TexFont *txf)
{
- Pixmap offscreen = 0;
- XImage *image = NULL;
- GC xgc = 0;
- unsigned int height, length, pixwidth;
- unsigned int i, j, use_max_width;
- unsigned int wgap=2, hgap=2, tex_width, tex_height;
- unsigned char *to;
- unsigned int x, y;
- unsigned int width=0, maxSpanLength;
- int grabList[MAX_GLYPHS_PER_GRAB];
- unsigned int glyphsPerGrab = MAX_GLYPHS_PER_GRAB;
- unsigned int numToGrab, glyph;
- ZnTexGVI *tgvip;
+ Pixmap offscreen = 0;
+ XImage *image = NULL;
+ GC xgc = 0;
+ unsigned int height, length, pixwidth;
+ unsigned int i, j, use_max_width;
+ unsigned int wgap=2, hgap=2, tex_width, tex_height;
+ unsigned char *to;
+ unsigned int x, y;
+ unsigned int width=0, maxSpanLength;
+ int grabList[MAX_GLYPHS_PER_GRAB];
+ unsigned int glyphsPerGrab = MAX_GLYPHS_PER_GRAB;
+ unsigned int numToGrab, glyph;
+ ZnTexGVI *tgvip;
Tk_FontMetrics fm;
- CONST unsigned char *cur, *next;
+ CONST unsigned char *cur, *next;
#ifndef PTK_800
- Tcl_UniChar uni_ch;
+ Tcl_UniChar uni_ch;
#endif
ZnGLContextEntry *ce = ZnGetGLContext(wi->dpy);
@@ -1198,7 +1198,7 @@ SuckGlyphsFromServer(ZnWInfo *wi,
use_max_width = 1;
tex_height += height + hgap;
if ((tex_height > ce->max_tex_size) || (length > ce->max_tex_size)) {
- goto FreeAndReturn;
+ goto FreeAndReturn;
}
}
@@ -1262,7 +1262,7 @@ SuckGlyphsFromServer(ZnWInfo *wi,
}
pixwidth = glyphsPerGrab * 8 * maxSpanLength;
offscreen = Tk_GetPixmap(wi->dpy, RootWindowOfScreen(wi->screen),
- (int) pixwidth, (int) height, 1);
+ (int) pixwidth, (int) height, 1);
xgc = XCreateGC(wi->dpy, offscreen, 0, NULL);
XSetForeground(wi->dpy, xgc, WhitePixelOfScreen(wi->screen));
@@ -1283,7 +1283,7 @@ SuckGlyphsFromServer(ZnWInfo *wi,
#endif
if (txf->glyph[i].width != 0) {
Tk_DrawChars(wi->dpy, offscreen, xgc, txf->tkfont, cur, next - cur,
- (int) (8*maxSpanLength*numToGrab), txf->ascent);
+ (int) (8*maxSpanLength*numToGrab), txf->ascent);
grabList[numToGrab] = i;
numToGrab++;
}
@@ -1292,39 +1292,39 @@ SuckGlyphsFromServer(ZnWInfo *wi,
image = XGetImage(wi->dpy, offscreen, 0, 0, pixwidth, height, 1, XYPixmap);
for (j = 0; j < numToGrab; j++) {
- glyph = grabList[j];
- width = txf->glyph[glyph].width;
- tgvip = &txf->tgvi[glyph];
- to = txf->teximage + (int) (tgvip->t0y * tex_width) + (int) tgvip->t0x;
- tgvip->t0x = tgvip->t0x / (GLfloat) tex_width;
- tgvip->t0y = tgvip->t0y / (GLfloat) tex_height;
- tgvip->t1x = tgvip->t1x / (GLfloat) tex_width;
- tgvip->t1y = tgvip->t1y / (GLfloat) tex_height;
- for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++, to++) {
- /* XXX The algorithm used to suck across the font ensures that
- each glyph begins on a byte boundary. In theory this would
- make it convienent to copy the glyph into a byte oriented
- bitmap. We actually use the XGetPixel function to extract
- each pixel from the image which is not that efficient. We
- could either do tighter packing in the pixmap or more
- efficient extraction from the image. Oh well. */
- if (XGetPixel(image, (int) (j*maxSpanLength*8) + x, y) == BlackPixelOfScreen(wi->screen)) {
- *to = 255;
- }
- }
- to += tex_width - width;
- }
+ glyph = grabList[j];
+ width = txf->glyph[glyph].width;
+ tgvip = &txf->tgvi[glyph];
+ to = txf->teximage + (int) (tgvip->t0y * tex_width) + (int) tgvip->t0x;
+ tgvip->t0x = tgvip->t0x / (GLfloat) tex_width;
+ tgvip->t0y = tgvip->t0y / (GLfloat) tex_height;
+ tgvip->t1x = tgvip->t1x / (GLfloat) tex_width;
+ tgvip->t1y = tgvip->t1y / (GLfloat) tex_height;
+ for (y = 0; y < height; y++) {
+ for (x = 0; x < width; x++, to++) {
+ /* XXX The algorithm used to suck across the font ensures that
+ each glyph begins on a byte boundary. In theory this would
+ make it convienent to copy the glyph into a byte oriented
+ bitmap. We actually use the XGetPixel function to extract
+ each pixel from the image which is not that efficient. We
+ could either do tighter packing in the pixmap or more
+ efficient extraction from the image. Oh well. */
+ if (XGetPixel(image, (int) (j*maxSpanLength*8) + x, y) == BlackPixelOfScreen(wi->screen)) {
+ *to = 255;
+ }
+ }
+ to += tex_width - width;
+ }
}
XDestroyImage(image);
image = NULL;
numToGrab = 0;
/* do we need to clear the offscreen pixmap to get more? */
if (i < txf->num_glyphs - 1) {
- XSetForeground(wi->dpy, xgc, WhitePixelOfScreen(wi->screen));
- XFillRectangle(wi->dpy, offscreen, xgc, 0, 0,
- 8 * maxSpanLength * glyphsPerGrab, height);
- XSetForeground(wi->dpy, xgc, BlackPixelOfScreen(wi->screen));
+ XSetForeground(wi->dpy, xgc, WhitePixelOfScreen(wi->screen));
+ XFillRectangle(wi->dpy, offscreen, xgc, 0, 0,
+ 8 * maxSpanLength * glyphsPerGrab, height);
+ XSetForeground(wi->dpy, xgc, BlackPixelOfScreen(wi->screen));
}
}
@@ -1355,11 +1355,11 @@ SuckGlyphsFromServer(ZnWInfo *wi,
}
static void
-ZnNeedToGetGLGlyphs(ZnWInfo *wi,
- TexFont *txf)
+ZnNeedToGetGLGlyphs(ZnWInfo *wi,
+ TexFont *txf)
{
DeferredGLGlyphsStruct dgg, *dggp;
- int i, num;
+ int i, num;
if (!DeferredGLGlyphs) {
DeferredGLGlyphs = ZnListNew(4, sizeof(DeferredGLGlyphsStruct));
@@ -1382,7 +1382,7 @@ void
ZnGetDeferredGLGlyphs(void)
{
DeferredGLGlyphsStruct *dggp;
- int i, num = ZnListSize(DeferredGLGlyphs);
+ int i, num = ZnListSize(DeferredGLGlyphs);
if (!num) {
return;
@@ -1395,10 +1395,10 @@ ZnGetDeferredGLGlyphs(void)
}
static void
-ZnRemovedDeferredGLGlyph(TexFont *txf)
+ZnRemovedDeferredGLGlyph(TexFont *txf)
{
DeferredGLGlyphsStruct *dggp;
- int i, num;
+ int i, num;
dggp = ZnListArray(DeferredGLGlyphs);
num = ZnListSize(DeferredGLGlyphs);
@@ -1419,14 +1419,14 @@ ZnRemovedDeferredGLGlyph(TexFont *txf)
**********************************************************************************
*/
ZnTexFontInfo
-ZnGetTexFont(ZnWInfo *wi,
- Tk_Font font)
+ZnGetTexFont(ZnWInfo *wi,
+ Tk_Font font)
{
- TexFont *txf;
- TexFontInfo *tfi;
- static int inited = 0;
- Tcl_HashEntry *entry;
- int new;
+ TexFont *txf;
+ TexFontInfo *tfi;
+ static int inited = 0;
+ Tcl_HashEntry *entry;
+ int new;
if (!inited) {
Tcl_InitHashTable(&font_textures, TCL_STRING_KEYS);
@@ -1434,8 +1434,8 @@ ZnGetTexFont(ZnWInfo *wi,
}
/* printf("family: %s, size: %d, weight: %d, slant: %d, underline: %d, overstrike: %d\n",
- tft->fa.family, tft->fa.size, tft->fa.weight, tft->fa.slant, tft->fa.underline,
- tft->fa.overstrike);
+ tft->fa.family, tft->fa.size, tft->fa.weight, tft->fa.slant, tft->fa.underline,
+ tft->fa.overstrike);
*/
entry = Tcl_FindHashEntry(&font_textures, Tk_NameOfFont(font));
if (entry != NULL) {
@@ -1500,7 +1500,7 @@ ZnGetTexFont(ZnWInfo *wi,
**********************************************************************************
*/
char const *
-ZnNameOfTexFont(ZnTexFontInfo tfi)
+ZnNameOfTexFont(ZnTexFontInfo tfi)
{
return Tk_NameOfFont(((TexFontInfo *) tfi)->txf->tkfont);
}
@@ -1513,10 +1513,10 @@ ZnNameOfTexFont(ZnTexFontInfo tfi)
**********************************************************************************
*/
GLuint
-ZnTexFontTex(ZnTexFontInfo tfi)
+ZnTexFontTex(ZnTexFontInfo tfi)
{
- TexFontInfo *this = (TexFontInfo *) tfi;
- TexFont *txf = this->txf;
+ TexFontInfo *this = (TexFontInfo *) tfi;
+ TexFont *txf = this->txf;
if (!txf->teximage) {
return 0;
@@ -1533,8 +1533,8 @@ ZnTexFontTex(ZnTexFontInfo tfi)
glGetError();
/*printf("Demande texture de %d x %d\n", txf->tex_width, txf->tex_height);*/
glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, txf->tex_width,
- txf->tex_height, 0, GL_ALPHA, GL_UNSIGNED_BYTE,
- txf->teximage);
+ txf->tex_height, 0, GL_ALPHA, GL_UNSIGNED_BYTE,
+ txf->teximage);
if (glGetError() != GL_NO_ERROR) {
ZnWarning("Can't allocate the texture for font ");
ZnWarning(ZnNameOfTexFont(tfi));
@@ -1556,11 +1556,11 @@ ZnTexFontTex(ZnTexFontInfo tfi)
**********************************************************************************
*/
void
-ZnFreeTexFont(ZnTexFontInfo tfi)
+ZnFreeTexFont(ZnTexFontInfo tfi)
{
- TexFontInfo *this = ((TexFontInfo *) tfi);
- TexFont *txf = this->txf;
- TexFontInfo *prev, *scan;
+ TexFontInfo *this = ((TexFontInfo *) tfi);
+ TexFont *txf = this->txf;
+ TexFontInfo *prev, *scan;
for (prev=NULL, scan=this->txf->tfi; (scan!=NULL)&&(scan != this);
prev=scan, scan=scan->next);
@@ -1626,12 +1626,12 @@ ZnFreeTexFont(ZnTexFontInfo tfi)
**********************************************************************************
*/
int
-ZnGetFontIndex(ZnTexFontInfo tfi,
- int c)
+ZnGetFontIndex(ZnTexFontInfo tfi,
+ int c)
{
- TexFont *txf;
- ZnTexGVI *tgvi;
- int code, min, max, mid;
+ TexFont *txf;
+ ZnTexGVI *tgvi;
+ int code, min, max, mid;
if (c < 127) {
/*
@@ -1676,12 +1676,12 @@ ZnGetFontIndex(ZnTexFontInfo tfi,
**********************************************************************************
*/
ZnTexGVI *
-ZnTexFontGVI(ZnTexFontInfo tfi,
- int c)
+ZnTexFontGVI(ZnTexFontInfo tfi,
+ int c)
{
- TexFont *txf = ((TexFontInfo *) tfi)->txf;
- ZnTexGVI *tgvi = NULL;
- int index;
+ TexFont *txf = ((TexFontInfo *) tfi)->txf;
+ ZnTexGVI *tgvi = NULL;
+ int index;
index = ZnGetFontIndex(tfi, c);
if (index >= 0) {
diff --git a/generic/Image.h b/generic/Image.h
index 1ca8c06..a0d03bb 100644
--- a/generic/Image.h
+++ b/generic/Image.h
@@ -1,8 +1,8 @@
/*
* Image.h -- Image support routines.
*
- * Authors : Patrick LECOANET
- * Creation date : Wed Dec 8 11:04:44 1999
+ * Authors : Patrick LECOANET
+ * Creation date : Wed Dec 8 11:04:44 1999
*
* $Id$
*/
@@ -35,14 +35,14 @@
struct _ZnWInfo;
-typedef void *ZnImage;
+typedef void *ZnImage;
#define ZnGetBitmapPixel(bits, stride, x, y)\
(((bits)[(y)*(stride)+((x)>>3)]<<((x)&7))&0x80)
ZnImage
ZnGetImage(struct _ZnWInfo *wi, Tk_Uid image_name,
- void (*inv_proc)(void *cd), void *cd);
+ void (*inv_proc)(void *cd), void *cd);
ZnImage
ZnGetImageByValue(ZnImage image, void (*inv_proc)(void *cd), void *cd);
void
@@ -64,20 +64,20 @@ GLuint
ZnImageTex(ZnImage image, ZnReal *t, ZnReal *s);
typedef struct _ZnTexGlyphVertexInfo {
- GLfloat t0x;
- GLfloat t0y;
- GLshort v0x;
- GLshort v0y;
- GLfloat t1x;
- GLfloat t1y;
- GLshort v1x;
- GLshort v1y;
- GLfloat advance;
- int code;
+ GLfloat t0x;
+ GLfloat t0y;
+ GLshort v0x;
+ GLshort v0y;
+ GLfloat t1x;
+ GLfloat t1y;
+ GLshort v1x;
+ GLshort v1y;
+ GLfloat advance;
+ int code;
} ZnTexGVI;
-typedef void *ZnTexFontInfo;
+typedef void *ZnTexFontInfo;
ZnTexFontInfo ZnGetTexFont(struct _ZnWInfo *wi, Tk_Font font);
void ZnFreeTexFont(ZnTexFontInfo tfi);
@@ -87,4 +87,4 @@ GLuint ZnTexFontTex(ZnTexFontInfo tfi);
void ZnGetDeferredGLGlyphs(void);
#endif
-#endif /* _Image_h */
+#endif /* _Image_h */
diff --git a/generic/Item.c b/generic/Item.c
index e1c4230..5ff55b4 100644
--- a/generic/Item.c
+++ b/generic/Item.c
@@ -1,8 +1,8 @@
/*
* Item.c -- Implementation of items.
*
- * Authors : Patrick Lecoanet.
- * Creation date :
+ * Authors : Patrick Lecoanet.
+ * Creation date :
*
* $Id$
*/
@@ -43,7 +43,7 @@
#endif
#include <GL/glu.h>
-#include <limits.h> /* For INT_MAX */
+#include <limits.h> /* For INT_MAX */
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
@@ -53,8 +53,8 @@ static const char rcsid[] = "$Id$";
static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ " $";
-static ZnList item_classes = NULL;
-static ZnList item_stack = NULL;
+static ZnList item_classes = NULL;
+static ZnList item_stack = NULL;
/*
@@ -113,11 +113,11 @@ static int SetAttrFromAny _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Obj *obj));
*/
Tcl_ObjType ZnAttrObjType = {
- "attribute", /* name */
- (Tcl_FreeInternalRepProc *) NULL, /* freeIntRepProc */
- (Tcl_DupInternalRepProc *) NULL, /* dupIntRepProc */
- (Tcl_UpdateStringProc *) NULL, /* updateStringProc */
- SetAttrFromAny /* setFromAnyProc */
+ "attribute", /* name */
+ (Tcl_FreeInternalRepProc *) NULL, /* freeIntRepProc */
+ (Tcl_DupInternalRepProc *) NULL, /* dupIntRepProc */
+ (Tcl_UpdateStringProc *) NULL, /* updateStringProc */
+ SetAttrFromAny /* setFromAnyProc */
};
#endif
@@ -131,7 +131,7 @@ Tcl_ObjType ZnAttrObjType = {
*/
static void Invalidate(ZnItem item, int reason);
static void AttributeToObj(Tcl_Interp *interp, void *record, ZnAttrConfig *desc,
- Tcl_Obj *result);
+ Tcl_Obj *result);
@@ -160,7 +160,7 @@ ZnUpdateItemImage(void *client_data)
**********************************************************************************
*/
static void
-InitAttrDesc(ZnAttrConfig *attr_desc)
+InitAttrDesc(ZnAttrConfig *attr_desc)
{
if (!attr_desc) {
return;
@@ -177,20 +177,20 @@ InitAttrDesc(ZnAttrConfig *attr_desc)
*
* SetAttrFromAny --
*
- * This procedure is called to convert a Tcl object to an attribute
- * descriptor. This is only possible if given a attr_desc table, so
- * this method always returns an error.
+ * This procedure is called to convert a Tcl object to an attribute
+ * descriptor. This is only possible if given a attr_desc table, so
+ * this method always returns an error.
*
*----------------------------------------------------------------------
*/
#ifndef PTK
static int
-SetAttrFromAny(Tcl_Interp *interp,
- Tcl_Obj *obj)
+SetAttrFromAny(Tcl_Interp *interp,
+ Tcl_Obj *obj)
{
Tcl_AppendToObj(Tcl_GetObjResult(interp),
- "can't convert value to attribute except via GetAttrDesc",
- -1);
+ "can't convert value to attribute except via GetAttrDesc",
+ -1);
return TCL_ERROR;
}
#endif
@@ -204,12 +204,12 @@ SetAttrFromAny(Tcl_Interp *interp,
**********************************************************************************
*/
static ZnAttrConfig *
-GetAttrDesc(Tcl_Interp *interp,
- Tcl_Obj *arg,
- ZnAttrConfig *desc_table)
+GetAttrDesc(Tcl_Interp *interp,
+ Tcl_Obj *arg,
+ ZnAttrConfig *desc_table)
{
- Tk_Uid attr_uid;
- ZnAttrConfig *desc;
+ Tk_Uid attr_uid;
+ ZnAttrConfig *desc;
#ifndef PTK
if (arg->typePtr == &ZnAttrObjType) {
@@ -233,7 +233,7 @@ GetAttrDesc(Tcl_Interp *interp,
else if (attr_uid == desc->uid) {
#ifndef PTK
if ((arg->typePtr != NULL) && (arg->typePtr->freeIntRepProc != NULL)) {
- arg->typePtr->freeIntRepProc(arg);
+ arg->typePtr->freeIntRepProc(arg);
}
arg->internalRep.twoPtrValue.ptr1 = (void *) desc_table;
arg->internalRep.twoPtrValue.ptr2 = (void *) desc;
@@ -256,13 +256,13 @@ GetAttrDesc(Tcl_Interp *interp,
**********************************************************************************
*/
int
-ZnAttributesInfo(Tcl_Interp *interp,
- void *record,
- ZnAttrConfig *desc_table,
- int argc,
- Tcl_Obj *CONST args[])
+ZnAttributesInfo(Tcl_Interp *interp,
+ void *record,
+ ZnAttrConfig *desc_table,
+ int argc,
+ Tcl_Obj *CONST args[])
{
- Tcl_Obj *l, *entries[5];
+ Tcl_Obj *l, *entries[5];
if (argc == 1) {
ZnAttrConfig *desc = GetAttrDesc(interp, args[0], desc_table);
@@ -303,18 +303,18 @@ ZnAttributesInfo(Tcl_Interp *interp,
**********************************************************************************
*/
int
-ZnConfigureAttributes(ZnWInfo *wi,
- ZnItem item,
- void *record,
- ZnAttrConfig *desc_table,
- int argc,
- Tcl_Obj *CONST args[],
- int *flags)
+ZnConfigureAttributes(ZnWInfo *wi,
+ ZnItem item,
+ void *record,
+ ZnAttrConfig *desc_table,
+ int argc,
+ Tcl_Obj *CONST args[],
+ int *flags)
{
- int i;
- ZnAttrConfig *desc;
- ZnPtr valp;
- char *str;
+ int i;
+ ZnAttrConfig *desc;
+ ZnPtr valp;
+ char *str;
for (i = 0; i < argc; i += 2) {
desc = GetAttrDesc(wi->interp, args[i], desc_table);
@@ -323,7 +323,7 @@ ZnConfigureAttributes(ZnWInfo *wi,
}
else if (desc->read_only) {
Tcl_AppendResult(wi->interp, "attribute \"",
- Tcl_GetString(args[i]), "\" can only be read", NULL);
+ Tcl_GetString(args[i]), "\" can only be read", NULL);
return TCL_ERROR;
}
@@ -332,444 +332,444 @@ ZnConfigureAttributes(ZnWInfo *wi,
switch (desc->type) {
case ZN_CONFIG_GRADIENT:
{
- ZnGradient *g;
- Tk_Uid new_name = Tk_GetUid(Tcl_GetString(args[i+1]));
- char *name = NULL;
- if (*((ZnGradient **) valp)) {
- name = ZnNameOfGradient(*((ZnGradient **) valp));
- }
- if (name != new_name) {
- g = ZnGetGradient(wi->interp, wi->win, new_name);
- if (!g) {
- Tcl_AppendResult(wi->interp,
- " gradient expected for attribute \"",
- Tcl_GetString(args[i]), "\"", NULL);
- return TCL_ERROR;
- }
- if (*((ZnGradient **) valp)) {
- ZnFreeGradient(*((ZnGradient **) valp));
- }
- *((ZnGradient **) valp) = g;
- *flags |= desc->flags;
- }
- break;
+ ZnGradient *g;
+ Tk_Uid new_name = Tk_GetUid(Tcl_GetString(args[i+1]));
+ char *name = NULL;
+ if (*((ZnGradient **) valp)) {
+ name = ZnNameOfGradient(*((ZnGradient **) valp));
+ }
+ if (name != new_name) {
+ g = ZnGetGradient(wi->interp, wi->win, new_name);
+ if (!g) {
+ Tcl_AppendResult(wi->interp,
+ " gradient expected for attribute \"",
+ Tcl_GetString(args[i]), "\"", NULL);
+ return TCL_ERROR;
+ }
+ if (*((ZnGradient **) valp)) {
+ ZnFreeGradient(*((ZnGradient **) valp));
+ }
+ *((ZnGradient **) valp) = g;
+ *flags |= desc->flags;
+ }
+ break;
}
case ZN_CONFIG_GRADIENT_LIST:
{
- ZnList new_grad_list = NULL;
- ZnGradient **grads;
- unsigned int num_grads, j, k;
- Tcl_Obj **elems;
-
- if (Tcl_ListObjGetElements(wi->interp, args[i+1],
- &num_grads, &elems) == TCL_ERROR) {
- Tcl_AppendResult(wi->interp,
- " gradient list expected for attribute \"",
- Tcl_GetString(args[i]), "\"", NULL);
- return TCL_ERROR;
- }
- if (num_grads) {
- new_grad_list = ZnListNew(num_grads, sizeof(ZnGradient *));
- ZnListAssertSize(new_grad_list, num_grads);
- grads = ZnListArray(new_grad_list);
- for (j = 0; j < num_grads; j++) {
- str = Tcl_GetString(elems[j]);
- if (!*str) {
- if (j == 0) {
- goto grads_err;
- }
- grads[j] = grads[j-1];
- }
- else {
- grads[j] = ZnGetGradient(wi->interp, wi->win, str);
- }
- if (!grads[j]) {
- grads_err:
- Tcl_AppendResult(wi->interp, " invalid gradient \"", str,
- "\" in gradient list", NULL);
- for (k = 0; k < j; k++) {
- ZnFreeGradient(grads[k]);
- }
- ZnListFree(new_grad_list);
- return TCL_ERROR;
- }
- }
- }
- if (*((ZnList *) valp)) {
- num_grads = ZnListSize(*((ZnList *) valp));
- grads = ZnListArray(*((ZnList *) valp));
- for (j = 0; j < num_grads; j++) {
- if (grads[j]) {
- ZnFreeGradient(grads[j]);
- }
- }
- ZnListFree(*((ZnList *) valp));
- *((ZnList *) valp) = new_grad_list;
- *flags |= desc->flags;
- }
- else {
- if (new_grad_list) {
- *((ZnList *) valp) = new_grad_list;
- *flags |= desc->flags;
- }
- }
- break;
+ ZnList new_grad_list = NULL;
+ ZnGradient **grads;
+ unsigned int num_grads, j, k;
+ Tcl_Obj **elems;
+
+ if (Tcl_ListObjGetElements(wi->interp, args[i+1],
+ &num_grads, &elems) == TCL_ERROR) {
+ Tcl_AppendResult(wi->interp,
+ " gradient list expected for attribute \"",
+ Tcl_GetString(args[i]), "\"", NULL);
+ return TCL_ERROR;
+ }
+ if (num_grads) {
+ new_grad_list = ZnListNew(num_grads, sizeof(ZnGradient *));
+ ZnListAssertSize(new_grad_list, num_grads);
+ grads = ZnListArray(new_grad_list);
+ for (j = 0; j < num_grads; j++) {
+ str = Tcl_GetString(elems[j]);
+ if (!*str) {
+ if (j == 0) {
+ goto grads_err;
+ }
+ grads[j] = grads[j-1];
+ }
+ else {
+ grads[j] = ZnGetGradient(wi->interp, wi->win, str);
+ }
+ if (!grads[j]) {
+ grads_err:
+ Tcl_AppendResult(wi->interp, " invalid gradient \"", str,
+ "\" in gradient list", NULL);
+ for (k = 0; k < j; k++) {
+ ZnFreeGradient(grads[k]);
+ }
+ ZnListFree(new_grad_list);
+ return TCL_ERROR;
+ }
+ }
+ }
+ if (*((ZnList *) valp)) {
+ num_grads = ZnListSize(*((ZnList *) valp));
+ grads = ZnListArray(*((ZnList *) valp));
+ for (j = 0; j < num_grads; j++) {
+ if (grads[j]) {
+ ZnFreeGradient(grads[j]);
+ }
+ }
+ ZnListFree(*((ZnList *) valp));
+ *((ZnList *) valp) = new_grad_list;
+ *flags |= desc->flags;
+ }
+ else {
+ if (new_grad_list) {
+ *((ZnList *) valp) = new_grad_list;
+ *flags |= desc->flags;
+ }
+ }
+ break;
}
case ZN_CONFIG_BOOL:
{
- int b;
- if (Tcl_GetBooleanFromObj(wi->interp, args[i+1], &b) != TCL_OK) {
- Tcl_AppendResult(wi->interp, " boolean expected for attribute \"",
- Tcl_GetString(args[i]), "\"", NULL);
- return TCL_ERROR;
- }
- if (b ^ (ISSET(*((unsigned short *) valp), desc->bool_bit) != 0)) {
- ASSIGN(*((unsigned short *) valp), desc->bool_bit, b);
- *flags |= desc->flags;
- }
- break;
+ int b;
+ if (Tcl_GetBooleanFromObj(wi->interp, args[i+1], &b) != TCL_OK) {
+ Tcl_AppendResult(wi->interp, " boolean expected for attribute \"",
+ Tcl_GetString(args[i]), "\"", NULL);
+ return TCL_ERROR;
+ }
+ if (b ^ (ISSET(*((unsigned short *) valp), desc->bool_bit) != 0)) {
+ ASSIGN(*((unsigned short *) valp), desc->bool_bit, b);
+ *flags |= desc->flags;
+ }
+ break;
}
case ZN_CONFIG_IMAGE:
case ZN_CONFIG_BITMAP:
{
- ZnImage image = ZnUnspecifiedImage;
- ZnBool is_bmap = True;
- char *name = "";
-
- if (*((ZnImage *) valp) != ZnUnspecifiedImage) {
- name = ZnNameOfImage(*((ZnImage *) valp));
- }
- str = Tcl_GetString(args[i+1]);
- if (strcmp(name, str) != 0) {
- if (strlen(str) != 0) {
- if (desc->type == ZN_CONFIG_IMAGE) {
- image = ZnGetImage(wi, str, ZnUpdateItemImage, record);
- if (image == ZnUnspecifiedImage) {
- Tcl_AppendResult(wi->interp, " image expected for attribute \"",
- Tcl_GetString(args[i]), "\"", NULL);
- return TCL_ERROR;
- }
- }
- else {
- image = ZnGetImage(wi, str, NULL, NULL);
- if ((image == ZnUnspecifiedImage) ||
- (!(is_bmap = ZnImageIsBitmap(image)))) {
- if (!is_bmap) {
- ZnFreeImage(image, NULL, NULL);
- }
- Tcl_AppendResult(wi->interp, " bitmap expected for attribute \"",
- Tcl_GetString(args[i]), "\"", NULL);
- return TCL_ERROR;
- }
- }
- }
- if (*((ZnImage *) valp) != ZnUnspecifiedImage) {
- ZnFreeImage(*((ZnImage *) valp), ZnUpdateItemImage, record);
- }
- *((ZnImage *) valp) = image;
- *flags |= desc->flags;
- }
- break;
+ ZnImage image = ZnUnspecifiedImage;
+ ZnBool is_bmap = True;
+ char *name = "";
+
+ if (*((ZnImage *) valp) != ZnUnspecifiedImage) {
+ name = ZnNameOfImage(*((ZnImage *) valp));
+ }
+ str = Tcl_GetString(args[i+1]);
+ if (strcmp(name, str) != 0) {
+ if (strlen(str) != 0) {
+ if (desc->type == ZN_CONFIG_IMAGE) {
+ image = ZnGetImage(wi, str, ZnUpdateItemImage, record);
+ if (image == ZnUnspecifiedImage) {
+ Tcl_AppendResult(wi->interp, " image expected for attribute \"",
+ Tcl_GetString(args[i]), "\"", NULL);
+ return TCL_ERROR;
+ }
+ }
+ else {
+ image = ZnGetImage(wi, str, NULL, NULL);
+ if ((image == ZnUnspecifiedImage) ||
+ (!(is_bmap = ZnImageIsBitmap(image)))) {
+ if (!is_bmap) {
+ ZnFreeImage(image, NULL, NULL);
+ }
+ Tcl_AppendResult(wi->interp, " bitmap expected for attribute \"",
+ Tcl_GetString(args[i]), "\"", NULL);
+ return TCL_ERROR;
+ }
+ }
+ }
+ if (*((ZnImage *) valp) != ZnUnspecifiedImage) {
+ ZnFreeImage(*((ZnImage *) valp), ZnUpdateItemImage, record);
+ }
+ *((ZnImage *) valp) = image;
+ *flags |= desc->flags;
+ }
+ break;
}
case ZN_CONFIG_BITMAP_LIST:
{
- ZnList new_pat_list = NULL;
- ZnImage *pats;
- unsigned int num_pats, j, k;
- Tcl_Obj **elems;
- ZnBool is_bmap = True;
-
- if (Tcl_ListObjGetElements(wi->interp, args[i+1],
- &num_pats, &elems) == TCL_ERROR) {
- Tcl_AppendResult(wi->interp,
- " pattern list expected for attribute \"",
- Tcl_GetString(args[i]), "\"", NULL);
- return TCL_ERROR;
- }
- if (num_pats) {
- new_pat_list = ZnListNew(num_pats, sizeof(Pixmap));
- ZnListAssertSize(new_pat_list, num_pats);
- pats = ZnListArray(new_pat_list);
- for (j = 0; j < num_pats; j++) {
- str = Tcl_GetString(elems[j]);
- if (strlen(str) != 0) {
- pats[j] = ZnGetImage(wi, str, NULL, NULL);
- if ((pats[j] == ZnUnspecifiedImage) ||
- !(is_bmap = ZnImageIsBitmap(pats[j]))) {
- if (!is_bmap) {
- ZnFreeImage(pats[j], NULL, NULL);
- }
- for (k = 0; k < j; k++) {
- ZnFreeImage(pats[k], NULL, NULL);
- }
- ZnListFree(new_pat_list);
- Tcl_AppendResult(wi->interp, " unknown pattern \"", str,
- "\" in pattern list", NULL);
- return TCL_ERROR;
- }
- }
- else {
- pats[j] = ZnUnspecifiedImage;
- }
- }
- }
- if (*((ZnList *) valp)) {
- num_pats = ZnListSize(*((ZnList *) valp));
- pats = ZnListArray(*((ZnList *) valp));
- for (j = 0; j < num_pats; j++) {
- if (pats[j] != ZnUnspecifiedImage) {
- ZnFreeImage(pats[j], NULL, NULL);
- }
- }
- ZnListFree(*((ZnList *) valp));
- *((ZnList *) valp) = new_pat_list;
- *flags |= desc->flags;
- }
- else {
- if (new_pat_list) {
- *((ZnList *) valp) = new_pat_list;
- *flags |= desc->flags;
- }
- }
- break;
+ ZnList new_pat_list = NULL;
+ ZnImage *pats;
+ unsigned int num_pats, j, k;
+ Tcl_Obj **elems;
+ ZnBool is_bmap = True;
+
+ if (Tcl_ListObjGetElements(wi->interp, args[i+1],
+ &num_pats, &elems) == TCL_ERROR) {
+ Tcl_AppendResult(wi->interp,
+ " pattern list expected for attribute \"",
+ Tcl_GetString(args[i]), "\"", NULL);
+ return TCL_ERROR;
+ }
+ if (num_pats) {
+ new_pat_list = ZnListNew(num_pats, sizeof(Pixmap));
+ ZnListAssertSize(new_pat_list, num_pats);
+ pats = ZnListArray(new_pat_list);
+ for (j = 0; j < num_pats; j++) {
+ str = Tcl_GetString(elems[j]);
+ if (strlen(str) != 0) {
+ pats[j] = ZnGetImage(wi, str, NULL, NULL);
+ if ((pats[j] == ZnUnspecifiedImage) ||
+ !(is_bmap = ZnImageIsBitmap(pats[j]))) {
+ if (!is_bmap) {
+ ZnFreeImage(pats[j], NULL, NULL);
+ }
+ for (k = 0; k < j; k++) {
+ ZnFreeImage(pats[k], NULL, NULL);
+ }
+ ZnListFree(new_pat_list);
+ Tcl_AppendResult(wi->interp, " unknown pattern \"", str,
+ "\" in pattern list", NULL);
+ return TCL_ERROR;
+ }
+ }
+ else {
+ pats[j] = ZnUnspecifiedImage;
+ }
+ }
+ }
+ if (*((ZnList *) valp)) {
+ num_pats = ZnListSize(*((ZnList *) valp));
+ pats = ZnListArray(*((ZnList *) valp));
+ for (j = 0; j < num_pats; j++) {
+ if (pats[j] != ZnUnspecifiedImage) {
+ ZnFreeImage(pats[j], NULL, NULL);
+ }
+ }
+ ZnListFree(*((ZnList *) valp));
+ *((ZnList *) valp) = new_pat_list;
+ *flags |= desc->flags;
+ }
+ else {
+ if (new_pat_list) {
+ *((ZnList *) valp) = new_pat_list;
+ *flags |= desc->flags;
+ }
+ }
+ break;
}
case ZN_CONFIG_TAG_LIST:
{
- int num_tags, j;
- Tcl_Obj **elems;
-
- if (Tcl_ListObjGetElements(wi->interp, args[i+1],
- &num_tags, &elems) == TCL_ERROR) {
- Tcl_AppendResult(wi->interp,
- " tag list expected for attribute \"",
- Tcl_GetString(args[i]), "\"", NULL);
- return TCL_ERROR;
- }
- if (*((ZnList *) valp)) {
- ZnITEM.FreeTags(item);
- *flags |= desc->flags;
- }
- if (num_tags) {
- for (j = 0; j < num_tags; j++) {
- ZnITEM.AddTag(item, Tk_GetUid(Tcl_GetString(elems[j])));
- }
- *flags |= desc->flags;
- }
- break;
+ int num_tags, j;
+ Tcl_Obj **elems;
+
+ if (Tcl_ListObjGetElements(wi->interp, args[i+1],
+ &num_tags, &elems) == TCL_ERROR) {
+ Tcl_AppendResult(wi->interp,
+ " tag list expected for attribute \"",
+ Tcl_GetString(args[i]), "\"", NULL);
+ return TCL_ERROR;
+ }
+ if (*((ZnList *) valp)) {
+ ZnITEM.FreeTags(item);
+ *flags |= desc->flags;
+ }
+ if (num_tags) {
+ for (j = 0; j < num_tags; j++) {
+ ZnITEM.AddTag(item, Tk_GetUid(Tcl_GetString(elems[j])));
+ }
+ *flags |= desc->flags;
+ }
+ break;
}
case ZN_CONFIG_STRING:
case ZN_CONFIG_MAP_INFO:
{
- char *text = NULL;
- str = Tcl_GetString(args[i+1]);
- if (!*((char **) valp) || strcmp(str, *((char **) valp)) != 0) {
- if (strlen(str)) {
- text = (char *) ZnMalloc(strlen(str)+1);
- strcpy(text, str);
- }
- if (*((char **) valp)) {
- ZnFree(*((char **) valp));
- }
- *((char **) valp) = text;
- *flags |= desc->flags;
- }
- break;
+ char *text = NULL;
+ str = Tcl_GetString(args[i+1]);
+ if (!*((char **) valp) || strcmp(str, *((char **) valp)) != 0) {
+ if (strlen(str)) {
+ text = (char *) ZnMalloc(strlen(str)+1);
+ strcpy(text, str);
+ }
+ if (*((char **) valp)) {
+ ZnFree(*((char **) valp));
+ }
+ *((char **) valp) = text;
+ *flags |= desc->flags;
+ }
+ break;
}
case ZN_CONFIG_FONT:
{
- Tk_Font font;
- Tk_Uid name = "";
- if (*((Tk_Font *) valp)) {
- name = Tk_NameOfFont(*((Tk_Font *) valp));
- }
- str = Tcl_GetString(args[i+1]);
- if (strcmp(name, str) != 0) {
- font = Tk_GetFont(wi->interp, wi->win, str);
- if (!font) {
- Tcl_AppendResult(wi->interp, " font expected for attribute \"",
- Tcl_GetString(args[i]), "\"", NULL);
- return TCL_ERROR;
- }
- if (*((Tk_Font *) valp)) {
- Tk_FreeFont(*((Tk_Font *) valp));
- }
- *((Tk_Font *) valp) = font;
- *flags |= desc->flags;
- }
- break;
+ Tk_Font font;
+ Tk_Uid name = "";
+ if (*((Tk_Font *) valp)) {
+ name = Tk_NameOfFont(*((Tk_Font *) valp));
+ }
+ str = Tcl_GetString(args[i+1]);
+ if (strcmp(name, str) != 0) {
+ font = Tk_GetFont(wi->interp, wi->win, str);
+ if (!font) {
+ Tcl_AppendResult(wi->interp, " font expected for attribute \"",
+ Tcl_GetString(args[i]), "\"", NULL);
+ return TCL_ERROR;
+ }
+ if (*((Tk_Font *) valp)) {
+ Tk_FreeFont(*((Tk_Font *) valp));
+ }
+ *((Tk_Font *) valp) = font;
+ *flags |= desc->flags;
+ }
+ break;
}
case ZN_CONFIG_EDGE_LIST:
{
- ZnBorder border;
-
- if (ZnGetBorder(wi, args[i+1], &border) == TCL_ERROR) {
- Tcl_AppendResult(wi->interp, " edge list expected for attribute \"",
- Tcl_GetString(args[i]), "\"", NULL);
- return TCL_ERROR;
- }
- if (border != *((ZnBorder *) valp)) {
- *((ZnBorder *) valp) = border;
- *flags |= desc->flags;
- }
- break;
+ ZnBorder border;
+
+ if (ZnGetBorder(wi, args[i+1], &border) == TCL_ERROR) {
+ Tcl_AppendResult(wi->interp, " edge list expected for attribute \"",
+ Tcl_GetString(args[i]), "\"", NULL);
+ return TCL_ERROR;
+ }
+ if (border != *((ZnBorder *) valp)) {
+ *((ZnBorder *) valp) = border;
+ *flags |= desc->flags;
+ }
+ break;
}
case ZN_CONFIG_LINE_SHAPE:
{
- ZnLineShape line_shape;
-
- if (ZnGetLineShape(wi, Tcl_GetString(args[i+1]), &line_shape) == TCL_ERROR) {
- Tcl_AppendResult(wi->interp, " line shape expected for attribute \"",
- Tcl_GetString(args[i]), "\"", NULL);
- return TCL_ERROR;
- }
- if (line_shape != *((ZnLineShape *) valp)) {
- *((ZnLineShape *) valp) = line_shape;
- *flags |= desc->flags;
- }
- break;
+ ZnLineShape line_shape;
+
+ if (ZnGetLineShape(wi, Tcl_GetString(args[i+1]), &line_shape) == TCL_ERROR) {
+ Tcl_AppendResult(wi->interp, " line shape expected for attribute \"",
+ Tcl_GetString(args[i]), "\"", NULL);
+ return TCL_ERROR;
+ }
+ if (line_shape != *((ZnLineShape *) valp)) {
+ *((ZnLineShape *) valp) = line_shape;
+ *flags |= desc->flags;
+ }
+ break;
}
case ZN_CONFIG_LINE_STYLE:
{
- ZnLineStyle line_style;
-
- if (ZnGetLineStyle(wi, Tcl_GetString(args[i+1]), &line_style) == TCL_ERROR) {
- Tcl_AppendResult(wi->interp, " line style expected for attribute \"",
- Tcl_GetString(args[i]), "\"", NULL);
- return TCL_ERROR;
- }
- if (line_style != *((ZnLineStyle *) valp)) {
- *((ZnLineStyle *) valp) = line_style;
- *flags |= desc->flags;
- }
- break;
+ ZnLineStyle line_style;
+
+ if (ZnGetLineStyle(wi, Tcl_GetString(args[i+1]), &line_style) == TCL_ERROR) {
+ Tcl_AppendResult(wi->interp, " line style expected for attribute \"",
+ Tcl_GetString(args[i]), "\"", NULL);
+ return TCL_ERROR;
+ }
+ if (line_style != *((ZnLineStyle *) valp)) {
+ *((ZnLineStyle *) valp) = line_style;
+ *flags |= desc->flags;
+ }
+ break;
}
case ZN_CONFIG_LINE_END:
{
- ZnLineEnd line_end = NULL;
- str = Tcl_GetString(args[i+1]);
- if (strlen(str) != 0) {
- line_end = ZnLineEndCreate(wi->interp, str);
- if (line_end == NULL) {
- return TCL_ERROR;
- }
- }
- if (*((ZnLineEnd *) valp) != NULL) {
- ZnLineEndDelete(*((ZnLineEnd *) valp));
- *((ZnLineEnd *) valp) = line_end;
- *flags |= desc->flags;
- }
- else {
- if (line_end != NULL) {
- *((ZnLineEnd *) valp) = line_end;
- *flags |= desc->flags;
- }
- }
- break;
+ ZnLineEnd line_end = NULL;
+ str = Tcl_GetString(args[i+1]);
+ if (strlen(str) != 0) {
+ line_end = ZnLineEndCreate(wi->interp, str);
+ if (line_end == NULL) {
+ return TCL_ERROR;
+ }
+ }
+ if (*((ZnLineEnd *) valp) != NULL) {
+ ZnLineEndDelete(*((ZnLineEnd *) valp));
+ *((ZnLineEnd *) valp) = line_end;
+ *flags |= desc->flags;
+ }
+ else {
+ if (line_end != NULL) {
+ *((ZnLineEnd *) valp) = line_end;
+ *flags |= desc->flags;
+ }
+ }
+ break;
}
case ZN_CONFIG_RELIEF:
{
- ZnReliefStyle relief;
- if (ZnGetRelief(wi, Tcl_GetString(args[i+1]), &relief) == TCL_ERROR) {
- Tcl_AppendResult(wi->interp, " relief expected for attribute \"",
- Tcl_GetString(args[i]), "\"", NULL);
- return TCL_ERROR;
- }
- if (relief != *((ZnReliefStyle *) valp)) {
- /*printf("valp <0x%X>, flags <0x%X>, relief %d\n", valp, flags, relief);*/
- *((ZnReliefStyle *) valp) = relief;
- *flags |= desc->flags;
- }
- break;
+ ZnReliefStyle relief;
+ if (ZnGetRelief(wi, Tcl_GetString(args[i+1]), &relief) == TCL_ERROR) {
+ Tcl_AppendResult(wi->interp, " relief expected for attribute \"",
+ Tcl_GetString(args[i]), "\"", NULL);
+ return TCL_ERROR;
+ }
+ if (relief != *((ZnReliefStyle *) valp)) {
+ /*printf("valp <0x%X>, flags <0x%X>, relief %d\n", valp, flags, relief);*/
+ *((ZnReliefStyle *) valp) = relief;
+ *flags |= desc->flags;
+ }
+ break;
}
case ZN_CONFIG_JOIN_STYLE:
{
- int join;
- if (Tk_GetJoinStyle(wi->interp, Tcl_GetString(args[i+1]), &join) == TCL_ERROR) {
- Tcl_AppendResult(wi->interp, " join expected for attribute \"",
- Tcl_GetString(args[i]), "\"", NULL);
- return TCL_ERROR;
- }
- if (join != *((int *) valp)) {
- *((int *) valp) = join;
- *flags |= desc->flags;
- }
- break;
+ int join;
+ if (Tk_GetJoinStyle(wi->interp, Tcl_GetString(args[i+1]), &join) == TCL_ERROR) {
+ Tcl_AppendResult(wi->interp, " join expected for attribute \"",
+ Tcl_GetString(args[i]), "\"", NULL);
+ return TCL_ERROR;
+ }
+ if (join != *((int *) valp)) {
+ *((int *) valp) = join;
+ *flags |= desc->flags;
+ }
+ break;
}
case ZN_CONFIG_CAP_STYLE:
{
- int cap;
- if (Tk_GetCapStyle(wi->interp, Tcl_GetString(args[i+1]), &cap) == TCL_ERROR) {
- Tcl_AppendResult(wi->interp, " cap expected for attribute \"",
- Tcl_GetString(args[i]), "\"", NULL);
- return TCL_ERROR;
- }
- if (cap != *((int *) valp)) {
- *((int *) valp) = cap;
- *flags |= desc->flags;
- }
- break;
+ int cap;
+ if (Tk_GetCapStyle(wi->interp, Tcl_GetString(args[i+1]), &cap) == TCL_ERROR) {
+ Tcl_AppendResult(wi->interp, " cap expected for attribute \"",
+ Tcl_GetString(args[i]), "\"", NULL);
+ return TCL_ERROR;
+ }
+ if (cap != *((int *) valp)) {
+ *((int *) valp) = cap;
+ *flags |= desc->flags;
+ }
+ break;
}
case ZN_CONFIG_POINT:
{
- ZnPoint point;
- int largc;
- Tcl_Obj **largv;
- double d;
-
- if ((Tcl_ListObjGetElements(wi->interp, args[i+1],
- &largc, &largv) == TCL_ERROR) ||
- (largc != 2)) {
- point_error:
- Tcl_AppendResult(wi->interp, " position expected for attribute \"",
- Tcl_GetString(args[i]), "\"", NULL);
- return TCL_ERROR;
- }
- if (Tcl_GetDoubleFromObj(wi->interp, largv[0], &d) == TCL_ERROR) {
- goto point_error;
- }
- point.x = d;
- if (Tcl_GetDoubleFromObj(wi->interp, largv[1], &d) == TCL_ERROR) {
- goto point_error;
- }
- point.y = d;
- if ((point.x != ((ZnPoint *) valp)->x) ||
- (point.y != ((ZnPoint *) valp)->y)) {
- *((ZnPoint *) valp) = point;
- *flags |= desc->flags;
- }
- break;
+ ZnPoint point;
+ int largc;
+ Tcl_Obj **largv;
+ double d;
+
+ if ((Tcl_ListObjGetElements(wi->interp, args[i+1],
+ &largc, &largv) == TCL_ERROR) ||
+ (largc != 2)) {
+ point_error:
+ Tcl_AppendResult(wi->interp, " position expected for attribute \"",
+ Tcl_GetString(args[i]), "\"", NULL);
+ return TCL_ERROR;
+ }
+ if (Tcl_GetDoubleFromObj(wi->interp, largv[0], &d) == TCL_ERROR) {
+ goto point_error;
+ }
+ point.x = d;
+ if (Tcl_GetDoubleFromObj(wi->interp, largv[1], &d) == TCL_ERROR) {
+ goto point_error;
+ }
+ point.y = d;
+ if ((point.x != ((ZnPoint *) valp)->x) ||
+ (point.y != ((ZnPoint *) valp)->y)) {
+ *((ZnPoint *) valp) = point;
+ *flags |= desc->flags;
+ }
+ break;
}
case ZN_CONFIG_DIM:
{
- ZnDim dim;
- if (Tcl_GetDoubleFromObj(wi->interp, args[i+1], &dim) == TCL_ERROR) {
- Tcl_AppendResult(wi->interp, " dimension expected for attribute \"",
- Tcl_GetString(args[i+1]), "\"", NULL);
- return TCL_ERROR;
- }
- if (dim != *((ZnDim *) valp)) {
- *((ZnDim *) valp) = dim;
- *flags |= desc->flags;
- }
- break;
+ ZnDim dim;
+ if (Tcl_GetDoubleFromObj(wi->interp, args[i+1], &dim) == TCL_ERROR) {
+ Tcl_AppendResult(wi->interp, " dimension expected for attribute \"",
+ Tcl_GetString(args[i+1]), "\"", NULL);
+ return TCL_ERROR;
+ }
+ if (dim != *((ZnDim *) valp)) {
+ *((ZnDim *) valp) = dim;
+ *flags |= desc->flags;
+ }
+ break;
}
case ZN_CONFIG_PRI:
{
- int pri;
- if (Tcl_GetIntFromObj(wi->interp, args[i+1], &pri) == TCL_ERROR) {
- return TCL_ERROR;
- }
- if (pri < 0) {
- Tcl_AppendResult(wi->interp, " priority must be a positive integer \"",
- Tcl_GetString(args[i+1]), "\"", NULL);
- return TCL_ERROR;
- }
- if (pri != *((unsigned short *) valp)) {
- *((unsigned short *) valp) = pri;
- ZnITEM.UpdateItemPriority(item, ZN_NO_ITEM, True);
- *flags |= desc->flags;
- }
- break;
+ int pri;
+ if (Tcl_GetIntFromObj(wi->interp, args[i+1], &pri) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+ if (pri < 0) {
+ Tcl_AppendResult(wi->interp, " priority must be a positive integer \"",
+ Tcl_GetString(args[i+1]), "\"", NULL);
+ return TCL_ERROR;
+ }
+ if (pri != *((unsigned short *) valp)) {
+ *((unsigned short *) valp) = pri;
+ ZnITEM.UpdateItemPriority(item, ZN_NO_ITEM, True);
+ *flags |= desc->flags;
+ }
+ break;
}
case ZN_CONFIG_ITEM:
/*
@@ -778,275 +778,275 @@ ZnConfigureAttributes(ZnWInfo *wi,
* associated with the tag.
*/
{
- ZnItem item2;
- int result;
- ZnTagSearch *search_var = NULL;
-
- if (strlen(Tcl_GetString(args[i+1])) == 0) {
- item2 = ZN_NO_ITEM;
- }
- else {
- result = ZnItemWithTagOrId(wi, args[i+1], &item2, &search_var);
- ZnTagSearchDestroy(search_var);
- if ((result == TCL_ERROR) || (item2 == ZN_NO_ITEM)) {
- Tcl_AppendResult(wi->interp, " unknown item \"",
- Tcl_GetString(args[i+1]), "\"", NULL);
- return TCL_ERROR;
- }
- }
- if (item2 != *((ZnItem *) valp)) {
- *((ZnItem *) valp) = item2;
- *flags |= desc->flags;
- }
+ ZnItem item2;
+ int result;
+ ZnTagSearch *search_var = NULL;
+
+ if (strlen(Tcl_GetString(args[i+1])) == 0) {
+ item2 = ZN_NO_ITEM;
+ }
+ else {
+ result = ZnItemWithTagOrId(wi, args[i+1], &item2, &search_var);
+ ZnTagSearchDestroy(search_var);
+ if ((result == TCL_ERROR) || (item2 == ZN_NO_ITEM)) {
+ Tcl_AppendResult(wi->interp, " unknown item \"",
+ Tcl_GetString(args[i+1]), "\"", NULL);
+ return TCL_ERROR;
+ }
+ }
+ if (item2 != *((ZnItem *) valp)) {
+ *((ZnItem *) valp) = item2;
+ *flags |= desc->flags;
+ }
}
break;
case ZN_CONFIG_WINDOW:
{
- Tk_Window win, ancestor, parent;
- str = Tcl_GetString(args[i+1]);
- if (strlen(str) == 0) {
- win = NULL;
- }
- else {
- win = Tk_NameToWindow(wi->interp, str, wi->win);
- if (win == NULL) {
- return TCL_ERROR;
- }
- else {
- /*
- * Make sure that the zinc widget is either the parent of the
- * window associated with the item or a descendant of that
- * parent. Also, don't allow a toplevel window or the widget
- * itself to be managed.
- */
- parent = Tk_Parent(win);
- for (ancestor = wi->win; ; ancestor = Tk_Parent(ancestor)) {
- if (ancestor == parent) {
- break;
- }
- if (((Tk_FakeWin *) (ancestor))->flags & TK_TOP_LEVEL) {
- badWindow:
- Tcl_AppendResult(wi->interp, "can't use ",
- Tk_PathName(win),
- " in a window item of this zinc widget",
- (char *) NULL);
- win = NULL;
- return TCL_ERROR;
- }
- }
- if (((Tk_FakeWin *) (win))->flags & TK_TOP_LEVEL) {
- goto badWindow;
- }
- if (win == wi->win) {
- goto badWindow;
- }
- if (win != *((Tk_Window *) valp)) {
- *((Tk_Window *) valp) = win;
- *flags |= desc->flags;
- }
- }
- }
+ Tk_Window win, ancestor, parent;
+ str = Tcl_GetString(args[i+1]);
+ if (strlen(str) == 0) {
+ win = NULL;
+ }
+ else {
+ win = Tk_NameToWindow(wi->interp, str, wi->win);
+ if (win == NULL) {
+ return TCL_ERROR;
+ }
+ else {
+ /*
+ * Make sure that the zinc widget is either the parent of the
+ * window associated with the item or a descendant of that
+ * parent. Also, don't allow a toplevel window or the widget
+ * itself to be managed.
+ */
+ parent = Tk_Parent(win);
+ for (ancestor = wi->win; ; ancestor = Tk_Parent(ancestor)) {
+ if (ancestor == parent) {
+ break;
+ }
+ if (((Tk_FakeWin *) (ancestor))->flags & TK_TOP_LEVEL) {
+ badWindow:
+ Tcl_AppendResult(wi->interp, "can't use ",
+ Tk_PathName(win),
+ " in a window item of this zinc widget",
+ (char *) NULL);
+ win = NULL;
+ return TCL_ERROR;
+ }
+ }
+ if (((Tk_FakeWin *) (win))->flags & TK_TOP_LEVEL) {
+ goto badWindow;
+ }
+ if (win == wi->win) {
+ goto badWindow;
+ }
+ if (win != *((Tk_Window *) valp)) {
+ *((Tk_Window *) valp) = win;
+ *flags |= desc->flags;
+ }
+ }
+ }
}
break;
case ZN_CONFIG_CHAR:
case ZN_CONFIG_UCHAR:
case ZN_CONFIG_ALPHA:
{
- int integer;
- if (Tcl_GetIntFromObj(wi->interp, args[i+1], &integer) == TCL_ERROR) {
- return TCL_ERROR;
- }
- switch (desc->type) {
- case ZN_CONFIG_UCHAR:
- if (integer < 0) {
- integer = 0;
- }
- case ZN_CONFIG_ALPHA:
- if (integer < 0) {
- integer = 0;
- }
- if (integer > 100) {
- integer = 100;
- }
- break;
- }
- if (integer != *((char *) valp)) {
- *((char *) valp) = integer;
- *flags |= desc->flags;
- }
- break;
+ int integer;
+ if (Tcl_GetIntFromObj(wi->interp, args[i+1], &integer) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+ switch (desc->type) {
+ case ZN_CONFIG_UCHAR:
+ if (integer < 0) {
+ integer = 0;
+ }
+ case ZN_CONFIG_ALPHA:
+ if (integer < 0) {
+ integer = 0;
+ }
+ if (integer > 100) {
+ integer = 100;
+ }
+ break;
+ }
+ if (integer != *((char *) valp)) {
+ *((char *) valp) = integer;
+ *flags |= desc->flags;
+ }
+ break;
}
case ZN_CONFIG_SHORT:
case ZN_CONFIG_USHORT:
{
- int integer;
- if (Tcl_GetIntFromObj(wi->interp, args[i+1], &integer) == TCL_ERROR) {
- return TCL_ERROR;
- }
- if (desc->type == ZN_CONFIG_SHORT) {
- if (integer < SHRT_MIN) {
- integer = SHRT_MIN;
- }
- else if (integer > SHRT_MAX) {
- integer = SHRT_MAX;
- }
- if (integer != *((short *) valp)) {
- *((short *) valp) = integer;
- *flags |= desc->flags;
- }
- }
- else {
- if (integer < 0) {
- integer = 0;
- }
- else if (integer > USHRT_MAX) {
- integer = USHRT_MAX;
- }
- if (integer != *((unsigned short *) valp)) {
- *((unsigned short *) valp) = integer;
- *flags |= desc->flags;
- }
- }
- break;
+ int integer;
+ if (Tcl_GetIntFromObj(wi->interp, args[i+1], &integer) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+ if (desc->type == ZN_CONFIG_SHORT) {
+ if (integer < SHRT_MIN) {
+ integer = SHRT_MIN;
+ }
+ else if (integer > SHRT_MAX) {
+ integer = SHRT_MAX;
+ }
+ if (integer != *((short *) valp)) {
+ *((short *) valp) = integer;
+ *flags |= desc->flags;
+ }
+ }
+ else {
+ if (integer < 0) {
+ integer = 0;
+ }
+ else if (integer > USHRT_MAX) {
+ integer = USHRT_MAX;
+ }
+ if (integer != *((unsigned short *) valp)) {
+ *((unsigned short *) valp) = integer;
+ *flags |= desc->flags;
+ }
+ }
+ break;
}
case ZN_CONFIG_INT:
case ZN_CONFIG_UINT:
case ZN_CONFIG_ANGLE:
{
- int integer;
- if (Tcl_GetIntFromObj(wi->interp, args[i+1], &integer) == TCL_ERROR) {
- return TCL_ERROR;
- }
- switch (desc->type) {
- case ZN_CONFIG_ANGLE:
- if ((integer > 360) || (integer < -360)) {
- integer = integer % 360;
- }
- break;
- case ZN_CONFIG_UINT:
- if (integer < 0) {
- integer = 0;
- }
- break;
- }
- if (integer != *((int *) valp)) {
- *((int *) valp) = integer;
- *flags |= desc->flags;
- }
- break;
+ int integer;
+ if (Tcl_GetIntFromObj(wi->interp, args[i+1], &integer) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+ switch (desc->type) {
+ case ZN_CONFIG_ANGLE:
+ if ((integer > 360) || (integer < -360)) {
+ integer = integer % 360;
+ }
+ break;
+ case ZN_CONFIG_UINT:
+ if (integer < 0) {
+ integer = 0;
+ }
+ break;
+ }
+ if (integer != *((int *) valp)) {
+ *((int *) valp) = integer;
+ *flags |= desc->flags;
+ }
+ break;
}
case ZN_CONFIG_FILL_RULE:
{
- ZnFillRule fill_rule;
-
- if (ZnGetFillRule(wi, Tcl_GetString(args[i+1]), &fill_rule) == TCL_ERROR) {
- Tcl_AppendResult(wi->interp, " fill rule expected for attribute \"",
- Tcl_GetString(args[i]), "\"", NULL);
- return TCL_ERROR;
- }
- if (fill_rule != *((ZnFillRule *) valp)) {
- *((ZnFillRule *) valp) = fill_rule;
- *flags |= desc->flags;
- }
- break;
+ ZnFillRule fill_rule;
+
+ if (ZnGetFillRule(wi, Tcl_GetString(args[i+1]), &fill_rule) == TCL_ERROR) {
+ Tcl_AppendResult(wi->interp, " fill rule expected for attribute \"",
+ Tcl_GetString(args[i]), "\"", NULL);
+ return TCL_ERROR;
+ }
+ if (fill_rule != *((ZnFillRule *) valp)) {
+ *((ZnFillRule *) valp) = fill_rule;
+ *flags |= desc->flags;
+ }
+ break;
}
case ZN_CONFIG_ALIGNMENT:
{
- Tk_Justify justify;
- if (Tk_GetJustify(wi->interp, Tcl_GetString(args[i+1]), &justify) == TCL_ERROR) {
- Tcl_AppendResult(wi->interp, " justify expected for attribute \"",
- Tcl_GetString(args[i]), "\"", NULL);
- return TCL_ERROR;
- }
- if (justify != *((Tk_Justify *) valp)) {
- *((Tk_Justify *) valp) = justify;
- *flags |= desc->flags;
- }
- break;
+ Tk_Justify justify;
+ if (Tk_GetJustify(wi->interp, Tcl_GetString(args[i+1]), &justify) == TCL_ERROR) {
+ Tcl_AppendResult(wi->interp, " justify expected for attribute \"",
+ Tcl_GetString(args[i]), "\"", NULL);
+ return TCL_ERROR;
+ }
+ if (justify != *((Tk_Justify *) valp)) {
+ *((Tk_Justify *) valp) = justify;
+ *flags |= desc->flags;
+ }
+ break;
}
case ZN_CONFIG_ANCHOR:
{
- Tk_Anchor anchor;
- if (Tk_GetAnchor(wi->interp, Tcl_GetString(args[i+1]), &anchor) == TCL_ERROR) {
- Tcl_AppendResult(wi->interp, " anchor expected for attribute \"",
- Tcl_GetString(args[i]), "\"", NULL);
- return TCL_ERROR;
- }
- if (anchor != *((Tk_Anchor *) valp)) {
- *((Tk_Anchor *) valp) = anchor;
- *flags |= desc->flags;
- }
- break;
+ Tk_Anchor anchor;
+ if (Tk_GetAnchor(wi->interp, Tcl_GetString(args[i+1]), &anchor) == TCL_ERROR) {
+ Tcl_AppendResult(wi->interp, " anchor expected for attribute \"",
+ Tcl_GetString(args[i]), "\"", NULL);
+ return TCL_ERROR;
+ }
+ if (anchor != *((Tk_Anchor *) valp)) {
+ *((Tk_Anchor *) valp) = anchor;
+ *flags |= desc->flags;
+ }
+ break;
}
case ZN_CONFIG_LABEL_FORMAT:
{
- ZnLabelFormat frmt = NULL;
-
- str = Tcl_GetString(args[i+1]);
- while (*str && (*str == ' ')) {
- str++;
- }
- if (strlen(str) != 0) {
- frmt = ZnLFCreate(wi->interp, str,
- ZnFIELD.NumFields(item->class->GetFieldSet(item)));
- if (frmt == NULL) {
- return TCL_ERROR;
- }
- }
-
- if (*((ZnLabelFormat *) valp) != NULL) {
- ZnLFDelete(*((ZnLabelFormat *) valp));
- *((ZnLabelFormat *) valp) = frmt;
- *flags |= desc->flags;
- }
- else {
- if (frmt != NULL) {
- *((ZnLabelFormat *) valp) = frmt;
- *flags |= desc->flags;
- }
- }
- break;
+ ZnLabelFormat frmt = NULL;
+
+ str = Tcl_GetString(args[i+1]);
+ while (*str && (*str == ' ')) {
+ str++;
+ }
+ if (strlen(str) != 0) {
+ frmt = ZnLFCreate(wi->interp, str,
+ ZnFIELD.NumFields(item->class->GetFieldSet(item)));
+ if (frmt == NULL) {
+ return TCL_ERROR;
+ }
+ }
+
+ if (*((ZnLabelFormat *) valp) != NULL) {
+ ZnLFDelete(*((ZnLabelFormat *) valp));
+ *((ZnLabelFormat *) valp) = frmt;
+ *flags |= desc->flags;
+ }
+ else {
+ if (frmt != NULL) {
+ *((ZnLabelFormat *) valp) = frmt;
+ *flags |= desc->flags;
+ }
+ }
+ break;
}
case ZN_CONFIG_AUTO_ALIGNMENT:
{
- ZnAutoAlign aa;
-
- if (ZnGetAutoAlign(wi, Tcl_GetString(args[i+1]), &aa) == TCL_ERROR) {
- Tcl_AppendResult(wi->interp, " auto alignment expected for attribute \"",
- Tcl_GetString(args[i]), "\"", NULL);
- return TCL_ERROR;
- }
- if ((aa.automatic != ((ZnAutoAlign *) valp)->automatic) ||
- (aa.align[0] != ((ZnAutoAlign *) valp)->align[0]) ||
- (aa.align[1] != ((ZnAutoAlign *) valp)->align[1]) ||
- (aa.align[2] != ((ZnAutoAlign *) valp)->align[2])) {
- *((ZnAutoAlign *) valp) = aa;
- *flags |= desc->flags;
- }
- break;
+ ZnAutoAlign aa;
+
+ if (ZnGetAutoAlign(wi, Tcl_GetString(args[i+1]), &aa) == TCL_ERROR) {
+ Tcl_AppendResult(wi->interp, " auto alignment expected for attribute \"",
+ Tcl_GetString(args[i]), "\"", NULL);
+ return TCL_ERROR;
+ }
+ if ((aa.automatic != ((ZnAutoAlign *) valp)->automatic) ||
+ (aa.align[0] != ((ZnAutoAlign *) valp)->align[0]) ||
+ (aa.align[1] != ((ZnAutoAlign *) valp)->align[1]) ||
+ (aa.align[2] != ((ZnAutoAlign *) valp)->align[2])) {
+ *((ZnAutoAlign *) valp) = aa;
+ *flags |= desc->flags;
+ }
+ break;
}
case ZN_CONFIG_LEADER_ANCHORS:
{
- ZnLeaderAnchors lanch = NULL;
- if (ZnGetLeaderAnchors(wi, Tcl_GetString(args[i+1]), &lanch) == TCL_ERROR) {
- Tcl_AppendResult(wi->interp, " leader anchors expected for attribute \"",
- Tcl_GetString(args[i]), "\"", NULL);
- return TCL_ERROR;
- }
- if (*((ZnLeaderAnchors *) valp) != NULL) {
- ZnFree(*((ZnLeaderAnchors *) valp));
- *((ZnLeaderAnchors *) valp) = lanch;
- *flags |= desc->flags;
- }
- else {
- if (lanch != NULL) {
- *((ZnLeaderAnchors *) valp) = lanch;
- *flags |= desc->flags;
- }
- }
- break;
+ ZnLeaderAnchors lanch = NULL;
+ if (ZnGetLeaderAnchors(wi, Tcl_GetString(args[i+1]), &lanch) == TCL_ERROR) {
+ Tcl_AppendResult(wi->interp, " leader anchors expected for attribute \"",
+ Tcl_GetString(args[i]), "\"", NULL);
+ return TCL_ERROR;
+ }
+ if (*((ZnLeaderAnchors *) valp) != NULL) {
+ ZnFree(*((ZnLeaderAnchors *) valp));
+ *((ZnLeaderAnchors *) valp) = lanch;
+ *flags |= desc->flags;
+ }
+ else {
+ if (lanch != NULL) {
+ *((ZnLeaderAnchors *) valp) = lanch;
+ *flags |= desc->flags;
+ }
+ }
+ break;
}
}
}
@@ -1060,23 +1060,23 @@ ZnConfigureAttributes(ZnWInfo *wi,
*
* AttributeToObj --
*
- * Returns the obj representation of the attribute pointed
- * by 'valp'. The attribute type is given by 'type'. The function
- * never fail.
+ * Returns the obj representation of the attribute pointed
+ * by 'valp'. The attribute type is given by 'type'. The function
+ * never fail.
*
**********************************************************************************
*/
static void
-AttributeToObj(Tcl_Interp *interp,
- void *record,
- ZnAttrConfig *desc,
- Tcl_Obj *result)
+AttributeToObj(Tcl_Interp *interp,
+ void *record,
+ ZnAttrConfig *desc,
+ Tcl_Obj *result)
{
- char *valp = ((char *) record) + desc->offset;
- char *str = "";
- Tcl_Obj *o;
- unsigned int i;
- char buffer[256];
+ char *valp = ((char *) record) + desc->offset;
+ char *str = "";
+ Tcl_Obj *o;
+ unsigned int i;
+ char buffer[256];
switch (desc->type) {
case ZN_CONFIG_GRADIENT:
@@ -1090,14 +1090,14 @@ AttributeToObj(Tcl_Interp *interp,
ZnGradient **grads;
if (*((ZnList *) valp)) {
- grads = ZnListArray(*((ZnList *) valp));
- num_grads = ZnListSize(*((ZnList *) valp));
-
- for (i = 0; i < num_grads; i++) {
- o = Tcl_NewStringObj(ZnNameOfGradient(grads[i]), -1);
- Tcl_ListObjAppendElement(interp, result, o);
- }
- return;
+ grads = ZnListArray(*((ZnList *) valp));
+ num_grads = ZnListSize(*((ZnList *) valp));
+
+ for (i = 0; i < num_grads; i++) {
+ o = Tcl_NewStringObj(ZnNameOfGradient(grads[i]), -1);
+ Tcl_ListObjAppendElement(interp, result, o);
+ }
+ return;
}
}
break;
@@ -1113,38 +1113,38 @@ AttributeToObj(Tcl_Interp *interp,
case ZN_CONFIG_BITMAP_LIST:
{
unsigned int num_pats=0;
- ZnImage *pats;
+ ZnImage *pats;
if (*((ZnList *) valp)) {
- pats = (ZnImage *) ZnListArray(*((ZnList *) valp));
- num_pats = ZnListSize(*((ZnList *) valp));
-
- for (i = 0; i < num_pats; i++) {
- if (pats[i] != ZnUnspecifiedImage) {
- o = Tcl_NewStringObj(ZnNameOfImage(pats[i]), -1);
- }
- else {
- o = Tcl_NewStringObj("", -1);
- }
- Tcl_ListObjAppendElement(interp, result, o);
- }
- return;
+ pats = (ZnImage *) ZnListArray(*((ZnList *) valp));
+ num_pats = ZnListSize(*((ZnList *) valp));
+
+ for (i = 0; i < num_pats; i++) {
+ if (pats[i] != ZnUnspecifiedImage) {
+ o = Tcl_NewStringObj(ZnNameOfImage(pats[i]), -1);
+ }
+ else {
+ o = Tcl_NewStringObj("", -1);
+ }
+ Tcl_ListObjAppendElement(interp, result, o);
+ }
+ return;
}
break;
}
case ZN_CONFIG_TAG_LIST:
{
unsigned int num_tags=0;
- Tk_Uid *tags;
+ Tk_Uid *tags;
if (*((ZnList *) valp)) {
- tags = (Tk_Uid *) ZnListArray(*((ZnList *) valp));
- num_tags = ZnListSize(*((ZnList *) valp));
- for (i = 0; i < num_tags; i++) {
- Tcl_ListObjAppendElement(interp, result,
- Tcl_NewStringObj(tags[i], -1));
- }
- return;
+ tags = (Tk_Uid *) ZnListArray(*((ZnList *) valp));
+ num_tags = ZnListSize(*((ZnList *) valp));
+ for (i = 0; i < num_tags; i++) {
+ Tcl_ListObjAppendElement(interp, result,
+ Tcl_NewStringObj(tags[i], -1));
+ }
+ return;
}
break;
}
@@ -1257,12 +1257,12 @@ AttributeToObj(Tcl_Interp *interp,
**********************************************************************************
*/
int
-ZnQueryAttribute(Tcl_Interp *interp,
- void *record,
- ZnAttrConfig *desc_table,
- Tcl_Obj *attr_name)
+ZnQueryAttribute(Tcl_Interp *interp,
+ void *record,
+ ZnAttrConfig *desc_table,
+ Tcl_Obj *attr_name)
{
- ZnAttrConfig *desc = GetAttrDesc(interp, attr_name, desc_table);
+ ZnAttrConfig *desc = GetAttrDesc(interp, attr_name, desc_table);
if (!desc) {
return TCL_ERROR;
@@ -1294,10 +1294,10 @@ ZnItemClassList()
**********************************************************************************
*/
ZnItemClass
-ZnLookupItemClass(char *class_name)
+ZnLookupItemClass(char *class_name)
{
- ZnItemClass *class;
- int i, num_classes;
+ ZnItemClass *class;
+ int i, num_classes;
class = (ZnItemClass *) ZnListArray(item_classes);
num_classes = ZnListSize(item_classes);
@@ -1318,7 +1318,7 @@ ZnLookupItemClass(char *class_name)
**********************************************************************************
*/
void
-ZnAddItemClass(ZnItemClass class)
+ZnAddItemClass(ZnItemClass class)
{
if (!ZnLookupItemClass(class->name)) {
ZnListAdd(item_classes, &class, ZnListTail);
@@ -1330,7 +1330,7 @@ ZnAddItemClass(ZnItemClass class)
**********************************************************************************
*
* ZnItemInit --
- * Initialize classes static state.
+ * Initialize classes static state.
*
**********************************************************************************
*/
@@ -1364,14 +1364,14 @@ ZnItemInit()
**********************************************************************************
*
* UpdateItemDependency -- Method
- * Update the group dependency list following a change in the
- * connection of an item.
+ * Update the group dependency list following a change in the
+ * connection of an item.
*
**********************************************************************************
*/
static void
-UpdateItemDependency(ZnItem item,
- ZnItem old_connection)
+UpdateItemDependency(ZnItem item,
+ ZnItem old_connection)
{
if (old_connection == ZN_NO_ITEM) {
/* Add a connection */
@@ -1395,16 +1395,16 @@ UpdateItemDependency(ZnItem item,
**********************************************************************************
*
* ExtractItem --
- * Extract an item from its context, includes updating graphic
- * state flags.
+ * Extract an item from its context, includes updating graphic
+ * state flags.
*
**********************************************************************************
*/
static void
-ExtractItem(ZnItem item)
+ExtractItem(ZnItem item)
{
- ZnWInfo *wi = item->wi;
- ZnItem group = item->parent;
+ ZnWInfo *wi = item->wi;
+ ZnItem group = item->parent;
/* damage bounding boxes */
if (ISSET(item->flags, ZN_VISIBLE_BIT)) {
@@ -1441,19 +1441,19 @@ ExtractItem(ZnItem item)
*
* InsertItem -- Method
*
- * Insert an item in the display list according to its priority.
- * It is inserted in front of items of lower or same priority. If
- * mark_item is not ZN_NO_ITEM the insertion is done relative
- * to this item, before it if 'before' is True, after it otherwise.
- * mark_item must be in the group 'group'.
+ * Insert an item in the display list according to its priority.
+ * It is inserted in front of items of lower or same priority. If
+ * mark_item is not ZN_NO_ITEM the insertion is done relative
+ * to this item, before it if 'before' is True, after it otherwise.
+ * mark_item must be in the group 'group'.
*
**********************************************************************************
*/
static void
-InsertItem(ZnItem item,
- ZnItem grp,
- ZnItem mark_item,
- ZnBool before)
+InsertItem(ZnItem item,
+ ZnItem grp,
+ ZnItem mark_item,
+ ZnBool before)
{
if (!grp) {
grp = item->wi->top_group;
@@ -1472,17 +1472,17 @@ InsertItem(ZnItem item,
**********************************************************************************
*
* UpdateItemPriority -- Method
- * Reorder a group's item list following a change in an
- * item priority or a call to lower/raise.
+ * Reorder a group's item list following a change in an
+ * item priority or a call to lower/raise.
*
**********************************************************************************
*/
static void
-UpdateItemPriority(ZnItem item,
- ZnItem mark_item,
- ZnBool before)
+UpdateItemPriority(ZnItem item,
+ ZnItem mark_item,
+ ZnBool before)
{
- ZnItem parent = item->parent;
+ ZnItem parent = item->parent;
ZnGroupExtractItem(item);
InsertItem(item, parent, mark_item, before);
@@ -1496,19 +1496,19 @@ UpdateItemPriority(ZnItem item,
*
* SetId,
* FreeId -- Method
- * Get a fresh object id from the widget and enter the new
- * object with this id in the object hash table. The id is
- * incremented. FreeId on the other hand suppress the item
- * from the hash table and set its object id to zero.
+ * Get a fresh object id from the widget and enter the new
+ * object with this id in the object hash table. The id is
+ * incremented. FreeId on the other hand suppress the item
+ * from the hash table and set its object id to zero.
*
**********************************************************************************
*/
static void
-SetId(ZnItem item)
+SetId(ZnItem item)
{
- ZnWInfo *wi = item->wi;
- Tcl_HashEntry *entry;
- int dummy;
+ ZnWInfo *wi = item->wi;
+ Tcl_HashEntry *entry;
+ int dummy;
item->id = wi->obj_id;
wi->obj_id++;
@@ -1517,9 +1517,9 @@ SetId(ZnItem item)
}
static void
-FreeId(ZnItem item)
+FreeId(ZnItem item)
{
- Tcl_HashEntry *entry;
+ Tcl_HashEntry *entry;
if (item->id) {
entry = Tcl_FindHashEntry(item->wi->id_table, (char *) item->id);
@@ -1534,19 +1534,19 @@ FreeId(ZnItem item)
**********************************************************************************
*
* AddTag -- Method
- * Add a tag to the item. If the tag is already on the list it
- * is not added. As a side effect the tag/item pair is added to
- * the tag table of the widget.
- * 'tag' must be a Tk_Uid.
+ * Add a tag to the item. If the tag is already on the list it
+ * is not added. As a side effect the tag/item pair is added to
+ * the tag table of the widget.
+ * 'tag' must be a Tk_Uid.
*
**********************************************************************************
*/
static void
-AddTag(ZnItem item,
- Tk_Uid tag)
+AddTag(ZnItem item,
+ Tk_Uid tag)
{
- int num, i;
- char **ptr;
+ int num, i;
+ char **ptr;
/*
* No tags yet.
@@ -1562,7 +1562,7 @@ AddTag(ZnItem item,
num = ZnListSize(item->tags);
for (i = 0; i < num; i++) {
if (ptr[i] == tag) {
- return;
+ return;
}
}
}
@@ -1580,11 +1580,11 @@ AddTag(ZnItem item,
**********************************************************************************
*/
static void
-RemoveTag(ZnItem item,
- Tk_Uid tag)
+RemoveTag(ZnItem item,
+ Tk_Uid tag)
{
- unsigned int indx, num;
- char **ptr;
+ unsigned int indx, num;
+ char **ptr;
if (!item->tags) {
return;
@@ -1612,7 +1612,7 @@ RemoveTag(ZnItem item,
**********************************************************************************
*/
static void
-FreeTags(ZnItem item)
+FreeTags(ZnItem item)
{
if (!item->tags) {
return;
@@ -1630,11 +1630,11 @@ FreeTags(ZnItem item)
**********************************************************************************
*/
static ZnBool
-HasTag(ZnItem item,
- Tk_Uid tag)
+HasTag(ZnItem item,
+ Tk_Uid tag)
{
- int num;
- Tk_Uid *tags;
+ int num;
+ Tk_Uid *tags;
if (!item->tags || !ZnListSize(item->tags)) {
return False;
@@ -1644,7 +1644,7 @@ HasTag(ZnItem item,
tags = ZnListArray(item->tags);
for (tags = ZnListArray(item->tags); num > 0; tags++, num--) {
if (*tags == tag) {
- return True;
+ return True;
}
}
}
@@ -1657,21 +1657,21 @@ HasTag(ZnItem item,
*
* ZnCreateItem --
*
- * InsertItem and ConfigureItem must be called after CreateItem
- * to finalize the setup of a new item. This is so even if
- * there are no attributes to be changed after creation.
- * ConfigureItem must be called in this case with the 'init'
- * parameter set to True.
+ * InsertItem and ConfigureItem must be called after CreateItem
+ * to finalize the setup of a new item. This is so even if
+ * there are no attributes to be changed after creation.
+ * ConfigureItem must be called in this case with the 'init'
+ * parameter set to True.
*
**********************************************************************************
*/
ZnItem
-ZnCreateItem(ZnWInfo *wi,
- ZnItemClass item_class,
- int *argc,
- Tcl_Obj *CONST *args[])
+ZnCreateItem(ZnWInfo *wi,
+ ZnItemClass item_class,
+ int *argc,
+ Tcl_Obj *CONST *args[])
{
- ZnItem item;
+ ZnItem item;
item = ZnMalloc(item_class->size);
@@ -1713,18 +1713,18 @@ ZnCreateItem(ZnWInfo *wi,
**********************************************************************************
*
* CloneItem -- Method
- * Can't clone the top level group.
+ * Can't clone the top level group.
*
**********************************************************************************
*/
static ZnItem
-CloneItem(ZnItem model)
+CloneItem(ZnItem model)
{
- ZnWInfo *wi = model->wi;
- ZnItem item;
- Tk_Uid *tags;
- unsigned int num_tags;
- int i;
+ ZnWInfo *wi = model->wi;
+ ZnItem item;
+ Tk_Uid *tags;
+ unsigned int num_tags;
+ int i;
if (!model->parent) {
return ZN_NO_ITEM;
@@ -1773,31 +1773,31 @@ CloneItem(ZnItem model)
**********************************************************************************
*/
static int
-ConfigureItem(ZnItem item,
- int field,
- int argc,
- Tcl_Obj *CONST argv[],
- ZnBool init)
+ConfigureItem(ZnItem item,
+ int field,
+ int argc,
+ Tcl_Obj *CONST argv[],
+ ZnBool init)
{
- ZnWInfo *wi = item->wi;
- int flags;
- ZnBool previous_visible = init ? False : ISSET(item->flags, ZN_VISIBLE_BIT);
+ ZnWInfo *wi = item->wi;
+ int flags;
+ ZnBool previous_visible = init ? False : ISSET(item->flags, ZN_VISIBLE_BIT);
flags = 0;
ASSIGN(flags, ZN_COORDS_FLAG, init);
if (argv) {
if (field < 0){
if (item->class->Configure(item, argc, argv, &flags) == TCL_ERROR) {
- return TCL_ERROR;
+ return TCL_ERROR;
}
if (item->class->GetFieldSet && ISSET(flags, ZN_CLFC_FLAG)) {
- ZnFIELD.ClearFieldCache(item->class->GetFieldSet(item), -1);
+ ZnFIELD.ClearFieldCache(item->class->GetFieldSet(item), -1);
}
}
else if (item->class->GetFieldSet) {
if (ZnFIELD.ConfigureField(item->class->GetFieldSet(item),
- field, argc, argv, &flags) == TCL_ERROR) {
- return TCL_ERROR;
+ field, argc, argv, &flags) == TCL_ERROR) {
+ return TCL_ERROR;
}
}
else {
@@ -1827,17 +1827,17 @@ ConfigureItem(ZnItem item,
**********************************************************************************
*/
static int
-QueryItem(ZnItem item,
- int field,
- int argc,
- Tcl_Obj *CONST argv[])
+QueryItem(ZnItem item,
+ int field,
+ int argc,
+ Tcl_Obj *CONST argv[])
{
if (field < 0) {
return item->class->Query(item, argc, argv);
}
else if (item->class->GetFieldSet) {
return ZnFIELD.QueryField(item->class->GetFieldSet(item),
- field, argc, argv);
+ field, argc, argv);
}
return TCL_ERROR;
@@ -1848,20 +1848,20 @@ QueryItem(ZnItem item,
**********************************************************************************
*
* ComposeTransform --
- * Compose a transform transfo with current_t to new_t.
+ * Compose a transform transfo with current_t to new_t.
*
**********************************************************************************
*/
static void
-ComposeTransform(ZnTransfo *transfo,
- ZnPoint *pos,
- ZnTransfo *current_t,
- ZnTransfo *new_t,
- ZnBool compose_scale,
- ZnBool compose_rot)
+ComposeTransform(ZnTransfo *transfo,
+ ZnPoint *pos,
+ ZnTransfo *current_t,
+ ZnTransfo *new_t,
+ ZnBool compose_scale,
+ ZnBool compose_rot)
{
- ZnBool full;
- ZnTransfo t, t2;
+ ZnBool full;
+ ZnTransfo t, t2;
full = compose_scale && compose_rot;
@@ -1876,10 +1876,10 @@ ComposeTransform(ZnTransfo *transfo,
/*ZnPrintTransfo(transfo);*/
if (pos) {
if (!transfo) {
- ZnTransfoSetIdentity(&t);
+ ZnTransfoSetIdentity(&t);
}
else {
- t = *transfo;
+ t = *transfo;
}
ZnTranslate(&t, pos->x, pos->y, False);
ZnTransfoCompose(new_t, &t, current_t);
@@ -1889,8 +1889,8 @@ ComposeTransform(ZnTransfo *transfo,
}
}
else {
- ZnPoint scale, trans, local_scale, local_trans, p;
- ZnReal local_rot, rot;
+ ZnPoint scale, trans, local_scale, local_trans, p;
+ ZnReal local_rot, rot;
ZnTransfoSetIdentity(new_t);
ZnTransfoDecompose(transfo, &local_scale, &local_trans, &local_rot, NULL);
@@ -1924,18 +1924,18 @@ ComposeTransform(ZnTransfo *transfo,
**********************************************************************************
*
* GetItemTransform -- Method
- * Compute the current transform for an item.
+ * Compute the current transform for an item.
*
**********************************************************************************
*/
static void
-GetItemTransform(ZnItem item,
- ZnTransfo *t)
+GetItemTransform(ZnItem item,
+ ZnTransfo *t)
{
- ZnItem *items;
- int i;
- ZnTransfo t_tmp, *t1, *t2, *swap;
- ZnPoint *pos;
+ ZnItem *items;
+ int i;
+ ZnTransfo t_tmp, *t1, *t2, *swap;
+ ZnPoint *pos;
if (item_stack == NULL) {
item_stack = ZnListNew(16, sizeof(ZnItem));
@@ -1958,12 +1958,12 @@ GetItemTransform(ZnItem item,
if (items[i]->class->pos_offset >= 0) {
pos = (ZnPoint *) (((char *) items[i]) + items[i]->class->pos_offset);
if (pos->x == 0 && pos->y == 0) {
- pos = NULL;
+ pos = NULL;
}
}
ComposeTransform(items[i]->transfo, pos, t1, t2,
- ISSET(items[i]->flags, ZN_COMPOSE_SCALE_BIT),
- ISSET(items[i]->flags, ZN_COMPOSE_ROTATION_BIT));
+ ISSET(items[i]->flags, ZN_COMPOSE_SCALE_BIT),
+ ISSET(items[i]->flags, ZN_COMPOSE_ROTATION_BIT));
swap = t2;
t2 = t1;
t1 = swap;
@@ -1988,7 +1988,7 @@ GetItemTransform(ZnItem item,
**********************************************************************************
*/
void
-ZnResetTransformStack(ZnWInfo *wi)
+ZnResetTransformStack(ZnWInfo *wi)
{
ZnListAssertSize(wi->transfo_stack, 1);
wi->current_transfo = (ZnTransfo *) ZnListAt(wi->transfo_stack, 0);
@@ -1996,27 +1996,27 @@ ZnResetTransformStack(ZnWInfo *wi)
}
void
-ZnInitTransformStack(ZnWInfo *wi)
+ZnInitTransformStack(ZnWInfo *wi)
{
wi->transfo_stack = ZnListNew(8, sizeof(ZnTransfo));
ZnResetTransformStack(wi);
}
void
-ZnFreeTransformStack(ZnWInfo *wi)
+ZnFreeTransformStack(ZnWInfo *wi)
{
ZnListFree(wi->transfo_stack);
}
void
-ZnPushTransform(ZnWInfo *wi,
- ZnTransfo *transfo,
- ZnPoint *pos,
- ZnBool compose_scale,
- ZnBool compose_rot)
+ZnPushTransform(ZnWInfo *wi,
+ ZnTransfo *transfo,
+ ZnPoint *pos,
+ ZnBool compose_scale,
+ ZnBool compose_rot)
{
- ZnTransfo *next_t;
- unsigned int num_t;
+ ZnTransfo *next_t;
+ unsigned int num_t;
/*
* Push the current transform and concatenate
@@ -2027,12 +2027,12 @@ ZnPushTransform(ZnWInfo *wi,
ZnListAssertSize(wi->transfo_stack, num_t+1);
next_t = (ZnTransfo *) ZnListAt(wi->transfo_stack, num_t);
ComposeTransform(transfo, pos, wi->current_transfo, next_t,
- compose_scale, compose_rot);
+ compose_scale, compose_rot);
wi->current_transfo = next_t;
}
void
-ZnPopTransform(ZnWInfo *wi)
+ZnPopTransform(ZnWInfo *wi)
{
/*
* Restore the previous transform.
@@ -2059,17 +2059,17 @@ ZnPopTransform(ZnWInfo *wi)
* of the item hierarchy.
*/
typedef struct _ClipState {
- ZnBool simple; /* The clip is an aligned rectangle. */
- TkRegion region; /* The region used to draw and to */
- /* probe for picking. */
- ZnBBox clip_box; /* The bounding box of the clip area. */
+ ZnBool simple; /* The clip is an aligned rectangle. */
+ TkRegion region; /* The region used to draw and to */
+ /* probe for picking. */
+ ZnBBox clip_box; /* The bounding box of the clip area. */
} ClipState;
void
-ZnResetClipStack(ZnWInfo *wi)
+ZnResetClipStack(ZnWInfo *wi)
{
- int i;
- ClipState *clips = (ClipState *) ZnListArray(wi->clip_stack);
+ int i;
+ ClipState *clips = (ClipState *) ZnListArray(wi->clip_stack);
/*
* Should not happen, clip stack should be
@@ -2083,23 +2083,23 @@ ZnResetClipStack(ZnWInfo *wi)
}
void
-ZnInitClipStack(ZnWInfo *wi)
+ZnInitClipStack(ZnWInfo *wi)
{
wi->clip_stack = ZnListNew(8, sizeof(ClipState));
ZnResetClipStack(wi);
}
void
-ZnFreeClipStack(ZnWInfo *wi)
+ZnFreeClipStack(ZnWInfo *wi)
{
ZnListFree(wi->clip_stack);
}
ZnBool
-ZnCurrentClip(ZnWInfo *wi,
- TkRegion *reg,
- ZnBBox **clip_box,
- ZnBool *simple)
+ZnCurrentClip(ZnWInfo *wi,
+ TkRegion *reg,
+ ZnBBox **clip_box,
+ ZnBool *simple)
{
if (wi->current_clip) {
if (reg) {
@@ -2123,18 +2123,18 @@ ZnCurrentClip(ZnWInfo *wi,
* is a regular pointer to a multi contour poly.
*/
void
-ZnPushClip(ZnWInfo *wi,
- ZnTriStrip *tristrip,
- ZnBool simple,
- ZnBool set_gc)
+ZnPushClip(ZnWInfo *wi,
+ ZnTriStrip *tristrip,
+ ZnBool simple,
+ ZnBool set_gc)
{
- unsigned int i, j, num_clips;
- unsigned int num_pts, max_num_pts;
- ZnPoint *p;
- ClipState *previous_clip=NULL;
- TkRegion reg, reg_op, reg_to;
- XRectangle rect;
- XPoint xpts[3];
+ unsigned int i, j, num_clips;
+ unsigned int num_pts, max_num_pts;
+ ZnPoint *p;
+ ClipState *previous_clip=NULL;
+ TkRegion reg, reg_op, reg_to;
+ XRectangle rect;
+ XPoint xpts[3];
if (tristrip->num_strips == 0) {
return;
@@ -2167,9 +2167,9 @@ ZnPushClip(ZnWInfo *wi,
rect.x = (short) tristrip->strips[0].points[0].x;
rect.y = (short) tristrip->strips[0].points[0].y;
rect.width = ((unsigned short) (tristrip->strips[0].points[1].x -
- tristrip->strips[0].points[0].x));
+ tristrip->strips[0].points[0].x));
rect.height = ((unsigned short) (tristrip->strips[0].points[1].y -
- tristrip->strips[0].points[0].y));
+ tristrip->strips[0].points[0].y));
reg = TkCreateRegion();
TkUnionRectWithRegion(&rect, reg, reg);
/*printf("Adding a simple clip: %d, %d, %d, %d\n",
@@ -2181,43 +2181,43 @@ ZnPushClip(ZnWInfo *wi,
num_pts = tristrip->strips[j].num_points;
p = tristrip->strips[j].points;
if (tristrip->strips[j].fan) {
- xpts[0].x = ZnNearestInt(p->x);
- xpts[0].y = ZnNearestInt(p->y);
- p++;
- xpts[1].x = ZnNearestInt(p->x);
- xpts[1].y = ZnNearestInt(p->y);
- p++;
- for (i = 2; i < num_pts; i++, p++) {
- xpts[2].x = ZnNearestInt(p->x);
- xpts[2].y = ZnNearestInt(p->y);
- reg_op = (TkRegion) ZnPolygonRegion(xpts, 3, EvenOddRule);
- reg_to = TkCreateRegion();
- ZnUnionRegion(reg, reg_op, reg_to);
- TkDestroyRegion(reg);
- TkDestroyRegion(reg_op);
- reg = reg_to;
- xpts[1] = xpts[2];
- }
+ xpts[0].x = ZnNearestInt(p->x);
+ xpts[0].y = ZnNearestInt(p->y);
+ p++;
+ xpts[1].x = ZnNearestInt(p->x);
+ xpts[1].y = ZnNearestInt(p->y);
+ p++;
+ for (i = 2; i < num_pts; i++, p++) {
+ xpts[2].x = ZnNearestInt(p->x);
+ xpts[2].y = ZnNearestInt(p->y);
+ reg_op = (TkRegion) ZnPolygonRegion(xpts, 3, EvenOddRule);
+ reg_to = TkCreateRegion();
+ ZnUnionRegion(reg, reg_op, reg_to);
+ TkDestroyRegion(reg);
+ TkDestroyRegion(reg_op);
+ reg = reg_to;
+ xpts[1] = xpts[2];
+ }
}
else {
- xpts[0].x = (short) p->x;
- xpts[0].y = (short) p->y;
- p++;
- xpts[1].x = (short) p->x;
- xpts[1].y = (short) p->y;
- p++;
- for (i = 2 ; i < num_pts; i++, p++) {
- xpts[2].x = (short) p->x;
- xpts[2].y = (short) p->y;
- reg_op = (TkRegion) ZnPolygonRegion(xpts, 3, EvenOddRule);
- reg_to = TkCreateRegion();
- ZnUnionRegion(reg, reg_op, reg_to);
- TkDestroyRegion(reg);
- TkDestroyRegion(reg_op);
- reg = reg_to;
- xpts[0] = xpts[1];
- xpts[1] = xpts[2];
- }
+ xpts[0].x = (short) p->x;
+ xpts[0].y = (short) p->y;
+ p++;
+ xpts[1].x = (short) p->x;
+ xpts[1].y = (short) p->y;
+ p++;
+ for (i = 2 ; i < num_pts; i++, p++) {
+ xpts[2].x = (short) p->x;
+ xpts[2].y = (short) p->y;
+ reg_op = (TkRegion) ZnPolygonRegion(xpts, 3, EvenOddRule);
+ reg_to = TkCreateRegion();
+ ZnUnionRegion(reg, reg_op, reg_to);
+ TkDestroyRegion(reg);
+ TkDestroyRegion(reg_op);
+ reg = reg_to;
+ xpts[0] = xpts[1];
+ xpts[1] = xpts[2];
+ }
}
}
}
@@ -2252,34 +2252,34 @@ ZnPushClip(ZnWInfo *wi,
glStencilOp(GL_KEEP, GL_INCR, GL_INCR);
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
if (simple) {
- /* printf("Clip box is : %d, %d, %d, %d, num_clips : %d\n",
- rect.x, rect.y, rect.width, rect.height, num_clips);*/
- glBegin(GL_QUADS);
- glVertex2d(wi->current_clip->clip_box.orig.x, wi->current_clip->clip_box.orig.y);
- glVertex2d(wi->current_clip->clip_box.orig.x, wi->current_clip->clip_box.corner.y);
- glVertex2d(wi->current_clip->clip_box.corner.x, wi->current_clip->clip_box.corner.y);
- glVertex2d(wi->current_clip->clip_box.corner.x, wi->current_clip->clip_box.orig.y);
- glEnd();
+ /* printf("Clip box is : %d, %d, %d, %d, num_clips : %d\n",
+ rect.x, rect.y, rect.width, rect.height, num_clips);*/
+ glBegin(GL_QUADS);
+ glVertex2d(wi->current_clip->clip_box.orig.x, wi->current_clip->clip_box.orig.y);
+ glVertex2d(wi->current_clip->clip_box.orig.x, wi->current_clip->clip_box.corner.y);
+ glVertex2d(wi->current_clip->clip_box.corner.x, wi->current_clip->clip_box.corner.y);
+ glVertex2d(wi->current_clip->clip_box.corner.x, wi->current_clip->clip_box.orig.y);
+ glEnd();
}
else {
- for (j = 0; j < tristrip->num_strips; j++) {
- num_pts = tristrip->strips[j].num_points;
- p = tristrip->strips[j].points;
- if (tristrip->strips[j].fan) {
- glBegin(GL_TRIANGLE_FAN);
- }
- else {
- glBegin(GL_TRIANGLE_STRIP);
- }
- for (i = 0; i < num_pts; i++, p++) {
- glVertex2d(p->x, p->y);
- }
- glEnd();
- }
+ for (j = 0; j < tristrip->num_strips; j++) {
+ num_pts = tristrip->strips[j].num_points;
+ p = tristrip->strips[j].points;
+ if (tristrip->strips[j].fan) {
+ glBegin(GL_TRIANGLE_FAN);
+ }
+ else {
+ glBegin(GL_TRIANGLE_STRIP);
+ }
+ for (i = 0; i < num_pts; i++, p++) {
+ glVertex2d(p->x, p->y);
+ }
+ glEnd();
+ }
}
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glStencilFunc(GL_EQUAL, (GLint) (num_clips+1), 0xFF);
- glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
+ glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
#endif
}
else {
@@ -2289,10 +2289,10 @@ ZnPushClip(ZnWInfo *wi,
}
void
-ZnPopClip(ZnWInfo *wi,
- ZnBool set_gc)
+ZnPopClip(ZnWInfo *wi,
+ ZnBool set_gc)
{
- int num_clips;
+ int num_clips;
if (wi->current_clip == NULL) {
return;
@@ -2316,42 +2316,42 @@ ZnPopClip(ZnWInfo *wi,
if (num_clips != 0) {
if (wi->render) {
#ifdef GL
- glStencilFunc(GL_EQUAL, (GLint) (num_clips+1), 0xFF);
- glStencilOp(GL_KEEP, GL_DECR, GL_DECR);
- glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
+ glStencilFunc(GL_EQUAL, (GLint) (num_clips+1), 0xFF);
+ glStencilOp(GL_KEEP, GL_DECR, GL_DECR);
+ glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
#if 0
- if (wi->current_clip->simple) {
+ if (wi->current_clip->simple) {
#endif
- glBegin(GL_QUADS);
- glVertex2d(wi->current_clip->clip_box.orig.x, wi->current_clip->clip_box.orig.y);
- glVertex2d(wi->current_clip->clip_box.orig.x, wi->current_clip->clip_box.corner.y);
- glVertex2d(wi->current_clip->clip_box.corner.x, wi->current_clip->clip_box.corner.y);
- glVertex2d(wi->current_clip->clip_box.corner.x, wi->current_clip->clip_box.orig.y);
- glEnd();
+ glBegin(GL_QUADS);
+ glVertex2d(wi->current_clip->clip_box.orig.x, wi->current_clip->clip_box.orig.y);
+ glVertex2d(wi->current_clip->clip_box.orig.x, wi->current_clip->clip_box.corner.y);
+ glVertex2d(wi->current_clip->clip_box.corner.x, wi->current_clip->clip_box.corner.y);
+ glVertex2d(wi->current_clip->clip_box.corner.x, wi->current_clip->clip_box.orig.y);
+ glEnd();
#if 0
- }
- else {
- }
+ }
+ else {
+ }
#endif
- glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
- glStencilFunc(GL_EQUAL, (GLint) num_clips, 0xFF);
- glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
+ glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
+ glStencilFunc(GL_EQUAL, (GLint) num_clips, 0xFF);
+ glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
#endif
}
else {
- TkSetRegion(wi->dpy, wi->gc, wi->current_clip->region);
+ TkSetRegion(wi->dpy, wi->gc, wi->current_clip->region);
}
}
else {
/*printf("resetting clip mask\n");*/
if (wi->render) {
#ifdef GL
- glClear(GL_STENCIL_BUFFER_BIT);
- glDisable(GL_STENCIL_TEST);
+ glClear(GL_STENCIL_BUFFER_BIT);
+ glDisable(GL_STENCIL_TEST);
#endif
}
else {
- XSetClipMask(wi->dpy, wi->gc, None);
+ XSetClipMask(wi->dpy, wi->gc, None);
}
}
}
@@ -2367,8 +2367,8 @@ ZnPopClip(ZnWInfo *wi,
**********************************************************************************
*/
static void
-Invalidate(ZnItem item,
- int reason)
+Invalidate(ZnItem item,
+ int reason)
{
/*
* Why this test has to be so an abrupt shortcut ?
@@ -2383,8 +2383,8 @@ Invalidate(ZnItem item,
ISSET(reason, ZN_TRANSFO_FLAG)) {
ZnItem parent = item->parent;
while ((parent != NULL) &&
- ISCLEAR(parent->inv_flags, ZN_COORDS_FLAG) &&
- ISCLEAR(parent->inv_flags, ZN_TRANSFO_FLAG)) {
+ ISCLEAR(parent->inv_flags, ZN_COORDS_FLAG) &&
+ ISCLEAR(parent->inv_flags, ZN_TRANSFO_FLAG)) {
SET(parent->inv_flags, ZN_COORDS_FLAG);
/*printf("invalidate coords for parent %d\n", parent->id);*/
parent = parent->parent;
@@ -2396,8 +2396,8 @@ Invalidate(ZnItem item,
*/
item->inv_flags |= reason;
/*printf("invalidate %s for item %d, flags %s\n",
- ISSET(reason, ZN_TRANSFO_FLAG)?"TRANSFO":"COORDS", item->id,
- ISSET(item->inv_flags, ZN_TRANSFO_FLAG)?"TRANSFO":"COORDS");*/
+ ISSET(reason, ZN_TRANSFO_FLAG)?"TRANSFO":"COORDS", item->id,
+ ISSET(item->inv_flags, ZN_TRANSFO_FLAG)?"TRANSFO":"COORDS");*/
ZnNeedRedisplay(item->wi);
}
else if (ISSET(reason, ZN_DRAW_FLAG)) {
@@ -2411,8 +2411,8 @@ Invalidate(ZnItem item,
* to reflect the changes.
*/
if (item->gl_list) {
- glDeleteLists(item->gl_list, 1);
- item->gl_list = 0;
+ glDeleteLists(item->gl_list, 1);
+ item->gl_list = 0;
}
#endif
#endif
@@ -2420,22 +2420,22 @@ Invalidate(ZnItem item,
}
}
-
+
/*
**********************************************************************************
*
* InvalidateItems -- Method
- * Invalidate the geometric state of all items belonging
- * to a given class. The search for items starts at group
- * and proceed depth first.
+ * Invalidate the geometric state of all items belonging
+ * to a given class. The search for items starts at group
+ * and proceed depth first.
*
**********************************************************************************
*/
static void
-InvalidateItems(ZnItem group,
- ZnItemClass item_class)
+InvalidateItems(ZnItem group,
+ ZnItemClass item_class)
{
- ZnItem item;
+ ZnItem item;
if (group->class != ZnGroup) {
return;
@@ -2462,14 +2462,14 @@ InvalidateItems(ZnItem group,
* ScaleItem
* SkewItem
* RotateItem -- Methods
- * Set of functions that deal with item transform. They take care
- * of all details including managing NULL transforms and invalidating
- * the item hierarchy.
+ * Set of functions that deal with item transform. They take care
+ * of all details including managing NULL transforms and invalidating
+ * the item hierarchy.
*
**********************************************************************************
*/
static void
-ResetTransfo(ZnItem item)
+ResetTransfo(ZnItem item)
{
if (item->transfo) {
ZnFree(item->transfo);
@@ -2480,8 +2480,8 @@ ResetTransfo(ZnItem item)
static void
-SetTransfo(ZnItem item,
- ZnTransfo *t)
+SetTransfo(ZnItem item,
+ ZnTransfo *t)
{
if (item->transfo) {
ZnFree(item->transfo);
@@ -2497,10 +2497,10 @@ SetTransfo(ZnItem item,
static void
-TranslateItem(ZnItem item,
- ZnReal dx,
- ZnReal dy,
- ZnBool abs)
+TranslateItem(ZnItem item,
+ ZnReal dx,
+ ZnReal dy,
+ ZnBool abs)
{
if (!item->transfo) {
item->transfo = ZnTransfoNew();
@@ -2511,10 +2511,10 @@ TranslateItem(ZnItem item,
static void
-ScaleItem(ZnItem item,
- ZnReal sx,
- ZnReal sy,
- ZnPoint *p)
+ScaleItem(ZnItem item,
+ ZnReal sx,
+ ZnReal sy,
+ ZnPoint *p)
{
if (!item->transfo) {
item->transfo = ZnTransfoNew();
@@ -2531,9 +2531,9 @@ ScaleItem(ZnItem item,
static void
-SkewItem(ZnItem item,
- ZnReal x_skew,
- ZnReal y_skew)
+SkewItem(ZnItem item,
+ ZnReal x_skew,
+ ZnReal y_skew)
{
if (!item->transfo) {
item->transfo = ZnTransfoNew();
@@ -2544,10 +2544,10 @@ SkewItem(ZnItem item,
static void
-RotateItem(ZnItem item,
- ZnReal angle,
- ZnBool deg,
- ZnPoint *p)
+RotateItem(ZnItem item,
+ ZnReal angle,
+ ZnBool deg,
+ ZnPoint *p)
{
if (!item->transfo) {
item->transfo = ZnTransfoNew();
@@ -2577,10 +2577,10 @@ RotateItem(ZnItem item,
**********************************************************************************
*/
static void
-DestroyItem(ZnItem item)
+DestroyItem(ZnItem item)
{
- ZnWInfo *wi = item->wi;
- ZnTextInfo *ti = &wi->text_info;
+ ZnWInfo *wi = item->wi;
+ ZnTextInfo *ti = &wi->text_info;
/*
* Extract it from its group.
diff --git a/generic/Item.h b/generic/Item.h
index c3e381e..a63f9f6 100644
--- a/generic/Item.h
+++ b/generic/Item.h
@@ -1,8 +1,8 @@
/*
* Item.h -- Header to access items' common state and functions.
*
- * Authors : Patrick Lecoanet.
- * Creation date :
+ * Authors : Patrick Lecoanet.
+ * Creation date :
*
* $Id$
*/
@@ -45,12 +45,12 @@
* Types and constants for attribute processing.
*/
typedef struct _ZnAttrConfig {
- int type;
- char *name;
+ int type;
+ char *name;
Tk_Uid uid;
- int offset;
- int bool_bit;
- int flags;
+ int offset;
+ int bool_bit;
+ int flags;
ZnBool read_only;
} ZnAttrConfig;
@@ -59,66 +59,66 @@ typedef struct _ZnAttrConfig {
* do not forget to update attribute_type_strings
* in Item.c.
*/
-#define ZN_CONFIG_END 0
-#define ZN_CONFIG_BOOL 1
-#define ZN_CONFIG_BITMAP 2
-#define ZN_CONFIG_BITMAP_LIST 3
-#define ZN_CONFIG_STRING 4
-#define ZN_CONFIG_FONT 5
-#define ZN_CONFIG_EDGE_LIST 6
-#define ZN_CONFIG_RELIEF 7
-#define ZN_CONFIG_DIM 8
-#define ZN_CONFIG_PRI 9
-#define ZN_CONFIG_ALIGNMENT 10
+#define ZN_CONFIG_END 0
+#define ZN_CONFIG_BOOL 1
+#define ZN_CONFIG_BITMAP 2
+#define ZN_CONFIG_BITMAP_LIST 3
+#define ZN_CONFIG_STRING 4
+#define ZN_CONFIG_FONT 5
+#define ZN_CONFIG_EDGE_LIST 6
+#define ZN_CONFIG_RELIEF 7
+#define ZN_CONFIG_DIM 8
+#define ZN_CONFIG_PRI 9
+#define ZN_CONFIG_ALIGNMENT 10
#define ZN_CONFIG_AUTO_ALIGNMENT 11
-#define ZN_CONFIG_LINE_END 12
-#define ZN_CONFIG_LABEL_FORMAT 13
-#define ZN_CONFIG_LINE_STYLE 14
-#define ZN_CONFIG_LINE_SHAPE 15
-#define ZN_CONFIG_ITEM 16
-#define ZN_CONFIG_ANGLE 17
-#define ZN_CONFIG_INT 18
-#define ZN_CONFIG_UINT 19
-#define ZN_CONFIG_POINT 20
-#define ZN_CONFIG_ANCHOR 21
-#define ZN_CONFIG_TAG_LIST 22
-#define ZN_CONFIG_MAP_INFO 23
-#define ZN_CONFIG_IMAGE 24
+#define ZN_CONFIG_LINE_END 12
+#define ZN_CONFIG_LABEL_FORMAT 13
+#define ZN_CONFIG_LINE_STYLE 14
+#define ZN_CONFIG_LINE_SHAPE 15
+#define ZN_CONFIG_ITEM 16
+#define ZN_CONFIG_ANGLE 17
+#define ZN_CONFIG_INT 18
+#define ZN_CONFIG_UINT 19
+#define ZN_CONFIG_POINT 20
+#define ZN_CONFIG_ANCHOR 21
+#define ZN_CONFIG_TAG_LIST 22
+#define ZN_CONFIG_MAP_INFO 23
+#define ZN_CONFIG_IMAGE 24
#define ZN_CONFIG_LEADER_ANCHORS 25
-#define ZN_CONFIG_JOIN_STYLE 26
-#define ZN_CONFIG_CAP_STYLE 27
-#define ZN_CONFIG_GRADIENT 28
-#define ZN_CONFIG_GRADIENT_LIST 29
-#define ZN_CONFIG_WINDOW 30
-#define ZN_CONFIG_ALPHA 31
-#define ZN_CONFIG_FILL_RULE 32
-#define ZN_CONFIG_SHORT 33
-#define ZN_CONFIG_USHORT 34
-#define ZN_CONFIG_CHAR 35
-#define ZN_CONFIG_UCHAR 36
-
-#define ZN_DRAW_FLAG 1 << 0
-#define ZN_COORDS_FLAG 1 << 1
-#define ZN_TRANSFO_FLAG 1 << 2
-#define ZN_REPICK_FLAG 1 << 3
-#define ZN_BORDER_FLAG 1 << 4
-#define ZN_CLFC_FLAG 1 << 5 /* Clear Label Format Cache. */
-#define ZN_IMAGE_FLAG 1 << 6 /* Update image pointer. */
-#define ZN_VIS_FLAG 1 << 7 /* Visibility has changed. */
-#define ZN_MOVED_FLAG 1 << 8 /* Item has moved. */
-#define ZN_ITEM_FLAG 1 << 9 /* Signal a change in an item type attribute. */
+#define ZN_CONFIG_JOIN_STYLE 26
+#define ZN_CONFIG_CAP_STYLE 27
+#define ZN_CONFIG_GRADIENT 28
+#define ZN_CONFIG_GRADIENT_LIST 29
+#define ZN_CONFIG_WINDOW 30
+#define ZN_CONFIG_ALPHA 31
+#define ZN_CONFIG_FILL_RULE 32
+#define ZN_CONFIG_SHORT 33
+#define ZN_CONFIG_USHORT 34
+#define ZN_CONFIG_CHAR 35
+#define ZN_CONFIG_UCHAR 36
+
+#define ZN_DRAW_FLAG 1 << 0
+#define ZN_COORDS_FLAG 1 << 1
+#define ZN_TRANSFO_FLAG 1 << 2
+#define ZN_REPICK_FLAG 1 << 3
+#define ZN_BORDER_FLAG 1 << 4
+#define ZN_CLFC_FLAG 1 << 5 /* Clear Label Format Cache. */
+#define ZN_IMAGE_FLAG 1 << 6 /* Update image pointer. */
+#define ZN_VIS_FLAG 1 << 7 /* Visibility has changed. */
+#define ZN_MOVED_FLAG 1 << 8 /* Item has moved. */
+#define ZN_ITEM_FLAG 1 << 9 /* Signal a change in an item type attribute. */
#define ZN_MAP_INFO_FLAG 1 << 10/* Update mapinfo pointer. */
-#define ZN_LAYOUT_FLAG 1 << 11 /* A layout need update. */
-#define ZN_POLAR_FLAG 1 << 12 /* Signal a cartesian to polar change. */
-#define ZN_CARTESIAN_FLAG 1 << 13 /* Signal a polar to cartesian change. */
-#define ZN_TILE_FLAG 1 << 14 /* Update tile pointer. */
-#define ZN_WINDOW_FLAG 1 << 15 /* Signal a change in a window type attribute. */
+#define ZN_LAYOUT_FLAG 1 << 11 /* A layout need update. */
+#define ZN_POLAR_FLAG 1 << 12 /* Signal a cartesian to polar change. */
+#define ZN_CARTESIAN_FLAG 1 << 13 /* Signal a polar to cartesian change. */
+#define ZN_TILE_FLAG 1 << 14 /* Update tile pointer. */
+#define ZN_WINDOW_FLAG 1 << 15 /* Signal a change in a window type attribute. */
/*
* This constant marks a non existant item
*/
-#define ZN_NO_ITEM NULL
+#define ZN_NO_ITEM NULL
/*
* Constants for item parts. The item indexable parts (named fields) are coded
@@ -126,27 +126,27 @@ typedef struct _ZnAttrConfig {
* coded as negatives beginning at -2 up to -9 which is the current limit. The
* -1 value is reserved to indicate no part.
*/
-#define ZnPartToBit(part) (1 << (ABS(part)-2))
-#define ZN_NO_PART -1
+#define ZnPartToBit(part) (1 << (ABS(part)-2))
+#define ZN_NO_PART -1
/*
* Some flags macros.
*/
-#define ISSET(var, mask) ((var) & (mask))
-#define ISCLEAR(var, mask) (((var) & (mask)) == 0)
-#define SET(var,mask) ((var) |= (mask))
-#define CLEAR(var, mask) ((var) &= ~(mask))
-#define ASSIGN(var, mask, bool) ((bool) ? SET((var), (mask)) : CLEAR((var), (mask)))
+#define ISSET(var, mask) ((var) & (mask))
+#define ISCLEAR(var, mask) (((var) & (mask)) == 0)
+#define SET(var,mask) ((var) |= (mask))
+#define CLEAR(var, mask) ((var) &= ~(mask))
+#define ASSIGN(var, mask, bool) ((bool) ? SET((var), (mask)) : CLEAR((var), (mask)))
/*
* Item flags values.
*/
-#define ZN_VISIBLE_BIT (1<<0)
-#define ZN_SENSITIVE_BIT (1<<1)
-#define ZN_UPDATE_DEPENDENT_BIT (1<<2)
-#define ZN_COMPOSE_SCALE_BIT (1<<3)
-#define ZN_COMPOSE_ROTATION_BIT (1<<4)
-#define ZN_COMPOSE_ALPHA_BIT (1<<5)
+#define ZN_VISIBLE_BIT (1<<0)
+#define ZN_SENSITIVE_BIT (1<<1)
+#define ZN_UPDATE_DEPENDENT_BIT (1<<2)
+#define ZN_COMPOSE_SCALE_BIT (1<<3)
+#define ZN_COMPOSE_ROTATION_BIT (1<<4)
+#define ZN_COMPOSE_ALPHA_BIT (1<<5)
/*
* Must be kept one greater than the last flag shift count.
*/
@@ -156,13 +156,13 @@ typedef struct _ZnAttrConfig {
/*
* Operator constants for the coord method.
*/
-#define ZN_COORDS_READ 0
-#define ZN_COORDS_READ_ALL 1
-#define ZN_COORDS_REPLACE 2
-#define ZN_COORDS_REPLACE_ALL 3
-#define ZN_COORDS_ADD 4
-#define ZN_COORDS_ADD_LAST 5
-#define ZN_COORDS_REMOVE 6
+#define ZN_COORDS_READ 0
+#define ZN_COORDS_READ_ALL 1
+#define ZN_COORDS_REPLACE 2
+#define ZN_COORDS_REPLACE_ALL 3
+#define ZN_COORDS_ADD 4
+#define ZN_COORDS_ADD_LAST 5
+#define ZN_COORDS_REMOVE 6
struct _ZnWInfo;
@@ -173,48 +173,48 @@ struct _ZnTransfo;
*/
typedef struct _ZnItemStruct {
/* Private data */
- unsigned int id;
- ZnList tags;
- struct _ZnWInfo *wi; /* The widget this item is on */
- struct _ZnItemClassStruct *class; /* item class */
- struct _ZnItemStruct *previous; /* previous item in group list */
- struct _ZnItemStruct *next; /* next item in group list */
- struct _ZnItemStruct *parent;
- ZnBBox item_bounding_box; /* device item bounding box */
+ unsigned int id;
+ ZnList tags;
+ struct _ZnWInfo *wi; /* The widget this item is on */
+ struct _ZnItemClassStruct *class; /* item class */
+ struct _ZnItemStruct *previous; /* previous item in group list */
+ struct _ZnItemStruct *next; /* next item in group list */
+ struct _ZnItemStruct *parent;
+ ZnBBox item_bounding_box; /* device item bounding box */
/* Common attributes */
- unsigned short flags;
- unsigned short part_sensitive; /* Currently limited to 16 parts per item */
- unsigned short inv_flags;
- unsigned short priority;
- struct _ZnTransfo *transfo;
- struct _ZnItemStruct *connected_item; /* Item this item is connected to */
+ unsigned short flags;
+ unsigned short part_sensitive; /* Currently limited to 16 parts per item */
+ unsigned short inv_flags;
+ unsigned short priority;
+ struct _ZnTransfo *transfo;
+ struct _ZnItemStruct *connected_item; /* Item this item is connected to */
#ifdef GL
#ifdef GL_LIST
- GLuint gl_list; /* Display list storing the item graphics */
+ GLuint gl_list; /* Display list storing the item graphics */
#endif
#endif
} ZnItemStruct, *ZnItem;
typedef struct _ZnToAreaStruct {
- Tk_Uid tag_uid;
- ZnBool enclosed;
- ZnItem in_group;
- ZnBool report;
- ZnBool recursive;
- ZnBool override_atomic;
- ZnBBox *area;
+ Tk_Uid tag_uid;
+ ZnBool enclosed;
+ ZnItem in_group;
+ ZnBool report;
+ ZnBool recursive;
+ ZnBool override_atomic;
+ ZnBBox *area;
} ZnToAreaStruct, *ZnToArea;
typedef struct _ZnPickStruct {
- int aperture;
- ZnItem in_group;
- ZnItem start_item;
- ZnBool recursive;
- ZnBool override_atomic;
- ZnPoint *point;
- ZnItem a_item;
- int a_part;
+ int aperture;
+ ZnItem in_group;
+ ZnItem start_item;
+ ZnBool recursive;
+ ZnBool override_atomic;
+ ZnPoint *point;
+ ZnItem a_item;
+ int a_part;
} ZnPickStruct, *ZnPick;
@@ -223,7 +223,7 @@ typedef struct _ZnPickStruct {
*/
typedef int (*ZnItemInitMethod)(ZnItem item, int *argc, Tcl_Obj *CONST *args[]);
typedef int (*ZnItemConfigureMethod)(ZnItem item, int argc, Tcl_Obj *CONST args[],
- int *flags);
+ int *flags);
typedef int (*ZnItemQueryMethod)(ZnItem item, int argc, Tcl_Obj *CONST args[]);
typedef void (*ZnItemCloneMethod)(ZnItem item);
typedef void (*ZnItemDestroyMethod)(ZnItem item);
@@ -236,64 +236,64 @@ typedef ZnBool (*ZnItemIsSensitiveMethod)(ZnItem item, int part);
typedef struct _ZnFieldSetStruct* (*ZnItemGetFieldSetMethod)(ZnItem item);
typedef int (*ZnItemContourMethod)(ZnItem item, int cmd, int index, ZnPoly *poly);
typedef void (*ZnItemPickVertexMethod)(ZnItem item, ZnPoint *p, int *contour,
- int *vertex, int *o_vertex);
+ int *vertex, int *o_vertex);
typedef void (*ZnItemGetAnchorMethod)(ZnItem item, Tk_Anchor anchor, ZnPoint *p);
typedef ZnBool (*ZnItemGetClipVerticesMethod)(ZnItem item, ZnTriStrip *tristrip);
typedef ZnBool (*ZnItemGetContoursMethod)(ZnItem item, ZnPoly *poly);
typedef int (*ZnItemCoordsMethod)(ZnItem item, int contour, int index, int cmd,
- ZnPoint **points, char **controls, unsigned int *num_points);
+ ZnPoint **points, char **controls, unsigned int *num_points);
typedef void (*ZnItemInsertCharsMethod)(ZnItem item, int field, int *index,
- char *chars);
+ char *chars);
typedef void (*ZnItemDeleteCharsMethod)(ZnItem item, int field, int *first,
- int *last);
+ int *last);
typedef void (*ZnItemCursorMethod)(ZnItem item, int field, int index);
typedef int (*ZnItemIndexMethod)(ZnItem item, int field, Tcl_Obj *index_spec,
- int *index);
+ int *index);
typedef int (*ZnItemPartMethod)(ZnItem item, Tcl_Obj **part_spec, int *part);
typedef int (*ZnItemSelectionMethod)(ZnItem item, int field, int offset,
- char *chars, int max_chars);
+ char *chars, int max_chars);
typedef void (*ZnItemPostScriptMethod)(ZnItem item, ZnBool prepass);
-typedef void *ZnItemClassId;
+typedef void *ZnItemClassId;
-#define ZN_CLASS_HAS_ANCHORS (1<<0)
-#define ZN_CLASS_ONE_COORD (1<<1)
+#define ZN_CLASS_HAS_ANCHORS (1<<0)
+#define ZN_CLASS_ONE_COORD (1<<1)
typedef struct _ZnItemClassStruct {
- char *name;
- unsigned int size;
- ZnAttrConfig *attr_desc;
- unsigned int num_parts; /* 0 if no special parts, else
- * gives how many parts exist. */
- int flags; /* HAS_ANCHORS, ONE_COORD */
- int pos_offset; /* Offset of -position attrib, */
- /* if any, -1 otherwise. */
- ZnItemInitMethod Init;
- ZnItemCloneMethod Clone;
- ZnItemDestroyMethod Destroy;
- ZnItemConfigureMethod Configure;
- ZnItemQueryMethod Query;
- ZnItemGetFieldSetMethod GetFieldSet;
- ZnItemGetAnchorMethod GetAnchor;
- ZnItemGetClipVerticesMethod GetClipVertices;
- ZnItemGetContoursMethod GetContours;
- ZnItemCoordsMethod Coords;
- ZnItemInsertCharsMethod InsertChars;
- ZnItemDeleteCharsMethod DeleteChars;
- ZnItemCursorMethod Cursor;
- ZnItemIndexMethod Index;
- ZnItemPartMethod Part;
- ZnItemSelectionMethod Selection;
- ZnItemContourMethod Contour;
+ char *name;
+ unsigned int size;
+ ZnAttrConfig *attr_desc;
+ unsigned int num_parts; /* 0 if no special parts, else
+ * gives how many parts exist. */
+ int flags; /* HAS_ANCHORS, ONE_COORD */
+ int pos_offset; /* Offset of -position attrib, */
+ /* if any, -1 otherwise. */
+ ZnItemInitMethod Init;
+ ZnItemCloneMethod Clone;
+ ZnItemDestroyMethod Destroy;
+ ZnItemConfigureMethod Configure;
+ ZnItemQueryMethod Query;
+ ZnItemGetFieldSetMethod GetFieldSet;
+ ZnItemGetAnchorMethod GetAnchor;
+ ZnItemGetClipVerticesMethod GetClipVertices;
+ ZnItemGetContoursMethod GetContours;
+ ZnItemCoordsMethod Coords;
+ ZnItemInsertCharsMethod InsertChars;
+ ZnItemDeleteCharsMethod DeleteChars;
+ ZnItemCursorMethod Cursor;
+ ZnItemIndexMethod Index;
+ ZnItemPartMethod Part;
+ ZnItemSelectionMethod Selection;
+ ZnItemContourMethod Contour;
ZnItemComputeCoordinatesMethod ComputeCoordinates;
- ZnItemToAreaMethod ToArea;
- ZnItemDrawMethod Draw;
- ZnItemRenderMethod Render;
- ZnItemIsSensitiveMethod IsSensitive;
- ZnItemPickMethod Pick;
- ZnItemPickVertexMethod PickVertex;
- ZnItemPostScriptMethod PostScript;
+ ZnItemToAreaMethod ToArea;
+ ZnItemDrawMethod Draw;
+ ZnItemRenderMethod Render;
+ ZnItemIsSensitiveMethod IsSensitive;
+ ZnItemPickMethod Pick;
+ ZnItemPickVertexMethod PickVertex;
+ ZnItemPostScriptMethod PostScript;
} ZnItemClassStruct, *ZnItemClass;
@@ -308,7 +308,7 @@ extern struct _ZnITEM {
ZnItem (*CloneItem)(ZnItem model);
void (*DestroyItem)(ZnItem item);
int (*ConfigureItem)(ZnItem item, int field, int argc, Tcl_Obj *CONST args[],
- ZnBool init);
+ ZnBool init);
int (*QueryItem)(ZnItem item, int field, int argc, Tcl_Obj *CONST args[]);
void (*InsertItem)(ZnItem item, ZnItem group, ZnItem mark_item, ZnBool before);
void (*UpdateItemPriority)(ZnItem item, ZnItem mark_item, ZnBool before);
@@ -341,48 +341,48 @@ extern struct _ZnITEM {
*/
void ZnItemInit();
ZnItem ZnCreateItem(struct _ZnWInfo *wi, ZnItemClass item_class,
- int *argc, Tcl_Obj *CONST *args[]);
+ int *argc, Tcl_Obj *CONST *args[]);
void ZnAddItemClass(ZnItemClass class);
ZnItemClass ZnLookupItemClass(char *class_name);
ZnList ZnItemClassList();
int ZnConfigureAttributes(struct _ZnWInfo *wi, ZnItem item, void *record,
- ZnAttrConfig *attr_desc, int argc, Tcl_Obj *CONST args[],
- int *flags);
+ ZnAttrConfig *attr_desc, int argc, Tcl_Obj *CONST args[],
+ int *flags);
int ZnAttributesInfo(Tcl_Interp *interp, void *record,
- ZnAttrConfig *attr_desc, int argc, Tcl_Obj *CONST args[]);
+ ZnAttrConfig *attr_desc, int argc, Tcl_Obj *CONST args[]);
int ZnQueryAttribute(Tcl_Interp *interp, void *record, ZnAttrConfig *attr_desc,
- Tcl_Obj *attr_name);
+ Tcl_Obj *attr_name);
void ZnInitTransformStack(struct _ZnWInfo *wi);
void ZnFreeTransformStack(struct _ZnWInfo *wi);
void ZnResetTransformStack(struct _ZnWInfo *wi);
void ZnPushTransform(struct _ZnWInfo *wi, struct _ZnTransfo *transfo,
- ZnPoint *pos, ZnBool compose_scale, ZnBool compose_rot);
+ ZnPoint *pos, ZnBool compose_scale, ZnBool compose_rot);
void ZnPopTransform(struct _ZnWInfo *wi);
void ZnInitClipStack(struct _ZnWInfo *wi);
void ZnFreeClipStack(struct _ZnWInfo *wi);
void ZnResetClipStack(struct _ZnWInfo *wi);
void ZnPushClip(struct _ZnWInfo *wi, ZnTriStrip *tristrip, ZnBool simple,
- ZnBool set_gc);
+ ZnBool set_gc);
void ZnPopClip(struct _ZnWInfo *wi, ZnBool set_gc);
ZnBool ZnCurrentClip(struct _ZnWInfo *wi, TkRegion *reg, ZnBBox **clip_box,
- ZnBool *simple);
+ ZnBool *simple);
void ZnUpdateItemImage(void *client_data);
-extern ZnItemClassId ZnArc;
-extern ZnItemClassId ZnMap;
-extern ZnItemClassId ZnTabular;
-extern ZnItemClassId ZnCurve;
-extern ZnItemClassId ZnBezier;
-extern ZnItemClassId ZnTriangles;
-extern ZnItemClassId ZnRectangle;
-extern ZnItemClassId ZnReticle;
-extern ZnItemClassId ZnTrack;
-extern ZnItemClassId ZnWayPoint;
-extern ZnItemClassId ZnGroup;
-extern ZnItemClassId ZnIcon;
-extern ZnItemClassId ZnText;
-extern ZnItemClassId ZnWindow;
+extern ZnItemClassId ZnArc;
+extern ZnItemClassId ZnMap;
+extern ZnItemClassId ZnTabular;
+extern ZnItemClassId ZnCurve;
+extern ZnItemClassId ZnBezier;
+extern ZnItemClassId ZnTriangles;
+extern ZnItemClassId ZnRectangle;
+extern ZnItemClassId ZnReticle;
+extern ZnItemClassId ZnTrack;
+extern ZnItemClassId ZnWayPoint;
+extern ZnItemClassId ZnGroup;
+extern ZnItemClassId ZnIcon;
+extern ZnItemClassId ZnText;
+extern ZnItemClassId ZnWindow;
-#endif /* _Item_h */
+#endif /* _Item_h */
diff --git a/generic/List.c b/generic/List.c
index 3d0e9db..b0b56ae 100644
--- a/generic/List.c
+++ b/generic/List.c
@@ -1,8 +1,8 @@
/*
* List.c -- Implementation of list module.
*
- * Authors : Patrick Lecoanet.
- * Creation date : Tue Mar 15 17:18:17 1994
+ * Authors : Patrick Lecoanet.
+ * Creation date : Tue Mar 15 17:18:17 1994
*
* $Id$
*/
@@ -31,25 +31,25 @@
**********************************************************************************
*
* This modules exports the following functions:
- * - ZnListNew
- * - ZnListDuplicate
- * - ZnListEmpty
- * - ZnListFromArray
- * - ZnListArray
- * - ZnListFree
- * - ZnListSize
- * - ZnListAssertSize
- * - ZnListAdd
- * - ZnListAt
- * - ZnListAtPut
- * - ZnListDelete
- * - ZnListTruncate
- * - ZnListDetect
- * - ZnListDo
+ * - ZnListNew
+ * - ZnListDuplicate
+ * - ZnListEmpty
+ * - ZnListFromArray
+ * - ZnListArray
+ * - ZnListFree
+ * - ZnListSize
+ * - ZnListAssertSize
+ * - ZnListAdd
+ * - ZnListAt
+ * - ZnListAtPut
+ * - ZnListDelete
+ * - ZnListTruncate
+ * - ZnListDetect
+ * - ZnListDo
*
* To appear soon:
- * - ZnListCollect
- * - ZnListReject
+ * - ZnListCollect
+ * - ZnListReject
*
* And the following variables:
*
@@ -82,10 +82,10 @@
static const char rcs_id[]="$Id$";
static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ " $";
-#define MAX_CHUNCK_SIZE 1024
+#define MAX_CHUNCK_SIZE 1024
-#define MAX(a, b) ((a) > (b) ? (a) : (b))
-#define MIN(a, b) ((a) < (b) ? (a) : (b))
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
/*
@@ -97,10 +97,10 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ "
*/
typedef struct {
- char *list;
- unsigned long elem_size;
- unsigned long alloc_size;
- unsigned long used_size;
+ char *list;
+ unsigned long elem_size;
+ unsigned long alloc_size;
+ unsigned long used_size;
} _ZnList;
@@ -108,15 +108,15 @@ typedef struct {
**********************************************************************************
*
* GrowIfNeeded --
- * Enlarge a list so that it has min_size available. Take care of
- * static storage.
+ * Enlarge a list so that it has min_size available. Take care of
+ * static storage.
*
**********************************************************************************
*/
static void
-GrowIfNeeded(_ZnList *list,
- unsigned int min_size)
+GrowIfNeeded(_ZnList *list,
+ unsigned int min_size)
{
if (list->used_size+min_size <= list->alloc_size) {
return;
@@ -130,28 +130,28 @@ GrowIfNeeded(_ZnList *list,
}
else {
/* Case of a list made by ZnListFromArray. If we try to make
- it grow we need to reallocate and copy. */
- char *new_list;
+ it grow we need to reallocate and copy. */
+ char *new_list;
list->alloc_size = list->used_size+min_size;
new_list = ZnMalloc(list->alloc_size*list->elem_size);
memcpy(new_list,
- list->list,
- list->used_size*list->elem_size);
+ list->list,
+ list->used_size*list->elem_size);
list->list = new_list;
}
}
else {
list->alloc_size = MAX(MIN(list->alloc_size*2, MAX_CHUNCK_SIZE),
- list->alloc_size+min_size);
+ list->alloc_size+min_size);
list->list = ZnRealloc(list->list,
- list->alloc_size*list->elem_size);
+ list->alloc_size*list->elem_size);
}
memset(list->list+(list->used_size*list->elem_size),
- 0,
- (list->alloc_size-list->used_size)*list->elem_size);
+ 0,
+ (list->alloc_size-list->used_size)*list->elem_size);
}
@@ -159,16 +159,16 @@ GrowIfNeeded(_ZnList *list,
**********************************************************************************
*
* ZnListNew --
- * Return a new empty list 'initial_size' large.
+ * Return a new empty list 'initial_size' large.
*
**********************************************************************************
*/
ZnList
-ZnListNew(unsigned int initial_size,
- unsigned int element_size)
+ZnListNew(unsigned int initial_size,
+ unsigned int element_size)
{
- _ZnList *new_list;
+ _ZnList *new_list;
if (element_size == 0) {
element_size = 1;
@@ -198,16 +198,16 @@ ZnListNew(unsigned int initial_size,
**********************************************************************************
*
* ZnListDuplicate --
- * Return a copy of the list given as parameter.
+ * Return a copy of the list given as parameter.
*
**********************************************************************************
*/
ZnList
-ZnListDuplicate(ZnList list)
+ZnListDuplicate(ZnList list)
{
- _ZnList *cur_list = (_ZnList *) list;
- _ZnList *new_list;
+ _ZnList *cur_list = (_ZnList *) list;
+ _ZnList *new_list;
new_list = ZnMalloc(sizeof(_ZnList));
@@ -240,15 +240,15 @@ ZnListDuplicate(ZnList list)
**********************************************************************************
*
* ZnListEmpty --
- * Clear out a list, kkeping its allocated size.
+ * Clear out a list, kkeping its allocated size.
*
**********************************************************************************
*/
void
-ZnListEmpty(ZnList list)
+ZnListEmpty(ZnList list)
{
- _ZnList *cur_list = (_ZnList *) list;
+ _ZnList *cur_list = (_ZnList *) list;
cur_list->used_size = 0;
}
@@ -258,17 +258,17 @@ ZnListEmpty(ZnList list)
**********************************************************************************
*
* ZnListFromArray --
- * Return a list filled from the given array.
+ * Return a list filled from the given array.
*
**********************************************************************************
*/
ZnList
-ZnListFromArray(void *array,
- unsigned int array_size,
- unsigned int element_size)
+ZnListFromArray(void *array,
+ unsigned int array_size,
+ unsigned int element_size)
{
- _ZnList *new_list;
+ _ZnList *new_list;
new_list = (_ZnList *) ZnListNew(0, element_size);
new_list->list = array;
@@ -281,15 +281,15 @@ ZnListFromArray(void *array,
**********************************************************************************
*
* ZnListArray --
- * Return a pointer to the array containing the list.
+ * Return a pointer to the array containing the list.
*
**********************************************************************************
*/
void *
-ZnListArray(ZnList list)
+ZnListArray(ZnList list)
{
- _ZnList *cur_list = (_ZnList *) list;
+ _ZnList *cur_list = (_ZnList *) list;
return (void *) cur_list->list;
}
@@ -299,17 +299,17 @@ ZnListArray(ZnList list)
**********************************************************************************
*
* ZnListFree --
- * Delete a list and free its memory. The entries
- * still in the list are lost but no further deallocation
- * is attempted.
+ * Delete a list and free its memory. The entries
+ * still in the list are lost but no further deallocation
+ * is attempted.
*
**********************************************************************************
*/
void
-ZnListFree(ZnList list)
+ZnListFree(ZnList list)
{
- _ZnList *cur_list = (_ZnList *) list;
+ _ZnList *cur_list = (_ZnList *) list;
if (cur_list->list != NULL && cur_list->alloc_size != 0) {
ZnFree(cur_list->list);
@@ -323,13 +323,13 @@ ZnListFree(ZnList list)
**********************************************************************************
*
* ZnListSize --
- * Return the current number of entries kept in list.
+ * Return the current number of entries kept in list.
*
**********************************************************************************
*/
unsigned int
-ZnListSize(ZnList list)
+ZnListSize(ZnList list)
{
return ((_ZnList *)list)->used_size;
}
@@ -339,16 +339,16 @@ ZnListSize(ZnList list)
**********************************************************************************
*
* ZnListAssertSize --
- * Set the list length to size.
+ * Set the list length to size.
*
**********************************************************************************
*/
void
-ZnListAssertSize(ZnList list,
- unsigned int size)
+ZnListAssertSize(ZnList list,
+ unsigned int size)
{
- _ZnList *cur_list = (_ZnList *) list;
+ _ZnList *cur_list = (_ZnList *) list;
if (cur_list->used_size < size) {
GrowIfNeeded(cur_list, size - cur_list->used_size);
@@ -361,19 +361,19 @@ ZnListAssertSize(ZnList list,
**********************************************************************************
*
* ZnListCopy --
- * Destructively copy 'from' into 'to' starting at the first
- * position. It is the same as saying ZnListEmpty and then
- * ZnListAppend.
+ * Destructively copy 'from' into 'to' starting at the first
+ * position. It is the same as saying ZnListEmpty and then
+ * ZnListAppend.
*
**********************************************************************************
*/
void
-ZnListCopy(ZnList to,
- ZnList from)
+ZnListCopy(ZnList to,
+ ZnList from)
{
- _ZnList *to_list = (_ZnList *) to;
- _ZnList *from_list = (_ZnList *) from;
+ _ZnList *to_list = (_ZnList *) to;
+ _ZnList *from_list = (_ZnList *) from;
if (from_list->elem_size != to_list->elem_size) {
return;
@@ -382,8 +382,8 @@ ZnListCopy(ZnList to,
to_list->used_size = 0;
GrowIfNeeded(to_list, from_list->used_size);
memcpy(to_list->list,
- from_list->list,
- from_list->used_size*from_list->elem_size);
+ from_list->list,
+ from_list->used_size*from_list->elem_size);
to_list->used_size = from_list->used_size;
}
@@ -392,17 +392,17 @@ ZnListCopy(ZnList to,
**********************************************************************************
*
* ZnListAppend --
- * Append 'from' at the end of 'to' which is enlarged as needed.
+ * Append 'from' at the end of 'to' which is enlarged as needed.
*
**********************************************************************************
*/
void
-ZnListAppend(ZnList to,
- ZnList from)
+ZnListAppend(ZnList to,
+ ZnList from)
{
- _ZnList *to_list = (_ZnList *) to;
- _ZnList *from_list = (_ZnList *) from;
+ _ZnList *to_list = (_ZnList *) to;
+ _ZnList *from_list = (_ZnList *) from;
if (from_list->elem_size != to_list->elem_size) {
return;
@@ -410,8 +410,8 @@ ZnListAppend(ZnList to,
GrowIfNeeded(to_list, from_list->used_size);
memcpy(to_list->list+(to_list->used_size*to_list->elem_size),
- from_list->list,
- from_list->used_size*from_list->elem_size);
+ from_list->list,
+ from_list->used_size*from_list->elem_size);
to_list->used_size += from_list->used_size;
}
@@ -420,30 +420,30 @@ ZnListAppend(ZnList to,
**********************************************************************************
*
* ZnListAdd --
- * Add a new entry 'value' in the list before
- * 'index'. 'index' can be the position of a
- * previous entry or the special values ZnListHead,
- * ZnListTail. The entries have positions
- * starting at 0.
+ * Add a new entry 'value' in the list before
+ * 'index'. 'index' can be the position of a
+ * previous entry or the special values ZnListHead,
+ * ZnListTail. The entries have positions
+ * starting at 0.
*
**********************************************************************************
*/
void
-ZnListAdd(ZnList list,
- void *value,
- unsigned int index)
+ZnListAdd(ZnList list,
+ void *value,
+ unsigned int index)
{
_ZnList *cur_list = (_ZnList *) list;
- int i;
+ int i;
GrowIfNeeded(cur_list, 1);
if (index < cur_list->used_size) {
for (i = cur_list->used_size-1; i >= (int) index; i--) {
memcpy(cur_list->list+((i+1)*cur_list->elem_size),
- cur_list->list+(i*cur_list->elem_size),
- cur_list->elem_size);
+ cur_list->list+(i*cur_list->elem_size),
+ cur_list->elem_size);
}
}
else if (index > cur_list->used_size) {
@@ -451,8 +451,8 @@ ZnListAdd(ZnList list,
}
memcpy(cur_list->list+(index*cur_list->elem_size),
- (char *) value,
- cur_list->elem_size);
+ (char *) value,
+ cur_list->elem_size);
(cur_list->used_size)++;
}
@@ -462,16 +462,16 @@ ZnListAdd(ZnList list,
**********************************************************************************
*
* ZnListAt --
- * Return the entry at 'index'. Indices start at 0.
- * Indices out of the current range are constrained
- * to fit in the range.
+ * Return the entry at 'index'. Indices start at 0.
+ * Indices out of the current range are constrained
+ * to fit in the range.
*
**********************************************************************************
*/
void *
-ZnListAt(ZnList list,
- unsigned int index)
+ZnListAt(ZnList list,
+ unsigned int index)
{
if (!((_ZnList *) list)->used_size) {
return NULL;
@@ -488,17 +488,17 @@ ZnListAt(ZnList list,
**********************************************************************************
*
* ZnListAtPut --
- * Set the entry at 'index' to 'value'.
- * Indices start at 0. Indices out of the current
- * range are constrained to fit in the range.
+ * Set the entry at 'index' to 'value'.
+ * Indices start at 0. Indices out of the current
+ * range are constrained to fit in the range.
*
**********************************************************************************
*/
void
-ZnListAtPut(ZnList list,
- void *value,
- unsigned int index)
+ZnListAtPut(ZnList list,
+ void *value,
+ unsigned int index)
{
if (!((_ZnList *) list)->used_size) {
return;
@@ -508,8 +508,8 @@ ZnListAtPut(ZnList list,
}
memcpy(((_ZnList *) list)->list+(index*((_ZnList *) list)->elem_size),
- (char *) value,
- ((_ZnList *) list)->elem_size);
+ (char *) value,
+ ((_ZnList *) list)->elem_size);
}
@@ -517,18 +517,18 @@ ZnListAtPut(ZnList list,
**********************************************************************************
*
* ZnListDelete --
- * Suppress the entry matching value, searching from position
- * 'index'. If value is NULL suppress entry at index.
+ * Suppress the entry matching value, searching from position
+ * 'index'. If value is NULL suppress entry at index.
*
**********************************************************************************
*/
void
-ZnListDelete(ZnList list,
- unsigned int index)
+ZnListDelete(ZnList list,
+ unsigned int index)
{
- _ZnList *cur_list = (_ZnList *) list;
- unsigned int i;
+ _ZnList *cur_list = (_ZnList *) list;
+ unsigned int i;
if (!((_ZnList *) list)->used_size) {
return;
@@ -539,8 +539,8 @@ ZnListDelete(ZnList list,
for (i = index; i < cur_list->used_size-1; i++) {
memcpy(cur_list->list+(i*cur_list->elem_size),
- cur_list->list+((i+1)*cur_list->elem_size),
- cur_list->elem_size);
+ cur_list->list+((i+1)*cur_list->elem_size),
+ cur_list->elem_size);
}
(cur_list->used_size)--;
}
@@ -549,16 +549,16 @@ ZnListDelete(ZnList list,
**********************************************************************************
*
* ZnListTruncate --
- * Suppress the entries from position 'index' inclusive to the end.
+ * Suppress the entries from position 'index' inclusive to the end.
*
**********************************************************************************
*/
void
-ZnListTruncate(ZnList list,
- unsigned int index)
+ZnListTruncate(ZnList list,
+ unsigned int index)
{
- _ZnList *cur_list = (_ZnList *) list;
+ _ZnList *cur_list = (_ZnList *) list;
if (index >= ((_ZnList *) list)->used_size) {
return;
diff --git a/generic/List.h b/generic/List.h
index 49aed9b..53970f7 100644
--- a/generic/List.h
+++ b/generic/List.h
@@ -1,8 +1,8 @@
/*
* List.h -- Header of list module.
*
- * Authors : Patrick Lecoanet.
- * Creation date : Tue Mar 15 17:24:51 1994
+ * Authors : Patrick Lecoanet.
+ * Creation date : Tue Mar 15 17:24:51 1994
*
* $Id$
*/
@@ -36,41 +36,41 @@ extern "C" {
#endif
-#define ZnListHead 0
-#define ZnListTail (~(1 << ((8*sizeof(int)) - 1)))
+#define ZnListHead 0
+#define ZnListTail (~(1 << ((8*sizeof(int)) - 1)))
-typedef void *ZnList;
+typedef void *ZnList;
-ZnList ZnListNew(unsigned int /* initial_size */,
- unsigned int /* element_size */);
-ZnList ZnListDuplicate(ZnList /* list */);
-void ZnListEmpty(ZnList /* list */);
-ZnList ZnListFromArray(void * /* array */,
- unsigned int /* array_size */,
- unsigned int /* element_size */);
-void *ZnListArray(ZnList /* list */);
-void ZnListFree(ZnList /* list */);
-unsigned int ZnListSize(ZnList /* list */);
-void ZnListAssertSize(ZnList /* list */,
- unsigned int /* size */);
-void ZnListCopy(ZnList /* to */,
- ZnList /* from */);
-void ZnListAppend(ZnList /* to */,
- ZnList /* from */);
-void ZnListAdd(ZnList /* list */,
- void * /* value */,
- unsigned int /* index */);
-void *ZnListAt(ZnList /* list */,
- unsigned int /* index */);
-void ZnListAtPut(ZnList /* list */,
- void * /* value */,
- unsigned int /* index */);
-void ZnListDelete(ZnList /* list */,
- unsigned int /* index */);
-void ZnListTruncate(ZnList /* list */,
- unsigned int /* index */);
+ZnList ZnListNew(unsigned int /* initial_size */,
+ unsigned int /* element_size */);
+ZnList ZnListDuplicate(ZnList /* list */);
+void ZnListEmpty(ZnList /* list */);
+ZnList ZnListFromArray(void * /* array */,
+ unsigned int /* array_size */,
+ unsigned int /* element_size */);
+void *ZnListArray(ZnList /* list */);
+void ZnListFree(ZnList /* list */);
+unsigned int ZnListSize(ZnList /* list */);
+void ZnListAssertSize(ZnList /* list */,
+ unsigned int /* size */);
+void ZnListCopy(ZnList /* to */,
+ ZnList /* from */);
+void ZnListAppend(ZnList /* to */,
+ ZnList /* from */);
+void ZnListAdd(ZnList /* list */,
+ void * /* value */,
+ unsigned int /* index */);
+void *ZnListAt(ZnList /* list */,
+ unsigned int /* index */);
+void ZnListAtPut(ZnList /* list */,
+ void * /* value */,
+ unsigned int /* index */);
+void ZnListDelete(ZnList /* list */,
+ unsigned int /* index */);
+void ZnListTruncate(ZnList /* list */,
+ unsigned int /* index */);
#ifdef __CPLUSPLUS__
}
diff --git a/generic/Map.c b/generic/Map.c
index 7b1f8f5..a307f61 100644
--- a/generic/Map.c
+++ b/generic/Map.c
@@ -1,8 +1,8 @@
/*
* Map.c -- Implementation of Map item.
*
- * Authors : Patrick Lecoanet.
- * Creation date :
+ * Authors : Patrick Lecoanet.
+ * Creation date :
*
* $Id$
*/
@@ -53,36 +53,36 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ "
*/
typedef struct _MapItemStruct {
- ZnItemStruct header;
+ ZnItemStruct header;
/* Public data */
- ZnBool filled;
- ZnImage fill_pattern;
- ZnGradient *color;
- Tk_Font text_font; /* null value -> use zn_map_text_font */
- char *map_info_name;
- ZnList symbol_patterns;
+ ZnBool filled;
+ ZnImage fill_pattern;
+ ZnGradient *color;
+ Tk_Font text_font; /* null value -> use zn_map_text_font */
+ char *map_info_name;
+ ZnList symbol_patterns;
/* Private data */
- ZnMapInfoId map_info;
- ZnList vectors;
- ZnList dashed_vectors;
- ZnList dotted_vectors;
- ZnList mixed_vectors;
- ZnList arcs;
- ZnList dashed_arcs;
- ZnList dotted_arcs;
- ZnList mixed_arcs;
- ZnList marks;
- ZnList symbols;
- ZnList texts;
+ ZnMapInfoId map_info;
+ ZnList vectors;
+ ZnList dashed_vectors;
+ ZnList dotted_vectors;
+ ZnList mixed_vectors;
+ ZnList arcs;
+ ZnList dashed_arcs;
+ ZnList dotted_arcs;
+ ZnList mixed_arcs;
+ ZnList marks;
+ ZnList symbols;
+ ZnList texts;
#ifdef GL
- ZnTexFontInfo *tfi;
+ ZnTexFontInfo *tfi;
#endif
} MapItemStruct, *MapItem;
-static ZnAttrConfig map_attrs[] = {
+static ZnAttrConfig map_attrs[] = {
{ ZN_CONFIG_GRADIENT, "-color", NULL,
Tk_Offset(MapItemStruct, color), 0, ZN_DRAW_FLAG, False },
{ ZN_CONFIG_BOOL, "-composealpha", NULL,
@@ -122,10 +122,10 @@ static ZnAttrConfig map_attrs[] = {
void
-UpdateMapInfo(ClientData client_data,
- ZnMapInfoId map_info)
+UpdateMapInfo(ClientData client_data,
+ ZnMapInfoId map_info)
{
- ZnItem item = (ZnItem) client_data;
+ ZnItem item = (ZnItem) client_data;
/*printf("updating a map 'cause of a change in mapinfo\n");*/
ZnITEM.Invalidate(item, ZN_COORDS_FLAG);
@@ -133,7 +133,7 @@ UpdateMapInfo(ClientData client_data,
static void
-FreeLists(MapItem map)
+FreeLists(MapItem map)
{
if (map->vectors) {
ZnListFree(map->vectors);
@@ -194,12 +194,12 @@ FreeLists(MapItem map)
**********************************************************************************
*/
static int
-Init(ZnItem item,
- int *argc,
- Tcl_Obj *CONST *args[])
+Init(ZnItem item,
+ int *argc,
+ Tcl_Obj *CONST *args[])
{
- MapItem map = (MapItem) item;
- ZnWInfo *wi = item->wi;
+ MapItem map = (MapItem) item;
+ ZnWInfo *wi = item->wi;
SET(item->flags, ZN_VISIBLE_BIT);
CLEAR(item->flags, ZN_SENSITIVE_BIT);
@@ -213,7 +213,7 @@ Init(ZnItem item,
map->symbol_patterns = NULL;
map->color = ZnGetGradientByValue(wi->fore_color);
map->text_font = Tk_GetFont(wi->interp, wi->win,
- Tk_NameOfFont(wi->map_text_font));
+ Tk_NameOfFont(wi->map_text_font));
#ifdef GL
map->tfi = NULL;
#endif
@@ -246,10 +246,10 @@ Init(ZnItem item,
*/
static void
-Clone(ZnItem item)
+Clone(ZnItem item)
{
- MapItem map = (MapItem) item;
- ZnWInfo *wi = item->wi;
+ MapItem map = (MapItem) item;
+ ZnWInfo *wi = item->wi;
if (map->vectors) {
map->vectors = ZnListDuplicate(map->vectors);
@@ -295,7 +295,7 @@ Clone(ZnItem item)
strcpy(text, map->map_info_name);
map->map_info_name = text;
map->map_info = ZnGetMapInfo(wi->interp, map->map_info_name,
- UpdateMapInfo, (ClientData) map);
+ UpdateMapInfo, (ClientData) map);
}
map->color = ZnGetGradientByValue(map->color);
@@ -325,14 +325,14 @@ Clone(ZnItem item)
**********************************************************************************
*
* Destroy --
- * Free the Map storage.
+ * Free the Map storage.
*
**********************************************************************************
*/
static void
-Destroy(ZnItem item)
+Destroy(ZnItem item)
{
- MapItem map = (MapItem) item;
+ MapItem map = (MapItem) item;
FreeLists(map);
ZnFreeGradient(map->color);
@@ -348,13 +348,13 @@ Destroy(ZnItem item)
}
if (map->symbol_patterns) {
ZnImage *pats;
- int i, num_pats;
+ int i, num_pats;
pats = ZnListArray(map->symbol_patterns);
num_pats = ZnListSize(map->symbol_patterns);
for (i = 0; i < num_pats; i++) {
if (pats[i] != ZnUnspecifiedImage) {
- ZnFreeImage(pats[i], NULL, NULL);
+ ZnFreeImage(pats[i], NULL, NULL);
}
}
ZnListFree(map->symbol_patterns);
@@ -376,15 +376,15 @@ Destroy(ZnItem item)
**********************************************************************************
*/
static int
-Configure(ZnItem item,
- int argc,
- Tcl_Obj *CONST argv[],
- int *flags)
+Configure(ZnItem item,
+ int argc,
+ Tcl_Obj *CONST argv[],
+ int *flags)
{
- ZnWInfo *wi = item->wi;
- MapItem map = (MapItem) item;
+ ZnWInfo *wi = item->wi;
+ MapItem map = (MapItem) item;
#ifdef GL
- Tk_Font old_font = map->text_font;
+ Tk_Font old_font = map->text_font;
#endif
if (ZnConfigureAttributes(wi, item, item, map_attrs, argc, argv, flags) == TCL_ERROR) {
@@ -400,14 +400,14 @@ Configure(ZnItem item,
}
#endif
if (ISSET(*flags, ZN_MAP_INFO_FLAG)) {
- ZnMapInfoId map_info;
- ZnBool error = False;
+ ZnMapInfoId map_info;
+ ZnBool error = False;
if (map->map_info_name) {
map_info = ZnGetMapInfo(wi->interp, map->map_info_name,
- UpdateMapInfo, (ClientData) map);
+ UpdateMapInfo, (ClientData) map);
if (!map_info) {
- error = True;
+ error = True;
}
}
else {
@@ -415,7 +415,7 @@ Configure(ZnItem item,
}
if (!error) {
if (map->map_info != NULL) {
- ZnFreeMapInfo(map->map_info, UpdateMapInfo, (ClientData) map);
+ ZnFreeMapInfo(map->map_info, UpdateMapInfo, (ClientData) map);
}
map->map_info = map_info;
}
@@ -436,9 +436,9 @@ Configure(ZnItem item,
**********************************************************************************
*/
static int
-Query(ZnItem item,
- int argc,
- Tcl_Obj *CONST argv[])
+Query(ZnItem item,
+ int argc,
+ Tcl_Obj *CONST argv[])
{
if (ZnQueryAttribute(item->wi->interp, item, map_attrs, argv[0]) == TCL_ERROR) {
return TCL_ERROR;
@@ -457,42 +457,42 @@ Query(ZnItem item,
*/
static void
-ComputeCoordinates(ZnItem item,
- ZnBool force)
+ComputeCoordinates(ZnItem item,
+ ZnBool force)
{
- ZnWInfo *wi = item->wi;
- MapItem map = (MapItem) item;
- ZnMapInfoId map_info;
- ZnMapInfoLineStyle line_style;
- ZnMapInfoTextStyle text_style;
- char symbol;
- char *text;
- unsigned int i, j, cnt;
- unsigned int num_points;
- unsigned int num_dashed_points;
- unsigned int num_dotted_points;
- unsigned int num_mixed_points;
- unsigned int num_arcs;
- unsigned int num_dashed_arcs;
- unsigned int num_dotted_arcs;
- unsigned int num_mixed_arcs;
- unsigned int num_marks;
- ZnPoint *vectors, *dashed_vectors, *dotted_vectors;
- ZnPoint *mixed_vectors, *marks;
- XArc *arcs, *dashed_arcs, *dotted_arcs, *mixed_arcs;
- ZnPoint *symbols, *texts;
- ZnPoint from, to, center;
- ZnPoint tmp_from, tmp_to;
- XArc arc;
- ZnBBox bbox, bbox_inter, zn_bbox;
- ZnPos x_from_w, y_from_w, x_to_w, y_to_w;
- ZnPos start_angle, extend;
- ZnDim radius_w, line_width;
- int radius;
- ZnPoint *new_marks;
- unsigned int n_new_marks;
- Tk_Font text_font;
- int sym_w2=0, sym_h2=0;
+ ZnWInfo *wi = item->wi;
+ MapItem map = (MapItem) item;
+ ZnMapInfoId map_info;
+ ZnMapInfoLineStyle line_style;
+ ZnMapInfoTextStyle text_style;
+ char symbol;
+ char *text;
+ unsigned int i, j, cnt;
+ unsigned int num_points;
+ unsigned int num_dashed_points;
+ unsigned int num_dotted_points;
+ unsigned int num_mixed_points;
+ unsigned int num_arcs;
+ unsigned int num_dashed_arcs;
+ unsigned int num_dotted_arcs;
+ unsigned int num_mixed_arcs;
+ unsigned int num_marks;
+ ZnPoint *vectors, *dashed_vectors, *dotted_vectors;
+ ZnPoint *mixed_vectors, *marks;
+ XArc *arcs, *dashed_arcs, *dotted_arcs, *mixed_arcs;
+ ZnPoint *symbols, *texts;
+ ZnPoint from, to, center;
+ ZnPoint tmp_from, tmp_to;
+ XArc arc;
+ ZnBBox bbox, bbox_inter, zn_bbox;
+ ZnPos x_from_w, y_from_w, x_to_w, y_to_w;
+ ZnPos start_angle, extend;
+ ZnDim radius_w, line_width;
+ int radius;
+ ZnPoint *new_marks;
+ unsigned int n_new_marks;
+ Tk_Font text_font;
+ int sym_w2=0, sym_h2=0;
ZnResetBBox(&item->item_bounding_box);
@@ -506,15 +506,15 @@ ComputeCoordinates(ZnItem item,
map_info = map->map_info;
- num_points = 0;
- num_dashed_points = 0;
- num_dotted_points = 0;
- num_mixed_points = 0;
- num_marks = 0;
- num_arcs = 0;
- num_dashed_arcs = 0;
- num_dotted_arcs = 0;
- num_mixed_arcs = 0;
+ num_points = 0;
+ num_dashed_points = 0;
+ num_dotted_points = 0;
+ num_mixed_points = 0;
+ num_marks = 0;
+ num_arcs = 0;
+ num_dashed_arcs = 0;
+ num_dotted_arcs = 0;
+ num_mixed_arcs = 0;
/*
* Experimental code to help trap out of bounds
@@ -559,17 +559,17 @@ ComputeCoordinates(ZnItem item,
switch (line_style) {
case ZnMapInfoLineSimple:
case ZnMapInfoLineMarked:
- num_points += 2;
- break;
+ num_points += 2;
+ break;
case ZnMapInfoLineDotted:
- num_dotted_points += 2;
- break;
+ num_dotted_points += 2;
+ break;
case ZnMapInfoLineMixed:
- num_mixed_points += 2;
- break;
+ num_mixed_points += 2;
+ break;
case ZnMapInfoLineDashed:
- num_dashed_points += 2;
- break;
+ num_dashed_points += 2;
+ break;
}
}
}
@@ -648,17 +648,17 @@ ComputeCoordinates(ZnItem item,
/*
* Ask the pointers to the actual arrays.
*/
- vectors = (ZnPoint *) ZnListArray(map->vectors);
+ vectors = (ZnPoint *) ZnListArray(map->vectors);
dashed_vectors = (ZnPoint *) ZnListArray(map->dashed_vectors);
dotted_vectors = (ZnPoint *) ZnListArray(map->dotted_vectors);
- mixed_vectors = (ZnPoint *) ZnListArray(map->mixed_vectors);
- arcs = (XArc *) ZnListArray(map->arcs);
- dashed_arcs = (XArc *) ZnListArray(map->dashed_arcs);
- dotted_arcs = (XArc *) ZnListArray(map->dotted_arcs);
- mixed_arcs = (XArc *) ZnListArray(map->mixed_arcs);
- marks = (ZnPoint *) ZnListArray(map->marks);
- symbols = (ZnPoint *) ZnListArray(map->symbols);
- texts = (ZnPoint *) ZnListArray(map->texts);
+ mixed_vectors = (ZnPoint *) ZnListArray(map->mixed_vectors);
+ arcs = (XArc *) ZnListArray(map->arcs);
+ dashed_arcs = (XArc *) ZnListArray(map->dashed_arcs);
+ dotted_arcs = (XArc *) ZnListArray(map->dotted_arcs);
+ mixed_arcs = (XArc *) ZnListArray(map->mixed_arcs);
+ marks = (ZnPoint *) ZnListArray(map->marks);
+ symbols = (ZnPoint *) ZnListArray(map->symbols);
+ texts = (ZnPoint *) ZnListArray(map->texts);
if (num_marks && (wi->map_distance_symbol != ZnUnspecifiedImage)) {
ZnSizeOfImage(wi->map_distance_symbol, &sym_w2, &sym_h2);
@@ -666,26 +666,26 @@ ComputeCoordinates(ZnItem item,
sym_h2 = (sym_h2+1)/2;
}
/*printf("Map: %d %d %d %d %d, texts: %d, symbols: %d\n", num_points, num_dashed_points, num_dotted_points,
- num_mixed_points, num_marks, ZnMapInfoNumTexts(map_info), ZnMapInfoNumSymbols(map_info));*/
+ num_mixed_points, num_marks, ZnMapInfoNumTexts(map_info), ZnMapInfoNumSymbols(map_info));*/
/*
* Reset the counts of points to compute the actual
* counts taking into account the clipping and the
* filled attribute.
*/
- num_points = 0;
- num_dashed_points = 0;
- num_dotted_points = 0;
- num_mixed_points = 0;
- num_marks = 0;
- num_arcs = 0;
- num_dashed_arcs = 0;
- num_dotted_arcs = 0;
- num_mixed_arcs = 0;
+ num_points = 0;
+ num_dashed_points = 0;
+ num_dotted_points = 0;
+ num_mixed_points = 0;
+ num_marks = 0;
+ num_arcs = 0;
+ num_dashed_arcs = 0;
+ num_dotted_arcs = 0;
+ num_mixed_arcs = 0;
cnt = ZnMapInfoNumLines(map_info);
for (i = 0; i < cnt; i++) {
ZnMapInfoGetLine(map_info, i, NULL, &line_style, &line_width,
- &x_from_w, &y_from_w, &x_to_w, &y_to_w);
+ &x_from_w, &y_from_w, &x_to_w, &y_to_w);
tmp_from.x = x_from_w;
tmp_from.y = y_from_w;
@@ -703,7 +703,7 @@ ComputeCoordinates(ZnItem item,
if (!map->filled) {
if (ZnLineInBBox(&from, &to, &zn_bbox) < 0) {
- continue;
+ continue;
}
}
@@ -716,52 +716,52 @@ ComputeCoordinates(ZnItem item,
break;
case ZnMapInfoLineDashed:
if (!map->filled) {
- dashed_vectors[num_dashed_points] = from;
- num_dashed_points++;
- dashed_vectors[num_dashed_points] = to;
- num_dashed_points++;
+ dashed_vectors[num_dashed_points] = from;
+ num_dashed_points++;
+ dashed_vectors[num_dashed_points] = to;
+ num_dashed_points++;
}
break;
case ZnMapInfoLineDotted:
if (!map->filled) {
- dotted_vectors[num_dotted_points] = from;
- num_dotted_points++;
- dotted_vectors[num_dotted_points] = to;
- num_dotted_points++;
+ dotted_vectors[num_dotted_points] = from;
+ num_dotted_points++;
+ dotted_vectors[num_dotted_points] = to;
+ num_dotted_points++;
}
break;
case ZnMapInfoLineMixed:
if (!map->filled) {
- mixed_vectors[num_mixed_points] = from;
- num_mixed_points++;
- mixed_vectors[num_mixed_points] = to;
- num_mixed_points++;
+ mixed_vectors[num_mixed_points] = from;
+ num_mixed_points++;
+ mixed_vectors[num_mixed_points] = to;
+ num_mixed_points++;
}
break;
case ZnMapInfoLineMarked:
if (!map->filled) {
- vectors[num_points] = from;
- num_points++;
- vectors[num_points] = to;
- num_points++;
- if (wi->map_distance_symbol != ZnUnspecifiedImage) {
- ZnMapInfoGetMarks(map_info, i, &new_marks, &n_new_marks);
- for (j = 0; j < n_new_marks; j++) {
- /*
- * The transform can be put outside the loop when
- * MapInfo point type is modified to ZnPoint.
- * Will use then ZnTransformPoints.
- */
- tmp_from.x = new_marks[j].x;
- tmp_from.y = new_marks[j].y;
- ZnTransformPoint(wi->current_transfo, &tmp_from, &marks[num_marks]);
- ZnAddPointToBBox(&item->item_bounding_box,
- marks[num_marks].x-sym_w2, marks[num_marks].y-sym_h2);
- ZnAddPointToBBox(&item->item_bounding_box,
- marks[num_marks].x+sym_w2, marks[num_marks].x+sym_h2);
- num_marks++;
- }
- }
+ vectors[num_points] = from;
+ num_points++;
+ vectors[num_points] = to;
+ num_points++;
+ if (wi->map_distance_symbol != ZnUnspecifiedImage) {
+ ZnMapInfoGetMarks(map_info, i, &new_marks, &n_new_marks);
+ for (j = 0; j < n_new_marks; j++) {
+ /*
+ * The transform can be put outside the loop when
+ * MapInfo point type is modified to ZnPoint.
+ * Will use then ZnTransformPoints.
+ */
+ tmp_from.x = new_marks[j].x;
+ tmp_from.y = new_marks[j].y;
+ ZnTransformPoint(wi->current_transfo, &tmp_from, &marks[num_marks]);
+ ZnAddPointToBBox(&item->item_bounding_box,
+ marks[num_marks].x-sym_w2, marks[num_marks].y-sym_h2);
+ ZnAddPointToBBox(&item->item_bounding_box,
+ marks[num_marks].x+sym_w2, marks[num_marks].x+sym_h2);
+ num_marks++;
+ }
+ }
}
break;
}
@@ -772,7 +772,7 @@ ComputeCoordinates(ZnItem item,
ZnPoint xp;
ZnMapInfoGetArc(map_info, i, NULL, &line_style, &line_width,
- &x_from_w, &y_from_w, &radius_w, &start_angle, &extend);
+ &x_from_w, &y_from_w, &radius_w, &start_angle, &extend);
tmp_from.x = x_from_w;
tmp_from.y = y_from_w;
@@ -799,12 +799,12 @@ ComputeCoordinates(ZnItem item,
continue;
}
- arc.x = (int) (center.x - radius);
- arc.y = (int) (center.y - radius);
- arc.width = 2 * radius;
- arc.height = arc.width;
- arc.angle1 = ((unsigned short) start_angle) * 64;
- arc.angle2 = ((unsigned short) extend) * 64;
+ arc.x = (int) (center.x - radius);
+ arc.y = (int) (center.y - radius);
+ arc.width = 2 * radius;
+ arc.height = arc.width;
+ arc.angle1 = ((unsigned short) start_angle) * 64;
+ arc.angle2 = ((unsigned short) extend) * 64;
switch (line_style) {
case ZnMapInfoLineSimple:
@@ -820,38 +820,38 @@ ComputeCoordinates(ZnItem item,
break;
case ZnMapInfoLineDashed:
if (!map->filled) {
- dashed_arcs[num_dashed_arcs] = arc;
- num_dashed_arcs++;
-
- bbox.orig.x = arc.x;
- bbox.orig.y = arc.y;
- bbox.corner.x = bbox.orig.x + arc.width + 1;
- bbox.corner.y = bbox.orig.y + arc.height + 1;
- ZnAddBBoxToBBox(&item->item_bounding_box, &bbox);
+ dashed_arcs[num_dashed_arcs] = arc;
+ num_dashed_arcs++;
+
+ bbox.orig.x = arc.x;
+ bbox.orig.y = arc.y;
+ bbox.corner.x = bbox.orig.x + arc.width + 1;
+ bbox.corner.y = bbox.orig.y + arc.height + 1;
+ ZnAddBBoxToBBox(&item->item_bounding_box, &bbox);
}
break;
case ZnMapInfoLineDotted:
if (!map->filled) {
- dotted_arcs[num_dotted_arcs] = arc;
- num_dotted_arcs++;
-
- bbox.orig.x = arc.x;
- bbox.orig.y = arc.y;
- bbox.corner.x = bbox.orig.x + arc.width + 1;
- bbox.corner.y = bbox.orig.y + arc.height + 1;
- ZnAddBBoxToBBox(&item->item_bounding_box, &bbox);
+ dotted_arcs[num_dotted_arcs] = arc;
+ num_dotted_arcs++;
+
+ bbox.orig.x = arc.x;
+ bbox.orig.y = arc.y;
+ bbox.corner.x = bbox.orig.x + arc.width + 1;
+ bbox.corner.y = bbox.orig.y + arc.height + 1;
+ ZnAddBBoxToBBox(&item->item_bounding_box, &bbox);
}
break;
case ZnMapInfoLineMixed:
if (!map->filled) {
- mixed_arcs[num_mixed_arcs] = arc;
- num_mixed_arcs++;
-
- bbox.orig.x = arc.x;
- bbox.orig.y = arc.y;
- bbox.corner.x = bbox.orig.x + arc.width + 1;
- bbox.corner.y = bbox.orig.y + arc.height + 1;
- ZnAddBBoxToBBox(&item->item_bounding_box, &bbox);
+ mixed_arcs[num_mixed_arcs] = arc;
+ num_mixed_arcs++;
+
+ bbox.orig.x = arc.x;
+ bbox.orig.y = arc.y;
+ bbox.corner.x = bbox.orig.x + arc.width + 1;
+ bbox.corner.y = bbox.orig.y + arc.height + 1;
+ ZnAddBBoxToBBox(&item->item_bounding_box, &bbox);
}
break;
}
@@ -873,20 +873,20 @@ ComputeCoordinates(ZnItem item,
cnt = ZnMapInfoNumSymbols(map_info);
for (i = 0; i < cnt; i++) {
- ZnMapInfoGetSymbol(map_info, i, NULL, &x_from_w, &y_from_w, &symbol);
- tmp_from.x = x_from_w;
- tmp_from.y = y_from_w;
- ZnTransformPoint(wi->current_transfo, &tmp_from, &symbols[i]);
- sym = syms[symbol%num_syms];
- if (sym != ZnUnspecifiedImage) {
- ZnSizeOfImage(sym, &sym_w2, &sym_h2);
- sym_w2 = (sym_w2+1)/2;
- sym_h2 = (sym_h2+1)/2;
- ZnAddPointToBBox(&item->item_bounding_box,
- symbols[i].x-sym_w2, symbols[i].y-sym_h2);
- ZnAddPointToBBox(&item->item_bounding_box,
- symbols[i].x+sym_w2, symbols[i].y+sym_h2);
- }
+ ZnMapInfoGetSymbol(map_info, i, NULL, &x_from_w, &y_from_w, &symbol);
+ tmp_from.x = x_from_w;
+ tmp_from.y = y_from_w;
+ ZnTransformPoint(wi->current_transfo, &tmp_from, &symbols[i]);
+ sym = syms[symbol%num_syms];
+ if (sym != ZnUnspecifiedImage) {
+ ZnSizeOfImage(sym, &sym_w2, &sym_h2);
+ sym_w2 = (sym_w2+1)/2;
+ sym_h2 = (sym_h2+1)/2;
+ ZnAddPointToBBox(&item->item_bounding_box,
+ symbols[i].x-sym_w2, symbols[i].y-sym_h2);
+ ZnAddPointToBBox(&item->item_bounding_box,
+ symbols[i].x+sym_w2, symbols[i].y+sym_h2);
+ }
}
ZnListAssertSize(map->symbols, cnt);
}
@@ -895,48 +895,48 @@ ComputeCoordinates(ZnItem item,
text_font = map->text_font ? map->text_font : wi->map_text_font;
for (i = 0; i < cnt; i++) {
ZnMapInfoGetText(map_info, i, NULL,
- &text_style, &line_style, &x_from_w, &y_from_w, &text);
+ &text_style, &line_style, &x_from_w, &y_from_w, &text);
tmp_from.x = x_from_w;
tmp_from.y = y_from_w;
ZnTransformPoint(wi->current_transfo, &tmp_from, &texts[i]);
ZnAddStringToBBox(&item->item_bounding_box, text, text_font,
- texts[i].x, texts[i].y);
+ texts[i].x, texts[i].y);
if (text_style == ZnMapInfoUnderlinedText) {
- ZnGetStringBBox(text, text_font, texts[i].x, texts[i].y, &bbox);
-
- from.x = bbox.orig.x;
- from.y = bbox.corner.y;
- to.x = bbox.corner.x;
- to.y = bbox.corner.y;
-
- switch (line_style) {
- case ZnMapInfoLineSimple:
- case ZnMapInfoLineMarked:
- vectors[num_points] = from;
- num_points++;
- vectors[num_points] = to;
- num_points++;
- break;
- case ZnMapInfoLineDashed:
- dashed_vectors[num_dashed_points] = from;
- num_dashed_points++;
- dashed_vectors[num_dashed_points] = to;
- num_dashed_points++;
- break;
- case ZnMapInfoLineDotted:
- dotted_vectors[num_dotted_points] = from;
- num_dotted_points++;
- dotted_vectors[num_dotted_points] = to;
- num_dotted_points++;
- break;
- case ZnMapInfoLineMixed:
- mixed_vectors[num_mixed_points] = from;
- num_mixed_points++;
- mixed_vectors[num_mixed_points] = to;
- num_mixed_points++;
- break;
- }
+ ZnGetStringBBox(text, text_font, texts[i].x, texts[i].y, &bbox);
+
+ from.x = bbox.orig.x;
+ from.y = bbox.corner.y;
+ to.x = bbox.corner.x;
+ to.y = bbox.corner.y;
+
+ switch (line_style) {
+ case ZnMapInfoLineSimple:
+ case ZnMapInfoLineMarked:
+ vectors[num_points] = from;
+ num_points++;
+ vectors[num_points] = to;
+ num_points++;
+ break;
+ case ZnMapInfoLineDashed:
+ dashed_vectors[num_dashed_points] = from;
+ num_dashed_points++;
+ dashed_vectors[num_dashed_points] = to;
+ num_dashed_points++;
+ break;
+ case ZnMapInfoLineDotted:
+ dotted_vectors[num_dotted_points] = from;
+ num_dotted_points++;
+ dotted_vectors[num_dotted_points] = to;
+ num_dotted_points++;
+ break;
+ case ZnMapInfoLineMixed:
+ mixed_vectors[num_mixed_points] = from;
+ num_mixed_points++;
+ mixed_vectors[num_mixed_points] = to;
+ num_mixed_points++;
+ break;
+ }
}
}
ZnListAssertSize(map->texts, cnt);
@@ -952,13 +952,13 @@ ComputeCoordinates(ZnItem item,
ZnListAssertSize(map->marks, num_marks);
ZnAddPointsToBBox(&item->item_bounding_box,
- ZnListArray(map->vectors), ZnListSize(map->vectors));
+ ZnListArray(map->vectors), ZnListSize(map->vectors));
ZnAddPointsToBBox(&item->item_bounding_box,
- ZnListArray(map->dashed_vectors), ZnListSize(map->dashed_vectors));
+ ZnListArray(map->dashed_vectors), ZnListSize(map->dashed_vectors));
ZnAddPointsToBBox(&item->item_bounding_box,
- ZnListArray(map->dotted_vectors), ZnListSize(map->dotted_vectors));
+ ZnListArray(map->dotted_vectors), ZnListSize(map->dotted_vectors));
ZnAddPointsToBBox(&item->item_bounding_box,
- ZnListArray(map->mixed_vectors), ZnListSize(map->mixed_vectors));
+ ZnListArray(map->mixed_vectors), ZnListSize(map->mixed_vectors));
item->item_bounding_box.orig.x -= 0.5;
item->item_bounding_box.orig.y -= 0.5;
item->item_bounding_box.corner.x += 0.5;
@@ -970,15 +970,15 @@ ComputeCoordinates(ZnItem item,
**********************************************************************************
*
* ToArea --
- * Tell if the object is entirely outside (-1),
- * entirely inside (1) or in between (0).
+ * Tell if the object is entirely outside (-1),
+ * entirely inside (1) or in between (0).
*
**********************************************************************************
*/
static int
-ToArea(ZnItem item,
- ZnToArea ta)
+ToArea(ZnItem item,
+ ZnToArea ta)
{
return -1;
}
@@ -993,20 +993,20 @@ ToArea(ZnItem item,
*/
static void
-Draw(ZnItem item)
+Draw(ZnItem item)
{
- ZnWInfo *wi = item->wi;
- MapItem map = (MapItem) item;
- ZnMapInfoId map_info;
- ZnPoint *points;
- XPoint *xpoints;
- XArc *arcs;
- char *text;
- char tmp_str[] = ".";
- XGCValues values;
- unsigned int i, cnt;
- ZnDim line_width_w;
- int line_width;
+ ZnWInfo *wi = item->wi;
+ MapItem map = (MapItem) item;
+ ZnMapInfoId map_info;
+ ZnPoint *points;
+ XPoint *xpoints;
+ XArc *arcs;
+ char *text;
+ char tmp_str[] = ".";
+ XGCValues values;
+ unsigned int i, cnt;
+ ZnDim line_width_w;
+ int line_width;
if (map->map_info == NULL) {
return;
@@ -1019,37 +1019,37 @@ Draw(ZnItem item)
if (map->filled) {
if (ZnListSize(map->vectors) || ZnListSize(map->arcs)) {
if (map->fill_pattern == ZnUnspecifiedImage) { /* Fill solid */
- values.fill_style = FillSolid;
- XChangeGC(wi->dpy, wi->gc, GCFillStyle | GCForeground, &values);
+ values.fill_style = FillSolid;
+ XChangeGC(wi->dpy, wi->gc, GCFillStyle | GCForeground, &values);
}
else { /* Fill stippled */
- values.fill_style = FillStippled;
- values.stipple = ZnImagePixmap(map->fill_pattern, wi->win);
- XChangeGC(wi->dpy, wi->gc,
- GCFillStyle | GCStipple | GCForeground, &values);
+ values.fill_style = FillStippled;
+ values.stipple = ZnImagePixmap(map->fill_pattern, wi->win);
+ XChangeGC(wi->dpy, wi->gc,
+ GCFillStyle | GCStipple | GCForeground, &values);
}
cnt = ZnListSize(map->vectors);
if (cnt) {
- ZnListAssertSize(ZnWorkXPoints, cnt);
- xpoints = (XPoint *) ZnListArray(ZnWorkXPoints);
- points = (ZnPoint *) ZnListArray(map->vectors);
- for (i = 0; i < cnt; i++) {
- xpoints[i].x = (int) points[i].x;
- xpoints[i].y = (int) points[i].y;
- }
- XFillPolygon(wi->dpy, wi->draw_buffer, wi->gc, xpoints, (int) cnt,
- Nonconvex, CoordModeOrigin);
+ ZnListAssertSize(ZnWorkXPoints, cnt);
+ xpoints = (XPoint *) ZnListArray(ZnWorkXPoints);
+ points = (ZnPoint *) ZnListArray(map->vectors);
+ for (i = 0; i < cnt; i++) {
+ xpoints[i].x = (int) points[i].x;
+ xpoints[i].y = (int) points[i].y;
+ }
+ XFillPolygon(wi->dpy, wi->draw_buffer, wi->gc, xpoints, (int) cnt,
+ Nonconvex, CoordModeOrigin);
}
if (ZnListSize(map->arcs)) {
- arcs = ZnListArray(map->arcs);
- cnt = ZnListSize(map->arcs);
- for (i = 0; i < cnt; i++, arcs++) {
- XFillArc(wi->dpy, wi->draw_buffer, wi->gc,
- arcs->x, arcs->y, arcs->width, arcs->height,
- arcs->angle1, arcs->angle2);
- }
+ arcs = ZnListArray(map->arcs);
+ cnt = ZnListSize(map->arcs);
+ for (i = 0; i < cnt; i++, arcs++) {
+ XFillArc(wi->dpy, wi->draw_buffer, wi->gc,
+ arcs->x, arcs->y, arcs->width, arcs->height,
+ arcs->angle1, arcs->angle2);
+ }
}
}
}
@@ -1060,33 +1060,33 @@ Draw(ZnItem item)
values.fill_style = FillSolid;
values.line_width = 0;
XChangeGC(wi->dpy, wi->gc,
- GCFillStyle | GCLineWidth | GCForeground, &values);
+ GCFillStyle | GCLineWidth | GCForeground, &values);
/* !! WARNING !! XDrawSegments can't handle an unlimited number of segments
- in releases R4 and older */
+ in releases R4 and older */
/* XDrawSegments(wi->dpy, wi->draw_buffer, wi->gc,
- (XSegment *) ZnListArray(map->vectors),
- ZnListSize(map->vectors)/2);*/
+ (XSegment *) ZnListArray(map->vectors),
+ ZnListSize(map->vectors)/2);*/
cnt = ZnListSize(map->vectors);
points = (ZnPoint *) ZnListArray(map->vectors);
for (i = 0; i < cnt; i += 2) {
- if (ZnLineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
+ if (ZnLineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
ZnMapInfoGetLine(map_info, i/2, NULL, NULL, &line_width_w, NULL,
- NULL, NULL, NULL);
- line_width = (int) line_width_w;
+ NULL, NULL, NULL);
+ line_width = (int) line_width_w;
if (line_width != values.line_width) {
values.line_width = line_width;
XChangeGC(wi->dpy, wi->gc, GCLineWidth, &values);
}
- /*printf("Dessin d'une ligne de %d %d à %d %d\n",
- (int)points[i].x, (int)points[i].y,
- (int)points[i+1].x, (int)points[i+1].y);*/
- XDrawLine(wi->dpy, wi->draw_buffer, wi->gc,
- (int) points[i].x,
- (int) points[i].y,
- (int) points[i+1].x,
- (int) points[i+1].y);
- }
+ /*printf("Dessin d'une ligne de %d %d à %d %d\n",
+ (int)points[i].x, (int)points[i].y,
+ (int)points[i+1].x, (int)points[i+1].y);*/
+ XDrawLine(wi->dpy, wi->draw_buffer, wi->gc,
+ (int) points[i].x,
+ (int) points[i].y,
+ (int) points[i+1].x,
+ (int) points[i+1].y);
+ }
}
}
@@ -1097,25 +1097,25 @@ Draw(ZnItem item)
XChangeGC(wi->dpy, wi->gc, GCFillStyle | GCLineWidth | GCForeground, &values);
/* !! WARNING !! XDrawSegments can't handle an unlimited number of segments
- in releases R4 and older */
+ in releases R4 and older */
/* XDrawSegments(wi->dpy, wi->draw_buffer, wi->gc,
- (XSegment *) ZnListArray(map->dashed_vectors), ZnListSize(map->dashed_vectors)/2);*/
+ (XSegment *) ZnListArray(map->dashed_vectors), ZnListSize(map->dashed_vectors)/2);*/
cnt = ZnListSize(map->dashed_vectors);
points = (ZnPoint *) ZnListArray(map->dashed_vectors);
for (i = 0; i < cnt; i += 2) {
- if (ZnLineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
+ if (ZnLineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
ZnMapInfoGetLine(map_info, i/2, NULL, NULL, &line_width_w, NULL, NULL, NULL, NULL);
- line_width = (int) line_width_w;
+ line_width = (int) line_width_w;
if (line_width != values.line_width) {
values.line_width = line_width;
XChangeGC(wi->dpy, wi->gc, GCLineWidth, &values);
}
- XDrawLine(wi->dpy, wi->draw_buffer, wi->gc,
- (int) points[i].x,
- (int) points[i].y,
- (int) points[i+1].x,
- (int) points[i+1].y);
- }
+ XDrawLine(wi->dpy, wi->draw_buffer, wi->gc,
+ (int) points[i].x,
+ (int) points[i].y,
+ (int) points[i+1].x,
+ (int) points[i+1].y);
+ }
}
}
@@ -1124,28 +1124,28 @@ Draw(ZnItem item)
values.fill_style = FillSolid;
values.line_width = 0;
XChangeGC(wi->dpy, wi->gc,
- GCFillStyle | GCLineWidth | GCForeground, &values);
+ GCFillStyle | GCLineWidth | GCForeground, &values);
/* !! WARNING !! XDrawSegments can't handle an unlimited number of segments
- in releases R4 and older */
+ in releases R4 and older */
/* XDrawSegments(wi->dpy, wi->draw_buffer, wi->gc,
- (XSegment *) ZnListArray(map->dotted_vectors), ZnListSize(map->dotted_vectors)/2);*/
+ (XSegment *) ZnListArray(map->dotted_vectors), ZnListSize(map->dotted_vectors)/2);*/
cnt = ZnListSize(map->dotted_vectors);
points = (ZnPoint *) ZnListArray(map->dotted_vectors);
for (i = 0; i < cnt; i += 2) {
- if (ZnLineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
+ if (ZnLineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
ZnMapInfoGetLine(map_info, i/2, NULL, NULL, &line_width_w, NULL, NULL, NULL, NULL);
- line_width = (int) line_width_w;
+ line_width = (int) line_width_w;
if (line_width != values.line_width) {
values.line_width = line_width;
XChangeGC(wi->dpy, wi->gc, GCLineWidth, &values);
}
- XDrawLine(wi->dpy, wi->draw_buffer, wi->gc,
- (int) points[i].x,
- (int) points[i].y,
- (int) points[i+1].x,
- (int) points[i+1].y);
- }
+ XDrawLine(wi->dpy, wi->draw_buffer, wi->gc,
+ (int) points[i].x,
+ (int) points[i].y,
+ (int) points[i+1].x,
+ (int) points[i+1].y);
+ }
}
}
@@ -1156,25 +1156,25 @@ Draw(ZnItem item)
XChangeGC(wi->dpy, wi->gc, GCFillStyle | GCLineWidth | GCForeground, &values);
/* !! WARNING !! XDrawSegments can't handle an unlimited number of segments
- in releases R4 and older */
+ in releases R4 and older */
/*XDrawSegments(wi->dpy, wi->draw_buffer, wi->gc,
- (XSegment *) ZnListArray(map->mixed_vectors), ZnListSize(map->mixed_vectors)/2);*/
+ (XSegment *) ZnListArray(map->mixed_vectors), ZnListSize(map->mixed_vectors)/2);*/
cnt = ZnListSize(map->mixed_vectors);
points = (ZnPoint *) ZnListArray(map->mixed_vectors);
for (i = 0; i < cnt; i += 2) {
- if (ZnLineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
+ if (ZnLineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
ZnMapInfoGetLine(map_info, i/2, NULL, NULL, &line_width_w, NULL, NULL, NULL, NULL);
- line_width = (int) line_width_w;
+ line_width = (int) line_width_w;
if (line_width != values.line_width) {
values.line_width = line_width;
XChangeGC(wi->dpy, wi->gc, GCLineWidth, &values);
}
- XDrawLine(wi->dpy, wi->draw_buffer, wi->gc,
- (int) points[i].x,
- (int) points[i].y,
- (int) points[i+1].x,
- (int) points[i+1].y);
- }
+ XDrawLine(wi->dpy, wi->draw_buffer, wi->gc,
+ (int) points[i].x,
+ (int) points[i].y,
+ (int) points[i+1].x,
+ (int) points[i+1].y);
+ }
}
}
@@ -1187,9 +1187,9 @@ Draw(ZnItem item)
arcs = ZnListArray(map->arcs);
cnt = ZnListSize(map->arcs);
for (i = 0; i < cnt; i++, arcs++) {
- XDrawArc(wi->dpy, wi->draw_buffer, wi->gc,
- arcs->x, arcs->y, arcs->width, arcs->height,
- arcs->angle1, arcs->angle2);
+ XDrawArc(wi->dpy, wi->draw_buffer, wi->gc,
+ arcs->x, arcs->y, arcs->width, arcs->height,
+ arcs->angle1, arcs->angle2);
}
}
@@ -1202,9 +1202,9 @@ Draw(ZnItem item)
arcs = ZnListArray(map->arcs);
cnt = ZnListSize(map->arcs);
for (i = 0; i < cnt; i++, arcs++) {
- XDrawArc(wi->dpy, wi->draw_buffer, wi->gc,
- arcs->x, arcs->y, arcs->width, arcs->height,
- arcs->angle1, arcs->angle2);
+ XDrawArc(wi->dpy, wi->draw_buffer, wi->gc,
+ arcs->x, arcs->y, arcs->width, arcs->height,
+ arcs->angle1, arcs->angle2);
}
}
@@ -1217,9 +1217,9 @@ Draw(ZnItem item)
arcs = ZnListArray(map->arcs);
cnt = ZnListSize(map->arcs);
for (i = 0; i < cnt; i++, arcs++) {
- XDrawArc(wi->dpy, wi->draw_buffer, wi->gc,
- arcs->x, arcs->y, arcs->width, arcs->height,
- arcs->angle1, arcs->angle2);
+ XDrawArc(wi->dpy, wi->draw_buffer, wi->gc,
+ arcs->x, arcs->y, arcs->width, arcs->height,
+ arcs->angle1, arcs->angle2);
}
}
@@ -1232,9 +1232,9 @@ Draw(ZnItem item)
arcs = ZnListArray(map->arcs);
cnt = ZnListSize(map->arcs);
for (i = 0; i < cnt; i++, arcs++) {
- XDrawArc(wi->dpy, wi->draw_buffer, wi->gc,
- arcs->x, arcs->y, arcs->width, arcs->height,
- arcs->angle1, arcs->angle2);
+ XDrawArc(wi->dpy, wi->draw_buffer, wi->gc,
+ arcs->x, arcs->y, arcs->width, arcs->height,
+ arcs->angle1, arcs->angle2);
}
}
@@ -1245,15 +1245,15 @@ Draw(ZnItem item)
values.font = Tk_FontId(map->text_font);
values.fill_style = FillSolid;
XChangeGC(wi->dpy, wi->gc,
- GCFillStyle | GCFont | GCForeground, &values);
+ GCFillStyle | GCFont | GCForeground, &values);
cnt = ZnListSize(map->texts);
points = (ZnPoint *) ZnListArray(map->texts);
for (i = 0; i < cnt; i++) {
- ZnMapInfoGetText(map_info, i, NULL, NULL, NULL, NULL, NULL, &text);
- Tk_DrawChars(wi->dpy, wi->draw_buffer, wi->gc,
- map->text_font, text, (int) strlen(text),
- (int) points[i].x, (int) points[i].y);
+ ZnMapInfoGetText(map_info, i, NULL, NULL, NULL, NULL, NULL, &text);
+ Tk_DrawChars(wi->dpy, wi->draw_buffer, wi->gc,
+ map->text_font, text, (int) strlen(text),
+ (int) points[i].x, (int) points[i].y);
}
}
@@ -1266,42 +1266,42 @@ Draw(ZnItem item)
XChangeGC(wi->dpy, wi->gc, GCFillStyle, &values);
if (map->symbol_patterns) {
- ZnImage *syms = ZnListArray(map->symbol_patterns);
- int num_syms = ZnListSize(map->symbol_patterns);
-
- cnt = ZnListSize(map->symbols);
- points = ZnListArray(map->symbols);
- for (i = 0; i < cnt; i++) {
- ZnMapInfoGetSymbol(map_info, i, NULL, NULL, NULL, &(tmp_str[0]));
- sym = syms[tmp_str[0]%num_syms];
- if (sym != ZnUnspecifiedImage) {
- ZnSizeOfImage(sym, &w ,&h);
- ox = ((int) points[i].x) - w/2;
- oy = ((int) points[i].y) - h/2;
- values.stipple = ZnImagePixmap(sym, wi->win);
- values.ts_x_origin = ox;
- values.ts_y_origin = oy;
- XChangeGC(wi->dpy, wi->gc,
- GCStipple|GCTileStipXOrigin|GCTileStipYOrigin, &values);
- XFillRectangle(wi->dpy, wi->draw_buffer, wi->gc, ox, oy, w, h);
- }
- }
+ ZnImage *syms = ZnListArray(map->symbol_patterns);
+ int num_syms = ZnListSize(map->symbol_patterns);
+
+ cnt = ZnListSize(map->symbols);
+ points = ZnListArray(map->symbols);
+ for (i = 0; i < cnt; i++) {
+ ZnMapInfoGetSymbol(map_info, i, NULL, NULL, NULL, &(tmp_str[0]));
+ sym = syms[tmp_str[0]%num_syms];
+ if (sym != ZnUnspecifiedImage) {
+ ZnSizeOfImage(sym, &w ,&h);
+ ox = ((int) points[i].x) - w/2;
+ oy = ((int) points[i].y) - h/2;
+ values.stipple = ZnImagePixmap(sym, wi->win);
+ values.ts_x_origin = ox;
+ values.ts_y_origin = oy;
+ XChangeGC(wi->dpy, wi->gc,
+ GCStipple|GCTileStipXOrigin|GCTileStipYOrigin, &values);
+ XFillRectangle(wi->dpy, wi->draw_buffer, wi->gc, ox, oy, w, h);
+ }
+ }
}
if (wi->map_distance_symbol != ZnUnspecifiedImage) {
- ZnSizeOfImage(wi->map_distance_symbol, &w, &h);
- cnt = ZnListSize(map->marks);
- points = ZnListArray(map->marks);
- values.stipple = ZnImagePixmap(wi->map_distance_symbol, wi->win);
- XChangeGC(wi->dpy, wi->gc, GCStipple, &values);
- for (i = 0; i < cnt; i++) {
- ox = ((int) points[i].x) - w/2;
- oy = ((int) points[i].y) - h/2;
- values.ts_x_origin = ox;
- values.ts_y_origin = oy;
- XChangeGC(wi->dpy, wi->gc, GCTileStipXOrigin|GCTileStipYOrigin, &values);
- XFillRectangle(wi->dpy, wi->draw_buffer, wi->gc, ox, oy, w, h);
- }
+ ZnSizeOfImage(wi->map_distance_symbol, &w, &h);
+ cnt = ZnListSize(map->marks);
+ points = ZnListArray(map->marks);
+ values.stipple = ZnImagePixmap(wi->map_distance_symbol, wi->win);
+ XChangeGC(wi->dpy, wi->gc, GCStipple, &values);
+ for (i = 0; i < cnt; i++) {
+ ox = ((int) points[i].x) - w/2;
+ oy = ((int) points[i].y) - h/2;
+ values.ts_x_origin = ox;
+ values.ts_y_origin = oy;
+ XChangeGC(wi->dpy, wi->gc, GCTileStipXOrigin|GCTileStipYOrigin, &values);
+ XFillRectangle(wi->dpy, wi->draw_buffer, wi->gc, ox, oy, w, h);
+ }
}
}
}
@@ -1317,19 +1317,19 @@ Draw(ZnItem item)
*/
#ifdef GL
static void
-Render(ZnItem item)
+Render(ZnItem item)
{
- ZnWInfo *wi = item->wi;
- MapItem map = (MapItem) item;
- ZnMapInfoId map_info;
- ZnPoint *points, p;
- char *text;
- char tmp_str[] = ".";
- unsigned int i, cnt;
- int w, h;
- XColor *color;
- GLfloat line_width;
- ZnDim new_width;
+ ZnWInfo *wi = item->wi;
+ MapItem map = (MapItem) item;
+ ZnMapInfoId map_info;
+ ZnPoint *points, p;
+ char *text;
+ char tmp_str[] = ".";
+ unsigned int i, cnt;
+ int w, h;
+ XColor *color;
+ GLfloat line_width;
+ ZnDim new_width;
unsigned short alpha;
if (!map->map_info) {
@@ -1342,11 +1342,11 @@ Render(ZnItem item)
glColor4us(color->red, color->green, color->blue, alpha);
if (map->filled) {
if (ZnListSize(map->vectors) || ZnListSize(map->arcs)) {
- /* TODO_GL: Need to have a tesselated polygon then
- * fill it either using ZnRenderTile or solid.
- */
+ /* TODO_GL: Need to have a tesselated polygon then
+ * fill it either using ZnRenderTile or solid.
+ */
if (map->fill_pattern != ZnUnspecifiedImage) {
- /* Fill stippled */
+ /* Fill stippled */
}
else {
}
@@ -1361,16 +1361,16 @@ Render(ZnItem item)
points = ZnListArray(map->vectors);
glBegin(GL_LINES);
for (i = 0; i < cnt; i += 2) {
- if (ZnLineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
+ if (ZnLineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
ZnMapInfoGetLine(map_info, i/2, NULL, NULL, &new_width, NULL,
- NULL, NULL, NULL);
+ NULL, NULL, NULL);
if (new_width != line_width) {
- line_width = (GLfloat)new_width;
- glLineWidth(line_width);
+ line_width = (GLfloat)new_width;
+ glLineWidth(line_width);
}
- glVertex2d(points[i].x, points[i].y);
- glVertex2d(points[i+1].x, points[i+1].y);
- }
+ glVertex2d(points[i].x, points[i].y);
+ glVertex2d(points[i+1].x, points[i+1].y);
+ }
}
glEnd();
}
@@ -1382,16 +1382,16 @@ Render(ZnItem item)
points = ZnListArray(map->dashed_vectors);
glBegin(GL_LINES);
for (i = 0; i < cnt; i += 2) {
- if (ZnLineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
+ if (ZnLineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
ZnMapInfoGetLine(map_info, i/2, NULL, NULL, &new_width, NULL,
- NULL, NULL, NULL);
+ NULL, NULL, NULL);
if (new_width != line_width) {
- line_width = (GLfloat)new_width;
- glLineWidth(line_width);
+ line_width = (GLfloat)new_width;
+ glLineWidth(line_width);
}
- glVertex2d(points[i].x, points[i].y);
- glVertex2d(points[i+1].x, points[i+1].y);
- }
+ glVertex2d(points[i].x, points[i].y);
+ glVertex2d(points[i+1].x, points[i+1].y);
+ }
}
glEnd();
glDisable(GL_LINE_STIPPLE);
@@ -1404,16 +1404,16 @@ Render(ZnItem item)
points = ZnListArray(map->dotted_vectors);
glBegin(GL_LINES);
for (i = 0; i < cnt; i += 2) {
- if (ZnLineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
+ if (ZnLineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
ZnMapInfoGetLine(map_info, i/2, NULL, NULL, &new_width, NULL,
- NULL, NULL, NULL);
+ NULL, NULL, NULL);
if (new_width != line_width) {
- line_width = (GLfloat)new_width;
- glLineWidth(line_width);
+ line_width = (GLfloat)new_width;
+ glLineWidth(line_width);
}
- glVertex2d(points[i].x, points[i].y);
- glVertex2d(points[i+1].x, points[i+1].y);
- }
+ glVertex2d(points[i].x, points[i].y);
+ glVertex2d(points[i+1].x, points[i+1].y);
+ }
}
glEnd();
glDisable(GL_LINE_STIPPLE);
@@ -1426,16 +1426,16 @@ Render(ZnItem item)
points = ZnListArray(map->mixed_vectors);
glBegin(GL_LINES);
for (i = 0; i < cnt; i += 2) {
- if (ZnLineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
+ if (ZnLineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
ZnMapInfoGetLine(map_info, i/2, NULL, NULL, &new_width, NULL,
- NULL, NULL, NULL);
+ NULL, NULL, NULL);
if (new_width != line_width) {
- line_width = (GLfloat)new_width;
- glLineWidth(line_width);
+ line_width = (GLfloat)new_width;
+ glLineWidth(line_width);
}
- glVertex2d(points[i].x, points[i].y);
- glVertex2d(points[i+1].x, points[i+1].y);
- }
+ glVertex2d(points[i].x, points[i].y);
+ glVertex2d(points[i+1].x, points[i+1].y);
+ }
}
glEnd();
glDisable(GL_LINE_STIPPLE);
@@ -1478,11 +1478,11 @@ Render(ZnItem item)
cnt = ZnListSize(map->texts);
points = ZnListArray(map->texts);
for (i = 0; i < cnt; i++, points++) {
- glPushMatrix();
- ZnMapInfoGetText(map_info, i, NULL, NULL, NULL, NULL, NULL, &text);
- glTranslated(points->x, points->y, 0.0);
- ZnRenderString(map->tfi, text, strlen(text));
- glPopMatrix();
+ glPushMatrix();
+ ZnMapInfoGetText(map_info, i, NULL, NULL, NULL, NULL, NULL, &text);
+ glTranslated(points->x, points->y, 0.0);
+ ZnRenderString(map->tfi, text, strlen(text));
+ glPopMatrix();
}
glDisable(GL_TEXTURE_2D);
}
@@ -1494,14 +1494,14 @@ Render(ZnItem item)
cnt = ZnListSize(map->symbols);
points = ZnListArray(map->symbols);
for (i = 0; i < cnt; i++) {
- ZnMapInfoGetSymbol(map_info, i, NULL, NULL, NULL, &(tmp_str[0]));
- sym = syms[tmp_str[0]%num_syms];
- if (sym != ZnUnspecifiedImage) {
- ZnSizeOfImage(sym, &w, &h);
- p.x = points[i].x-(w+1.0)/2.0;
- p.y = points[i].y-(h+1.0)/2.0;
- ZnRenderIcon(wi, sym, map->color, &p, True);
- }
+ ZnMapInfoGetSymbol(map_info, i, NULL, NULL, NULL, &(tmp_str[0]));
+ sym = syms[tmp_str[0]%num_syms];
+ if (sym != ZnUnspecifiedImage) {
+ ZnSizeOfImage(sym, &w, &h);
+ p.x = points[i].x-(w+1.0)/2.0;
+ p.y = points[i].y-(h+1.0)/2.0;
+ ZnRenderIcon(wi, sym, map->color, &p, True);
+ }
}
}
@@ -1510,16 +1510,16 @@ Render(ZnItem item)
cnt = ZnListSize(map->marks);
points = ZnListArray(map->marks);
for (i = 0; i < cnt; i++, points++) {
- p.x = points->x-(w+1)/2;
- p.y = points->y-(h+1)/2;
- ZnRenderIcon(wi, wi->map_distance_symbol, map->color, &p, True);
+ p.x = points->x-(w+1)/2;
+ p.y = points->y-(h+1)/2;
+ ZnRenderIcon(wi, wi->map_distance_symbol, map->color, &p, True);
}
}
}
}
#else
static void
-Render(ZnItem item)
+Render(ZnItem item)
{
}
#endif
@@ -1533,11 +1533,11 @@ Render(ZnItem item)
**********************************************************************************
*/
static ZnBool
-IsSensitive(ZnItem item,
- int item_part)
+IsSensitive(ZnItem item,
+ int item_part)
{
return (ISSET(item->flags, ZN_SENSITIVE_BIT) &&
- item->parent->class->IsSensitive(item->parent, ZN_NO_PART));
+ item->parent->class->IsSensitive(item->parent, ZN_NO_PART));
}
@@ -1545,17 +1545,17 @@ IsSensitive(ZnItem item,
**********************************************************************************
*
* Pick --
- * This is *NOT* correct but for now we will tell that we are
- * transparent even if we are solid filled.
+ * This is *NOT* correct but for now we will tell that we are
+ * transparent even if we are solid filled.
*
- * !!!! We need to say we are opaque at least if we are solid
- * filled. !!!!
+ * !!!! We need to say we are opaque at least if we are solid
+ * filled. !!!!
*
**********************************************************************************
*/
static double
-Pick(ZnItem item,
- ZnPick ps)
+Pick(ZnItem item,
+ ZnPick ps)
{
return 1e40;
}
@@ -1569,8 +1569,8 @@ Pick(ZnItem item,
**********************************************************************************
*/
static void
-PostScript(ZnItem item,
- ZnBool prepass)
+PostScript(ZnItem item,
+ ZnBool prepass)
{
}
@@ -1587,33 +1587,33 @@ static ZnItemClassStruct MAP_ITEM_CLASS = {
"map",
sizeof(MapItemStruct),
map_attrs,
- 0, /* num_parts */
- 0, /* flags */
+ 0, /* num_parts */
+ 0, /* flags */
-1,
Init,
Clone,
Destroy,
Configure,
Query,
- NULL, /* GetFieldSet */
- NULL, /* GetAnchor */
- NULL, /* GetClipVertices */
- NULL, /* GetContours */
+ NULL, /* GetFieldSet */
+ NULL, /* GetAnchor */
+ NULL, /* GetClipVertices */
+ NULL, /* GetContours */
NULL,
- NULL, /* InsertChars */
- NULL, /* DeleteChars */
- NULL, /* Cursor */
- NULL, /* Index */
- NULL, /* Part */
- NULL, /* Selection */
- NULL, /* Contour */
+ NULL, /* InsertChars */
+ NULL, /* DeleteChars */
+ NULL, /* Cursor */
+ NULL, /* Index */
+ NULL, /* Part */
+ NULL, /* Selection */
+ NULL, /* Contour */
ComputeCoordinates,
ToArea,
Draw,
Render,
IsSensitive,
Pick,
- NULL, /* PickVertex */
+ NULL, /* PickVertex */
PostScript
};
diff --git a/generic/MapInfo.c b/generic/MapInfo.c
index 21a3592..ccc6e1a 100644
--- a/generic/MapInfo.c
+++ b/generic/MapInfo.c
@@ -1,8 +1,8 @@
/*
* MapInfo.c -- MapInfo interface.
*
- * Authors : Patrick Lecoanet.
- * Creation date :
+ * Authors : Patrick Lecoanet.
+ * Creation date :
*
* $Id$
*/
@@ -54,50 +54,50 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ "
*-----------------------------------------------------------------------
*/
typedef struct {
- ZnPtr tag;
- ZnMapInfoLineStyle style;
- int width;
- ZnPoint center;
- unsigned int radius;
- int start_angle;
- int extend;
+ ZnPtr tag;
+ ZnMapInfoLineStyle style;
+ int width;
+ ZnPoint center;
+ unsigned int radius;
+ int start_angle;
+ int extend;
} ZnMapInfoArcStruct, *ZnMapInfoArc;
typedef struct {
- ZnPtr tag;
- ZnMapInfoLineStyle style;
- int width;
- ZnPoint from;
- ZnPoint to;
- unsigned int num_marks;
- ZnPoint *marks;
+ ZnPtr tag;
+ ZnMapInfoLineStyle style;
+ int width;
+ ZnPoint from;
+ ZnPoint to;
+ unsigned int num_marks;
+ ZnPoint *marks;
} ZnMapInfoLineStruct, *ZnMapInfoLine;
typedef struct {
- ZnPtr tag;
- ZnPoint at;
- char symbol[2];
+ ZnPtr tag;
+ ZnPoint at;
+ char symbol[2];
} ZnMapInfoSymbolStruct, *ZnMapInfoSymbol;
typedef struct {
- ZnPtr tag;
- ZnMapInfoTextStyle text_style;
- ZnMapInfoLineStyle line_style;
- ZnPoint at;
- char *text;
+ ZnPtr tag;
+ ZnMapInfoTextStyle text_style;
+ ZnMapInfoLineStyle line_style;
+ ZnPoint at;
+ char *text;
} ZnMapInfoTextStruct, *ZnMapInfoText;
typedef struct {
- char *name;
- ZnList lines;
- ZnList symbols;
- ZnList texts;
- ZnList arcs;
+ char *name;
+ ZnList lines;
+ ZnList symbols;
+ ZnList texts;
+ ZnList arcs;
} ZnMapInfoStruct, *ZnMapInfo;
-#define MARKERS_SPACING 80.0 /* 10 nautic miles in 1/8 of a mile */
-#define BASE_ALLOC_SIZE 8
+#define MARKERS_SPACING 80.0 /* 10 nautic miles in 1/8 of a mile */
+#define BASE_ALLOC_SIZE 8
/*
@@ -107,7 +107,7 @@ typedef struct {
*
*-----------------------------------------------------------------------
*/
-#define NOT_MARKED_STYLE(style) \
+#define NOT_MARKED_STYLE(style) \
((style) == ZnMapInfoLineMarked ? ZnMapInfoLineSimple : (style));
@@ -115,23 +115,23 @@ typedef struct {
*-----------------------------------------------------------------------
*
* ComputeLineMarks --
- * Add marks to a line in the marks substructure.
+ * Add marks to a line in the marks substructure.
*
*-----------------------------------------------------------------------
*/
static void
-ComputeLineMarks(ZnMapInfoLine marked_line)
+ComputeLineMarks(ZnMapInfoLine marked_line)
{
- ZnDim length;
- ZnPos x_from = marked_line->from.x;
- ZnPos y_from = marked_line->from.y;
- ZnPos x_to = marked_line->to.x;
- ZnPos y_to = marked_line->to.y;
- ZnPos delta_x = x_from - x_to;
- ZnPos delta_y = y_from - y_to;
- ZnPos step_x, step_y;
- unsigned int j;
+ ZnDim length;
+ ZnPos x_from = marked_line->from.x;
+ ZnPos y_from = marked_line->from.y;
+ ZnPos x_to = marked_line->to.x;
+ ZnPos y_to = marked_line->to.y;
+ ZnPos delta_x = x_from - x_to;
+ ZnPos delta_y = y_from - y_to;
+ ZnPos step_x, step_y;
+ unsigned int j;
length = sqrt(delta_x * delta_x + delta_y * delta_y);
step_x = (x_to - x_from) * MARKERS_SPACING / length;
@@ -156,9 +156,9 @@ ComputeLineMarks(ZnMapInfoLine marked_line)
static ZnMapInfoId
-ZnMapInfoCreate(char *name)
+ZnMapInfoCreate(char *name)
{
- ZnMapInfo new_map;
+ ZnMapInfo new_map;
new_map = ZnMalloc(sizeof(ZnMapInfoStruct));
memset((char *) new_map, 0, sizeof(ZnMapInfoStruct));
@@ -174,7 +174,7 @@ ZnMapInfoCreate(char *name)
static char *
-ZnMapInfoName(ZnMapInfoId map_info)
+ZnMapInfoName(ZnMapInfoId map_info)
{
if (!map_info) {
return "";
@@ -184,13 +184,13 @@ ZnMapInfoName(ZnMapInfoId map_info)
static ZnMapInfoId
-ZnMapInfoDuplicate(ZnMapInfoId map_info)
+ZnMapInfoDuplicate(ZnMapInfoId map_info)
{
- ZnMapInfo cur_map = map_info;
- ZnMapInfo new_map;
- unsigned int i, num_lines, num_texts;
- ZnMapInfoText new_texts, cur_texts;
- ZnMapInfoLine new_lines, cur_lines;
+ ZnMapInfo cur_map = map_info;
+ ZnMapInfo new_map;
+ unsigned int i, num_lines, num_texts;
+ ZnMapInfoText new_texts, cur_texts;
+ ZnMapInfoLine new_lines, cur_lines;
if (!cur_map) {
return ((ZnMapInfoId) NULL);
@@ -207,10 +207,10 @@ ZnMapInfoDuplicate(ZnMapInfoId map_info)
for (i = 0; i < num_lines; i++) {
if (new_lines[i].style == ZnMapInfoLineMarked) {
- new_lines[i].marks = ZnMalloc(new_lines[i].num_marks * sizeof(ZnPoint));
- memcpy((char *) new_lines[i].marks,
- (char *) cur_lines[i].marks,
- new_lines[i].num_marks * sizeof(ZnPoint));
+ new_lines[i].marks = ZnMalloc(new_lines[i].num_marks * sizeof(ZnPoint));
+ memcpy((char *) new_lines[i].marks,
+ (char *) cur_lines[i].marks,
+ new_lines[i].num_marks * sizeof(ZnPoint));
}
}
}
@@ -238,12 +238,12 @@ ZnMapInfoDuplicate(ZnMapInfoId map_info)
static void
-ZnMapInfoDelete(ZnMapInfoId map_info)
+ZnMapInfoDelete(ZnMapInfoId map_info)
{
- ZnMapInfo cur_map = map_info;
- unsigned int i, num_texts, num_lines;
- ZnMapInfoText cur_texts;
- ZnMapInfoLine cur_lines;
+ ZnMapInfo cur_map = map_info;
+ unsigned int i, num_texts, num_lines;
+ ZnMapInfoText cur_texts;
+ ZnMapInfoLine cur_lines;
if (cur_map) {
if (cur_map->texts) {
@@ -251,7 +251,7 @@ ZnMapInfoDelete(ZnMapInfoId map_info)
cur_texts = ZnListArray(cur_map->texts);
for (i = 0; i < num_texts; i++) {
- ZnFree(cur_texts[i].text);
+ ZnFree(cur_texts[i].text);
}
ZnListFree(cur_map->texts);
@@ -262,9 +262,9 @@ ZnMapInfoDelete(ZnMapInfoId map_info)
cur_lines = ZnListArray(cur_map->lines);
for (i = 0; i < num_lines; i++) {
- if (cur_lines[i].style == ZnMapInfoLineMarked) {
- ZnFree(cur_lines[i].marks);
- }
+ if (cur_lines[i].style == ZnMapInfoLineMarked) {
+ ZnFree(cur_lines[i].marks);
+ }
}
ZnListFree(cur_map->lines);
@@ -284,7 +284,7 @@ ZnMapInfoDelete(ZnMapInfoId map_info)
}
static void
-ZnMapInfoEmpty(ZnMapInfoId map_info)
+ZnMapInfoEmpty(ZnMapInfoId map_info)
{
ZnMapInfo cur_map = map_info;
@@ -306,18 +306,18 @@ ZnMapInfoEmpty(ZnMapInfoId map_info)
static void
-ZnMapInfoAddLine(ZnMapInfoId map_info,
- unsigned int index,
- ZnPtr tag,
- ZnMapInfoLineStyle line_style,
- ZnDim line_width,
- ZnPos x_from,
- ZnPos y_from,
- ZnPos x_to,
- ZnPos y_to)
+ZnMapInfoAddLine(ZnMapInfoId map_info,
+ unsigned int index,
+ ZnPtr tag,
+ ZnMapInfoLineStyle line_style,
+ ZnDim line_width,
+ ZnPos x_from,
+ ZnPos y_from,
+ ZnPos x_to,
+ ZnPos y_to)
{
- ZnMapInfo cur_map = map_info;
- ZnMapInfoLineStruct line_struct;
+ ZnMapInfo cur_map = map_info;
+ ZnMapInfoLineStruct line_struct;
if (cur_map) {
if (!cur_map->lines) {
@@ -347,24 +347,24 @@ ZnMapInfoAddLine(ZnMapInfoId map_info,
static void
-ZnMapInfoReplaceLine(ZnMapInfoId map_info,
- unsigned int index,
- ZnPtr tag,
- ZnMapInfoLineStyle line_style,
- ZnDim line_width,
- ZnPos x_from,
- ZnPos y_from,
- ZnPos x_to,
- ZnPos y_to)
+ZnMapInfoReplaceLine(ZnMapInfoId map_info,
+ unsigned int index,
+ ZnPtr tag,
+ ZnMapInfoLineStyle line_style,
+ ZnDim line_width,
+ ZnPos x_from,
+ ZnPos y_from,
+ ZnPos x_to,
+ ZnPos y_to)
{
- ZnMapInfo cur_map = map_info;
- ZnMapInfoLine line_ptr;
+ ZnMapInfo cur_map = map_info;
+ ZnMapInfoLine line_ptr;
if (cur_map && cur_map->lines) {
line_ptr = ZnListAt(cur_map->lines, index);
if (line_ptr) {
if (line_ptr->style == ZnMapInfoLineMarked) {
- ZnFree(line_ptr->marks);
+ ZnFree(line_ptr->marks);
}
line_ptr->style = line_style;
@@ -381,7 +381,7 @@ ZnMapInfoReplaceLine(ZnMapInfoId map_info,
line_ptr->to.y = y_to;
if (line_ptr->style == ZnMapInfoLineMarked) {
- ComputeLineMarks(line_ptr);
+ ComputeLineMarks(line_ptr);
}
}
}
@@ -389,17 +389,17 @@ ZnMapInfoReplaceLine(ZnMapInfoId map_info,
static void
-ZnMapInfoRemoveLine(ZnMapInfoId map_info,
- unsigned int index)
+ZnMapInfoRemoveLine(ZnMapInfoId map_info,
+ unsigned int index)
{
- ZnMapInfo cur_map = map_info;
- ZnMapInfoLine line_ptr;
+ ZnMapInfo cur_map = map_info;
+ ZnMapInfoLine line_ptr;
if (cur_map && cur_map->lines) {
line_ptr = ZnListAt(cur_map->lines, index);
if (line_ptr) {
if (line_ptr->style == ZnMapInfoLineMarked) {
- ZnFree(line_ptr->marks);
+ ZnFree(line_ptr->marks);
}
ZnListDelete(cur_map->lines, index);
@@ -409,47 +409,47 @@ ZnMapInfoRemoveLine(ZnMapInfoId map_info,
void
-ZnMapInfoGetLine(ZnMapInfoId map_info,
- unsigned int index,
- ZnPtr *tag,
- ZnMapInfoLineStyle *line_style,
- ZnDim *line_width,
- ZnPos *x_from,
- ZnPos *y_from,
- ZnPos *x_to,
- ZnPos *y_to)
+ZnMapInfoGetLine(ZnMapInfoId map_info,
+ unsigned int index,
+ ZnPtr *tag,
+ ZnMapInfoLineStyle *line_style,
+ ZnDim *line_width,
+ ZnPos *x_from,
+ ZnPos *y_from,
+ ZnPos *x_to,
+ ZnPos *y_to)
{
- ZnMapInfo cur_map = map_info;
- ZnMapInfoLine line_ptr;
+ ZnMapInfo cur_map = map_info;
+ ZnMapInfoLine line_ptr;
if (cur_map && cur_map->lines) {
line_ptr = ZnListAt(cur_map->lines, index);
if (line_ptr) {
if (tag) {
- *tag = line_ptr->tag;
+ *tag = line_ptr->tag;
}
if (line_style) {
- *line_style = line_ptr->style;
+ *line_style = line_ptr->style;
}
if (line_width) {
if (line_ptr->width == 1.0) {
- *line_width = 0;
- }
+ *line_width = 0;
+ }
else {
- *line_width = line_ptr->width;
- }
+ *line_width = line_ptr->width;
+ }
}
if (x_from) {
- *x_from = line_ptr->from.x;
+ *x_from = line_ptr->from.x;
}
if (y_from) {
- *y_from = line_ptr->from.y;
+ *y_from = line_ptr->from.y;
}
if (x_to) {
- *x_to = line_ptr->to.x;
+ *x_to = line_ptr->to.x;
}
if (y_to) {
- *y_to = line_ptr->to.y;
+ *y_to = line_ptr->to.y;
}
}
}
@@ -457,22 +457,22 @@ ZnMapInfoGetLine(ZnMapInfoId map_info,
void
-ZnMapInfoGetMarks(ZnMapInfoId map_info,
- unsigned int index,
- ZnPoint **marks,
- unsigned int *num_marks)
+ZnMapInfoGetMarks(ZnMapInfoId map_info,
+ unsigned int index,
+ ZnPoint **marks,
+ unsigned int *num_marks)
{
- ZnMapInfo cur_map = map_info;
- ZnMapInfoLine line_ptr;
+ ZnMapInfo cur_map = map_info;
+ ZnMapInfoLine line_ptr;
if (cur_map && cur_map->lines) {
line_ptr = ZnListAt(cur_map->lines, index);
if (line_ptr && line_ptr->style == ZnMapInfoLineMarked) {
if (marks) {
- *marks = line_ptr->marks;
+ *marks = line_ptr->marks;
}
if (num_marks) {
- *num_marks = line_ptr->num_marks;
+ *num_marks = line_ptr->num_marks;
}
}
}
@@ -480,9 +480,9 @@ ZnMapInfoGetMarks(ZnMapInfoId map_info,
unsigned int
-ZnMapInfoNumLines(ZnMapInfoId map_info)
+ZnMapInfoNumLines(ZnMapInfoId map_info)
{
- ZnMapInfo cur_map = map_info;
+ ZnMapInfo cur_map = map_info;
if (cur_map && cur_map->lines) {
return ZnListSize(cur_map->lines);
@@ -494,15 +494,15 @@ ZnMapInfoNumLines(ZnMapInfoId map_info)
static void
-ZnMapInfoAddSymbol(ZnMapInfoId map_info,
- unsigned int index,
- ZnPtr tag,
- ZnPos x,
- ZnPos y,
- int symbol)
+ZnMapInfoAddSymbol(ZnMapInfoId map_info,
+ unsigned int index,
+ ZnPtr tag,
+ ZnPos x,
+ ZnPos y,
+ int symbol)
{
- ZnMapInfo cur_map = map_info;
- ZnMapInfoSymbolStruct symbol_struct;
+ ZnMapInfo cur_map = map_info;
+ ZnMapInfoSymbolStruct symbol_struct;
if (cur_map) {
if (!cur_map->symbols) {
@@ -521,15 +521,15 @@ ZnMapInfoAddSymbol(ZnMapInfoId map_info,
static void
-ZnMapInfoReplaceSymbol(ZnMapInfoId map_info,
- unsigned int index,
- ZnPtr tag,
- ZnPos x,
- ZnPos y,
- int symbol)
+ZnMapInfoReplaceSymbol(ZnMapInfoId map_info,
+ unsigned int index,
+ ZnPtr tag,
+ ZnPos x,
+ ZnPos y,
+ int symbol)
{
- ZnMapInfo cur_map = map_info;
- ZnMapInfoSymbolStruct symbol_struct;
+ ZnMapInfo cur_map = map_info;
+ ZnMapInfoSymbolStruct symbol_struct;
if (cur_map && cur_map->symbols) {
symbol_struct.tag = tag;
@@ -544,10 +544,10 @@ ZnMapInfoReplaceSymbol(ZnMapInfoId map_info,
static void
-ZnMapInfoRemoveSymbol(ZnMapInfoId map_info,
- unsigned int index)
+ZnMapInfoRemoveSymbol(ZnMapInfoId map_info,
+ unsigned int index)
{
- ZnMapInfo cur_map = map_info;
+ ZnMapInfo cur_map = map_info;
if (cur_map && cur_map->symbols) {
ZnListDelete(cur_map->symbols, index);
@@ -556,30 +556,30 @@ ZnMapInfoRemoveSymbol(ZnMapInfoId map_info,
void
-ZnMapInfoGetSymbol(ZnMapInfoId map_info,
- unsigned int index,
- ZnPtr *tag,
- ZnPos *x,
- ZnPos *y,
- char *symbol)
+ZnMapInfoGetSymbol(ZnMapInfoId map_info,
+ unsigned int index,
+ ZnPtr *tag,
+ ZnPos *x,
+ ZnPos *y,
+ char *symbol)
{
- ZnMapInfo cur_map = map_info;
+ ZnMapInfo cur_map = map_info;
ZnMapInfoSymbol symbol_ptr;
if (cur_map && cur_map->symbols) {
symbol_ptr = ZnListAt(cur_map->symbols, index);
if (symbol_ptr) {
if (tag) {
- *tag = symbol_ptr->tag;
+ *tag = symbol_ptr->tag;
}
if (x) {
- *x = symbol_ptr->at.x;
+ *x = symbol_ptr->at.x;
}
if (y) {
- *y = symbol_ptr->at.y;
+ *y = symbol_ptr->at.y;
}
if (symbol) {
- *symbol = symbol_ptr->symbol[0];
+ *symbol = symbol_ptr->symbol[0];
}
}
}
@@ -587,7 +587,7 @@ ZnMapInfoGetSymbol(ZnMapInfoId map_info,
unsigned int
-ZnMapInfoNumSymbols(ZnMapInfoId map_info)
+ZnMapInfoNumSymbols(ZnMapInfoId map_info)
{
ZnMapInfo cur_map = map_info;
@@ -601,29 +601,29 @@ ZnMapInfoNumSymbols(ZnMapInfoId map_info)
static void
-ZnMapInfoAddText(ZnMapInfoId map_info,
- unsigned int index,
- ZnPtr tag,
- ZnMapInfoTextStyle text_style,
- ZnMapInfoLineStyle line_style,
- ZnPos x,
- ZnPos y,
- char *text)
+ZnMapInfoAddText(ZnMapInfoId map_info,
+ unsigned int index,
+ ZnPtr tag,
+ ZnMapInfoTextStyle text_style,
+ ZnMapInfoLineStyle line_style,
+ ZnPos x,
+ ZnPos y,
+ char *text)
{
- ZnMapInfo cur_map = map_info;
- ZnMapInfoTextStruct text_struct;
+ ZnMapInfo cur_map = map_info;
+ ZnMapInfoTextStruct text_struct;
if (cur_map) {
if (!cur_map->texts) {
cur_map->texts = ZnListNew(16, sizeof(ZnMapInfoTextStruct));
}
- text_struct.tag = tag;
+ text_struct.tag = tag;
text_struct.text_style = text_style;
text_struct.line_style = NOT_MARKED_STYLE(line_style);
- text_struct.at.x = x;
- text_struct.at.y = y;
- text_struct.text = ZnMalloc(strlen(text) + 1);
+ text_struct.at.x = x;
+ text_struct.at.y = y;
+ text_struct.text = ZnMalloc(strlen(text) + 1);
strcpy(text_struct.text, text);
ZnListAdd(cur_map->texts, &text_struct, index);
@@ -632,29 +632,29 @@ ZnMapInfoAddText(ZnMapInfoId map_info,
static void
-ZnMapInfoReplaceText(ZnMapInfoId map_info,
- unsigned int index,
- ZnPtr tag,
- ZnMapInfoTextStyle text_style,
- ZnMapInfoLineStyle line_style,
- ZnPos x,
- ZnPos y,
- char *text)
+ZnMapInfoReplaceText(ZnMapInfoId map_info,
+ unsigned int index,
+ ZnPtr tag,
+ ZnMapInfoTextStyle text_style,
+ ZnMapInfoLineStyle line_style,
+ ZnPos x,
+ ZnPos y,
+ char *text)
{
- ZnMapInfo cur_map = map_info;
- ZnMapInfoText text_ptr;
+ ZnMapInfo cur_map = map_info;
+ ZnMapInfoText text_ptr;
if (cur_map && cur_map->texts) {
text_ptr = ZnListAt(cur_map->texts, index);
if (text_ptr) {
ZnFree(text_ptr->text);
- text_ptr->tag = tag;
+ text_ptr->tag = tag;
text_ptr->text_style = text_style;
text_ptr->line_style = NOT_MARKED_STYLE(line_style);
- text_ptr->at.x = x;
- text_ptr->at.y = y;
- text_ptr->text = ZnMalloc(strlen(text) + 1);
+ text_ptr->at.x = x;
+ text_ptr->at.y = y;
+ text_ptr->text = ZnMalloc(strlen(text) + 1);
strcpy(text_ptr->text, text);
}
}
@@ -662,11 +662,11 @@ ZnMapInfoReplaceText(ZnMapInfoId map_info,
static void
-ZnMapInfoRemoveText(ZnMapInfoId map_info,
- unsigned int index)
+ZnMapInfoRemoveText(ZnMapInfoId map_info,
+ unsigned int index)
{
- ZnMapInfo cur_map = map_info;
- ZnMapInfoText text_ptr;
+ ZnMapInfo cur_map = map_info;
+ ZnMapInfoText text_ptr;
if (cur_map && cur_map->texts) {
text_ptr = ZnListAt(cur_map->texts, index);
@@ -680,38 +680,38 @@ ZnMapInfoRemoveText(ZnMapInfoId map_info,
void
-ZnMapInfoGetText(ZnMapInfoId map_info,
- unsigned int index,
- ZnPtr *tag,
- ZnMapInfoTextStyle *text_style,
- ZnMapInfoLineStyle *line_style,
- ZnPos *x,
- ZnPos *y,
- char **text)
+ZnMapInfoGetText(ZnMapInfoId map_info,
+ unsigned int index,
+ ZnPtr *tag,
+ ZnMapInfoTextStyle *text_style,
+ ZnMapInfoLineStyle *line_style,
+ ZnPos *x,
+ ZnPos *y,
+ char **text)
{
- ZnMapInfo cur_map = map_info;
- ZnMapInfoText text_ptr;
+ ZnMapInfo cur_map = map_info;
+ ZnMapInfoText text_ptr;
if (cur_map && cur_map->texts) {
text_ptr = ZnListAt(cur_map->texts, index);
if (text_ptr) {
if (tag) {
- *tag = text_ptr->tag;
+ *tag = text_ptr->tag;
}
if (text_style) {
- *text_style = text_ptr->text_style;
+ *text_style = text_ptr->text_style;
}
if (line_style) {
- *line_style = text_ptr->line_style;
+ *line_style = text_ptr->line_style;
}
if (x) {
- *x = text_ptr->at.x;
+ *x = text_ptr->at.x;
}
if (y) {
- *y = text_ptr->at.y;
+ *y = text_ptr->at.y;
}
if (text) {
- *text = text_ptr->text;
+ *text = text_ptr->text;
}
}
}
@@ -719,7 +719,7 @@ ZnMapInfoGetText(ZnMapInfoId map_info,
unsigned int
-ZnMapInfoNumTexts(ZnMapInfoId map_info)
+ZnMapInfoNumTexts(ZnMapInfoId map_info)
{
ZnMapInfo cur_map = map_info;
@@ -733,19 +733,19 @@ ZnMapInfoNumTexts(ZnMapInfoId map_info)
static void
-ZnMapInfoAddArc(ZnMapInfoId map_info,
- unsigned int index,
- ZnPtr tag,
- ZnMapInfoLineStyle line_style,
- ZnDim line_width,
- ZnPos center_x,
- ZnPos center_y,
- ZnDim radius,
- ZnReal start_angle,
- ZnReal extend)
+ZnMapInfoAddArc(ZnMapInfoId map_info,
+ unsigned int index,
+ ZnPtr tag,
+ ZnMapInfoLineStyle line_style,
+ ZnDim line_width,
+ ZnPos center_x,
+ ZnPos center_y,
+ ZnDim radius,
+ ZnReal start_angle,
+ ZnReal extend)
{
- ZnMapInfo cur_map = map_info;
- ZnMapInfoArcStruct arc_struct;
+ ZnMapInfo cur_map = map_info;
+ ZnMapInfoArcStruct arc_struct;
if (cur_map) {
if (!cur_map->arcs) {
@@ -772,19 +772,19 @@ ZnMapInfoAddArc(ZnMapInfoId map_info,
static void
-ZnMapInfoReplaceArc(ZnMapInfoId map_info,
- unsigned int index,
- ZnPtr tag,
- ZnMapInfoLineStyle line_style,
- ZnDim line_width,
- ZnPos center_x,
- ZnPos center_y,
- ZnDim radius,
- ZnReal start_angle,
- ZnReal extend)
+ZnMapInfoReplaceArc(ZnMapInfoId map_info,
+ unsigned int index,
+ ZnPtr tag,
+ ZnMapInfoLineStyle line_style,
+ ZnDim line_width,
+ ZnPos center_x,
+ ZnPos center_y,
+ ZnDim radius,
+ ZnReal start_angle,
+ ZnReal extend)
{
- ZnMapInfo cur_map = map_info;
- ZnMapInfoArc arc_ptr;
+ ZnMapInfo cur_map = map_info;
+ ZnMapInfoArc arc_ptr;
if (cur_map && cur_map->arcs) {
arc_ptr = ZnListAt(cur_map->arcs, index);
@@ -808,11 +808,11 @@ ZnMapInfoReplaceArc(ZnMapInfoId map_info,
static void
-ZnMapInfoRemoveArc(ZnMapInfoId map_info,
- unsigned int index)
+ZnMapInfoRemoveArc(ZnMapInfoId map_info,
+ unsigned int index)
{
- ZnMapInfo cur_map = map_info;
- ZnMapInfoArc arc_ptr;
+ ZnMapInfo cur_map = map_info;
+ ZnMapInfoArc arc_ptr;
if (cur_map && cur_map->arcs) {
arc_ptr = ZnListAt(cur_map->arcs, index);
@@ -824,58 +824,58 @@ ZnMapInfoRemoveArc(ZnMapInfoId map_info,
void
-ZnMapInfoGetArc(ZnMapInfoId map_info,
- unsigned int index,
- ZnPtr *tag,
- ZnMapInfoLineStyle *line_style,
- ZnDim *line_width,
- ZnPos *center_x,
- ZnPos *center_y,
- ZnDim *radius,
- ZnReal *start_angle,
- ZnReal *extend)
+ZnMapInfoGetArc(ZnMapInfoId map_info,
+ unsigned int index,
+ ZnPtr *tag,
+ ZnMapInfoLineStyle *line_style,
+ ZnDim *line_width,
+ ZnPos *center_x,
+ ZnPos *center_y,
+ ZnDim *radius,
+ ZnReal *start_angle,
+ ZnReal *extend)
{
- ZnMapInfo cur_map = map_info;
- ZnMapInfoArc arc_ptr;
+ ZnMapInfo cur_map = map_info;
+ ZnMapInfoArc arc_ptr;
if (cur_map && cur_map->arcs) {
arc_ptr = ZnListAt(cur_map->arcs, index);
if (arc_ptr) {
if (tag) {
- *tag = arc_ptr->tag;
+ *tag = arc_ptr->tag;
}
if (line_style) {
- *line_style = arc_ptr->style;
+ *line_style = arc_ptr->style;
}
if (line_width) {
if (arc_ptr->width == 1.0) {
- *line_width = 0;
- }
+ *line_width = 0;
+ }
else {
- *line_width = arc_ptr->width;
- }
+ *line_width = arc_ptr->width;
+ }
}
if (center_x) {
- *center_x = arc_ptr->center.x;
+ *center_x = arc_ptr->center.x;
}
if (center_y) {
- *center_y = arc_ptr->center.y;
+ *center_y = arc_ptr->center.y;
}
if (radius) {
- *radius = arc_ptr->radius;
+ *radius = arc_ptr->radius;
}
if (start_angle) {
- *start_angle = arc_ptr->start_angle;
+ *start_angle = arc_ptr->start_angle;
}
if (extend) {
- *extend = arc_ptr->extend;
+ *extend = arc_ptr->extend;
}
}
}
}
unsigned int
-ZnMapInfoNumArcs(ZnMapInfoId map_info)
+ZnMapInfoNumArcs(ZnMapInfoId map_info)
{
ZnMapInfo cur_map = map_info;
@@ -888,15 +888,15 @@ ZnMapInfoNumArcs(ZnMapInfoId map_info)
}
static void
-ZnMapInfoScale(ZnMapInfoId map_info,
- ZnReal factor)
+ZnMapInfoScale(ZnMapInfoId map_info,
+ ZnReal factor)
{
- ZnMapInfo mp = map_info;
- int i, num;
- ZnMapInfoLine line_ptr;
+ ZnMapInfo mp = map_info;
+ int i, num;
+ ZnMapInfoLine line_ptr;
ZnMapInfoSymbol sym_ptr;
- ZnMapInfoText text_ptr;
- ZnMapInfoArc arc_ptr;
+ ZnMapInfoText text_ptr;
+ ZnMapInfoArc arc_ptr;
if (mp && mp->lines) {
num = ZnListSize(mp->lines);
@@ -936,16 +936,16 @@ ZnMapInfoScale(ZnMapInfoId map_info,
}
static void
-ZnMapInfoTranslate(ZnMapInfoId map_info,
- ZnPos x,
- ZnPos y)
+ZnMapInfoTranslate(ZnMapInfoId map_info,
+ ZnPos x,
+ ZnPos y)
{
- ZnMapInfo mp = map_info;
- int i, num;
- ZnMapInfoLine line_ptr;
+ ZnMapInfo mp = map_info;
+ int i, num;
+ ZnMapInfoLine line_ptr;
ZnMapInfoSymbol sym_ptr;
- ZnMapInfoText text_ptr;
- ZnMapInfoArc arc_ptr;
+ ZnMapInfoText text_ptr;
+ ZnMapInfoArc arc_ptr;
if (mp && mp->lines) {
num = ZnListSize(mp->lines);
@@ -985,7 +985,7 @@ ZnMapInfoTranslate(ZnMapInfoId map_info,
-#define TEXT_SIZE 256
+#define TEXT_SIZE 256
#define ntohi(n) ntohl((n))
/*
@@ -997,15 +997,15 @@ ZnMapInfoTranslate(ZnMapInfoId map_info,
*/
typedef struct {
- int id; /* Map id (internal) */
- int dashed; /* Tell if vectors are dashed (exclusive with marked) */
- int expanded; /* Device coordinates or world coordinates (ignored now) */
+ int id; /* Map id (internal) */
+ int dashed; /* Tell if vectors are dashed (exclusive with marked) */
+ int expanded; /* Device coordinates or world coordinates (ignored now) */
int marked; /* Tell if vectors are marked (exclusive with dashed) */
int color; /* drawing color (ignored now) */
- int elements[50]; /* Element type ('P', 'V', 'T') */
+ int elements[50]; /* Element type ('P', 'V', 'T') */
int x[50]; /* Coordinates if 'P' or 'V' */
int y[50];
- int symbol[50]; /* Filled if 'P' or 'V' */
+ int symbol[50]; /* Filled if 'P' or 'V' */
int text[50]; /* Low order byte is ascii char if 'T' */
int num_elements; /* Number of elements */
} VideoMap;
@@ -1047,117 +1047,117 @@ ReorderVidomap(VideoMap *vm)
*/
static void
-FillMap(ZnMapInfoId map,
- VideoMap *vm)
+FillMap(ZnMapInfoId map,
+ VideoMap *vm)
{
- int i;
- ZnBool has_start_pos = False;
- ZnPos x_cur=0, y_cur=0;
- char ch;
- ZnPos text_x=0, text_y=0;
- char text[TEXT_SIZE];
- ZnBool in_text = False;
- ZnBool in_mod_text = False;
- unsigned int text_size=0;
+ int i;
+ ZnBool has_start_pos = False;
+ ZnPos x_cur=0, y_cur=0;
+ char ch;
+ ZnPos text_x=0, text_y=0;
+ char text[TEXT_SIZE];
+ ZnBool in_text = False;
+ ZnBool in_mod_text = False;
+ unsigned int text_size=0;
for (i = 0; i < vm->num_elements; i++) {
switch(vm->elements[i] & 0xFF) {
case 'p':
case 'P':
if (in_text) {
- in_text = in_mod_text = False;
- while (text[text_size - 1] == ' ') {
- text_size--;
- }
- text[text_size] = (char) 0;
- ZnMapInfoAddText(map, ZnMapInfoNumTexts(map), NULL, ZnMapInfoNormalText,
- ZnMapInfoLineSimple, text_x, text_y, text);
+ in_text = in_mod_text = False;
+ while (text[text_size - 1] == ' ') {
+ text_size--;
+ }
+ text[text_size] = (char) 0;
+ ZnMapInfoAddText(map, ZnMapInfoNumTexts(map), NULL, ZnMapInfoNormalText,
+ ZnMapInfoLineSimple, text_x, text_y, text);
}
x_cur = (int) (short) vm->x[i];
y_cur = (int) (short) vm->y[i];
has_start_pos = True;
-
+
if (vm->symbol[i]) {
- ZnMapInfoAddSymbol(map, ZnMapInfoNumSymbols(map), NULL, x_cur, y_cur,
- (char) vm->symbol[i]);
+ ZnMapInfoAddSymbol(map, ZnMapInfoNumSymbols(map), NULL, x_cur, y_cur,
+ (char) vm->symbol[i]);
}
break;
/* We gather consecutive 'T' elements in a text. We skip
- leading and trailing spaces and mod texts (between '@'
- and now obsolete) */
+ leading and trailing spaces and mod texts (between '@'
+ and now obsolete) */
case 't':
case 'T':
if (!has_start_pos) {
- ZnWarning("Bogus map block, it has been discarded\n");
- return;
+ ZnWarning("Bogus map block, it has been discarded\n");
+ return;
}
if (in_text == False) {
- ch = (char) vm->text[i] & 0xFF;
- if (ch == '@') {
- if (in_mod_text == True) {
- in_mod_text = False;
- }
- else {
- in_mod_text = True;
- }
- }
- else if (in_mod_text == False) {
- in_text = True;
- text_size = 0;
- text_x = x_cur;
- text_y = y_cur;
- text[0] = (char) 0;
- }
+ ch = (char) vm->text[i] & 0xFF;
+ if (ch == '@') {
+ if (in_mod_text == True) {
+ in_mod_text = False;
+ }
+ else {
+ in_mod_text = True;
+ }
+ }
+ else if (in_mod_text == False) {
+ in_text = True;
+ text_size = 0;
+ text_x = x_cur;
+ text_y = y_cur;
+ text[0] = (char) 0;
+ }
}
if (in_text) {
- text[text_size] = (char) vm->text[i] & 0xFF;
- text_size++;
+ text[text_size] = (char) vm->text[i] & 0xFF;
+ text_size++;
}
break;
case 'v':
case 'V':
if (!has_start_pos) {
- ZnWarning("Bogus map block, it has been discarded\n");
- return;
+ ZnWarning("Bogus map block, it has been discarded\n");
+ return;
}
if (in_text) {
- in_text = in_mod_text = False;
- while (text[text_size - 1] == ' ') {
- text_size--;
- }
- text[text_size] = (char) 0;
- ZnMapInfoAddText(map, ZnMapInfoNumTexts(map), NULL, ZnMapInfoNormalText,
- ZnMapInfoLineSimple, text_x, text_y, text);
+ in_text = in_mod_text = False;
+ while (text[text_size - 1] == ' ') {
+ text_size--;
+ }
+ text[text_size] = (char) 0;
+ ZnMapInfoAddText(map, ZnMapInfoNumTexts(map), NULL, ZnMapInfoNormalText,
+ ZnMapInfoLineSimple, text_x, text_y, text);
}
- if (vm->dashed) {
- ZnMapInfoAddLine(map, ZnMapInfoNumLines(map), NULL, ZnMapInfoLineDashed,
- 0, x_cur, y_cur,
- (int) (short) vm->x[i], (int) (short) vm->y[i]);
+ if (vm->dashed) {
+ ZnMapInfoAddLine(map, ZnMapInfoNumLines(map), NULL, ZnMapInfoLineDashed,
+ 0, x_cur, y_cur,
+ (int) (short) vm->x[i], (int) (short) vm->y[i]);
}
else if (vm->marked) {
- ZnMapInfoAddLine(map, ZnMapInfoNumLines(map), NULL, ZnMapInfoLineMarked,
- 0, x_cur, y_cur,
- (int) (short) vm->x[i], (int) (short) vm->y[i]);
+ ZnMapInfoAddLine(map, ZnMapInfoNumLines(map), NULL, ZnMapInfoLineMarked,
+ 0, x_cur, y_cur,
+ (int) (short) vm->x[i], (int) (short) vm->y[i]);
}
else {
- ZnMapInfoAddLine(map, ZnMapInfoNumLines(map), NULL, ZnMapInfoLineSimple,
- 0, x_cur, y_cur,
- (int) (short) vm->x[i], (int) (short) vm->y[i]);
+ ZnMapInfoAddLine(map, ZnMapInfoNumLines(map), NULL, ZnMapInfoLineSimple,
+ 0, x_cur, y_cur,
+ (int) (short) vm->x[i], (int) (short) vm->y[i]);
}
x_cur = (int) (short) vm->x[i];
y_cur = (int) (short) vm->y[i];
if (vm->symbol[i]) {
- ZnMapInfoAddSymbol(map, ZnMapInfoNumSymbols(map), NULL, x_cur, y_cur,
- (char) vm->symbol[i]);
+ ZnMapInfoAddSymbol(map, ZnMapInfoNumSymbols(map), NULL, x_cur, y_cur,
+ (char) vm->symbol[i]);
}
break;
}
@@ -1170,7 +1170,7 @@ FillMap(ZnMapInfoId map,
}
text[text_size] = (char) 0;
ZnMapInfoAddText(map, ZnMapInfoNumTexts(map), NULL, ZnMapInfoNormalText,
- ZnMapInfoLineSimple, text_x, text_y, text);
+ ZnMapInfoLineSimple, text_x, text_y, text);
}
}
@@ -1178,20 +1178,20 @@ FillMap(ZnMapInfoId map,
*-----------------------------------------------------------------------
*
* ZnMapInfoGetVideomap - Load a mapinfo with the content of a videomap
- * file named 'filename'. Only the sub map 'index' will be loaded.
- * If successful a new mapinfo is returned, NULL otherwise. The
- * index is zero based.
+ * file named 'filename'. Only the sub map 'index' will be loaded.
+ * If successful a new mapinfo is returned, NULL otherwise. The
+ * index is zero based.
*
*-----------------------------------------------------------------------
*/
static int
-ZnMapInfoGetVideomap(ZnMapInfoId map,
- char *filename,
- unsigned int index)
+ZnMapInfoGetVideomap(ZnMapInfoId map,
+ char *filename,
+ unsigned int index)
{
- VideoMap current_vm;
- Tcl_Channel chan;
- unsigned int cur_index, cur_id;
+ VideoMap current_vm;
+ Tcl_Channel chan;
+ unsigned int cur_index, cur_id;
/* Open the specified map file. */
chan = Tcl_OpenFileChannel(NULL, filename, "r", 0);
@@ -1199,7 +1199,7 @@ ZnMapInfoGetVideomap(ZnMapInfoId map,
return TCL_ERROR;
}
if (Tcl_SetChannelOption(NULL, chan,
- "-translation", "binary") == TCL_ERROR) {
+ "-translation", "binary") == TCL_ERROR) {
return TCL_ERROR;
}
@@ -1208,13 +1208,13 @@ ZnMapInfoGetVideomap(ZnMapInfoId map,
/* First skip the leading maps up to index. */
cur_index = 0;
if (Tcl_Read(chan, (char *) &current_vm,
- sizeof(VideoMap)) != sizeof(VideoMap)) {
+ sizeof(VideoMap)) != sizeof(VideoMap)) {
goto error;
}
cur_id = ntohi((unsigned int) current_vm.id);
while (cur_index != index) {
if (Tcl_Read(chan, (char *) &current_vm,
- sizeof(VideoMap)) != sizeof(VideoMap)) {
+ sizeof(VideoMap)) != sizeof(VideoMap)) {
goto error;
}
if (cur_id != ntohi((unsigned int) current_vm.id)) {
@@ -1228,13 +1228,13 @@ ZnMapInfoGetVideomap(ZnMapInfoId map,
ReorderVidomap(&current_vm);
FillMap(map, &current_vm);
if ((Tcl_Read(chan, (char *) &current_vm,
- sizeof(VideoMap)) != sizeof(VideoMap)) &&
- !Tcl_Eof(chan)) {
+ sizeof(VideoMap)) != sizeof(VideoMap)) &&
+ !Tcl_Eof(chan)) {
goto error;
}
}
while ((cur_id == ntohi((unsigned int) current_vm.id)) &&
- !Tcl_Eof(chan));
+ !Tcl_Eof(chan));
Tcl_Close(NULL, chan);
return TCL_OK;
@@ -1248,20 +1248,20 @@ ZnMapInfoGetVideomap(ZnMapInfoId map,
*-----------------------------------------------------------------------
*
* ZnMapInfoVideomapIds - Return the list of sub map ids contained in a
- * videomap file. This makes it possible to iterate through such
- * a file without stumbling on an error, to know how much maps
- * are there and to sort them according to their ids.
+ * videomap file. This makes it possible to iterate through such
+ * a file without stumbling on an error, to know how much maps
+ * are there and to sort them according to their ids.
*
*-----------------------------------------------------------------------
*/
static ZnList
-ZnMapInfoVideomapIds(char *filename)
+ZnMapInfoVideomapIds(char *filename)
{
- Tcl_Channel chan;
- VideoMap current_vm;
- unsigned int cur_id;
- ZnList ids;
+ Tcl_Channel chan;
+ VideoMap current_vm;
+ unsigned int cur_id;
+ ZnList ids;
/* Open the specified map file. */
chan = Tcl_OpenFileChannel(NULL, filename, "r", 0);
@@ -1269,12 +1269,12 @@ ZnMapInfoVideomapIds(char *filename)
return NULL;
}
if (Tcl_SetChannelOption(NULL, chan,
- "-translation", "binary") == TCL_ERROR) {
+ "-translation", "binary") == TCL_ERROR) {
return NULL;
}
if (Tcl_Read(chan, (char *) &current_vm,
- sizeof(VideoMap)) != sizeof(VideoMap)) {
+ sizeof(VideoMap)) != sizeof(VideoMap)) {
error:
Tcl_Close(NULL, chan);
return NULL;
@@ -1286,7 +1286,7 @@ ZnMapInfoVideomapIds(char *filename)
do {
if (Tcl_Read(chan, (char *) &current_vm,
- sizeof(VideoMap)) != sizeof(VideoMap)) {
+ sizeof(VideoMap)) != sizeof(VideoMap)) {
ZnListFree(ids);
goto error;
}
@@ -1311,18 +1311,18 @@ ZnMapInfoVideomapIds(char *filename)
*--------------------------------------------------------------------------
*/
-static Tcl_HashTable mapInfoTable;
-static ZnBool map_info_inited = False;
+static Tcl_HashTable mapInfoTable;
+static ZnBool map_info_inited = False;
typedef struct {
- ClientData client_data;
- ZnMapInfoChangeProc proc;
+ ClientData client_data;
+ ZnMapInfoChangeProc proc;
} ZnMapInfoClient;
typedef struct {
- ZnMapInfoId map_info;
- ZnBool deleted;
- ZnList clients;
+ ZnMapInfoId map_info;
+ ZnBool deleted;
+ ZnList clients;
} ZnMapInfoMaster;
static void
@@ -1334,9 +1334,9 @@ ZnMapInfoInit()
}
static void
-UpdateMapInfoClients(ZnMapInfoMaster *master)
+UpdateMapInfoClients(ZnMapInfoMaster *master)
{
- int i, num;
+ int i, num;
ZnMapInfoClient *client;
num = ZnListSize(master->clients);
@@ -1347,13 +1347,13 @@ UpdateMapInfoClients(ZnMapInfoMaster *master)
}
static int
-ZnCreateMapInfo(Tcl_Interp *interp,
- char *name,
- ZnMapInfoId *map_info)
+ZnCreateMapInfo(Tcl_Interp *interp,
+ char *name,
+ ZnMapInfoId *map_info)
{
- Tk_Uid uid = Tk_GetUid(name);
- Tcl_HashEntry *entry;
- int new;
+ Tk_Uid uid = Tk_GetUid(name);
+ Tcl_HashEntry *entry;
+ int new;
ZnMapInfoMaster *master;
if (!map_info_inited) {
@@ -1388,13 +1388,13 @@ ZnCreateMapInfo(Tcl_Interp *interp,
}
static int
-ZnDuplicateZnMapInfo(Tcl_Interp *interp,
- char *name,
- ZnMapInfoId map_info)
+ZnDuplicateZnMapInfo(Tcl_Interp *interp,
+ char *name,
+ ZnMapInfoId map_info)
{
- Tk_Uid uid = Tk_GetUid(name);
- Tcl_HashEntry *entry;
- int new;
+ Tk_Uid uid = Tk_GetUid(name);
+ Tcl_HashEntry *entry;
+ int new;
ZnMapInfoMaster *master;
if (!map_info_inited) {
@@ -1416,11 +1416,11 @@ ZnDuplicateZnMapInfo(Tcl_Interp *interp,
}
static ZnMapInfoMaster *
-LookupMapInfoMaster(Tcl_Interp *interp,
- char *name)
+LookupMapInfoMaster(Tcl_Interp *interp,
+ char *name)
{
- Tk_Uid uid = Tk_GetUid(name);
- Tcl_HashEntry *entry;
+ Tk_Uid uid = Tk_GetUid(name);
+ Tcl_HashEntry *entry;
ZnMapInfoMaster *master;
if (!map_info_inited) {
@@ -1441,12 +1441,12 @@ LookupMapInfoMaster(Tcl_Interp *interp,
}
static int
-ZnDeleteMapInfo(Tcl_Interp *interp,
- char *name)
+ZnDeleteMapInfo(Tcl_Interp *interp,
+ char *name)
{
ZnMapInfoMaster *master;
- Tk_Uid uid = Tk_GetUid(name);
- Tcl_HashEntry *entry;
+ Tk_Uid uid = Tk_GetUid(name);
+ Tcl_HashEntry *entry;
if (!map_info_inited) {
ZnMapInfoInit();
@@ -1474,13 +1474,13 @@ ZnDeleteMapInfo(Tcl_Interp *interp,
}
ZnMapInfoId
-ZnGetMapInfo(Tcl_Interp *interp,
- char *name,
- ZnMapInfoChangeProc proc,
- ClientData client_data)
+ZnGetMapInfo(Tcl_Interp *interp,
+ char *name,
+ ZnMapInfoChangeProc proc,
+ ClientData client_data)
{
- ZnMapInfoMaster *master;
- ZnMapInfoClient client;
+ ZnMapInfoMaster *master;
+ ZnMapInfoClient client;
master = LookupMapInfoMaster(interp, name);
if (master == NULL) {
@@ -1494,15 +1494,15 @@ ZnGetMapInfo(Tcl_Interp *interp,
}
void
-ZnFreeMapInfo(ZnMapInfoId map_info,
- ZnMapInfoChangeProc proc,
- ClientData client_data)
+ZnFreeMapInfo(ZnMapInfoId map_info,
+ ZnMapInfoChangeProc proc,
+ ClientData client_data)
{
- Tk_Uid uid = Tk_GetUid(ZnMapInfoName(map_info));
- Tcl_HashEntry *entry;
+ Tk_Uid uid = Tk_GetUid(ZnMapInfoName(map_info));
+ Tcl_HashEntry *entry;
ZnMapInfoMaster *master;
ZnMapInfoClient *client;
- unsigned int num, i;
+ unsigned int num, i;
if (!map_info_inited) {
ZnMapInfoInit();
@@ -1517,7 +1517,7 @@ ZnFreeMapInfo(ZnMapInfoId map_info,
num = ZnListSize(master->clients);
for (i = 0; i < num; i++, client++) {
if ((client->client_data == client_data) &&
- (client->proc == proc)) {
+ (client->proc == proc)) {
ZnListDelete(master->clients, i);
return;
}
@@ -1525,10 +1525,10 @@ ZnFreeMapInfo(ZnMapInfoId map_info,
}
static void
-ZnUpdateMapInfoClients(ZnMapInfoId map_info)
+ZnUpdateMapInfoClients(ZnMapInfoId map_info)
{
- Tk_Uid uid = Tk_GetUid(ZnMapInfoName(map_info));
- Tcl_HashEntry *entry;
+ Tk_Uid uid = Tk_GetUid(ZnMapInfoName(map_info));
+ Tcl_HashEntry *entry;
ZnMapInfoMaster *master;
if (!map_info_inited) {
@@ -1562,17 +1562,17 @@ static char *text_style_strings[] = {
};
static char *
-ZnMapInfoLineStyleToString(ZnMapInfoLineStyle line_style)
+ZnMapInfoLineStyleToString(ZnMapInfoLineStyle line_style)
{
return line_style_strings[line_style];
}
static int
-ZnMapInfoLineStyleFromString(Tcl_Interp *interp,
- char *str,
- ZnMapInfoLineStyle *line_style)
+ZnMapInfoLineStyleFromString(Tcl_Interp *interp,
+ char *str,
+ ZnMapInfoLineStyle *line_style)
{
- int i, num = sizeof(line_style_strings)/sizeof(char *);
+ int i, num = sizeof(line_style_strings)/sizeof(char *);
for (i = 0; i < num; i++) {
if (strcmp(str, line_style_strings[i]) == 0) {
@@ -1581,22 +1581,22 @@ ZnMapInfoLineStyleFromString(Tcl_Interp *interp,
}
}
Tcl_AppendResult(interp, " incorrect mapinfo line style \"",
- str,"\"", NULL);
+ str,"\"", NULL);
return TCL_ERROR;
}
static char *
-ZnMapInfoTextStyleToString(ZnMapInfoTextStyle text_style)
+ZnMapInfoTextStyleToString(ZnMapInfoTextStyle text_style)
{
return text_style_strings[text_style];
}
static int
-ZnMapInfoTextStyleFromString(Tcl_Interp *interp,
- char *str,
- ZnMapInfoTextStyle *text_style)
+ZnMapInfoTextStyleFromString(Tcl_Interp *interp,
+ char *str,
+ ZnMapInfoTextStyle *text_style)
{
- int i, num = sizeof(text_style_strings)/sizeof(char *);
+ int i, num = sizeof(text_style_strings)/sizeof(char *);
for (i = 0; i < num; i++) {
if (strcmp(str, text_style_strings[i]) == 0) {
@@ -1605,20 +1605,20 @@ ZnMapInfoTextStyleFromString(Tcl_Interp *interp,
}
}
Tcl_AppendResult(interp, " incorrect mapinfo text style \"",
- str,"\"", NULL);
+ str,"\"", NULL);
return TCL_ERROR;
}
int
-ZnMapInfoObjCmd(ClientData client_data,
- Tcl_Interp *interp, /* Current interpreter. */
- int argc, /* Number of arguments. */
- Tcl_Obj *CONST args[])
+ZnMapInfoObjCmd(ClientData client_data,
+ Tcl_Interp *interp, /* Current interpreter. */
+ int argc, /* Number of arguments. */
+ Tcl_Obj *CONST args[])
{
- ZnPos x, y;
- int index, index2, result;
+ ZnPos x, y;
+ int index, index2, result;
ZnMapInfoMaster *master;
- Tcl_Obj *l;
+ Tcl_Obj *l;
#ifdef PTK_800
static char *sub_cmd_strings[] =
#else
@@ -1636,11 +1636,11 @@ ZnMapInfoObjCmd(ClientData client_data,
{
"arc", "line", "symbol", "text", NULL
};
- enum sub_cmds {
+ enum sub_cmds {
ZN_MI_ADD, ZN_MI_COUNT, ZN_MI_CREATE, ZN_MI_DELETE, ZN_MI_DUPLICATE,
ZN_MI_GET, ZN_MI_REMOVE, ZN_MI_REPLACE, ZN_MI_SCALE, ZN_MI_TRANSLATE
};
- enum e_types {
+ enum e_types {
ZN_E_ARC, ZN_E_LINE, ZN_E_SYMBOL, ZN_E_TEXT
};
@@ -1651,7 +1651,7 @@ ZnMapInfoObjCmd(ClientData client_data,
}
if (Tcl_GetIndexFromObj(interp, args[2], sub_cmd_strings,
- "subCmd", 0, &index) != TCL_OK) {
+ "subCmd", 0, &index) != TCL_OK) {
return TCL_ERROR;
}
result = TCL_OK;
@@ -1665,11 +1665,11 @@ ZnMapInfoObjCmd(ClientData client_data,
case ZN_MI_CREATE:
{
if (argc != 3) {
- Tcl_WrongNumArgs(interp, 1, args, "name create");
- return TCL_ERROR;
+ Tcl_WrongNumArgs(interp, 1, args, "name create");
+ return TCL_ERROR;
}
if (ZnCreateMapInfo(interp, Tcl_GetString(args[1]), NULL) == TCL_ERROR) {
- return TCL_ERROR;
+ return TCL_ERROR;
}
}
break;
@@ -1679,11 +1679,11 @@ ZnMapInfoObjCmd(ClientData client_data,
case ZN_MI_DELETE:
{
if (argc != 3) {
- Tcl_WrongNumArgs(interp, 1, args, "mapInfo delete");
- return TCL_ERROR;
+ Tcl_WrongNumArgs(interp, 1, args, "mapInfo delete");
+ return TCL_ERROR;
}
if (ZnDeleteMapInfo(interp, Tcl_GetString(args[1])) == TCL_ERROR) {
- return TCL_ERROR;
+ return TCL_ERROR;
}
}
break;
@@ -1693,16 +1693,16 @@ ZnMapInfoObjCmd(ClientData client_data,
case ZN_MI_DUPLICATE:
{
if (argc != 4) {
- Tcl_WrongNumArgs(interp, 1, args, "mapInfo duplicate name");
- return TCL_ERROR;
+ Tcl_WrongNumArgs(interp, 1, args, "mapInfo duplicate name");
+ return TCL_ERROR;
}
master = LookupMapInfoMaster(interp, Tcl_GetString(args[1]));
if (master == NULL) {
- return TCL_ERROR;
+ return TCL_ERROR;
}
if (ZnDuplicateZnMapInfo(interp, Tcl_GetString(args[3]),
- master->map_info) == TCL_ERROR) {
- return TCL_ERROR;
+ master->map_info) == TCL_ERROR) {
+ return TCL_ERROR;
}
}
break;
@@ -1714,153 +1714,153 @@ ZnMapInfoObjCmd(ClientData client_data,
{
ZnMapInfoLineStyle line_style;
ZnMapInfoTextStyle text_style;
- int i, insert, val;
- ZnPos coords[6];
- ZnBool add_cmd = (enum sub_cmds) index == ZN_MI_ADD;
- int num_param = add_cmd ? 4 : 5;
+ int i, insert, val;
+ ZnPos coords[6];
+ ZnBool add_cmd = (enum sub_cmds) index == ZN_MI_ADD;
+ int num_param = add_cmd ? 4 : 5;
if (argc < num_param) {
- Tcl_WrongNumArgs(interp, 3, args,
- add_cmd ? "elementType ?args?" : "elementType index ?args?");
- return TCL_ERROR;
+ Tcl_WrongNumArgs(interp, 3, args,
+ add_cmd ? "elementType ?args?" : "elementType index ?args?");
+ return TCL_ERROR;
}
master = LookupMapInfoMaster(interp, Tcl_GetString(args[1]));
if (master == NULL) {
- return TCL_ERROR;
+ return TCL_ERROR;
}
if (!add_cmd) {
- if (Tcl_GetIntFromObj(interp, args[4], &insert) == TCL_ERROR) {
- return TCL_ERROR;
- }
+ if (Tcl_GetIntFromObj(interp, args[4], &insert) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
}
if (Tcl_GetIndexFromObj(interp, args[3], e_type_strings,
- "elementType", 0, &index2) != TCL_OK) {
- return TCL_ERROR;
+ "elementType", 0, &index2) != TCL_OK) {
+ return TCL_ERROR;
}
switch ((enum e_types) index2) {
case ZN_E_LINE:
- {
- if (argc != (num_param+6)) {
- Tcl_WrongNumArgs(interp, 4, args,
- add_cmd ? "style width x1 y1 x2 y2" : "index style width x1 y1 x2 y2");
- return TCL_ERROR;
- }
- if (ZnMapInfoLineStyleFromString(interp, Tcl_GetString(args[num_param]),
- &line_style) == TCL_ERROR) {
- return TCL_ERROR;
- }
- for (i = 0; i < 5; i++) {
- if (Tcl_GetDoubleFromObj(interp, args[num_param+i+1], &coords[i]) == TCL_ERROR) {
- return TCL_ERROR;
- }
- }
- if (coords[0] < 0) {
- coords[0] = 0;
- }
- if (add_cmd) {
- ZnMapInfoAddLine(master->map_info, ZnListTail, NULL, line_style,
- coords[0], coords[1], coords[2], coords[3], coords[4]);
- }
- else {
- ZnMapInfoReplaceLine(master->map_info, insert, NULL, line_style,
- coords[0], coords[1], coords[2], coords[3], coords[4]);
- }
- }
- break;
+ {
+ if (argc != (num_param+6)) {
+ Tcl_WrongNumArgs(interp, 4, args,
+ add_cmd ? "style width x1 y1 x2 y2" : "index style width x1 y1 x2 y2");
+ return TCL_ERROR;
+ }
+ if (ZnMapInfoLineStyleFromString(interp, Tcl_GetString(args[num_param]),
+ &line_style) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+ for (i = 0; i < 5; i++) {
+ if (Tcl_GetDoubleFromObj(interp, args[num_param+i+1], &coords[i]) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+ }
+ if (coords[0] < 0) {
+ coords[0] = 0;
+ }
+ if (add_cmd) {
+ ZnMapInfoAddLine(master->map_info, ZnListTail, NULL, line_style,
+ coords[0], coords[1], coords[2], coords[3], coords[4]);
+ }
+ else {
+ ZnMapInfoReplaceLine(master->map_info, insert, NULL, line_style,
+ coords[0], coords[1], coords[2], coords[3], coords[4]);
+ }
+ }
+ break;
case ZN_E_SYMBOL:
- {
- if (argc != (num_param+3)) {
- Tcl_WrongNumArgs(interp, 4, args,
- add_cmd ? "x y intVal" : "index x y intVal");
- return TCL_ERROR;
- }
- for (i = 0; i < 2; i++) {
- if (Tcl_GetDoubleFromObj(interp, args[num_param+i], &coords[i]) == TCL_ERROR) {
- return TCL_ERROR;
- }
- }
- if (Tcl_GetIntFromObj(interp, args[num_param+2], &val) == TCL_ERROR) {
- return TCL_ERROR;
- }
- if (val < 0) {
- val = 0;
- }
- if (add_cmd) {
- ZnMapInfoAddSymbol(master->map_info, ZnListTail, NULL, coords[0],
- coords[1], (char) val);
- }
- else {
- ZnMapInfoReplaceSymbol(master->map_info, insert, NULL, coords[0],
- coords[1], (char) val);
- }
- }
- break;
+ {
+ if (argc != (num_param+3)) {
+ Tcl_WrongNumArgs(interp, 4, args,
+ add_cmd ? "x y intVal" : "index x y intVal");
+ return TCL_ERROR;
+ }
+ for (i = 0; i < 2; i++) {
+ if (Tcl_GetDoubleFromObj(interp, args[num_param+i], &coords[i]) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+ }
+ if (Tcl_GetIntFromObj(interp, args[num_param+2], &val) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+ if (val < 0) {
+ val = 0;
+ }
+ if (add_cmd) {
+ ZnMapInfoAddSymbol(master->map_info, ZnListTail, NULL, coords[0],
+ coords[1], (char) val);
+ }
+ else {
+ ZnMapInfoReplaceSymbol(master->map_info, insert, NULL, coords[0],
+ coords[1], (char) val);
+ }
+ }
+ break;
case ZN_E_TEXT:
- {
- if (argc != (num_param+5)) {
- Tcl_WrongNumArgs(interp, 4, args,
- add_cmd ? "textStyle lineStyle x y string" : "index textStyle lineStyle x y string");
- return TCL_ERROR;
- }
- if (ZnMapInfoTextStyleFromString(interp, Tcl_GetString(args[num_param]),
- &text_style) == TCL_ERROR) {
- return TCL_ERROR;
- }
- if (ZnMapInfoLineStyleFromString(interp, Tcl_GetString(args[num_param+1]),
- &line_style) == TCL_ERROR) {
- return TCL_ERROR;
- }
- for (i = 0; i < 2; i++) {
- if (Tcl_GetDoubleFromObj(interp, args[num_param+i+2], &coords[i]) == TCL_ERROR) {
- return TCL_ERROR;
- }
- }
- if (add_cmd) {
- ZnMapInfoAddText(master->map_info, ZnListTail, NULL, text_style,
- line_style, coords[0], coords[1],
- Tcl_GetString(args[num_param+4]));
- }
- else {
- /*printf("replace text ts %d ls %d %g %g %s\n", text_style,
- line_style, coords[0], coords[1], Tcl_GetString(args[num_param+4]));*/
- ZnMapInfoReplaceText(master->map_info, insert, NULL, text_style,
- line_style, coords[0], coords[1],
- Tcl_GetString(args[num_param+4]));
- }
- }
- break;
+ {
+ if (argc != (num_param+5)) {
+ Tcl_WrongNumArgs(interp, 4, args,
+ add_cmd ? "textStyle lineStyle x y string" : "index textStyle lineStyle x y string");
+ return TCL_ERROR;
+ }
+ if (ZnMapInfoTextStyleFromString(interp, Tcl_GetString(args[num_param]),
+ &text_style) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+ if (ZnMapInfoLineStyleFromString(interp, Tcl_GetString(args[num_param+1]),
+ &line_style) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+ for (i = 0; i < 2; i++) {
+ if (Tcl_GetDoubleFromObj(interp, args[num_param+i+2], &coords[i]) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+ }
+ if (add_cmd) {
+ ZnMapInfoAddText(master->map_info, ZnListTail, NULL, text_style,
+ line_style, coords[0], coords[1],
+ Tcl_GetString(args[num_param+4]));
+ }
+ else {
+ /*printf("replace text ts %d ls %d %g %g %s\n", text_style,
+ line_style, coords[0], coords[1], Tcl_GetString(args[num_param+4]));*/
+ ZnMapInfoReplaceText(master->map_info, insert, NULL, text_style,
+ line_style, coords[0], coords[1],
+ Tcl_GetString(args[num_param+4]));
+ }
+ }
+ break;
case ZN_E_ARC:
- {
- if (argc != (num_param+7)) {
- Tcl_WrongNumArgs(interp, 4, args,
- add_cmd ? "style width cx cy radius start extent" : "index style width cx cy radius start extent");
- return TCL_ERROR;
- }
- if (ZnMapInfoLineStyleFromString(interp, Tcl_GetString(args[num_param]),
- &line_style) == TCL_ERROR) {
- return TCL_ERROR;
- }
- for (i = 0; i < 6; i++) {
- if (Tcl_GetDoubleFromObj(interp, args[num_param+i+1], &coords[i]) == TCL_ERROR) {
- return TCL_ERROR;
- }
- }
- if (coords[0] < 0) {
- coords[0] = 0;
- }
- if (coords[3] < 0) {
- coords[3] = 0;
- }
- if (add_cmd) {
- ZnMapInfoAddArc(master->map_info, ZnListTail, NULL, line_style, coords[0],
- coords[1], coords[2], coords[3], coords[4], coords[5]);
- }
- else {
- ZnMapInfoReplaceArc(master->map_info, insert, NULL, line_style, coords[0],
- coords[1], coords[2], coords[3], coords[4], coords[5]);
- }
- }
- break;
+ {
+ if (argc != (num_param+7)) {
+ Tcl_WrongNumArgs(interp, 4, args,
+ add_cmd ? "style width cx cy radius start extent" : "index style width cx cy radius start extent");
+ return TCL_ERROR;
+ }
+ if (ZnMapInfoLineStyleFromString(interp, Tcl_GetString(args[num_param]),
+ &line_style) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+ for (i = 0; i < 6; i++) {
+ if (Tcl_GetDoubleFromObj(interp, args[num_param+i+1], &coords[i]) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+ }
+ if (coords[0] < 0) {
+ coords[0] = 0;
+ }
+ if (coords[3] < 0) {
+ coords[3] = 0;
+ }
+ if (add_cmd) {
+ ZnMapInfoAddArc(master->map_info, ZnListTail, NULL, line_style, coords[0],
+ coords[1], coords[2], coords[3], coords[4], coords[5]);
+ }
+ else {
+ ZnMapInfoReplaceArc(master->map_info, insert, NULL, line_style, coords[0],
+ coords[1], coords[2], coords[3], coords[4], coords[5]);
+ }
+ }
+ break;
}
UpdateMapInfoClients(master);
}
@@ -1870,32 +1870,32 @@ ZnMapInfoObjCmd(ClientData client_data,
*/
case ZN_MI_COUNT:
{
- int count = 0;
+ int count = 0;
if (argc != 4) {
- Tcl_WrongNumArgs(interp, 1, args, "mapInfo count type");
- return TCL_ERROR;
+ Tcl_WrongNumArgs(interp, 1, args, "mapInfo count type");
+ return TCL_ERROR;
}
master = LookupMapInfoMaster(interp, Tcl_GetString(args[1]));
if (master == NULL) {
- return TCL_ERROR;
+ return TCL_ERROR;
}
if (Tcl_GetIndexFromObj(interp, args[3], e_type_strings,
- "elementType", 0, &index2) != TCL_OK) {
- return TCL_ERROR;
+ "elementType", 0, &index2) != TCL_OK) {
+ return TCL_ERROR;
}
switch ((enum e_types) index2) {
case ZN_E_LINE:
- count = ZnMapInfoNumLines(master->map_info);
- break;
+ count = ZnMapInfoNumLines(master->map_info);
+ break;
case ZN_E_SYMBOL:
- count = ZnMapInfoNumSymbols(master->map_info);
- break;
+ count = ZnMapInfoNumSymbols(master->map_info);
+ break;
case ZN_E_TEXT:
- count = ZnMapInfoNumTexts(master->map_info);
- break;
+ count = ZnMapInfoNumTexts(master->map_info);
+ break;
case ZN_E_ARC:
- count = ZnMapInfoNumArcs(master->map_info);
- break;
+ count = ZnMapInfoNumArcs(master->map_info);
+ break;
}
l = Tcl_NewIntObj(count);
Tcl_SetObjResult(interp, l);
@@ -1909,82 +1909,82 @@ ZnMapInfoObjCmd(ClientData client_data,
int insert;
if (argc != 5) {
- Tcl_WrongNumArgs(interp, 1, args, "mapInfo get type index");
- return TCL_ERROR;
+ Tcl_WrongNumArgs(interp, 1, args, "mapInfo get type index");
+ return TCL_ERROR;
}
master = LookupMapInfoMaster(interp, Tcl_GetString(args[1]));
if (master == NULL) {
- return TCL_ERROR;
+ return TCL_ERROR;
}
if (Tcl_GetIntFromObj(interp, args[4], &insert) == TCL_ERROR) {
- return TCL_ERROR;
+ return TCL_ERROR;
}
if (insert < 0) {
- insert = 0;
+ insert = 0;
}
if (Tcl_GetIndexFromObj(interp, args[3], e_type_strings,
- "elementType", 0, &index2) != TCL_OK) {
- return TCL_ERROR;
+ "elementType", 0, &index2) != TCL_OK) {
+ return TCL_ERROR;
}
switch ((enum e_types) index2) {
case ZN_E_LINE:
- {
- ZnMapInfoLineStyle line_style;
- ZnDim line_width;
- ZnPos x_to, y_to;
- ZnMapInfoGetLine(master->map_info, insert, NULL, &line_style,
- &line_width, &x, &y, &x_to, &y_to);
- l = Tcl_GetObjResult(interp);
- Tcl_ListObjAppendElement(interp, l, Tcl_NewStringObj(ZnMapInfoLineStyleToString(line_style), -1));
- Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(line_width));
- Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(x));
- Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(y));
- Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(x_to));
- Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(y_to));
- }
- break;
+ {
+ ZnMapInfoLineStyle line_style;
+ ZnDim line_width;
+ ZnPos x_to, y_to;
+ ZnMapInfoGetLine(master->map_info, insert, NULL, &line_style,
+ &line_width, &x, &y, &x_to, &y_to);
+ l = Tcl_GetObjResult(interp);
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewStringObj(ZnMapInfoLineStyleToString(line_style), -1));
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(line_width));
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(x));
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(y));
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(x_to));
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(y_to));
+ }
+ break;
case ZN_E_SYMBOL:
- {
- char symbol;
- ZnMapInfoGetSymbol(master->map_info, insert, NULL, &x, &y, &symbol);
- l = Tcl_GetObjResult(interp);
- Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(x));
- Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(y));
- Tcl_ListObjAppendElement(interp, l, Tcl_NewIntObj(symbol));
- }
- break;
+ {
+ char symbol;
+ ZnMapInfoGetSymbol(master->map_info, insert, NULL, &x, &y, &symbol);
+ l = Tcl_GetObjResult(interp);
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(x));
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(y));
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewIntObj(symbol));
+ }
+ break;
case ZN_E_TEXT:
- {
- char *text;
- ZnMapInfoTextStyle text_style;
- ZnMapInfoLineStyle line_style;
- ZnMapInfoGetText(master->map_info, insert, NULL, &text_style, &line_style,
- &x, &y, &text);
- l = Tcl_GetObjResult(interp);
- Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(x));
- Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(y));
- Tcl_ListObjAppendElement(interp, l, Tcl_NewStringObj(ZnMapInfoTextStyleToString(text_style), -1));
- Tcl_ListObjAppendElement(interp, l, Tcl_NewStringObj(ZnMapInfoLineStyleToString(line_style), -1));
- Tcl_ListObjAppendElement(interp, l, Tcl_NewStringObj(text, -1));
- }
- break;
+ {
+ char *text;
+ ZnMapInfoTextStyle text_style;
+ ZnMapInfoLineStyle line_style;
+ ZnMapInfoGetText(master->map_info, insert, NULL, &text_style, &line_style,
+ &x, &y, &text);
+ l = Tcl_GetObjResult(interp);
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(x));
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(y));
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewStringObj(ZnMapInfoTextStyleToString(text_style), -1));
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewStringObj(ZnMapInfoLineStyleToString(line_style), -1));
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewStringObj(text, -1));
+ }
+ break;
case ZN_E_ARC:
- {
- ZnMapInfoLineStyle line_style;
- ZnDim line_width, radius;
- ZnPos start, extent;
- ZnMapInfoGetArc(master->map_info, insert, NULL, &line_style, &line_width,
- &x, &y, &radius, &start, &extent);
- l = Tcl_GetObjResult(interp);
- Tcl_ListObjAppendElement(interp, l, Tcl_NewStringObj(ZnMapInfoLineStyleToString(line_style), -1));
- Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(line_width));
- Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(x));
- Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(y));
- Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(radius));
- Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(start));
- Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(extent));
- }
- break;
+ {
+ ZnMapInfoLineStyle line_style;
+ ZnDim line_width, radius;
+ ZnPos start, extent;
+ ZnMapInfoGetArc(master->map_info, insert, NULL, &line_style, &line_width,
+ &x, &y, &radius, &start, &extent);
+ l = Tcl_GetObjResult(interp);
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewStringObj(ZnMapInfoLineStyleToString(line_style), -1));
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(line_width));
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(x));
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(y));
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(radius));
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(start));
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(extent));
+ }
+ break;
}
}
break;
@@ -1995,36 +1995,36 @@ ZnMapInfoObjCmd(ClientData client_data,
{
int insert;
if (argc != 5) {
- Tcl_WrongNumArgs(interp, 1, args, "mapInfo remove type index");
- return TCL_ERROR;
+ Tcl_WrongNumArgs(interp, 1, args, "mapInfo remove type index");
+ return TCL_ERROR;
}
master = LookupMapInfoMaster(interp, Tcl_GetString(args[1]));
if (master == NULL) {
- return TCL_ERROR;
+ return TCL_ERROR;
}
if (Tcl_GetIntFromObj(interp, args[4], &insert) == TCL_ERROR) {
- return TCL_ERROR;
+ return TCL_ERROR;
}
if (insert < 0) {
- insert = 0;
+ insert = 0;
}
if (Tcl_GetIndexFromObj(interp, args[3], e_type_strings,
- "elementType", 0, &index2) != TCL_OK) {
- return TCL_ERROR;
+ "elementType", 0, &index2) != TCL_OK) {
+ return TCL_ERROR;
}
switch ((enum e_types) index2) {
case ZN_E_LINE:
- ZnMapInfoRemoveLine(master->map_info, insert);
- break;
+ ZnMapInfoRemoveLine(master->map_info, insert);
+ break;
case ZN_E_SYMBOL:
- ZnMapInfoRemoveSymbol(master->map_info, insert);
- break;
+ ZnMapInfoRemoveSymbol(master->map_info, insert);
+ break;
case ZN_E_TEXT:
- ZnMapInfoRemoveText(master->map_info, insert);
- break;
+ ZnMapInfoRemoveText(master->map_info, insert);
+ break;
case ZN_E_ARC:
- ZnMapInfoRemoveArc(master->map_info, insert);
- break;
+ ZnMapInfoRemoveArc(master->map_info, insert);
+ break;
}
UpdateMapInfoClients(master);
}
@@ -2037,15 +2037,15 @@ ZnMapInfoObjCmd(ClientData client_data,
double factor;
if (argc != 4) {
- Tcl_WrongNumArgs(interp, 1, args, "mapInfo scale factor");
- return TCL_ERROR;
+ Tcl_WrongNumArgs(interp, 1, args, "mapInfo scale factor");
+ return TCL_ERROR;
}
master = LookupMapInfoMaster(interp, Tcl_GetString(args[1]));
if (master == NULL) {
- return TCL_ERROR;
+ return TCL_ERROR;
}
if (Tcl_GetDoubleFromObj(interp, args[3], &factor) == TCL_ERROR) {
- return TCL_ERROR;
+ return TCL_ERROR;
}
ZnMapInfoScale(master->map_info, factor);
UpdateMapInfoClients(master);
@@ -2057,18 +2057,18 @@ ZnMapInfoObjCmd(ClientData client_data,
case ZN_MI_TRANSLATE:
{
if (argc != 5) {
- Tcl_WrongNumArgs(interp, 1, args, "mapInfo translate xAmount yAmount");
- return TCL_ERROR;
+ Tcl_WrongNumArgs(interp, 1, args, "mapInfo translate xAmount yAmount");
+ return TCL_ERROR;
}
master = LookupMapInfoMaster(interp, Tcl_GetString(args[1]));
if (master == NULL) {
- return TCL_ERROR;
+ return TCL_ERROR;
}
if (Tcl_GetDoubleFromObj(interp, args[3], &x) == TCL_ERROR) {
- return TCL_ERROR;
+ return TCL_ERROR;
}
if (Tcl_GetDoubleFromObj(interp, args[4], &y) == TCL_ERROR) {
- return TCL_ERROR;
+ return TCL_ERROR;
}
ZnMapInfoTranslate(master->map_info, x, y);
UpdateMapInfoClients(master);
@@ -2089,15 +2089,15 @@ ZnMapInfoObjCmd(ClientData client_data,
*----------------------------------------------------------------------
*/
int
-ZnVideomapObjCmd(ClientData client_data,
- Tcl_Interp *interp, /* Current interpreter. */
- int argc, /* Number of arguments. */
- Tcl_Obj *CONST args[])
+ZnVideomapObjCmd(ClientData client_data,
+ Tcl_Interp *interp, /* Current interpreter. */
+ int argc, /* Number of arguments. */
+ Tcl_Obj *CONST args[])
{
- ZnList ids;
- int index;
- int *id_array, id_num, i;
- Tcl_Obj *l;
+ ZnList ids;
+ int index;
+ int *id_array, id_num, i;
+ Tcl_Obj *l;
#ifdef PTK_800
static char *sub_cmd_strings[] =
#else
@@ -2106,7 +2106,7 @@ ZnVideomapObjCmd(ClientData client_data,
{
"ids", "load", NULL
};
- enum sub_cmds {
+ enum sub_cmds {
ZN_V_IDS, ZN_V_LOAD
};
@@ -2117,7 +2117,7 @@ ZnVideomapObjCmd(ClientData client_data,
}
if (Tcl_GetIndexFromObj(interp, args[1], sub_cmd_strings,
- "subCmd", 0, &index) != TCL_OK) {
+ "subCmd", 0, &index) != TCL_OK) {
return TCL_ERROR;
}
@@ -2128,20 +2128,20 @@ ZnVideomapObjCmd(ClientData client_data,
case ZN_V_IDS:
{
if (argc != 3) {
- Tcl_WrongNumArgs(interp, 1, args,"ids filename");
- return TCL_ERROR;
+ Tcl_WrongNumArgs(interp, 1, args,"ids filename");
+ return TCL_ERROR;
}
ids = ZnMapInfoVideomapIds(Tcl_GetString(args[2]));
if (ids == NULL) {
- Tcl_AppendResult(interp, "unable to look at videomap file \"",
- Tcl_GetString(args[2]), "\"", NULL);
- return TCL_ERROR;
+ Tcl_AppendResult(interp, "unable to look at videomap file \"",
+ Tcl_GetString(args[2]), "\"", NULL);
+ return TCL_ERROR;
}
id_array = ZnListArray(ids);
id_num = ZnListSize(ids);
l = Tcl_GetObjResult(interp);
for (i = 0; i < id_num; i++) {
- Tcl_ListObjAppendElement(interp, l, Tcl_NewIntObj(id_array[i]));
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewIntObj(id_array[i]));
}
ZnListFree(ids);
}
@@ -2151,27 +2151,27 @@ ZnVideomapObjCmd(ClientData client_data,
*/
case ZN_V_LOAD:
{
- ZnMapInfoId map_info;
+ ZnMapInfoId map_info;
int insert;
if (argc != 5) {
- Tcl_WrongNumArgs(interp, 1, args, "load filename index mapInfo");
- return TCL_ERROR;
+ Tcl_WrongNumArgs(interp, 1, args, "load filename index mapInfo");
+ return TCL_ERROR;
}
if (Tcl_GetIntFromObj(interp, args[3], &insert) == TCL_ERROR) {
- return TCL_ERROR;
+ return TCL_ERROR;
}
if (insert < 0) {
- insert = 0;
+ insert = 0;
}
if (ZnCreateMapInfo(interp, Tcl_GetString(args[4]), &map_info) == TCL_ERROR) {
- return TCL_ERROR;
+ return TCL_ERROR;
}
if (ZnMapInfoGetVideomap(map_info, Tcl_GetString(args[2]), insert) == TCL_ERROR) {
- Tcl_AppendResult(interp, "unable to load videomap file \"",
- Tcl_GetString(args[2]), ":",
- Tcl_GetString(args[3]), "\"", NULL);
- return TCL_ERROR;
+ Tcl_AppendResult(interp, "unable to load videomap file \"",
+ Tcl_GetString(args[2]), ":",
+ Tcl_GetString(args[3]), "\"", NULL);
+ return TCL_ERROR;
}
ZnUpdateMapInfoClients(map_info);
}
diff --git a/generic/MapInfo.h b/generic/MapInfo.h
index 257146a..290e587 100644
--- a/generic/MapInfo.h
+++ b/generic/MapInfo.h
@@ -1,8 +1,8 @@
/*
* MapInfo.h -- Public include file for MapInfo interface.
*
- * Authors : Patrick Lecoanet.
- * Creation date :
+ * Authors : Patrick Lecoanet.
+ * Creation date :
*
* $Id$
*/
@@ -48,7 +48,7 @@ extern "C" {
*-----------------------------------------------------------------------
*/
-typedef void *ZnMapInfoId;
+typedef void *ZnMapInfoId;
typedef enum {
ZnMapInfoLineSimple,
@@ -65,42 +65,42 @@ typedef enum {
void ZnMapInfoGetLine(ZnMapInfoId map_info, unsigned int index, ZnPtr *tag,
- ZnMapInfoLineStyle *line_style, ZnDim *line_width,
- ZnPos *x_from, ZnPos *y_from,
- ZnPos *x_to, ZnPos *y_to);
+ ZnMapInfoLineStyle *line_style, ZnDim *line_width,
+ ZnPos *x_from, ZnPos *y_from,
+ ZnPos *x_to, ZnPos *y_to);
unsigned int ZnMapInfoNumLines(ZnMapInfoId map_info);
void ZnMapInfoGetMarks(ZnMapInfoId map_info, unsigned int index,
- ZnPoint **marks, unsigned int *num_marks);
+ ZnPoint **marks, unsigned int *num_marks);
void ZnMapInfoGetSymbol(ZnMapInfoId map_info, unsigned int index, ZnPtr *tag,
- ZnPos *x, ZnPos *y, char *symbol);
+ ZnPos *x, ZnPos *y, char *symbol);
unsigned int ZnMapInfoNumSymbols(ZnMapInfoId map_info);
void ZnMapInfoGetText(ZnMapInfoId map_info, unsigned int index, ZnPtr *tag,
- ZnMapInfoTextStyle *text_style,
- ZnMapInfoLineStyle *line_style,
- ZnPos *x, ZnPos *y, char **text);
+ ZnMapInfoTextStyle *text_style,
+ ZnMapInfoLineStyle *line_style,
+ ZnPos *x, ZnPos *y, char **text);
unsigned int ZnMapInfoNumTexts(ZnMapInfoId map_info);
void ZnMapInfoGetArc(ZnMapInfoId map_info, unsigned int index, ZnPtr *tag,
- ZnMapInfoLineStyle *line_style, ZnDim *line_width,
- ZnPos *center_x, ZnPos *center_y, ZnDim *radius,
- ZnReal *start_angle, ZnReal *extend);
+ ZnMapInfoLineStyle *line_style, ZnDim *line_width,
+ ZnPos *center_x, ZnPos *center_y, ZnDim *radius,
+ ZnReal *start_angle, ZnReal *extend);
unsigned int ZnMapInfoNumArcs(ZnMapInfoId map_info);
typedef void (*ZnMapInfoChangeProc)(ClientData client_data, ZnMapInfoId map_info);
ZnMapInfoId ZnGetMapInfo(Tcl_Interp *interp, char *name,
- ZnMapInfoChangeProc proc, ClientData client_data);
+ ZnMapInfoChangeProc proc, ClientData client_data);
void ZnFreeMapInfo(ZnMapInfoId map_info, ZnMapInfoChangeProc proc,
- ClientData client_data);
+ ClientData client_data);
int ZnMapInfoObjCmd(ClientData client_data, Tcl_Interp *interp,
- int argc, Tcl_Obj *CONST args[]);
+ int argc, Tcl_Obj *CONST args[]);
int ZnVideomapObjCmd(ClientData client_data, Tcl_Interp *interp,
- int argc, Tcl_Obj *CONST args[]);
+ int argc, Tcl_Obj *CONST args[]);
#ifdef __CPLUSPLUS__
}
#endif
-#endif /* _MapInfo_h */
+#endif /* _MapInfo_h */
diff --git a/generic/OverlapMan.c b/generic/OverlapMan.c
index e8515ff..72f4499 100644
--- a/generic/OverlapMan.c
+++ b/generic/OverlapMan.c
@@ -1,8 +1,8 @@
/*
* OverlapMan.c -- Track label overlap avoidance manager implementation.
*
- * Authors :
- * Creation date :
+ * Authors :
+ * Creation date :
*
* $Id$
*/
@@ -59,13 +59,13 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ "
#define signe(a) ((a) < (0) ? (-1) : (1))
#define abs(a) ((a) < (0) ? -(a) : (a))
#ifndef M_PI
-#define M_PI 3.14159265358979323846264338327
+#define M_PI 3.14159265358979323846264338327
#endif
#ifndef M_PI_2
-#define M_PI_2 1.57079632679489661923
+#define M_PI_2 1.57079632679489661923
#endif
#ifndef M_PI_4
-#define M_PI_4 0.78539816339744830962
+#define M_PI_4 0.78539816339744830962
#endif
#define DegreesToRadian(angle) \
(M_PI * (double) (angle) / 180.0)
@@ -79,9 +79,9 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ "
#define COEF1 0.5 /* coef of second repulsion point */
#define COEF2 0.1 /* coef of second repulsion point */
-#define DELTA_T 0.1 /* integration step for Euler method */
-#define FALSE 0
-#define TRUE 1
+#define DELTA_T 0.1 /* integration step for Euler method */
+#define FALSE 0
+#define TRUE 1
typedef int BOOLEAN;
@@ -108,12 +108,12 @@ typedef struct _INFOS {
} INFOS;
typedef struct _ZINCS {
- void *rw;
- void *(*_next_track)();
- void (*_set_label_angle)();
- INFOS *infos;
- int NBinfos;
- int NBalloc_infos;
+ void *rw;
+ void *(*_next_track)();
+ void (*_set_label_angle)();
+ INFOS *infos;
+ int NBinfos;
+ int NBalloc_infos;
} ZINCS;
/*
@@ -124,25 +124,25 @@ typedef struct _ZINCS {
/*
* real parameters adresse
*/
-static double K0 = 2100.0; /* Repulsion factor */
-static double K0min = 500.0;
-static double K0max = 3000.0;
+static double K0 = 2100.0; /* Repulsion factor */
+static double K0min = 500.0;
+static double K0max = 3000.0;
-static double n0 = 2.10; /* Repulsion exponent */
-static double n0min = 2.0;
-static double n0max = 3.0;
+static double n0 = 2.10; /* Repulsion exponent */
+static double n0min = 2.0;
+static double n0max = 3.0;
-static double K1 = 6.0; /* Friction factor */
-static double K1min = 1.0;
-static double K1max = 10.0;
+static double K1 = 6.0; /* Friction factor */
+static double K1min = 1.0;
+static double K1max = 10.0;
-static double K2 = 6.0; /* Drawback forces factor */
-static double K2min = 1.0;
-static double K2max = 10.0;
+static double K2 = 6.0; /* Drawback forces factor */
+static double K2min = 1.0;
+static double K2max = 10.0;
-static double K3 = 4.0; /* Keep in view forces factor */
-static double K3min = 1.0;
-static double K3max = 10.0;
+static double K3 = 4.0; /* Keep in view forces factor */
+static double K3min = 1.0;
+static double K3max = 10.0;
/*
* accessor structure need for generic set/get method
@@ -152,7 +152,7 @@ typedef struct _OMPARAM {
int size;
char *name;
void *data;
- BOOLEAN rw; /* 1 means readwrite, 0 means read only */
+ BOOLEAN rw; /* 1 means readwrite, 0 means read only */
} OMPARAM, *pOMPARAM;
/*
@@ -179,45 +179,45 @@ static OMPARAM OmParamAccess[] = {
};
static int NbParam = sizeof(OmParamAccess) / sizeof(OMPARAM) - 1;
-static ZINCS *wr = NULL;
-static int NBzincs=0;
-static int NBalloc_zincs=0;
-static INFOS info1;
+static ZINCS *wr = NULL;
+static int NBzincs=0;
+static int NBalloc_zincs=0;
+static INFOS info1;
/*
* Square of the distance (between two label centers) below which
* the repulsion is not computed.
*/
-static double limit_distance = 6.0;
+static double limit_distance = 6.0;
/*
* Square of the minimum distance (between two label centers)
* considered during initialisation of the leaders.
*/
-static double placing_min_dist = 11000.0;
+static double placing_min_dist = 11000.0;
/*
* Angle step between two placement trials.
*/
-static double placing_step = M_PI/6.0;
+static double placing_step = M_PI/6.0;
/*
****************************************************************************
*
* FindPosW --
- * Find the zinc position in the database,
+ * Find the zinc position in the database,
* if not found, gets the positon to insert in.
*
****************************************************************************
*/
static BOOLEAN
-FindPosW(void *w,
- int *mid)
+FindPosW(void *w,
+ int *mid)
{
- int left=0;
- int right=NBzincs-1;
+ int left=0;
+ int right=NBzincs-1;
if (w < wr[0].rw) {
*mid = 0;
@@ -256,15 +256,15 @@ FindPosW(void *w,
****************************************************************************
*
* AllocW --
- * Allocate cells in database for the specified zinc.
+ * Allocate cells in database for the specified zinc.
*
****************************************************************************
*/
static void
-AllocW(void *w,
- int pos)
+AllocW(void *w,
+ int pos)
{
- int i;
+ int i;
if (NBzincs == NBalloc_zincs) {
NBalloc_zincs += NB_ALLOC;
@@ -280,7 +280,7 @@ AllocW(void *w,
wr[pos].rw = w;
wr[pos].infos = NULL;
wr[pos].NBinfos = 0;
- wr[pos].NBalloc_infos = 0;
+ wr[pos].NBalloc_infos = 0;
}
@@ -288,13 +288,13 @@ AllocW(void *w,
***************************************************************************
*
* ProjToAngle --
- * Compute an angle from dx and dy projections.
+ * Compute an angle from dx and dy projections.
*
***************************************************************************
*/
static double
-ProjToAngle(int dx,
- int dy)
+ProjToAngle(int dx,
+ int dy)
{
if (dx == 0) {
if (dy < 0) {
@@ -302,10 +302,10 @@ ProjToAngle(int dx,
}
else {
if (dy > 0) {
- return M_PI_2;
+ return M_PI_2;
}
else {
- return 0;
+ return 0;
}
}
}
@@ -324,7 +324,7 @@ ProjToAngle(int dx,
****************************************************************************
*
* OmInit --
- * Called only once to initialize some internal data.
+ * Called only once to initialize some internal data.
*
****************************************************************************
*/
@@ -332,31 +332,31 @@ void
OmInit()
{
/* printf("OmInit\n");*/
-}
+}
/*
****************************************************************************
*
* OmRegister --
- * Create a database entry for the specified zinc.
+ * Create a database entry for the specified zinc.
*
****************************************************************************
*/
void
-OmRegister(void *w,
- void *(*_fnext_track)(void *, void *,
- int *, int *,
- int *, int *,
- int *, int *,
- int *, int *,
- int *, int *),
- void (*_fset_label_angle)(void *, void *, int, int),
- void (*_fquery_label_pos)(void *, void *, int,
- int *, int *, int *, int *))
+OmRegister(void *w,
+ void *(*_fnext_track)(void *, void *,
+ int *, int *,
+ int *, int *,
+ int *, int *,
+ int *, int *,
+ int *, int *),
+ void (*_fset_label_angle)(void *, void *, int, int),
+ void (*_fquery_label_pos)(void *, void *, int,
+ int *, int *, int *, int *))
{
- int iw=0;
- BOOLEAN found=FALSE;
+ int iw=0;
+ BOOLEAN found=FALSE;
if (NBzincs > 0) {
found = FindPosW(w, &iw);
@@ -373,14 +373,14 @@ OmRegister(void *w,
****************************************************************************
*
* OmUnregister --
- * Cancel database information about the specified zinc.
+ * Cancel database information about the specified zinc.
*
****************************************************************************
*/
void
-OmUnregister(void *w)
+OmUnregister(void *w)
{
- int i;
+ int i;
if (FindPosW(w, &i) == TRUE) {
free(wr[i].infos);
@@ -394,18 +394,18 @@ OmUnregister(void *w)
***************************************************************************
*
* FindPosId --
- * Find track position in the database,
+ * Find track position in the database,
* if not found gets the positon to insert in.
*
***************************************************************************
*/
static BOOLEAN
-FindPosId(int iw,
- void *id,
- int *mid)
+FindPosId(int iw,
+ void *id,
+ int *mid)
{
- int left=0;
- int right= wr[iw].NBinfos-1;
+ int left=0;
+ int right= wr[iw].NBinfos-1;
if (id < wr[iw].infos[0].id) {
*mid = 0;
@@ -444,7 +444,7 @@ FindPosId(int iw,
***************************************************************************
*
* SetTrackInitValues --
- * Set initial label values for a track.
+ * Set initial label values for a track.
*
***************************************************************************
*/
@@ -461,13 +461,13 @@ SetTrackInitValues()
/*
***************************************************************************
* SetTrackCurrentValues --
- * Update label values for a track.
+ * Update label values for a track.
*
***************************************************************************
*/
static void
-SetTrackCurrentValues(int iw,
- int pos)
+SetTrackCurrentValues(int iw,
+ int pos)
{
info1.New_Track = FALSE;
info1.alpha_point = wr[iw].infos[pos].alpha_point;
@@ -478,15 +478,15 @@ SetTrackCurrentValues(int iw,
***************************************************************************
*
* PutTrackLoaded --
- * Put track labels information into database.
+ * Put track labels information into database.
*
***************************************************************************
*/
static void
-PutTrackLoaded(int iw)
+PutTrackLoaded(int iw)
{
- int pos = 0, i;
- BOOLEAN found = FALSE;
+ int pos = 0, i;
+ BOOLEAN found = FALSE;
if (wr[iw].NBinfos > 0) {
found = FindPosId(iw, info1.id, &pos);
@@ -495,19 +495,19 @@ PutTrackLoaded(int iw)
/*
* New track.
*/
- if (wr[iw].NBinfos == wr[iw].NBalloc_infos) {
+ if (wr[iw].NBinfos == wr[iw].NBalloc_infos) {
wr[iw].NBalloc_infos += NB_ALLOC;
wr[iw].infos = realloc((void *) wr[iw].infos,
- sizeof(INFOS)*wr[iw].NBalloc_infos);
+ sizeof(INFOS)*wr[iw].NBalloc_infos);
}
if (pos < wr[iw].NBinfos) {
for(i = wr[iw].NBinfos-1; i >= pos; i--) {
- memcpy((char *) &(wr[iw].infos[i+1]), (char *) &(wr[iw].infos[i]),
- sizeof(INFOS));
+ memcpy((char *) &(wr[iw].infos[i+1]), (char *) &(wr[iw].infos[i]),
+ sizeof(INFOS));
}
/* memcpy((char *) &(wr[iw].infos[pos+1]), (char *) &(wr[iw].infos[pos]),
- (wr[iw].NBinfos-pos)*sizeof(INFOS) );*/
+ (wr[iw].NBinfos-pos)*sizeof(INFOS) );*/
}
info1.New_Track = TRUE;
@@ -532,14 +532,14 @@ PutTrackLoaded(int iw)
***************************************************************************
*
* ReadTracks --
- * Get track labels information from zinc.
+ * Get track labels information from zinc.
*
***************************************************************************
*/
static void
-ReadTracks(int iw)
+ReadTracks(int iw)
{
- int i=0;
+ int i=0;
int trash1; /* dummy variable : received unused data */
for (i = 0; i < wr[iw].NBinfos; i++) {
@@ -548,17 +548,17 @@ ReadTracks(int iw)
info1.id = NULL;
while ((info1.id = (*wr[iw]._next_track)(wr[iw].rw, info1.id,
- &info1.x, &info1.y,
- &info1.vv_dx, &info1.vv_dy,
- /* Fri Oct 13 15:15:48 2000
- * &info1.label_x, &info1.label_y,
- * &info1.label_width, &info1.label_height,
- */
- &info1.rho, &info1.theta,
- &info1.visibility,
- &trash1,&trash1,&trash1))) {
+ &info1.x, &info1.y,
+ &info1.vv_dx, &info1.vv_dy,
+ /* Fri Oct 13 15:15:48 2000
+ * &info1.label_x, &info1.label_y,
+ * &info1.label_width, &info1.label_height,
+ */
+ &info1.rho, &info1.theta,
+ &info1.visibility,
+ &trash1,&trash1,&trash1))) {
info1.alpha = (ProjToAngle(info1.vv_dx, info1.vv_dy ) - M_PI_2 -
- DegreesToRadian(info1.theta));
+ DegreesToRadian(info1.theta));
info1.dx = (int) (info1.rho * cos(info1.alpha));
info1.dy = (int) (info1.rho * sin(info1.alpha));
info1.Refresh = TRUE;
@@ -576,7 +576,7 @@ ReadTracks(int iw)
*/
if (wr[iw].infos[i].Refresh == FALSE) {
memcpy((char *) &(wr[iw].infos[i]), (char *) &(wr[iw].infos[i+1]),
- (wr[iw].NBinfos-i-1)*sizeof(INFOS));
+ (wr[iw].NBinfos-i-1)*sizeof(INFOS));
wr[iw].NBinfos--;
}
else {
@@ -589,32 +589,32 @@ ReadTracks(int iw)
***************************************************************************
*
* OmSetNParam --
- * Return 1 if ok, anything else if nok (non existing parameters,
+ * Return 1 if ok, anything else if nok (non existing parameters,
* wrong type).
*
***************************************************************************
*/
int
OmSetNParam(char *name, /* parameter's name */
- void *value)
+ void *value)
{
int accessid = 0;
int status = 0;
while (OmParamAccess[accessid].type != OM_PARAM_END) {
- if (!strcmp(name, OmParamAccess[accessid].name)) {
- /* a parameter named name has been found */
- if (OmParamAccess[accessid].rw) {
- memcpy(OmParamAccess[accessid].data, value,
- (unsigned int) OmParamAccess[accessid].size);
- status = 1;
- break;
- }
- else {
- status = -1 ; /* data is readonly */
- };
- };
- ++accessid;
+ if (!strcmp(name, OmParamAccess[accessid].name)) {
+ /* a parameter named name has been found */
+ if (OmParamAccess[accessid].rw) {
+ memcpy(OmParamAccess[accessid].data, value,
+ (unsigned int) OmParamAccess[accessid].size);
+ status = 1;
+ break;
+ }
+ else {
+ status = -1 ; /* data is readonly */
+ };
+ };
+ ++accessid;
};
return(status);
}
@@ -623,27 +623,27 @@ OmSetNParam(char *name, /* parameter's name */
***************************************************************************
*
* OmGetNParam --
- * Return 1 if ok, anything else if nok (non existing parameters,
+ * Return 1 if ok, anything else if nok (non existing parameters,
* wrong type).
*
***************************************************************************
*/
int
OmGetNParam(char *name, /* parameter's name */
- void *ptvalue)
+ void *ptvalue)
{
int accessid = 0;
int status = 0;
while (OmParamAccess[accessid].type != OM_PARAM_END) {
- if (!strcmp(name, OmParamAccess[accessid].name)) {
- /* a parameter named "name" has been found */
- memcpy(ptvalue, OmParamAccess[accessid].data,
- (unsigned int) OmParamAccess[accessid].size);
- status = 1;
- break;
- };
- ++accessid;
+ if (!strcmp(name, OmParamAccess[accessid].name)) {
+ /* a parameter named "name" has been found */
+ memcpy(ptvalue, OmParamAccess[accessid].data,
+ (unsigned int) OmParamAccess[accessid].size);
+ status = 1;
+ break;
+ };
+ ++accessid;
};
return(status);
}
@@ -652,7 +652,7 @@ OmGetNParam(char *name, /* parameter's name */
***************************************************************************
*
* OmGetNParamList --
- * Return 1 and next index if remains to read, the current param
+ * Return 1 and next index if remains to read, the current param
* being written in current_param. Return 0 if end of list.
*
***************************************************************************
@@ -663,23 +663,23 @@ OmGetNParamList(OmParam *current_param, int *idx_next)
int status = 0 ;
pOMPARAM cparam ;
if (*idx_next < NbParam) {
- cparam = &OmParamAccess[*idx_next];
- current_param->type = cparam->type ;
- strcpy(current_param->name, cparam->name);
- /* printf("value of parameter is %f \n", *((double *)(cparam->data)));
- printf("adresse de K0 %x \n", (int)&K0); */
- ++(*idx_next) ;
- status = 1;
+ cparam = &OmParamAccess[*idx_next];
+ current_param->type = cparam->type ;
+ strcpy(current_param->name, cparam->name);
+ /* printf("value of parameter is %f \n", *((double *)(cparam->data)));
+ printf("adresse de K0 %x \n", (int)&K0); */
+ ++(*idx_next) ;
+ status = 1;
};
return(status);
}
void
OmSetParam(double OmKrepulsion,
- double OmKrepulsionBearing,
- double OmKfriction,
- double OmKbestPositionAttraction,
- double OmKscreenEdgeRepulsion)
+ double OmKrepulsionBearing,
+ double OmKfriction,
+ double OmKbestPositionAttraction,
+ double OmKscreenEdgeRepulsion)
{
K0 = OmKrepulsion;
n0 = OmKrepulsionBearing;
@@ -690,10 +690,10 @@ OmSetParam(double OmKrepulsion,
void
OmGetParam(double *OmKrepulsion,
- double *OmKrepulsionBearing,
- double *OmKfriction,
- double *OmKbestPositionAttraction,
- double *OmKscreenEdgeRepulsion)
+ double *OmKrepulsionBearing,
+ double *OmKfriction,
+ double *OmKbestPositionAttraction,
+ double *OmKscreenEdgeRepulsion)
{
*OmKrepulsion = K0;
*OmKrepulsionBearing = n0;
@@ -704,10 +704,10 @@ OmGetParam(double *OmKrepulsion,
void
OmGetMinParam(double *OmKminRepulsion,
- double *OmKminRepulsionBearing,
- double *OmKminFriction,
- double *OmKminBestPositionAttraction,
- double *OmKminScreenEdgeRepulsion)
+ double *OmKminRepulsionBearing,
+ double *OmKminFriction,
+ double *OmKminBestPositionAttraction,
+ double *OmKminScreenEdgeRepulsion)
{
*OmKminRepulsion = K0min;
*OmKminRepulsionBearing = n0min;
@@ -718,10 +718,10 @@ OmGetMinParam(double *OmKminRepulsion,
void
OmGetMaxParam(double *OmKmaxRepulsion,
- double *OmKmaxRepulsionBearing,
- double *OmKmaxFriction,
- double *OmKmaxBestPositionAttraction,
- double *OmKmaxScreenEdgeRepulsion)
+ double *OmKmaxRepulsionBearing,
+ double *OmKmaxFriction,
+ double *OmKmaxBestPositionAttraction,
+ double *OmKmaxScreenEdgeRepulsion)
{
*OmKmaxRepulsion = K0max;
*OmKmaxRepulsionBearing = n0max;
@@ -735,20 +735,20 @@ OmGetMaxParam(double *OmKmaxRepulsion,
***************************************************************************
*
* SetupLeaderPosition --
- * Setup leader position for new tracks.
+ * Setup leader position for new tracks.
*
***************************************************************************
*/
static void
-SetupLeaderPosition(int iw,
- int ip)
+SetupLeaderPosition(int iw,
+ int ip)
{
- double X10, Y10, X20, Y20;
- double D, k, Fx0, Fy0;
- int jp;
- double alpha;
- BOOLEAN ok = FALSE;
- double dx = 0, dy = 0;
+ double X10, Y10, X20, Y20;
+ double D, k, Fx0, Fy0;
+ int jp;
+ double alpha;
+ BOOLEAN ok = FALSE;
+ double dx = 0, dy = 0;
Fx0 = 0.0;
Fy0 = 0.0;
@@ -758,23 +758,23 @@ SetupLeaderPosition(int iw,
X10 = (double) (wr[iw].infos[ip].x - wr[iw].infos[jp].x - wr[iw].infos[jp].dx);
Y10 = (double) (wr[iw].infos[ip].y - wr[iw].infos[jp].y - wr[iw].infos[jp].dy);
X20 = ((double) (wr[iw].infos[ip].x - wr[iw].infos[jp].x) -
- (double) (wr[iw].infos[jp].dx) * COEF1 +
- (double) (wr[iw].infos[jp].dy) * COEF2);
+ (double) (wr[iw].infos[jp].dx) * COEF1 +
+ (double) (wr[iw].infos[jp].dy) * COEF2);
Y20 = ((double) (wr[iw].infos[ip].y - wr[iw].infos[jp].y) -
- (double) (wr[iw].infos[jp].dy) * COEF1 -
- (double) (wr[iw].infos[jp].dx) * COEF2);
+ (double) (wr[iw].infos[jp].dy) * COEF1 -
+ (double) (wr[iw].infos[jp].dx) * COEF2);
D = X10 * X10 + Y10 * Y10;
if (D > limit_distance) {
- k = K0 / (sqrt(D) * pow(D, n0 - 1.0));
- Fx0 += X10 * k;
- Fy0 += Y10 * k;
+ k = K0 / (sqrt(D) * pow(D, n0 - 1.0));
+ Fx0 += X10 * k;
+ Fy0 += Y10 * k;
}
D = X20 * X20 + Y20 * Y20;
if (D > limit_distance) {
- k = K0 / (sqrt(D) * pow(D, n0 - 1.0));
- Fx0 += X20 * k;
- Fy0 += Y20 * k;
+ k = K0 / (sqrt(D) * pow(D, n0 - 1.0));
+ Fx0 += X20 * k;
+ Fy0 += Y20 * k;
}
}
}
@@ -796,14 +796,14 @@ SetupLeaderPosition(int iw,
for (jp = 0; jp < wr[iw].NBinfos; jp++) {
if (wr[iw].infos[jp].New_Track == FALSE) {
- X10 = (double) (wr[iw].infos[ip].x + (int) dx -
- wr[iw].infos[jp].x - wr[iw].infos[jp].dx);
- Y10 = (double) (wr[iw].infos[ip].y + (int) dy -
- wr[iw].infos[jp].y - wr[iw].infos[jp].dy);
- D = X10 * X10 + Y10 * Y10;
- if (D < placing_min_dist) {
- ok = FALSE;
- }
+ X10 = (double) (wr[iw].infos[ip].x + (int) dx -
+ wr[iw].infos[jp].x - wr[iw].infos[jp].dx);
+ Y10 = (double) (wr[iw].infos[ip].y + (int) dy -
+ wr[iw].infos[jp].y - wr[iw].infos[jp].dy);
+ D = X10 * X10 + Y10 * Y10;
+ if (D < placing_min_dist) {
+ ok = FALSE;
+ }
}
}
alpha += placing_step;
@@ -820,27 +820,27 @@ SetupLeaderPosition(int iw,
***************************************************************************
*
* ComputeRepulsion --
- * Compute the moment of the repulsion forces of all the other
- * tracks.
+ * Compute the moment of the repulsion forces of all the other
+ * tracks.
*
***************************************************************************
*/
static double
-ComputeRepulsion(int iw,
- int ip)
+ComputeRepulsion(int iw,
+ int ip)
{
- double X10, Y10, X00, Y00, X11, Y11, X01, Y01;
- double D0, D1, k, Fx0, Fy0, Fx1, Fy1;
- int jp;
+ double X10, Y10, X00, Y00, X11, Y11, X01, Y01;
+ double D0, D1, k, Fx0, Fy0, Fx1, Fy1;
+ int jp;
X00 = (double) (wr[iw].infos[ip].x + wr[iw].infos[ip].dx);
Y00 = (double) (wr[iw].infos[ip].y + wr[iw].infos[ip].dy);
X01 = ((double) (wr[iw].infos[ip].x) +
- (double) (wr[iw].infos[ip].dx) * COEF1 -
- (double) (wr[iw].infos[ip].dy) * COEF2);
+ (double) (wr[iw].infos[ip].dx) * COEF1 -
+ (double) (wr[iw].infos[ip].dy) * COEF2);
Y01 = ((double) (wr[iw].infos[ip].y) +
- (double) (wr[iw].infos[ip].dy) * COEF1 +
- (double) (wr[iw].infos[ip].dx) * COEF2);
+ (double) (wr[iw].infos[ip].dy) * COEF1 +
+ (double) (wr[iw].infos[ip].dx) * COEF2);
Fx0 = 0.0;
Fy0 = 0.0;
Fx1 = 0.0;
@@ -851,33 +851,33 @@ ComputeRepulsion(int iw,
X10 = (double) (wr[iw].infos[jp].x + wr[iw].infos[jp].dx);
Y10 = (double) (wr[iw].infos[jp].y + wr[iw].infos[jp].dy);
X11 = ((double) (wr[iw].infos[jp].x) +
- (double) (wr[iw].infos[jp].dx) * COEF1 -
- (double) (wr[iw].infos[jp].dy) * COEF2);
+ (double) (wr[iw].infos[jp].dx) * COEF1 -
+ (double) (wr[iw].infos[jp].dy) * COEF2);
Y11 = ((double) (wr[iw].infos[jp].y) +
- (double) (wr[iw].infos[jp].dy) * COEF1 +
- (double) (wr[iw].infos[jp].dx) * COEF2);
+ (double) (wr[iw].infos[jp].dy) * COEF1 +
+ (double) (wr[iw].infos[jp].dx) * COEF2);
D0 = (X10 - X00) * (X10 - X00) + (Y10 - Y00) * (Y10 - Y00);
if (D0 > limit_distance) {
- k = K0 / (sqrt(D0) * pow(D0, n0 - 1.0));
- Fx0 += (X10 - X00) * k;
- Fy0 += (Y10 - Y00) * k;
+ k = K0 / (sqrt(D0) * pow(D0, n0 - 1.0));
+ Fx0 += (X10 - X00) * k;
+ Fy0 += (Y10 - Y00) * k;
}
D1 = (X11 - X01) * (X11 - X01) + (Y11 - Y01) * (Y11 - Y01);
if (D1 > limit_distance) {
- k = K0 / (sqrt(D1) * pow(D1, n0 - 1.0));
- Fx1 += (X11 - X01) * k;
- Fy1 += (Y11 - Y01) * k;
+ k = K0 / (sqrt(D1) * pow(D1, n0 - 1.0));
+ Fx1 += (X11 - X01) * k;
+ Fy1 += (Y11 - Y01) * k;
}
}
}
return -((double) (wr[iw].infos[ip].dx) * Fy0 -
- (double) (wr[iw].infos[ip].dy) * Fx0 +
- (double) (wr[iw].infos[ip].dx) * COEF1 * Fy1 -
- (double) (wr[iw].infos[ip].dy) * COEF2 * Fy1 -
- (double) (wr[iw].infos[ip].dy) * COEF1 * Fx1 -
- (double) (wr[iw].infos[ip].dx) * COEF2 * Fx1);
+ (double) (wr[iw].infos[ip].dy) * Fx0 +
+ (double) (wr[iw].infos[ip].dx) * COEF1 * Fy1 -
+ (double) (wr[iw].infos[ip].dy) * COEF2 * Fy1 -
+ (double) (wr[iw].infos[ip].dy) * COEF1 * Fx1 -
+ (double) (wr[iw].infos[ip].dx) * COEF2 * Fx1);
}
@@ -885,13 +885,13 @@ ComputeRepulsion(int iw,
***************************************************************************
*
* ComputeFriction --
- * Compute the moment of the friction force.
+ * Compute the moment of the friction force.
*
***************************************************************************
*/
static double
-ComputeFriction(int iw,
- int ip)
+ComputeFriction(int iw,
+ int ip)
{
return (double) (-K1 * wr[iw].infos[ip].alpha_point);
}
@@ -899,20 +899,20 @@ ComputeFriction(int iw,
/*
***************************************************************************
- *
+ *
* ComputeDrawback --
- * Compute the moment of the best positions drawback forces.
+ * Compute the moment of the best positions drawback forces.
*
***************************************************************************
*/
static double
-ComputeDrawback(int iw,
- int ip)
+ComputeDrawback(int iw,
+ int ip)
{
- int vx, vy, dx, dy;
- double m = 0;
- double nd = 1.0, nv = 1.0;
- double vi;
+ int vx, vy, dx, dy;
+ double m = 0;
+ double nd = 1.0, nv = 1.0;
+ double vi;
vx = wr[iw].infos[ip].vv_dx;
vy = wr[iw].infos[ip].vv_dy;
@@ -946,19 +946,19 @@ ComputeDrawback(int iw,
***************************************************************************
*
* ComputeDrawbackInView --
- * Compute the moment of the keep in view forces.
+ * Compute the moment of the keep in view forces.
*
***************************************************************************
*/
static double
-DrawbackDirection(int vx,
- int vy,
- int dx,
- int dy)
+DrawbackDirection(int vx,
+ int vy,
+ int dx,
+ int dy)
{
- double m=0;
- double nd=1.0, nv=1.0;
- double vi;
+ double m=0;
+ double nd=1.0, nv=1.0;
+ double vi;
if ((vx != 0) || (vy != 0)) {
nv = sqrt((double)(vx * vx + vy * vy));
@@ -984,14 +984,14 @@ DrawbackDirection(int vx,
static double
-ComputeDrawbackInView(int iw,
- int ip,
- int width,
- int height)
+ComputeDrawbackInView(int iw,
+ int ip,
+ int width,
+ int height)
{
- int r=50;
- int dx, dy;
- double Gamma=0;
+ int r=50;
+ int dx, dy;
+ double Gamma=0;
r = wr[iw].infos[ip].rho;
dx = wr[iw].infos[ip].dx;
@@ -1017,20 +1017,20 @@ ComputeDrawbackInView(int iw,
***************************************************************************
*
* RefineSetup --
- * Refine setup for far spaced tracks.
+ * Refine setup for far spaced tracks.
*
***************************************************************************
*/
static void
-RefineSetup(int iw,
- int ip)
+RefineSetup(int iw,
+ int ip)
{
- double acceleration;
- int i;
+ double acceleration;
+ int i;
for (i = 0; i <= 10; i++) {
acceleration = ComputeRepulsion(iw, ip) + ComputeDrawback(iw, ip);
-
+
if (acceleration > 100) {
acceleration = 100;
}
@@ -1057,79 +1057,79 @@ RefineSetup(int iw,
***************************************************************************
*
* OmProcessOverlap --
- * Overlap Manager main function.
+ * Overlap Manager main function.
*
***************************************************************************
*/
void
-OmProcessOverlap(void *zinc,
- int width,
- int height,
- double scale)
+OmProcessOverlap(void *zinc,
+ int width,
+ int height,
+ double scale)
{
- double acceleration = 0.0;
- int ip, iw;
+ double acceleration = 0.0;
+ int ip, iw;
if (NBzincs != 0 && FindPosW(zinc, &iw) == TRUE) {
ReadTracks(iw);
for (ip = 0; ip < wr[iw].NBinfos; ip++) {
if (wr[iw].infos[ip].New_Track == TRUE) {
- SetupLeaderPosition(iw, ip);
- RefineSetup(iw, ip);
- wr[iw].infos[ip].New_Track = FALSE;
+ SetupLeaderPosition(iw, ip);
+ RefineSetup(iw, ip);
+ wr[iw].infos[ip].New_Track = FALSE;
}
}
for (ip = 0; ip < wr[iw].NBinfos; ip++) {
acceleration = (ComputeRepulsion(iw, ip) + ComputeDrawback(iw, ip) +
- ComputeDrawbackInView(iw, ip, width, height));
+ ComputeDrawbackInView(iw, ip, width, height));
if (acceleration > 100) {
- acceleration = 100;
+ acceleration = 100;
}
if (acceleration < -100) {
- acceleration = -100;
+ acceleration = -100;
}
-
+
wr[iw].infos[ip].alpha_point += acceleration * DELTA_T ;
wr[iw].infos[ip].alpha_point += ComputeFriction(iw, ip) * DELTA_T ;
if (wr[iw].infos[ip].alpha_point > 30) {
- wr[iw].infos[ip].alpha_point = 30;
+ wr[iw].infos[ip].alpha_point = 30;
}
if (wr[iw].infos[ip].alpha_point < -30) {
- wr[iw].infos[ip].alpha_point = -30;
+ wr[iw].infos[ip].alpha_point = -30;
}
wr[iw].infos[ip].alpha += wr[iw].infos[ip].alpha_point * DELTA_T ;
wr[iw].infos[ip].theta = (int) RadianToDegrees360(-wr[iw].infos[ip].alpha +
- ProjToAngle(wr[iw].infos[ip].vv_dx,
- wr[iw].infos[ip].vv_dy)
- - M_PI_2);
+ ProjToAngle(wr[iw].infos[ip].vv_dx,
+ wr[iw].infos[ip].vv_dy)
+ - M_PI_2);
/*
if (wr[iw].infos[ip].theta > 75 && wr[iw].infos[ip].theta < 105) {
- if (wr[iw].infos[ip].alpha_point > 0) {
- wr[iw].infos[ip].theta = 105;
- }
- else {
- wr[iw].infos[ip].theta = 75;
- }
+ if (wr[iw].infos[ip].alpha_point > 0) {
+ wr[iw].infos[ip].theta = 105;
+ }
+ else {
+ wr[iw].infos[ip].theta = 75;
+ }
}
if (wr[iw].infos[ip].theta > 255 && wr[iw].infos[ip].theta < 285) {
- if (wr[iw].infos[ip].alpha_point > 0) {
- wr[iw].infos[ip].theta = 285;
- }
- else {
- wr[iw].infos[ip].theta = 255;
- }
+ if (wr[iw].infos[ip].alpha_point > 0) {
+ wr[iw].infos[ip].theta = 285;
+ }
+ else {
+ wr[iw].infos[ip].theta = 255;
+ }
}
*/
(*wr[iw]._set_label_angle) (wr[iw].rw, wr[iw].infos[ip].id,
- 120, wr[iw].infos[ip].theta);
+ 120, wr[iw].infos[ip].theta);
/* wr[iw].infos[ip].rho*/
}
}
diff --git a/generic/OverlapMan.h b/generic/OverlapMan.h
index e53908c..68f84d9 100644
--- a/generic/OverlapMan.h
+++ b/generic/OverlapMan.h
@@ -1,8 +1,8 @@
/*
* OverlapMan.h -- Track label overlap avoidance manager header file
*
- * Authors :
- * Creation date :
+ * Authors :
+ * Creation date :
*
* $Id$
*/
@@ -46,30 +46,30 @@ OmInit();
* this API.
*/
void
-OmRegister(void *w,
- void *(*_fnext_track)(void *ptr,
- void *item,
- int *x, int *y,
- int *sv_dx, int *sv_dy,
- /* Fri Oct 13 15:16:13 2000
- int *label_x, int *label_y,
- int *label_width, int *label_height,
- */
- int *rho, int *theta,
- int *visibility,
- int *locked ,
- int *preferred_angle ,
- int *convergence_style),
- void (*_fset_label_angle)(void *ptr, void *item, int rho, int theta),
- void (*_fquery_label_pos)(void *ptr, void *item, int theta,
- int *x, int *y, int *w, int *h));
+OmRegister(void *w,
+ void *(*_fnext_track)(void *ptr,
+ void *item,
+ int *x, int *y,
+ int *sv_dx, int *sv_dy,
+ /* Fri Oct 13 15:16:13 2000
+ int *label_x, int *label_y,
+ int *label_width, int *label_height,
+ */
+ int *rho, int *theta,
+ int *visibility,
+ int *locked ,
+ int *preferred_angle ,
+ int *convergence_style),
+ void (*_fset_label_angle)(void *ptr, void *item, int rho, int theta),
+ void (*_fquery_label_pos)(void *ptr, void *item, int theta,
+ int *x, int *y, int *w, int *h));
void
-OmUnregister(void *w);
+OmUnregister(void *w);
void
-OmProcessOverlap(void *zinc,
- int width,
- int height,
- double scale);
+OmProcessOverlap(void *zinc,
+ int width,
+ int height,
+ double scale);
/*
@@ -100,14 +100,14 @@ typedef struct {
wrong type) */
int
OmSetNParam(char *name, /* parameter's name */
- void *value);
+ void *value);
/* OmGetNParam
return 1 if ok , anythingelse if nok (non existing parameters ,
wrong type)
*/
int
OmGetNParam(char *name, /* parameter's name */
- void *ptvalue);
+ void *ptvalue);
/* OmGetNParamList
return 1 and next index if remains to read, the current param
@@ -117,4 +117,4 @@ int
OmGetNParamList(OmParam *current_param, int *idx_next);
-#endif /* _OverlapMan_h */
+#endif /* _OverlapMan_h */
diff --git a/generic/PostScript.c b/generic/PostScript.c
index f8458a6..d1ba9f2 100644
--- a/generic/PostScript.c
+++ b/generic/PostScript.c
@@ -1,8 +1,8 @@
/*
* PostScript.c -- Implementation of PostScript driver.
*
- * Authors : Patrick Lecoanet.
- * Creation date : Tue Jan 3 13:17:17 1995
+ * Authors : Patrick Lecoanet.
+ * Creation date : Tue Jan 3 13:17:17 1995
*
* $Id$
*/
@@ -66,78 +66,78 @@
**********************************************************************************
*/
-static const char rcsid[] = "$Id$";
+static const char rcsid[] = "$Id$";
static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ " $";
-#define PROLOG_VERSION 1.0
-#define PROLOG_REVISION 0
+#define PROLOG_VERSION 1.0
+#define PROLOG_REVISION 0
-static char ps_prolog[] = "";
+static char ps_prolog[] = "";
typedef struct _ZnPostScriptInfo {
- ZnBBox area; /* Area to print, in device coordinates. */
- ZnReal page_x; /* PostScript coordinates of anchor on page */
- ZnReal page_y;
- ZnReal page_width; /* Printed width and height of output area. */
- ZnReal page_height;
- Tk_Anchor page_anchor; /* Area anchor on Postscript page. */
- ZnBool landscape; /* True means output is rotated ccw by 90 degrees
- * (landscape mode). */
- char *font_var; /* If non-NULL, gives name of global variable
- * containing font mapping information. Malloc'ed. */
- char *color_var; /* If non-NULL, give name of global variable
- * containing color mapping information. Malloc'ed. */
- int colormode; /* Tell how color show be handled: 0 for mono,
- * 1 for gray, 2 for color. */
- char *filename; /* Name of file in which to write PostScript; NULL
- * means return Postscript info as result. Malloc'ed. */
- char *channel_name; /* If -channel is specified, the name of the channel
- * to use. Malloc'ed */
- Tcl_Channel chan; /* Open channel corresponding to fileName. */
- Tcl_HashTable font_table; /* Hash table containing names of all font families
- * used in output. The table values are not used. */
- ZnBool prepass; /* True means that we're currently in
- * the pre-pass that collects font information,
- * so the PostScript generated isn't relevant. */
- ZnBool prolog; /* True means output should contain the file
- * prolog.ps in the header. */
+ ZnBBox area; /* Area to print, in device coordinates. */
+ ZnReal page_x; /* PostScript coordinates of anchor on page */
+ ZnReal page_y;
+ ZnReal page_width; /* Printed width and height of output area. */
+ ZnReal page_height;
+ Tk_Anchor page_anchor; /* Area anchor on Postscript page. */
+ ZnBool landscape; /* True means output is rotated ccw by 90 degrees
+ * (landscape mode). */
+ char *font_var; /* If non-NULL, gives name of global variable
+ * containing font mapping information. Malloc'ed. */
+ char *color_var; /* If non-NULL, give name of global variable
+ * containing color mapping information. Malloc'ed. */
+ int colormode; /* Tell how color show be handled: 0 for mono,
+ * 1 for gray, 2 for color. */
+ char *filename; /* Name of file in which to write PostScript; NULL
+ * means return Postscript info as result. Malloc'ed. */
+ char *channel_name; /* If -channel is specified, the name of the channel
+ * to use. Malloc'ed */
+ Tcl_Channel chan; /* Open channel corresponding to fileName. */
+ Tcl_HashTable font_table; /* Hash table containing names of all font families
+ * used in output. The table values are not used. */
+ ZnBool prepass; /* True means that we're currently in
+ * the pre-pass that collects font information,
+ * so the PostScript generated isn't relevant. */
+ ZnBool prolog; /* True means output should contain the file
+ * prolog.ps in the header. */
} ZnPostScriptInfo;
static int ZnPsDimParse _ANSI_ARGS_((ClientData client_data, Tcl_Interp *interp,
- Tk_Window tkwin, Tcl_Obj *ovalue,
- char *widget_rec, int offset));
+ Tk_Window tkwin, Tcl_Obj *ovalue,
+ char *widget_rec, int offset));
static Tcl_Obj *ZnPsDimPrint _ANSI_ARGS_((ClientData client_data, Tk_Window tkwin,
- char *widget_rec, int offset,
- Tcl_FreeProc **free_proc));
+ char *widget_rec, int offset,
+ Tcl_FreeProc **free_proc));
static int ZnPsColorModeParse _ANSI_ARGS_((ClientData client_data, Tcl_Interp *interp,
- Tk_Window tkwin, Tcl_Obj *ovalue,
- char *widget_rec, int offset));
+ Tk_Window tkwin, Tcl_Obj *ovalue,
+ char *widget_rec, int offset));
static Tcl_Obj *ZnPsColorModePrint _ANSI_ARGS_((ClientData client_data, Tk_Window tkwin,
- char *widget_rec, int offset,
- Tcl_FreeProc **free_proc));
+ char *widget_rec, int offset,
+ Tcl_FreeProc **free_proc));
static int ZnBBoxParse _ANSI_ARGS_((ClientData client_data, Tcl_Interp *interp,
- Tk_Window tkwin, Tcl_Obj *ovalue,
- char *widget_rec, int offset));
-static Tcl_Obj *ZnBBoxPrint _ANSI_ARGS_((ClientData client_data, Tk_Window tkwin,
- char *widget_rec, int offset,
- Tcl_FreeProc **free_proc));
+ Tk_Window tkwin, Tcl_Obj *ovalue,
+ char *widget_rec, int offset));
+static Tcl_Obj *ZnBBoxPrint _ANSI_ARGS_((ClientData client_data, Tk_Window tkwin,
+ char *widget_rec, int offset,
+ Tcl_FreeProc **free_proc));
-static Tk_CustomOption psDimOption = {
+static Tk_CustomOption psDimOption = {
(Tk_OptionParseProc *) ZnPsDimParse,
(Tk_OptionPrintProc *) ZnPsDimPrint,
NULL
};
-static Tk_CustomOption psColorModeOption = {
+static Tk_CustomOption psColorModeOption = {
(Tk_OptionParseProc *) ZnPsColorModeParse,
(Tk_OptionPrintProc *) ZnPsColorModePrint,
NULL
};
-static Tk_CustomOption bboxOption = {
+static Tk_CustomOption bboxOption = {
(Tk_OptionParseProc *) ZnBBoxParse,
(Tk_OptionPrintProc *) ZnBBoxPrint,
NULL
@@ -148,33 +148,33 @@ static Tk_CustomOption bboxOption = {
*/
static Tk_ConfigSpec config_specs[] = {
{TK_CONFIG_CUSTOM, "-area", (char *) NULL, (char *) NULL,
- "", Tk_Offset(ZnPostScriptInfo, area), 0, &bboxOption},
+ "", Tk_Offset(ZnPostScriptInfo, area), 0, &bboxOption},
{TK_CONFIG_STRING, "-colormap", (char *) NULL, (char *) NULL,
- "", Tk_Offset(ZnPostScriptInfo, color_var), 0, NULL},
+ "", Tk_Offset(ZnPostScriptInfo, color_var), 0, NULL},
{TK_CONFIG_CUSTOM, "-colormode", (char *) NULL, (char *) NULL,
- "", Tk_Offset(ZnPostScriptInfo, colormode), 0, &psColorModeOption},
+ "", Tk_Offset(ZnPostScriptInfo, colormode), 0, &psColorModeOption},
{TK_CONFIG_STRING, "-file", (char *) NULL, (char *) NULL,
- "", Tk_Offset(ZnPostScriptInfo, filename), 0, NULL},
+ "", Tk_Offset(ZnPostScriptInfo, filename), 0, NULL},
{TK_CONFIG_STRING, "-channel", (char *) NULL, (char *) NULL,
- "", Tk_Offset(ZnPostScriptInfo, channel_name), 0, NULL},
+ "", Tk_Offset(ZnPostScriptInfo, channel_name), 0, NULL},
{TK_CONFIG_STRING, "-fontmap", (char *) NULL, (char *) NULL,
- "", Tk_Offset(ZnPostScriptInfo, font_var), 0, NULL},
+ "", Tk_Offset(ZnPostScriptInfo, font_var), 0, NULL},
{TK_CONFIG_BOOLEAN, "-landscape", (char *) NULL, (char *) NULL,
- "", Tk_Offset(ZnPostScriptInfo, landscape), 0, NULL},
+ "", Tk_Offset(ZnPostScriptInfo, landscape), 0, NULL},
{TK_CONFIG_ANCHOR, "-pageanchor", (char *) NULL, (char *) NULL,
- "", Tk_Offset(ZnPostScriptInfo, page_anchor), 0, NULL},
+ "", Tk_Offset(ZnPostScriptInfo, page_anchor), 0, NULL},
{TK_CONFIG_CUSTOM, "-pageheight", (char *) NULL, (char *) NULL,
- "", Tk_Offset(ZnPostScriptInfo, page_height), 0, &psDimOption},
+ "", Tk_Offset(ZnPostScriptInfo, page_height), 0, &psDimOption},
{TK_CONFIG_CUSTOM, "-pagewidth", (char *) NULL, (char *) NULL,
- "", Tk_Offset(ZnPostScriptInfo, page_width), 0, &psDimOption},
+ "", Tk_Offset(ZnPostScriptInfo, page_width), 0, &psDimOption},
{TK_CONFIG_CUSTOM, "-pagex", (char *) NULL, (char *) NULL,
- "", Tk_Offset(ZnPostScriptInfo, page_x), 0, &psDimOption},
+ "", Tk_Offset(ZnPostScriptInfo, page_x), 0, &psDimOption},
{TK_CONFIG_CUSTOM, "-pagey", (char *) NULL, (char *) NULL,
- "", Tk_Offset(ZnPostScriptInfo, page_y), 0, &psDimOption},
+ "", Tk_Offset(ZnPostScriptInfo, page_y), 0, &psDimOption},
{TK_CONFIG_BOOLEAN, "-prolog", (char *) NULL, (char *) NULL,
- "", Tk_Offset(ZnPostScriptInfo, prolog), 0, NULL},
+ "", Tk_Offset(ZnPostScriptInfo, prolog), 0, NULL},
{TK_CONFIG_END, (char *) NULL, (char *) NULL, (char *) NULL,
- (char *) NULL, 0, 0, NULL}
+ (char *) NULL, 0, 0, NULL}
};
@@ -183,26 +183,26 @@ static Tk_ConfigSpec config_specs[] = {
*
* ZnPsDimParse
* ZnPsDimPrint --
- * Converter for the PostScript dimension options
+ * Converter for the PostScript dimension options
* (-pagex, -pagey, -pagewidth, -pageheight).
*
*----------------------------------------------------------------------
*/
static int
-ZnPsDimParse(ClientData client_data,
- Tcl_Interp *interp,
- Tk_Window tkwin,
- Tcl_Obj *ovalue,
- char *widget_rec,
- int offset)
+ZnPsDimParse(ClientData client_data,
+ Tcl_Interp *interp,
+ Tk_Window tkwin,
+ Tcl_Obj *ovalue,
+ char *widget_rec,
+ int offset)
{
ZnReal *dim = (ZnReal *) (widget_rec + offset);
#ifdef PTK
- char *value = Tcl_GetString(ovalue);
+ char *value = Tcl_GetString(ovalue);
#else
- char *value = (char *) ovalue;
+ char *value = (char *) ovalue;
#endif
- char *end;
+ char *end;
double d;
d = strtod(value, &end);
@@ -250,14 +250,14 @@ ZnPsDimParse(ClientData client_data,
}
static Tcl_Obj *
-ZnPsDimPrint(ClientData client_data,
- Tk_Window tkwin,
- char *widget_rec,
- int offset,
+ZnPsDimPrint(ClientData client_data,
+ Tk_Window tkwin,
+ char *widget_rec,
+ int offset,
#ifdef PTK
- Tcl_FreeProc **free_proc
+ Tcl_FreeProc **free_proc
#else
- Tcl_FreeProc **free_proc
+ Tcl_FreeProc **free_proc
#endif
)
{
@@ -284,25 +284,25 @@ ZnPsDimPrint(ClientData client_data,
*
* ZnPsColorModeParse
* ZnPsColorModePrint --
- * Converter for the PostScript -colormode option.
+ * Converter for the PostScript -colormode option.
*
*----------------------------------------------------------------------
*/
static int
-ZnPsColorModeParse(ClientData client_data,
- Tcl_Interp *interp,
- Tk_Window tkwin,
- Tcl_Obj *ovalue,
- char *widget_rec,
- int offset)
+ZnPsColorModeParse(ClientData client_data,
+ Tcl_Interp *interp,
+ Tk_Window tkwin,
+ Tcl_Obj *ovalue,
+ char *widget_rec,
+ int offset)
{
- int *mode = (int *) (widget_rec + offset);
+ int *mode = (int *) (widget_rec + offset);
#ifdef PTK
- char *value = Tcl_GetString(ovalue);
+ char *value = Tcl_GetString(ovalue);
#else
- char *value = (char *) ovalue;
+ char *value = (char *) ovalue;
#endif
- int result = TCL_OK;
+ int result = TCL_OK;
if (value != NULL) {
if (strcmp(value, "monochrome") == 0) {
@@ -316,8 +316,8 @@ ZnPsColorModeParse(ClientData client_data,
}
else {
Tcl_AppendResult(interp, " incorrect PostScript color mode \"",
- value, "\" should be \"monochrome\", \"gray\"",
- " or \"color\"", NULL);
+ value, "\" should be \"monochrome\", \"gray\"",
+ " or \"color\"", NULL);
result = TCL_ERROR;
}
}
@@ -326,14 +326,14 @@ ZnPsColorModeParse(ClientData client_data,
}
static Tcl_Obj *
-ZnPsColorModePrint(ClientData client_data,
- Tk_Window tkwin,
- char *widget_rec,
- int offset,
- Tcl_FreeProc **free_proc)
+ZnPsColorModePrint(ClientData client_data,
+ Tk_Window tkwin,
+ char *widget_rec,
+ int offset,
+ Tcl_FreeProc **free_proc)
{
- int *mode = (int *) (widget_rec + offset);
- char *s;
+ int *mode = (int *) (widget_rec + offset);
+ char *s;
switch (*mode) {
case 0: s = "monochrome";
@@ -357,20 +357,20 @@ ZnPsColorModePrint(ClientData client_data,
*
* ZnBBoxParse
* ZnBBoxPrint --
- * Converter for the -area option.
+ * Converter for the -area option.
*
*----------------------------------------------------------------------
*/
static int
-ZnBBoxParse(ClientData client_data,
- Tcl_Interp *interp,
- Tk_Window tkwin,
- Tcl_Obj *ovalue,
- char *widget_rec,
- int offset)
+ZnBBoxParse(ClientData client_data,
+ Tcl_Interp *interp,
+ Tk_Window tkwin,
+ Tcl_Obj *ovalue,
+ char *widget_rec,
+ int offset)
{
ZnBBox *bbox = (ZnBBox *) (widget_rec + offset);
- int i, result, num_elems;
+ int i, result, num_elems;
Tcl_Obj **elems;
double d[4];
@@ -389,7 +389,7 @@ ZnBBoxParse(ClientData client_data,
for (i = 0; i < 4; i++) {
result = Tcl_GetDoubleFromObj(interp, elems[0], &d[0]);
if (result == TCL_ERROR) {
- goto bbox_error;
+ goto bbox_error;
}
}
bbox->orig.x = d[0];
@@ -402,16 +402,16 @@ ZnBBoxParse(ClientData client_data,
}
static Tcl_Obj *
-ZnBBoxPrint(ClientData client_data,
- Tk_Window tkwin,
- char *widget_rec,
- int offset,
+ZnBBoxPrint(ClientData client_data,
+ Tk_Window tkwin,
+ char *widget_rec,
+ int offset,
#ifdef PTK
- Tcl_FreeProc **free_proc
+ Tcl_FreeProc **free_proc
#else
- Tcl_FreeProc **free_proc
+ Tcl_FreeProc **free_proc
#endif
- )
+ )
{
ZnBBox *bbox = (ZnBBox *) (widget_rec + offset);
Tcl_Obj *obj = NULL;
@@ -466,12 +466,12 @@ ZnBBoxPrint(ClientData client_data,
fprintf(ps_info->file, "%%%%Pages: 1\n");
fprintf(ps_info->file, "%%%%DocumentData: Clean7Bit\n");
fprintf(ps_info->file, "%%%%Orientation: %s\n",
- ps_info->landscape ? "Landscape" : "Portrait");
+ ps_info->landscape ? "Landscape" : "Portrait");
fprintf(ps_info->file, "%%%%LanguageLevel: 1\n");
fprintf(ps_info->file, "%%%%DocumentNeededResources: (atend)\n");
fprintf(ps_info->file,
- "%%%%DocumentSuppliedResources: procset Zinc-Widget-Prolog %f %d\n",
- PROLOG_VERSION, PROLOG_REVISION);
+ "%%%%DocumentSuppliedResources: procset Zinc-Widget-Prolog %f %d\n",
+ PROLOG_VERSION, PROLOG_REVISION);
fprintf(ps_info->file, "%%%%EndComments\n\n\n");
/*
@@ -479,7 +479,7 @@ ZnBBoxPrint(ClientData client_data,
*/
fprintf(ps_info->file, "%%%%BeginProlog\n");
fprintf(ps_info->file, "%%%%BeginResource: procset Zinc-Widget-Prolog %f %d\n",
- PROLOG_VERSION, PROLOG_REVISION);
+ PROLOG_VERSION, PROLOG_REVISION);
fwrite(ps_prolog, 1, sizeof(ps_prolog), ps_info->file);
fprintf(ps_info->file, "%%%%EndResource\n");
fprintf(ps_info->file, "%%%%EndProlog\n");
@@ -512,7 +512,7 @@ ZnBBoxPrint(ClientData client_data,
fprintf(ps_info->file, "%%%%Trailer\n");
s = "%%DocumentNeededResources: font ";
for (fs = (XFontStruct *) ZnListArray(ps_info->fonts),
- i = ZnListSize(ps_info->fonts); i > 0; i--, fs++) {
+ i = ZnListSize(ps_info->fonts); i > 0; i--, fs++) {
fprintf(ps_info->file, "%s", s);
s = "%%+ font";
}
@@ -524,14 +524,14 @@ ZnBBoxPrint(ClientData client_data,
*
* ZnPostScriptY --
*
- * Given a y-coordinate in local coordinates, this procedure
- * returns a y-coordinate to use for PostScript output.
+ * Given a y-coordinate in local coordinates, this procedure
+ * returns a y-coordinate to use for PostScript output.
*
*--------------------------------------------------------------
*/
ZnReal
-ZnPostScriptY(ZnReal y,
- void *ps_info)
+ZnPostScriptY(ZnReal y,
+ void *ps_info)
{
return ((ZnPostScriptInfo *) ps_info)->area.corner.y - y;
}
@@ -541,27 +541,27 @@ ZnPostScriptY(ZnReal y,
*
* ZnPostScriptCmd --
*
- * This procedure process the "postscript" command for
- * zinc widgets.
+ * This procedure process the "postscript" command for
+ * zinc widgets.
*
*----------------------------------------------------------------------------
*/
int
-ZnPostScriptCmd(ZnWInfo *wi,
- int argc,
- Tcl_Obj *CONST args[])
+ZnPostScriptCmd(ZnWInfo *wi,
+ int argc,
+ Tcl_Obj *CONST args[])
{
ZnPostScriptInfo ps_info;
- void *old_info;
- int result;
- int delta_x = 0, delta_y = 0;
- ZnReal width, height;
- CONST char *p;
- Tcl_DString buffer;
+ void *old_info;
+ int result;
+ int delta_x = 0, delta_y = 0;
+ ZnReal width, height;
+ CONST char *p;
+ Tcl_DString buffer;
#define STRING_LENGTH 400
- char string[STRING_LENGTH+1];
- ZnBBox *area;
- time_t now;
+ char string[STRING_LENGTH+1];
+ ZnBBox *area;
+ time_t now;
Tcl_HashSearch search;
Tcl_HashEntry *entry;
@@ -599,11 +599,11 @@ ZnPostScriptCmd(ZnWInfo *wi,
Tcl_InitHashTable(&ps_info.font_table, TCL_STRING_KEYS);
result = Tk_ConfigureWidget(wi->interp, wi->win, config_specs, argc-2,
#ifdef PTK
- (Tcl_Obj **) args+2, (char *) &ps_info,
- TK_CONFIG_ARGV_ONLY
+ (Tcl_Obj **) args+2, (char *) &ps_info,
+ TK_CONFIG_ARGV_ONLY
#else
- (CONST char **) args+2, (char *) &ps_info,
- TK_CONFIG_ARGV_ONLY|TK_CONFIG_OBJS
+ (CONST char **) args+2, (char *) &ps_info,
+ TK_CONFIG_ARGV_ONLY|TK_CONFIG_OBJS
#endif
);
if (result != TCL_OK) {
@@ -722,7 +722,7 @@ ZnPostScriptCmd(ZnWInfo *wi,
}
if ((mode & TCL_WRITABLE) == 0) {
Tcl_AppendResult(wi->interp, "channel \"", ps_info.channel_name,
- "\" wasn't opened for writing", NULL);
+ "\" wasn't opened for writing", NULL);
result = TCL_ERROR;
goto cleanup;
}
@@ -756,68 +756,68 @@ ZnPostScriptCmd(ZnWInfo *wi,
scale_y = ps_info.page_height/ height;
Tcl_AppendResult(wi->interp,
- "%!PS-Adobe-3.0 EPSF-3.0\n",
- "%%Creator: TkZinc Widget\n",
- NULL);
+ "%!PS-Adobe-3.0 EPSF-3.0\n",
+ "%%Creator: TkZinc Widget\n",
+ NULL);
#ifdef HAVE_PW_GECOS
if (!Tcl_IsSafe(wi->interp)) {
struct passwd *pw = getpwuid(getuid());
Tcl_AppendResult(wi->interp,
- "%%For: ", (pw != NULL) ? pw->pw_gecos : "Unknown", "\n",
- NULL);
+ "%%For: ", (pw != NULL) ? pw->pw_gecos : "Unknown", "\n",
+ NULL);
endpwent();
}
#endif /* HAVE_PW_GECOS */
Tcl_AppendResult(wi->interp,
- "%%Title: Window ", Tk_PathName(wi->win), "\n",
- NULL);
+ "%%Title: Window ", Tk_PathName(wi->win), "\n",
+ NULL);
time(&now);
Tcl_AppendResult(wi->interp,
- "%%CreationDate: ", ctime(&now),
- NULL);
+ "%%CreationDate: ", ctime(&now),
+ NULL);
if (!ps_info.landscape) {
sprintf(string, "%d %d %d %d",
- (int) (ps_info.page_x + scale_x*delta_x),
- (int) (ps_info.page_y + scale_y*delta_y),
- (int) (ps_info.page_x + scale_x*(delta_x + width) + 1.0),
- (int) (ps_info.page_y + scale_y*(delta_y + height) + 1.0));
+ (int) (ps_info.page_x + scale_x*delta_x),
+ (int) (ps_info.page_y + scale_y*delta_y),
+ (int) (ps_info.page_x + scale_x*(delta_x + width) + 1.0),
+ (int) (ps_info.page_y + scale_y*(delta_y + height) + 1.0));
} else {
sprintf(string, "%d %d %d %d",
- (int) (ps_info.page_x - scale_x*(delta_y + height)),
- (int) (ps_info.page_y + scale_y*delta_x),
- (int) (ps_info.page_x - scale_x*delta_y + 1.0),
- (int) (ps_info.page_y + scale_y*(delta_x + width) + 1.0));
+ (int) (ps_info.page_x - scale_x*(delta_y + height)),
+ (int) (ps_info.page_y + scale_y*delta_x),
+ (int) (ps_info.page_x - scale_x*delta_y + 1.0),
+ (int) (ps_info.page_y + scale_y*(delta_x + width) + 1.0));
}
Tcl_AppendResult(wi->interp,
- "%%BoundingBox: ", string, "\n",
- NULL);
+ "%%BoundingBox: ", string, "\n",
+ NULL);
Tcl_AppendResult(wi->interp,
- "%%Pages: 1\n",
- "%%DocumentData: Clean7Bit\n",
- NULL);
+ "%%Pages: 1\n",
+ "%%DocumentData: Clean7Bit\n",
+ NULL);
Tcl_AppendResult(wi->interp,
- "%%Orientation: ",
- ps_info.landscape ? "Landscape\n" : "Portrait\n",
- NULL);
+ "%%Orientation: ",
+ ps_info.landscape ? "Landscape\n" : "Portrait\n",
+ NULL);
p = "%%DocumentNeededResources: font ";
for (entry = Tcl_FirstHashEntry(&ps_info.font_table, &search);
- entry != NULL; entry = Tcl_NextHashEntry(&search)) {
+ entry != NULL; entry = Tcl_NextHashEntry(&search)) {
Tcl_AppendResult(wi->interp,
- p, Tcl_GetHashKey(&ps_info.font_table, entry), "\n",
- NULL);
+ p, Tcl_GetHashKey(&ps_info.font_table, entry), "\n",
+ NULL);
p = "%%+ font ";
}
Tcl_AppendResult(wi->interp,
- "%%EndComments\n\n",
- NULL);
+ "%%EndComments\n\n",
+ NULL);
/*
* Insert the prolog
*/
Tcl_AppendResult(wi->interp,
- Tcl_GetVar(wi->interp,"::tk::ps_preamable", TCL_GLOBAL_ONLY),
- NULL);
+ Tcl_GetVar(wi->interp,"::tk::ps_preamable", TCL_GLOBAL_ONLY),
+ NULL);
if (ps_info.chan != NULL) {
/* Tcl_Write(ps_info.chan, Tcl_GetStringResult(wi->interp), -1);*/
@@ -831,18 +831,18 @@ ZnPostScriptCmd(ZnWInfo *wi,
*/
sprintf(string, "/CL %d def\n", ps_info.colormode);
Tcl_AppendResult(wi->interp,
- "%%BeginSetup\n", string,
- NULL);
+ "%%BeginSetup\n", string,
+ NULL);
for (entry = Tcl_FirstHashEntry(&ps_info.font_table, &search);
- entry != NULL; entry = Tcl_NextHashEntry(&search)) {
+ entry != NULL; entry = Tcl_NextHashEntry(&search)) {
Tcl_AppendResult(wi->interp,
- "%%IncludeResource: font ",
- Tcl_GetHashKey(&ps_info.font_table, entry), "\n",
- NULL);
+ "%%IncludeResource: font ",
+ Tcl_GetHashKey(&ps_info.font_table, entry), "\n",
+ NULL);
}
Tcl_AppendResult(wi->interp,
- "%%EndSetup\n\n",
- NULL);
+ "%%EndSetup\n\n",
+ NULL);
/*
*-----------------------------------------------------------
@@ -852,29 +852,29 @@ ZnPostScriptCmd(ZnWInfo *wi,
*-----------------------------------------------------------
*/
Tcl_AppendResult(wi->interp,
- "%%Page: 1 1\n",
- "save\n",
- NULL);
+ "%%Page: 1 1\n",
+ "save\n",
+ NULL);
sprintf(string, "%.1f %.1f translate\n", ps_info.page_x, ps_info.page_y);
Tcl_AppendResult(wi->interp, string, NULL);
if (ps_info.landscape) {
Tcl_AppendResult(wi->interp,
- "90 rotate\n",
- NULL);
+ "90 rotate\n",
+ NULL);
}
sprintf(string, "%.4g %.4g scale\n", scale_x, scale_y);
Tcl_AppendResult(wi->interp, string, NULL);
sprintf(string, "%d %d translate\n",
- (int) (delta_x - area->orig.x), (int) delta_y);
+ (int) (delta_x - area->orig.x), (int) delta_y);
Tcl_AppendResult(wi->interp, string, NULL);
sprintf(string, "%d %.15g moveto %d %.15g lineto %d %.15g lineto %d %.15g",
- (int) area->orig.x, ZnPostScriptY(area->orig.y, &ps_info),
- (int) area->corner.x, ZnPostScriptY(area->orig.y, &ps_info),
- (int) area->corner.x, ZnPostScriptY(area->corner.y, &ps_info),
- (int) area->orig.x, ZnPostScriptY(area->corner.y, &ps_info));
+ (int) area->orig.x, ZnPostScriptY(area->orig.y, &ps_info),
+ (int) area->corner.x, ZnPostScriptY(area->orig.y, &ps_info),
+ (int) area->corner.x, ZnPostScriptY(area->corner.y, &ps_info),
+ (int) area->orig.x, ZnPostScriptY(area->corner.y, &ps_info));
Tcl_AppendResult(wi->interp,
- string, " lineto closepath clip newpath\n",
- NULL);
+ string, " lineto closepath clip newpath\n",
+ NULL);
}
if (ps_info.chan != NULL) {
@@ -898,9 +898,9 @@ ZnPostScriptCmd(ZnWInfo *wi,
*/
if (ps_info.prolog) {
Tcl_AppendResult(wi->interp,
- "restore showpage\n\n",
- "%%Trailer\nend\n%%EOF\n",
- NULL);
+ "restore showpage\n\n",
+ "%%Trailer\nend\n%%EOF\n",
+ NULL);
}
if (ps_info.chan != NULL) {
/* Tcl_Write(ps_info.chan, Tcl_GetStringResult(wi->interp), -1);*/
diff --git a/generic/PostScript.h b/generic/PostScript.h
index 18939e4..2dc33e1 100644
--- a/generic/PostScript.h
+++ b/generic/PostScript.h
@@ -1,8 +1,8 @@
/*
* PostScript.h -- Header to access PostScript driver.
*
- * Authors : Patrick Lecoanet.
- * Creation date : Wed Jan 4 11:30:00 1995
+ * Authors : Patrick Lecoanet.
+ * Creation date : Wed Jan 4 11:30:00 1995
*
* $Id$
*/
@@ -45,4 +45,4 @@ struct _ZnWInfo;
int ZnPostScriptCmd(struct _ZnWInfo *wi, int argc, Tcl_Obj *CONST *args);
-#endif /* _PostScript_h */
+#endif /* _PostScript_h */
diff --git a/generic/Rectangle.c b/generic/Rectangle.c
index c8be3ca..e5a9a42 100644
--- a/generic/Rectangle.c
+++ b/generic/Rectangle.c
@@ -1,8 +1,8 @@
/*
* Rectangle.c -- Implementation of rectangle item.
*
- * Authors : Patrick Lecoanet.
- * Creation date : Fri Dec 2 14:47:42 1994
+ * Authors : Patrick Lecoanet.
+ * Creation date : Fri Dec 2 14:47:42 1994
*
* $Id$
*/
@@ -43,8 +43,8 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ "
/*
* Bit offset of flags.
*/
-#define FILLED_BIT 1 /* If the rectangle is filled with color/pattern */
-#define ALIGNED_BIT 2
+#define FILLED_BIT 1 /* If the rectangle is filled with color/pattern */
+#define ALIGNED_BIT 2
/*
@@ -56,27 +56,27 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ "
*/
typedef struct _RectangleItemStruct {
- ZnItemStruct header;
+ ZnItemStruct header;
/* Public data */
- ZnPoint coords[2];
+ ZnPoint coords[2];
unsigned short flags;
- ZnReliefStyle relief;
- ZnLineStyle line_style;
- ZnDim line_width;
- ZnGradient *line_color;
- ZnImage line_pattern;
- ZnGradient *fill_color;
- ZnImage tile;
+ ZnReliefStyle relief;
+ ZnLineStyle line_style;
+ ZnDim line_width;
+ ZnGradient *line_color;
+ ZnImage line_pattern;
+ ZnGradient *fill_color;
+ ZnImage tile;
/* Private data */
- ZnPoint dev[4];
- ZnGradient *gradient;
- ZnPoint *grad_geo;
+ ZnPoint dev[4];
+ ZnGradient *gradient;
+ ZnPoint *grad_geo;
} RectangleItemStruct, *RectangleItem;
-static ZnAttrConfig rect_attrs[] = {
+static ZnAttrConfig rect_attrs[] = {
{ ZN_CONFIG_BOOL, "-composealpha", NULL,
Tk_Offset(RectangleItemStruct, header.flags), ZN_COMPOSE_ALPHA_BIT,
ZN_DRAW_FLAG, False },
@@ -131,14 +131,14 @@ static ZnAttrConfig rect_attrs[] = {
**********************************************************************************
*/
static int
-Init(ZnItem item,
- int *argc,
- Tcl_Obj *CONST *args[])
+Init(ZnItem item,
+ int *argc,
+ Tcl_Obj *CONST *args[])
{
- ZnWInfo *wi = item->wi;
- RectangleItem rect = (RectangleItem) item;
- unsigned int num_points;
- ZnPoint *points;
+ ZnWInfo *wi = item->wi;
+ RectangleItem rect = (RectangleItem) item;
+ unsigned int num_points;
+ ZnPoint *points;
rect->gradient = NULL;
rect->grad_geo = NULL;
@@ -156,7 +156,7 @@ Init(ZnItem item,
return TCL_ERROR;
}
if (ZnParseCoordList(wi, (*args)[0], &points,
- NULL, &num_points, NULL) == TCL_ERROR) {
+ NULL, &num_points, NULL) == TCL_ERROR) {
return TCL_ERROR;
}
if (num_points != 2) {
@@ -189,9 +189,9 @@ Init(ZnItem item,
**********************************************************************************
*/
static void
-Clone(ZnItem item)
+Clone(ZnItem item)
{
- RectangleItem rect = (RectangleItem) item;
+ RectangleItem rect = (RectangleItem) item;
if (rect->gradient) {
rect->gradient = ZnGetGradientByValue(rect->gradient);
@@ -216,9 +216,9 @@ Clone(ZnItem item)
**********************************************************************************
*/
static void
-Destroy(ZnItem item)
+Destroy(ZnItem item)
{
- RectangleItem rect = (RectangleItem) item;
+ RectangleItem rect = (RectangleItem) item;
if (rect->tile != ZnUnspecifiedImage) {
ZnFreeImage(rect->tile, ZnUpdateItemImage, item);
@@ -247,15 +247,15 @@ Destroy(ZnItem item)
**********************************************************************************
*/
static int
-Configure(ZnItem item,
- int argc,
- Tcl_Obj *CONST argv[],
- int *flags)
+Configure(ZnItem item,
+ int argc,
+ Tcl_Obj *CONST argv[],
+ int *flags)
{
- ZnWInfo *wi = item->wi;
- RectangleItem rect = (RectangleItem) item;
- int status = TCL_OK;
- XColor *color;
+ ZnWInfo *wi = item->wi;
+ RectangleItem rect = (RectangleItem) item;
+ int status = TCL_OK;
+ XColor *color;
unsigned short alpha;
status = ZnConfigureAttributes(wi, item, item, rect_attrs, argc, argv, flags);
@@ -268,7 +268,7 @@ Configure(ZnItem item,
if ((rect->relief != ZN_RELIEF_FLAT) && !rect->gradient) {
color = ZnGetGradientColor(rect->line_color, 51.0, &alpha);
rect->gradient = ZnGetReliefGradient(wi->interp, wi->win,
- Tk_NameOfColor(color), alpha);
+ Tk_NameOfColor(color), alpha);
if (rect->gradient == NULL) {
status = TCL_ERROR;
}
@@ -286,9 +286,9 @@ Configure(ZnItem item,
**********************************************************************************
*/
static int
-Query(ZnItem item,
- int argc,
- Tcl_Obj *CONST argv[])
+Query(ZnItem item,
+ int argc,
+ Tcl_Obj *CONST argv[])
{
if (ZnQueryAttribute(item->wi->interp, item, rect_attrs, argv[0]) == TCL_ERROR) {
return TCL_ERROR;
@@ -306,15 +306,15 @@ Query(ZnItem item,
**********************************************************************************
*/
static void
-ComputeCoordinates(ZnItem item,
- ZnBool force)
+ComputeCoordinates(ZnItem item,
+ ZnBool force)
{
- ZnWInfo *wi = item->wi;
- RectangleItem rect = (RectangleItem) item;
- ZnPoint p[4];
- int i;
- ZnBool aligned;
- ZnDim delta, lw2;
+ ZnWInfo *wi = item->wi;
+ RectangleItem rect = (RectangleItem) item;
+ ZnPoint p[4];
+ int i;
+ ZnBool aligned;
+ ZnDim delta, lw2;
ZnResetBBox(&item->item_bounding_box);
if (!rect->line_width && ISCLEAR(rect->flags, FILLED_BIT)) {
@@ -363,31 +363,31 @@ ComputeCoordinates(ZnItem item,
* Compute the gradient geometry
*/
if (!ZnGradientFlat(rect->fill_color)) {
- ZnPoly shape;
+ ZnPoly shape;
if (rect->fill_color->type == ZN_AXIAL_GRADIENT) {
- int angle = rect->fill_color->angle;
+ int angle = rect->fill_color->angle;
if ((angle != 0) && (angle != 90) && (angle != 180) && (angle != 270)) {
- if (!rect->grad_geo) {
- rect->grad_geo = ZnMalloc(6*sizeof(ZnPoint));
- }
- ZnPolyContour1(&shape, p, 4, False);
- ZnComputeGradient(rect->fill_color, wi, &shape, rect->grad_geo);
+ if (!rect->grad_geo) {
+ rect->grad_geo = ZnMalloc(6*sizeof(ZnPoint));
+ }
+ ZnPolyContour1(&shape, p, 4, False);
+ ZnComputeGradient(rect->fill_color, wi, &shape, rect->grad_geo);
}
else {
- goto free_ggeo;
+ goto free_ggeo;
}
}
else {
if (!rect->grad_geo) {
- rect->grad_geo = ZnMalloc(6*sizeof(ZnPoint));
+ rect->grad_geo = ZnMalloc(6*sizeof(ZnPoint));
}
if (rect->fill_color->type == ZN_PATH_GRADIENT) {
- ZnPolyContour1(&shape, rect->coords, 2, False);
+ ZnPolyContour1(&shape, rect->coords, 2, False);
}
else {
- ZnPolyContour1(&shape, p, 4, False);
+ ZnPolyContour1(&shape, p, 4, False);
}
ZnComputeGradient(rect->fill_color, wi, &shape, rect->grad_geo);
}
@@ -407,18 +407,18 @@ ComputeCoordinates(ZnItem item,
**********************************************************************************
*
* ToArea --
- * Tell if the object is entirely outside (-1),
- * entirely inside (1) or in between (0).
+ * Tell if the object is entirely outside (-1),
+ * entirely inside (1) or in between (0).
*
**********************************************************************************
*/
static int
-ToArea(ZnItem item,
- ZnToArea ta)
+ToArea(ZnItem item,
+ ZnToArea ta)
{
- RectangleItem rect = (RectangleItem) item;
- int result, result2;
- ZnBBox *area = ta->area;
+ RectangleItem rect = (RectangleItem) item;
+ int result, result2;
+ ZnBBox *area = ta->area;
result = -1;
@@ -429,18 +429,18 @@ ToArea(ZnItem item,
}
}
if (rect->line_width > 0) {
- int i;
- ZnPoint pts[5];
+ int i;
+ ZnPoint pts[5];
for (i = 0; i < 4; i++) {
pts[i] = rect->dev[i];
}
pts[4] = pts[0];
result2 = ZnPolylineInBBox(pts, 5, rect->line_width,
- CapProjecting, JoinMiter, area);
+ CapProjecting, JoinMiter, area);
if (ISCLEAR(rect->flags, FILLED_BIT)) {
if (result2 == 0) {
- return 0;
+ return 0;
}
result = result2;
}
@@ -461,14 +461,14 @@ ToArea(ZnItem item,
**********************************************************************************
*/
static void
-Draw(ZnItem item)
+Draw(ZnItem item)
{
- ZnWInfo *wi = item->wi;
- RectangleItem rect = (RectangleItem) item;
- XGCValues values;
- unsigned int i, gc_mask;
- XRectangle r;
- XPoint xp[5];
+ ZnWInfo *wi = item->wi;
+ RectangleItem rect = (RectangleItem) item;
+ XGCValues values;
+ unsigned int i, gc_mask;
+ XRectangle r;
+ XPoint xp[5];
if (ISSET(rect->flags, ALIGNED_BIT)) {
if (rect->dev[0].x < rect->dev[2].x) {
@@ -503,33 +503,33 @@ Draw(ZnItem item)
values.foreground = ZnGetGradientPixel(rect->fill_color, 0.0);
if (rect->tile != ZnUnspecifiedImage) {
if (!ZnImageIsBitmap(rect->tile)) { /* Fill tiled */
- values.fill_style = FillTiled;
- values.tile = ZnImagePixmap(rect->tile, wi->win);
- if (ISSET(rect->flags, ALIGNED_BIT)) {
- values.ts_x_origin = (int) r.x;
- values.ts_y_origin = (int) r.y;
- }
- else {
- values.ts_x_origin = (int) item->item_bounding_box.orig.x;
- values.ts_y_origin = (int) item->item_bounding_box.orig.y;
- }
- XChangeGC(wi->dpy, wi->gc,
- GCTileStipXOrigin|GCTileStipYOrigin|GCFillStyle|GCTile, &values);
+ values.fill_style = FillTiled;
+ values.tile = ZnImagePixmap(rect->tile, wi->win);
+ if (ISSET(rect->flags, ALIGNED_BIT)) {
+ values.ts_x_origin = (int) r.x;
+ values.ts_y_origin = (int) r.y;
+ }
+ else {
+ values.ts_x_origin = (int) item->item_bounding_box.orig.x;
+ values.ts_y_origin = (int) item->item_bounding_box.orig.y;
+ }
+ XChangeGC(wi->dpy, wi->gc,
+ GCTileStipXOrigin|GCTileStipYOrigin|GCFillStyle|GCTile, &values);
}
else {
- values.fill_style = FillStippled;
- values.stipple = ZnImagePixmap(rect->tile, wi->win);
- if (ISSET(rect->flags, ALIGNED_BIT)) {
- values.ts_x_origin = (int) r.x;
- values.ts_y_origin = (int) r.y;
- }
- else {
- values.ts_x_origin = (int) item->item_bounding_box.orig.x;
- values.ts_y_origin = (int) item->item_bounding_box.orig.y;
- }
- XChangeGC(wi->dpy, wi->gc,
- GCTileStipXOrigin|GCTileStipYOrigin|GCFillStyle|GCStipple|GCForeground,
- &values);
+ values.fill_style = FillStippled;
+ values.stipple = ZnImagePixmap(rect->tile, wi->win);
+ if (ISSET(rect->flags, ALIGNED_BIT)) {
+ values.ts_x_origin = (int) r.x;
+ values.ts_y_origin = (int) r.y;
+ }
+ else {
+ values.ts_x_origin = (int) item->item_bounding_box.orig.x;
+ values.ts_y_origin = (int) item->item_bounding_box.orig.y;
+ }
+ XChangeGC(wi->dpy, wi->gc,
+ GCTileStipXOrigin|GCTileStipYOrigin|GCFillStyle|GCStipple|GCForeground,
+ &values);
}
}
else { /* Fill solid */
@@ -538,7 +538,7 @@ Draw(ZnItem item)
}
if (ISSET(rect->flags, ALIGNED_BIT)) {
XFillRectangle(wi->dpy, wi->draw_buffer, wi->gc, r.x, r.y,
- r.width, r.height);
+ r.width, r.height);
}
else {
XFillPolygon(wi->dpy, wi->draw_buffer, wi->gc, xp, 4, Convex, CoordModeOrigin);
@@ -549,18 +549,18 @@ Draw(ZnItem item)
if (rect->line_width) {
if (rect->relief != ZN_RELIEF_FLAT) {
if (ISSET(rect->flags, ALIGNED_BIT)) {
- ZnDrawRectangleRelief(wi, rect->relief, rect->gradient,
- &r, rect->line_width);
+ ZnDrawRectangleRelief(wi, rect->relief, rect->gradient,
+ &r, rect->line_width);
}
else {
- ZnPoint p[5];
- for (i = 0; i < 4; i++) {
- p[4-i].x = rect->dev[i].x;
- p[4-i].y = rect->dev[i].y;
- }
- p[0] = p[4];
- ZnDrawPolygonRelief(wi, rect->relief, rect->gradient,
- p, 5, rect->line_width);
+ ZnPoint p[5];
+ for (i = 0; i < 4; i++) {
+ p[4-i].x = rect->dev[i].x;
+ p[4-i].y = rect->dev[i].y;
+ }
+ p[0] = p[4];
+ ZnDrawPolygonRelief(wi, rect->relief, rect->gradient,
+ p, 5, rect->line_width);
}
}
else {
@@ -570,25 +570,25 @@ Draw(ZnItem item)
values.line_width = (rect->line_width == 1) ? 0 : (int) rect->line_width;
values.join_style = JoinMiter;
if (ISCLEAR(rect->flags, ALIGNED_BIT)) {
- gc_mask |= GCCapStyle;
- values.cap_style = CapProjecting;
+ gc_mask |= GCCapStyle;
+ values.cap_style = CapProjecting;
}
if (rect->line_pattern == ZnUnspecifiedImage) {
- values.fill_style = FillSolid;
- XChangeGC(wi->dpy, wi->gc, gc_mask, &values);
+ values.fill_style = FillSolid;
+ XChangeGC(wi->dpy, wi->gc, gc_mask, &values);
}
else {
- values.fill_style = FillStippled;
- values.stipple = ZnImagePixmap(rect->line_pattern, wi->win);
- gc_mask |= GCStipple;
- XChangeGC(wi->dpy, wi->gc, gc_mask, &values);
+ values.fill_style = FillStippled;
+ values.stipple = ZnImagePixmap(rect->line_pattern, wi->win);
+ gc_mask |= GCStipple;
+ XChangeGC(wi->dpy, wi->gc, gc_mask, &values);
}
if (ISSET(rect->flags, ALIGNED_BIT)) {
- XDrawRectangle(wi->dpy, wi->draw_buffer, wi->gc, r.x, r.y,
- r.width, r.height);
+ XDrawRectangle(wi->dpy, wi->draw_buffer, wi->gc, r.x, r.y,
+ r.width, r.height);
}
else {
- XDrawLines(wi->dpy, wi->draw_buffer, wi->gc, xp, 5, CoordModeOrigin);
+ XDrawLines(wi->dpy, wi->draw_buffer, wi->gc, xp, 5, CoordModeOrigin);
}
}
}
@@ -606,7 +606,7 @@ Draw(ZnItem item)
static void
RectRenderCB(void *closure)
{
- RectangleItem rect = (RectangleItem) closure;
+ RectangleItem rect = (RectangleItem) closure;
glBegin(GL_TRIANGLE_STRIP);
glVertex2d(rect->dev[0].x, rect->dev[0].y);
@@ -619,11 +619,11 @@ RectRenderCB(void *closure)
#ifdef GL
static void
-Render(ZnItem item)
+Render(ZnItem item)
{
- ZnWInfo *wi = item->wi;
- RectangleItem rect = (RectangleItem) item;
- int i;
+ ZnWInfo *wi = item->wi;
+ RectangleItem rect = (RectangleItem) item;
+ int i;
#ifdef GL_LIST
if (!item->gl_list) {
@@ -634,51 +634,51 @@ Render(ZnItem item)
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
if (!ZnGradientFlat(rect->fill_color)) {
- ZnBool fast = (rect->fill_color->type == ZN_AXIAL_GRADIENT) && !rect->grad_geo;
- ZnPoly poly;
-
- ZnPolyContour1(&poly, rect->dev, 4, False);
- ZnRenderGradient(wi, rect->fill_color,
- fast ? NULL: RectRenderCB, rect,
- fast ? rect->dev : rect->grad_geo, &poly);
+ ZnBool fast = (rect->fill_color->type == ZN_AXIAL_GRADIENT) && !rect->grad_geo;
+ ZnPoly poly;
+
+ ZnPolyContour1(&poly, rect->dev, 4, False);
+ ZnRenderGradient(wi, rect->fill_color,
+ fast ? NULL: RectRenderCB, rect,
+ fast ? rect->dev : rect->grad_geo, &poly);
}
else if (rect->tile != ZnUnspecifiedImage) { /* Fill tiled/patterned */
- if (ISSET(rect->flags, ALIGNED_BIT)) {
- ZnBBox bbox;
-
- bbox.orig = rect->dev[0];
- bbox.corner = rect->dev[2];
- ZnRenderTile(wi, rect->tile, rect->fill_color, NULL, NULL, (ZnPoint *) &bbox);
- }
- else {
- ZnRenderTile(wi, rect->tile, rect->fill_color, RectRenderCB,
- rect, (ZnPoint *) &item->item_bounding_box);
- }
+ if (ISSET(rect->flags, ALIGNED_BIT)) {
+ ZnBBox bbox;
+
+ bbox.orig = rect->dev[0];
+ bbox.corner = rect->dev[2];
+ ZnRenderTile(wi, rect->tile, rect->fill_color, NULL, NULL, (ZnPoint *) &bbox);
+ }
+ else {
+ ZnRenderTile(wi, rect->tile, rect->fill_color, RectRenderCB,
+ rect, (ZnPoint *) &item->item_bounding_box);
+ }
}
else {
- unsigned short alpha;
- XColor *color = ZnGetGradientColor(rect->fill_color, 0.0, &alpha);
- alpha = ZnComposeAlpha(alpha, wi->alpha);
- glColor4us(color->red, color->green, color->blue, alpha);
- RectRenderCB(rect);
+ unsigned short alpha;
+ XColor *color = ZnGetGradientColor(rect->fill_color, 0.0, &alpha);
+ alpha = ZnComposeAlpha(alpha, wi->alpha);
+ glColor4us(color->red, color->green, color->blue, alpha);
+ RectRenderCB(rect);
}
}
if (rect->line_width) {
ZnPoint p[5];
for (i = 0; i < 4; i++) {
- p[4-i].x = rect->dev[i].x;
- p[4-i].y = rect->dev[i].y;
+ p[4-i].x = rect->dev[i].x;
+ p[4-i].y = rect->dev[i].y;
}
p[0] = p[4];
if (rect->relief != ZN_RELIEF_FLAT) {
- ZnRenderPolygonRelief(wi, rect->relief, rect->gradient, False,
- p, 5, rect->line_width);
+ ZnRenderPolygonRelief(wi, rect->relief, rect->gradient, False,
+ p, 5, rect->line_width);
}
else {
- ZnRenderPolyline(wi, p, 5, rect->line_width,
- rect->line_style, CapRound, JoinMiter,
- NULL, NULL, rect->line_color);
+ ZnRenderPolyline(wi, p, 5, rect->line_width,
+ rect->line_style, CapRound, JoinMiter,
+ NULL, NULL, rect->line_color);
}
}
#ifdef GL_LIST
@@ -690,7 +690,7 @@ Render(ZnItem item)
}
#else
static void
-Render(ZnItem item)
+Render(ZnItem item)
{
}
#endif
@@ -704,11 +704,11 @@ Render(ZnItem item)
**********************************************************************************
*/
static ZnBool
-IsSensitive(ZnItem item,
- int item_part)
+IsSensitive(ZnItem item,
+ int item_part)
{
return (ISSET(item->flags, ZN_SENSITIVE_BIT) &&
- item->parent->class->IsSensitive(item->parent, ZN_NO_PART));
+ item->parent->class->IsSensitive(item->parent, ZN_NO_PART));
}
@@ -720,12 +720,12 @@ IsSensitive(ZnItem item,
**********************************************************************************
*/
static double
-Pick(ZnItem item,
- ZnPick ps)
+Pick(ZnItem item,
+ ZnPick ps)
{
- RectangleItem rect = (RectangleItem) item;
- double best_dist;
- ZnPoint *p = ps->point;
+ RectangleItem rect = (RectangleItem) item;
+ double best_dist;
+ ZnPoint *p = ps->point;
best_dist = ZnPolygonToPointDist(rect->dev, 4, p);
@@ -737,16 +737,16 @@ Pick(ZnItem item,
best_dist = ABS(best_dist);
if (rect->line_width > 1) {
- double dist;
- int i;
- ZnPoint pts[5];
+ double dist;
+ int i;
+ ZnPoint pts[5];
for (i = 0; i < 4; i++) {
pts[i] = rect->dev[i];
}
pts[4] = pts[0];
dist = ZnPolylineToPointDist(pts, 5, rect->line_width,
- CapProjecting, JoinMiter, p);
+ CapProjecting, JoinMiter, p);
if (dist <= 0.0) {
return 0.0;
}
@@ -765,8 +765,8 @@ Pick(ZnItem item,
**********************************************************************************
*/
static void
-PostScript(ZnItem item,
- ZnBool prepass)
+PostScript(ZnItem item,
+ ZnBool prepass)
{
}
@@ -775,17 +775,17 @@ PostScript(ZnItem item,
**********************************************************************************
*
* GetClipVertices --
- * Get the clipping shape.
- * Never ever call ZnTriFree on the tristrip returned by GetClipVertices.
+ * Get the clipping shape.
+ * Never ever call ZnTriFree on the tristrip returned by GetClipVertices.
*
**********************************************************************************
*/
static ZnBool
-GetClipVertices(ZnItem item,
- ZnTriStrip *tristrip)
+GetClipVertices(ZnItem item,
+ ZnTriStrip *tristrip)
{
- RectangleItem rect = (RectangleItem) item;
- ZnPoint *points;
+ RectangleItem rect = (RectangleItem) item;
+ ZnPoint *points;
if (ISSET(rect->flags, ALIGNED_BIT)) {
ZnListAssertSize(ZnWorkPoints, 2);
@@ -828,30 +828,30 @@ GetClipVertices(ZnItem item,
**********************************************************************************
*
* Coords --
- * Return or edit the item vertices.
+ * Return or edit the item vertices.
*
**********************************************************************************
*/
static int
-Coords(ZnItem item,
- int contour,
- int index,
- int cmd,
- ZnPoint **pts,
- char **controls,
- unsigned int *num_pts)
+Coords(ZnItem item,
+ int contour,
+ int index,
+ int cmd,
+ ZnPoint **pts,
+ char **controls,
+ unsigned int *num_pts)
{
- RectangleItem rect = (RectangleItem) item;
+ RectangleItem rect = (RectangleItem) item;
if ((cmd == ZN_COORDS_ADD) || (cmd == ZN_COORDS_ADD_LAST) || (cmd == ZN_COORDS_REMOVE)) {
Tcl_AppendResult(item->wi->interp,
- " rectangles can't add or remove vertices", NULL);
+ " rectangles can't add or remove vertices", NULL);
return TCL_ERROR;
}
else if (cmd == ZN_COORDS_REPLACE_ALL) {
if (*num_pts != 2) {
Tcl_AppendResult(item->wi->interp,
- " coords command need 2 points on rectangles", NULL);
+ " coords command need 2 points on rectangles", NULL);
return TCL_ERROR;
}
rect->coords[0] = (*pts)[0];
@@ -861,7 +861,7 @@ Coords(ZnItem item,
else if (cmd == ZN_COORDS_REPLACE) {
if (*num_pts < 1) {
Tcl_AppendResult(item->wi->interp,
- " coords command need at least 1 point", NULL);
+ " coords command need at least 1 point", NULL);
return TCL_ERROR;
}
if (index < 0) {
@@ -870,7 +870,7 @@ Coords(ZnItem item,
if ((index < 0) || (index > 1)) {
range_err:
Tcl_AppendResult(item->wi->interp,
- " incorrect coord index, should be between -2 and 1", NULL);
+ " incorrect coord index, should be between -2 and 1", NULL);
return TCL_ERROR;
}
rect->coords[index] = (*pts)[0];
@@ -903,16 +903,16 @@ Coords(ZnItem item,
**********************************************************************************
*/
static void
-GetAnchor(ZnItem item,
- Tk_Anchor anchor,
- ZnPoint *p)
+GetAnchor(ZnItem item,
+ Tk_Anchor anchor,
+ ZnPoint *p)
{
ZnBBox *bbox = &item->item_bounding_box;
ZnOrigin2Anchor(&bbox->orig,
- bbox->corner.x - bbox->orig.x,
- bbox->corner.y - bbox->orig.y,
- anchor, p);
+ bbox->corner.x - bbox->orig.x,
+ bbox->corner.y - bbox->orig.y,
+ anchor, p);
}
@@ -927,33 +927,33 @@ static ZnItemClassStruct RECTANGLE_ITEM_CLASS = {
"rectangle",
sizeof(RectangleItemStruct),
rect_attrs,
- 0, /* num_parts */
- 0, /* flags */
+ 0, /* num_parts */
+ 0, /* flags */
-1,
Init,
Clone,
Destroy,
Configure,
Query,
- NULL, /* GetFieldSet */
+ NULL, /* GetFieldSet */
GetAnchor,
GetClipVertices,
- NULL, /* GetContours */
+ NULL, /* GetContours */
Coords,
- NULL, /* InsertChars */
- NULL, /* DeleteChars */
- NULL, /* Cursor */
- NULL, /* Index */
- NULL, /* Part */
- NULL, /* Selection */
- NULL, /* Contour */
+ NULL, /* InsertChars */
+ NULL, /* DeleteChars */
+ NULL, /* Cursor */
+ NULL, /* Index */
+ NULL, /* Part */
+ NULL, /* Selection */
+ NULL, /* Contour */
ComputeCoordinates,
ToArea,
Draw,
Render,
IsSensitive,
Pick,
- NULL, /* PickVertex */
+ NULL, /* PickVertex */
PostScript
};
diff --git a/generic/Reticle.c b/generic/Reticle.c
index 3011f5d..844fcc7 100644
--- a/generic/Reticle.c
+++ b/generic/Reticle.c
@@ -1,8 +1,8 @@
/*
* Reticle.c -- Implementation of Reticle item.
*
- * Authors : Patrick Lecoanet.
- * Creation date : Mon Feb 1 12:13:24 1999
+ * Authors : Patrick Lecoanet.
+ * Creation date : Mon Feb 1 12:13:24 1999
*
* $Id$
*/
@@ -43,13 +43,13 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ "
/*
* Draw as many circles as visible.
*/
-#define ANY_CIRCLES -1
+#define ANY_CIRCLES -1
/*
* Some default values.
*/
-#define DEFAULT_RETICLE_STEP_SIZE 80
-#define DEFAULT_RETICLE_PERIOD 5
+#define DEFAULT_RETICLE_STEP_SIZE 80
+#define DEFAULT_RETICLE_PERIOD 5
/*
**********************************************************************************
@@ -60,27 +60,27 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ "
*/
typedef struct _ReticleItemStruct {
- ZnItemStruct header;
+ ZnItemStruct header;
/* Public data */
- ZnPoint pos; /* Origin world coordinates */
- ZnGradient *line_color; /* circle color */
- ZnGradient *bright_line_color; /* intermediate circle color */
- ZnDim first_radius; /* first world radius */
- ZnDim step_size; /* step world size */
- int period; /* bright circle period */
- int num_circles; /* num cercles max */
- ZnLineStyle line_style; /* circles lines styles */
- ZnLineStyle bright_line_style;
+ ZnPoint pos; /* Origin world coordinates */
+ ZnGradient *line_color; /* circle color */
+ ZnGradient *bright_line_color; /* intermediate circle color */
+ ZnDim first_radius; /* first world radius */
+ ZnDim step_size; /* step world size */
+ int period; /* bright circle period */
+ int num_circles; /* num cercles max */
+ ZnLineStyle line_style; /* circles lines styles */
+ ZnLineStyle bright_line_style;
/* Private data */
- ZnPoint dev; /* item device coordinate */
- ZnDim first_radius_dev; /* first device radius */
- ZnDim step_size_dev; /* steps device size */
+ ZnPoint dev; /* item device coordinate */
+ ZnDim first_radius_dev; /* first device radius */
+ ZnDim step_size_dev; /* steps device size */
} ReticleItemStruct, *ReticleItem;
-static ZnAttrConfig reticle_attrs[] = {
+static ZnAttrConfig reticle_attrs[] = {
{ ZN_CONFIG_GRADIENT, "-brightlinecolor", NULL,
Tk_Offset(ReticleItemStruct, bright_line_color), 0, ZN_DRAW_FLAG, False },
{ ZN_CONFIG_LINE_STYLE, "-brightlinestyle", NULL,
@@ -136,12 +136,12 @@ static ZnAttrConfig reticle_attrs[] = {
**********************************************************************************
*/
static int
-Init(ZnItem item,
- int *argc,
- Tcl_Obj *CONST *args[])
+Init(ZnItem item,
+ int *argc,
+ Tcl_Obj *CONST *args[])
{
- ReticleItem reticle = (ReticleItem) item;
- ZnWInfo *wi = item->wi;
+ ReticleItem reticle = (ReticleItem) item;
+ ZnWInfo *wi = item->wi;
SET(item->flags, ZN_VISIBLE_BIT);
CLEAR(item->flags, ZN_SENSITIVE_BIT);
@@ -177,9 +177,9 @@ Init(ZnItem item,
**********************************************************************************
*/
static void
-Clone(ZnItem item)
+Clone(ZnItem item)
{
- ReticleItem reticle = (ReticleItem) item;
+ ReticleItem reticle = (ReticleItem) item;
reticle->line_color = ZnGetGradientByValue(reticle->line_color);
reticle->bright_line_color = ZnGetGradientByValue(reticle->bright_line_color);
@@ -194,9 +194,9 @@ Clone(ZnItem item)
**********************************************************************************
*/
static void
-Destroy(ZnItem item)
+Destroy(ZnItem item)
{
- ReticleItem reticle = (ReticleItem) item;
+ ReticleItem reticle = (ReticleItem) item;
ZnFreeGradient(reticle->line_color);
ZnFreeGradient(reticle->bright_line_color);
@@ -211,13 +211,13 @@ Destroy(ZnItem item)
**********************************************************************************
*/
static int
-Configure(ZnItem item,
- int argc,
- Tcl_Obj *CONST argv[],
- int *flags)
+Configure(ZnItem item,
+ int argc,
+ Tcl_Obj *CONST argv[],
+ int *flags)
{
if (ZnConfigureAttributes(item->wi, item, item, reticle_attrs,
- argc, argv, flags) == TCL_ERROR) {
+ argc, argv, flags) == TCL_ERROR) {
return TCL_ERROR;
}
@@ -233,9 +233,9 @@ Configure(ZnItem item,
**********************************************************************************
*/
static int
-Query(ZnItem item,
- int argc,
- Tcl_Obj *CONST argv[])
+Query(ZnItem item,
+ int argc,
+ Tcl_Obj *CONST argv[])
{
if (ZnQueryAttribute(item->wi->interp, item, reticle_attrs, argv[0]) == TCL_ERROR) {
return TCL_ERROR;
@@ -253,13 +253,13 @@ Query(ZnItem item,
**********************************************************************************
*/
static void
-ComputeCoordinates(ZnItem item,
- ZnBool force)
+ComputeCoordinates(ZnItem item,
+ ZnBool force)
{
- ZnWInfo *wi = item->wi;
- ReticleItem reticle = (ReticleItem) item;
- ZnDim half_width;
- ZnPoint p, xp;
+ ZnWInfo *wi = item->wi;
+ ReticleItem reticle = (ReticleItem) item;
+ ZnDim half_width;
+ ZnPoint p, xp;
/* Compute center device coordinates */
p.x = p.y = 0;
@@ -299,14 +299,14 @@ ComputeCoordinates(ZnItem item,
**********************************************************************************
*
* ToArea --
- * Tell if the object is entirely outside (-1),
- * entirely inside (1) or in between (0).
+ * Tell if the object is entirely outside (-1),
+ * entirely inside (1) or in between (0).
*
**********************************************************************************
*/
static int
-ToArea(ZnItem item,
- ZnToArea ta)
+ToArea(ZnItem item,
+ ZnToArea ta)
{
return -1;
}
@@ -320,31 +320,31 @@ ToArea(ZnItem item,
**********************************************************************************
*/
static void
-Draw(ZnItem item)
+Draw(ZnItem item)
{
- ZnWInfo *wi = item->wi;
- ReticleItem reticle = (ReticleItem) item;
- ZnDim radius = reticle->first_radius_dev;
- ZnDim radius_max_dev;
- XGCValues values;
- int i;
- ZnDim l1, l2, l3, l4;
-/* int count = 0;*/
+ ZnWInfo *wi = item->wi;
+ ReticleItem reticle = (ReticleItem) item;
+ ZnDim radius = reticle->first_radius_dev;
+ ZnDim radius_max_dev;
+ XGCValues values;
+ int i;
+ ZnDim l1, l2, l3, l4;
+/* int count = 0;*/
/* Compute radius max */
l1 = (ZnDim) hypot(wi->damaged_area.orig.x - reticle->dev.x,
- wi->damaged_area.orig.y - reticle->dev.y);
+ wi->damaged_area.orig.y - reticle->dev.y);
l2 = (ZnDim) hypot(wi->damaged_area.corner.x - reticle->dev.x,
- wi->damaged_area.orig.y - reticle->dev.y);
+ wi->damaged_area.orig.y - reticle->dev.y);
l3 = (ZnDim) hypot(wi->damaged_area.orig.x - reticle->dev.x,
- wi->damaged_area.corner.y - reticle->dev.y);
+ wi->damaged_area.corner.y - reticle->dev.y);
l4 = (ZnDim) hypot(wi->damaged_area.corner.x - reticle->dev.x,
- wi->damaged_area.corner.y - reticle->dev.y);
+ wi->damaged_area.corner.y - reticle->dev.y);
radius_max_dev = MAX(MAX(l1,l2), MAX(l3, l4));
if (reticle->num_circles > 0) {
radius_max_dev = MIN(radius_max_dev, reticle->first_radius_dev +
- (reticle->num_circles - 1) * reticle->step_size_dev);
+ (reticle->num_circles - 1) * reticle->step_size_dev);
}
while (radius <= radius_max_dev) {
@@ -355,35 +355,35 @@ Draw(ZnItem item)
XChangeGC(wi->dpy, wi->gc, GCForeground | GCLineWidth | GCFillStyle, &values);
for (i = 1; ((radius <= radius_max_dev) && (i < reticle->period)); i++) {
if ((reticle->dev.x >= wi->damaged_area.orig.x - radius) &&
- (reticle->dev.x <= wi->damaged_area.corner.x + radius) &&
- (reticle->dev.y >= wi->damaged_area.orig.y - radius) &&
- (reticle->dev.y <= wi->damaged_area.corner.y + radius)) {
- XDrawArc(wi->dpy, wi->draw_buffer, wi->gc,
- (int) (reticle->dev.x - radius),
- (int) (reticle->dev.y - radius),
- (unsigned int) (radius * 2 - 1),
- (unsigned int) (radius * 2 - 1),
- 0, 360 * 64);
-/* count++;*/
+ (reticle->dev.x <= wi->damaged_area.corner.x + radius) &&
+ (reticle->dev.y >= wi->damaged_area.orig.y - radius) &&
+ (reticle->dev.y <= wi->damaged_area.corner.y + radius)) {
+ XDrawArc(wi->dpy, wi->draw_buffer, wi->gc,
+ (int) (reticle->dev.x - radius),
+ (int) (reticle->dev.y - radius),
+ (unsigned int) (radius * 2 - 1),
+ (unsigned int) (radius * 2 - 1),
+ 0, 360 * 64);
+/* count++;*/
}
radius += (reticle->step_size_dev);
}
if ((radius <= radius_max_dev) &&
- (reticle->dev.x >= wi->damaged_area.orig.x - radius) &&
- (reticle->dev.x <= wi->damaged_area.corner.x + radius) &&
- (reticle->dev.y >= wi->damaged_area.orig.y - radius) &&
- (reticle->dev.y <= wi->damaged_area.corner.y + radius)) {
+ (reticle->dev.x >= wi->damaged_area.orig.x - radius) &&
+ (reticle->dev.x <= wi->damaged_area.corner.x + radius) &&
+ (reticle->dev.y >= wi->damaged_area.orig.y - radius) &&
+ (reticle->dev.y <= wi->damaged_area.corner.y + radius)) {
ZnSetLineStyle(wi, reticle->bright_line_style);
values.foreground = ZnGetGradientPixel(reticle->bright_line_color, 0.0);
values.line_width = 0;
values.fill_style = FillSolid;
XChangeGC(wi->dpy, wi->gc, GCForeground | GCLineWidth | GCFillStyle, &values);
XDrawArc(wi->dpy, wi->draw_buffer, wi->gc,
- (int) (reticle->dev.x - radius),
- (int) (reticle->dev.y - radius),
- (unsigned int) (radius * 2 - 1),
- (unsigned int) (radius * 2 - 1),
- 0, 360 * 64);
+ (int) (reticle->dev.x - radius),
+ (int) (reticle->dev.y - radius),
+ (unsigned int) (radius * 2 - 1),
+ (unsigned int) (radius * 2 - 1),
+ 0, 360 * 64);
/*count++;*/
}
radius += (reticle->step_size_dev);
@@ -401,17 +401,17 @@ Draw(ZnItem item)
*/
#ifdef GL
static void
-Render(ZnItem item)
+Render(ZnItem item)
{
- ZnWInfo *wi = item->wi;
- ReticleItem reticle = (ReticleItem) item;
- ZnDim radius = reticle->first_radius_dev;
- ZnDim radius_max_dev, new, x, y, xo, yo;
- int i, j;
- ZnPoint *genarc;
- int num_p;
+ ZnWInfo *wi = item->wi;
+ ReticleItem reticle = (ReticleItem) item;
+ ZnDim radius = reticle->first_radius_dev;
+ ZnDim radius_max_dev, new, x, y, xo, yo;
+ int i, j;
+ ZnPoint *genarc;
+ int num_p;
unsigned short alpha;
- XColor *color;
+ XColor *color;
xo = reticle->dev.x;
yo = reticle->dev.y;
@@ -445,7 +445,7 @@ Render(ZnItem item)
if (reticle->num_circles > 0) {
radius_max_dev = MIN(radius_max_dev, reticle->first_radius_dev +
- (reticle->num_circles - 1) * reticle->step_size_dev);
+ (reticle->num_circles - 1) * reticle->step_size_dev);
}
genarc = ZnGetCirclePoints(3, ZN_CIRCLE_FINER, 0.0, 2*M_PI, &num_p, NULL);
@@ -457,33 +457,33 @@ Render(ZnItem item)
glColor4us(color->red, color->green, color->blue, alpha);
for (i = 1; ((radius <= radius_max_dev) && (i < reticle->period)); i++) {
if ((xo >= wi->damaged_area.orig.x - radius) &&
- (xo <= wi->damaged_area.corner.x + radius) &&
- (yo >= wi->damaged_area.orig.y - radius) &&
- (yo <= wi->damaged_area.corner.y + radius)) {
- glBegin(GL_LINE_LOOP);
- for (j = 0; j < num_p; j++) {
- x = xo + genarc[j].x * radius;
- y = yo + genarc[j].y * radius;
- glVertex2d(x, y);
- }
- glEnd();
+ (xo <= wi->damaged_area.corner.x + radius) &&
+ (yo >= wi->damaged_area.orig.y - radius) &&
+ (yo <= wi->damaged_area.corner.y + radius)) {
+ glBegin(GL_LINE_LOOP);
+ for (j = 0; j < num_p; j++) {
+ x = xo + genarc[j].x * radius;
+ y = yo + genarc[j].y * radius;
+ glVertex2d(x, y);
+ }
+ glEnd();
}
radius += (reticle->step_size_dev);
}
if ((radius <= radius_max_dev) &&
- (xo >= wi->damaged_area.orig.x - radius) &&
- (xo <= wi->damaged_area.corner.x + radius) &&
- (yo >= wi->damaged_area.orig.y - radius) &&
- (yo <= wi->damaged_area.corner.y + radius)) {
+ (xo >= wi->damaged_area.orig.x - radius) &&
+ (xo <= wi->damaged_area.corner.x + radius) &&
+ (yo >= wi->damaged_area.orig.y - radius) &&
+ (yo <= wi->damaged_area.corner.y + radius)) {
ZnSetLineStyle(wi, reticle->bright_line_style);
color = ZnGetGradientColor(reticle->bright_line_color, 0.0, &alpha);
alpha = ZnComposeAlpha(alpha, wi->alpha);
glColor4us(color->red, color->green, color->blue, alpha);
glBegin(GL_LINE_LOOP);
for (j = 0; j < num_p; j++) {
- x = xo + genarc[j].x * radius;
- y = yo + genarc[j].y * radius;
- glVertex2d(x, y);
+ x = xo + genarc[j].x * radius;
+ y = yo + genarc[j].y * radius;
+ glVertex2d(x, y);
}
glEnd();
}
@@ -493,7 +493,7 @@ Render(ZnItem item)
}
#else
static void
-Render(ZnItem item)
+Render(ZnItem item)
{
}
#endif
@@ -507,11 +507,11 @@ Render(ZnItem item)
**********************************************************************************
*/
static ZnBool
-IsSensitive(ZnItem item,
- int item_part)
+IsSensitive(ZnItem item,
+ int item_part)
{
return (ISSET(item->flags, ZN_SENSITIVE_BIT) &&
- item->parent->class->IsSensitive(item->parent, ZN_NO_PART));
+ item->parent->class->IsSensitive(item->parent, ZN_NO_PART));
}
@@ -519,13 +519,13 @@ IsSensitive(ZnItem item,
**********************************************************************************
*
* Pick --
- * Nothing to pick, we are almost transparent.
+ * Nothing to pick, we are almost transparent.
*
**********************************************************************************
*/
static double
-Pick(ZnItem item,
- ZnPick ps)
+Pick(ZnItem item,
+ ZnPick ps)
{
return 1e40;
}
@@ -535,30 +535,30 @@ Pick(ZnItem item,
**********************************************************************************
*
* Coords --
- * Return or edit the item center.
+ * Return or edit the item center.
*
**********************************************************************************
*/
static int
-Coords(ZnItem item,
- int contour,
- int index,
- int cmd,
- ZnPoint **pts,
- char **controls,
- unsigned int *num_pts)
+Coords(ZnItem item,
+ int contour,
+ int index,
+ int cmd,
+ ZnPoint **pts,
+ char **controls,
+ unsigned int *num_pts)
{
- ReticleItem reticle = (ReticleItem) item;
+ ReticleItem reticle = (ReticleItem) item;
if ((cmd == ZN_COORDS_ADD) || (cmd == ZN_COORDS_ADD_LAST) || (cmd == ZN_COORDS_REMOVE)) {
Tcl_AppendResult(item->wi->interp,
- " reticles can't add or remove vertices", NULL);
+ " reticles can't add or remove vertices", NULL);
return TCL_ERROR;
}
else if ((cmd == ZN_COORDS_REPLACE) || (cmd == ZN_COORDS_REPLACE_ALL)) {
if (*num_pts == 0) {
Tcl_AppendResult(item->wi->interp,
- " coords command need 1 point on reticles", NULL);
+ " coords command need 1 point on reticles", NULL);
return TCL_ERROR;
}
reticle->pos = (*pts)[0];
@@ -580,8 +580,8 @@ Coords(ZnItem item,
**********************************************************************************
*/
static void
-PostScript(ZnItem item,
- ZnBool prepass)
+PostScript(ZnItem item,
+ ZnBool prepass)
{
}
@@ -597,33 +597,33 @@ static ZnItemClassStruct RETICLE_ITEM_CLASS = {
"reticle",
sizeof(ReticleItemStruct),
reticle_attrs,
- 0, /* num_parts */
- ZN_CLASS_ONE_COORD, /* flags */
+ 0, /* num_parts */
+ ZN_CLASS_ONE_COORD, /* flags */
Tk_Offset(ReticleItemStruct, pos),
Init,
Clone,
Destroy,
Configure,
Query,
- NULL, /* GetFieldSet */
- NULL, /* GetAnchor */
- NULL, /* GetClipVertices */
- NULL, /* GetContours */
+ NULL, /* GetFieldSet */
+ NULL, /* GetAnchor */
+ NULL, /* GetClipVertices */
+ NULL, /* GetContours */
Coords,
- NULL, /* InsertChars */
- NULL, /* DeleteChars */
- NULL, /* Cursor */
- NULL, /* Index */
- NULL, /* Part */
- NULL, /* Selection */
- NULL, /* Contour */
+ NULL, /* InsertChars */
+ NULL, /* DeleteChars */
+ NULL, /* Cursor */
+ NULL, /* Index */
+ NULL, /* Part */
+ NULL, /* Selection */
+ NULL, /* Contour */
ComputeCoordinates,
ToArea,
Draw,
Render,
IsSensitive,
Pick,
- NULL, /* PickVertex */
+ NULL, /* PickVertex */
PostScript
};
diff --git a/generic/Tabular.c b/generic/Tabular.c
index d6f1cd6..bbd9cd1 100644
--- a/generic/Tabular.c
+++ b/generic/Tabular.c
@@ -1,8 +1,8 @@
/*
* Tabular.c -- Implementation of Tabular item.
*
- * Authors : Patrick Lecoanet.
- * Creation date :
+ * Authors : Patrick Lecoanet.
+ * Creation date :
*
* $Id$
*/
@@ -49,19 +49,19 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ "
**********************************************************************************
*/
typedef struct _TabularItemStruct {
- ZnItemStruct header;
+ ZnItemStruct header;
/* Public data */
- ZnPoint pos;
- Tk_Anchor anchor;
- Tk_Anchor connection_anchor;
+ ZnPoint pos;
+ Tk_Anchor anchor;
+ Tk_Anchor connection_anchor;
/* Private data */
- ZnFieldSetStruct field_set;
+ ZnFieldSetStruct field_set;
} TabularItemStruct, *TabularItem;
-static ZnAttrConfig tabular_attrs[] = {
+static ZnAttrConfig tabular_attrs[] = {
{ ZN_CONFIG_ANCHOR, "-anchor", NULL,
Tk_Offset(TabularItemStruct, anchor), 0, ZN_COORDS_FLAG, False },
{ ZN_CONFIG_BOOL, "-composealpha", NULL,
@@ -109,14 +109,14 @@ static ZnAttrConfig tabular_attrs[] = {
**********************************************************************************
*/
static int
-Init(ZnItem item,
- int *argc,
- Tcl_Obj *CONST *args[])
+Init(ZnItem item,
+ int *argc,
+ Tcl_Obj *CONST *args[])
{
- ZnWInfo *wi = item->wi;
- TabularItem tab = (TabularItem) item;
- ZnFieldSet field_set = &tab->field_set;
- int num_fields;
+ ZnWInfo *wi = item->wi;
+ TabularItem tab = (TabularItem) item;
+ ZnFieldSet field_set = &tab->field_set;
+ int num_fields;
item->priority = 1;
@@ -162,9 +162,9 @@ Init(ZnItem item,
**********************************************************************************
*/
static void
-Clone(ZnItem item)
+Clone(ZnItem item)
{
- ZnFieldSet fs = &((TabularItem) item)->field_set;
+ ZnFieldSet fs = &((TabularItem) item)->field_set;
ZnFIELD.CloneFields(fs);
fs->item = item;
@@ -179,7 +179,7 @@ Clone(ZnItem item)
**********************************************************************************
*/
static void
-Destroy(ZnItem item)
+Destroy(ZnItem item)
{
ZnFIELD.FreeFields(&((TabularItem) item)->field_set);
}
@@ -193,16 +193,16 @@ Destroy(ZnItem item)
**********************************************************************************
*/
static int
-Configure(ZnItem item,
- int argc,
- Tcl_Obj *CONST argv[],
- int *flags)
+Configure(ZnItem item,
+ int argc,
+ Tcl_Obj *CONST argv[],
+ int *flags)
{
- ZnItem old_connected;
+ ZnItem old_connected;
old_connected = item->connected_item;
if (ZnConfigureAttributes(item->wi, item, item, tabular_attrs,
- argc, argv, flags) == TCL_ERROR) {
+ argc, argv, flags) == TCL_ERROR) {
return TCL_ERROR;
}
if (ISSET(*flags, ZN_ITEM_FLAG)) {
@@ -211,8 +211,8 @@ Configure(ZnItem item,
* to the old one.
*/
if ((item->connected_item == ZN_NO_ITEM) ||
- (ISSET(item->connected_item->class->flags, ZN_CLASS_HAS_ANCHORS) &&
- (item->parent == item->connected_item->parent))) {
+ (ISSET(item->connected_item->class->flags, ZN_CLASS_HAS_ANCHORS) &&
+ (item->parent == item->connected_item->parent))) {
ZnITEM.UpdateItemDependency(item, old_connected);
}
else {
@@ -232,9 +232,9 @@ Configure(ZnItem item,
**********************************************************************************
*/
static int
-Query(ZnItem item,
- int argc,
- Tcl_Obj *CONST argv[])
+Query(ZnItem item,
+ int argc,
+ Tcl_Obj *CONST argv[])
{
if (ZnQueryAttribute(item->wi->interp, item, tabular_attrs, argv[0]) == TCL_ERROR) {
return TCL_ERROR;
@@ -252,13 +252,13 @@ Query(ZnItem item,
**********************************************************************************
*/
static void
-ComputeCoordinates(ZnItem item,
- ZnBool force)
+ComputeCoordinates(ZnItem item,
+ ZnBool force)
{
- TabularItem tab = (TabularItem) item;
- ZnWInfo *wi = item->wi;
- ZnFieldSet field_set = &tab->field_set;
- ZnDim width, height;
+ TabularItem tab = (TabularItem) item;
+ ZnWInfo *wi = item->wi;
+ ZnFieldSet field_set = &tab->field_set;
+ ZnDim width, height;
ZnResetBBox(&item->item_bounding_box);
if (field_set->label_format && field_set->num_fields) {
@@ -270,18 +270,18 @@ ComputeCoordinates(ZnItem item,
*/
if (item->connected_item != ZN_NO_ITEM) {
item->connected_item->class->GetAnchor(item->connected_item,
- tab->connection_anchor,
- &field_set->label_pos);
+ tab->connection_anchor,
+ &field_set->label_pos);
}
else {
ZnPoint pos;
pos.x = pos.y = 0;
ZnTransformPoint(wi->current_transfo, &pos,
- &field_set->label_pos);
+ &field_set->label_pos);
}
ZnAnchor2Origin(&field_set->label_pos, width, height, tab->anchor,
- &field_set->label_pos);
+ &field_set->label_pos);
/*
* Setup the item bounding box.
@@ -311,14 +311,14 @@ ComputeCoordinates(ZnItem item,
**********************************************************************************
*
* ToArea --
- * Tell if the object is entirely outside (-1),
- * entirely inside (1) or in between (0).
+ * Tell if the object is entirely outside (-1),
+ * entirely inside (1) or in between (0).
*
**********************************************************************************
*/
static int
-ToArea(ZnItem item,
- ZnToArea ta)
+ToArea(ZnItem item,
+ ZnToArea ta)
{
return ZnFIELD.FieldsToArea(&((TabularItem) item)->field_set, ta->area);
}
@@ -332,7 +332,7 @@ ToArea(ZnItem item,
**********************************************************************************
*/
static void
-Draw(ZnItem item)
+Draw(ZnItem item)
{
ZnFIELD.DrawFields(&((TabularItem) item)->field_set);
}
@@ -346,7 +346,7 @@ Draw(ZnItem item)
**********************************************************************************
*/
static void
-Render(ZnItem item)
+Render(ZnItem item)
{
ZnFIELD.RenderFields(&((TabularItem) item)->field_set);
}
@@ -360,8 +360,8 @@ Render(ZnItem item)
**********************************************************************************
*/
static ZnBool
-IsSensitive(ZnItem item,
- int item_part)
+IsSensitive(ZnItem item,
+ int item_part)
{
if (ISCLEAR(item->flags, ZN_SENSITIVE_BIT) ||
!item->parent->class->IsSensitive(item->parent, ZN_NO_PART)) {
@@ -380,13 +380,13 @@ IsSensitive(ZnItem item,
**********************************************************************************
*
* Pick --
- * We tell what our label tells.
+ * We tell what our label tells.
*
**********************************************************************************
*/
static double
-Pick(ZnItem item,
- ZnPick ps)
+Pick(ZnItem item,
+ ZnPick ps)
{
int best_part;
double dist;
@@ -411,8 +411,8 @@ Pick(ZnItem item,
**********************************************************************************
*/
static void
-PostScript(ZnItem item,
- ZnBool prepass)
+PostScript(ZnItem item,
+ ZnBool prepass)
{
}
@@ -425,7 +425,7 @@ PostScript(ZnItem item,
**********************************************************************************
*/
static ZnFieldSet
-GetFieldSet(ZnItem item)
+GetFieldSet(ZnItem item)
{
return &((TabularItem) item)->field_set;
}
@@ -439,12 +439,12 @@ GetFieldSet(ZnItem item)
**********************************************************************************
*/
static void
-GetAnchor(ZnItem item,
- Tk_Anchor anchor,
- ZnPoint *p)
+GetAnchor(ZnItem item,
+ Tk_Anchor anchor,
+ ZnPoint *p)
{
- ZnFieldSet field_set = &((TabularItem) item)->field_set;
- ZnDim width, height;
+ ZnFieldSet field_set = &((TabularItem) item)->field_set;
+ ZnDim width, height;
if (field_set->label_format) {
ZnFIELD.GetLabelBBox(field_set, &width, &height);
@@ -460,18 +460,18 @@ GetAnchor(ZnItem item,
**********************************************************************************
*
* GetClipVertices --
- * Get the clipping shape.
- * Never ever call ZnTriFree on the tristrip returned by GetClipVertices.
+ * Get the clipping shape.
+ * Never ever call ZnTriFree on the tristrip returned by GetClipVertices.
*
**********************************************************************************
*/
static ZnBool
-GetClipVertices(ZnItem item,
- ZnTriStrip *tristrip)
+GetClipVertices(ZnItem item,
+ ZnTriStrip *tristrip)
{
- ZnFieldSet field_set = &((TabularItem) item)->field_set;
- ZnDim width, height;
- ZnPoint *points;
+ ZnFieldSet field_set = &((TabularItem) item)->field_set;
+ ZnDim width, height;
+ ZnPoint *points;
if (field_set->label_format) {
ZnFIELD.GetLabelBBox(field_set, &width, &height);
@@ -491,32 +491,32 @@ GetClipVertices(ZnItem item,
**********************************************************************************
*
* Coords --
- * Return or edit the item origin. This doesn't take care of
- * the possible attachment. The change will be effective at the
- * end of the attachment.
+ * Return or edit the item origin. This doesn't take care of
+ * the possible attachment. The change will be effective at the
+ * end of the attachment.
*
**********************************************************************************
*/
static int
-Coords(ZnItem item,
- int contour,
- int index,
- int cmd,
- ZnPoint **pts,
- char **controls,
- unsigned int *num_pts)
+Coords(ZnItem item,
+ int contour,
+ int index,
+ int cmd,
+ ZnPoint **pts,
+ char **controls,
+ unsigned int *num_pts)
{
- TabularItem tabular = (TabularItem) item;
+ TabularItem tabular = (TabularItem) item;
if ((cmd == ZN_COORDS_ADD) || (cmd == ZN_COORDS_ADD_LAST) || (cmd == ZN_COORDS_REMOVE)) {
Tcl_AppendResult(item->wi->interp,
- " tabulars can't add or remove vertices", NULL);
+ " tabulars can't add or remove vertices", NULL);
return TCL_ERROR;
}
else if ((cmd == ZN_COORDS_REPLACE) || (cmd == ZN_COORDS_REPLACE_ALL)) {
if (*num_pts == 0) {
Tcl_AppendResult(item->wi->interp,
- " coords command need 1 point on tabulars", NULL);
+ " coords command need 1 point on tabulars", NULL);
return TCL_ERROR;
}
tabular->pos = (*pts)[0];
@@ -534,17 +534,17 @@ Coords(ZnItem item,
**********************************************************************************
*
* Part --
- * Convert a private part from/to symbolic representation.
+ * Convert a private part from/to symbolic representation.
*
**********************************************************************************
*/
static int
-Part(ZnItem item,
- Tcl_Obj **part_spec,
- int *part)
+Part(ZnItem item,
+ Tcl_Obj **part_spec,
+ int *part)
{
- char *part_str;
- char *end;
+ char *part_str;
+ char *end;
if (*part_spec) {
part_str = Tcl_GetString(*part_spec);
@@ -554,14 +554,14 @@ Part(ZnItem item,
else if (isdigit(part_str[0])) {
*part = strtol(part_str, &end, 0);
if ((*end != 0) || (*part < 0) ||
- ((unsigned int) *part >= ((TabularItem) item)->field_set.num_fields)) {
- goto part_error;
+ ((unsigned int) *part >= ((TabularItem) item)->field_set.num_fields)) {
+ goto part_error;
}
}
else {
part_error:
Tcl_AppendResult(item->wi->interp, " invalid item part specification", NULL);
- return TCL_ERROR;
+ return TCL_ERROR;
}
}
else {
@@ -580,19 +580,19 @@ Part(ZnItem item,
**********************************************************************************
*
* Index --
- * Parse a text index and return its value and aa
- * error status (standard Tcl result).
+ * Parse a text index and return its value and aa
+ * error status (standard Tcl result).
*
**********************************************************************************
*/
static int
-Index(ZnItem item,
- int field,
- Tcl_Obj *index_spec,
- int *index)
+Index(ZnItem item,
+ int field,
+ Tcl_Obj *index_spec,
+ int *index)
{
return ZnFIELD.FieldIndex(&((TabularItem) item)->field_set, field,
- index_spec, index);
+ index_spec, index);
}
@@ -604,13 +604,13 @@ Index(ZnItem item,
**********************************************************************************
*/
static void
-InsertChars(ZnItem item,
- int field,
- int *index,
- char *chars)
+InsertChars(ZnItem item,
+ int field,
+ int *index,
+ char *chars)
{
if (ZnFIELD.FieldInsertChars(&((TabularItem) item)->field_set,
- field, index, chars)) {
+ field, index, chars)) {
ZnITEM.Invalidate(item, ZN_COORDS_FLAG);
}
}
@@ -624,13 +624,13 @@ InsertChars(ZnItem item,
**********************************************************************************
*/
static void
-DeleteChars(ZnItem item,
- int field,
- int *first,
- int *last)
+DeleteChars(ZnItem item,
+ int field,
+ int *first,
+ int *last)
{
if (ZnFIELD.FieldDeleteChars(&((TabularItem) item)->field_set,
- field, first, last)) {
+ field, first, last)) {
ZnITEM.Invalidate(item, ZN_COORDS_FLAG);
}
}
@@ -644,9 +644,9 @@ DeleteChars(ZnItem item,
**********************************************************************************
*/
static void
-TabularCursor(ZnItem item,
- int field,
- int index)
+TabularCursor(ZnItem item,
+ int field,
+ int index)
{
ZnFIELD.FieldCursor(&((TabularItem) item)->field_set, field, index);
}
@@ -660,14 +660,14 @@ TabularCursor(ZnItem item,
**********************************************************************************
*/
static int
-Selection(ZnItem item,
- int field,
- int offset,
- char *chars,
- int max_chars)
+Selection(ZnItem item,
+ int field,
+ int offset,
+ char *chars,
+ int max_chars)
{
return ZnFIELD.FieldSelection(&((TabularItem) item)->field_set, field,
- offset, chars, max_chars);
+ offset, chars, max_chars);
}
@@ -693,7 +693,7 @@ static ZnItemClassStruct TABULAR_ITEM_CLASS = {
GetFieldSet,
GetAnchor,
GetClipVertices,
- NULL, /* GetContours */
+ NULL, /* GetContours */
Coords,
InsertChars,
DeleteChars,
@@ -701,14 +701,14 @@ static ZnItemClassStruct TABULAR_ITEM_CLASS = {
Index,
Part,
Selection,
- NULL, /* Contour */
+ NULL, /* Contour */
ComputeCoordinates,
ToArea,
Draw,
Render,
IsSensitive,
Pick,
- NULL, /* PickVertex */
+ NULL, /* PickVertex */
PostScript
};
diff --git a/generic/Text.c b/generic/Text.c
index 391525e..fdfdb94 100644
--- a/generic/Text.c
+++ b/generic/Text.c
@@ -1,8 +1,8 @@
/*
* Text.c -- Implementation of Text item.
*
- * Authors : Patrick LECOANET
- * Creation date : Sat Mar 25 13:58:39 1995
+ * Authors : Patrick LECOANET
+ * Creation date : Sat Mar 25 13:58:39 1995
*/
/*
@@ -55,8 +55,8 @@ static const char compile_id[] = "$Compile: " __FILE__ " " __DATE__ " " __TIME__
/*
* Bit offset of flags.
*/
-#define UNDERLINED 1
-#define OVERSTRIKED 2
+#define UNDERLINED 1
+#define OVERSTRIKED 2
/*
@@ -68,43 +68,43 @@ static const char compile_id[] = "$Compile: " __FILE__ " " __DATE__ " " __TIME__
*/
typedef struct _TextLineInfo
{
- char *start; /* Index of first char in line */
- unsigned short num_bytes; /* Number of displayed bytes in line (NOT chars)*/
- unsigned short width; /* Line width in pixels */
- unsigned short origin_x; /* X pos for drawing the line */
+ char *start; /* Index of first char in line */
+ unsigned short num_bytes; /* Number of displayed bytes in line (NOT chars)*/
+ unsigned short width; /* Line width in pixels */
+ unsigned short origin_x; /* X pos for drawing the line */
unsigned short origin_y;
} TextLineInfoStruct, *TextLineInfo;
typedef struct _TextItemStruct {
- ZnItemStruct header;
+ ZnItemStruct header;
/* Public data */
- ZnPoint pos; /* Position at anchor */
- ZnGradient *color;
- char *text;
- ZnImage fill_pattern;
- Tk_Font font;
+ ZnPoint pos; /* Position at anchor */
+ ZnGradient *color;
+ char *text;
+ ZnImage fill_pattern;
+ Tk_Font font;
unsigned short width;
- short spacing;
+ short spacing;
unsigned short flags;
- Tk_Anchor anchor;
- Tk_Anchor connection_anchor;
- Tk_Justify alignment;
+ Tk_Anchor anchor;
+ Tk_Anchor connection_anchor;
+ Tk_Justify alignment;
/* Private data */
unsigned short num_chars;
unsigned short insert_index;
- ZnList text_info;
+ ZnList text_info;
unsigned short max_width;
unsigned short height;
- ZnPoint poly[4];
+ ZnPoint poly[4];
#ifdef GL
- ZnTexFontInfo *tfi;
+ ZnTexFontInfo *tfi;
#endif
} TextItemStruct, *TextItem;
-static ZnAttrConfig text_attrs[] = {
+static ZnAttrConfig text_attrs[] = {
{ ZN_CONFIG_ALIGNMENT, "-alignment", NULL,
Tk_Offset(TextItemStruct, alignment), 0,
ZN_COORDS_FLAG|ZN_LAYOUT_FLAG, False },
@@ -170,12 +170,12 @@ static ZnAttrConfig text_attrs[] = {
**********************************************************************************
*/
static int
-Init(ZnItem item,
- int *argc,
- Tcl_Obj *CONST *args[])
+Init(ZnItem item,
+ int *argc,
+ Tcl_Obj *CONST *args[])
{
- ZnWInfo *wi = item->wi;
- TextItem text = (TextItem) item;
+ ZnWInfo *wi = item->wi;
+ TextItem text = (TextItem) item;
/*printf("size of a text(header) = %d(%d) %d\n",
sizeof(TextItemStruct), sizeof(ZnItemStruct), sizeof(TextLineInfoStruct));*/
@@ -220,11 +220,11 @@ Init(ZnItem item,
**********************************************************************************
*/
static void
-Clone(ZnItem item)
+Clone(ZnItem item)
{
- TextItem text = (TextItem) item;
- ZnWInfo *wi = item->wi;
- char *str;
+ TextItem text = (TextItem) item;
+ ZnWInfo *wi = item->wi;
+ char *str;
if (text->text) {
str = ZnMalloc((strlen(text->text) + 1) * sizeof(char));
@@ -259,9 +259,9 @@ Clone(ZnItem item)
**********************************************************************************
*/
static void
-Destroy(ZnItem item)
+Destroy(ZnItem item)
{
- TextItem text = (TextItem) item;
+ TextItem text = (TextItem) item;
if (text->text) {
ZnFree(text->text);
@@ -292,20 +292,20 @@ Destroy(ZnItem item)
**********************************************************************************
*/
static int
-Configure(ZnItem item,
- int argc,
- Tcl_Obj *CONST argv[],
- int *flags)
+Configure(ZnItem item,
+ int argc,
+ Tcl_Obj *CONST argv[],
+ int *flags)
{
- TextItem text = (TextItem) item;
- ZnItem old_connected = item->connected_item;
- unsigned int num_chars;
+ TextItem text = (TextItem) item;
+ ZnItem old_connected = item->connected_item;
+ unsigned int num_chars;
#ifdef GL
- Tk_Font old_font = text->font;
+ Tk_Font old_font = text->font;
#endif
if (ZnConfigureAttributes(item->wi, item, item, text_attrs,
- argc, argv, flags) == TCL_ERROR) {
+ argc, argv, flags) == TCL_ERROR) {
return TCL_ERROR;
}
@@ -329,14 +329,14 @@ Configure(ZnItem item,
*/
if (item == ti->sel_item) {
if (ti->sel_last > (int) num_chars) {
- ti->sel_last = num_chars;
+ ti->sel_last = num_chars;
}
if (ti->sel_first >= ti->sel_last) {
- ti->sel_item = ZN_NO_ITEM;
- ti->sel_field = ZN_NO_PART;
+ ti->sel_item = ZN_NO_ITEM;
+ ti->sel_field = ZN_NO_PART;
}
if ((ti->anchor_item == item) && (ti->sel_anchor > (int) num_chars)) {
- ti->sel_anchor = num_chars;
+ ti->sel_anchor = num_chars;
}
}
if (text->insert_index > num_chars) {
@@ -351,8 +351,8 @@ Configure(ZnItem item,
* to the old one.
*/
if ((item->connected_item == ZN_NO_ITEM) ||
- (ISSET(item->connected_item->class->flags, ZN_CLASS_HAS_ANCHORS) &&
- (item->parent == item->connected_item->parent))) {
+ (ISSET(item->connected_item->class->flags, ZN_CLASS_HAS_ANCHORS) &&
+ (item->parent == item->connected_item->parent))) {
ZnITEM.UpdateItemDependency(item, old_connected);
}
else {
@@ -372,9 +372,9 @@ Configure(ZnItem item,
**********************************************************************************
*/
static int
-Query(ZnItem item,
- int argc,
- Tcl_Obj *CONST argv[])
+Query(ZnItem item,
+ int argc,
+ Tcl_Obj *CONST argv[])
{
if (ZnQueryAttribute(item->wi->interp, item, text_attrs, argv[0]) == TCL_ERROR) {
return TCL_ERROR;
@@ -389,8 +389,8 @@ Query(ZnItem item,
* of the text (upper left point in item coordinates).
*/
static ZnTransfo *
-ComputeTransfoAndOrigin(ZnItem item,
- ZnPoint *origin)
+ComputeTransfoAndOrigin(ZnItem item,
+ ZnPoint *origin)
{
TextItem text = (TextItem) item;
@@ -401,8 +401,8 @@ ComputeTransfoAndOrigin(ZnItem item,
ZnTransfo inv;
item->connected_item->class->GetAnchor(item->connected_item,
- text->connection_anchor,
- origin);
+ text->connection_anchor,
+ origin);
/* GetAnchor return a position in device coordinates not in
* the item coordinate space. To compute the text origin
@@ -412,7 +412,7 @@ ComputeTransfoAndOrigin(ZnItem item,
ZnTransfoInvert(item->transfo, &inv);
ZnTransformPoint(&inv, origin, origin);
ZnAnchor2Origin(origin, (ZnReal) text->max_width,
- (ZnReal) text->height, text->anchor, origin);
+ (ZnReal) text->height, text->anchor, origin);
origin->x = ZnNearestInt(origin->x);
origin->y = ZnNearestInt(origin->y);
/*
@@ -427,7 +427,7 @@ ComputeTransfoAndOrigin(ZnItem item,
ZnPoint p;
p.x = p.y = 0;
ZnAnchor2Origin(&p, (ZnReal) text->max_width,
- (ZnReal) text->height, text->anchor, origin);
+ (ZnReal) text->height, text->anchor, origin);
origin->x = ZnNearestInt(origin->x);
origin->y = ZnNearestInt(origin->y);
@@ -440,14 +440,14 @@ ComputeTransfoAndOrigin(ZnItem item,
* Compute the selection and the cursor geometry.
*/
void
-ComputeCursor(ZnItem item,
- int *cursor_line,
- unsigned int *cursor_offset)
+ComputeCursor(ZnItem item,
+ int *cursor_line,
+ unsigned int *cursor_offset)
{
- TextItem text = (TextItem) item;
- ZnWInfo *wi = item->wi;
- ZnTextInfo *ti = &wi->text_info;
- TextLineInfo lines, lines_ptr;
+ TextItem text = (TextItem) item;
+ ZnWInfo *wi = item->wi;
+ ZnTextInfo *ti = &wi->text_info;
+ TextLineInfo lines, lines_ptr;
unsigned int i, line_index, insert_index, num_lines;
num_lines = ZnListSize(text->text_info);
@@ -465,10 +465,10 @@ ComputeCursor(ZnItem item,
*/
line_index = lines_ptr->start - text->text;
if ((insert_index >= line_index) &&
- (insert_index <= line_index + lines_ptr->num_bytes)) {
- *cursor_line = i;
- *cursor_offset = Tk_TextWidth(text->font, (char *) lines_ptr->start,
- insert_index - line_index);
+ (insert_index <= line_index + lines_ptr->num_bytes)) {
+ *cursor_line = i;
+ *cursor_offset = Tk_TextWidth(text->font, (char *) lines_ptr->start,
+ insert_index - line_index);
}
}
}
@@ -476,17 +476,17 @@ ComputeCursor(ZnItem item,
}
static void
-ComputeSelection(ZnItem item,
- int *sel_first_line,
- int *sel_last_line,
- unsigned int *sel_start_offset,
- unsigned int *sel_stop_offset)
+ComputeSelection(ZnItem item,
+ int *sel_first_line,
+ int *sel_last_line,
+ unsigned int *sel_start_offset,
+ unsigned int *sel_stop_offset)
{
- TextItem text = (TextItem) item;
- ZnWInfo *wi = item->wi;
- ZnTextInfo *ti = &wi->text_info;
- TextLineInfo lines_ptr, lines;
- int i, num_lines, byte_index;
+ TextItem text = (TextItem) item;
+ ZnWInfo *wi = item->wi;
+ ZnTextInfo *ti = &wi->text_info;
+ TextLineInfo lines_ptr, lines;
+ int i, num_lines, byte_index;
unsigned int line_index;
unsigned int sel_first, sel_last;
@@ -507,28 +507,28 @@ ComputeSelection(ZnItem item,
*/
line_index = lines_ptr->start - text->text;
if ((sel_last >= line_index) &&
- (sel_first <= (line_index + lines_ptr->num_bytes))) {
+ (sel_first <= (line_index + lines_ptr->num_bytes))) {
if (*sel_first_line < 0) {
- byte_index = sel_first - line_index;
- if (byte_index <= 0) {
- *sel_first_line = i;
- *sel_start_offset = 0;
- /*printf("sel_start_offset 1 : %d\n", *sel_start_offset);*/
- }
- else if (byte_index <= lines_ptr->num_bytes) {
- *sel_first_line = i;
- *sel_start_offset = Tk_TextWidth(text->font, (char *) lines_ptr->start,
- byte_index);
- /*printf("sel_start_offset 2 : %d\n", *sel_start_offset);*/
- }
+ byte_index = sel_first - line_index;
+ if (byte_index <= 0) {
+ *sel_first_line = i;
+ *sel_start_offset = 0;
+ /*printf("sel_start_offset 1 : %d\n", *sel_start_offset);*/
+ }
+ else if (byte_index <= lines_ptr->num_bytes) {
+ *sel_first_line = i;
+ *sel_start_offset = Tk_TextWidth(text->font, (char *) lines_ptr->start,
+ byte_index);
+ /*printf("sel_start_offset 2 : %d\n", *sel_start_offset);*/
+ }
}
byte_index = ti->sel_last+1 - line_index;
*sel_last_line = i;
if (byte_index == lines_ptr->num_bytes+1)
- *sel_stop_offset = lines_ptr->width;
+ *sel_stop_offset = lines_ptr->width;
else if (byte_index <= lines_ptr->num_bytes)
- *sel_stop_offset = Tk_TextWidth(text->font, (char *) lines_ptr->start,
- byte_index);
+ *sel_stop_offset = Tk_TextWidth(text->font, (char *) lines_ptr->start,
+ byte_index);
}
}
}
@@ -542,15 +542,15 @@ ComputeSelection(ZnItem item,
**********************************************************************************
*/
static void
-ComputeCoordinates(ZnItem item,
- ZnBool force)
+ComputeCoordinates(ZnItem item,
+ ZnBool force)
{
- ZnWInfo *wi = item->wi;
- TextItem text = (TextItem) item;
- TextLineInfo infos;
+ ZnWInfo *wi = item->wi;
+ TextItem text = (TextItem) item;
+ TextLineInfo infos;
Tk_FontMetrics fm;
- ZnTransfo *transfo;
- int i, num_lines, cur_dy, font_height;
+ ZnTransfo *transfo;
+ int i, num_lines, cur_dy, font_height;
ZnResetBBox(&item->item_bounding_box);
@@ -563,7 +563,7 @@ ComputeCoordinates(ZnItem item,
*/
if (ISSET(item->inv_flags, ZN_LAYOUT_FLAG)) {
char *scan;
- int wrap, prev_num_lines;
+ int wrap, prev_num_lines;
text->max_width = 0;
if (text->text_info != NULL) {
@@ -586,54 +586,54 @@ ComputeCoordinates(ZnItem item,
TextLineInfoStruct info;
while (*scan) {
- char *special;
- int num, w;
-
- /*
- * Limit the excursion of Tk_MeasureChars to the end
- * of the line. Do not include \n in the measure done.
- */
- num = strcspn(scan, "\r\n");
- special = scan + num;
- info.num_bytes = Tk_MeasureChars(text->font, scan, num, wrap,
- TK_WHOLE_WORDS|TK_AT_LEAST_ONE, &w);
-
- info.width = w;
- info.start = scan;
- text->max_width = MAX(info.width, text->max_width);
-
- scan += info.num_bytes;
-
- /*
- * Skip the newline line character.
- */
- if ((*scan == '\r') || (*scan == '\n')) {
- scan++;
- }
- else {
- /*
- * Skip white spaces occuring after an
- * automatic line break.
- */
- while (*scan == ' ') {
- scan++;
- }
- }
-
- ZnListAdd(text->text_info, &info, ZnListTail);
- /*printf("adding a text info : %s, num_bytes : %d, width : %d\n",
- info.start, info.num_bytes, info.width);*/
+ char *special;
+ int num, w;
+
+ /*
+ * Limit the excursion of Tk_MeasureChars to the end
+ * of the line. Do not include \n in the measure done.
+ */
+ num = strcspn(scan, "\r\n");
+ special = scan + num;
+ info.num_bytes = Tk_MeasureChars(text->font, scan, num, wrap,
+ TK_WHOLE_WORDS|TK_AT_LEAST_ONE, &w);
+
+ info.width = w;
+ info.start = scan;
+ text->max_width = MAX(info.width, text->max_width);
+
+ scan += info.num_bytes;
+
+ /*
+ * Skip the newline line character.
+ */
+ if ((*scan == '\r') || (*scan == '\n')) {
+ scan++;
+ }
+ else {
+ /*
+ * Skip white spaces occuring after an
+ * automatic line break.
+ */
+ while (*scan == ' ') {
+ scan++;
+ }
+ }
+
+ ZnListAdd(text->text_info, &info, ZnListTail);
+ /*printf("adding a text info : %s, num_bytes : %d, width : %d\n",
+ info.start, info.num_bytes, info.width);*/
}
if (*text->text && ((scan[-1] == '\r') || (scan[-1] == '\n'))) {
- /* Build a text info even for an empty line
- * at the end of text or for an empty text.
- * It is needed to enable selection and cursor
- * insertion to behave correctly.
- */
- info.num_bytes = 0;
- info.width = 0;
- info.start = scan;
- ZnListAdd(text->text_info, &info, ZnListTail);
+ /* Build a text info even for an empty line
+ * at the end of text or for an empty text.
+ * It is needed to enable selection and cursor
+ * insertion to behave correctly.
+ */
+ info.num_bytes = 0;
+ info.width = 0;
+ info.start = scan;
+ ZnListAdd(text->text_info, &info, ZnListTail);
}
}
@@ -648,27 +648,27 @@ ComputeCoordinates(ZnItem item,
for (i = 0; i < num_lines; i++) {
switch (text->alignment) {
case TK_JUSTIFY_LEFT:
- infos[i].origin_x = 0;
- break;
+ infos[i].origin_x = 0;
+ break;
case TK_JUSTIFY_CENTER:
- infos[i].origin_x = (text->max_width + 1 - infos[i].width)/2;
- break;
+ infos[i].origin_x = (text->max_width + 1 - infos[i].width)/2;
+ break;
case TK_JUSTIFY_RIGHT:
- infos[i].origin_x = text->max_width + 1 - infos[i].width;
- break;
+ infos[i].origin_x = text->max_width + 1 - infos[i].width;
+ break;
}
infos[i].origin_y = cur_dy;
cur_dy += font_height + text->spacing;
/*printf("fixing line %d x : %d, y : %d\n", i, infos[i].origin_x,
- infos[i].origin_y);*/
+ infos[i].origin_y);*/
}
} /* ISSET(item->inv_flags, INV_TEXT_LAYOUT) */
text->height = font_height;
if (text->text_info && text->max_width) {
unsigned int h, cursor_offset;
- int cursor_line;
- ZnPoint origin, box[4];
+ int cursor_line;
+ ZnPoint origin, box[4];
num_lines = ZnListSize(text->text_info);
infos = ZnListArray(text->text_info);
@@ -699,13 +699,13 @@ ComputeCoordinates(ZnItem item,
ComputeCursor(item, &cursor_line, &cursor_offset);
if (cursor_line >= 0) {
if (num_lines) {
- box[0].x = origin.x + infos[cursor_line].origin_x + cursor_offset -
- wi->text_info.insert_width/2;
- box[0].y = origin.y + infos[cursor_line].origin_y - fm.ascent + 1;
+ box[0].x = origin.x + infos[cursor_line].origin_x + cursor_offset -
+ wi->text_info.insert_width/2;
+ box[0].y = origin.y + infos[cursor_line].origin_y - fm.ascent + 1;
}
else {
- box[0].x = origin.x;
- box[0].y = origin.y;
+ box[0].x = origin.x;
+ box[0].y = origin.y;
}
box[2].x = box[0].x + wi->text_info.insert_width;
box[2].y = box[0].y + font_height - 1;
@@ -719,8 +719,8 @@ ComputeCoordinates(ZnItem item,
}
/*printf("bbox origin: %g %g corner %g %g\n",
- item->item_bounding_box.orig.x, item->item_bounding_box.orig.y,
- item->item_bounding_box.corner.x, item->item_bounding_box.corner.y);*/
+ item->item_bounding_box.orig.x, item->item_bounding_box.orig.y,
+ item->item_bounding_box.corner.x, item->item_bounding_box.corner.y);*/
/*
* Update connected items.
*/
@@ -732,25 +732,25 @@ ComputeCoordinates(ZnItem item,
**********************************************************************************
*
* ToArea --
- * Tell if the object is entirely outside (-1),
- * entirely inside (1) or in between (0).
+ * Tell if the object is entirely outside (-1),
+ * entirely inside (1) or in between (0).
*
**********************************************************************************
*/
static int
-ToArea(ZnItem item,
- ZnToArea ta)
+ToArea(ZnItem item,
+ ZnToArea ta)
{
- TextItem text = (TextItem) item;
- int inside = -1;
- ZnBool first_done = False;
- int num_lines, i;
- TextLineInfo lines, lines_ptr;
+ TextItem text = (TextItem) item;
+ int inside = -1;
+ ZnBool first_done = False;
+ int num_lines, i;
+ TextLineInfo lines, lines_ptr;
Tk_FontMetrics fm;
- int font_height;
- ZnBBox line_bbox, *area = ta->area;
- ZnPoint box[4], p, origin;
- ZnTransfo inv, *transfo;
+ int font_height;
+ ZnBBox line_bbox, *area = ta->area;
+ ZnPoint box[4], p, origin;
+ ZnTransfo inv, *transfo;
if (!text->text_info || !text->text) {
return -1;
@@ -785,12 +785,12 @@ ToArea(ZnItem item,
first_done = True;
inside = ZnPolygonInBBox(box, 4, &line_bbox, NULL);
if (inside == 0) {
- return 0;
+ return 0;
}
}
else {
if (ZnPolygonInBBox(box, 4, &line_bbox, NULL) == 0) {
- return 0;
+ return 0;
}
}
}
@@ -807,26 +807,26 @@ ToArea(ZnItem item,
**********************************************************************************
*/
static void
-Draw(ZnItem item)
+Draw(ZnItem item)
{
- ZnWInfo *wi = item->wi;
- TextItem text = (TextItem) item;
- XGCValues values;
- ZnPoint pos, box[4], origin;
- ZnTransfo *transfo;
- Drawable drw;
- GC gc;
- XImage *src_im, *dest_im=NULL;
+ ZnWInfo *wi = item->wi;
+ TextItem text = (TextItem) item;
+ XGCValues values;
+ ZnPoint pos, box[4], origin;
+ ZnTransfo *transfo;
+ Drawable drw;
+ GC gc;
+ XImage *src_im, *dest_im=NULL;
unsigned int dest_im_width=0, dest_im_height=0;
- unsigned int gc_mask = 0;
+ unsigned int gc_mask = 0;
Tk_FontMetrics fm;
- unsigned int font_height;
- int num_lines, i;
- TextLineInfo lines, lines_ptr;
- ZnTextInfo *ti = &wi->text_info;
- unsigned int underline_thickness, underline_pos=0, overstrike_pos=0;
- int sel_first_line=-1, sel_last_line=-1, cursor_line=-1;
- unsigned int sel_start_offset=0, sel_stop_offset=0, cursor_offset=0;
+ unsigned int font_height;
+ int num_lines, i;
+ TextLineInfo lines, lines_ptr;
+ ZnTextInfo *ti = &wi->text_info;
+ unsigned int underline_thickness, underline_pos=0, overstrike_pos=0;
+ int sel_first_line=-1, sel_last_line=-1, cursor_line=-1;
+ unsigned int sel_start_offset=0, sel_stop_offset=0, cursor_offset=0;
if (!text->text_info/* || !text->text*/) {
return;
@@ -844,7 +844,7 @@ Draw(ZnItem item)
*/
ComputeCursor(item, &cursor_line, &cursor_offset);
ComputeSelection(item, &sel_first_line, &sel_last_line,
- &sel_start_offset, &sel_stop_offset);
+ &sel_start_offset, &sel_stop_offset);
ZnTransformPoint(transfo, &origin, &pos);
@@ -863,9 +863,9 @@ Draw(ZnItem item)
if (sel_first_line == sel_last_line) {
box[0].x = origin.x +
- lines[sel_first_line].origin_x + sel_start_offset;
+ lines[sel_first_line].origin_x + sel_start_offset;
box[0].y = origin.y +
- lines[sel_first_line].origin_y - fm.ascent;
+ lines[sel_first_line].origin_y - fm.ascent;
box[2].x = box[0].x + sel_stop_offset - sel_start_offset;
box[2].y = box[0].y + font_height;
box[1].x = box[2].x;
@@ -874,18 +874,18 @@ Draw(ZnItem item)
box[3].y = box[2].y;
ZnTransformPoints(transfo, box, box, 4);
for (i = 0; i < 4; i++) {
- xp[i].x = (short) box[i].x;
- xp[i].y = (short) box[i].y;
+ xp[i].x = (short) box[i].x;
+ xp[i].y = (short) box[i].y;
}
XFillPolygon(wi->dpy, wi->draw_buffer, wi->gc, xp, 4, Convex, CoordModeOrigin);
}
else {
box[0].x = origin.x +
- lines[sel_first_line].origin_x + sel_start_offset;
+ lines[sel_first_line].origin_x + sel_start_offset;
box[0].y = origin.y +
- lines[sel_first_line].origin_y - fm.ascent;
+ lines[sel_first_line].origin_y - fm.ascent;
box[2].x = box[0].x +
- text->max_width-lines[sel_first_line].origin_x-sel_start_offset;
+ text->max_width-lines[sel_first_line].origin_x-sel_start_offset;
box[2].y = box[0].y + font_height;
box[1].x = box[2].x;
box[1].y = box[0].y;
@@ -893,26 +893,26 @@ Draw(ZnItem item)
box[3].y = box[2].y;
ZnTransformPoints(transfo, box, box, 4);
for (i = 0; i < 4; i++) {
- xp[i].x = (short) box[i].x;
- xp[i].y = (short) box[i].y;
+ xp[i].x = (short) box[i].x;
+ xp[i].y = (short) box[i].y;
}
XFillPolygon(wi->dpy, wi->draw_buffer, wi->gc, xp, 4, Convex, CoordModeOrigin);
for (i = sel_first_line+1, lines_ptr = &lines[sel_first_line+1];
- i < sel_last_line; i++, lines_ptr++) {
- box[0].x = origin.x;
- box[0].y = origin.y + lines_ptr->origin_y - fm.ascent;
- box[2].x = box[0].x + text->max_width;
- box[2].y = box[0].y + font_height;
- box[1].x = box[2].x;
- box[1].y = box[0].y;
- box[3].x = box[0].x;
- box[3].y = box[2].y;
- ZnTransformPoints(transfo, box, box, 4);
- for (i = 0; i < 4; i++) {
- xp[i].x = (short) box[i].x;
- xp[i].y = (short) box[i].y;
- }
- XFillPolygon(wi->dpy, wi->draw_buffer, wi->gc, xp, 4, Convex, CoordModeOrigin);
+ i < sel_last_line; i++, lines_ptr++) {
+ box[0].x = origin.x;
+ box[0].y = origin.y + lines_ptr->origin_y - fm.ascent;
+ box[2].x = box[0].x + text->max_width;
+ box[2].y = box[0].y + font_height;
+ box[1].x = box[2].x;
+ box[1].y = box[0].y;
+ box[3].x = box[0].x;
+ box[3].y = box[2].y;
+ ZnTransformPoints(transfo, box, box, 4);
+ for (i = 0; i < 4; i++) {
+ xp[i].x = (short) box[i].x;
+ xp[i].y = (short) box[i].y;
+ }
+ XFillPolygon(wi->dpy, wi->draw_buffer, wi->gc, xp, 4, Convex, CoordModeOrigin);
}
box[0].x = origin.x;
box[0].y = origin.y + lines[sel_last_line].origin_y - fm.ascent;
@@ -924,8 +924,8 @@ Draw(ZnItem item)
box[3].y = box[2].y;
ZnTransformPoints(transfo, box, box, 4);
for (i = 0; i < 4; i++) {
- xp[i].x = (short) box[i].x;
- xp[i].y = (short) box[i].y;
+ xp[i].x = (short) box[i].x;
+ xp[i].y = (short) box[i].y;
}
XFillPolygon(wi->dpy, wi->draw_buffer, wi->gc, xp, 4, Convex, CoordModeOrigin);
}
@@ -948,7 +948,7 @@ Draw(ZnItem item)
box[1].y = box[0].y + font_height - 1;
ZnTransformPoints(transfo, box, box, 2);
XDrawLine(wi->dpy, wi->draw_buffer, wi->gc,
- (int) box[0].x, (int) box[0].y, (int) box[1].x, (int) box[1].y);
+ (int) box[0].x, (int) box[0].y, (int) box[1].x, (int) box[1].y);
}
@@ -968,21 +968,21 @@ Draw(ZnItem item)
}
else {
dest_im_width = (unsigned int) (item->item_bounding_box.corner.x -
- item->item_bounding_box.orig.x);
+ item->item_bounding_box.orig.x);
dest_im_height = (unsigned int) (item->item_bounding_box.corner.y -
- item->item_bounding_box.orig.y);
+ item->item_bounding_box.orig.y);
drw = Tk_GetPixmap(wi->dpy, wi->draw_buffer,
- MAX(dest_im_width, text->max_width),
- MAX(dest_im_height, text->height), 1);
+ MAX(dest_im_width, text->max_width),
+ MAX(dest_im_height, text->height), 1);
gc = XCreateGC(wi->dpy, drw, 0, NULL);
XSetForeground(wi->dpy, gc, 0);
XFillRectangle(wi->dpy, drw, gc, 0, 0,
- MAX(dest_im_width, text->max_width),
- MAX(dest_im_height, text->height));
+ MAX(dest_im_width, text->max_width),
+ MAX(dest_im_height, text->height));
dest_im = XCreateImage(wi->dpy, Tk_Visual(wi->win), 1,
- XYPixmap, 0, NULL, dest_im_width, dest_im_height,
- 8, 0);
+ XYPixmap, 0, NULL, dest_im_width, dest_im_height,
+ 8, 0);
dest_im->data = ZnMalloc(dest_im->bytes_per_line * dest_im->height);
memset(dest_im->data, 0, dest_im->bytes_per_line * dest_im->height);
@@ -1021,30 +1021,30 @@ Draw(ZnItem item)
}
XChangeGC(wi->dpy, gc, gc_mask, &values);
for (i = 0, lines_ptr = lines; i < num_lines; i++, lines_ptr++) {
- int tmp_x, tmp_y;
+ int tmp_x, tmp_y;
tmp_x = (int)(pos.x + lines_ptr->origin_x);
tmp_y = (int)(pos.y + lines_ptr->origin_y);
Tk_DrawChars(wi->dpy, drw, gc,
- text->font, (char *) lines_ptr->start,
- (int) lines_ptr->num_bytes, tmp_x, tmp_y);
+ text->font, (char *) lines_ptr->start,
+ (int) lines_ptr->num_bytes, tmp_x, tmp_y);
if (ISSET(text->flags, UNDERLINED)) {
int y_under = tmp_y + underline_pos;
XDrawLine(wi->dpy, drw, gc,
- tmp_x, y_under, tmp_x + (int) lines_ptr->width, y_under);
+ tmp_x, y_under, tmp_x + (int) lines_ptr->width, y_under);
}
if (ISSET(text->flags, OVERSTRIKED)) {
int y_over = tmp_y-overstrike_pos;
XDrawLine(wi->dpy, drw, gc,
- tmp_x, y_over, tmp_x + (int) lines_ptr->width, y_over);
+ tmp_x, y_over, tmp_x + (int) lines_ptr->width, y_over);
}
}
if (dest_im != NULL) {
src_im = XGetImage(wi->dpy, drw, 0, 0, text->max_width, text->height,
- 1, XYPixmap);
+ 1, XYPixmap);
box[0].x = origin.x;
box[0].y = origin.y;
@@ -1065,7 +1065,7 @@ Draw(ZnItem item)
ZnMapImage(src_im, dest_im, box);
TkPutImage(NULL, 0,wi->dpy, drw, gc, dest_im,
- 0, 0, 0, 0, dest_im_width, dest_im_height);
+ 0, 0, 0, 0, dest_im_width, dest_im_height);
values.foreground = ZnGetGradientPixel(text->color, 0.0);
values.stipple = drw;
@@ -1073,12 +1073,12 @@ Draw(ZnItem item)
values.ts_y_origin = (int) item->item_bounding_box.orig.y;
values.fill_style = FillStippled;
XChangeGC(wi->dpy, wi->gc,
- GCFillStyle|GCStipple|GCTileStipXOrigin|GCTileStipYOrigin|GCForeground,
- &values);
+ GCFillStyle|GCStipple|GCTileStipXOrigin|GCTileStipYOrigin|GCForeground,
+ &values);
XFillRectangle(wi->dpy, wi->draw_buffer, wi->gc,
- (int) item->item_bounding_box.orig.x,
- (int) item->item_bounding_box.orig.y,
- dest_im_width, dest_im_height);
+ (int) item->item_bounding_box.orig.x,
+ (int) item->item_bounding_box.orig.y,
+ dest_im_width, dest_im_height);
XFreeGC(wi->dpy, gc);
Tk_FreePixmap(wi->dpy, drw);
@@ -1097,23 +1097,23 @@ Draw(ZnItem item)
*/
#ifdef GL
static void
-Render(ZnItem item)
+Render(ZnItem item)
{
- ZnWInfo *wi = item->wi;
- TextItem text = (TextItem) item;
- TextLineInfo lines, lines_ptr;
- ZnTextInfo *ti = &wi->text_info;
- ZnPoint o, c, origin;
- ZnTransfo *transfo;
- GLdouble m[16];
- int i, num_lines;
- XColor *color;
+ ZnWInfo *wi = item->wi;
+ TextItem text = (TextItem) item;
+ TextLineInfo lines, lines_ptr;
+ ZnTextInfo *ti = &wi->text_info;
+ ZnPoint o, c, origin;
+ ZnTransfo *transfo;
+ GLdouble m[16];
+ int i, num_lines;
+ XColor *color;
unsigned short alpha;
Tk_FontMetrics fm;
- int font_height;
- int underline_thickness, underline_pos=0, overstrike_pos=0;
- int sel_first_line=-1, sel_last_line=-1, cursor_line=-1;
- int sel_start_offset=0, sel_stop_offset=0, cursor_offset=0;
+ int font_height;
+ int underline_thickness, underline_pos=0, overstrike_pos=0;
+ int sel_first_line=-1, sel_last_line=-1, cursor_line=-1;
+ int sel_start_offset=0, sel_stop_offset=0, cursor_offset=0;
if (!text->text_info) {
return;
@@ -1145,7 +1145,7 @@ Render(ZnItem item)
*/
ComputeCursor(item, &cursor_line, &cursor_offset);
ComputeSelection(item, &sel_first_line, &sel_last_line,
- &sel_start_offset, &sel_stop_offset);
+ &sel_start_offset, &sel_stop_offset);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glPushMatrix();
@@ -1172,40 +1172,40 @@ Render(ZnItem item)
o.y = lines[sel_first_line].origin_y - fm.ascent;
glBegin(GL_QUADS);
if (sel_first_line == sel_last_line) {
- c.x = o.x + sel_stop_offset - sel_start_offset;
- c.y = o.y + font_height;
- glVertex2d(o.x, o.y);
- glVertex2d(o.x, c.y);
- glVertex2d(c.x, c.y);
- glVertex2d(c.x, o.y);
+ c.x = o.x + sel_stop_offset - sel_start_offset;
+ c.y = o.y + font_height;
+ glVertex2d(o.x, o.y);
+ glVertex2d(o.x, c.y);
+ glVertex2d(c.x, c.y);
+ glVertex2d(c.x, o.y);
}
else {
- c.x = o.x + (text->max_width -
- lines[sel_first_line].origin_x - sel_start_offset);
- c.y = o.y + font_height;
- glVertex2d(o.x, o.y);
- glVertex2d(o.x, c.y);
- glVertex2d(c.x, c.y);
- glVertex2d(c.x, o.y);
- for (i = sel_first_line+1, lines_ptr = &lines[sel_first_line+1];
- i < sel_last_line; i++, lines_ptr++) {
- o.x = 0;
- o.y = lines_ptr->origin_y - fm.ascent;
- c.x = o.x + text->max_width;
- c.y = o.y + font_height;
- glVertex2d(o.x, o.y);
- glVertex2d(o.x, c.y);
- glVertex2d(c.x, c.y);
- glVertex2d(c.x, o.y);
- }
- o.x = 0;
- o.y = lines[sel_last_line].origin_y - fm.ascent;
- c.x = o.x + lines[sel_last_line].origin_x + sel_stop_offset;
- c.y = o.y + font_height;
- glVertex2d(o.x, o.y);
- glVertex2d(o.x, c.y);
- glVertex2d(c.x, c.y);
- glVertex2d(c.x, o.y);
+ c.x = o.x + (text->max_width -
+ lines[sel_first_line].origin_x - sel_start_offset);
+ c.y = o.y + font_height;
+ glVertex2d(o.x, o.y);
+ glVertex2d(o.x, c.y);
+ glVertex2d(c.x, c.y);
+ glVertex2d(c.x, o.y);
+ for (i = sel_first_line+1, lines_ptr = &lines[sel_first_line+1];
+ i < sel_last_line; i++, lines_ptr++) {
+ o.x = 0;
+ o.y = lines_ptr->origin_y - fm.ascent;
+ c.x = o.x + text->max_width;
+ c.y = o.y + font_height;
+ glVertex2d(o.x, o.y);
+ glVertex2d(o.x, c.y);
+ glVertex2d(c.x, c.y);
+ glVertex2d(c.x, o.y);
+ }
+ o.x = 0;
+ o.y = lines[sel_last_line].origin_y - fm.ascent;
+ c.x = o.x + lines[sel_last_line].origin_x + sel_stop_offset;
+ c.y = o.y + font_height;
+ glVertex2d(o.x, o.y);
+ glVertex2d(o.x, c.y);
+ glVertex2d(c.x, c.y);
+ glVertex2d(c.x, o.y);
}
glEnd();
}
@@ -1214,7 +1214,7 @@ Render(ZnItem item)
* Render the cursor.
*/
if ((cursor_line >= 0) &&
- (wi->focus_item == item) && ti->cursor_on) {
+ (wi->focus_item == item) && ti->cursor_on) {
color = ZnGetGradientColor(ti->insert_color, 0.0, &alpha);
alpha = ZnComposeAlpha(alpha, wi->alpha);
glColor4us(color->red, color->green, color->blue, alpha);
@@ -1245,21 +1245,21 @@ Render(ZnItem item)
glTranslated(lines_ptr->origin_x, lines_ptr->origin_y, 0.0);
if (ISSET(text->flags, UNDERLINED) || ISSET(text->flags, OVERSTRIKED)) {
- glLineWidth((GLfloat) underline_thickness);
- glDisable(GL_TEXTURE_2D);
- if (ISSET(text->flags, UNDERLINED)) {
- glBegin(GL_LINES);
- glVertex2d(0, underline_pos);
- glVertex2d(lines_ptr->width, underline_pos);
- glEnd();
- }
- if (ISSET(text->flags, OVERSTRIKED)) {
- glBegin(GL_LINES);
- glVertex2d(0, -overstrike_pos);
- glVertex2d(lines_ptr->width, -overstrike_pos);
- glEnd();
- }
- glEnable(GL_TEXTURE_2D);
+ glLineWidth((GLfloat) underline_thickness);
+ glDisable(GL_TEXTURE_2D);
+ if (ISSET(text->flags, UNDERLINED)) {
+ glBegin(GL_LINES);
+ glVertex2d(0, underline_pos);
+ glVertex2d(lines_ptr->width, underline_pos);
+ glEnd();
+ }
+ if (ISSET(text->flags, OVERSTRIKED)) {
+ glBegin(GL_LINES);
+ glVertex2d(0, -overstrike_pos);
+ glVertex2d(lines_ptr->width, -overstrike_pos);
+ glEnd();
+ }
+ glEnable(GL_TEXTURE_2D);
}
ZnRenderString(text->tfi, lines_ptr->start, lines_ptr->num_bytes);
@@ -1280,7 +1280,7 @@ Render(ZnItem item)
}
#else
static void
-Render(ZnItem item)
+Render(ZnItem item)
{
}
#endif
@@ -1294,11 +1294,11 @@ Render(ZnItem item)
**********************************************************************************
*/
static ZnBool
-IsSensitive(ZnItem item,
- int item_part)
+IsSensitive(ZnItem item,
+ int item_part)
{
return (ISSET(item->flags, ZN_SENSITIVE_BIT) &&
- item->parent->class->IsSensitive(item->parent, ZN_NO_PART));
+ item->parent->class->IsSensitive(item->parent, ZN_NO_PART));
}
@@ -1310,17 +1310,17 @@ IsSensitive(ZnItem item,
**********************************************************************************
*/
static double
-Pick(ZnItem item,
- ZnPick ps)
+Pick(ZnItem item,
+ ZnPick ps)
{
- TextItem text = (TextItem) item;
- double dist = 1.0e40, new_dist;
- int num_lines, i;
- TextLineInfo lines, lines_ptr;
+ TextItem text = (TextItem) item;
+ double dist = 1.0e40, new_dist;
+ int num_lines, i;
+ TextLineInfo lines, lines_ptr;
Tk_FontMetrics fm;
- int font_height;
- ZnPoint box[4], origin, *p = ps->point;
- ZnTransfo *transfo;
+ int font_height;
+ ZnPoint box[4], origin, *p = ps->point;
+ ZnTransfo *transfo;
if (!text->text_info || !text->text) {
return dist;
@@ -1366,8 +1366,8 @@ Pick(ZnItem item,
**********************************************************************************
*/
static void
-PostScript(ZnItem item,
- ZnBool prepass)
+PostScript(ZnItem item,
+ ZnBool prepass)
{
}
@@ -1380,11 +1380,11 @@ PostScript(ZnItem item,
**********************************************************************************
*/
static void
-GetAnchor(ZnItem item,
- Tk_Anchor anchor,
- ZnPoint *p)
+GetAnchor(ZnItem item,
+ Tk_Anchor anchor,
+ ZnPoint *p)
{
- TextItem text = (TextItem) item;
+ TextItem text = (TextItem) item;
if (text->num_chars != 0) {
ZnRectOrigin2Anchor(text->poly, anchor, p);
@@ -1399,16 +1399,16 @@ GetAnchor(ZnItem item,
**********************************************************************************
*
* GetClipVertices --
- * Get the clipping shape.
- * Never ever call ZnTriFree on the tristrip returned by GetClipVertices.
+ * Get the clipping shape.
+ * Never ever call ZnTriFree on the tristrip returned by GetClipVertices.
*
**********************************************************************************
*/
static ZnBool
-GetClipVertices(ZnItem item,
- ZnTriStrip *tristrip)
+GetClipVertices(ZnItem item,
+ ZnTriStrip *tristrip)
{
- TextItem text = (TextItem) item;
+ TextItem text = (TextItem) item;
ZnTriStrip1(tristrip, text->poly, 4, False);
@@ -1420,32 +1420,32 @@ GetClipVertices(ZnItem item,
**********************************************************************************
*
* Coords --
- * Return or edit the item origin. This doesn't take care of
- * the possible attachment. The change will be effective at the
- * end of the attachment.
+ * Return or edit the item origin. This doesn't take care of
+ * the possible attachment. The change will be effective at the
+ * end of the attachment.
*
**********************************************************************************
*/
static int
-Coords(ZnItem item,
- int contour,
- int index,
- int cmd,
- ZnPoint **pts,
- char **controls,
- unsigned int *num_pts)
+Coords(ZnItem item,
+ int contour,
+ int index,
+ int cmd,
+ ZnPoint **pts,
+ char **controls,
+ unsigned int *num_pts)
{
- TextItem text = (TextItem) item;
+ TextItem text = (TextItem) item;
if ((cmd == ZN_COORDS_ADD) || (cmd == ZN_COORDS_ADD_LAST) || (cmd == ZN_COORDS_REMOVE)) {
Tcl_AppendResult(item->wi->interp,
- " texts can't add or remove vertices", NULL);
+ " texts can't add or remove vertices", NULL);
return TCL_ERROR;
}
else if ((cmd == ZN_COORDS_REPLACE) || (cmd == ZN_COORDS_REPLACE_ALL)) {
if (*num_pts == 0) {
Tcl_AppendResult(item->wi->interp,
- " coords command need 1 point on texts", NULL);
+ " coords command need 1 point on texts", NULL);
return TCL_ERROR;
}
text->pos = (*pts)[0];
@@ -1463,21 +1463,21 @@ Coords(ZnItem item,
**********************************************************************************
*
* Index --
- * Parse a text index and return its value and a
- * error status (standard Tcl result).
+ * Parse a text index and return its value and a
+ * error status (standard Tcl result).
*
**********************************************************************************
*/
static int
-PointToChar(TextItem text,
- int x,
- int y)
+PointToChar(TextItem text,
+ int x,
+ int y)
{
- int i, n, num_lines, dummy, byte_index;
- ZnPoint p;
- TextLineInfo ti;
+ int i, n, num_lines, dummy, byte_index;
+ ZnPoint p;
+ TextLineInfo ti;
Tk_FontMetrics fm;
- ZnReal a, b;
+ ZnReal a, b;
byte_index = 0;
if (!text->text_info) {
@@ -1489,9 +1489,9 @@ PointToChar(TextItem text,
a = ZnLineToPointDist(&text->poly[0], &text->poly[2], &p, NULL);
b = ZnLineToPointDist(&text->poly[0], &text->poly[1], &p, NULL);
p.x = (text->max_width * b /
- hypot(text->poly[2].x - text->poly[0].x, text->poly[2].y - text->poly[0].y));
+ hypot(text->poly[2].x - text->poly[0].x, text->poly[2].y - text->poly[0].y));
p.y = (text->height * a /
- hypot(text->poly[1].x - text->poly[0].x, text->poly[1].y - text->poly[0].y));
+ hypot(text->poly[1].x - text->poly[0].x, text->poly[1].y - text->poly[0].y));
p.x = ZnNearestInt(p.x);
p.y = ZnNearestInt(p.y);
@@ -1511,24 +1511,24 @@ PointToChar(TextItem text,
for (i = 0; i < num_lines; i++, ti++) {
if (p.y < ti->origin_y + fm.descent) {
if (p.x < ti->origin_x) {
- /*
- * Point to the left of the current line, returns
- * index of first char.
- */
- byte_index = ti->start - text->text;
- break;
+ /*
+ * Point to the left of the current line, returns
+ * index of first char.
+ */
+ byte_index = ti->start - text->text;
+ break;
}
if (p.x >= (ti->origin_x + ti->width)) {
- /*
- * Point to the right of the current line, returns
- * index past the last char.
- */
- byte_index = ti->start + ti->num_bytes - text->text;
- break;
+ /*
+ * Point to the right of the current line, returns
+ * index past the last char.
+ */
+ byte_index = ti->start + ti->num_bytes - text->text;
+ break;
}
n = Tk_MeasureChars(text->font, ti->start, (int) ti->num_bytes,
- (int) (p.x + 2 - ti->origin_x), TK_PARTIAL_OK,
- &dummy);
+ (int) (p.x + 2 - ti->origin_x), TK_PARTIAL_OK,
+ &dummy);
#ifdef PTK_800
byte_index = (ti->start + n - 1) - text->text;
#else
@@ -1562,14 +1562,14 @@ PointToChar(TextItem text,
*
*/
static int
-MoveFromIndex(TextItem text,
- unsigned int char_index,
- int move)
+MoveFromIndex(TextItem text,
+ unsigned int char_index,
+ int move)
{
- unsigned int num_lines, byte_index, num_bytes=0;
- unsigned int line_index, line_start=0;
- TextLineInfo lines, p;
- char *strp;
+ unsigned int num_lines, byte_index, num_bytes=0;
+ unsigned int line_index, line_start=0;
+ TextLineInfo lines, p;
+ char *strp;
if (!text->text_info || !text->text) {
return char_index;
@@ -1641,18 +1641,18 @@ MoveFromIndex(TextItem text,
}
static int
-Index(ZnItem item,
- int field,
- Tcl_Obj *index_spec,
- int *index)
+Index(ZnItem item,
+ int field,
+ Tcl_Obj *index_spec,
+ int *index)
{
- TextItem text = (TextItem) item;
- ZnWInfo *wi = item->wi;
- ZnTextInfo *ti = &wi->text_info;
- unsigned int length;
- int c, x, y;
- double tmp;
- char *end, *p;
+ TextItem text = (TextItem) item;
+ ZnWInfo *wi = item->wi;
+ ZnTextInfo *ti = &wi->text_info;
+ unsigned int length;
+ int c, x, y;
+ double tmp;
+ char *end, *p;
p = Tcl_GetString(index_spec);
c = p[0];
@@ -1683,7 +1683,7 @@ Index(ZnItem item,
*index = text->insert_index;
}
else if ((c == 's') && (strncmp(p, "sel.first", length) == 0) &&
- (length >= 5)) {
+ (length >= 5)) {
if (ti->sel_item != item) {
Tcl_AppendResult(wi->interp, "selection isn't in item", (char *) NULL);
return TCL_ERROR;
@@ -1691,7 +1691,7 @@ Index(ZnItem item,
*index = ti->sel_first;
}
else if ((c == 's') && (strncmp(p, "sel.last", length) == 0) &&
- (length >= 5)) {
+ (length >= 5)) {
if (ti->sel_item != item) {
Tcl_AppendResult(wi->interp, "selection isn't in item", (char *) NULL);
return TCL_ERROR;
@@ -1747,15 +1747,15 @@ Index(ZnItem item,
**********************************************************************************
*/
static void
-InsertChars(ZnItem item,
- int field,
- int *index,
- char *chars)
+InsertChars(ZnItem item,
+ int field,
+ int *index,
+ char *chars)
{
- TextItem text = (TextItem) item;
- ZnTextInfo *ti = &item->wi->text_info;
- unsigned int num_chars, byte_index, num_bytes = strlen(chars);
- char *new;
+ TextItem text = (TextItem) item;
+ ZnTextInfo *ti = &item->wi->text_info;
+ unsigned int num_chars, byte_index, num_bytes = strlen(chars);
+ char *new;
if (num_bytes == 0) {
return;
@@ -1811,16 +1811,16 @@ InsertChars(ZnItem item,
**********************************************************************************
*/
static void
-DeleteChars(ZnItem item,
- int field,
- int *first,
- int *last)
+DeleteChars(ZnItem item,
+ int field,
+ int *first,
+ int *last)
{
- TextItem text = (TextItem) item;
- int byte_count, first_offset;
- int char_count, num_bytes;
- ZnTextInfo *ti = &item->wi->text_info;
- char *new;
+ TextItem text = (TextItem) item;
+ int byte_count, first_offset;
+ int char_count, num_bytes;
+ ZnTextInfo *ti = &item->wi->text_info;
+ char *new;
if (!text->text) {
return;
@@ -1867,13 +1867,13 @@ DeleteChars(ZnItem item,
if (ti->sel_first > *first) {
ti->sel_first -= char_count;
if (ti->sel_first < *first) {
- ti->sel_first = *first;
+ ti->sel_first = *first;
}
}
if (ti->sel_last >= *first) {
ti->sel_last -= char_count;
if (ti->sel_last < *first - 1) {
- ti->sel_last = *first - 1;
+ ti->sel_last = *first - 1;
}
}
if (ti->sel_first > ti->sel_last) {
@@ -1882,7 +1882,7 @@ DeleteChars(ZnItem item,
if ((ti->anchor_item == item) && (ti->sel_anchor > *first)) {
ti->sel_anchor -= char_count;
if (ti->sel_anchor < *first) {
- ti->sel_anchor = *first;
+ ti->sel_anchor = *first;
}
}
}
@@ -1899,11 +1899,11 @@ DeleteChars(ZnItem item,
**********************************************************************************
*/
static void
-TextCursor(ZnItem item,
- int field,
- int index)
+TextCursor(ZnItem item,
+ int field,
+ int index)
{
- TextItem text = (TextItem) item;
+ TextItem text = (TextItem) item;
if (index < 0) {
text->insert_index = 0;
@@ -1925,17 +1925,17 @@ TextCursor(ZnItem item,
**********************************************************************************
*/
static int
-Selection(ZnItem item,
- int field,
- int offset,
- char *chars,
- int max_bytes)
+Selection(ZnItem item,
+ int field,
+ int offset,
+ char *chars,
+ int max_bytes)
{
- TextItem text = (TextItem) item;
- ZnWInfo *wi = item->wi;
- ZnTextInfo *ti = &wi->text_info;
- int count;
- char const *sel_first, *sel_last;
+ TextItem text = (TextItem) item;
+ ZnWInfo *wi = item->wi;
+ ZnTextInfo *ti = &wi->text_info;
+ int count;
+ char const *sel_first, *sel_last;
if (!text->text) {
return 0;
@@ -1971,7 +1971,7 @@ static ZnItemClassStruct TEXT_ITEM_CLASS = {
"text",
sizeof(TextItemStruct),
text_attrs,
- 0, /* num_parts */
+ 0, /* num_parts */
ZN_CLASS_HAS_ANCHORS|ZN_CLASS_ONE_COORD, /* flags */
Tk_Offset(TextItemStruct, pos),
Init,
@@ -1979,25 +1979,25 @@ static ZnItemClassStruct TEXT_ITEM_CLASS = {
Destroy,
Configure,
Query,
- NULL, /* GetFieldSet */
+ NULL, /* GetFieldSet */
GetAnchor,
GetClipVertices,
- NULL, /* GetContours */
+ NULL, /* GetContours */
Coords,
InsertChars,
DeleteChars,
TextCursor,
Index,
- NULL, /* Part */
+ NULL, /* Part */
Selection,
- NULL, /* Contour */
+ NULL, /* Contour */
ComputeCoordinates,
ToArea,
Draw,
Render,
IsSensitive,
Pick,
- NULL, /* PickVertex */
+ NULL, /* PickVertex */
PostScript
};
diff --git a/generic/Track.c b/generic/Track.c
index 48c55d5..3c73a17 100644
--- a/generic/Track.c
+++ b/generic/Track.c
@@ -1,8 +1,8 @@
/*
* Track.c -- Implementation of Track and WayPoint items.
*
- * Authors : Patrick Lecoanet.
- * Creation date :
+ * Authors : Patrick Lecoanet.
+ * Creation date :
*
* $Id$
*/
@@ -53,14 +53,14 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ "
/*
* Some default values
*/
-#define DEFAULT_MARKER_SIZE 0
-#define DEFAULT_LABEL_ANGLE 20
-#define DEFAULT_LABEL_DISTANCE 50
-#define DEFAULT_LINE_WIDTH 1
-#define DEFAULT_LABEL_PREFERRED_ANGLE 0
-#define DEFAULT_CONVERGENCE_STYLE 0
+#define DEFAULT_MARKER_SIZE 0
+#define DEFAULT_LABEL_ANGLE 20
+#define DEFAULT_LABEL_DISTANCE 50
+#define DEFAULT_LINE_WIDTH 1
+#define DEFAULT_LABEL_PREFERRED_ANGLE 0
+#define DEFAULT_CONVERGENCE_STYLE 0
-#define SPEED_VECTOR_PICKING_THRESHOLD 5 /* In pixels */
+#define SPEED_VECTOR_PICKING_THRESHOLD 5 /* In pixels */
/*
* Sets a threshold for calculating distance from label_dx, label_dy.
@@ -69,21 +69,21 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ "
*/
#define LABEL_DISTANCE_THRESHOLD 5
-#define MARKER_FILLED_BIT 1 << 0
-#define FILLED_HISTORY_BIT 1 << 1
-#define DOT_MIXED_HISTORY_BIT 1 << 2
-#define CIRCLE_HISTORY_BIT 1 << 3
-#define SV_MARK_BIT 1 << 4
-#define SV_TICKS_BIT 1 << 5
-#define POLAR_BIT 1 << 6
-#define FROZEN_LABEL_BIT 1 << 7
-#define LAST_AS_FIRST_BIT 1 << 8
-#define HISTORY_VISIBLE_BIT 1 << 9
+#define MARKER_FILLED_BIT 1 << 0
+#define FILLED_HISTORY_BIT 1 << 1
+#define DOT_MIXED_HISTORY_BIT 1 << 2
+#define CIRCLE_HISTORY_BIT 1 << 3
+#define SV_MARK_BIT 1 << 4
+#define SV_TICKS_BIT 1 << 5
+#define POLAR_BIT 1 << 6
+#define FROZEN_LABEL_BIT 1 << 7
+#define LAST_AS_FIRST_BIT 1 << 8
+#define HISTORY_VISIBLE_BIT 1 << 9
-#define CURRENT_POSITION -2
-#define LEADER -3
-#define CONNECTION -4
-#define SPEED_VECTOR -5
+#define CURRENT_POSITION -2
+#define LEADER -3
+#define CONNECTION -4
+#define SPEED_VECTOR -5
/*
@@ -94,57 +94,57 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ "
**********************************************************************************
*/
typedef struct {
- ZnPoint world; /* world coord of pos */
- ZnPoint dev; /* dev coord of pos */
- ZnBool visible;
+ ZnPoint world; /* world coord of pos */
+ ZnPoint dev; /* dev coord of pos */
+ ZnBool visible;
} HistoryStruct, *History;
typedef struct _TrackItemStruct {
- ZnItemStruct header;
+ ZnItemStruct header;
/* Public data */
unsigned short flags;
- ZnImage symbol; /* item symbol */
- ZnGradient *symbol_color;
- int label_angle; /* Label angle from track. */
- ZnDim label_distance; /* Label distance from track. */
- ZnDim label_dx; /* Label dx/dy from track. */
- ZnDim label_dy;
+ ZnImage symbol; /* item symbol */
+ ZnGradient *symbol_color;
+ int label_angle; /* Label angle from track. */
+ ZnDim label_distance; /* Label distance from track. */
+ ZnDim label_dx; /* Label dx/dy from track. */
+ ZnDim label_dy;
int label_preferred_angle;
int label_convergence_style;
- Tk_Anchor label_anchor;
- ZnLeaderAnchors leader_anchors; /* Spec of the leader attachment */
- ZnGradient *leader_color; /* leader color */
- ZnLineStyle leader_style;
- ZnLineShape leader_shape;
- ZnLineEnd leader_first_end;
- ZnLineEnd leader_last_end;
- ZnDim leader_width;
- ZnDim marker_size; /* world size of error circle */
- ZnGradient *marker_color; /* error circle color */
- ZnLineStyle marker_style; /* error circle style */
- ZnImage marker_fill_pattern; /* error circle fill pattern */
- ZnGradient *connection_color; /* connection color */
- ZnLineStyle connection_style;
- ZnDim connection_width;
- ZnGradient *speed_vector_color; /* s. v. color */
- ZnPoint pos; /* item world coordinates */
- ZnPoint speed_vector; /* s. v. slope in world coord */
- ZnDim speed_vector_width;
- ZnGradient *history_color;
- ZnDim history_width;
+ Tk_Anchor label_anchor;
+ ZnLeaderAnchors leader_anchors; /* Spec of the leader attachment */
+ ZnGradient *leader_color; /* leader color */
+ ZnLineStyle leader_style;
+ ZnLineShape leader_shape;
+ ZnLineEnd leader_first_end;
+ ZnLineEnd leader_last_end;
+ ZnDim leader_width;
+ ZnDim marker_size; /* world size of error circle */
+ ZnGradient *marker_color; /* error circle color */
+ ZnLineStyle marker_style; /* error circle style */
+ ZnImage marker_fill_pattern; /* error circle fill pattern */
+ ZnGradient *connection_color; /* connection color */
+ ZnLineStyle connection_style;
+ ZnDim connection_width;
+ ZnGradient *speed_vector_color; /* s. v. color */
+ ZnPoint pos; /* item world coordinates */
+ ZnPoint speed_vector; /* s. v. slope in world coord */
+ ZnDim speed_vector_width;
+ ZnGradient *history_color;
+ ZnDim history_width;
/* Private data */
ZnFieldSetStruct field_set;
- ZnPoint dev; /* device coords of current pos */
- ZnPoint speed_vector_dev; /* s. v. end in device coord */
- ZnDim marker_size_dev; /* dev size of error circle */
- ZnList history; /* pos list */
- ZnList leader_points;
+ ZnPoint dev; /* device coords of current pos */
+ ZnPoint speed_vector_dev; /* s. v. end in device coord */
+ ZnDim marker_size_dev; /* dev size of error circle */
+ ZnList history; /* pos list */
+ ZnList leader_points;
} TrackItemStruct, *TrackItem;
-static ZnAttrConfig track_attrs[] = {
+static ZnAttrConfig track_attrs[] = {
{ ZN_CONFIG_BOOL, "-circlehistory", NULL,
Tk_Offset(TrackItemStruct, flags), CIRCLE_HISTORY_BIT, ZN_DRAW_FLAG, False },
{ ZN_CONFIG_BOOL, "-composealpha", NULL,
@@ -268,7 +268,7 @@ static ZnAttrConfig track_attrs[] = {
{ ZN_CONFIG_END, NULL, NULL, 0, 0, 0, False }
};
-static ZnAttrConfig wp_attrs[] = {
+static ZnAttrConfig wp_attrs[] = {
{ ZN_CONFIG_BOOL, "-composealpha", NULL,
Tk_Offset(TrackItemStruct, header.flags), ZN_COMPOSE_ALPHA_BIT,
ZN_DRAW_FLAG, False },
@@ -369,14 +369,14 @@ static ZnAttrConfig wp_attrs[] = {
**********************************************************************************
*/
static int
-Init(ZnItem item,
- int *argc,
- Tcl_Obj *CONST *args[])
+Init(ZnItem item,
+ int *argc,
+ Tcl_Obj *CONST *args[])
{
- TrackItem track = (TrackItem) item;
- ZnFieldSet field_set = &track->field_set;
- ZnWInfo *wi = item->wi;
- int num_fields;
+ TrackItem track = (TrackItem) item;
+ ZnFieldSet field_set = &track->field_set;
+ ZnWInfo *wi = item->wi;
+ int num_fields;
/*printf("size of a track = %d\n", sizeof(TrackItemStruct));*/
@@ -413,7 +413,7 @@ Init(ZnItem item,
track->marker_fill_pattern = ZnUnspecifiedImage;
track->speed_vector_color = ZnGetGradientByValue(wi->fore_color);
track->history_color = ZnGetGradientByValue(wi->fore_color);
- track->history_width = 8;
+ track->history_width = 8;
CLEAR(track->flags, MARKER_FILLED_BIT);
SET(track->flags, FILLED_HISTORY_BIT);
CLEAR(track->flags, DOT_MIXED_HISTORY_BIT);
@@ -481,9 +481,9 @@ Init(ZnItem item,
**********************************************************************************
*/
static void
-Clone(ZnItem item)
+Clone(ZnItem item)
{
- TrackItem track = (TrackItem) item;
+ TrackItem track = (TrackItem) item;
if (track->history) {
track->history = ZnListDuplicate(track->history);
@@ -532,9 +532,9 @@ Clone(ZnItem item)
**********************************************************************************
*/
static void
-Destroy(ZnItem item)
+Destroy(ZnItem item)
{
- TrackItem track = (TrackItem) item;
+ TrackItem track = (TrackItem) item;
if (track->leader_points) {
ZnListFree(track->leader_points);
@@ -580,13 +580,13 @@ Destroy(ZnItem item)
**********************************************************************************
*/
static void
-AddToHistory(TrackItem track,
- ZnPoint old_pos)
+AddToHistory(TrackItem track,
+ ZnPoint old_pos)
{
- ZnWInfo *wi = ((ZnItem) track)->wi;
+ ZnWInfo *wi = ((ZnItem) track)->wi;
if (track->history) {
- HistoryStruct hist;
+ HistoryStruct hist;
hist.world = old_pos;
hist.dev = track->dev;
@@ -599,20 +599,20 @@ AddToHistory(TrackItem track,
* is not valid. */
/*printf("creating history\n");*/
track->history = ZnListNew(wi->track_managed_history_size+1,
- sizeof(HistoryStruct));
+ sizeof(HistoryStruct));
}
}
static int
-Configure(ZnItem item,
- int argc,
- Tcl_Obj *CONST argv[],
- int *flags)
+Configure(ZnItem item,
+ int argc,
+ Tcl_Obj *CONST argv[],
+ int *flags)
{
- TrackItem track = (TrackItem) item;
- ZnWInfo *wi = item->wi;
- ZnItem old_connected;
- ZnPoint old_pos;
+ TrackItem track = (TrackItem) item;
+ ZnWInfo *wi = item->wi;
+ ZnItem old_connected;
+ ZnPoint old_pos;
old_pos = track->pos;
old_connected = item->connected_item;
@@ -643,9 +643,9 @@ Configure(ZnItem item,
* to the old one.
*/
if ((item->connected_item == ZN_NO_ITEM) ||
- (((item->connected_item->class == ZnTrack) ||
- (item->connected_item->class == ZnWayPoint)) &&
- (item->parent == item->connected_item->parent))) {
+ (((item->connected_item->class == ZnTrack) ||
+ (item->connected_item->class == ZnWayPoint)) &&
+ (item->parent == item->connected_item->parent))) {
ZnITEM.UpdateItemDependency(item, old_connected);
}
else {
@@ -680,9 +680,9 @@ Configure(ZnItem item,
**********************************************************************************
*/
static int
-Query(ZnItem item,
- int argc,
- Tcl_Obj *CONST argv[])
+Query(ZnItem item,
+ int argc,
+ Tcl_Obj *CONST argv[])
{
if (ZnQueryAttribute(item->wi->interp, item, track_attrs, argv[0]) == TCL_ERROR) {
return TCL_ERROR;
@@ -700,22 +700,22 @@ Query(ZnItem item,
**********************************************************************************
*/
static void
-ComputeCoordinates(ZnItem item,
- ZnBool force)
+ComputeCoordinates(ZnItem item,
+ ZnBool force)
{
- ZnWInfo *wi = item->wi;
- TrackItem track = (TrackItem) item;
- ZnFieldSet field_set = &track->field_set;
- ZnItem c_item;
- History hist;
- ZnPoint old_label_pos, old_pos, p, xp;
- ZnDim old_label_width, old_label_height;
- ZnReal rotation;
- ZnBBox bbox;
- ZnPoint *points;
- unsigned int num_points, num_acc_pos, i;
- int alignment;
- int w2=0, h2=0, w=0, h=0;
+ ZnWInfo *wi = item->wi;
+ TrackItem track = (TrackItem) item;
+ ZnFieldSet field_set = &track->field_set;
+ ZnItem c_item;
+ History hist;
+ ZnPoint old_label_pos, old_pos, p, xp;
+ ZnDim old_label_width, old_label_height;
+ ZnReal rotation;
+ ZnBBox bbox;
+ ZnPoint *points;
+ unsigned int num_points, num_acc_pos, i;
+ int alignment;
+ int w2=0, h2=0, w=0, h=0;
ZnResetBBox(&item->item_bounding_box);
old_label_pos = field_set->label_pos;
@@ -753,21 +753,21 @@ ComputeCoordinates(ZnItem item,
*/
ZnListTruncate(track->history, wi->track_managed_history_size);
visible_history_size = (ISSET(track->flags, HISTORY_VISIBLE_BIT) ?
- wi->track_visible_history_size : 0);
+ wi->track_visible_history_size : 0);
ZnResetBBox(&bbox);
w = (int) track->history_width;
- w2 = (w+1)/2;
+ w2 = (w+1)/2;
num_acc_pos = ZnListSize(track->history);
hist = ZnListArray(track->history);
for (i = 0; i < num_acc_pos; i++) {
ZnTransformPoint(wi->current_transfo, &hist[i].world, &hist[i].dev);
if ((i < visible_history_size) && (hist[i].visible)) {
- bbox.orig.x = hist[i].dev.x - w2;
- bbox.orig.y = hist[i].dev.y - w2;
- bbox.corner.x = bbox.orig.x + w;
- bbox.corner.y = bbox.orig.y + w;
- ZnAddBBoxToBBox(&item->item_bounding_box, &bbox);
+ bbox.orig.x = hist[i].dev.x - w2;
+ bbox.orig.y = hist[i].dev.y - w2;
+ bbox.corner.x = bbox.orig.x + w;
+ bbox.corner.y = bbox.orig.y + w;
+ ZnAddBBoxToBBox(&item->item_bounding_box, &bbox);
}
}
}
@@ -784,15 +784,15 @@ ComputeCoordinates(ZnItem item,
if (ISSET(track->flags, SV_MARK_BIT)) {
int w = (int) track->speed_vector_width + 1;
ZnAddPointToBBox(&item->item_bounding_box,
- track->speed_vector_dev.x - w,
- track->speed_vector_dev.y - w);
+ track->speed_vector_dev.x - w,
+ track->speed_vector_dev.y - w);
ZnAddPointToBBox(&item->item_bounding_box,
- track->speed_vector_dev.x + w,
- track->speed_vector_dev.y + w);
+ track->speed_vector_dev.x + w,
+ track->speed_vector_dev.y + w);
}
else {
ZnAddPointToBBox(&item->item_bounding_box, track->speed_vector_dev.x,
- track->speed_vector_dev.y);
+ track->speed_vector_dev.y);
}
}
@@ -804,7 +804,7 @@ ComputeCoordinates(ZnItem item,
w2 = (int) track->connection_width/2;
ZnAddPointToBBox(&item->item_bounding_box, track->dev.x-w2, track->dev.y-w2);
ZnAddPointToBBox(&item->item_bounding_box, ((TrackItem)c_item)->dev.x+w2,
- ((TrackItem)c_item)->dev.y+w2);
+ ((TrackItem)c_item)->dev.y+w2);
}
/*
@@ -819,18 +819,18 @@ ComputeCoordinates(ZnItem item,
track->marker_size_dev = ZnNearestInt(track->marker_size_dev);
if (track->marker_size_dev > PRECISION_LIMIT) {
ZnAddPointToBBox(&item->item_bounding_box,
- track->dev.x - (ZnPos) track->marker_size_dev,
- track->dev.y - (ZnPos) track->marker_size_dev);
+ track->dev.x - (ZnPos) track->marker_size_dev,
+ track->dev.y - (ZnPos) track->marker_size_dev);
ZnAddPointToBBox(&item->item_bounding_box,
- track->dev.x + (ZnPos) track->marker_size_dev,
- track->dev.y + (ZnPos) track->marker_size_dev);
+ track->dev.x + (ZnPos) track->marker_size_dev,
+ track->dev.y + (ZnPos) track->marker_size_dev);
}
/* Compute the new label bounding box. */
if (field_set->label_format && field_set->num_fields) {
- ZnDim bb_width, bb_height;
- ZnReal rho, dist;
- ZnPoint leader_end;
+ ZnDim bb_width, bb_height;
+ ZnReal rho, dist;
+ ZnPoint leader_end;
int it;
ZnFIELD.GetLabelBBox(field_set, &bb_width, &bb_height);
@@ -844,34 +844,34 @@ ComputeCoordinates(ZnItem item,
*/
ZnTransfoDecompose(wi->current_transfo, NULL, NULL, &rotation, NULL);
/*printf("rotation=%g, heading=%g, angle=%d\n", rotation,
- ZnProjectionToAngle(track->speed_vector.x, track->speed_vector.y),
- track->label_angle);*/
+ ZnProjectionToAngle(track->speed_vector.x, track->speed_vector.y),
+ track->label_angle);*/
rotation = ZnProjectionToAngle(track->speed_vector.x, track->speed_vector.y)-rotation;
it = 0;
while (1) {
- ZnPointPolarToCartesian(rotation, rho, (ZnReal) track->label_angle,
- &track->label_dx, &track->label_dy);
- field_set->label_pos.x = track->dev.x + track->label_dx;
- field_set->label_pos.y = track->dev.y - track->label_dy;
- ZnAnchor2Origin(&field_set->label_pos, bb_width, bb_height,
- track->label_anchor, &field_set->label_pos);
- ZnResetBBox(&bbox);
- ZnAddPointToBBox(&bbox, field_set->label_pos.x, field_set->label_pos.y);
- ZnAddPointToBBox(&bbox, field_set->label_pos.x + bb_width, field_set->label_pos.y + bb_height);
- dist = ZnRectangleToPointDist(&bbox, &track->dev);
- dist = track->label_distance - dist;
- if (ABS(dist) < 1.0 || it > 5) {
- break;
- }
- it++;
- rho += dist;
+ ZnPointPolarToCartesian(rotation, rho, (ZnReal) track->label_angle,
+ &track->label_dx, &track->label_dy);
+ field_set->label_pos.x = track->dev.x + track->label_dx;
+ field_set->label_pos.y = track->dev.y - track->label_dy;
+ ZnAnchor2Origin(&field_set->label_pos, bb_width, bb_height,
+ track->label_anchor, &field_set->label_pos);
+ ZnResetBBox(&bbox);
+ ZnAddPointToBBox(&bbox, field_set->label_pos.x, field_set->label_pos.y);
+ ZnAddPointToBBox(&bbox, field_set->label_pos.x + bb_width, field_set->label_pos.y + bb_height);
+ dist = ZnRectangleToPointDist(&bbox, &track->dev);
+ dist = track->label_distance - dist;
+ if (ABS(dist) < 1.0 || it > 5) {
+ break;
+ }
+ it++;
+ rho += dist;
}
}
else {
field_set->label_pos.x = track->dev.x + track->label_dx;
field_set->label_pos.y = track->dev.y - track->label_dy;
ZnAnchor2Origin(&field_set->label_pos, bb_width, bb_height,
- track->label_anchor, &field_set->label_pos);
+ track->label_anchor, &field_set->label_pos);
}
field_set->label_pos.x = ZnNearestInt(field_set->label_pos.x);
field_set->label_pos.y = ZnNearestInt(field_set->label_pos.y);
@@ -886,52 +886,52 @@ ComputeCoordinates(ZnItem item,
#endif
ZnAddPointToBBox(&item->item_bounding_box, field_set->label_pos.x - CORR, field_set->label_pos.y - CORR);
ZnAddPointToBBox(&item->item_bounding_box,
- field_set->label_pos.x + (ZnPos) bb_width + CORR,
- field_set->label_pos.y + (ZnPos) bb_height + CORR);
+ field_set->label_pos.x + (ZnPos) bb_width + CORR,
+ field_set->label_pos.y + (ZnPos) bb_height + CORR);
#undef CORR
/*
* Process the leader.
*/
if (track->leader_width > 0) {
- int left_x, left_y, right_x, right_y;
- ZnPoint end_points[ZN_LINE_END_POINTS];
+ int left_x, left_y, right_x, right_y;
+ ZnPoint end_points[ZN_LINE_END_POINTS];
/*
* Compute the actual leader end in the label.
*/
if (track->leader_anchors) {
- left_x = track->leader_anchors->left_x;
- right_x = track->leader_anchors->right_x;
- left_y = track->leader_anchors->left_y;
- right_y = track->leader_anchors->right_y;
+ left_x = track->leader_anchors->left_x;
+ right_x = track->leader_anchors->right_x;
+ left_y = track->leader_anchors->left_y;
+ right_y = track->leader_anchors->right_y;
}
else {
- left_x = right_x = left_y = right_y = 50;
+ left_x = right_x = left_y = right_y = 50;
}
if (track->label_angle >= 270 || track->label_angle < 90) {
- if (track->leader_anchors && (left_y < 0)) {
- ZnFIELD.GetFieldBBox(field_set, (unsigned int) left_x, &bbox);
- leader_end.x = bbox.orig.x;
- leader_end.y = bbox.corner.y;
- }
- else {
- leader_end.x = field_set->label_pos.x + left_x*bb_width/100;
- leader_end.y = field_set->label_pos.y + left_y*bb_height/100;
- }
- alignment = ZN_AA_LEFT;
+ if (track->leader_anchors && (left_y < 0)) {
+ ZnFIELD.GetFieldBBox(field_set, (unsigned int) left_x, &bbox);
+ leader_end.x = bbox.orig.x;
+ leader_end.y = bbox.corner.y;
+ }
+ else {
+ leader_end.x = field_set->label_pos.x + left_x*bb_width/100;
+ leader_end.y = field_set->label_pos.y + left_y*bb_height/100;
+ }
+ alignment = ZN_AA_LEFT;
}
else {
- if (track->leader_anchors && (right_y < 0)) {
- ZnFIELD.GetFieldBBox(field_set, (unsigned int) right_x, &bbox);
- leader_end.x = bbox.corner.x;
- leader_end.y = bbox.corner.y;
- }
- else {
- leader_end.x = field_set->label_pos.x + right_x*bb_width/100;
- leader_end.y = field_set->label_pos.y + right_y*bb_height/100;
- }
- alignment = ZN_AA_RIGHT;
+ if (track->leader_anchors && (right_y < 0)) {
+ ZnFIELD.GetFieldBBox(field_set, (unsigned int) right_x, &bbox);
+ leader_end.x = bbox.corner.x;
+ leader_end.y = bbox.corner.y;
+ }
+ else {
+ leader_end.x = field_set->label_pos.x + right_x*bb_width/100;
+ leader_end.y = field_set->label_pos.y + right_y*bb_height/100;
+ }
+ alignment = ZN_AA_RIGHT;
}
ZnFIELD.SetFieldsAutoAlign(field_set, alignment);
@@ -941,24 +941,24 @@ ComputeCoordinates(ZnItem item,
/* Setup leader shape points */
if (!track->leader_points) {
- track->leader_points = ZnListNew(ZN_LINE_SHAPE_POINTS, sizeof(ZnPoint));
+ track->leader_points = ZnListNew(ZN_LINE_SHAPE_POINTS, sizeof(ZnPoint));
}
ZnLineShapePoints(&track->dev, &leader_end, track->leader_width,
- track->leader_shape, &bbox, track->leader_points);
+ track->leader_shape, &bbox, track->leader_points);
ZnAddBBoxToBBox(&item->item_bounding_box, &bbox);
points = (ZnPoint *) ZnListArray(track->leader_points);
num_points = ZnListSize(track->leader_points);
/* Setup leader ends */
if (track->leader_first_end != NULL) {
- ZnGetLineEnd(&points[0], &points[1], track->leader_width,
- CapRound, track->leader_first_end, end_points);
- ZnAddPointsToBBox(&item->item_bounding_box, end_points, ZN_LINE_END_POINTS);
+ ZnGetLineEnd(&points[0], &points[1], track->leader_width,
+ CapRound, track->leader_first_end, end_points);
+ ZnAddPointsToBBox(&item->item_bounding_box, end_points, ZN_LINE_END_POINTS);
}
if (track->leader_last_end != NULL) {
- ZnGetLineEnd(&points[num_points-1], &points[num_points-2], track->leader_width,
- CapRound, track->leader_last_end, end_points);
- ZnAddPointsToBBox(&item->item_bounding_box, end_points, ZN_LINE_END_POINTS);
+ ZnGetLineEnd(&points[num_points-1], &points[num_points-2], track->leader_width,
+ CapRound, track->leader_last_end, end_points);
+ ZnAddPointsToBBox(&item->item_bounding_box, end_points, ZN_LINE_END_POINTS);
}
}
}
@@ -980,21 +980,21 @@ ComputeCoordinates(ZnItem item,
**********************************************************************************
*
* ToArea --
-* Tell if the object is entirely outside (-1),
-* entirely inside (1) or in between (0).
+* Tell if the object is entirely outside (-1),
+* entirely inside (1) or in between (0).
*
**********************************************************************************
*/
static int
-ToArea(ZnItem item,
- ZnToArea ta)
+ToArea(ZnItem item,
+ ZnToArea ta)
{
- TrackItem track = (TrackItem) item;
- int inside;
- int width, height;
- ZnDim lwidth, lheight;
- ZnBBox bbox, *area = ta->area;
- ZnPoint pts[2];
+ TrackItem track = (TrackItem) item;
+ int inside;
+ int width, height;
+ ZnDim lwidth, lheight;
+ ZnBBox bbox, *area = ta->area;
+ ZnPoint pts[2];
/*
* Try the current position.
@@ -1027,32 +1027,32 @@ ToArea(ZnItem item,
* Try the leader.
*/
if (track->field_set.label_format && (track->leader_width > 0)) {
- ZnPoint end_points[ZN_LINE_END_POINTS];
- ZnPoint *points;
+ ZnPoint end_points[ZN_LINE_END_POINTS];
+ ZnPoint *points;
unsigned int num_points;
points = (ZnPoint *) ZnListArray(track->leader_points);
num_points = ZnListSize(track->leader_points);
lwidth = track->leader_width > 1 ? track->leader_width : 0;
if (ZnPolylineInBBox(points, num_points, lwidth,
- CapRound, JoinRound, area) != inside) {
+ CapRound, JoinRound, area) != inside) {
/*printf("track leader\n");*/
return 0;
}
if (track->leader_first_end != NULL) {
ZnGetLineEnd(&points[0], &points[1], track->leader_width,
- CapRound, track->leader_first_end, end_points);
+ CapRound, track->leader_first_end, end_points);
if (ZnPolygonInBBox(end_points, ZN_LINE_END_POINTS, area, NULL) != inside) {
- /*printf("track leader\n");*/
- return 0;
+ /*printf("track leader\n");*/
+ return 0;
}
}
if (track->leader_last_end != NULL) {
ZnGetLineEnd(&points[num_points-1], &points[num_points-2], track->leader_width,
- CapRound, track->leader_last_end, end_points);
+ CapRound, track->leader_last_end, end_points);
if (ZnPolygonInBBox(end_points, ZN_LINE_END_POINTS, area, NULL) != inside) {
- /*printf("track leader\n");*/
- return 0;
+ /*printf("track leader\n");*/
+ return 0;
}
}
}
@@ -1095,16 +1095,16 @@ ToArea(ZnItem item,
**********************************************************************************
*/
static void
-Draw(ZnItem item)
+Draw(ZnItem item)
{
- ZnWInfo *wi = item->wi;
- TrackItem track = (TrackItem) item;
- ZnItem c_item;
- XGCValues values;
- History hist;
- unsigned int h_side_size, side_size, width=0, height=0;
- unsigned int i, nb_hist, num_acc_pos;
- int x, y;
+ ZnWInfo *wi = item->wi;
+ TrackItem track = (TrackItem) item;
+ ZnItem c_item;
+ XGCValues values;
+ History hist;
+ unsigned int h_side_size, side_size, width=0, height=0;
+ unsigned int i, nb_hist, num_acc_pos;
+ int x, y;
/* Draw the marker */
if (track->marker_size_dev != 0) {
@@ -1113,33 +1113,33 @@ Draw(ZnItem item)
values.line_width = 0;
if (ISSET(track->flags, MARKER_FILLED_BIT)) {
if (track->marker_fill_pattern == ZnUnspecifiedImage) {
- /* Fill solid */
- values.fill_style = FillSolid;
- XChangeGC(wi->dpy, wi->gc, GCFillStyle | GCLineWidth | GCForeground, &values);
+ /* Fill solid */
+ values.fill_style = FillSolid;
+ XChangeGC(wi->dpy, wi->gc, GCFillStyle | GCLineWidth | GCForeground, &values);
}
else {
- /* Fill stippled */
- values.fill_style = FillStippled;
- values.stipple = ZnImagePixmap(track->marker_fill_pattern, wi->win);
- XChangeGC(wi->dpy, wi->gc,
- GCFillStyle | GCStipple | GCLineWidth | GCForeground, &values);
+ /* Fill stippled */
+ values.fill_style = FillStippled;
+ values.stipple = ZnImagePixmap(track->marker_fill_pattern, wi->win);
+ XChangeGC(wi->dpy, wi->gc,
+ GCFillStyle | GCStipple | GCLineWidth | GCForeground, &values);
}
XFillArc(wi->dpy, wi->draw_buffer, wi->gc,
- (int) (track->dev.x - (ZnPos) track->marker_size_dev),
- (int) (track->dev.y - (ZnPos) track->marker_size_dev),
- (unsigned int) track->marker_size_dev * 2,
- (unsigned int) track->marker_size_dev * 2,
- 0, 360 * 64);
+ (int) (track->dev.x - (ZnPos) track->marker_size_dev),
+ (int) (track->dev.y - (ZnPos) track->marker_size_dev),
+ (unsigned int) track->marker_size_dev * 2,
+ (unsigned int) track->marker_size_dev * 2,
+ 0, 360 * 64);
}
else {
values.fill_style = FillSolid;
XChangeGC(wi->dpy, wi->gc, GCFillStyle | GCLineWidth | GCForeground, &values);
XDrawArc(wi->dpy, wi->draw_buffer, wi->gc,
- (int) (track->dev.x - (ZnPos) track->marker_size_dev),
- (int) (track->dev.y - (ZnPos) track->marker_size_dev),
- (unsigned int) (track->marker_size_dev * 2),
- (unsigned int) (track->marker_size_dev * 2),
- 0, 360 * 64);
+ (int) (track->dev.x - (ZnPos) track->marker_size_dev),
+ (int) (track->dev.y - (ZnPos) track->marker_size_dev),
+ (unsigned int) (track->marker_size_dev * 2),
+ (unsigned int) (track->marker_size_dev * 2),
+ 0, 360 * 64);
}
}
@@ -1148,13 +1148,13 @@ Draw(ZnItem item)
*/
c_item = item->connected_item;
if ((c_item != ZN_NO_ITEM) && (track->connection_width > 0)) {
- ZnPoint pts[2];
+ ZnPoint pts[2];
pts[0] = track->dev;
pts[1] = ((TrackItem) item->connected_item)->dev;
ZnDrawLineShape(wi, pts, 2, track->connection_style,
- ZnGetGradientPixel(track->connection_color, 0.0),
- track->connection_width, ZN_LINE_STRAIGHT);
+ ZnGetGradientPixel(track->connection_color, 0.0),
+ track->connection_width, ZN_LINE_STRAIGHT);
}
/*
@@ -1166,19 +1166,19 @@ Draw(ZnItem item)
values.line_style = LineSolid;
values.fill_style = FillSolid;
XChangeGC(wi->dpy, wi->gc,
- GCForeground | GCLineWidth | GCLineStyle | GCFillStyle, &values);
+ GCForeground | GCLineWidth | GCLineStyle | GCFillStyle, &values);
XDrawLine(wi->dpy, wi->draw_buffer, wi->gc,
- (int) track->dev.x,
- (int) track->dev.y,
- (int) track->speed_vector_dev.x,
- (int) track->speed_vector_dev.y);
+ (int) track->dev.x,
+ (int) track->dev.y,
+ (int) track->speed_vector_dev.x,
+ (int) track->speed_vector_dev.y);
}
/*
* Draw the leader.
*/
if (track->field_set.label_format && (track->leader_width > 0)) {
- ZnPoint end_points[ZN_LINE_END_POINTS];
+ ZnPoint end_points[ZN_LINE_END_POINTS];
XPoint xpoints[ZN_LINE_END_POINTS];
ZnPoint *points;
unsigned int num_points;
@@ -1186,27 +1186,27 @@ Draw(ZnItem item)
points = (ZnPoint *) ZnListArray(track->leader_points);
num_points = ZnListSize(track->leader_points);
ZnDrawLineShape(wi, points, num_points, track->leader_style,
- ZnGetGradientPixel(track->leader_color, 0.0),
- track->leader_width, track->leader_shape);
+ ZnGetGradientPixel(track->leader_color, 0.0),
+ track->leader_width, track->leader_shape);
if (track->leader_first_end != NULL) {
ZnGetLineEnd(&points[0], &points[1], track->leader_width,
- CapRound, track->leader_first_end, end_points);
+ CapRound, track->leader_first_end, end_points);
for (i = 0; i < ZN_LINE_END_POINTS; i++) {
- xpoints[i].x = (short) end_points[i].x;
- xpoints[i].y = (short) end_points[i].y;
+ xpoints[i].x = (short) end_points[i].x;
+ xpoints[i].y = (short) end_points[i].y;
}
XFillPolygon(wi->dpy, wi->draw_buffer, wi->gc, xpoints, ZN_LINE_END_POINTS,
- Nonconvex, CoordModeOrigin);
+ Nonconvex, CoordModeOrigin);
}
if (track->leader_last_end != NULL) {
ZnGetLineEnd(&points[num_points-1], &points[num_points-2], track->leader_width,
- CapRound, track->leader_last_end, end_points);
+ CapRound, track->leader_last_end, end_points);
for (i = 0; i < ZN_LINE_END_POINTS; i++) {
- xpoints[i].x = (short) end_points[i].x;
- xpoints[i].y = (short) end_points[i].y;
+ xpoints[i].x = (short) end_points[i].x;
+ xpoints[i].y = (short) end_points[i].y;
}
XFillPolygon(wi->dpy, wi->draw_buffer, wi->gc, xpoints, ZN_LINE_END_POINTS,
- Nonconvex, CoordModeOrigin);
+ Nonconvex, CoordModeOrigin);
}
}
@@ -1221,7 +1221,7 @@ Draw(ZnItem item)
unsigned int visible_history_size;
visible_history_size = (ISSET(track->flags, HISTORY_VISIBLE_BIT) ?
- wi->track_visible_history_size : 0);
+ wi->track_visible_history_size : 0);
values.foreground = ZnGetGradientPixel(track->history_color, 0.0);
values.fill_style = FillSolid;
@@ -1237,44 +1237,44 @@ Draw(ZnItem item)
for (i = 0, nb_hist = 0; i < num_acc_pos; i++) {
if (ISSET(track->flags, LAST_AS_FIRST_BIT) &&
- (i == visible_history_size-1)) {
- values.foreground = ZnGetGradientPixel(track->symbol_color, 0.0);
- XChangeGC(wi->dpy, wi->gc, GCForeground, &values);
+ (i == visible_history_size-1)) {
+ values.foreground = ZnGetGradientPixel(track->symbol_color, 0.0);
+ XChangeGC(wi->dpy, wi->gc, GCForeground, &values);
}
side_size--;
side_size = MAX(1, side_size);
h_side_size = (side_size+1)/2;
if (hist[i].visible) {
- if (ISSET(track->flags, DOT_MIXED_HISTORY_BIT) && !(nb_hist++ % 2)) {
- x = (int) hist[i].dev.x;
- y = (int) hist[i].dev.y;
- /* Draw a point (portability layer doesn't define a XDrawPoint) */
- XDrawLine(wi->dpy, wi->draw_buffer, wi->gc, x, y, x, y);
- }
- else {
- x = ((int) hist[i].dev.x) - h_side_size;
- y = ((int) hist[i].dev.y) - h_side_size;
- if (ISSET(track->flags, CIRCLE_HISTORY_BIT)) {
- if (ISSET(track->flags, FILLED_HISTORY_BIT)) {
- XFillArc(wi->dpy, wi->draw_buffer, wi->gc,
- x, y, side_size, side_size, 0, 360*64);
- }
- else {
- XDrawArc(wi->dpy, wi->draw_buffer, wi->gc,
- x, y, side_size - 1, side_size - 1, 0, 360*64);
- }
- }
- else {
- if (ISSET(track->flags, FILLED_HISTORY_BIT)) {
- XFillRectangle(wi->dpy, wi->draw_buffer, wi->gc,
- x, y, side_size, side_size);
- }
- else {
- XDrawRectangle(wi->dpy, wi->draw_buffer, wi->gc,
- x, y, side_size - 1, side_size - 1);
- }
- }
- }
+ if (ISSET(track->flags, DOT_MIXED_HISTORY_BIT) && !(nb_hist++ % 2)) {
+ x = (int) hist[i].dev.x;
+ y = (int) hist[i].dev.y;
+ /* Draw a point (portability layer doesn't define a XDrawPoint) */
+ XDrawLine(wi->dpy, wi->draw_buffer, wi->gc, x, y, x, y);
+ }
+ else {
+ x = ((int) hist[i].dev.x) - h_side_size;
+ y = ((int) hist[i].dev.y) - h_side_size;
+ if (ISSET(track->flags, CIRCLE_HISTORY_BIT)) {
+ if (ISSET(track->flags, FILLED_HISTORY_BIT)) {
+ XFillArc(wi->dpy, wi->draw_buffer, wi->gc,
+ x, y, side_size, side_size, 0, 360*64);
+ }
+ else {
+ XDrawArc(wi->dpy, wi->draw_buffer, wi->gc,
+ x, y, side_size - 1, side_size - 1, 0, 360*64);
+ }
+ }
+ else {
+ if (ISSET(track->flags, FILLED_HISTORY_BIT)) {
+ XFillRectangle(wi->dpy, wi->draw_buffer, wi->gc,
+ x, y, side_size, side_size);
+ }
+ else {
+ XDrawRectangle(wi->dpy, wi->draw_buffer, wi->gc,
+ x, y, side_size - 1, side_size - 1);
+ }
+ }
+ }
}
}
}
@@ -1291,8 +1291,8 @@ Draw(ZnItem item)
values.ts_x_origin = x;
values.ts_y_origin = y;
XChangeGC(wi->dpy, wi->gc,
- GCForeground|GCFillStyle|GCStipple|GCTileStipXOrigin|GCTileStipYOrigin,
- &values);
+ GCForeground|GCFillStyle|GCStipple|GCTileStipXOrigin|GCTileStipYOrigin,
+ &values);
XFillRectangle(wi->dpy, wi->draw_buffer, wi->gc, x, y, width, height);
}
@@ -1313,7 +1313,7 @@ Draw(ZnItem item)
#ifdef GL
struct MarkerCBData {
ZnPoint *p;
- int num;
+ int num;
ZnReal size;
ZnPoint center;
};
@@ -1322,31 +1322,31 @@ static void
MarkerRenderCB(void *closure)
{
struct MarkerCBData *cbd = (struct MarkerCBData *) closure;
- int i;
+ int i;
glBegin(GL_TRIANGLE_FAN);
glVertex2d(cbd->center.x, cbd->center.y);
for (i = 0; i < cbd->num; i++) {
glVertex2d(cbd->center.x + cbd->p[i].x*cbd->size,
- cbd->center.y + cbd->p[i].y*cbd->size);
+ cbd->center.y + cbd->p[i].y*cbd->size);
}
glEnd();
}
static void
-Render(ZnItem item)
+Render(ZnItem item)
{
- ZnWInfo *wi = item->wi;
- TrackItem track = (TrackItem) item;
- TrackItem c_item;
- History hist;
- unsigned int h_side_size, side_size, width=0, height=0;
- unsigned int i, j, nb_hist, num_acc_pos;
+ ZnWInfo *wi = item->wi;
+ TrackItem track = (TrackItem) item;
+ TrackItem c_item;
+ History hist;
+ unsigned int h_side_size, side_size, width=0, height=0;
+ unsigned int i, j, nb_hist, num_acc_pos;
unsigned short alpha;
- XColor *color;
- ZnPoint *points;
- unsigned int num_points;
- ZnReal x0, y0, size;
+ XColor *color;
+ ZnPoint *points;
+ unsigned int num_points;
+ ZnReal x0, y0, size;
/* Draw the marker */
if (track->marker_size_dev != 0) {
@@ -1355,7 +1355,7 @@ Render(ZnItem item)
y0 = track->dev.y;
size = track->marker_size_dev;
if (ISSET(track->flags, MARKER_FILLED_BIT)) {
- ZnBBox bbox;
+ ZnBBox bbox;
struct MarkerCBData cbd;
cbd.center.x = x0;
@@ -1365,17 +1365,17 @@ Render(ZnItem item)
cbd.p = points;
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
if (track->marker_fill_pattern != ZnUnspecifiedImage) { /* Fill stippled */
- ZnResetBBox(&bbox);
- ZnAddPointToBBox(&bbox, track->dev.x-size, track->dev.y-size);
- ZnAddPointToBBox(&bbox, track->dev.x+size, track->dev.y+size);
- ZnRenderTile(wi, track->marker_fill_pattern, track->marker_color,
- MarkerRenderCB, &cbd, (ZnPoint *) &bbox);
+ ZnResetBBox(&bbox);
+ ZnAddPointToBBox(&bbox, track->dev.x-size, track->dev.y-size);
+ ZnAddPointToBBox(&bbox, track->dev.x+size, track->dev.y+size);
+ ZnRenderTile(wi, track->marker_fill_pattern, track->marker_color,
+ MarkerRenderCB, &cbd, (ZnPoint *) &bbox);
}
else {
- color = ZnGetGradientColor(track->marker_color, 0.0, &alpha);
- alpha = ZnComposeAlpha(alpha, wi->alpha);
- glColor4us(color->red, color->green, color->blue, alpha);
- MarkerRenderCB(&cbd);
+ color = ZnGetGradientColor(track->marker_color, 0.0, &alpha);
+ alpha = ZnComposeAlpha(alpha, wi->alpha);
+ glColor4us(color->red, color->green, color->blue, alpha);
+ MarkerRenderCB(&cbd);
}
}
else {
@@ -1383,7 +1383,7 @@ Render(ZnItem item)
ZnSetLineStyle(wi, track->marker_style);
glBegin(GL_LINE_LOOP);
for (i = 0; i < num_points; i++) {
- glVertex2d(x0 + points[i].x*size, y0 + points[i].y*size);
+ glVertex2d(x0 + points[i].x*size, y0 + points[i].y*size);
}
glEnd();
}
@@ -1409,8 +1409,8 @@ Render(ZnItem item)
*/
if ((item->class == ZnTrack) && (track->speed_vector_width > 0)) {
unsigned int num_clips=0, svlength=0;
- ZnReal svxstep=0, svystep=0;
- GLfloat ticksize=0;
+ ZnReal svxstep=0, svystep=0;
+ GLfloat ticksize=0;
color = ZnGetGradientColor(track->speed_vector_color, 0.0, &alpha);
alpha = ZnComposeAlpha(alpha, wi->alpha);
@@ -1421,23 +1421,23 @@ Render(ZnItem item)
* Turn off AA to obtain a square point precisely defined
*/
if (ISSET(track->flags, SV_TICKS_BIT) ||
- ISSET(track->flags, SV_MARK_BIT)) {
+ ISSET(track->flags, SV_MARK_BIT)) {
glDisable(GL_POINT_SMOOTH);
if (ISSET(track->flags, SV_TICKS_BIT)) {
- num_clips = ZnListSize(wi->clip_stack);
- ticksize = 3;
- svlength = (int) wi->speed_vector_length;
- svxstep = (track->speed_vector_dev.x-track->dev.x)/svlength;
- svystep = (track->speed_vector_dev.y-track->dev.y)/svlength;
- glPointSize(ticksize);
- ZnGlStartClip(num_clips, False);
- glBegin(GL_POINTS);
- for (i = 1; i < svlength; i++) {
- glVertex2d(track->dev.x + i*svxstep, track->dev.y + i*svystep);
- }
- glEnd();
- ZnGlRenderClipped();
+ num_clips = ZnListSize(wi->clip_stack);
+ ticksize = 3;
+ svlength = (int) wi->speed_vector_length;
+ svxstep = (track->speed_vector_dev.x-track->dev.x)/svlength;
+ svystep = (track->speed_vector_dev.y-track->dev.y)/svlength;
+ glPointSize(ticksize);
+ ZnGlStartClip(num_clips, False);
+ glBegin(GL_POINTS);
+ for (i = 1; i < svlength; i++) {
+ glVertex2d(track->dev.x + i*svxstep, track->dev.y + i*svystep);
+ }
+ glEnd();
+ ZnGlRenderClipped();
}
}
@@ -1454,18 +1454,18 @@ Render(ZnItem item)
}
if (ISSET(track->flags, SV_TICKS_BIT) ||
- ISSET(track->flags, SV_MARK_BIT)) {
+ ISSET(track->flags, SV_MARK_BIT)) {
glEnable(GL_POINT_SMOOTH);
if (ISSET(track->flags, SV_TICKS_BIT)) {
- glPointSize(ticksize);
- ZnGlRestoreStencil(num_clips, False);
- glBegin(GL_POINTS);
- for (i = 1; i < svlength; i++) {
- glVertex2d(track->dev.x + i*svxstep, track->dev.y + i*svystep);
- }
- glEnd();
- ZnGlEndClip(num_clips);
+ glPointSize(ticksize);
+ ZnGlRestoreStencil(num_clips, False);
+ glBegin(GL_POINTS);
+ for (i = 1; i < svlength; i++) {
+ glVertex2d(track->dev.x + i*svxstep, track->dev.y + i*svystep);
+ }
+ glEnd();
+ ZnGlEndClip(num_clips);
}
}
}
@@ -1477,10 +1477,10 @@ Render(ZnItem item)
points = ZnListArray(track->leader_points);
num_points = ZnListSize(track->leader_points);
ZnRenderPolyline(wi,
- points, num_points, track->leader_width,
- track->leader_style, CapRound, JoinRound,
- track->leader_first_end, track->leader_last_end,
- track->leader_color);
+ points, num_points, track->leader_width,
+ track->leader_style, CapRound, JoinRound,
+ track->leader_first_end, track->leader_last_end,
+ track->leader_color);
}
if (track->symbol != ZnUnspecifiedImage) {
@@ -1494,7 +1494,7 @@ Render(ZnItem item)
unsigned int visible_history_size;
visible_history_size = (ISSET(track->flags, HISTORY_VISIBLE_BIT) ?
- wi->track_visible_history_size : 0);
+ wi->track_visible_history_size : 0);
points = ZnGetCirclePoints(3, ZN_CIRCLE_COARSE, 0.0, 2*M_PI, &num_points, NULL);
color = ZnGetGradientColor(track->history_color, 0.0, &alpha);
@@ -1513,64 +1513,64 @@ Render(ZnItem item)
glDisable(GL_POINT_SMOOTH);
for (i = 0, nb_hist = 0; i < num_acc_pos; i++) {
if (ISSET(track->flags, LAST_AS_FIRST_BIT) &&
- (i == visible_history_size-1)) {
- color = ZnGetGradientColor(track->symbol_color, 0.0, &alpha);
- alpha = ZnComposeAlpha(alpha, wi->alpha);
- glColor4us(color->red, color->green, color->blue, alpha);
+ (i == visible_history_size-1)) {
+ color = ZnGetGradientColor(track->symbol_color, 0.0, &alpha);
+ alpha = ZnComposeAlpha(alpha, wi->alpha);
+ glColor4us(color->red, color->green, color->blue, alpha);
}
side_size--;
side_size = MAX(1, side_size);
h_side_size = (side_size+1)/2;
if (hist[i].visible) {
- x0 = hist[i].dev.x;
- y0 = hist[i].dev.y;
- if ((ISSET(track->flags, DOT_MIXED_HISTORY_BIT) && !(nb_hist++ % 2)) ||
- (side_size == 1)) {
- glPointSize(1.0);
- glBegin(GL_POINTS);
- glVertex2d(x0, y0);
- glEnd();
- }
- else {
- if (ISSET(track->flags, CIRCLE_HISTORY_BIT)) {
- if (ISSET(track->flags, FILLED_HISTORY_BIT)) {
- glPointSize((GLfloat) side_size);
- glBegin(GL_POINTS);
- glVertex2d(x0, y0);
- glEnd();
- }
- else {
+ x0 = hist[i].dev.x;
+ y0 = hist[i].dev.y;
+ if ((ISSET(track->flags, DOT_MIXED_HISTORY_BIT) && !(nb_hist++ % 2)) ||
+ (side_size == 1)) {
+ glPointSize(1.0);
+ glBegin(GL_POINTS);
+ glVertex2d(x0, y0);
+ glEnd();
+ }
+ else {
+ if (ISSET(track->flags, CIRCLE_HISTORY_BIT)) {
+ if (ISSET(track->flags, FILLED_HISTORY_BIT)) {
+ glPointSize((GLfloat) side_size);
+ glBegin(GL_POINTS);
+ glVertex2d(x0, y0);
+ glEnd();
+ }
+ else {
#if 1
- glBegin(GL_LINE_LOOP);
- for (j = 0; j < num_points; j++) {
- glVertex2d(x0 + points[j].x*h_side_size,
- y0 + points[j].y*h_side_size);
- }
- glEnd();
+ glBegin(GL_LINE_LOOP);
+ for (j = 0; j < num_points; j++) {
+ glVertex2d(x0 + points[j].x*h_side_size,
+ y0 + points[j].y*h_side_size);
+ }
+ glEnd();
#else
- RenderHollowDot(wi, &hist[i].dev, side_size+1);
+ RenderHollowDot(wi, &hist[i].dev, side_size+1);
#endif
- }
- }
- else {
- if (ISSET(track->flags, FILLED_HISTORY_BIT)) {
- glBegin(GL_QUADS);
- glVertex2d(x0 - h_side_size, y0 - h_side_size);
- glVertex2d(x0 - h_side_size, y0 + h_side_size);
- glVertex2d(x0 + h_side_size, y0 + h_side_size);
- glVertex2d(x0 + h_side_size, y0 - h_side_size);
- glEnd();
- }
- else {
- glBegin(GL_LINE_LOOP);
- glVertex2d(x0 - h_side_size, y0 - h_side_size);
- glVertex2d(x0 - h_side_size, y0 + h_side_size);
- glVertex2d(x0 + h_side_size, y0 + h_side_size);
- glVertex2d(x0 + h_side_size, y0 - h_side_size);
- glEnd();
- }
- }
- }
+ }
+ }
+ else {
+ if (ISSET(track->flags, FILLED_HISTORY_BIT)) {
+ glBegin(GL_QUADS);
+ glVertex2d(x0 - h_side_size, y0 - h_side_size);
+ glVertex2d(x0 - h_side_size, y0 + h_side_size);
+ glVertex2d(x0 + h_side_size, y0 + h_side_size);
+ glVertex2d(x0 + h_side_size, y0 - h_side_size);
+ glEnd();
+ }
+ else {
+ glBegin(GL_LINE_LOOP);
+ glVertex2d(x0 - h_side_size, y0 - h_side_size);
+ glVertex2d(x0 - h_side_size, y0 + h_side_size);
+ glVertex2d(x0 + h_side_size, y0 + h_side_size);
+ glVertex2d(x0 + h_side_size, y0 - h_side_size);
+ glEnd();
+ }
+ }
+ }
}
}
glEnable(GL_LINE_SMOOTH);
@@ -1595,7 +1595,7 @@ Render(ZnItem item)
}
#else
static void
-Render(ZnItem item)
+Render(ZnItem item)
{
}
#endif
@@ -1609,8 +1609,8 @@ Render(ZnItem item)
**********************************************************************************
*/
static ZnBool
-IsSensitive(ZnItem item,
- int item_part)
+IsSensitive(ZnItem item,
+ int item_part)
{
if (ISCLEAR(item->flags, ZN_SENSITIVE_BIT) ||
!item->parent->class->IsSensitive(item->parent, ZN_NO_PART)) {
@@ -1638,20 +1638,20 @@ IsSensitive(ZnItem item,
**********************************************************************************
*/
static double
-Pick(ZnItem item,
- ZnPick ps)
+Pick(ZnItem item,
+ ZnPick ps)
{
- TrackItem track = (TrackItem) item;
- ZnItem c_item;
- ZnBBox bbox;
- double dist=0, new_dist;
- ZnPoint *points, *p = ps->point;
- int num_points, i;
- int width=0, height=0;
- double width_2;
- int best_part;
- ZnPoint pts[2];
-
+ TrackItem track = (TrackItem) item;
+ ZnItem c_item;
+ ZnBBox bbox;
+ double dist=0, new_dist;
+ ZnPoint *points, *p = ps->point;
+ int num_points, i;
+ int width=0, height=0;
+ double width_2;
+ int best_part;
+ ZnPoint pts[2];
+
/*
* Try one of the fields.
*/
@@ -1695,35 +1695,35 @@ Pick(ZnItem item,
new_dist = ZnLineToPointDist(&points[i], &points[i+1], p, NULL);
new_dist -= width_2;
if (new_dist < dist) {
- best_part = LEADER;
- dist = new_dist;
+ best_part = LEADER;
+ dist = new_dist;
}
if (dist <= 0.0) {
- goto report0;
+ goto report0;
}
}
if (track->leader_first_end != NULL) {
ZnGetLineEnd(&points[0], &points[1], track->leader_width,
- CapRound, track->leader_first_end, end_points);
+ CapRound, track->leader_first_end, end_points);
new_dist = ZnPolygonToPointDist(end_points, ZN_LINE_END_POINTS, p);
if (new_dist < dist) {
- best_part = LEADER;
- dist = new_dist;
+ best_part = LEADER;
+ dist = new_dist;
}
if (dist <= 0.0) {
- goto report0;
+ goto report0;
}
}
if (track->leader_last_end != NULL) {
ZnGetLineEnd(&points[num_points-1], &points[num_points-2], track->leader_width,
- CapRound, track->leader_last_end, end_points);
+ CapRound, track->leader_last_end, end_points);
new_dist = ZnPolygonToPointDist(end_points, ZN_LINE_END_POINTS, p);
if (new_dist < dist) {
- best_part = LEADER;
- dist = new_dist;
+ best_part = LEADER;
+ dist = new_dist;
}
if (dist <= 0.0) {
- goto report0;
+ goto report0;
}
}
}
@@ -1735,7 +1735,7 @@ Pick(ZnItem item,
pts[0] = track->dev;
pts[1] = track->speed_vector_dev;
new_dist = ZnPolylineToPointDist(pts, 2, track->speed_vector_width,
- CapRound, JoinRound, p);
+ CapRound, JoinRound, p);
if (new_dist < dist) {
best_part = SPEED_VECTOR;
dist = new_dist;
@@ -1753,7 +1753,7 @@ Pick(ZnItem item,
pts[0] = track->dev;
pts[1] = ((TrackItem) item->connected_item)->dev;
new_dist = ZnPolylineToPointDist(pts, 2, track->connection_width,
- CapRound, JoinRound, p);
+ CapRound, JoinRound, p);
if (new_dist < dist) {
dist = new_dist;
best_part = CONNECTION;
@@ -1779,8 +1779,8 @@ Pick(ZnItem item,
**********************************************************************************
*/
static void
-PostScript(ZnItem item,
- ZnBool prepass)
+PostScript(ZnItem item,
+ ZnBool prepass)
{
}
@@ -1802,28 +1802,28 @@ PostScript(ZnItem item,
* dealing with tracks.
*/
void *
-ZnSendTrackToOm(void *ptr,
- void *item,
- int *x,
- int *y,
- int *sv_dx,
- int *sv_dy,
- /*int *label_x,
- int *label_y,
- int *label_width,
- int *label_height,*/
- int *rho,
- int *theta,
- int *visibility,
- int *locked,
- int *preferred_angle,
- int *convergence_style)
+ZnSendTrackToOm(void *ptr,
+ void *item,
+ int *x,
+ int *y,
+ int *sv_dx,
+ int *sv_dy,
+ /*int *label_x,
+ int *label_y,
+ int *label_width,
+ int *label_height,*/
+ int *rho,
+ int *theta,
+ int *visibility,
+ int *locked,
+ int *preferred_angle,
+ int *convergence_style)
{
- ZnWInfo *wi = (ZnWInfo *) ptr;
- ZnItem current_item = (ZnItem) item;
- TrackItem track;
- ZnBBox zn_bbox, bbox;
- ZnBool to_be_sent;
+ ZnWInfo *wi = (ZnWInfo *) ptr;
+ ZnItem current_item = (ZnItem) item;
+ TrackItem track;
+ ZnBBox zn_bbox, bbox;
+ ZnBool to_be_sent;
int rho_derived ;
@@ -1866,7 +1866,7 @@ ZnSendTrackToOm(void *ptr,
*label_x = track->field_set.label_pos.x;
*label_y = wi->height - track->field_set.label_pos.y;
if (track->field_set.label_format) {
- ZnDim bb_width, bb_height;
+ ZnDim bb_width, bb_height;
ZnFIELD.GetLabelBBox(&track->field_set, &bb_width, &bb_height);
*label_width = bb_width;
@@ -1883,15 +1883,15 @@ ZnSendTrackToOm(void *ptr,
* roundoff error.
*/
rho_derived = (int) sqrt(track->label_dx*track->label_dx +
- track->label_dy*track->label_dy);
+ track->label_dy*track->label_dy);
#ifdef DP
if (ABS(rho_derived - track->label_distance) < LABEL_DISTANCE_THRESHOLD) {
- /* The error is narrow so value discarded */
- *rho = track->label_distance ;
+ /* The error is narrow so value discarded */
+ *rho = track->label_distance ;
}
else {
- /* Means a user change has been performed on label_dx label_dy */
- *rho = rho_derived ;
+ /* Means a user change has been performed on label_dx label_dy */
+ *rho = rho_derived ;
}
#else
*rho = rho_derived;
@@ -1919,12 +1919,12 @@ ZnSendTrackToOm(void *ptr,
**********************************************************************************
*/
void
-ZnSetLabelAngleFromOm(void *ptr, /* No longer in use. */
- void *item,
- int rho,
- int theta)
+ZnSetLabelAngleFromOm(void *ptr, /* No longer in use. */
+ void *item,
+ int rho,
+ int theta)
{
- TrackItem track = (TrackItem) item;
+ TrackItem track = (TrackItem) item;
theta %= 360;
if (theta < 0) {
@@ -1946,27 +1946,27 @@ ZnSetLabelAngleFromOm(void *ptr, /* No longer in use. */
**********************************************************************************
*
* ZnQueryLabelPosition -- OverlapMan query the widget about what would be the
-* label position if label_angle is theta
+* label position if label_angle is theta
*
**********************************************************************************
*/
void
-ZnQueryLabelPosition(void *ptr, /* No longer in use. */
- void *item,
- int theta,
- int *x,
- int *y,
- int *w,
- int *h)
+ZnQueryLabelPosition(void *ptr, /* No longer in use. */
+ void *item,
+ int theta,
+ int *x,
+ int *y,
+ int *w,
+ int *h)
{
- ZnItem it = (ZnItem) item;
- ZnWInfo *wi = it->wi;
- TrackItem track = (TrackItem) it;
+ ZnItem it = (ZnItem) item;
+ ZnWInfo *wi = it->wi;
+ TrackItem track = (TrackItem) it;
if (track->field_set.label_format) {
- ZnDim bb_width, bb_height;
- ZnDim delta_x, delta_y;
- ZnReal heading;
+ ZnDim bb_width, bb_height;
+ ZnDim delta_x, delta_y;
+ ZnReal heading;
/*
* !! BUG !! This doesn't work if the current transform has some rotation.
@@ -1999,9 +1999,9 @@ ZnQueryLabelPosition(void *ptr, /* No longer in use. */
**********************************************************************************
*/
void
-ZnSetHistoryVisibility(ZnItem item,
- int index,
- ZnBool visible)
+ZnSetHistoryVisibility(ZnItem item,
+ int index,
+ ZnBool visible)
{
}
@@ -2014,9 +2014,9 @@ ZnSetHistoryVisibility(ZnItem item,
**********************************************************************************
*/
void
-ZnTruncHistory(ZnItem item)
+ZnTruncHistory(ZnItem item)
{
- TrackItem track = (TrackItem) item;
+ TrackItem track = (TrackItem) item;
if (track->history) {
int size = ZnListSize (track->history);
@@ -2037,7 +2037,7 @@ ZnTruncHistory(ZnItem item)
**********************************************************************************
*/
static ZnFieldSet
-GetFieldSet(ZnItem item)
+GetFieldSet(ZnItem item)
{
return &((TrackItem) item)->field_set;
}
@@ -2051,12 +2051,12 @@ GetFieldSet(ZnItem item)
**********************************************************************************
*/
static void
-GetAnchor(ZnItem item,
- Tk_Anchor anchor,
- ZnPoint *p)
+GetAnchor(ZnItem item,
+ Tk_Anchor anchor,
+ ZnPoint *p)
{
- ZnFieldSet field_set = &((TrackItem) item)->field_set;
- ZnDim width, height;
+ ZnFieldSet field_set = &((TrackItem) item)->field_set;
+ ZnDim width, height;
if (field_set->label_format) {
ZnFIELD.GetLabelBBox(field_set, &width, &height);
@@ -2072,31 +2072,31 @@ GetAnchor(ZnItem item,
**********************************************************************************
*
* Coords --
-* Return or edit the item position.
+* Return or edit the item position.
*
**********************************************************************************
*/
static int
-Coords(ZnItem item,
- int contour,
- int index,
- int cmd,
- ZnPoint **pts,
- char **controls,
- unsigned int *num_pts)
+Coords(ZnItem item,
+ int contour,
+ int index,
+ int cmd,
+ ZnPoint **pts,
+ char **controls,
+ unsigned int *num_pts)
{
- TrackItem track = (TrackItem) item;
+ TrackItem track = (TrackItem) item;
if ((cmd == ZN_COORDS_ADD) || (cmd == ZN_COORDS_ADD_LAST) || (cmd == ZN_COORDS_REMOVE)) {
Tcl_AppendResult(item->wi->interp, " ",
- item->class->name, "s can't add or remove vertices", NULL);
+ item->class->name, "s can't add or remove vertices", NULL);
return TCL_ERROR;
}
else if ((cmd == ZN_COORDS_REPLACE) || (cmd == ZN_COORDS_REPLACE_ALL)) {
if (*num_pts == 0) {
Tcl_AppendResult(item->wi->interp,
- " coords command need 1 point on ",
- item->class->name, "s", NULL);
+ " coords command need 1 point on ",
+ item->class->name, "s", NULL);
return TCL_ERROR;
}
if (item->class == ZnTrack) {
@@ -2117,18 +2117,18 @@ Coords(ZnItem item,
**********************************************************************************
*
* Part --
-* Convert a private part from/to symbolic representation.
+* Convert a private part from/to symbolic representation.
*
**********************************************************************************
*/
static int
-Part(ZnItem item,
- Tcl_Obj **part_spec,
- int *part)
+Part(ZnItem item,
+ Tcl_Obj **part_spec,
+ int *part)
{
- char *part_str="";
- int c;
- char *end;
+ char *part_str="";
+ int c;
+ char *end;
if (*part_spec) {
part_str = Tcl_GetString(*part_spec);
@@ -2138,31 +2138,31 @@ Part(ZnItem item,
else if (isdigit(part_str[0])) {
*part = strtol(part_str, &end, 0);
if ((*end != 0) || (*part < 0) ||
- ((unsigned int) *part >= ((TrackItem) item)->field_set.num_fields)) {
- goto part_error;
+ ((unsigned int) *part >= ((TrackItem) item)->field_set.num_fields)) {
+ goto part_error;
}
}
else {
c = part_str[0];
if ((c == 'c') && (strcmp(part_str, "connection") == 0)) {
- *part = CONNECTION;
+ *part = CONNECTION;
}
else if ((c == 'l') && (strcmp(part_str, "leader") == 0)) {
- *part = LEADER;
+ *part = LEADER;
}
else if ((c == 'p') && (strcmp(part_str, "position") == 0)) {
- *part = CURRENT_POSITION;
+ *part = CURRENT_POSITION;
}
else if ((c == 's') && (strcmp(part_str, "speedvector") == 0)) {
- if (item->class != ZnTrack) {
- goto part_error;
- }
- *part = SPEED_VECTOR;
+ if (item->class != ZnTrack) {
+ goto part_error;
+ }
+ *part = SPEED_VECTOR;
}
else {
part_error:
- Tcl_AppendResult(item->wi->interp, " invalid item part specification", NULL);
- return TCL_ERROR;
+ Tcl_AppendResult(item->wi->interp, " invalid item part specification", NULL);
+ return TCL_ERROR;
}
}
}
@@ -2175,24 +2175,24 @@ Part(ZnItem item,
switch (*part) {
default:
case ZN_NO_PART:
- break;
+ break;
case CURRENT_POSITION:
- part_str = "position";
- break;
+ part_str = "position";
+ break;
case LEADER:
- part_str = "leader";
- break;
+ part_str = "leader";
+ break;
case CONNECTION:
- part_str = "connection";
- break;
+ part_str = "connection";
+ break;
case SPEED_VECTOR:
- if (item->class == ZnTrack) {
- part_str = "speedvector";
- break;
- }
+ if (item->class == ZnTrack) {
+ part_str = "speedvector";
+ break;
+ }
}
if (part_str[0]) {
- *part_spec = Tcl_NewStringObj(part_str, -1);
+ *part_spec = Tcl_NewStringObj(part_str, -1);
}
}
}
@@ -2204,19 +2204,19 @@ Part(ZnItem item,
**********************************************************************************
*
* Index --
-* Parse a text index and return its value and aa
-* error status (standard Tcl result).
+* Parse a text index and return its value and aa
+* error status (standard Tcl result).
*
**********************************************************************************
*/
static int
-Index(ZnItem item,
- int field,
- Tcl_Obj *index_spec,
- int *index)
+Index(ZnItem item,
+ int field,
+ Tcl_Obj *index_spec,
+ int *index)
{
return ZnFIELD.FieldIndex(&((TrackItem) item)->field_set, field,
- index_spec, index);
+ index_spec, index);
}
@@ -2228,13 +2228,13 @@ Index(ZnItem item,
**********************************************************************************
*/
static void
-InsertChars(ZnItem item,
- int field,
- int *index,
- char *chars)
+InsertChars(ZnItem item,
+ int field,
+ int *index,
+ char *chars)
{
if (ZnFIELD.FieldInsertChars(&((TrackItem) item)->field_set,
- field, index, chars)) {
+ field, index, chars)) {
ZnITEM.Invalidate(item, ZN_COORDS_FLAG);
}
}
@@ -2248,13 +2248,13 @@ InsertChars(ZnItem item,
**********************************************************************************
*/
static void
-DeleteChars(ZnItem item,
- int field,
- int *first,
- int *last)
+DeleteChars(ZnItem item,
+ int field,
+ int *first,
+ int *last)
{
if (ZnFIELD.FieldDeleteChars(&((TrackItem) item)->field_set,
- field, first, last)) {
+ field, first, last)) {
ZnITEM.Invalidate(item, ZN_COORDS_FLAG);
}
}
@@ -2268,9 +2268,9 @@ DeleteChars(ZnItem item,
**********************************************************************************
*/
static void
-TrackCursor(ZnItem item,
- int field,
- int index)
+TrackCursor(ZnItem item,
+ int field,
+ int index)
{
ZnFIELD.FieldCursor(&((TrackItem) item)->field_set, field, index);
}
@@ -2284,14 +2284,14 @@ TrackCursor(ZnItem item,
**********************************************************************************
*/
static int
-Selection(ZnItem item,
- int field,
- int offset,
- char *chars,
- int max_chars)
+Selection(ZnItem item,
+ int field,
+ int offset,
+ char *chars,
+ int max_chars)
{
return ZnFIELD.FieldSelection(&((TrackItem) item)->field_set, field,
- offset, chars, max_chars);
+ offset, chars, max_chars);
}
@@ -2313,7 +2313,7 @@ static ZnItemClassStruct TRACK_ITEM_CLASS = {
"track",
sizeof(TrackItemStruct),
track_attrs,
- 4, /* num_parts */
+ 4, /* num_parts */
ZN_CLASS_HAS_ANCHORS|ZN_CLASS_ONE_COORD, /* flags */
-1,
Init,
@@ -2323,8 +2323,8 @@ static ZnItemClassStruct TRACK_ITEM_CLASS = {
Query,
GetFieldSet,
GetAnchor,
- NULL, /* GetClipVertices */
- NULL, /* GetContours */
+ NULL, /* GetClipVertices */
+ NULL, /* GetContours */
Coords,
InsertChars,
DeleteChars,
@@ -2332,14 +2332,14 @@ static ZnItemClassStruct TRACK_ITEM_CLASS = {
Index,
Part,
Selection,
- NULL, /* Contour */
+ NULL, /* Contour */
ComputeCoordinates,
ToArea,
Draw,
Render,
IsSensitive,
Pick,
- NULL, /* PickVertex */
+ NULL, /* PickVertex */
PostScript
};
@@ -2347,7 +2347,7 @@ static ZnItemClassStruct WAY_POINT_ITEM_CLASS = {
"waypoint",
sizeof(TrackItemStruct),
wp_attrs,
- 3, /* num_parts */
+ 3, /* num_parts */
ZN_CLASS_HAS_ANCHORS|ZN_CLASS_ONE_COORD, /* flags */
-1,
Init,
@@ -2357,8 +2357,8 @@ static ZnItemClassStruct WAY_POINT_ITEM_CLASS = {
Query,
GetFieldSet,
GetAnchor,
- NULL, /* GetClipVertices */
- NULL, /* GetContours */
+ NULL, /* GetClipVertices */
+ NULL, /* GetContours */
Coords,
InsertChars,
DeleteChars,
@@ -2366,14 +2366,14 @@ static ZnItemClassStruct WAY_POINT_ITEM_CLASS = {
Index,
Part,
Selection,
- NULL, /* Contour */
+ NULL, /* Contour */
ComputeCoordinates,
ToArea,
Draw,
Render,
IsSensitive,
Pick,
- NULL, /* PickVertex */
+ NULL, /* PickVertex */
PostScript
};
diff --git a/generic/Track.h b/generic/Track.h
index 36aa951..b0d2d5b 100644
--- a/generic/Track.h
+++ b/generic/Track.h
@@ -1,8 +1,8 @@
/*
* Track.h --
*
- * Authors : Patrick Lecoanet.
- * Creation date : Tue Jan 19 16:03:53 1999
+ * Authors : Patrick Lecoanet.
+ * Creation date : Tue Jan 19 16:03:53 1999
*
* $Id$
*/
@@ -43,15 +43,15 @@
*/
void *ZnSendTrackToOm(void *ptr, void *item, int *x, int *y,
- int *sv_dx, int *sv_dy,
- /* Fri Oct 13 15:18:11 2000
- int *label_x, int *label_y,
- int *label_width, int *label_height,*/
- int *rho, int *theta, int *visibility, int *locked,
- int *preferred_angle, int *convergence_style);
+ int *sv_dx, int *sv_dy,
+ /* Fri Oct 13 15:18:11 2000
+ int *label_x, int *label_y,
+ int *label_width, int *label_height,*/
+ int *rho, int *theta, int *visibility, int *locked,
+ int *preferred_angle, int *convergence_style);
void ZnSetLabelAngleFromOm(void *ptr, void *item, int rho, int theta);
void ZnQueryLabelPosition(void *ptr, void *item, int theta,
- int *x, int *y, int *w, int *h);
+ int *x, int *y, int *w, int *h);
void ZnSetHistoryVisibility(ZnItem item, int index, ZnBool visibility);
void ZnTruncHistory(ZnItem item);
diff --git a/generic/Transfo.c b/generic/Transfo.c
index 93fcf16..db52788 100644
--- a/generic/Transfo.c
+++ b/generic/Transfo.c
@@ -1,8 +1,8 @@
/*
* Transfo.c -- Implementation of transformation routines.
*
- * Authors : Patrick Lecoanet.
- * Creation date :
+ * Authors : Patrick Lecoanet.
+ * Creation date :
*
* $Id$
*/
@@ -61,9 +61,9 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ "
* The transformation primitives are based on affines matrices retricted
* to the following pattern:
*
- * x x 0
- * x x 0
- * x x 1
+ * x x 0
+ * x x 0
+ * x x 1
*
* It is necessary to feed only those matrices to the Transfo primitives
* as they do optimizations based on the properties of affine matrices.
@@ -78,15 +78,15 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ "
*************************************************************************
*
* ZnTransfoNew --
- * Create a new transformation and return it initialized to
- * identity.
+ * Create a new transformation and return it initialized to
+ * identity.
*
*************************************************************************
*/
ZnTransfo *
ZnTransfoNew()
{
- ZnTransfo *t;
+ ZnTransfo *t;
t = (ZnTransfo *) ZnMalloc(sizeof(ZnTransfo));
ZnTransfoSetIdentity(t);
@@ -99,14 +99,14 @@ ZnTransfoNew()
*************************************************************************
*
* ZnTransfoDuplicate --
- * Create a new transformation identical to the model t.
+ * Create a new transformation identical to the model t.
*
*************************************************************************
*/
ZnTransfo *
ZnTransfoDuplicate(ZnTransfo *t)
{
- ZnTransfo *nt;
+ ZnTransfo *nt;
nt = (ZnTransfo *) ZnMalloc(sizeof(ZnTransfo));
if (t) {
@@ -124,12 +124,12 @@ ZnTransfoDuplicate(ZnTransfo *t)
*************************************************************************
*
* ZnTransfoFree --
- * Delete a transformation and free its memory.
+ * Delete a transformation and free its memory.
*
*************************************************************************
*/
void
-ZnTransfoFree(ZnTransfo *t)
+ZnTransfoFree(ZnTransfo *t)
{
ZnFree(t);
}
@@ -139,27 +139,27 @@ ZnTransfoFree(ZnTransfo *t)
*************************************************************************
*
* ZnPrintTransfo --
- * Print the transfo matrix on stdout.
+ * Print the transfo matrix on stdout.
*
*************************************************************************
*/
void
-ZnPrintTransfo(ZnTransfo *t)
+ZnPrintTransfo(ZnTransfo *t)
{
/*
- * sx 0 cos(rot) sin(rot) 1 tan(skewy) 1 0
- * 0 sy -sin(rot) cos(rot) tan(skewx) 1 0 1
- * 0 0 0 0 0 0 tx ty
+ * sx 0 cos(rot) sin(rot) 1 tan(skewy) 1 0
+ * 0 sy -sin(rot) cos(rot) tan(skewx) 1 0 1
+ * 0 0 0 0 0 0 tx ty
*/
if (t) {
printf("(%5g %5g\n %5g %5g\n %5g %5g)\n",
- t->_[0][0], t->_[0][1],
- t->_[1][0], t->_[1][1],
- t->_[2][0], t->_[2][1]);
+ t->_[0][0], t->_[0][1],
+ t->_[1][0], t->_[1][1],
+ t->_[2][0], t->_[2][1]);
}
else {
printf("(%5g %5g\n %5g %5g\n %5g %5g)\n",
- 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
+ 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
}
}
@@ -168,15 +168,15 @@ ZnPrintTransfo(ZnTransfo *t)
*************************************************************************
*
* ZnTransfoIsIdentity --
- * Tell if the given transfo is (close to) identity.
+ * Tell if the given transfo is (close to) identity.
*
*************************************************************************
*/
ZnBool
-ZnTransfoIsIdentity(ZnTransfo *t)
+ZnTransfoIsIdentity(ZnTransfo *t)
{
- ZnReal tmp;
- ZnBool res = False;
+ ZnReal tmp;
+ ZnBool res = False;
tmp = t->_[0][0] - 1.0;
res = res & ((tmp < PRECISION_LIMIT) && (tmp > -PRECISION_LIMIT));
@@ -198,12 +198,12 @@ ZnTransfoIsIdentity(ZnTransfo *t)
*************************************************************************
*
* ZnTransfoSetIdentity --
- * Initialize the given transfo to identity.
+ * Initialize the given transfo to identity.
*
*************************************************************************
*/
void
-ZnTransfoSetIdentity(ZnTransfo *t)
+ZnTransfoSetIdentity(ZnTransfo *t)
{
t->_[0][0] = 1;
t->_[0][1] = 0;
@@ -218,22 +218,22 @@ ZnTransfoSetIdentity(ZnTransfo *t)
*************************************************************************
*
* ZnTransfoCompose --
- * Combine two transformations t1 and t2 by post-concatenation.
- * Returns the resulting transformation.
- * t2 can be NULL, meaning identity transform. This is used in
- * the toolkit to optimize some cases.
+ * Combine two transformations t1 and t2 by post-concatenation.
+ * Returns the resulting transformation.
+ * t2 can be NULL, meaning identity transform. This is used in
+ * the toolkit to optimize some cases.
*
- * All the parameters must be distincts transforms.
+ * All the parameters must be distincts transforms.
*
*************************************************************************
*/
ZnTransfo *
-ZnTransfoCompose(ZnTransfo *res,
- ZnTransfo *t1,
- ZnTransfo *t2)
+ZnTransfoCompose(ZnTransfo *res,
+ ZnTransfo *t1,
+ ZnTransfo *t2)
{
if ((t1 != NULL) && (t2 != NULL)) {
- register float tmp;
+ register float tmp;
tmp = t1->_[0][0];
res->_[0][0] = tmp*t2->_[0][0] + t1->_[0][1]*t2->_[1][0];
@@ -267,20 +267,20 @@ ZnTransfoCompose(ZnTransfo *res,
*************************************************************************
*
* ZnTransfoInvert --
- * Compute the inverse of the given matrix and return it. This
- * function makes the assumption that the matrix is affine to
- * optimize the job. Do not give it a general matrix, this will
- * fail. This code is from Graphics Gems II. Anyway an affine
- * matrix is always invertible for affine matrices form a sub
- * group of the non-singular matrices.
+ * Compute the inverse of the given matrix and return it. This
+ * function makes the assumption that the matrix is affine to
+ * optimize the job. Do not give it a general matrix, this will
+ * fail. This code is from Graphics Gems II. Anyway an affine
+ * matrix is always invertible for affine matrices form a sub
+ * group of the non-singular matrices.
*
*************************************************************************
*/
ZnTransfo *
-ZnTransfoInvert(ZnTransfo *t,
- ZnTransfo *inv)
+ZnTransfoInvert(ZnTransfo *t,
+ ZnTransfo *inv)
{
- float pos, neg, temp, det_l;
+ float pos, neg, temp, det_l;
if (t == NULL) {
ZnTransfoSetIdentity(inv);
@@ -337,24 +337,24 @@ ZnTransfoInvert(ZnTransfo *t,
*************************************************************************
*
* ZnTransfoDecompose --
- * Decompose an affine matrix into translation, scale, skew and
- * rotation. The different values are stored in the locations
- * pointed to by the pointer parameters. If some values are not
- * needed a NULL pointer can be given instead. The resulting skew
- * shews x coordinate when y change.
- * This code is taken from Graphics Gems II.
+ * Decompose an affine matrix into translation, scale, skew and
+ * rotation. The different values are stored in the locations
+ * pointed to by the pointer parameters. If some values are not
+ * needed a NULL pointer can be given instead. The resulting skew
+ * shews x coordinate when y change.
+ * This code is taken from Graphics Gems II.
*
*************************************************************************
*/
void
-ZnTransfoDecompose(ZnTransfo *t,
- ZnPoint *scale,
- ZnPoint *trans,
- ZnReal *rotation,
- ZnReal *skewxy)
+ZnTransfoDecompose(ZnTransfo *t,
+ ZnPoint *scale,
+ ZnPoint *trans,
+ ZnReal *rotation,
+ ZnReal *skewxy)
{
- ZnTransfo local;
- float skew, len, rot, det;
+ ZnTransfo local;
+ float skew, len, rot, det;
if (t == NULL) {
/* Identity transform */
@@ -395,14 +395,14 @@ ZnTransfoDecompose(ZnTransfo *t,
/* Get scale and skew */
len = (float) sqrt(local._[0][0]*local._[0][0] +
- local._[0][1]*local._[0][1]); /* Get x scale from 1st row */
+ local._[0][1]*local._[0][1]); /* Get x scale from 1st row */
if (scale) {
scale->x = len < PRECISION_LIMIT ? 0.0 : len;
}
- local._[0][0] /= len; /* Normalize 1st row */
+ local._[0][0] /= len; /* Normalize 1st row */
local._[0][1] /= len;
skew = (local._[0][0]*local._[1][0] +
- local._[0][1]*local._[1][1]); /* Skew is dot product of 1st row & 2nd row */
+ local._[0][1]*local._[1][1]); /* Skew is dot product of 1st row & 2nd row */
/* Make the 2nd row orthogonal to the 1st row
* by linear combinaison:
* row1.x = row1.x + row0.x*-skew &
@@ -411,7 +411,7 @@ ZnTransfoDecompose(ZnTransfo *t,
local._[1][0] -= local._[0][0]*skew;
local._[1][1] -= local._[0][1]*skew;
len = (float) sqrt(local._[1][0]*local._[1][0] +
- local._[1][1]*local._[1][1]); /* Get y scale from 2nd row */
+ local._[1][1]*local._[1][1]); /* Get y scale from 2nd row */
if (scale) {
scale->y = len < PRECISION_LIMIT ? 0.0 : len;
}
@@ -420,7 +420,7 @@ ZnTransfoDecompose(ZnTransfo *t,
return;
}
- local._[1][0] /= len; /* Normalize 2nd row */
+ local._[1][0] /= len; /* Normalize 2nd row */
local._[1][1] /= len;
skew /= len;
if (skewxy) {
@@ -473,30 +473,30 @@ ZnTransfoDecompose(ZnTransfo *t,
*************************************************************************
*
* ZnTransfoEqual --
- * Return True if t1 and t2 are equal (i.e they have the same
- * rotation, skew scales and translations). If include_translation
- * is True the translations are considered in the test.
+ * Return True if t1 and t2 are equal (i.e they have the same
+ * rotation, skew scales and translations). If include_translation
+ * is True the translations are considered in the test.
*
*************************************************************************
*/
ZnBool
-ZnTransfoEqual(ZnTransfo *t1,
- ZnTransfo *t2,
- ZnBool include_translation)
+ZnTransfoEqual(ZnTransfo *t1,
+ ZnTransfo *t2,
+ ZnBool include_translation)
{
if (include_translation) {
return (t1->_[0][0] == t2->_[0][0] &&
- t1->_[0][1] == t2->_[0][1] &&
- t1->_[1][0] == t2->_[1][0] &&
- t1->_[1][1] == t2->_[1][1] &&
- t1->_[2][0] == t2->_[2][0] &&
- t1->_[2][1] == t2->_[2][1]);
+ t1->_[0][1] == t2->_[0][1] &&
+ t1->_[1][0] == t2->_[1][0] &&
+ t1->_[1][1] == t2->_[1][1] &&
+ t1->_[2][0] == t2->_[2][0] &&
+ t1->_[2][1] == t2->_[2][1]);
}
else {
return (t1->_[0][0] == t2->_[0][0] &&
- t1->_[0][1] == t2->_[0][1] &&
- t1->_[1][0] == t2->_[1][0] &&
- t1->_[1][1] == t2->_[1][1]);
+ t1->_[0][1] == t2->_[0][1] &&
+ t1->_[1][0] == t2->_[1][0] &&
+ t1->_[1][1] == t2->_[1][1]);
}
}
@@ -505,13 +505,13 @@ ZnTransfoEqual(ZnTransfo *t1,
*************************************************************************
*
* ZnTransfoHasSkew --
- * Return True if t has a skew factor in x or y or describe a
- * rotation or both.
+ * Return True if t has a skew factor in x or y or describe a
+ * rotation or both.
*
*************************************************************************
*/
ZnBool
-ZnTransfoHasSkew(ZnTransfo *t)
+ZnTransfoHasSkew(ZnTransfo *t)
{
return t->_[0][1] != 0.0 || t->_[1][0] != 0.0;
}
@@ -521,20 +521,20 @@ ZnTransfoHasSkew(ZnTransfo *t)
*************************************************************************
*
* ZnTransfoIsTranslation --
- * Return True if t is a pure translation.
+ * Return True if t is a pure translation.
*
*************************************************************************
*/
ZnBool
-ZnTransfoIsTranslation(ZnTransfo *t)
+ZnTransfoIsTranslation(ZnTransfo *t)
{
if (!t) {
return True;
}
return (t->_[0][0] == 1.0 &&
- t->_[0][1] == 0.0 &&
- t->_[1][0] == 0.0 &&
- t->_[1][1] == 1.0);
+ t->_[0][1] == 0.0 &&
+ t->_[1][0] == 0.0 &&
+ t->_[1][1] == 1.0);
}
@@ -542,19 +542,19 @@ ZnTransfoIsTranslation(ZnTransfo *t)
*************************************************************************
*
* ZnTransformPoint --
- * Apply the transformation to the point. The point is
- * modified and returned as the value of the function.
- * It is safe for p and xp to be the same point (structure).
- * A NULL transformation means identity. This is only used
- * in the toolkit to optimize some cases. It should never
- * happen in user code.
+ * Apply the transformation to the point. The point is
+ * modified and returned as the value of the function.
+ * It is safe for p and xp to be the same point (structure).
+ * A NULL transformation means identity. This is only used
+ * in the toolkit to optimize some cases. It should never
+ * happen in user code.
*
*************************************************************************
*/
ZnPoint *
-ZnTransformPoint(ZnTransfo *t,
- register ZnPoint *p,
- ZnPoint *xp)
+ZnTransformPoint(ZnTransfo *t,
+ register ZnPoint *p,
+ ZnPoint *xp)
{
if (t == NULL) {
xp->x = p->x;
@@ -574,20 +574,20 @@ ZnTransformPoint(ZnTransfo *t,
*************************************************************************
*
* ZnTransformPoints --
- * Apply the transformation to the points in p returning points in xp.
- * It is safe for p and xp to be the same array of ponits.
- * The number of points is in num.
- * A NULL transformation means identity. This is only used
- * in the toolkit to optimize some cases. It should never
- * happen in user code.
+ * Apply the transformation to the points in p returning points in xp.
+ * It is safe for p and xp to be the same array of ponits.
+ * The number of points is in num.
+ * A NULL transformation means identity. This is only used
+ * in the toolkit to optimize some cases. It should never
+ * happen in user code.
*
*************************************************************************
*/
void
-ZnTransformPoints(ZnTransfo *t,
- ZnPoint *p,
- ZnPoint *xp,
- unsigned int num)
+ZnTransformPoints(ZnTransfo *t,
+ ZnPoint *p,
+ ZnPoint *xp,
+ unsigned int num)
{
if (t == NULL) {
memcpy(xp, p, sizeof(ZnPoint)*num);
@@ -609,17 +609,17 @@ ZnTransformPoints(ZnTransfo *t,
*************************************************************************
*
* ZnTranslate --
- * Translate the given transformation by delta_x, delta_y. Returns
- * the resulting transformation. If abs is true, delta_x and
- * delta_y are used to set the translation instead of adding deltas.
+ * Translate the given transformation by delta_x, delta_y. Returns
+ * the resulting transformation. If abs is true, delta_x and
+ * delta_y are used to set the translation instead of adding deltas.
*
*************************************************************************
*/
ZnTransfo *
-ZnTranslate(ZnTransfo *t,
- ZnReal delta_x,
- ZnReal delta_y,
- ZnBool abs)
+ZnTranslate(ZnTransfo *t,
+ ZnReal delta_x,
+ ZnReal delta_y,
+ ZnBool abs)
{
if (abs) {
t->_[2][0] = (float) delta_x;
@@ -637,15 +637,15 @@ ZnTranslate(ZnTransfo *t,
*************************************************************************
*
* ZnScale --
- * Scale the given transformation by scale_x, scale_y. Returns the
- * resulting transformation.
+ * Scale the given transformation by scale_x, scale_y. Returns the
+ * resulting transformation.
*
*************************************************************************
*/
ZnTransfo *
-ZnScale(ZnTransfo *t,
- ZnReal scale_x,
- ZnReal scale_y)
+ZnScale(ZnTransfo *t,
+ ZnReal scale_x,
+ ZnReal scale_y)
{
t->_[0][0] = t->_[0][0] * (float) scale_x;
t->_[0][1] = t->_[0][1] * (float) scale_y;
@@ -662,19 +662,19 @@ ZnScale(ZnTransfo *t,
*************************************************************************
*
* ZnRotateRad --
- * Rotate the given transformation by angle radians
- * counter-clockwise around the origin. Returns the resulting
- * transformation.
+ * Rotate the given transformation by angle radians
+ * counter-clockwise around the origin. Returns the resulting
+ * transformation.
*
*************************************************************************
*/
ZnTransfo *
-ZnRotateRad(ZnTransfo *t,
- ZnReal angle)
+ZnRotateRad(ZnTransfo *t,
+ ZnReal angle)
{
- float c = (float) cos(angle);
- float s = (float) sin(angle);
- float tmp;
+ float c = (float) cos(angle);
+ float s = (float) sin(angle);
+ float tmp;
tmp = t->_[0][0];
t->_[0][0] = tmp*c - t->_[0][1]*s;
@@ -694,15 +694,15 @@ ZnRotateRad(ZnTransfo *t,
*************************************************************************
*
* ZnRotateDeg --
- * Rotate the given transformation by angle degrees
- * counter-clockwise around the origin. Returns the resulting
- * transformation.
+ * Rotate the given transformation by angle degrees
+ * counter-clockwise around the origin. Returns the resulting
+ * transformation.
*
*************************************************************************
*/
ZnTransfo *
-ZnRotateDeg(ZnTransfo *t,
- ZnReal angle)
+ZnRotateDeg(ZnTransfo *t,
+ ZnReal angle)
{
return ZnRotateRad(t, ZnDegRad(angle));
}
@@ -712,20 +712,20 @@ ZnRotateDeg(ZnTransfo *t,
*************************************************************************
*
* ZnSkewRad --
- * Skew the given transformation by x_angle and y_angle radians
- * counter-clockwise around the origin. Returns the resulting
- * transformation.
+ * Skew the given transformation by x_angle and y_angle radians
+ * counter-clockwise around the origin. Returns the resulting
+ * transformation.
*
*************************************************************************
*/
ZnTransfo *
-ZnSkewRad(ZnTransfo *t,
- ZnReal skew_x,
- ZnReal skew_y)
+ZnSkewRad(ZnTransfo *t,
+ ZnReal skew_x,
+ ZnReal skew_y)
{
- float sx = (float) tan(skew_x);
- float sy = (float) tan(skew_y);
- float tmp;
+ float sx = (float) tan(skew_x);
+ float sy = (float) tan(skew_y);
+ float tmp;
tmp = t->_[0][0];
t->_[0][0] = tmp + t->_[0][1]*sx;
@@ -745,16 +745,16 @@ ZnSkewRad(ZnTransfo *t,
*************************************************************************
*
* ZnSkewDeg --
- * Skew the given transformation by x_angle and y_angle degrees
- * counter-clockwise around the origin. Returns the resulting
- * transformation.
+ * Skew the given transformation by x_angle and y_angle degrees
+ * counter-clockwise around the origin. Returns the resulting
+ * transformation.
*
*************************************************************************
*/
ZnTransfo *
-ZnSkewDeg(ZnTransfo *t,
- ZnReal skew_x,
- ZnReal skew_y)
+ZnSkewDeg(ZnTransfo *t,
+ ZnReal skew_x,
+ ZnReal skew_y)
{
return ZnSkewRad(t, ZnDegRad(skew_x), ZnDegRad(skew_y));
}
diff --git a/generic/Transfo.h b/generic/Transfo.h
index c10621b..c8f594f 100644
--- a/generic/Transfo.h
+++ b/generic/Transfo.h
@@ -1,8 +1,8 @@
/*
* Transfo.h -- Header for common geometric routines.
*
- * Authors : Patrick Lecoanet.
- * Creation date :
+ * Authors : Patrick Lecoanet.
+ * Creation date :
*
* $Id$
*/
@@ -43,7 +43,7 @@
* is lower left corner.
*/
typedef struct _ZnTransfo {
- float _[3][2];
+ float _[3][2];
} ZnTransfo;
@@ -52,65 +52,65 @@ ZnTransfoNew(void);
ZnTransfo *
ZnTransfoDuplicate(ZnTransfo *t);
void
-ZnTransfoFree(ZnTransfo *t);
+ZnTransfoFree(ZnTransfo *t);
void
-ZnPrintTransfo(ZnTransfo *t);
+ZnPrintTransfo(ZnTransfo *t);
void
-ZnTransfoSetIdentity(ZnTransfo *t);
+ZnTransfoSetIdentity(ZnTransfo *t);
ZnBool
-ZnTransfoIsIdentity(ZnTransfo *t);
+ZnTransfoIsIdentity(ZnTransfo *t);
ZnTransfo *
-ZnTransfoCompose(ZnTransfo *res,
- ZnTransfo *t1,
- ZnTransfo *t2);
+ZnTransfoCompose(ZnTransfo *res,
+ ZnTransfo *t1,
+ ZnTransfo *t2);
ZnTransfo *
-ZnTransfoInvert(ZnTransfo *t,
- ZnTransfo *inv);
+ZnTransfoInvert(ZnTransfo *t,
+ ZnTransfo *inv);
void
-ZnTransfoDecompose(ZnTransfo *t,
- ZnPoint *scale,
- ZnPoint *trans,
- ZnReal *rotation,
- ZnReal *skewxy);
+ZnTransfoDecompose(ZnTransfo *t,
+ ZnPoint *scale,
+ ZnPoint *trans,
+ ZnReal *rotation,
+ ZnReal *skewxy);
ZnBool
-ZnTransfoEqual(ZnTransfo *t1,
- ZnTransfo *t2,
- ZnBool include_translation);
+ZnTransfoEqual(ZnTransfo *t1,
+ ZnTransfo *t2,
+ ZnBool include_translation);
ZnBool
-ZnTransfoHasSkew(ZnTransfo *t);
+ZnTransfoHasSkew(ZnTransfo *t);
ZnBool
-ZnTransfoIsTranslation(ZnTransfo *t);
+ZnTransfoIsTranslation(ZnTransfo *t);
ZnPoint *
-ZnTransformPoint(ZnTransfo *t,
- ZnPoint *p,
- ZnPoint *xp);
+ZnTransformPoint(ZnTransfo *t,
+ ZnPoint *p,
+ ZnPoint *xp);
void
-ZnTransformPoints(ZnTransfo *t,
- ZnPoint *p,
- ZnPoint *xp,
- unsigned int num);
+ZnTransformPoints(ZnTransfo *t,
+ ZnPoint *p,
+ ZnPoint *xp,
+ unsigned int num);
ZnTransfo *
-ZnTranslate(ZnTransfo *t,
- ZnReal delta_x,
- ZnReal delta_y,
- ZnBool abs);
+ZnTranslate(ZnTransfo *t,
+ ZnReal delta_x,
+ ZnReal delta_y,
+ ZnBool abs);
ZnTransfo *
-ZnScale(ZnTransfo *t,
- ZnReal scale_x,
- ZnReal scale_y);
+ZnScale(ZnTransfo *t,
+ ZnReal scale_x,
+ ZnReal scale_y);
ZnTransfo *
-ZnRotateRad(ZnTransfo *t,
- ZnReal angle);
+ZnRotateRad(ZnTransfo *t,
+ ZnReal angle);
ZnTransfo *
-ZnRotateDeg(ZnTransfo *t,
- ZnReal angle);
+ZnRotateDeg(ZnTransfo *t,
+ ZnReal angle);
ZnTransfo *
-ZnSkewRad(ZnTransfo *t,
- ZnReal skew_x,
- ZnReal skew_y);
+ZnSkewRad(ZnTransfo *t,
+ ZnReal skew_x,
+ ZnReal skew_y);
ZnTransfo *
-ZnSkewDeg(ZnTransfo *t,
- ZnReal skew_x,
- ZnReal skew_y);
+ZnSkewDeg(ZnTransfo *t,
+ ZnReal skew_x,
+ ZnReal skew_y);
-#endif /* _Transfo_h */
+#endif /* _Transfo_h */
diff --git a/generic/Triangles.c b/generic/Triangles.c
index 8d94d79..3d9162a 100644
--- a/generic/Triangles.c
+++ b/generic/Triangles.c
@@ -1,8 +1,8 @@
/*
* Triangles.c -- Implementation of Triangle fan/strips item.
*
- * Authors : Patrick Lecoanet.
- * Creation date : Tue Dec 11 10:52:01 2001
+ * Authors : Patrick Lecoanet.
+ * Creation date : Tue Dec 11 10:52:01 2001
*
* $Id$
*/
@@ -46,7 +46,7 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ "
/*
* Bit offset of flags.
*/
-#define FAN_BIT 1<<0 /* Tell if the triangles are arranged in fan or strips. */
+#define FAN_BIT 1<<0 /* Tell if the triangles are arranged in fan or strips. */
/*
@@ -57,19 +57,19 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ "
**********************************************************************************
*/
typedef struct _TrianglesItemStruct {
- ZnItemStruct header;
+ ZnItemStruct header;
/* Public data */
- ZnList points;
+ ZnList points;
unsigned short flags;
- ZnList colors;
+ ZnList colors;
/* Private data */
- ZnTriStrip dev_points;
+ ZnTriStrip dev_points;
} TrianglesItemStruct, *TrianglesItem;
-static ZnAttrConfig tr_attrs[] = {
+static ZnAttrConfig tr_attrs[] = {
{ ZN_CONFIG_GRADIENT_LIST, "-colors", NULL,
Tk_Offset(TrianglesItemStruct, colors), 0, ZN_DRAW_FLAG, False },
{ ZN_CONFIG_BOOL, "-composealpha", NULL,
@@ -107,16 +107,16 @@ static ZnAttrConfig tr_attrs[] = {
**********************************************************************************
*/
static int
-Init(ZnItem item,
- int *argc,
- Tcl_Obj *CONST *args[])
+Init(ZnItem item,
+ int *argc,
+ Tcl_Obj *CONST *args[])
{
- ZnWInfo *wi = item->wi;
- TrianglesItem tr = (TrianglesItem) item;
- unsigned int num_points;
- ZnPoint *points;
- ZnList l;
- ZnGradient **grads;
+ ZnWInfo *wi = item->wi;
+ TrianglesItem tr = (TrianglesItem) item;
+ unsigned int num_points;
+ ZnPoint *points;
+ ZnList l;
+ ZnGradient **grads;
tr->dev_points.num_strips = 0;
@@ -134,7 +134,7 @@ Init(ZnItem item,
return TCL_ERROR;
}
if (ZnParseCoordList(wi, (*args)[0], &points,
- NULL, &num_points, NULL) == TCL_ERROR) {
+ NULL, &num_points, NULL) == TCL_ERROR) {
return TCL_ERROR;
}
if (num_points < 3) {
@@ -167,13 +167,13 @@ Init(ZnItem item,
**********************************************************************************
*/
static void
-Clone(ZnItem item)
+Clone(ZnItem item)
{
- TrianglesItem tr = (TrianglesItem) item;
+ TrianglesItem tr = (TrianglesItem) item;
if (tr->colors) {
- int i, num_grads;
- ZnGradient **grads;
+ int i, num_grads;
+ ZnGradient **grads;
tr->colors = ZnListDuplicate(tr->colors);
num_grads = ZnListSize(tr->colors);
@@ -196,17 +196,17 @@ Clone(ZnItem item)
**********************************************************************************
*/
static void
-Destroy(ZnItem item)
+Destroy(ZnItem item)
{
- TrianglesItem tr = (TrianglesItem) item;
+ TrianglesItem tr = (TrianglesItem) item;
ZnListFree(tr->points);
if (tr->dev_points.num_strips) {
ZnFree(tr->dev_points.strips->points);
}
if (tr->colors) {
- int i, num_grads;
- ZnGradient **grads;
+ int i, num_grads;
+ ZnGradient **grads;
num_grads = ZnListSize(tr->colors);
grads = ZnListArray(tr->colors);
@@ -226,12 +226,12 @@ Destroy(ZnItem item)
**********************************************************************************
*/
static int
-Configure(ZnItem item,
- int argc,
- Tcl_Obj *CONST argv[],
- int *flags)
+Configure(ZnItem item,
+ int argc,
+ Tcl_Obj *CONST argv[],
+ int *flags)
{
- int status = TCL_OK;
+ int status = TCL_OK;
status = ZnConfigureAttributes(item->wi, item, item, tr_attrs, argc, argv, flags);
@@ -247,9 +247,9 @@ Configure(ZnItem item,
**********************************************************************************
*/
static int
-Query(ZnItem item,
- int argc,
- Tcl_Obj *CONST argv[])
+Query(ZnItem item,
+ int argc,
+ Tcl_Obj *CONST argv[])
{
if (ZnQueryAttribute(item->wi->interp, item, tr_attrs, argv[0]) == TCL_ERROR) {
return TCL_ERROR;
@@ -267,14 +267,14 @@ Query(ZnItem item,
**********************************************************************************
*/
static void
-ComputeCoordinates(ZnItem item,
- ZnBool force)
+ComputeCoordinates(ZnItem item,
+ ZnBool force)
{
- ZnWInfo *wi = item->wi;
- TrianglesItem tr = (TrianglesItem) item;
- ZnPoint *points;
- ZnPoint *dev_points;
- unsigned int num_points;
+ ZnWInfo *wi = item->wi;
+ TrianglesItem tr = (TrianglesItem) item;
+ ZnPoint *points;
+ ZnPoint *dev_points;
+ unsigned int num_points;
ZnResetBBox(&item->item_bounding_box);
@@ -294,7 +294,7 @@ ComputeCoordinates(ZnItem item,
}
}
ZnTriStrip1(&tr->dev_points, dev_points, num_points,
- ISSET(tr->flags, FAN_BIT));
+ ISSET(tr->flags, FAN_BIT));
/*
* Compute device coordinates.
@@ -322,20 +322,20 @@ ComputeCoordinates(ZnItem item,
**********************************************************************************
*
* ToArea --
- * Tell if the object is entirely outside (-1),
- * entirely inside (1) or in between (0).
+ * Tell if the object is entirely outside (-1),
+ * entirely inside (1) or in between (0).
*
**********************************************************************************
*/
static int
-ToArea(ZnItem item,
- ZnToArea ta)
+ToArea(ZnItem item,
+ ZnToArea ta)
{
- TrianglesItem tr = (TrianglesItem) item;
- ZnPoint *points;
- unsigned int i, num_points;
- int result=-1, result2;
- ZnBBox *area = ta->area;
+ TrianglesItem tr = (TrianglesItem) item;
+ ZnPoint *points;
+ unsigned int i, num_points;
+ int result=-1, result2;
+ ZnBBox *area = ta->area;
if (tr->dev_points.num_strips == 0) {
return -1;
@@ -353,12 +353,12 @@ ToArea(ZnItem item,
for (i = 0; i < num_points-3; i++, points++) {
result2 = ZnPolygonInBBox(points, 3, area, NULL);
if (result2 != result) {
- return 0;
+ return 0;
}
}
}
else {
- ZnPoint tri[3];
+ ZnPoint tri[3];
tri[0] = points[0];
tri[1] = points[1];
@@ -373,7 +373,7 @@ ToArea(ZnItem item,
tri[2] = *points;
result2 = ZnPolygonInBBox(points, num_points, area, NULL);
if (result2 != result) {
- return 0;
+ return 0;
}
}
}
@@ -390,13 +390,13 @@ ToArea(ZnItem item,
**********************************************************************************
*/
static void
-Draw(ZnItem item)
+Draw(ZnItem item)
{
- ZnWInfo *wi = item->wi;
- TrianglesItem tr = (TrianglesItem) item;
- unsigned int i, num_points, last_color_index;
- ZnPoint *points;
- ZnGradient **grads;
+ ZnWInfo *wi = item->wi;
+ TrianglesItem tr = (TrianglesItem) item;
+ unsigned int i, num_points, last_color_index;
+ ZnPoint *points;
+ ZnGradient **grads;
if (tr->dev_points.num_strips == 0) {
return;
@@ -410,7 +410,7 @@ Draw(ZnItem item)
XSetFillStyle(wi->dpy, wi->gc, FillSolid);
if (ISCLEAR(tr->flags, FAN_BIT)) {
- XPoint *xpoints;
+ XPoint *xpoints;
ZnListAssertSize(ZnWorkXPoints, num_points);
xpoints = ZnListArray(ZnWorkXPoints);
for (i = 0; i < num_points; i++) {
@@ -419,14 +419,14 @@ Draw(ZnItem item)
}
for (i = 0; i < num_points-2; i++, xpoints++) {
if (i <= last_color_index) {
- XSetForeground(wi->dpy, wi->gc, ZnGetGradientPixel(grads[i], 0.0));
+ XSetForeground(wi->dpy, wi->gc, ZnGetGradientPixel(grads[i], 0.0));
}
XFillPolygon(wi->dpy, wi->draw_buffer, wi->gc,
- xpoints, 3, Convex, CoordModeOrigin);
+ xpoints, 3, Convex, CoordModeOrigin);
}
}
else {
- XPoint tri[3];
+ XPoint tri[3];
tri[0].x = ZnNearestInt(points[0].x);
tri[0].y = ZnNearestInt(points[0].y);
@@ -437,10 +437,10 @@ Draw(ZnItem item)
points += 3;
for (i = 0; i < num_points-2; i++, points++) {
if (i <= last_color_index) {
- XSetForeground(wi->dpy, wi->gc, ZnGetGradientPixel(grads[i], 0.0));
+ XSetForeground(wi->dpy, wi->gc, ZnGetGradientPixel(grads[i], 0.0));
}
XFillPolygon(wi->dpy, wi->draw_buffer, wi->gc,
- tri, 3, Convex, CoordModeOrigin);
+ tri, 3, Convex, CoordModeOrigin);
tri[1] = tri[2];
tri[2].x = ZnNearestInt(points->x);
tri[2].y = ZnNearestInt(points->y);
@@ -458,15 +458,15 @@ Draw(ZnItem item)
*/
#ifdef GL
static void
-Render(ZnItem item)
+Render(ZnItem item)
{
- ZnWInfo *wi = item->wi;
- TrianglesItem tr = (TrianglesItem) item;
- int i, num_points, last_color_index;
- ZnPoint *points;
- ZnGradient **grads;
+ ZnWInfo *wi = item->wi;
+ TrianglesItem tr = (TrianglesItem) item;
+ int i, num_points, last_color_index;
+ ZnPoint *points;
+ ZnGradient **grads;
unsigned short alpha;
- XColor *color;
+ XColor *color;
if (tr->dev_points.num_strips == 0) {
return;
@@ -498,7 +498,7 @@ Render(ZnItem item)
}
#else
static void
-Render(ZnItem item)
+Render(ZnItem item)
{
}
#endif
@@ -512,11 +512,11 @@ Render(ZnItem item)
**********************************************************************************
*/
static ZnBool
-IsSensitive(ZnItem item,
- int item_part)
+IsSensitive(ZnItem item,
+ int item_part)
{
return (ISSET(item->flags, ZN_SENSITIVE_BIT) &&
- item->parent->class->IsSensitive(item->parent, ZN_NO_PART));
+ item->parent->class->IsSensitive(item->parent, ZN_NO_PART));
}
@@ -528,13 +528,13 @@ IsSensitive(ZnItem item,
**********************************************************************************
*/
static double
-Pick(ZnItem item,
- ZnPick ps)
+Pick(ZnItem item,
+ ZnPick ps)
{
- TrianglesItem tr = (TrianglesItem) item;
- double dist=1.0e40, new_dist;
- ZnPoint *points, *p = ps->point;
- int i, num_points;
+ TrianglesItem tr = (TrianglesItem) item;
+ double dist=1.0e40, new_dist;
+ ZnPoint *points, *p = ps->point;
+ int i, num_points;
if (tr->dev_points.num_strips == 0) {
return dist;
@@ -547,15 +547,15 @@ Pick(ZnItem item,
for (i = 0; i < num_points-2; i++, points++) {
new_dist = ZnPolygonToPointDist(points, 3, p);
if (new_dist <= 0.0) {
- return 0.0;
+ return 0.0;
}
if (new_dist < dist) {
- dist = new_dist;
+ dist = new_dist;
}
}
}
else {
- ZnPoint tri[3];
+ ZnPoint tri[3];
tri[0] = points[0];
tri[1] = points[1];
@@ -563,10 +563,10 @@ Pick(ZnItem item,
for (i = 0; i < num_points-2; i++, points++) {
new_dist = ZnPolygonToPointDist(tri, 3, p);
if (new_dist <= 0.0) {
- return 0.0;
+ return 0.0;
}
if (new_dist < dist) {
- dist = new_dist;
+ dist = new_dist;
}
tri[1] = tri[2];
tri[2] = *points;
@@ -585,8 +585,8 @@ Pick(ZnItem item,
**********************************************************************************
*/
static void
-PostScript(ZnItem item,
- ZnBool prepass)
+PostScript(ZnItem item,
+ ZnBool prepass)
{
}
@@ -595,16 +595,16 @@ PostScript(ZnItem item,
**********************************************************************************
*
* GetClipVertices --
- * Get the clipping shape.
- * Never ever call ZnTriFree on the tristrip returned by GetClipVertices.
+ * Get the clipping shape.
+ * Never ever call ZnTriFree on the tristrip returned by GetClipVertices.
*
**********************************************************************************
*/
static ZnBool
-GetClipVertices(ZnItem item,
- ZnTriStrip *tristrip)
+GetClipVertices(ZnItem item,
+ ZnTriStrip *tristrip)
{
- TrianglesItem tr = (TrianglesItem) item;
+ TrianglesItem tr = (TrianglesItem) item;
if (tr->dev_points.num_strips == 0) {
tristrip->num_strips = 0;
@@ -612,8 +612,8 @@ GetClipVertices(ZnItem item,
}
ZnTriStrip1(tristrip, tr->dev_points.strips->points,
- tr->dev_points.strips->num_points,
- tr->dev_points.strips[0].fan);
+ tr->dev_points.strips->num_points,
+ tr->dev_points.strips[0].fan);
return False;
}
@@ -622,19 +622,19 @@ GetClipVertices(ZnItem item,
**********************************************************************************
*
* GetContours --
- * Get the external contour(s).
- * Never ever call ZnPolyFree on the poly returned by GetContours.
+ * Get the external contour(s).
+ * Never ever call ZnPolyFree on the poly returned by GetContours.
*
**********************************************************************************
*/
static ZnBool
-GetContours(ZnItem item,
- ZnPoly *poly)
+GetContours(ZnItem item,
+ ZnPoly *poly)
{
- TrianglesItem tr = (TrianglesItem) item;
- ZnPoint *points;
- unsigned int k, j, num_points;
- int i;
+ TrianglesItem tr = (TrianglesItem) item;
+ ZnPoint *points;
+ unsigned int k, j, num_points;
+ int i;
if (tr->dev_points.num_strips == 0) {
poly->num_contours = 0;
@@ -672,30 +672,30 @@ GetContours(ZnItem item,
**********************************************************************************
*
* Coords --
- * Return or edit the item vertices.
+ * Return or edit the item vertices.
*
**********************************************************************************
*/
static int
-Coords(ZnItem item,
- int contour,
- int index,
- int cmd,
- ZnPoint **pts,
- char **controls,
- unsigned int *num_pts)
+Coords(ZnItem item,
+ int contour,
+ int index,
+ int cmd,
+ ZnPoint **pts,
+ char **controls,
+ unsigned int *num_pts)
{
- TrianglesItem tr = (TrianglesItem) item;
- unsigned int num_points, i;
- ZnPoint *points;
+ TrianglesItem tr = (TrianglesItem) item;
+ unsigned int num_points, i;
+ ZnPoint *points;
if ((cmd == ZN_COORDS_REPLACE) || (cmd == ZN_COORDS_REPLACE_ALL)) {
if (cmd == ZN_COORDS_REPLACE_ALL) {
- ZnList tmp;
+ ZnList tmp;
if (*num_pts == 0) {
- Tcl_AppendResult(item->wi->interp,
- " coords command need at least 3 points on triangles", NULL);
- return TCL_ERROR;
+ Tcl_AppendResult(item->wi->interp,
+ " coords command need at least 3 points on triangles", NULL);
+ return TCL_ERROR;
}
tmp = ZnListFromArray(*pts, *num_pts, sizeof(ZnPoint));
ZnListEmpty(tr->points);
@@ -704,19 +704,19 @@ Coords(ZnItem item,
}
else {
if (*num_pts == 0) {
- Tcl_AppendResult(item->wi->interp,
- " coords command need at least 1 point on triangles", NULL);
- return TCL_ERROR;
+ Tcl_AppendResult(item->wi->interp,
+ " coords command need at least 1 point on triangles", NULL);
+ return TCL_ERROR;
}
points = ZnListArray(tr->points);
num_points = ZnListSize(tr->points);
if (index < 0) {
- index += num_points;
+ index += num_points;
}
if ((index < 0) || ((unsigned int) index >= num_points)) {
range_err:
- Tcl_AppendResult(item->wi->interp, " coord index out of range", NULL);
- return TCL_ERROR;
+ Tcl_AppendResult(item->wi->interp, " coord index out of range", NULL);
+ return TCL_ERROR;
}
points[index] = (*pts)[0];
}
@@ -731,10 +731,10 @@ Coords(ZnItem item,
}
else {
if (index < 0) {
- index += num_points;
+ index += num_points;
}
if ((index < 0) || ((unsigned int)index >= num_points)) {
- goto range_err;
+ goto range_err;
}
*num_pts = 1;
*pts = &points[index];
@@ -744,17 +744,17 @@ Coords(ZnItem item,
if (cmd == ZN_COORDS_ADD) {
num_points = ZnListSize(tr->points);
if (index < 0) {
- index += num_points;
+ index += num_points;
}
if ((index < 0) || ((unsigned int)index >= num_points)) {
- goto range_err;
+ goto range_err;
}
for (i = 0; i < *num_pts; i++, index++) {
- ZnListAdd(tr->points, &(*pts)[i], (unsigned int) index);
+ ZnListAdd(tr->points, &(*pts)[i], (unsigned int) index);
}
}
else {
- ZnList tmp;
+ ZnList tmp;
tmp = ZnListFromArray(*pts, *num_pts, sizeof(ZnPoint));
ZnListAppend(tr->points, tmp);
ZnListFree(tmp);
@@ -764,7 +764,7 @@ Coords(ZnItem item,
else if (cmd == ZN_COORDS_REMOVE) {
if (ZnListSize(tr->points) < 4) {
Tcl_AppendResult(item->wi->interp,
- " triangles should keep at least 3 points", NULL);
+ " triangles should keep at least 3 points", NULL);
return TCL_ERROR;
}
points = ZnListArray(tr->points);
@@ -787,23 +787,23 @@ Coords(ZnItem item,
**********************************************************************************
*
* PickVertex --
- * Return in 'vertex' the vertex closest to p and in 'o_vertex' the
- * opposite vertex on the closest edge, if such an edge exists or -1
- * in the other case.
+ * Return in 'vertex' the vertex closest to p and in 'o_vertex' the
+ * opposite vertex on the closest edge, if such an edge exists or -1
+ * in the other case.
*
**********************************************************************************
*/
static void
-PickVertex(ZnItem item,
- ZnPoint *p,
- int *contour,
- int *vertex,
- int *o_vertex)
+PickVertex(ZnItem item,
+ ZnPoint *p,
+ int *contour,
+ int *vertex,
+ int *o_vertex)
{
- TrianglesItem tr = (TrianglesItem) item;
- int i, k, num_points;
- ZnPoint *points;
- ZnReal dist=1.0e40, new_dist, dist2;
+ TrianglesItem tr = (TrianglesItem) item;
+ int i, k, num_points;
+ ZnPoint *points;
+ ZnReal dist=1.0e40, new_dist, dist2;
*contour = *vertex = *o_vertex = -1;
@@ -844,8 +844,8 @@ static ZnItemClassStruct TRIANGLES_ITEM_CLASS = {
"triangles",
sizeof(TrianglesItemStruct),
tr_attrs,
- 0, /* num_parts */
- 0, /* flags */
+ 0, /* num_parts */
+ 0, /* flags */
-1,
Init,
Clone,
@@ -857,20 +857,20 @@ static ZnItemClassStruct TRIANGLES_ITEM_CLASS = {
GetClipVertices,
GetContours,
Coords,
- NULL, /* InsertChars */
- NULL, /* DeleteChars */
- NULL, /* Cursor */
- NULL, /* Index */
- NULL, /* Part */
- NULL, /* Selection */
- NULL, /* Contour */
+ NULL, /* InsertChars */
+ NULL, /* DeleteChars */
+ NULL, /* Cursor */
+ NULL, /* Index */
+ NULL, /* Part */
+ NULL, /* Selection */
+ NULL, /* Contour */
ComputeCoordinates,
ToArea,
Draw,
Render,
IsSensitive,
Pick,
- PickVertex, /* PickVertex */
+ PickVertex, /* PickVertex */
PostScript
};
diff --git a/generic/Types.h b/generic/Types.h
index e02b75b..773f12b 100644
--- a/generic/Types.h
+++ b/generic/Types.h
@@ -1,8 +1,8 @@
/*
* Types.h -- Some types and macros used by the Zinc widget.
*
- * Authors : Patrick Lecoanet.
- * Creation date : Mon Feb 1 12:13:24 1999
+ * Authors : Patrick Lecoanet.
+ * Creation date : Mon Feb 1 12:13:24 1999
*
* $Id$
*/
@@ -88,24 +88,24 @@ extern "C" {
#endif
-typedef double ZnReal; /* Keep it a double for GL and Tcl. */
-typedef int ZnBool; /* Keep it an int to keep Tk happy */
-typedef ZnReal ZnPos;
-typedef ZnReal ZnDim;
-typedef void *ZnPtr;
+typedef double ZnReal; /* Keep it a double for GL and Tcl. */
+typedef int ZnBool; /* Keep it an int to keep Tk happy */
+typedef ZnReal ZnPos;
+typedef ZnReal ZnDim;
+typedef void *ZnPtr;
-#define ZnPixel(color) ((color)->pixel)
-#define ZnMalloc(size) ((void *)ckalloc(size))
-#define ZnFree(ptr) (ckfree((char *)(ptr)))
-#define ZnRealloc(ptr, size) ((void *)ckrealloc((void *)(ptr), size))
-#define ZnWarning(msg) (fprintf(stderr, "%s", (msg)))
+#define ZnPixel(color) ((color)->pixel)
+#define ZnMalloc(size) ((void *)ckalloc(size))
+#define ZnFree(ptr) (ckfree((char *)(ptr)))
+#define ZnRealloc(ptr, size) ((void *)ckrealloc((void *)(ptr), size))
+#define ZnWarning(msg) (fprintf(stderr, "%s", (msg)))
-#define ZnUnspecifiedImage None
-#define ZnUnspecifiedColor NULL
+#define ZnUnspecifiedImage None
+#define ZnUnspecifiedColor NULL
#ifndef TCL_INTEGER_SPACE
-# define TCL_INTEGER_SPACE 24
+# define TCL_INTEGER_SPACE 24
#endif
#ifdef PTK_800
@@ -146,34 +146,34 @@ Tk_GetScrollInfo(interp, argc, (Tcl_Obj **) args, fract, count)
# endif
#undef XFillRectangle
void XFillRectangle(Display *display, Drawable d, GC gc, int x, int y,
- unsigned int width, unsigned int height);
+ unsigned int width, unsigned int height);
# undef XFillRectangles
void XFillRectangles(Display *display, Drawable d, GC gc,
- XRectangle* rectangles, int nrectangles);
+ XRectangle* rectangles, int nrectangles);
# undef XFillArc
void XFillArc(Display *display, Drawable d, GC gc, int x, int y, unsigned int width,
- unsigned int height, int start, int extent);
+ unsigned int height, int start, int extent);
# undef XFillPolygon
void XFillPolygon(Display *display, Drawable d, GC gc, XPoint *points, int npoints,
- int shape, int mode);
+ int shape, int mode);
# undef XDrawRectangle
void XDrawRectangle(Display *display, Drawable d, GC gc, int x, int y,
- unsigned int width, unsigned int height);
+ unsigned int width, unsigned int height);
# undef XDrawArc
void XDrawArc(Display *display, Drawable d, GC gc, int x, int y,
- unsigned int width, unsigned int height, int start, int extent);
+ unsigned int width, unsigned int height, int start, int extent);
# undef XDrawLine
void XDrawLine(Display *display, Drawable d, GC gc, int x1, int y1, int x2, int y2);
# undef XDrawLines
void XDrawLines(Display *display, Drawable d, GC gc, XPoint* points,
- int npoints, int mode);
+ int npoints, int mode);
ZnBool ZnPointInRegion(TkRegion reg, int x, int y);
void ZnUnionRegion(TkRegion sra, TkRegion srb,
- TkRegion dr_return);
+ TkRegion dr_return);
void ZnOffsetRegion(TkRegion reg, int dx, int dy);
TkRegion ZnPolygonRegion(XPoint *points, int n,
- int fill_rule);
+ int fill_rule);
# ifdef GL
# define ZnGLContext HGLRC
# define ZnGLWaitX()
diff --git a/generic/WidgetInfo.h b/generic/WidgetInfo.h
index 725b2d9..2526366 100644
--- a/generic/WidgetInfo.h
+++ b/generic/WidgetInfo.h
@@ -1,8 +1,8 @@
/*
* WidgetInfo.h -- Zinc Widget record.
*
- * Authors : Patrick Lecoanet.
- * Creation date : Mon Feb 1 12:13:24 1999
+ * Authors : Patrick Lecoanet.
+ * Creation date : Mon Feb 1 12:13:24 1999
*
* $Id$
*/
@@ -40,25 +40,25 @@
#include "Color.h"
-#define ZN_NUM_ALPHA_STEPS 16
+#define ZN_NUM_ALPHA_STEPS 16
/*
* Constants for flags
*/
-#define ZN_REPICK_IN_PROGRESS (1<<0)
-#define ZN_GRABBED_ITEM (1<<1)
-#define ZN_GRABBED_PART (1<<2)
-#define ZN_REALIZED (1<<3)
-#define ZN_INTERNAL_NEED_REPICK (1<<4)
-#define ZN_UPDATE_SCROLLBARS (1<<5) /* If set, the scrollbars must be updated. */
-#define ZN_GOT_FOCUS (1<<6) /* Set means that the widget has the input focus. */
-#define ZN_UPDATE_PENDING (1<<7) /* Set means there is a pending graphic update. */
-#define ZN_HAS_GL (1<<8) /* Tell if openGL can be used. */
-#define ZN_HAS_X_SHAPE (1<<9) /* Tell if the X shape extension is available. */
-#define ZN_MONITORING (1<<10) /* Set if performance monitoring is on. */
-#define ZN_PRINT_CONFIG (1<<11) /* If set the openGL hardware configuration
- * is printed on startup. */
-#define ZN_CONFIGURE_EVENT (1<<12)
+#define ZN_REPICK_IN_PROGRESS (1<<0)
+#define ZN_GRABBED_ITEM (1<<1)
+#define ZN_GRABBED_PART (1<<2)
+#define ZN_REALIZED (1<<3)
+#define ZN_INTERNAL_NEED_REPICK (1<<4)
+#define ZN_UPDATE_SCROLLBARS (1<<5) /* If set, the scrollbars must be updated. */
+#define ZN_GOT_FOCUS (1<<6) /* Set means that the widget has the input focus. */
+#define ZN_UPDATE_PENDING (1<<7) /* Set means there is a pending graphic update. */
+#define ZN_HAS_GL (1<<8) /* Tell if openGL can be used. */
+#define ZN_HAS_X_SHAPE (1<<9) /* Tell if the X shape extension is available. */
+#define ZN_MONITORING (1<<10) /* Set if performance monitoring is on. */
+#define ZN_PRINT_CONFIG (1<<11) /* If set the openGL hardware configuration
+ * is printed on startup. */
+#define ZN_CONFIGURE_EVENT (1<<12)
#ifdef __CPLUSPLUS__
extern "C" {
@@ -73,187 +73,187 @@ extern "C" {
* only by the canvas generic code.
*/
typedef struct _ZnTextInfo {
- ZnGradient *sel_color; /* Background color for selected text.
- * Read-only to items.*/
- ZnItem sel_item; /* Pointer to selected item. ZN_NO_ITEM
- * means that the widget doesn't own the
- * selection. Writable by items. */
- int sel_field;
- int sel_first; /* Index of first selected character.
- * Writable by items. */
- int sel_last; /* Index of last selected character.
- * Writable by items. */
- ZnItem anchor_item; /* Item corresponding to sel_anchor: not
- * necessarily sel_item. Read-only to items. */
- int anchor_field;
- int sel_anchor; /* Fixed end of selection (i.e. "select to"
- * operation will use this as one end of the
- * selection). Writable by items. */
- ZnGradient *insert_color; /* Used to draw vertical bar for insertion
- * cursor. Read-only to items. */
- unsigned int insert_width; /* Total width of insertion cursor. Read-only
- * to items. */
- ZnBool cursor_on; /* True means that an insertion cursor should
- * be displayed in focus_item. Read-only to
- * items.*/
+ ZnGradient *sel_color; /* Background color for selected text.
+ * Read-only to items.*/
+ ZnItem sel_item; /* Pointer to selected item. ZN_NO_ITEM
+ * means that the widget doesn't own the
+ * selection. Writable by items. */
+ int sel_field;
+ int sel_first; /* Index of first selected character.
+ * Writable by items. */
+ int sel_last; /* Index of last selected character.
+ * Writable by items. */
+ ZnItem anchor_item; /* Item corresponding to sel_anchor: not
+ * necessarily sel_item. Read-only to items. */
+ int anchor_field;
+ int sel_anchor; /* Fixed end of selection (i.e. "select to"
+ * operation will use this as one end of the
+ * selection). Writable by items. */
+ ZnGradient *insert_color; /* Used to draw vertical bar for insertion
+ * cursor. Read-only to items. */
+ unsigned int insert_width; /* Total width of insertion cursor. Read-only
+ * to items. */
+ ZnBool cursor_on; /* True means that an insertion cursor should
+ * be displayed in focus_item. Read-only to
+ * items.*/
} ZnTextInfo;
typedef struct _ZnWInfo {
- Tcl_Interp *interp; /* Interpreter associated with widget. */
- Tcl_Command cmd; /* Token for zinc widget command. */
- Tcl_HashTable *id_table; /* Hash table for object ids. */
- Tcl_HashTable *t_table; /* Hash table for transformations. */
- unsigned long obj_id; /* Id for the next new object. */
- int flags;
- Tk_BindingTable binding_table; /* Table of all bindings currently defined
- * for this widget. NULL means that no
- * bindings exist, so the table hasn't been
- * created. Each "object" used for this
- * table is either a Tk_Uid for a tag or
- * the address of an item named by id. */
- int state; /* Last known modifier state. Used to
- * defer picking a new current object
- * while buttons are down. */
- ZnItem current_item; /* Item picked from previous pick sequence */
- ZnItem new_item; /* Item picked from current pick sequence */
- int current_part;
- int new_part;
- ZnItem hot_item;
- ZnItem hot_prev;
- ZnItem focus_item; /* Item that currently has the input focus,
- * or ZN_NO_ITEM if no such item. Read-only to
- * items. */
- int focus_field;
- XEvent pick_event; /* Event used to forge fake events and to do
- * repicks. */
- ZnBBox exposed_area; /* Window area that need to be rexposed.
- * It is distinct from redraw_area which
- * is updated when items are changed. */
- Pixmap alpha_stipples[ZN_NUM_ALPHA_STEPS];
- int border_width;
- int opt_width; /* Window size as stated/reported by the option. */
- int opt_height; /* They are equal to the width/height fields after
- * the actual resize. They may to be equal if
- * the resize is not acknowledged by the geo
- * manager. */
- ZnGradient *relief_grad; /* The gradient describing the border relief
- * colors. */
- ZnReliefStyle relief; /* The border relief. */
+ Tcl_Interp *interp; /* Interpreter associated with widget. */
+ Tcl_Command cmd; /* Token for zinc widget command. */
+ Tcl_HashTable *id_table; /* Hash table for object ids. */
+ Tcl_HashTable *t_table; /* Hash table for transformations. */
+ unsigned long obj_id; /* Id for the next new object. */
+ int flags;
+ Tk_BindingTable binding_table; /* Table of all bindings currently defined
+ * for this widget. NULL means that no
+ * bindings exist, so the table hasn't been
+ * created. Each "object" used for this
+ * table is either a Tk_Uid for a tag or
+ * the address of an item named by id. */
+ int state; /* Last known modifier state. Used to
+ * defer picking a new current object
+ * while buttons are down. */
+ ZnItem current_item; /* Item picked from previous pick sequence */
+ ZnItem new_item; /* Item picked from current pick sequence */
+ int current_part;
+ int new_part;
+ ZnItem hot_item;
+ ZnItem hot_prev;
+ ZnItem focus_item; /* Item that currently has the input focus,
+ * or ZN_NO_ITEM if no such item. Read-only to
+ * items. */
+ int focus_field;
+ XEvent pick_event; /* Event used to forge fake events and to do
+ * repicks. */
+ ZnBBox exposed_area; /* Window area that need to be rexposed.
+ * It is distinct from redraw_area which
+ * is updated when items are changed. */
+ Pixmap alpha_stipples[ZN_NUM_ALPHA_STEPS];
+ int border_width;
+ int opt_width; /* Window size as stated/reported by the option. */
+ int opt_height; /* They are equal to the width/height fields after
+ * the actual resize. They may to be equal if
+ * the resize is not acknowledged by the geo
+ * manager. */
+ ZnGradient *relief_grad; /* The gradient describing the border relief
+ * colors. */
+ ZnReliefStyle relief; /* The border relief. */
- /* Tracks global resources */
+ /* Tracks global resources */
#ifdef ATC
- unsigned int track_managed_history_size; /* Size of history for tracks */
- unsigned int track_visible_history_size; /* Size of displayed history */
- ZnReal speed_vector_length; /* How long (in time) are speedvectors*/
- int om_group_id; /* Tell which group contains tracks to be */
- ZnItem om_group; /* processed for anti label overlap. */
+ unsigned int track_managed_history_size; /* Size of history for tracks */
+ unsigned int track_visible_history_size; /* Size of displayed history */
+ ZnReal speed_vector_length; /* How long (in time) are speedvectors*/
+ int om_group_id; /* Tell which group contains tracks to be */
+ ZnItem om_group; /* processed for anti label overlap. */
/* Maps global resources */
- Tk_Font map_text_font; /* Font for texts in Map items */
+ Tk_Font map_text_font; /* Font for texts in Map items */
#ifdef GL
- ZnTexFontInfo map_font_tfi; /* Used to preserve the default font from
- * being freed again and again */
+ ZnTexFontInfo map_font_tfi; /* Used to preserve the default font from
+ * being freed again and again */
#endif
- Tcl_Obj *map_symbol_obj;
- ZnImage map_distance_symbol; /* Distance marks displayed along Map */
- /* lines. */
- Tcl_Obj *track_symbol_obj;
- ZnImage track_symbol; /* Symbol displayed at track/wp current */
- /* position. */
+ Tcl_Obj *map_symbol_obj;
+ ZnImage map_distance_symbol; /* Distance marks displayed along Map */
+ /* lines. */
+ Tcl_Obj *track_symbol_obj;
+ ZnImage track_symbol; /* Symbol displayed at track/wp current */
+ /* position. */
#endif
/* Transformer */
- ZnTransfo *current_transfo;
- ZnList transfo_stack;
- struct _ClipState *current_clip;
- ZnList clip_stack;
+ ZnTransfo *current_transfo;
+ ZnList transfo_stack;
+ struct _ClipState *current_clip;
+ ZnList clip_stack;
/* Others */
- ZnGradient *fore_color; /* Default gradient used in new items */
- ZnGradient *back_color; /* Color of the widget background. */
- ZnGradient *bbox_color; /* Color used to draw bboxes (debug). */
- Tk_Cursor cursor; /* Cursor displayed in zinc window. */
- ZnBool draw_bboxes; /* Draw item's bboxes (debug). */
- ZnBool follow_pointer; /* Process pointer motion events to */
- /* emit enter/leave events. */
- int light_angle;
+ ZnGradient *fore_color; /* Default gradient used in new items */
+ ZnGradient *back_color; /* Color of the widget background. */
+ ZnGradient *bbox_color; /* Color used to draw bboxes (debug). */
+ Tk_Cursor cursor; /* Cursor displayed in zinc window. */
+ ZnBool draw_bboxes; /* Draw item's bboxes (debug). */
+ ZnBool follow_pointer; /* Process pointer motion events to */
+ /* emit enter/leave events. */
+ int light_angle;
- int pick_aperture; /* size of pick aperture in pixels */
- Tk_Font font; /* Default font used in new items */
+ int pick_aperture; /* size of pick aperture in pixels */
+ Tk_Font font; /* Default font used in new items */
#ifdef GL
- ZnTexFontInfo font_tfi; /* Used to preserve the default font from
- * being freed again and again */
+ ZnTexFontInfo font_tfi; /* Used to preserve the default font from
+ * being freed again and again */
#endif
- Tcl_Obj *tile_obj;
- ZnImage tile;
+ Tcl_Obj *tile_obj;
+ ZnImage tile;
/* Zinc private resources */
- int width; /* Actual window dimension. */
- int height;
- int inset; /* Border and highlight width */
+ int width; /* Actual window dimension. */
+ int height;
+ int inset; /* Border and highlight width */
/* Graphic variables */
- Display *dpy; /* The display of the widget window. */
- Screen *screen;
- Tk_Window win; /* The window of the widget. */
- Pixmap draw_buffer; /* Pixmap for double buffering */
- ZnBBox damaged_area; /* The current damaged rectangle */
- GC gc;
- ZnBool reshape; /* Use the Shape Extension on the window.*/
- ZnBool full_reshape; /* Use it on the top level window. */
- Window real_top;
- int render;
- unsigned char alpha; /* Current composite group alpha. */
- ZnItem top_group;
+ Display *dpy; /* The display of the widget window. */
+ Screen *screen;
+ Tk_Window win; /* The window of the widget. */
+ Pixmap draw_buffer; /* Pixmap for double buffering */
+ ZnBBox damaged_area; /* The current damaged rectangle */
+ GC gc;
+ ZnBool reshape; /* Use the Shape Extension on the window.*/
+ ZnBool full_reshape; /* Use it on the top level window. */
+ Window real_top;
+ int render;
+ unsigned char alpha; /* Current composite group alpha. */
+ ZnItem top_group;
#ifndef PTK_800
- Tk_OptionTable opt_table;
+ Tk_OptionTable opt_table;
#endif
/* Text management */
- ZnTextInfo text_info;
- int insert_on_time;
- int insert_off_time;
- Tcl_TimerToken blink_handler;
- char *take_focus;
- int highlight_width; /* Width in pixels of highlight to draw
- * around widget when it has the focus.
- * = 0 means don't draw a highlight. */
- ZnGradient *highlight_bg_color; /* Color for drawing traversal highlight
- * area when highlight is off. */
- ZnGradient *highlight_color; /* Color for drawing traversal highlight.*/
+ ZnTextInfo text_info;
+ int insert_on_time;
+ int insert_off_time;
+ Tcl_TimerToken blink_handler;
+ char *take_focus;
+ int highlight_width; /* Width in pixels of highlight to draw
+ * around widget when it has the focus.
+ * = 0 means don't draw a highlight. */
+ ZnGradient *highlight_bg_color; /* Color for drawing traversal highlight
+ * area when highlight is off. */
+ ZnGradient *highlight_color; /* Color for drawing traversal highlight.*/
/* Scrollbar management */
- ZnPoint origin; /* Coordinate mapped to the upper left corner
- * of the zinc window. */
+ ZnPoint origin; /* Coordinate mapped to the upper left corner
+ * of the zinc window. */
#ifdef PTK
- LangCallback *x_scroll_cmd;
- LangCallback *y_scroll_cmd;
+ LangCallback *x_scroll_cmd;
+ LangCallback *y_scroll_cmd;
#else
- Tcl_Obj *x_scroll_cmd; /* Command prefixes for communicating with */
- Tcl_Obj *y_scroll_cmd; /* scrollbars. NULL means no scrollbar.
- * Malloc'ed */
+ Tcl_Obj *x_scroll_cmd; /* Command prefixes for communicating with */
+ Tcl_Obj *y_scroll_cmd; /* scrollbars. NULL means no scrollbar.
+ * Malloc'ed */
#endif
- int x_scroll_incr; /* If >0, defines a grid for horiz/vert */
- int y_scroll_incr; /* scrolling. This is the size of the "unit",
- * and the left edge of the screen will always
- * lie on an even unit boundary. */
- int scroll_xo; /* This bbox define the region that is the */
- int scroll_yo; /* 100% area for scrolling (i.e. it determines */
- int scroll_xc; /* the size and location of the sliders on */
- int scroll_yc; /* scrollbars). */
- ZnBool confine; /* When true, it is not possible to scroll the
- * viewing area past the scroll region. */
- Tcl_Obj *region; /* Scroll region option string source of the
- * scroll_region above. */
+ int x_scroll_incr; /* If >0, defines a grid for horiz/vert */
+ int y_scroll_incr; /* scrolling. This is the size of the "unit",
+ * and the left edge of the screen will always
+ * lie on an even unit boundary. */
+ int scroll_xo; /* This bbox define the region that is the */
+ int scroll_yo; /* 100% area for scrolling (i.e. it determines */
+ int scroll_xc; /* the size and location of the sliders on */
+ int scroll_yc; /* scrollbars). */
+ ZnBool confine; /* When true, it is not possible to scroll the
+ * viewing area past the scroll region. */
+ Tcl_Obj *region; /* Scroll region option string source of the
+ * scroll_region above. */
/* Perf measurement variables. */
#ifndef _WIN32
- ZnChrono this_draw_chrono;
- ZnChrono total_draw_chrono;
- void *ps_info;
+ ZnChrono this_draw_chrono;
+ ZnChrono total_draw_chrono;
+ void *ps_info;
#endif
- int num_items;
- int damaged_area_w;
- int damaged_area_h;
+ int num_items;
+ int damaged_area_w;
+ int damaged_area_h;
} ZnWInfo;
diff --git a/generic/Window.c b/generic/Window.c
index d02c302..e00d7ec 100644
--- a/generic/Window.c
+++ b/generic/Window.c
@@ -1,8 +1,8 @@
/*
* Window.c -- Implementation of Window item.
*
- * Authors : Patrick LECOANET
- * Creation date : Fri May 12 11:25:53 2000
+ * Authors : Patrick LECOANET
+ * Creation date : Fri May 12 11:25:53 2000
*/
/*
@@ -43,24 +43,24 @@ static const char compile_id[] = "$Compile: " __FILE__ " " __DATE__ " " __TIME__
**********************************************************************************
*/
typedef struct _WindowItemStruct {
- ZnItemStruct header;
+ ZnItemStruct header;
/* Public data */
- ZnPoint pos;
- Tk_Anchor anchor;
- Tk_Anchor connection_anchor;
- Tk_Window win;
- int width;
- int height;
+ ZnPoint pos;
+ Tk_Anchor anchor;
+ Tk_Anchor connection_anchor;
+ Tk_Window win;
+ int width;
+ int height;
/* Private data */
- ZnPoint pos_dev;
- int real_width;
- int real_height;
+ ZnPoint pos_dev;
+ int real_width;
+ int real_height;
} WindowItemStruct, *WindowItem;
-static ZnAttrConfig wind_attrs[] = {
+static ZnAttrConfig wind_attrs[] = {
{ ZN_CONFIG_ANCHOR, "-anchor", NULL,
Tk_Offset(WindowItemStruct, anchor), 0, ZN_COORDS_FLAG, False },
{ ZN_CONFIG_BOOL, "-composealpha", NULL,
@@ -107,13 +107,13 @@ static ZnAttrConfig wind_attrs[] = {
*
* WindowDeleted --
*
- * Do the bookeeping after a managed window deletion.
+ * Do the bookeeping after a managed window deletion.
*
**********************************************************************************
*/
static void
-WindowDeleted(ClientData client_data,
- XEvent *event)
+WindowDeleted(ClientData client_data,
+ XEvent *event)
{
WindowItem wind = (WindowItem) client_data;
@@ -135,8 +135,8 @@ WindowDeleted(ClientData client_data,
* A managed window changes requested dimensions.
*/
static void
-WindowItemRequest(ClientData client_data,
- Tk_Window win)
+WindowItemRequest(ClientData client_data,
+ Tk_Window win)
{
WindowItem wind = (WindowItem) client_data;
@@ -148,14 +148,14 @@ WindowItemRequest(ClientData client_data,
* to another geometry manager.
*/
static void
-WindowItemLostSlave(ClientData client_data,
- Tk_Window win)
+WindowItemLostSlave(ClientData client_data,
+ Tk_Window win)
{
WindowItem wind = (WindowItem) client_data;
ZnWInfo *wi = ((ZnItem) wind)->wi;
Tk_DeleteEventHandler(wi->win, StructureNotifyMask, WindowDeleted,
- (ClientData) wind);
+ (ClientData) wind);
if (wi->win != Tk_Parent(wind->win)) {
Tk_UnmaintainGeometry(wind->win, wi->win);
}
@@ -164,9 +164,9 @@ WindowItemLostSlave(ClientData client_data,
}
static Tk_GeomMgr wind_geom_type = {
- "zincwindow", /* name */
- WindowItemRequest, /* requestProc */
- WindowItemLostSlave, /* lostSlaveProc */
+ "zincwindow", /* name */
+ WindowItemRequest, /* requestProc */
+ WindowItemLostSlave, /* lostSlaveProc */
};
@@ -178,11 +178,11 @@ static Tk_GeomMgr wind_geom_type = {
**********************************************************************************
*/
static int
-Init(ZnItem item,
- int *argc,
- Tcl_Obj *CONST *args[])
+Init(ZnItem item,
+ int *argc,
+ Tcl_Obj *CONST *args[])
{
- WindowItem wind = (WindowItem) item;
+ WindowItem wind = (WindowItem) item;
/* Init attributes */
SET(item->flags, ZN_VISIBLE_BIT);
@@ -210,9 +210,9 @@ Init(ZnItem item,
**********************************************************************************
*/
static void
-Clone(ZnItem item)
+Clone(ZnItem item)
{
- WindowItem wind = (WindowItem) item;
+ WindowItem wind = (WindowItem) item;
/*
* The same Tk widget can't be shared by to Window items.
@@ -229,17 +229,17 @@ Clone(ZnItem item)
**********************************************************************************
*/
static void
-Destroy(ZnItem item)
+Destroy(ZnItem item)
{
- ZnWInfo *wi = item->wi;
- WindowItem wind = (WindowItem) item;
+ ZnWInfo *wi = item->wi;
+ WindowItem wind = (WindowItem) item;
/*
* Unmanage the widget.
*/
if (wind->win) {
Tk_DeleteEventHandler(wind->win, StructureNotifyMask, WindowDeleted,
- (ClientData) item);
+ (ClientData) item);
Tk_ManageGeometry(wind->win, (Tk_GeomMgr *) NULL, (ClientData) NULL);
if (wi->win != Tk_Parent(wind->win)) {
Tk_UnmaintainGeometry(wind->win, wi->win);
@@ -257,15 +257,15 @@ Destroy(ZnItem item)
**********************************************************************************
*/
static int
-Configure(ZnItem item,
- int argc,
- Tcl_Obj *CONST argv[],
- int *flags)
+Configure(ZnItem item,
+ int argc,
+ Tcl_Obj *CONST argv[],
+ int *flags)
{
- WindowItem wind = (WindowItem) item;
- ZnWInfo *wi = item->wi;
- ZnItem old_connected;
- Tk_Window old_win;
+ WindowItem wind = (WindowItem) item;
+ ZnWInfo *wi = item->wi;
+ ZnItem old_connected;
+ Tk_Window old_win;
old_connected = item->connected_item;
old_win = wind->win;
@@ -279,8 +279,8 @@ Configure(ZnItem item,
* to the old one.
*/
if ((item->connected_item == ZN_NO_ITEM) ||
- (ISSET(item->connected_item->class->flags, ZN_CLASS_HAS_ANCHORS) &&
- (item->parent == item->connected_item->parent))) {
+ (ISSET(item->connected_item->class->flags, ZN_CLASS_HAS_ANCHORS) &&
+ (item->parent == item->connected_item->parent))) {
ZnITEM.UpdateItemDependency(item, old_connected);
}
else {
@@ -291,14 +291,14 @@ Configure(ZnItem item,
if (ISSET(*flags, ZN_WINDOW_FLAG)) {
if (old_win != NULL) {
Tk_DeleteEventHandler(old_win, StructureNotifyMask,
- WindowDeleted, (ClientData) item);
+ WindowDeleted, (ClientData) item);
Tk_ManageGeometry(old_win, (Tk_GeomMgr *) NULL, (ClientData) NULL);
Tk_UnmaintainGeometry(old_win, wi->win);
Tk_UnmapWindow(old_win);
}
if (wind->win != NULL) {
Tk_CreateEventHandler(wind->win, StructureNotifyMask,
- WindowDeleted, (ClientData) item);
+ WindowDeleted, (ClientData) item);
Tk_ManageGeometry(wind->win, &wind_geom_type, (ClientData) item);
}
}
@@ -321,9 +321,9 @@ Configure(ZnItem item,
**********************************************************************************
*/
static int
-Query(ZnItem item,
- int argc,
- Tcl_Obj *CONST argv[])
+Query(ZnItem item,
+ int argc,
+ Tcl_Obj *CONST argv[])
{
if (ZnQueryAttribute(item->wi->interp, item, wind_attrs, argv[0]) == TCL_ERROR) {
return TCL_ERROR;
@@ -341,11 +341,11 @@ Query(ZnItem item,
**********************************************************************************
*/
static void
-ComputeCoordinates(ZnItem item,
- ZnBool force)
+ComputeCoordinates(ZnItem item,
+ ZnBool force)
{
- ZnWInfo *wi = item->wi;
- WindowItem wind = (WindowItem) item;
+ ZnWInfo *wi = item->wi;
+ WindowItem wind = (WindowItem) item;
ZnResetBBox(&item->item_bounding_box);
@@ -374,8 +374,8 @@ ComputeCoordinates(ZnItem item,
*/
if (item->connected_item != ZN_NO_ITEM) {
item->connected_item->class->GetAnchor(item->connected_item,
- wind->connection_anchor,
- &wind->pos_dev);
+ wind->connection_anchor,
+ &wind->pos_dev);
}
else {
ZnPoint pos;
@@ -384,7 +384,7 @@ ComputeCoordinates(ZnItem item,
}
ZnAnchor2Origin(&wind->pos_dev, (ZnReal) wind->real_width, (ZnReal) wind->real_height,
- wind->anchor, &wind->pos_dev);
+ wind->anchor, &wind->pos_dev);
wind->pos_dev.x = ZnNearestInt(wind->pos_dev.x);
wind->pos_dev.y = ZnNearestInt(wind->pos_dev.y);
@@ -393,7 +393,7 @@ ComputeCoordinates(ZnItem item,
*/
ZnAddPointToBBox(&item->item_bounding_box, wind->pos_dev.x, wind->pos_dev.y);
ZnAddPointToBBox(&item->item_bounding_box, wind->pos_dev.x+wind->real_width,
- wind->pos_dev.y+wind->real_height);
+ wind->pos_dev.y+wind->real_height);
item->item_bounding_box.orig.x -= 1.0;
item->item_bounding_box.orig.y -= 1.0;
item->item_bounding_box.corner.x += 1.0;
@@ -410,18 +410,18 @@ ComputeCoordinates(ZnItem item,
**********************************************************************************
*
* ToArea --
- * Tell if the object is entirely outside (-1),
- * entirely inside (1) or in between (0).
+ * Tell if the object is entirely outside (-1),
+ * entirely inside (1) or in between (0).
*
**********************************************************************************
*/
static int
-ToArea(ZnItem item,
- ZnToArea ta)
+ToArea(ZnItem item,
+ ZnToArea ta)
{
- WindowItem wind = (WindowItem) item;
- ZnBBox box;
- int w=0, h=0;
+ WindowItem wind = (WindowItem) item;
+ ZnBBox box;
+ int w=0, h=0;
box.orig = wind->pos_dev;
if (wind->win != NULL) {
@@ -442,10 +442,10 @@ ToArea(ZnItem item,
**********************************************************************************
*/
static void
-Draw(ZnItem item)
+Draw(ZnItem item)
{
- ZnWInfo *wi = item->wi;
- WindowItem wind = (WindowItem) item;
+ ZnWInfo *wi = item->wi;
+ WindowItem wind = (WindowItem) item;
if (wind->win == NULL) {
return;
@@ -472,19 +472,19 @@ Draw(ZnItem item)
*/
if (wi->win == Tk_Parent(wind->win)) {
if ((wind->pos_dev.x != Tk_X(wind->win)) ||
- (wind->pos_dev.y != Tk_Y(wind->win)) ||
- (wind->real_width != Tk_Width(wind->win)) ||
- (wind->real_height != Tk_Height(wind->win))) {
+ (wind->pos_dev.y != Tk_Y(wind->win)) ||
+ (wind->real_width != Tk_Width(wind->win)) ||
+ (wind->real_height != Tk_Height(wind->win))) {
Tk_MoveResizeWindow(wind->win,
- (int) wind->pos_dev.x, (int) wind->pos_dev.y,
- wind->real_width, wind->real_height);
+ (int) wind->pos_dev.x, (int) wind->pos_dev.y,
+ wind->real_width, wind->real_height);
}
Tk_MapWindow(wind->win);
}
else {
Tk_MaintainGeometry(wind->win, wi->win,
- (int) wind->pos_dev.x, (int) wind->pos_dev.y,
- wind->real_width, wind->real_height);
+ (int) wind->pos_dev.x, (int) wind->pos_dev.y,
+ wind->real_width, wind->real_height);
}
}
@@ -498,8 +498,8 @@ Draw(ZnItem item)
**********************************************************************************
*/
static ZnBool
-IsSensitive(ZnItem item,
- int item_part)
+IsSensitive(ZnItem item,
+ int item_part)
{
/*
* Sensitivity can't be controlled.
@@ -516,13 +516,13 @@ IsSensitive(ZnItem item,
**********************************************************************************
*/
static double
-Pick(ZnItem item,
- ZnPick ps)
+Pick(ZnItem item,
+ ZnPick ps)
{
- WindowItem wind = (WindowItem) item;
- ZnBBox box;
- ZnReal dist = 1e40;
- ZnPoint *p = ps->point;
+ WindowItem wind = (WindowItem) item;
+ ZnBBox box;
+ ZnReal dist = 1e40;
+ ZnPoint *p = ps->point;
box.orig = wind->pos_dev;
if (wind->win != NULL) {
@@ -545,8 +545,8 @@ Pick(ZnItem item,
**********************************************************************************
*/
static void
-PostScript(ZnItem item,
- ZnBool prepass)
+PostScript(ZnItem item,
+ ZnBool prepass)
{
}
@@ -559,15 +559,15 @@ PostScript(ZnItem item,
**********************************************************************************
*/
static void
-GetAnchor(ZnItem item,
- Tk_Anchor anchor,
- ZnPoint *p)
+GetAnchor(ZnItem item,
+ Tk_Anchor anchor,
+ ZnPoint *p)
{
- WindowItem wind = (WindowItem) item;
+ WindowItem wind = (WindowItem) item;
if (wind->win != NULL) {
ZnOrigin2Anchor(&wind->pos_dev, (ZnReal) wind->real_width,
- (ZnReal) wind->real_height, anchor, p);
+ (ZnReal) wind->real_height, anchor, p);
}
else {
p->x = p->y = 0.0;
@@ -579,17 +579,17 @@ GetAnchor(ZnItem item,
**********************************************************************************
*
* GetClipVertices --
- * Get the clipping shape.
+ * Get the clipping shape.
*
**********************************************************************************
*/
static ZnBool
-GetClipVertices(ZnItem item,
- ZnTriStrip *tristrip)
+GetClipVertices(ZnItem item,
+ ZnTriStrip *tristrip)
{
- WindowItem wind = (WindowItem) item;
- int w=0, h=0;
- ZnPoint *points;
+ WindowItem wind = (WindowItem) item;
+ int w=0, h=0;
+ ZnPoint *points;
ZnListAssertSize(ZnWorkPoints, 2);
if (wind->win != NULL) {
@@ -610,32 +610,32 @@ GetClipVertices(ZnItem item,
**********************************************************************************
*
* Coords --
- * Return or edit the item origin. This doesn't take care of
- * the possible attachment. The change will be effective at the
- * end of the attachment.
+ * Return or edit the item origin. This doesn't take care of
+ * the possible attachment. The change will be effective at the
+ * end of the attachment.
*
**********************************************************************************
*/
static int
-Coords(ZnItem item,
- int contour,
- int index,
- int cmd,
- ZnPoint **pts,
- char **controls,
- unsigned int *num_pts)
+Coords(ZnItem item,
+ int contour,
+ int index,
+ int cmd,
+ ZnPoint **pts,
+ char **controls,
+ unsigned int *num_pts)
{
- WindowItem wind = (WindowItem) item;
+ WindowItem wind = (WindowItem) item;
if ((cmd == ZN_COORDS_ADD) || (cmd == ZN_COORDS_ADD_LAST) || (cmd == ZN_COORDS_REMOVE)) {
Tcl_AppendResult(item->wi->interp,
- " windows can't add or remove vertices", NULL);
+ " windows can't add or remove vertices", NULL);
return TCL_ERROR;
}
else if ((cmd == ZN_COORDS_REPLACE) || (cmd == ZN_COORDS_REPLACE_ALL)) {
if (*num_pts == 0) {
Tcl_AppendResult(item->wi->interp,
- " coords command need 1 point on windows", NULL);
+ " coords command need 1 point on windows", NULL);
return TCL_ERROR;
}
wind->pos = (*pts)[0];
@@ -660,7 +660,7 @@ static ZnItemClassStruct WINDOW_ITEM_CLASS = {
"window",
sizeof(WindowItemStruct),
wind_attrs,
- 0, /* num_parts */
+ 0, /* num_parts */
ZN_CLASS_HAS_ANCHORS|ZN_CLASS_ONE_COORD, /* flags */
Tk_Offset(WindowItemStruct, pos),
Init,
@@ -668,25 +668,25 @@ static ZnItemClassStruct WINDOW_ITEM_CLASS = {
Destroy,
Configure,
Query,
- NULL, /* GetFieldSet */
+ NULL, /* GetFieldSet */
GetAnchor,
GetClipVertices,
- NULL, /* GetContours */
+ NULL, /* GetContours */
Coords,
- NULL, /* InsertChars */
- NULL, /* DeleteChars */
- NULL, /* Cursor */
- NULL, /* Index */
- NULL, /* Part */
- NULL, /* Selection */
- NULL, /* Contour */
+ NULL, /* InsertChars */
+ NULL, /* DeleteChars */
+ NULL, /* Cursor */
+ NULL, /* Index */
+ NULL, /* Part */
+ NULL, /* Selection */
+ NULL, /* Contour */
ComputeCoordinates,
ToArea,
Draw,
- Draw, /* Render use the same code as Draw. */
+ Draw, /* Render use the same code as Draw. */
IsSensitive,
Pick,
- NULL, /* PickVertex */
+ NULL, /* PickVertex */
PostScript
};
diff --git a/generic/perfos.c b/generic/perfos.c
index 1a0f57c..1156ea6 100644
--- a/generic/perfos.c
+++ b/generic/perfos.c
@@ -1,8 +1,8 @@
/*
* perfos.c -- Perfos modules.
*
- * Authors : Patrick Lecoanet.
- * Creation date :
+ * Authors : Patrick Lecoanet.
+ * Creation date :
*
* $Id$
*/
@@ -39,7 +39,7 @@ static const char rcsid[] = "$Id$";
static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ " $";
-static ZnList Chronos = NULL;
+static ZnList Chronos = NULL;
/*
@@ -50,8 +50,8 @@ static ZnList Chronos = NULL;
**********************************************************************************
*/
static void
-HardwareSynchronize(Display *test_display,
- Drawable test_window)
+HardwareSynchronize(Display *test_display,
+ Drawable test_window)
{
/*XImage *image;*/
@@ -68,14 +68,14 @@ HardwareSynchronize(Display *test_display,
**********************************************************************************
*
* GetUCTime - Return machine time. This is the sum of user and system
- * times for the process so far.
+ * times for the process so far.
*
**********************************************************************************
*/
static long
GetUCTime(void)
{
- struct tms time;
+ struct tms time;
times(&time);
return time.tms_utime + time.tms_stime;
@@ -119,7 +119,7 @@ XGetCurrentTime(Display *display, Drawable window)
*
* XCorrectionValue - Evaluate the correction value to apply
* to counter the client-server round trip
- * time.
+ * time.
*
**********************************************************************************
*/
@@ -238,8 +238,8 @@ ZnStopUCChrono(ZnChrono chrono)
void
ZnPrintChronos(void)
{
- int i, cnt;
- ZnChrono *chrs;
+ int i, cnt;
+ ZnChrono *chrs;
cnt = ZnListSize(Chronos);
chrs = (ZnChrono *) ZnListArray(Chronos);
@@ -262,9 +262,9 @@ ZnPrintChronos(void)
**********************************************************************************
*/
void
-ZnGetChrono(ZnChrono chrono,
- long *time,
- int *actions)
+ZnGetChrono(ZnChrono chrono,
+ long *time,
+ int *actions)
{
if (time) {
*time = chrono->total_delay*10;
@@ -283,10 +283,10 @@ ZnGetChrono(ZnChrono chrono,
**********************************************************************************
*/
void
-ZnResetChronos(ZnChrono chrono)
+ZnResetChronos(ZnChrono chrono)
{
- int i, cnt;
- ZnChrono *chrs;
+ int i, cnt;
+ ZnChrono *chrs;
if (chrono) {
chrono->actions = 0;
@@ -314,7 +314,7 @@ ZnResetChronos(ZnChrono chrono)
ZnChrono
ZnNewChrono(char *message)
{
- ZnChrono new;
+ ZnChrono new;
if (!Chronos) {
Chronos = ZnListNew(8, sizeof(ZnChrono));
@@ -338,9 +338,9 @@ ZnNewChrono(char *message)
**********************************************************************************
*/
void
-ZnFreeChrono(ZnChrono chrono)
+ZnFreeChrono(ZnChrono chrono)
{
- int i;
+ int i;
ZnChrono *chrs = ZnListArray(Chronos);
ZnFree(chrono);
diff --git a/generic/perfos.h b/generic/perfos.h
index 4fef0b6..23e30a6 100644
--- a/generic/perfos.h
+++ b/generic/perfos.h
@@ -1,8 +1,8 @@
/*
* perfos.h -- Header for perf module.
*
- * Authors : Patrick Lecoanet.
- * Creation date :
+ * Authors : Patrick Lecoanet.
+ * Creation date :
*
* $Id$
*/
diff --git a/generic/tkZinc.c b/generic/tkZinc.c
index f9ff6a7..c341518 100644
--- a/generic/tkZinc.c
+++ b/generic/tkZinc.c
@@ -1,8 +1,8 @@
/*
* tkZinc.c -- Zinc widget for the Tk Toolkit. Main module.
*
- * Authors : Patrick Lecoanet.
- * Creation date : Mon Feb 1 12:13:24 1999
+ * Authors : Patrick Lecoanet.
+ * Creation date : Mon Feb 1 12:13:24 1999
*
* $Id$
*/
@@ -74,12 +74,12 @@ static const char * const zinc_version = "zinc-version-" VERSION;
typedef struct _TagSearchExpr {
struct _TagSearchExpr *next; /* for linked lists of expressions - used in bindings */
- Tk_Uid uid; /* the uid of the whole expression */
- Tk_Uid *uids; /* expresion compiled to an array of uids */
- int allocated; /* available space for array of uids */
- int length; /* length of expression */
- int index; /* current position in expression evaluation */
- int match; /* this expression matches event's item's tags*/
+ Tk_Uid uid; /* the uid of the whole expression */
+ Tk_Uid *uids; /* expresion compiled to an array of uids */
+ int allocated; /* available space for array of uids */
+ int length; /* length of expression */
+ int index; /* current position in expression evaluation */
+ int match; /* this expression matches event's item's tags*/
} TagSearchExpr;
@@ -119,24 +119,24 @@ static unsigned char dither4x4[4][4] = {
static unsigned char bitmaps[ZN_NUM_ALPHA_STEPS][32][4];
-static Tk_Uid all_uid;
-static Tk_Uid current_uid;
-static Tk_Uid and_uid;
-static Tk_Uid or_uid;
-static Tk_Uid xor_uid;
-static Tk_Uid paren_uid;
-static Tk_Uid end_paren_uid;
-static Tk_Uid neg_paren_uid;
-static Tk_Uid tag_val_uid;
-static Tk_Uid neg_tag_val_uid;
-static Tk_Uid dot_uid;
-static Tk_Uid star_uid;
+static Tk_Uid all_uid;
+static Tk_Uid current_uid;
+static Tk_Uid and_uid;
+static Tk_Uid or_uid;
+static Tk_Uid xor_uid;
+static Tk_Uid paren_uid;
+static Tk_Uid end_paren_uid;
+static Tk_Uid neg_paren_uid;
+static Tk_Uid tag_val_uid;
+static Tk_Uid neg_tag_val_uid;
+static Tk_Uid dot_uid;
+static Tk_Uid star_uid;
#ifdef GL
-static ZnGLContextEntry *gl_contexts = NULL;
+static ZnGLContextEntry *gl_contexts = NULL;
#ifndef _WIN32
-static int ZnMajorGlx, ZnMinorGlx;
-static int ZnGLAttribs[] = {
+static int ZnMajorGlx, ZnMinorGlx;
+static int ZnGLAttribs[] = {
GLX_RGBA,
GLX_DOUBLEBUFFER,
GLX_RED_SIZE, 8,
@@ -153,77 +153,77 @@ static int ZnGLAttribs[] = {
/*
* Temporary object lists
*/
- ZnList ZnWorkPoints;
- ZnList ZnWorkXPoints;
- ZnList ZnWorkStrings;
+ ZnList ZnWorkPoints;
+ ZnList ZnWorkXPoints;
+ ZnList ZnWorkStrings;
/*
* Tesselator
*/
- ZnTess ZnTesselator;
+ ZnTess ZnTesselator;
static void PickCurrentItem _ANSI_ARGS_((ZnWInfo *wi, XEvent *event));
#ifdef PTK_800
-static int ZnReliefParse _ANSI_ARGS_((ClientData client_data, Tcl_Interp *interp,
- Tk_Window tkwin, Tcl_Obj *ovalue,
- char *widget_rec, int offset));
-static Tcl_Obj *ZnReliefPrint _ANSI_ARGS_((ClientData client_data, Tk_Window tkwin,
- char *widget_rec, int offset,
- Tcl_FreeProc **free_proc));
-static int ZnGradientParse _ANSI_ARGS_((ClientData client_data, Tcl_Interp *interp,
- Tk_Window tkwin, Tcl_Obj *ovalue,
- char *widget_rec, int offset));
-static Tcl_Obj *ZnGradientPrint _ANSI_ARGS_((ClientData client_data, Tk_Window tkwin,
- char *widget_rec, int offset,
- Tcl_FreeProc **free_proc));
-static int ZnImageParse _ANSI_ARGS_((ClientData client_data, Tcl_Interp *interp,
- Tk_Window tkwin, Tcl_Obj *ovalue,
- char *widget_rec, int offset));
-static int ZnBitmapParse _ANSI_ARGS_((ClientData client_data, Tcl_Interp *interp,
- Tk_Window tkwin, Tcl_Obj *ovalue,
- char *widget_rec, int offset));
-static Tcl_Obj *ZnImagePrint _ANSI_ARGS_((ClientData client_data, Tk_Window tkwin,
- char *widget_rec, int offset,
- Tcl_FreeProc **free_proc));
-static Tk_CustomOption reliefOption = {
+static int ZnReliefParse _ANSI_ARGS_((ClientData client_data, Tcl_Interp *interp,
+ Tk_Window tkwin, Tcl_Obj *ovalue,
+ char *widget_rec, int offset));
+static Tcl_Obj *ZnReliefPrint _ANSI_ARGS_((ClientData client_data, Tk_Window tkwin,
+ char *widget_rec, int offset,
+ Tcl_FreeProc **free_proc));
+static int ZnGradientParse _ANSI_ARGS_((ClientData client_data, Tcl_Interp *interp,
+ Tk_Window tkwin, Tcl_Obj *ovalue,
+ char *widget_rec, int offset));
+static Tcl_Obj *ZnGradientPrint _ANSI_ARGS_((ClientData client_data, Tk_Window tkwin,
+ char *widget_rec, int offset,
+ Tcl_FreeProc **free_proc));
+static int ZnImageParse _ANSI_ARGS_((ClientData client_data, Tcl_Interp *interp,
+ Tk_Window tkwin, Tcl_Obj *ovalue,
+ char *widget_rec, int offset));
+static int ZnBitmapParse _ANSI_ARGS_((ClientData client_data, Tcl_Interp *interp,
+ Tk_Window tkwin, Tcl_Obj *ovalue,
+ char *widget_rec, int offset));
+static Tcl_Obj *ZnImagePrint _ANSI_ARGS_((ClientData client_data, Tk_Window tkwin,
+ char *widget_rec, int offset,
+ Tcl_FreeProc **free_proc));
+static Tk_CustomOption reliefOption = {
(Tk_OptionParseProc *) ZnReliefParse,
(Tk_OptionPrintProc *) ZnReliefPrint,
NULL
};
-static Tk_CustomOption gradientOption = {
+static Tk_CustomOption gradientOption = {
(Tk_OptionParseProc *) ZnGradientParse,
(Tk_OptionPrintProc *) ZnGradientPrint,
NULL
};
-static Tk_CustomOption imageOption = {
+static Tk_CustomOption imageOption = {
(Tk_OptionParseProc *) ZnImageParse,
(Tk_OptionPrintProc *) ZnImagePrint,
NULL
};
-static Tk_CustomOption bitmapOption = {
+static Tk_CustomOption bitmapOption = {
(Tk_OptionParseProc *) ZnBitmapParse,
(Tk_OptionPrintProc *) ZnImagePrint,
NULL
};
#else
-static int ZnSetReliefOpt _ANSI_ARGS_((ClientData client_data, Tcl_Interp *interp,
- Tk_Window tkwin, Tcl_Obj **ovalue,
- char *widget_rec, int offset, char *old_val_ptr, int flags));
-static Tcl_Obj *ZnGetReliefOpt _ANSI_ARGS_((ClientData client_data, Tk_Window tkwin,
- char *widget_rec, int offset));
+static int ZnSetReliefOpt _ANSI_ARGS_((ClientData client_data, Tcl_Interp *interp,
+ Tk_Window tkwin, Tcl_Obj **ovalue,
+ char *widget_rec, int offset, char *old_val_ptr, int flags));
+static Tcl_Obj *ZnGetReliefOpt _ANSI_ARGS_((ClientData client_data, Tk_Window tkwin,
+ char *widget_rec, int offset));
static void ZnRestoreReliefOpt _ANSI_ARGS_((ClientData client_data, Tk_Window tkwin,
- char *val_ptr, char *old_val_ptr));
-static int ZnSetGradientOpt _ANSI_ARGS_((ClientData client_data, Tcl_Interp *interp,
- Tk_Window tkwin, Tcl_Obj **ovalue,
- char *widget_rec, int offset, char *old_val_ptr, int flags));
-static Tcl_Obj *ZnGetGradientOpt _ANSI_ARGS_((ClientData client_data, Tk_Window tkwin,
- char *widget_rec, int offset));
-static void ZnRestoreGradientOpt _ANSI_ARGS_((ClientData client_data, Tk_Window tkwin,
- char *val_ptr, char *old_val_ptr));
-static void ZnFreeGradientOpt _ANSI_ARGS_((ClientData client_data, Tk_Window tkwin, char *val_ptr));
-
-static Tk_ObjCustomOption reliefOption = {
+ char *val_ptr, char *old_val_ptr));
+static int ZnSetGradientOpt _ANSI_ARGS_((ClientData client_data, Tcl_Interp *interp,
+ Tk_Window tkwin, Tcl_Obj **ovalue,
+ char *widget_rec, int offset, char *old_val_ptr, int flags));
+static Tcl_Obj *ZnGetGradientOpt _ANSI_ARGS_((ClientData client_data, Tk_Window tkwin,
+ char *widget_rec, int offset));
+static void ZnRestoreGradientOpt _ANSI_ARGS_((ClientData client_data, Tk_Window tkwin,
+ char *val_ptr, char *old_val_ptr));
+static void ZnFreeGradientOpt _ANSI_ARGS_((ClientData client_data, Tk_Window tkwin, char *val_ptr));
+
+static Tk_ObjCustomOption reliefOption = {
"znrelief",
ZnSetReliefOpt,
ZnGetReliefOpt,
@@ -231,7 +231,7 @@ static Tk_ObjCustomOption reliefOption = {
NULL,
0
};
-static Tk_ObjCustomOption gradientOption = {
+static Tk_ObjCustomOption gradientOption = {
"zngradient",
ZnSetGradientOpt,
ZnGetGradientOpt,
@@ -242,64 +242,64 @@ static Tk_ObjCustomOption gradientOption = {
#endif
#ifdef PTK_800
-#define BORDER_WIDTH_SPEC 0
-#define BACK_COLOR_SPEC 1
-#define CONFINE_SPEC 2
-#define CURSOR_SPEC 3
-#define FONT_SPEC 4
-#define FORE_COLOR_SPEC 5
-#define FULL_RESHAPE_SPEC 6
-#define HEIGHT_SPEC 7
-#define HIGHLIGHT_BACK_COLOR_SPEC 8
-#define HIGHLIGHT_COLOR_SPEC 9
-#define HIGHLIGHT_THICKNESS_SPEC 10
-#define INSERT_COLOR_SPEC 11
-#define INSERT_OFF_TIME_SPEC 12
-#define INSERT_ON_TIME_SPEC 13
-#define INSERT_WIDTH_SPEC 14
-#define MAP_DISTANCE_SYMBOL_SPEC 15
-#define MAP_TEXT_FONT_SPEC 16
-#define OVERLAP_MANAGER_SPEC 17
-#define PICK_APERTURE_SPEC 18
-#define RELIEF_SPEC 19
-#define RENDER_SPEC 20
-#define RESHAPE_SPEC 21
-#define SCROLL_REGION_SPEC 22
-#define SELECT_COLOR_SPEC 23
-#define SPEED_VECTOR_LENGTH_SPEC 24
-#define TAKE_FOCUS_SPEC 25
-#define TILE_SPEC 26
-#define VISIBLE_HISTORY_SIZE_SPEC 27
-#define MANAGED_HISTORY_SIZE_SPEC 28
-#define TRACK_SYMBOL_SPEC 29
-#define WIDTH_SPEC 30
-#define X_SCROLL_CMD_SPEC 31
-#define X_SCROLL_INCREMENT_SPEC 32
-#define Y_SCROLL_CMD_SPEC 33
-#define Y_SCROLL_INCREMENT_SPEC 34
-#define BBOXES_SPEC 35
-#define BBOXES_COLOR_SPEC 36
-#define LIGHT_ANGLE_SPEC 37
-#define FOLLOW_POINTER_SPEC 38
+#define BORDER_WIDTH_SPEC 0
+#define BACK_COLOR_SPEC 1
+#define CONFINE_SPEC 2
+#define CURSOR_SPEC 3
+#define FONT_SPEC 4
+#define FORE_COLOR_SPEC 5
+#define FULL_RESHAPE_SPEC 6
+#define HEIGHT_SPEC 7
+#define HIGHLIGHT_BACK_COLOR_SPEC 8
+#define HIGHLIGHT_COLOR_SPEC 9
+#define HIGHLIGHT_THICKNESS_SPEC 10
+#define INSERT_COLOR_SPEC 11
+#define INSERT_OFF_TIME_SPEC 12
+#define INSERT_ON_TIME_SPEC 13
+#define INSERT_WIDTH_SPEC 14
+#define MAP_DISTANCE_SYMBOL_SPEC 15
+#define MAP_TEXT_FONT_SPEC 16
+#define OVERLAP_MANAGER_SPEC 17
+#define PICK_APERTURE_SPEC 18
+#define RELIEF_SPEC 19
+#define RENDER_SPEC 20
+#define RESHAPE_SPEC 21
+#define SCROLL_REGION_SPEC 22
+#define SELECT_COLOR_SPEC 23
+#define SPEED_VECTOR_LENGTH_SPEC 24
+#define TAKE_FOCUS_SPEC 25
+#define TILE_SPEC 26
+#define VISIBLE_HISTORY_SIZE_SPEC 27
+#define MANAGED_HISTORY_SIZE_SPEC 28
+#define TRACK_SYMBOL_SPEC 29
+#define WIDTH_SPEC 30
+#define X_SCROLL_CMD_SPEC 31
+#define X_SCROLL_INCREMENT_SPEC 32
+#define Y_SCROLL_CMD_SPEC 33
+#define Y_SCROLL_INCREMENT_SPEC 34
+#define BBOXES_SPEC 35
+#define BBOXES_COLOR_SPEC 36
+#define LIGHT_ANGLE_SPEC 37
+#define FOLLOW_POINTER_SPEC 38
#else
-#define CONFIG_FONT 1<<0
-#define CONFIG_MAP_FONT 1<<1
-#define CONFIG_BACK_COLOR 1<<2
-#define CONFIG_REDISPLAY 1<<3
-#define CONFIG_DAMAGE_ALL 1<<4
-#define CONFIG_INVALIDATE_TRACKS 1<<5
-#define CONFIG_INVALIDATE_WPS 1<<6
-#define CONFIG_INVALIDATE_MAPS 1<<7
-#define CONFIG_REQUEST_GEOM 1<<8
-#define CONFIG_OM 1<<9
-#define CONFIG_FOCUS 1<<10
-#define CONFIG_FOCUS_ITEM 1<<11
-#define CONFIG_SCROLL_REGION 1<<12
-#define CONFIG_SET_ORIGIN 1<<13
-#define CONFIG_FOLLOW_POINTER 1<<14
-#define CONFIG_MAP_SYMBOL 1<<15
-#define CONFIG_TRACK_SYMBOL 1<<16
-#define CONFIG_TILE 1<<17
+#define CONFIG_FONT 1<<0
+#define CONFIG_MAP_FONT 1<<1
+#define CONFIG_BACK_COLOR 1<<2
+#define CONFIG_REDISPLAY 1<<3
+#define CONFIG_DAMAGE_ALL 1<<4
+#define CONFIG_INVALIDATE_TRACKS 1<<5
+#define CONFIG_INVALIDATE_WPS 1<<6
+#define CONFIG_INVALIDATE_MAPS 1<<7
+#define CONFIG_REQUEST_GEOM 1<<8
+#define CONFIG_OM 1<<9
+#define CONFIG_FOCUS 1<<10
+#define CONFIG_FOCUS_ITEM 1<<11
+#define CONFIG_SCROLL_REGION 1<<12
+#define CONFIG_SET_ORIGIN 1<<13
+#define CONFIG_FOLLOW_POINTER 1<<14
+#define CONFIG_MAP_SYMBOL 1<<15
+#define CONFIG_TRACK_SYMBOL 1<<16
+#define CONFIG_TILE 1<<17
#endif
/*
@@ -513,27 +513,27 @@ static Tk_OptionSpec option_specs[] = {
};
#endif
-static void CmdDeleted _ANSI_ARGS_((ClientData client_data));
-static void Event _ANSI_ARGS_((ClientData client_data, XEvent *eventPtr));
-static void Bind _ANSI_ARGS_((ClientData client_data, XEvent *eventPtr));
-static int FetchSelection _ANSI_ARGS_((ClientData clientData, int offset,
- char *buffer, int maxBytes));
-static void SelectTo _ANSI_ARGS_((ZnItem item, int field, int index));
-static int WidgetObjCmd _ANSI_ARGS_((ClientData client_data,
- Tcl_Interp *, int argc, Tcl_Obj *CONST args[]));
+static void CmdDeleted _ANSI_ARGS_((ClientData client_data));
+static void Event _ANSI_ARGS_((ClientData client_data, XEvent *eventPtr));
+static void Bind _ANSI_ARGS_((ClientData client_data, XEvent *eventPtr));
+static int FetchSelection _ANSI_ARGS_((ClientData clientData, int offset,
+ char *buffer, int maxBytes));
+static void SelectTo _ANSI_ARGS_((ZnItem item, int field, int index));
+static int WidgetObjCmd _ANSI_ARGS_((ClientData client_data,
+ Tcl_Interp *, int argc, Tcl_Obj *CONST args[]));
#ifdef PTK_800
-static int Configure _ANSI_ARGS_((Tcl_Interp *interp, ZnWInfo *wi,
- int argc, Tcl_Obj *CONST args[], int flags));
+static int Configure _ANSI_ARGS_((Tcl_Interp *interp, ZnWInfo *wi,
+ int argc, Tcl_Obj *CONST args[], int flags));
#else
-static int Configure _ANSI_ARGS_((Tcl_Interp *interp, ZnWInfo *wi,
- int argc, Tcl_Obj *CONST args[]));
+static int Configure _ANSI_ARGS_((Tcl_Interp *interp, ZnWInfo *wi,
+ int argc, Tcl_Obj *CONST args[]));
#endif
-static void Redisplay _ANSI_ARGS_((ClientData client_data));
-static void Destroy _ANSI_ARGS_((char *mem_ptr));
-static void InitZinc _ANSI_ARGS_((Tcl_Interp *interp));
-static void Focus _ANSI_ARGS_((ZnWInfo *wi, ZnBool got_focus));
-static void Update _ANSI_ARGS_((ZnWInfo *wi));
-static void Repair _ANSI_ARGS_((ZnWInfo *wi));
+static void Redisplay _ANSI_ARGS_((ClientData client_data));
+static void Destroy _ANSI_ARGS_((char *mem_ptr));
+static void InitZinc _ANSI_ARGS_((Tcl_Interp *interp));
+static void Focus _ANSI_ARGS_((ZnWInfo *wi, ZnBool got_focus));
+static void Update _ANSI_ARGS_((ZnWInfo *wi));
+static void Repair _ANSI_ARGS_((ZnWInfo *wi));
#ifdef PTK_800
@@ -542,22 +542,22 @@ static void Repair _ANSI_ARGS_((ZnWInfo *wi));
*
* ZnReliefParse
* ZnReliefPrint --
- * Converter for the -relief option.
+ * Converter for the -relief option.
*
*----------------------------------------------------------------------
*/
static int
-ZnReliefParse(ClientData client_data,
- Tcl_Interp *interp,
- Tk_Window tkwin,
- Tcl_Obj *ovalue,
- char *widget_rec,
- int offset)
+ZnReliefParse(ClientData client_data,
+ Tcl_Interp *interp,
+ Tk_Window tkwin,
+ Tcl_Obj *ovalue,
+ char *widget_rec,
+ int offset)
{
ZnReliefStyle *relief_ptr = (ZnReliefStyle *) (widget_rec + offset);
ZnReliefStyle relief;
- char *value = Tcl_GetString(ovalue);
- int result = TCL_OK;
+ char *value = Tcl_GetString(ovalue);
+ int result = TCL_OK;
if (value != NULL) {
result = ZnGetRelief((ZnWInfo *) widget_rec, value, &relief);
@@ -569,11 +569,11 @@ ZnReliefParse(ClientData client_data,
}
static Tcl_Obj *
-ZnReliefPrint(ClientData client_data,
- Tk_Window tkwin,
- char *widget_rec,
- int offset,
- Tcl_FreeProc **free_proc)
+ZnReliefPrint(ClientData client_data,
+ Tk_Window tkwin,
+ char *widget_rec,
+ int offset,
+ Tcl_FreeProc **free_proc)
{
ZnReliefStyle relief = *(ZnReliefStyle *) (widget_rec + offset);
return Tcl_NewStringObj(ZnNameOfRelief(relief), -1);
@@ -585,21 +585,21 @@ ZnReliefPrint(ClientData client_data,
*
* ZnGradientParse
* ZnGradientPrint --
- * Converter for the -*color* options.
+ * Converter for the -*color* options.
*
*----------------------------------------------------------------------
*/
static int
-ZnGradientParse(ClientData client_data,
- Tcl_Interp *interp,
- Tk_Window tkwin,
- Tcl_Obj *ovalue,
- char *widget_rec,
- int offset)
+ZnGradientParse(ClientData client_data,
+ Tcl_Interp *interp,
+ Tk_Window tkwin,
+ Tcl_Obj *ovalue,
+ char *widget_rec,
+ int offset)
{
- ZnGradient **grad_ptr = (ZnGradient **) (widget_rec + offset);
- ZnGradient *grad, *prev_grad;
- char *value = Tcl_GetString(ovalue);
+ ZnGradient **grad_ptr = (ZnGradient **) (widget_rec + offset);
+ ZnGradient *grad, *prev_grad;
+ char *value = Tcl_GetString(ovalue);
prev_grad = *grad_ptr;
if ((value != NULL) && (*value != '\0')) {
@@ -616,11 +616,11 @@ ZnGradientParse(ClientData client_data,
}
static Tcl_Obj *
-ZnGradientPrint(ClientData client_data,
- Tk_Window tkwin,
- char *widget_rec,
- int offset,
- Tcl_FreeProc **free_proc)
+ZnGradientPrint(ClientData client_data,
+ Tk_Window tkwin,
+ char *widget_rec,
+ int offset,
+ Tcl_FreeProc **free_proc)
{
ZnGradient *gradient = *(ZnGradient **) (widget_rec + offset);
return Tcl_NewStringObj(ZnNameOfGradient(gradient), -1);
@@ -633,31 +633,31 @@ ZnGradientPrint(ClientData client_data,
* ZnBitmapParse
* ZnImageParse
* ZnImagePrint --
- * Converter for the -*image* options.
+ * Converter for the -*image* options.
*
*----------------------------------------------------------------------
*/
static int
-ZnBitmapParse(ClientData client_data,
- Tcl_Interp *interp,
- Tk_Window tkwin,
- Tcl_Obj *ovalue,
- char *widget_rec,
- int offset)
+ZnBitmapParse(ClientData client_data,
+ Tcl_Interp *interp,
+ Tk_Window tkwin,
+ Tcl_Obj *ovalue,
+ char *widget_rec,
+ int offset)
{
- ZnImage *image_ptr = (ZnImage *) (widget_rec + offset);
- ZnImage image, prev_image;
- char *value = Tcl_GetString(ovalue);
- ZnWInfo *wi = (ZnWInfo*) widget_rec;
- ZnBool is_bmap = True;
+ ZnImage *image_ptr = (ZnImage *) (widget_rec + offset);
+ ZnImage image, prev_image;
+ char *value = Tcl_GetString(ovalue);
+ ZnWInfo *wi = (ZnWInfo*) widget_rec;
+ ZnBool is_bmap = True;
prev_image = *image_ptr;
if ((value != NULL) && (*value != '\0')) {
image = ZnGetImage(wi, value, NULL, NULL);
if ((image == ZnUnspecifiedImage) ||
- ! (is_bmap = ZnImageIsBitmap(image))) {
+ ! (is_bmap = ZnImageIsBitmap(image))) {
if (!is_bmap) {
- ZnFreeImage(image, NULL, NULL);
+ ZnFreeImage(image, NULL, NULL);
}
return TCL_ERROR;
}
@@ -683,17 +683,17 @@ ZnImageUpdate(void *client_data)
}
static int
-ZnImageParse(ClientData client_data,
- Tcl_Interp *interp,
- Tk_Window tkwin,
- Tcl_Obj *ovalue,
- char *widget_rec,
- int offset)
+ZnImageParse(ClientData client_data,
+ Tcl_Interp *interp,
+ Tk_Window tkwin,
+ Tcl_Obj *ovalue,
+ char *widget_rec,
+ int offset)
{
- ZnImage *image_ptr = (ZnImage *) (widget_rec + offset);
- ZnImage image, prev_image;
- char *value = Tcl_GetString(ovalue);
- ZnWInfo *wi = (ZnWInfo*) widget_rec;
+ ZnImage *image_ptr = (ZnImage *) (widget_rec + offset);
+ ZnImage image, prev_image;
+ char *value = Tcl_GetString(ovalue);
+ ZnWInfo *wi = (ZnWInfo*) widget_rec;
prev_image = *image_ptr;
if ((value != NULL) && (*value != '\0')) {
@@ -714,11 +714,11 @@ ZnImageParse(ClientData client_data,
}
static Tcl_Obj *
-ZnImagePrint(ClientData client_data,
- Tk_Window tkwin,
- char *widget_rec,
- int offset,
- Tcl_FreeProc **free_proc)
+ZnImagePrint(ClientData client_data,
+ Tk_Window tkwin,
+ char *widget_rec,
+ int offset,
+ Tcl_FreeProc **free_proc)
{
ZnImage image = *(ZnImage *) (widget_rec + offset);
return Tcl_NewStringObj(image?ZnNameOfImage(image):"", -1);
@@ -730,23 +730,23 @@ ZnImagePrint(ClientData client_data,
* ZnSetReliefOpt
* ZnGetReliefOpt
* ZnRestoreReliefOpt --
- * Converter for the -relief option.
+ * Converter for the -relief option.
*
*----------------------------------------------------------------------
*/
static int
-ZnSetReliefOpt(ClientData client_data,
- Tcl_Interp *interp,
- Tk_Window tkwin,
- Tcl_Obj **ovalue,
- char *widget_rec,
- int offset,
- char *old_val_ptr,
- int flags)
+ZnSetReliefOpt(ClientData client_data,
+ Tcl_Interp *interp,
+ Tk_Window tkwin,
+ Tcl_Obj **ovalue,
+ char *widget_rec,
+ int offset,
+ char *old_val_ptr,
+ int flags)
{
ZnReliefStyle *relief_ptr;
ZnReliefStyle relief;
- char *value = Tcl_GetString(*ovalue);
+ char *value = Tcl_GetString(*ovalue);
if (ZnGetRelief((ZnWInfo *) widget_rec, value, &relief) == TCL_ERROR) {
return TCL_ERROR;
@@ -760,20 +760,20 @@ ZnSetReliefOpt(ClientData client_data,
}
static Tcl_Obj *
-ZnGetReliefOpt(ClientData client_data,
- Tk_Window tkwin,
- char *widget_rec,
- int offset)
+ZnGetReliefOpt(ClientData client_data,
+ Tk_Window tkwin,
+ char *widget_rec,
+ int offset)
{
ZnReliefStyle relief = *(ZnReliefStyle *) (widget_rec + offset);
return Tcl_NewStringObj(ZnNameOfRelief(relief), -1);
}
static void
-ZnRestoreReliefOpt(ClientData client_data,
- Tk_Window tkwin,
- char *val_ptr,
- char *old_val_ptr)
+ZnRestoreReliefOpt(ClientData client_data,
+ Tk_Window tkwin,
+ char *val_ptr,
+ char *old_val_ptr)
{
*(ZnReliefStyle *) val_ptr = *(ZnReliefStyle *) old_val_ptr;
}
@@ -784,23 +784,23 @@ ZnRestoreReliefOpt(ClientData client_data,
* ZnSetGradientOpt
* ZnGetGradientOpt
* ZnRestoreGradientOpt --
- * Converter for the -*color* options.
+ * Converter for the -*color* options.
*
*----------------------------------------------------------------------
*/
static int
-ZnSetGradientOpt(ClientData client_data,
- Tcl_Interp *interp,
- Tk_Window tkwin,
- Tcl_Obj **ovalue,
- char *widget_rec,
- int offset,
- char *old_val_ptr,
- int flags)
+ZnSetGradientOpt(ClientData client_data,
+ Tcl_Interp *interp,
+ Tk_Window tkwin,
+ Tcl_Obj **ovalue,
+ char *widget_rec,
+ int offset,
+ char *old_val_ptr,
+ int flags)
{
- ZnGradient **grad_ptr;
- ZnGradient *grad;
- char *value = Tcl_GetString(*ovalue);
+ ZnGradient **grad_ptr;
+ ZnGradient *grad;
+ char *value = Tcl_GetString(*ovalue);
if (offset >= 0) {
if (*value == '\0') {
@@ -809,7 +809,7 @@ ZnSetGradientOpt(ClientData client_data,
else {
grad = ZnGetGradient(interp, tkwin, value);
if (grad == NULL) {
- return TCL_ERROR;
+ return TCL_ERROR;
}
}
grad_ptr = (ZnGradient **) (widget_rec + offset);
@@ -820,20 +820,20 @@ ZnSetGradientOpt(ClientData client_data,
}
static Tcl_Obj *
-ZnGetGradientOpt(ClientData client_data,
- Tk_Window tkwin,
- char *widget_rec,
- int offset)
+ZnGetGradientOpt(ClientData client_data,
+ Tk_Window tkwin,
+ char *widget_rec,
+ int offset)
{
ZnGradient *gradient = *(ZnGradient **) (widget_rec + offset);
return Tcl_NewStringObj(ZnNameOfGradient(gradient), -1);
}
static void
-ZnRestoreGradientOpt(ClientData client_data,
- Tk_Window tkwin,
- char *val_ptr,
- char *old_val_ptr)
+ZnRestoreGradientOpt(ClientData client_data,
+ Tk_Window tkwin,
+ char *val_ptr,
+ char *old_val_ptr)
{
if (*(ZnGradient **) val_ptr != NULL) {
ZnFreeGradient(*(ZnGradient **) val_ptr);
@@ -842,9 +842,9 @@ ZnRestoreGradientOpt(ClientData client_data,
}
static void
-ZnFreeGradientOpt(ClientData client_data,
- Tk_Window tkwin,
- char *val_ptr)
+ZnFreeGradientOpt(ClientData client_data,
+ Tk_Window tkwin,
+ char *val_ptr)
{
if (*(ZnGradient **) val_ptr != NULL) {
ZnFreeGradient(*(ZnGradient **) val_ptr);
@@ -857,14 +857,14 @@ ZnFreeGradientOpt(ClientData client_data,
*----------------------------------------------------------------------
*
* ZnGetAlphaStipple --
- * Need to be handled per screen/dpy toolkit wide, not on a
- * widget basis.
+ * Need to be handled per screen/dpy toolkit wide, not on a
+ * widget basis.
*
*----------------------------------------------------------------------
*/
static Pixmap
-ZnGetAlphaStipple(ZnWInfo *wi,
- unsigned int val)
+ZnGetAlphaStipple(ZnWInfo *wi,
+ unsigned int val)
{
if (val >= 255)
return None;
@@ -880,7 +880,7 @@ ZnGetAlphaStipple(ZnWInfo *wi,
*----------------------------------------------------------------------
*/
Pixmap
-ZnGetInactiveStipple(ZnWInfo *wi)
+ZnGetInactiveStipple(ZnWInfo *wi)
{
return ZnGetAlphaStipple(wi, 128);
}
@@ -894,7 +894,7 @@ ZnGetInactiveStipple(ZnWInfo *wi)
*----------------------------------------------------------------------
*/
void
-ZnNeedRedisplay(ZnWInfo *wi)
+ZnNeedRedisplay(ZnWInfo *wi)
{
if (ISCLEAR(wi->flags, ZN_UPDATE_PENDING) && ISSET(wi->flags, ZN_REALIZED)) {
/*printf("scheduling an update\n");*/
@@ -924,8 +924,8 @@ ZnGetGLContext(Display *dpy)
}
ZnGLContextEntry *
-ZnGLMakeCurrent(Display *dpy,
- ZnWInfo *wi)
+ZnGLMakeCurrent(Display *dpy,
+ ZnWInfo *wi)
{
ZnGLContextEntry *ce;
@@ -942,12 +942,12 @@ ZnGLMakeCurrent(Display *dpy,
* textures.
*/
ZnWInfo **wip = ZnListArray(ce->widgets);
- int i, num = ZnListSize(ce->widgets);
+ int i, num = ZnListSize(ce->widgets);
for (i = 0; i <num; i++, wip++) {
if ((*wip)->win != NULL) {
- wi = *wip;
- break;
+ wi = *wip;
+ break;
}
}
if (!wi) {
@@ -983,7 +983,7 @@ ZnGLReleaseContext(ZnGLContextEntry *ce)
static void
ZnGLSwapBuffers(ZnGLContextEntry *ce,
- ZnWInfo *wi)
+ ZnWInfo *wi)
{
if (ce) {
#ifdef _WIN32
@@ -998,15 +998,15 @@ ZnGLSwapBuffers(ZnGLContextEntry *ce,
#ifdef GL
static void
-InitRendering1(ZnWInfo *wi)
+InitRendering1(ZnWInfo *wi)
{
if (wi->render) {
# ifndef _WIN32
- ZnGLContextEntry *ce;
- ZnGLContext gl_context;
+ ZnGLContextEntry *ce;
+ ZnGLContext gl_context;
XVisualInfo *gl_visual = NULL;
- Colormap colormap = 0;
+ Colormap colormap = 0;
ASSIGN(wi->flags, ZN_PRINT_CONFIG, (getenv("ZINC_GLX_INFO") != NULL));
@@ -1028,56 +1028,56 @@ InitRendering1(ZnWInfo *wi)
int val;
gl_visual = glXChooseVisual(wi->dpy,
- XScreenNumberOfScreen(wi->screen),
- ZnGLAttribs);
+ XScreenNumberOfScreen(wi->screen),
+ ZnGLAttribs);
if (!gl_visual) {
- fprintf(stderr, "No glx visual\n");
+ fprintf(stderr, "No glx visual\n");
}
else {
- gl_context = glXCreateContext(wi->dpy, gl_visual,
- NULL, wi->render==1);
- if (!gl_context) {
- fprintf(stderr, "No glx context\n");
- }
- else {
- colormap = XCreateColormap(wi->dpy, RootWindowOfScreen(wi->screen),
- gl_visual->visual, AllocNone);
- ce = ZnMalloc(sizeof(ZnGLContextEntry));
- ce->context = gl_context;
- ce->visual = gl_visual;
- ce->colormap = colormap;
- ce->dpy = wi->dpy;
- ce->max_tex_size = 64; /* Minimum value is always valid */
- ce->max_line_width = 1;
- ce->max_point_width = 1;
- ce->next = gl_contexts;
- gl_contexts = ce;
- ce->widgets = ZnListNew(1, sizeof(ZnWInfo *));
- ZnListAdd(ce->widgets, &wi, ZnListTail);
-
- if (ISSET(wi->flags, ZN_PRINT_CONFIG)) {
- fprintf(stderr, " Visual : 0x%x, ",
- (int) gl_visual->visualid);
- glXGetConfig(wi->dpy, gl_visual, GLX_RGBA, &val);
- fprintf(stderr, "RGBA : %d, ", val);
- glXGetConfig(wi->dpy, gl_visual, GLX_DOUBLEBUFFER, &val);
- fprintf(stderr, "Double Buffer : %d, ", val);
- glXGetConfig(wi->dpy, gl_visual, GLX_STENCIL_SIZE, &val);
- fprintf(stderr, "Stencil : %d, ", val);
- glXGetConfig(wi->dpy, gl_visual, GLX_BUFFER_SIZE, &val);
- fprintf(stderr, "depth : %d, ", val);
- glXGetConfig(wi->dpy, gl_visual, GLX_RED_SIZE, &val);
- fprintf(stderr, "red : %d, ", val);
- glXGetConfig(wi->dpy, gl_visual, GLX_GREEN_SIZE, &val);
- fprintf(stderr, "green : %d, ", val);
- glXGetConfig(wi->dpy, gl_visual, GLX_BLUE_SIZE, &val);
- fprintf(stderr, "blue : %d, ", val);
- glXGetConfig(wi->dpy, gl_visual, GLX_ALPHA_SIZE, &val);
- fprintf(stderr, "alpha : %d\n", val);
- fprintf(stderr, " Direct Rendering: %d\n",
- glXIsDirect(wi->dpy, gl_context));
- }
- }
+ gl_context = glXCreateContext(wi->dpy, gl_visual,
+ NULL, wi->render==1);
+ if (!gl_context) {
+ fprintf(stderr, "No glx context\n");
+ }
+ else {
+ colormap = XCreateColormap(wi->dpy, RootWindowOfScreen(wi->screen),
+ gl_visual->visual, AllocNone);
+ ce = ZnMalloc(sizeof(ZnGLContextEntry));
+ ce->context = gl_context;
+ ce->visual = gl_visual;
+ ce->colormap = colormap;
+ ce->dpy = wi->dpy;
+ ce->max_tex_size = 64; /* Minimum value is always valid */
+ ce->max_line_width = 1;
+ ce->max_point_width = 1;
+ ce->next = gl_contexts;
+ gl_contexts = ce;
+ ce->widgets = ZnListNew(1, sizeof(ZnWInfo *));
+ ZnListAdd(ce->widgets, &wi, ZnListTail);
+
+ if (ISSET(wi->flags, ZN_PRINT_CONFIG)) {
+ fprintf(stderr, " Visual : 0x%x, ",
+ (int) gl_visual->visualid);
+ glXGetConfig(wi->dpy, gl_visual, GLX_RGBA, &val);
+ fprintf(stderr, "RGBA : %d, ", val);
+ glXGetConfig(wi->dpy, gl_visual, GLX_DOUBLEBUFFER, &val);
+ fprintf(stderr, "Double Buffer : %d, ", val);
+ glXGetConfig(wi->dpy, gl_visual, GLX_STENCIL_SIZE, &val);
+ fprintf(stderr, "Stencil : %d, ", val);
+ glXGetConfig(wi->dpy, gl_visual, GLX_BUFFER_SIZE, &val);
+ fprintf(stderr, "depth : %d, ", val);
+ glXGetConfig(wi->dpy, gl_visual, GLX_RED_SIZE, &val);
+ fprintf(stderr, "red : %d, ", val);
+ glXGetConfig(wi->dpy, gl_visual, GLX_GREEN_SIZE, &val);
+ fprintf(stderr, "green : %d, ", val);
+ glXGetConfig(wi->dpy, gl_visual, GLX_BLUE_SIZE, &val);
+ fprintf(stderr, "blue : %d, ", val);
+ glXGetConfig(wi->dpy, gl_visual, GLX_ALPHA_SIZE, &val);
+ fprintf(stderr, "alpha : %d\n", val);
+ fprintf(stderr, " Direct Rendering: %d\n",
+ glXIsDirect(wi->dpy, gl_context));
+ }
+ }
}
}
if (gl_visual && colormap) {
@@ -1088,12 +1088,12 @@ InitRendering1(ZnWInfo *wi)
}
static void
-InitRendering2(ZnWInfo *wi)
+InitRendering2(ZnWInfo *wi)
{
- ZnGLContextEntry *ce;
- ZnGLContext gl_context;
- GLfloat r[2]; /* Min, Max */
- GLint i[1];
+ ZnGLContextEntry *ce;
+ ZnGLContext gl_context;
+ GLfloat r[2]; /* Min, Max */
+ GLint i[1];
if (wi->render) {
# ifdef _WIN32
@@ -1128,34 +1128,34 @@ InitRendering2(ZnWInfo *wi)
ce->pfd.iLayerType = PFD_MAIN_PLANE;
ce->ipixel = ChoosePixelFormat(ce->hdc, &ce->pfd);
/*printf("ipixel=%d dwFlags=0x%x req=0x%x iPixelType=%d hdc=%d\n",
- ce->ipixel, ce->pfd.dwFlags,
- PFD_DRAW_TO_WINDOW|PFD_SUPPORT_OPENGL|PFD_DOUBLEBUFFER,
- ce->pfd.iPixelType==PFD_TYPE_RGBA,
- ce->hdc);*/
+ ce->ipixel, ce->pfd.dwFlags,
+ PFD_DRAW_TO_WINDOW|PFD_SUPPORT_OPENGL|PFD_DOUBLEBUFFER,
+ ce->pfd.iPixelType==PFD_TYPE_RGBA,
+ ce->hdc);*/
if (!ce->ipixel ||
- (ce->pfd.cRedBits != 8) || (ce->pfd.cGreenBits != 8) || (ce->pfd.cBlueBits != 8) ||
- (ce->pfd.cStencilBits != 8)) {
- fprintf(stderr, "ChoosePixelFormat failed\n");
+ (ce->pfd.cRedBits != 8) || (ce->pfd.cGreenBits != 8) || (ce->pfd.cBlueBits != 8) ||
+ (ce->pfd.cStencilBits != 8)) {
+ fprintf(stderr, "ChoosePixelFormat failed\n");
}
if (SetPixelFormat(ce->hdc, ce->ipixel, &ce->pfd) == TRUE) {
- gl_context = wglCreateContext(ce->hdc);
- if (gl_context) {
- ce->context = gl_context;
- ce->dpy = wi->dpy;
- ce->max_tex_size = 64; /* Minimum value is always valid */
- ce->max_line_width = 1;
- ce->max_point_width = 1;
- ce->next = gl_contexts;
- gl_contexts = ce;
- }
- else {
- fprintf(stderr, "wglCreateContext failed\n");
- ZnFree(ce);
- }
+ gl_context = wglCreateContext(ce->hdc);
+ if (gl_context) {
+ ce->context = gl_context;
+ ce->dpy = wi->dpy;
+ ce->max_tex_size = 64; /* Minimum value is always valid */
+ ce->max_line_width = 1;
+ ce->max_point_width = 1;
+ ce->next = gl_contexts;
+ gl_contexts = ce;
+ }
+ else {
+ fprintf(stderr, "wglCreateContext failed\n");
+ ZnFree(ce);
+ }
}
else {
- ZnFree(ce);
+ ZnFree(ce);
}
}
ReleaseDC(ce->hwnd, ce->hdc);
@@ -1171,19 +1171,19 @@ InitRendering2(ZnWInfo *wi)
if (ISSET(wi->flags, ZN_PRINT_CONFIG)) {
fprintf(stderr, "OpenGL version %s\n",
- (char *) glGetString(GL_VERSION));
+ (char *) glGetString(GL_VERSION));
fprintf(stderr, " Rendering engine: %s, ",
- (char *) glGetString(GL_RENDERER));
+ (char *) glGetString(GL_RENDERER));
fprintf(stderr, " Vendor: %s\n",
- (char *) glGetString(GL_VENDOR));
+ (char *) glGetString(GL_VENDOR));
fprintf(stderr, " Available extensions: %s\n",
- (char *) glGetString(GL_EXTENSIONS));
+ (char *) glGetString(GL_EXTENSIONS));
fprintf(stderr, "Max antialiased line width: %g\n",
- ce->max_line_width);
+ ce->max_line_width);
fprintf(stderr, "Max antialiased point size: %g\n",
- ce->max_point_width);
+ ce->max_point_width);
fprintf(stderr, "Max texture size: %d\n",
- ce->max_tex_size);
+ ce->max_tex_size);
}
ZnGLReleaseContext(ce);
@@ -1197,33 +1197,33 @@ InitRendering2(ZnWInfo *wi)
*
* ZincObjCmd --
*
- * This procedure is invoked to process the "zinc" Tcl
- * command. It creates a new "zinc" widget.
+ * This procedure is invoked to process the "zinc" Tcl
+ * command. It creates a new "zinc" widget.
*
*----------------------------------------------------------------------
*/
int
-ZincObjCmd(ClientData client_data, /* Main window associated with
- * interpreter. */
- Tcl_Interp *interp, /* Current interpreter. */
- int argc, /* Number of arguments. */
- Tcl_Obj *CONST args[]) /* Argument strings. */
+ZincObjCmd(ClientData client_data, /* Main window associated with
+ * interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int argc, /* Number of arguments. */
+ Tcl_Obj *CONST args[]) /* Argument strings. */
{
- Tk_Window top_w = (Tk_Window) client_data;
- ZnWInfo *wi;
- Tk_Window tkwin;
+ Tk_Window top_w = (Tk_Window) client_data;
+ ZnWInfo *wi;
+ Tk_Window tkwin;
#ifndef PTK_800
Tk_OptionTable opt_table;
#endif
- unsigned int num;
- ZnBool has_gl = False;
+ unsigned int num;
+ ZnBool has_gl = False;
#ifndef _WIN32
# if defined(GL) || defined(SHAPE)
- int major_op, first_err, first_evt;
+ int major_op, first_err, first_evt;
# endif
# ifdef GL
- Display *dpy = Tk_Display(top_w);
- Screen *screen = Tk_Screen(top_w);
+ Display *dpy = Tk_Display(top_w);
+ Screen *screen = Tk_Screen(top_w);
# endif
#endif
@@ -1236,16 +1236,16 @@ ZincObjCmd(ClientData client_data, /* Main window associated with
if (XQueryExtension(dpy, "GLX", &major_op, &first_evt, &first_err)) {
if (glXQueryExtension(dpy, &first_err, &first_evt)) {
if (glXQueryVersion(dpy, &ZnMajorGlx, &ZnMinorGlx)) {
- if ((ZnMajorGlx == 1) && (ZnMinorGlx >= 1)) {
- has_gl = True;
- }
+ if ((ZnMajorGlx == 1) && (ZnMinorGlx >= 1)) {
+ has_gl = True;
+ }
}
}
}
if (has_gl) {
XVisualInfo *visual = glXChooseVisual(dpy,
- XScreenNumberOfScreen(screen),
- ZnGLAttribs);
+ XScreenNumberOfScreen(screen),
+ ZnGLAttribs);
if (visual) {
XFree(visual);
}
@@ -1297,7 +1297,7 @@ ZincObjCmd(ClientData client_data, /* Main window associated with
ASSIGN(wi->flags, ZN_HAS_GL, has_gl);
#if defined(SHAPE) && !defined(_WIN32)
ASSIGN(wi->flags, ZN_HAS_X_SHAPE,
- XQueryExtension(wi->dpy, "SHAPE", &major_op, &first_evt, &first_err));
+ XQueryExtension(wi->dpy, "SHAPE", &major_op, &first_evt, &first_err));
wi->reshape = wi->full_reshape = True;
#else
CLEAR(wi->flags, ZN_HAS_X_SHAPE);
@@ -1307,13 +1307,13 @@ ZincObjCmd(ClientData client_data, /* Main window associated with
#ifdef PTK
#ifdef PTK_800
wi->cmd = Lang_CreateWidget(interp, tkwin, (Tcl_CmdProc *) WidgetObjCmd,
- (ClientData) wi, CmdDeleted);
+ (ClientData) wi, CmdDeleted);
#else
wi->cmd = Lang_CreateWidget(interp, tkwin, WidgetObjCmd, (ClientData) wi, CmdDeleted);
#endif
#else
wi->cmd = Tcl_CreateObjCommand(interp, Tk_PathName(tkwin), WidgetObjCmd,
- (ClientData) wi, CmdDeleted);
+ (ClientData) wi, CmdDeleted);
#endif
#ifndef PTK_800
wi->opt_table = opt_table;
@@ -1422,21 +1422,21 @@ ZincObjCmd(ClientData client_data, /* Main window associated with
ZnInitTransformStack(wi);
for (num = 0; num < ZN_NUM_ALPHA_STEPS; num++) {
- char name[TCL_INTEGER_SPACE+12];
+ char name[TCL_INTEGER_SPACE+12];
sprintf(name, "AlphaStipple%d", num);
wi->alpha_stipples[num] = Tk_GetBitmap(interp, tkwin, Tk_GetUid(name));
}
Tk_CreateEventHandler(tkwin,
- ExposureMask|StructureNotifyMask|FocusChangeMask,
- Event, (ClientData) wi);
+ ExposureMask|StructureNotifyMask|FocusChangeMask,
+ Event, (ClientData) wi);
Tk_CreateEventHandler(tkwin, KeyPressMask|KeyReleaseMask|
- ButtonPressMask|ButtonReleaseMask|EnterWindowMask|
- LeaveWindowMask|PointerMotionMask|VirtualEventMask,
- Bind, (ClientData) wi);
+ ButtonPressMask|ButtonReleaseMask|EnterWindowMask|
+ LeaveWindowMask|PointerMotionMask|VirtualEventMask,
+ Bind, (ClientData) wi);
Tk_CreateSelHandler(tkwin, XA_PRIMARY, XA_STRING,
- FetchSelection, (ClientData) wi, XA_STRING);
+ FetchSelection, (ClientData) wi, XA_STRING);
#ifdef PTK_800
if (Configure(interp, wi, argc-2, args+2, 0) != TCL_OK) {
@@ -1464,7 +1464,7 @@ ZincObjCmd(ClientData client_data, /* Main window associated with
* Allocate double buffer pixmap/image.
*/
wi->draw_buffer = Tk_GetPixmap(wi->dpy, RootWindowOfScreen(wi->screen),
- wi->width, wi->height, Tk_Depth(wi->win));
+ wi->width, wi->height, Tk_Depth(wi->win));
}
#ifdef GL
else {
@@ -1486,14 +1486,14 @@ ZincObjCmd(ClientData client_data, /* Main window associated with
*
* EncodeItemPart --
*
- * Form a ClientData value from an item/part that is suitable
- * as a key in a binding table.
+ * Form a ClientData value from an item/part that is suitable
+ * as a key in a binding table.
*
*----------------------------------------------------------------------
*/
ClientData
-EncodeItemPart(ZnItem item,
- int part)
+EncodeItemPart(ZnItem item,
+ int part)
{
if (part >= 0) {
ZnFieldSet fs;
@@ -1525,12 +1525,12 @@ EncodeItemPart(ZnItem item,
* TagSearchExprInit --
*
* This procedure allocates and initializes one
- * TagSearchExpr struct.
+ * TagSearchExpr struct.
*
*--------------------------------------------------------------
*/
static void
-TagSearchExprInit(TagSearchExpr **expr_var)
+TagSearchExprInit(TagSearchExpr **expr_var)
{
TagSearchExpr* expr = *expr_var;
@@ -1557,7 +1557,7 @@ TagSearchExprInit(TagSearchExpr **expr_var)
*--------------------------------------------------------------
*/
static void
-TagSearchExprDestroy(TagSearchExpr *expr)
+TagSearchExprDestroy(TagSearchExpr *expr)
{
if (expr) {
if (expr->uids) {
@@ -1589,17 +1589,17 @@ TagSearchExprDestroy(TagSearchExpr *expr)
*--------------------------------------------------------------
*/
static int
-TagSearchScanExpr(Tcl_Interp *interp, /* Current interpreter. */
- ZnTagSearch *search, /* Search data */
- TagSearchExpr *expr) /* Compiled expression result */
+TagSearchScanExpr(Tcl_Interp *interp, /* Current interpreter. */
+ ZnTagSearch *search, /* Search data */
+ TagSearchExpr *expr) /* Compiled expression result */
{
- int looking_for_tag; /* When true, scanner expects next char(s)
- * to be a tag, else operand expected */
- int found_tag; /* One or more tags found */
- int found_endquote; /* For quoted tag string parsing */
- int negate_result; /* Pending negation of next tag value */
- char *tag; /* tag from tag expression string */
- char c;
+ int looking_for_tag; /* When true, scanner expects next char(s)
+ * to be a tag, else operand expected */
+ int found_tag; /* One or more tags found */
+ int found_endquote; /* For quoted tag string parsing */
+ int negate_result; /* Pending negation of next tag value */
+ char *tag; /* tag from tag expression string */
+ char c;
negate_result = 0;
found_tag = 0;
@@ -1610,165 +1610,165 @@ TagSearchScanExpr(Tcl_Interp *interp, /* Current interpreter. */
if (expr->allocated == expr->index) {
expr->allocated += 15;
if (expr->uids) {
- expr->uids = (Tk_Uid *) ZnRealloc((char *) expr->uids,
- expr->allocated * sizeof(Tk_Uid));
+ expr->uids = (Tk_Uid *) ZnRealloc((char *) expr->uids,
+ expr->allocated * sizeof(Tk_Uid));
}
else {
- expr->uids = (Tk_Uid *) ZnMalloc(expr->allocated * sizeof(Tk_Uid));
+ expr->uids = (Tk_Uid *) ZnMalloc(expr->allocated * sizeof(Tk_Uid));
}
}
if (looking_for_tag) {
switch (c) {
- case ' ': /* ignore unquoted whitespace */
+ case ' ': /* ignore unquoted whitespace */
case '\t':
case '\n':
case '\r':
- break;
- case '!': /* negate next tag or subexpr */
- if (looking_for_tag > 1) {
- Tcl_AppendResult(interp, "Too many '!' in tag search expression",
- (char *) NULL);
- return TCL_ERROR;
- }
- looking_for_tag++;
- negate_result = 1;
- break;
- case '(': /* scan (negated) subexpr recursively */
- if (negate_result) {
- expr->uids[expr->index++] = neg_paren_uid;
- negate_result = 0;
- }
- else {
- expr->uids[expr->index++] = paren_uid;
- }
- if (TagSearchScanExpr(interp, search, expr) != TCL_OK) {
- /* Result string should be already set
- * by nested call to tag_expr_scan() */
- return TCL_ERROR;
- }
- looking_for_tag = 0;
- found_tag = 1;
- break;
- case '"': /* quoted tag string */
- if (negate_result) {
- expr->uids[expr->index++] = neg_tag_val_uid;
- negate_result = 0;
- }
- else {
- expr->uids[expr->index++] = tag_val_uid;
- }
- tag = search->rewrite_buf;
- found_endquote = 0;
- while (search->tag_index < search->tag_len) {
- c = search->tag[search->tag_index++];
- if (c == '\\') {
- c = search->tag[search->tag_index++];
- }
- if (c == '"') {
- found_endquote = 1;
- break;
- }
- *tag++ = c;
- }
- if (! found_endquote) {
- Tcl_AppendResult(interp, "Missing endquote in tag search expression",
- (char *) NULL);
- return TCL_ERROR;
- }
- if (! (tag - search->rewrite_buf)) {
- Tcl_AppendResult(interp,
- "Null quoted tag string in tag search expression",
- (char *) NULL);
- return TCL_ERROR;
- }
- *tag++ = '\0';
- expr->uids[expr->index++] = Tk_GetUid(search->rewrite_buf);
- looking_for_tag = 0;
- found_tag = 1;
- break;
- case '&': /* illegal chars when looking for tag */
+ break;
+ case '!': /* negate next tag or subexpr */
+ if (looking_for_tag > 1) {
+ Tcl_AppendResult(interp, "Too many '!' in tag search expression",
+ (char *) NULL);
+ return TCL_ERROR;
+ }
+ looking_for_tag++;
+ negate_result = 1;
+ break;
+ case '(': /* scan (negated) subexpr recursively */
+ if (negate_result) {
+ expr->uids[expr->index++] = neg_paren_uid;
+ negate_result = 0;
+ }
+ else {
+ expr->uids[expr->index++] = paren_uid;
+ }
+ if (TagSearchScanExpr(interp, search, expr) != TCL_OK) {
+ /* Result string should be already set
+ * by nested call to tag_expr_scan() */
+ return TCL_ERROR;
+ }
+ looking_for_tag = 0;
+ found_tag = 1;
+ break;
+ case '"': /* quoted tag string */
+ if (negate_result) {
+ expr->uids[expr->index++] = neg_tag_val_uid;
+ negate_result = 0;
+ }
+ else {
+ expr->uids[expr->index++] = tag_val_uid;
+ }
+ tag = search->rewrite_buf;
+ found_endquote = 0;
+ while (search->tag_index < search->tag_len) {
+ c = search->tag[search->tag_index++];
+ if (c == '\\') {
+ c = search->tag[search->tag_index++];
+ }
+ if (c == '"') {
+ found_endquote = 1;
+ break;
+ }
+ *tag++ = c;
+ }
+ if (! found_endquote) {
+ Tcl_AppendResult(interp, "Missing endquote in tag search expression",
+ (char *) NULL);
+ return TCL_ERROR;
+ }
+ if (! (tag - search->rewrite_buf)) {
+ Tcl_AppendResult(interp,
+ "Null quoted tag string in tag search expression",
+ (char *) NULL);
+ return TCL_ERROR;
+ }
+ *tag++ = '\0';
+ expr->uids[expr->index++] = Tk_GetUid(search->rewrite_buf);
+ looking_for_tag = 0;
+ found_tag = 1;
+ break;
+ case '&': /* illegal chars when looking for tag */
case '|':
case '^':
case ')':
- Tcl_AppendResult(interp, "Unexpected operator in tag search expression",
- (char *) NULL);
- return TCL_ERROR;
- default: /* unquoted tag string */
- if (negate_result) {
- expr->uids[expr->index++] = neg_tag_val_uid;
- negate_result = 0;
- }
- else {
- expr->uids[expr->index++] = tag_val_uid;
- }
- tag = search->rewrite_buf;
- *tag++ = c;
- /* copy rest of tag, including any embedded whitespace */
- while (search->tag_index < search->tag_len) {
- c = search->tag[search->tag_index];
- if ((c == '!') || (c == '&') || (c == '|') || (c == '^') ||
- (c == '(') || (c == ')') || (c == '"')) {
- break;
- }
- *tag++ = c;
- search->tag_index++;
- }
- /* remove trailing whitespace */
- while (1) {
- c = *--tag;
- /* there must have been one non-whitespace char,
- * so this will terminate */
- if ((c != ' ') && (c != '\t') && (c != '\n') && (c != '\r')) {
- break;
- }
- }
- *++tag = '\0';
- expr->uids[expr->index++] = Tk_GetUid(search->rewrite_buf);
- looking_for_tag = 0;
- found_tag = 1;
+ Tcl_AppendResult(interp, "Unexpected operator in tag search expression",
+ (char *) NULL);
+ return TCL_ERROR;
+ default: /* unquoted tag string */
+ if (negate_result) {
+ expr->uids[expr->index++] = neg_tag_val_uid;
+ negate_result = 0;
+ }
+ else {
+ expr->uids[expr->index++] = tag_val_uid;
+ }
+ tag = search->rewrite_buf;
+ *tag++ = c;
+ /* copy rest of tag, including any embedded whitespace */
+ while (search->tag_index < search->tag_len) {
+ c = search->tag[search->tag_index];
+ if ((c == '!') || (c == '&') || (c == '|') || (c == '^') ||
+ (c == '(') || (c == ')') || (c == '"')) {
+ break;
+ }
+ *tag++ = c;
+ search->tag_index++;
+ }
+ /* remove trailing whitespace */
+ while (1) {
+ c = *--tag;
+ /* there must have been one non-whitespace char,
+ * so this will terminate */
+ if ((c != ' ') && (c != '\t') && (c != '\n') && (c != '\r')) {
+ break;
+ }
+ }
+ *++tag = '\0';
+ expr->uids[expr->index++] = Tk_GetUid(search->rewrite_buf);
+ looking_for_tag = 0;
+ found_tag = 1;
}
}
else { /* ! looking_for_tag */
switch (c) {
- case ' ' : /* ignore whitespace */
+ case ' ' : /* ignore whitespace */
case '\t' :
case '\n' :
case '\r' :
- break;
- case '&' : /* AND operator */
- c = search->tag[search->tag_index++];
- if (c != '&') {
- Tcl_AppendResult(interp, "Singleton '&' in tag search expression",
- (char *) NULL);
- return TCL_ERROR;
- }
- expr->uids[expr->index++] = and_uid;
- looking_for_tag = 1;
- break;
- case '|' : /* OR operator */
- c = search->tag[search->tag_index++];
- if (c != '|') {
- Tcl_AppendResult(interp, "Singleton '|' in tag search expression",
- (char *) NULL);
- return TCL_ERROR;
- }
- expr->uids[expr->index++] = or_uid;
- looking_for_tag = 1;
- break;
- case '^' : /* XOR operator */
- expr->uids[expr->index++] = xor_uid;
- looking_for_tag = 1;
- break;
- case ')' : /* end subexpression */
- expr->uids[expr->index++] = end_paren_uid;
- goto breakwhile;
- default : /* syntax error */
- Tcl_AppendResult(interp,
- "Invalid boolean operator in tag search expression",
- (char *) NULL);
- return TCL_ERROR;
+ break;
+ case '&' : /* AND operator */
+ c = search->tag[search->tag_index++];
+ if (c != '&') {
+ Tcl_AppendResult(interp, "Singleton '&' in tag search expression",
+ (char *) NULL);
+ return TCL_ERROR;
+ }
+ expr->uids[expr->index++] = and_uid;
+ looking_for_tag = 1;
+ break;
+ case '|' : /* OR operator */
+ c = search->tag[search->tag_index++];
+ if (c != '|') {
+ Tcl_AppendResult(interp, "Singleton '|' in tag search expression",
+ (char *) NULL);
+ return TCL_ERROR;
+ }
+ expr->uids[expr->index++] = or_uid;
+ looking_for_tag = 1;
+ break;
+ case '^' : /* XOR operator */
+ expr->uids[expr->index++] = xor_uid;
+ looking_for_tag = 1;
+ break;
+ case ')' : /* end subexpression */
+ expr->uids[expr->index++] = end_paren_uid;
+ goto breakwhile;
+ default : /* syntax error */
+ Tcl_AppendResult(interp,
+ "Invalid boolean operator in tag search expression",
+ (char *) NULL);
+ return TCL_ERROR;
}
}
}
@@ -1777,7 +1777,7 @@ TagSearchScanExpr(Tcl_Interp *interp, /* Current interpreter. */
return TCL_OK;
}
Tcl_AppendResult(interp, "Missing tag in tag search expression",
- (char *) NULL);
+ (char *) NULL);
return TCL_ERROR;
}
@@ -1798,15 +1798,15 @@ TagSearchScanExpr(Tcl_Interp *interp, /* Current interpreter. */
*--------------------------------------------------------------
*/
static int
-TagSearchEvalExpr(TagSearchExpr *expr, /* Search expression */
- ZnItem item) /* Item being test for match */
+TagSearchEvalExpr(TagSearchExpr *expr, /* Search expression */
+ ZnItem item) /* Item being test for match */
{
- int looking_for_tag; /* When true, scanner expects next char(s)
- * to be a tag, else operand expected */
- int negate_result; /* Pending negation of next tag value */
- Tk_Uid uid;
- int result=0; /* Value of expr so far */
- int paren_depth;
+ int looking_for_tag; /* When true, scanner expects next char(s)
+ * to be a tag, else operand expected */
+ int negate_result; /* Pending negation of next tag value */
+ Tk_Uid uid;
+ int result=0; /* Value of expr so far */
+ int paren_depth;
negate_result = 0;
looking_for_tag = 1;
@@ -1814,90 +1814,90 @@ TagSearchEvalExpr(TagSearchExpr *expr, /* Search expression */
uid = expr->uids[expr->index++];
if (looking_for_tag) {
if (uid == tag_val_uid) {
- /*
- * assert(expr->index < expr->length);
- */
- uid = expr->uids[expr->index++];
- /*
- * set result 1 if tag is found in item's tags
- */
- result = ZnITEM.HasTag(item, uid) ? 1 : 0;
+ /*
+ * assert(expr->index < expr->length);
+ */
+ uid = expr->uids[expr->index++];
+ /*
+ * set result 1 if tag is found in item's tags
+ */
+ result = ZnITEM.HasTag(item, uid) ? 1 : 0;
}
else if (uid == neg_tag_val_uid) {
- negate_result = ! negate_result;
- /*
- * assert(expr->index < expr->length);
- */
- uid = expr->uids[expr->index++];
- /*
- * set result 1 if tag is found in item's tags
- */
- result = ZnITEM.HasTag(item, uid) ? 1 : 0;
+ negate_result = ! negate_result;
+ /*
+ * assert(expr->index < expr->length);
+ */
+ uid = expr->uids[expr->index++];
+ /*
+ * set result 1 if tag is found in item's tags
+ */
+ result = ZnITEM.HasTag(item, uid) ? 1 : 0;
}
else if (uid == paren_uid) {
- /*
- * evaluate subexpressions with recursion
- */
- result = TagSearchEvalExpr(expr, item);
+ /*
+ * evaluate subexpressions with recursion
+ */
+ result = TagSearchEvalExpr(expr, item);
}
else if (uid == neg_paren_uid) {
- negate_result = ! negate_result;
- /*
- * evaluate subexpressions with recursion
- */
- result = TagSearchEvalExpr(expr, item);
- /*
- * } else {
- * assert(0);
- */
+ negate_result = ! negate_result;
+ /*
+ * evaluate subexpressions with recursion
+ */
+ result = TagSearchEvalExpr(expr, item);
+ /*
+ * } else {
+ * assert(0);
+ */
}
if (negate_result) {
- result = ! result;
- negate_result = 0;
+ result = ! result;
+ negate_result = 0;
}
looking_for_tag = 0;
}
else { /* ! looking_for_tag */
if (((uid == and_uid) && (!result)) || ((uid == or_uid) && result)) {
- /*
- * short circuit expression evaluation
- *
- * if result before && is 0, or result before || is 1, then
- * the expression is decided and no further evaluation is needed.
- */
- paren_depth = 0;
- while (expr->index < expr->length) {
- uid = expr->uids[expr->index++];
- if ((uid == tag_val_uid) || (uid == neg_tag_val_uid)) {
- expr->index++;
- continue;
- }
- if ((uid == paren_uid) || (uid == neg_paren_uid)) {
- paren_depth++;
- continue;
- }
- if (uid == end_paren_uid) {
- paren_depth--;
- if (paren_depth < 0) {
- break;
- }
- }
- }
- return result;
-
+ /*
+ * short circuit expression evaluation
+ *
+ * if result before && is 0, or result before || is 1, then
+ * the expression is decided and no further evaluation is needed.
+ */
+ paren_depth = 0;
+ while (expr->index < expr->length) {
+ uid = expr->uids[expr->index++];
+ if ((uid == tag_val_uid) || (uid == neg_tag_val_uid)) {
+ expr->index++;
+ continue;
+ }
+ if ((uid == paren_uid) || (uid == neg_paren_uid)) {
+ paren_depth++;
+ continue;
+ }
+ if (uid == end_paren_uid) {
+ paren_depth--;
+ if (paren_depth < 0) {
+ break;
+ }
+ }
+ }
+ return result;
+
}
else if (uid == xor_uid) {
- /*
- * if the previous result was 1 then negate the next result.
- */
- negate_result = result;
+ /*
+ * if the previous result was 1 then negate the next result.
+ */
+ negate_result = result;
}
else if (uid == end_paren_uid) {
- return result;
- /*
- * } else {
- * assert(0);
- */
+ return result;
+ /*
+ * } else {
+ * assert(0);
+ */
}
looking_for_tag = 1;
}
@@ -1910,14 +1910,14 @@ TagSearchEvalExpr(TagSearchExpr *expr, /* Search expression */
static ZnItem
-LookupGroupFromPath(ZnItem start,
- Tk_Uid *names,
- unsigned int num_names)
+LookupGroupFromPath(ZnItem start,
+ Tk_Uid *names,
+ unsigned int num_names)
{
- Tk_Uid name, *tags;
- unsigned int count;
- ZnBool recursive;
- ZnItem result, current = ZnGroupHead(start);
+ Tk_Uid name, *tags;
+ unsigned int count;
+ ZnBool recursive;
+ ZnItem result, current = ZnGroupHead(start);
if (num_names == 0) {
return start;
@@ -1932,24 +1932,24 @@ LookupGroupFromPath(ZnItem start,
tags = ZnListArray(current->tags);
count = ZnListSize(current->tags);
for (; count > 0; tags++, count--) {
- if (name == *tags) {
- if (num_names > 2) {
- result = LookupGroupFromPath(current, names+2, num_names-2);
- return result;
- }
- else {
- return current;
- }
- }
+ if (name == *tags) {
+ if (num_names > 2) {
+ result = LookupGroupFromPath(current, names+2, num_names-2);
+ return result;
+ }
+ else {
+ return current;
+ }
+ }
}
/*
* This group doesn't match try to search depth first.
*/
if (recursive) {
- result = LookupGroupFromPath(current, names, num_names);
- if (result != ZN_NO_ITEM) {
- return result;
- }
+ result = LookupGroupFromPath(current, names, num_names);
+ if (result != ZN_NO_ITEM) {
+ return result;
+ }
}
}
current = current->next;
@@ -1972,28 +1972,28 @@ LookupGroupFromPath(ZnItem start,
* The return value indicates if the tagOrId expression
* was successfully scanned (syntax).
* The information at *search is initialized such that a
- * call to ZnTagSearchFirst, followed by successive calls
- * to ZnTagSearchNext will return items that match tag.
+ * call to ZnTagSearchFirst, followed by successive calls
+ * to ZnTagSearchNext will return items that match tag.
*
* Side effects:
* search is linked into a list of searches in progress
* in zinc, so that elements can safely be deleted while
- * the search is in progress.
+ * the search is in progress.
*
*--------------------------------------------------------------
*/
static int
-ZnTagSearchScan(ZnWInfo *wi,
- Tcl_Obj *tag_obj, /* Object giving tag value, NULL
- * is the same as 'all'. */
- ZnTagSearch **search_var) /* Record describing tag search;
- * will be initialized here. */
+ZnTagSearchScan(ZnWInfo *wi,
+ Tcl_Obj *tag_obj, /* Object giving tag value, NULL
+ * is the same as 'all'. */
+ ZnTagSearch **search_var) /* Record describing tag search;
+ * will be initialized here. */
{
- Tk_Uid tag;
- int i;
- ZnTagSearch *search;
- ZnItem group = wi->top_group;
- ZnBool recursive = True;
+ Tk_Uid tag;
+ int i;
+ ZnTagSearch *search;
+ ZnItem group = wi->top_group;
+ ZnBool recursive = True;
if (tag_obj) {
tag = Tcl_GetString(tag_obj);
@@ -2042,7 +2042,7 @@ ZnTagSearchScan(ZnWInfo *wi,
*/
if (strpbrk(tag, ".*")) {
Tk_Uid path;
- char c, *next;
+ char c, *next;
unsigned int id;
Tcl_HashEntry *entry;
@@ -2055,55 +2055,55 @@ ZnTagSearchScan(ZnWInfo *wi,
path = tag;
while ((next = strpbrk(path, ".*"))) {
if (isdigit(*path)) {
- if (path == tag) { /* Group id is ok only in first section. */
- c = *next;
- *next = '\0';
- id = strtoul(path, NULL, 10);
- *next = c;
- group = wi->hot_item;
- if ((group == ZN_NO_ITEM) || (group->id != id)) {
- entry = Tcl_FindHashEntry(wi->id_table, (char *) id);
- if (entry != NULL) {
- group = (ZnItem) Tcl_GetHashValue(entry);
- }
- else {
- Tcl_AppendResult(wi->interp, "unknown group in path \"",
- tag, "\"", NULL);
- return TCL_ERROR;
- }
- }
- if (group->class != ZnGroup) {
- Tcl_AppendResult(wi->interp, "item is not a group in path \"",
- tag, "\"", NULL);
- return TCL_ERROR;
- }
- }
- else {
- Tcl_AppendResult(wi->interp, "misplaced group id in path \"",
- tag, "\"", NULL);
- return TCL_ERROR;
- }
+ if (path == tag) { /* Group id is ok only in first section. */
+ c = *next;
+ *next = '\0';
+ id = strtoul(path, NULL, 10);
+ *next = c;
+ group = wi->hot_item;
+ if ((group == ZN_NO_ITEM) || (group->id != id)) {
+ entry = Tcl_FindHashEntry(wi->id_table, (char *) id);
+ if (entry != NULL) {
+ group = (ZnItem) Tcl_GetHashValue(entry);
+ }
+ else {
+ Tcl_AppendResult(wi->interp, "unknown group in path \"",
+ tag, "\"", NULL);
+ return TCL_ERROR;
+ }
+ }
+ if (group->class != ZnGroup) {
+ Tcl_AppendResult(wi->interp, "item is not a group in path \"",
+ tag, "\"", NULL);
+ return TCL_ERROR;
+ }
+ }
+ else {
+ Tcl_AppendResult(wi->interp, "misplaced group id in path \"",
+ tag, "\"", NULL);
+ return TCL_ERROR;
+ }
}
else {
- ZnListAdd(ZnWorkStrings,
- (void *) (recursive ? &star_uid : &dot_uid),
- ZnListTail);
- c = *next;
- *next = '\0';
- path = Tk_GetUid(path);
- *next = c;
- ZnListAdd(ZnWorkStrings, (void *) &path, ZnListTail);
+ ZnListAdd(ZnWorkStrings,
+ (void *) (recursive ? &star_uid : &dot_uid),
+ ZnListTail);
+ c = *next;
+ *next = '\0';
+ path = Tk_GetUid(path);
+ *next = c;
+ ZnListAdd(ZnWorkStrings, (void *) &path, ZnListTail);
}
recursive = (*next == '*');
path = next+1;
}
group = LookupGroupFromPath(group,
- ZnListArray(ZnWorkStrings),
- ZnListSize(ZnWorkStrings));
+ ZnListArray(ZnWorkStrings),
+ ZnListSize(ZnWorkStrings));
if (group == ZN_NO_ITEM) {
Tcl_AppendResult(wi->interp, "path does not lead to a valid group\"",
- tag, "\"", NULL);
+ tag, "\"", NULL);
return TCL_ERROR;
}
@@ -2128,7 +2128,7 @@ ZnTagSearchScan(ZnWInfo *wi,
if ((unsigned int)(search->tag_len*1.3) >= search->rewrite_buf_alloc) {
search->rewrite_buf_alloc = (unsigned int) (search->tag_len*1.3);
search->rewrite_buf = ZnRealloc(search->rewrite_buf,
- search->rewrite_buf_alloc);
+ search->rewrite_buf_alloc);
}
/* Initialize search */
@@ -2162,21 +2162,21 @@ ZnTagSearchScan(ZnWInfo *wi,
if (tag[i] == '"') {
i++;
for ( ; i < search->tag_len; i++) {
- if (tag[i] == '\\') {
- i++;
- continue;
- }
- if (tag[i] == '"') {
- break;
- }
+ if (tag[i] == '\\') {
+ i++;
+ continue;
+ }
+ if (tag[i] == '"') {
+ break;
+ }
}
}
else {
if (((tag[i] == '&') && (tag[i+1] == '&')) ||
- ((tag[i] == '|') && (tag[i+1] == '|')) ||
- (tag[i] == '^') || (tag[i] == '!')) {
- search->type = 4;
- break;
+ ((tag[i] == '|') && (tag[i+1] == '|')) ||
+ (tag[i] == '^') || (tag[i] == '!')) {
+ search->type = 4;
+ break;
}
}
}
@@ -2237,12 +2237,12 @@ ZnTagSearchScan(ZnWInfo *wi,
* Side effects:
* *search is linked into a list of searches in progress
* in zinc, so that elements can safely be deleted while
- * the search is in progress.
+ * the search is in progress.
*
*--------------------------------------------------------------
*/
static ZnItem
-ZnTagSearchFirst(ZnTagSearch *search) /* Record describing tag search */
+ZnTagSearchFirst(ZnTagSearch *search) /* Record describing tag search */
{
ZnItem item, previous;
@@ -2263,14 +2263,14 @@ ZnTagSearchFirst(ZnTagSearch *search) /* Record describing tag search */
item = search->wi->hot_item;
previous = search->wi->hot_prev;
if ((item == ZN_NO_ITEM) || (item->id != search->id) ||
- (previous == ZN_NO_ITEM) || (previous->next != item)) {
+ (previous == ZN_NO_ITEM) || (previous->next != item)) {
entry = Tcl_FindHashEntry(search->wi->id_table, (char *) search->id);
if (entry != NULL) {
- item = (ZnItem) Tcl_GetHashValue(entry);
- previous = item->previous;
+ item = (ZnItem) Tcl_GetHashValue(entry);
+ previous = item->previous;
}
else {
- previous = item = ZN_NO_ITEM;
+ previous = item = ZN_NO_ITEM;
}
}
search->previous = previous;
@@ -2294,51 +2294,51 @@ ZnTagSearchFirst(ZnTagSearch *search) /* Record describing tag search */
do {
while (item != ZN_NO_ITEM) {
if (search->type == 3) {
- /*
- * Optimized single-tag search
- */
- if (ZnITEM.HasTag(item, search->expr->uid)) {
- search->previous = previous;
- search->current = item;
- return item;
- }
+ /*
+ * Optimized single-tag search
+ */
+ if (ZnITEM.HasTag(item, search->expr->uid)) {
+ search->previous = previous;
+ search->current = item;
+ return item;
+ }
}
else {
- /*
- * Type = 4. Search for an item matching
- * the tag expression.
- */
- search->expr->index = 0;
- if (TagSearchEvalExpr(search->expr, item)) {
- search->previous = previous;
- search->current = item;
- return item;
- }
+ /*
+ * Type = 4. Search for an item matching
+ * the tag expression.
+ */
+ search->expr->index = 0;
+ if (TagSearchEvalExpr(search->expr, item)) {
+ search->previous = previous;
+ search->current = item;
+ return item;
+ }
}
if ((item->class == ZnGroup) && (search->recursive)) {
- ZnItem prev_group = (ZnItem) search->group;
- /*
- * Explore the hierarchy depth first using the item stack
- * to save the current node.
- */
- /*printf("ZnTagSearchFirst diving for tag '%s', detph %d\n",
- search->tag, ZnListSize(search->item_stack)/2);*/
- search->group = item;
- previous = item;
- if (item == prev_group) {
- item = ZN_NO_ITEM;
- }
- else {
- item = item->next;
- }
- ZnListAdd(search->item_stack, &previous, ZnListTail);
- ZnListAdd(search->item_stack, &item, ZnListTail);
- previous = ZN_NO_ITEM;
- item = ZnGroupHead(search->group);
+ ZnItem prev_group = (ZnItem) search->group;
+ /*
+ * Explore the hierarchy depth first using the item stack
+ * to save the current node.
+ */
+ /*printf("ZnTagSearchFirst diving for tag '%s', detph %d\n",
+ search->tag, ZnListSize(search->item_stack)/2);*/
+ search->group = item;
+ previous = item;
+ if (item == prev_group) {
+ item = ZN_NO_ITEM;
+ }
+ else {
+ item = item->next;
+ }
+ ZnListAdd(search->item_stack, &previous, ZnListTail);
+ ZnListAdd(search->item_stack, &item, ZnListTail);
+ previous = ZN_NO_ITEM;
+ item = ZnGroupHead(search->group);
}
else {
- previous = item;
- item = item->next;
+ previous = item;
+ item = item->next;
}
}
/*
@@ -2385,7 +2385,7 @@ ZnTagSearchFirst(ZnTagSearch *search) /* Record describing tag search */
*--------------------------------------------------------------
*/
static ZnItem
-ZnTagSearchNext(ZnTagSearch *search) /* Record describing search in progress. */
+ZnTagSearchNext(ZnTagSearch *search) /* Record describing search in progress. */
{
ZnItem item, previous;
@@ -2445,8 +2445,8 @@ ZnTagSearchNext(ZnTagSearch *search) /* Record describing search in progress. */
if (item != ZN_NO_ITEM) {
search->group = item->parent;
/*printf("ZnTagSearchNext popping %d, previous %d, next %d\n",
- item->id, (item->previous)?item->previous->id:0,
- (item->next)?item->next->id:0);*/
+ item->id, (item->previous)?item->previous->id:0,
+ (item->next)?item->next->id:0);*/
}
else {
/*
@@ -2469,44 +2469,44 @@ ZnTagSearchNext(ZnTagSearch *search) /* Record describing search in progress. */
do {
while (item != ZN_NO_ITEM) {
if (search->type == 3) {
- /*
- * Optimized single-tag search
- */
- if (ZnITEM.HasTag(item, search->expr->uid)) {
- search->previous = previous;
- search->current = item;
- return item;
- }
+ /*
+ * Optimized single-tag search
+ */
+ if (ZnITEM.HasTag(item, search->expr->uid)) {
+ search->previous = previous;
+ search->current = item;
+ return item;
+ }
}
else {
- /*
- * Else.... evaluate tag expression
- */
- search->expr->index = 0;
- if (TagSearchEvalExpr(search->expr, item)) {
- search->previous = previous;
- search->current = item;
- return item;
- }
+ /*
+ * Else.... evaluate tag expression
+ */
+ search->expr->index = 0;
+ if (TagSearchEvalExpr(search->expr, item)) {
+ search->previous = previous;
+ search->current = item;
+ return item;
+ }
}
if ((item->class == ZnGroup) && (search->recursive)) {
- /*
- * Explore the hierarchy depth first using the item stack
- * to save the current node.
- */
- /*printf("ZnTagSearchNext diving for tag, depth %d\n",
- ZnListSize(search->item_stack)/2);*/
- search->group = item;
- previous = item;
+ /*
+ * Explore the hierarchy depth first using the item stack
+ * to save the current node.
+ */
+ /*printf("ZnTagSearchNext diving for tag, depth %d\n",
+ ZnListSize(search->item_stack)/2);*/
+ search->group = item;
+ previous = item;
item = item->next;
- ZnListAdd(search->item_stack, &previous, ZnListTail);
- ZnListAdd(search->item_stack, &item, ZnListTail);
- previous = ZN_NO_ITEM;
- item = ZnGroupHead(search->group);
+ ZnListAdd(search->item_stack, &previous, ZnListTail);
+ ZnListAdd(search->item_stack, &item, ZnListTail);
+ previous = ZN_NO_ITEM;
+ item = ZnGroupHead(search->group);
}
else {
- previous = item;
- item = item->next;
+ previous = item;
+ item = item->next;
}
}
/*printf("ZnTagSearchNext backup for tag, depth %d\n",
@@ -2543,7 +2543,7 @@ ZnTagSearchNext(ZnTagSearch *search) /* Record describing search in progress. */
*--------------------------------------------------------------
*/
void
-ZnTagSearchDestroy(ZnTagSearch *search) /* Record describing tag search */
+ZnTagSearchDestroy(ZnTagSearch *search) /* Record describing tag search */
{
if (search) {
TagSearchExprDestroy(search->expr);
@@ -2559,17 +2559,17 @@ ZnTagSearchDestroy(ZnTagSearch *search) /* Record describing tag search */
*
* ZnItemWithTagOrId --
*
- * Return the first item matching the given tag or id. The
- * function returns the item in 'item' and the operation
- * status as the function's value.
+ * Return the first item matching the given tag or id. The
+ * function returns the item in 'item' and the operation
+ * status as the function's value.
*
*----------------------------------------------------------------------
*/
int
-ZnItemWithTagOrId(ZnWInfo *wi,
- Tcl_Obj *tag_or_id,
- ZnItem *item,
- ZnTagSearch **search_var)
+ZnItemWithTagOrId(ZnWInfo *wi,
+ Tcl_Obj *tag_or_id,
+ ZnItem *item,
+ ZnTagSearch **search_var)
{
if (ZnTagSearchScan(wi, tag_or_id, search_var) != TCL_OK) {
return TCL_ERROR;
@@ -2584,20 +2584,20 @@ ZnItemWithTagOrId(ZnWInfo *wi,
*
* LayoutItems --
*
- * Perform layouts on items. It can position items horizontally,
- * vertically, along a path or with respect to a reference item.
- * It can also align on a grid, evenly space items and resize
- * items to a common reference.
+ * Perform layouts on items. It can position items horizontally,
+ * vertically, along a path or with respect to a reference item.
+ * It can also align on a grid, evenly space items and resize
+ * items to a common reference.
*
*----------------------------------------------------------------------
*/
static int
-LayoutItems(ZnWInfo *wi,
- int argc,
- Tcl_Obj *CONST args[])
+LayoutItems(ZnWInfo *wi,
+ int argc,
+ Tcl_Obj *CONST args[])
{
- int index/*, result*/;
- /*ZnItem item;*/
+ int index/*, result*/;
+ /*ZnItem item;*/
#ifdef PTK_800
static char *layout_cmd_strings[] =
#else
@@ -2606,12 +2606,12 @@ LayoutItems(ZnWInfo *wi,
{
"align", "grid", "position", "scale", "space", NULL
};
- enum layout_cmds {
+ enum layout_cmds {
ZN_L_ALIGN, ZN_L_GRID, ZN_L_POSITION, ZN_L_SCALE, ZN_L_SPACE
};
if (Tcl_GetIndexFromObj(wi->interp, args[0], layout_cmd_strings,
- "layout command", 0, &index) != TCL_OK) {
+ "layout command", 0, &index) != TCL_OK) {
return TCL_ERROR;
}
switch((enum layout_cmds) index) {
@@ -2651,27 +2651,27 @@ LayoutItems(ZnWInfo *wi,
*
* SetOrigin --
*
- * This procedure is invoked to translate the viewed area so
- * that the given point is displayed in the top left corner.
+ * This procedure is invoked to translate the viewed area so
+ * that the given point is displayed in the top left corner.
*
* Results:
- * None.
+ * None.
*
* Side effects:
- * Zinc will be redisplayed to reflect the change in ciew.
+ * Zinc will be redisplayed to reflect the change in ciew.
* The scrollbars will be updated if there are any.
- * The top group transform is modified to achieve the effect,
- * it is not a good idea to mix view control and application
- * control of the top group transform.
+ * The top group transform is modified to achieve the effect,
+ * it is not a good idea to mix view control and application
+ * control of the top group transform.
*
*----------------------------------------------------------------------
*/
static void
-SetOrigin(ZnWInfo *wi,
- ZnReal x_origin,
- ZnReal y_origin)
+SetOrigin(ZnWInfo *wi,
+ ZnReal x_origin,
+ ZnReal y_origin)
{
- int left, right, top, bottom, delta;
+ int left, right, top, bottom, delta;
/*
* If scroll increments have been set, round the window origin
@@ -2712,28 +2712,28 @@ SetOrigin(ZnWInfo *wi,
if ((left < 0) && (right > 0)) {
delta = (right > -left) ? -left : right;
if (wi->x_scroll_incr > 0) {
- delta -= delta % wi->x_scroll_incr;
+ delta -= delta % wi->x_scroll_incr;
}
x_origin += delta;
}
else if ((right < 0) && (left > 0)) {
delta = (left > -right) ? -right : left;
if (wi->x_scroll_incr > 0) {
- delta -= delta % wi->x_scroll_incr;
+ delta -= delta % wi->x_scroll_incr;
}
x_origin -= delta;
}
if ((top < 0) && (bottom > 0)) {
delta = (bottom > -top) ? -top : bottom;
if (wi->y_scroll_incr > 0) {
- delta -= delta % wi->y_scroll_incr;
+ delta -= delta % wi->y_scroll_incr;
}
y_origin += delta;
}
else if ((bottom < 0) && (top > 0)) {
delta = (top > -bottom) ? -bottom : top;
if (wi->y_scroll_incr > 0) {
- delta -= delta % wi->y_scroll_incr;
+ delta -= delta % wi->y_scroll_incr;
}
y_origin -= delta;
}
@@ -2758,34 +2758,34 @@ SetOrigin(ZnWInfo *wi,
*
* ScrollFractions --
*
- * Given the range that's visible in the window and the "100%
- * range", return a list of two real representing the scroll
- * fractions. This procedure is used for both x and y scrolling.
+ * Given the range that's visible in the window and the "100%
+ * range", return a list of two real representing the scroll
+ * fractions. This procedure is used for both x and y scrolling.
*
* Results:
- * Return a string as a Tcl_Obj holding two real numbers
- * describing the scroll fraction (between 0 and 1) corresponding
- * to the arguments.
+ * Return a string as a Tcl_Obj holding two real numbers
+ * describing the scroll fraction (between 0 and 1) corresponding
+ * to the arguments.
*
* Side effects:
- * None.
+ * None.
*
*----------------------------------------------------------------------
*/
#ifdef PTK
static void
-ScrollFractions(ZnReal view1, /* Lowest coordinate visible in the window. */
- ZnReal view2, /* Highest coordinate visible in the window. */
- ZnReal region1,/* Lowest coordinate in the object. */
- ZnReal region2,/* Highest coordinate in the object. */
- ZnReal *first,
- ZnReal *last)
+ScrollFractions(ZnReal view1, /* Lowest coordinate visible in the window. */
+ ZnReal view2, /* Highest coordinate visible in the window. */
+ ZnReal region1,/* Lowest coordinate in the object. */
+ ZnReal region2,/* Highest coordinate in the object. */
+ ZnReal *first,
+ ZnReal *last)
#else
static Tcl_Obj *
-ScrollFractions(ZnReal view1, /* Lowest coordinate visible in the window. */
- ZnReal view2, /* Highest coordinate visible in the window. */
- ZnReal region1,/* Lowest coordinate in the object. */
- ZnReal region2)/* Highest coordinate in the object. */
+ScrollFractions(ZnReal view1, /* Lowest coordinate visible in the window. */
+ ZnReal view2, /* Highest coordinate visible in the window. */
+ ZnReal region1,/* Lowest coordinate in the object. */
+ ZnReal region2)/* Highest coordinate in the object. */
#endif
{
ZnReal range, f1, f2;
@@ -2824,34 +2824,34 @@ ScrollFractions(ZnReal view1, /* Lowest coordinate visible in the window. */
*
* UpdateScrollbars --
*
- * This procedure is invoked whenever zinc has changed in
- * a way that requires scrollbars to be redisplayed (e.g.
- * the view has changed).
+ * This procedure is invoked whenever zinc has changed in
+ * a way that requires scrollbars to be redisplayed (e.g.
+ * the view has changed).
*
* Results:
- * None.
+ * None.
*
* Side effects:
- * If there are scrollbars associated with zinc, then
- * their scrolling commands are invoked to cause them to
- * redisplay. If errors occur, additional Tcl commands may
- * be invoked to process the errors.
+ * If there are scrollbars associated with zinc, then
+ * their scrolling commands are invoked to cause them to
+ * redisplay. If errors occur, additional Tcl commands may
+ * be invoked to process the errors.
*
*--------------------------------------------------------------
*/
static void
-UpdateScrollbars(ZnWInfo *wi)
+UpdateScrollbars(ZnWInfo *wi)
{
- int result;
- Tcl_Interp *interp;
- int x_origin, y_origin, width, height;
- int scroll_xo, scroll_xc, scroll_yo, scroll_yc;
+ int result;
+ Tcl_Interp *interp;
+ int x_origin, y_origin, width, height;
+ int scroll_xo, scroll_xc, scroll_yo, scroll_yc;
#ifdef PTK
LangCallback *x_scroll_cmd, *y_scroll_cmd;
#else
- Tcl_Obj *x_scroll_cmd, *y_scroll_cmd;
+ Tcl_Obj *x_scroll_cmd, *y_scroll_cmd;
#endif
- Tcl_Obj *fractions;
+ Tcl_Obj *fractions;
/*
* Save all the relevant values from wi, because it might be
@@ -2895,7 +2895,7 @@ UpdateScrollbars(ZnWInfo *wi)
if (y_scroll_cmd != NULL) {
#ifdef PTK
- ZnReal first, last;
+ ZnReal first, last;
ScrollFractions(y_origin, y_origin + height, scroll_yo, scroll_yc, &first, &last);
result = LangDoCallback(interp, y_scroll_cmd, 0, 2, " %g %g", first, last);
#else
@@ -2918,18 +2918,18 @@ UpdateScrollbars(ZnWInfo *wi)
*
* ZnDoItem --
*
- * Either add a tag to an item or add the item id/part to the
- * interpreter result, depending on the value of tag. If tag
- * is NULL, the item id/part is added to the result, otherwise
- * the tag is added to the item.
+ * Either add a tag to an item or add the item id/part to the
+ * interpreter result, depending on the value of tag. If tag
+ * is NULL, the item id/part is added to the result, otherwise
+ * the tag is added to the item.
*
*----------------------------------------------------------------------
*/
void
-ZnDoItem(Tcl_Interp *interp,
- ZnItem item,
- int part,
- Tk_Uid tag_uid)
+ZnDoItem(Tcl_Interp *interp,
+ ZnItem item,
+ int part,
+ Tk_Uid tag_uid)
{
if (tag_uid == NULL) {
Tcl_Obj *l;
@@ -2950,31 +2950,31 @@ ZnDoItem(Tcl_Interp *interp,
*----------------------------------------------------------------------
*
* FindArea --
- * Search the items that are enclosed or overlapping a given
- * area of the widget. It is used by FindItems.
- * If tag_uid is not NULL, all the items found are tagged with
- * tag_uid. If tag_uid is NULL, the items found are added to the
- * interp result. If enclosed is 1, the search look for
- * items enclosed in the area. If enclosed is 0, it looks
- * for overlapping and enclosed items.
- * If an error occurs, a message is left in the interp result
- * and TCL_ERROR is returned.
+ * Search the items that are enclosed or overlapping a given
+ * area of the widget. It is used by FindItems.
+ * If tag_uid is not NULL, all the items found are tagged with
+ * tag_uid. If tag_uid is NULL, the items found are added to the
+ * interp result. If enclosed is 1, the search look for
+ * items enclosed in the area. If enclosed is 0, it looks
+ * for overlapping and enclosed items.
+ * If an error occurs, a message is left in the interp result
+ * and TCL_ERROR is returned.
*
*----------------------------------------------------------------------
*/
static int
-FindArea(ZnWInfo *wi,
- Tcl_Obj *CONST args[],
- Tk_Uid tag_uid,
- ZnBool enclosed,
- ZnBool recursive,
- ZnBool override_atomic,
- ZnItem group)
+FindArea(ZnWInfo *wi,
+ Tcl_Obj *CONST args[],
+ Tk_Uid tag_uid,
+ ZnBool enclosed,
+ ZnBool recursive,
+ ZnBool override_atomic,
+ ZnItem group)
{
- ZnPos pos;
- ZnBBox area;
+ ZnPos pos;
+ ZnBBox area;
ZnToAreaStruct ta;
- double d;
+ double d;
if (Tcl_GetDoubleFromObj(wi->interp, args[0], &d) == TCL_ERROR) {
return TCL_ERROR;
@@ -3023,29 +3023,29 @@ FindArea(ZnWInfo *wi,
*
* FindItems --
*
- * This procedure interprets the small object query langage for
- * commands like addtag and find.
- * If new_tag is NULL, the procedure collects all the objects
- * matching the request and return them in the interpreter result.
- * If new_tag is non NULL, it is interpreted as the tag to add to
- * all matching objects. In this case the interpreter result is
- * left empty.
+ * This procedure interprets the small object query langage for
+ * commands like addtag and find.
+ * If new_tag is NULL, the procedure collects all the objects
+ * matching the request and return them in the interpreter result.
+ * If new_tag is non NULL, it is interpreted as the tag to add to
+ * all matching objects. In this case the interpreter result is
+ * left empty.
*
*----------------------------------------------------------------------
*/
static int
-FindItems(ZnWInfo *wi,
- int argc,
- Tcl_Obj *CONST args[],
- Tcl_Obj *tag, /* NULL to search or tag to add tag. */
- int first, /* First arg to process in args */
- ZnTagSearch **search_var)
+FindItems(ZnWInfo *wi,
+ int argc,
+ Tcl_Obj *CONST args[],
+ Tcl_Obj *tag, /* NULL to search or tag to add tag. */
+ int first, /* First arg to process in args */
+ ZnTagSearch **search_var)
{
- Tk_Uid tag_uid = NULL;
- int index, result;
- ZnItem item;
- ZnPickStruct ps;
- char *str;
+ Tk_Uid tag_uid = NULL;
+ int index, result;
+ ZnItem item;
+ ZnPickStruct ps;
+ char *str;
#ifdef PTK_800
static char *search_cmd_strings[] =
#else
@@ -3055,13 +3055,13 @@ FindItems(ZnWInfo *wi,
"above", "ancestors", "atpriority", "below", "closest", "enclosed",
"overlapping", "withtag", "withtype", NULL
};
- enum search_cmds {
+ enum search_cmds {
ZN_S_ABOVE, ZN_S_ANCESTORS, ZN_S_ATPRIORITY, ZN_S_BELOW, ZN_S_CLOSEST,
ZN_S_ENCLOSED, ZN_S_OVERLAPPING, ZN_S_WITHTAG, ZN_S_WITHTYPE
};
if (Tcl_GetIndexFromObj(wi->interp, args[first], search_cmd_strings,
- "search command", 0, &index) != TCL_OK) {
+ "search command", 0, &index) != TCL_OK) {
return TCL_ERROR;
}
@@ -3076,17 +3076,17 @@ FindItems(ZnWInfo *wi,
case ZN_S_ABOVE:
{
if (argc != first+2) {
- Tcl_WrongNumArgs(wi->interp, first+1, args, "tagOrId");
- return TCL_ERROR;
+ Tcl_WrongNumArgs(wi->interp, first+1, args, "tagOrId");
+ return TCL_ERROR;
}
result = ZnItemWithTagOrId(wi, args[first+1], &item, search_var);
if (result == TCL_OK) {
- if ((item != ZN_NO_ITEM) && (item->previous != ZN_NO_ITEM)) {
- ZnDoItem(wi->interp, item->previous, ZN_NO_PART, tag_uid);
- }
+ if ((item != ZN_NO_ITEM) && (item->previous != ZN_NO_ITEM)) {
+ ZnDoItem(wi->interp, item->previous, ZN_NO_PART, tag_uid);
+ }
}
else {
- return TCL_ERROR;
+ return TCL_ERROR;
}
}
break;
@@ -3097,24 +3097,24 @@ FindItems(ZnWInfo *wi,
{
Tk_Uid uid = NULL;
if ((argc != first+2) && (argc != first+3)) {
- Tcl_WrongNumArgs(wi->interp, first+1, args, "tagOrId ?withTag?");
- return TCL_ERROR;
+ Tcl_WrongNumArgs(wi->interp, first+1, args, "tagOrId ?withTag?");
+ return TCL_ERROR;
}
result = ZnItemWithTagOrId(wi, args[first+1], &item, search_var);
if (result == TCL_ERROR) {
- return TCL_ERROR;
+ return TCL_ERROR;
}
if (item) {
- item = item->parent;
- if (argc == first+3) {
- uid = Tk_GetUid(Tcl_GetString(args[first+2]));
- }
- while (item != ZN_NO_ITEM) {
- if (!uid || ZnITEM.HasTag(item, uid)) {
- ZnDoItem(wi->interp, item, ZN_NO_PART, tag_uid);
- }
- item = item->parent;
- }
+ item = item->parent;
+ if (argc == first+3) {
+ uid = Tk_GetUid(Tcl_GetString(args[first+2]));
+ }
+ while (item != ZN_NO_ITEM) {
+ if (!uid || ZnITEM.HasTag(item, uid)) {
+ ZnDoItem(wi->interp, item, ZN_NO_PART, tag_uid);
+ }
+ item = item->parent;
+ }
}
}
break;
@@ -3126,12 +3126,12 @@ FindItems(ZnWInfo *wi,
int pri;
if ((argc != first+2) && (argc != first+3)) {
- Tcl_WrongNumArgs(wi->interp, first+1, args, "pri ?tagOrId?");
- return TCL_ERROR;
+ Tcl_WrongNumArgs(wi->interp, first+1, args, "pri ?tagOrId?");
+ return TCL_ERROR;
}
if ((Tcl_GetIntFromObj(wi->interp, args[first+1], &pri) == TCL_ERROR) ||
- (pri < 0)){
- return TCL_ERROR;
+ (pri < 0)){
+ return TCL_ERROR;
}
/*
@@ -3139,14 +3139,14 @@ FindItems(ZnWInfo *wi,
* the given priority.
*/
if (ZnTagSearchScan(wi, (argc == first+3) ? args[first+2] : NULL,
- search_var) == TCL_ERROR) {
- return TCL_ERROR;
+ search_var) == TCL_ERROR) {
+ return TCL_ERROR;
}
for (item = ZnTagSearchFirst(*search_var);
- item != ZN_NO_ITEM; item = ZnTagSearchNext(*search_var)) {
- if (item->priority == (unsigned int) pri) {
- ZnDoItem(wi->interp, item, ZN_NO_PART, tag_uid);
- }
+ item != ZN_NO_ITEM; item = ZnTagSearchNext(*search_var)) {
+ if (item->priority == (unsigned int) pri) {
+ ZnDoItem(wi->interp, item, ZN_NO_PART, tag_uid);
+ }
}
}
break;
@@ -3155,22 +3155,22 @@ FindItems(ZnWInfo *wi,
*/
case ZN_S_BELOW:
{
- ZnItem next;
+ ZnItem next;
if (argc != first+2) {
- Tcl_WrongNumArgs(wi->interp, first+1, args, "tagOrId");
- return TCL_ERROR;
+ Tcl_WrongNumArgs(wi->interp, first+1, args, "tagOrId");
+ return TCL_ERROR;
}
item = ZN_NO_ITEM;
if (ZnTagSearchScan(wi, args[first+1], search_var) == TCL_ERROR) {
- return TCL_ERROR;
+ return TCL_ERROR;
}
for (next = ZnTagSearchFirst(*search_var);
- next != ZN_NO_ITEM; next = ZnTagSearchNext(*search_var)) {
- item = next;
+ next != ZN_NO_ITEM; next = ZnTagSearchNext(*search_var)) {
+ item = next;
}
if ((item != ZN_NO_ITEM) && (item->next != ZN_NO_ITEM)) {
- ZnDoItem(wi->interp, item->next, ZN_NO_PART, tag_uid);
+ ZnDoItem(wi->interp, item->next, ZN_NO_PART, tag_uid);
}
}
break;
@@ -3179,61 +3179,61 @@ FindItems(ZnWInfo *wi,
*/
case ZN_S_CLOSEST:
{
- int halo = 1;
- ZnPoint p;
- double d;
+ int halo = 1;
+ ZnPoint p;
+ double d;
if ((argc < first+3) || (argc > first+6)) {
- Tcl_WrongNumArgs(wi->interp, first+1, args, "x y ?halo? ?start?, ?recursive?");
- return TCL_ERROR;
+ Tcl_WrongNumArgs(wi->interp, first+1, args, "x y ?halo? ?start?, ?recursive?");
+ return TCL_ERROR;
}
if (Tcl_GetDoubleFromObj(wi->interp, args[first+1], &d) == TCL_ERROR) {
- return TCL_ERROR;
+ return TCL_ERROR;
}
p.x = d;
if (Tcl_GetDoubleFromObj(wi->interp, args[first+2], &d) == TCL_ERROR) {
- return TCL_ERROR;
+ return TCL_ERROR;
}
p.y = d;
if (argc > first+3) {
- if (Tcl_GetIntFromObj(wi->interp, args[first+3], &halo) == TCL_ERROR) {
- return TCL_ERROR;
- }
- if (halo < 0) {
- halo = 0;
- }
+ if (Tcl_GetIntFromObj(wi->interp, args[first+3], &halo) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+ if (halo < 0) {
+ halo = 0;
+ }
}
ps.in_group = ZN_NO_ITEM;
ps.start_item = ZN_NO_ITEM;
item = ZN_NO_ITEM;
if (argc > (first+4)) {
- result = ZnItemWithTagOrId(wi, args[first+4], &item, search_var);
- if ((result == TCL_OK) && (item != ZN_NO_ITEM)) {
- if ((item->class == ZnGroup) && !ZnGroupAtomic(item)) {
- ps.in_group = item;
- }
- else {
- ps.in_group = item->parent;
- ps.start_item = item->next;
- }
- }
+ result = ZnItemWithTagOrId(wi, args[first+4], &item, search_var);
+ if ((result == TCL_OK) && (item != ZN_NO_ITEM)) {
+ if ((item->class == ZnGroup) && !ZnGroupAtomic(item)) {
+ ps.in_group = item;
+ }
+ else {
+ ps.in_group = item->parent;
+ ps.start_item = item->next;
+ }
+ }
}
ps.recursive = True;
ps.override_atomic = False;
if (argc > first+5) {
- result = Tcl_GetBooleanFromObj(wi->interp, args[first+5], &ps.recursive);
- if (result != TCL_OK) {
- str = Tcl_GetString(args[first+5]);
- if (strcmp(str, "override") != 0) {
- Tcl_AppendResult(wi->interp,
- "recursive should be a boolean value or ",
- "override \"", str, "\"", NULL);
- return TCL_ERROR;
- }
- ps.recursive = True;
- ps.override_atomic = True;
- }
+ result = Tcl_GetBooleanFromObj(wi->interp, args[first+5], &ps.recursive);
+ if (result != TCL_OK) {
+ str = Tcl_GetString(args[first+5]);
+ if (strcmp(str, "override") != 0) {
+ Tcl_AppendResult(wi->interp,
+ "recursive should be a boolean value or ",
+ "override \"", str, "\"", NULL);
+ return TCL_ERROR;
+ }
+ ps.recursive = True;
+ ps.override_atomic = True;
+ }
}
/*
* We always start the search at the top group to use the
@@ -3247,8 +3247,8 @@ FindItems(ZnWInfo *wi,
wi->top_group->class->Pick(wi->top_group, &ps);
if (ps.a_item != ZN_NO_ITEM) {
- ZnDoItem(wi->interp, ps.a_item, ps.a_part, tag_uid);
- /*printf("first %d %d\n", ps.a_item->id, ps.a_part);*/
+ ZnDoItem(wi->interp, ps.a_item, ps.a_part, tag_uid);
+ /*printf("first %d %d\n", ps.a_item->id, ps.a_part);*/
}
}
break;
@@ -3258,35 +3258,35 @@ FindItems(ZnWInfo *wi,
case ZN_S_ENCLOSED:
{
if ((argc < first+5) || (argc > first+7)) {
- Tcl_WrongNumArgs(wi->interp, first+1, args, "x1 y1 x2 y2 ?inGroup? ?recursive?");
- return TCL_ERROR;
+ Tcl_WrongNumArgs(wi->interp, first+1, args, "x1 y1 x2 y2 ?inGroup? ?recursive?");
+ return TCL_ERROR;
}
item = wi->top_group;
if (argc > first+5) {
- result = ZnItemWithTagOrId(wi, args[first+5], &item, search_var);
- if ((result != TCL_OK) || (item == ZN_NO_ITEM) || (item->class != ZnGroup)) {
- return TCL_ERROR;
- }
+ result = ZnItemWithTagOrId(wi, args[first+5], &item, search_var);
+ if ((result != TCL_OK) || (item == ZN_NO_ITEM) || (item->class != ZnGroup)) {
+ return TCL_ERROR;
+ }
}
ps.recursive = True;
ps.override_atomic = False;
if (argc > first+6) {
- result = Tcl_GetBooleanFromObj(wi->interp, args[first+6], &ps.recursive);
- if (result != TCL_OK) {
- str = Tcl_GetString(args[first+6]);
- if (strcmp(str, "override") != 0) {
- Tcl_AppendResult(wi->interp,
- "recursive should be a boolean value or ",
- "override \"", str, "\"", NULL);
- return TCL_ERROR;
- }
- ps.recursive = True;
- ps.override_atomic = True;
- }
+ result = Tcl_GetBooleanFromObj(wi->interp, args[first+6], &ps.recursive);
+ if (result != TCL_OK) {
+ str = Tcl_GetString(args[first+6]);
+ if (strcmp(str, "override") != 0) {
+ Tcl_AppendResult(wi->interp,
+ "recursive should be a boolean value or ",
+ "override \"", str, "\"", NULL);
+ return TCL_ERROR;
+ }
+ ps.recursive = True;
+ ps.override_atomic = True;
+ }
}
return FindArea(wi, args+first+1, tag_uid,
- True, ps.recursive, ps.override_atomic,
- item);
+ True, ps.recursive, ps.override_atomic,
+ item);
}
break;
/*
@@ -3295,35 +3295,35 @@ FindItems(ZnWInfo *wi,
case ZN_S_OVERLAPPING:
{
if ((argc < first+5) || (argc > first+7)) {
- Tcl_WrongNumArgs(wi->interp, first+1, args, "x1 y1 x2 y2 ?inGroup? ?recursive?");
- return TCL_ERROR;
+ Tcl_WrongNumArgs(wi->interp, first+1, args, "x1 y1 x2 y2 ?inGroup? ?recursive?");
+ return TCL_ERROR;
}
item = wi->top_group;
if (argc > first+5) {
- result = ZnItemWithTagOrId(wi, args[first+5], &item, search_var);
- if ((result != TCL_OK) || (item == ZN_NO_ITEM) || (item->class != ZnGroup)) {
- return TCL_ERROR;
- }
+ result = ZnItemWithTagOrId(wi, args[first+5], &item, search_var);
+ if ((result != TCL_OK) || (item == ZN_NO_ITEM) || (item->class != ZnGroup)) {
+ return TCL_ERROR;
+ }
}
ps.recursive = True;
ps.override_atomic = False;
if (argc > first+6) {
- result = Tcl_GetBooleanFromObj(wi->interp, args[first+6], &ps.recursive);
- if (result != TCL_OK) {
- str = Tcl_GetString(args[first+6]);
- if (strcmp(str, "override") != 0) {
- Tcl_AppendResult(wi->interp,
- "recursive should be a boolean value or ",
- "override \"", str, "\"", NULL);
- return TCL_ERROR;
- }
- ps.recursive = True;
- ps.override_atomic = True;
- }
+ result = Tcl_GetBooleanFromObj(wi->interp, args[first+6], &ps.recursive);
+ if (result != TCL_OK) {
+ str = Tcl_GetString(args[first+6]);
+ if (strcmp(str, "override") != 0) {
+ Tcl_AppendResult(wi->interp,
+ "recursive should be a boolean value or ",
+ "override \"", str, "\"", NULL);
+ return TCL_ERROR;
+ }
+ ps.recursive = True;
+ ps.override_atomic = True;
+ }
}
return FindArea(wi, args+first+1, tag_uid,
- False, ps.recursive, ps.override_atomic,
- item);
+ False, ps.recursive, ps.override_atomic,
+ item);
}
break;
/*
@@ -3332,15 +3332,15 @@ FindItems(ZnWInfo *wi,
case ZN_S_WITHTAG:
{
if (argc != first+2) {
- Tcl_WrongNumArgs(wi->interp, first+1, args, "tagOrId");
- return TCL_ERROR;
+ Tcl_WrongNumArgs(wi->interp, first+1, args, "tagOrId");
+ return TCL_ERROR;
}
if (ZnTagSearchScan(wi, args[first+1], search_var) == TCL_ERROR) {
- return TCL_ERROR;
+ return TCL_ERROR;
}
for (item = ZnTagSearchFirst(*search_var);
- item != ZN_NO_ITEM; item = ZnTagSearchNext(*search_var)) {
- ZnDoItem(wi->interp, item, ZN_NO_PART, tag_uid);
+ item != ZN_NO_ITEM; item = ZnTagSearchNext(*search_var)) {
+ ZnDoItem(wi->interp, item, ZN_NO_PART, tag_uid);
}
}
break;
@@ -3349,17 +3349,17 @@ FindItems(ZnWInfo *wi,
*/
case ZN_S_WITHTYPE:
{
- ZnItemClass cls;
+ ZnItemClass cls;
if ((argc != first+2) && (argc != first+3)) {
- Tcl_WrongNumArgs(wi->interp, first+1, args, "itemType ?tagOrId?");
- return TCL_ERROR;
+ Tcl_WrongNumArgs(wi->interp, first+1, args, "itemType ?tagOrId?");
+ return TCL_ERROR;
}
cls = ZnLookupItemClass(Tcl_GetString(args[first+1]));
if (!cls) {
- Tcl_AppendResult(wi->interp, "unknown item type \"",
- Tcl_GetString(args[first+1]), "\"", NULL);
- return TCL_ERROR;
+ Tcl_AppendResult(wi->interp, "unknown item type \"",
+ Tcl_GetString(args[first+1]), "\"", NULL);
+ return TCL_ERROR;
}
/*
@@ -3367,14 +3367,14 @@ FindItems(ZnWInfo *wi,
* the given item type.
*/
if (ZnTagSearchScan(wi, (argc == first+3) ? args[first+2] : NULL,
- search_var) == TCL_ERROR) {
- return TCL_ERROR;
+ search_var) == TCL_ERROR) {
+ return TCL_ERROR;
}
for (item = ZnTagSearchFirst(*search_var);
- item != ZN_NO_ITEM; item = ZnTagSearchNext(*search_var)) {
- if (item->class == cls) {
- ZnDoItem(wi->interp, item, ZN_NO_PART, tag_uid);
- }
+ item != ZN_NO_ITEM; item = ZnTagSearchNext(*search_var)) {
+ if (item->class == cls) {
+ ZnDoItem(wi->interp, item, ZN_NO_PART, tag_uid);
+ }
}
}
break;
@@ -3392,19 +3392,19 @@ FindItems(ZnWInfo *wi,
*----------------------------------------------------------------------
*/
int
-ZnParseCoordList(ZnWInfo *wi,
- Tcl_Obj *arg,
- ZnPoint **pts,
- char **controls,
- unsigned int *num_pts,
- ZnBool *old_format)
+ZnParseCoordList(ZnWInfo *wi,
+ Tcl_Obj *arg,
+ ZnPoint **pts,
+ char **controls,
+ unsigned int *num_pts,
+ ZnBool *old_format)
{
- Tcl_Obj **elems, **selems;
- int i, result, num_elems, num_selems;
- ZnPoint *p;
- int old_style, len;
- char *str;
- double d;
+ Tcl_Obj **elems, **selems;
+ int i, result, num_elems, num_selems;
+ ZnPoint *p;
+ int old_style, len;
+ char *str;
+ double d;
if (controls) {
*controls = NULL;
@@ -3440,15 +3440,15 @@ ZnParseCoordList(ZnWInfo *wi,
ZnListAssertSize(ZnWorkPoints, *num_pts);
*pts = p = (ZnPoint *) ZnListArray(ZnWorkPoints);
for (i = 0; i < num_elems; i += 2, p++) {
- if (Tcl_GetDoubleFromObj(wi->interp, elems[i], &d) == TCL_ERROR) {
- goto coord_error;
- }
- p->x = d;
- if (Tcl_GetDoubleFromObj(wi->interp, elems[i+1], &d) == TCL_ERROR) {
- goto coord_error;
- }
- p->y = d;
- /*printf("Parsed a point: %g@%g, ", p->x, p->y);*/
+ if (Tcl_GetDoubleFromObj(wi->interp, elems[i], &d) == TCL_ERROR) {
+ goto coord_error;
+ }
+ p->x = d;
+ if (Tcl_GetDoubleFromObj(wi->interp, elems[i+1], &d) == TCL_ERROR) {
+ goto coord_error;
+ }
+ p->y = d;
+ /*printf("Parsed a point: %g@%g, ", p->x, p->y);*/
}
/*printf("\n");*/
}
@@ -3457,22 +3457,22 @@ ZnParseCoordList(ZnWInfo *wi,
ZnListAssertSize(ZnWorkPoints, *num_pts);
*pts = p = (ZnPoint *) ZnListArray(ZnWorkPoints);
if (Tcl_GetDoubleFromObj(wi->interp, elems[0], &d) == TCL_ERROR) {
- goto coord_error;
+ goto coord_error;
}
p->x = d;
if (Tcl_GetDoubleFromObj(wi->interp, elems[1], &d) == TCL_ERROR) {
- goto coord_error;
+ goto coord_error;
}
p->y = d;
if (controls) {
- if (! *controls) {
- *controls = ZnMalloc(*num_pts * sizeof(char));
- memset(*controls, 0, *num_pts * sizeof(char));
- }
- str = Tcl_GetStringFromObj(elems[2], &len);
- if (len) {
- (*controls)[0] = str[0];
- }
+ if (! *controls) {
+ *controls = ZnMalloc(*num_pts * sizeof(char));
+ memset(*controls, 0, *num_pts * sizeof(char));
+ }
+ str = Tcl_GetStringFromObj(elems[2], &len);
+ if (len) {
+ (*controls)[0] = str[0];
+ }
}
}
else {
@@ -3487,27 +3487,27 @@ ZnParseCoordList(ZnWInfo *wi,
for (i = 0; i < num_elems; i++, p++) {
result = Tcl_ListObjGetElements(wi->interp, elems[i], &num_selems, &selems);
if ((result == TCL_ERROR) || (num_selems < 2) || (num_selems > 3)) {
- goto coord_error;
+ goto coord_error;
}
if (Tcl_GetDoubleFromObj(wi->interp, selems[0], &d) == TCL_ERROR) {
- goto coord_error;
+ goto coord_error;
}
p->x = d;
if (Tcl_GetDoubleFromObj(wi->interp, selems[1], &d) == TCL_ERROR) {
- goto coord_error;
+ goto coord_error;
}
p->y = d;
if (controls) {
- if (num_selems == 3) {
- if (! *controls) {
- *controls = ZnMalloc(*num_pts * sizeof(char));
- memset(*controls, 0, *num_pts * sizeof(char));
- }
- str = Tcl_GetStringFromObj(selems[2], &len);
- if (len) {
- (*controls)[i] = str[0];
- }
- }
+ if (num_selems == 3) {
+ if (! *controls) {
+ *controls = ZnMalloc(*num_pts * sizeof(char));
+ memset(*controls, 0, *num_pts * sizeof(char));
+ }
+ str = Tcl_GetStringFromObj(selems[2], &len);
+ if (len) {
+ (*controls)[i] = str[0];
+ }
+ }
}
}
}
@@ -3527,22 +3527,22 @@ ZnParseCoordList(ZnWInfo *wi,
*----------------------------------------------------------------------
*/
static int
-Contour(ZnWInfo *wi,
- int argc,
- Tcl_Obj *CONST args[],
- ZnTagSearch **search_var)
+Contour(ZnWInfo *wi,
+ int argc,
+ Tcl_Obj *CONST args[],
+ ZnTagSearch **search_var)
{
- ZnPoint *points;
- ZnItem item, shape;
- unsigned int i, j, k,num_points;
- int cmd, cw, result;
- int winding_flag, revert = False;
- long index;
- char *controls;
- ZnBool simple=False;
- ZnPoly poly;
- ZnTransfo t, inv;
- ZnContour *contours;
+ ZnPoint *points;
+ ZnItem item, shape;
+ unsigned int i, j, k,num_points;
+ int cmd, cw, result;
+ int winding_flag, revert = False;
+ long index;
+ char *controls;
+ ZnBool simple=False;
+ ZnPoly poly;
+ ZnTransfo t, inv;
+ ZnContour *contours;
/* Keep this array in sync with ZnContourCmd in Types.h */
#ifdef PTK_800
@@ -3557,12 +3557,12 @@ Contour(ZnWInfo *wi,
result = ZnItemWithTagOrId(wi, args[2], &item, search_var);
if ((result == TCL_ERROR) || (item == ZN_NO_ITEM)){
Tcl_AppendResult(wi->interp, "unknown item \"", Tcl_GetString(args[2]),
- "\"", NULL);
+ "\"", NULL);
return TCL_ERROR;
}
if (!item->class->Contour) {
if (item->class->GetClipVertices ||
- item->class->GetContours) {
+ item->class->GetContours) {
Tcl_SetObjResult(wi->interp, Tcl_NewIntObj(1));
}
else {
@@ -3581,7 +3581,7 @@ Contour(ZnWInfo *wi,
* Get the sub-command
*/
if (Tcl_GetIndexFromObj(wi->interp, args[3], op_strings,
- "contour operation", 0, &cmd) != TCL_OK) {
+ "contour operation", 0, &cmd) != TCL_OK) {
return TCL_ERROR;
}
/*
@@ -3590,7 +3590,7 @@ Contour(ZnWInfo *wi,
if ((Tcl_GetIntFromObj(wi->interp, args[4], &winding_flag) != TCL_OK) ||
(winding_flag < -1) || (winding_flag > 1)) {
Tcl_AppendResult(wi->interp, " incorrect winding flag, should be -1, 0, 1, \"",
- Tcl_GetString(args[4]), "\"", NULL);
+ Tcl_GetString(args[4]), "\"", NULL);
return TCL_ERROR;
}
index = ZnListTail;
@@ -3598,7 +3598,7 @@ Contour(ZnWInfo *wi,
/* Look for an index value. */
if (Tcl_GetLongFromObj(wi->interp, args[5], &index) != TCL_OK) {
Tcl_AppendResult(wi->interp, " incorrect contour index \"",
- Tcl_GetString(args[5]), "\"", NULL);
+ Tcl_GetString(args[5]), "\"", NULL);
return TCL_ERROR;
}
argc--;
@@ -3613,8 +3613,8 @@ Contour(ZnWInfo *wi,
if ((result == TCL_ERROR) || (shape == ZN_NO_ITEM)) {
Tcl_ResetResult(wi->interp);
if (ZnParseCoordList(wi, args[5], &points,
- &controls, &num_points, NULL) == TCL_ERROR) {
- return TCL_ERROR;
+ &controls, &num_points, NULL) == TCL_ERROR) {
+ return TCL_ERROR;
}
/*
* Processing contours from an explicit list.
@@ -3627,24 +3627,24 @@ Contour(ZnWInfo *wi,
poly.contours[0].points = ZnMalloc(num_points*sizeof(ZnPoint));
cw = poly.contours[0].cw = !ZnTestCCW(points, num_points);
if (winding_flag != 0) {
- revert = cw ^ (winding_flag == -1);
+ revert = cw ^ (winding_flag == -1);
}
if (revert) {
- /* Revert the contour */
- for (i = 0; i < num_points; i++) {
- poly.contours[0].points[num_points-i-1] = points[i];
- }
- if (controls) {
- char ch;
- for (i = 0, j = num_points-1; i < j; i++, j--) {
- ch = controls[i];
- controls[i] = controls[j];
- controls[j] = ch;
- }
- }
+ /* Revert the contour */
+ for (i = 0; i < num_points; i++) {
+ poly.contours[0].points[num_points-i-1] = points[i];
+ }
+ if (controls) {
+ char ch;
+ for (i = 0, j = num_points-1; i < j; i++, j--) {
+ ch = controls[i];
+ controls[i] = controls[j];
+ controls[j] = ch;
+ }
+ }
}
else {
- memcpy(poly.contours[0].points, points, num_points*sizeof(ZnPoint));
+ memcpy(poly.contours[0].points, points, num_points*sizeof(ZnPoint));
}
poly.contours[0].controls = controls;
}
@@ -3653,10 +3653,10 @@ Contour(ZnWInfo *wi,
* Processing contours from an item
*/
if (winding_flag == 0) {
- Tcl_AppendResult(wi->interp,
- "Must supply an explicit winding direction (-1, 1)\nwhen adding a contour from an item",
- NULL);
- return TCL_ERROR;
+ Tcl_AppendResult(wi->interp,
+ "Must supply an explicit winding direction (-1, 1)\nwhen adding a contour from an item",
+ NULL);
+ return TCL_ERROR;
}
/*
* If something has changed in the geometry we need to
@@ -3664,36 +3664,36 @@ Contour(ZnWInfo *wi,
*/
Update(wi);
if (!shape->class->GetContours &&
- !shape->class->GetClipVertices) {
- Tcl_AppendResult(wi->interp, "class: \"", shape->class->name,
- "\" can't give a polygonal shape", NULL);
- return TCL_ERROR;
+ !shape->class->GetClipVertices) {
+ Tcl_AppendResult(wi->interp, "class: \"", shape->class->name,
+ "\" can't give a polygonal shape", NULL);
+ return TCL_ERROR;
}
if (!shape->class->GetContours) {
- ZnTriStrip tristrip;
- /*
- * If there is no GetContours method try to use
- * the GetClipVertices. It works only for simple
- * shapes (i.e tose returning a bounding box).
- */
- tristrip.num_strips = 0;
- /*
- * GetClipVertices _may_ return a tristrip describing a fan
- * this would lead to strange results. For now, this case
- * should not appear, the items candidates to such a behavior
- * export a GetContours method which has higher precedence.
- */
- simple = shape->class->GetClipVertices(shape, &tristrip);
- ZnPolyContour1(&poly, tristrip.strip1.points, tristrip.strip1.num_points,
- False);
- poly.contours[0].controls = NULL;
+ ZnTriStrip tristrip;
+ /*
+ * If there is no GetContours method try to use
+ * the GetClipVertices. It works only for simple
+ * shapes (i.e tose returning a bounding box).
+ */
+ tristrip.num_strips = 0;
+ /*
+ * GetClipVertices _may_ return a tristrip describing a fan
+ * this would lead to strange results. For now, this case
+ * should not appear, the items candidates to such a behavior
+ * export a GetContours method which has higher precedence.
+ */
+ simple = shape->class->GetClipVertices(shape, &tristrip);
+ ZnPolyContour1(&poly, tristrip.strip1.points, tristrip.strip1.num_points,
+ False);
+ poly.contours[0].controls = NULL;
}
else {
- poly.num_contours = 0;
- simple = shape->class->GetContours(shape, &poly);
+ poly.num_contours = 0;
+ simple = shape->class->GetContours(shape, &poly);
}
if (poly.num_contours == 0) {
- return TCL_OK;
+ return TCL_OK;
}
/*
* Compute the tranform to map the device points
@@ -3706,82 +3706,82 @@ Contour(ZnWInfo *wi,
* the contour(s) returned by the item.
*/
if (simple) {
- ZnPoint p[4];
- p[0] = poly.contours[0].points[0];
- p[2] = poly.contours[0].points[1];
- if (winding_flag == -1) {
- p[1].x = p[2].x;
- p[1].y = p[0].y;
- p[3].x = p[0].x;
- p[3].y = p[2].y;
- }
- else {
- p[1].x = p[0].x;
- p[1].y = p[2].y;
- p[3].x = p[2].x;
- p[3].y = p[0].y;
- }
- points = ZnMalloc(4*sizeof(ZnPoint));
- ZnTransformPoints(&inv, p, points, 4);
- poly.contours[0].points = points;
- poly.contours[0].num_points = 4;
- poly.contours[0].cw = (winding_flag == -1);
- poly.contours[0].controls = NULL;
+ ZnPoint p[4];
+ p[0] = poly.contours[0].points[0];
+ p[2] = poly.contours[0].points[1];
+ if (winding_flag == -1) {
+ p[1].x = p[2].x;
+ p[1].y = p[0].y;
+ p[3].x = p[0].x;
+ p[3].y = p[2].y;
+ }
+ else {
+ p[1].x = p[0].x;
+ p[1].y = p[2].y;
+ p[3].x = p[2].x;
+ p[3].y = p[0].y;
+ }
+ points = ZnMalloc(4*sizeof(ZnPoint));
+ ZnTransformPoints(&inv, p, points, 4);
+ poly.contours[0].points = points;
+ poly.contours[0].num_points = 4;
+ poly.contours[0].cw = (winding_flag == -1);
+ poly.contours[0].controls = NULL;
}
else {
- /* Unshare the contour array or use the static storage */
- contours = poly.contours;
- if (poly.num_contours == 1) {
- poly.contours = &poly.contour1;
- }
- else {
- poly.contours = ZnMalloc(poly.num_contours*sizeof(ZnContour));
- }
- for (i = 0; i < poly.num_contours; i++) {
- points = contours[i].points;
- num_points = contours[i].num_points;
- cw = contours[i].cw;
- poly.contours[i].num_points = num_points;
- poly.contours[i].cw = cw;
- if (contours[i].controls) {
- /*
- * The controls array returned by GetContour is shared.
- * Here we unshare it.
- */
- poly.contours[i].controls = ZnMalloc(num_points*sizeof(char));
- }
- /*
- * Unshare the point array.
- */
- poly.contours[i].points = ZnMalloc(num_points*sizeof(ZnPoint));
- ZnTransformPoints(&inv, points, poly.contours[i].points, num_points);
-
- if ((((poly.num_contours == 1) && ((winding_flag == -1) ^ cw)) ||
- ((poly.num_contours > 1) && (winding_flag == -1)))) {
- ZnPoint p;
-
- revert = True;
- /* Revert the points */
- poly.contours[i].cw = ! cw;
- for (j = 0, k = num_points-1; j < k; j++, k--) {
- p = poly.contours[i].points[j];
- poly.contours[i].points[j] = poly.contours[i].points[k];
- poly.contours[i].points[k] = p;
- }
-
- /* Revert the controls */
- if (contours[i].controls) {
- for (j = 0; j < num_points; j++) {
- poly.contours[i].controls[num_points-j-1] = contours[i].controls[j];
- }
- }
- }
- else {
- if (contours[i].controls) {
- memcpy(poly.contours[i].controls, contours[i].controls, num_points);
- }
- }
- }
+ /* Unshare the contour array or use the static storage */
+ contours = poly.contours;
+ if (poly.num_contours == 1) {
+ poly.contours = &poly.contour1;
+ }
+ else {
+ poly.contours = ZnMalloc(poly.num_contours*sizeof(ZnContour));
+ }
+ for (i = 0; i < poly.num_contours; i++) {
+ points = contours[i].points;
+ num_points = contours[i].num_points;
+ cw = contours[i].cw;
+ poly.contours[i].num_points = num_points;
+ poly.contours[i].cw = cw;
+ if (contours[i].controls) {
+ /*
+ * The controls array returned by GetContour is shared.
+ * Here we unshare it.
+ */
+ poly.contours[i].controls = ZnMalloc(num_points*sizeof(char));
+ }
+ /*
+ * Unshare the point array.
+ */
+ poly.contours[i].points = ZnMalloc(num_points*sizeof(ZnPoint));
+ ZnTransformPoints(&inv, points, poly.contours[i].points, num_points);
+
+ if ((((poly.num_contours == 1) && ((winding_flag == -1) ^ cw)) ||
+ ((poly.num_contours > 1) && (winding_flag == -1)))) {
+ ZnPoint p;
+
+ revert = True;
+ /* Revert the points */
+ poly.contours[i].cw = ! cw;
+ for (j = 0, k = num_points-1; j < k; j++, k--) {
+ p = poly.contours[i].points[j];
+ poly.contours[i].points[j] = poly.contours[i].points[k];
+ poly.contours[i].points[k] = p;
+ }
+
+ /* Revert the controls */
+ if (contours[i].controls) {
+ for (j = 0; j < num_points; j++) {
+ poly.contours[i].controls[num_points-j-1] = contours[i].controls[j];
+ }
+ }
+ }
+ else {
+ if (contours[i].controls) {
+ memcpy(poly.contours[i].controls, contours[i].controls, num_points);
+ }
+ }
+ }
}
}
@@ -3812,28 +3812,28 @@ Contour(ZnWInfo *wi,
*----------------------------------------------------------------------
*/
static int
-Coords(ZnWInfo *wi,
- int argc,
- Tcl_Obj *CONST args[],
- ZnTagSearch **search_var)
+Coords(ZnWInfo *wi,
+ int argc,
+ Tcl_Obj *CONST args[],
+ ZnTagSearch **search_var)
{
- ZnPoint *points;
- ZnItem item;
- unsigned int num_points, i;
- int result, cmd = ZN_COORDS_READ;
- long index, contour = 0;
- char *str, *controls = NULL;
- Tcl_Obj *l, *entries[3];
+ ZnPoint *points;
+ ZnItem item;
+ unsigned int num_points, i;
+ int result, cmd = ZN_COORDS_READ;
+ long index, contour = 0;
+ char *str, *controls = NULL;
+ Tcl_Obj *l, *entries[3];
result = ZnItemWithTagOrId(wi, args[2], &item, search_var);
if ((result == TCL_ERROR) || (item == ZN_NO_ITEM)) {
Tcl_AppendResult(wi->interp, " unknown item \"",
- Tcl_GetString(args[2]), "\"", NULL);
+ Tcl_GetString(args[2]), "\"", NULL);
return TCL_ERROR;
}
if (!item->class->Coords) {
Tcl_AppendResult(wi->interp, " ", item->class->name,
- " does not support the coords command", NULL);
+ " does not support the coords command", NULL);
return TCL_ERROR;
}
num_points = 0;
@@ -3842,7 +3842,7 @@ Coords(ZnWInfo *wi,
if (argc == 3) {
/* Get all coords of default contour (0). */
if (item->class->Coords(item, 0, 0, ZN_COORDS_READ_ALL,
- &points, &controls, &num_points) == TCL_ERROR) {
+ &points, &controls, &num_points) == TCL_ERROR) {
return TCL_ERROR;
}
coords_read:
@@ -3853,20 +3853,20 @@ Coords(ZnWInfo *wi,
Tcl_ListObjAppendElement(wi->interp, l, Tcl_NewDoubleObj(points->x));
Tcl_ListObjAppendElement(wi->interp, l, Tcl_NewDoubleObj(points->y));
if (controls && *controls) {
- Tcl_ListObjAppendElement(wi->interp, l, Tcl_NewStringObj(controls, 1));
+ Tcl_ListObjAppendElement(wi->interp, l, Tcl_NewStringObj(controls, 1));
}
}
else {
for (i = 0; i < num_points; i++, points++) {
- entries[0] = Tcl_NewDoubleObj(points->x);
- entries[1] = Tcl_NewDoubleObj(points->y);
- if (controls && controls[i]) {
- entries[2] = Tcl_NewStringObj(&controls[i], 1);
- Tcl_ListObjAppendElement(wi->interp, l, Tcl_NewListObj(3, entries));
- }
- else {
- Tcl_ListObjAppendElement(wi->interp, l, Tcl_NewListObj(2, entries));
- }
+ entries[0] = Tcl_NewDoubleObj(points->x);
+ entries[1] = Tcl_NewDoubleObj(points->y);
+ if (controls && controls[i]) {
+ entries[2] = Tcl_NewStringObj(&controls[i], 1);
+ Tcl_ListObjAppendElement(wi->interp, l, Tcl_NewListObj(3, entries));
+ }
+ else {
+ Tcl_ListObjAppendElement(wi->interp, l, Tcl_NewListObj(2, entries));
+ }
}
}
return TCL_OK;
@@ -3880,7 +3880,7 @@ Coords(ZnWInfo *wi,
if ((str[0] == 'a') && (strcmp(str, "add") == 0)) {
if ((argc < 5) || (argc > 7)) {
Tcl_WrongNumArgs(wi->interp, 1, args,
- "coords tagOrId add ?contour? ?index? coordList");
+ "coords tagOrId add ?contour? ?index? coordList");
return TCL_ERROR;
}
cmd = ZN_COORDS_ADD;
@@ -3889,7 +3889,7 @@ Coords(ZnWInfo *wi,
else if ((str[0] == 'r') && (strcmp(str, "remove") == 0)) {
if ((argc != 5) && (argc != 6)) {
Tcl_WrongNumArgs(wi->interp, 1, args,
- "coords tagOrId remove ?contour? index");
+ "coords tagOrId remove ?contour? index");
return TCL_ERROR;
}
cmd = ZN_COORDS_REMOVE;
@@ -3904,32 +3904,32 @@ Coords(ZnWInfo *wi,
if (Tcl_GetLongFromObj(wi->interp, args[i], &index) != TCL_OK) {
Tcl_ResetResult(wi->interp);
if (((argc == 5) && (cmd != ZN_COORDS_ADD) && (cmd != ZN_COORDS_REMOVE)) ||
- (argc == 6) || (argc == 7)) {
+ (argc == 6) || (argc == 7)) {
Tcl_AppendResult(wi->interp, " incorrect contour index \"",
- Tcl_GetString(args[i]), "\"", NULL);
+ Tcl_GetString(args[i]), "\"", NULL);
return TCL_ERROR;
}
else if ((argc == 5) && (cmd != ZN_COORDS_ADD)) {
Tcl_AppendResult(wi->interp, " incorrect coord index \"",
- Tcl_GetString(args[i]), "\"", NULL);
+ Tcl_GetString(args[i]), "\"", NULL);
return TCL_ERROR;
}
else if (ZnParseCoordList(wi, args[argc-1], &points,
- &controls, &num_points, NULL) == TCL_ERROR) {
+ &controls, &num_points, NULL) == TCL_ERROR) {
return TCL_ERROR;
}
if (cmd == ZN_COORDS_ADD) {
/* Append coords at end of default contour (0). */
if (item->class->Coords(item, 0, 0, ZN_COORDS_ADD_LAST,
- &points, &controls, &num_points) == TCL_ERROR) {
- return TCL_ERROR;
+ &points, &controls, &num_points) == TCL_ERROR) {
+ return TCL_ERROR;
}
}
else {
/* Set all coords of default contour (0). */
if (item->class->Coords(item, 0, 0, ZN_COORDS_REPLACE_ALL,
- &points, &controls, &num_points) == TCL_ERROR) {
- return TCL_ERROR;
+ &points, &controls, &num_points) == TCL_ERROR) {
+ return TCL_ERROR;
}
}
if (controls) {
@@ -3942,7 +3942,7 @@ Coords(ZnWInfo *wi,
if (argc == 4) {
/* Get all coords of contour. */
if (item->class->Coords(item, contour, 0, ZN_COORDS_READ_ALL,
- &points, &controls, &num_points) == TCL_ERROR) {
+ &points, &controls, &num_points) == TCL_ERROR) {
return TCL_ERROR;
}
goto coords_read;
@@ -3950,7 +3950,7 @@ Coords(ZnWInfo *wi,
else if ((argc == 5) && (cmd == ZN_COORDS_REMOVE)) {
/* Remove coord at index in default contour (0). */
if (item->class->Coords(item, 0, index, ZN_COORDS_REMOVE,
- &points, &controls, &num_points) == TCL_ERROR) {
+ &points, &controls, &num_points) == TCL_ERROR) {
return TCL_ERROR;
}
return TCL_OK;
@@ -3964,25 +3964,25 @@ Coords(ZnWInfo *wi,
Tcl_ResetResult(wi->interp);
if ((argc == 7) || ((argc == 6) && (cmd != ZN_COORDS_ADD))) {
Tcl_AppendResult(wi->interp, " incorrect coord index \"",
- Tcl_GetString(args[i]), "\"", NULL);
+ Tcl_GetString(args[i]), "\"", NULL);
return TCL_ERROR;
}
else if (ZnParseCoordList(wi, args[argc-1], &points,
- &controls, &num_points, NULL) == TCL_ERROR) {
+ &controls, &num_points, NULL) == TCL_ERROR) {
return TCL_ERROR;
}
if (cmd == ZN_COORDS_ADD) {
/* Append coords at end of contour. */
if (item->class->Coords(item, contour, 0, ZN_COORDS_ADD_LAST,
- &points, &controls, &num_points) == TCL_ERROR) {
- return TCL_ERROR;
+ &points, &controls, &num_points) == TCL_ERROR) {
+ return TCL_ERROR;
}
}
else {
/* Set all coords of contour. */
if (item->class->Coords(item, contour, 0, ZN_COORDS_REPLACE_ALL,
- &points, &controls, &num_points) == TCL_ERROR) {
- return TCL_ERROR;
+ &points, &controls, &num_points) == TCL_ERROR) {
+ return TCL_ERROR;
}
}
if (controls) {
@@ -3993,17 +3993,17 @@ Coords(ZnWInfo *wi,
if (argc == 5) {
/* Get coord of contour at index. */
if (item->class->Coords(item, contour, index, ZN_COORDS_READ,
- &points, &controls, &num_points) == TCL_ERROR) {
+ &points, &controls, &num_points) == TCL_ERROR) {
return TCL_ERROR;
}
if (num_points) {
/*printf(" coords: read contour:%d, index:%d, point is %g@%g\n",
- contour, index, points->x, points->y); */
+ contour, index, points->x, points->y); */
l = Tcl_GetObjResult(wi->interp);
Tcl_ListObjAppendElement(wi->interp, l, Tcl_NewDoubleObj(points->x));
Tcl_ListObjAppendElement(wi->interp, l, Tcl_NewDoubleObj(points->y));
if (controls && *controls) {
- Tcl_ListObjAppendElement(wi->interp, l, Tcl_NewStringObj(controls, 1));
+ Tcl_ListObjAppendElement(wi->interp, l, Tcl_NewStringObj(controls, 1));
}
}
return TCL_OK;
@@ -4011,7 +4011,7 @@ Coords(ZnWInfo *wi,
else if ((argc == 6) && (cmd == ZN_COORDS_REMOVE)) {
/* Remove coord of contour at index. */
if (item->class->Coords(item, contour, index, ZN_COORDS_REMOVE,
- &points, &controls, &num_points) == TCL_ERROR) {
+ &points, &controls, &num_points) == TCL_ERROR) {
return TCL_ERROR;
}
return TCL_OK;
@@ -4019,7 +4019,7 @@ Coords(ZnWInfo *wi,
/* Set a single coord or add coords at index in contour. */
if (ZnParseCoordList(wi, args[argc-1], &points,
- &controls, &num_points, NULL) == TCL_ERROR) {
+ &controls, &num_points, NULL) == TCL_ERROR) {
return TCL_ERROR;
}
if (argc == 6) {
@@ -4027,7 +4027,7 @@ Coords(ZnWInfo *wi,
cmd = ZN_COORDS_REPLACE;
}
if (item->class->Coords(item, contour, index, cmd,
- &points, &controls, &num_points) == TCL_ERROR) {
+ &points, &controls, &num_points) == TCL_ERROR) {
return TCL_ERROR;
}
if (controls) {
@@ -4042,41 +4042,41 @@ Coords(ZnWInfo *wi,
*
* WidgetObjCmd --
*
- * This procedure is invoked to process the Tcl command
- * that corresponds to a widget managed by this module.
- * See the user documentation for details on what it does.
+ * This procedure is invoked to process the Tcl command
+ * that corresponds to a widget managed by this module.
+ * See the user documentation for details on what it does.
*
* Results:
- * A standard Tcl result.
+ * A standard Tcl result.
*
* Side effects:
- * See the user documentation.
+ * See the user documentation.
*
*----------------------------------------------------------------------
*/
static int
-WidgetObjCmd(ClientData client_data, /* Information about the widget. */
- Tcl_Interp *interp, /* Current interpreter. */
- int argc, /* Number of arguments. */
- Tcl_Obj *CONST args[]) /* Arguments. */
+WidgetObjCmd(ClientData client_data, /* Information about the widget. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int argc, /* Number of arguments. */
+ Tcl_Obj *CONST args[]) /* Arguments. */
{
- ZnWInfo *wi = (ZnWInfo *) client_data;
- int length, result, cmd_index, index;
- ZnItem item, item2;
- int field = ZN_NO_PART;
- unsigned int num = 0, i, j;
- char *end, *str;
- ZnTransfo *t = NULL;
- Tcl_Obj *l;
- ZnTagSearch *search_var = NULL;
+ ZnWInfo *wi = (ZnWInfo *) client_data;
+ int length, result, cmd_index, index;
+ ZnItem item, item2;
+ int field = ZN_NO_PART;
+ unsigned int num = 0, i, j;
+ char *end, *str;
+ ZnTransfo *t = NULL;
+ Tcl_Obj *l;
+ ZnTagSearch *search_var = NULL;
Tcl_HashEntry *entry;
- ZnPoint *points;
- ZnPoint p;
- unsigned int num_points;
- ZnList to_points;
- Tcl_Obj *entries[3];
- char c[] = "c";
- double d;
+ ZnPoint *points;
+ ZnPoint p;
+ unsigned int num_points;
+ ZnList to_points;
+ Tcl_Obj *entries[3];
+ char c[] = "c";
+ double d;
#ifdef PTK_800
static char *sub_cmd_strings[] =
@@ -4096,7 +4096,7 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
"transform", "translate", "treset", "trestore", "tsave",
"tset", "type", "vertexat", "xview", "yview", NULL
};
- enum sub_cmds {
+ enum sub_cmds {
ZN_W_ADD, ZN_W_ADDTAG, ZN_W_ANCHORXY, ZN_W_BBOX, ZN_W_BECOMES, ZN_W_BIND,
ZN_W_CGET, ZN_W_CHGGROUP, ZN_W_CLONE, ZN_W_CONFIGURE,
ZN_W_CONTOUR, ZN_W_COORDS, ZN_W_CURRENTPART, ZN_W_CURSOR, ZN_W_DCHARS,
@@ -4117,7 +4117,7 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
{
"adjust", "clear", "from", "item", "to", NULL
};
- enum sel_cmds {
+ enum sel_cmds {
ZN_SEL_ADJUST, ZN_SEL_CLEAR, ZN_SEL_FROM, ZN_SEL_ITEM, ZN_SEL_TO
};
@@ -4130,7 +4130,7 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
Tcl_Preserve((ClientData) wi);
if (Tcl_GetIndexFromObj(interp, args[1], sub_cmd_strings,
- "subcommand", 0, &cmd_index) != TCL_OK) {
+ "subcommand", 0, &cmd_index) != TCL_OK) {
goto error;
}
result = TCL_OK;
@@ -4143,51 +4143,51 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
*/
case ZN_W_ADD:
{
- ZnItem group;
+ ZnItem group;
ZnItemClass cls;
if (argc == 2) { /* create subcommand alone, return the list of known
- * object types. */
- ZnItemClass *classes = ZnListArray(ZnItemClassList());
-
- num = ZnListSize(ZnItemClassList());
- l = Tcl_GetObjResult(interp);
- for (i = 0; i < num; i++) {
- Tcl_ListObjAppendElement(interp, l, Tcl_NewStringObj(classes[i]->name, -1));
- }
- goto done;
+ * object types. */
+ ZnItemClass *classes = ZnListArray(ZnItemClassList());
+
+ num = ZnListSize(ZnItemClassList());
+ l = Tcl_GetObjResult(interp);
+ for (i = 0; i < num; i++) {
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewStringObj(classes[i]->name, -1));
+ }
+ goto done;
}
if ((argc < 4)) {
add_err:
- Tcl_WrongNumArgs(interp, 1, args, "add type group ?args?");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args, "add type group ?args?");
+ goto error;
}
str = Tcl_GetString(args[2]);
if (str[0] == '-') {
- goto add_err;
+ goto add_err;
}
cls = ZnLookupItemClass(str);
if (!cls) {
- Tcl_AppendResult(interp, "unknown item type \"", str, "\"", NULL);
- goto error;
+ Tcl_AppendResult(interp, "unknown item type \"", str, "\"", NULL);
+ goto error;
}
result = ZnItemWithTagOrId(wi, args[3], &group, &search_var);
if ((result == TCL_ERROR) || (group == ZN_NO_ITEM) ||
- (group->class != ZnGroup)) {
- Tcl_AppendResult(interp, ", group item expected, got \"",
- Tcl_GetString(args[3]), "\"", NULL);
- goto error;
+ (group->class != ZnGroup)) {
+ Tcl_AppendResult(interp, ", group item expected, got \"",
+ Tcl_GetString(args[3]), "\"", NULL);
+ goto error;
}
argc -= 4;
args += 4;
item = ZnCreateItem(wi, cls, &argc, &args);
if (item == ZN_NO_ITEM) {
- goto error;
+ goto error;
}
ZnITEM.InsertItem(item, group, ZN_NO_ITEM, True);
if (ZnITEM.ConfigureItem(item, ZN_NO_PART, argc, args, True) == TCL_ERROR) {
- goto error;
+ goto error;
}
wi->hot_item = item;
wi->hot_prev = item->previous;
@@ -4201,8 +4201,8 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
case ZN_W_ADDTAG:
{
if (argc < 4) {
- Tcl_WrongNumArgs(interp, 1, args, "addtag tag searchCommand ?arg arg ...?");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args, "addtag tag searchCommand ?arg arg ...?");
+ goto error;
}
result = FindItems(wi, argc, args, args[2], 3, &search_var);
}
@@ -4212,21 +4212,21 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
*/
case ZN_W_ANCHORXY:
{
- Tk_Anchor anchor;
+ Tk_Anchor anchor;
if (argc != 4) {
- Tcl_WrongNumArgs(interp, 1, args, "anchorxy tagOrId anchor");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args, "anchorxy tagOrId anchor");
+ goto error;
}
result = ZnItemWithTagOrId(wi, args[2], &item, &search_var);
if ((result == TCL_ERROR) || (item == ZN_NO_ITEM) ||
- ISCLEAR(item->class->flags, ZN_CLASS_HAS_ANCHORS)) {
- Tcl_AppendResult(interp, "unknown item or doesn't support anchors \"",
- Tcl_GetString(args[2]), NULL);
- goto error;
+ ISCLEAR(item->class->flags, ZN_CLASS_HAS_ANCHORS)) {
+ Tcl_AppendResult(interp, "unknown item or doesn't support anchors \"",
+ Tcl_GetString(args[2]), NULL);
+ goto error;
}
if (Tk_GetAnchor(interp, Tcl_GetString(args[3]), &anchor)) {
- goto error;
+ goto error;
}
/*
* If something has changed in the geometry we need to
@@ -4253,13 +4253,13 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
*/
case ZN_W_BBOX:
{
- ZnBBox bbox;
- ZnDim width, height;
+ ZnBBox bbox;
+ ZnDim width, height;
ZnFieldSet fs;
if (argc < 3) {
- Tcl_WrongNumArgs(interp, 1, args, "bbox ?-field fieldNo? ?-label? tagOrId ?tagOrId ...?");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args, "bbox ?-field fieldNo? ?-label? tagOrId ?tagOrId ...?");
+ goto error;
}
argc -= 2;
args += 2;
@@ -4269,76 +4269,76 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
str = Tcl_GetString(args[0]);
if (*str == '-') {
- if ((strcmp(str, "-field") == 0) && (argc > 2)) {
- if (Tcl_GetIntFromObj(wi->interp, args[1], &field) == TCL_ERROR) {
- goto error;
- }
- argc -= 2;
- args += 2;
- }
- else if ((strcmp(str, "-label") == 0) && (argc > 1)) {
- field = -1;
- argc--;
- args++;
- }
- else {
- Tcl_AppendResult(interp, "bbox option should be -field numField or -label",
- NULL);
- goto error;
- }
- result = ZnItemWithTagOrId(wi, args[0], &item, &search_var);
- if ((result == TCL_ERROR) || (item == ZN_NO_ITEM) ||
- ! item->class->GetFieldSet) {
- Tcl_AppendResult(interp, "unknown item or doesn't support fields \"",
- Tcl_GetString(args[0]), "\"", NULL);
- goto error;
- }
- fs = item->class->GetFieldSet(item);
- if (field >= 0) {
- if ((unsigned int) field >= fs->num_fields) {
- Tcl_AppendResult(interp, "field index is out of bounds", NULL);
- goto error;
- }
- ZnFIELD.GetFieldBBox(fs, field, &bbox);
- }
- else {
- ZnFIELD.GetLabelBBox(fs, &width, &height);
- if (width && height) {
- p.x = ZnNearestInt(fs->label_pos.x);
- p.y = ZnNearestInt(fs->label_pos.y);
- ZnAddPointToBBox(&bbox, p.x, p.y);
- p.x += width;
- p.y += height;
- ZnAddPointToBBox(&bbox, p.x, p.y);
- }
- }
+ if ((strcmp(str, "-field") == 0) && (argc > 2)) {
+ if (Tcl_GetIntFromObj(wi->interp, args[1], &field) == TCL_ERROR) {
+ goto error;
+ }
+ argc -= 2;
+ args += 2;
+ }
+ else if ((strcmp(str, "-label") == 0) && (argc > 1)) {
+ field = -1;
+ argc--;
+ args++;
+ }
+ else {
+ Tcl_AppendResult(interp, "bbox option should be -field numField or -label",
+ NULL);
+ goto error;
+ }
+ result = ZnItemWithTagOrId(wi, args[0], &item, &search_var);
+ if ((result == TCL_ERROR) || (item == ZN_NO_ITEM) ||
+ ! item->class->GetFieldSet) {
+ Tcl_AppendResult(interp, "unknown item or doesn't support fields \"",
+ Tcl_GetString(args[0]), "\"", NULL);
+ goto error;
+ }
+ fs = item->class->GetFieldSet(item);
+ if (field >= 0) {
+ if ((unsigned int) field >= fs->num_fields) {
+ Tcl_AppendResult(interp, "field index is out of bounds", NULL);
+ goto error;
+ }
+ ZnFIELD.GetFieldBBox(fs, field, &bbox);
+ }
+ else {
+ ZnFIELD.GetLabelBBox(fs, &width, &height);
+ if (width && height) {
+ p.x = ZnNearestInt(fs->label_pos.x);
+ p.y = ZnNearestInt(fs->label_pos.y);
+ ZnAddPointToBBox(&bbox, p.x, p.y);
+ p.x += width;
+ p.y += height;
+ ZnAddPointToBBox(&bbox, p.x, p.y);
+ }
+ }
}
else {
- for (i = 0; i < (unsigned int) argc; i++) {
- /*
- * Check for options in wrong place amidst tags.
- */
- str = Tcl_GetString(args[i]);
- if (*str == '-') {
- Tcl_AppendResult(interp, "bbox options should be specified before any tag", NULL);
- goto error;
- }
- if (ZnTagSearchScan(wi, args[i], &search_var) == TCL_ERROR) {
- goto error;
- }
- for (item = ZnTagSearchFirst(search_var);
- item != ZN_NO_ITEM; item = ZnTagSearchNext(search_var)) {
- ZnAddBBoxToBBox(&bbox, &item->item_bounding_box);
- }
- }
+ for (i = 0; i < (unsigned int) argc; i++) {
+ /*
+ * Check for options in wrong place amidst tags.
+ */
+ str = Tcl_GetString(args[i]);
+ if (*str == '-') {
+ Tcl_AppendResult(interp, "bbox options should be specified before any tag", NULL);
+ goto error;
+ }
+ if (ZnTagSearchScan(wi, args[i], &search_var) == TCL_ERROR) {
+ goto error;
+ }
+ for (item = ZnTagSearchFirst(search_var);
+ item != ZN_NO_ITEM; item = ZnTagSearchNext(search_var)) {
+ ZnAddBBoxToBBox(&bbox, &item->item_bounding_box);
+ }
+ }
}
if (!ZnIsEmptyBBox(&bbox)) {
- l = Tcl_GetObjResult(interp);
- Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(bbox.orig.x));
- Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(bbox.orig.y));
- Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(bbox.corner.x));
- Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(bbox.corner.y));
+ l = Tcl_GetObjResult(interp);
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(bbox.orig.x));
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(bbox.orig.y));
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(bbox.corner.x));
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(bbox.corner.y));
}
}
break;
@@ -4347,13 +4347,13 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
*/
case ZN_W_BIND:
{
- ClientData elem = 0;
- int part = ZN_NO_PART;
+ ClientData elem = 0;
+ int part = ZN_NO_PART;
if ((argc < 3) || (argc > 6)) {
- Tcl_WrongNumArgs(interp, 1, args,
- "bind tagOrId ?part? ?sequence? ?command?");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args,
+ "bind tagOrId ?part? ?sequence? ?command?");
+ goto error;
}
/*
* Test if (a) an itemid or (b) an itemid:part or
@@ -4365,142 +4365,142 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
args += 3;
if (isdigit(str[0])) {
- int id;
-
- id = strtoul(str, &end, 0);
- if ((*end != 0) && (*end != ':')) {
- goto bind_a_tag;
- }
- entry = Tcl_FindHashEntry(wi->id_table, (char *) id);
- if (entry == NULL) {
- Tcl_AppendResult(interp, "item \"", str, "\" doesn't exist", NULL);
- goto error;
- }
- item = elem = Tcl_GetHashValue(entry);
- if (!elem) {
- goto error;
- }
-
- if (*end == ':') {
- /*
- * The part is provided with the id (old method).
- */
- end++;
- part_encode:
- if (item->class->Part) {
- l = Tcl_NewStringObj(end, -1);
- if (item->class->Part(item, &l, &part) == TCL_ERROR) {
- goto error;
- }
- elem = EncodeItemPart(item, part);
- }
- else {
- Tcl_AppendResult(interp, "item \"", str, "\" doesn't have parts", NULL);
- goto error;
- }
- }
- else {
- /*
- * Check if a part is given in the next parameter
- * (alternative method for providing a part).
- */
- if (argc > 3) {
- str = Tcl_GetString(args[0]);
- if (str[0] != '<') {
- end = str;
- argc--;
- args++;
- goto part_encode;
- }
- }
- }
- /*printf("adding element 0x%X to the binding table of item 0x%X\n", elem, item);*/
+ int id;
+
+ id = strtoul(str, &end, 0);
+ if ((*end != 0) && (*end != ':')) {
+ goto bind_a_tag;
+ }
+ entry = Tcl_FindHashEntry(wi->id_table, (char *) id);
+ if (entry == NULL) {
+ Tcl_AppendResult(interp, "item \"", str, "\" doesn't exist", NULL);
+ goto error;
+ }
+ item = elem = Tcl_GetHashValue(entry);
+ if (!elem) {
+ goto error;
+ }
+
+ if (*end == ':') {
+ /*
+ * The part is provided with the id (old method).
+ */
+ end++;
+ part_encode:
+ if (item->class->Part) {
+ l = Tcl_NewStringObj(end, -1);
+ if (item->class->Part(item, &l, &part) == TCL_ERROR) {
+ goto error;
+ }
+ elem = EncodeItemPart(item, part);
+ }
+ else {
+ Tcl_AppendResult(interp, "item \"", str, "\" doesn't have parts", NULL);
+ goto error;
+ }
+ }
+ else {
+ /*
+ * Check if a part is given in the next parameter
+ * (alternative method for providing a part).
+ */
+ if (argc > 3) {
+ str = Tcl_GetString(args[0]);
+ if (str[0] != '<') {
+ end = str;
+ argc--;
+ args++;
+ goto part_encode;
+ }
+ }
+ }
+ /*printf("adding element 0x%X to the binding table of item 0x%X\n", elem, item);*/
}
else {
bind_a_tag:
- elem = (ClientData) Tk_GetUid(str);
+ elem = (ClientData) Tk_GetUid(str);
}
/*
* Make a binding table if the widget doesn't already have one.
*/
if (wi->binding_table == NULL) {
- wi->binding_table = Tk_CreateBindingTable(interp);
+ wi->binding_table = Tk_CreateBindingTable(interp);
}
if (argc == 2) {
- int append = 0;
- unsigned long mask;
-
- str = Tcl_GetString(args[1]);
- if (str[0] == 0) {
- result = Tk_DeleteBinding(interp, wi->binding_table, elem,
- Tcl_GetString(args[0]));
- goto done;
- }
+ int append = 0;
+ unsigned long mask;
+
+ str = Tcl_GetString(args[1]);
+ if (str[0] == 0) {
+ result = Tk_DeleteBinding(interp, wi->binding_table, elem,
+ Tcl_GetString(args[0]));
+ goto done;
+ }
#ifdef PTK
- mask = Tk_CreateBinding(interp, wi->binding_table,
- elem, Tcl_GetString(args[0]), args[1], append);
+ mask = Tk_CreateBinding(interp, wi->binding_table,
+ elem, Tcl_GetString(args[0]), args[1], append);
#else
- if (str[0] == '+') {
- str++;
- append = 1;
- }
- mask = Tk_CreateBinding(interp, wi->binding_table,
- elem, Tcl_GetString(args[0]), str, append);
+ if (str[0] == '+') {
+ str++;
+ append = 1;
+ }
+ mask = Tk_CreateBinding(interp, wi->binding_table,
+ elem, Tcl_GetString(args[0]), str, append);
#endif
- if (mask == 0) {
- goto error;
- }
- if (mask & (unsigned) ~(ButtonMotionMask | Button1MotionMask |
- Button2MotionMask | Button3MotionMask |
- Button4MotionMask | Button5MotionMask |
- ButtonPressMask | ButtonReleaseMask |
- EnterWindowMask | LeaveWindowMask |
- KeyPressMask | KeyReleaseMask |
- PointerMotionMask | VirtualEventMask)) {
- Tk_DeleteBinding(interp, wi->binding_table, elem, Tcl_GetString(args[3]));
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "requested illegal events; ",
- "only key, button, motion, enter, leave ",
- "and virtual events may be used", NULL);
- goto error;
- }
+ if (mask == 0) {
+ goto error;
+ }
+ if (mask & (unsigned) ~(ButtonMotionMask | Button1MotionMask |
+ Button2MotionMask | Button3MotionMask |
+ Button4MotionMask | Button5MotionMask |
+ ButtonPressMask | ButtonReleaseMask |
+ EnterWindowMask | LeaveWindowMask |
+ KeyPressMask | KeyReleaseMask |
+ PointerMotionMask | VirtualEventMask)) {
+ Tk_DeleteBinding(interp, wi->binding_table, elem, Tcl_GetString(args[3]));
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "requested illegal events; ",
+ "only key, button, motion, enter, leave ",
+ "and virtual events may be used", NULL);
+ goto error;
+ }
}
else if (argc == 1) {
#ifdef PTK
- Tcl_Obj *command;
- command = Tk_GetBinding(interp, wi->binding_table, elem,
- Tcl_GetString(args[0]));
- if (command == NULL) {
- char *string = Tcl_GetString(Tcl_GetObjResult(interp));
- /*
- * Ignore missing binding errors. This is a special hack
- * that relies on the error message returned by FindSequence
- * in tkBind.c.
- */
- if (string[0] != '\0') {
- goto error;
- }
- else {
- Tcl_ResetResult(interp);
- }
- }
- else {
- Tcl_SetObjResult(interp, command);
- }
+ Tcl_Obj *command;
+ command = Tk_GetBinding(interp, wi->binding_table, elem,
+ Tcl_GetString(args[0]));
+ if (command == NULL) {
+ char *string = Tcl_GetString(Tcl_GetObjResult(interp));
+ /*
+ * Ignore missing binding errors. This is a special hack
+ * that relies on the error message returned by FindSequence
+ * in tkBind.c.
+ */
+ if (string[0] != '\0') {
+ goto error;
+ }
+ else {
+ Tcl_ResetResult(interp);
+ }
+ }
+ else {
+ Tcl_SetObjResult(interp, command);
+ }
#else
- CONST char *command;
- command = Tk_GetBinding(interp, wi->binding_table, elem,
- Tcl_GetString(args[0]));
- if (command == NULL) {
- goto error;
- }
- Tcl_SetObjResult(interp, Tcl_NewStringObj(command, -1));
+ CONST char *command;
+ command = Tk_GetBinding(interp, wi->binding_table, elem,
+ Tcl_GetString(args[0]));
+ if (command == NULL) {
+ goto error;
+ }
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(command, -1));
#endif
}
else {
- Tk_GetAllBindings(interp, wi->binding_table, elem);
+ Tk_GetAllBindings(interp, wi->binding_table, elem);
}
}
break;
@@ -4510,16 +4510,16 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
case ZN_W_CGET:
{
if (argc != 3) {
- Tcl_WrongNumArgs(interp, 1, args, "cget option");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args, "cget option");
+ goto error;
}
#ifdef PTK_800
result = Tk_ConfigureValue(interp, wi->win, config_specs,
- (char *) wi, Tcl_GetString(args[2]), 0);
+ (char *) wi, Tcl_GetString(args[2]), 0);
#else
l = Tk_GetOptionValue(interp, (char *) wi, wi->opt_table, args[2], wi->win);
if (l == NULL) {
- goto error;
+ goto error;
}
Tcl_SetObjResult(interp, l);
#endif
@@ -4530,28 +4530,28 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
*/
case ZN_W_CHGGROUP:
{
- ZnItem grp, scan;
- int adjust=0;
+ ZnItem grp, scan;
+ int adjust=0;
ZnTransfo inv, t, t2, *this_one=NULL;
if ((argc != 4) && (argc != 5)) {
- Tcl_WrongNumArgs(interp, 1, args, "chggroup tagOrIg group ?adjustTransform?");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args, "chggroup tagOrIg group ?adjustTransform?");
+ goto error;
}
result = ZnItemWithTagOrId(wi, args[2], &item, &search_var);
if ((result == TCL_ERROR) || (item == ZN_NO_ITEM)) {
- goto error;
+ goto error;
}
result = ZnItemWithTagOrId(wi, args[3], &grp, &search_var);
if ((result == TCL_ERROR) || (grp == ZN_NO_ITEM)|| (grp->class != ZnGroup)) {
- goto error;
+ goto error;
}
if (item->parent == grp) {
- /*
- * Nothing to be done, the item is already in the
- * target group.
- */
- goto done;
+ /*
+ * Nothing to be done, the item is already in the
+ * target group.
+ */
+ goto done;
}
/*
* Check the ancestors to find if item is an
@@ -4560,29 +4560,29 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
*/
for (scan = grp; scan && (scan != item); scan = scan->parent);
if (scan == item) {
- Tcl_AppendResult(interp, "\"", Tcl_GetString(args[3]),
- "\" is a descendant of \"", Tcl_GetString(args[2]),
- "\" and can't be used as its parent", NULL);
- goto error;
+ Tcl_AppendResult(interp, "\"", Tcl_GetString(args[3]),
+ "\" is a descendant of \"", Tcl_GetString(args[2]),
+ "\" and can't be used as its parent", NULL);
+ goto error;
}
if (argc == 5) {
- if (Tcl_GetBooleanFromObj(interp, args[4], &adjust) != TCL_OK) {
- goto error;
- }
+ if (Tcl_GetBooleanFromObj(interp, args[4], &adjust) != TCL_OK) {
+ goto error;
+ }
}
if ((item->parent == grp) || (item->parent == ZN_NO_ITEM)) {
- goto done;
+ goto done;
}
if (adjust) {
- ZnITEM.GetItemTransform(grp, &t);
- ZnTransfoInvert(&t, &inv);
- ZnITEM.GetItemTransform(item->parent, &t);
- ZnTransfoCompose(&t2, &t, &inv);
- this_one = &t2;
- if (item->transfo) {
- ZnTransfoCompose(&t, item->transfo, &t2);
- this_one = &t;
- }
+ ZnITEM.GetItemTransform(grp, &t);
+ ZnTransfoInvert(&t, &inv);
+ ZnITEM.GetItemTransform(item->parent, &t);
+ ZnTransfoCompose(&t2, &t, &inv);
+ this_one = &t2;
+ if (item->transfo) {
+ ZnTransfoCompose(&t, item->transfo, &t2);
+ this_one = &t;
+ }
}
ZnITEM.ExtractItem(item);
ZnITEM.InsertItem(item, grp, ZN_NO_ITEM, True);
@@ -4593,9 +4593,9 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
* is enough.
*/
ZnITEM.Invalidate(item,
- item->class==ZnGroup?ZN_TRANSFO_FLAG:ZN_COORDS_FLAG);
+ item->class==ZnGroup?ZN_TRANSFO_FLAG:ZN_COORDS_FLAG);
if (adjust) {
- ZnITEM.SetTransfo(item, this_one);
+ ZnITEM.SetTransfo(item, this_one);
}
}
break;
@@ -4605,20 +4605,20 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
case ZN_W_CLONE:
{
if (argc < 3) {
- Tcl_WrongNumArgs(interp, 1, args, "clone tagOrId ?option value ...?");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args, "clone tagOrId ?option value ...?");
+ goto error;
}
result = ZnItemWithTagOrId(wi, args[2], &item, &search_var);
if ((result == TCL_ERROR) ||
- (item == ZN_NO_ITEM) || (item == wi->top_group)) {
- goto error;
+ (item == ZN_NO_ITEM) || (item == wi->top_group)) {
+ goto error;
}
argc -= 3;
args += 3;
item2 = ZnITEM.CloneItem(item);
ZnITEM.InsertItem(item2, item->parent, ZN_NO_ITEM, True);
if (ZnITEM.ConfigureItem(item2, ZN_NO_PART, argc, args, False) == TCL_ERROR) {
- goto error;
+ goto error;
}
l = Tcl_NewLongObj(item2->id);
Tcl_SetObjResult(interp, l);
@@ -4631,29 +4631,29 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
{
#ifdef PTK_800
if (argc == 2) {
- result = Tk_ConfigureInfo(interp, wi->win, config_specs,
- (char *) wi, (char *) NULL, 0);
+ result = Tk_ConfigureInfo(interp, wi->win, config_specs,
+ (char *) wi, (char *) NULL, 0);
}
else if (argc == 3) {
- result = Tk_ConfigureInfo(interp, wi->win, config_specs,
- (char *) wi, Tcl_GetString(args[2]), 0);
+ result = Tk_ConfigureInfo(interp, wi->win, config_specs,
+ (char *) wi, Tcl_GetString(args[2]), 0);
}
else {
- result = Configure(interp, wi, argc-2, args+2, TK_CONFIG_ARGV_ONLY);
+ result = Configure(interp, wi, argc-2, args+2, TK_CONFIG_ARGV_ONLY);
}
#else
if (argc == 2) {
- l = Tk_GetOptionInfo(interp, (char *) wi, wi->opt_table,
- (argc == 3) ? args[2] : NULL, wi->win);
- if (l == NULL) {
- goto error;
- }
- else {
- Tcl_SetObjResult(interp, l);
- }
+ l = Tk_GetOptionInfo(interp, (char *) wi, wi->opt_table,
+ (argc == 3) ? args[2] : NULL, wi->win);
+ if (l == NULL) {
+ goto error;
+ }
+ else {
+ Tcl_SetObjResult(interp, l);
+ }
}
else {
- result = Configure(interp, wi, argc-2, args+2);
+ result = Configure(interp, wi, argc-2, args+2);
}
#endif
}
@@ -4664,12 +4664,12 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
case ZN_W_CONTOUR:
{
if ((argc < 3) || (argc > 7)) {
- Tcl_WrongNumArgs(interp, 1, args,
- "contour tagOrId ?operator windingFlag? ?index? ?coordListOrTagOrId?");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args,
+ "contour tagOrId ?operator windingFlag? ?index? ?coordListOrTagOrId?");
+ goto error;
}
if (Contour(wi, argc, args, &search_var) == TCL_ERROR) {
- goto error;
+ goto error;
}
break;
}
@@ -4679,12 +4679,12 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
case ZN_W_COORDS:
{
if ((argc < 3) || (argc > 7)) {
- Tcl_WrongNumArgs(interp, 1, args,
- "coords tagOrId ?add/remove? ?contour? ?index? ?coordList?");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args,
+ "coords tagOrId ?add/remove? ?contour? ?index? ?coordList?");
+ goto error;
}
if (Coords(wi, argc, args, &search_var) == TCL_ERROR) {
- goto error;
+ goto error;
}
}
break;
@@ -4693,22 +4693,22 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
*/
case ZN_W_CURRENTPART:
{
- ZnBool only_fields = False;
+ ZnBool only_fields = False;
if ((argc != 2) && (argc != 3)) {
- Tcl_WrongNumArgs(interp, 1, args, "currentpart ?onlyFields?");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args, "currentpart ?onlyFields?");
+ goto error;
}
if (argc == 3) {
- if (Tcl_GetBooleanFromObj(interp, args[2], &only_fields) != TCL_OK) {
- goto error;
- }
+ if (Tcl_GetBooleanFromObj(interp, args[2], &only_fields) != TCL_OK) {
+ goto error;
+ }
}
if ((wi->current_item != ZN_NO_ITEM) &&
- (wi->current_item->class->Part != NULL) &&
- ((wi->current_part >= 0) || !only_fields)) {
- l = NULL;
- wi->current_item->class->Part(wi->current_item, &l, &wi->current_part);
- Tcl_SetObjResult(interp, l);
+ (wi->current_item->class->Part != NULL) &&
+ ((wi->current_part >= 0) || !only_fields)) {
+ l = NULL;
+ wi->current_item->class->Part(wi->current_item, &l, &wi->current_part);
+ Tcl_SetObjResult(interp, l);
}
}
break;
@@ -4718,41 +4718,41 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
case ZN_W_CURSOR:
{
if ((argc != 4) && (argc != 5)) {
- Tcl_WrongNumArgs(interp, 1, args, "cursor tagOrId ?field? index");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args, "cursor tagOrId ?field? index");
+ goto error;
}
if (ZnTagSearchScan(wi, args[2], &search_var) == TCL_ERROR) {
- goto error;
+ goto error;
}
if (argc == 5) {
- if (Tcl_GetIntFromObj(interp, args[3], &field) != TCL_OK) {
- field = ZN_NO_PART;
- if (Tcl_GetString(args[3])[0] != 0) {
- Tcl_AppendResult(interp, "invalid field index \"",
- Tcl_GetString(args[3]),
- "\", should be a positive integer", NULL);
- goto error;
- }
- }
- argc--;
- args++;
+ if (Tcl_GetIntFromObj(interp, args[3], &field) != TCL_OK) {
+ field = ZN_NO_PART;
+ if (Tcl_GetString(args[3])[0] != 0) {
+ Tcl_AppendResult(interp, "invalid field index \"",
+ Tcl_GetString(args[3]),
+ "\", should be a positive integer", NULL);
+ goto error;
+ }
+ }
+ argc--;
+ args++;
}
for (item = ZnTagSearchFirst(search_var);
- item != ZN_NO_ITEM; item = ZnTagSearchNext(search_var)) {
- if ((item->class->Cursor == NULL) ||
- (item->class->Index == NULL)) {
- continue;
- }
- result = (*item->class->Index)(item, field, args[3], &index);
- if (result != TCL_OK) {
- goto error;
- }
-
- (*item->class->Cursor)(item, field, index);
- if ((item == wi->focus_item) && (field == wi->focus_field) &&
- wi->text_info.cursor_on) {
- ZnITEM.Invalidate(item, ZN_DRAW_FLAG);
- }
+ item != ZN_NO_ITEM; item = ZnTagSearchNext(search_var)) {
+ if ((item->class->Cursor == NULL) ||
+ (item->class->Index == NULL)) {
+ continue;
+ }
+ result = (*item->class->Index)(item, field, args[3], &index);
+ if (result != TCL_OK) {
+ goto error;
+ }
+
+ (*item->class->Cursor)(item, field, index);
+ if ((item == wi->focus_item) && (field == wi->focus_field) &&
+ wi->text_info.cursor_on) {
+ ZnITEM.Invalidate(item, ZN_DRAW_FLAG);
+ }
}
}
break;
@@ -4761,80 +4761,80 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
*/
case ZN_W_DCHARS:
{
- int first, last;
+ int first, last;
ZnTextInfo *ti = &wi->text_info;
if ((argc < 4) || (argc > 6)) {
- Tcl_WrongNumArgs(interp, 1, args, "dchars tagOrId ?field? first ?last?");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args, "dchars tagOrId ?field? first ?last?");
+ goto error;
}
if (ZnTagSearchScan(wi, args[2], &search_var) == TCL_ERROR) {
- goto error;
+ goto error;
}
if (argc == 6) {
- if (Tcl_GetIntFromObj(interp, args[3], &field) != TCL_OK) {
- field = ZN_NO_PART;
- if (Tcl_GetString(args[3])[0] != 0) {
- Tcl_AppendResult(interp, "invalid field index \"",
- Tcl_GetString(args[3]),
- "\", should be a positive integer", NULL);
- goto error;
- }
- }
- argc--;
- args++;
+ if (Tcl_GetIntFromObj(interp, args[3], &field) != TCL_OK) {
+ field = ZN_NO_PART;
+ if (Tcl_GetString(args[3])[0] != 0) {
+ Tcl_AppendResult(interp, "invalid field index \"",
+ Tcl_GetString(args[3]),
+ "\", should be a positive integer", NULL);
+ goto error;
+ }
+ }
+ argc--;
+ args++;
}
for (item = ZnTagSearchFirst(search_var);
- item != ZN_NO_ITEM; item = ZnTagSearchNext(search_var)) {
- if ((item->class->Index == NULL) ||
- (item->class->DeleteChars == NULL)) {
- continue;
- }
- result = (*item->class->Index)(item, field, args[3], &first);
- if (result != TCL_OK) {
- goto error;
- }
- if (argc == 5) {
- result = (*item->class->Index)(item, field, args[4], &last);
- if (result != TCL_OK) {
- goto error;
- }
- }
- else {
- last = first;
- }
- (*item->class->DeleteChars)(item, field, &first, &last);
-
- /*
- * Update indexes for the selection to reflect the
- * change.
- */
- if ((ti->sel_item == item) && (ti->sel_field == field)) {
- int count = last + 1 - first;
- if (ti->sel_first > first) {
- ti->sel_first -= count;
- if (ti->sel_first < first) {
- ti->sel_first = first;
- }
- }
- if (ti->sel_last >= first) {
- ti->sel_last -= count;
- if (ti->sel_last < (first-1)) {
- ti->sel_last = first-1;
- }
- }
- if (ti->sel_first >= ti->sel_last) {
- ti->sel_item = ZN_NO_ITEM;
- ti->sel_field = ZN_NO_PART;
- }
- if ((ti->anchor_item == item) && (ti->anchor_field == field) &&
- (ti->sel_anchor > first)) {
- ti->sel_anchor -= count;
- if (ti->sel_anchor < first) {
- ti->sel_anchor = first;
- }
- }
- }
+ item != ZN_NO_ITEM; item = ZnTagSearchNext(search_var)) {
+ if ((item->class->Index == NULL) ||
+ (item->class->DeleteChars == NULL)) {
+ continue;
+ }
+ result = (*item->class->Index)(item, field, args[3], &first);
+ if (result != TCL_OK) {
+ goto error;
+ }
+ if (argc == 5) {
+ result = (*item->class->Index)(item, field, args[4], &last);
+ if (result != TCL_OK) {
+ goto error;
+ }
+ }
+ else {
+ last = first;
+ }
+ (*item->class->DeleteChars)(item, field, &first, &last);
+
+ /*
+ * Update indexes for the selection to reflect the
+ * change.
+ */
+ if ((ti->sel_item == item) && (ti->sel_field == field)) {
+ int count = last + 1 - first;
+ if (ti->sel_first > first) {
+ ti->sel_first -= count;
+ if (ti->sel_first < first) {
+ ti->sel_first = first;
+ }
+ }
+ if (ti->sel_last >= first) {
+ ti->sel_last -= count;
+ if (ti->sel_last < (first-1)) {
+ ti->sel_last = first-1;
+ }
+ }
+ if (ti->sel_first >= ti->sel_last) {
+ ti->sel_item = ZN_NO_ITEM;
+ ti->sel_field = ZN_NO_PART;
+ }
+ if ((ti->anchor_item == item) && (ti->anchor_field == field) &&
+ (ti->sel_anchor > first)) {
+ ti->sel_anchor -= count;
+ if (ti->sel_anchor < first) {
+ ti->sel_anchor = first;
+ }
+ }
+ }
}
}
break;
@@ -4843,24 +4843,24 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
*/
case ZN_W_DTAG:
{
- Tk_Uid tag;
+ Tk_Uid tag;
if ((argc != 3) && (argc != 4)) {
- Tcl_WrongNumArgs(interp, 1, args, "dtag tagOrId ?tagToDelete?");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args, "dtag tagOrId ?tagToDelete?");
+ goto error;
}
if (argc == 4) {
- tag = Tk_GetUid(Tcl_GetString(args[3]));
+ tag = Tk_GetUid(Tcl_GetString(args[3]));
}
else {
- tag = Tk_GetUid(Tcl_GetString(args[2]));
+ tag = Tk_GetUid(Tcl_GetString(args[2]));
}
if (ZnTagSearchScan(wi, args[2], &search_var) == TCL_ERROR) {
- goto error;
+ goto error;
}
for (item = ZnTagSearchFirst(search_var);
- item != ZN_NO_ITEM; item = ZnTagSearchNext(search_var)) {
- ZnITEM.RemoveTag(item, (char *) tag);
+ item != ZN_NO_ITEM; item = ZnTagSearchNext(search_var)) {
+ ZnITEM.RemoveTag(item, (char *) tag);
}
}
break;
@@ -4870,8 +4870,8 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
case ZN_W_FIND:
{
if (argc < 3) {
- Tcl_WrongNumArgs(interp, 1, args, "find searchCommand ?arg arg ...?");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args, "find searchCommand ?arg arg ...?");
+ goto error;
}
result = FindItems(wi, argc, args, NULL, 2, &search_var);
}
@@ -4882,15 +4882,15 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
case ZN_W_FIT:
{
if (argc != 4) {
- Tcl_WrongNumArgs(interp, 1, args, "fit coordList error");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args, "fit coordList error");
+ goto error;
}
if (ZnParseCoordList(wi, args[2], &points,
- NULL, &num_points, NULL) == TCL_ERROR) {
- return TCL_ERROR;
+ NULL, &num_points, NULL) == TCL_ERROR) {
+ return TCL_ERROR;
}
if (Tcl_GetDoubleFromObj(interp, args[3], &d) == TCL_ERROR) {
- goto error;
+ goto error;
}
to_points = ZnListNew(32, sizeof(ZnPoint));
ZnFitBezier(points, num_points, d, to_points);
@@ -4898,15 +4898,15 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
num_points = ZnListSize(to_points);
l = Tcl_GetObjResult(interp);
for (i = 0; i < num_points; i++, points++) {
- entries[0] = Tcl_NewDoubleObj(points->x);
- entries[1] = Tcl_NewDoubleObj(points->y);
- if (i % 3) {
- entries[2] = Tcl_NewStringObj(c, -1);
- Tcl_ListObjAppendElement(interp, l, Tcl_NewListObj(3, entries));
- }
- else {
- Tcl_ListObjAppendElement(interp, l, Tcl_NewListObj(2, entries));
- }
+ entries[0] = Tcl_NewDoubleObj(points->x);
+ entries[1] = Tcl_NewDoubleObj(points->y);
+ if (i % 3) {
+ entries[2] = Tcl_NewStringObj(c, -1);
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewListObj(3, entries));
+ }
+ else {
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewListObj(2, entries));
+ }
}
ZnListFree(to_points);
}
@@ -4917,51 +4917,51 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
case ZN_W_FOCUS:
{
if (argc > 4) {
- Tcl_WrongNumArgs(interp, 1, args, "focus ?tagOrId? ?field?");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args, "focus ?tagOrId? ?field?");
+ goto error;
}
item = wi->focus_item;
if (argc == 2) {
- field = wi->focus_field;
- if (item != ZN_NO_ITEM) {
- l = Tcl_GetObjResult(interp);
- Tcl_ListObjAppendElement(interp, l, Tcl_NewLongObj(item->id));
- if (field != ZN_NO_PART) {
- Tcl_ListObjAppendElement(interp, l, Tcl_NewIntObj(field));
- }
- else {
- Tcl_ListObjAppendElement(interp, l, Tcl_NewStringObj("", -1));
- }
- }
- break;
+ field = wi->focus_field;
+ if (item != ZN_NO_ITEM) {
+ l = Tcl_GetObjResult(interp);
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewLongObj(item->id));
+ if (field != ZN_NO_PART) {
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewIntObj(field));
+ }
+ else {
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewStringObj("", -1));
+ }
+ }
+ break;
}
if ((item != ZN_NO_ITEM) && (item->class->Cursor != NULL) &&
- ISSET(wi->flags, ZN_GOT_FOCUS)) {
- ZnITEM.Invalidate(item, ZN_COORDS_FLAG);
+ ISSET(wi->flags, ZN_GOT_FOCUS)) {
+ ZnITEM.Invalidate(item, ZN_COORDS_FLAG);
}
if (Tcl_GetString(args[2])[0] == 0) {
- wi->focus_item = ZN_NO_ITEM;
- wi->focus_field = ZN_NO_PART;
- break;
+ wi->focus_item = ZN_NO_ITEM;
+ wi->focus_field = ZN_NO_PART;
+ break;
}
if (ZnItemWithTagOrId(wi, args[2], &item, &search_var) == TCL_ERROR) {
- goto error;
+ goto error;
}
if (argc == 4) {
- if (Tcl_GetIntFromObj(interp, args[3], &field) != TCL_OK) {
- field = ZN_NO_PART;
- if (Tcl_GetString(args[3])[0] != 0) {
- Tcl_AppendResult(interp, "invalid field index \"",
- Tcl_GetString(args[3]),
- "\", should be a positive integer", NULL);
- goto error;
- }
- }
+ if (Tcl_GetIntFromObj(interp, args[3], &field) != TCL_OK) {
+ field = ZN_NO_PART;
+ if (Tcl_GetString(args[3])[0] != 0) {
+ Tcl_AppendResult(interp, "invalid field index \"",
+ Tcl_GetString(args[3]),
+ "\", should be a positive integer", NULL);
+ goto error;
+ }
+ }
}
wi->focus_item = item;
wi->focus_field = field;
if (ISSET(wi->flags, ZN_GOT_FOCUS) && (item->class->Cursor != NULL)) {
- ZnITEM.Invalidate(wi->focus_item, ZN_COORDS_FLAG);
+ ZnITEM.Invalidate(wi->focus_item, ZN_COORDS_FLAG);
}
}
break;
@@ -4971,8 +4971,8 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
case ZN_W_GDELETE:
{
if (argc != 3) {
- Tcl_WrongNumArgs(interp, 1, args, "gdelete gName");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args, "gdelete gName");
+ goto error;
}
ZnDeleteGradientName(Tcl_GetString(args[2]));
}
@@ -4982,26 +4982,26 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
*/
case ZN_W_GETTAGS:
{
- Tk_Uid *tags;
+ Tk_Uid *tags;
if (argc != 3) {
- Tcl_WrongNumArgs(interp, 1, args, "gettags tagOrId");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args, "gettags tagOrId");
+ goto error;
}
result = ZnItemWithTagOrId(wi, args[2], &item, &search_var);
if ((result == TCL_ERROR) || (item == ZN_NO_ITEM)) {
- goto error;
+ goto error;
}
if (!item->tags || !ZnListSize(item->tags)) {
- goto done;
+ goto done;
}
else {
- num = ZnListSize(item->tags);
- tags = (Tk_Uid *) ZnListArray(item->tags);
- l = Tcl_GetObjResult(interp);
- for (i = 0; i < num; i++) {
- Tcl_ListObjAppendElement(interp, l, Tcl_NewStringObj(tags[i], -1));
- }
+ num = ZnListSize(item->tags);
+ tags = (Tk_Uid *) ZnListArray(item->tags);
+ l = Tcl_GetObjResult(interp);
+ for (i = 0; i < num; i++) {
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewStringObj(tags[i], -1));
+ }
}
}
break;
@@ -5010,22 +5010,22 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
*/
case ZN_W_GNAME:
{
- ZnBool ok;
+ ZnBool ok;
if ((argc != 3) && (argc != 4)) {
- Tcl_WrongNumArgs(interp, 1, args, "gname ?grad? gName");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args, "gname ?grad? gName");
+ goto error;
}
if (argc == 3) {
- l = Tcl_NewBooleanObj(ZnGradientNameExists(Tcl_GetString(args[2])));
- Tcl_SetObjResult(interp, l);
+ l = Tcl_NewBooleanObj(ZnGradientNameExists(Tcl_GetString(args[2])));
+ Tcl_SetObjResult(interp, l);
}
else {
- ok = ZnNameGradient(interp, wi->win, Tcl_GetString(args[2]),
- Tcl_GetString(args[3]));
- if (!ok) {
- goto error;
- }
+ ok = ZnNameGradient(interp, wi->win, Tcl_GetString(args[2]),
+ Tcl_GetString(args[3]));
+ if (!ok) {
+ goto error;
+ }
}
}
break;
@@ -5035,23 +5035,23 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
case ZN_W_GROUP:
{
if (argc != 3) {
- Tcl_WrongNumArgs(interp, 1, args, "group tagOrId");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args, "group tagOrId");
+ goto error;
}
result = ZnItemWithTagOrId(wi, args[2], &item, &search_var);
if ((result == TCL_ERROR) || (item == ZN_NO_ITEM)) {
- goto error;
+ goto error;
}
if (item->parent != ZN_NO_ITEM) {
- l = Tcl_NewLongObj(item->parent->id);
- Tcl_SetObjResult(interp, l);
+ l = Tcl_NewLongObj(item->parent->id);
+ Tcl_SetObjResult(interp, l);
}
else {
- /*
- * Top group is its own parent.
- */
- l = Tcl_NewLongObj(item->id);
- Tcl_SetObjResult(interp, l);
+ /*
+ * Top group is its own parent.
+ */
+ l = Tcl_NewLongObj(item->id);
+ Tcl_SetObjResult(interp, l);
}
}
break;
@@ -5061,12 +5061,12 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
case ZN_W_HASANCHORS:
{
if (argc != 3) {
- Tcl_WrongNumArgs(interp, 1, args, "hasanchors tagOrId");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args, "hasanchors tagOrId");
+ goto error;
}
result = ZnItemWithTagOrId(wi, args[2], &item, &search_var);
if ((result == TCL_ERROR) || (item == ZN_NO_ITEM)) {
- goto error;
+ goto error;
}
l = Tcl_NewBooleanObj(ISSET(item->class->flags, ZN_CLASS_HAS_ANCHORS) ? 1 : 0);
Tcl_SetObjResult(interp, l);
@@ -5078,12 +5078,12 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
case ZN_W_HASFIELDS:
{
if (argc != 3) {
- Tcl_WrongNumArgs(interp, 1, args, "hasfields tagOrId");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args, "hasfields tagOrId");
+ goto error;
}
result = ZnItemWithTagOrId(wi, args[2], &item, &search_var);
if ((result == TCL_ERROR) || (item == ZN_NO_ITEM)) {
- goto error;
+ goto error;
}
l = Tcl_NewBooleanObj(item->class->GetFieldSet?1:0);
Tcl_SetObjResult(interp, l);
@@ -5095,15 +5095,15 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
case ZN_W_HASTAG:
{
if (argc != 4) {
- Tcl_WrongNumArgs(interp, 1, args, "hastag tagOrId tag");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args, "hastag tagOrId tag");
+ goto error;
}
result = ZnItemWithTagOrId(wi, args[2], &item, &search_var);
if ((result == TCL_ERROR) || (item == ZN_NO_ITEM)) {
- goto error;
+ goto error;
}
l = Tcl_NewBooleanObj(ZnITEM.HasTag(item,
- Tk_GetUid(Tcl_GetString(args[3]))));
+ Tk_GetUid(Tcl_GetString(args[3]))));
Tcl_SetObjResult(interp, l);
}
break;
@@ -5113,39 +5113,39 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
case ZN_W_INDEX:
{
if ((argc != 4) && (argc != 5)) {
- Tcl_WrongNumArgs(interp, 1, args, "index tagOrId ?field? string");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args, "index tagOrId ?field? string");
+ goto error;
}
if (ZnTagSearchScan(wi, args[2], &search_var) == TCL_ERROR) {
- goto error;
+ goto error;
}
if (argc == 5) {
- if (Tcl_GetIntFromObj(interp, args[3], &field) != TCL_OK) {
- field = ZN_NO_PART;
- if (Tcl_GetString(args[3])[0] != 0) {
- Tcl_AppendResult(interp, "invalid field index \"",
- Tcl_GetString(args[3]),
- "\", should be a positive integer", NULL);
- goto error;
- }
- }
- argc--;
- args++;
+ if (Tcl_GetIntFromObj(interp, args[3], &field) != TCL_OK) {
+ field = ZN_NO_PART;
+ if (Tcl_GetString(args[3])[0] != 0) {
+ Tcl_AppendResult(interp, "invalid field index \"",
+ Tcl_GetString(args[3]),
+ "\", should be a positive integer", NULL);
+ goto error;
+ }
+ }
+ argc--;
+ args++;
}
for (item = ZnTagSearchFirst(search_var);
- item != ZN_NO_ITEM; item = ZnTagSearchNext(search_var)) {
- if (item->class->Index != NULL) {
- result = (*item->class->Index)(item, field, args[3], &index);
- if (result != TCL_OK) {
- goto error;
- }
- l = Tcl_NewIntObj(index);
- Tcl_SetObjResult(interp, l);
- goto done;
- }
+ item != ZN_NO_ITEM; item = ZnTagSearchNext(search_var)) {
+ if (item->class->Index != NULL) {
+ result = (*item->class->Index)(item, field, args[3], &index);
+ if (result != TCL_OK) {
+ goto error;
+ }
+ l = Tcl_NewIntObj(index);
+ Tcl_SetObjResult(interp, l);
+ goto done;
+ }
}
Tcl_AppendResult(interp, "can't find an indexable item \"",
- Tcl_GetString(args[2]), "\"", NULL);
+ Tcl_GetString(args[2]), "\"", NULL);
goto error;
}
break;
@@ -5155,56 +5155,56 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
case ZN_W_INSERT:
{
ZnTextInfo *ti = &wi->text_info;
- char *chars;
+ char *chars;
if ((argc != 5) && (argc != 6)) {
- Tcl_WrongNumArgs(interp, 1, args, "insert tagOrId ?field? before string");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args, "insert tagOrId ?field? before string");
+ goto error;
}
if (ZnTagSearchScan(wi, args[2], &search_var) == TCL_ERROR) {
- goto error;
+ goto error;
}
if (argc == 6) {
- if (Tcl_GetIntFromObj(interp, args[3], &field) != TCL_OK) {
- field = ZN_NO_PART;
- if (Tcl_GetString(args[3])[0] != 0) {
- Tcl_AppendResult(interp, "invalid field index \"",
- Tcl_GetString(args[3]),
- "\", should be a positive integer", NULL);
- goto error;
- }
- }
- argc--;
- args++;
+ if (Tcl_GetIntFromObj(interp, args[3], &field) != TCL_OK) {
+ field = ZN_NO_PART;
+ if (Tcl_GetString(args[3])[0] != 0) {
+ Tcl_AppendResult(interp, "invalid field index \"",
+ Tcl_GetString(args[3]),
+ "\", should be a positive integer", NULL);
+ goto error;
+ }
+ }
+ argc--;
+ args++;
}
for (item = ZnTagSearchFirst(search_var);
- item != ZN_NO_ITEM; item = ZnTagSearchNext(search_var)) {
- if ((item->class->Index == NULL) ||
- (item->class->InsertChars == NULL)) {
- continue;
- }
- result = (*item->class->Index)(item, field, args[3], &index);
- if (result != TCL_OK) {
- goto error;
- }
- chars = Tcl_GetString(args[4]);
- (*item->class->InsertChars)(item, field, &index, chars);
- /*
- * Inserting characters invalidates selection indices.
- */
- if ((ti->sel_item == item) && (ti->sel_field == field)) {
- length = strlen(chars);
- if (ti->sel_first >= index) {
- ti->sel_first += length;
- }
- if (ti->sel_last >= index) {
- ti->sel_last += length;
- }
- if ((ti->anchor_item == item) && (ti->anchor_field == field) &&
- (ti->sel_anchor >= index)) {
- ti->sel_anchor += length;
- }
- }
+ item != ZN_NO_ITEM; item = ZnTagSearchNext(search_var)) {
+ if ((item->class->Index == NULL) ||
+ (item->class->InsertChars == NULL)) {
+ continue;
+ }
+ result = (*item->class->Index)(item, field, args[3], &index);
+ if (result != TCL_OK) {
+ goto error;
+ }
+ chars = Tcl_GetString(args[4]);
+ (*item->class->InsertChars)(item, field, &index, chars);
+ /*
+ * Inserting characters invalidates selection indices.
+ */
+ if ((ti->sel_item == item) && (ti->sel_field == field)) {
+ length = strlen(chars);
+ if (ti->sel_first >= index) {
+ ti->sel_first += length;
+ }
+ if (ti->sel_last >= index) {
+ ti->sel_last += length;
+ }
+ if ((ti->anchor_item == item) && (ti->anchor_field == field) &&
+ (ti->sel_anchor >= index)) {
+ ti->sel_anchor += length;
+ }
+ }
}
}
break;
@@ -5215,31 +5215,31 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
{
if (argc < 4) {
itemcget_syntax:
- Tcl_WrongNumArgs(interp, 1, args, "itemcget tagOrId ?field? option");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args, "itemcget tagOrId ?field? option");
+ goto error;
}
result = ZnItemWithTagOrId(wi, args[2], &item, &search_var);
if ((result == TCL_ERROR) || (item == ZN_NO_ITEM)) {
- goto error;
+ goto error;
}
if (argc == 5) {
- if (Tcl_GetIntFromObj(interp, args[3], &field) != TCL_OK) {
- field = ZN_NO_PART;
- if (Tcl_GetString(args[3])[0] != 0) {
- Tcl_AppendResult(interp, "invalid field index \"",
- Tcl_GetString(args[3]),
- "\", should be a positive integer", NULL);
- goto error;
- }
- }
- argc--;
- args++;
+ if (Tcl_GetIntFromObj(interp, args[3], &field) != TCL_OK) {
+ field = ZN_NO_PART;
+ if (Tcl_GetString(args[3])[0] != 0) {
+ Tcl_AppendResult(interp, "invalid field index \"",
+ Tcl_GetString(args[3]),
+ "\", should be a positive integer", NULL);
+ goto error;
+ }
+ }
+ argc--;
+ args++;
}
if (argc != 4) {
- goto itemcget_syntax;
+ goto itemcget_syntax;
}
if (ZnITEM.QueryItem(item, field, 1, &args[3]) != TCL_OK) {
- goto error;
+ goto error;
}
}
break;
@@ -5249,57 +5249,57 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
case ZN_W_ITEMCONFIGURE:
{
if (argc < 3) {
- Tcl_WrongNumArgs(interp, 1, args,
- "itemconfigure tagOrId ?field? option value ?option value? ...");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args,
+ "itemconfigure tagOrId ?field? option value ?option value? ...");
+ goto error;
}
if (ZnTagSearchScan(wi, args[2], &search_var) == TCL_ERROR) {
- goto error;
+ goto error;
}
if ((argc > 3) && (Tcl_GetString(args[3])[0] != '-')) {
- if (Tcl_GetIntFromObj(interp, args[3], &field) != TCL_OK) {
- field = ZN_NO_PART;
- if (Tcl_GetString(args[3])[0] != 0) {
- Tcl_AppendResult(interp, "invalid field index \"",
- Tcl_GetString(args[3]),
- "\", should be a positive integer", NULL);
- goto error;
- }
- }
- argc--;
- args++;
+ if (Tcl_GetIntFromObj(interp, args[3], &field) != TCL_OK) {
+ field = ZN_NO_PART;
+ if (Tcl_GetString(args[3])[0] != 0) {
+ Tcl_AppendResult(interp, "invalid field index \"",
+ Tcl_GetString(args[3]),
+ "\", should be a positive integer", NULL);
+ goto error;
+ }
+ }
+ argc--;
+ args++;
}
argc -= 3;
args += 3;
for (item = ZnTagSearchFirst(search_var);
- item != ZN_NO_ITEM; item = ZnTagSearchNext(search_var)) {
- if (argc < 2) {
- if (field == ZN_NO_PART) {
- result = ZnAttributesInfo(wi->interp, item, item->class->attr_desc, argc, args);
- }
- else if (item->class->GetFieldSet) {
- ZnFieldSet fs = item->class->GetFieldSet(item);
- if (field < (int) ZnFIELD.NumFields(fs)) {
- result = ZnAttributesInfo(wi->interp, ZnFIELD.GetFieldStruct(fs, field),
- ZnFIELD.attr_desc, argc, args);
- }
- else {
- Tcl_AppendResult(interp, "field index out of bound", NULL);
- goto error;
- }
- }
- else {
- Tcl_AppendResult(interp, "the item does not support fields", NULL);
- goto error;
- }
- goto done;
- }
- else {
- result = ZnITEM.ConfigureItem(item, field, argc, args, False);
- }
- if (result == TCL_ERROR) {
- goto error;
- }
+ item != ZN_NO_ITEM; item = ZnTagSearchNext(search_var)) {
+ if (argc < 2) {
+ if (field == ZN_NO_PART) {
+ result = ZnAttributesInfo(wi->interp, item, item->class->attr_desc, argc, args);
+ }
+ else if (item->class->GetFieldSet) {
+ ZnFieldSet fs = item->class->GetFieldSet(item);
+ if (field < (int) ZnFIELD.NumFields(fs)) {
+ result = ZnAttributesInfo(wi->interp, ZnFIELD.GetFieldStruct(fs, field),
+ ZnFIELD.attr_desc, argc, args);
+ }
+ else {
+ Tcl_AppendResult(interp, "field index out of bound", NULL);
+ goto error;
+ }
+ }
+ else {
+ Tcl_AppendResult(interp, "the item does not support fields", NULL);
+ goto error;
+ }
+ goto done;
+ }
+ else {
+ result = ZnITEM.ConfigureItem(item, field, argc, args, False);
+ }
+ if (result == TCL_ERROR) {
+ goto error;
+ }
}
}
break;
@@ -5309,12 +5309,12 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
case ZN_W_LAYOUT:
{
if (argc < 4) {
- Tcl_WrongNumArgs(interp, 1, args,
- "layout operator ?args...? tagOrId ?tagOrId...?");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args,
+ "layout operator ?args...? tagOrId ?tagOrId...?");
+ goto error;
}
if (LayoutItems(wi, argc-2, args+2) == TCL_ERROR) {
- goto error;
+ goto error;
}
}
break;
@@ -5326,41 +5326,41 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
ZnItem first, group, mark = ZN_NO_ITEM;
if (argc < 3) {
- Tcl_WrongNumArgs(interp, 1, args, "lower tagOrId ?belowThis?");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args, "lower tagOrId ?belowThis?");
+ goto error;
}
if (argc == 4) {
- if (ZnTagSearchScan(wi, args[3], &search_var) == TCL_ERROR) {
- goto error;
- }
- for (item = ZnTagSearchFirst(search_var);
- item != ZN_NO_ITEM; item = ZnTagSearchNext(search_var)) {
- mark = item;
- }
- if (mark == ZN_NO_ITEM) {
- Tcl_AppendResult(interp, "unknown tag or item \"",
- Tcl_GetString(args[3]), "\"", NULL);
- goto error;
- }
+ if (ZnTagSearchScan(wi, args[3], &search_var) == TCL_ERROR) {
+ goto error;
+ }
+ for (item = ZnTagSearchFirst(search_var);
+ item != ZN_NO_ITEM; item = ZnTagSearchNext(search_var)) {
+ mark = item;
+ }
+ if (mark == ZN_NO_ITEM) {
+ Tcl_AppendResult(interp, "unknown tag or item \"",
+ Tcl_GetString(args[3]), "\"", NULL);
+ goto error;
+ }
}
if (ZnTagSearchScan(wi, args[2], &search_var) == TCL_ERROR) {
- goto error;
+ goto error;
}
item = ZnTagSearchFirst(search_var);
if ((item == ZN_NO_ITEM) || (item == wi->top_group)) {
- goto done;
+ goto done;
}
first = item;
if (mark == ZN_NO_ITEM) {
- mark = ZnGroupTail(item->parent);
+ mark = ZnGroupTail(item->parent);
}
group = mark->parent;
do {
- if ((item->parent == group) && (item != mark)) {
- ZnITEM.UpdateItemPriority(item, mark, False);
- mark = item;
- }
- item = ZnTagSearchNext(search_var);
+ if ((item->parent == group) && (item != mark)) {
+ ZnITEM.UpdateItemPriority(item, mark, False);
+ mark = item;
+ }
+ item = ZnTagSearchNext(search_var);
}
while ((item != ZN_NO_ITEM) && (item != first));
}
@@ -5374,31 +5374,31 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
ZnBool on_off;
if ((argc != 2) && (argc != 3)) {
- Tcl_WrongNumArgs(interp, 1, args, "monitor ?onOff?");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args, "monitor ?onOff?");
+ goto error;
}
if (argc == 3) {
- if (Tcl_GetBooleanFromObj(interp, args[2], &on_off) != TCL_OK) {
- goto error;
- }
- ASSIGN(wi->flags, ZN_MONITORING, on_off);
- if (on_off == True) {
- ZnResetChronos(wi->total_draw_chrono);
- ZnResetChronos(wi->this_draw_chrono);
- }
+ if (Tcl_GetBooleanFromObj(interp, args[2], &on_off) != TCL_OK) {
+ goto error;
+ }
+ ASSIGN(wi->flags, ZN_MONITORING, on_off);
+ if (on_off == True) {
+ ZnResetChronos(wi->total_draw_chrono);
+ ZnResetChronos(wi->this_draw_chrono);
+ }
}
if ((argc == 2) || (on_off == False)) {
- long ttime, ltime;
- int num_actions;
- ZnGetChrono(wi->total_draw_chrono, &ttime, &num_actions);
- ZnGetChrono(wi->this_draw_chrono, &ltime, NULL);
- l = Tcl_GetObjResult(interp);
- Tcl_ListObjAppendElement(interp, l, Tcl_NewIntObj(num_actions));
- Tcl_ListObjAppendElement(interp, l, Tcl_NewIntObj(ltime));
- Tcl_ListObjAppendElement(interp, l, Tcl_NewIntObj(ttime));
- /*Tcl_ListObjAppendElement(interp, l, Tcl_NewIntObj(wi->damaged_area_w));
- Tcl_ListObjAppendElement(interp, l, Tcl_NewIntObj(wi->damaged_area_h));
- Tcl_ListObjAppendElement(interp, l, Tcl_NewIntObj(ttime));*/
+ long ttime, ltime;
+ int num_actions;
+ ZnGetChrono(wi->total_draw_chrono, &ttime, &num_actions);
+ ZnGetChrono(wi->this_draw_chrono, &ltime, NULL);
+ l = Tcl_GetObjResult(interp);
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewIntObj(num_actions));
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewIntObj(ltime));
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewIntObj(ttime));
+ /*Tcl_ListObjAppendElement(interp, l, Tcl_NewIntObj(wi->damaged_area_w));
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewIntObj(wi->damaged_area_h));
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewIntObj(ttime));*/
}
#endif
}
@@ -5409,12 +5409,12 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
case ZN_W_NUMPARTS:
{
if (argc != 3) {
- Tcl_WrongNumArgs(interp, 1, args, "numparts tagOrId");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args, "numparts tagOrId");
+ goto error;
}
result = ZnItemWithTagOrId(wi, args[2], &item, &search_var);
if ((result == TCL_ERROR) || (item == ZN_NO_ITEM)) {
- goto error;
+ goto error;
}
l = Tcl_NewIntObj((int) item->class->num_parts);
Tcl_SetObjResult(interp, l);
@@ -5427,7 +5427,7 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
{
#if 0
if (ZnPostScriptCmd(wi, argc, args) != TCL_OK) {
- goto error;
+ goto error;
}
#endif
}
@@ -5440,41 +5440,41 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
ZnItem group, mark = ZN_NO_ITEM;
if (argc < 3) {
- Tcl_WrongNumArgs(interp, 1, args, "raise tagOrId ?aboveThis?");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args, "raise tagOrId ?aboveThis?");
+ goto error;
}
if (argc == 4) {
- /*
- * Find the topmost item with the tag.
- */
- if (ZnTagSearchScan(wi, args[3], &search_var) == TCL_ERROR) {
- goto error;
- }
- mark = ZnTagSearchFirst(search_var);
- if (mark == ZN_NO_ITEM) {
- Tcl_AppendResult(interp, "unknown tag or item \"",
- Tcl_GetString(args[3]), "\"", NULL);
- goto error;
- }
+ /*
+ * Find the topmost item with the tag.
+ */
+ if (ZnTagSearchScan(wi, args[3], &search_var) == TCL_ERROR) {
+ goto error;
+ }
+ mark = ZnTagSearchFirst(search_var);
+ if (mark == ZN_NO_ITEM) {
+ Tcl_AppendResult(interp, "unknown tag or item \"",
+ Tcl_GetString(args[3]), "\"", NULL);
+ goto error;
+ }
}
if (ZnTagSearchScan(wi, args[2], &search_var) == TCL_ERROR) {
- goto error;
+ goto error;
}
item = ZnTagSearchFirst(search_var);
if ((item == ZN_NO_ITEM) || (item == wi->top_group)) {
- goto done;
+ goto done;
}
if (mark == ZN_NO_ITEM) {
- mark = ZnGroupHead(item->parent);
+ mark = ZnGroupHead(item->parent);
}
group = mark->parent;
for (; item != ZN_NO_ITEM; item = ZnTagSearchNext(search_var)) {
- if (item->parent != group) {
- continue;
- }
- if (item != mark) {
- ZnITEM.UpdateItemPriority(item, mark, True);
- }
+ if (item->parent != group) {
+ continue;
+ }
+ if (item != mark) {
+ ZnITEM.UpdateItemPriority(item, mark, True);
+ }
}
}
break;
@@ -5486,36 +5486,36 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
unsigned int num_fields;
if (argc < 3) {
- Tcl_WrongNumArgs(interp, 1, args, "remove tagOrId ?tagOrId ...?");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args, "remove tagOrId ?tagOrId ...?");
+ goto error;
}
argc -= 2;
args += 2;
for (i = 0; i < (unsigned int) argc; i++) {
- if (ZnTagSearchScan(wi, args[i], &search_var) == TCL_ERROR) {
- goto error;
- }
- for (item = ZnTagSearchFirst(search_var);
- item != ZN_NO_ITEM; item = ZnTagSearchNext(search_var)) {
- if (item == wi->top_group) {
- continue;
- }
- if (wi->binding_table != NULL) {
- Tk_DeleteAllBindings(wi->binding_table, (ClientData) item);
- if (item->class->GetFieldSet) {
- num_fields = ZnFIELD.NumFields(item->class->GetFieldSet(item));
- for (j = 0; j < num_fields; j++) {
- Tk_DeleteAllBindings(wi->binding_table,
- (ClientData) EncodeItemPart(item, j));
- }
- }
- for (j = 0; j < item->class->num_parts; j++) {
- Tk_DeleteAllBindings(wi->binding_table,
- (ClientData) EncodeItemPart(item, -(int)(j+2)));
- }
- }
- ZnITEM.DestroyItem(item);
- }
+ if (ZnTagSearchScan(wi, args[i], &search_var) == TCL_ERROR) {
+ goto error;
+ }
+ for (item = ZnTagSearchFirst(search_var);
+ item != ZN_NO_ITEM; item = ZnTagSearchNext(search_var)) {
+ if (item == wi->top_group) {
+ continue;
+ }
+ if (wi->binding_table != NULL) {
+ Tk_DeleteAllBindings(wi->binding_table, (ClientData) item);
+ if (item->class->GetFieldSet) {
+ num_fields = ZnFIELD.NumFields(item->class->GetFieldSet(item));
+ for (j = 0; j < num_fields; j++) {
+ Tk_DeleteAllBindings(wi->binding_table,
+ (ClientData) EncodeItemPart(item, j));
+ }
+ }
+ for (j = 0; j < item->class->num_parts; j++) {
+ Tk_DeleteAllBindings(wi->binding_table,
+ (ClientData) EncodeItemPart(item, -(int)(j+2)));
+ }
+ }
+ ZnITEM.DestroyItem(item);
+ }
}
}
break;
@@ -5524,61 +5524,61 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
*/
case ZN_W_ROTATE:
{
- ZnBool deg=False;
+ ZnBool deg=False;
if ((argc < 4) && (argc > 7)) {
- Tcl_WrongNumArgs(interp, 1, args, "rotate tagOrIdOrTransform angle ?degree? ?centerX centerY?");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args, "rotate tagOrIdOrTransform angle ?degree? ?centerX centerY?");
+ goto error;
}
if (argc > 5) {
- if (Tcl_GetDoubleFromObj(interp, args[argc-2], &d) == TCL_ERROR) {
- goto error;
- }
- p.x = d;
- if (Tcl_GetDoubleFromObj(interp, args[argc-1], &d) == TCL_ERROR) {
- goto error;
- }
- p.y = d;
+ if (Tcl_GetDoubleFromObj(interp, args[argc-2], &d) == TCL_ERROR) {
+ goto error;
+ }
+ p.x = d;
+ if (Tcl_GetDoubleFromObj(interp, args[argc-1], &d) == TCL_ERROR) {
+ goto error;
+ }
+ p.y = d;
}
if ((argc == 5) || (argc == 7)) {
- if (Tcl_GetBooleanFromObj(interp, args[4], &deg) != TCL_OK) {
- goto error;
- }
-
+ if (Tcl_GetBooleanFromObj(interp, args[4], &deg) != TCL_OK) {
+ goto error;
+ }
+
}
entry = Tcl_FindHashEntry(wi->t_table, Tcl_GetString(args[2]));
if (entry != NULL) {
- t = (ZnTransfo *) Tcl_GetHashValue(entry);
+ t = (ZnTransfo *) Tcl_GetHashValue(entry);
}
else {
- if (ZnTagSearchScan(wi, args[2], &search_var) == TCL_ERROR) {
- goto error;
- }
+ if (ZnTagSearchScan(wi, args[2], &search_var) == TCL_ERROR) {
+ goto error;
+ }
}
if (Tcl_GetDoubleFromObj(interp, args[3], &d) == TCL_ERROR) {
- goto error;
+ goto error;
}
if (t) {
- if (argc > 5) {
- ZnTranslate(t, -p.x, -p.y, False);
- }
- if (deg) {
- ZnRotateDeg(t, d);
- }
- else {
- ZnRotateRad(t, d);
- }
- if (argc > 5) {
- ZnTranslate(t, p.x, p.y, False);
- }
+ if (argc > 5) {
+ ZnTranslate(t, -p.x, -p.y, False);
+ }
+ if (deg) {
+ ZnRotateDeg(t, d);
+ }
+ else {
+ ZnRotateRad(t, d);
+ }
+ if (argc > 5) {
+ ZnTranslate(t, p.x, p.y, False);
+ }
}
else {
- for (item = ZnTagSearchFirst(search_var);
- item != ZN_NO_ITEM; item = ZnTagSearchNext(search_var)) {
- ZnITEM.RotateItem(item, d, deg, (argc > 5) ? &p : NULL);
- }
+ for (item = ZnTagSearchFirst(search_var);
+ item != ZN_NO_ITEM; item = ZnTagSearchNext(search_var)) {
+ ZnITEM.RotateItem(item, d, deg, (argc > 5) ? &p : NULL);
+ }
}
}
break;
@@ -5590,52 +5590,52 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
ZnPoint scale;
if ((argc != 5) && (argc != 7)) {
- Tcl_WrongNumArgs(interp, 1, args,
- "scale tagOrIdOrTransform xFactor yFactor ?centerX centerY?");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args,
+ "scale tagOrIdOrTransform xFactor yFactor ?centerX centerY?");
+ goto error;
}
entry = Tcl_FindHashEntry(wi->t_table, Tcl_GetString(args[2]));
if (entry != NULL) {
- t = (ZnTransfo *) Tcl_GetHashValue(entry);
+ t = (ZnTransfo *) Tcl_GetHashValue(entry);
}
else {
- if (ZnTagSearchScan(wi, args[2], &search_var) == TCL_ERROR) {
- goto error;
- }
+ if (ZnTagSearchScan(wi, args[2], &search_var) == TCL_ERROR) {
+ goto error;
+ }
}
if (Tcl_GetDoubleFromObj(interp, args[3], &d) == TCL_ERROR) {
- goto error;
+ goto error;
}
scale.x = d;
if (Tcl_GetDoubleFromObj(interp, args[4], &d) == TCL_ERROR) {
- goto error;
+ goto error;
}
scale.y = d;
if (argc == 7) {
- if (Tcl_GetDoubleFromObj(interp, args[5], &d) == TCL_ERROR) {
- goto error;
- }
- p.x = d;
- if (Tcl_GetDoubleFromObj(interp, args[6], &d) == TCL_ERROR) {
- goto error;
- }
- p.y = d;
+ if (Tcl_GetDoubleFromObj(interp, args[5], &d) == TCL_ERROR) {
+ goto error;
+ }
+ p.x = d;
+ if (Tcl_GetDoubleFromObj(interp, args[6], &d) == TCL_ERROR) {
+ goto error;
+ }
+ p.y = d;
}
if (t) {
- if (argc == 7) {
- ZnTranslate(t, -p.x, -p.y, False);
- }
- ZnScale(t, scale.x, scale.y);
- if (argc == 7) {
- ZnTranslate(t, p.x, p.y, False);
- }
+ if (argc == 7) {
+ ZnTranslate(t, -p.x, -p.y, False);
+ }
+ ZnScale(t, scale.x, scale.y);
+ if (argc == 7) {
+ ZnTranslate(t, p.x, p.y, False);
+ }
}
else {
- for (item = ZnTagSearchFirst(search_var);
- item != ZN_NO_ITEM; item = ZnTagSearchNext(search_var)) {
- ZnITEM.ScaleItem(item, scale.x, scale.y, (argc == 7) ? &p : NULL);
- }
+ for (item = ZnTagSearchFirst(search_var);
+ item != ZN_NO_ITEM; item = ZnTagSearchNext(search_var)) {
+ ZnITEM.ScaleItem(item, scale.x, scale.y, (argc == 7) ? &p : NULL);
+ }
}
}
break;
@@ -5647,108 +5647,108 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
ZnTextInfo *ti = &wi->text_info;
if (argc < 3) {
- Tcl_WrongNumArgs(interp, 1, args, "select option ?tagOrId? ?arg?");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args, "select option ?tagOrId? ?arg?");
+ goto error;
}
if (argc >= 4) {
- if (ZnTagSearchScan(wi, args[3], &search_var) == TCL_ERROR) {
- goto error;
- }
- for (item = ZnTagSearchFirst(search_var);
- item != ZN_NO_ITEM; item = ZnTagSearchNext(search_var)) {
- if ((item->class->Index != NULL) &&
- (item->class->Selection != NULL)) {
- break;
- }
- }
- if (item == ZN_NO_ITEM) {
- Tcl_AppendResult(interp, "can't find an indexable item \"",
- Tcl_GetString(args[3]), "\"", NULL);
- goto error;
- }
+ if (ZnTagSearchScan(wi, args[3], &search_var) == TCL_ERROR) {
+ goto error;
+ }
+ for (item = ZnTagSearchFirst(search_var);
+ item != ZN_NO_ITEM; item = ZnTagSearchNext(search_var)) {
+ if ((item->class->Index != NULL) &&
+ (item->class->Selection != NULL)) {
+ break;
+ }
+ }
+ if (item == ZN_NO_ITEM) {
+ Tcl_AppendResult(interp, "can't find an indexable item \"",
+ Tcl_GetString(args[3]), "\"", NULL);
+ goto error;
+ }
}
if (Tcl_GetIndexFromObj(interp, args[2], sel_cmd_strings,
- "selection option", 0, &cmd_index) != TCL_OK) {
- goto error;
+ "selection option", 0, &cmd_index) != TCL_OK) {
+ goto error;
}
if ((argc == 5) || (argc == 6)) {
- if (argc == 6) {
- if (Tcl_GetIntFromObj(interp, args[4], &field) != TCL_OK) {
- field = ZN_NO_PART;
- if (Tcl_GetString(args[4])[0] != 0) {
- Tcl_AppendResult(interp, "invalid field index \"",
- Tcl_GetString(args[4]),
- "\", should be a positive integer", NULL);
- goto error;
- }
- }
- argc--;
- args++;
- }
- result = item->class->Index(item, field, args[4], &index);
- if (result != TCL_OK) {
- goto error;
- }
+ if (argc == 6) {
+ if (Tcl_GetIntFromObj(interp, args[4], &field) != TCL_OK) {
+ field = ZN_NO_PART;
+ if (Tcl_GetString(args[4])[0] != 0) {
+ Tcl_AppendResult(interp, "invalid field index \"",
+ Tcl_GetString(args[4]),
+ "\", should be a positive integer", NULL);
+ goto error;
+ }
+ }
+ argc--;
+ args++;
+ }
+ result = item->class->Index(item, field, args[4], &index);
+ if (result != TCL_OK) {
+ goto error;
+ }
}
switch ((enum sel_cmds) cmd_index) {
case ZN_SEL_ADJUST:
- if (argc != 5) {
- Tcl_WrongNumArgs(interp, 1, args, "select adjust tagOrId ?field? index");
- goto error;
- }
- if ((ti->sel_item == item) && (ti->sel_field == field)) {
- if (index < (ti->sel_first + ti->sel_last)/2) {
- ti->sel_anchor = ti->sel_last+1;
- }
- else {
- ti->sel_anchor = ti->sel_first;
- }
- }
- SelectTo(item, field, index);
- break;
+ if (argc != 5) {
+ Tcl_WrongNumArgs(interp, 1, args, "select adjust tagOrId ?field? index");
+ goto error;
+ }
+ if ((ti->sel_item == item) && (ti->sel_field == field)) {
+ if (index < (ti->sel_first + ti->sel_last)/2) {
+ ti->sel_anchor = ti->sel_last+1;
+ }
+ else {
+ ti->sel_anchor = ti->sel_first;
+ }
+ }
+ SelectTo(item, field, index);
+ break;
case ZN_SEL_CLEAR:
- if (argc != 3) {
- Tcl_WrongNumArgs(interp, 1, args, "select clear");
- goto error;
- }
- if (ti->sel_item != ZN_NO_ITEM) {
- ZnITEM.Invalidate(ti->sel_item, ZN_DRAW_FLAG);
- ti->sel_item = ZN_NO_ITEM;
- ti->sel_field = ZN_NO_PART;
- }
- break;
+ if (argc != 3) {
+ Tcl_WrongNumArgs(interp, 1, args, "select clear");
+ goto error;
+ }
+ if (ti->sel_item != ZN_NO_ITEM) {
+ ZnITEM.Invalidate(ti->sel_item, ZN_DRAW_FLAG);
+ ti->sel_item = ZN_NO_ITEM;
+ ti->sel_field = ZN_NO_PART;
+ }
+ break;
case ZN_SEL_FROM:
- if (argc != 5) {
- Tcl_WrongNumArgs(interp, 1, args, "select from tagOrId ?field? index");
- goto error;
- }
- ti->anchor_item = item;
- ti->anchor_field = field;
- ti->sel_anchor = index;
- break;
+ if (argc != 5) {
+ Tcl_WrongNumArgs(interp, 1, args, "select from tagOrId ?field? index");
+ goto error;
+ }
+ ti->anchor_item = item;
+ ti->anchor_field = field;
+ ti->sel_anchor = index;
+ break;
case ZN_SEL_ITEM:
- if (argc != 3) {
- Tcl_WrongNumArgs(interp, 1, args, "select item");
- goto error;
- }
- if (ti->sel_item != ZN_NO_ITEM) {
- l = Tcl_GetObjResult(interp);
- Tcl_ListObjAppendElement(interp, l, Tcl_NewLongObj(ti->sel_item->id));
- if (ti->sel_field != ZN_NO_PART) {
- Tcl_ListObjAppendElement(interp, l, Tcl_NewIntObj(ti->sel_field));
- }
- else {
- Tcl_ListObjAppendElement(interp, l, Tcl_NewStringObj("", -1));
- }
- }
- break;
+ if (argc != 3) {
+ Tcl_WrongNumArgs(interp, 1, args, "select item");
+ goto error;
+ }
+ if (ti->sel_item != ZN_NO_ITEM) {
+ l = Tcl_GetObjResult(interp);
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewLongObj(ti->sel_item->id));
+ if (ti->sel_field != ZN_NO_PART) {
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewIntObj(ti->sel_field));
+ }
+ else {
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewStringObj("", -1));
+ }
+ }
+ break;
case ZN_SEL_TO:
- if (argc != 5) {
- Tcl_WrongNumArgs(interp, 1, args, "select to tagOrId ?field? index");
- goto error;
- }
- SelectTo(item, field, index);
- break;
+ if (argc != 5) {
+ Tcl_WrongNumArgs(interp, 1, args, "select to tagOrId ?field? index");
+ goto error;
+ }
+ SelectTo(item, field, index);
+ break;
}
}
break;
@@ -5760,33 +5760,33 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
double x_skew, y_skew;
if (argc != 5) {
- Tcl_WrongNumArgs(interp, 1, args, "skew tagOrIdOrTransform xSkewAngle ySkewAngle");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args, "skew tagOrIdOrTransform xSkewAngle ySkewAngle");
+ goto error;
}
entry = Tcl_FindHashEntry(wi->t_table, Tcl_GetString(args[2]));
if (entry != NULL) {
- t = (ZnTransfo *) Tcl_GetHashValue(entry);
+ t = (ZnTransfo *) Tcl_GetHashValue(entry);
}
else {
- if (ZnTagSearchScan(wi, args[2], &search_var) == TCL_ERROR) {
- goto error;
- }
+ if (ZnTagSearchScan(wi, args[2], &search_var) == TCL_ERROR) {
+ goto error;
+ }
}
if (Tcl_GetDoubleFromObj(interp, args[3], &x_skew) == TCL_ERROR) {
- goto error;
+ goto error;
}
if (Tcl_GetDoubleFromObj(interp, args[4], &y_skew) == TCL_ERROR) {
- goto error;
+ goto error;
}
if (t) {
- ZnSkewRad(t, x_skew, y_skew);
+ ZnSkewRad(t, x_skew, y_skew);
}
else {
- for (item = ZnTagSearchFirst(search_var);
- item != ZN_NO_ITEM; item = ZnTagSearchNext(search_var)) {
- ZnITEM.SkewItem(item, x_skew, y_skew);
- }
+ for (item = ZnTagSearchFirst(search_var);
+ item != ZN_NO_ITEM; item = ZnTagSearchNext(search_var)) {
+ ZnITEM.SkewItem(item, x_skew, y_skew);
+ }
}
}
break;
@@ -5796,12 +5796,12 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
case ZN_W_SMOOTH:
{
if (argc != 3) {
- Tcl_WrongNumArgs(interp, 1, args, "smooth coordList");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args, "smooth coordList");
+ goto error;
}
if (ZnParseCoordList(wi, args[2], &points,
- NULL, &num_points, NULL) == TCL_ERROR) {
- return TCL_ERROR;
+ NULL, &num_points, NULL) == TCL_ERROR) {
+ return TCL_ERROR;
}
to_points = ZnListNew(32, sizeof(ZnPoint));
ZnSmoothPathWithBezier(points, num_points, to_points);
@@ -5809,9 +5809,9 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
num_points = ZnListSize(to_points);
l = Tcl_GetObjResult(interp);
for (i = 0; i < num_points; i++, points++) {
- entries[0] = Tcl_NewDoubleObj(points->x);
- entries[1] = Tcl_NewDoubleObj(points->y);
- Tcl_ListObjAppendElement(interp, l, Tcl_NewListObj(2, entries));
+ entries[0] = Tcl_NewDoubleObj(points->x);
+ entries[1] = Tcl_NewDoubleObj(points->y);
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewListObj(2, entries));
}
ZnListFree(to_points);
}
@@ -5830,68 +5830,68 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
*/
case ZN_W_TCOMPOSE:
{
- ZnTransfo *to;
- ZnBool invert=False;
- ZnTransfo res_t, inv_t;
+ ZnTransfo *to;
+ ZnBool invert=False;
+ ZnTransfo res_t, inv_t;
if ((argc != 4) && (argc != 5)) {
- Tcl_WrongNumArgs(interp, 1, args, "tcompose transformTo aTransform ?invert?");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args, "tcompose transformTo aTransform ?invert?");
+ goto error;
}
if (argc == 5) {
- if (Tcl_GetBooleanFromObj(interp, args[4], &invert) != TCL_OK) {
- goto error;
- }
- argc--;
+ if (Tcl_GetBooleanFromObj(interp, args[4], &invert) != TCL_OK) {
+ goto error;
+ }
+ argc--;
}
entry = Tcl_FindHashEntry(wi->t_table, Tcl_GetString(args[3]));
if (entry != NULL) {
- t = (ZnTransfo *) Tcl_GetHashValue(entry);
+ t = (ZnTransfo *) Tcl_GetHashValue(entry);
}
else {
- result = ZnItemWithTagOrId(wi, args[3], &item, &search_var);
- if ((result == TCL_ERROR) || (item == ZN_NO_ITEM)) {
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "\"", Tcl_GetString(args[3]),
- "\" must be either a tag, ",
- "an id or a transform name", (char *) NULL);
- goto error;
- }
- t = item->transfo;
+ result = ZnItemWithTagOrId(wi, args[3], &item, &search_var);
+ if ((result == TCL_ERROR) || (item == ZN_NO_ITEM)) {
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "\"", Tcl_GetString(args[3]),
+ "\" must be either a tag, ",
+ "an id or a transform name", (char *) NULL);
+ goto error;
+ }
+ t = item->transfo;
}
entry = Tcl_FindHashEntry(wi->t_table, Tcl_GetString(args[2]));
if (entry != NULL) {
- to = (ZnTransfo *) Tcl_GetHashValue(entry);
+ to = (ZnTransfo *) Tcl_GetHashValue(entry);
}
else {
- result = ZnItemWithTagOrId(wi, args[2], &item, &search_var);
- if ((result == TCL_ERROR) || (item == ZN_NO_ITEM)) {
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "\"", Tcl_GetString(args[2]),
- "\" must be either a tag, ",
- "an id or a transform name", (char *) NULL);
- goto error;
- }
- to = item->transfo;
+ result = ZnItemWithTagOrId(wi, args[2], &item, &search_var);
+ if ((result == TCL_ERROR) || (item == ZN_NO_ITEM)) {
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "\"", Tcl_GetString(args[2]),
+ "\" must be either a tag, ",
+ "an id or a transform name", (char *) NULL);
+ goto error;
+ }
+ to = item->transfo;
}
if (invert) {
- ZnTransfoInvert(t, &inv_t);
- ZnTransfoCompose(&res_t, to, &inv_t);
+ ZnTransfoInvert(t, &inv_t);
+ ZnTransfoCompose(&res_t, to, &inv_t);
}
else {
- ZnTransfoCompose(&res_t, to, t);
+ ZnTransfoCompose(&res_t, to, t);
}
if (item != ZN_NO_ITEM) {
- /* Set back the transform in the item */
- ZnITEM.SetTransfo(item, &res_t);
+ /* Set back the transform in the item */
+ ZnITEM.SetTransfo(item, &res_t);
}
else {
- ZnTransfoFree(to);
- Tcl_SetHashValue(entry, ZnTransfoDuplicate(&res_t));
+ ZnTransfoFree(to);
+ Tcl_SetHashValue(entry, ZnTransfoDuplicate(&res_t));
}
break;
@@ -5902,14 +5902,14 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
case ZN_W_TDELETE:
{
if (argc != 3) {
- Tcl_WrongNumArgs(interp, 1, args, "tdelete tName");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args, "tdelete tName");
+ goto error;
}
entry = Tcl_FindHashEntry(wi->t_table, Tcl_GetString(args[2]));
if (entry == NULL) {
- Tcl_AppendResult(interp, "\"", Tcl_GetString(args[2]),
- "\" must be a transform name", (char *) NULL);
- goto error;
+ Tcl_AppendResult(interp, "\"", Tcl_GetString(args[2]),
+ "\" must be a transform name", (char *) NULL);
+ goto error;
}
t = (ZnTransfo *) Tcl_GetHashValue(entry);
ZnTransfoFree(t);
@@ -5921,82 +5921,82 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
*/
case ZN_W_TGET:
{
- ZnPoint scale, trans;
- ZnReal rotation, skewxy;
- ZnBool raw=1, get_trans=0, get_rot=0;
- ZnBool get_scale=0, get_skew=0;
- ZnTransfo tid;
+ ZnPoint scale, trans;
+ ZnReal rotation, skewxy;
+ ZnBool raw=1, get_trans=0, get_rot=0;
+ ZnBool get_scale=0, get_skew=0;
+ ZnTransfo tid;
if ((argc != 3) && (argc != 4)) {
err_tget:
- Tcl_WrongNumArgs(interp, 1, args, "tget transform ?all|translation|scale|rotation|skew?");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args, "tget transform ?all|translation|scale|rotation|skew?");
+ goto error;
}
if (argc == 4) {
- raw = 0;
- str = Tcl_GetString(args[3]);
- length = strlen(str);
- if (strncmp(str, "all", length) == 0) {
- get_scale = get_rot = get_trans = get_skew = 1;
- }
- else if (strncmp(str, "translation", length) == 0) {
- get_trans = 1;
- }
- else if (strncmp(str, "scale", length) == 0) {
- get_scale = 1;
- }
- else if (strncmp(str, "rotation", length) == 0) {
- get_rot = 1;
- }
- else if (strncmp(str, "skew", length) == 0) {
- get_skew = 1;
- }
- else {
- goto err_tget;
- }
+ raw = 0;
+ str = Tcl_GetString(args[3]);
+ length = strlen(str);
+ if (strncmp(str, "all", length) == 0) {
+ get_scale = get_rot = get_trans = get_skew = 1;
+ }
+ else if (strncmp(str, "translation", length) == 0) {
+ get_trans = 1;
+ }
+ else if (strncmp(str, "scale", length) == 0) {
+ get_scale = 1;
+ }
+ else if (strncmp(str, "rotation", length) == 0) {
+ get_rot = 1;
+ }
+ else if (strncmp(str, "skew", length) == 0) {
+ get_skew = 1;
+ }
+ else {
+ goto err_tget;
+ }
}
entry = Tcl_FindHashEntry(wi->t_table, Tcl_GetString(args[2]));
if (entry != NULL) {
- t = (ZnTransfo *) Tcl_GetHashValue(entry);
+ t = (ZnTransfo *) Tcl_GetHashValue(entry);
}
else {
- result = ZnItemWithTagOrId(wi, args[2], &item, &search_var);
- if ((result == TCL_ERROR) || (item == ZN_NO_ITEM)) {
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "\"", Tcl_GetString(args[3]),
- "\" must be either a tag, ",
- "an id or a transform name", (char *) NULL);
- goto error;
- }
- t = item->transfo;
+ result = ZnItemWithTagOrId(wi, args[2], &item, &search_var);
+ if ((result == TCL_ERROR) || (item == ZN_NO_ITEM)) {
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "\"", Tcl_GetString(args[3]),
+ "\" must be either a tag, ",
+ "an id or a transform name", (char *) NULL);
+ goto error;
+ }
+ t = item->transfo;
}
l = Tcl_GetObjResult(interp);
if (raw) {
- if (!t) {
- ZnTransfoSetIdentity(&tid);
- t = &tid;
- }
- for (i = 0; i < 6; i++) {
- Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(t->_[i/2][i%2]));
- }
+ if (!t) {
+ ZnTransfoSetIdentity(&tid);
+ t = &tid;
+ }
+ for (i = 0; i < 6; i++) {
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(t->_[i/2][i%2]));
+ }
}
else {
- ZnTransfoDecompose(t, get_scale?&scale:NULL, get_trans?&trans:NULL,
- get_rot?&rotation:NULL, get_skew?&skewxy:NULL);
- if (get_trans) {
- Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(trans.x));
- Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(trans.y));
- }
- if (get_scale) {
- Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(scale.x));
- Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(scale.y));
- }
- if (get_rot) {
- Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(rotation));
- }
- if (get_skew) {
- Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(skewxy));
- }
+ ZnTransfoDecompose(t, get_scale?&scale:NULL, get_trans?&trans:NULL,
+ get_rot?&rotation:NULL, get_skew?&skewxy:NULL);
+ if (get_trans) {
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(trans.x));
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(trans.y));
+ }
+ if (get_scale) {
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(scale.x));
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(scale.y));
+ }
+ if (get_rot) {
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(rotation));
+ }
+ if (get_skew) {
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(skewxy));
+ }
}
break;
}
@@ -6005,121 +6005,121 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
*/
case ZN_W_TRANSFORM:
{
- char *controls, *tag;
- ZnPoint *p, xp;
- ZnTransfo *from_t=NULL, *to_t=NULL, *result_t;
- ZnTransfo t1, t2, t3;
- ZnBool old_format;
+ char *controls, *tag;
+ ZnPoint *p, xp;
+ ZnTransfo *from_t=NULL, *to_t=NULL, *result_t;
+ ZnTransfo t1, t2, t3;
+ ZnBool old_format;
if ((argc != 4) && (argc != 5)) {
- Tcl_WrongNumArgs(interp, 1, args, "transform ?tagOrIdFrom? tagOrIdTo coordlist");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args, "transform ?tagOrIdFrom? tagOrIdTo coordlist");
+ goto error;
}
if (argc == 5) {
- /*
- * Setup the source transform.
- */
- tag = Tcl_GetString(args[2]);
- if (strcmp(tag, "device") == 0) {
- from_t = &t1;
- ZnTransfoSetIdentity(from_t);
- }
- else {
- entry = Tcl_FindHashEntry(wi->t_table, tag);
- if (entry != NULL) {
- /* from is a named transform */
- from_t = (ZnTransfo *) Tcl_GetHashValue(entry);
- }
- else {
- result = ZnItemWithTagOrId(wi, args[2], &item, &search_var);
- if ((result == TCL_ERROR) || (item == ZN_NO_ITEM)) {
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "\"", Tcl_GetString(args[argc-2]),
- "\" must be either identity or a tag or ",
- "an id or a transform name", (char *) NULL);
- goto error;
- }
- ZnITEM.GetItemTransform(item, &t1);
- from_t = &t1;
- }
- }
+ /*
+ * Setup the source transform.
+ */
+ tag = Tcl_GetString(args[2]);
+ if (strcmp(tag, "device") == 0) {
+ from_t = &t1;
+ ZnTransfoSetIdentity(from_t);
+ }
+ else {
+ entry = Tcl_FindHashEntry(wi->t_table, tag);
+ if (entry != NULL) {
+ /* from is a named transform */
+ from_t = (ZnTransfo *) Tcl_GetHashValue(entry);
+ }
+ else {
+ result = ZnItemWithTagOrId(wi, args[2], &item, &search_var);
+ if ((result == TCL_ERROR) || (item == ZN_NO_ITEM)) {
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "\"", Tcl_GetString(args[argc-2]),
+ "\" must be either identity or a tag or ",
+ "an id or a transform name", (char *) NULL);
+ goto error;
+ }
+ ZnITEM.GetItemTransform(item, &t1);
+ from_t = &t1;
+ }
+ }
}
/*
* Setup the destination transform
*/
tag = Tcl_GetString(args[argc-2]);
if (strcmp(tag, "device") == 0) {
- to_t = &t2;
- ZnTransfoSetIdentity(to_t);
+ to_t = &t2;
+ ZnTransfoSetIdentity(to_t);
}
else {
- entry = Tcl_FindHashEntry(wi->t_table, tag);
- if (entry != NULL) {
- /* to is a named transform */
- to_t = (ZnTransfo *) Tcl_GetHashValue(entry);
- }
- else {
- result = ZnItemWithTagOrId(wi, args[argc-2], &item, &search_var);
- if ((result == TCL_ERROR) || (item == ZN_NO_ITEM)) {
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "\"", Tcl_GetString(args[argc-2]),
- "\" must be either identity a tag or ",
- "an id or a transform name", (char *) NULL);
- goto error;
- }
- ZnITEM.GetItemTransform(item, &t2);
- to_t = &t2;
- }
+ entry = Tcl_FindHashEntry(wi->t_table, tag);
+ if (entry != NULL) {
+ /* to is a named transform */
+ to_t = (ZnTransfo *) Tcl_GetHashValue(entry);
+ }
+ else {
+ result = ZnItemWithTagOrId(wi, args[argc-2], &item, &search_var);
+ if ((result == TCL_ERROR) || (item == ZN_NO_ITEM)) {
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "\"", Tcl_GetString(args[argc-2]),
+ "\" must be either identity a tag or ",
+ "an id or a transform name", (char *) NULL);
+ goto error;
+ }
+ ZnITEM.GetItemTransform(item, &t2);
+ to_t = &t2;
+ }
}
ZnTransfoInvert(to_t, &t3);
to_t = &t3;
result_t = to_t;
if (argc == 5) {
- ZnTransfoCompose(&t2, from_t, to_t);
- result_t = &t2;
+ ZnTransfoCompose(&t2, from_t, to_t);
+ result_t = &t2;
}
/*ZnPrintTransfo(&t);
- ZnPrintTransfo(&inv);*/
+ ZnPrintTransfo(&inv);*/
if (ZnParseCoordList(wi, args[argc-1], &p,
- &controls, &num_points, &old_format) == TCL_ERROR) {
- Tcl_AppendResult(interp, " invalid coord list \"",
- Tcl_GetString(args[argc-1]), "\"", NULL);
- goto error;
+ &controls, &num_points, &old_format) == TCL_ERROR) {
+ Tcl_AppendResult(interp, " invalid coord list \"",
+ Tcl_GetString(args[argc-1]), "\"", NULL);
+ goto error;
}
l = Tcl_GetObjResult(interp);
if (old_format) {
- for (i = 0; i < num_points; i++, p++) {
- ZnTransformPoint(result_t, p, &xp);
- /*printf("p->x=%g, p->y=%g, xp.x=%g, xp.y=%g\n", p->x, p->y, xp.x, xp.y);*/
- Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(xp.x));
- Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(xp.y));
- /* The next case only applies for a one point
- * list with a control flag.
- */
- if (controls && controls[i]) {
- c[0] = controls[i];
- Tcl_ListObjAppendElement(interp, l, Tcl_NewStringObj(c, -1));
- }
- }
+ for (i = 0; i < num_points; i++, p++) {
+ ZnTransformPoint(result_t, p, &xp);
+ /*printf("p->x=%g, p->y=%g, xp.x=%g, xp.y=%g\n", p->x, p->y, xp.x, xp.y);*/
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(xp.x));
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(xp.y));
+ /* The next case only applies for a one point
+ * list with a control flag.
+ */
+ if (controls && controls[i]) {
+ c[0] = controls[i];
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewStringObj(c, -1));
+ }
+ }
}
else {
- for (i = 0; i < num_points; i++, p++) {
- ZnTransformPoint(result_t, p, &xp);
- /*printf("p->x=%g, p->y=%g, xp.x=%g, xp.y=%g\n", p->x, p->y, xp.x, xp.y);*/
- entries[0] = Tcl_NewDoubleObj(xp.x);
- entries[1] = Tcl_NewDoubleObj(xp.y);
- if (controls && controls[i]) {
- c[0] = controls[i];
- entries[2] = Tcl_NewStringObj(c, -1);
- Tcl_ListObjAppendElement(interp, l, Tcl_NewListObj(3, entries));
- }
- else {
- Tcl_ListObjAppendElement(interp, l, Tcl_NewListObj(2, entries));
- }
- }
+ for (i = 0; i < num_points; i++, p++) {
+ ZnTransformPoint(result_t, p, &xp);
+ /*printf("p->x=%g, p->y=%g, xp.x=%g, xp.y=%g\n", p->x, p->y, xp.x, xp.y);*/
+ entries[0] = Tcl_NewDoubleObj(xp.x);
+ entries[1] = Tcl_NewDoubleObj(xp.y);
+ if (controls && controls[i]) {
+ c[0] = controls[i];
+ entries[2] = Tcl_NewStringObj(c, -1);
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewListObj(3, entries));
+ }
+ else {
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewListObj(2, entries));
+ }
+ }
}
}
break;
@@ -6131,40 +6131,40 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
ZnBool abs = False;
if ((argc != 5) && (argc != 6)) {
- Tcl_WrongNumArgs(interp, 1, args, "translate tagOrIdorTransform xAmount yAmount ?abs?");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args, "translate tagOrIdorTransform xAmount yAmount ?abs?");
+ goto error;
}
entry = Tcl_FindHashEntry(wi->t_table, Tcl_GetString(args[2]));
if (entry != NULL) {
- t = (ZnTransfo *) Tcl_GetHashValue(entry);
+ t = (ZnTransfo *) Tcl_GetHashValue(entry);
}
else {
- if (ZnTagSearchScan(wi, args[2], &search_var) == TCL_ERROR) {
- goto error;
- }
+ if (ZnTagSearchScan(wi, args[2], &search_var) == TCL_ERROR) {
+ goto error;
+ }
}
if (Tcl_GetDoubleFromObj(interp, args[3], &d) == TCL_ERROR) {
- goto error;
+ goto error;
}
p.x = d;
if (Tcl_GetDoubleFromObj(interp, args[4], &d) == TCL_ERROR) {
- goto error;
+ goto error;
}
p.y = d;
if (argc == 6) {
- if (Tcl_GetBooleanFromObj(interp, args[5], &abs) == TCL_ERROR) {
- goto error;
- }
+ if (Tcl_GetBooleanFromObj(interp, args[5], &abs) == TCL_ERROR) {
+ goto error;
+ }
}
if (t) {
- ZnTranslate(t, p.x, p.y, abs);
+ ZnTranslate(t, p.x, p.y, abs);
}
else {
- for (item = ZnTagSearchFirst(search_var);
- item != ZN_NO_ITEM; item =ZnTagSearchNext(search_var)) {
- ZnITEM.TranslateItem(item, p.x, p.y, abs);
- }
+ for (item = ZnTagSearchFirst(search_var);
+ item != ZN_NO_ITEM; item =ZnTagSearchNext(search_var)) {
+ ZnITEM.TranslateItem(item, p.x, p.y, abs);
+ }
}
}
break;
@@ -6174,27 +6174,27 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
case ZN_W_TRESET:
{
if (argc != 3) {
- Tcl_WrongNumArgs(interp, 1, args, "treset tagOrIdOrTransform");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args, "treset tagOrIdOrTransform");
+ goto error;
}
entry = Tcl_FindHashEntry(wi->t_table, Tcl_GetString(args[2]));
if (entry != NULL) {
- t = (ZnTransfo *) Tcl_GetHashValue(entry);
+ t = (ZnTransfo *) Tcl_GetHashValue(entry);
}
else {
- if (ZnTagSearchScan(wi, args[2], &search_var) == TCL_ERROR) {
- goto error;
- }
+ if (ZnTagSearchScan(wi, args[2], &search_var) == TCL_ERROR) {
+ goto error;
+ }
}
if (t) {
- ZnTransfoSetIdentity(t);
+ ZnTransfoSetIdentity(t);
}
else {
- for (item = ZnTagSearchFirst(search_var);
- item != ZN_NO_ITEM; item = ZnTagSearchNext(search_var)) {
- ZnITEM.ResetTransfo(item);
- }
+ for (item = ZnTagSearchFirst(search_var);
+ item != ZN_NO_ITEM; item = ZnTagSearchNext(search_var)) {
+ ZnITEM.ResetTransfo(item);
+ }
}
}
break;
@@ -6204,22 +6204,22 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
case ZN_W_TRESTORE:
{
if (argc != 4) {
- Tcl_WrongNumArgs(interp, 1, args, "trestore tagOrId tName");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args, "trestore tagOrId tName");
+ goto error;
}
entry = Tcl_FindHashEntry(wi->t_table, Tcl_GetString(args[argc-1]));
if (entry == NULL) {
- Tcl_AppendResult(interp, "\"", Tcl_GetString(args[argc-1]),
- "\" must be a transform name", (char *) NULL);
- goto error;
+ Tcl_AppendResult(interp, "\"", Tcl_GetString(args[argc-1]),
+ "\" must be a transform name", (char *) NULL);
+ goto error;
}
t = (ZnTransfo *) Tcl_GetHashValue(entry);
if (ZnTagSearchScan(wi, args[2], &search_var) == TCL_ERROR) {
- goto error;
+ goto error;
}
for (item = ZnTagSearchFirst(search_var);
- item != ZN_NO_ITEM; item = ZnTagSearchNext(search_var)) {
- ZnITEM.SetTransfo(item, t);
+ item != ZN_NO_ITEM; item = ZnTagSearchNext(search_var)) {
+ ZnITEM.SetTransfo(item, t);
}
}
break;
@@ -6228,56 +6228,56 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
*/
case ZN_W_TSAVE:
{
- int is_ident, new, invert=0;
- ZnTransfo *inv, ident;
- char *from;
+ int is_ident, new, invert=0;
+ ZnTransfo *inv, ident;
+ char *from;
if ((argc != 3) && (argc != 4) && (argc != 5)) {
- Tcl_WrongNumArgs(interp, 1, args, "tsave ?tagOrIdOrTransform? tName ?invert?");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args, "tsave ?tagOrIdOrTransform? tName ?invert?");
+ goto error;
}
if (argc == 3) {
- entry = Tcl_FindHashEntry(wi->t_table, Tcl_GetString(args[2]));
- l = Tcl_NewBooleanObj(entry != NULL);
- Tcl_SetObjResult(interp, l);
- goto done;
+ entry = Tcl_FindHashEntry(wi->t_table, Tcl_GetString(args[2]));
+ l = Tcl_NewBooleanObj(entry != NULL);
+ Tcl_SetObjResult(interp, l);
+ goto done;
}
from = Tcl_GetString(args[2]);
is_ident = strcmp(from, "identity") == 0;
if (is_ident) {
- t = &ident;
- ZnTransfoSetIdentity(t);
+ t = &ident;
+ ZnTransfoSetIdentity(t);
}
else {
- entry = Tcl_FindHashEntry(wi->t_table, from);
- if (entry != NULL) {
- t = (ZnTransfo *) Tcl_GetHashValue(entry);
- }
- else {
- result = ZnItemWithTagOrId(wi, args[2], &item, &search_var);
- if ((result == TCL_ERROR) || (item == ZN_NO_ITEM)) {
- goto error;
- }
- t = item->transfo;
- }
+ entry = Tcl_FindHashEntry(wi->t_table, from);
+ if (entry != NULL) {
+ t = (ZnTransfo *) Tcl_GetHashValue(entry);
+ }
+ else {
+ result = ZnItemWithTagOrId(wi, args[2], &item, &search_var);
+ if ((result == TCL_ERROR) || (item == ZN_NO_ITEM)) {
+ goto error;
+ }
+ t = item->transfo;
+ }
}
if (argc == 5) {
- if (Tcl_GetBooleanFromObj(interp, args[4], &invert) != TCL_OK) {
- goto error;
- }
- argc--;
+ if (Tcl_GetBooleanFromObj(interp, args[4], &invert) != TCL_OK) {
+ goto error;
+ }
+ argc--;
}
entry = Tcl_CreateHashEntry(wi->t_table, Tcl_GetString(args[argc-1]), &new);
if (!new) {
- ZnTransfoFree((ZnTransfo *) Tcl_GetHashValue(entry));
+ ZnTransfoFree((ZnTransfo *) Tcl_GetHashValue(entry));
}
if (invert && !is_ident) {
- inv = ZnTransfoNew();
- ZnTransfoInvert(t, inv);
- Tcl_SetHashValue(entry, inv);
+ inv = ZnTransfoNew();
+ ZnTransfoInvert(t, inv);
+ Tcl_SetHashValue(entry, inv);
}
else {
- Tcl_SetHashValue(entry, ZnTransfoDuplicate(t));
+ Tcl_SetHashValue(entry, ZnTransfoDuplicate(t));
}
}
break;
@@ -6286,35 +6286,35 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
*/
case ZN_W_TSET:
{
- ZnTransfo new;
+ ZnTransfo new;
if (argc != 9) {
- Tcl_WrongNumArgs(interp, 1, args,
- "tset tagOrIdorTransform m00 m01 m10 m11 m20 m21");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args,
+ "tset tagOrIdorTransform m00 m01 m10 m11 m20 m21");
+ goto error;
}
for (i = 0; i < 6; i++) {
- if (Tcl_GetDoubleFromObj(interp, args[3+i], &d) == TCL_ERROR) {
- goto error;
- }
- new._[i/2][i%2] = (float) d;
+ if (Tcl_GetDoubleFromObj(interp, args[3+i], &d) == TCL_ERROR) {
+ goto error;
+ }
+ new._[i/2][i%2] = (float) d;
}
entry = Tcl_FindHashEntry(wi->t_table, Tcl_GetString(args[2]));
if (entry != NULL) {
- t = (ZnTransfo *) Tcl_GetHashValue(entry);
- *t = new;
+ t = (ZnTransfo *) Tcl_GetHashValue(entry);
+ *t = new;
}
else {
- result = ZnItemWithTagOrId(wi, args[2], &item, &search_var);
- if ((result == TCL_ERROR) || (item == ZN_NO_ITEM)) {
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "\"", Tcl_GetString(args[2]),
- "\" must be either a tag, ",
- "an id or a transform name", (char *) NULL);
- goto error;
- }
- ZnITEM.SetTransfo(item, &new);
+ result = ZnItemWithTagOrId(wi, args[2], &item, &search_var);
+ if ((result == TCL_ERROR) || (item == ZN_NO_ITEM)) {
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "\"", Tcl_GetString(args[2]),
+ "\" must be either a tag, ",
+ "an id or a transform name", (char *) NULL);
+ goto error;
+ }
+ ZnITEM.SetTransfo(item, &new);
}
break;
}
@@ -6324,16 +6324,16 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
case ZN_W_TYPE:
{
if (argc != 3) {
- Tcl_WrongNumArgs(interp, 1, args, "type tagOrId");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args, "type tagOrId");
+ goto error;
}
result = ZnItemWithTagOrId(wi, args[2], &item, &search_var);
if (result == TCL_ERROR) {
- goto error;
+ goto error;
}
if (item != ZN_NO_ITEM) {
- l = Tcl_NewStringObj(item->class->name, -1);
- Tcl_SetObjResult(interp, l);
+ l = Tcl_NewStringObj(item->class->name, -1);
+ Tcl_SetObjResult(interp, l);
}
}
break;
@@ -6345,29 +6345,29 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
int contour, vertex, o_vertex;
if (argc != 5) {
- Tcl_WrongNumArgs(interp, 1, args, " vertexat tagOrId x y");
- goto error;
+ Tcl_WrongNumArgs(interp, 1, args, " vertexat tagOrId x y");
+ goto error;
}
if (ZnTagSearchScan(wi, args[2], &search_var) == TCL_ERROR) {
- goto error;
+ goto error;
}
for (item = ZnTagSearchFirst(search_var);
- item != ZN_NO_ITEM; item = ZnTagSearchNext(search_var)) {
- if (item->class->PickVertex != NULL) {
- break;
- }
+ item != ZN_NO_ITEM; item = ZnTagSearchNext(search_var)) {
+ if (item->class->PickVertex != NULL) {
+ break;
+ }
}
if (item == ZN_NO_ITEM) {
- Tcl_AppendResult(interp, "can't find a suitable item \"",
- Tcl_GetString(args[2]), "\"", NULL);
- goto error;
+ Tcl_AppendResult(interp, "can't find a suitable item \"",
+ Tcl_GetString(args[2]), "\"", NULL);
+ goto error;
}
if (Tcl_GetDoubleFromObj(interp, args[3], &d) == TCL_ERROR) {
- goto error;
+ goto error;
}
p.x = d;
if (Tcl_GetDoubleFromObj(interp, args[4], &d) == TCL_ERROR) {
- goto error;
+ goto error;
}
p.y = d;
item->class->PickVertex(item, &p, &contour, &vertex, &o_vertex);
@@ -6381,43 +6381,43 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
/* xview */
case ZN_W_XVIEW:
{
- int count, type;
- ZnReal new_x=0.0, fraction;
+ int count, type;
+ ZnReal new_x=0.0, fraction;
if (argc == 2) {
#ifdef PTK
- ZnReal first, last;
- ScrollFractions(wi->origin.x, wi->origin.x + Tk_Width(wi->win),
- wi->scroll_xo, wi->scroll_xc, &first, &last);
- Tcl_DoubleResults(interp, 2, 0, first, last);
+ ZnReal first, last;
+ ScrollFractions(wi->origin.x, wi->origin.x + Tk_Width(wi->win),
+ wi->scroll_xo, wi->scroll_xc, &first, &last);
+ Tcl_DoubleResults(interp, 2, 0, first, last);
#else
- Tcl_SetObjResult(interp,
- ScrollFractions(wi->origin.x, wi->origin.x + Tk_Width(wi->win),
- wi->scroll_xo, wi->scroll_xc));
+ Tcl_SetObjResult(interp,
+ ScrollFractions(wi->origin.x, wi->origin.x + Tk_Width(wi->win),
+ wi->scroll_xo, wi->scroll_xc));
#endif
}
else {
- type = Tk_GetScrollInfoObj(interp, argc, args, &fraction, &count);
- switch (type) {
- case TK_SCROLL_ERROR:
- result = TCL_ERROR;
- goto done;
- case TK_SCROLL_MOVETO:
- new_x = (wi->scroll_xo + (int) (fraction * (wi->scroll_xc - wi->scroll_xo) + 0.5));
- break;
- case TK_SCROLL_PAGES:
- new_x = (int) (wi->origin.x + count * 0.9 * Tk_Width(wi->win));
- break;
- case TK_SCROLL_UNITS:
- if (wi->x_scroll_incr > 0) {
- new_x = wi->origin.x + count * wi->x_scroll_incr;
- }
- else {
- new_x = (int) (wi->origin.x + count * 0.1 * Tk_Width(wi->win));
- }
- break;
- }
- SetOrigin(wi, new_x, wi->origin.y);
+ type = Tk_GetScrollInfoObj(interp, argc, args, &fraction, &count);
+ switch (type) {
+ case TK_SCROLL_ERROR:
+ result = TCL_ERROR;
+ goto done;
+ case TK_SCROLL_MOVETO:
+ new_x = (wi->scroll_xo + (int) (fraction * (wi->scroll_xc - wi->scroll_xo) + 0.5));
+ break;
+ case TK_SCROLL_PAGES:
+ new_x = (int) (wi->origin.x + count * 0.9 * Tk_Width(wi->win));
+ break;
+ case TK_SCROLL_UNITS:
+ if (wi->x_scroll_incr > 0) {
+ new_x = wi->origin.x + count * wi->x_scroll_incr;
+ }
+ else {
+ new_x = (int) (wi->origin.x + count * 0.1 * Tk_Width(wi->win));
+ }
+ break;
+ }
+ SetOrigin(wi, new_x, wi->origin.y);
}
break;
}
@@ -6425,43 +6425,43 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
/*yview */
case ZN_W_YVIEW:
{
- int count, type;
- ZnReal new_y = 0.0, fraction;
+ int count, type;
+ ZnReal new_y = 0.0, fraction;
if (argc == 2) {
#ifdef PTK
- ZnReal first, last;
- ScrollFractions(wi->origin.y, wi->origin.y + Tk_Height(wi->win),
- wi->scroll_yo, wi->scroll_yc, &first, &last);
- Tcl_DoubleResults(interp, 2, 0, first, last);
+ ZnReal first, last;
+ ScrollFractions(wi->origin.y, wi->origin.y + Tk_Height(wi->win),
+ wi->scroll_yo, wi->scroll_yc, &first, &last);
+ Tcl_DoubleResults(interp, 2, 0, first, last);
#else
- Tcl_SetObjResult(interp,
- ScrollFractions(wi->origin.y, wi->origin.y + Tk_Height(wi->win),
- wi->scroll_yo, wi->scroll_yc));
+ Tcl_SetObjResult(interp,
+ ScrollFractions(wi->origin.y, wi->origin.y + Tk_Height(wi->win),
+ wi->scroll_yo, wi->scroll_yc));
#endif
}
else {
- type = Tk_GetScrollInfoObj(interp, argc, args, &fraction, &count);
- switch (type) {
- case TK_SCROLL_ERROR:
- result = TCL_ERROR;
- goto done;
- case TK_SCROLL_MOVETO:
- new_y = (wi->scroll_yo + (int) (fraction * (wi->scroll_yc - wi->scroll_yo) + 0.5));
- break;
- case TK_SCROLL_PAGES:
- new_y = (int) (wi->origin.y + count * 0.9 * Tk_Height(wi->win));
- break;
- case TK_SCROLL_UNITS:
- if (wi->y_scroll_incr > 0) {
- new_y = wi->origin.y + count * wi->y_scroll_incr;
- }
- else {
- new_y = (int) (wi->origin.y + count * 0.1 * Tk_Height(wi->win));
- }
- break;
- }
- SetOrigin(wi, wi->origin.x, new_y);
+ type = Tk_GetScrollInfoObj(interp, argc, args, &fraction, &count);
+ switch (type) {
+ case TK_SCROLL_ERROR:
+ result = TCL_ERROR;
+ goto done;
+ case TK_SCROLL_MOVETO:
+ new_y = (wi->scroll_yo + (int) (fraction * (wi->scroll_yc - wi->scroll_yo) + 0.5));
+ break;
+ case TK_SCROLL_PAGES:
+ new_y = (int) (wi->origin.y + count * 0.9 * Tk_Height(wi->win));
+ break;
+ case TK_SCROLL_UNITS:
+ if (wi->y_scroll_incr > 0) {
+ new_y = wi->origin.y + count * wi->y_scroll_incr;
+ }
+ else {
+ new_y = (int) (wi->origin.y + count * 0.1 * Tk_Height(wi->win));
+ }
+ break;
+ }
+ SetOrigin(wi, wi->origin.x, new_y);
}
break;
}
@@ -6483,41 +6483,41 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
*
* Configure --
*
- * This procedure is called to process an args/argc list in
- * conjunction with the Tk option database to configure (or
- * reconfigure) a Zinc widget.
+ * This procedure is called to process an args/argc list in
+ * conjunction with the Tk option database to configure (or
+ * reconfigure) a Zinc widget.
*
* Results:
- * The return value is a standard Tcl result. If TCL_ERROR is
- * returned, then interp->result contains an error message.
+ * The return value is a standard Tcl result. If TCL_ERROR is
+ * returned, then interp->result contains an error message.
*
* Side effects:
- * Configuration information, such as colors, border width,
- * etc. get set for the widget; old resources get freed,
- * if there were any.
+ * Configuration information, such as colors, border width,
+ * etc. get set for the widget; old resources get freed,
+ * if there were any.
*
*----------------------------------------------------------------------
*/
#ifdef PTK_800
static int
-Configure(Tcl_Interp *interp,/* Used for error reporting. */
- ZnWInfo *wi, /* Information about widget. */
- int argc, /* Number of valid entries in args. */
- Tcl_Obj *CONST args[], /* Arguments. */
- int flags) /* Flags to pass to Tk_ConfigureWidget. */
+Configure(Tcl_Interp *interp,/* Used for error reporting. */
+ ZnWInfo *wi, /* Information about widget. */
+ int argc, /* Number of valid entries in args. */
+ Tcl_Obj *CONST args[], /* Arguments. */
+ int flags) /* Flags to pass to Tk_ConfigureWidget. */
{
#define CONFIG_PROBE(offset) (ISSET(config_specs[offset].specFlags, \
TK_CONFIG_OPTION_SPECIFIED))
ZnBool init;
- int render;
+ int render;
init = wi->fore_color == NULL;
render = wi->render;
if (Tk_ConfigureWidget(interp, wi->win, config_specs, argc,
#ifdef PTK
- (Tcl_Obj **) args, (char *) wi, flags) != TCL_OK)
+ (Tcl_Obj **) args, (char *) wi, flags) != TCL_OK)
#else
- (CONST char **) args, (char *) wi, flags|TK_CONFIG_OBJS) != TCL_OK)
+ (CONST char **) args, (char *) wi, flags|TK_CONFIG_OBJS) != TCL_OK)
#endif
{
return TCL_ERROR;
@@ -6561,7 +6561,7 @@ Configure(Tcl_Interp *interp,/* Used for error reporting. */
wi->pick_aperture = 0;
}
if (CONFIG_PROBE(BACK_COLOR_SPEC) || !wi->relief_grad) {
- XColor *color;
+ XColor *color;
unsigned short alpha;
Tk_SetWindowBackground(wi->win, ZnGetGradientPixel(wi->back_color, 0.0));
@@ -6572,7 +6572,7 @@ Configure(Tcl_Interp *interp,/* Used for error reporting. */
if (wi->relief != ZN_RELIEF_FLAT) {
color = ZnGetGradientColor(wi->back_color, 0.0, &alpha);
wi->relief_grad = ZnGetReliefGradient(interp, wi->win,
- Tk_NameOfColor(color), alpha);
+ Tk_NameOfColor(color), alpha);
}
}
if (CONFIG_PROBE(BACK_COLOR_SPEC) || CONFIG_PROBE(LIGHT_ANGLE_SPEC)) {
@@ -6601,7 +6601,7 @@ Configure(Tcl_Interp *interp,/* Used for error reporting. */
ZnITEM.InvalidateItems(wi->top_group, ZnWayPoint);
}
#endif
-
+
/*
* Request the new geometry.
*/
@@ -6620,8 +6620,8 @@ Configure(Tcl_Interp *interp,/* Used for error reporting. */
*/
#ifdef ATC
if (CONFIG_PROBE(OVERLAP_MANAGER_SPEC)) {
- Tcl_HashEntry *entry;
- ZnItem grp;
+ Tcl_HashEntry *entry;
+ ZnItem grp;
if (wi->om_group != ZN_NO_ITEM) {
OmUnregister((void *) wi);
@@ -6630,12 +6630,12 @@ Configure(Tcl_Interp *interp,/* Used for error reporting. */
if (wi->om_group_id != 0) {
entry = Tcl_FindHashEntry(wi->id_table, (char *) wi->om_group_id);
if (entry != NULL) {
- grp = (ZnItem) Tcl_GetHashValue(entry);
- if (grp->class == ZnGroup) {
- OmRegister((void *) wi, ZnSendTrackToOm,
- ZnSetLabelAngleFromOm, ZnQueryLabelPosition);
- wi->om_group = grp;
- }
+ grp = (ZnItem) Tcl_GetHashValue(entry);
+ if (grp->class == ZnGroup) {
+ OmRegister((void *) wi, ZnSendTrackToOm,
+ ZnSetLabelAngleFromOm, ZnQueryLabelPosition);
+ wi->om_group = grp;
+ }
}
}
}
@@ -6660,9 +6660,9 @@ Configure(Tcl_Interp *interp,/* Used for error reporting. */
wi->scroll_xo = wi->scroll_yo = 0;
wi->scroll_xc = wi->scroll_yc = 0;
if (wi->region != NULL) {
- int argc2;
+ int argc2;
#ifdef PTK
- Arg *args2;
+ Arg *args2;
#else
CONST char **args2;
#endif
@@ -6673,38 +6673,38 @@ Configure(Tcl_Interp *interp,/* Used for error reporting. */
if (Tcl_SplitList(interp, wi->region, &argc2, &args2) != TCL_OK)
#endif
{
- return TCL_ERROR;
+ return TCL_ERROR;
}
if (argc2 != 4) {
- Tcl_AppendResult(interp, "bad scrollRegion \"", wi->region, "\"", (char *) NULL);
+ Tcl_AppendResult(interp, "bad scrollRegion \"", wi->region, "\"", (char *) NULL);
badRegion:
#ifndef PTK
- ZnFree(wi->region);
- ZnFree(args2);
+ ZnFree(wi->region);
+ ZnFree(args2);
#endif
- wi->region = NULL;
- return TCL_ERROR;
+ wi->region = NULL;
+ return TCL_ERROR;
}
#ifdef PTK
#ifdef PTK_800
if ((Tk_GetPixels(interp, wi->win, LangString(args2[0]), &wi->scroll_xo) != TCL_OK) ||
- (Tk_GetPixels(interp, wi->win, LangString(args2[1]), &wi->scroll_yo) != TCL_OK) ||
- (Tk_GetPixels(interp, wi->win, LangString(args2[2]), &wi->scroll_xc) != TCL_OK) ||
- (Tk_GetPixels(interp, wi->win, LangString(args2[3]), &wi->scroll_yc) != TCL_OK))
+ (Tk_GetPixels(interp, wi->win, LangString(args2[1]), &wi->scroll_yo) != TCL_OK) ||
+ (Tk_GetPixels(interp, wi->win, LangString(args2[2]), &wi->scroll_xc) != TCL_OK) ||
+ (Tk_GetPixels(interp, wi->win, LangString(args2[3]), &wi->scroll_yc) != TCL_OK))
#else
if ((Tk_GetPixelsFromObj(interp, wi->win, args2[0], &wi->scroll_xo) != TCL_OK) ||
- (Tk_GetPixelsFromObj(interp, wi->win, args2[1], &wi->scroll_yo) != TCL_OK) ||
- (Tk_GetPixelsFromObj(interp, wi->win, args2[2], &wi->scroll_xc) != TCL_OK) ||
- (Tk_GetPixelsFromObj(interp, wi->win, args2[3], &wi->scroll_yc) != TCL_OK))
+ (Tk_GetPixelsFromObj(interp, wi->win, args2[1], &wi->scroll_yo) != TCL_OK) ||
+ (Tk_GetPixelsFromObj(interp, wi->win, args2[2], &wi->scroll_xc) != TCL_OK) ||
+ (Tk_GetPixelsFromObj(interp, wi->win, args2[3], &wi->scroll_yc) != TCL_OK))
#endif
#else
if ((Tk_GetPixels(interp, wi->win, args2[0], &wi->scroll_xo) != TCL_OK) ||
- (Tk_GetPixels(interp, wi->win, args2[1], &wi->scroll_yo) != TCL_OK) ||
- (Tk_GetPixels(interp, wi->win, args2[2], &wi->scroll_xc) != TCL_OK) ||
- (Tk_GetPixels(interp, wi->win, args2[3], &wi->scroll_yc) != TCL_OK))
+ (Tk_GetPixels(interp, wi->win, args2[1], &wi->scroll_yo) != TCL_OK) ||
+ (Tk_GetPixels(interp, wi->win, args2[2], &wi->scroll_xc) != TCL_OK) ||
+ (Tk_GetPixels(interp, wi->win, args2[3], &wi->scroll_yc) != TCL_OK))
#endif
{
- goto badRegion;
+ goto badRegion;
}
}
}
@@ -6722,14 +6722,14 @@ Configure(Tcl_Interp *interp,/* Used for error reporting. */
* the item under pointer.
*/
if (wi->pick_event.type == ButtonPress ||
- wi->pick_event.type == ButtonRelease ||
- wi->pick_event.type == MotionNotify ||
- wi->pick_event.type == EnterNotify ||
- wi->pick_event.type == LeaveNotify) {
- Tcl_Preserve((ClientData) wi);
- CLEAR(wi->flags, ZN_INTERNAL_NEED_REPICK);
- PickCurrentItem(wi, &wi->pick_event);
- Tcl_Release((ClientData) wi);
+ wi->pick_event.type == ButtonRelease ||
+ wi->pick_event.type == MotionNotify ||
+ wi->pick_event.type == EnterNotify ||
+ wi->pick_event.type == LeaveNotify) {
+ Tcl_Preserve((ClientData) wi);
+ CLEAR(wi->flags, ZN_INTERNAL_NEED_REPICK);
+ PickCurrentItem(wi, &wi->pick_event);
+ Tcl_Release((ClientData) wi);
}
}
}
@@ -6746,15 +6746,15 @@ TileUpdate(void *client_data)
}
static int
-Configure(Tcl_Interp *interp,/* Used for error reporting. */
- ZnWInfo *wi, /* Information about widget. */
- int argc, /* Number of valid entries in args. */
- Tcl_Obj *CONST args[]) /* Arguments. */
+Configure(Tcl_Interp *interp,/* Used for error reporting. */
+ ZnWInfo *wi, /* Information about widget. */
+ int argc, /* Number of valid entries in args. */
+ Tcl_Obj *CONST args[]) /* Arguments. */
{
- ZnBool init;
- int render, mask, error;
- Tk_SavedOptions saved_options;
- Tcl_Obj *error_result = NULL;
+ ZnBool init;
+ int render, mask, error;
+ Tk_SavedOptions saved_options;
+ Tcl_Obj *error_result = NULL;
render = wi->render;
init = render < 0;
@@ -6762,8 +6762,8 @@ Configure(Tcl_Interp *interp,/* Used for error reporting. */
for (error = 0; error <= 1; error++) {
if (!error) {
if (Tk_SetOptions(interp, (char *) wi, wi->opt_table, argc, args,
- wi->win, &saved_options, &mask) != TCL_OK) {
- continue;
+ wi->win, &saved_options, &mask) != TCL_OK) {
+ continue;
}
}
else {
@@ -6775,8 +6775,8 @@ Configure(Tcl_Interp *interp,/* Used for error reporting. */
if (!init) {
if (render != wi->render) {
- ZnWarning("It is not possible to change the -render option after widget creation.\n");
- wi->render = render;
+ ZnWarning("It is not possible to change the -render option after widget creation.\n");
+ wi->render = render;
}
}
else if (wi->render < 0) {
@@ -6798,32 +6798,32 @@ Configure(Tcl_Interp *interp,/* Used for error reporting. */
wi->scroll_xo = wi->scroll_yo = 0;
wi->scroll_xc = wi->scroll_yc = 0;
if (wi->region != NULL) {
- int argc2;
- Tcl_Obj **args2;
-
- if (Tcl_ListObjGetElements(interp, wi->region, &argc2, &args2) != TCL_OK) {
- badRegion:
- Tcl_AppendResult(interp, "bad scrollRegion \"",
- Tcl_GetString(wi->region), "\"", (char *) NULL);
- continue;
- }
- if (argc2 != 4) {
- goto badRegion;
- }
+ int argc2;
+ Tcl_Obj **args2;
+
+ if (Tcl_ListObjGetElements(interp, wi->region, &argc2, &args2) != TCL_OK) {
+ badRegion:
+ Tcl_AppendResult(interp, "bad scrollRegion \"",
+ Tcl_GetString(wi->region), "\"", (char *) NULL);
+ continue;
+ }
+ if (argc2 != 4) {
+ goto badRegion;
+ }
#ifdef PTK_800
- if ((Tk_GetPixels(interp, wi->win, LangString(args2[0]), &wi->scroll_xo) != TCL_OK) ||
- (Tk_GetPixels(interp, wi->win, LangString(args2[1]), &wi->scroll_yo) != TCL_OK) ||
- (Tk_GetPixels(interp, wi->win, LangString(args2[2]), &wi->scroll_xc) != TCL_OK) ||
- (Tk_GetPixels(interp, wi->win, LangString(args2[3]), &wi->scroll_yc) != TCL_OK))
+ if ((Tk_GetPixels(interp, wi->win, LangString(args2[0]), &wi->scroll_xo) != TCL_OK) ||
+ (Tk_GetPixels(interp, wi->win, LangString(args2[1]), &wi->scroll_yo) != TCL_OK) ||
+ (Tk_GetPixels(interp, wi->win, LangString(args2[2]), &wi->scroll_xc) != TCL_OK) ||
+ (Tk_GetPixels(interp, wi->win, LangString(args2[3]), &wi->scroll_yc) != TCL_OK))
#else
- if ((Tk_GetPixelsFromObj(interp, wi->win, args2[0], &wi->scroll_xo) != TCL_OK) ||
- (Tk_GetPixelsFromObj(interp, wi->win, args2[1], &wi->scroll_yo) != TCL_OK) ||
- (Tk_GetPixelsFromObj(interp, wi->win, args2[2], &wi->scroll_xc) != TCL_OK) ||
- (Tk_GetPixelsFromObj(interp, wi->win, args2[3], &wi->scroll_yc) != TCL_OK))
+ if ((Tk_GetPixelsFromObj(interp, wi->win, args2[0], &wi->scroll_xo) != TCL_OK) ||
+ (Tk_GetPixelsFromObj(interp, wi->win, args2[1], &wi->scroll_yo) != TCL_OK) ||
+ (Tk_GetPixelsFromObj(interp, wi->win, args2[2], &wi->scroll_xc) != TCL_OK) ||
+ (Tk_GetPixelsFromObj(interp, wi->win, args2[3], &wi->scroll_yc) != TCL_OK))
#endif
- {
- goto badRegion;
- }
+ {
+ goto badRegion;
+ }
}
}
@@ -6835,14 +6835,14 @@ Configure(Tcl_Interp *interp,/* Used for error reporting. */
#ifdef GL
if ((mask & CONFIG_FONT) || !wi->font_tfi) {
if (wi->font_tfi) {
- ZnFreeTexFont(wi->font_tfi);
+ ZnFreeTexFont(wi->font_tfi);
}
wi->font_tfi = ZnGetTexFont(wi, wi->font);
}
#ifdef ATC
if ((mask & CONFIG_MAP_FONT) || !wi->map_font_tfi) {
if (wi->map_font_tfi) {
- ZnFreeTexFont(wi->map_font_tfi);
+ ZnFreeTexFont(wi->map_font_tfi);
}
wi->map_font_tfi = ZnGetTexFont(wi, wi->map_text_font);
}
@@ -6852,45 +6852,45 @@ Configure(Tcl_Interp *interp,/* Used for error reporting. */
if ((mask & CONFIG_TILE) || init) {
char *tile_name;
if (wi->tile) {
- ZnFreeImage(wi->tile, TileUpdate, wi);
+ ZnFreeImage(wi->tile, TileUpdate, wi);
}
if (!wi->tile_obj || !*(tile_name = Tcl_GetString(wi->tile_obj))) {
- wi->tile = ZnUnspecifiedImage;
+ wi->tile = ZnUnspecifiedImage;
}
else {
- wi->tile = ZnGetImage(wi, tile_name, TileUpdate, wi);
- if (wi->tile == ZnUnspecifiedImage) {
- Tcl_AppendResult(interp, "Incorrect tile \"", tile_name, "\"", (char *) NULL);
- continue;
- }
+ wi->tile = ZnGetImage(wi, tile_name, TileUpdate, wi);
+ if (wi->tile == ZnUnspecifiedImage) {
+ Tcl_AppendResult(interp, "Incorrect tile \"", tile_name, "\"", (char *) NULL);
+ continue;
+ }
}
}
#ifdef ATC
if ((mask & CONFIG_MAP_SYMBOL) || init) {
if (wi->map_distance_symbol) {
- ZnFreeImage(wi->map_distance_symbol, NULL, NULL);
+ ZnFreeImage(wi->map_distance_symbol, NULL, NULL);
}
wi->map_distance_symbol = ZnGetImage(wi, Tcl_GetString(wi->map_symbol_obj), NULL, NULL);
if ((wi->map_distance_symbol == ZnUnspecifiedImage) ||
- ! ZnImageIsBitmap(wi->map_distance_symbol)) {
- Tcl_AppendResult(interp, "Incorrect bitmap \"",
- Tcl_GetString(wi->map_symbol_obj), "\"", (char *) NULL);
- continue;
+ ! ZnImageIsBitmap(wi->map_distance_symbol)) {
+ Tcl_AppendResult(interp, "Incorrect bitmap \"",
+ Tcl_GetString(wi->map_symbol_obj), "\"", (char *) NULL);
+ continue;
}
}
if ((mask & CONFIG_TRACK_SYMBOL) || init) {
if (wi->track_symbol) {
- ZnFreeImage(wi->track_symbol, NULL, NULL);
+ ZnFreeImage(wi->track_symbol, NULL, NULL);
}
wi->track_symbol = ZnGetImage(wi, Tcl_GetString(wi->track_symbol_obj), NULL, NULL);
if ((wi->track_symbol == ZnUnspecifiedImage) ||
- ! ZnImageIsBitmap(wi->track_symbol)) {
- Tcl_AppendResult(interp, "Incorrect bitmap \"",
- Tcl_GetString(wi->track_symbol_obj), "\"", (char *) NULL);
- continue;
-
+ ! ZnImageIsBitmap(wi->track_symbol)) {
+ Tcl_AppendResult(interp, "Incorrect bitmap \"",
+ Tcl_GetString(wi->track_symbol_obj), "\"", (char *) NULL);
+ continue;
+
}
}
#endif
@@ -6903,18 +6903,18 @@ Configure(Tcl_Interp *interp,/* Used for error reporting. */
}
if ((mask & CONFIG_BACK_COLOR) || !wi->relief_grad) {
- XColor *color;
+ XColor *color;
unsigned short alpha;
Tk_SetWindowBackground(wi->win, ZnGetGradientPixel(wi->back_color, 0.0));
if (wi->relief_grad) {
- ZnFreeGradient(wi->relief_grad);
- wi->relief_grad = NULL;
+ ZnFreeGradient(wi->relief_grad);
+ wi->relief_grad = NULL;
}
if (wi->relief != ZN_RELIEF_FLAT) {
- color = ZnGetGradientColor(wi->back_color, 0.0, &alpha);
- wi->relief_grad = ZnGetReliefGradient(interp, wi->win,
- Tk_NameOfColor(color), alpha);
+ color = ZnGetGradientColor(wi->back_color, 0.0, &alpha);
+ wi->relief_grad = ZnGetReliefGradient(interp, wi->win,
+ Tk_NameOfColor(color), alpha);
}
}
if (mask & CONFIG_DAMAGE_ALL) {
@@ -6937,7 +6937,7 @@ Configure(Tcl_Interp *interp,/* Used for error reporting. */
ZnITEM.InvalidateItems(wi->top_group, ZnWayPoint);
}
#endif
-
+
/*
* Request the new geometry.
*/
@@ -6950,23 +6950,23 @@ Configure(Tcl_Interp *interp,/* Used for error reporting. */
*/
#ifdef ATC
if (mask & CONFIG_OM) {
- Tcl_HashEntry *entry;
- ZnItem grp;
+ Tcl_HashEntry *entry;
+ ZnItem grp;
if (wi->om_group != ZN_NO_ITEM) {
- OmUnregister((void *) wi);
- wi->om_group = ZN_NO_ITEM;
+ OmUnregister((void *) wi);
+ wi->om_group = ZN_NO_ITEM;
}
if (wi->om_group_id != 0) {
- entry = Tcl_FindHashEntry(wi->id_table, (char *) wi->om_group_id);
- if (entry != NULL) {
- grp = (ZnItem) Tcl_GetHashValue(entry);
- if (grp->class == ZnGroup) {
- OmRegister((void *) wi, ZnSendTrackToOm,
- ZnSetLabelAngleFromOm, ZnQueryLabelPosition);
- wi->om_group = grp;
- }
- }
+ entry = Tcl_FindHashEntry(wi->id_table, (char *) wi->om_group_id);
+ if (entry != NULL) {
+ grp = (ZnItem) Tcl_GetHashValue(entry);
+ if (grp->class == ZnGroup) {
+ OmRegister((void *) wi, ZnSendTrackToOm,
+ ZnSetLabelAngleFromOm, ZnQueryLabelPosition);
+ wi->om_group = grp;
+ }
+ }
}
}
#endif
@@ -6983,20 +6983,20 @@ Configure(Tcl_Interp *interp,/* Used for error reporting. */
if (mask & CONFIG_FOLLOW_POINTER) {
if (wi->follow_pointer) {
- /* Flag has just been turned on, process
- * the last known positional event to update
- * the item under pointer.
- */
- if (wi->pick_event.type == ButtonPress ||
- wi->pick_event.type == ButtonRelease ||
- wi->pick_event.type == MotionNotify ||
- wi->pick_event.type == EnterNotify ||
- wi->pick_event.type == LeaveNotify) {
- Tcl_Preserve((ClientData) wi);
- CLEAR(wi->flags, ZN_INTERNAL_NEED_REPICK);
- PickCurrentItem(wi, &wi->pick_event);
- Tcl_Release((ClientData) wi);
- }
+ /* Flag has just been turned on, process
+ * the last known positional event to update
+ * the item under pointer.
+ */
+ if (wi->pick_event.type == ButtonPress ||
+ wi->pick_event.type == ButtonRelease ||
+ wi->pick_event.type == MotionNotify ||
+ wi->pick_event.type == EnterNotify ||
+ wi->pick_event.type == LeaveNotify) {
+ Tcl_Preserve((ClientData) wi);
+ CLEAR(wi->flags, ZN_INTERNAL_NEED_REPICK);
+ PickCurrentItem(wi, &wi->pick_event);
+ Tcl_Release((ClientData) wi);
+ }
}
}
break;
@@ -7019,20 +7019,20 @@ Configure(Tcl_Interp *interp,/* Used for error reporting. */
*
* Focus --
*
- * This procedure is called whenever a zinc gets or loses the
- * input focus. It's also called whenever the window is
- * reconfigured while it has the focus.
+ * This procedure is called whenever a zinc gets or loses the
+ * input focus. It's also called whenever the window is
+ * reconfigured while it has the focus.
*
* Results:
- * None.
+ * None.
*
* Side effects:
- * The cursor gets turned on or off.
+ * The cursor gets turned on or off.
*
*----------------------------------------------------------------------
*/
static void
-Blink(ClientData client_data)
+Blink(ClientData client_data)
{
ZnWInfo *wi = (ZnWInfo *) client_data;
@@ -7042,12 +7042,12 @@ Blink(ClientData client_data)
if (wi->text_info.cursor_on) {
wi->text_info.cursor_on = 0;
wi->blink_handler = Tcl_CreateTimerHandler(wi->insert_off_time,
- Blink, client_data);
+ Blink, client_data);
}
else {
wi->text_info.cursor_on = 1;
wi->blink_handler = Tcl_CreateTimerHandler(wi->insert_on_time,
- Blink, client_data);
+ Blink, client_data);
}
if ((wi->focus_item != ZN_NO_ITEM) &&
(wi->focus_item->class->Cursor != NULL)) {
@@ -7056,8 +7056,8 @@ Blink(ClientData client_data)
}
static void
-Focus(ZnWInfo *wi,
- ZnBool got_focus)
+Focus(ZnWInfo *wi,
+ ZnBool got_focus)
{
Tcl_DeleteTimerHandler(wi->blink_handler);
if (got_focus) {
@@ -7065,7 +7065,7 @@ Focus(ZnWInfo *wi,
wi->text_info.cursor_on = 1;
if (wi->insert_off_time != 0) {
wi->blink_handler = Tcl_CreateTimerHandler(wi->insert_off_time,
- Blink, (ClientData) wi);
+ Blink, (ClientData) wi);
}
}
else {
@@ -7089,23 +7089,23 @@ Focus(ZnWInfo *wi,
*
* Event --
*
- * This procedure is invoked by the Tk dispatcher for various
- * events on Zincs.
+ * This procedure is invoked by the Tk dispatcher for various
+ * events on Zincs.
*
* Results:
- * None.
+ * None.
*
* Side effects:
- * When the window gets deleted, internal structures get
- * cleaned up. When it gets exposed, it is redisplayed.
+ * When the window gets deleted, internal structures get
+ * cleaned up. When it gets exposed, it is redisplayed.
*
*----------------------------------------------------------------------
*/
static void
-TopEvent(ClientData client_data, /* Information about widget. */
- XEvent *event)
+TopEvent(ClientData client_data, /* Information about widget. */
+ XEvent *event)
{
- ZnWInfo *wi = (ZnWInfo *) client_data;
+ ZnWInfo *wi = (ZnWInfo *) client_data;
if (event->type == ConfigureNotify) {
/*printf("Window moved\n");*/
SET(wi->flags, ZN_CONFIGURE_EVENT);
@@ -7113,20 +7113,20 @@ TopEvent(ClientData client_data, /* Information about widget. */
}
static void
-Event(ClientData client_data, /* Information about widget. */
- XEvent *event) /* Information about event. */
+Event(ClientData client_data, /* Information about widget. */
+ XEvent *event) /* Information about event. */
{
- ZnWInfo *wi = (ZnWInfo *) client_data;
- XGCValues values;
- ZnBBox bbox;
+ ZnWInfo *wi = (ZnWInfo *) client_data;
+ XGCValues values;
+ ZnBBox bbox;
/*printf("=============== DEBUT %s %d EVENT ==================\n",
event->type == MapNotify ? "MAP":
- event->type == Expose? "EXPOSE" :
- event->type == ConfigureNotify ? "CONFIGURE" :
- event->type == VisibilityNotify ? "VISIBILITY" :
- event->type == DestroyNotify ? "DESTROY" :
- "??", event->type);*/
+ event->type == Expose? "EXPOSE" :
+ event->type == ConfigureNotify ? "CONFIGURE" :
+ event->type == VisibilityNotify ? "VISIBILITY" :
+ event->type == DestroyNotify ? "DESTROY" :
+ "??", event->type);*/
if (event->type == MapNotify) {
SET(wi->flags, ZN_CONFIGURE_EVENT);
if (!wi->gc) {
@@ -7147,38 +7147,38 @@ Event(ClientData client_data, /* Information about widget. */
* Set the real top window above us.
*/
{
- Window parent, root, *children=NULL;
- Tk_Window top_level;
- int num_children, success;
-
- top_level = wi->win;
- while (!Tk_IsTopLevel(top_level)) {
- top_level = Tk_Parent(top_level);
- }
- success = XQueryTree(wi->dpy, Tk_WindowId(top_level), &root, &parent,
- &children, &num_children);
- if (!success || (root == parent)) {
- wi->real_top = Tk_WindowId(top_level);
- }
- else {
- wi->real_top = parent;
- }
- /*
- * Needed under glx to suspend update with scissors after
- * a move to synchronise the two buffers. Fix a refresh
- * bug when the window is partially clipped by the display
- * border. Can be usefull under Windows too.
- */
- Tk_CreateEventHandler(top_level, StructureNotifyMask, TopEvent, (ClientData) wi);
- if (children && success) {
- XFree(children);
- }
+ Window parent, root, *children=NULL;
+ Tk_Window top_level;
+ int num_children, success;
+
+ top_level = wi->win;
+ while (!Tk_IsTopLevel(top_level)) {
+ top_level = Tk_Parent(top_level);
+ }
+ success = XQueryTree(wi->dpy, Tk_WindowId(top_level), &root, &parent,
+ &children, &num_children);
+ if (!success || (root == parent)) {
+ wi->real_top = Tk_WindowId(top_level);
+ }
+ else {
+ wi->real_top = parent;
+ }
+ /*
+ * Needed under glx to suspend update with scissors after
+ * a move to synchronise the two buffers. Fix a refresh
+ * bug when the window is partially clipped by the display
+ * border. Can be usefull under Windows too.
+ */
+ Tk_CreateEventHandler(top_level, StructureNotifyMask, TopEvent, (ClientData) wi);
+ if (children && success) {
+ XFree(children);
+ }
}
}
ZnNeedRedisplay(wi);
}
else if (event->type == Expose) {
- ZnDim width, height;
+ ZnDim width, height;
SET(wi->flags, ZN_CONFIGURE_EVENT);
@@ -7198,8 +7198,8 @@ Event(ClientData client_data, /* Information about widget. */
bbox.corner.y = MIN(wi->height, bbox.orig.y + height);
/*printf("expose %d %d %d %d\n",
- ((XExposeEvent*) event)->x, ((XExposeEvent*) event)->y,
- ((XExposeEvent*) event)->width, ((XExposeEvent*) event)->height);*/
+ ((XExposeEvent*) event)->x, ((XExposeEvent*) event)->y,
+ ((XExposeEvent*) event)->width, ((XExposeEvent*) event)->height);*/
/*
* Add the exposed area to the expose region and
* schedule an asynchronous redisplay of the window
@@ -7207,7 +7207,7 @@ Event(ClientData client_data, /* Information about widget. */
*/
ZnAddBBoxToBBox(&wi->exposed_area, &bbox);
if (/*(((XExposeEvent*) event)->count == 0) &&*/
- !ZnIsEmptyBBox(&wi->exposed_area)) {
+ !ZnIsEmptyBBox(&wi->exposed_area)) {
ZnNeedRedisplay(wi);
}
}
@@ -7249,13 +7249,13 @@ Event(ClientData client_data, /* Information about widget. */
* Reallocate the double buffer pixmap/image.
*/
if (!wi->render) {
- /*printf("reallocating double buffer\n");*/
- if (wi->draw_buffer) {
- Tk_FreePixmap(wi->dpy, wi->draw_buffer);
- }
- wi->draw_buffer = Tk_GetPixmap(wi->dpy, RootWindowOfScreen(wi->screen),
- int_width, int_height,
- DefaultDepthOfScreen(wi->screen));
+ /*printf("reallocating double buffer\n");*/
+ if (wi->draw_buffer) {
+ Tk_FreePixmap(wi->dpy, wi->draw_buffer);
+ }
+ wi->draw_buffer = Tk_GetPixmap(wi->dpy, RootWindowOfScreen(wi->screen),
+ int_width, int_height,
+ DefaultDepthOfScreen(wi->screen));
}
}
else {
@@ -7303,12 +7303,12 @@ Event(ClientData client_data, /* Information about widget. */
}
/*printf("=============== FIN %s EVENT ==================\n",
- event->type == MapNotify ? "MAP":
- event->type == Expose? "EXPOSE" :
- event->type == ConfigureNotify ? "CONFIGURE" :
- event->type == VisibilityNotify ? "VISIBILITY" :
- event->type == DestroyNotify ? "DESTROY" :
- "??");*/
+ event->type == MapNotify ? "MAP":
+ event->type == Expose? "EXPOSE" :
+ event->type == ConfigureNotify ? "CONFIGURE" :
+ event->type == VisibilityNotify ? "VISIBILITY" :
+ event->type == DestroyNotify ? "DESTROY" :
+ "??");*/
}
@@ -7317,38 +7317,38 @@ Event(ClientData client_data, /* Information about widget. */
*
* DoEvent --
*
- * Trigger the bindings associated with an event.
+ * Trigger the bindings associated with an event.
*
*----------------------------------------------------------------------
*/
static void
-DoEvent(ZnWInfo *wi,
- XEvent *event,
- ZnBool bind_item, /* Controls whether item bindings will trigger.
- * Useful for Enter/Leaves between fields */
- ZnBool bind_part) /* Controls whether part bindings will trigger.
- * Useful for precise control of Enter/Leaves
- * during grabs. */
+DoEvent(ZnWInfo *wi,
+ XEvent *event,
+ ZnBool bind_item, /* Controls whether item bindings will trigger.
+ * Useful for Enter/Leaves between fields */
+ ZnBool bind_part) /* Controls whether part bindings will trigger.
+ * Useful for precise control of Enter/Leaves
+ * during grabs. */
{
#define NUM_STATIC 4
- ClientData items[NUM_STATIC], *its;
- static unsigned int worksize = 128, len, num, num_tags;
- static char *workspace = NULL;
- unsigned int i, ptr;
- ClientData *tag_list = NULL;
- ZnItem item;
- int part;
-
-#define BIND_ITEM(test) \
- if (bind_item && (test)) { \
- its[ptr] = (ClientData) all_uid; \
- ptr++; \
- for (i = 0; i < num_tags; i++) { \
- its[ptr] = tag_list[i]; \
- ptr++; \
- } \
- its[ptr] = (ClientData) item; \
- ptr++; \
+ ClientData items[NUM_STATIC], *its;
+ static unsigned int worksize = 128, len, num, num_tags;
+ static char *workspace = NULL;
+ unsigned int i, ptr;
+ ClientData *tag_list = NULL;
+ ZnItem item;
+ int part;
+
+#define BIND_ITEM(test) \
+ if (bind_item && (test)) { \
+ its[ptr] = (ClientData) all_uid; \
+ ptr++; \
+ for (i = 0; i < num_tags; i++) { \
+ its[ptr] = tag_list[i]; \
+ ptr++; \
+ } \
+ its[ptr] = (ClientData) item; \
+ ptr++; \
}
if (wi->binding_table == NULL) {
@@ -7377,19 +7377,19 @@ DoEvent(ZnWInfo *wi,
num_tags = 0;
its = items;
bind_part = (bind_part &&
- (part != ZN_NO_PART) &&
- item->class->IsSensitive(item, part) &&
- (wi->current_item->class->num_parts ||
- wi->current_item->class->GetFieldSet));
+ (part != ZN_NO_PART) &&
+ item->class->IsSensitive(item, part) &&
+ (wi->current_item->class->num_parts ||
+ wi->current_item->class->GetFieldSet));
/*printf("type=%s, current=%d, new=%d --> %s, currentp %d, newp %d\n",
- event->type==EnterNotify?"<Enter>":
- event->type==LeaveNotify?"<Leave>":
- event->type==MotionNotify?"<Motion>":"other",
- wi->current_item?wi->current_item->id:0,
- wi->new_item?wi->new_item->id:0,
- bind_item?"bind":"nobind",
- wi->current_part, wi->new_part);*/
+ event->type==EnterNotify?"<Enter>":
+ event->type==LeaveNotify?"<Leave>":
+ event->type==MotionNotify?"<Motion>":"other",
+ wi->current_item?wi->current_item->id:0,
+ wi->new_item?wi->new_item->id:0,
+ bind_item?"bind":"nobind",
+ wi->current_part, wi->new_part);*/
if (bind_item) {
num += 2;
}
@@ -7424,8 +7424,8 @@ DoEvent(ZnWInfo *wi,
for (i = 0; i < num_tags; i++) {
len = strlen(tag_list[i])+ TCL_INTEGER_SPACE;
if (worksize < len) {
- worksize = len + 10;
- workspace = ZnRealloc(workspace, len);
+ worksize = len + 10;
+ workspace = ZnRealloc(workspace, len);
}
sprintf(workspace, "%s:%d", (char *) tag_list[i], part);
its[ptr] = (ClientData) Tk_GetUid(workspace);
@@ -7459,36 +7459,36 @@ DoEvent(ZnWInfo *wi,
*
* PickCurrentItem --
*
- * Finds the topmost item/field that contains the pointer and mark
- * it has the current item. Generates Enter/leave events on the
- * old and new current items/fields has necessary.
+ * Finds the topmost item/field that contains the pointer and mark
+ * it has the current item. Generates Enter/leave events on the
+ * old and new current items/fields has necessary.
*
* Results:
- * None.
+ * None.
*
* Side effects:
- * The current item/field may change. If it does,
- * then the commands associated with item entry and exit
- * could do just about anything. A binding script could
- * delete the widget, so callers should protect themselves
- * with Tcl_Preserve and Tcl_Release.
+ * The current item/field may change. If it does,
+ * then the commands associated with item entry and exit
+ * could do just about anything. A binding script could
+ * delete the widget, so callers should protect themselves
+ * with Tcl_Preserve and Tcl_Release.
*
* Note:
- * See the Bind function's note.
+ * See the Bind function's note.
*
*----------------------------------------------------------------------
*/
static void
-PickCurrentItem(ZnWInfo *wi,
- XEvent *event)
+PickCurrentItem(ZnWInfo *wi,
+ XEvent *event)
{
- int button_down;
+ int button_down;
ZnBool enter_item;
ZnBool grab_release = False;
/*printf("PickCurrent current=%d, new=%d\n",
- wi->current_item?wi->current_item->id:0,
- wi->new_item?wi->new_item->id:0);*/
+ wi->current_item?wi->current_item->id:0,
+ wi->new_item?wi->new_item->id:0);*/
/*
* Check whether or not a button is down. If so, we'll log entry
* and exit into and out of the current item, but not entry into
@@ -7556,8 +7556,8 @@ PickCurrentItem(ZnWInfo *wi,
*/
if (wi->pick_event.type != LeaveNotify) {
ZnPickStruct ps;
- ZnReal dist;
- ZnPoint p;
+ ZnReal dist;
+ ZnPoint p;
p.x = wi->pick_event.xcrossing.x;
p.y = wi->pick_event.xcrossing.y;
@@ -7588,8 +7588,8 @@ PickCurrentItem(ZnWInfo *wi,
enter_item = ((wi->new_item != wi->current_item) || ISSET(wi->flags, ZN_GRABBED_ITEM));
/*printf("------ PickCurrentItem current: %d %d, new %d %d\n",
- wi->current_item==ZN_NO_ITEM?0:wi->current_item->id, wi->current_part,
- wi->new_item==ZN_NO_ITEM?0:wi->new_item->id, wi->new_part);*/
+ wi->current_item==ZN_NO_ITEM?0:wi->current_item->id, wi->current_part,
+ wi->new_item==ZN_NO_ITEM?0:wi->new_item->id, wi->new_part);*/
if ((wi->new_item == wi->current_item) &&
(wi->new_part == wi->current_part) &&
@@ -7627,7 +7627,7 @@ PickCurrentItem(ZnWInfo *wi,
event.xcrossing.detail = NotifyAncestor;
SET(wi->flags, ZN_REPICK_IN_PROGRESS);
DoEvent(wi, &event,
- wi->new_item != wi->current_item, ISCLEAR(wi->flags, ZN_GRABBED_PART));
+ wi->new_item != wi->current_item, ISCLEAR(wi->flags, ZN_GRABBED_PART));
CLEAR(wi->flags, ZN_REPICK_IN_PROGRESS);
}
@@ -7691,7 +7691,7 @@ PickCurrentItem(ZnWInfo *wi,
event.type = EnterNotify;
event.xcrossing.detail = NotifyAncestor;
DoEvent(wi, &event,
- enter_item, !(grab_release && ISSET(wi->flags, ZN_GRABBED_PART)));
+ enter_item, !(grab_release && ISSET(wi->flags, ZN_GRABBED_PART)));
}
}
@@ -7701,29 +7701,29 @@ PickCurrentItem(ZnWInfo *wi,
*
* Bind --
*
- * This procedure is invoked by the Tk dispatcher to handle
- * events associated with bindings on items.
+ * This procedure is invoked by the Tk dispatcher to handle
+ * events associated with bindings on items.
*
* Results:
- * None.
+ * None.
*
* Side effects:
- * Depends on the command invoked as part of the binding
- * (if there was any).
+ * Depends on the command invoked as part of the binding
+ * (if there was any).
*
* Note:
- * This has been taken as is from the Tk canvas. It might not
- * not be fully adequate for the purpose. But at least this
- * provides two benefits: a/ It is believe to be correct and
- * b/ users are accustomed to its behavior.
+ * This has been taken as is from the Tk canvas. It might not
+ * not be fully adequate for the purpose. But at least this
+ * provides two benefits: a/ It is believe to be correct and
+ * b/ users are accustomed to its behavior.
*
*----------------------------------------------------------------------
*/
static void
-Bind(ClientData client_data, /* Information about widget. */
- XEvent *event) /* Information about event. */
+Bind(ClientData client_data, /* Information about widget. */
+ XEvent *event) /* Information about event. */
{
- ZnWInfo *wi = (ZnWInfo *) client_data;
+ ZnWInfo *wi = (ZnWInfo *) client_data;
Tcl_Preserve((ClientData) wi);
@@ -7773,7 +7773,7 @@ Bind(ClientData client_data, /* Information about widget. */
PickCurrentItem(wi, event);
wi->state ^= mask;
if (wi->current_item != ZN_NO_ITEM) {
- DoEvent(wi, event, True, True);
+ DoEvent(wi, event, True, True);
}
}
else {
@@ -7823,23 +7823,23 @@ done:
*
* LostSelection --
*
- * This procedure is called back by Tk when the selection is
- * grabbed away from a zinc widget.
+ * This procedure is called back by Tk when the selection is
+ * grabbed away from a zinc widget.
*
* Results:
- * None.
+ * None.
*
* Side effects:
- * The existing selection is unhighlighted, and the window is
- * marked as not containing a selection.
+ * The existing selection is unhighlighted, and the window is
+ * marked as not containing a selection.
*
*----------------------------------------------------------------------
*/
static void
-LostSelection(ClientData client_data)
+LostSelection(ClientData client_data)
{
- ZnWInfo *wi = (ZnWInfo *) client_data;
- ZnTextInfo *ti = &wi->text_info;
+ ZnWInfo *wi = (ZnWInfo *) client_data;
+ ZnTextInfo *ti = &wi->text_info;
if (ti->sel_item != ZN_NO_ITEM) {
ZnITEM.Invalidate(ti->sel_item, ZN_DRAW_FLAG);
@@ -7854,26 +7854,26 @@ LostSelection(ClientData client_data)
*
* SelectTo --
*
- * Modify the selection by moving its un-anchored end. This could
- * make the selection either larger or smaller.
+ * Modify the selection by moving its un-anchored end. This could
+ * make the selection either larger or smaller.
*
* Results:
- * None.
+ * None.
*
* Side effects:
- * The selection changes.
+ * The selection changes.
*
*----------------------------------------------------------------------
*/
static void
-SelectTo(ZnItem item,
- int field,
- int index)
+SelectTo(ZnItem item,
+ int field,
+ int index)
{
- ZnWInfo *wi = item->wi;
- ZnTextInfo *ti = &wi->text_info;
- int old_first, old_last, old_field;
- ZnItem old_sel_item;
+ ZnWInfo *wi = item->wi;
+ ZnTextInfo *ti = &wi->text_info;
+ int old_first, old_last, old_field;
+ ZnItem old_sel_item;
old_first = ti->sel_first;
old_last = ti->sel_last;
@@ -7918,33 +7918,33 @@ SelectTo(ZnItem item,
*
* FetchSelection --
*
- * This procedure is invoked by Tk to return part or all of
- * the selection, when the selection is in a zinc widget.
- * This procedure always returns the selection as a STRING.
+ * This procedure is invoked by Tk to return part or all of
+ * the selection, when the selection is in a zinc widget.
+ * This procedure always returns the selection as a STRING.
*
* Results:
- * The return value is the number of non-NULL bytes stored
- * at buffer. Buffer is filled (or partially filled) with a
- * NULL-terminated string containing part or all of the selection,
- * as given by offset and maxBytes.
+ * The return value is the number of non-NULL bytes stored
+ * at buffer. Buffer is filled (or partially filled) with a
+ * NULL-terminated string containing part or all of the selection,
+ * as given by offset and maxBytes.
*
* Side effects:
- * None.
+ * None.
*
*--------------------------------------------------------------
*/
static int
-FetchSelection( ClientData client_data,
- int offset, /* Offset within selection of first
- * character to be returned. */
- char *buffer, /* Location in which to place
- * selection. */
- int max_bytes) /* Maximum number of bytes to place
- * at buffer, not including terminating
- * NULL character. */
+FetchSelection( ClientData client_data,
+ int offset, /* Offset within selection of first
+ * character to be returned. */
+ char *buffer, /* Location in which to place
+ * selection. */
+ int max_bytes) /* Maximum number of bytes to place
+ * at buffer, not including terminating
+ * NULL character. */
{
- ZnWInfo *wi = (ZnWInfo *) client_data;
- ZnTextInfo *ti = &wi->text_info;
+ ZnWInfo *wi = (ZnWInfo *) client_data;
+ ZnTextInfo *ti = &wi->text_info;
if (ti->sel_item == ZN_NO_ITEM) {
return -1;
@@ -7953,7 +7953,7 @@ FetchSelection( ClientData client_data,
return -1;
}
return (*ti->sel_item->class->Selection)(ti->sel_item, ti->sel_field,
- offset, buffer, max_bytes);
+ offset, buffer, max_bytes);
}
@@ -7962,22 +7962,22 @@ FetchSelection( ClientData client_data,
*
* CmdDeleted --
*
- * This procedure is invoked when a widget command is deleted. If
- * the widget isn't already in the process of being destroyed,
- * this command destroys it.
+ * This procedure is invoked when a widget command is deleted. If
+ * the widget isn't already in the process of being destroyed,
+ * this command destroys it.
*
* Results:
- * None.
+ * None.
*
* Side effects:
- * The widget is destroyed.
+ * The widget is destroyed.
*
*----------------------------------------------------------------------
*/
static void
CmdDeleted(ClientData client_data) /* Pointer to widget record for widget. */
{
- ZnWInfo *wi = (ZnWInfo *) client_data;
+ ZnWInfo *wi = (ZnWInfo *) client_data;
if (wi->win != NULL) {
Tk_DestroyWindow(wi->win);
@@ -7991,29 +7991,29 @@ CmdDeleted(ClientData client_data) /* Pointer to widget record for widget. */
*
* Destroy --
*
- * This procedure is invoked by Tk_EventuallyFree or Tk_Release
- * to clean up the internal structure of the widget at a safe time
- * (when no-one is using it anymore).
+ * This procedure is invoked by Tk_EventuallyFree or Tk_Release
+ * to clean up the internal structure of the widget at a safe time
+ * (when no-one is using it anymore).
*
* Results:
- * None.
+ * None.
*
* Side effects:
- * Everything associated with the widget is freed up.
+ * Everything associated with the widget is freed up.
*
*----------------------------------------------------------------------
*/
static void
-Destroy(char *mem_ptr) /* Info about the widget. */
+Destroy(char *mem_ptr) /* Info about the widget. */
{
- ZnWInfo *wi = (ZnWInfo *) mem_ptr;
- unsigned int num;
+ ZnWInfo *wi = (ZnWInfo *) mem_ptr;
+ unsigned int num;
Tcl_HashSearch search;
- Tcl_HashEntry *entry;
+ Tcl_HashEntry *entry;
#ifdef GL
- unsigned int i;
+ unsigned int i;
ZnGLContextEntry *ce;
- ZnWInfo **wip;
+ ZnWInfo **wip;
#endif
/*printf("Destroy begining\n");*/
@@ -8150,7 +8150,7 @@ Destroy(char *mem_ptr) /* Info about the widget. */
num = ZnListSize(ce->widgets);
for (i = 0; i < num; i++, wip++) {
if (*wip == wi) {
- ZnListDelete(ce->widgets, i);
+ ZnListDelete(ce->widgets, i);
}
}
/*
@@ -8164,16 +8164,16 @@ Destroy(char *mem_ptr) /* Info about the widget. */
ZnGLContextEntry *prev, *next;
/*printf("Freeing a GL context\n");*/
if (ce == gl_contexts) {
- gl_contexts = ce->next;
+ gl_contexts = ce->next;
}
else {
- for (prev = gl_contexts, next = gl_contexts->next; next;
- prev = next, next = next->next) {
- if (next == ce) {
- prev->next = next->next;
- break;
- }
- }
+ for (prev = gl_contexts, next = gl_contexts->next; next;
+ prev = next, next = next->next) {
+ if (next == ce) {
+ prev->next = next->next;
+ break;
+ }
+ }
}
#ifdef _WIN32
ZnGLReleaseContext(ce);
@@ -8224,8 +8224,8 @@ Destroy(char *mem_ptr) /* Info about the widget. */
**********************************************************************************
*/
void
-ZnDamage(ZnWInfo *wi,
- ZnBBox *damage)
+ZnDamage(ZnWInfo *wi,
+ ZnBBox *damage)
{
if ((damage == NULL) || ZnIsEmptyBBox(damage)) {
return;
@@ -8248,8 +8248,8 @@ ZnDamage(ZnWInfo *wi,
wi->damaged_area.corner.y = MAX(wi->damaged_area.corner.y, damage->corner.y);
}
/*printf("damaged area: %g %g %g %g\n", wi->damaged_area.orig.x,
- wi->damaged_area.orig.y, wi->damaged_area.corner.x,
- wi->damaged_area.corner.y);*/
+ wi->damaged_area.orig.y, wi->damaged_area.corner.x,
+ wi->damaged_area.corner.y);*/
}
void
@@ -8264,9 +8264,9 @@ ZnDamageAll(ZnWInfo *wi)
}
static void
-ClampDamageArea(ZnWInfo *wi)
+ClampDamageArea(ZnWInfo *wi)
{
- int width, height;
+ int width, height;
if (wi->damaged_area.orig.x < wi->inset) {
wi->damaged_area.orig.x = wi->inset;
@@ -8305,7 +8305,7 @@ ClampDamageArea(ZnWInfo *wi)
**********************************************************************************
*/
static void
-Update(ZnWInfo *wi)
+Update(ZnWInfo *wi)
{
/*
* Give the overlap manager a chance to do its work.
@@ -8315,7 +8315,7 @@ Update(ZnWInfo *wi)
ZnPoint scale={1.0,1.0};
if (wi->om_group->transfo) {
ZnTransfoDecompose(wi->om_group->transfo, &scale,
- NULL, NULL, NULL);
+ NULL, NULL, NULL);
}
OmProcessOverlap((void *) wi, wi->width, wi->height, scale.x);
ZnGroupSetCallOm(wi->om_group, False);
@@ -8336,17 +8336,17 @@ Update(ZnWInfo *wi)
**********************************************************************************
*/
static void
-Repair(ZnWInfo *wi)
+Repair(ZnWInfo *wi)
{
- XGCValues values;
- ZnPoint p[5];
- ZnTriStrip tristrip;
+ XGCValues values;
+ ZnPoint p[5];
+ ZnTriStrip tristrip;
#ifdef GL
- XColor *color;
+ XColor *color;
ZnGLContextEntry *ce;
#endif
- int int_width = Tk_Width(wi->win);
- int int_height = Tk_Height(wi->win);
+ int int_width = Tk_Width(wi->win);
+ int int_height = Tk_Height(wi->win);
/*SET(wi->flags, ZN_CONFIGURE_EVENT);*/
if (wi->render) {
@@ -8365,7 +8365,7 @@ Repair(ZnWInfo *wi)
*/
ZnAddBBoxToBBox(&wi->damaged_area, &wi->exposed_area);
if (ZnIsEmptyBBox(&wi->damaged_area)) {
- return;
+ return;
}
}
#endif
@@ -8385,7 +8385,7 @@ Repair(ZnWInfo *wi)
glClearStencil(0);
color = ZnGetGradientColor(wi->back_color, 0.0, NULL);
glClearColor((GLfloat) color->red/65536, (GLfloat) color->green/65536,
- (GLfloat) color->blue/65536, 0.0);
+ (GLfloat) color->blue/65536, 0.0);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
@@ -8412,9 +8412,9 @@ Repair(ZnWInfo *wi)
wi->damaged_area.corner.x = ZnNearestInt(wi->damaged_area.corner.x);
wi->damaged_area.corner.y = ZnNearestInt(wi->damaged_area.corner.y);
glScissor((int) wi->damaged_area.orig.x,
- int_height - (int) wi->damaged_area.corner.y,
- (int) (wi->damaged_area.corner.x - wi->damaged_area.orig.x),
- (int) (wi->damaged_area.corner.y - wi->damaged_area.orig.y));
+ int_height - (int) wi->damaged_area.corner.y,
+ (int) (wi->damaged_area.corner.x - wi->damaged_area.orig.x),
+ (int) (wi->damaged_area.corner.y - wi->damaged_area.orig.y));
}
else {
glDisable(GL_SCISSOR_TEST);
@@ -8456,55 +8456,55 @@ Repair(ZnWInfo *wi)
#ifdef GL_DAMAGE
if (ISCLEAR(wi->flags, ZN_CONFIGURE_EVENT)) {
- glDisable(GL_SCISSOR_TEST);
+ glDisable(GL_SCISSOR_TEST);
}
#endif
if (wi->highlight_width > 0) {
- color = ZnGetGradientColor(ISSET(wi->flags, ZN_GOT_FOCUS)?wi->highlight_color:
- wi->highlight_bg_color, 0.0, &alpha);
- alpha = ZnComposeAlpha(alpha, 100);
- glColor4us(color->red, color->green, color->blue, alpha);
-
- glBegin(GL_QUAD_STRIP);
- glVertex2d(0.0, 0.0);
- glVertex2i(wi->highlight_width, wi->highlight_width);
- glVertex2i(int_width, 0);
- glVertex2i(int_width - wi->highlight_width, wi->highlight_width);
- glVertex2i(int_width, int_height);
- glVertex2i(int_width - wi->highlight_width, int_height - wi->highlight_width);
- glVertex2i(0, int_height);
- glVertex2i(wi->highlight_width, int_height - wi->highlight_width);
- glVertex2i(0, 0);
- glVertex2i(wi->highlight_width, wi->highlight_width);
- glEnd();
+ color = ZnGetGradientColor(ISSET(wi->flags, ZN_GOT_FOCUS)?wi->highlight_color:
+ wi->highlight_bg_color, 0.0, &alpha);
+ alpha = ZnComposeAlpha(alpha, 100);
+ glColor4us(color->red, color->green, color->blue, alpha);
+
+ glBegin(GL_QUAD_STRIP);
+ glVertex2d(0.0, 0.0);
+ glVertex2i(wi->highlight_width, wi->highlight_width);
+ glVertex2i(int_width, 0);
+ glVertex2i(int_width - wi->highlight_width, wi->highlight_width);
+ glVertex2i(int_width, int_height);
+ glVertex2i(int_width - wi->highlight_width, int_height - wi->highlight_width);
+ glVertex2i(0, int_height);
+ glVertex2i(wi->highlight_width, int_height - wi->highlight_width);
+ glVertex2i(0, 0);
+ glVertex2i(wi->highlight_width, wi->highlight_width);
+ glEnd();
}
if (wi->border_width > 0) {
- if (wi->relief != ZN_RELIEF_FLAT) {
- p[4].x = p[4].y = p[3].y = p[1].x = wi->highlight_width;
- p[0] = p[4];
- p[3].x = p[2].x = int_width - wi->highlight_width;
- p[2].y = p[1].y = int_height - wi->highlight_width;
- ZnRenderPolygonRelief(wi, wi->relief, wi->relief_grad,
- False, p, 5, (ZnReal) wi->border_width);
- }
- else {
- color = ZnGetGradientColor(wi->back_color, 0.0, &alpha);
- alpha = ZnComposeAlpha(alpha, 100);
- glColor4us(color->red, color->green, color->blue, alpha);
-
- glBegin(GL_QUAD_STRIP);
- glVertex2d(0.0, 0.0);
- glVertex2i(wi->highlight_width, wi->highlight_width);
- glVertex2i(int_width, 0);
- glVertex2i(int_width - wi->highlight_width, wi->highlight_width);
- glVertex2i(int_width, int_height);
- glVertex2i(int_width - wi->highlight_width, int_height - wi->highlight_width);
- glVertex2i(0, int_height);
- glVertex2i(wi->highlight_width, int_height - wi->highlight_width);
- glVertex2i(0, 0);
- glVertex2i(wi->highlight_width, wi->highlight_width);
- glEnd();
- }
+ if (wi->relief != ZN_RELIEF_FLAT) {
+ p[4].x = p[4].y = p[3].y = p[1].x = wi->highlight_width;
+ p[0] = p[4];
+ p[3].x = p[2].x = int_width - wi->highlight_width;
+ p[2].y = p[1].y = int_height - wi->highlight_width;
+ ZnRenderPolygonRelief(wi, wi->relief, wi->relief_grad,
+ False, p, 5, (ZnReal) wi->border_width);
+ }
+ else {
+ color = ZnGetGradientColor(wi->back_color, 0.0, &alpha);
+ alpha = ZnComposeAlpha(alpha, 100);
+ glColor4us(color->red, color->green, color->blue, alpha);
+
+ glBegin(GL_QUAD_STRIP);
+ glVertex2d(0.0, 0.0);
+ glVertex2i(wi->highlight_width, wi->highlight_width);
+ glVertex2i(int_width, 0);
+ glVertex2i(int_width - wi->highlight_width, wi->highlight_width);
+ glVertex2i(int_width, int_height);
+ glVertex2i(int_width - wi->highlight_width, int_height - wi->highlight_width);
+ glVertex2i(0, int_height);
+ glVertex2i(wi->highlight_width, int_height - wi->highlight_width);
+ glVertex2i(0, 0);
+ glVertex2i(wi->highlight_width, wi->highlight_width);
+ glEnd();
+ }
}
CLEAR(wi->flags, ZN_CONFIGURE_EVENT);
@@ -8534,8 +8534,8 @@ Repair(ZnWInfo *wi)
#endif
}
else {
- XRectangle r, rs[4];
- ZnBBox merge;
+ XRectangle r, rs[4];
+ ZnBBox merge;
ClampDamageArea(wi);
/*
@@ -8560,17 +8560,17 @@ m * Merge the damaged area with the exposed area.
/* Fill the background of the double buffer pixmap. */
if (wi->tile == ZnUnspecifiedImage) {
- values.foreground = ZnGetGradientPixel(wi->back_color, 0.0);
- values.fill_style = FillSolid;
- XChangeGC(wi->dpy, wi->gc, GCFillStyle|GCForeground, &values);
+ values.foreground = ZnGetGradientPixel(wi->back_color, 0.0);
+ values.fill_style = FillSolid;
+ XChangeGC(wi->dpy, wi->gc, GCFillStyle|GCForeground, &values);
}
else {
- values.fill_style = FillTiled;
- values.tile = ZnImagePixmap(wi->tile, wi->win);
- values.ts_x_origin = values.ts_y_origin = 0;
- XChangeGC(wi->dpy, wi->gc,
- GCFillStyle|GCTile|GCTileStipXOrigin|GCTileStipYOrigin,
- &values);
+ values.fill_style = FillTiled;
+ values.tile = ZnImagePixmap(wi->tile, wi->win);
+ values.ts_x_origin = values.ts_y_origin = 0;
+ XChangeGC(wi->dpy, wi->gc,
+ GCFillStyle|GCTile|GCTileStipXOrigin|GCTileStipYOrigin,
+ &values);
}
XFillRectangle(wi->dpy, wi->draw_buffer, wi->gc, r.x, r.y, r.width, r.height);
@@ -8588,8 +8588,8 @@ m * Merge the damaged area with the exposed area.
merge.corner.y = MIN(merge.corner.y, int_height-wi->inset);
ZnBBox2XRect(&merge, &r);
XCopyArea(wi->dpy,
- wi->draw_buffer, Tk_WindowId(wi->win), wi->gc,
- r.x, r.y, r.width, r.height, r.x, r.y);
+ wi->draw_buffer, Tk_WindowId(wi->win), wi->gc,
+ r.x, r.y, r.width, r.height, r.x, r.y);
}
/*
@@ -8601,37 +8601,37 @@ m * Merge the damaged area with the exposed area.
save = wi->draw_buffer;
wi->draw_buffer = Tk_WindowId(wi->win);
if (wi->relief_grad != ZN_RELIEF_FLAT) {
- r.x = r.y = wi->highlight_width;
- r.width = int_width - 2*wi->highlight_width;
- r.height = int_height - 2*wi->highlight_width;
- ZnDrawRectangleRelief(wi, wi->relief, wi->relief_grad, &r,
- (ZnDim) wi->border_width);
+ r.x = r.y = wi->highlight_width;
+ r.width = int_width - 2*wi->highlight_width;
+ r.height = int_height - 2*wi->highlight_width;
+ ZnDrawRectangleRelief(wi, wi->relief, wi->relief_grad, &r,
+ (ZnDim) wi->border_width);
}
else {
- XSetForeground(wi->dpy, wi->gc, ZnGetGradientPixel(wi->back_color, 0.0));
- XSetFillStyle(wi->dpy, wi->gc, FillSolid);
- rs[0].x = rs[0].y = wi->highlight_width;
- rs[0].width = int_width - 2*wi->highlight_width;
- rs[0].height = wi->border_width;
- rs[1].x = int_width - wi->highlight_width - wi->border_width;
- rs[1].y = 0;
- rs[1].width = wi->border_width;
- rs[1].height = int_height - 2*wi->highlight_width;
- rs[2].x = 0;
- rs[2].y = int_height - wi->highlight_width - wi->border_width;
- rs[2].width = rs[0].width;
- rs[2].height = wi->border_width;
- rs[3].x = rs[3].y = wi->highlight_width;
- rs[3].width = wi->border_width;
- rs[3].height = rs[1].height;
- XFillRectangles(wi->dpy, Tk_WindowId(wi->win), wi->gc, rs, 4);
+ XSetForeground(wi->dpy, wi->gc, ZnGetGradientPixel(wi->back_color, 0.0));
+ XSetFillStyle(wi->dpy, wi->gc, FillSolid);
+ rs[0].x = rs[0].y = wi->highlight_width;
+ rs[0].width = int_width - 2*wi->highlight_width;
+ rs[0].height = wi->border_width;
+ rs[1].x = int_width - wi->highlight_width - wi->border_width;
+ rs[1].y = 0;
+ rs[1].width = wi->border_width;
+ rs[1].height = int_height - 2*wi->highlight_width;
+ rs[2].x = 0;
+ rs[2].y = int_height - wi->highlight_width - wi->border_width;
+ rs[2].width = rs[0].width;
+ rs[2].height = wi->border_width;
+ rs[3].x = rs[3].y = wi->highlight_width;
+ rs[3].width = wi->border_width;
+ rs[3].height = rs[1].height;
+ XFillRectangles(wi->dpy, Tk_WindowId(wi->win), wi->gc, rs, 4);
}
wi->draw_buffer = save;
}
if (wi->highlight_width > 0) {
XSetForeground(wi->dpy, wi->gc,
- ZnGetGradientPixel(ISSET(wi->flags, ZN_GOT_FOCUS)?wi->highlight_color:
- wi->highlight_bg_color, 0.0));
+ ZnGetGradientPixel(ISSET(wi->flags, ZN_GOT_FOCUS)?wi->highlight_color:
+ wi->highlight_bg_color, 0.0));
XSetFillStyle(wi->dpy, wi->gc, FillSolid);
rs[0].x = rs[0].y = 0;
rs[0].width = int_width;
@@ -8658,23 +8658,23 @@ m * Merge the damaged area with the exposed area.
*
* Redisplay --
*
- * This procedure redraws the contents of a Zinc window.
- * It is invoked as a do-when-idle handler, so it only runs
- * when there's nothing else for the application to do.
+ * This procedure redraws the contents of a Zinc window.
+ * It is invoked as a do-when-idle handler, so it only runs
+ * when there's nothing else for the application to do.
*
* Results:
- * None.
+ * None.
*
* Side effects:
- * Information appears on the screen.
+ * Information appears on the screen.
*
*----------------------------------------------------------------------
*/
static void
-Redisplay(ClientData client_data) /* Information about the widget. */
+Redisplay(ClientData client_data) /* Information about the widget. */
{
- ZnWInfo *wi = (ZnWInfo *) client_data;
+ ZnWInfo *wi = (ZnWInfo *) client_data;
CLEAR(wi->flags, ZN_UPDATE_PENDING);
if (ISCLEAR(wi->flags, ZN_REALIZED) || !Tk_IsMapped(wi->win)) {
@@ -8704,29 +8704,29 @@ Redisplay(ClientData client_data) /* Information about the widget. */
* for Tcl_Preserve/Tcl_Release.
*/
if (ISSET(wi->flags, ZN_INTERNAL_NEED_REPICK)) {
- Tk_Window tkwin;
+ Tk_Window tkwin;
if (wi->follow_pointer) {
- Tcl_Preserve((ClientData) wi);
- CLEAR(wi->flags, ZN_INTERNAL_NEED_REPICK);
- PickCurrentItem(wi, &wi->pick_event);
- tkwin = wi->win;
- Tcl_Release((ClientData) wi);
- if (tkwin == NULL) {
- return;
- }
+ Tcl_Preserve((ClientData) wi);
+ CLEAR(wi->flags, ZN_INTERNAL_NEED_REPICK);
+ PickCurrentItem(wi, &wi->pick_event);
+ tkwin = wi->win;
+ Tcl_Release((ClientData) wi);
+ if (tkwin == NULL) {
+ return;
+ }
}
else if (ISCLEAR(wi->top_group->inv_flags, ZN_COORDS_FLAG) &&
- ISCLEAR(wi->top_group->inv_flags, ZN_TRANSFO_FLAG)) {
- /* Don't repick now but escape the loop if
- * the geometry is updated. */
- break;
+ ISCLEAR(wi->top_group->inv_flags, ZN_TRANSFO_FLAG)) {
+ /* Don't repick now but escape the loop if
+ * the geometry is updated. */
+ break;
}
}
}
while (ISSET(wi->top_group->inv_flags, ZN_COORDS_FLAG) ||
- ISSET(wi->top_group->inv_flags, ZN_TRANSFO_FLAG) ||
- ISSET(wi->flags, ZN_INTERNAL_NEED_REPICK));
+ ISSET(wi->top_group->inv_flags, ZN_TRANSFO_FLAG) ||
+ ISSET(wi->flags, ZN_INTERNAL_NEED_REPICK));
/*
* Repair the scene where it is no longer up to date,
@@ -8757,39 +8757,39 @@ Redisplay(ClientData client_data) /* Information about the widget. */
#endif
static void CALLBACK
-ZnTessBegin(GLenum type,
- void *data)
+ZnTessBegin(GLenum type,
+ void *data)
{
- ZnPoly *outlines = data;
- ZnTriStrip *tristrips = data;
+ ZnPoly *outlines = data;
+ ZnTriStrip *tristrips = data;
ZnListEmpty(ZnWorkPoints);
ZnTesselator.type = type;
if (type == GL_LINE_LOOP) {
outlines->num_contours++;
outlines->contours = ZnRealloc(outlines->contours,
- outlines->num_contours * sizeof(ZnContour));
+ outlines->num_contours * sizeof(ZnContour));
}
else {
tristrips->num_strips++;
tristrips->strips = ZnRealloc(tristrips->strips,
- tristrips->num_strips * sizeof(ZnStrip));
+ tristrips->num_strips * sizeof(ZnStrip));
tristrips->strips[tristrips->num_strips-1].fan = (type==GL_TRIANGLE_FAN);
}
//printf("Début de fragment de type: %s\n",
- //(type == GL_TRIANGLE_FAN) ? "FAN" :
- //(type == GL_TRIANGLE_STRIP) ? "STRIP" :
- //(type == GL_TRIANGLES) ? "TRIANGLES" :
- //(type == GL_LINE_LOOP) ? "LINE LOOP" : "");
+ //(type == GL_TRIANGLE_FAN) ? "FAN" :
+ //(type == GL_TRIANGLE_STRIP) ? "STRIP" :
+ //(type == GL_TRIANGLES) ? "TRIANGLES" :
+ //(type == GL_LINE_LOOP) ? "LINE LOOP" : "");
}
static void CALLBACK
-ZnTessVertex(void *vertex_data,
- void *data)
+ZnTessVertex(void *vertex_data,
+ void *data)
{
- ZnTriStrip *tristrips = data;
- ZnPoint p;
- int size;
+ ZnTriStrip *tristrips = data;
+ ZnPoint p;
+ int size;
p.x = ((GLdouble *) vertex_data)[0];
p.y = ((GLdouble *) vertex_data)[1];
@@ -8799,25 +8799,25 @@ ZnTessVertex(void *vertex_data,
tristrips->strips[tristrips->num_strips-1].num_points = size;
tristrips->strips[tristrips->num_strips-1].points = ZnMalloc(size * sizeof(ZnPoint));
memcpy(tristrips->strips[tristrips->num_strips-1].points,
- ZnListArray(ZnWorkPoints), size * sizeof(ZnPoint));
+ ZnListArray(ZnWorkPoints), size * sizeof(ZnPoint));
//printf("Fin de fragment intermediaire %d, num points: %d\n", tristrips->num_strips-1, size);
/* Allocate a new fragment */
ZnListEmpty(ZnWorkPoints);
tristrips->num_strips++;
tristrips->strips = ZnRealloc(tristrips->strips,
- tristrips->num_strips * sizeof(ZnStrip));
+ tristrips->num_strips * sizeof(ZnStrip));
tristrips->strips[tristrips->num_strips-1].fan = False;
}
ZnListAdd(ZnWorkPoints, &p, ZnListTail);
}
static void CALLBACK
-ZnTessEnd(void *data)
+ZnTessEnd(void *data)
{
- ZnPoly *outlines = data;
- ZnTriStrip *tristrips = data;
- unsigned int size = ZnListSize(ZnWorkPoints);
- unsigned int num;
+ ZnPoly *outlines = data;
+ ZnTriStrip *tristrips = data;
+ unsigned int size = ZnListSize(ZnWorkPoints);
+ unsigned int num;
if (ZnTesselator.type == GL_LINE_LOOP) {
/* Add the last point to close the outline */
@@ -8826,7 +8826,7 @@ ZnTessEnd(void *data)
outlines->contours[num-1].num_points = size;
outlines->contours[num-1].points = ZnMalloc(size * sizeof(ZnPoint));
memcpy(outlines->contours[num-1].points,
- ZnListArray(ZnWorkPoints), size * sizeof(ZnPoint));
+ ZnListArray(ZnWorkPoints), size * sizeof(ZnPoint));
outlines->contours[num-1].points[size-1] = outlines->contours[num-1].points[0];
outlines->contours[num-1].cw = !ZnTestCCW(outlines->contours[num-1].points, size);
}
@@ -8835,19 +8835,19 @@ ZnTessEnd(void *data)
tristrips->strips[num-1].num_points = size;
tristrips->strips[num-1].points = ZnMalloc(size * sizeof(ZnPoint));
memcpy(tristrips->strips[num-1].points,
- ZnListArray(ZnWorkPoints), size * sizeof(ZnPoint));
+ ZnListArray(ZnWorkPoints), size * sizeof(ZnPoint));
}
//printf("Fin de fragment %d, num points: %d\n", num, size);
}
static void CALLBACK
-ZnTessCombine(GLdouble coords[3],
- void *vertex_data[4],
- GLfloat weight[4],
- void **out_data,
- void *data)
+ZnTessCombine(GLdouble coords[3],
+ void *vertex_data[4],
+ GLfloat weight[4],
+ void **out_data,
+ void *data)
{
- ZnCombineData *cdata;
+ ZnCombineData *cdata;
cdata = ZnMalloc(sizeof(ZnCombineData));
cdata->v[0] = coords[0];
@@ -8855,14 +8855,14 @@ ZnTessCombine(GLdouble coords[3],
cdata->next = ZnTesselator.combine_list;
ZnTesselator.combine_list = cdata;
*out_data = &cdata->v;
- ZnTesselator.combine_length++;
+ ZnTesselator.combine_length++;
//printf("Création d'un nouveau sommet en %g %g\n",
//cdata->v[0], cdata->v[1]);
}
static void CALLBACK
-ZnTessError(GLenum errno,
- void *data)
+ZnTessError(GLenum errno,
+ void *data)
{
fprintf(stderr, "Tesselation error in curve item: %d\n", errno);
}
@@ -8870,9 +8870,9 @@ ZnTessError(GLenum errno,
static void
InitZinc(Tcl_Interp *interp) {
- static ZnBool inited = False;
- unsigned int i, x, y, bit;
- char name[TCL_INTEGER_SPACE + 20];
+ static ZnBool inited = False;
+ unsigned int i, x, y, bit;
+ char name[TCL_INTEGER_SPACE + 20];
if (inited) {
return;
@@ -8884,25 +8884,25 @@ InitZinc(Tcl_Interp *interp) {
for (i = 0; i < sizeof(SYMBOLS_BITS)/(SYMBOL_WIDTH*SYMBOL_HEIGHT/8); i++) {
sprintf(name, "AtcSymbol%d", i+1);
Tk_DefineBitmap(interp, Tk_GetUid(name),
- SYMBOLS_BITS[i], SYMBOL_WIDTH, SYMBOL_HEIGHT);
+ SYMBOLS_BITS[i], SYMBOL_WIDTH, SYMBOL_HEIGHT);
}
for (i = 0; i < ZN_NUM_ALPHA_STEPS; i++) {
for (y = 0; y < 4; y++) {
bitmaps[i][y][0] = 0;
for (x = 0; x < 4; x++) {
- /*
- * Use the dither4x4 matrix to determine if this bit is on
- */
- bit = (i >= dither4x4[y][x]) ? 1 : 0;
- /*
- * set the bit in the array used to make the X Bitmap
- * mirror the pattern in x & y to make an 8x8 bitmap.
- */
- if (bit) {
- bitmaps[i][y][0] |= (1 << x);
- bitmaps[i][y][0] |= (1 << (4 + x));
- }
+ /*
+ * Use the dither4x4 matrix to determine if this bit is on
+ */
+ bit = (i >= dither4x4[y][x]) ? 1 : 0;
+ /*
+ * set the bit in the array used to make the X Bitmap
+ * mirror the pattern in x & y to make an 8x8 bitmap.
+ */
+ if (bit) {
+ bitmaps[i][y][0] |= (1 << x);
+ bitmaps[i][y][0] |= (1 << (4 + x));
+ }
}
bitmaps[i][y][1] = bitmaps[i][y][2] = bitmaps[i][y][3] = bitmaps[i][y][0];
bitmaps[i][y+4][0] = bitmaps[i][y+4][1] = bitmaps[i][y][0];
@@ -8936,7 +8936,7 @@ InitZinc(Tcl_Interp *interp) {
*/
ZnTesselator.tess = gluNewTess();
ZnTesselator.combine_list = NULL;
- ZnTesselator.combine_length = 0;
+ ZnTesselator.combine_length = 0;
gluTessCallback(ZnTesselator.tess, GLU_TESS_BEGIN_DATA, ZnTessBegin);
gluTessCallback(ZnTesselator.tess, GLU_TESS_VERTEX_DATA, ZnTessVertex);
gluTessCallback(ZnTesselator.tess, GLU_TESS_END_DATA, ZnTessEnd);
@@ -8982,13 +8982,13 @@ InitZinc(Tcl_Interp *interp) {
*
* Tkzinc_Init --
*
- * This procedure is invoked by Tcl_AppInit in tkAppInit.c to
- * initialize the widget.
+ * This procedure is invoked by Tcl_AppInit in tkAppInit.c to
+ * initialize the widget.
*
*----------------------------------------------------------------------
*/
EXTERN int
-Tkzinc_Init(Tcl_Interp *interp) /* Used for error reporting. */
+Tkzinc_Init(Tcl_Interp *interp) /* Used for error reporting. */
{
#ifndef PTK
if (
@@ -9015,13 +9015,13 @@ Tkzinc_Init(Tcl_Interp *interp) /* Used for error reporting. */
* Create additional commands
*/
Tcl_CreateObjCommand(interp, "zinc", ZincObjCmd,
- (ClientData) Tk_MainWindow(interp),
- (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) Tk_MainWindow(interp),
+ (Tcl_CmdDeleteProc *) NULL);
#ifdef ATC
Tcl_CreateObjCommand(interp, "mapinfo", ZnMapInfoObjCmd,
- (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateObjCommand(interp, "videomap", ZnVideomapObjCmd,
- (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
#endif
#ifndef PTK
@@ -9034,7 +9034,7 @@ Tkzinc_Init(Tcl_Interp *interp) /* Used for error reporting. */
}
EXTERN int
-Tkzinc_debug_Init(Tcl_Interp *interp) /* Used for error reporting. */
+Tkzinc_debug_Init(Tcl_Interp *interp) /* Used for error reporting. */
{
return Tkzinc_Init(interp);
}
@@ -9045,23 +9045,23 @@ Tkzinc_debug_Init(Tcl_Interp *interp) /* Used for error reporting. */
*
* DllEntryPoint --
*
- * This wrapper function is used by Windows to invoke the
- * initialization code for the DLL. If we are compiling
- * with Visual C++, this routine will be renamed to DllMain.
- * routine.
+ * This wrapper function is used by Windows to invoke the
+ * initialization code for the DLL. If we are compiling
+ * with Visual C++, this routine will be renamed to DllMain.
+ * routine.
*
* Results:
- * Returns TRUE;
+ * Returns TRUE;
*
* Side effects:
- * None.
+ * None.
*
*----------------------------------------------------------------------
*/
BOOL APIENTRY
-DllEntryPoint(HINSTANCE hInst, /* Library instance handle. */
- DWORD reason, /* Reason this function is being called. */
- LPVOID reserved) /* Not used. */
+DllEntryPoint(HINSTANCE hInst, /* Library instance handle. */
+ DWORD reason, /* Reason this function is being called. */
+ LPVOID reserved) /* Not used. */
{
return TRUE;
}
diff --git a/generic/tkZinc.h b/generic/tkZinc.h
index 14022ee..6adae6d 100644
--- a/generic/tkZinc.h
+++ b/generic/tkZinc.h
@@ -1,8 +1,8 @@
/*
* tkZinc.h -- Header file for Tk zinc widget.
*
- * Authors : Patrick Lecoanet.
- * Creation date : Mon Mar 15 14:02:03 1999
+ * Authors : Patrick Lecoanet.
+ * Creation date : Mon Mar 15 14:02:03 1999
*
* $Id$
*/
@@ -38,66 +38,66 @@
#include <GL/glu.h>
typedef struct _ZnTagSearch {
- ZnWInfo *wi;
- ZnItem current; /* Pointer to last item returned. */
- ZnItem previous; /* The item right before the current
- * is tracked so if the current is
- * deleted we don't have to start from the
- * beginning. */
- ZnBool over; /* Non-zero means NextItem should always
- * return NULL. */
- int type; /* search type */
- unsigned int id; /* item id for searches by id */
-
- Tk_Uid tag; /* tag expression string */
- int tag_index; /* current position in string scan */
- int tag_len; /* length of tag expression string */
-
- char *rewrite_buf; /* tag string (after removing escapes) */
- unsigned int rewrite_buf_alloc; /* available space for rewrites */
-
- struct _TagSearchExpr *expr; /* compiled tag expression */
- ZnItem group;
- ZnBool recursive;
- ZnList item_stack;
+ ZnWInfo *wi;
+ ZnItem current; /* Pointer to last item returned. */
+ ZnItem previous; /* The item right before the current
+ * is tracked so if the current is
+ * deleted we don't have to start from the
+ * beginning. */
+ ZnBool over; /* Non-zero means NextItem should always
+ * return NULL. */
+ int type; /* search type */
+ unsigned int id; /* item id for searches by id */
+
+ Tk_Uid tag; /* tag expression string */
+ int tag_index; /* current position in string scan */
+ int tag_len; /* length of tag expression string */
+
+ char *rewrite_buf; /* tag string (after removing escapes) */
+ unsigned int rewrite_buf_alloc; /* available space for rewrites */
+
+ struct _TagSearchExpr *expr; /* compiled tag expression */
+ ZnItem group;
+ ZnBool recursive;
+ ZnList item_stack;
} ZnTagSearch;
/*
* Structure used by the tesselator.
*/
typedef struct _ZnCombineData {
- ZnReal v[2];
- struct _ZnCombineData *next;
+ ZnReal v[2];
+ struct _ZnCombineData *next;
} ZnCombineData;
typedef struct _ZnTess {
- GLUtesselator *tess;
- ZnCombineData *combine_list;
- int type;
- int combine_length;
+ GLUtesselator *tess;
+ ZnCombineData *combine_list;
+ int type;
+ int combine_length;
} ZnTess;
-extern ZnList ZnWorkPoints;
-extern ZnList ZnWorkXPoints;
-extern ZnList ZnWorkStrings;
-extern ZnTess ZnTesselator;
+extern ZnList ZnWorkPoints;
+extern ZnList ZnWorkXPoints;
+extern ZnList ZnWorkStrings;
+extern ZnTess ZnTesselator;
#ifdef GL
typedef struct _ZnGLContextEntry {
- ZnGLContext context;
- Display *dpy;
- ZnReal max_line_width;
- ZnReal max_point_width;
- unsigned int max_tex_size;
- ZnList widgets;
+ ZnGLContext context;
+ Display *dpy;
+ ZnReal max_line_width;
+ ZnReal max_point_width;
+ unsigned int max_tex_size;
+ ZnList widgets;
#ifdef _WIN32
PIXELFORMATDESCRIPTOR pfd;
- int ipixel;
- HWND hwnd; /* Temporary storage between MakeCurrent and Release */
- HDC hdc;
+ int ipixel;
+ HWND hwnd; /* Temporary storage between MakeCurrent and Release */
+ HDC hdc;
#else
- XVisualInfo *visual; /* Should these two be managed by screen ? */
- Colormap colormap;
+ XVisualInfo *visual; /* Should these two be managed by screen ? */
+ Colormap colormap;
#endif
struct _ZnGLContextEntry *next;
} ZnGLContextEntry;
@@ -108,9 +108,9 @@ void ZnGLReleaseContext(ZnGLContextEntry *ce);
#endif
int ZnParseCoordList(ZnWInfo *wi, Tcl_Obj *arg, ZnPoint **pts,
- char **controls, unsigned int *num_pts, ZnBool *old_format);
+ char **controls, unsigned int *num_pts, ZnBool *old_format);
int ZnItemWithTagOrId(ZnWInfo *wi, Tcl_Obj *tag_or_id,
- ZnItem *item, ZnTagSearch **search_var);
+ ZnItem *item, ZnTagSearch **search_var);
void ZnTagSearchDestroy(ZnTagSearch *search);
void ZnDoItem(Tcl_Interp *interp, ZnItem item, int part, Tk_Uid tag_uid);
void ZnNeedRedisplay(ZnWInfo *wi);