aboutsummaryrefslogtreecommitdiff
path: root/generic/Arc.c
diff options
context:
space:
mode:
authorlecoanet2000-02-02 14:01:15 +0000
committerlecoanet2000-02-02 14:01:15 +0000
commit64089dca388f5a9a8235a94b4372763875132219 (patch)
tree0455fa06d471a568cbece8fc27cde0216d4def23 /generic/Arc.c
parent2b91521b4c124546e59638f2e990dcbc75903d85 (diff)
downloadtkzinc-64089dca388f5a9a8235a94b4372763875132219.zip
tkzinc-64089dca388f5a9a8235a94b4372763875132219.tar.gz
tkzinc-64089dca388f5a9a8235a94b4372763875132219.tar.bz2
tkzinc-64089dca388f5a9a8235a94b4372763875132219.tar.xz
Passage en Zinc
Diffstat (limited to 'generic/Arc.c')
-rw-r--r--generic/Arc.c332
1 files changed, 166 insertions, 166 deletions
diff --git a/generic/Arc.c b/generic/Arc.c
index a5203b5..4477867 100644
--- a/generic/Arc.c
+++ b/generic/Arc.c
@@ -53,7 +53,7 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ "
#define LAST_END_OK 1<<4
-static double Pick(Item item, RadarPoint *p, Item start_item, int aperture,
+static double Pick(Item item, ZnPoint *p, Item start_item, int aperture,
Item *a_item, int *a_part);
@@ -68,13 +68,13 @@ typedef struct _ArcItemStruct {
ItemStruct header;
/* Public data */
- RadarPoint coords[2];
+ ZnPoint coords[2];
int start_angle;
int angle_extent;
Pixmap line_pattern;
Pixmap fill_pattern;
- RadarColor fill_color;
- RadarColor line_color;
+ ZnColor fill_color;
+ ZnColor line_color;
int line_width;
LineStyle line_style;
LineEnd first_end;
@@ -83,65 +83,65 @@ typedef struct _ArcItemStruct {
unsigned char flags;
/* Private data */
- RadarPoint orig;
- RadarPoint corner;
- RadarPoint center1;
- RadarPoint center2;
- RadarImage tile;
- RadarList render_shape;
+ ZnPoint orig;
+ ZnPoint corner;
+ ZnPoint center1;
+ ZnPoint center2;
+ ZnImage tile;
+ ZnList render_shape;
} ArcItemStruct, *ArcItem;
-static RadarAttrConfig arc_attrs[] = {
- { RADAR_CONFIG_BOOL, "-closed", NULL,
- Tk_Offset(ArcItemStruct, flags), CLOSED_BIT, RADAR_COORDS_FLAG, False },
- { RADAR_CONFIG_BOOL, "-composerotation", NULL,
+static ZnAttrConfig arc_attrs[] = {
+ { ZN_CONFIG_BOOL, "-closed", NULL,
+ Tk_Offset(ArcItemStruct, flags), CLOSED_BIT, ZN_COORDS_FLAG, False },
+ { ZN_CONFIG_BOOL, "-composerotation", NULL,
Tk_Offset(ArcItemStruct, header.flags), COMPOSE_ROTATION_BIT,
- RADAR_COORDS_FLAG, False },
- { RADAR_CONFIG_BOOL, "-composescale", NULL,
+ ZN_COORDS_FLAG, False },
+ { ZN_CONFIG_BOOL, "-composescale", NULL,
Tk_Offset(ArcItemStruct, header.flags), COMPOSE_SCALE_BIT,
- RADAR_COORDS_FLAG, False },
- { RADAR_CONFIG_ANGLE, "-extent", NULL,
- Tk_Offset(ArcItemStruct, angle_extent), 0, RADAR_COORDS_FLAG, False },
- { RADAR_CONFIG_COLOR, "-fillcolor", NULL,
- Tk_Offset(ArcItemStruct, fill_color), 0, RADAR_DRAW_FLAG, False },
- { RADAR_CONFIG_BOOL, "-filled", NULL,
- Tk_Offset(ArcItemStruct, flags), FILLED_BIT, RADAR_COORDS_FLAG, False },
- { RADAR_CONFIG_PATTERN, "-fillpattern", NULL,
- Tk_Offset(ArcItemStruct, fill_pattern), 0, RADAR_DRAW_FLAG, False },
- { RADAR_CONFIG_LINE_END, "-firstend", NULL,
- Tk_Offset(ArcItemStruct, first_end), 0, RADAR_COORDS_FLAG, False },
- { RADAR_CONFIG_LINE_END, "-lastend", NULL,
- Tk_Offset(ArcItemStruct, last_end), 0, RADAR_COORDS_FLAG, False },
- { RADAR_CONFIG_COLOR, "-linecolor", NULL,
+ ZN_COORDS_FLAG, False },
+ { ZN_CONFIG_ANGLE, "-extent", NULL,
+ Tk_Offset(ArcItemStruct, angle_extent), 0, ZN_COORDS_FLAG, False },
+ { ZN_CONFIG_COLOR, "-fillcolor", NULL,
+ Tk_Offset(ArcItemStruct, fill_color), 0, ZN_DRAW_FLAG, False },
+ { ZN_CONFIG_BOOL, "-filled", NULL,
+ Tk_Offset(ArcItemStruct, flags), FILLED_BIT, ZN_COORDS_FLAG, False },
+ { ZN_CONFIG_PATTERN, "-fillpattern", NULL,
+ Tk_Offset(ArcItemStruct, fill_pattern), 0, ZN_DRAW_FLAG, False },
+ { ZN_CONFIG_LINE_END, "-firstend", NULL,
+ Tk_Offset(ArcItemStruct, first_end), 0, ZN_COORDS_FLAG, False },
+ { ZN_CONFIG_LINE_END, "-lastend", NULL,
+ Tk_Offset(ArcItemStruct, last_end), 0, ZN_COORDS_FLAG, False },
+ { ZN_CONFIG_COLOR, "-linecolor", NULL,
Tk_Offset(ArcItemStruct, line_color), 0,
- RADAR_DRAW_FLAG|RADAR_BORDER_FLAG, False },
- { RADAR_CONFIG_PATTERN, "-linepattern", NULL,
- Tk_Offset(ArcItemStruct, line_pattern), 0, RADAR_DRAW_FLAG, False },
- { RADAR_CONFIG_LINE_STYLE, "-linestyle", NULL,
- Tk_Offset(ArcItemStruct, line_style), 0, RADAR_DRAW_FLAG, False },
- { RADAR_CONFIG_DIM, "-linewidth", NULL,
- Tk_Offset(ArcItemStruct, line_width), 0, RADAR_COORDS_FLAG, False },
- { RADAR_CONFIG_BOOL, "-pieslice", NULL,
- Tk_Offset(ArcItemStruct, flags), PIE_SLICE_BIT, RADAR_COORDS_FLAG, False },
- { RADAR_CONFIG_PRI, "-priority", NULL,
+ ZN_DRAW_FLAG|ZN_BORDER_FLAG, False },
+ { ZN_CONFIG_PATTERN, "-linepattern", NULL,
+ Tk_Offset(ArcItemStruct, line_pattern), 0, ZN_DRAW_FLAG, False },
+ { ZN_CONFIG_LINE_STYLE, "-linestyle", NULL,
+ Tk_Offset(ArcItemStruct, line_style), 0, ZN_DRAW_FLAG, False },
+ { ZN_CONFIG_DIM, "-linewidth", NULL,
+ Tk_Offset(ArcItemStruct, line_width), 0, ZN_COORDS_FLAG, False },
+ { ZN_CONFIG_BOOL, "-pieslice", NULL,
+ Tk_Offset(ArcItemStruct, flags), PIE_SLICE_BIT, ZN_COORDS_FLAG, False },
+ { ZN_CONFIG_PRI, "-priority", NULL,
Tk_Offset(ArcItemStruct, header.priority), 0,
- RADAR_DRAW_FLAG|RADAR_REPICK_FLAG, False },
- { RADAR_CONFIG_BOOL, "-sensitive", NULL,
+ ZN_DRAW_FLAG|ZN_REPICK_FLAG, False },
+ { ZN_CONFIG_BOOL, "-sensitive", NULL,
Tk_Offset(ArcItemStruct, header.flags), SENSITIVE_BIT,
- RADAR_REPICK_FLAG, False },
- { RADAR_CONFIG_ANGLE, "-startangle", NULL,
- Tk_Offset(ArcItemStruct, start_angle), 0, RADAR_COORDS_FLAG, False },
- { RADAR_CONFIG_TAGS, "-tags", NULL,
+ ZN_REPICK_FLAG, False },
+ { ZN_CONFIG_ANGLE, "-startangle", NULL,
+ Tk_Offset(ArcItemStruct, start_angle), 0, ZN_COORDS_FLAG, False },
+ { ZN_CONFIG_TAGS, "-tags", NULL,
Tk_Offset(ArcItemStruct, header.tags), 0, 0, False },
- { RADAR_CONFIG_IMAGE, "-tile", NULL,
+ { ZN_CONFIG_IMAGE, "-tile", NULL,
Tk_Offset(ArcItemStruct, tile_name), 0,
- RADAR_DRAW_FLAG|RADAR_TILE_FLAG, False },
- { RADAR_CONFIG_BOOL, "-visible", NULL,
+ ZN_DRAW_FLAG|ZN_TILE_FLAG, False },
+ { ZN_CONFIG_BOOL, "-visible", NULL,
Tk_Offset(ArcItemStruct, header.flags), VISIBLE_BIT,
- RADAR_DRAW_FLAG|RADAR_REPICK_FLAG|RADAR_VIS_FLAG, False },
+ ZN_DRAW_FLAG|ZN_REPICK_FLAG|ZN_VIS_FLAG, False },
- { RADAR_CONFIG_END, NULL, NULL, 0, 0, 0 }
+ { ZN_CONFIG_END, NULL, NULL, 0, 0, 0 }
};
@@ -164,7 +164,7 @@ ArcTileChange(ClientData client_data,
ArcItem arc = (ArcItem) client_data;
InvalidateImage(arc->tile);
- ITEM.Invalidate((Item) arc, RADAR_COORDS_FLAG);
+ ITEM.Invalidate((Item) arc, ZN_COORDS_FLAG);
}
@@ -200,21 +200,21 @@ Init(Item item,
CLEAR(arc->flags, FILLED_BIT);
CLEAR(arc->flags, CLOSED_BIT);
CLEAR(arc->flags, PIE_SLICE_BIT);
- arc->line_pattern = RadarUnspecifiedPattern;
- arc->fill_pattern = RadarUnspecifiedPattern;
+ arc->line_pattern = ZnUnspecifiedPattern;
+ arc->fill_pattern = ZnUnspecifiedPattern;
arc->line_style = LINE_SIMPLE;
arc->line_width = 1;
arc->first_end = arc->last_end = NULL;
arc->tile_name = "";
- arc->tile = RadarUnspecifiedImage;
+ arc->tile = ZnUnspecifiedImage;
arc->render_shape = NULL;
if (*argc < 1) {
Tcl_AppendResult(wi->interp, " arc coords expected", NULL);
- return RADAR_ERROR;
+ return ZN_ERROR;
}
result = Lang_SplitList(wi->interp, (*args)[0], &num_elems, &elems, &freeProc);
- if ((result == RADAR_ERROR) || (num_elems != 4)) {
+ if ((result == ZN_ERROR) || (num_elems != 4)) {
arc_error:
#ifdef PTK
if (elems != NULL && freeProc) {
@@ -222,22 +222,22 @@ Init(Item item,
}
#endif
Tcl_AppendResult(wi->interp, " malformed arc coords", NULL);
- return RADAR_ERROR;
+ return ZN_ERROR;
}
- if (Tcl_GetDouble(wi->interp, elems[0], &arc->coords[0].x) == RADAR_ERROR) {
+ if (Tcl_GetDouble(wi->interp, elems[0], &arc->coords[0].x) == ZN_ERROR) {
arc_error2:
#ifndef PTK
Tcl_Free((char *) elems);
#endif
goto arc_error;
};
- if (Tcl_GetDouble(wi->interp, elems[1], &arc->coords[0].y) == RADAR_ERROR) {
+ if (Tcl_GetDouble(wi->interp, elems[1], &arc->coords[0].y) == ZN_ERROR) {
goto arc_error2;
};
- if (Tcl_GetDouble(wi->interp, elems[2], &arc->coords[1].x) == RADAR_ERROR) {
+ if (Tcl_GetDouble(wi->interp, elems[2], &arc->coords[1].x) == ZN_ERROR) {
goto arc_error2;
};
- if (Tcl_GetDouble(wi->interp, elems[3], &arc->coords[1].y) == RADAR_ERROR) {
+ if (Tcl_GetDouble(wi->interp, elems[3], &arc->coords[1].y) == ZN_ERROR) {
goto arc_error2;
};
(*args)++;
@@ -250,10 +250,10 @@ Init(Item item,
}
#endif
- arc->fill_color = RadarGetColorByValue(wi->win, wi->fore_color);
- arc->line_color = RadarGetColorByValue(wi->win, wi->fore_color);
+ arc->fill_color = ZnGetColorByValue(wi->win, wi->fore_color);
+ arc->line_color = ZnGetColorByValue(wi->win, wi->fore_color);
- return RADAR_OK;
+ return ZN_OK;
}
@@ -272,7 +272,7 @@ Clone(Item item)
char *text;
if (strlen(arc->tile_name) != 0) {
- text = RadarMalloc((strlen(arc->tile_name) + 1) * sizeof(char));
+ text = ZnMalloc((strlen(arc->tile_name) + 1) * sizeof(char));
strcpy(text, arc->tile_name);
arc->tile_name = text;
arc->tile = Tk_GetImage(wi->interp, wi->win, arc->tile_name,
@@ -284,18 +284,18 @@ Clone(Item item)
if (arc->last_end) {
LineEndDuplicate(arc->last_end);
}
- if (arc->line_pattern != RadarUnspecifiedPattern) {
+ if (arc->line_pattern != ZnUnspecifiedPattern) {
arc->line_pattern = Tk_GetBitmap(wi->interp, wi->win,
Tk_NameOfBitmap(wi->dpy, arc->line_pattern));
}
- if (arc->fill_pattern != RadarUnspecifiedPattern) {
+ if (arc->fill_pattern != ZnUnspecifiedPattern) {
arc->fill_pattern = Tk_GetBitmap(wi->interp, wi->win,
Tk_NameOfBitmap(wi->dpy, arc->fill_pattern));
}
- arc->line_color = RadarGetColorByValue(wi->win, arc->line_color);
- arc->fill_color = RadarGetColorByValue(wi->win, arc->fill_color);
+ arc->line_color = ZnGetColorByValue(wi->win, arc->line_color);
+ arc->fill_color = ZnGetColorByValue(wi->win, arc->fill_color);
if (arc->render_shape) {
- arc->render_shape = RadarListDuplicate(arc->render_shape);
+ arc->render_shape = ZnListDuplicate(arc->render_shape);
}
}
@@ -314,10 +314,10 @@ Destroy(Item item)
ArcItem arc = (ArcItem) item;
if (arc->render_shape) {
- RadarListFree(arc->render_shape);
+ ZnListFree(arc->render_shape);
}
if (strlen(arc->tile_name) != 0) {
- RadarFree(arc->tile_name);
+ ZnFree(arc->tile_name);
}
if (arc->first_end) {
LineEndDelete(arc->first_end);
@@ -325,18 +325,18 @@ Destroy(Item item)
if (arc->last_end) {
LineEndDelete(arc->last_end);
}
- if (arc->tile != RadarUnspecifiedImage) {
+ if (arc->tile != ZnUnspecifiedImage) {
Tk_FreeImage(arc->tile);
- arc->tile = RadarUnspecifiedImage;
+ arc->tile = ZnUnspecifiedImage;
}
- if (arc->line_pattern != RadarUnspecifiedPattern) {
+ if (arc->line_pattern != ZnUnspecifiedPattern) {
Tk_FreeBitmap(wi->dpy, arc->line_pattern);
}
- if (arc->fill_pattern != RadarUnspecifiedPattern) {
+ if (arc->fill_pattern != ZnUnspecifiedPattern) {
Tk_FreeBitmap(wi->dpy, arc->fill_pattern);
}
- RadarFreeColor(arc->fill_color);
- RadarFreeColor(arc->line_color);
+ ZnFreeColor(arc->fill_color);
+ ZnFreeColor(arc->line_color);
}
@@ -373,17 +373,17 @@ SetRenderFlags(ArcItem arc)
static int
Configure(Item item,
int argc,
- RadarAttrList argv,
+ ZnAttrList argv,
int *flags)
{
WidgetInfo *wi = item->wi;
ArcItem arc = (ArcItem) item;
- if (ITEM_P.ConfigureAttributes((char *) item, -1, argc, argv, flags) == RADAR_ERROR) {
- return RADAR_ERROR;
+ if (ITEM_P.ConfigureAttributes((char *) item, -1, argc, argv, flags) == ZN_ERROR) {
+ return ZN_ERROR;
}
- if (ISSET(*flags, RADAR_TILE_FLAG)) {
+ if (ISSET(*flags, ZN_TILE_FLAG)) {
Tk_Image tile;
if (strcmp(arc->tile_name, "") != 0) {
@@ -394,13 +394,13 @@ Configure(Item item,
* The name will not be in sync with the image in
* this case.
*/
- return RADAR_ERROR;
+ return ZN_ERROR;
}
}
else {
- tile = RadarUnspecifiedImage;
+ tile = ZnUnspecifiedImage;
}
- if (arc->tile != RadarUnspecifiedImage) {
+ if (arc->tile != ZnUnspecifiedImage) {
Tk_FreeImage(arc->tile);
}
arc->tile = tile;
@@ -408,7 +408,7 @@ Configure(Item item,
SetRenderFlags(arc);
- return RADAR_OK;
+ return ZN_OK;
}
@@ -422,13 +422,13 @@ Configure(Item item,
static int
Query(Item item,
int argc,
- RadarAttrList argv)
+ ZnAttrList argv)
{
- if (ITEM_P.QueryAttribute((char *) item, -1, argv[0]) == RADAR_ERROR) {
- return RADAR_ERROR;
+ if (ITEM_P.QueryAttribute((char *) item, -1, argv[0]) == ZN_ERROR) {
+ return ZN_ERROR;
}
- return RADAR_OK;
+ return ZN_OK;
}
@@ -439,13 +439,13 @@ Query(Item item,
* the arc (ie: it is suitable for drawing arrows).
*/
void
-Tangent(ArcItem arc,
- RadarBool first,
- RadarPoint *p)
+Tangent(ArcItem arc,
+ ZnBool first,
+ ZnPoint *p)
{
double a2, b2, w_2, h_2;
double angle;
- RadarPoint p1, center;
+ ZnPoint p1, center;
if (first) {
angle = DegreesToRadian(arc->start_angle);
@@ -501,16 +501,16 @@ Tangent(ArcItem arc,
*/
static void
ComputeCoordinates(Item item,
- RadarBool force)
+ ZnBool force)
{
WidgetInfo *wi = item->wi;
ArcItem arc = (ArcItem) item;
- RadarReal angle, sin1, cos1, sin2, cos2;
- RadarReal tmp, w_2, h_2, center_x, center_y;
+ ZnReal angle, sin1, cos1, sin2, cos2;
+ ZnReal tmp, w_2, h_2, center_x, center_y;
int num_p, i;
- RadarPoint *p_list, p;
- RadarPoint end_points[LINE_END_POINTS];
- RadarReal width_2, height_2, ox, oy;
+ ZnPoint *p_list, p;
+ ZnPoint end_points[LINE_END_POINTS];
+ ZnReal width_2, height_2, ox, oy;
ResetBBox(&item->item_bounding_box);
/*
@@ -525,17 +525,17 @@ ComputeCoordinates(Item item,
* This could eventually be the only code but it has to
* good results and be fast enough.
*/
- RadarTransfoDecompose(wi->current_transfo, NULL, NULL, &angle, NULL);
+ ZnTransfoDecompose(wi->current_transfo, NULL, NULL, &angle, NULL);
if (angle >= PRECISION_LIMIT) {
if (!arc->render_shape) {
- arc->render_shape = RadarListNew(4, sizeof(RadarPoint));
+ arc->render_shape = ZnListNew(4, sizeof(ZnPoint));
}
GetArcPath(DegreesToRadian(arc->start_angle),
DegreesToRadian(arc->start_angle+arc->angle_extent),
(ISCLEAR(arc->flags, CLOSED_BIT) ? 0 :
ISCLEAR(arc->flags, PIE_SLICE_BIT) ? 1 : 2), arc->render_shape);
- p_list = (RadarPoint *) RadarListArray(arc->render_shape);
- num_p = RadarListSize(arc->render_shape);
+ p_list = (ZnPoint *) ZnListArray(arc->render_shape);
+ num_p = ZnListSize(arc->render_shape);
width_2 = (arc->coords[1].x - arc->coords[0].x)/2.0;
height_2 = (arc->coords[1].y - arc->coords[0].y)/2.0;
ox = (arc->coords[1].x + arc->coords[0].x)/2.0;
@@ -543,7 +543,7 @@ ComputeCoordinates(Item item,
for (i = 0; i < num_p; i++, p_list++) {
p.x = ox + p_list->x*width_2;
p.y = oy + p_list->y*height_2;
- RadarTransformPoint(wi->current_transfo, &p, p_list);
+ ZnTransformPoint(wi->current_transfo, &p, p_list);
AddPointToBBox(&item->item_bounding_box, p_list->x, p_list->y);
}
@@ -556,7 +556,7 @@ ComputeCoordinates(Item item,
/*
* Add the arrows if any.
*/
- p_list = (RadarPoint *) RadarListArray(arc->render_shape);
+ p_list = (ZnPoint *) ZnListArray(arc->render_shape);
if (ISSET(arc->flags, FIRST_END_OK)) {
GetLineEnd(p_list, p_list+1, arc->line_width, CapRound,
arc->first_end, end_points);
@@ -576,11 +576,11 @@ ComputeCoordinates(Item item,
******* ******** **********
*/
if (arc->render_shape) {
- RadarListFree(arc->render_shape);
+ ZnListFree(arc->render_shape);
arc->render_shape = NULL;
}
- RadarTransformPoint(wi->current_transfo, &arc->coords[0], &arc->orig);
- RadarTransformPoint(wi->current_transfo, &arc->coords[1], &arc->corner);
+ ZnTransformPoint(wi->current_transfo, &arc->coords[0], &arc->orig);
+ ZnTransformPoint(wi->current_transfo, &arc->coords[1], &arc->corner);
if (arc->orig.x > arc->corner.x) {
tmp = arc->orig.x;
@@ -704,28 +704,28 @@ ComputeCoordinates(Item item,
**********************************************************************************
*/
static int
-ToArea(Item item,
- RadarBBox *area,
- Tk_Uid tag_uid,
- int enclosed,
- RadarBool report)
+ToArea(Item item,
+ ZnBBox *area,
+ Tk_Uid tag_uid,
+ int enclosed,
+ ZnBool report)
{
ArcItem arc = (ArcItem) item;
WidgetInfo *wi = item->wi;
- RadarPoint *points;
- RadarPoint pts[20]; /* Should be at least LINE_END_POINTS large */
- RadarPoint center, tang;
- RadarBBox t_area;
+ ZnPoint *points;
+ ZnPoint pts[20]; /* Should be at least LINE_END_POINTS large */
+ ZnPoint center, tang;
+ ZnBBox t_area;
int num_points, result, result2;
- RadarReal lw = arc->line_width;
- RadarReal rx, ry, angle, tmp;
- RadarBool inside, new_inside;
+ ZnReal lw = arc->line_width;
+ ZnReal rx, ry, angle, tmp;
+ ZnBool inside, new_inside;
if (arc->render_shape &&
(ISSET(arc->flags, FILLED_BIT) || (arc->line_width))) {
GetBezierPath(arc->render_shape, wi->work_pts);
- points = (RadarPoint *) RadarListArray(wi->work_pts);
- num_points = RadarListSize(wi->work_pts);
+ points = (ZnPoint *) ZnListArray(wi->work_pts);
+ num_points = ZnListSize(wi->work_pts);
if (ISSET(arc->flags, FILLED_BIT)) {
result = PolygonInBBox(points, num_points, area);
@@ -973,7 +973,7 @@ ToArea(Item item,
* to see if it's inside the arc. If it is, we've got overlap. If
* it isn't, the arc's really outside the rectangle.
*/
- if (Pick(item, &area->orig, RADAR_NO_ITEM, 0, NULL, NULL) == 0.0) {
+ if (Pick(item, &area->orig, ZN_NO_ITEM, 0, NULL, NULL) == 0.0) {
return 0;
}
@@ -995,15 +995,15 @@ Draw(Item item)
ArcItem arc = (ArcItem) item;
XGCValues values;
int width, height;
- RadarPoint *p;
+ ZnPoint *p;
XPoint *xp;
int num_points, i;
if (arc->render_shape &&
(ISSET(arc->flags, FILLED_BIT) || (arc->line_width))) {
GetBezierPath(arc->render_shape, wi->work_pts);
- p = (RadarPoint *) RadarListArray(wi->work_pts);
- num_points = RadarListSize(wi->work_pts);
+ p = (ZnPoint *) ZnListArray(wi->work_pts);
+ num_points = ZnListSize(wi->work_pts);
xp = (XPoint *) alloca(num_points*sizeof(XPoint));
for (i = 0; i < num_points; i++, p++) {
xp[i].x = (short) p->x;
@@ -1017,9 +1017,9 @@ Draw(Item item)
/* Fill if requested */
if (ISSET(arc->flags, FILLED_BIT)) {
- values.foreground = RadarPixel(arc->fill_color);
+ values.foreground = ZnPixel(arc->fill_color);
values.arc_mode = ISSET(arc->flags, PIE_SLICE_BIT) ? ArcPieSlice : ArcChord;
- if (arc->tile != RadarUnspecifiedImage) { /* Fill Tiled */
+ if (arc->tile != ZnUnspecifiedImage) { /* Fill Tiled */
Pixmap pmap = GetImagePixmap(wi->win, arc->tile);
values.fill_style = FillTiled;
values.tile = pmap;
@@ -1029,7 +1029,7 @@ Draw(Item item)
GCTileStipXOrigin|GCTileStipYOrigin|GCFillStyle|GCTile|GCArcMode,
&values);
}
- else if (arc->fill_pattern != RadarUnspecifiedPattern) { /* Fill stippled */
+ else if (arc->fill_pattern != ZnUnspecifiedPattern) { /* Fill stippled */
values.fill_style = FillStippled;
values.stipple = arc->fill_pattern;
values.ts_x_origin = (int) item->item_bounding_box.orig.x;
@@ -1057,16 +1057,16 @@ Draw(Item item)
* Draw the arc.
*/
if (arc->line_width) {
- RadarPoint end_points[LINE_END_POINTS];
+ ZnPoint end_points[LINE_END_POINTS];
XPoint xap[LINE_END_POINTS];
- RadarPoint tang;
+ ZnPoint tang;
SetLineStyle(wi->dpy, wi->gc, arc->line_style);
- values.foreground = RadarPixel(arc->line_color);
+ values.foreground = ZnPixel(arc->line_color);
values.line_width = (arc->line_width == 1) ? 0 : arc->line_width;
values.cap_style = CapRound;
values.join_style = JoinRound;
- if (arc->line_pattern == RadarUnspecifiedPattern) {
+ if (arc->line_pattern == ZnUnspecifiedPattern) {
values.fill_style = FillSolid;
XChangeGC(wi->dpy, wi->gc,
GCFillStyle|GCLineWidth|GCCapStyle|GCJoinStyle|GCForeground, &values);
@@ -1087,7 +1087,7 @@ Draw(Item item)
xp[0].x, xp[0].y);
}
if (ISSET(arc->flags, FIRST_END_OK)) {
- p = (RadarPoint *) RadarListArray(arc->render_shape);
+ p = (ZnPoint *) ZnListArray(arc->render_shape);
GetLineEnd(p, p+1, arc->line_width, CapRound,
arc->first_end, end_points);
for (i = 0; i < LINE_END_POINTS; i++) {
@@ -1098,8 +1098,8 @@ Draw(Item item)
Nonconvex, CoordModeOrigin);
}
if (ISSET(arc->flags, LAST_END_OK)) {
- p = (RadarPoint *) RadarListArray(arc->render_shape);
- num_points = RadarListSize(arc->render_shape);
+ p = (ZnPoint *) ZnListArray(arc->render_shape);
+ num_points = ZnListSize(arc->render_shape);
GetLineEnd(&p[num_points-1], &p[num_points-2], arc->line_width,
CapRound, arc->last_end, end_points);
for (i = 0; i < LINE_END_POINTS; i++) {
@@ -1168,12 +1168,12 @@ Draw(Item item)
*
**********************************************************************************
*/
-static RadarBool
+static ZnBool
IsSensitive(Item item,
int item_part)
{
return (ISSET(item->flags, SENSITIVE_BIT) &&
- item->parent->class->IsSensitive(item->parent, RADAR_NO_PART));
+ item->parent->class->IsSensitive(item->parent, ZN_NO_PART));
}
@@ -1186,7 +1186,7 @@ IsSensitive(Item item,
*/
static double
Pick(Item item,
- RadarPoint *p,
+ ZnPoint *p,
Item start_item,
int aperture,
Item *a_item,
@@ -1195,20 +1195,20 @@ Pick(Item item,
WidgetInfo *wi = item->wi;
ArcItem arc = (ArcItem) item;
double dist = 1e40, new_dist;
- RadarBool point_in_angle, filled, closed;
- RadarBool in_triangle, acute_angle;
- RadarPoint p1, center, tang;
- RadarPoint *points;
- RadarPoint end_points[LINE_END_POINTS];
+ ZnBool point_in_angle, filled, closed;
+ ZnBool in_triangle, acute_angle;
+ ZnPoint p1, center, tang;
+ ZnPoint *points;
+ ZnPoint end_points[LINE_END_POINTS];
int num_points;
int width, height;
- RadarDim lw = arc->line_width;
+ ZnDim lw = arc->line_width;
if (arc->render_shape &&
(ISSET(arc->flags, FILLED_BIT) || (arc->line_width))) {
GetBezierPath(arc->render_shape, wi->work_pts);
- points = (RadarPoint *) RadarListArray(wi->work_pts);
- num_points = RadarListSize(wi->work_pts);
+ points = (ZnPoint *) ZnListArray(wi->work_pts);
+ num_points = ZnListSize(wi->work_pts);
if (ISSET(arc->flags, FILLED_BIT)) {
dist = PolygonToPointDist(points, num_points, p);
@@ -1468,10 +1468,10 @@ Pick(Item item,
*
**********************************************************************************
*/
-static RadarBool
-GetClipVertices(Item item,
- RadarPoint **points,
- int *num_points)
+static ZnBool
+GetClipVertices(Item item,
+ ZnPoint **points,
+ int *num_points)
{
return False;
}
@@ -1486,34 +1486,34 @@ GetClipVertices(Item item,
**********************************************************************************
*/
static int
-Coords(Item item,
- int index,
- int cmd,
- RadarPoint **pts,
- int *num_pts)
+Coords(Item item,
+ int index,
+ int cmd,
+ ZnPoint **pts,
+ int *num_pts)
{
ArcItem arc = (ArcItem) item;
if ((cmd == COORDS_ADD) || (cmd == COORDS_ADD_LAST) || (cmd == COORDS_REMOVE)) {
Tcl_AppendResult(item->wi->interp,
" arcs can't add or remove vertices", NULL);
- return RADAR_ERROR;
+ return ZN_ERROR;
}
else if (cmd == COORDS_REPLACE_ALL) {
if (*num_pts != 2) {
Tcl_AppendResult(item->wi->interp,
" coords command need 2 points on arcs", NULL);
- return RADAR_ERROR;
+ return ZN_ERROR;
}
arc->coords[0] = (*pts)[0];
arc->coords[1] = (*pts)[1];
- ITEM.Invalidate(item, RADAR_COORDS_FLAG);
+ ITEM.Invalidate(item, ZN_COORDS_FLAG);
}
else if (cmd == COORDS_REPLACE) {
if (*num_pts < 1) {
Tcl_AppendResult(item->wi->interp,
" coords command need at least 1 point", NULL);
- return RADAR_ERROR;
+ return ZN_ERROR;
}
if (index < 0) {
index += 2;
@@ -1522,10 +1522,10 @@ Coords(Item item,
range_err:
Tcl_AppendResult(item->wi->interp,
" incorrect coord index, should be between -2 and 1", NULL);
- return RADAR_ERROR;
+ return ZN_ERROR;
}
arc->coords[index] = (*pts)[0];
- ITEM.Invalidate(item, RADAR_COORDS_FLAG);
+ ITEM.Invalidate(item, ZN_COORDS_FLAG);
}
else if (cmd == COORDS_READ_ALL) {
*num_pts = 2;
@@ -1542,7 +1542,7 @@ Coords(Item item,
*pts = &arc->coords[index];
}
- return RADAR_OK;
+ return ZN_OK;
}
@@ -1591,4 +1591,4 @@ static ItemClassStruct ARC_ITEM_CLASS = {
PostScript
};
-RadarItemClassId RadarArc = (RadarItemClassId) &ARC_ITEM_CLASS;
+ZnItemClassId ZnArc = (ZnItemClassId) &ARC_ITEM_CLASS;