aboutsummaryrefslogtreecommitdiff
path: root/generic/Reticle.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/Reticle.c')
-rw-r--r--generic/Reticle.c184
1 files changed, 92 insertions, 92 deletions
diff --git a/generic/Reticle.c b/generic/Reticle.c
index d59088c..a182243 100644
--- a/generic/Reticle.c
+++ b/generic/Reticle.c
@@ -53,9 +53,9 @@ typedef struct _ReticleItemStruct {
ItemStruct header;
/* Public data */
- RadarPoint pos; /* Origin world coordinates */
- RadarColor line_color; /* circle color */
- RadarColor bright_line_color; /* intermediate circle color */
+ ZnPoint pos; /* Origin world coordinates */
+ ZnColor line_color; /* circle color */
+ ZnColor bright_line_color; /* intermediate circle color */
int first_radius; /* first world radius */
int step_size; /* step world size */
int period; /* bright circle period */
@@ -64,54 +64,54 @@ typedef struct _ReticleItemStruct {
LineStyle bright_line_style;
/* Private data */
- RadarPoint dev; /* item device coordinate */
- RadarDim first_radius_dev; /* first device radius */
- RadarDim 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 RadarAttrConfig reticle_attrs[] = {
- { RADAR_CONFIG_COLOR, "-brightlinecolor", NULL,
- Tk_Offset(ReticleItemStruct, bright_line_color), 0, RADAR_DRAW_FLAG, False },
- { RADAR_CONFIG_LINE_STYLE, "-brightlinestyle", NULL,
- Tk_Offset(ReticleItemStruct, bright_line_style), 0, RADAR_DRAW_FLAG, False },
- { RADAR_CONFIG_BOOL, "-composerotation", NULL,
+static ZnAttrConfig reticle_attrs[] = {
+ { ZN_CONFIG_COLOR, "-brightlinecolor", NULL,
+ Tk_Offset(ReticleItemStruct, bright_line_color), 0, ZN_DRAW_FLAG, False },
+ { ZN_CONFIG_LINE_STYLE, "-brightlinestyle", NULL,
+ Tk_Offset(ReticleItemStruct, bright_line_style), 0, ZN_DRAW_FLAG, False },
+ { ZN_CONFIG_BOOL, "-composerotation", NULL,
Tk_Offset(ReticleItemStruct, 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(ReticleItemStruct, header.flags), COMPOSE_SCALE_BIT,
- RADAR_COORDS_FLAG, False },
- { RADAR_CONFIG_DIM, "-stepsize", NULL,
+ ZN_COORDS_FLAG, False },
+ { ZN_CONFIG_DIM, "-stepsize", NULL,
Tk_Offset(ReticleItemStruct, step_size), 0,
- RADAR_COORDS_FLAG, False },
- { RADAR_CONFIG_DIM, "-firstradius", NULL,
+ ZN_COORDS_FLAG, False },
+ { ZN_CONFIG_DIM, "-firstradius", NULL,
Tk_Offset(ReticleItemStruct, first_radius), 0,
- RADAR_COORDS_FLAG, False },
- { RADAR_CONFIG_COLOR, "-linecolor", NULL,
- Tk_Offset(ReticleItemStruct, line_color), 0, RADAR_DRAW_FLAG, False },
- { RADAR_CONFIG_LINE_STYLE, "-linestyle", NULL,
- Tk_Offset(ReticleItemStruct, line_style), 0, RADAR_DRAW_FLAG, False },
- { RADAR_CONFIG_UINT, "-numcircles", NULL,
+ ZN_COORDS_FLAG, False },
+ { ZN_CONFIG_COLOR, "-linecolor", NULL,
+ Tk_Offset(ReticleItemStruct, line_color), 0, ZN_DRAW_FLAG, False },
+ { ZN_CONFIG_LINE_STYLE, "-linestyle", NULL,
+ Tk_Offset(ReticleItemStruct, line_style), 0, ZN_DRAW_FLAG, False },
+ { ZN_CONFIG_UINT, "-numcircles", NULL,
Tk_Offset(ReticleItemStruct, num_circles), 0,
- RADAR_COORDS_FLAG, False },
- { RADAR_CONFIG_UINT, "-period", NULL,
- Tk_Offset(ReticleItemStruct, period), 0, RADAR_DRAW_FLAG, False },
- { RADAR_CONFIG_POINT, "-position", NULL,
+ ZN_COORDS_FLAG, False },
+ { ZN_CONFIG_UINT, "-period", NULL,
+ Tk_Offset(ReticleItemStruct, period), 0, ZN_DRAW_FLAG, False },
+ { ZN_CONFIG_POINT, "-position", NULL,
Tk_Offset(ReticleItemStruct, pos), 0,
- RADAR_COORDS_FLAG, False},
- { RADAR_CONFIG_PRI, "-priority", NULL,
+ ZN_COORDS_FLAG, False},
+ { ZN_CONFIG_PRI, "-priority", NULL,
Tk_Offset(ReticleItemStruct, 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(ReticleItemStruct, header.flags), SENSITIVE_BIT,
- RADAR_REPICK_FLAG, False },
- { RADAR_CONFIG_TAGS, "-tags", NULL,
+ ZN_REPICK_FLAG, False },
+ { ZN_CONFIG_TAGS, "-tags", NULL,
Tk_Offset(ReticleItemStruct, header.tags), 0, 0, False },
- { RADAR_CONFIG_BOOL, "-visible", NULL,
+ { ZN_CONFIG_BOOL, "-visible", NULL,
Tk_Offset(ReticleItemStruct, 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 }
};
@@ -136,12 +136,12 @@ Init(Item item,
SET(item->flags, COMPOSE_SCALE_BIT);
item->priority = DEFAULT_RETICLE_PRIORITY;
item->part_sensitive = 0;
- reticle->line_color = RadarGetColorByValue(wi->win, wi->fore_color);
- reticle->bright_line_color = RadarGetColorByValue(wi->win, wi->fore_color);
+ reticle->line_color = ZnGetColorByValue(wi->win, wi->fore_color);
+ reticle->bright_line_color = ZnGetColorByValue(wi->win, wi->fore_color);
reticle->first_radius = DEFAULT_RETICLE_STEP_SIZE;
reticle->step_size = DEFAULT_RETICLE_STEP_SIZE;
reticle->period = DEFAULT_RETICLE_PERIOD;
- reticle->num_circles = RADAR_ANY_CIRCLES;
+ reticle->num_circles = ZN_ANY_CIRCLES;
reticle->line_style = LINE_SIMPLE;
reticle->bright_line_style = LINE_SIMPLE;
reticle->pos.x = 0;
@@ -151,7 +151,7 @@ Init(Item item,
reticle->first_radius_dev = 0;
reticle->step_size_dev = 0;
- return RADAR_OK;
+ return ZN_OK;
}
@@ -168,8 +168,8 @@ Clone(Item item)
WidgetInfo *wi = item->wi;
ReticleItem reticle = (ReticleItem) item;
- reticle->line_color = RadarGetColorByValue(wi->win, reticle->line_color);
- reticle->bright_line_color = RadarGetColorByValue(wi->win,
+ reticle->line_color = ZnGetColorByValue(wi->win, reticle->line_color);
+ reticle->bright_line_color = ZnGetColorByValue(wi->win,
reticle->bright_line_color);
}
@@ -186,8 +186,8 @@ Destroy(Item item)
{
ReticleItem reticle = (ReticleItem) item;
- RadarFreeColor(reticle->line_color);
- RadarFreeColor(reticle->bright_line_color);
+ ZnFreeColor(reticle->line_color);
+ ZnFreeColor(reticle->bright_line_color);
}
@@ -201,14 +201,14 @@ Destroy(Item item)
static int
Configure(Item item,
int argc,
- RadarAttrList argv,
+ ZnAttrList argv,
int *flags)
{
- 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;
}
- return RADAR_OK;
+ return ZN_OK;
}
@@ -222,13 +222,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;
}
@@ -241,25 +241,25 @@ Query(Item item,
*/
static void
ComputeCoordinates(Item item,
- RadarBool force)
+ ZnBool force)
{
WidgetInfo *wi = item->wi;
ReticleItem reticle = (ReticleItem) item;
- RadarDim half_width;
- RadarPoint p, xp;
+ ZnDim half_width;
+ ZnPoint p, xp;
/* Compute center device coordinates */
- RadarTransformPoint(wi->current_transfo, &reticle->pos, &reticle->dev);
+ ZnTransformPoint(wi->current_transfo, &reticle->pos, &reticle->dev);
p.x = reticle->pos.x + reticle->step_size;
p.y = 0;
- RadarTransformPoint(wi->current_transfo, &p, &xp);
+ ZnTransformPoint(wi->current_transfo, &p, &xp);
reticle->step_size_dev = xp.x - reticle->dev.x;
p.x = reticle->pos.x + reticle->first_radius;
- RadarTransformPoint(wi->current_transfo, &p, &xp);
+ ZnTransformPoint(wi->current_transfo, &p, &xp);
reticle->first_radius_dev = xp.x - reticle->dev.x;
- /* Reticle bounding box is radar bounding box or depends on num_circles */
- if (reticle->num_circles == RADAR_ANY_CIRCLES) {
+ /* Reticle bounding box is zn bounding box or depends on num_circles */
+ if (reticle->num_circles == ZN_ANY_CIRCLES) {
item->item_bounding_box.orig.x = 0;
item->item_bounding_box.orig.y = 0;
item->item_bounding_box.corner.x = wi->width;
@@ -286,11 +286,11 @@ 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)
{
return -1;
}
@@ -308,21 +308,21 @@ Draw(Item item)
{
WidgetInfo *wi = item->wi;
ReticleItem reticle = (ReticleItem) item;
- RadarDim radius = reticle->first_radius_dev;
- RadarDim radius_max_dev;
+ ZnDim radius = reticle->first_radius_dev;
+ ZnDim radius_max_dev;
XGCValues values;
unsigned int i;
- RadarDim l1, l2, l3, l4;
+ ZnDim l1, l2, l3, l4;
/* int count = 0;*/
/* Compute radius max */
- l1 = (RadarDim) hypot(wi->damaged_area.orig.x - reticle->dev.x,
+ l1 = (ZnDim) hypot(wi->damaged_area.orig.x - reticle->dev.x,
wi->damaged_area.orig.y - reticle->dev.y);
- l2 = (RadarDim) hypot(wi->damaged_area.corner.x - reticle->dev.x,
+ l2 = (ZnDim) hypot(wi->damaged_area.corner.x - reticle->dev.x,
wi->damaged_area.orig.y - reticle->dev.y);
- l3 = (RadarDim) hypot(wi->damaged_area.orig.x - reticle->dev.x,
+ l3 = (ZnDim) hypot(wi->damaged_area.orig.x - reticle->dev.x,
wi->damaged_area.corner.y - reticle->dev.y);
- l4 = (RadarDim) hypot(wi->damaged_area.corner.x - reticle->dev.x,
+ l4 = (ZnDim) hypot(wi->damaged_area.corner.x - reticle->dev.x,
wi->damaged_area.corner.y - reticle->dev.y);
radius_max_dev = MAX(MAX(l1,l2), MAX(l3, l4));
@@ -333,7 +333,7 @@ Draw(Item item)
while (radius <= radius_max_dev) {
SetLineStyle(wi->dpy, wi->gc, reticle->line_style);
- values.foreground = RadarPixel(reticle->line_color);
+ values.foreground = ZnPixel(reticle->line_color);
values.line_width = 0;
values.fill_style = FillSolid;
XChangeGC(wi->dpy, wi->gc, GCForeground | GCLineWidth | GCFillStyle, &values);
@@ -343,8 +343,8 @@ Draw(Item item)
(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,
- reticle->dev.x - (RadarPos) radius, reticle->dev.y - (RadarPos) radius,
- (RadarPos) radius * 2 - 1, (RadarPos) radius * 2 - 1,
+ reticle->dev.x - (ZnPos) radius, reticle->dev.y - (ZnPos) radius,
+ (ZnPos) radius * 2 - 1, (ZnPos) radius * 2 - 1,
0, 360 * 64);
/* count++;*/
}
@@ -356,13 +356,13 @@ Draw(Item item)
(reticle->dev.y >= wi->damaged_area.orig.y - radius) &&
(reticle->dev.y <= wi->damaged_area.corner.y + radius)) {
SetLineStyle(wi->dpy, wi->gc, reticle->bright_line_style);
- values.foreground = RadarPixel(reticle->bright_line_color);
+ values.foreground = ZnPixel(reticle->bright_line_color);
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,
- reticle->dev.x - (RadarPos) radius, reticle->dev.y - (RadarPos) radius,
- (RadarPos) radius * 2 - 1, (RadarPos) radius * 2 - 1, 0, 360 * 64);
+ reticle->dev.x - (ZnPos) radius, reticle->dev.y - (ZnPos) radius,
+ (ZnPos) radius * 2 - 1, (ZnPos) radius * 2 - 1, 0, 360 * 64);
/*count++;*/
}
radius += (reticle->step_size_dev);
@@ -378,12 +378,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));
}
@@ -397,7 +397,7 @@ IsSensitive(Item item,
*/
static double
Pick(Item item,
- RadarPoint *p,
+ ZnPoint *p,
Item start_item,
int aperture,
Item *a_item,
@@ -416,33 +416,33 @@ Pick(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)
{
ReticleItem reticle = (ReticleItem) item;
if ((cmd == COORDS_ADD) || (cmd == COORDS_ADD_LAST) || (cmd == COORDS_REMOVE)) {
Tcl_AppendResult(item->wi->interp,
" reticles can't add or remove vertices", NULL);
- return RADAR_ERROR;
+ return ZN_ERROR;
}
else if ((cmd == COORDS_REPLACE) || (cmd == COORDS_REPLACE_ALL)) {
if (*num_pts == 0) {
Tcl_AppendResult(item->wi->interp,
" coords command need 1 point on reticles", NULL);
- return RADAR_ERROR;
+ return ZN_ERROR;
}
reticle->pos = (*pts)[0];
- ITEM.Invalidate(item, RADAR_COORDS_FLAG);
+ ITEM.Invalidate(item, ZN_COORDS_FLAG);
}
else if ((cmd == COORDS_READ) || (cmd == COORDS_READ_ALL)) {
*num_pts = 1;
*pts = &reticle->pos;
}
- return RADAR_OK;
+ return ZN_OK;
}
@@ -491,4 +491,4 @@ static ItemClassStruct RETICLE_ITEM_CLASS = {
PostScript
};
-RadarItemClassId RadarReticle = (RadarItemClassId) &RETICLE_ITEM_CLASS;
+ZnItemClassId ZnReticle = (ZnItemClassId) &RETICLE_ITEM_CLASS;