From 64089dca388f5a9a8235a94b4372763875132219 Mon Sep 17 00:00:00 2001 From: lecoanet Date: Wed, 2 Feb 2000 14:01:15 +0000 Subject: Passage en Zinc --- Mosaic.c | 154 +++--- Perl/Zinc.xs | 6 +- Perl/t/zinc.t | 176 +++--- Python/Zinc.py | 116 ++-- configure | 234 ++++---- debian/README.debian | 2 +- debian/changelog | 6 + debian/control | 33 +- debian/copyright | 19 +- debian/dirs | 4 +- debian/rules | 14 +- debian/zinc-perl.files | 4 +- debian/zinc-python.postinst | 2 +- debian/zinc-python.prerm | 2 +- generic/Arc.c | 332 +++++------ generic/Attrs.c | 46 +- generic/Attrs.h | 12 +- generic/Color.c | 182 +++---- generic/Color.h | 34 +- generic/Curve.c | 486 ++++++++--------- generic/Draw.c | 100 ++-- generic/Draw.h | 24 +- generic/Geo.c | 432 +++++++-------- generic/Geo.h | 264 ++++----- generic/Group.c | 309 ++++++----- generic/Icon.c | 214 ++++---- generic/Image.c | 28 +- generic/Image.h | 10 +- generic/Item.c | 1272 +++++++++++++++++++++---------------------- generic/Item.h | 111 ++-- generic/List.c | 238 ++++---- generic/List.h | 70 +-- generic/Map.c | 494 ++++++++--------- generic/MapInfo.c | 230 ++++---- generic/MapInfo.h | 58 +- generic/OverlapMan.c | 46 +- generic/OverlapMan.h | 4 +- generic/PostScript.c | 30 +- generic/PostScript.h | 8 +- generic/Rectangle.c | 244 ++++----- generic/Reticle.c | 184 +++---- generic/Tabular.c | 150 ++--- generic/Text.c | 272 ++++----- generic/Track.c | 732 ++++++++++++------------- generic/Track.h | 2 +- generic/Transfo.c | 196 +++---- generic/Transfo.h | 116 ++-- generic/WidgetInfo.h | 58 +- generic/perfos.c | 16 +- generic/tkZinc.c | 1106 ++++++++++++++++++------------------- generic/tkZinc.h | 30 +- generic/version.c | 4 +- patchlvl.h | 12 +- sandbox/testarc.tcl | 4 +- sandbox/testicon.tcl | 4 +- sandbox/testpoly.tcl | 4 +- sandbox/testtext.tcl | 4 +- sandbox/testzinc.pl | 180 +++--- sandbox/zinc.tcl | 38 +- tkAppInit.c | 2 +- 60 files changed, 4612 insertions(+), 4552 deletions(-) diff --git a/Mosaic.c b/Mosaic.c index 22331ee..9557135 100644 --- a/Mosaic.c +++ b/Mosaic.c @@ -38,11 +38,7 @@ #include "Item.h" #include "Geo.h" -#ifdef XTOOLKIT -#include "Radar.h" -#else /* PLC : ą completer */ -#endif /* @@ -56,7 +52,7 @@ static const char rcsid[] = "$Imagine: Mosaic.c,v 1.7 1997/08/11 12:29:18 lecoanet Exp $"; static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ " $"; -static const char invalid_attribute[] = "RadarMosaic : Invalid attribute."; +static const char invalid_attribute[] = "ZnMosaic : Invalid attribute."; static const char read_only_attribute[] = "This attribute is read only."; @@ -77,7 +73,7 @@ typedef struct _MosaicItemStruct { int tile_size; int row_count; /* Number of tiles per row */ int column_count; /* Number of tiles per column */ - RadarColor *tile_palette; /* Color palette for tiles */ + ZnColor *tile_palette; /* Color palette for tiles */ int *color_usage; /* Numbers of merged rectangles */ /* using the corresponding color */ /* in the palette. */ @@ -136,10 +132,10 @@ Clone(Item item) item->user_data = NULL; if (mosaic->tile_palette) { - RadarColor *tile_palette; + ZnColor *tile_palette; - tile_palette = (RadarColor *) RadarMalloc(mosaic->palette_size*sizeof(RadarColor)); - memcpy(tile_palette, mosaic->tile_palette, mosaic->palette_size*sizeof(RadarColor)); + tile_palette = (ZnColor *) ZnMalloc(mosaic->palette_size*sizeof(ZnColor)); + memcpy(tile_palette, mosaic->tile_palette, mosaic->palette_size*sizeof(ZnColor)); mosaic->tile_palette = tile_palette; } @@ -149,7 +145,7 @@ Clone(Item item) if (mosaic->color_usage) { int *color_usage; - color_usage = (int *) RadarMalloc(mosaic->palette_size*sizeof(int)); + color_usage = (int *) ZnMalloc(mosaic->palette_size*sizeof(int)); memcpy(color_usage, mosaic->color_usage, mosaic->palette_size*sizeof(int)); mosaic->color_usage = color_usage; } @@ -158,7 +154,7 @@ Clone(Item item) int size = mosaic->row_count*mosaic->column_count*sizeof(unsigned char); unsigned char *tile_colors; - tile_colors = (unsigned char *) RadarMalloc(size); + tile_colors = (unsigned char *) ZnMalloc(size); memcpy(tile_colors, mosaic->tile_colors, size); mosaic->tile_colors = tile_colors; } @@ -179,15 +175,15 @@ Remove(Item item) MosaicItem mosaic = (MosaicItem) item; if (mosaic->tile_palette) { - RadarFree(mosaic->tile_palette); + ZnFree(mosaic->tile_palette); } if (mosaic->color_usage) { - RadarFree(mosaic->color_usage); + ZnFree(mosaic->color_usage); } if (mosaic->tile_colors) { - RadarFree(mosaic->tile_colors); + ZnFree(mosaic->tile_colors); } } @@ -202,54 +198,54 @@ Remove(Item item) static void Configure(Item item, - RadarList attrs, - RadarBool *draw_item, - RadarBool *draw_label, - RadarBool *compute_coord, - RadarBool init) + ZnList attrs, + ZnBool *draw_item, + ZnBool *draw_label, + ZnBool *compute_coord, + ZnBool init) { WidgetInfo *wi = item->wi; MosaicItem mosaic = (MosaicItem) item; - RadarAttr *attr; + ZnAttr *attr; unsigned int i, size, num_attrs; - RadarBool b_value; + ZnBool b_value; unsigned char *tile_colors = NULL; - RadarColor *tile_palette = NULL; - RadarBool resize_palette = False; - RadarBool resize_colors = False; + ZnColor *tile_palette = NULL; + ZnBool resize_palette = False; + ZnBool resize_colors = False; - num_attrs = RadarListSize(attrs); + num_attrs = ZnListSize(attrs); for (i = 0; i < num_attrs; i++) { - attr = (RadarAttr *) RadarListAt(attrs, i); + attr = (ZnAttr *) ZnListAt(attrs, i); switch (attr->name) { ITEM_COMMON_CONFIGURE; - case RadarItemX: + case ZnItemX: if (mosaic->x != attr->value) { mosaic->x = attr->value; *draw_item = *compute_coord = True; } break; - case RadarItemY: + case ZnItemY: if (mosaic->y != attr->value) { mosaic->y = attr->value; *draw_item = *compute_coord = True; } break; - case RadarItemTilePalette: - tile_palette = (RadarColor *) attr->value; + case ZnItemTilePalette: + tile_palette = (ZnColor *) attr->value; *draw_item = True; break; - case RadarItemTileColors: + case ZnItemTileColors: tile_colors = (unsigned char *) attr->value; *draw_item = True; break; - case RadarItemTileSize: + case ZnItemTileSize: if (attr->value >= 0 && mosaic->tile_size != attr->value) { mosaic->tile_size = attr->value; @@ -257,14 +253,14 @@ Configure(Item item, } break; - case RadarItemPaletteSize: + case ZnItemPaletteSize: if (attr->value >= 0) { mosaic->palette_size = attr->value; resize_palette = True; } break; - case RadarItemRowCount: + case ZnItemRowCount: if (attr->value >= 0 && mosaic->row_count != attr->value) { mosaic->row_count = attr->value; resize_colors = True; @@ -272,7 +268,7 @@ Configure(Item item, } break; - case RadarItemColumnCount: + case ZnItemColumnCount: if (attr->value >= 0 && mosaic->column_count != attr->value) { mosaic->column_count = attr->value; resize_colors = True; @@ -281,27 +277,27 @@ Configure(Item item, break; default: - RadarWarning(invalid_attribute); + ZnWarning(invalid_attribute); break; } } if (tile_palette) { if (mosaic->tile_palette) { - RadarFree(mosaic->tile_palette); + ZnFree(mosaic->tile_palette); } - mosaic->tile_palette = (RadarColor *) RadarMalloc(mosaic->palette_size*sizeof(RadarColor)); - memcpy(mosaic->tile_palette, tile_palette, mosaic->palette_size*sizeof(RadarColor)); + mosaic->tile_palette = (ZnColor *) ZnMalloc(mosaic->palette_size*sizeof(ZnColor)); + memcpy(mosaic->tile_palette, tile_palette, mosaic->palette_size*sizeof(ZnColor)); } else if (resize_palette) { - tile_palette = (RadarColor *) RadarMalloc(mosaic->palette_size*sizeof(RadarColor)); - memcpy(tile_palette, mosaic->tile_palette, mosaic->palette_size*sizeof(RadarColor)); - RadarFree(mosaic->tile_palette); + tile_palette = (ZnColor *) ZnMalloc(mosaic->palette_size*sizeof(ZnColor)); + memcpy(tile_palette, mosaic->tile_palette, mosaic->palette_size*sizeof(ZnColor)); + ZnFree(mosaic->tile_palette); mosaic->tile_palette = tile_palette; /* The palette size has changed, erase the cached info * and let the appropriate code fault on it to recreate. */ - RadarFree(mosaic->color_usage); + ZnFree(mosaic->color_usage); mosaic->color_usage = NULL; } @@ -309,29 +305,29 @@ Configure(Item item, /* Here we could optimize the damaged area. No opt should be taken if init or compute_coord.*/ if (mosaic->tile_colors) { - RadarFree(mosaic->tile_colors); + ZnFree(mosaic->tile_colors); } size = mosaic->row_count * mosaic->column_count; - mosaic->tile_colors = (unsigned char *) RadarMalloc(size*sizeof(unsigned char)); + mosaic->tile_colors = (unsigned char *) ZnMalloc(size*sizeof(unsigned char)); memcpy(mosaic->tile_colors, tile_colors, size*sizeof(unsigned char)); /* * The color counts might need update, let the code fault on an * empty cache. */ - RadarFree(mosaic->color_usage); + ZnFree(mosaic->color_usage); mosaic->color_usage = NULL; } else if (resize_colors) { size = mosaic->row_count * mosaic->column_count; - tile_colors = (unsigned char *) RadarMalloc(size*sizeof(unsigned char)); + tile_colors = (unsigned char *) ZnMalloc(size*sizeof(unsigned char)); memcpy(tile_colors, mosaic->tile_colors, size*sizeof(unsigned char)); - RadarFree(mosaic->tile_colors); + ZnFree(mosaic->tile_colors); mosaic->tile_colors = tile_colors; /* * The color counts might need update, let the code fault on an * empty cache. */ - RadarFree(mosaic->color_usage); + ZnFree(mosaic->color_usage); mosaic->color_usage = NULL; } } @@ -347,53 +343,53 @@ Configure(Item item, static void Query(Item item, - RadarList attrs) + ZnList attrs) { MosaicItem mosaic = (MosaicItem) item; unsigned int i, num_attrs; - RadarAttr *attr; + ZnAttr *attr; - num_attrs = RadarListSize(attrs); + num_attrs = ZnListSize(attrs); for (i = 0; i < num_attrs; i++) { - attr = (RadarAttr *) RadarListAt(attrs, i); + attr = (ZnAttr *) ZnListAt(attrs, i); switch (attr->name) { ITEM_COMMON_QUERY; - case RadarItemX: + case ZnItemX: *((int *) attr->value) = mosaic->x; break; - case RadarItemY: + case ZnItemY: *((int *) attr->value) = mosaic->y; break; - case RadarItemTilePalette: - *((RadarColor **) attr->value) = mosaic->tile_palette; + case ZnItemTilePalette: + *((ZnColor **) attr->value) = mosaic->tile_palette; break; - case RadarItemTileColors: + case ZnItemTileColors: *((unsigned char **) attr->value) = mosaic->tile_colors; break; - case RadarItemTileSize: + case ZnItemTileSize: *((int *) attr->value) = mosaic->tile_size; break; - case RadarItemPaletteSize: + case ZnItemPaletteSize: *((int *) attr->value) = mosaic->palette_size; break; - case RadarItemRowCount: + case ZnItemRowCount: *((int *) attr->value) = mosaic->row_count; break; - case RadarItemColumnCount: + case ZnItemColumnCount: *((int *) attr->value) = mosaic->column_count; break; default: - RadarWarning(invalid_attribute); + ZnWarning(invalid_attribute); break; } } @@ -413,7 +409,7 @@ ComputeCoordinates(Item item) { WidgetInfo *wi = item->wi; MosaicItem mosaic = (MosaicItem) item; - RadarPos x_dev, y_dev; + ZnPos x_dev, y_dev; ResetBBox(&item->item_bounding_box); @@ -424,8 +420,8 @@ ComputeCoordinates(Item item) /* Compute bounding box */ AddPointToBBox(&item->item_bounding_box, x_dev, y_dev); AddPointToBBox(&item->item_bounding_box, - x_dev + (RadarPos) LENGTH_TO_DEVICE(wi, mosaic->tile_size * mosaic->column_count), - y_dev + (RadarPos) LENGTH_TO_DEVICE(wi, mosaic->tile_size * mosaic->row_count)); + x_dev + (ZnPos) LENGTH_TO_DEVICE(wi, mosaic->tile_size * mosaic->column_count), + y_dev + (ZnPos) LENGTH_TO_DEVICE(wi, mosaic->tile_size * mosaic->row_count)); } @@ -460,12 +456,12 @@ Draw(Item item) { WidgetInfo *wi = item->wi; MosaicItem mosaic = (MosaicItem) item; - RadarPos delta_x_min, delta_x_max; - RadarPos delta_y_min, delta_y_max; - RadarPos x_dev = X_TO_DEVICE(wi, mosaic->x); - RadarPos y_dev = Y_TO_DEVICE(wi, mosaic->y); - RadarDim delta_x_dev, delta_y_dev; - RadarDim offset_x, offset_y; + ZnPos delta_x_min, delta_x_max; + ZnPos delta_y_min, delta_y_max; + ZnPos x_dev = X_TO_DEVICE(wi, mosaic->x); + ZnPos y_dev = Y_TO_DEVICE(wi, mosaic->y); + ZnDim delta_x_dev, delta_y_dev; + ZnDim offset_x, offset_y; unsigned int start_row, stop_row; unsigned int start_col, stop_col; XGCValues values; @@ -606,8 +602,8 @@ Draw(Item item) delta_x_dev = LENGTH_TO_DEVICE(wi, mosaic->tile_size * (j+1)) - offset_x; delta_y_dev = LENGTH_TO_DEVICE(wi, mosaic->tile_size * (i+1)) - offset_y; rect = &run_cache[current_color][run_cache_index[current_color]]; - rect->x = x_dev + (RadarPos) offset_x; - rect->y = y_dev + (RadarPos) offset_y; + rect->x = x_dev + (ZnPos) offset_x; + rect->y = y_dev + (ZnPos) offset_y; rect->width = delta_x_dev; rect->height = delta_y_dev; /* printf("Adding x:%d, y:%d, with:%d, height:%d\n", @@ -655,12 +651,12 @@ Draw(Item item) ********************************************************************************** */ -static RadarBool +static ZnBool Pick(Item item, XPoint *p, - RadarDim aperture, - RadarBool closest, - RadarList items) + ZnDim aperture, + ZnBool closest, + ZnList items) { return False; } @@ -705,4 +701,4 @@ static ItemClassStruct MOSAIC_ITEM_CLASS = { PostScript }; -RadarItemClassId RadarMosaic = (RadarItemClassId) &MOSAIC_ITEM_CLASS; +ZnItemClassId ZnMosaic = (ZnItemClassId) &MOSAIC_ITEM_CLASS; diff --git a/Perl/Zinc.xs b/Perl/Zinc.xs index 02df3c1..f062ef2 100644 --- a/Perl/Zinc.xs +++ b/Perl/Zinc.xs @@ -17,7 +17,7 @@ #include "tkGlue.m" extern int -RadarCmd( +ZincCmd( ClientData client_data, Tcl_Interp* interp, int argc, @@ -40,14 +40,14 @@ MapInfoCmd( DECLARE_VTABLES; -MODULE = Tk::Radar PACKAGE = Tk::Radar +MODULE = Tk::Zinc PACKAGE = Tk::Zinc PROTOTYPES: DISABLE BOOT: { IMPORT_VTABLES; - Lang_TkCommand("radar", RadarCmd); + Lang_TkCommand("zinc", ZincCmd); Lang_TkCommand("videomap", VideomapCmd); Lang_TkCommand("mapinfo", MapInfoCmd); } diff --git a/Perl/t/zinc.t b/Perl/t/zinc.t index cb95f9c..f345ec2 100644 --- a/Perl/t/zinc.t +++ b/Perl/t/zinc.t @@ -18,113 +18,113 @@ $logo = $mw->Photo(-file => "$image_path/logo.gif"); # MainLoop; # exit; ################################################### -# creation radar +# creation zinc ################################################### -#$mw->Radar()->pack; +#$mw->Zinc()->pack; #MainLoop; exit; $top = 1; -$radar = $mw->Radar(-backcolor => 'skyblue', -relief => 'sunken'); -$radar->pack(-expand => t, -fill => 'both'); +$zinc = $mw->Zinc(-backcolor => 'skyblue', -relief => 'sunken'); +$zinc->pack(-expand => t, -fill => 'both'); -$radar->configure(-width => 800, -height => 500); -$color = $radar->cget("-backcolor"); print "radar backcolor=$color\n"; +$zinc->configure(-width => 800, -height => 500); +$color = $zinc->cget("-backcolor"); print "zinc backcolor=$color\n"; ################################################### # creation track ################################################### -$track = $radar->add("track", $top, 10); -#$radar->itemconfigure($track, -tags => 'toto'); - -$radar->itemconfigure($track, -position => [1, 1]); -$radar->itemconfigure($track, -position => [10, 10]); -$radar->itemconfigure($track, -position => [20, 20]); -$radar->itemconfigure($track, -position => [30, 30]); -$radar->itemconfigure($track, -position => [40, 40]); -$radar->itemconfigure($track, -position => [50, 50]); -$radar->itemconfigure($track, -position => [60, 50]); -$radar->itemconfigure($track, -speedvector => [20, 0]); -$radar->itemconfigure($track, -symbolcolor => 'red', -labeldistance => 60); -$radar->itemconfigure($track, -markersize => 10, -filledmarker => 1, +$track = $zinc->add("track", $top, 10); +#$zinc->itemconfigure($track, -tags => 'toto'); + +$zinc->itemconfigure($track, -position => [1, 1]); +$zinc->itemconfigure($track, -position => [10, 10]); +$zinc->itemconfigure($track, -position => [20, 20]); +$zinc->itemconfigure($track, -position => [30, 30]); +$zinc->itemconfigure($track, -position => [40, 40]); +$zinc->itemconfigure($track, -position => [50, 50]); +$zinc->itemconfigure($track, -position => [60, 50]); +$zinc->itemconfigure($track, -speedvector => [20, 0]); +$zinc->itemconfigure($track, -symbolcolor => 'red', -labeldistance => 60); +$zinc->itemconfigure($track, -markersize => 10, -filledmarker => 1, -markercolor => "green"); -print "radar itemconfigure :\n\n"; -for $attr ($radar->itemconfigure($track)) { +print "zinc itemconfigure :\n\n"; +for $attr ($zinc->itemconfigure($track)) { print " ( ",join(',', @$attr)," )\n" ; } print "\n"; -$size = $radar->itemcget($track, -markersize); print "track markersize=$size\n"; -(@coords) = $radar->itemcget($track, "-position"); +$size = $zinc->itemcget($track, -markersize); print "track markersize=$size\n"; +(@coords) = $zinc->itemcget($track, "-position"); print "track position=",$coords[0],"+",$coords[1],"\n"; -$radar->itemconfigure($track, -labelformat => "x40x20+0+0 x40x20+40+0 x150x60+0+0"); +$zinc->itemconfigure($track, -labelformat => "x40x20+0+0 x40x20+40+0 x150x60+0+0"); -$radar->itemconfigure($track, 0, -filled => 1 , -backcolor => "red", +$zinc->itemconfigure($track, 0, -filled => 1 , -backcolor => "red", -border => "contour"); -$radar->itemconfigure($track, 0, -text => "TO"); -$radar->itemconfigure($track, 1, -filled => 1 , -backcolor => "green", +$zinc->itemconfigure($track, 0, -text => "TO"); +$zinc->itemconfigure($track, 1, -filled => 1 , -backcolor => "green", -border => "contour"); -$radar->itemconfigure($track, 1, -filled => 1 , -backcolor => "green", +$zinc->itemconfigure($track, 1, -filled => 1 , -backcolor => "green", -border => "contour"); -$radar->itemconfigure($track, 2, -image => $logo , -alignment => "center"); -$mk = $radar->itemcget($track, -markercolor); +$zinc->itemconfigure($track, 2, -image => $logo , -alignment => "center"); +$mk = $zinc->itemcget($track, -markercolor); -$radar->itemconfigure($track, 0, -reliefthickness => 2, -relief => "sunken", +$zinc->itemconfigure($track, 0, -reliefthickness => 2, -relief => "sunken", -bordercolor => "red", -border => "noborder"); -$radar->bind($track.":-3", "", - sub {$radar->itemconfigure($track, -speedvectorcolor => 'red')}); -$radar->bind($track.":-3", "", - sub {$radar->itemconfigure($track, -speedvectorcolor => 'black')}); +$zinc->bind($track.":-3", "", + sub {$zinc->itemconfigure($track, -speedvectorcolor => 'red')}); +$zinc->bind($track.":-3", "", + sub {$zinc->itemconfigure($track, -speedvectorcolor => 'black')}); ################################################### # creation way point ################################################### print "creating way point\n"; -my $wp = $radar->add("waypoint", $top, 10); -$radar->itemconfigure($wp, +my $wp = $zinc->add("waypoint", $top, 10); +$zinc->itemconfigure($wp, -symbolcolor => "green", -position => [0, 80], -labelformat => "x40x20+0+0x40x20+40+0x80x40+0+0" ); -$radar->itemconfigure($wp, 0 ,-filled => 1 ,-backcolor => "tan",-text => "TO"); -$radar->itemconfigure($wp, 1 ,-filled => 1 ,-backcolor => "wheat",-text => "TO"); -$radar->itemconfigure($wp, 2 ,-border => "contour"); -$radar->bind($wp, "", [ \&borders, "on"]); -$radar->bind($wp, "", [ \&borders, "off"]); +$zinc->itemconfigure($wp, 0 ,-filled => 1 ,-backcolor => "tan",-text => "TO"); +$zinc->itemconfigure($wp, 1 ,-filled => 1 ,-backcolor => "wheat",-text => "TO"); +$zinc->itemconfigure($wp, 2 ,-border => "contour"); +$zinc->bind($wp, "", [ \&borders, "on"]); +$zinc->bind($wp, "", [ \&borders, "off"]); ################################################### # creation 2nd track ################################################### print "creating second track\n"; -$track2 = $radar->add("track", $top, 10, -speedvector => [-20, 0], -position => [0, 50]); -$radar->itemconfigure($track2, -connecteditem => $track); +$track2 = $zinc->add("track", $top, 10, -speedvector => [-20, 0], -position => [0, 50]); +$zinc->itemconfigure($track2, -connecteditem => $track); ################################################### # creation macro ################################################### print "creating macro\n"; -$macro = $radar->add("tabular", $top, 10, +$macro = $zinc->add("tabular", $top, 10, -labelformat => "x40x20+0+0 x40x20+40+0" ); -$radar->itemconfigure($macro, 0 , -text => "une"); -$radar->itemconfigure($macro, 1, -text => "macro"); -$radar->itemconfigure($macro, -connecteditem => $track); -$radar->bind($macro.":0", "", [ \&borders, "on"]); -$radar->bind($macro.":0", "", [ \&borders, "off"]); +$zinc->itemconfigure($macro, 0 , -text => "une"); +$zinc->itemconfigure($macro, 1, -text => "macro"); +$zinc->itemconfigure($macro, -connecteditem => $track); +$zinc->bind($macro.":0", "", [ \&borders, "on"]); +$zinc->bind($macro.":0", "", [ \&borders, "off"]); ################################################### # creation ministrip ################################################### print "creating ministrip\n"; -$ministrip = $radar->add("tabular", $top, 10, +$ministrip = $zinc->add("tabular", $top, 10, -labelformat => "x40x20+0+0 x40x20+40+0", -position => [100, 10] ); -$radar->itemconfigure($ministrip, 0 , -text => 'ministrip'); +$zinc->itemconfigure($ministrip, 0 , -text => 'ministrip'); ################################################### # creation map @@ -136,41 +136,41 @@ $mw->videomap("load", "$map_path/hegias_parouest_TE.vid", 0, "paris-ouest"); print "videomap ids : ", join('|', $mw->videomap("ids", "$map_path/videomap_orly")),"\n"; -$map = $radar->add("map", $top, -color => red); -$radar->itemconfigure($map,-mapinfo => orly); +$map = $zinc->add("map", $top, -color => red); +$zinc->itemconfigure($map,-mapinfo => orly); -$map2 = $radar->add("map", $top, -color => green, -filled => 1, -priority => 0, +$map2 = $zinc->add("map", $top, -color => green, -filled => 1, -priority => 0, -fillpattern => AlphaStipple6); -#$radar->itemconfigure($map2, -mapinfo => paris-ouest); +#$zinc->itemconfigure($map2, -mapinfo => paris-ouest); -$map3 = $radar->add("map", $top, -color => orange); -$radar->itemconfigure($map3,-mapinfo => "paris-w"); +$map3 = $zinc->add("map", $top, -color => orange); +$zinc->itemconfigure($map3,-mapinfo => "paris-w"); ################################################### #creation rectangle, arc, curve ################################################### -$rect = $radar->add(rectangle, $top, [-50, -50, 50, -80], -linecolor => bisque); -$radar->bind($rect, '', sub { $radar->itemconfigure($rect, -linecolor => red)}); -$radar->bind($rect, '', sub { $radar->itemconfigure($rect, -linecolor => bisque)}); +$rect = $zinc->add(rectangle, $top, [-50, -50, 50, -80], -linecolor => bisque); +$zinc->bind($rect, '', sub { $zinc->itemconfigure($rect, -linecolor => red)}); +$zinc->bind($rect, '', sub { $zinc->itemconfigure($rect, -linecolor => bisque)}); -$arc = $radar->add(arc, $top, -100, 80, -50, 30, -linecolor => bisque, +$arc = $zinc->add(arc, $top, [-100, 80, -50, 30], -linecolor => bisque, -tags => ["arc"]); -#$radar->addtag("fleche",'withtag', $arc); -#$radar->addtag("carquois",'withtag', $arc); -$radar->add(rectangle, $top, [-101, 81, -49, 29], -linecolor => green); -$radar->raise($arc); -$radar->bind($arc, '', sub {$radar->itemconfigure($arc, -linecolor => red)}); -$radar->bind($arc, '', sub {$radar->itemconfigure($arc, -linecolor => bisque)}); -print "arc tags=", join('|',$radar->gettags($arc)),"\n"; - -$radar->itemconfigure($arc, -startangle => 0, -extent => 360); - -$mp = $radar->add(curve, $top, -300, 0, -250, 100, -80, 20); -$radar->itemconfigure($mp, -filled => 1, -linewidth => 4, -linecolor => yellow, +#$zinc->addtag("fleche",'withtag', $arc); +#$zinc->addtag("carquois",'withtag', $arc); +$zinc->add(rectangle, $top, [-101, 81, -49, 29], -linecolor => green); +$zinc->raise($arc); +$zinc->bind($arc, '', sub {$zinc->itemconfigure($arc, -linecolor => red)}); +$zinc->bind($arc, '', sub {$zinc->itemconfigure($arc, -linecolor => bisque)}); +print "arc tags=", join('|',$zinc->gettags($arc)),"\n"; + +$zinc->itemconfigure($arc, -startangle => 0, -extent => 360); + +$mp = $zinc->add(curve, $top, [-300, 0, -250, 100, -80, 20]); +$zinc->itemconfigure($mp, -filled => 1, -linewidth => 4, -linecolor => yellow, -fillcolor => tan, -fillpattern => AlphaStipple8); -$radar->itemconfigure($mp, -marker => AtcSymbol9 , -markercolor => red); +$zinc->itemconfigure($mp, -marker => AtcSymbol9 , -markercolor => red); ################################################### # Map info @@ -179,7 +179,7 @@ $mw->mapinfo('mpessai', 'create'); $mw->mapinfo('mpessai', add, text, normal, simple, 0, 200, "Et voilą"); $mw->mapinfo(mpessai, add, line, simple, 0, 0, 0, 0, 200); #$mw->mapinfo('mpessai', add, line, simple, 5, -100, 100, 0, 0); -$radar->itemconfigure($map3, -mapinfo => mpessai); +$zinc->itemconfigure($map3, -mapinfo => mpessai); print "mapinfo count line : ", $mw->mapinfo(mpessai, count, line),"\n"; print "mapinfo get line 3: ", join('|',$mw->mapinfo(mpessai, get, line, 0)),"\n"; @@ -187,39 +187,39 @@ print "mapinfo get line 3: ", join('|',$mw->mapinfo(mpessai, get, line, 0)),"\n" # tests diverses methodes ################################################### -for ($radar->find('all')) { - print $_, " -> ", $radar->type($_),"\n"; +for ($zinc->find('all')) { + print $_, " -> ", $zinc->type($_),"\n"; } -$radar->Tk::bind("<2>", [sub { +$zinc->Tk::bind("<2>", [sub { print $_[1], "@" ,$_[2], ", closest: ", - join(' ',$radar->find('closest', $_[1], $_[2])),"\n"; + join(' ',$zinc->find('closest', $_[1], $_[2])),"\n"; }, Ev('x'), Ev('y')]); -$radar->Tk::bind('', +$zinc->Tk::bind('', [ sub {($origx, $origy) = ($_[1], $_[2]); }, Ev('x'), Ev('y') ]); -$radar->Tk::bind('', +$zinc->Tk::bind('', [ sub {&finditems($_[1], $_[2]); }, Ev('x'), Ev('y') ]); -$radar->Tk::bind("<2>", sub {$radar->translate($top, 10,10); }); -$radar->Tk::bind("<3>", sub {$radar->scale($top, 1.1, 1.1); }); +$zinc->Tk::bind("<2>", sub {$zinc->translate($top, 10,10); }); +$zinc->Tk::bind("<3>", sub {$zinc->scale($top, 1.1, 1.1); }); MainLoop; sub borders { my($widget, $onoff) = @_; - my $part = $radar->currentpart; + my $part = $zinc->currentpart; my $contour = "noborder"; $contour = "contour" if ($onoff eq 'on'); - $radar->itemconfigure('current', $part, -border => $contour) if ($part >= 0); + $zinc->itemconfigure('current', $part, -border => $contour) if ($part >= 0); } sub finditems { my($cornerx, $cornery) = @_; print "--- enclosed --->", - join('|', $radar->find('enclosed',$origx, $origy, $cornerx, $cornery)),"\n"; + join('|', $zinc->find('enclosed',$origx, $origy, $cornerx, $cornery)),"\n"; print "--- overlapping --->", - join('|',$radar->find('overlapping',$origx, $origy, $cornerx, $cornery)),"\n\n"; + join('|',$zinc->find('overlapping',$origx, $origy, $cornerx, $cornery)),"\n\n"; } diff --git a/Python/Zinc.py b/Python/Zinc.py index d8705af..1420d8a 100644 --- a/Python/Zinc.py +++ b/Python/Zinc.py @@ -1,5 +1,5 @@ # -# Radar.py -- Python interface to the tkradar widget. +# Zinc.py -- Python interface to the tkzinc widget. # # Authors : Frederic Lepied, Patrick Lecoanet # Created Date : Thu Jul 22 09:36:04 1999 @@ -31,25 +31,25 @@ import types from Tkinter import * from Tkinter import _cnfmerge, _flatten -RADAR_NO_PART=-1 -RADAR_CURRENT_POSITION=-2 -RADAR_SPEED_VECTOR=-3 -RADAR_LEADER=-4 -RADAR_CONNECTION=-5 +ZINC_NO_PART=-1 +ZINC_CURRENT_POSITION=-2 +ZINC_SPEED_VECTOR=-3 +ZINC_LEADER=-4 +ZINC_CONNECTION=-5 -def havetkradar(window): +def havetkzinc(window): try: - window.tk.call('load', 'tkradar3.1.so') + window.tk.call('load', 'tkzinc3.1.so') # Call a function from the package to autoload it # and verify that all is OK. - window.tk.call('radar') + window.tk.call('zinc') except TclError: return 0 return 1 -class Radar(Widget): +class Zinc(Widget): def __init__(self, master=None, cnf={}, **kw): - Widget.__init__(self, master, 'radar', cnf, kw) + Widget.__init__(self, master, 'zinc', cnf, kw) self.items = {} def add(self, itemType, *args, **kw): @@ -258,11 +258,11 @@ class Radar(Widget): return self._do('type', (tagOrId,)) -class RadarItem: - def __init__(self, radar, itemType, *args, **kw): - self.radar = radar - self.id = apply(radar.add, (itemType,) + args, kw) - radar.items[self.id] = self +class ZincItem: + def __init__(self, zinc, itemType, *args, **kw): + self.zinc = zinc + self.id = apply(zinc.add, (itemType,) + args, kw) + zinc.items[self.id] = self def __str__(self): return str(self.id) @@ -271,19 +271,19 @@ class RadarItem: return str(self.id) def delete(self): - del self.radar.items[self.id] - self.radar.delete(self.id) + del self.zinc.items[self.id] + self.zinc.delete(self.id) def __getitem__(self, key): - return self.radar.itemcget(self.id, key) + return self.zinc.itemcget(self.id, key) def __setitem__(self, key, value): - self.radar.itemconfig(self.id, {key: value}) + self.zinc.itemconfig(self.id, {key: value}) def keys(self): if not hasattr(self, '_keys'): self._keys = {} - config=self.radar.itemconfig(self.id) + config=self.zinc.itemconfig(self.id) for x in config.keys(): self._keys[x] = config[x][1] return self._keys @@ -292,57 +292,57 @@ class RadarItem: return key in self.keys() def bind(self, sequence=None, command=None, add=None): - self.radar.bind_tag(self.id, sequence, command, add) + self.zinc.bind_tag(self.id, sequence, command, add) def cget(self, attr): - return self.radar.itemcget(self.id, attr) + return self.zinc.itemcget(self.id, attr) def fieldcget(self, field, attr): - return self.radar.itemfieldcget(self.id, field, attr) + return self.zinc.itemfieldcget(self.id, field, attr) -class Arc(RadarItem): - def __init__(self, radar, *args, **kw): - apply(RadarItem.__init__, (self, radar, 'arc') + args, kw) +class Arc(ZincItem): + def __init__(self, zinc, *args, **kw): + apply(ZincItem.__init__, (self, zinc, 'arc') + args, kw) -class Group(RadarItem): - def __init__(self, radar, *args, **kw): - apply(RadarItem.__init__, (self, radar, 'group') + args, kw) +class Group(ZincItem): + def __init__(self, zinc, *args, **kw): + apply(ZincItem.__init__, (self, zinc, 'group') + args, kw) -class Icon(RadarItem): - def __init__(self, radar, *args, **kw): - apply(RadarItem.__init__, (self, radar, 'icon') + args, kw) +class Icon(ZincItem): + def __init__(self, zinc, *args, **kw): + apply(ZincItem.__init__, (self, zinc, 'icon') + args, kw) -class Map(RadarItem): - def __init__(self, radar, *args, **kw): - apply(RadarItem.__init__, (self, radar, 'map') + args, kw) +class Map(ZincItem): + def __init__(self, zinc, *args, **kw): + apply(ZincItem.__init__, (self, zinc, 'map') + args, kw) -class Curve(RadarItem): - def __init__(self, radar, *args, **kw): - apply(RadarItem.__init__, (self, radar, 'curve') + args, kw) +class Curve(ZincItem): + def __init__(self, zinc, *args, **kw): + apply(ZincItem.__init__, (self, zinc, 'curve') + args, kw) -class Rectangle(RadarItem): - def __init__(self, radar, *args, **kw): - apply(RadarItem.__init__, (self, radar, 'rectangle') + args, kw) +class Rectangle(ZincItem): + def __init__(self, zinc, *args, **kw): + apply(ZincItem.__init__, (self, zinc, 'rectangle') + args, kw) -class Reticle(RadarItem): - def __init__(self, radar, *args, **kw): - apply(RadarItem.__init__, (self, radar, 'reticle') + args, kw) +class Reticle(ZincItem): + def __init__(self, zinc, *args, **kw): + apply(ZincItem.__init__, (self, zinc, 'reticle') + args, kw) -class Tabular(RadarItem): - def __init__(self, radar, *args, **kw): - apply(RadarItem.__init__, (self, radar, 'tabular') + args, kw) +class Tabular(ZincItem): + def __init__(self, zinc, *args, **kw): + apply(ZincItem.__init__, (self, zinc, 'tabular') + args, kw) -class Text(RadarItem): - def __init__(self, radar, *args, **kw): - apply(RadarItem.__init__, (self, radar, 'text') + args, kw) +class Text(ZincItem): + def __init__(self, zinc, *args, **kw): + apply(ZincItem.__init__, (self, zinc, 'text') + args, kw) -class Track(RadarItem): - def __init__(self, radar, *args, **kw): - apply(RadarItem.__init__, (self, radar, 'track') + args, kw) +class Track(ZincItem): + def __init__(self, zinc, *args, **kw): + apply(ZincItem.__init__, (self, zinc, 'track') + args, kw) -class WayPoint(RadarItem): - def __init__(self, radar, *args, **kw): - apply(RadarItem.__init__, (self, radar, 'waypoint') + args, kw) +class WayPoint(ZincItem): + def __init__(self, zinc, *args, **kw): + apply(ZincItem.__init__, (self, zinc, 'waypoint') + args, kw) # Class to hold mapinfos used by the Map Item class @@ -375,4 +375,4 @@ class Videomap (Mapinfo): print args apply(self.tk.call, ('videomap', 'load') + args + (self,)) -# Radar.py ends here +# Zinc.py ends here diff --git a/configure b/configure index 0933f0d..06afe21 100755 --- a/configure +++ b/configure @@ -452,7 +452,7 @@ echo > confdefs.h # A filename unique to this package, relative to the directory that # configure is in, which we can look for to find out if srcdir is correct. -ac_unique_file=tkRadar.c +ac_unique_file=tkZinc.c # Find the source files, if location was not specified. if test -z "$srcdir"; then @@ -697,10 +697,53 @@ else test "${CFLAGS+set}" = set || CFLAGS="-g" fi +for ac_prog in perl +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:706: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_PERL'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$PERL"; then + ac_cv_prog_PERL="$PERL" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_PERL="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +PERL="$ac_cv_prog_PERL" +if test -n "$PERL"; then + echo "$ac_t""$PERL" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$PERL" && break +done +test -n "$PERL" || PERL="error" + + +PERLLIB=`perl -e 'print $INC[0]'` + +SITEPERL=`find /usr/local -name site_perl` + + + # extract version information -XRADAR_VER=`sed -n -e 's/#define XRADARVER.*\([0-9]\)$/\1/p' patchlvl.h` -XRADAR_MAJOR=`sed -n -e 's/#define XRADARREV.*\([0-9]\)$/\1/p' patchlvl.h` -XRADAR_VERSION=`sed -n -e 's/#define XRADARVERSION.*\([0-9][a-z][0-9]\).*/\1/p' patchlvl.h` + +ZINC_VER=`sed -n -e 's/#define ZINCVER.*\([0-9]\)$/\1/p' patchlvl.h` +ZINC_MAJOR=`sed -n -e 's/#define ZINCREV.*\([0-9]\)$/\1/p' patchlvl.h` +ZINC_VERSION=`sed -n -e 's/#define ZINCVERSION.*\([0-9][a-z][0-9]\).*/\1/p' patchlvl.h` + @@ -710,7 +753,7 @@ XRADAR_VERSION=`sed -n -e 's/#define XRADARVERSION.*\([0-9][a-z][0-9]\).*/\1/p' echo $ac_n "checking for shared library support""... $ac_c" 1>&6 -echo "configure:714: checking for shared library support" >&5 +echo "configure:757: checking for shared library support" >&5 sharedlib_extension=so # right for almost everything sharedlib_suffix='.$(sharedlib_version)' sharedlib_cflags= @@ -812,7 +855,7 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:816: checking for a BSD compatible install" >&5 +echo "configure:859: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -862,7 +905,7 @@ test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:866: checking how to run the C preprocessor" >&5 +echo "configure:909: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -877,13 +920,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:887: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:930: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -894,13 +937,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:904: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:947: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -925,7 +968,7 @@ echo "$ac_t""$CPP" 1>&6 # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:929: checking for $ac_word" >&5 +echo "configure:972: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -952,7 +995,7 @@ else fi echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 -echo "configure:956: checking for POSIXized ISC" >&5 +echo "configure:999: checking for POSIXized ISC" >&5 if test -d /etc/conf/kconfig.d && grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 then @@ -973,12 +1016,12 @@ else fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:977: checking for ANSI C header files" >&5 +echo "configure:1020: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -986,7 +1029,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:990: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1033: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1003,7 +1046,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1021,7 +1064,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1042,7 +1085,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1053,7 +1096,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1057: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1100: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then : else @@ -1080,17 +1123,17 @@ for ac_hdr in values.h stddef.h stdarg.h limits.h strings.h string.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1084: checking for $ac_hdr" >&5 +echo "configure:1127: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1094: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1137: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1120,17 +1163,17 @@ for ac_hdr in unistd.h memory.h stdlib.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1124: checking for $ac_hdr" >&5 +echo "configure:1167: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1134: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1177: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1160,17 +1203,17 @@ for ac_hdr in sys/types.h sys/time.h sys/timeb.h sys/times.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1164: checking for $ac_hdr" >&5 +echo "configure:1207: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1174: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1217: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1199,12 +1242,12 @@ done for ac_func in gettimeofday do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1203: checking for $ac_func" >&5 +echo "configure:1246: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1274: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1258,7 +1301,7 @@ done # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 -echo "configure:1262: checking for X" >&5 +echo "configure:1305: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -1320,12 +1363,12 @@ if test "$ac_x_includes" = NO; then # First, try using that file with no special directory specified. cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1329: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1372: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1394,14 +1437,14 @@ if test "$ac_x_libraries" = NO; then ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1448: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. @@ -1507,17 +1550,17 @@ else case "`(uname -sr) 2>/dev/null`" in "SunOS 5"*) echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6 -echo "configure:1511: checking whether -R must be followed by a space" >&5 +echo "configure:1554: checking whether -R must be followed by a space" >&5 ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1564: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_R_nospace=yes else @@ -1533,14 +1576,14 @@ rm -f conftest* else LIBS="$ac_xsave_LIBS -R $x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1587: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_R_space=yes else @@ -1572,7 +1615,7 @@ rm -f conftest* # libraries were built with DECnet support. And karl@cs.umb.edu says # the Alpha needs dnet_stub (dnet does not exist). echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6 -echo "configure:1576: checking for dnet_ntoa in -ldnet" >&5 +echo "configure:1619: checking for dnet_ntoa in -ldnet" >&5 ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1580,7 +1623,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldnet $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1638: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1613,7 +1656,7 @@ fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6 -echo "configure:1617: checking for dnet_ntoa in -ldnet_stub" >&5 +echo "configure:1660: checking for dnet_ntoa in -ldnet_stub" >&5 ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1621,7 +1664,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldnet_stub $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1679: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1661,12 +1704,12 @@ fi # The nsl library prevents programs from opening the X display # on Irix 5.2, according to dickey@clark.net. echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 -echo "configure:1665: checking for gethostbyname" >&5 +echo "configure:1708: checking for gethostbyname" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1736: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else @@ -1710,7 +1753,7 @@ fi if test $ac_cv_func_gethostbyname = no; then echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:1714: checking for gethostbyname in -lnsl" >&5 +echo "configure:1757: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1718,7 +1761,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1776: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1759,12 +1802,12 @@ fi # -lsocket must be given before -lnsl if both are needed. # We assume that if connect needs -lnsl, so does gethostbyname. echo $ac_n "checking for connect""... $ac_c" 1>&6 -echo "configure:1763: checking for connect" >&5 +echo "configure:1806: checking for connect" >&5 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1834: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_connect=yes" else @@ -1808,7 +1851,7 @@ fi if test $ac_cv_func_connect = no; then echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 -echo "configure:1812: checking for connect in -lsocket" >&5 +echo "configure:1855: checking for connect in -lsocket" >&5 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1816,7 +1859,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1874: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1851,12 +1894,12 @@ fi # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX. echo $ac_n "checking for remove""... $ac_c" 1>&6 -echo "configure:1855: checking for remove" >&5 +echo "configure:1898: checking for remove" >&5 if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1926: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_remove=yes" else @@ -1900,7 +1943,7 @@ fi if test $ac_cv_func_remove = no; then echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6 -echo "configure:1904: checking for remove in -lposix" >&5 +echo "configure:1947: checking for remove in -lposix" >&5 ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1908,7 +1951,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lposix $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1966: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1943,12 +1986,12 @@ fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo $ac_n "checking for shmat""... $ac_c" 1>&6 -echo "configure:1947: checking for shmat" >&5 +echo "configure:1990: checking for shmat" >&5 if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2018: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_shmat=yes" else @@ -1992,7 +2035,7 @@ fi if test $ac_cv_func_shmat = no; then echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6 -echo "configure:1996: checking for shmat in -lipc" >&5 +echo "configure:2039: checking for shmat in -lipc" >&5 ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2000,7 +2043,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lipc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2058: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2044,7 +2087,7 @@ fi # libraries we check for below, so use a different variable. # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6 -echo "configure:2048: checking for IceConnectionNumber in -lICE" >&5 +echo "configure:2091: checking for IceConnectionNumber in -lICE" >&5 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2052,7 +2095,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lICE $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2110: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2109,7 +2152,7 @@ LIBS="-lX11 $X_EXTRA_LIBS" this_is_not_ok="" XPM="" echo $ac_n "checking for main in -lXpm""... $ac_c" 1>&6 -echo "configure:2113: checking for main in -lXpm" >&5 +echo "configure:2156: checking for main in -lXpm" >&5 ac_lib_var=`echo Xpm'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2117,14 +2160,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lXpm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2171: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2154,17 +2197,17 @@ for ac_hdr in X11/xpm.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2158: checking for $ac_hdr" >&5 +echo "configure:2201: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2168: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2211: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -2195,12 +2238,12 @@ CPPFLAGS=$TMP_CPPFLAGS LIBS="-lXext -lX11 $X_EXTRA_LIBS" echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:2199: checking for working const" >&5 +echo "configure:2242: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2296: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -2271,10 +2314,10 @@ fi if test "x$CC" != xcc; then echo $ac_n "checking whether $CC and cc understand -c and -o together""... $ac_c" 1>&6 -echo "configure:2275: checking whether $CC and cc understand -c and -o together" >&5 +echo "configure:2318: checking whether $CC and cc understand -c and -o together" >&5 else echo $ac_n "checking whether cc understands -c and -o together""... $ac_c" 1>&6 -echo "configure:2278: checking whether cc understands -c and -o together" >&5 +echo "configure:2321: checking whether cc understands -c and -o together" >&5 fi set dummy $CC; ac_cc="`echo $2 | sed -e 's/[^a-zA-Z0-9_]/_/g' -e 's/^[0-9]/_/'`" @@ -2286,16 +2329,16 @@ else # We do the test twice because some compilers refuse to overwrite an # existing .o file with -o, though they will create one. ac_try='${CC-cc} -c conftest.c -o conftest.o 1>&5' -if { (eval echo configure:2290: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } && - test -f conftest.o && { (eval echo configure:2291: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; +if { (eval echo configure:2333: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } && + test -f conftest.o && { (eval echo configure:2334: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; then eval ac_cv_prog_cc_${ac_cc}_c_o=yes if test "x$CC" != xcc; then # Test first that cc exists at all. - if { ac_try='cc -c conftest.c 1>&5'; { (eval echo configure:2296: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + if { ac_try='cc -c conftest.c 1>&5'; { (eval echo configure:2339: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then ac_try='cc -c conftest.c -o conftest.o 1>&5' - if { (eval echo configure:2298: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } && - test -f conftest.o && { (eval echo configure:2299: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; + if { (eval echo configure:2341: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } && + test -f conftest.o && { (eval echo configure:2342: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; then # cc works too. : @@ -2460,9 +2503,12 @@ s%@oldincludedir@%$oldincludedir%g s%@infodir@%$infodir%g s%@mandir@%$mandir%g s%@CC@%$CC%g -s%@XRADAR_VER@%$XRADAR_VER%g -s%@XRADAR_MAJOR@%$XRADAR_MAJOR%g -s%@XRADAR_VERSION@%$XRADAR_VERSION%g +s%@PERL@%$PERL%g +s%@PERLLIB@%$PERLLIB%g +s%@SITEPERL@%$SITEPERL%g +s%@ZINC_VER@%$ZINC_VER%g +s%@ZINC_MAJOR@%$ZINC_MAJOR%g +s%@ZINC_VERSION@%$ZINC_VERSION%g s%@sharedlib_extension@%$sharedlib_extension%g s%@sharedlib_suffix@%$sharedlib_suffix%g s%@sharedlib_cflags@%$sharedlib_cflags%g diff --git a/debian/README.debian b/debian/README.debian index 949f104..4e2e06c 100644 --- a/debian/README.debian +++ b/debian/README.debian @@ -1,4 +1,4 @@ -xradar for DEBIAN +zinc for DEBIAN ---------------------- Comments regarding the Package diff --git a/debian/changelog b/debian/changelog index 5f4f76f..3f114ba 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +zinc-tk (3.1.9) unstable; urgency=low + + * Passage du nom radar au nom zinc. + + -- Patrick Lecoanet Mon, 31 Jan 2000 14:27:56 +0100 + xradar3-tk (3.1.8) unstable; urgency=low * Fin de réalisation de ToArea pour Curve. diff --git a/debian/control b/debian/control index 284540a..b0c5e76 100644 --- a/debian/control +++ b/debian/control @@ -1,27 +1,28 @@ -Source: xradar3-tk +Source: zinc-tk Section: devel Priority: extra Maintainer: Patrick Lecoanet Standards-Version: 2.3.0.0 -Package: xradar3-tk +Package: zinc-tk Architecture: i386 Depends: tk8.0 (>= 8.0.4-2) -Provides: xradar-tk -Conflicts: xradar-dev, xradar3-dev -Description: The Tk radar widget. - Radar Widget incarnation for the Tk toolkit. +Provides: zinc-tk +Conflicts: xradar3-tk +Description: The Tk Zinc widget. + Zinc Widget for the Tk toolkit. -Package: xradar3-perl +Package: zinc-perl Architecture: i386 -Depends: perl-tk (>= 800.011), xradar3-tk (= ${Source-Version}) -Provides: xradar-perl -Conflicts: xradar-perl -Description: perl-tk variant of the Tk radar widget. - perl-tk variant of the Tk radar widget. +Depends: perl-tk (>= 800.011), zinc-tk (= ${Source-Version}) +Provides: zinc-perl +Conflicts: xradar3-perl +Description: perl-tk variant of the Tk Zinc widget. + perl-tk variant of the Tk Zinc widget. -Package: python-xradar3 +Package: zinc-python Architecture: all -Depends: python-tk, xradar3-tk (= ${Source-Version}) -Description: python interface to the xradar Tk widget. - python interface to the xradar Tk widget. +Depends: python-tk, zinc-tk (= ${Source-Version}) +Conflicts: python-xradar3 +Description: python interface to the Zinc Tk widget. + python interface to the Zinc Tk widget. diff --git a/debian/copyright b/debian/copyright index c6bee55..01e7f1d 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,8 +1,21 @@ This package was debianized by Patrick Lecoanet lecoanet@cena.dgac.fr on Wed, 25 Feb 1998 14:11:43 +0100. -It was downloaded from - Copyright: - + Copyright (c) 1993 - 1999 CENA, Patrick Lecoanet -- + + This code is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This code is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this code; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + diff --git a/debian/dirs b/debian/dirs index 92d2448..f0eabeb 100644 --- a/debian/dirs +++ b/debian/dirs @@ -1,5 +1,5 @@ usr/lib/python1.5/site-packages -usr/doc/xradar3-tk/examples -usr/doc/xradar3-perl/examples +usr/doc/zinc-tk/examples +usr/doc/zinc-perl/examples usr/include usr/man/man3 diff --git a/debian/rules b/debian/rules index 5ab6bd4..80451a2 100755 --- a/debian/rules +++ b/debian/rules @@ -15,7 +15,7 @@ build: # which reserves one register; thus, without -fPIC we get more efficient # code). # - $(MAKE) -f Makefile tkradar ptkradar doc + $(MAKE) -f Makefile tkzinc ptkzinc doc touch build clean: @@ -41,14 +41,14 @@ binary-arch: checkroot build -rm -f debian/tmp/usr/lib/perl5/i386-linux/5.004/perllocal.pod - install -m644 Perl/t/radar.pl debian/tmp/usr/doc/xradar3-perl/examples - install -m644 test/*.tcl test/*.pl debian/tmp/usr/doc/xradar3-tk/examples + install -m644 Perl/t/zinc.pl debian/tmp/usr/doc/zinc-perl/examples + install -m644 test/*.tcl test/*.pl debian/tmp/usr/doc/zinc-tk/examples - install -m644 Python/Radar.py debian/tmp/usr/lib/python1.5/site-packages/ + install -m644 Python/Zinc.py debian/tmp/usr/lib/python1.5/site-packages/ - debstd -m ChangeLog muwr.tex refman.tex refman.ps - -rm -Rf debian/tmp/usr/doc/xradar3-perl debian/tmp/usr/lib/perl5 - dpkg-gencontrol -pxradar3-tk + debstd -m doc/muwr.tex doc/refman.tex doc/refman.ps + -rm -Rf debian/tmp/usr/doc/zinc-perl debian/tmp/usr/lib/perl5 + dpkg-gencontrol -pzinc-tk chown -R root.root debian/tmp chmod -R go=rX debian/tmp dpkg --build debian/tmp .. diff --git a/debian/zinc-perl.files b/debian/zinc-perl.files index da1d3a4..aa4c9ed 100644 --- a/debian/zinc-perl.files +++ b/debian/zinc-perl.files @@ -1,3 +1,3 @@ -usr/lib/libptkradar3.1.so +usr/lib/libptkzinc3.1.so usr/lib/perl5 -usr/doc/xradar3-perl/examples +usr/doc/zinc-perl/examples diff --git a/debian/zinc-python.postinst b/debian/zinc-python.postinst index 8e6fcbb..66670a3 100644 --- a/debian/zinc-python.postinst +++ b/debian/zinc-python.postinst @@ -4,7 +4,7 @@ # Written by Gregor Hoffleit # -NAME=python-xradar3 +NAME=zinc-python DIRLIST="/usr/lib/python1.5/site-packages" case "$1" in diff --git a/debian/zinc-python.prerm b/debian/zinc-python.prerm index caac61f..42efba6 100644 --- a/debian/zinc-python.prerm +++ b/debian/zinc-python.prerm @@ -4,7 +4,7 @@ # Written by Gregor Hoffleit # -NAME=python-xradar3 +NAME=zinc-python dpkg --listfiles $NAME | awk '$0~/\.py$/ {print $0"c\n" $0"o"}' | 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; diff --git a/generic/Attrs.c b/generic/Attrs.c index 2bc3a81..a7238cd 100644 --- a/generic/Attrs.c +++ b/generic/Attrs.c @@ -49,7 +49,7 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ " ****************************************************************** */ static Tcl_HashTable format_cache; -static RadarBool format_inited = False; +static ZnBool format_inited = False; #if 0 static char @@ -159,13 +159,13 @@ LabelFormatCreate(Tcl_Interp *interp, char *format_str, int num_fields) { - RadarList fields; + ZnList fields; Tcl_HashEntry *entry; FieldFormatStruct field_struct; FieldFormat field_array; LabelFormat format; int width, height; - RadarDim c_width=0.0, c_height=0.0; + ZnDim c_width=0.0, c_height=0.0; int index, num_tok, num_ffs, new; int field_index=0; char *ptr = format_str, *next_ptr; @@ -189,7 +189,7 @@ LabelFormatCreate(Tcl_Interp *interp, } } - fields = RadarListNew(1, sizeof(FieldFormatStruct)); + fields = ZnListNew(1, sizeof(FieldFormatStruct)); /* * Try to see if it starts with a number or a leader spec. @@ -201,17 +201,17 @@ LabelFormatCreate(Tcl_Interp *interp, goto lf_end_parse; } if ((*ptr != 'x') && (*ptr != 'f') && (*ptr != 'i') && (*ptr != 'a')) { - c_width = (RadarDim) strtod(ptr, &next_ptr); + c_width = (ZnDim) strtod(ptr, &next_ptr); if ((ptr == next_ptr) || (*next_ptr != 'x')) { lf_error_syn: Tcl_AppendResult(interp, "invalid label format specification \"", ptr, "\"", NULL); lf_error: - RadarListFree(fields); + ZnListFree(fields); return NULL; } ptr = next_ptr+1; - c_height = (RadarDim) strtod(ptr, &next_ptr); + c_height = (ZnDim) strtod(ptr, &next_ptr); if (ptr == next_ptr) { goto lf_error_syn; } @@ -225,7 +225,7 @@ LabelFormatCreate(Tcl_Interp *interp, field_struct.width_spec = (short) c_width; field_struct.height_spec = (short) c_height; c_width = c_height = 0.0; - RadarListAdd(fields, &field_struct, RadarListTail); + ZnListAdd(fields, &field_struct, ZnListTail); goto lf_end_parse; } @@ -284,7 +284,7 @@ LabelFormatCreate(Tcl_Interp *interp, } field_struct.width_spec = (short) width; field_struct.height_spec = (short) height; - RadarListAdd(fields, &field_struct, RadarListTail); + ZnListAdd(fields, &field_struct, ZnListTail); field_index++; goto lf_parse2; } @@ -293,16 +293,16 @@ LabelFormatCreate(Tcl_Interp *interp, } lf_end_parse: - field_array = (FieldFormat) RadarListArray(fields); - num_ffs = RadarListSize(fields); + field_array = (FieldFormat) ZnListArray(fields); + num_ffs = ZnListSize(fields); - format = (LabelFormat) RadarMalloc(sizeof(LabelFormatStruct) + + format = (LabelFormat) ZnMalloc(sizeof(LabelFormatStruct) + (num_ffs-1) * sizeof(FieldFormatStruct)); format->clip_width = (short) c_width; format->clip_height = (short) c_height; format->num_fields = num_ffs; memcpy(&format->fields, field_array, num_ffs * sizeof(FieldFormatStruct)); - RadarListFree(fields); + ZnListFree(fields); format->ref_count = 1; format->entry = entry; @@ -326,7 +326,7 @@ LabelFormatDelete(LabelFormat lf) lf->ref_count--; if (lf->ref_count == 0) { Tcl_DeleteHashEntry(lf->entry); - RadarFree(lf); + ZnFree(lf); } } @@ -381,17 +381,17 @@ LabelFormatGetString(LabelFormat lf) * If the clip box has both its width and its height * set to zero, it means that there is no clipbox. */ -RadarBool +ZnBool LabelFormatGetClipBox(LabelFormat lf, - RadarDim *w, - RadarDim *h) + ZnDim *w, + ZnDim *h) { if ((lf->clip_width == 0) && (lf->clip_height == 0)) { return False; } - *w = (RadarDim) lf->clip_width; - *h = (RadarDim) lf->clip_height; + *w = (ZnDim) lf->clip_width; + *h = (ZnDim) lf->clip_height; return True; } @@ -431,7 +431,7 @@ LabelFormatGetField(LabelFormat lf, **************************************************************** */ static Tcl_HashTable line_end_cache; -static RadarBool line_end_inited = False; +static ZnBool line_end_inited = False; LineEnd @@ -441,7 +441,7 @@ LineEndCreate(Tcl_Interp *interp, Tcl_HashEntry *entry; LineEnd le; int new, argc; - RadarReal a, b ,c; + ZnReal a, b ,c; if (!line_end_inited) { Tcl_InitHashTable(&line_end_cache, TCL_STRING_KEYS); @@ -457,7 +457,7 @@ LineEndCreate(Tcl_Interp *interp, argc = sscanf(line_end_str, "%lf %lf %lf", &a, &b, &c); if (argc == 3) { - le = (LineEnd) RadarMalloc(sizeof(LineEndStruct)); + le = (LineEnd) ZnMalloc(sizeof(LineEndStruct)); le->shape_a = a; le->shape_b = b; le->shape_c = c; @@ -487,7 +487,7 @@ LineEndDelete(LineEnd le) le->ref_count--; if (le->ref_count == 0) { Tcl_DeleteHashEntry(le->entry); - RadarFree(le); + ZnFree(le); } } diff --git a/generic/Attrs.h b/generic/Attrs.h index 1d9ba0e..2cdb7ec 100644 --- a/generic/Attrs.h +++ b/generic/Attrs.h @@ -87,10 +87,10 @@ void LabelFormatDelete(LabelFormat /* label_format */); char * LabelFormatGetString(LabelFormat /* label_format */); -RadarBool +ZnBool LabelFormatGetClipBox(LabelFormat /* label_format */, - RadarDim */* width */, - RadarDim */* height */); + ZnDim */* width */, + ZnDim */* height */); #define LabelFormatNumFields(lf) ((lf)->num_fields) void LabelFormatGetField(LabelFormat /* label_format */, @@ -108,9 +108,9 @@ LabelFormatGetField(LabelFormat /* label_format */, * Line Ends. */ typedef struct { - RadarReal shape_a; - RadarReal shape_b; - RadarReal shape_c; + ZnReal shape_a; + ZnReal shape_b; + ZnReal shape_c; Tcl_HashEntry *entry; int ref_count; } LineEndStruct, *LineEnd; diff --git a/generic/Color.c b/generic/Color.c index 4cbaa6c..129d990 100644 --- a/generic/Color.c +++ b/generic/Color.c @@ -81,7 +81,7 @@ static StressedDpy *stressed_display_list = NULL; #define COLOR_MAGIC ((unsigned int) 0x46140277) -typedef struct TkColor { +typedef struct ZnColorInfo { XColor color; /* Information about this color. */ unsigned int magic; /* Used for quick integrity check on this * structure. Must always have the @@ -96,7 +96,7 @@ typedef struct TkColor { * (needed when deleting structure). */ Tcl_HashEntry *hash; /* Pointer to hash table entry for this * structure. (for use in deleting entry). */ -} TkColor; +} ZnColorInfo; /* @@ -112,7 +112,7 @@ typedef struct TkColor { */ /* - * Hash table for name -> TkColor mapping, and key structure used to + * Hash table for name -> ZnColorInfo mapping, and key structure used to * index into that table: */ static Tcl_HashTable name_table; @@ -126,7 +126,7 @@ typedef struct { /* - * Hash table for value -> TkColor mapping, and key structure used to + * Hash table for value -> ZnColorInfo mapping, and key structure used to * index into that table: */ static Tcl_HashTable value_table; @@ -149,7 +149,7 @@ typedef struct _ColorGradient { * allocated. */ int ref_count; Tcl_HashEntry *hash; - RadarBool realized; + ZnBool realized; int num_colors; /* Number of steps in the gradient. */ XColor *colors[1]; /* Colors of the gradient. */ } ColorGradient; @@ -210,7 +210,7 @@ GetStressedDisplay(Display *dpy) /* * Not found, allocate a new one. */ - cur = (StressedDpy *) RadarMalloc(sizeof(StressedDpy)); + cur = (StressedDpy *) ZnMalloc(sizeof(StressedDpy)); cur->dpy = dpy; cur->stress = NULL; cur->next = stressed_display_list; @@ -261,8 +261,8 @@ DeleteStressedCmap(Display *display, else { prev->next = stress->next; } - RadarFree(stress->color); - RadarFree(stress); + ZnFree(stress->color); + ZnFree(stress); return; } } @@ -312,18 +312,18 @@ FindClosestColor(Tk_Window tkwin, /* Window where color will */ for (stress = dpy->stress; ; stress = stress->next) { if (stress == NULL) { - stress = (StressedCmap *) RadarMalloc(sizeof(StressedCmap)); + stress = (StressedCmap *) ZnMalloc(sizeof(StressedCmap)); stress->colormap = colormap; template.visualid = XVisualIDFromVisual(Tk_Visual(tkwin)); vis_info = XGetVisualInfo(Tk_Display(tkwin), VisualIDMask, &template, &num_found); if (num_found < 1) { - RadarWarning("FindClosestColor (Radar) couldn't lookup visual"); + ZnWarning("FindClosestColor (Zinc) couldn't lookup visual"); abort(); } stress->num_colors = vis_info->colormap_size; XFree((char *) vis_info); - stress->color = (XColor *) RadarMalloc((unsigned) + stress->color = (XColor *) ZnMalloc((unsigned) (stress->num_colors*sizeof(XColor))); for (i = 0; i < stress->num_colors; i++) { stress->color[i].pixel = (unsigned long) i; @@ -347,7 +347,7 @@ FindClosestColor(Tk_Window tkwin, /* Window where color will */ while (1) { if (stress->num_colors == 0) { - RadarWarning("FindClosestColor (Radar) ran out of colors"); + ZnWarning("FindClosestColor (Zinc) ran out of colors"); abort(); } closest_dist = 1e30; @@ -403,7 +403,7 @@ FindClosestColor(Tk_Window tkwin, /* Window where color will *---------------------------------------------------------------------- */ #if 0 -static RadarBool +static ZnBool CmapStressed(Tk_Window tkwin, Colormap colormap) { @@ -448,7 +448,7 @@ ColorInit() /* *---------------------------------------------------------------------- * - * RadarGetColor -- + * ZnGetColor -- * * Given a string name for a color, map the name to a corresponding * XColor structure. @@ -463,16 +463,16 @@ ColorInit() * Side effects: * The color is added to an internal database with a reference count. * For each call to this procedure, there should eventually be a call - * to RadarFreeColor so that the database is cleaned up when colors + * to ZnFreeColor so that the database is cleaned up when colors * aren't in use anymore. * *---------------------------------------------------------------------- */ XColor * -RadarGetColor(Tcl_Interp *interp, - Tk_Window tkwin, /* Window in which color will be used. */ - Tk_Uid name) /* Name of color to allocated (in form - * suitable for passing to XParseColor). */ +ZnGetColor(Tcl_Interp *interp, + Tk_Window tkwin, /* Window in which color will be used. */ + Tk_Uid name) /* Name of color to allocated (in form + * suitable for passing to XParseColor). */ { NameKey name_key; Tcl_HashEntry *name_hash; @@ -480,13 +480,13 @@ RadarGetColor(Tcl_Interp *interp, Display *dpy = Tk_Display(tkwin); Colormap colormap = Tk_Colormap(tkwin); XColor color, screen; - TkColor *tk_col; + ZnColorInfo *tk_col; if (!initialized) { ColorInit(); } - /*printf("RadarGetColor color: %s\n", name);*/ + /*printf("ZnGetColor color: %s\n", name);*/ /* * First, check to see if there's already a mapping for this color * name. @@ -496,9 +496,9 @@ RadarGetColor(Tcl_Interp *interp, name_key.display = Tk_Display(tkwin); name_hash = Tcl_CreateHashEntry(&name_table, (char *) &name_key, &new); if (!new) { - tk_col = (TkColor *) Tcl_GetHashValue(name_hash); + tk_col = (ZnColorInfo *) Tcl_GetHashValue(name_hash); tk_col->ref_count++; - /*printf("RadarGetColor cache hit for: %d %d %d\n", + /*printf("ZnGetColor cache hit for: %d %d %d\n", tk_col->color.red, tk_col->color.green, tk_col->color.blue);*/ return &tk_col->color; } @@ -510,7 +510,7 @@ RadarGetColor(Tcl_Interp *interp, */ if (*name != '#') { if (XAllocNamedColor(dpy, colormap, name, &screen, &color) != 0) { - /*printf("RadarGetColor XAllocNamedColor gives: %d %d %d\n", + /*printf("ZnGetColor XAllocNamedColor gives: %d %d %d\n", color.red, color.green, color.blue);*/ DeleteStressedCmap(dpy, colormap); } @@ -549,11 +549,11 @@ RadarGetColor(Tcl_Interp *interp, } } - tk_col = (TkColor *) RadarMalloc(sizeof(TkColor)); + tk_col = (ZnColorInfo *) ZnMalloc(sizeof(ZnColorInfo)); tk_col->color = color; /* - * Now create a new TkColor structure and add it to nameTable. + * Now create a new ZnColorInfo structure and add it to nameTable. */ tk_col->magic = COLOR_MAGIC; tk_col->screen = Tk_Screen(tkwin); @@ -564,7 +564,7 @@ RadarGetColor(Tcl_Interp *interp, tk_col->hash = name_hash; Tcl_SetHashValue(name_hash, tk_col); - /*printf("RadarGetColor created: %d %d %d\n", + /*printf("ZnGetColor created: %d %d %d\n", tk_col->color.red, tk_col->color.green, tk_col->color.blue);*/ return &tk_col->color; } @@ -573,7 +573,7 @@ RadarGetColor(Tcl_Interp *interp, /* *---------------------------------------------------------------------- * - * RadarGetColorByValue -- + * ZnGetColorByValue -- * * Given a desired set of red-green-blue intensities for a color, * locate a pixel value to use to draw that color in a given @@ -588,19 +588,19 @@ RadarGetColor(Tcl_Interp *interp, * Side effects: * The color is added to an internal database with a reference count. * For each call to this procedure, there should eventually be a call - * to RadarFreeColor, so that the database is cleaned up when colors + * to ZnFreeColor, so that the database is cleaned up when colors * aren't in use anymore. * *---------------------------------------------------------------------- */ XColor * -RadarGetColorByValue(Tk_Window tkwin, - XColor *color) +ZnGetColorByValue(Tk_Window tkwin, + XColor *color) { ValueKey value_key; Tcl_HashEntry *value_hash; int new; - TkColor *tk_col; + ZnColorInfo *tk_col; Display *dpy = Tk_Display(tkwin); Colormap colormap = Tk_Colormap(tkwin); @@ -619,7 +619,7 @@ RadarGetColorByValue(Tk_Window tkwin, value_key.display = Tk_Display(tkwin); value_hash = Tcl_CreateHashEntry(&value_table, (char *) &value_key, &new); if (!new) { - tk_col = (TkColor *) Tcl_GetHashValue(value_hash); + tk_col = (ZnColorInfo *) Tcl_GetHashValue(value_hash); tk_col->ref_count++; return &tk_col->color; } @@ -628,7 +628,7 @@ RadarGetColorByValue(Tk_Window tkwin, * The name isn't currently known. Find a pixel value * to use to draw that color in a given window. */ - tk_col = (TkColor *) RadarMalloc(sizeof(TkColor)); + tk_col = (ZnColorInfo *) ZnMalloc(sizeof(ZnColorInfo)); tk_col->color.red = color->red; tk_col->color.green = color->green; tk_col->color.blue = color->blue; @@ -655,7 +655,7 @@ RadarGetColorByValue(Tk_Window tkwin, /* *-------------------------------------------------------------- * - * RadarNameOfColor -- + * ZnNameOfColor -- * * Given a color, return a textual string identifying * the color. @@ -674,9 +674,9 @@ RadarGetColorByValue(Tk_Window tkwin, *-------------------------------------------------------------- */ char * -RadarNameOfColor(XColor *color) +ZnNameOfColor(XColor *color) { - register TkColor *tk_col = (TkColor *) color; + register ZnColorInfo *tk_col = (ZnColorInfo *) color; static char string[20]; if ((tk_col->magic == COLOR_MAGIC) && (tk_col->table == &name_table)) { @@ -690,10 +690,10 @@ RadarNameOfColor(XColor *color) /* *---------------------------------------------------------------------- * - * RadarFreeColor -- + * ZnFreeColor -- * * This procedure is called to release a color allocated by - * RadarGetColor or RadarGetColorByValue. + * ZnGetColor or ZnGetColorByValue. * * Results: * None. @@ -706,27 +706,27 @@ RadarNameOfColor(XColor *color) *---------------------------------------------------------------------- */ void -RadarFreeColor(XColor *color) /* Color to be released. Must have been - * allocated by RadarGetColor or - * RadarGetColorByValue. */ +ZnFreeColor(XColor *color) /* Color to be released. Must have been + * allocated by ZnGetColor or + * ZnGetColorByValue. */ { - TkColor *tk_col = (TkColor *) color; + ZnColorInfo *tk_col = (ZnColorInfo *) color; Visual *visual; Screen *screen = tk_col->screen; Tk_ErrorHandler handler; /* * Do a quick sanity check to make sure this color was really - * allocated by RadarGetColor. + * allocated by ZnGetColor. */ if (tk_col->magic != COLOR_MAGIC) { - RadarWarning("RadarFreeColor called with bogus color"); + ZnWarning("ZnFreeColor called with bogus color"); abort(); } tk_col->ref_count--; if (tk_col->ref_count == 0) { - /*printf("RadarFreeColor freeing %s\n", RadarNameOfColor(color));*/ + /*printf("ZnFreeColor freeing %s\n", ZnNameOfColor(color));*/ /* * Careful! Don't free black or white, since this will * make some servers very unhappy. Also, there is a bug in @@ -752,7 +752,7 @@ RadarFreeColor(XColor *color) /* Color to be released. Must have been Tcl_DeleteHashEntry(tk_col->hash); tk_col->magic = 0; - RadarFree(tk_col); + ZnFree(tk_col); } } @@ -766,7 +766,7 @@ RadarFreeColor(XColor *color) /* Color to be released. Must have been * a gradient. The first and last colors are always allocated * during the gradient's creation. For 3D gradients the center * color is also allocated. - * It's called lazily by RadarColorGradientPixel, so that the + * It's called lazily by ZnColorGradientPixel, so that the * colors aren't allocated until something is actually drawn * with them. * @@ -805,7 +805,7 @@ RealizeColorGradient(ColorGradient *grad, color.red = (int) base->red + red_range * i / (num_colors-2); color.green = (int) base->green + green_range * i / (num_colors-2); color.blue = (int) base->blue + blue_range * i / (num_colors-2); - grad->colors[i] = RadarGetColorByValue(tkwin, &color); + grad->colors[i] = ZnGetColorByValue(tkwin, &color); } red_range = (int) base->red - (int) last->red; green_range = (int) base->green - (int) last->green; @@ -814,7 +814,7 @@ RealizeColorGradient(ColorGradient *grad, color.red = (int) base->red + red_range * i / (num_colors-2); color.green = (int) base->green + green_range * i / (num_colors-2); color.blue = (int) base->blue + blue_range * i / (num_colors-2); - grad->colors[i] = RadarGetColorByValue(tkwin, &color); + grad->colors[i] = ZnGetColorByValue(tkwin, &color); } } else { @@ -825,7 +825,7 @@ RealizeColorGradient(ColorGradient *grad, color.red =(int) first->red + red_range * i / (num_colors-2); color.green = (int) first->green + green_range * i / (num_colors-2); color.blue = (int) first->blue + blue_range * i / (num_colors-2); - grad->colors[i] = RadarGetColorByValue(tkwin, &color); + grad->colors[i] = ZnGetColorByValue(tkwin, &color); } } } @@ -834,12 +834,12 @@ RealizeColorGradient(ColorGradient *grad, /* *---------------------------------------------------------------------- * - * RadarColorGradientSpan -- + * ZnColorGradientSpan -- * *---------------------------------------------------------------------- */ int -RadarColorGradientSpan(RadarColorGradient gradient) +ZnColorGradientSpan(ZnColorGradient gradient) { return ((ColorGradient *) gradient)->num_colors; } @@ -848,14 +848,14 @@ RadarColorGradientSpan(RadarColorGradient gradient) /* *---------------------------------------------------------------------- * - * RadarColorGradientPixel -- + * ZnColorGradientPixel -- * *---------------------------------------------------------------------- */ int -RadarColorGradientPixel(RadarColorGradient gradient, - Tk_Window tkwin, - int color_index) +ZnColorGradientPixel(ZnColorGradient gradient, + Tk_Window tkwin, + int color_index) { ColorGradient *grad = (ColorGradient *) gradient; @@ -868,14 +868,14 @@ RadarColorGradientPixel(RadarColorGradient gradient, if (!grad->realized) { RealizeColorGradient(grad, tkwin); } - return RadarPixel(grad->colors[color_index]); + return ZnPixel(grad->colors[color_index]); } /* *-------------------------------------------------------------- * - * RadarGetReliefGradient -- + * ZnGetReliefGradient -- * * Create a data structure containing a range of colors * used to display a 3D border. Name contains the base @@ -889,7 +889,7 @@ RadarColorGradientPixel(RadarColorGradient gradient, * to the drawing routines. This function allocate * the base color and the two end colors in an attempt * to use only actually needed resources. The function - * RadarColorGradientPixel asserts that all the colors + * ZnColorGradientPixel asserts that all the colors * get allocated when needed. * If an error prevented the gradient from being created * then NULL is returned and an error message will be @@ -898,14 +898,14 @@ RadarColorGradientPixel(RadarColorGradient gradient, * Side effects: * Data structures, etc. are allocated. * It is the caller's responsibility to eventually call - * RadarFreeColorGradient to release the resources. + * ZnFreeColorGradient to release the resources. * *-------------------------------------------------------------- */ -RadarColorGradient -RadarGetReliefGradient(Tcl_Interp *interp, - Tk_Window tkwin, - Tk_Uid name) +ZnColorGradient +ZnGetReliefGradient(Tcl_Interp *interp, + Tk_Window tkwin, + Tk_Uid name) { GradientKey key; Tcl_HashEntry *hash; @@ -934,14 +934,14 @@ RadarGetReliefGradient(Tcl_Interp *interp, /* * No satisfactory gradient exists yet. Initialize a new one. */ - base = RadarGetColor(interp, tkwin, name); + base = ZnGetColor(interp, tkwin, name); if (base == NULL) { Tcl_AppendResult(interp, " in border gradient", NULL); Tcl_DeleteHashEntry(hash); return NULL; } - grad = (ColorGradient *) RadarMalloc(sizeof(ColorGradient) + + grad = (ColorGradient *) ZnMalloc(sizeof(ColorGradient) + sizeof(XColor *)*(BORDER_STEPS-1)); grad->screen = Tk_Screen(tkwin); grad->visual = Tk_Visual(tkwin); @@ -986,7 +986,7 @@ RadarGetReliefGradient(Tcl_Interp *interp, tmp1 = (60 * (int) base->blue)/100; tmp2 = (MAX_INTENSITY + (int) base->blue)/2; color.blue = MIN(tmp1, tmp2); - grad->colors[0] = RadarGetColorByValue(tkwin, &color); + grad->colors[0] = ZnGetColorByValue(tkwin, &color); tmp1 = (14 * (int) base->red)/10; if (tmp1 > MAX_INTENSITY) { @@ -1006,7 +1006,7 @@ RadarGetReliefGradient(Tcl_Interp *interp, } tmp2 = (MAX_INTENSITY + (int) base->blue)/2; color.blue = MAX(tmp1, tmp2); - grad->colors[BORDER_STEPS-1] = RadarGetColorByValue(tkwin, &color); + grad->colors[BORDER_STEPS-1] = ZnGetColorByValue(tkwin, &color); /* * Now init the in between colors to let RealizeColorGradient know @@ -1025,14 +1025,14 @@ RadarGetReliefGradient(Tcl_Interp *interp, * Delay the allocation of colors until they are actually * needed for drawing. */ - return (RadarColorGradient) grad; + return (ZnColorGradient) grad; } /* *-------------------------------------------------------------- * - * RadarGetColorGradient -- + * ZnGetColorGradient -- * * Create a data structure containing a range of colors * used to display a gradient. Name contains the gradient @@ -1045,7 +1045,7 @@ RadarGetReliefGradient(Tcl_Interp *interp, * to the drawing routines. This function allocate * the two end colors in an attempt to use only * actually needed resources. The function - * RadarColorGradientPixel asserts that all the colors + * ZnColorGradientPixel asserts that all the colors * get allocated when needed. * If an error prevented the gradient from being created * then NULL is returned and an error message will be @@ -1054,12 +1054,12 @@ RadarGetReliefGradient(Tcl_Interp *interp, * Side effects: * Data structures, etc. are allocated. * It is the caller's responsibility to eventually call - * RadarFreeColorGradient to release the resources. + * ZnFreeColorGradient to release the resources. * *-------------------------------------------------------------- */ -RadarColorGradient -RadarGetColorGradientByValue(RadarColorGradient gradient) +ZnColorGradient +ZnGetColorGradientByValue(ZnColorGradient gradient) { ColorGradient *grad; @@ -1069,10 +1069,10 @@ RadarGetColorGradientByValue(RadarColorGradient gradient) } -RadarColorGradient -RadarGetColorGradient(Tcl_Interp *interp, - Tk_Window tkwin, - Tk_Uid name) +ZnColorGradient +ZnGetColorGradient(Tcl_Interp *interp, + Tk_Window tkwin, + Tk_Uid name) { GradientKey key; Tcl_HashEntry *hash; @@ -1110,19 +1110,19 @@ RadarGetColorGradient(Tcl_Interp *interp, Tcl_DeleteHashEntry(hash); return NULL; } - first = RadarGetColor(interp, tkwin, name_first); + first = ZnGetColor(interp, tkwin, name_first); if (first == NULL) { grad_err2: Tcl_AppendResult(interp, " in gradient", NULL); goto grad_err; } - last = RadarGetColor(interp, tkwin, name_last); + last = ZnGetColor(interp, tkwin, name_last); if (last == NULL) { - RadarFreeColor(first); + ZnFreeColor(first); goto grad_err2; } - grad = (ColorGradient *) RadarMalloc(sizeof(ColorGradient) + + grad = (ColorGradient *) ZnMalloc(sizeof(ColorGradient) + sizeof(XColor *)*(steps-1)); grad->screen = Tk_Screen(tkwin); grad->visual = Tk_Visual(tkwin); @@ -1144,18 +1144,18 @@ RadarGetColorGradient(Tcl_Interp *interp, * Delay the allocation of colors until they are actually * needed for drawing. */ - return (RadarColorGradient) grad; + return (ZnColorGradient) grad; } /* *-------------------------------------------------------------- * - * RadarNameOfColorGradient -- + * ZnNameOfColorGradient -- * * Given a gradient, return a textual string identifying * the gradient. This can be either a single color (for - * gradients allocated by RadarGetReliefGradient) or a + * gradients allocated by ZnGetReliefGradient) or a * full gradient spec: color1:color2:steps. * * Results: @@ -1168,7 +1168,7 @@ RadarGetColorGradient(Tcl_Interp *interp, *-------------------------------------------------------------- */ char * -RadarNameOfColorGradient(RadarColorGradient gradient) +ZnNameOfColorGradient(ZnColorGradient gradient) { ColorGradient *grad = (ColorGradient *) gradient; @@ -1179,7 +1179,7 @@ RadarNameOfColorGradient(RadarColorGradient gradient) /* *-------------------------------------------------------------- * - * RadarFreeColorGradient -- + * ZnFreeColorGradient -- * * This procedure is called when a gradient is no longer * needed. It frees the resources associated with the @@ -1195,7 +1195,7 @@ RadarNameOfColorGradient(RadarColorGradient gradient) *-------------------------------------------------------------- */ void -RadarFreeColorGradient(RadarColorGradient gradient) +ZnFreeColorGradient(ZnColorGradient gradient) { ColorGradient *grad = (ColorGradient *) gradient; int i; @@ -1204,10 +1204,10 @@ RadarFreeColorGradient(RadarColorGradient gradient) if (grad->ref_count == 0) { for (i = 0; i < grad->num_colors; i++) { if (grad->colors[i] != NULL) { - RadarFreeColor(grad->colors[i]); + ZnFreeColor(grad->colors[i]); } } Tcl_DeleteHashEntry(grad->hash); - RadarFree(grad); + ZnFree(grad); } } diff --git a/generic/Color.h b/generic/Color.h index 548b946..53da97b 100644 --- a/generic/Color.h +++ b/generic/Color.h @@ -34,23 +34,23 @@ #include "Types.h" -typedef struct _ColorGradient *RadarColorGradient; - -XColor *RadarGetColor(Tcl_Interp *interp, Tk_Window tkwin, Tk_Uid name); -XColor *RadarGetColorByValue(Tk_Window tkwin, XColor *color); -char *RadarNameOfColor(XColor *color); -void RadarFreeColor(XColor *color); - -RadarColorGradient RadarGetColorGradient(Tcl_Interp *interp, Tk_Window tkwin, - Tk_Uid name); -RadarColorGradient RadarGetColorGradientByValue(RadarColorGradient gradient); -RadarColorGradient RadarGetReliefGradient(Tcl_Interp *interp, Tk_Window tkwin, - Tk_Uid name); -int RadarColorGradientSpan(RadarColorGradient); -int RadarColorGradientPixel(RadarColorGradient gradient, Tk_Window tkwin, - int color_index); -char *RadarNameOfColorGradient(RadarColorGradient gradient); -void RadarFreeColorGradient(RadarColorGradient gradient); +typedef struct _ColorGradient *ZnColorGradient; + +XColor *ZnGetColor(Tcl_Interp *interp, Tk_Window tkwin, Tk_Uid name); +XColor *ZnGetColorByValue(Tk_Window tkwin, XColor *color); +char *ZnNameOfColor(XColor *color); +void ZnFreeColor(XColor *color); + +ZnColorGradient ZnGetColorGradient(Tcl_Interp *interp, Tk_Window tkwin, + Tk_Uid name); +ZnColorGradient ZnGetColorGradientByValue(ZnColorGradient gradient); +ZnColorGradient ZnGetReliefGradient(Tcl_Interp *interp, Tk_Window tkwin, + Tk_Uid name); +int ZnColorGradientSpan(ZnColorGradient); +int ZnColorGradientPixel(ZnColorGradient gradient, Tk_Window tkwin, + int color_index); +char *ZnNameOfColorGradient(ZnColorGradient gradient); +void ZnFreeColorGradient(ZnColorGradient gradient); #endif /* _Color_h */ diff --git a/generic/Curve.c b/generic/Curve.c index 5942fda..0d17e09 100644 --- a/generic/Curve.c +++ b/generic/Curve.c @@ -47,20 +47,20 @@ 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 SMOOTHED_BIT 1<<2 /* If we `smooth' the path with Bezier curves */ -#define BEZIER_BIT 1<<3 /* If we interpret the vertices as Bezier controls. */ - -#define CCW 1<<5 /* Tell if the vertices are described in - * clockwise or ccw order. */ -#define FIRST_END_OK 1<<6 -#define LAST_END_OK 1<<7 -#define FILLED_OK 1<<8 -#define SMOOTHED_OK 1<<9 -#define RELIEF_OK 1<<10 -#define BEZIER_OK 1<<11 -#define MARKER_OK 1<<12 +#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 SMOOTHED_BIT 1<<2 /* If we `smooth' the path with Bezier curves */ +#define BEZIER_BIT 1<<3 /* If we interpret the vertices as Bezier controls. */ + +#define CCW 1<<5 /* Tell if the vertices are described in + * clockwise or ccw order. */ +#define FIRST_END_OK 1<<6 +#define LAST_END_OK 1<<7 +#define FILLED_OK 1<<8 +#define SMOOTHED_OK 1<<9 +#define RELIEF_OK 1<<10 +#define BEZIER_OK 1<<11 +#define MARKER_OK 1<<12 /* @@ -74,7 +74,7 @@ typedef struct _CurveItemStruct { ItemStruct header; /* Public data */ - RadarList points; + ZnList points; unsigned int flags; Pixmap marker; LineEnd first_end; /* These two are considered only if relief is flat */ @@ -85,84 +85,84 @@ typedef struct _CurveItemStruct { ReliefStyle relief; int line_width; /* If 0 the path is not drawn, if <2 relief is flat */ Pixmap fill_pattern; - RadarColor fill_color; + ZnColor fill_color; Pixmap line_pattern; - RadarColor line_color; - RadarColor marker_color; + ZnColor line_color; + ZnColor marker_color; char *tile_name; /* Private data */ - RadarImage tile; - RadarList dev_points; - RadarColorGradient gradient; + ZnImage tile; + ZnList dev_points; + ZnColorGradient gradient; } CurveItemStruct, *CurveItem; /* - * Need RADAR_COORDS_FLAG in -smoothed and -bezier because + * Need ZN_COORDS_FLAG in -smoothed and -bezier because * -relief may need a reversing of vertices and this is done * lazily. */ -static RadarAttrConfig cv_attrs[] = { - { RADAR_CONFIG_BOOL, "-bezier", NULL, +static ZnAttrConfig cv_attrs[] = { + { ZN_CONFIG_BOOL, "-bezier", NULL, Tk_Offset(CurveItemStruct, flags), BEZIER_BIT, - RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_CAP_STYLE, "-capstyle", NULL, + ZN_COORDS_FLAG, False }, + { ZN_CONFIG_CAP_STYLE, "-capstyle", NULL, Tk_Offset(CurveItemStruct, cap_style), 0, - RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_BOOL, "-composerotation", NULL, + ZN_COORDS_FLAG, False }, + { ZN_CONFIG_BOOL, "-composerotation", NULL, Tk_Offset(CurveItemStruct, 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(CurveItemStruct, header.flags), COMPOSE_SCALE_BIT, - RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_COLOR, "-fillcolor", NULL, + ZN_COORDS_FLAG, False }, + { ZN_CONFIG_COLOR, "-fillcolor", NULL, Tk_Offset(CurveItemStruct, fill_color), 0, - RADAR_DRAW_FLAG|RADAR_BORDER_FLAG, False }, - { RADAR_CONFIG_PATTERN, "-fillpattern", NULL, - Tk_Offset(CurveItemStruct, fill_pattern), 0, RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_BOOL, "-filled", NULL, - Tk_Offset(CurveItemStruct, flags), FILLED_BIT, RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_LINE_END, "-firstend", NULL, - Tk_Offset(CurveItemStruct, first_end), 0, RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_JOIN_STYLE, "-joinstyle", NULL, + ZN_DRAW_FLAG|ZN_BORDER_FLAG, False }, + { ZN_CONFIG_PATTERN, "-fillpattern", NULL, + Tk_Offset(CurveItemStruct, fill_pattern), 0, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_BOOL, "-filled", NULL, + Tk_Offset(CurveItemStruct, flags), FILLED_BIT, ZN_COORDS_FLAG, False }, + { ZN_CONFIG_LINE_END, "-firstend", NULL, + Tk_Offset(CurveItemStruct, first_end), 0, ZN_COORDS_FLAG, False }, + { ZN_CONFIG_JOIN_STYLE, "-joinstyle", NULL, Tk_Offset(CurveItemStruct, join_style), 0, - RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_LINE_END, "-lastend", NULL, - Tk_Offset(CurveItemStruct, last_end), 0, RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_COLOR, "-linecolor", NULL, + ZN_COORDS_FLAG, False }, + { ZN_CONFIG_LINE_END, "-lastend", NULL, + Tk_Offset(CurveItemStruct, last_end), 0, ZN_COORDS_FLAG, False }, + { ZN_CONFIG_COLOR, "-linecolor", NULL, Tk_Offset(CurveItemStruct, line_color), 0, - RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_PATTERN, "-linepattern", NULL, - Tk_Offset(CurveItemStruct, line_pattern), 0, RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_LINE_STYLE, "-linestyle", NULL, - Tk_Offset(CurveItemStruct, line_style), 0, RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_DIM, "-linewidth", NULL, - Tk_Offset(CurveItemStruct, line_width), 0, RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_PRI, "-priority", NULL, + ZN_DRAW_FLAG, False }, + { ZN_CONFIG_PATTERN, "-linepattern", NULL, + Tk_Offset(CurveItemStruct, line_pattern), 0, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_LINE_STYLE, "-linestyle", NULL, + Tk_Offset(CurveItemStruct, line_style), 0, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_DIM, "-linewidth", NULL, + Tk_Offset(CurveItemStruct, line_width), 0, ZN_COORDS_FLAG, False }, + { ZN_CONFIG_PRI, "-priority", NULL, Tk_Offset(CurveItemStruct, header.priority), 0, - RADAR_DRAW_FLAG|RADAR_REPICK_FLAG, False }, - { RADAR_CONFIG_PATTERN, "-marker", NULL, - Tk_Offset(CurveItemStruct, marker), 0, RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_COLOR, "-markercolor", NULL, - Tk_Offset(CurveItemStruct, marker_color), 0, RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_RELIEF, "-relief", NULL, Tk_Offset(CurveItemStruct, relief), 0, - RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_BOOL, "-sensitive", NULL, + ZN_DRAW_FLAG|ZN_REPICK_FLAG, False }, + { ZN_CONFIG_PATTERN, "-marker", NULL, + Tk_Offset(CurveItemStruct, marker), 0, ZN_COORDS_FLAG, False }, + { ZN_CONFIG_COLOR, "-markercolor", NULL, + Tk_Offset(CurveItemStruct, marker_color), 0, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_RELIEF, "-relief", NULL, Tk_Offset(CurveItemStruct, relief), 0, + ZN_COORDS_FLAG, False }, + { ZN_CONFIG_BOOL, "-sensitive", NULL, Tk_Offset(CurveItemStruct, header.flags), SENSITIVE_BIT, - RADAR_REPICK_FLAG, False }, - { RADAR_CONFIG_BOOL, "-smoothed", NULL, + ZN_REPICK_FLAG, False }, + { ZN_CONFIG_BOOL, "-smoothed", NULL, Tk_Offset(CurveItemStruct, flags), SMOOTHED_BIT, - RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_TAGS, "-tags", NULL, + ZN_COORDS_FLAG, False }, + { ZN_CONFIG_TAGS, "-tags", NULL, Tk_Offset(CurveItemStruct, header.tags), 0, 0, False }, - { RADAR_CONFIG_IMAGE, "-tile", NULL, + { ZN_CONFIG_IMAGE, "-tile", NULL, Tk_Offset(CurveItemStruct, 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(CurveItemStruct, 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 } }; @@ -175,17 +175,17 @@ static RadarAttrConfig cv_attrs[] = { */ static void CvTileChange(ClientData client_data, - int x, - int y, - int width, - int height, - int image_width, - int image_height) + int x, + int y, + int width, + int height, + int image_width, + int image_height) { CurveItem cv = (CurveItem) client_data; InvalidateImage(cv->tile); - ITEM.Invalidate((Item) cv, RADAR_COORDS_FLAG); + ITEM.Invalidate((Item) cv, ZN_COORDS_FLAG); } @@ -205,7 +205,7 @@ Init(Item item, CurveItem cv = (CurveItem) item; Arg *elems; int i, result, num_elems; - RadarPoint p; + ZnPoint p; #ifdef PTK LangFreeProc *freeProc = NULL; #endif @@ -222,10 +222,10 @@ Init(Item item, if (*argc < 1) { Tcl_AppendResult(wi->interp, " curve 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%2) != 0)) { + if ((result == ZN_ERROR) || ((num_elems%2) != 0)) { cv_error: #ifdef PTK if (elems != NULL && freeProc) { @@ -233,24 +233,24 @@ Init(Item item, } #endif Tcl_AppendResult(wi->interp, " malformed curve coords", NULL); - return RADAR_ERROR; + return ZN_ERROR; } - cv->points = RadarListNew(num_elems/2, sizeof(RadarPoint)); + cv->points = ZnListNew(num_elems/2, sizeof(ZnPoint)); for (i = 0; i < num_elems; i += 2) { - if (Tcl_GetDouble(wi->interp, elems[i], &p.x) == RADAR_ERROR) { + if (Tcl_GetDouble(wi->interp, elems[i], &p.x) == ZN_ERROR) { cv_error2: #ifndef PTK Tcl_Free((char *) elems); #endif - RadarListFree(cv->points); + ZnListFree(cv->points); cv->points = NULL; goto cv_error; } - if (Tcl_GetDouble(wi->interp, elems[i+1], &p.y) == RADAR_ERROR) { + if (Tcl_GetDouble(wi->interp, elems[i+1], &p.y) == ZN_ERROR) { goto cv_error2; } - RadarListAdd(cv->points, &p, RadarListTail); + ZnListAdd(cv->points, &p, ZnListTail); } (*args)++; (*argc)--; @@ -271,9 +271,9 @@ Init(Item item, cv->relief = RELIEF_FLAT; cv->line_width = 1; cv->tile_name = ""; - cv->tile = RadarUnspecifiedImage; - cv->fill_pattern = RadarUnspecifiedPattern; - cv->line_pattern = RadarUnspecifiedPattern; + cv->tile = ZnUnspecifiedImage; + cv->fill_pattern = ZnUnspecifiedPattern; + cv->line_pattern = ZnUnspecifiedPattern; cv->cap_style = CapRound; cv->join_style = JoinRound; @@ -282,12 +282,12 @@ Init(Item item, * being unspecified. */ SET(cv->flags, MARKED_BIT); - cv->marker = RadarUnspecifiedPattern; - cv->fill_color = RadarGetColorByValue(wi->win, wi->fore_color); - cv->line_color = RadarGetColorByValue(wi->win, wi->fore_color); - cv->marker_color = RadarGetColorByValue(wi->win, wi->fore_color); + cv->marker = ZnUnspecifiedPattern; + cv->fill_color = ZnGetColorByValue(wi->win, wi->fore_color); + cv->line_color = ZnGetColorByValue(wi->win, wi->fore_color); + cv->marker_color = ZnGetColorByValue(wi->win, wi->fore_color); - return RADAR_OK; + return ZN_OK; } @@ -308,12 +308,12 @@ Clone(Item item) cv->dev_points = NULL; if (cv->gradient) { - cv->gradient = RadarGetColorGradientByValue(cv->gradient); + cv->gradient = ZnGetColorGradientByValue(cv->gradient); } if (cv->points) { - cv->points = RadarListDuplicate(cv->points); + cv->points = ZnListDuplicate(cv->points); } - if (cv->line_pattern != RadarUnspecifiedPattern) { + if (cv->line_pattern != ZnUnspecifiedPattern) { cv->line_pattern = Tk_GetBitmap(wi->interp, wi->win, Tk_NameOfBitmap(wi->dpy, cv->line_pattern)); } @@ -324,23 +324,23 @@ Clone(Item item) LineEndDuplicate(cv->last_end); } if (strlen(cv->tile_name) != 0) { - text = RadarMalloc((strlen(cv->tile_name) + 1) * sizeof(char)); + text = ZnMalloc((strlen(cv->tile_name) + 1) * sizeof(char)); strcpy(text, cv->tile_name); cv->tile_name = text; cv->tile = Tk_GetImage(wi->interp, wi->win, cv->tile_name, CvTileChange, (ClientData) cv); } - if (cv->fill_pattern != RadarUnspecifiedPattern) { + if (cv->fill_pattern != ZnUnspecifiedPattern) { cv->fill_pattern = Tk_GetBitmap(wi->interp, wi->win, Tk_NameOfBitmap(wi->dpy, cv->fill_pattern)); } - if (cv->marker != RadarUnspecifiedPattern) { + if (cv->marker != ZnUnspecifiedPattern) { cv->marker = Tk_GetBitmap(wi->interp, wi->win, Tk_NameOfBitmap(wi->dpy, cv->marker)); } - cv->line_color = RadarGetColorByValue(wi->win, cv->line_color); - cv->fill_color = RadarGetColorByValue(wi->win, cv->fill_color); - cv->marker_color = RadarGetColorByValue(wi->win, cv->marker_color); + cv->line_color = ZnGetColorByValue(wi->win, cv->line_color); + cv->fill_color = ZnGetColorByValue(wi->win, cv->fill_color); + cv->marker_color = ZnGetColorByValue(wi->win, cv->marker_color); } @@ -358,10 +358,10 @@ Destroy(Item item) CurveItem cv = (CurveItem) item; if (cv->points) { - RadarListFree(cv->points); + ZnListFree(cv->points); } if (cv->dev_points) { - RadarListFree(cv->dev_points); + ZnListFree(cv->dev_points); } if (cv->first_end) { LineEndDelete(cv->first_end); @@ -370,27 +370,27 @@ Destroy(Item item) LineEndDelete(cv->last_end); } if (cv->gradient) { - RadarFreeColorGradient(cv->gradient); + ZnFreeColorGradient(cv->gradient); } if (strlen(cv->tile_name) != 0) { - RadarFree(cv->tile_name); + ZnFree(cv->tile_name); } - if (cv->tile != RadarUnspecifiedImage) { + if (cv->tile != ZnUnspecifiedImage) { Tk_FreeImage(cv->tile); - cv->tile = RadarUnspecifiedImage; + cv->tile = ZnUnspecifiedImage; } - if (cv->line_pattern != RadarUnspecifiedPattern) { + if (cv->line_pattern != ZnUnspecifiedPattern) { Tk_FreeBitmap(wi->dpy, cv->line_pattern); } - if (cv->fill_pattern != RadarUnspecifiedPattern) { + if (cv->fill_pattern != ZnUnspecifiedPattern) { Tk_FreeBitmap(wi->dpy, cv->fill_pattern); } - if (cv->marker != RadarUnspecifiedPattern) { + if (cv->marker != ZnUnspecifiedPattern) { Tk_FreeBitmap(wi->dpy, cv->marker); } - RadarFreeColor(cv->fill_color); - RadarFreeColor(cv->line_color); - RadarFreeColor(cv->marker_color); + ZnFreeColor(cv->fill_color); + ZnFreeColor(cv->line_color); + ZnFreeColor(cv->marker_color); } @@ -406,33 +406,33 @@ static void SetRenderFlags(CurveItem cv) { ASSIGN(cv->flags, FILLED_OK, - ISSET(cv->flags, FILLED_BIT) && (RadarListSize(cv->points) > 2)); + ISSET(cv->flags, FILLED_BIT) && (ZnListSize(cv->points) > 2)); ASSIGN(cv->flags, BEZIER_OK, - ISSET(cv->flags, BEZIER_BIT) && (RadarListSize(cv->points) > 2) && + ISSET(cv->flags, BEZIER_BIT) && (ZnListSize(cv->points) > 2) && (ISSET(cv->flags, FILLED_BIT) || cv->line_width)); ASSIGN(cv->flags, SMOOTHED_OK, - ISSET(cv->flags, SMOOTHED_BIT) && (RadarListSize(cv->points) > 2) && + ISSET(cv->flags, SMOOTHED_BIT) && (ZnListSize(cv->points) > 2) && ISCLEAR(cv->flags, BEZIER_OK) && (ISSET(cv->flags, FILLED_BIT) || cv->line_width)); ASSIGN(cv->flags, RELIEF_OK, - (cv->relief != RELIEF_FLAT) && (RadarListSize(cv->points) > 1) && + (cv->relief != RELIEF_FLAT) && (ZnListSize(cv->points) > 1) && (cv->line_width > 1) && ISCLEAR(cv->flags, SMOOTHED_OK) && ISCLEAR(cv->flags, BEZIER_OK)); ASSIGN(cv->flags, MARKER_OK, - (cv->marker != RadarUnspecifiedPattern) && ISCLEAR(cv->flags, BEZIER_OK) && + (cv->marker != ZnUnspecifiedPattern) && ISCLEAR(cv->flags, BEZIER_OK) && ISCLEAR(cv->flags, SMOOTHED_OK) && ISCLEAR(cv->flags, RELIEF_OK)); ASSIGN(cv->flags, FIRST_END_OK, - (cv->first_end != NULL) && (RadarListSize(cv->points) > 1) && + (cv->first_end != NULL) && (ZnListSize(cv->points) > 1) && ISCLEAR(cv->flags, FILLED_BIT) && cv->line_width && ISCLEAR(cv->flags, RELIEF_OK)); ASSIGN(cv->flags, LAST_END_OK, - (cv->last_end != NULL) && (RadarListSize(cv->points) > 1) && + (cv->last_end != NULL) && (ZnListSize(cv->points) > 1) && ISCLEAR(cv->flags, FILLED_BIT) && cv->line_width && ISCLEAR(cv->flags, RELIEF_OK)); } @@ -448,26 +448,26 @@ SetRenderFlags(CurveItem cv) static int Configure(Item item, int argc, - RadarAttrList argv, + ZnAttrList argv, int *flags) { WidgetInfo *wi = item->wi; CurveItem cv = (CurveItem) 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 (cv->gradient && - (ISSET(*flags, RADAR_BORDER_FLAG) || (cv->relief == RELIEF_FLAT))) { - RadarFreeColorGradient(cv->gradient); + (ISSET(*flags, ZN_BORDER_FLAG) || (cv->relief == RELIEF_FLAT))) { + ZnFreeColorGradient(cv->gradient); cv->gradient = NULL; } if ((cv->relief != RELIEF_FLAT) && !cv->gradient) { - cv->gradient = RadarGetReliefGradient(wi->interp, wi->win, - RadarNameOfColor(cv->fill_color)); + cv->gradient = ZnGetReliefGradient(wi->interp, wi->win, + ZnNameOfColor(cv->fill_color)); } - if (ISSET(*flags, RADAR_TILE_FLAG)) { + if (ISSET(*flags, ZN_TILE_FLAG)) { Tk_Image tile; if (strcmp(cv->tile_name, "") != 0) { @@ -478,13 +478,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 (cv->tile != RadarUnspecifiedImage) { + if (cv->tile != ZnUnspecifiedImage) { Tk_FreeImage(cv->tile); } cv->tile = tile; @@ -492,7 +492,7 @@ Configure(Item item, SetRenderFlags(cv); - return RADAR_OK; + return ZN_OK; } @@ -506,22 +506,22 @@ 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; } -static RadarBool -TestCCW(RadarPoint *points, - int num_points) +static ZnBool +TestCCW(ZnPoint *points, + int num_points) { - RadarPoint *p, *p_p, *p_n, min; - RadarReal xprod; + ZnPoint *p, *p_p, *p_n, min; + ZnReal xprod; int i, min_index; if (num_points < 3) { @@ -565,16 +565,16 @@ TestCCW(RadarPoint *points, */ static void ComputeCoordinates(Item item, - RadarBool force) + ZnBool force) { WidgetInfo *wi = item->wi; CurveItem cv = (CurveItem) item; int i, j; - RadarPoint *points; - RadarPoint end_points[LINE_END_POINTS]; - RadarPoint *dev_points, *p; + ZnPoint *points; + ZnPoint end_points[LINE_END_POINTS]; + ZnPoint *dev_points, *p; int num_points; - RadarBBox bbox; + ZnBBox bbox; int lw; ResetBBox(&item->item_bounding_box); @@ -582,17 +582,17 @@ ComputeCoordinates(Item item, return; } - points = (RadarPoint *) RadarListArray(cv->points); - num_points = RadarListSize(cv->points); + points = (ZnPoint *) ZnListArray(cv->points); + num_points = ZnListSize(cv->points); /* * Allocate space for devices coordinates */ if (cv->dev_points == NULL) { - cv->dev_points = RadarListNew(num_points, sizeof(RadarPoint)); + cv->dev_points = ZnListNew(num_points, sizeof(ZnPoint)); } - RadarListAssertSize(cv->dev_points, num_points); - dev_points = (RadarPoint *) RadarListArray(cv->dev_points); + ZnListAssertSize(cv->dev_points, num_points); + dev_points = (ZnPoint *) ZnListArray(cv->dev_points); /* * Process all points, skipping adjacent points that transform @@ -603,7 +603,7 @@ ComputeCoordinates(Item item, * Identical vertices are no longer skipped to allow a better control * on Bezier curves and smoothing. */ - RadarTransformPoint(wi->current_transfo, &points[i], &dev_points[j]); + ZnTransformPoint(wi->current_transfo, &points[i], &dev_points[j]); /* if ((j == 0) || (dev_points[j].x != dev_points[j-1].x) || (dev_points[j].y != dev_points[j-1].y)) { @@ -615,15 +615,15 @@ ComputeCoordinates(Item item, /* * Adjust the device coords list to the actual size. */ - RadarListTruncate(cv->dev_points, j); - /*printf("==========num_points %d=============\n", RadarListSize(cv->dev_points));*/ + ZnListTruncate(cv->dev_points, j); + /*printf("==========num_points %d=============\n", ZnListSize(cv->dev_points));*/ lw = cv->line_width; ASSIGN(cv->flags, CCW, TestCCW(dev_points, num_points)); if (ISCLEAR(cv->flags, CCW)) { if (ISSET(cv->flags, RELIEF_OK)) { - RadarPoint tmp; + ZnPoint tmp; int mid = num_points/2; /* * Revert the points to draw the relief inside. @@ -664,7 +664,7 @@ ComputeCoordinates(Item item, * Take care of miters. */ if (cv->join_style == JoinMiter) { - RadarPoint miter_i, miter_o; + ZnPoint miter_i, miter_o; for (i = j, p = dev_points; i >= 3; i--, p++) { GetMiterPoints(p, p+1, p+2, lw, &miter_i, &miter_o); AddPointToBBox(&item->item_bounding_box, miter_i.x, miter_i.y); @@ -676,8 +676,8 @@ ComputeCoordinates(Item item, * Add the markers. */ if (ISSET(cv->flags, MARKER_OK)) { - int w, h; - RadarBBox bbox; + int w, h; + ZnBBox bbox; Tk_SizeOfBitmap(wi->dpy, cv->marker, &w, &h); w = w/2 + 2; @@ -727,24 +727,24 @@ 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) { CurveItem cv = (CurveItem) item; WidgetInfo *wi = item->wi; - RadarBBox bbox; - RadarPoint *points; - RadarPoint end_points[LINE_END_POINTS]; + ZnBBox bbox; + ZnPoint *points; + ZnPoint end_points[LINE_END_POINTS]; int num_points, result, result2; - RadarList actual_points; + ZnList actual_points; if (cv->dev_points == NULL) { return -1; } - printf("============== poly %d ==============\n", item->id); + /*printf("============== poly %d ==============\n", item->id);*/ if (ISSET(cv->flags, SMOOTHED_OK)) { SmoothPathWithBezier(cv->dev_points, wi->work_pts); actual_points = wi->work_pts; @@ -757,8 +757,8 @@ ToArea(Item item, actual_points = cv->dev_points; } - points = (RadarPoint *) RadarListArray(actual_points); - num_points = RadarListSize(actual_points); + points = (ZnPoint *) ZnListArray(actual_points); + num_points = ZnListSize(actual_points); if (ISSET(cv->flags, FILLED_OK)) { result = PolygonInBBox(points, num_points, area); @@ -808,10 +808,10 @@ ToArea(Item item, */ if (ISSET(cv->flags, MARKER_OK)) { int num_points, width, height; - RadarPoint *points; + ZnPoint *points; - points = (RadarPoint *) RadarListArray(actual_points); - num_points = RadarListSize(actual_points); + points = (ZnPoint *) ZnListArray(actual_points); + num_points = ZnListSize(actual_points); if (ISSET(cv->flags, FIRST_END_OK)) { num_points--; @@ -855,7 +855,7 @@ Draw(Item item) XGCValues values; int i, num_points; unsigned int gc_mask; - RadarPoint *points; + ZnPoint *points; XPoint *xpoints = NULL; if (cv->dev_points == NULL) { @@ -864,26 +864,26 @@ Draw(Item item) if (ISSET(cv->flags, SMOOTHED_OK)) { SmoothPathWithBezier(cv->dev_points, 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); } else if (ISSET(cv->flags, BEZIER_OK)) { GetBezierPath(cv->dev_points, 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); } else { - points = (RadarPoint *) RadarListArray(cv->dev_points); - num_points = RadarListSize(cv->dev_points); + points = (ZnPoint *) ZnListArray(cv->dev_points); + num_points = ZnListSize(cv->dev_points); } /* * Fill if requested. */ if (ISSET(cv->flags, FILLED_OK)) { - values.foreground = RadarPixel(cv->fill_color); + values.foreground = ZnPixel(cv->fill_color); gc_mask = GCFillStyle; - if (cv->tile != RadarUnspecifiedImage) { /* Fill tiled */ + if (cv->tile != ZnUnspecifiedImage) { /* Fill tiled */ Pixmap pmap = GetImagePixmap(wi->win, cv->tile); values.fill_style = FillTiled; values.tile = pmap; @@ -891,7 +891,7 @@ Draw(Item item) values.ts_y_origin = REAL_TO_INT(item->item_bounding_box.orig.y); gc_mask |= GCTileStipXOrigin|GCTileStipYOrigin|GCTile; } - else if (cv->fill_pattern != RadarUnspecifiedPattern) { /* Fill stippled */ + else if (cv->fill_pattern != ZnUnspecifiedPattern) { /* Fill stippled */ values.fill_style = FillStippled; values.stipple = cv->fill_pattern; values.ts_x_origin = REAL_TO_INT(item->item_bounding_box.orig.x); @@ -919,7 +919,7 @@ Draw(Item item) * Draw the lines between points */ if (cv->line_width) { - RadarPoint end_points[LINE_END_POINTS]; + ZnPoint end_points[LINE_END_POINTS]; XPoint xp[LINE_END_POINTS]; /* @@ -931,11 +931,11 @@ Draw(Item item) } else { SetLineStyle(wi->dpy, wi->gc, cv->line_style); - values.foreground = RadarPixel(cv->line_color); + values.foreground = ZnPixel(cv->line_color); values.line_width = (cv->line_width == 1) ? 0 : cv->line_width; values.join_style = cv->join_style; values.cap_style = cv->cap_style; - if (cv->line_pattern == RadarUnspecifiedPattern) { + if (cv->line_pattern == ZnUnspecifiedPattern) { values.fill_style = FillSolid; XChangeGC(wi->dpy, wi->gc, GCFillStyle|GCLineWidth|GCJoinStyle|GCCapStyle|GCForeground, &values); @@ -987,7 +987,7 @@ Draw(Item item) */ if (ISSET(cv->flags, MARKER_OK)) { int width, h_width, height, h_height; - RadarPoint ptmp, *p; + ZnPoint ptmp, *p; int i; i = num_points; @@ -1002,7 +1002,7 @@ Draw(Item item) i--; } - values.foreground = RadarPixel(cv->marker_color); + values.foreground = ZnPixel(cv->marker_color); Tk_SizeOfBitmap(wi->dpy, cv->marker, &width, &height); h_width = (width+1)/2; h_height = (height+1)/2; @@ -1027,8 +1027,8 @@ Draw(Item item) * guess that drawing points is useful. */ if (ISCLEAR(cv->flags, FILLED_OK) && !cv->line_width && - (cv->marker == RadarUnspecifiedPattern)) { - values.foreground = RadarPixel(cv->marker_color); + (cv->marker == ZnUnspecifiedPattern)) { + values.foreground = ZnPixel(cv->marker_color); values.fill_style = FillSolid; XChangeGC(wi->dpy, wi->gc, GCForeground | GCFillStyle, &values); @@ -1051,12 +1051,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)); } @@ -1069,7 +1069,7 @@ IsSensitive(Item item, */ static double Pick(Item item, - RadarPoint *p, + ZnPoint *p, Item start_item, int aperture, Item *a_item, @@ -1077,12 +1077,12 @@ Pick(Item item, { CurveItem cv = (CurveItem) item; WidgetInfo *wi = item->wi; - RadarBBox bbox; + ZnBBox bbox; double dist=1.0e40, new_dist; - RadarPoint *points; - RadarPoint end_points[LINE_END_POINTS]; + ZnPoint *points; + ZnPoint end_points[LINE_END_POINTS]; int num_points; - RadarList actual_points; + ZnList actual_points; if (cv->dev_points == NULL) { return dist; @@ -1101,8 +1101,8 @@ Pick(Item item, actual_points = cv->dev_points; } - points = (RadarPoint *) RadarListArray(actual_points); - num_points = RadarListSize(actual_points); + points = (ZnPoint *) ZnListArray(actual_points); + num_points = ZnListSize(actual_points); if (ISSET(cv->flags, FILLED_OK)) { dist = PolygonToPointDist(points, num_points, p); @@ -1164,10 +1164,10 @@ Pick(Item item, */ if (ISSET(cv->flags, MARKER_OK)) { int num_points, width, height; - RadarPoint *points; + ZnPoint *points; - points = (RadarPoint *) RadarListArray(actual_points); - num_points = RadarListSize(actual_points); + points = (ZnPoint *) ZnListArray(actual_points); + num_points = ZnListSize(actual_points); if (ISSET(cv->flags, FIRST_END_OK)) { num_points--; @@ -1221,10 +1221,10 @@ PostScript(Item item, * ********************************************************************************** */ -static RadarBool -GetClipVertices(Item item, - RadarPoint **points, - int *num_points) +static ZnBool +GetClipVertices(Item item, + ZnPoint **points, + int *num_points) { CurveItem cv = (CurveItem) item; @@ -1232,8 +1232,8 @@ GetClipVertices(Item item, *num_points = 0; if (cv->dev_points) { - *points = (RadarPoint *) RadarListArray(cv->dev_points); - *num_points = RadarListSize(cv->dev_points); + *points = (ZnPoint *) ZnListArray(cv->dev_points); + *num_points = ZnListSize(cv->dev_points); } return False; @@ -1249,64 +1249,64 @@ 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) { CurveItem cv = (CurveItem) item; int num_points, i; - RadarPoint *points; + ZnPoint *points; if ((cmd == COORDS_REPLACE) || (cmd == COORDS_REPLACE_ALL)) { if (*num_pts == 0) { Tcl_AppendResult(item->wi->interp, " coords command need at least 1 point on curves", NULL); - return RADAR_ERROR; + return ZN_ERROR; } if (cmd == COORDS_REPLACE_ALL) { - RadarList tmp; + ZnList tmp; replace_all: - tmp = RadarListFromArray(*pts, *num_pts, sizeof(RadarPoint)); + tmp = ZnListFromArray(*pts, *num_pts, sizeof(ZnPoint)); if (!cv->points) { - RadarListEmpty(cv->points); + ZnListEmpty(cv->points); } else { - cv->points = RadarListNew(*num_pts, sizeof(RadarPoint)); + cv->points = ZnListNew(*num_pts, sizeof(ZnPoint)); } - RadarListAppend(cv->points, tmp); - RadarListFree(tmp); + ZnListAppend(cv->points, tmp); + ZnListFree(tmp); } else { if (!cv->points) { edit_err: Tcl_AppendResult(item->wi->interp, " coords command cannot edit empty curves", NULL); - return RADAR_ERROR; + return ZN_ERROR; } - points = RadarListArray(cv->points); - num_points = RadarListSize(cv->points); + points = ZnListArray(cv->points); + num_points = ZnListSize(cv->points); if (index < 0) { index += num_points; } if ((index < 0) || (index >= num_points)) { range_err: Tcl_AppendResult(item->wi->interp, " coord index out of range", NULL); - return RADAR_ERROR; + return ZN_ERROR; } points[index] = (*pts)[0]; } - ITEM.Invalidate(item, RADAR_COORDS_FLAG); + ITEM.Invalidate(item, ZN_COORDS_FLAG); } else if ((cmd == COORDS_READ) || (cmd == COORDS_READ_ALL)) { if (!cv->points) { *num_pts = 0; *pts = NULL; - return RADAR_OK; + return ZN_OK; } - points = RadarListArray(cv->points); - num_points = RadarListSize(cv->points); + points = ZnListArray(cv->points); + num_points = ZnListSize(cv->points); if (cmd == COORDS_READ_ALL) { *num_pts = num_points; *pts = points; @@ -1327,7 +1327,7 @@ Coords(Item item, goto replace_all; } else if (cmd == COORDS_ADD) { - num_points = RadarListSize(cv->points); + num_points = ZnListSize(cv->points); if (index < 0) { index += num_points; } @@ -1335,34 +1335,34 @@ Coords(Item item, goto range_err; } for (i = 0; i < *num_pts; i++, index++) { - RadarListAdd(cv->points, &(*pts)[i], index); + ZnListAdd(cv->points, &(*pts)[i], index); } } else { - RadarList tmp; - tmp = RadarListFromArray(*pts, *num_pts, sizeof(RadarPoint)); - RadarListAppend(cv->points, tmp); - RadarListFree(tmp); + ZnList tmp; + tmp = ZnListFromArray(*pts, *num_pts, sizeof(ZnPoint)); + ZnListAppend(cv->points, tmp); + ZnListFree(tmp); } - ITEM.Invalidate(item, RADAR_COORDS_FLAG); + ITEM.Invalidate(item, ZN_COORDS_FLAG); } else if (cmd == COORDS_REMOVE) { if (!cv->points) { goto edit_err; } - points = RadarListArray(cv->points); - num_points = RadarListSize(cv->points); + points = ZnListArray(cv->points); + num_points = ZnListSize(cv->points); if (index < 0) { index += num_points; } if ((index < 0) || (index >= num_points)) { goto range_err; } - RadarListDelete(cv->points, index); - ITEM.Invalidate(item, RADAR_COORDS_FLAG); + ZnListDelete(cv->points, index); + ITEM.Invalidate(item, ZN_COORDS_FLAG); } - return RADAR_OK; + return ZN_OK; } @@ -1397,4 +1397,4 @@ static ItemClassStruct CURVE_ITEM_CLASS = { PostScript }; -RadarItemClassId RadarCurve = (RadarItemClassId) &CURVE_ITEM_CLASS; +ZnItemClassId ZnCurve = (ZnItemClassId) &CURVE_ITEM_CLASS; diff --git a/generic/Draw.c b/generic/Draw.c index f0ace86..26d952f 100644 --- a/generic/Draw.c +++ b/generic/Draw.c @@ -140,14 +140,14 @@ SetLineStyle(Display *display, ********************************************************************************** */ void -GetLineShape(RadarPoint *p1, - RadarPoint *p2, +GetLineShape(ZnPoint *p1, + ZnPoint *p2, unsigned int line_width, LineShape shape, - RadarBBox *bbox, - RadarList to_points) + ZnBBox *bbox, + ZnList to_points) { - RadarPoint *points; + ZnPoint *points; int num_points, i; /* @@ -162,8 +162,8 @@ GetLineShape(RadarPoint *p1, double temp; num_points = LIGHTNING_POINTS; - RadarListAssertSize(to_points, num_points); - points = (RadarPoint *) RadarListArray(to_points); + ZnListAssertSize(to_points, num_points); + points = (ZnPoint *) ZnListArray(to_points); points[0] = *p1; points[3] = *p2; @@ -193,8 +193,8 @@ GetLineShape(RadarPoint *p1, else if (shape == LINE_LEFT_CORNER || shape == LINE_RIGHT_CORNER) { num_points = CORNER_POINTS; - RadarListAssertSize(to_points, num_points); - points = (RadarPoint *) RadarListArray(to_points); + ZnListAssertSize(to_points, num_points); + points = (ZnPoint *) ZnListArray(to_points); points[0] = *p1; points[2] = *p2; @@ -213,8 +213,8 @@ GetLineShape(RadarPoint *p1, int dx, dy; num_points = DOUBLE_CORNER_POINTS; - RadarListAssertSize(to_points, num_points); - points = (RadarPoint *) RadarListArray(to_points); + ZnListAssertSize(to_points, num_points); + points = (ZnPoint *) ZnListArray(to_points); points[0] = *p1; points[3] = *p2; @@ -234,8 +234,8 @@ GetLineShape(RadarPoint *p1, } else /* if (shape) == LINE_STRAIGHT) */ { num_points = STRAIGHT_POINTS; - RadarListAssertSize(to_points, num_points); - points = (RadarPoint *) RadarListArray(to_points); + ZnListAssertSize(to_points, num_points); + points = (ZnPoint *) ZnListArray(to_points); points[0] = *p1; points[1] = *p2; @@ -279,10 +279,10 @@ void DrawLineShape(Display *display, Drawable draw_buffer, GC gc, - RadarPoint *p, + ZnPoint *p, int num_p, LineStyle line_style, - RadarColor foreground, + ZnColor foreground, unsigned int line_width, LineShape shape) { @@ -294,7 +294,7 @@ DrawLineShape(Display *display, * Setup GC. */ SetLineStyle(display, gc, line_style); - values.foreground = RadarPixel(foreground); + values.foreground = ZnPixel(foreground); values.line_width = (line_width == 1) ? 0 : line_width; values.fill_style = FillSolid; values.join_style = JoinRound; @@ -321,7 +321,7 @@ DrawLineShape(Display *display, void DrawRectangleRelief(WidgetInfo *wi, ReliefStyle relief, - RadarColorGradient gradient, + ZnColorGradient gradient, XRectangle *bbox, unsigned int line_width) { @@ -362,10 +362,10 @@ DrawRectangleRelief(WidgetInfo *wi, gc_values.fill_style = FillSolid; if (relief == RELIEF_BEVEL_IN) { - gc_values.foreground = RadarColorGradientPixel(gradient, wi->win, -1); + gc_values.foreground = ZnColorGradientPixel(gradient, wi->win, -1); } else { - gc_values.foreground = RadarColorGradientPixel(gradient, wi->win, 0); + gc_values.foreground = ZnColorGradientPixel(gradient, wi->win, 0); } XChangeGC(wi->dpy, wi->gc, GCFillStyle|GCForeground, &gc_values); XFillRectangle(wi->dpy, wi->draw_buffer, wi->gc, @@ -376,10 +376,10 @@ DrawRectangleRelief(WidgetInfo *wi, line_width, bbox->height); if (relief == RELIEF_BEVEL_IN) { - gc_values.foreground = RadarColorGradientPixel(gradient, wi->win, 0); + gc_values.foreground = ZnColorGradientPixel(gradient, wi->win, 0); } else { - gc_values.foreground = RadarColorGradientPixel(gradient, wi->win, -1); + gc_values.foreground = ZnColorGradientPixel(gradient, wi->win, -1); } XChangeGC(wi->dpy, wi->gc, GCFillStyle|GCForeground, &gc_values); top_points[0].x = top_points[1].x = top_points[6].x = bbox->x; @@ -396,45 +396,45 @@ DrawRectangleRelief(WidgetInfo *wi, static void -DoPolygonRelief(RadarPoint *p, +DoPolygonRelief(ZnPoint *p, int num_points, unsigned int line_width, int what_to_do, ...) { int i, j, processed_points, *result; - RadarPoint *p1, *p2; - RadarPoint pp1, pp2, new_pp1, new_pp2; - RadarPoint perp, c, shift1, shift2; - RadarPoint bevel_points[4]; + ZnPoint *p1, *p2; + ZnPoint pp1, pp2, new_pp1, new_pp2; + ZnPoint perp, c, shift1, shift2; + ZnPoint bevel_points[4]; XPoint bevel_xpoints[4]; - RadarBool parallel, closed; + ZnBool parallel, closed; WidgetInfo *wi = NULL; ReliefStyle relief = 0; - RadarColorGradient gradient = NULL; - RadarPoint *pp = NULL; + ZnColorGradient gradient = NULL; + ZnPoint *pp = NULL; double *dist = NULL; - RadarBBox *bbox = NULL; + ZnBBox *bbox = NULL; va_list var; va_start(var, what_to_do); if (what_to_do == POLYGON_RELIEF_DIST) { - pp = va_arg(var, RadarPoint *); + pp = va_arg(var, ZnPoint *); dist = va_arg(var, double *); *dist = 1.0e40; } if (what_to_do == POLYGON_RELIEF_IN_BBOX) { - bbox = va_arg(var, RadarBBox *); + bbox = va_arg(var, ZnBBox *); result = va_arg(var, int *); } else if (what_to_do == POLYGON_RELIEF_BBOX) { - bbox = va_arg(var, RadarBBox *); + bbox = va_arg(var, ZnBBox *); ResetBBox(bbox); } else if (what_to_do == POLYGON_RELIEF_DRAW) { wi = va_arg(var, WidgetInfo *); relief = va_arg(var, int); - gradient = va_arg(var, RadarColorGradient); + gradient = va_arg(var, ZnColorGradient); } va_end(var); @@ -556,7 +556,7 @@ DoPolygonRelief(RadarPoint *p, if ((processed_points >= 2) || (!closed && (processed_points == 1))) { if (what_to_do == POLYGON_RELIEF_DIST) { - double new_dist; + double new_dist; new_dist = PolygonToPointDist(bevel_points, 4, pp); if (new_dist < 0) { @@ -586,8 +586,8 @@ DoPolygonRelief(RadarPoint *p, } } else if (what_to_do == POLYGON_RELIEF_DRAW) { - RadarReal dx, dy; - RadarBool light_on_left; + ZnReal dx, dy; + ZnBool light_on_left; XGCValues gc_values; dx = bevel_points[3].x - bevel_points[0].x; @@ -601,10 +601,10 @@ DoPolygonRelief(RadarPoint *p, gc_values.fill_style = FillSolid; if (light_on_left ^ (relief == RELIEF_BEVEL_OUT)) { - gc_values.foreground = RadarColorGradientPixel(gradient, wi->win, -1); + gc_values.foreground = ZnColorGradientPixel(gradient, wi->win, -1); } else { - gc_values.foreground = RadarColorGradientPixel(gradient, wi->win, 0); + gc_values.foreground = ZnColorGradientPixel(gradient, wi->win, 0); } XChangeGC(wi->dpy, wi->gc, GCFillStyle|GCForeground, &gc_values); @@ -641,11 +641,11 @@ DoPolygonRelief(RadarPoint *p, ********************************************************************************** */ void -GetPolygonReliefBBox(RadarList points, +GetPolygonReliefBBox(ZnList points, unsigned int line_width, - RadarBBox *bbox) + ZnBBox *bbox) { - DoPolygonRelief(RadarListArray(points), RadarListSize(points), + DoPolygonRelief(ZnListArray(points), ZnListSize(points), line_width, POLYGON_RELIEF_BBOX, bbox); } @@ -660,13 +660,13 @@ GetPolygonReliefBBox(RadarList points, ********************************************************************************** */ int -PolygonReliefInBBox(RadarList points, +PolygonReliefInBBox(ZnList points, unsigned int line_width, - RadarBBox *area) + ZnBBox *area) { int result; - DoPolygonRelief(RadarListArray(points), RadarListSize(points), + DoPolygonRelief(ZnListArray(points), ZnListSize(points), line_width, POLYGON_RELIEF_IN_BBOX, area, &result); return result; @@ -683,13 +683,13 @@ PolygonReliefInBBox(RadarList points, ********************************************************************************** */ double -PolygonReliefToPointDist(RadarList points, +PolygonReliefToPointDist(ZnList points, unsigned int line_width, - RadarPoint *pp) + ZnPoint *pp) { double dist; - DoPolygonRelief(RadarListArray(points), RadarListSize(points), + DoPolygonRelief(ZnListArray(points), ZnListSize(points), line_width, POLYGON_RELIEF_DIST, pp, &dist); return dist; @@ -707,8 +707,8 @@ PolygonReliefToPointDist(RadarList points, void DrawPolygonRelief(WidgetInfo *wi, ReliefStyle relief, - RadarColorGradient gradient, - RadarPoint *points, + ZnColorGradient gradient, + ZnPoint *points, int num_points, int line_width) { diff --git a/generic/Draw.h b/generic/Draw.h index 35630ed..2d349f5 100644 --- a/generic/Draw.h +++ b/generic/Draw.h @@ -48,23 +48,23 @@ struct _WidgetInfo; void SetLineStyle(Display *display, GC gc, LineStyle line_style); -void GetLineShape(RadarPoint *p1, RadarPoint *p2, unsigned int line_width, - LineShape shape, RadarBBox *bbox, RadarList to_points); +void GetLineShape(ZnPoint *p1, ZnPoint *p2, unsigned int line_width, + LineShape shape, ZnBBox *bbox, ZnList to_points); void DrawLineShape(Display *display, Drawable draw_buffer, GC gc, - RadarPoint *points, int num_points, LineStyle line_style, - RadarColor line_foreground, unsigned int line_width, + ZnPoint *points, int num_points, LineStyle line_style, + ZnColor line_foreground, unsigned int line_width, LineShape shape); void DrawRectangleRelief(struct _WidgetInfo *wi, - ReliefStyle relief, RadarColorGradient gradient, + ReliefStyle relief, ZnColorGradient gradient, XRectangle *bbox, unsigned int line_width); -int PolygonReliefInBBox(RadarList points, unsigned int line_width, - RadarBBox *bbox); -void GetPolygonReliefBBox(RadarList points, unsigned int line_width, - RadarBBox *bbox); -double PolygonReliefToPointDist(RadarList points, unsigned int line_width, - RadarPoint *pp); +int PolygonReliefInBBox(ZnList points, unsigned int line_width, + ZnBBox *bbox); +void GetPolygonReliefBBox(ZnList points, unsigned int line_width, + ZnBBox *bbox); +double PolygonReliefToPointDist(ZnList points, unsigned int line_width, + ZnPoint *pp); void DrawPolygonRelief(struct _WidgetInfo *wi, ReliefStyle relief, - RadarColorGradient gradient, RadarPoint *points, + ZnColorGradient gradient, ZnPoint *points, int num_points, int line_width); diff --git a/generic/Geo.c b/generic/Geo.c index c2d569d..16cee3e 100644 --- a/generic/Geo.c +++ b/generic/Geo.c @@ -46,45 +46,45 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ " * by position, anchor, width and height. */ void -Anchor2Origin(RadarPoint *position, - RadarDim width, - RadarDim height, - RadarAnchor anchor, - RadarPoint *origin) +Anchor2Origin(ZnPoint *position, + ZnDim width, + ZnDim height, + ZnAnchor anchor, + ZnPoint *origin) { switch (anchor) { - case RadarAnchorCenter: + case ZnAnchorCenter: origin->x = position->x - width/2; origin->y = position->y - height/2; break; - case RadarAnchorNW: + case ZnAnchorNW: *origin = *position; break; - case RadarAnchorN: + case ZnAnchorN: origin->x = position->x - width/2; origin->y = position->y; break; - case RadarAnchorNE: + case ZnAnchorNE: origin->x = position->x - width; origin->y = position->y; break; - case RadarAnchorE: + case ZnAnchorE: origin->x = position->x - width; origin->y = position->y - height/2; break; - case RadarAnchorSE: + case ZnAnchorSE: origin->x = position->x - width; origin->y = position->y - height; break; - case RadarAnchorS: + case ZnAnchorS: origin->x = position->x - width/2; origin->y = position->y - height; break; - case RadarAnchorSW: + case ZnAnchorSW: origin->x = position->x; origin->y = position->y - height; break; - case RadarAnchorW: + case ZnAnchorW: origin->x = position->x; origin->y = position->y - height/2; break; @@ -97,45 +97,45 @@ Anchor2Origin(RadarPoint *position, * height and the anchor. */ void -Origin2Anchor(RadarPoint *origin, - RadarDim width, - RadarDim height, - RadarAnchor anchor, - RadarPoint *position) +Origin2Anchor(ZnPoint *origin, + ZnDim width, + ZnDim height, + ZnAnchor anchor, + ZnPoint *position) { switch (anchor) { - case RadarAnchorCenter: + case ZnAnchorCenter: position->x = origin->x + width/2; position->y = origin->y + height/2; break; - case RadarAnchorNW: + case ZnAnchorNW: *position = *origin; break; - case RadarAnchorN: + case ZnAnchorN: position->x = origin->x + width/2; position->y = origin->y; break; - case RadarAnchorNE: + case ZnAnchorNE: position->x = origin->x + width; position->y = origin->y; break; - case RadarAnchorE: + case ZnAnchorE: position->x = origin->x + width; position->y = origin->y + height/2; break; - case RadarAnchorSE: + case ZnAnchorSE: position->x = origin->x + width; position->y = origin->y + height; break; - case RadarAnchorS: + case ZnAnchorS: position->x = origin->x + width/2; position->y = origin->y + height; break; - case RadarAnchorSW: + case ZnAnchorSW: position->x = origin->x; position->y = origin->y + height; break; - case RadarAnchorW: + case ZnAnchorW: position->x = origin->x; position->y = origin->y + height/2; break; @@ -144,7 +144,7 @@ Origin2Anchor(RadarPoint *origin, void -BBox2XRect(RadarBBox *bbox, +BBox2XRect(ZnBBox *bbox, XRectangle *r) { r->x = REAL_TO_INT(bbox->orig.x); @@ -156,15 +156,15 @@ BBox2XRect(RadarBBox *bbox, void GetStringBBox(char *str, - RadarFont font, - RadarPos x, - RadarPos y, - RadarBBox *str_bbox) + ZnFont font, + ZnPos x, + ZnPos y, + ZnBBox *str_bbox) { Tk_FontMetrics fm; str_bbox->orig.x = x; - str_bbox->corner.x = x + RadarTextWidth(font, str, strlen(str)); + str_bbox->corner.x = x + ZnTextWidth(font, str, strlen(str)); Tk_GetFontMetrics(font, &fm); str_bbox->orig.y = y - fm.ascent; str_bbox->corner.y = str_bbox->orig.y + fm.ascent + fm.descent; @@ -172,7 +172,7 @@ GetStringBBox(char *str, void -ResetBBox(RadarBBox *bbox) +ResetBBox(ZnBBox *bbox) { bbox->orig.x = bbox->orig.y = 0; bbox->corner = bbox->orig; @@ -180,8 +180,8 @@ ResetBBox(RadarBBox *bbox) void -CopyBBox(RadarBBox *bbox_from, - RadarBBox *bbox_to) +CopyBBox(ZnBBox *bbox_from, + ZnBBox *bbox_to) { bbox_to->orig = bbox_from->orig; bbox_to->corner = bbox_from->corner; @@ -189,9 +189,9 @@ CopyBBox(RadarBBox *bbox_from, void -IntersectBBox(RadarBBox *bbox1, - RadarBBox *bbox2, - RadarBBox *bbox_inter) +IntersectBBox(ZnBBox *bbox1, + ZnBBox *bbox2, + ZnBBox *bbox_inter) { if ((bbox1->corner.x < bbox2->orig.x) || (bbox1->corner.y < bbox2->orig.y) || @@ -208,16 +208,16 @@ IntersectBBox(RadarBBox *bbox1, } -RadarBool -IsEmptyBBox(RadarBBox *bbox) +ZnBool +IsEmptyBBox(ZnBBox *bbox) { return (bbox->orig.x >= bbox->corner.x) || (bbox->orig.y >= bbox->corner.y); } void -AddBBoxToBBox(RadarBBox *bbox, - RadarBBox *bbox2) +AddBBoxToBBox(ZnBBox *bbox, + ZnBBox *bbox2) { if (IsEmptyBBox(bbox2)) { return; @@ -235,9 +235,9 @@ AddBBoxToBBox(RadarBBox *bbox, void -AddPointToBBox(RadarBBox *bbox, - RadarPos px, - RadarPos py) +AddPointToBBox(ZnBBox *bbox, + ZnPos px, + ZnPos py) { if (IsEmptyBBox(bbox)) { bbox->orig.x = px; @@ -255,9 +255,9 @@ AddPointToBBox(RadarBBox *bbox, void -AddPointsToBBox(RadarBBox *bbox, - RadarPoint *points, - int num_points) +AddPointsToBBox(ZnBBox *bbox, + ZnPoint *points, + int num_points) { int x1, y1, x2, y2, cur; @@ -308,22 +308,22 @@ AddPointsToBBox(RadarBBox *bbox, void -AddStringToBBox(RadarBBox *bbox, - char *str, - RadarFont font, - RadarPos cx, - RadarPos cy) +AddStringToBBox(ZnBBox *bbox, + char *str, + ZnFont font, + ZnPos cx, + ZnPos cy) { - RadarBBox str_bbox; + ZnBBox str_bbox; GetStringBBox(str, font, cx, cy, &str_bbox); AddBBoxToBBox(bbox, &str_bbox); } -RadarBool -PointInBBox(RadarBBox *bbox, - RadarPos x, - RadarPos y) +ZnBool +PointInBBox(ZnBBox *bbox, + ZnPos x, + ZnPos y) { return ((x >= bbox->orig.x) && (x < bbox->corner.x) && (y >= bbox->orig.y) && (y < bbox->corner.y)); @@ -336,8 +336,8 @@ PointInBBox(RadarBBox *bbox, * 1 if it is entirely inside and 0 otherwise. */ int -BBoxInBBox(RadarBBox *bbox1, - RadarBBox *bbox2) +BBoxInBBox(ZnBBox *bbox1, + ZnBBox *bbox2) { if ((bbox1->corner.x <= bbox2->orig.x) || (bbox1->orig.x >= bbox2->corner.x) || @@ -360,12 +360,12 @@ BBoxInBBox(RadarBBox *bbox1, * if it is entirely inside and 0 otherwise. */ int -LineInBBox(RadarPoint *p1, - RadarPoint *p2, - RadarBBox *bbox) +LineInBBox(ZnPoint *p1, + ZnPoint *p2, + ZnBBox *bbox) { - RadarBool p1_inside = PointInBBox(bbox, p1->x, p1->y); - RadarBool p2_inside = PointInBBox(bbox, p2->x, p2->y); + ZnBool p1_inside = PointInBBox(bbox, p1->x, p1->y); + ZnBool p2_inside = PointInBBox(bbox, p2->x, p2->y); if (p1_inside != p2_inside) { return 0; @@ -457,14 +457,14 @@ LineInBBox(RadarPoint *p1, * on the right. */ void -ShiftLine(RadarPoint *p1, - RadarPoint *p2, - RadarReal dist, - RadarPoint *p3, - RadarPoint *p4) +ShiftLine(ZnPoint *p1, + ZnPoint *p2, + ZnReal dist, + ZnPoint *p3, + ZnPoint *p4) { static int shift_table[129]; - RadarBool dx_neg, dy_neg; + ZnBool dx_neg, dy_neg; int dx, dy; /* @@ -524,12 +524,12 @@ ShiftLine(RadarPoint *p1, * The function returns True if the lines are not parallel and False * otherwise. */ -RadarBool -IntersectLines(RadarPoint *a1, - RadarPoint *a2, - RadarPoint *b1, - RadarPoint *b2, - RadarPoint *pi) +ZnBool +IntersectLines(ZnPoint *a1, + ZnPoint *a2, + ZnPoint *b1, + ZnPoint *b2, + ZnPoint *pi) { int dxadyb, dxbdya, dxadxb, dyadyb, p, q; @@ -580,13 +580,13 @@ IntersectLines(RadarPoint *a1, */ /**** A FINIR ****/ void -InsetPolygon(RadarPoint *p, +InsetPolygon(ZnPoint *p, int num_points, - RadarDim inset) + ZnDim inset) { - RadarPoint *p1, *p2; - RadarPoint new_p1, new_p2; - RadarPoint shift1, shift2; + ZnPoint *p1, *p2; + ZnPoint new_p1, new_p2; + ZnPoint shift1, shift2; int i, processed_points; processed_points = 0; @@ -624,12 +624,12 @@ InsetPolygon(RadarPoint *p, * end is located around p2. */ void -GetButtPoints(RadarPoint *p1, - RadarPoint *p2, - int width, - RadarBool projecting, - RadarPoint *c1, - RadarPoint *c2) +GetButtPoints(ZnPoint *p1, + ZnPoint *p2, + int width, + ZnBool projecting, + ZnPoint *c1, + ZnPoint *c2) { double w_2 = width/2.0; double length = hypot(p2->x - p1->x, p2->y - p1->y); @@ -668,13 +668,13 @@ GetButtPoints(RadarPoint *p1, * * Hmmm, the switch has been done but not the rounding ;-) */ -RadarBool -GetMiterPoints(RadarPoint *p1, - RadarPoint *p2, - RadarPoint *p3, - int width, - RadarPoint *c1, - RadarPoint *c2) +ZnBool +GetMiterPoints(ZnPoint *p1, + ZnPoint *p2, + ZnPoint *p3, + int width, + ZnPoint *c1, + ZnPoint *c2) { static double deg11 = (11.0*2.0*M_PI)/360.0; double theta1; /* angle of p2-p1 segment. */ @@ -752,16 +752,16 @@ GetMiterPoints(RadarPoint *p1, * can be: CapRound, CapButt, CapProjecting. */ int -PolylineInBBox(RadarPoint *points, - int num_points, - int width, - int cap_style, - int join_style, - RadarBBox *bbox) +PolylineInBBox(ZnPoint *points, + int num_points, + int width, + int cap_style, + int join_style, + ZnBBox *bbox) { int count, inside = -1; - RadarBool do_miter_as_bevel; - RadarPoint poly[4]; + ZnBool do_miter_as_bevel; + ZnPoint poly[4]; /* * If the first point is inside the area, change inside @@ -872,13 +872,13 @@ PolylineInBBox(RadarPoint *points, * if it is entirely inside and 0 otherwise. */ int -PolygonInBBox(RadarPoint *points, - int num_points, - RadarBBox *bbox) +PolygonInBBox(ZnPoint *points, + int num_points, + ZnBBox *bbox) { int inside, count; - RadarPoint *p, *head, *first, *second; - RadarBool closed; + ZnPoint *p, *head, *first, *second; + ZnBool closed; p = head = points; closed = True; @@ -945,12 +945,12 @@ PolygonInBBox(RadarPoint *points, * if it is entirely inside and 0 otherwise. */ int -OvalInBBox(RadarPoint *center, +OvalInBBox(ZnPoint *center, int width, int height, - RadarBBox *bbox) + ZnBBox *bbox) { - RadarPoint origin, corner; + ZnPoint origin, corner; int w_2, h_2; double delta_x, delta_y; @@ -1050,10 +1050,10 @@ OvalInBBox(RadarPoint *center, * case we need to normalize a figure to take care of its shape and * the result needs precision. */ -RadarBool +ZnBool PointInAngle(int start_angle, int angle_extent, - RadarPoint *p) + ZnPoint *p) { double point_angle; int angle_diff; @@ -1081,17 +1081,17 @@ PointInAngle(int start_angle, * the arc described by (r1, r2, start_angle and angle_extent). * This arc is origin centered. */ -RadarBool -HorizLineToArc(RadarReal x1, - RadarReal x2, - RadarReal y, - RadarReal rx, - RadarReal ry, - RadarReal start_angle, - RadarReal angle_extent) +ZnBool +HorizLineToArc(ZnReal x1, + ZnReal x2, + ZnReal y, + ZnReal rx, + ZnReal ry, + ZnReal start_angle, + ZnReal angle_extent) { - RadarReal tmp, x; - RadarPoint t; + ZnReal tmp, x; + ZnPoint t; /* * Compute the x-coordinate of one possible intersection point @@ -1129,17 +1129,17 @@ HorizLineToArc(RadarReal x1, * the arc described by (r1, r2, start_angle and angle_extent). * This arc is origin centered. */ -RadarBool -VertLineToArc(RadarReal x, - RadarReal y1, - RadarReal y2, - RadarReal rx, - RadarReal ry, - RadarReal start_angle, - RadarReal angle_extent) +ZnBool +VertLineToArc(ZnReal x, + ZnReal y1, + ZnReal y2, + ZnReal rx, + ZnReal ry, + ZnReal start_angle, + ZnReal angle_extent) { - RadarReal tmp, y; - RadarPoint t; + ZnReal tmp, y; + ZnPoint t; /* * Compute the y-coordinate of one possible intersection point @@ -1175,11 +1175,11 @@ VertLineToArc(RadarReal x, * the rectangle. */ double -RectangleToPointDist(RadarBBox *bbox, - RadarPoint *p) +RectangleToPointDist(ZnBBox *bbox, + ZnPoint *p) { double new_dist, dist; - RadarPoint p1, p2; + ZnPoint p1, p2; p1.x = bbox->orig.x; p1.y = p2.y = bbox->orig.y; @@ -1224,9 +1224,9 @@ RectangleToPointDist(RadarBBox *bbox, * described by , .. */ double -LineToPointDist(RadarPoint *p1, - RadarPoint *p2, - RadarPoint *p) +LineToPointDist(ZnPoint *p1, + ZnPoint *p2, + ZnPoint *p) { double x, y; int x_int, y_int; @@ -1315,16 +1315,16 @@ LineToPointDist(RadarPoint *p1, * inside return values are negative. */ double -PolygonToPointDist(RadarPoint *points, +PolygonToPointDist(ZnPoint *points, int num_points, - RadarPoint *p) + ZnPoint *p) { double best_distance; int intersections; int x_int, y_int; - RadarPoint *first_point; + ZnPoint *first_point; double x, y, dist; - RadarPoint p1, p2; + ZnPoint p1, p2; /* * The algorithm iterates through all the edges of the polygon @@ -1472,17 +1472,17 @@ PolygonToPointDist(RadarPoint *points, * in the process. */ double -PolylineToPointDist(RadarPoint *points, +PolylineToPointDist(ZnPoint *points, int num_points, int width, int cap_style, int join_style, - RadarPoint *p) + ZnPoint *p) { - RadarBool miter2bevel = False; + ZnBool miter2bevel = False; int count; - RadarPoint *ptr; - RadarPoint outline[5]; + ZnPoint *ptr; + ZnPoint outline[5]; double dist, best_dist, h_width; best_dist = 1.0e36; @@ -1587,11 +1587,11 @@ PolylineToPointDist(RadarPoint *points, * if the point is inside. */ double -OvalToPointDist(RadarPoint *center, +OvalToPointDist(ZnPoint *center, int width, int height, unsigned int line_width, - RadarPoint *p) + ZnPoint *p) { double x_delta, y_delta; /* double x_diameter, y_diameter;*/ @@ -1667,12 +1667,12 @@ static int bezier_basis[][4] = ********************************************************************************** */ #define EVAL(coeff, t) (((coeff[0]*t + coeff[1])*t + coeff[2]) * t + coeff[3]) -static RadarReal -Arc2Param(RadarPoint *controls, - RadarReal angle) +static ZnReal +Arc2Param(ZnPoint *controls, + ZnReal angle) { - RadarReal coeff_x[4], coeff_y[4]; - RadarReal min_angle, min_t, max_angle, max_t, cur_angle, cur_t; + 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 */ @@ -1733,13 +1733,13 @@ Arc2Param(RadarPoint *controls, ********************************************************************************** */ void -BezierSubdivide(RadarPoint *controls, - RadarReal t, - RadarBool first) +BezierSubdivide(ZnPoint *controls, + ZnReal t, + ZnBool first) { - RadarReal s = 1.0 - t; - RadarPoint r[7]; - RadarPoint a; + ZnReal s = 1.0 - t; + ZnPoint r[7]; + ZnPoint a; r[0] = controls[0]; r[6] = controls[3]; @@ -1757,10 +1757,10 @@ BezierSubdivide(RadarPoint *controls, r[3].y = s*r[2].y + t*r[4].y; if (first) { - memcpy(controls, r, 4*sizeof(RadarPoint)); + memcpy(controls, r, 4*sizeof(ZnPoint)); } else { - memcpy(controls, &r[3], 4*sizeof(RadarPoint)); + memcpy(controls, &r[3], 4*sizeof(ZnPoint)); } } @@ -1777,12 +1777,12 @@ BezierSubdivide(RadarPoint *controls, ********************************************************************************** */ static void -GetBezierPoints(RadarPoint *controls, - RadarList to_points, - double eps) +GetBezierPoints(ZnPoint *controls, + ZnList to_points, + double eps) { - RadarReal dist2; - RadarPoint mid_segm, mid_cord, delta; + ZnReal dist2; + ZnPoint mid_segm, mid_cord, delta; /* * Compute distance between cord center and curve at t = 0.5 @@ -1796,7 +1796,7 @@ GetBezierPoints(RadarPoint *controls, dist2 = delta.x*delta.x + delta.y*delta.y; if (dist2 > eps) { - RadarPoint new_controls[4]; + ZnPoint new_controls[4]; /* * Subdivide the curve at t = 0.5 * and compute each new curve. @@ -1822,7 +1822,7 @@ GetBezierPoints(RadarPoint *controls, * Flat enough add the end to the current path. * The start should already be there. */ - RadarListAdd(to_points, &controls[3], RadarListTail); + ZnListAdd(to_points, &controls[3], ZnListTail); } } @@ -1842,21 +1842,21 @@ GetBezierPoints(RadarPoint *controls, ********************************************************************************** */ void -GetBezierPath(RadarList from_points, - RadarList to_points) +GetBezierPath(ZnList from_points, + ZnList to_points) { - RadarPoint *fp; + ZnPoint *fp; int num_fp, i; - RadarPoint s[4]; + ZnPoint s[4]; - fp = (RadarPoint *) RadarListArray(from_points); - num_fp = RadarListSize(from_points); + fp = (ZnPoint *) ZnListArray(from_points); + num_fp = ZnListSize(from_points); /* * make sure the output vector is empty, then add the first point. */ - RadarListEmpty(to_points); - RadarListAdd(to_points, &fp[0], RadarListTail); + ZnListEmpty(to_points); + ZnListAdd(to_points, &fp[0], ZnListTail); for (i = 0; i < num_fp; ) { if (i < (num_fp-3)) { @@ -1877,7 +1877,7 @@ GetBezierPath(RadarList from_points, break; } else if (i == (num_fp-2)) { - RadarListAdd(to_points, &fp[1], RadarListTail); + ZnListAdd(to_points, &fp[1], ZnListTail); break; } } @@ -1901,19 +1901,19 @@ static double arc_nodes_y[4] = { 0.0, 1.0, 0.0, -1.0 }; static double arc_controls_x[8] = { 1.0, 0.55197, -0.55197, -1.0, -1.0, -0.55197, 0.55197, 1.0 }; static double arc_controls_y[8] = { 0.55197, 1.0, 1.0, 0.55197, -0.55197, -1.0, -1.0, -0.55197 }; void -GetArcPath(RadarReal start_angle, - RadarReal end_angle, +GetArcPath(ZnReal start_angle, + ZnReal end_angle, int type, - RadarList to_points) + ZnList to_points) { int start_quad, end_quad, quadrant; - RadarPoint center_p = { 0.0, 0.0 }; - RadarPoint start_p = center_p; + ZnPoint center_p = { 0.0, 0.0 }; + ZnPoint start_p = center_p; /* * make sure the output vector is empty. */ - RadarListEmpty(to_points); + ZnListEmpty(to_points); /* * normalize start_angle and end_angle. @@ -1941,8 +1941,8 @@ GetArcPath(RadarReal start_angle, end_quad = end_angle / (M_PI / 2.0); for (quadrant = start_quad; quadrant <= end_quad; quadrant++) { - RadarPoint controls[4]; - RadarReal t; + ZnPoint controls[4]; + ZnReal t; controls[0].x = arc_nodes_x[quadrant % 4]; controls[0].y = arc_nodes_y[quadrant % 4]; @@ -1961,7 +1961,7 @@ GetArcPath(RadarReal start_angle, * vertex. */ start_p = controls[0]; - RadarListAdd(to_points, &controls[0], RadarListTail); + ZnListAdd(to_points, &controls[0], ZnListTail); } if (quadrant == end_quad) { t = Arc2Param(controls, end_angle); @@ -1970,23 +1970,23 @@ GetArcPath(RadarReal start_angle, } BezierSubdivide(controls, t, True); } - RadarListAdd(to_points, &controls[1], RadarListTail); - RadarListAdd(to_points, &controls[2], RadarListTail); - RadarListAdd(to_points, &controls[3], RadarListTail); + ZnListAdd(to_points, &controls[1], ZnListTail); + ZnListAdd(to_points, &controls[2], ZnListTail); + ZnListAdd(to_points, &controls[3], ZnListTail); } if (type == 2) { - RadarListAdd(to_points, ¢er_p, RadarListTail); + ZnListAdd(to_points, ¢er_p, ZnListTail); /* * Can't add this one, it would be interpreted by GetBezierPath * as an off-curve control. The path should be closed by the client * after expansion by GetBezierPath. * - RadarListAdd(to_points, &start_p, RadarListTail); + ZnListAdd(to_points, &start_p, ZnListTail); */ } else if (type == 1) { - RadarListAdd(to_points, &start_p, RadarListTail); + ZnListAdd(to_points, &start_p, ZnListTail); } } @@ -2001,22 +2001,22 @@ GetArcPath(RadarReal start_angle, ********************************************************************************** */ void -SmoothPathWithBezier(RadarList from_points, - RadarList to_points) +SmoothPathWithBezier(ZnList from_points, + ZnList to_points) { - RadarPoint *fp; - int num_fp; - RadarBool closed; - RadarPoint s[4]; - int i; + ZnPoint *fp; + int num_fp; + ZnBool closed; + ZnPoint s[4]; + int i; - fp = (RadarPoint *) RadarListArray(from_points); - num_fp = RadarListSize(from_points); + fp = (ZnPoint *) ZnListArray(from_points); + num_fp = ZnListSize(from_points); /* * make sure the output vector is empty */ - RadarListEmpty(to_points); + ZnListEmpty(to_points); /* * If the curve is closed, generates a Bezier curve that @@ -2033,12 +2033,12 @@ SmoothPathWithBezier(RadarList from_points, s[2].y = REAL_TO_INT(0.833*fp[0].y + 0.167*fp[1].y); s[3].x = REAL_TO_INT(0.5*fp[0].x + 0.5*fp[1].x); s[3].y = REAL_TO_INT(0.5*fp[0].y + 0.5*fp[1].y); - RadarListAdd(to_points, s, RadarListTail); + ZnListAdd(to_points, s, ZnListTail); GetBezierPoints(s, to_points, 1.0); } else { closed = False; - RadarListAdd(to_points, &fp[0], RadarListTail); + ZnListAdd(to_points, &fp[0], ZnListTail); } for (i = 2; i < num_fp; i++, fp++) { @@ -2081,7 +2081,7 @@ SmoothPathWithBezier(RadarList from_points, */ 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))) { - RadarListAdd(to_points, &s[3], RadarListTail); + ZnListAdd(to_points, &s[3], ZnListTail); } else { GetBezierPoints(s, to_points, 1.0); @@ -2119,17 +2119,17 @@ SmoothPathWithBezier(RadarList from_points, ********************************************************************************** */ void -GetLineEnd(RadarPoint *p1, - RadarPoint *p2, +GetLineEnd(ZnPoint *p1, + ZnPoint *p2, unsigned int line_width, int cap_style, LineEnd end_style, - RadarPoint *points) + ZnPoint *points) { - RadarReal dx, dy, length, temp, backup; - RadarReal frac_height, sin_theta, cos_theta; - RadarReal vert_x, vert_y; - RadarReal 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; diff --git a/generic/Geo.h b/generic/Geo.h index 00382ea..8a173b1 100644 --- a/generic/Geo.h +++ b/generic/Geo.h @@ -70,199 +70,199 @@ void -Anchor2Origin(RadarPoint *position, - RadarDim width, - RadarDim height, - RadarAnchor anchor, - RadarPoint *origin); +Anchor2Origin(ZnPoint *position, + ZnDim width, + ZnDim height, + ZnAnchor anchor, + ZnPoint *origin); void -Origin2Anchor(RadarPoint *origin, - RadarDim width, - RadarDim height, - RadarAnchor anchor, - RadarPoint *position); +Origin2Anchor(ZnPoint *origin, + ZnDim width, + ZnDim height, + ZnAnchor anchor, + ZnPoint *position); void -BBox2XRect(RadarBBox *bbox, +BBox2XRect(ZnBBox *bbox, XRectangle *rect); void -GetStringBBox(char *str, - RadarFont font, - RadarPos x, - RadarPos y, - RadarBBox *str_bbox); +GetStringBBox(char *str, + ZnFont font, + ZnPos x, + ZnPos y, + ZnBBox *str_bbox); void -ResetBBox(RadarBBox *bbox); +ResetBBox(ZnBBox *bbox); void -CopyBBox(RadarBBox *bbox_from, - RadarBBox *bbox_to); +CopyBBox(ZnBBox *bbox_from, + ZnBBox *bbox_to); void -IntersectBBox(RadarBBox *bbox1, - RadarBBox *bbox2, - RadarBBox *bbox_inter); -RadarBool -IsEmptyBBox(RadarBBox *bbox); +IntersectBBox(ZnBBox *bbox1, + ZnBBox *bbox2, + ZnBBox *bbox_inter); +ZnBool +IsEmptyBBox(ZnBBox *bbox); void -AddBBoxToBBox(RadarBBox *bbox, - RadarBBox *bbox2); +AddBBoxToBBox(ZnBBox *bbox, + ZnBBox *bbox2); void -AddPointToBBox(RadarBBox *bbox, - RadarPos px, - RadarPos py); +AddPointToBBox(ZnBBox *bbox, + ZnPos px, + ZnPos py); void -AddPointsToBBox(RadarBBox *bbox, - RadarPoint *points, - int num_points); +AddPointsToBBox(ZnBBox *bbox, + ZnPoint *points, + int num_points); void -AddStringToBBox(RadarBBox *bbox, - char *str, - RadarFont font, - RadarPos cx, - RadarPos cy); -RadarBool -PointInBBox(RadarBBox *bbox, - RadarPos x, - RadarPos y); +AddStringToBBox(ZnBBox *bbox, + char *str, + ZnFont font, + ZnPos cx, + ZnPos cy); +ZnBool +PointInBBox(ZnBBox *bbox, + ZnPos x, + ZnPos y); int -LineInBBox(RadarPoint *p1, - RadarPoint *p2, - RadarBBox *bbox); +LineInBBox(ZnPoint *p1, + ZnPoint *p2, + ZnBBox *bbox); int -BBoxInBBox(RadarBBox *bbox1, - RadarBBox *bbox2); +BBoxInBBox(ZnBBox *bbox1, + ZnBBox *bbox2); int -PolylineInBBox(RadarPoint *points, - int num_points, - int width, - int cap_style, - int join_style, - RadarBBox *bbox); +PolylineInBBox(ZnPoint *points, + int num_points, + int width, + int cap_style, + int join_style, + ZnBBox *bbox); int -PolygonInBBox(RadarPoint *points, - int num_points, - RadarBBox *bbox); +PolygonInBBox(ZnPoint *points, + int num_points, + ZnBBox *bbox); int -OvalInBBox(RadarPoint *center, +OvalInBBox(ZnPoint *center, int width, int height, - RadarBBox *bbox); - -RadarBool -HorizLineToArc(RadarReal x1, - RadarReal x2, - RadarReal y, - RadarReal rx, - RadarReal ry, - RadarReal start_angle, - RadarReal angle_extent); - -RadarBool -VertLineToArc(RadarReal x, - RadarReal y1, - RadarReal y2, - RadarReal rx, - RadarReal ry, - RadarReal start_angle, - RadarReal angle_extent); - -RadarBool + ZnBBox *bbox); + +ZnBool +HorizLineToArc(ZnReal x1, + ZnReal x2, + ZnReal y, + ZnReal rx, + ZnReal ry, + ZnReal start_angle, + ZnReal angle_extent); + +ZnBool +VertLineToArc(ZnReal x, + ZnReal y1, + ZnReal y2, + ZnReal rx, + ZnReal ry, + ZnReal start_angle, + ZnReal angle_extent); + +ZnBool PointInAngle(int start_angle, int angle_extent, - RadarPoint *p); + ZnPoint *p); double -RectangleToPointDist(RadarBBox *bbox, - RadarPoint *p); +RectangleToPointDist(ZnBBox *bbox, + ZnPoint *p); double -LineToPointDist(RadarPoint *p1, - RadarPoint *p2, - RadarPoint *p); +LineToPointDist(ZnPoint *p1, + ZnPoint *p2, + ZnPoint *p); double -PolygonToPointDist(RadarPoint *points, +PolygonToPointDist(ZnPoint *points, int num_points, - RadarPoint *p); + ZnPoint *p); double -PolylineToPointDist(RadarPoint *points, +PolylineToPointDist(ZnPoint *points, int num_points, int width, int cap_style, int join_style, - RadarPoint *p); + ZnPoint *p); double -OvalToPointDist(RadarPoint *center, - int width, - int height, +OvalToPointDist(ZnPoint *center, + int width, + int height, unsigned int line_width, - RadarPoint *p); + ZnPoint *p); void -GetButtPoints(RadarPoint *p1, - RadarPoint *p2, - int width, - RadarBool projecting, - RadarPoint *c1, - RadarPoint *c2); - -RadarBool -GetMiterPoints(RadarPoint *p1, - RadarPoint *p2, - RadarPoint *p3, - int width, - RadarPoint *c1, - RadarPoint *c2); - -RadarBool -IntersectLines(RadarPoint *a1, - RadarPoint *a2, - RadarPoint *b1, - RadarPoint *b2, - RadarPoint *pi); +GetButtPoints(ZnPoint *p1, + ZnPoint *p2, + int width, + ZnBool projecting, + ZnPoint *c1, + ZnPoint *c2); + +ZnBool +GetMiterPoints(ZnPoint *p1, + ZnPoint *p2, + ZnPoint *p3, + int width, + ZnPoint *c1, + ZnPoint *c2); + +ZnBool +IntersectLines(ZnPoint *a1, + ZnPoint *a2, + ZnPoint *b1, + ZnPoint *b2, + ZnPoint *pi); void -ShiftLine(RadarPoint *p1, - RadarPoint *p2, - RadarReal dist, - RadarPoint *p3, - RadarPoint *p4); +ShiftLine(ZnPoint *p1, + ZnPoint *p2, + ZnReal dist, + ZnPoint *p3, + ZnPoint *p4); void -InsetPolygon(RadarPoint *p, +InsetPolygon(ZnPoint *p, int num_points, - RadarDim inset); + ZnDim inset); void -BezierSubdivide(RadarPoint *controls, - RadarReal t, - RadarBool first); +BezierSubdivide(ZnPoint *controls, + ZnReal t, + ZnBool first); void -SmoothPathWithBezier(RadarList from_points, - RadarList to_points); +SmoothPathWithBezier(ZnList from_points, + ZnList to_points); void -GetBezierPath(RadarList from_points, - RadarList to_points); +GetBezierPath(ZnList from_points, + ZnList to_points); void -GetArcPath(RadarReal start_angle, - RadarReal end_angle, +GetArcPath(ZnReal start_angle, + ZnReal end_angle, int type, - RadarList to_points); + ZnList to_points); void -GetLineEnd(RadarPoint *p1, - RadarPoint *p2, +GetLineEnd(ZnPoint *p1, + ZnPoint *p2, unsigned int line_width, int cap_style, LineEnd end_style, - RadarPoint *points); + ZnPoint *points); #endif /* _Geo_h */ diff --git a/generic/Group.c b/generic/Group.c index 9e68486..8d5523d 100644 --- a/generic/Group.c +++ b/generic/Group.c @@ -31,7 +31,7 @@ #include "WidgetInfo.h" #include "Item.h" #include "Geo.h" -#include "tkRadar.h" +#include "tkZinc.h" #include #include @@ -47,32 +47,32 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ " * ********************************************************************************** */ -static RadarAttrConfig group_attrs[] = { - { RADAR_CONFIG_BOOL, "-atomic", NULL, +static ZnAttrConfig group_attrs[] = { + { ZN_CONFIG_BOOL, "-atomic", NULL, Tk_Offset(GroupItemStruct, header.flags), ATOMIC_BIT, - RADAR_REPICK_FLAG, False }, - { RADAR_CONFIG_ITEM, "-clip", NULL, + ZN_REPICK_FLAG, False }, + { ZN_CONFIG_ITEM, "-clip", NULL, Tk_Offset(GroupItemStruct, clip), 0, - RADAR_COORDS_FLAG|RADAR_ITEM_FLAG, False }, - { RADAR_CONFIG_BOOL, "-composerotation", NULL, + ZN_COORDS_FLAG|ZN_ITEM_FLAG, False }, + { ZN_CONFIG_BOOL, "-composerotation", NULL, Tk_Offset(GroupItemStruct, header.flags), COMPOSE_ROTATION_BIT, - RADAR_TRANSFO_FLAG, False }, - { RADAR_CONFIG_BOOL, "-composescale", NULL, + ZN_TRANSFO_FLAG, False }, + { ZN_CONFIG_BOOL, "-composescale", NULL, Tk_Offset(GroupItemStruct, header.flags), COMPOSE_SCALE_BIT, - RADAR_TRANSFO_FLAG, False }, - { RADAR_CONFIG_PRI, "-priority", NULL, + ZN_TRANSFO_FLAG, False }, + { ZN_CONFIG_PRI, "-priority", NULL, Tk_Offset(GroupItemStruct, 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(GroupItemStruct, header.flags), SENSITIVE_BIT, - RADAR_REPICK_FLAG, False }, - { RADAR_CONFIG_TAGS, "-tags", NULL, + ZN_REPICK_FLAG, False }, + { ZN_CONFIG_TAGS, "-tags", NULL, Tk_Offset(GroupItemStruct, header.tags), 0, 0, False }, - { RADAR_CONFIG_BOOL, "-visible", NULL, + { ZN_CONFIG_BOOL, "-visible", NULL, Tk_Offset(GroupItemStruct, 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 } }; @@ -90,9 +90,9 @@ Init(Item item, { GroupItem group = (GroupItem) item; - group->head = RADAR_NO_ITEM; - group->tail = RADAR_NO_ITEM; - group->clip = RADAR_NO_ITEM; + group->head = ZN_NO_ITEM; + group->tail = ZN_NO_ITEM; + group->clip = ZN_NO_ITEM; group->dependents = NULL; SET(item->flags, VISIBLE_BIT); SET(item->flags, SENSITIVE_BIT); @@ -104,7 +104,7 @@ Init(Item item, group->call_om = False; #endif - return RADAR_OK; + return ZN_OK; } @@ -119,7 +119,7 @@ static void Clone(Item item) { GroupItem group = (GroupItem) item; - RadarList dependents; + ZnList dependents; Item connected, current_item, new_item; Item *items; Tcl_HashTable mapping; @@ -127,7 +127,7 @@ Clone(Item item) int new, num_items, i; current_item = group->head; - group->head = group->tail = RADAR_NO_ITEM; + group->head = group->tail = ZN_NO_ITEM; #ifdef OM group->call_om = False; #endif @@ -140,11 +140,11 @@ Clone(Item item) * First clone all the children, and build a mapping * table if there is some attachments to relink. */ - while (current_item != RADAR_NO_ITEM) { + while (current_item != ZN_NO_ITEM) { connected = current_item->connected_item; new_item = ITEM.CloneItem(current_item); new_item->connected_item = connected; - ITEM.InsertItem(new_item, item, RADAR_NO_ITEM, True); + ITEM.InsertItem(new_item, item, ZN_NO_ITEM, True); if (dependents) { entry = Tcl_CreateHashEntry(&mapping, (char *) current_item, &new); @@ -163,12 +163,12 @@ Clone(Item item) if (dependents) { printf("rebuilding dependents\n"); group->dependents = NULL; - items = (Item *) RadarListArray(dependents); - num_items = RadarListSize(dependents); + items = (Item *) ZnListArray(dependents); + num_items = ZnListSize(dependents); for (i = 0; i < num_items; i++, items++) { entry = Tcl_FindHashEntry(&mapping, (char *) *items); if (entry == NULL) { - RadarWarning("Can't find item correspondance in Group Clone"); + ZnWarning("Can't find item correspondance in Group Clone"); abort(); } else { @@ -176,7 +176,7 @@ Clone(Item item) } entry = Tcl_FindHashEntry(&mapping, (char *) current_item->connected_item); if (entry == NULL) { - RadarWarning("Can't found item correspondance in Group Clone"); + ZnWarning("Can't found item correspondance in Group Clone"); abort(); } else { @@ -205,13 +205,13 @@ Destroy(Item item) Item current_item, next_item; current_item = group->head; - while (current_item != RADAR_NO_ITEM) { + while (current_item != ZN_NO_ITEM) { next_item = current_item->next; ITEM.DestroyItem(current_item); current_item = next_item; } if (group->dependents) { - RadarListFree(group->dependents); + ZnListFree(group->dependents); } } @@ -230,10 +230,10 @@ SetXShape(Item grp) WidgetInfo *wi = grp->wi; Item clip = ((GroupItem) grp)->clip; int i, num_pts; - RadarPos min_x, min_y, max_x, max_y; - RadarPoint *pts, *p; - RadarBool simple; - RadarDim width, height; + ZnPos min_x, min_y, max_x, max_y; + ZnPoint *pts, *p; + ZnBool simple; + ZnDim width, height; XPoint *xpts, *xp; Region reg; @@ -241,12 +241,12 @@ SetXShape(Item grp) return; } - if ((clip == RADAR_NO_ITEM) || !wi->reshape) { + if ((clip == ZN_NO_ITEM) || !wi->reshape) { /* * Reset both clip just to be sure (the application can have * changed wi->full_reshape while resetting wi->reshape). */ - XShapeCombineMask(wi->dpy, RadarWindowId(wi->win), ShapeBounding, + XShapeCombineMask(wi->dpy, ZnWindowId(wi->win), ShapeBounding, 0, 0, None, ShapeSet); XShapeCombineMask(wi->dpy, wi->real_top, ShapeBounding, 0, 0, None, ShapeSet); @@ -262,7 +262,7 @@ SetXShape(Item grp) * fit exactly the window. We may test here if a shape is currently * active and reset the mask only in this case (need a flag in wi). */ - XShapeCombineMask(wi->dpy, RadarWindowId(wi->win), ShapeBounding, + XShapeCombineMask(wi->dpy, ZnWindowId(wi->win), ShapeBounding, 0, 0, None, ShapeSet); XShapeCombineMask(wi->dpy, wi->real_top, ShapeBounding, 0, 0, None, ShapeSet); @@ -304,7 +304,7 @@ SetXShape(Item grp) } width = wi->width + 2*wi->border_width; height = wi->height + 2*wi->border_width; - xpts = (XPoint *) RadarMalloc(num_pts * sizeof(XPoint)); + xpts = (XPoint *) ZnMalloc(num_pts * sizeof(XPoint)); for (p = &pts[0], xp = xpts, i = 0; i < num_pts; i++, p++, xp++) { xp->x = (short) (p->x * width / max_x); xp->y = (short) (p->y * height / max_y); @@ -313,12 +313,12 @@ SetXShape(Item grp) * Translate it in a region and apply this region to the window. */ reg = XPolygonRegion(xpts, num_pts, EvenOddRule); - XShapeCombineMask(wi->dpy, wi->full_reshape ? RadarWindowId(wi->win) : wi->real_top, + XShapeCombineMask(wi->dpy, wi->full_reshape ? ZnWindowId(wi->win) : wi->real_top, ShapeBounding, 0, 0, None, ShapeSet); - XShapeCombineRegion(wi->dpy, wi->full_reshape ? wi->real_top : RadarWindowId(wi->win), + XShapeCombineRegion(wi->dpy, wi->full_reshape ? wi->real_top : ZnWindowId(wi->win), ShapeBounding, 0, 0, reg, ShapeSet); XDestroyRegion(reg); - RadarFree(xpts); + ZnFree(xpts); } } #endif @@ -335,34 +335,34 @@ SetXShape(Item grp) static int Configure(Item item, int argc, - RadarAttrList argv, + ZnAttrList argv, int *flags) { GroupItem group = (GroupItem) item; WidgetInfo *wi = item->wi; - 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 the clip item changed, check if it is a legal * item type that is inside this group. */ - if (ISSET(*flags, RADAR_ITEM_FLAG)) { + if (ISSET(*flags, ZN_ITEM_FLAG)) { if (group->clip && (!group->clip->class->GetClipVertices || (group->clip->parent != item))) { - group->clip = RADAR_NO_ITEM; + group->clip = ZN_NO_ITEM; Tcl_AppendResult(wi->interp, " clip item must be a child of the group", NULL); - return RADAR_ERROR; + return ZN_ERROR; } if (!group->clip && (item == wi->top_group)) { SetXShape(item); } } - return RADAR_OK; + return ZN_OK; } @@ -376,13 +376,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; } @@ -399,30 +399,30 @@ Query(Item item, */ static void PushClip(GroupItem group, - RadarBool set_gc) + ZnBool set_gc) { WidgetInfo *wi = ((Item) group)->wi; int i, num_c, num_pts; - RadarPoint *pts; - RadarBool simple, has_clip=False; + ZnPoint *pts; + ZnBool simple, has_clip=False; ClipState *previous_clip=NULL; Region reg; XRectangle rect; XPoint *xpts; - if ((group->clip != RADAR_NO_ITEM) && + if ((group->clip != ZN_NO_ITEM) && ((((Item) group) != wi->top_group) || !wi->reshape)) { simple = group->clip->class->GetClipVertices(group->clip, &pts, &num_pts); if (num_pts != 0) { has_clip = True; - num_c = RadarListSize(wi->clip_stack); + num_c = ZnListSize(wi->clip_stack); if (num_c != 0) { - previous_clip = (ClipState *) RadarListAt(wi->clip_stack, RadarListTail); + previous_clip = (ClipState *) ZnListAt(wi->clip_stack, ZnListTail); } - RadarListAssertSize(wi->clip_stack, num_c+1); - wi->current_clip = (ClipState *) RadarListAt(wi->clip_stack, RadarListTail); + ZnListAssertSize(wi->clip_stack, num_c+1); + wi->current_clip = (ClipState *) ZnListAt(wi->clip_stack, ZnListTail); wi->current_clip->simple = simple; /* @@ -439,13 +439,13 @@ PushClip(GroupItem group, rect.x, rect.y, rect.width, rect.height);*/ } else { - xpts = (XPoint *) RadarMalloc(num_pts * sizeof(XPoint)); + xpts = (XPoint *) ZnMalloc(num_pts * sizeof(XPoint)); for (i = 0; i < num_pts; i++) { xpts[i].x = pts[i].x; xpts[i].y = pts[i].y; } reg = XPolygonRegion(xpts, num_pts, EvenOddRule); - RadarFree(xpts); + ZnFree(xpts); } /* * Combine with previous region if any. @@ -499,16 +499,16 @@ PushClip(GroupItem group, */ static void PopClip(GroupItem group, - RadarBool set_gc) + ZnBool set_gc) { WidgetInfo *wi = ((Item) group)->wi; - if ((group->clip != RADAR_NO_ITEM) && + if ((group->clip != ZN_NO_ITEM) && ((((Item) group) != wi->top_group) || !wi->reshape)) { XDestroyRegion(wi->current_clip->region); - RadarListDelete(wi->clip_stack, RadarListTail); - if (RadarListSize(wi->clip_stack) != 0) { - wi->current_clip = (ClipState *) RadarListAt(wi->clip_stack, RadarListTail); + ZnListDelete(wi->clip_stack, ZnListTail); + if (ZnListSize(wi->clip_stack) != 0) { + wi->current_clip = (ClipState *) ZnListAt(wi->clip_stack, ZnListTail); } else { wi->current_clip = NULL; @@ -547,7 +547,7 @@ static void PushTransform(Item item) { WidgetInfo *wi; - RadarTransfo *next_t; + ZnTransfo *next_t; int num_t; if (!item->transfo && @@ -561,13 +561,13 @@ PushTransform(Item item) * combination flags. */ wi = item->wi; - num_t = RadarListSize(wi->transfo_stack); - RadarListAssertSize(wi->transfo_stack, num_t+1); - next_t = (RadarTransfo *) RadarListAt(wi->transfo_stack, num_t); + num_t = ZnListSize(wi->transfo_stack); + ZnListAssertSize(wi->transfo_stack, num_t+1); + next_t = (ZnTransfo *) ZnListAt(wi->transfo_stack, num_t); ITEM.ComposeItemTransform(item, wi->current_transfo, next_t); wi->current_transfo = next_t; /*printf("Pushing transfo for item: %d\n;", item->id); - RadarPrintTransfo(wi->current_transfo);*/ + ZnPrintTransfo(wi->current_transfo);*/ } @@ -594,11 +594,10 @@ PopTransform(Item item) * Restore the previous transform. */ wi = item->wi; - RadarListDelete(wi->transfo_stack, RadarListTail); - wi->current_transfo = (RadarTransfo *) RadarListAt(wi->transfo_stack, - RadarListTail); + ZnListDelete(wi->transfo_stack, ZnListTail); + wi->current_transfo = (ZnTransfo *) ZnListAt(wi->transfo_stack, ZnListTail); /*printf("Popping transfo for item: %d\n", item->id); - RadarPrintTransfo(wi->current_transfo);*/ + ZnPrintTransfo(wi->current_transfo);*/ } @@ -628,14 +627,14 @@ CallRegularCC(Item item) PushTransform(item); /*printf("calling cc on regular item %d\n", item->id);*/ - /*RadarPrintTransfo(wi->current_transfo);*/ + /*ZnPrintTransfo(wi->current_transfo);*/ item->class->ComputeCoordinates(item, False); /* * If a current clipbox exists adjust the item * bounding box accordingly. */ if (wi->current_clip) { - RadarBBox inter; + ZnBBox inter; IntersectBBox(&item->item_bounding_box, &wi->current_clip->clip_box, &inter); item->item_bounding_box = inter; @@ -643,10 +642,10 @@ CallRegularCC(Item item) /* * Do some generic post-work in behalf of the (regular) children. */ - if (ISSET(item->inv_flags, RADAR_REPICK_FLAG)) { + if (ISSET(item->inv_flags, ZN_REPICK_FLAG)) { SET(wi->events_flags, INTERNAL_NEED_REPICK); } - if (ISSET(item->inv_flags, RADAR_COORDS_FLAG) && + if (ISSET(item->inv_flags, ZN_COORDS_FLAG) && (ISSET(item->flags, SENSITIVE_BIT) || ISSET(item->flags, VISIBLE_BIT))) { SET(wi->events_flags, INTERNAL_NEED_REPICK); @@ -666,7 +665,7 @@ CallRegularCC(Item item) static void ComputeCoordinates(Item item, - RadarBool force) + ZnBool force) { GroupItem group = (GroupItem) item; Item current_item; @@ -675,24 +674,24 @@ ComputeCoordinates(Item item, PushTransform(item); /* printf("Group.c\n"); - RadarPrintTransfo(item->wi->current_transfo); + ZnPrintTransfo(item->wi->current_transfo); printf("\n");*/ - force |= ISSET(item->inv_flags, RADAR_TRANSFO_FLAG); + force |= ISSET(item->inv_flags, ZN_TRANSFO_FLAG); /* * Clip shape is computed in the group's local * coordinates. */ - if (group->clip != RADAR_NO_ITEM) { + if (group->clip != ZN_NO_ITEM) { /* * Update the geometry of the clip item if needed. * Its bounding box will be clipped by the current * clipbox (i.e the clipbox of the group's parent). */ if (force || - ISSET(group->clip->inv_flags, RADAR_COORDS_FLAG) || - ISSET(group->clip->inv_flags, RADAR_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);*/ CallRegularCC(group->clip); @@ -709,7 +708,7 @@ ComputeCoordinates(Item item, PushClip(group, False); - for (current_item = group->head; current_item != RADAR_NO_ITEM; + for (current_item = group->head; current_item != ZN_NO_ITEM; current_item = current_item->next) { /* * Skip the clip item, it has been already updated. @@ -717,13 +716,13 @@ ComputeCoordinates(Item item, * be updated later. */ if ((current_item == group->clip) || - (current_item->connected_item != RADAR_NO_ITEM)) { + (current_item->connected_item != ZN_NO_ITEM)) { continue; } if (force || - ISSET(current_item->inv_flags, RADAR_COORDS_FLAG) || - ISSET(current_item->inv_flags, RADAR_TRANSFO_FLAG)) { - if (current_item->class != RadarGroup) { + 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); } @@ -739,13 +738,13 @@ ComputeCoordinates(Item item, * items can be concerned. */ if (group->dependents) { - num_deps = RadarListSize(group->dependents); - deps = (Item *) RadarListArray(group->dependents); + num_deps = ZnListSize(group->dependents); + deps = (Item *) ZnListArray(group->dependents); for (i = 0; i < num_deps; i++) { current_item = deps[i]; if (force || - ISSET(current_item->inv_flags, RADAR_COORDS_FLAG) || - ISSET(current_item->inv_flags, RADAR_TRANSFO_FLAG) || + ISSET(current_item->inv_flags, ZN_COORDS_FLAG) || + ISSET(current_item->inv_flags, ZN_TRANSFO_FLAG) || ISSET(current_item->connected_item->flags, UPDATE_DEPENDENT_BIT)) { /*printf("Updating dependent: %d\n", current_item->id);*/ CallRegularCC(current_item); @@ -764,7 +763,7 @@ ComputeCoordinates(Item item, */ ResetBBox(&item->item_bounding_box); current_item = group->head; - while (current_item != RADAR_NO_ITEM) { + while (current_item != ZN_NO_ITEM) { AddBBoxToBBox(&item->item_bounding_box, ¤t_item->item_bounding_box); current_item = current_item->next; } @@ -785,18 +784,18 @@ 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) { GroupItem group = (GroupItem) item; Item current_item; - RadarBBox enclosing, inter; + ZnBBox enclosing, inter; int result; - RadarBool outside = True; - RadarBool atomic = ISSET(item->flags, ATOMIC_BIT); + ZnBool outside = True; + ZnBool atomic = ISSET(item->flags, ATOMIC_BIT); PushTransform(item); @@ -806,7 +805,7 @@ ToArea(Item item, enclosing.corner.y = area->corner.y + 1; current_item = group->head; - while (current_item != RADAR_NO_ITEM) { + while (current_item != ZN_NO_ITEM) { if (ISCLEAR(current_item->flags, VISIBLE_BIT) && ISCLEAR(current_item->flags, SENSITIVE_BIT)) { goto cont_ta; @@ -815,7 +814,7 @@ ToArea(Item item, if (IsEmptyBBox(&inter)) { goto cont_ta; } - if (current_item->class != RadarGroup) { + if (current_item->class != ZnGroup) { PushTransform(current_item); } @@ -844,10 +843,10 @@ ToArea(Item item, } } if (!atomic && (result >= enclosed)) { - DoItem(item->wi->interp, current_item, RADAR_NO_PART, tag_uid); + DoItem(item->wi->interp, current_item, ZN_NO_PART, tag_uid); } - if (current_item->class != RadarGroup) { + if (current_item->class != ZnGroup) { PopTransform(current_item); } cont_ta: @@ -883,32 +882,32 @@ Draw(Item item) GroupItem group = (GroupItem) item; WidgetInfo *wi = item->wi; Item current_item; - RadarBBox bbox; - RadarBBox old_damaged_area; + ZnBBox bbox; + ZnBBox old_damaged_area; PushTransform(item); PushClip(group, True); - if ((group->clip != RADAR_NO_ITEM) && wi->current_clip) { + if ((group->clip != ZN_NO_ITEM) && wi->current_clip) { old_damaged_area = wi->damaged_area; IntersectBBox(&wi->damaged_area, &wi->current_clip->clip_box, &bbox); wi->damaged_area = bbox; } current_item = group->tail; - while (current_item != RADAR_NO_ITEM) { + while (current_item != ZN_NO_ITEM) { if (ISSET(current_item->flags, VISIBLE_BIT)) { IntersectBBox(&wi->damaged_area, ¤t_item->item_bounding_box, &bbox); if (!IsEmptyBBox(&bbox)) { - if (current_item->class != RadarGroup) { + if (current_item->class != ZnGroup) { PushTransform(current_item); } current_item->class->Draw(current_item); if (wi->draw_bboxes) { XGCValues values; - values.foreground = RadarPixel(wi->bbox_color); + values.foreground = ZnPixel(wi->bbox_color); values.fill_style = FillSolid; values.line_width = 1; - values.line_style = (current_item->class==RadarGroup)?LineOnOffDash:LineSolid; + 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, @@ -919,7 +918,7 @@ Draw(Item item) current_item->item_bounding_box.corner.y - current_item->item_bounding_box.orig.y); } - if (current_item->class != RadarGroup) { + if (current_item->class != ZnGroup) { PopTransform(current_item); } } @@ -927,7 +926,7 @@ Draw(Item item) current_item = current_item->previous; } - if ((group->clip != RADAR_NO_ITEM) && wi->current_clip) { + if ((group->clip != ZN_NO_ITEM) && wi->current_clip) { wi->damaged_area = old_damaged_area; } PopClip(group, True); @@ -942,14 +941,14 @@ Draw(Item item) * ********************************************************************************** */ -static RadarBool +static ZnBool IsSensitive(Item item, int item_part) { - RadarBool sensitive = ISSET(item->flags, SENSITIVE_BIT); + ZnBool sensitive = ISSET(item->flags, SENSITIVE_BIT); Item parent = item->parent; - while (sensitive && (parent != RADAR_NO_ITEM)) { + while (sensitive && (parent != ZN_NO_ITEM)) { sensitive &= ISSET(item->flags, SENSITIVE_BIT); parent = parent->parent; } @@ -969,7 +968,7 @@ IsSensitive(Item item, * 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 RADAR_NO_ITEM/RADAR_NO_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. * @@ -980,24 +979,24 @@ IsSensitive(Item item, */ static double Pick(Item item, - RadarPoint *p, + ZnPoint *p, Item start_item, int aperture, Item *a_item, int *a_part) { - GroupItem group = (GroupItem) item; - Item p_item, current_item; - WidgetInfo *wi = item->wi; - int p_part; - double dist, best = 1e10; - RadarBBox bbox, inter; - RadarBool in_depth; + GroupItem group = (GroupItem) item; + Item p_item, current_item; + WidgetInfo *wi = item->wi; + int p_part; + double dist, best = 1e10; + ZnBBox bbox, inter; + ZnBool in_depth; - *a_item= RADAR_NO_ITEM; - *a_part = RADAR_NO_PART; + *a_item= ZN_NO_ITEM; + *a_part = ZN_NO_PART; - if (group->head == RADAR_NO_ITEM) { + if (group->head == ZN_NO_ITEM) { return best; } @@ -1016,13 +1015,13 @@ Pick(Item item, } } - if ((start_item == RADAR_NO_ITEM) || (start_item->parent == item)) { + if ((start_item == ZN_NO_ITEM) || (start_item->parent == item)) { in_depth = False; } else { in_depth = True; } - if ((start_item == RADAR_NO_ITEM) || (start_item->parent != item)) { + if ((start_item == ZN_NO_ITEM) || (start_item->parent != item)) { current_item = group->head; } else { @@ -1038,13 +1037,13 @@ Pick(Item item, if (IsEmptyBBox(&inter)) { goto cont; } - if (current_item->class != RadarGroup) { + if (current_item->class != ZnGroup) { if (in_depth) { goto cont; } PushTransform(current_item); p_item = current_item; - p_part = RADAR_NO_PART; + p_part = ZN_NO_PART; dist = current_item->class->Pick(current_item, p, NULL, aperture, &p_item, &p_part); PopTransform(current_item); @@ -1071,7 +1070,7 @@ Pick(Item item, } cont: current_item = current_item->next; - } while (current_item != RADAR_NO_ITEM); + } while (current_item != ZN_NO_ITEM); out: PopClip(group, False); @@ -1091,39 +1090,39 @@ 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) { if ((cmd == COORDS_ADD) || (cmd == COORDS_ADD_LAST) || (cmd == COORDS_REMOVE)) { Tcl_AppendResult(item->wi->interp, " groups 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 groups", NULL); - return RADAR_ERROR; + return ZN_ERROR; } if (!item->transfo) { - item->transfo = RadarTransfoNew(); + item->transfo = ZnTransfoNew(); } - RadarSetTranslation(item->transfo, (*pts)[0].x, (*pts)[0].y); - ITEM.Invalidate(item, RADAR_TRANSFO_FLAG); + ZnSetTranslation(item->transfo, (*pts)[0].x, (*pts)[0].y); + ITEM.Invalidate(item, ZN_TRANSFO_FLAG); } else if ((cmd == COORDS_READ) || (cmd == COORDS_READ_ALL)) { - RadarPoint *p; + ZnPoint *p; - RadarListAssertSize(item->wi->work_pts, 1); - p = (RadarPoint *) RadarListArray(item->wi->work_pts); - RadarTransfoDecompose(item->transfo, NULL, p, NULL, NULL); + ZnListAssertSize(item->wi->work_pts, 1); + p = (ZnPoint *) ZnListArray(item->wi->work_pts); + ZnTransfoDecompose(item->transfo, NULL, p, NULL, NULL); *num_pts = 1; *pts = p; } - return RADAR_OK; + return ZN_OK; } @@ -1172,4 +1171,4 @@ static ItemClassStruct GROUP_ITEM_CLASS = { PostScript }; -RadarItemClassId RadarGroup = (RadarItemClassId) &GROUP_ITEM_CLASS; +ZnItemClassId ZnGroup = (ZnItemClassId) &GROUP_ITEM_CLASS; diff --git a/generic/Icon.c b/generic/Icon.c index b5f4de0..d92c0b1 100644 --- a/generic/Icon.c +++ b/generic/Icon.c @@ -50,55 +50,55 @@ typedef struct _IconItemStruct { ItemStruct header; /* Public data */ - RadarPoint pos; + ZnPoint pos; char *image_name; - RadarAnchor anchor; - RadarAnchor connection_anchor; + ZnAnchor anchor; + ZnAnchor connection_anchor; Pixmap mask; /* Used only if the image is *NOT* specified */ - RadarColor color; /* Used with the mask */ + ZnColor color; /* Used with the mask */ /* Private data */ - RadarPoint pos_dev; - RadarImage image; + ZnPoint pos_dev; + ZnImage image; } IconItemStruct, *IconItem; -static RadarAttrConfig icon_attrs[] = { - { RADAR_CONFIG_ANCHOR, "-anchor", NULL, - Tk_Offset(IconItemStruct, anchor), 0, RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_COLOR, "-color", NULL, - Tk_Offset(IconItemStruct, color), 0, RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_BOOL, "-composerotation", NULL, +static ZnAttrConfig icon_attrs[] = { + { ZN_CONFIG_ANCHOR, "-anchor", NULL, + Tk_Offset(IconItemStruct, anchor), 0, ZN_COORDS_FLAG, False }, + { ZN_CONFIG_COLOR, "-color", NULL, + Tk_Offset(IconItemStruct, color), 0, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_BOOL, "-composerotation", NULL, Tk_Offset(IconItemStruct, 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(IconItemStruct, header.flags), COMPOSE_SCALE_BIT, - RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_ITEM, "-connecteditem", NULL, + ZN_COORDS_FLAG, False }, + { ZN_CONFIG_ITEM, "-connecteditem", NULL, Tk_Offset(IconItemStruct, header.connected_item), 0, - RADAR_COORDS_FLAG|RADAR_ITEM_FLAG, False }, - { RADAR_CONFIG_ANCHOR, "-connectionanchor", NULL, - Tk_Offset(IconItemStruct, connection_anchor), 0, RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_IMAGE, "-image", NULL, + ZN_COORDS_FLAG|ZN_ITEM_FLAG, False }, + { ZN_CONFIG_ANCHOR, "-connectionanchor", NULL, + Tk_Offset(IconItemStruct, connection_anchor), 0, ZN_COORDS_FLAG, False }, + { ZN_CONFIG_IMAGE, "-image", NULL, Tk_Offset(IconItemStruct, image_name), 0, - RADAR_COORDS_FLAG|RADAR_IMAGE_FLAG, False }, - { RADAR_CONFIG_PATTERN, "-mask", NULL, - Tk_Offset(IconItemStruct, mask), 0, RADAR_DRAW_FLAG|RADAR_REPICK_FLAG, False }, - { RADAR_CONFIG_POINT, "-position", NULL, Tk_Offset(IconItemStruct, pos), 0, - RADAR_COORDS_FLAG, False}, - { RADAR_CONFIG_PRI, "-priority", NULL, + ZN_COORDS_FLAG|ZN_IMAGE_FLAG, False }, + { ZN_CONFIG_PATTERN, "-mask", NULL, + Tk_Offset(IconItemStruct, mask), 0, ZN_DRAW_FLAG|ZN_REPICK_FLAG, False }, + { ZN_CONFIG_POINT, "-position", NULL, Tk_Offset(IconItemStruct, pos), 0, + ZN_COORDS_FLAG, False}, + { ZN_CONFIG_PRI, "-priority", NULL, Tk_Offset(IconItemStruct, 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(IconItemStruct, header.flags), SENSITIVE_BIT, - RADAR_REPICK_FLAG, False }, - { RADAR_CONFIG_TAGS, "-tags", NULL, + ZN_REPICK_FLAG, False }, + { ZN_CONFIG_TAGS, "-tags", NULL, Tk_Offset(IconItemStruct, header.tags), 0, 0, False }, - { RADAR_CONFIG_BOOL, "-visible", NULL, + { ZN_CONFIG_BOOL, "-visible", NULL, Tk_Offset(IconItemStruct, 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 } }; @@ -121,7 +121,7 @@ IconImageChange(ClientData client_data, IconItem icon = (IconItem) client_data; InvalidateImage(icon->image); - ITEM.Invalidate((Item) icon, RADAR_COORDS_FLAG); + ITEM.Invalidate((Item) icon, ZN_COORDS_FLAG); } @@ -149,13 +149,13 @@ Init(Item item, icon->pos.x = icon->pos.y = 0.0; icon->image_name = ""; - icon->image = RadarUnspecifiedImage; - icon->anchor = RadarAnchorNW; - icon->connection_anchor = RadarAnchorSW; - icon->mask = RadarUnspecifiedPattern; - icon->color = RadarGetColorByValue(wi->win, wi->fore_color); + icon->image = ZnUnspecifiedImage; + icon->anchor = ZnAnchorNW; + icon->connection_anchor = ZnAnchorSW; + icon->mask = ZnUnspecifiedPattern; + icon->color = ZnGetColorByValue(wi->win, wi->fore_color); - return RADAR_OK; + return ZN_OK; } @@ -174,17 +174,17 @@ Clone(Item item) char *text; if (strlen(icon->image_name) != 0) { - text = RadarMalloc((strlen(icon->image_name) + 1) * sizeof(char)); + text = ZnMalloc((strlen(icon->image_name) + 1) * sizeof(char)); strcpy(text, icon->image_name); icon->image_name = text; icon->image = Tk_GetImage(wi->interp, wi->win, icon->image_name, IconImageChange, (ClientData) icon); } - if (icon->mask != RadarUnspecifiedPattern) { + if (icon->mask != ZnUnspecifiedPattern) { icon->mask = Tk_GetBitmap(wi->interp, wi->win, Tk_NameOfBitmap(wi->dpy, icon->mask)); } - icon->color = RadarGetColorByValue(wi->win, icon->color); + icon->color = ZnGetColorByValue(wi->win, icon->color); } @@ -202,17 +202,17 @@ Destroy(Item item) IconItem icon = (IconItem) item; if (strlen(icon->image_name) != 0) { - RadarFree(icon->image_name); + ZnFree(icon->image_name); } - if (icon->image != RadarUnspecifiedImage) { + if (icon->image != ZnUnspecifiedImage) { Tk_FreeImage(icon->image); - icon->image = RadarUnspecifiedImage; + icon->image = ZnUnspecifiedImage; } - if (icon->mask != RadarUnspecifiedPattern) { + if (icon->mask != ZnUnspecifiedPattern) { Tk_FreeBitmap(wi->dpy, icon->mask); - icon->mask = RadarUnspecifiedPattern; + icon->mask = ZnUnspecifiedPattern; } - RadarFreeColor(icon->color); + ZnFreeColor(icon->color); } @@ -226,7 +226,7 @@ Destroy(Item item) static int Configure(Item item, int argc, - RadarAttrList argv, + ZnAttrList argv, int *flags) { IconItem icon = (IconItem) item; @@ -234,16 +234,16 @@ Configure(Item item, Item old_connected; old_connected = item->connected_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_ITEM_FLAG)) { + if (ISSET(*flags, ZN_ITEM_FLAG)) { /* * If the new connected item is not appropriate back up * to the old one. */ - if ((item->connected_item == RADAR_NO_ITEM) || + if ((item->connected_item == ZN_NO_ITEM) || (item->connected_item->class->has_anchors && (item->parent == item->connected_item->parent))) { ITEM.UpdateItemDependency(item, old_connected); @@ -253,7 +253,7 @@ Configure(Item item, } } - if (ISSET(*flags, RADAR_IMAGE_FLAG)) { + if (ISSET(*flags, ZN_IMAGE_FLAG)) { Tk_Image image; if (strcmp(icon->image_name, "") != 0) { @@ -264,19 +264,19 @@ Configure(Item item, * The name will not be in sync with the image in * this case. */ - return RADAR_ERROR; + return ZN_ERROR; } } else { - image = RadarUnspecifiedImage; + image = ZnUnspecifiedImage; } - if (icon->image != RadarUnspecifiedImage) { + if (icon->image != ZnUnspecifiedImage) { Tk_FreeImage(icon->image); } icon->image = image; } - return RADAR_OK; + return ZN_OK; } @@ -290,13 +290,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; } @@ -309,11 +309,11 @@ Query(Item item, */ static void ComputeCoordinates(Item item, - RadarBool force) + ZnBool force) { WidgetInfo *wi = item->wi; IconItem icon = (IconItem) item; - RadarDim width, height; + ZnDim width, height; int w, h; ResetBBox(&item->item_bounding_box); @@ -321,12 +321,12 @@ ComputeCoordinates(Item item, /* * If there is no image and no mask then nothing to show. */ - if (icon->image == RadarUnspecifiedImage && - icon->mask == RadarUnspecifiedPattern) { + if (icon->image == ZnUnspecifiedImage && + icon->mask == ZnUnspecifiedPattern) { return; } - if (icon->image != RadarUnspecifiedImage) { + if (icon->image != ZnUnspecifiedImage) { Tk_SizeOfImage(icon->image, &w, &h); } else { @@ -339,13 +339,13 @@ ComputeCoordinates(Item item, * The connected item support anchors, this is checked by * configure. */ - if (item->connected_item != RADAR_NO_ITEM) { + if (item->connected_item != ZN_NO_ITEM) { item->connected_item->class->GetAnchor(item->connected_item, icon->connection_anchor, &icon->pos_dev); } else { - RadarTransformPoint(wi->current_transfo, &icon->pos, &icon->pos_dev); + ZnTransformPoint(wi->current_transfo, &icon->pos, &icon->pos_dev); } Anchor2Origin(&icon->pos_dev, width, height, icon->anchor, @@ -379,11 +379,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) { /* IconItem icon = (IconItem) item;*/ @@ -408,7 +408,7 @@ Draw(Item item) ImageBits *im_bits; Pixmap pmap, mask_pmap; - if (icon->image != RadarUnspecifiedImage) { + if (icon->image != ZnUnspecifiedImage) { if (wi->current_clip) { if (wi->current_clip->simple) { Tk_RedrawImage(icon->image, @@ -430,7 +430,7 @@ Draw(Item item) */ im_bits = GetImageBits(wi->win, icon->image); pmap = GetImagePixmap(wi->win, icon->image); - if (im_bits->mask == RadarUnspecifiedPattern) { + if (im_bits->mask == ZnUnspecifiedPattern) { XCopyArea(wi->dpy, pmap, wi->draw_buffer, wi->gc, item->item_bounding_box.orig.x-icon->pos_dev.x, item->item_bounding_box.orig.y-icon->pos_dev.y, @@ -444,7 +444,7 @@ Draw(Item item) /* * Build of the mask */ - mask_pmap = XCreatePixmap(wi->dpy, RadarWindowId(wi->win), + mask_pmap = XCreatePixmap(wi->dpy, ZnWindowId(wi->win), im_bits->width, im_bits->height, 1); gc = XCreateGC(wi->dpy, mask_pmap, 0, NULL); XFillRectangle(wi->dpy, mask_pmap, gc, 0, 0, im_bits->width, im_bits->height); @@ -489,12 +489,12 @@ Draw(Item item) item->item_bounding_box.orig.y); } } - else if (icon->mask != RadarUnspecifiedPattern) { + else if (icon->mask != ZnUnspecifiedPattern) { values.fill_style = FillStippled; values.stipple = icon->mask; values.ts_x_origin = icon->pos_dev.x; values.ts_y_origin = icon->pos_dev.y; - values.foreground = RadarPixel(icon->color); + values.foreground = ZnPixel(icon->color); gc_mask |= GCFillStyle | GCStipple | GCTileStipXOrigin | GCTileStipYOrigin | GCForeground; XChangeGC(wi->dpy, wi->gc, gc_mask, &values); XFillRectangle(wi->dpy, wi->draw_buffer, wi->gc, @@ -513,12 +513,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)); } @@ -531,7 +531,7 @@ IsSensitive(Item item, */ static double Pick(Item item, - RadarPoint *p, + ZnPoint *p, Item start_item, int aperture, Item *a_item, @@ -557,12 +557,12 @@ Pick(Item item, if (dist <= 0.0) { XImage *bitmap=NULL; ImageBits *im_bits; - RadarPoint dp; + ZnPoint dp; dist = 0.0; dp.x = p->x - item->item_bounding_box.orig.x; dp.y = p->y - item->item_bounding_box.orig.y; - if (icon->image != RadarUnspecifiedImage) { + if (icon->image != ZnUnspecifiedImage) { Tk_SizeOfImage(icon->image, &width, &height); if (dp.x >= width || dp.y >= height) { dist = off_dist; @@ -571,7 +571,7 @@ Pick(Item item, im_bits = GetImageBits(wi->win, icon->image); bitmap = im_bits->mask; } - else if (icon->mask != RadarUnspecifiedPattern) { + else if (icon->mask != ZnUnspecifiedPattern) { Tk_SizeOfBitmap(wi->dpy, icon->mask, &width, &height); if (dp.x >= width || dp.y >= height) { dist = off_dist; @@ -579,7 +579,7 @@ Pick(Item item, } bitmap = GetBitmapMask(wi->dpy, icon->mask); } - if (bitmap != RadarUnspecifiedPattern) { + if (bitmap != ZnUnspecifiedPattern) { /*printf("dpx=%g, dpy=%g, width=%d, height=%d, pixel=%ld\n", dp.x, dp.y, width, height, XGetPixel(bitmap, (int) dp.x, (int) dp.y));*/ if (! XGetPixel(bitmap, (int) dp.x, (int) dp.y)) { @@ -620,13 +620,13 @@ PostScript(Item item, */ static void GetAnchor(Item item, - RadarAnchor anchor, - RadarPoint *p) + ZnAnchor anchor, + ZnPoint *p) { IconItem icon = (IconItem) item; - if ((icon->image != RadarUnspecifiedImage) || - (icon->mask != RadarUnspecifiedPattern)) { + if ((icon->image != ZnUnspecifiedImage) || + (icon->mask != ZnUnspecifiedPattern)) { Origin2Anchor(&icon->pos_dev, item->item_bounding_box.corner.x-item->item_bounding_box.orig.x, item->item_bounding_box.corner.y-item->item_bounding_box.orig.y, @@ -646,13 +646,13 @@ GetAnchor(Item item, * ********************************************************************************** */ -static RadarBool -GetClipVertices(Item item, - RadarPoint **points, - int *num_points) +static ZnBool +GetClipVertices(Item item, + ZnPoint **points, + int *num_points) { - RadarListAssertSize(item->wi->work_pts, 2); - *points = (RadarPoint *) RadarListArray(item->wi->work_pts); + ZnListAssertSize(item->wi->work_pts, 2); + *points = (ZnPoint *) ZnListArray(item->wi->work_pts); *num_points = 2; (*points)[0] = item->item_bounding_box.orig; (*points)[1] = item->item_bounding_box.corner; @@ -672,33 +672,33 @@ 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) { IconItem icon = (IconItem) item; if ((cmd == COORDS_ADD) || (cmd == COORDS_ADD_LAST) || (cmd == COORDS_REMOVE)) { Tcl_AppendResult(item->wi->interp, " icons 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 icons", NULL); - return RADAR_ERROR; + return ZN_ERROR; } icon->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 = &icon->pos; } - return RADAR_OK; + return ZN_OK; } @@ -733,4 +733,4 @@ static ItemClassStruct ICON_ITEM_CLASS = { PostScript }; -RadarItemClassId RadarIcon = (RadarItemClassId) &ICON_ITEM_CLASS; +ZnItemClassId ZnIcon = (ZnItemClassId) &ICON_ITEM_CLASS; diff --git a/generic/Image.c b/generic/Image.c index 1b9093b..e568beb 100644 --- a/generic/Image.c +++ b/generic/Image.c @@ -62,8 +62,8 @@ static Tcl_HashTable bitmap_masks; ********************************************************************************** */ ImageBits * -GetImageBits(RadarWindow win, - RadarImage image) +GetImageBits(ZnWindow win, + ZnImage image) { static int inited = 0; Tcl_HashEntry *entry; @@ -75,7 +75,7 @@ GetImageBits(RadarWindow win, XGCValues values; GC gc; ImageBits *im_bits; - RadarBool full_mask=True; + ZnBool full_mask=True; if (!inited) { Tcl_InitHashTable(&image_bits, TCL_ONE_WORD_KEYS); @@ -87,9 +87,9 @@ GetImageBits(RadarWindow win, } else { Tk_SizeOfImage(image, &width, &height); - im_bits = (ImageBits *) RadarMalloc(sizeof(ImageBits)); + im_bits = (ImageBits *) ZnMalloc(sizeof(ImageBits)); im_bits->pixmaps = NULL; - pmap = XCreatePixmap(dpy, RadarWindowId(win), width, height, depth); + pmap = XCreatePixmap(dpy, ZnWindowId(win), width, height, depth); values.foreground = 0; gc = XCreateGC(dpy, pmap, GCForeground, &values); @@ -110,7 +110,7 @@ GetImageBits(RadarWindow win, /* * The image structure can be setup locally (TODO). */ - pmap = XCreatePixmap(dpy, RadarWindowId(win), width, height, 1); + pmap = XCreatePixmap(dpy, ZnWindowId(win), width, height, 1); values.foreground = 0; gc = XCreateGC(dpy, pmap, GCForeground, &values); XFillRectangle(dpy, pmap, gc, 0, 0, width, height); @@ -132,7 +132,7 @@ GetImageBits(RadarWindow win, XDestroyImage(im2); if (full_mask) { XDestroyImage(mask); - im_bits->mask = RadarUnspecifiedPattern; + im_bits->mask = ZnUnspecifiedPattern; } else { im_bits->mask = mask; @@ -146,7 +146,7 @@ GetImageBits(RadarWindow win, } void -InvalidateImage(RadarImage image) +InvalidateImage(ZnImage image) { Tcl_HashEntry *entry; ImageBits *im_bits; @@ -167,10 +167,10 @@ InvalidateImage(RadarImage image) while (im_pmap) { next_im_pmap = im_pmap->next; XFreePixmap(im_pmap->dpy, im_pmap->pixmap); - RadarFree(im_pmap); + ZnFree(im_pmap); im_pmap = next_im_pmap; } - RadarFree(im_bits); + ZnFree(im_bits); Tcl_DeleteHashEntry(entry); } } @@ -184,8 +184,8 @@ InvalidateImage(RadarImage image) ********************************************************************************** */ Pixmap -GetImagePixmap(RadarWindow win, - RadarImage image) +GetImagePixmap(ZnWindow win, + ZnImage image) { ImageBits *im_bits; Display *dpy = Tk_Display(win); @@ -200,10 +200,10 @@ GetImagePixmap(RadarWindow win, next_im_pmap = next_im_pmap->next; } if (!im_pmap || (im_pmap->dpy != dpy)) { - next_im_pmap = (ImagePixmap *) RadarMalloc(sizeof(ImagePixmap)); + next_im_pmap = (ImagePixmap *) ZnMalloc(sizeof(ImagePixmap)); next_im_pmap->next = NULL; next_im_pmap->dpy = dpy; - pixmap = XCreatePixmap(dpy, RadarWindowId(win), + pixmap = XCreatePixmap(dpy, ZnWindowId(win), im_bits->width, im_bits->height, depth); Tk_RedrawImage(image, 0, 0, im_bits->width, im_bits->height, pixmap, 0, 0); next_im_pmap->pixmap = pixmap; diff --git a/generic/Image.h b/generic/Image.h index b04c673..085bfa0 100644 --- a/generic/Image.h +++ b/generic/Image.h @@ -44,13 +44,13 @@ typedef struct { ImageBits * -GetImageBits(RadarWindow /* win */, - RadarImage /* image */); +GetImageBits(ZnWindow /* win */, + ZnImage /* image */); Pixmap -GetImagePixmap(RadarWindow /* win */, - RadarImage /* image */); +GetImagePixmap(ZnWindow /* win */, + ZnImage /* image */); void -InvalidateImage(RadarImage /* image */); +InvalidateImage(ZnImage /* image */); XImage * GetBitmapMask(Display */* dpy */, Pixmap /* bitmap */); diff --git a/generic/Item.c b/generic/Item.c index 5a7b92f..54a0d42 100644 --- a/generic/Item.c +++ b/generic/Item.c @@ -42,7 +42,7 @@ #include "MapInfo.h" #include "Image.h" #include "Color.h" -#include "tkRadar.h" +#include "tkZinc.h" static const char rcsid[] = "$Id$"; @@ -56,8 +56,8 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ " #define CACHE_OK 16 -static RadarList item_classes = NULL; -static RadarList item_stack = NULL; +static ZnList item_classes = NULL; +static ZnList item_stack = NULL; /* @@ -65,25 +65,25 @@ static RadarList item_stack = NULL; */ typedef struct _FieldStruct { /* Public data */ - RadarColor color; - RadarColor back_color; - RadarColor border_color; + ZnColor color; + ZnColor back_color; + ZnColor border_color; Pixmap fill_pattern; char *text; char *image_name; char *tile_name; - RadarFont font; + ZnFont font; unsigned char flags; Border border_edges; - RadarJustify alignment; + ZnJustify alignment; ReliefStyle relief; int relief_thickness; AutoAlign auto_alignment; /* Private data */ - RadarImage image; - RadarImage tile; - RadarColorGradient gradient; + ZnImage image; + ZnImage tile; + ZnColorGradient gradient; short orig_x; short orig_y; short corner_x; @@ -94,48 +94,48 @@ typedef struct _FieldStruct { /* * The -text, -image, -border, -relief, -visible and - * -filled attributes set the RADAR_COORDS_FLAG to update + * -filled attributes set the ZN_COORDS_FLAG to update * the leader that might protude if not clipped by the text. */ -RadarAttrConfig field_attrs[] = { - { RADAR_CONFIG_JUSTIFY, "-alignment", NULL, - Tk_Offset(FieldStruct, alignment), 0, RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_AUTO_JUSTIFY, "-autoalignment", NULL, - Tk_Offset(FieldStruct, auto_alignment), 0, RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_COLOR, "-backcolor", NULL, +ZnAttrConfig field_attrs[] = { + { ZN_CONFIG_JUSTIFY, "-alignment", NULL, + Tk_Offset(FieldStruct, alignment), 0, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_AUTO_JUSTIFY, "-autoalignment", NULL, + Tk_Offset(FieldStruct, auto_alignment), 0, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_COLOR, "-backcolor", NULL, Tk_Offset(FieldStruct, back_color), 0, - RADAR_DRAW_FLAG|RADAR_BORDER_FLAG, False }, - { RADAR_CONFIG_BORDER, "-border", NULL, - Tk_Offset(FieldStruct, border_edges), 0, RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_COLOR, "-bordercolor", NULL, - Tk_Offset(FieldStruct, border_color), 0, RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_COLOR, "-color", NULL, - Tk_Offset(FieldStruct, color), 0, RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_BOOL, "-filled", NULL, - Tk_Offset(FieldStruct, flags), FILLED_BIT, RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_PATTERN, "-fillpattern", NULL, - Tk_Offset(FieldStruct, fill_pattern), 0, RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_FONT, "-font", NULL, - Tk_Offset(FieldStruct, font), 0, RADAR_DRAW_FLAG|RADAR_CLFC_FLAG, False }, - { RADAR_CONFIG_IMAGE, "-image", NULL, + ZN_DRAW_FLAG|ZN_BORDER_FLAG, False }, + { ZN_CONFIG_BORDER, "-border", NULL, + Tk_Offset(FieldStruct, border_edges), 0, ZN_COORDS_FLAG, False }, + { ZN_CONFIG_COLOR, "-bordercolor", NULL, + Tk_Offset(FieldStruct, border_color), 0, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_COLOR, "-color", NULL, + Tk_Offset(FieldStruct, color), 0, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_BOOL, "-filled", NULL, + Tk_Offset(FieldStruct, flags), FILLED_BIT, ZN_COORDS_FLAG, False }, + { ZN_CONFIG_PATTERN, "-fillpattern", NULL, + Tk_Offset(FieldStruct, fill_pattern), 0, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_FONT, "-font", NULL, + Tk_Offset(FieldStruct, font), 0, ZN_DRAW_FLAG|ZN_CLFC_FLAG, False }, + { ZN_CONFIG_IMAGE, "-image", NULL, Tk_Offset(FieldStruct, image_name), 0, - RADAR_COORDS_FLAG|RADAR_IMAGE_FLAG|RADAR_CLFC_FLAG, False }, - { RADAR_CONFIG_RELIEF, "-relief", NULL, - Tk_Offset(FieldStruct, relief), 0, RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_DIM, "-reliefthickness", NULL, - Tk_Offset(FieldStruct, relief_thickness), 0, RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_BOOL, "-sensitive", NULL, - Tk_Offset(FieldStruct, flags), FIELD_SENSITIVE_BIT, RADAR_REPICK_FLAG, False }, - { RADAR_CONFIG_TEXT, "-text", NULL, - Tk_Offset(FieldStruct, text), 0, RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_IMAGE, "-tile", NULL, + ZN_COORDS_FLAG|ZN_IMAGE_FLAG|ZN_CLFC_FLAG, False }, + { ZN_CONFIG_RELIEF, "-relief", NULL, + Tk_Offset(FieldStruct, relief), 0, ZN_COORDS_FLAG, False }, + { ZN_CONFIG_DIM, "-reliefthickness", NULL, + Tk_Offset(FieldStruct, relief_thickness), 0, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_BOOL, "-sensitive", NULL, + Tk_Offset(FieldStruct, flags), FIELD_SENSITIVE_BIT, ZN_REPICK_FLAG, False }, + { ZN_CONFIG_TEXT, "-text", NULL, + Tk_Offset(FieldStruct, text), 0, ZN_COORDS_FLAG, False }, + { ZN_CONFIG_IMAGE, "-tile", NULL, Tk_Offset(FieldStruct, tile_name), 0, - RADAR_COORDS_FLAG|RADAR_TILE_FLAG|RADAR_CLFC_FLAG, False }, - { RADAR_CONFIG_BOOL, "-visible", NULL, + ZN_COORDS_FLAG|ZN_TILE_FLAG|ZN_CLFC_FLAG, False }, + { ZN_CONFIG_BOOL, "-visible", NULL, Tk_Offset(FieldStruct, flags), FIELD_VISIBLE_BIT, - RADAR_COORDS_FLAG|RADAR_CLFC_FLAG, False }, /* Keep RADAR_COORDS_FLAG here */ + ZN_COORDS_FLAG|ZN_CLFC_FLAG, False }, /* Keep ZN_COORDS_FLAG here */ - { RADAR_CONFIG_END, NULL, NULL, 0, 0, 0 } + { ZN_CONFIG_END, NULL, NULL, 0, 0, 0 } }; /* @@ -184,13 +184,13 @@ static char *attribute_type_strings[] = { * ********************************************************************************** */ -static void Damage(WidgetInfo *wi, RadarBBox *damage); +static void Damage(WidgetInfo *wi, ZnBBox *damage); static void Invalidate(Item item, int reason); static int ConfigureField(FieldSet field_set, unsigned int field, - int argc, RadarAttrList argv, int *flags); + int argc, ZnAttrList argv, int *flags); static int QueryField(FieldSet field_set, unsigned int field, - int argc, RadarAttrList argv); -static Arg AttributeToString(WidgetInfo *wi, char *record, RadarAttrConfig *desc, + int argc, ZnAttrList argv); +static Arg AttributeToString(WidgetInfo *wi, char *record, ZnAttrConfig *desc, char *buffer, Tcl_FreeProc **free_proc); static void FieldImageChange(ClientData client_data, int x, int y, int width, int height, int image_width, int image_height); @@ -206,13 +206,13 @@ static void FieldTileChange(ClientData client_data, int x, int y, int width, ********************************************************************************** */ static void -InitAttrDesc(RadarAttrConfig *attr_desc) +InitAttrDesc(ZnAttrConfig *attr_desc) { if (!attr_desc) { return; } - while (attr_desc->type != RADAR_CONFIG_END) { + while (attr_desc->type != ZN_CONFIG_END) { attr_desc->uid = Tk_GetUid(attr_desc->name); attr_desc++; } @@ -232,18 +232,18 @@ AttributesInfo(Item item, int argc, Arg *args) { - WidgetInfo *wi = item->wi; - char *record; - RadarAttrConfig *desc; - Tk_Uid attr_uid = NULL; + WidgetInfo *wi = item->wi; + char *record; + ZnAttrConfig *desc; + Tk_Uid attr_uid = NULL; #ifndef PTK - Arg entries[5]; + Arg entries[5]; #else - Arg *entries; + Arg *entries; #endif - Arg result; - char buffer[256]; - Tcl_FreeProc *free_proc; + Arg result; + char buffer[256]; + Tcl_FreeProc *free_proc; if (field < 0) { record = (char *) item; @@ -254,12 +254,12 @@ AttributesInfo(Item item, if (!item->class->has_fields) { Tcl_AppendResult(wi->interp, "item class \"", item->class->name, "\" doesn't support fields", NULL); - return RADAR_ERROR; + return ZN_ERROR; } field_set = item->class->GetFieldSet(item); if (field >= field_set->num_fields) { Tcl_AppendResult(wi->interp, "invalid field index \"", NULL); - return RADAR_ERROR; + return ZN_ERROR; } record = (char *) &field_set->fields[field]; desc = field_attrs; @@ -269,10 +269,10 @@ AttributesInfo(Item item, attr_uid = Tk_GetUid(LangString(args[0])); while (True) { - if (desc->type == RADAR_CONFIG_END) { + if (desc->type == ZN_CONFIG_END) { Tcl_AppendResult(wi->interp, "unknown attribute \"", LangString(args[0]), "\"", NULL); - return RADAR_ERROR; + return ZN_ERROR; } else if (attr_uid == desc->uid) { break; @@ -294,7 +294,7 @@ AttributesInfo(Item item, result = Tcl_Merge(5, entries); #ifndef PTK if (free_proc == TCL_DYNAMIC) { - RadarFree(entries[4]); + ZnFree(entries[4]); } Tcl_SetResult(wi->interp, result, TCL_DYNAMIC); #else @@ -303,7 +303,7 @@ AttributesInfo(Item item, #endif } else { - while (desc->type != RADAR_CONFIG_END) { + while (desc->type != ZN_CONFIG_END) { #ifdef PTK entries = LangAllocVec(5); LangSetInt(&entries[2], desc->read_only ? 1 : 0); @@ -317,10 +317,10 @@ AttributesInfo(Item item, result = Tcl_Merge(5, entries); #ifndef PTK if (free_proc == TCL_DYNAMIC) { - RadarFree(entries[4]); + ZnFree(entries[4]); } Tcl_AppendElement(wi->interp, result); - RadarFree(result); + ZnFree(result); #else LangFreeVec(5, entries); Tcl_AppendArg(wi->interp, result); @@ -347,14 +347,14 @@ ConfigureAttributes(char *record, Arg *args, int *flags) { - WidgetInfo *wi; - Item item = NULL; - int i; - Tk_Uid attr_uid; - RadarAttrConfig *desc; - RadarPtr valp; - RadarAttrConfig *attr_desc; - FieldSet field_set = NULL; + WidgetInfo *wi; + Item item = NULL; + int i; + Tk_Uid attr_uid; + ZnAttrConfig *desc; + ZnPtr valp; + ZnAttrConfig *attr_desc; + FieldSet field_set = NULL; if (field < 0) { @@ -367,7 +367,7 @@ ConfigureAttributes(char *record, wi = field_set->wi; if (field >= field_set->num_fields) { Tcl_AppendResult(wi->interp, "invalid field index \"", NULL); - return RADAR_ERROR; + return ZN_ERROR; } record = (char *) &field_set->fields[field]; /*printf("record <0x%X>, field %d\n", record, field);*/ @@ -379,51 +379,51 @@ ConfigureAttributes(char *record, desc = attr_desc; while (True) { - if (desc->type == RADAR_CONFIG_END) { + if (desc->type == ZN_CONFIG_END) { /*printf("ERROR: record <0x%X>\n", record);*/ Tcl_AppendResult(wi->interp, "unknown attribute \"", LangString(args[i]), "\"", NULL); - return RADAR_ERROR; + return ZN_ERROR; } else if (attr_uid == desc->uid) { if (desc->read_only) { Tcl_AppendResult(wi->interp, "attribute \"", LangString(args[i]), "\" can only be read", NULL); - return RADAR_ERROR; + return ZN_ERROR; } valp = record + desc->offset; /*printf("record <0x%X>, valp <0x%X>, offset %d\n", record, valp, desc->offset);*/ switch (desc->type) { - case RADAR_CONFIG_COLOR: + case ZN_CONFIG_COLOR: { XColor *color; Tk_Uid new_name = Tk_GetUid(LangString(args[i+1])); char *name = NULL; if (*((XColor **) valp)) { - name = RadarNameOfColor(*((XColor **) valp)); + name = ZnNameOfColor(*((XColor **) valp)); } if (name != new_name) { - color = RadarGetColor(wi->interp, wi->win, new_name); + color = ZnGetColor(wi->interp, wi->win, new_name); if (!color) { Tcl_AppendResult(wi->interp, " color expected for attribute \"", LangString(args[i]), "\"", NULL); - return RADAR_ERROR; + return ZN_ERROR; } if (*((XColor **) valp)) { - RadarFreeColor(*((XColor **) valp)); + ZnFreeColor(*((XColor **) valp)); } *((XColor **) valp) = color; *flags |= desc->flags; } break; } - case RADAR_CONFIG_BOOL: + case ZN_CONFIG_BOOL: { int b; - if (Tcl_GetBoolean(wi->interp, args[i+1], &b) != RADAR_OK) { + if (Tcl_GetBoolean(wi->interp, args[i+1], &b) != ZN_OK) { Tcl_AppendResult(wi->interp, " boolean expected for attribute \"", LangString(args[i]), "\"", NULL); - return RADAR_ERROR; + return ZN_ERROR; } if (b ^ (ISSET(*((char *) valp), desc->bool_bit) != 0)) { ASSIGN(*((char *) valp), desc->bool_bit, b); @@ -431,11 +431,11 @@ ConfigureAttributes(char *record, } break; } - case RADAR_CONFIG_PATTERN: + case ZN_CONFIG_PATTERN: { - Pixmap pattern = RadarUnspecifiedPattern; + Pixmap pattern = ZnUnspecifiedPattern; char *name = ""; - if (*((Pixmap *) valp) != RadarUnspecifiedPattern) { + if (*((Pixmap *) valp) != ZnUnspecifiedPattern) { name = Tk_NameOfBitmap(wi->dpy, *((Pixmap *) valp)); } if (strcmp(name, LangString(args[i+1])) != 0) { @@ -444,10 +444,10 @@ ConfigureAttributes(char *record, if (pattern == None) { Tcl_AppendResult(wi->interp, " pattern expected for attribute \"", LangString(args[i]), "\"", NULL); - return RADAR_ERROR; + return ZN_ERROR; } } - if (*((Pixmap *) valp) != RadarUnspecifiedPattern) { + if (*((Pixmap *) valp) != ZnUnspecifiedPattern) { Tk_FreeBitmap(wi->dpy, *((Pixmap *) valp)); } *((Pixmap *) valp) = pattern; @@ -455,19 +455,19 @@ ConfigureAttributes(char *record, } break; } - case RADAR_CONFIG_PATTERNS: + case ZN_CONFIG_PATTERNS: { - RadarList new_pat_list = NULL; - Pixmap *pats; - int num_pats, result, j; - Arg *elems; + ZnList new_pat_list = NULL; + Pixmap *pats; + int num_pats, result, j; + Arg *elems; #ifdef PTK LangFreeProc *freeProc = NULL; #endif if (strlen(LangString(args[i+1])) != 0) { result = Lang_SplitList(wi->interp, args[i+1], &num_pats, &elems, &freeProc); - if (result == RADAR_ERROR) { + if (result == ZN_ERROR) { Tcl_AppendResult(wi->interp, " pattern list expected for attribute \"", LangString(args[i]), "\"", NULL); @@ -476,12 +476,12 @@ ConfigureAttributes(char *record, (*freeProc)(num_pats, elems); } #endif - return RADAR_ERROR; + return ZN_ERROR; } if (num_pats) { - new_pat_list = RadarListNew(num_pats, sizeof(Pixmap)); - RadarListAssertSize(new_pat_list, num_pats); - pats = (Pixmap *) RadarListArray(new_pat_list); + new_pat_list = ZnListNew(num_pats, sizeof(Pixmap)); + ZnListAssertSize(new_pat_list, num_pats); + pats = (Pixmap *) ZnListArray(new_pat_list); for (j = 0; j < num_pats; j++) { if (strlen(LangString(elems[j])) != 0) { pats[j] = Tk_GetBitmap(wi->interp, wi->win, @@ -490,55 +490,55 @@ ConfigureAttributes(char *record, Tcl_AppendResult(wi->interp, " unknown pattern \"", LangString(elems[j]), "\" in pattern list", NULL); - RadarListFree(new_pat_list); + ZnListFree(new_pat_list); #ifndef PTK - RadarFree(elems); + ZnFree(elems); #else if (freeProc) { (*freeProc)(num_pats, elems); } #endif - return RADAR_ERROR; + return ZN_ERROR; } } else { - pats[j] = RadarUnspecifiedPattern; + pats[j] = ZnUnspecifiedPattern; } } } - RadarFree(elems); + ZnFree(elems); } - if (*((RadarList *) valp)) { - num_pats = RadarListSize(*((RadarList *) valp)); - pats = (Pixmap *) RadarListArray(*((RadarList *) valp)); + if (*((ZnList *) valp)) { + num_pats = ZnListSize(*((ZnList *) valp)); + pats = (Pixmap *) ZnListArray(*((ZnList *) valp)); for (j = 0; j < num_pats; j++) { - if (pats[j] != RadarUnspecifiedPattern) { + if (pats[j] != ZnUnspecifiedPattern) { Tk_FreeBitmap(wi->dpy, pats[j]); } } - RadarListFree(*((RadarList *) valp)); - *((RadarList *) valp) = new_pat_list; + ZnListFree(*((ZnList *) valp)); + *((ZnList *) valp) = new_pat_list; *flags |= desc->flags; } else { if (new_pat_list) { - *((RadarList *) valp) = new_pat_list; + *((ZnList *) valp) = new_pat_list; *flags |= desc->flags; } } break; } - case RADAR_CONFIG_TAGS: + case ZN_CONFIG_TAGS: { - int num_tags, result, j; - Arg *elems; + int num_tags, result, j; + Arg *elems; #ifdef PTK LangFreeProc *freeProc = NULL; #endif if (strlen(LangString(args[i+1])) != 0) { result = Lang_SplitList(wi->interp, args[i+1], &num_tags, &elems, &freeProc); - if (result == RADAR_ERROR) { + if (result == ZN_ERROR) { Tcl_AppendResult(wi->interp, " tag list expected for attribute \"", LangString(args[i]), "\"", NULL); @@ -547,9 +547,9 @@ ConfigureAttributes(char *record, (*freeProc)(num_tags, elems); } #endif - return RADAR_ERROR; + return ZN_ERROR; } - if (*((RadarList *) valp)) { + if (*((ZnList *) valp)) { ITEM.FreeTags(item); *flags |= desc->flags; } @@ -560,7 +560,7 @@ ConfigureAttributes(char *record, *flags |= desc->flags; } #ifndef PTK - RadarFree(elems); + ZnFree(elems); #else if (freeProc) { (*freeProc)(num_tags, elems); @@ -569,25 +569,25 @@ ConfigureAttributes(char *record, } break; } - case RADAR_CONFIG_TEXT: - case RADAR_CONFIG_MAP_INFO: - case RADAR_CONFIG_IMAGE: + case ZN_CONFIG_TEXT: + case ZN_CONFIG_MAP_INFO: + case ZN_CONFIG_IMAGE: { char *text = ""; if (strcmp(LangString(args[i+1]), *((char **) valp)) != 0) { if (strlen(LangString(args[i+1])) != 0) { - text = (char *) RadarMalloc(strlen(LangString(args[i+1]))+1); + text = (char *) ZnMalloc(strlen(LangString(args[i+1]))+1); strcpy(text, LangString(args[i+1])); } if (strlen(*((char **) valp)) != 0) { - RadarFree(*((char **) valp)); + ZnFree(*((char **) valp)); } *((char **) valp) = text; *flags |= desc->flags; } break; } - case RADAR_CONFIG_FONT: + case ZN_CONFIG_FONT: { Tk_Font font; char *name = ""; @@ -599,7 +599,7 @@ ConfigureAttributes(char *record, if (!font) { Tcl_AppendResult(wi->interp, " font expected for attribute \"", LangString(args[i]), "\"", NULL); - return RADAR_ERROR; + return ZN_ERROR; } if (*((Tk_Font *) valp)) { Tk_FreeFont(*((Tk_Font *) valp)); @@ -609,17 +609,17 @@ ConfigureAttributes(char *record, } break; } - case RADAR_CONFIG_BORDER: + case ZN_CONFIG_BORDER: { Border border = NO_BORDER; - int j, len, largc, result; - Arg *largv; + int j, len, largc, result; + Arg *largv; #ifdef PTK LangFreeProc *freeProc = NULL; #endif result = Lang_SplitList(wi->interp, args[i+1], &largc, &largv, &freeProc); - if (result == RADAR_ERROR) { + if (result == ZN_ERROR) { border_error: Tcl_AppendResult(wi->interp, " border expected for attribute \"", LangString(args[i]), "\"", NULL); @@ -628,7 +628,7 @@ ConfigureAttributes(char *record, (*freeProc)(largc, largv); } #endif - return RADAR_ERROR; + return ZN_ERROR; } len = strlen(LangString(args[i+1])); for (j = 0; j < largc; j++) { @@ -658,13 +658,13 @@ ConfigureAttributes(char *record, } else { #ifndef PTK - RadarFree(largv); + ZnFree(largv); #endif goto border_error; } } #ifndef PTK - RadarFree(largv); + ZnFree(largv); #else if (largv != NULL && freeProc) { (*freeProc)(largc, largv); @@ -676,7 +676,7 @@ ConfigureAttributes(char *record, } break; } - case RADAR_CONFIG_LINE_SHAPE: + case ZN_CONFIG_LINE_SHAPE: { LineShape line_shape; int len; @@ -705,7 +705,7 @@ ConfigureAttributes(char *record, else { Tcl_AppendResult(wi->interp, " line shape expected for attribute \"", LangString(args[i]), "\"", NULL); - return RADAR_ERROR; + return ZN_ERROR; } if (line_shape != *((LineShape *) valp)) { *((LineShape *) valp) = line_shape; @@ -713,7 +713,7 @@ ConfigureAttributes(char *record, } break; } - case RADAR_CONFIG_LINE_STYLE: + case ZN_CONFIG_LINE_STYLE: { LineStyle line_style; int len; @@ -729,7 +729,7 @@ ConfigureAttributes(char *record, else { Tcl_AppendResult(wi->interp, " line style expected for attribute \"", LangString(args[i]), "\"", NULL); - return RADAR_ERROR; + return ZN_ERROR; } if (line_style != *((LineStyle *) valp)) { *((LineStyle *) valp) = line_style; @@ -737,14 +737,14 @@ ConfigureAttributes(char *record, } break; } - case RADAR_CONFIG_LINE_END: + case ZN_CONFIG_LINE_END: { LineEnd line_end = NULL; char *ptr = LangString(args[i+1]); if (strlen(ptr) != 0) { line_end = LineEndCreate(wi->interp, LangString(args[i+1])); if (line_end == NULL) { - return RADAR_ERROR; + return ZN_ERROR; } } if (*((LineEnd *) valp) != NULL) { @@ -760,13 +760,13 @@ ConfigureAttributes(char *record, } break; } - case RADAR_CONFIG_RELIEF: + case ZN_CONFIG_RELIEF: { int relief; - if (Tk_GetRelief(wi->interp, LangString(args[i+1]), &relief) == RADAR_ERROR) { + if (Tk_GetRelief(wi->interp, LangString(args[i+1]), &relief) == ZN_ERROR) { Tcl_AppendResult(wi->interp, " relief expected for attribute \"", LangString(args[i]), "\"", NULL); - return RADAR_ERROR; + return ZN_ERROR; } if (relief != *((ReliefStyle *) valp)) { /*printf("valp <0x%X>, flags <0x%X>, relief %d\n", valp, flags, relief);*/ @@ -775,13 +775,13 @@ ConfigureAttributes(char *record, } break; } - case RADAR_CONFIG_JOIN_STYLE: + case ZN_CONFIG_JOIN_STYLE: { int join; - if (Tk_GetJoinStyle(wi->interp, LangString(args[i+1]), &join) == RADAR_ERROR) { + if (Tk_GetJoinStyle(wi->interp, LangString(args[i+1]), &join) == ZN_ERROR) { Tcl_AppendResult(wi->interp, " join expected for attribute \"", LangString(args[i]), "\"", NULL); - return RADAR_ERROR; + return ZN_ERROR; } if (join != *((int *) valp)) { *((int *) valp) = join; @@ -789,13 +789,13 @@ ConfigureAttributes(char *record, } break; } - case RADAR_CONFIG_CAP_STYLE: + case ZN_CONFIG_CAP_STYLE: { int cap; - if (Tk_GetCapStyle(wi->interp, LangString(args[i+1]), &cap) == RADAR_ERROR) { + if (Tk_GetCapStyle(wi->interp, LangString(args[i+1]), &cap) == ZN_ERROR) { Tcl_AppendResult(wi->interp, " cap expected for attribute \"", LangString(args[i]), "\"", NULL); - return RADAR_ERROR; + return ZN_ERROR; } if (cap != *((int *) valp)) { *((int *) valp) = cap; @@ -803,17 +803,17 @@ ConfigureAttributes(char *record, } break; } - case RADAR_CONFIG_POINT: + case ZN_CONFIG_POINT: { - RadarPoint point; - int largc, result; - Arg *largv; + ZnPoint point; + int largc, result; + Arg *largv; #ifdef PTK - LangFreeProc *freeProc = NULL; + LangFreeProc *freeProc = NULL; #endif result = Lang_SplitList(wi->interp, args[i+1], &largc, &largv, &freeProc); - if (result == RADAR_ERROR || largc != 2) { + if (result == ZN_ERROR || largc != 2) { point_error: #ifdef PTK if (largv != NULL && freeProc) { @@ -822,40 +822,40 @@ ConfigureAttributes(char *record, #endif Tcl_AppendResult(wi->interp, " position expected for attribute \"", LangString(args[i]), "\"", NULL); - return RADAR_ERROR; + return ZN_ERROR; } - if ((Tcl_GetDouble(wi->interp, largv[0], &point.x) == RADAR_ERROR) || - (Tcl_GetDouble(wi->interp, largv[1], &point.y) == RADAR_ERROR)) { + if ((Tcl_GetDouble(wi->interp, largv[0], &point.x) == ZN_ERROR) || + (Tcl_GetDouble(wi->interp, largv[1], &point.y) == ZN_ERROR)) { #ifndef PTK - RadarFree(largv); + ZnFree(largv); #endif goto point_error; } #ifndef PTK - RadarFree(largv); + ZnFree(largv); #else if (largv != NULL && freeProc) { (*freeProc)(largc, largv); } #endif - if ((point.x != ((RadarPoint *) valp)->x) || - (point.y != ((RadarPoint *) valp)->y)) { - *((RadarPoint *) valp) = point; + if ((point.x != ((ZnPoint *) valp)->x) || + (point.y != ((ZnPoint *) valp)->y)) { + *((ZnPoint *) valp) = point; *flags |= desc->flags; } break; } - case RADAR_CONFIG_RECT: + case ZN_CONFIG_RECT: { - RadarRect rect; - int largc, result; - Arg *largv; + ZnRect rect; + int largc, result; + Arg *largv; #ifdef PTK LangFreeProc *freeProc = NULL; #endif result = Lang_SplitList(wi->interp, args[i+1], &largc, &largv, &freeProc); - if (result == RADAR_ERROR || largc != 4) { + if (result == ZN_ERROR || largc != 4) { rect_error: #ifdef PTK if (largv != NULL && freeProc) { @@ -864,40 +864,40 @@ ConfigureAttributes(char *record, #endif Tcl_AppendResult(wi->interp, " rectangle expected for attribute \"", LangString(args[i]), "\"", NULL); - return RADAR_ERROR; + return ZN_ERROR; } - if ((Tcl_GetDouble(wi->interp, largv[0], &rect.x) == RADAR_ERROR) || - (Tcl_GetDouble(wi->interp, largv[1], &rect.y) == RADAR_ERROR) || - (Tcl_GetDouble(wi->interp, largv[2], &rect.w) == RADAR_ERROR) || - (Tcl_GetDouble(wi->interp, largv[3], &rect.h) == RADAR_ERROR)) { + if ((Tcl_GetDouble(wi->interp, largv[0], &rect.x) == ZN_ERROR) || + (Tcl_GetDouble(wi->interp, largv[1], &rect.y) == ZN_ERROR) || + (Tcl_GetDouble(wi->interp, largv[2], &rect.w) == ZN_ERROR) || + (Tcl_GetDouble(wi->interp, largv[3], &rect.h) == ZN_ERROR)) { #ifndef PTK - RadarFree(largv); + ZnFree(largv); #endif goto rect_error; } #ifndef PTK - RadarFree(largv); + ZnFree(largv); #else if (largv != NULL && freeProc) { (*freeProc)(largc, largv); } #endif - if ((rect.x != ((RadarRect *) valp)->x) && - (rect.y != ((RadarRect *) valp)->y) && - (rect.w != ((RadarRect *) valp)->w) && - (rect.h != ((RadarRect *) valp)->h)) { - *((RadarRect *) valp) = rect; + if ((rect.x != ((ZnRect *) valp)->x) && + (rect.y != ((ZnRect *) valp)->y) && + (rect.w != ((ZnRect *) valp)->w) && + (rect.h != ((ZnRect *) valp)->h)) { + *((ZnRect *) valp) = rect; *flags |= desc->flags; } break; } - case RADAR_CONFIG_DIM: + case ZN_CONFIG_DIM: { int size; - if (Tk_GetPixels(wi->interp, wi->win, LangString(args[i+1]), &size) == RADAR_ERROR) { + if (Tk_GetPixels(wi->interp, wi->win, LangString(args[i+1]), &size) == ZN_ERROR) { Tcl_AppendResult(wi->interp, " dimension expected for attribute \"", LangString(args[i]), "\"", NULL); - return RADAR_ERROR; + return ZN_ERROR; } if (size != *((int *) valp)) { *((int *) valp) = size; @@ -905,25 +905,25 @@ ConfigureAttributes(char *record, } break; } - case RADAR_CONFIG_PRI: + case ZN_CONFIG_PRI: { int pri; - if (Tcl_GetInt(wi->interp, args[i+1], &pri) == RADAR_ERROR) { - return RADAR_ERROR; + if (Tcl_GetInt(wi->interp, args[i+1], &pri) == ZN_ERROR) { + return ZN_ERROR; } if (pri < 0) { Tcl_AppendResult(wi->interp, " priority must be a positive integer \"", LangString(args[i+1]), "\"", NULL); - return RADAR_ERROR; + return ZN_ERROR; } if (pri != *((int *) valp)) { *((int *) valp) = pri; - ITEM.UpdateItemPriority((Item) record, RADAR_NO_ITEM, True); + ITEM.UpdateItemPriority((Item) record, ZN_NO_ITEM, True); *flags |= desc->flags; } break; } - case RADAR_CONFIG_ITEM: + case ZN_CONFIG_ITEM: /* * Can be an item id or a tag. In this last case * consider only the first item (unspecified order) @@ -933,12 +933,12 @@ ConfigureAttributes(char *record, Item item2; int num; if (strlen(LangString(args[i+1])) == 0) { - item2 = RADAR_NO_ITEM; + item2 = ZN_NO_ITEM; } else { - num = RadarItemsWithTagOrId(wi, LangString(args[i+1]), &item2, NULL); + num = ZnItemsWithTagOrId(wi, LangString(args[i+1]), &item2, NULL); if (num == 0) { - return RADAR_ERROR; + return ZN_ERROR; } } if (item2 != *((Item *) valp)) { @@ -947,26 +947,26 @@ ConfigureAttributes(char *record, } } break; - case RADAR_CONFIG_INT: - case RADAR_CONFIG_UINT: - case RADAR_CONFIG_ANGLE: + case ZN_CONFIG_INT: + case ZN_CONFIG_UINT: + case ZN_CONFIG_ANGLE: { int integer; - if (Tcl_GetInt(wi->interp, args[i+1], &integer) == RADAR_ERROR) { - return RADAR_ERROR; + if (Tcl_GetInt(wi->interp, args[i+1], &integer) == ZN_ERROR) { + return ZN_ERROR; } - if (desc->type == RADAR_CONFIG_ANGLE) { + if (desc->type == ZN_CONFIG_ANGLE) { if ((integer < 0) || (integer > 360)) { Tcl_AppendResult(wi->interp, " angle must be between 0 and 360 \"", LangString(args[i+1]), "\"", NULL); - return RADAR_ERROR; + return ZN_ERROR; } } - else if (desc->type == RADAR_CONFIG_UINT) { + else if (desc->type == ZN_CONFIG_UINT) { if (integer < 0) { Tcl_AppendResult(wi->interp, " positive integer expected for \"", LangString(args[i]), "\"", NULL); - return RADAR_ERROR; + return ZN_ERROR; } } if (integer != *((int *) valp)) { @@ -975,35 +975,35 @@ ConfigureAttributes(char *record, } break; } - case RADAR_CONFIG_JUSTIFY: + case ZN_CONFIG_JUSTIFY: { Tk_Justify justify; - if (Tk_GetJustify(wi->interp, LangString(args[i+1]), &justify) == RADAR_ERROR) { + if (Tk_GetJustify(wi->interp, LangString(args[i+1]), &justify) == ZN_ERROR) { Tcl_AppendResult(wi->interp, " justify expected for attribute \"", LangString(args[i]), "\"", NULL); - return RADAR_ERROR; + return ZN_ERROR; } - if (justify != *((RadarJustify *) valp)) { - *((RadarJustify *) valp) = justify; + if (justify != *((ZnJustify *) valp)) { + *((ZnJustify *) valp) = justify; *flags |= desc->flags; } break; } - case RADAR_CONFIG_ANCHOR: + case ZN_CONFIG_ANCHOR: { Tk_Anchor anchor; - if (Tk_GetAnchor(wi->interp, LangString(args[i+1]), &anchor) == RADAR_ERROR) { + if (Tk_GetAnchor(wi->interp, LangString(args[i+1]), &anchor) == ZN_ERROR) { Tcl_AppendResult(wi->interp, " anchor expected for attribute \"", LangString(args[i]), "\"", NULL); - return RADAR_ERROR; + return ZN_ERROR; } - if (anchor != *((RadarAnchor *) valp)) { - *((RadarAnchor *) valp) = anchor; + if (anchor != *((ZnAnchor *) valp)) { + *((ZnAnchor *) valp) = anchor; *flags |= desc->flags; } break; } - case RADAR_CONFIG_LABEL_FORMAT: + case ZN_CONFIG_LABEL_FORMAT: { LabelFormat frmt = NULL; char *ptr = LangString(args[i+1]); @@ -1015,7 +1015,7 @@ ConfigureAttributes(char *record, frmt = LabelFormatCreate(wi->interp, ptr, item->class->GetFieldSet(item)->num_fields); if (frmt == NULL) { - return RADAR_ERROR; + return ZN_ERROR; } } @@ -1033,7 +1033,7 @@ ConfigureAttributes(char *record, break; } - case RADAR_CONFIG_AUTO_JUSTIFY: + case ZN_CONFIG_AUTO_JUSTIFY: { AutoAlign aa; int j; @@ -1046,27 +1046,27 @@ ConfigureAttributes(char *record, switch(LangString(args[i+1])[j]) { case 'l': case 'L': - aa.align[j] = RadarJustifyLeft; + aa.align[j] = ZnJustifyLeft; break; case 'c': case 'C': - aa.align[j] = RadarJustifyCenter; + aa.align[j] = ZnJustifyCenter; break; case 'r': case 'R': - aa.align[j] = RadarJustifyRight; + aa.align[j] = ZnJustifyRight; break; default: Tcl_AppendResult(wi->interp, "invalid auto justify specifcation \"", LangString(args[i+1]), "\" should be - or a triple of lcr", NULL); - return RADAR_ERROR; + return ZN_ERROR; } } } else { Tcl_AppendResult(wi->interp, "invalid auto alignment specification \"", LangString(args[i+1]), "\" should be - or a triple of lcr", NULL); - return RADAR_ERROR; + return ZN_ERROR; } if ((aa.automatic != ((AutoAlign *) valp)->automatic) || (aa.align[0] != ((AutoAlign *) valp)->align[0]) || @@ -1078,7 +1078,7 @@ ConfigureAttributes(char *record, break; } - case RADAR_CONFIG_LEADER_ANCHORS: + case ZN_CONFIG_LEADER_ANCHORS: /* * Format is: lChar leftLeaderAnchor [ lChar rightLeaderAnchor] * @@ -1111,7 +1111,7 @@ ConfigureAttributes(char *record, la_error: Tcl_AppendResult(wi->interp, " incorrect leader anchors \"", LangString(args[i+1]), "\"", NULL); - return RADAR_ERROR; + return ZN_ERROR; } anchors[anchor_index+1] = -1; break; @@ -1142,7 +1142,7 @@ ConfigureAttributes(char *record, * If empty, pick the default (center of the bounding box). */ if (anchor_index != 0) { - lanch = (LeaderAnchors ) RadarMalloc(sizeof(LeaderAnchorsStruct)); + lanch = (LeaderAnchors ) ZnMalloc(sizeof(LeaderAnchorsStruct)); lanch->left_x = anchors[0]; lanch->left_y = anchors[1]; if (anchor_index == 2) { @@ -1155,7 +1155,7 @@ ConfigureAttributes(char *record, } } if (*((LeaderAnchors *) valp) != NULL) { - RadarFree(*((LeaderAnchors *) valp)); + ZnFree(*((LeaderAnchors *) valp)); *((LeaderAnchors *) valp) = lanch; *flags |= desc->flags; } @@ -1175,7 +1175,7 @@ ConfigureAttributes(char *record, } } } - return RADAR_OK; + return ZN_OK; } @@ -1194,7 +1194,7 @@ ConfigureAttributes(char *record, static Arg AttributeToString(WidgetInfo *wi, char *record, - RadarAttrConfig *desc, + ZnAttrConfig *desc, char *buffer, Tcl_FreeProc **free_proc) { @@ -1209,36 +1209,36 @@ AttributeToString(WidgetInfo *wi, *free_proc = TCL_STATIC; switch (desc->type) { - case RADAR_CONFIG_COLOR: + case ZN_CONFIG_COLOR: LangSetString(&result, ""); if (*((XColor **) valp)) { - LangSetString(&result, RadarNameOfColor(*((XColor **) valp))); + LangSetString(&result, ZnNameOfColor(*((XColor **) valp))); } break; - case RADAR_CONFIG_BOOL: + case ZN_CONFIG_BOOL: #ifndef PTK result = ISSET(*((char *) valp), desc->bool_bit) ? "1" : "0"; #else LangSetInt(&result, ISSET(*((char *) valp), desc->bool_bit) ? 1 : 0); #endif break; - case RADAR_CONFIG_PATTERN: + case ZN_CONFIG_PATTERN: LangSetString(&result, ""); if (*((Pixmap *) valp)) { LangSetString(&result, Tk_NameOfBitmap(wi->dpy, *((Pixmap *) valp))); } break; - case RADAR_CONFIG_PATTERNS: + case ZN_CONFIG_PATTERNS: { int num_pats, i; Pixmap *pats; - if (*((RadarList *) valp)) { - pats = (Pixmap *) RadarListArray(*((RadarList *) valp)); - num_pats = RadarListSize(*((RadarList *) valp)); + if (*((ZnList *) valp)) { + pats = (Pixmap *) ZnListArray(*((ZnList *) valp)); + num_pats = ZnListSize(*((ZnList *) valp)); #ifndef PTK if (num_pats > NUM_ELEMS) { - el_ptr = (char **) RadarMalloc(num_pats*sizeof(char *)); + el_ptr = (char **) ZnMalloc(num_pats*sizeof(char *)); } else { el_ptr = elems; @@ -1247,7 +1247,7 @@ AttributeToString(WidgetInfo *wi, el_ptr = LangAllocVec(num_pats); #endif for (i = 0; i < num_pats; i++) { - if (pats[i] != RadarUnspecifiedPattern) { + if (pats[i] != ZnUnspecifiedPattern) { LangSetString(&el_ptr[i], Tk_NameOfBitmap(wi->dpy, pats[i])); } else { @@ -1258,7 +1258,7 @@ AttributeToString(WidgetInfo *wi, *free_proc = TCL_DYNAMIC; #ifndef PTK if (el_ptr != elems) { - RadarFree(el_ptr); + ZnFree(el_ptr); } #else LangFreeVec(num_pats, el_ptr); @@ -1269,17 +1269,17 @@ AttributeToString(WidgetInfo *wi, } break; } - case RADAR_CONFIG_TAGS: + case ZN_CONFIG_TAGS: { int num_tags, i; Tk_Uid *tags; - if (*((RadarList *) valp)) { - tags = (Tk_Uid *) RadarListArray(*((RadarList *) valp)); - num_tags = RadarListSize(*((RadarList *) valp)); + if (*((ZnList *) valp)) { + tags = (Tk_Uid *) ZnListArray(*((ZnList *) valp)); + num_tags = ZnListSize(*((ZnList *) valp)); #ifndef PTK if (num_tags > NUM_ELEMS) { - el_ptr = (char **) RadarMalloc(num_tags*sizeof(char *)); + el_ptr = (char **) ZnMalloc(num_tags*sizeof(char *)); } else { el_ptr = elems; @@ -1294,7 +1294,7 @@ AttributeToString(WidgetInfo *wi, *free_proc = TCL_DYNAMIC; #ifndef PTK if (el_ptr != elems) { - RadarFree(el_ptr); + ZnFree(el_ptr); } #else LangFreeVec(num_tags, el_ptr); @@ -1305,18 +1305,18 @@ AttributeToString(WidgetInfo *wi, } break; } - case RADAR_CONFIG_TEXT: - case RADAR_CONFIG_MAP_INFO: - case RADAR_CONFIG_IMAGE: + case ZN_CONFIG_TEXT: + case ZN_CONFIG_MAP_INFO: + case ZN_CONFIG_IMAGE: LangSetString(&result, *((char **) valp)); break; - case RADAR_CONFIG_FONT: + case ZN_CONFIG_FONT: LangSetString(&result, ""); if (*((Tk_Font *) valp)) { LangSetString(&result, Tk_NameOfFont(*((Tk_Font *) valp))); } break; - case RADAR_CONFIG_BORDER: + case ZN_CONFIG_BORDER: { Border border = *((Border *) valp); if (border == NO_BORDER) { @@ -1366,7 +1366,7 @@ AttributeToString(WidgetInfo *wi, LangSetString(&result, buffer); } break; - case RADAR_CONFIG_LINE_SHAPE: + case ZN_CONFIG_LINE_SHAPE: { LineShape line_shape = *((LineShape *) valp); switch (line_shape) { @@ -1394,7 +1394,7 @@ AttributeToString(WidgetInfo *wi, } break; } - case RADAR_CONFIG_LINE_STYLE: + case ZN_CONFIG_LINE_STYLE: { LineStyle line_style = *((LineStyle *) valp); switch (line_style) { @@ -1413,7 +1413,7 @@ AttributeToString(WidgetInfo *wi, } break; } - case RADAR_CONFIG_LINE_END: + case ZN_CONFIG_LINE_END: { LineEnd line_end = *((LineEnd *) valp); @@ -1425,51 +1425,51 @@ AttributeToString(WidgetInfo *wi, } break; } - case RADAR_CONFIG_RELIEF: + case ZN_CONFIG_RELIEF: LangSetString(&result , Tk_NameOfRelief(*((ReliefStyle *) valp))); break; - case RADAR_CONFIG_JOIN_STYLE: + case ZN_CONFIG_JOIN_STYLE: LangSetString(&result , Tk_NameOfJoinStyle(*((int *) valp))); break; - case RADAR_CONFIG_CAP_STYLE: + case ZN_CONFIG_CAP_STYLE: LangSetString(&result , Tk_NameOfCapStyle(*((int *) valp))); break; - case RADAR_CONFIG_POINT: + case ZN_CONFIG_POINT: { #ifndef PTK *free_proc = TCL_VOLATILE; - sprintf(buffer, "%g %g", ((RadarPoint *) valp)->x, ((RadarPoint *) valp)->y); + sprintf(buffer, "%g %g", ((ZnPoint *) valp)->x, ((ZnPoint *) valp)->y); result = buffer; #else Arg *list = LangAllocVec(2); - LangSetInt(&list[0], ((RadarPoint *) valp)->x); - LangSetInt(&list[1], ((RadarPoint *) valp)->y); + LangSetInt(&list[0], ((ZnPoint *) valp)->x); + LangSetInt(&list[1], ((ZnPoint *) valp)->y); result = Tcl_Merge(2, list); LangFreeVec(2, list); #endif break; } - case RADAR_CONFIG_RECT: + case ZN_CONFIG_RECT: { #ifndef PTK *free_proc = TCL_VOLATILE; sprintf(buffer, "%g %g %g %g", - ((RadarRect *) valp)->x, ((RadarRect *) valp)->y, - ((RadarRect *) valp)->w, ((RadarRect *) valp)->h); + ((ZnRect *) valp)->x, ((ZnRect *) valp)->y, + ((ZnRect *) valp)->w, ((ZnRect *) valp)->h); result = buffer; #else Arg *list = LangAllocVec(4); - LangSetInt(&list[0], ((RadarRect *) valp)->x); - LangSetInt(&list[1], ((RadarRect *) valp)->x); - LangSetInt(&list[2], ((RadarRect *) valp)->w); - LangSetInt(&list[3], ((RadarRect *) valp)->h); + LangSetInt(&list[0], ((ZnRect *) valp)->x); + LangSetInt(&list[1], ((ZnRect *) valp)->x); + LangSetInt(&list[2], ((ZnRect *) valp)->w); + LangSetInt(&list[3], ((ZnRect *) valp)->h); result = Tcl_Merge(4, list); LangFreeVec(4, list); #endif break; } - case RADAR_CONFIG_ITEM: - if (*((Item *) valp) == RADAR_NO_ITEM) { + case ZN_CONFIG_ITEM: + if (*((Item *) valp) == ZN_NO_ITEM) { LangSetString(&result, ""); } else { @@ -1478,25 +1478,25 @@ AttributeToString(WidgetInfo *wi, LangSetString(&result, buffer); } break; - case RADAR_CONFIG_INT: - case RADAR_CONFIG_UINT: - case RADAR_CONFIG_DIM: - case RADAR_CONFIG_PRI: - case RADAR_CONFIG_ANGLE: + case ZN_CONFIG_INT: + case ZN_CONFIG_UINT: + case ZN_CONFIG_DIM: + case ZN_CONFIG_PRI: + case ZN_CONFIG_ANGLE: *free_proc = TCL_VOLATILE; sprintf(buffer, "%d", *((int *) valp)); LangSetString(&result, buffer); break; - case RADAR_CONFIG_JUSTIFY: + case ZN_CONFIG_JUSTIFY: { - Tk_Justify justify = *((RadarJustify *) valp); + Tk_Justify justify = *((ZnJustify *) valp); LangSetString(&result, Tk_NameOfJustify(justify)); break; } - case RADAR_CONFIG_ANCHOR: + case ZN_CONFIG_ANCHOR: LangSetString(&result, Tk_NameOfAnchor(*((Tk_Anchor *) valp))); break; - case RADAR_CONFIG_LABEL_FORMAT: + case ZN_CONFIG_LABEL_FORMAT: { LabelFormat frmt = *((LabelFormat *) valp); @@ -1508,10 +1508,10 @@ AttributeToString(WidgetInfo *wi, } break; } - case RADAR_CONFIG_AUTO_JUSTIFY: + case ZN_CONFIG_AUTO_JUSTIFY: { AutoAlign *aa = (AutoAlign *) valp; - int i; + int i; if (aa->automatic == False) { LangSetString(&result, "-"); } @@ -1520,13 +1520,13 @@ AttributeToString(WidgetInfo *wi, buffer[0] = 0; for (i = 0; i < 3; i++) { switch (aa->align[i]) { - case RadarJustifyLeft: + case ZnJustifyLeft: strcat(buffer, "l"); break; - case RadarJustifyCenter: + case ZnJustifyCenter: strcat(buffer, "c"); break; - case RadarJustifyRight: + case ZnJustifyRight: strcat(buffer, "r"); break; } @@ -1536,7 +1536,7 @@ AttributeToString(WidgetInfo *wi, } break; - case RADAR_CONFIG_LEADER_ANCHORS: + case ZN_CONFIG_LEADER_ANCHORS: { LeaderAnchors lanch = (LeaderAnchors) valp; char *ptr = buffer; @@ -1575,13 +1575,13 @@ QueryAttribute(char *record, int field, /* 0< means item itself. */ Arg attr_name) { - WidgetInfo *wi; - Item item; - Tk_Uid attr_uid = Tk_GetUid(LangString(attr_name)); - Arg result = NULL; - Tcl_FreeProc *free_proc; - char buffer[256]; - RadarAttrConfig *desc; + WidgetInfo *wi; + Item item; + Tk_Uid attr_uid = Tk_GetUid(LangString(attr_name)); + Arg result = NULL; + Tcl_FreeProc *free_proc; + char buffer[256]; + ZnAttrConfig *desc; if (field < 0) { item = (Item) record; @@ -1593,17 +1593,17 @@ QueryAttribute(char *record, wi = field_set->wi; if (field >= field_set->num_fields) { Tcl_AppendResult(wi->interp, "invalid field index \"", NULL); - return RADAR_ERROR; + return ZN_ERROR; } record = (char *) &field_set->fields[field]; desc = field_attrs; } while (True) { - if (desc->type == RADAR_CONFIG_END) { + if (desc->type == ZN_CONFIG_END) { Tcl_AppendResult(wi->interp, "unknown attribute \"", attr_uid, "\"", NULL); - return RADAR_ERROR; + return ZN_ERROR; } else if (attr_uid == desc->uid) { result = AttributeToString(wi, record, desc, buffer, &free_proc); @@ -1618,7 +1618,7 @@ QueryAttribute(char *record, desc++; } } - return RADAR_OK; + return ZN_OK; } @@ -1629,7 +1629,7 @@ QueryAttribute(char *record, * ********************************************************************************** */ -static RadarList +static ZnList ItemClassList() { return item_classes; @@ -1648,8 +1648,8 @@ LookupItemClass(char *class_name) ItemClass *class; int i, num_classes; - class = (ItemClass *) RadarListArray(item_classes); - num_classes = RadarListSize(item_classes); + class = (ItemClass *) ZnListArray(item_classes); + num_classes = ZnListSize(item_classes); for (i = 0; i < num_classes; i++) { if (strcasecmp((class[i])->name, class_name) == 0) { return class[i]; @@ -1670,7 +1670,7 @@ static void AddItemClass(ItemClass class) { if (!LookupItemClass(class->name)) { - RadarListAdd(item_classes, &class, RadarListTail); + ZnListAdd(item_classes, &class, ZnListTail); InitAttrDesc(class->attr_desc); } } @@ -1688,19 +1688,19 @@ GlobalModuleInit() { /* First check if static part already inited */ if (item_classes == NULL) { - item_classes = RadarListNew(16, sizeof(ItemClass)); - AddItemClass(RadarTrack); - AddItemClass(RadarWayPoint); - AddItemClass(RadarMap); - AddItemClass(RadarReticle); - AddItemClass(RadarTabular); - AddItemClass(RadarRectangle); - AddItemClass(RadarArc); - AddItemClass(RadarCurve); - AddItemClass(RadarGroup); - AddItemClass(RadarIcon); - AddItemClass(RadarText); - /*AddItemClass(RadarMosaic);*/ + item_classes = ZnListNew(16, sizeof(ItemClass)); + AddItemClass(ZnTrack); + AddItemClass(ZnWayPoint); + AddItemClass(ZnMap); + AddItemClass(ZnReticle); + AddItemClass(ZnTabular); + AddItemClass(ZnRectangle); + AddItemClass(ZnArc); + AddItemClass(ZnCurve); + AddItemClass(ZnGroup); + AddItemClass(ZnIcon); + AddItemClass(ZnText); + /*AddItemClass(ZnMosaic);*/ InitAttrDesc(field_attrs); } } @@ -1715,13 +1715,13 @@ GlobalModuleInit() ********************************************************************************** */ static void -ComputeFieldAttachment(FieldSet field_set, - int field, - RadarBBox *field_bbox) +ComputeFieldAttachment(FieldSet field_set, + int field, + ZnBBox *field_bbox) { - RadarBBox ref_bbox; - RadarDim real_width, real_height; + ZnBBox ref_bbox; + ZnDim real_width, real_height; int ref_field, num_fields; char x_attach, y_attach, x_dim, y_dim; short width_spec, height_spec; @@ -1731,8 +1731,8 @@ ComputeFieldAttachment(FieldSet field_set, field_ptr = &field_set->fields[field]; if (ISSET(field_ptr->flags, CACHE_OK)) { - field_bbox->orig.x = (RadarPos) field_ptr->orig_x; - field_bbox->orig.y = (RadarPos) field_ptr->orig_y; + field_bbox->orig.x = (ZnPos) field_ptr->orig_x; + field_bbox->orig.y = (ZnPos) field_ptr->orig_y; field_bbox->corner.x = field_ptr->corner_x; field_bbox->corner.y = field_ptr->corner_y; return; @@ -1747,7 +1747,7 @@ ComputeFieldAttachment(FieldSet field_set, * First try to compute the field size which may be a factor * of the field content (but not a factor of other fields). */ - if ((field_ptr->image != RadarUnspecifiedImage) && + if ((field_ptr->image != ZnUnspecifiedImage) && ((x_dim == LF_DIM_ICON) || (y_dim == LF_DIM_ICON) || (x_dim == LF_DIM_AUTO) || (y_dim == LF_DIM_AUTO))) { Tk_SizeOfImage(field_ptr->image, &icon_width, &icon_height); @@ -1755,30 +1755,30 @@ ComputeFieldAttachment(FieldSet field_set, switch (x_dim) { case LF_DIM_FONT: - real_width = (RadarDim) (width_spec*RadarTextWidth(field_ptr->font, "N", 1)/100); + real_width = (ZnDim) (width_spec*ZnTextWidth(field_ptr->font, "N", 1)/100); break; case LF_DIM_ICON: - real_width = (RadarDim) (width_spec*icon_width/100); + real_width = (ZnDim) (width_spec*icon_width/100); break; case LF_DIM_AUTO: { int len = strlen(field_ptr->text); - RadarDim text_width; + ZnDim text_width; real_width = 0.0; - if (field_ptr->image != RadarUnspecifiedImage) { - real_width = (RadarDim) icon_width; + if (field_ptr->image != ZnUnspecifiedImage) { + real_width = (ZnDim) icon_width; } if (len) { - text_width = (RadarDim) RadarTextWidth(field_ptr->font, field_ptr->text, len); + text_width = (ZnDim) ZnTextWidth(field_ptr->font, field_ptr->text, len); real_width = text_width < real_width ? real_width : text_width; } - real_width += (RadarDim) width_spec; + real_width += (ZnDim) width_spec; break; } case LF_DIM_PIXEL: default: - real_width = (RadarDim) width_spec; + real_width = (ZnDim) width_spec; break; } /*printf("field %d, width = %g\n", field, real_width);*/ @@ -1787,31 +1787,31 @@ ComputeFieldAttachment(FieldSet field_set, case LF_DIM_FONT: { Tk_GetFontMetrics(field_ptr->font, &fm); - real_height = (RadarDim) (height_spec*(fm.ascent + fm.descent)/100); + real_height = (ZnDim) (height_spec*(fm.ascent + fm.descent)/100); break; } case LF_DIM_ICON: - real_height = (RadarDim) (height_spec*icon_height/100); + real_height = (ZnDim) (height_spec*icon_height/100); break; case LF_DIM_AUTO: { - RadarDim text_height; + ZnDim text_height; real_height = 0.0; - if (field_ptr->image != RadarUnspecifiedImage) { - real_height = (RadarDim) icon_height; + if (field_ptr->image != ZnUnspecifiedImage) { + real_height = (ZnDim) icon_height; } if (strlen(field_ptr->text)) { Tk_GetFontMetrics(field_ptr->font, &fm); - text_height = (RadarDim) (fm.ascent + fm.descent); + text_height = (ZnDim) (fm.ascent + fm.descent); real_height = text_height < real_height ? real_height : text_height; } - real_height += (RadarDim) height_spec; + real_height += (ZnDim) height_spec; break; } case LF_DIM_PIXEL: default: - real_height = (RadarDim) height_spec; + real_height = (ZnDim) height_spec; break; } /*printf("field %d, height = %g\n", field, real_height);*/ @@ -1833,14 +1833,14 @@ ComputeFieldAttachment(FieldSet field_set, * Do the x axis. */ if (x_attach == LF_ATTACH_PIXEL) { - field_bbox->orig.x = (RadarPos) x_spec; + field_bbox->orig.x = (ZnPos) x_spec; field_bbox->corner.x = field_bbox->orig.x + real_width; } else { ref_field = x_spec; field_bbox->orig.x = field_bbox->corner.x = 0; if ((ref_field < 0) || (ref_field >= num_fields)) { - RadarWarning ("Attached (x) to an inexistant field geometry"); + ZnWarning ("Attached (x) to an inexistant field geometry"); } else { ComputeFieldAttachment(field_set, ref_field, &ref_bbox); @@ -1885,14 +1885,14 @@ ComputeFieldAttachment(FieldSet field_set, * Then the y axis. */ if (y_attach == LF_ATTACH_PIXEL) { - field_bbox->orig.y = (RadarPos) y_spec; + field_bbox->orig.y = (ZnPos) y_spec; field_bbox->corner.y = field_bbox->orig.y + real_height; } else { ref_field = y_spec; field_bbox->orig.y = field_bbox->corner.y = 0; if ((ref_field < 0) || (ref_field >= num_fields)) { - RadarWarning ("Attached (y) to an inexistant field geometry"); + ZnWarning ("Attached (y) to an inexistant field geometry"); } else { ComputeFieldAttachment(field_set, ref_field, &ref_bbox); @@ -1956,7 +1956,7 @@ ClearFieldCache(FieldSet field_set, int field) { int i, num_fields; - RadarBool clear_bbox; + ZnBool clear_bbox; int x_spec, y_spec; char x_attach, y_attach, x_dim, y_dim; short width_spec, height_spec; @@ -2021,13 +2021,13 @@ ClearFieldCache(FieldSet field_set, */ void GetLabelBBox(FieldSet field_set, - RadarDim *w, - RadarDim *h) + ZnDim *w, + ZnDim *h) { - RadarBBox bbox, tmp_bbox; + ZnBBox bbox, tmp_bbox; LabelFormat lf; int i, num_fields; - RadarDim clip_w, clip_h; + ZnDim clip_w, clip_h; if ((field_set->label_width >= 0.0) && (field_set->label_height >= 0.0)) { *w = field_set->label_width; @@ -2081,7 +2081,7 @@ GetLabelBBox(FieldSet field_set, static void GetFieldBBox(FieldSet field_set, unsigned int index, - RadarBBox *field_bbox) + ZnBBox *field_bbox) { if (field_set->label_format) { ComputeFieldAttachment(field_set, index, field_bbox); @@ -2109,28 +2109,28 @@ GetFieldBBox(FieldSet field_set, */ static void ComputeFieldTextLocation(Field field_ptr, - RadarBBox *bbox, - RadarPoint *pos, - RadarBBox *text_bbox) + ZnBBox *bbox, + ZnPoint *pos, + ZnBBox *text_bbox) { - RadarBool relief_thickness; - RadarDim w, h; + ZnBool relief_thickness; + ZnDim w, h; Tk_FontMetrics fm; relief_thickness = (field_ptr->relief != RELIEF_FLAT && field_ptr->relief_thickness > 1) ? field_ptr->relief_thickness : 0; Tk_GetFontMetrics(field_ptr->font, &fm); - w = RadarTextWidth(field_ptr->font, field_ptr->text, strlen(field_ptr->text)); + w = ZnTextWidth(field_ptr->font, field_ptr->text, strlen(field_ptr->text)); h = fm.ascent + fm.descent; text_bbox->orig.y = (bbox->orig.y + bbox->corner.y - h) / 2; text_bbox->corner.y = text_bbox->orig.y + h; pos->y = text_bbox->orig.y + fm.ascent; switch (field_ptr->alignment) { - case RadarJustifyLeft: + case ZnJustifyLeft: text_bbox->orig.x = bbox->orig.x + 1 + relief_thickness; break; - case RadarJustifyRight: + case ZnJustifyRight: text_bbox->orig.x = bbox->corner.x - w - 1 - relief_thickness; break; default: @@ -2152,16 +2152,16 @@ ComputeFieldTextLocation(Field field_ptr, ********************************************************************************** */ static void -LeaderToLabel(FieldSet field_set, - RadarPoint *start, - RadarPoint *end) +LeaderToLabel(FieldSet field_set, + ZnPoint *start, + ZnPoint *end) { int b_num; - RadarPoint delta, inf, sup; - RadarPos xt=0, yu=0, yw=0, xv=0; + ZnPoint delta, inf, sup; + ZnPos xt=0, yu=0, yw=0, xv=0; Field field_ptr; int i; - RadarBBox field_bbox; + ZnBBox field_bbox; /* Intersection points : */ /* T |xt / delta_y U |x1 V |y1 W |yw / delta_x */ @@ -2186,7 +2186,7 @@ LeaderToLabel(FieldSet field_set, ISCLEAR(field_ptr->flags, FILLED_BIT) && (field_ptr->border_edges == NO_BORDER) && (field_ptr->relief == RELIEF_FLAT) && - (field_ptr->image == RadarUnspecifiedImage))) { + (field_ptr->image == ZnUnspecifiedImage))) { continue; } @@ -2204,12 +2204,12 @@ LeaderToLabel(FieldSet field_set, if (*field_ptr->text && ISCLEAR(field_ptr->flags, FILLED_BIT) && (field_ptr->border_edges == NO_BORDER) && (field_ptr->relief == RELIEF_FLAT) && - (field_ptr->image == RadarUnspecifiedImage)) { - RadarBBox text_bbox; - RadarPoint text_pos; /* dummy */ - int space_width; - int scan_forw, scan_back; - space_width = RadarTextWidth(field_ptr->font, " ", 1); + (field_ptr->image == ZnUnspecifiedImage)) { + ZnBBox text_bbox; + ZnPoint text_pos; /* dummy */ + int space_width; + int scan_forw, scan_back; + space_width = ZnTextWidth(field_ptr->font, " ", 1); ComputeFieldTextLocation(field_ptr, &field_bbox, &text_pos, &text_bbox); /* @@ -2338,9 +2338,9 @@ InsertDependentItem(Item item) return; } if (!group->dependents) { - group->dependents = RadarListNew(2, sizeof(Item)); + group->dependents = ZnListNew(2, sizeof(Item)); } - RadarListAdd(group->dependents, &item, RadarListTail); + ZnListAdd(group->dependents, &item, ZnListTail); } @@ -2366,11 +2366,11 @@ ExtractDependentItem(Item item) if (!group || !group->dependents) { return; } - index = RadarListDo(group->dependents, item, CmpItem); + index = ZnListDo(group->dependents, item, CmpItem); if (index >= 0) { - RadarListDelete(group->dependents, index); - if (RadarListSize(group->dependents) == 0) { - RadarListFree(group->dependents); + ZnListDelete(group->dependents, index); + if (ZnListSize(group->dependents) == 0) { + ZnListFree(group->dependents); group->dependents = NULL; } } @@ -2390,11 +2390,11 @@ static void UpdateItemDependency(Item item, Item old_connection) { - if (old_connection == RADAR_NO_ITEM) { + if (old_connection == ZN_NO_ITEM) { /* Add a connection */ InsertDependentItem(item); } - else if (item->connected_item == RADAR_NO_ITEM) { + else if (item->connected_item == ZN_NO_ITEM) { /* Remove a connection */ ExtractDependentItem(item); } @@ -2427,19 +2427,19 @@ DisconnectDependentItems(Item item) if (!group || !group->dependents) { return; } - deps = (Item *) RadarListArray(group->dependents); - num_deps = RadarListSize(group->dependents); + deps = (Item *) ZnListArray(group->dependents); + num_deps = ZnListSize(group->dependents); for (i = num_deps-1; i >= 0; i--) { current_item = deps[i]; if (current_item->connected_item == item) { - current_item->connected_item = RADAR_NO_ITEM; - RadarListDelete(group->dependents, i); - Invalidate(current_item, RADAR_COORDS_FLAG); + current_item->connected_item = ZN_NO_ITEM; + ZnListDelete(group->dependents, i); + Invalidate(current_item, ZN_COORDS_FLAG); } } - if (RadarListSize(group->dependents) == 0) { - RadarListFree(group->dependents); + if (ZnListSize(group->dependents) == 0) { + ZnListFree(group->dependents); group->dependents = NULL; } } @@ -2452,7 +2452,7 @@ DisconnectDependentItems(Item item) * * 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 RADAR_NO_ITEM the insertion is done relative + * 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'. * @@ -2462,7 +2462,7 @@ static void InsertItem(Item item, Item grp, Item mark_item, - RadarBool before) + ZnBool before) { WidgetInfo *wi = item->wi; GroupItem group = (GroupItem) grp; @@ -2473,19 +2473,19 @@ InsertItem(Item item, item->parent = (Item) group; if (mark_item && (mark_item->parent != (Item) group)) { - mark_item = RADAR_NO_ITEM; + mark_item = ZN_NO_ITEM; } /* * Empty list, add the first item. */ - if (group->head == RADAR_NO_ITEM) { + if (group->head == ZN_NO_ITEM) { group->head = item; group->tail = item; - item->previous = item->next = RADAR_NO_ITEM; + item->previous = item->next = ZN_NO_ITEM; return; } - if (mark_item != RADAR_NO_ITEM) { + if (mark_item != ZN_NO_ITEM) { /* * Better leave here, mark_item will not * have the links set right. @@ -2501,20 +2501,20 @@ InsertItem(Item item, } else { mark_item = group->head; - while ((mark_item != RADAR_NO_ITEM) && + while ((mark_item != ZN_NO_ITEM) && (mark_item->priority > item->priority)) { mark_item = mark_item->next; } before = True; } - if (before && (mark_item != RADAR_NO_ITEM)) { + if (before && (mark_item != ZN_NO_ITEM)) { /* * Insert before mark. */ item->next = mark_item; item->previous = mark_item->previous; - if (mark_item->previous == RADAR_NO_ITEM) { + if (mark_item->previous == ZN_NO_ITEM) { group->head = item; } else { @@ -2526,9 +2526,9 @@ InsertItem(Item item, /* * Insert after mark either because 'before' is False * and mark_item valid or because the right place is at - * the end of the list and mark_item is RADAR_NO_ITEM. + * the end of the list and mark_item is ZN_NO_ITEM. */ - if (mark_item == RADAR_NO_ITEM) { + if (mark_item == ZN_NO_ITEM) { group->tail->next = item; item->previous = group->tail; group->tail = item; @@ -2536,7 +2536,7 @@ InsertItem(Item item, else { item->previous = mark_item; item->next = mark_item->next; - if (item->next == RADAR_NO_ITEM) { + if (item->next == ZN_NO_ITEM) { group->tail = item; } else { @@ -2565,22 +2565,22 @@ ExtractItem(Item item) } group = (GroupItem) item->parent; - if (item->previous != RADAR_NO_ITEM) { + if (item->previous != ZN_NO_ITEM) { item->previous->next = item->next; } else { group->head = item->next; } - if (item->next != RADAR_NO_ITEM) { + if (item->next != ZN_NO_ITEM) { item->next->previous = item->previous; } else { group->tail = item->previous; } - item->previous = RADAR_NO_ITEM; - item->next = RADAR_NO_ITEM; + item->previous = ZN_NO_ITEM; + item->next = ZN_NO_ITEM; item->parent = NULL; } @@ -2597,13 +2597,13 @@ ExtractItem(Item item) static void UpdateItemPriority(Item item, Item mark_item, - RadarBool before) + ZnBool before) { Item parent = item->parent; ExtractItem(item); InsertItem(item, parent, mark_item, before); - Invalidate(item, RADAR_DRAW_FLAG); + Invalidate(item, ZN_DRAW_FLAG); SET(item->wi->events_flags, INTERNAL_NEED_REPICK); } @@ -2665,20 +2665,20 @@ AddTag(Item item, int new_entry, num, i; char **ptr; Tcl_HashEntry *entry; - RadarList item_list; + ZnList item_list; /* * No tags yet. */ if (!item->tags) { - item->tags = RadarListNew(1, sizeof(char *)); + item->tags = ZnListNew(1, sizeof(char *)); } else { /* * If the tag is already there, that's done. */ - ptr = (char **) RadarListArray(item->tags); - num = RadarListSize(item->tags); + ptr = (char **) ZnListArray(item->tags); + num = ZnListSize(item->tags); for (i = 0; i < num; i++) { if (ptr[i] == tag) { return; @@ -2688,16 +2688,16 @@ AddTag(Item item, /* * Add it. */ - RadarListAdd(item->tags, &tag, RadarListTail); + ZnListAdd(item->tags, &tag, ZnListTail); entry = Tcl_CreateHashEntry(item->wi->tag_table, tag, &new_entry); if (new_entry) { - item_list = RadarListNew(1, sizeof(Item)); + item_list = ZnListNew(1, sizeof(Item)); Tcl_SetHashValue(entry, item_list); } else { - item_list = (RadarList) Tcl_GetHashValue(entry); + item_list = (ZnList) Tcl_GetHashValue(entry); } - RadarListAdd(item_list, &item, RadarListTail); + ZnListAdd(item_list, &item, ZnListTail); } /* @@ -2715,7 +2715,7 @@ RemoveTag(Item item, char **ptr; Item *item_ptr; Tcl_HashEntry *entry; - RadarList item_list; + ZnList item_list; if (!item->tags) { return; @@ -2723,24 +2723,24 @@ RemoveTag(Item item, /* * look up the tag in the list. */ - ptr = (char **) RadarListArray(item->tags); - num = RadarListSize(item->tags); + ptr = (char **) ZnListArray(item->tags); + num = ZnListSize(item->tags); for (indx = 0; indx < num; indx++) { if (ptr[indx] == tag) { /* The tag list is not freed when empty to avoid * overhead when using tags intensively. */ - RadarListDelete(item->tags, indx); + ZnListDelete(item->tags, indx); entry = Tcl_FindHashEntry(item->wi->tag_table, tag); if (entry) { /* Should not fail */ - item_list = (RadarList) Tcl_GetHashValue(entry); - num = RadarListSize(item_list); - item_ptr = (Item *) RadarListArray(item_list); + item_list = (ZnList) Tcl_GetHashValue(entry); + num = ZnListSize(item_list); + item_ptr = (Item *) ZnListArray(item_list); for (indx = 0; indx < num; indx++) { if (item_ptr[indx] == item) { /* Should not fail to get here */ - RadarListDelete(item_list, indx); - if (RadarListSize(item_list) == 0) { - RadarListFree(item_list); + ZnListDelete(item_list, indx); + if (ZnListSize(item_list) == 0) { + ZnListFree(item_list); Tcl_DeleteHashEntry(entry); } } @@ -2765,32 +2765,32 @@ FreeTags(Item item) char **ts; Item *item_ptr; Tcl_HashEntry *entry; - RadarList item_list; + ZnList item_list; if (!item->tags) { return; } - num = RadarListSize(item->tags); - ts = (char **) RadarListArray(item->tags); + num = ZnListSize(item->tags); + ts = (char **) ZnListArray(item->tags); for (i = 0; i < num; i++) { entry = Tcl_FindHashEntry(item->wi->tag_table, ts[i]); if (entry) { /* Should not fail */ - item_list = (RadarList) Tcl_GetHashValue(entry); - item_ptr = (Item *) RadarListArray(item_list); - num_items = RadarListSize(item_list); + item_list = (ZnList) Tcl_GetHashValue(entry); + item_ptr = (Item *) ZnListArray(item_list); + num_items = ZnListSize(item_list); for (j = 0; j < num_items; j++) { if (item_ptr[j] == item) { /* Should not fail to get here */ - RadarListDelete(item_list, j); - if (RadarListSize(item_list) == 0) { - RadarListFree(item_list); + ZnListDelete(item_list, j); + if (ZnListSize(item_list) == 0) { + ZnListFree(item_list); Tcl_DeleteHashEntry(entry); } } } } } - RadarListFree(item->tags); + ZnListFree(item->tags); item->tags = NULL; } @@ -2814,28 +2814,28 @@ CreateItem(WidgetInfo *wi, int *argc, Arg **args) { - Item item; + Item item; - item = (Item) RadarMalloc(item_class->item_size); + item = (Item) ZnMalloc(item_class->item_size); /* Initialize common state */ item->class = item_class; item->wi = wi; item->parent = NULL; - item->previous = RADAR_NO_ITEM; - item->next = RADAR_NO_ITEM; + item->previous = ZN_NO_ITEM; + item->next = ZN_NO_ITEM; CLEAR(item->flags, UPDATE_DEPENDENT_BIT); item->inv_flags = 0; item->transfo = NULL; item->parent = NULL; - item->connected_item = RADAR_NO_ITEM; + item->connected_item = ZN_NO_ITEM; ResetBBox(&item->item_bounding_box); /* Init item specific attributes */ - if (item_class->Init(item, argc, args) == RADAR_ERROR) { - RadarFree(item); - return RADAR_NO_ITEM; + if (item_class->Init(item, argc, args) == ZN_ERROR) { + ZnFree(item); + return ZN_NO_ITEM; } SetId(item); item->tags = NULL; @@ -2863,30 +2863,30 @@ CloneItem(Item model) int i, num_tags; if (!model->parent) { - return RADAR_NO_ITEM; + return ZN_NO_ITEM; } - item = (Item) RadarMalloc(model->class->item_size); + item = (Item) ZnMalloc(model->class->item_size); memcpy(item, model, model->class->item_size); - item->previous = RADAR_NO_ITEM; - item->next = RADAR_NO_ITEM; - item->connected_item = RADAR_NO_ITEM; + item->previous = ZN_NO_ITEM; + item->next = ZN_NO_ITEM; + item->connected_item = ZN_NO_ITEM; CLEAR(item->flags, UPDATE_DEPENDENT_BIT); item->inv_flags = 0; SetId(item); if (model->tags) { item->tags = NULL; - tags = (Tk_Uid *) RadarListArray(model->tags); - num_tags = RadarListSize(model->tags); + tags = (Tk_Uid *) ZnListArray(model->tags); + num_tags = ZnListSize(model->tags); for (i = num_tags-1; i >= 0; i--, tags++) { AddTag(item, *tags); } } if (item->transfo) { - item->transfo = RadarTransfoDuplicate(item->transfo); + item->transfo = ZnTransfoDuplicate(item->transfo); } /* Call item's clone duplicate not shared resources */ @@ -2908,32 +2908,32 @@ static int ConfigureItem(Item item, int field, int argc, - RadarAttrList argv, - RadarBool init) + ZnAttrList argv, + ZnBool init) { WidgetInfo *wi = item->wi; int flags; - RadarBool previous_visible = init ? False : ISSET(item->flags, VISIBLE_BIT); + ZnBool previous_visible = init ? False : ISSET(item->flags, VISIBLE_BIT); flags = 0; - ASSIGN(flags, RADAR_COORDS_FLAG, init); + ASSIGN(flags, ZN_COORDS_FLAG, init); if (argv) { if (field < 0){ - if (item->class->Configure(item, argc, argv, &flags) == RADAR_ERROR) { - return RADAR_ERROR; + if (item->class->Configure(item, argc, argv, &flags) == ZN_ERROR) { + return ZN_ERROR; } - if (item->class->has_fields && ISSET(flags, RADAR_CLFC_FLAG)) { + if (item->class->has_fields && ISSET(flags, ZN_CLFC_FLAG)) { ClearFieldCache(item->class->GetFieldSet(item), -1); } } else if (item->class->has_fields) { FieldSet field_set = item->class->GetFieldSet(item); - if (ConfigureField(field_set, field, argc, argv, &flags) == RADAR_ERROR) { - return RADAR_ERROR; + if (ConfigureField(field_set, field, argc, argv, &flags) == ZN_ERROR) { + return ZN_ERROR; } } else { - return RADAR_ERROR; + return ZN_ERROR; } } @@ -2943,12 +2943,12 @@ ConfigureItem(Item item, * just turned out. */ Damage(wi, &item->item_bounding_box); - RadarNeedRedisplay(wi); + ZnNeedRedisplay(wi); } Invalidate(item, flags); - return RADAR_OK; + return ZN_OK; } @@ -2963,7 +2963,7 @@ static int QueryItem(Item item, int field, int argc, - RadarAttrList argv) + ZnAttrList argv) { if (field < 0) { return item->class->Query(item, argc, argv); @@ -2973,7 +2973,7 @@ QueryItem(Item item, return QueryField(field_set, field, argc, argv); } - return RADAR_ERROR; + return ZN_ERROR; } @@ -2986,11 +2986,11 @@ QueryItem(Item item, ********************************************************************************** */ static void -ComposeItemTransform(Item item, - RadarTransfo *current_t, - RadarTransfo *new_t) +ComposeItemTransform(Item item, + ZnTransfo *current_t, + ZnTransfo *new_t) { - RadarBool full; + ZnBool full; full = (ISSET(item->flags, COMPOSE_SCALE_BIT) && ISSET(item->flags, COMPOSE_ROTATION_BIT)); @@ -3003,33 +3003,33 @@ ComposeItemTransform(Item item, /* * Full concatenation. */ - /*printf("Item transfo for item: 0x%X;", item); RadarPrintTransfo(item->transfo);*/ - RadarTransfoCompose(new_t, item->transfo, current_t); + /*printf("Item transfo for item: 0x%X;", item); ZnPrintTransfo(item->transfo);*/ + ZnTransfoCompose(new_t, item->transfo, current_t); } else { - RadarPoint scale, trans, local_scale, local_trans; - RadarReal local_rot, rot; - RadarTransfo t, t2; + ZnPoint scale, trans, local_scale, local_trans; + ZnReal local_rot, rot; + ZnTransfo t, t2; /* * Need to decompose the local transform in translation, * rotation and scale. */ - RadarTransfoSetIdentity(&t); - RadarTransfoSetIdentity(new_t); - RadarTransfoDecompose(item->transfo, &local_scale, &local_trans, &local_rot, NULL); - RadarTranslate(&t, local_trans.x, local_trans.y); - RadarTransfoCompose(&t2, &t, current_t); - RadarTransfoDecompose(&t2, &scale, &trans, &rot, NULL); + ZnTransfoSetIdentity(&t); + ZnTransfoSetIdentity(new_t); + ZnTransfoDecompose(item->transfo, &local_scale, &local_trans, &local_rot, NULL); + ZnTranslate(&t, local_trans.x, local_trans.y); + ZnTransfoCompose(&t2, &t, current_t); + ZnTransfoDecompose(&t2, &scale, &trans, &rot, NULL); if (ISSET(item->flags, COMPOSE_SCALE_BIT)) { - RadarScale(new_t, scale.x, scale.y); + ZnScale(new_t, scale.x, scale.y); } if (ISSET(item->flags, COMPOSE_ROTATION_BIT)) { - RadarRotateRad(new_t, rot); + ZnRotateRad(new_t, rot); } - RadarScale(new_t, local_scale.x, local_scale.y); - RadarRotateRad(new_t, local_rot); - RadarTranslate(new_t, trans.x, trans.y); + ZnScale(new_t, local_scale.x, local_scale.y); + ZnRotateRad(new_t, local_rot); + ZnTranslate(new_t, trans.x, trans.y); } } @@ -3043,30 +3043,30 @@ ComposeItemTransform(Item item, ********************************************************************************** */ static void -GetTransform(Item item, - RadarTransfo *t) +GetTransform(Item item, + ZnTransfo *t) { Item *items; int i; - RadarTransfo t_tmp, *t1, *t2, *swap; + ZnTransfo t_tmp, *t1, *t2, *swap; if (item_stack == NULL) { - item_stack = RadarListNew(16, sizeof(Item)); + item_stack = ZnListNew(16, sizeof(Item)); } else { - RadarListEmpty(item_stack); + ZnListEmpty(item_stack); } - while (item != RADAR_NO_ITEM) { - RadarListAdd(item_stack, &item, RadarListTail); + while (item != ZN_NO_ITEM) { + ZnListAdd(item_stack, &item, ZnListTail); item = item->parent; } - RadarTransfoSetIdentity(t); + ZnTransfoSetIdentity(t); t1 = t; t2 = &t_tmp; - items = (Item *) RadarListArray(item_stack); - for (i = RadarListSize(item_stack)-1; i >= 0; i--) { + items = (Item *) ZnListArray(item_stack); + for (i = ZnListSize(item_stack)-1; i >= 0; i--) { ComposeItemTransform(items[i], t1, t2); swap = t2; t2 = t1; @@ -3089,9 +3089,9 @@ GetTransform(Item item, static void ResetTransformStack(WidgetInfo *wi) { - RadarListAssertSize(wi->transfo_stack, 1); - wi->current_transfo = (RadarTransfo *) RadarListAt(wi->transfo_stack, 0); - RadarTransfoSetIdentity(wi->current_transfo); + ZnListAssertSize(wi->transfo_stack, 1); + wi->current_transfo = (ZnTransfo *) ZnListAt(wi->transfo_stack, 0); + ZnTransfoSetIdentity(wi->current_transfo); } @@ -3106,16 +3106,16 @@ static void ResetClipStack(WidgetInfo *wi) { int i; - ClipState *clips = (ClipState *) RadarListArray(wi->clip_stack); + ClipState *clips = (ClipState *) ZnListArray(wi->clip_stack); /* * Should not happen, clip stack should be * empty when this function is called. */ - for (i = RadarListSize(wi->clip_stack)-1; i >= 0; i--) { + for (i = ZnListSize(wi->clip_stack)-1; i >= 0; i--) { XDestroyRegion(clips[i].region); } - RadarListEmpty(wi->clip_stack); + ZnListEmpty(wi->clip_stack); wi->current_clip = NULL; } @@ -3131,17 +3131,17 @@ static void Invalidate(Item item, int reason) { - if (ISSET(item->inv_flags, RADAR_TRANSFO_FLAG)) { + if (ISSET(item->inv_flags, ZN_TRANSFO_FLAG)) { return; } - if (ISSET(reason, RADAR_COORDS_FLAG) || - ISSET(reason, RADAR_TRANSFO_FLAG)) { + if (ISSET(reason, ZN_COORDS_FLAG) || + ISSET(reason, ZN_TRANSFO_FLAG)) { Item parent = item->parent; while ((parent != NULL) && - ISCLEAR(parent->inv_flags, RADAR_COORDS_FLAG) && - ISCLEAR(parent->inv_flags, RADAR_TRANSFO_FLAG)) { - SET(parent->inv_flags, RADAR_COORDS_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; } @@ -3152,15 +3152,15 @@ Invalidate(Item item, */ item->inv_flags |= reason; /*printf("invalidate %s for item %d, flags %s\n", - ISSET(reason, RADAR_TRANSFO_FLAG)?"TRANSFO":"COORDS", item->id, - ISSET(item->inv_flags, RADAR_TRANSFO_FLAG)?"TRANSFO":"COORDS");*/ - RadarNeedRedisplay(item->wi); + 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, RADAR_DRAW_FLAG)) { + else if (ISSET(reason, ZN_DRAW_FLAG)) { if (ISSET(item->flags, VISIBLE_BIT)) { /*printf("invalidate graphics for item %d\n", item->id);*/ Damage(item->wi, &item->item_bounding_box); - RadarNeedRedisplay(item->wi); + ZnNeedRedisplay(item->wi); } } } @@ -3181,13 +3181,13 @@ InvalidateItems(Item group, { Item item; - if (group->class != RadarGroup) { + if (group->class != ZnGroup) { return; } item = ((GroupItem) group)->head; - while (item != RADAR_NO_ITEM) { + while (item != ZN_NO_ITEM) { if (item->class == item_class) { - Invalidate(item, RADAR_COORDS_FLAG); + Invalidate(item, ZN_COORDS_FLAG); } item = item->next; } @@ -3212,73 +3212,73 @@ static void ResetTransfo(Item item) { if (item->transfo) { - RadarFree(item->transfo); + ZnFree(item->transfo); item->transfo = NULL; } - Invalidate(item, RADAR_TRANSFO_FLAG); + Invalidate(item, ZN_TRANSFO_FLAG); } static void SetTransfo(Item item, - RadarTransfo *t) + ZnTransfo *t) { if (item->transfo) { - RadarFree(item->transfo); + ZnFree(item->transfo); } - if (!t || RadarTransfoIsIdentity(t)) { + if (!t || ZnTransfoIsIdentity(t)) { item->transfo = NULL; } else { - item->transfo = RadarTransfoDuplicate(t); + item->transfo = ZnTransfoDuplicate(t); } - Invalidate(item, RADAR_TRANSFO_FLAG); + Invalidate(item, ZN_TRANSFO_FLAG); } static void TranslateItem(Item item, - RadarReal dx, - RadarReal dy) + ZnReal dx, + ZnReal dy) { if (!item->transfo) { - item->transfo = RadarTransfoNew(); + item->transfo = ZnTransfoNew(); } - RadarTranslate(item->transfo, dx, dy); - Invalidate(item, RADAR_TRANSFO_FLAG); + ZnTranslate(item->transfo, dx, dy); + Invalidate(item, ZN_TRANSFO_FLAG); } static void ScaleItem(Item item, - RadarReal sx, - RadarReal sy) + ZnReal sx, + ZnReal sy) { if (!item->transfo) { - item->transfo = RadarTransfoNew(); + item->transfo = ZnTransfoNew(); } - RadarScale(item->transfo, sx, sy); - Invalidate(item, RADAR_TRANSFO_FLAG); + ZnScale(item->transfo, sx, sy); + Invalidate(item, ZN_TRANSFO_FLAG); } static void RotateItem(Item item, - RadarReal angle, - RadarPoint *p) + ZnReal angle, + ZnPoint *p) { if (!item->transfo) { - item->transfo = RadarTransfoNew(); + item->transfo = ZnTransfoNew(); } if (p) { - RadarTranslate(item->transfo, -p->x, -p->y); + ZnTranslate(item->transfo, -p->x, -p->y); } - RadarRotateRad(item->transfo, angle); + ZnRotateRad(item->transfo, angle); if (p) { - RadarTranslate(item->transfo, p->x, p->y); + ZnTranslate(item->transfo, p->x, p->y); } - Invalidate(item, RADAR_TRANSFO_FLAG); + Invalidate(item, ZN_TRANSFO_FLAG); } @@ -3302,13 +3302,13 @@ RemoveItem(Item item) /* damage bounding boxes */ if (ISSET(item->flags, VISIBLE_BIT)) { Damage(wi, &item->item_bounding_box); - RadarNeedRedisplay(wi); + ZnNeedRedisplay(wi); } /* * Tell that we need to repick */ - if (item->class != RadarGroup) { + if (item->class != ZnGroup) { SET(wi->events_flags, INTERNAL_NEED_REPICK); } @@ -3328,8 +3328,8 @@ RemoveItem(Item item) * Remove me as a clip item. */ if (group->clip == item) { - group->clip = RADAR_NO_ITEM; - Invalidate((Item) group, RADAR_COORDS_FLAG); + group->clip = ZN_NO_ITEM; + Invalidate((Item) group, ZN_COORDS_FLAG); } } } @@ -3356,12 +3356,12 @@ DestroyItem(Item item) * Update state variables to prevent dangling pointers. */ if (wi->current_item == item) { - wi->current_item = RADAR_NO_ITEM; - wi->current_part = RADAR_NO_PART; + wi->current_item = ZN_NO_ITEM; + wi->current_part = ZN_NO_PART; } if (wi->new_item == item) { - wi->new_item = RADAR_NO_ITEM; - wi->new_part = RADAR_NO_PART; + wi->new_item = ZN_NO_ITEM; + wi->new_part = ZN_NO_PART; } /* @@ -3372,7 +3372,7 @@ DestroyItem(Item item) * Free the transform if any. */ if (item->transfo) { - RadarFree(item->transfo); + ZnFree(item->transfo); } /* * Remove the item from the item table and free @@ -3383,7 +3383,7 @@ DestroyItem(Item item) /* * Free the item own memory */ - RadarFree(item); + ZnFree(item); } @@ -3405,13 +3405,13 @@ FieldImageChange(ClientData client_data, { Field field = (Field) client_data; int i; - RadarBBox bbox; + ZnBBox bbox; - if (field->image != RadarUnspecifiedImage) { + if (field->image != ZnUnspecifiedImage) { i = (((char *) field) - ((char *) field->field_set->fields)) / sizeof(FieldStruct); GetFieldBBox(field->field_set, i, &bbox); Damage(field->field_set->wi, &bbox); - RadarNeedRedisplay(field->field_set->wi); + ZnNeedRedisplay(field->field_set->wi); ClearFieldCache(field->field_set, i); } } @@ -3435,14 +3435,14 @@ FieldTileChange(ClientData client_data, { Field field = (Field) client_data; int i; - RadarBBox bbox; + ZnBBox bbox; - if (field->tile != RadarUnspecifiedImage) { + if (field->tile != ZnUnspecifiedImage) { i = (((char *) field) - ((char *) field->field_set->fields)) / sizeof(FieldStruct); InvalidateImage(field->tile); GetFieldBBox(field->field_set, i, &bbox); Damage(field->field_set->wi, &bbox); - RadarNeedRedisplay(field->field_set->wi); + ZnNeedRedisplay(field->field_set->wi); } } @@ -3473,28 +3473,28 @@ InitFields(FieldSet field_set) return; } num_fields = field_set->num_fields; - field_set->fields = (Field) RadarMalloc(num_fields*sizeof(FieldStruct)); + field_set->fields = (Field) ZnMalloc(num_fields*sizeof(FieldStruct)); for (i = 0; i < num_fields; i++){ field = &field_set->fields[i]; field->field_set = field_set; - field->color = RadarGetColorByValue(wi->win, wi->fore_color); - field->back_color = RadarGetColorByValue(wi->win, wi->back_color); - field->border_color = RadarGetColorByValue(wi->win, wi->fore_color); + field->color = ZnGetColorByValue(wi->win, wi->fore_color); + field->back_color = ZnGetColorByValue(wi->win, wi->back_color); + field->border_color = ZnGetColorByValue(wi->win, wi->fore_color); SET(field->flags, FIELD_VISIBLE_BIT); SET(field->flags, FIELD_SENSITIVE_BIT); CLEAR(field->flags, FILLED_BIT); CLEAR(field->flags, CACHE_OK); - field->fill_pattern = RadarUnspecifiedPattern; + field->fill_pattern = ZnUnspecifiedPattern; field->text = ""; - field->image = RadarUnspecifiedImage; + field->image = ZnUnspecifiedImage; field->image_name = ""; - field->tile = RadarUnspecifiedImage; + field->tile = ZnUnspecifiedImage; field->tile_name = ""; field->font = Tk_GetFont(wi->interp, wi->win, Tk_NameOfFont(wi->font)); field->border_edges = NO_BORDER; - field->alignment = RadarJustifyLeft; + field->alignment = ZnJustifyLeft; field->auto_alignment.automatic = False; field->relief = RELIEF_FLAT; @@ -3530,41 +3530,41 @@ CloneFields(FieldSet field_set) if (!num_fields) { return; } - fields_ret = (Field) RadarMalloc(num_fields*sizeof(FieldStruct)); + fields_ret = (Field) ZnMalloc(num_fields*sizeof(FieldStruct)); memcpy(fields_ret, field_set->fields, num_fields*sizeof(FieldStruct)); field_set->fields = fields_ret; for (i = 0; i < num_fields; i++) { field = &fields_ret[i]; if (field->gradient) { - field->gradient = RadarGetColorGradientByValue(field->gradient); + field->gradient = ZnGetColorGradientByValue(field->gradient); } if (strlen(field->image_name) != 0) { - text = RadarMalloc((strlen(field->image_name) + 1) * sizeof(char)); + text = ZnMalloc((strlen(field->image_name) + 1) * sizeof(char)); strcpy(text, field->image_name); field->image_name = text; field->image = Tk_GetImage(wi->interp, wi->win, field->image_name, FieldImageChange, (ClientData) field); } if (strlen(field->tile_name) != 0) { - text = RadarMalloc((strlen(field->tile_name) + 1) * sizeof(char)); + text = ZnMalloc((strlen(field->tile_name) + 1) * sizeof(char)); strcpy(text, field->tile_name); field->tile_name = text; field->tile = Tk_GetImage(wi->interp, wi->win, field->tile_name, FieldTileChange, (ClientData) field); } - if (field->fill_pattern != RadarUnspecifiedPattern) { + if (field->fill_pattern != ZnUnspecifiedPattern) { field->fill_pattern = Tk_GetBitmap(wi->interp, wi->win, Tk_NameOfBitmap(wi->dpy, field->fill_pattern)); } field->font = Tk_GetFont(wi->interp, wi->win, Tk_NameOfFont(field->font)); - field->color = RadarGetColorByValue(wi->win, field->color); - field->back_color = RadarGetColorByValue(wi->win, field->back_color); - field->border_color = RadarGetColorByValue(wi->win, field->border_color); + field->color = ZnGetColorByValue(wi->win, field->color); + field->back_color = ZnGetColorByValue(wi->win, field->back_color); + field->border_color = ZnGetColorByValue(wi->win, field->border_color); if (strlen(field->text) != 0) { - text = (char *) RadarMalloc((strlen(field->text) + 1) * sizeof(char)); + text = (char *) ZnMalloc((strlen(field->text) + 1) * sizeof(char)); strcpy(text, field->text); field->text = text; } @@ -3583,42 +3583,42 @@ static int ConfigureField(FieldSet field_set, unsigned int field, int argc, - RadarAttrList argv, + ZnAttrList argv, int *flags) { int i; Field field_ptr; - RadarBBox bbox; + ZnBBox bbox; WidgetInfo *wi = field_set->wi; if (field >= field_set->num_fields) { - return RADAR_ERROR; + return ZN_ERROR; } field_ptr = &field_set->fields[field]; - if (ConfigureAttributes((char *) field_set, field, argc, argv, flags) == RADAR_ERROR) { - return RADAR_ERROR; + if (ConfigureAttributes((char *) field_set, field, argc, argv, flags) == ZN_ERROR) { + return ZN_ERROR; } - if (ISSET(*flags, RADAR_REPICK_FLAG)) { + if (ISSET(*flags, ZN_REPICK_FLAG)) { SET(wi->events_flags, INTERNAL_NEED_REPICK); } - if (ISSET(*flags, RADAR_CLFC_FLAG)) { + if (ISSET(*flags, ZN_CLFC_FLAG)) { ClearFieldCache(field_set, field); } if (field_ptr->gradient && - (ISSET(*flags, RADAR_BORDER_FLAG) || (field_ptr->relief == RELIEF_FLAT))) { - RadarFreeColorGradient(field_ptr->gradient); + (ISSET(*flags, ZN_BORDER_FLAG) || (field_ptr->relief == RELIEF_FLAT))) { + ZnFreeColorGradient(field_ptr->gradient); field_ptr->gradient = NULL; } if ((field_ptr->relief != RELIEF_FLAT) && !field_ptr->gradient) { - field_ptr->gradient = RadarGetReliefGradient(wi->interp, wi->win, - RadarNameOfColor(field_ptr->back_color)); + field_ptr->gradient = ZnGetReliefGradient(wi->interp, wi->win, + ZnNameOfColor(field_ptr->back_color)); } - if (ISSET(*flags, RADAR_IMAGE_FLAG)) { + if (ISSET(*flags, ZN_IMAGE_FLAG)) { Tk_Image image; if (strcmp(field_ptr->image_name, "") != 0) { @@ -3629,32 +3629,32 @@ ConfigureField(FieldSet field_set, * The name will not be in sync with the image in * this case. */ - return RADAR_ERROR; + return ZN_ERROR; } } else { - image = RadarUnspecifiedImage; + image = ZnUnspecifiedImage; } - if (field_ptr->image != RadarUnspecifiedImage) { + if (field_ptr->image != ZnUnspecifiedImage) { Tk_FreeImage(field_ptr->image); } field_ptr->image = image; } - if (ISSET(*flags, RADAR_TILE_FLAG)) { + if (ISSET(*flags, ZN_TILE_FLAG)) { Tk_Image tile; if (strcmp(field_ptr->tile_name, "") != 0) { tile = Tk_GetImage(wi->interp, wi->win, field_ptr->tile_name, FieldTileChange, (ClientData) field_ptr); if (tile == NULL) { - return RADAR_ERROR; + return ZN_ERROR; } } else { - tile = RadarUnspecifiedImage; + tile = ZnUnspecifiedImage; } - if (field_ptr->tile != RadarUnspecifiedImage) { + if (field_ptr->tile != ZnUnspecifiedImage) { Tk_FreeImage(field_ptr->tile); } field_ptr->tile = tile; @@ -3664,8 +3664,8 @@ ConfigureField(FieldSet field_set, * This is done here to limit the redraw to the area of the * modified fields. */ - if (ISCLEAR(*flags, RADAR_COORDS_FLAG) && - field_set->label_format && ISSET(*flags, RADAR_DRAW_FLAG)) { + if (ISCLEAR(*flags, ZN_COORDS_FLAG) && + field_set->label_format && ISSET(*flags, ZN_DRAW_FLAG)) { for (i = 0; i < LabelFormatNumFields(field_set->label_format); i++) { if (i == field) { GetFieldBBox(field_set, i, &bbox); @@ -3675,7 +3675,7 @@ ConfigureField(FieldSet field_set, } } - return RADAR_OK; + return ZN_OK; } @@ -3690,20 +3690,20 @@ static int QueryField(FieldSet field_set, unsigned int field, int argc, - RadarAttrList argv) + ZnAttrList argv) { Field field_ptr; if (field >= field_set->num_fields) { - return RADAR_ERROR; + return ZN_ERROR; } field_ptr = &field_set->fields[field]; - if (QueryAttribute((char *) field_set, field, argv[0]) == RADAR_ERROR) { - return RADAR_ERROR; + if (QueryAttribute((char *) field_set, field, argv[0]) == ZN_ERROR) { + return ZN_ERROR; } - return RADAR_OK; + return ZN_OK; } @@ -3730,37 +3730,37 @@ FreeFields(FieldSet field_set) field = &field_set->fields[i]; if (strlen(field->text) != 0) { - RadarFree(field->text); + ZnFree(field->text); } if (field->gradient) { - RadarFreeColorGradient(field->gradient); + ZnFreeColorGradient(field->gradient); } if (strlen(field->image_name) != 0) { - RadarFree(field->image_name); + ZnFree(field->image_name); } - if (field->image != RadarUnspecifiedImage) { + if (field->image != ZnUnspecifiedImage) { Tk_FreeImage(field->image); - field->image = RadarUnspecifiedImage; + field->image = ZnUnspecifiedImage; } if (strlen(field->tile_name) != 0) { - RadarFree(field->tile_name); + ZnFree(field->tile_name); } - if (field->tile != RadarUnspecifiedImage) { + if (field->tile != ZnUnspecifiedImage) { Tk_FreeImage(field->tile); - field->tile = RadarUnspecifiedImage; + field->tile = ZnUnspecifiedImage; } - if (field->fill_pattern != RadarUnspecifiedPattern) { + if (field->fill_pattern != ZnUnspecifiedPattern) { Tk_FreeBitmap(wi->dpy, field->fill_pattern); - field->fill_pattern = RadarUnspecifiedPattern; + field->fill_pattern = ZnUnspecifiedPattern; } /*printf("freeing a font\n");*/ Tk_FreeFont(field->font); - RadarFreeColor(field->color); - RadarFreeColor(field->back_color); - RadarFreeColor(field->border_color); + ZnFreeColor(field->color); + ZnFreeColor(field->back_color); + ZnFreeColor(field->border_color); } if (num_fields) { - RadarFree(field_set->fields); + ZnFree(field_set->fields); } } @@ -3776,10 +3776,10 @@ FreeFields(FieldSet field_set) */ static void ComputeFieldImageLocation(Field field_ptr, - RadarBBox *bbox, - RadarBBox *pm_bbox) + ZnBBox *bbox, + ZnBBox *pm_bbox) { - RadarBool relief_thickness; + ZnBool relief_thickness; int width, height; Tk_SizeOfImage(field_ptr->image, &width, &height); @@ -3789,10 +3789,10 @@ ComputeFieldImageLocation(Field field_ptr, field_ptr->relief_thickness > 1) ? field_ptr->relief_thickness : 0; switch (field_ptr->alignment) { - case RadarJustifyLeft: + case ZnJustifyLeft: pm_bbox->orig.x = bbox->orig.x + 1 + relief_thickness; break; - case RadarJustifyRight: + case ZnJustifyRight: pm_bbox->orig.x = bbox->corner.x - width - 1 - relief_thickness; break; default: @@ -3818,14 +3818,14 @@ DrawFields(FieldSet field_set) int j, num; Field field_ptr; XGCValues values; - RadarBBox label_clip_box, clip_bbox, bbox, *global_clip_box; - RadarBBox text_bbox, clip_text_bbox; + ZnBBox label_clip_box, clip_bbox, bbox, *global_clip_box; + ZnBBox text_bbox, clip_text_bbox; XRectangle r; Region reg, reg2; - RadarPoint text_pos; - RadarBBox pm_bbox, clip_pm_bbox; - RadarBool restore = False; - RadarDim lwidth, lheight; + ZnPoint text_pos; + ZnBBox pm_bbox, clip_pm_bbox; + ZnBool restore = False; + ZnDim lwidth, lheight; if (field_set->label_format && LabelFormatNumFields(field_set->label_format)) { bbox.orig = field_set->label_pos; @@ -3866,7 +3866,7 @@ DrawFields(FieldSet field_set) IntersectBBox(&clip_bbox, &text_bbox, &clip_text_bbox); - if (field_ptr->image != RadarUnspecifiedImage) { + if (field_ptr->image != ZnUnspecifiedImage) { ComputeFieldImageLocation(field_ptr, &bbox, &pm_bbox); } else { @@ -3920,9 +3920,9 @@ DrawFields(FieldSet field_set) * Draw the background. */ if (ISSET(field_ptr->flags, FILLED_BIT)) { - values.foreground = RadarPixel(field_ptr->back_color); + values.foreground = ZnPixel(field_ptr->back_color); - if (field_ptr->tile != RadarUnspecifiedImage) { /* Fill tiled */ + if (field_ptr->tile != ZnUnspecifiedImage) { /* Fill tiled */ Pixmap pmap = GetImagePixmap(wi->win, field_ptr->tile); values.fill_style = FillTiled; values.tile = pmap; @@ -3932,7 +3932,7 @@ DrawFields(FieldSet field_set) GCTileStipXOrigin|GCTileStipYOrigin|GCFillStyle|GCTile, &values); } - else if (field_ptr->fill_pattern != RadarUnspecifiedPattern) { /* Fill stippled */ + else if (field_ptr->fill_pattern != ZnUnspecifiedPattern) { /* Fill stippled */ values.fill_style = FillStippled; values.stipple = field_ptr->fill_pattern; values.ts_x_origin = (int) bbox.orig.x; @@ -3959,7 +3959,7 @@ DrawFields(FieldSet field_set) /* * Draw the image. */ - if (field_ptr->image != RadarUnspecifiedImage) { + if (field_ptr->image != ZnUnspecifiedImage) { Tk_RedrawImage(field_ptr->image, clip_pm_bbox.orig.x-pm_bbox.orig.x, clip_pm_bbox.orig.y-pm_bbox.orig.y, @@ -3974,9 +3974,9 @@ DrawFields(FieldSet field_set) * Draw the text. */ if (field_ptr->text && strlen(field_ptr->text)) { - values.foreground = RadarPixel(field_ptr->color); + values.foreground = ZnPixel(field_ptr->color); values.fill_style = FillSolid; - values.font = RadarFontId(field_ptr->font); + values.font = ZnFontId(field_ptr->font); XChangeGC(wi->dpy, wi->gc, GCForeground | GCFillStyle | GCFont, &values); Tk_DrawChars(wi->dpy, wi->draw_buffer, wi->gc, field_ptr->font, field_ptr->text, strlen(field_ptr->text), @@ -3998,7 +3998,7 @@ DrawFields(FieldSet field_set) * Draw the border line. */ if (field_ptr->border_edges != NO_BORDER) { - values.foreground = RadarPixel(field_ptr->border_color); + values.foreground = ZnPixel(field_ptr->border_color); values.line_width = 0; values.line_style = LineSolid; values.fill_style = FillSolid; @@ -4054,7 +4054,7 @@ DrawFields(FieldSet field_set) * ********************************************************************************** */ -static RadarBool +static ZnBool IsFieldSensitive(FieldSet field_set, int part) { @@ -4083,11 +4083,11 @@ IsFieldSensitive(FieldSet field_set, */ static double FieldsPick(FieldSet field_set, - RadarPoint *p, + ZnPoint *p, int *part) { Field field_ptr; - RadarBBox bbox; + ZnBBox bbox; int i, best_field = 0; double new_dist, dist = 1e40; @@ -4131,13 +4131,13 @@ FieldsPick(FieldSet field_set, */ static int FieldsToArea(FieldSet field_set, - RadarBBox *area) + ZnBBox *area) { Field field_ptr; - RadarBBox bbox; + ZnBBox bbox; int inside = -1; int i; - RadarBool first_done = False; + ZnBool first_done = False; for (i = LabelFormatNumFields(field_set->label_format)-1; i >= 0; i--) { field_ptr = &field_set->fields[i]; @@ -4198,7 +4198,7 @@ SetFieldsAutoAlign(Item item, static void Damage(WidgetInfo *wi, - RadarBBox *damage) + ZnBBox *damage) { if ((damage == NULL) || IsEmptyBBox(damage)) { return; @@ -4240,8 +4240,8 @@ Damage(WidgetInfo *wi, static void Update(WidgetInfo *wi) { - if (ISSET(wi->top_group->inv_flags, RADAR_COORDS_FLAG) || - ISSET(wi->top_group->inv_flags, RADAR_TRANSFO_FLAG)) { + if (ISSET(wi->top_group->inv_flags, ZN_COORDS_FLAG) || + ISSET(wi->top_group->inv_flags, ZN_TRANSFO_FLAG)) { wi->top_group->class->ComputeCoordinates(wi->top_group, False); } } @@ -4271,8 +4271,8 @@ Repair(WidgetInfo *wi) /*StartChrono(int_draw_time);*/ #endif /* Fill the background */ - if (wi->tile == RadarUnspecifiedImage) { - values.foreground = RadarPixel(wi->back_color); + if (wi->tile == ZnUnspecifiedImage) { + values.foreground = ZnPixel(wi->back_color); values.fill_style = FillSolid; XChangeGC(wi->dpy, wi->gc, GCFillStyle|GCForeground, &values); } diff --git a/generic/Item.h b/generic/Item.h index 40fbbbb..c4b0464 100644 --- a/generic/Item.h +++ b/generic/Item.h @@ -81,12 +81,12 @@ typedef struct _ItemStruct { /* Private data */ int id; - RadarList tags; - struct _WidgetInfo *wi; /* The radar this item is on */ + ZnList tags; + struct _WidgetInfo *wi; /* The widget this item is on */ struct _ItemClassStruct *class; /* item class */ struct _ItemStruct *previous; /* previous item in group list */ struct _ItemStruct *next; /* next item in group list */ - RadarBBox item_bounding_box; /* device item bounding box */ + ZnBBox item_bounding_box; /* device item bounding box */ /* Common attributes */ unsigned char flags; @@ -94,7 +94,7 @@ typedef struct _ItemStruct { short inv_flags; struct _ItemStruct *parent; int priority; - struct _RadarTransfo *transfo; + struct _ZnTransfo *transfo; struct _ItemStruct *connected_item; /* Item this item is connected to */ } ItemStruct, *Item; @@ -111,12 +111,12 @@ typedef struct _GroupItemStruct { /* Private data */ Item head; /* Doubly linked list of all items. */ Item tail; - RadarList dependents; /* List of dependent items. */ + ZnList dependents; /* List of dependent items. */ #ifdef OM /* Overlap manager variables. * These variables are valid *only* if the overlap * manager is active. */ - RadarBool call_om; /* Tell if there is a need to call the */ + ZnBool call_om; /* Tell if there is a need to call the */ /* overlap manager. */ #endif } GroupItemStruct, *GroupItem; @@ -130,10 +130,10 @@ typedef struct _FieldSetStruct { LabelFormat label_format; unsigned int num_fields; struct _FieldStruct *fields; - RadarDim label_width; /* Describe the label size. Access these */ - RadarDim label_height; /* 2 only with GetLabelBBox. -1 means + ZnDim label_width; /* Describe the label size. Access these */ + ZnDim label_height; /* 2 only with GetLabelBBox. -1 means * not up to date. */ - RadarPoint label_pos; /* Describe the label origin. */ + ZnPoint label_pos; /* Describe the label origin. */ } FieldSetStruct, *FieldSet; @@ -141,36 +141,35 @@ typedef struct _FieldSetStruct { * Item class record -- */ typedef int (*ItemInitMethod)(Item item, int *argc, Arg **args); -typedef int (*ItemConfigureMethod)(Item item, int argc, RadarAttrList args, +typedef int (*ItemConfigureMethod)(Item item, int argc, ZnAttrList args, int *flags); -typedef int (*ItemQueryMethod)(Item item, int argc, RadarAttrList args); +typedef int (*ItemQueryMethod)(Item item, int argc, ZnAttrList args); typedef void (*ItemCloneMethod)(Item item); typedef void (*ItemDestroyMethod)(Item item); typedef void (*ItemDrawMethod)(Item item); -typedef void (*ItemComputeCoordinatesMethod)(Item item, RadarBool force); -typedef int (*ItemToAreaMethod)(Item item, RadarBBox *area, - Tk_Uid tag_uid, int enclosed, RadarBool report); -typedef RadarBool (*ItemIsSensitiveMethod)(Item item, int part); -typedef double (*ItemPickMethod)(Item item, RadarPoint *point, +typedef void (*ItemComputeCoordinatesMethod)(Item item, ZnBool force); +typedef int (*ItemToAreaMethod)(Item item, ZnBBox *area, + Tk_Uid tag_uid, int enclosed, ZnBool report); +typedef ZnBool (*ItemIsSensitiveMethod)(Item item, int part); +typedef double (*ItemPickMethod)(Item item, ZnPoint *point, Item start_item, int aperture, Item *a_item, int *a_part); typedef FieldSet (*ItemGetFieldSetMethod)(Item item); -typedef void (*ItemGetAnchorMethod)(Item item, RadarAnchor anchor, - RadarPoint *p); -typedef RadarBool (*ItemGetClipVerticesMethod)(Item item, RadarPoint **points, - int *num_points); +typedef void (*ItemGetAnchorMethod)(Item item, ZnAnchor anchor, ZnPoint *p); +typedef ZnBool (*ItemGetClipVerticesMethod)(Item item, ZnPoint **points, + int *num_points); typedef int (*ItemCoordsMethod)(Item item, int index, int cmd, - RadarPoint **points, int *num_points); + ZnPoint **points, int *num_points); typedef void (*ItemPostScriptMethod)(Item item, PostScriptInfo ps_info); typedef struct _ItemClassStruct { int item_size; - RadarBool has_fields; - RadarBool has_parts; /* True for items with parts + ZnBool has_fields; + ZnBool has_parts; /* True for items with parts * other than fields. */ - RadarBool has_anchors; + ZnBool has_anchors; char *name; - RadarAttrConfig *attr_desc; + ZnAttrConfig *attr_desc; ItemInitMethod Init; ItemCloneMethod Clone; ItemDestroyMethod Destroy; @@ -199,12 +198,12 @@ typedef struct _ItemClassStruct { extern struct _ITEM { Item (*CloneItem)(Item model); void (*DestroyItem)(Item item); - int (*ConfigureItem)(Item item, int field, int argc, RadarAttrList args, RadarBool init); - int (*QueryItem)(Item item, int field, int argc, RadarAttrList args); + int (*ConfigureItem)(Item item, int field, int argc, ZnAttrList args, ZnBool init); + int (*QueryItem)(Item item, int field, int argc, ZnAttrList args); int (*AttributesInfo)(Item item, int field, int argc, Arg *args); void (*SetFieldsAutoAlign)(Item item, int alignment); - void (*InsertItem)(Item item, Item group, Item mark_item, RadarBool before); - void (*UpdateItemPriority)(Item item, Item mark_item, RadarBool before); + void (*InsertItem)(Item item, Item group, Item mark_item, ZnBool before); + void (*UpdateItemPriority)(Item item, Item mark_item, ZnBool before); void (*InsertDependentItem)(Item item); void (*UpdateItemDependency)(Item item, Item old_connection); void (*RemoveItem)(Item item); @@ -214,15 +213,15 @@ extern struct _ITEM { void (*RemoveTag)(Item item, Tk_Uid tag); void (*FreeTags)(Item item); void (*ResetTransfo)(Item item); - void (*SetTransfo)(Item item, struct _RadarTransfo *t); - void (*TranslateItem)(Item item, RadarReal tx, RadarReal ty); - void (*ScaleItem)(Item item, RadarReal sx, RadarReal sy); - void (*RotateItem)(Item item, RadarReal angle, RadarPoint *p); + void (*SetTransfo)(Item item, struct _ZnTransfo *t); + void (*TranslateItem)(Item item, ZnReal tx, ZnReal ty); + void (*ScaleItem)(Item item, ZnReal sx, ZnReal sy); + void (*RotateItem)(Item item, ZnReal angle, ZnPoint *p); void (*Invalidate)(Item item, int reason); void (*InvalidateItems)(Item group, ItemClass item_class); - void (*ComposeItemTransform)(Item item, struct _RadarTransfo *current_t, - struct _RadarTransfo *new_t); - void (*GetTransform)(Item item, struct _RadarTransfo *t); + void (*ComposeItemTransform)(Item item, struct _ZnTransfo *current_t, + struct _ZnTransfo *new_t); + void (*GetTransform)(Item item, struct _ZnTransfo *t); } ITEM; @@ -239,8 +238,8 @@ extern struct _ITEM_P { int *argc, Arg **args); void (*AddItemClass)(ItemClass class); ItemClass (*LookupItemClass)(char *class_name); - RadarList (*ItemClassList)(); - void (*Damage)(struct _WidgetInfo *wi, RadarBBox *damage); + ZnList (*ItemClassList)(); + void (*Damage)(struct _WidgetInfo *wi, ZnBBox *damage); void (*Repair)(struct _WidgetInfo *wi); void (*Update)(struct _WidgetInfo *wi); int (*ConfigureAttributes)(char *record, int field, int argc, Arg *args, int *flags); @@ -249,29 +248,29 @@ extern struct _ITEM_P { void (*CloneFields)(FieldSet field_set); void (*FreeFields)(FieldSet field_set); void (*DrawFields)(FieldSet field_set); - int (*FieldsToArea)(FieldSet field_set, RadarBBox *area); - RadarBool (*IsFieldSensitive)(FieldSet field_set, int part); - double (*FieldsPick)(FieldSet field_set, RadarPoint *p, int *part); - void (*LeaderToLabel)(FieldSet field_set, RadarPoint *start, RadarPoint *end); - void (*GetLabelBBox)(FieldSet field_set, RadarDim *w, RadarDim *h); - void (*GetFieldBBox)(FieldSet field_set, unsigned int index, RadarBBox *field_bbox); + int (*FieldsToArea)(FieldSet field_set, ZnBBox *area); + ZnBool (*IsFieldSensitive)(FieldSet field_set, int part); + double (*FieldsPick)(FieldSet field_set, ZnPoint *p, int *part); + void (*LeaderToLabel)(FieldSet field_set, ZnPoint *start, ZnPoint *end); + void (*GetLabelBBox)(FieldSet field_set, ZnDim *w, ZnDim *h); + void (*GetFieldBBox)(FieldSet field_set, unsigned int index, ZnBBox *field_bbox); void (*ResetTransformStack)(struct _WidgetInfo *wi); void (*ResetClipStack)(struct _WidgetInfo *wi); } ITEM_P; -extern RadarItemClassId RadarArc; -extern RadarItemClassId RadarMap; -extern RadarItemClassId RadarTabular; -extern RadarItemClassId RadarMosaic; -extern RadarItemClassId RadarCurve; -extern RadarItemClassId RadarRectangle; -extern RadarItemClassId RadarReticle; -extern RadarItemClassId RadarTrack; -extern RadarItemClassId RadarWayPoint; -extern RadarItemClassId RadarGroup; -extern RadarItemClassId RadarIcon; -extern RadarItemClassId RadarText; +extern ZnItemClassId ZnArc; +extern ZnItemClassId ZnMap; +extern ZnItemClassId ZnTabular; +extern ZnItemClassId ZnMosaic; +extern ZnItemClassId ZnCurve; +extern ZnItemClassId ZnRectangle; +extern ZnItemClassId ZnReticle; +extern ZnItemClassId ZnTrack; +extern ZnItemClassId ZnWayPoint; +extern ZnItemClassId ZnGroup; +extern ZnItemClassId ZnIcon; +extern ZnItemClassId ZnText; #endif /* _Item_h */ diff --git a/generic/List.c b/generic/List.c index 573d7b2..2b0ed2f 100644 --- a/generic/List.c +++ b/generic/List.c @@ -31,25 +31,25 @@ ********************************************************************************** * * This modules exports the following functions: - * - RadarListNew - * - RadarListDuplicate - * - RadarListEmpty - * - RadarListFromArray - * - RadarListArray - * - RadarListFree - * - RadarListSize - * - RadarListAssertSize - * - RadarListAdd - * - RadarListAt - * - RadarListAtPut - * - RadarListDelete - * - RadarListTruncate - * - RadarListDetect - * - RadarListDo + * - ZnListNew + * - ZnListDuplicate + * - ZnListEmpty + * - ZnListFromArray + * - ZnListArray + * - ZnListFree + * - ZnListSize + * - ZnListAssertSize + * - ZnListAdd + * - ZnListAt + * - ZnListAtPut + * - ZnListDelete + * - ZnListTruncate + * - ZnListDetect + * - ZnListDo * * To appear soon: - * - RadarListCollect - * - RadarListReject + * - ZnListCollect + * - ZnListReject * * And the following variables: * @@ -102,7 +102,7 @@ typedef struct { long elem_size; long alloc_size; long used_size; -} _RadarList; +} _ZnList; /* @@ -116,7 +116,7 @@ typedef struct { */ static void -GrowIfNeeded(_RadarList *list, +GrowIfNeeded(_ZnList *list, int min_size) { if (list->used_size+min_size <= list->alloc_size) { @@ -127,15 +127,15 @@ GrowIfNeeded(_RadarList *list, if (list->list == NULL) { /* Normal case if we have created a zero sized list */ list->alloc_size = min_size; - list->list = (char *) RadarMalloc(list->alloc_size*list->elem_size); + list->list = (char *) ZnMalloc(list->alloc_size*list->elem_size); } else { - /* Case of a list made by RadarListFromArray. If we try to make + /* Case of a list made by ZnListFromArray. If we try to make it grow we need to reallocate and copy. */ char *new_list; list->alloc_size = list->used_size+min_size; - new_list = (char *) RadarMalloc(list->alloc_size*list->elem_size); + new_list = (char *) ZnMalloc(list->alloc_size*list->elem_size); memcpy(new_list, list->list, list->used_size*list->elem_size); @@ -146,7 +146,7 @@ GrowIfNeeded(_RadarList *list, list->alloc_size = MAX(MIN(list->alloc_size*2, MAX_CHUNCK_SIZE), list->alloc_size+min_size); - list->list = (char *) RadarRealloc(list->list, + list->list = (char *) ZnRealloc(list->list, list->alloc_size*list->elem_size); } @@ -159,17 +159,17 @@ GrowIfNeeded(_RadarList *list, /* ********************************************************************************** * - * RadarListNew -- + * ZnListNew -- * Return a new empty list 'initial_size' large. * ********************************************************************************** */ -RadarList -RadarListNew(int initial_size, - int element_size) +ZnList +ZnListNew(int initial_size, + int element_size) { - _RadarList *new_list; + _ZnList *new_list; if (initial_size < 0) { initial_size = 0; @@ -179,7 +179,7 @@ RadarListNew(int initial_size, element_size = 1; } - new_list = (_RadarList *) RadarMalloc(sizeof(_RadarList)); + new_list = (_ZnList *) ZnMalloc(sizeof(_ZnList)); new_list->alloc_size = initial_size; new_list->used_size = 0; @@ -188,33 +188,33 @@ RadarListNew(int initial_size, if (initial_size) { long size = new_list->alloc_size*new_list->elem_size; - new_list->list = RadarMalloc(size); + new_list->list = ZnMalloc(size); memset(new_list->list, 0, size); } else { new_list->list = NULL; } - return (RadarList) new_list; + return (ZnList) new_list; } /* ********************************************************************************** * - * RadarListDuplicate -- + * ZnListDuplicate -- * Return a copy of the list given as parameter. * ********************************************************************************** */ -RadarList -RadarListDuplicate(RadarList list) +ZnList +ZnListDuplicate(ZnList list) { - _RadarList *cur_list = (_RadarList *) list; - _RadarList *new_list; + _ZnList *cur_list = (_ZnList *) list; + _ZnList *new_list; - new_list = (_RadarList *) RadarMalloc(sizeof(_RadarList)); + new_list = (_ZnList *) ZnMalloc(sizeof(_ZnList)); new_list->alloc_size = cur_list->alloc_size == 0 ? cur_list->used_size : cur_list->alloc_size; @@ -225,7 +225,7 @@ RadarListDuplicate(RadarList list) long used_size = new_list->used_size*new_list->elem_size; long size = new_list->alloc_size*new_list->elem_size; - new_list->list = RadarMalloc(size); + new_list->list = ZnMalloc(size); if (used_size) { memcpy(new_list->list, cur_list->list, used_size); @@ -237,23 +237,23 @@ RadarListDuplicate(RadarList list) new_list->list = NULL; } - return (RadarList) new_list; + return (ZnList) new_list; } /* ********************************************************************************** * - * RadarListEmpty -- + * ZnListEmpty -- * Clear out a list, kkeping its allocated size. * ********************************************************************************** */ void -RadarListEmpty(RadarList list) +ZnListEmpty(ZnList list) { - _RadarList *cur_list = (_RadarList *) list; + _ZnList *cur_list = (_ZnList *) list; cur_list->used_size = 0; } @@ -262,39 +262,39 @@ RadarListEmpty(RadarList list) /* ********************************************************************************** * - * RadarListFromArray -- + * ZnListFromArray -- * Return a list filled from the given array. * ********************************************************************************** */ -RadarList -RadarListFromArray(void *array, - int array_size, - int element_size) +ZnList +ZnListFromArray(void *array, + int array_size, + int element_size) { - _RadarList *new_list; + _ZnList *new_list; - new_list = (_RadarList *) RadarListNew(0, element_size); + new_list = (_ZnList *) ZnListNew(0, element_size); new_list->list = array; new_list->used_size = array_size; - return (RadarList) new_list; + return (ZnList) new_list; } /* ********************************************************************************** * - * RadarListArray -- + * ZnListArray -- * Return a pointer to the array containing the list. * ********************************************************************************** */ void * -RadarListArray(RadarList list) +ZnListArray(ZnList list) { - _RadarList *cur_list = (_RadarList *) list; + _ZnList *cur_list = (_ZnList *) list; return (void *) cur_list->list; } @@ -303,7 +303,7 @@ RadarListArray(RadarList list) /* ********************************************************************************** * - * RadarListFree -- + * ZnListFree -- * Delete a list and free its memory. The entries * still in the list are lost but no further deallocation * is attempted. @@ -312,48 +312,48 @@ RadarListArray(RadarList list) */ void -RadarListFree(RadarList list) +ZnListFree(ZnList list) { - _RadarList *cur_list = (_RadarList *) list; + _ZnList *cur_list = (_ZnList *) list; if (cur_list->list != NULL && cur_list->alloc_size != 0) { - RadarFree(cur_list->list); + ZnFree(cur_list->list); } - RadarFree(cur_list); + ZnFree(cur_list); } /* ********************************************************************************** * - * RadarListSize -- + * ZnListSize -- * Return the current number of entries kept in list. * ********************************************************************************** */ int -RadarListSize(RadarList list) +ZnListSize(ZnList list) { - return ((_RadarList *)list)->used_size; + return ((_ZnList *)list)->used_size; } /* ********************************************************************************** * - * RadarListAssertSize -- + * ZnListAssertSize -- * Set the list length to size. * ********************************************************************************** */ void -RadarListAssertSize(RadarList list, - int size) +ZnListAssertSize(ZnList list, + int size) { - _RadarList *cur_list = (_RadarList *) list; + _ZnList *cur_list = (_ZnList *) list; if (cur_list->used_size < size) { GrowIfNeeded(cur_list, size - cur_list->used_size); @@ -365,20 +365,20 @@ RadarListAssertSize(RadarList list, /* ********************************************************************************** * - * RadarListCopy -- + * ZnListCopy -- * Destructively copy 'from' into 'to' starting at the first - * position. It is the same as saying RadarListEmpty and then - * RadarListAppend. + * position. It is the same as saying ZnListEmpty and then + * ZnListAppend. * ********************************************************************************** */ void -RadarListCopy(RadarList to, - RadarList from) +ZnListCopy(ZnList to, + ZnList from) { - _RadarList *to_list = (_RadarList *) to; - _RadarList *from_list = (_RadarList *) from; + _ZnList *to_list = (_ZnList *) to; + _ZnList *from_list = (_ZnList *) from; if (from_list->elem_size != to_list->elem_size) { return; @@ -396,18 +396,18 @@ RadarListCopy(RadarList to, /* ********************************************************************************** * - * RadarListAppend -- + * ZnListAppend -- * Append 'from' at the end of 'to' which is enlarged as needed. * ********************************************************************************** */ void -RadarListAppend(RadarList to, - RadarList from) +ZnListAppend(ZnList to, + ZnList from) { - _RadarList *to_list = (_RadarList *) to; - _RadarList *from_list = (_RadarList *) from; + _ZnList *to_list = (_ZnList *) to; + _ZnList *from_list = (_ZnList *) from; if (from_list->elem_size != to_list->elem_size) { return; @@ -424,22 +424,22 @@ RadarListAppend(RadarList to, /* ********************************************************************************** * - * RadarListAdd -- + * ZnListAdd -- * Add a new entry 'value' in the list before * 'index'. 'index' can be the position of a - * previous entry or the special values RadarListHead, - * RadarListTail. The entries have positions + * previous entry or the special values ZnListHead, + * ZnListTail. The entries have positions * starting at 0. * ********************************************************************************** */ void -RadarListAdd(RadarList list, - void *value, - int index) +ZnListAdd(ZnList list, + void *value, + int index) { - _RadarList *cur_list = (_RadarList *) list; + _ZnList *cur_list = (_ZnList *) list; int i; GrowIfNeeded(cur_list, 1); @@ -470,7 +470,7 @@ RadarListAdd(RadarList list, /* ********************************************************************************** * - * RadarListAt -- + * ZnListAt -- * Return the entry at 'index'. Indices start at 0. * Indices out of the current range are constrained * to fit in the range. @@ -479,27 +479,27 @@ RadarListAdd(RadarList list, */ void * -RadarListAt(RadarList list, - int index) +ZnListAt(ZnList list, + int index) { - if (!((_RadarList *) list)->used_size) { + if (!((_ZnList *) list)->used_size) { return NULL; } - if (index >= ((_RadarList *) list)->used_size) { - index = ((_RadarList *) list)->used_size - 1; + if (index >= ((_ZnList *) list)->used_size) { + index = ((_ZnList *) list)->used_size - 1; } if (index < 0) { index = 0; } - return (void *) ((_RadarList *) list)->list+(index*((_RadarList *) list)->elem_size); + return (void *) ((_ZnList *) list)->list+(index*((_ZnList *) list)->elem_size); } /* ********************************************************************************** * - * RadarListAtPut -- + * 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. @@ -508,30 +508,30 @@ RadarListAt(RadarList list, */ void -RadarListAtPut(RadarList list, - void *value, - int index) +ZnListAtPut(ZnList list, + void *value, + int index) { - if (!((_RadarList *) list)->used_size) { + if (!((_ZnList *) list)->used_size) { return; } - if (index >= ((_RadarList *) list)->used_size) { - index = ((_RadarList *) list)->used_size - 1; + if (index >= ((_ZnList *) list)->used_size) { + index = ((_ZnList *) list)->used_size - 1; } if (index < 0) { index = 0; } - memcpy(((_RadarList *) list)->list+(index*((_RadarList *) list)->elem_size), + memcpy(((_ZnList *) list)->list+(index*((_ZnList *) list)->elem_size), (char *) value, - ((_RadarList *) list)->elem_size); + ((_ZnList *) list)->elem_size); } /* ********************************************************************************** * - * RadarListDelete -- + * ZnListDelete -- * Suppress the entry matching value, searching from position * 'index'. If value is NULL suppress entry at index. * @@ -539,17 +539,17 @@ RadarListAtPut(RadarList list, */ void -RadarListDelete(RadarList list, - int index) +ZnListDelete(ZnList list, + int index) { - _RadarList *cur_list = (_RadarList *) list; + _ZnList *cur_list = (_ZnList *) list; int i; - if (!((_RadarList *) list)->used_size) { + if (!((_ZnList *) list)->used_size) { return; } - if (index >= ((_RadarList *) list)->used_size) { - index = ((_RadarList *) list)->used_size - 1; + if (index >= ((_ZnList *) list)->used_size) { + index = ((_ZnList *) list)->used_size - 1; } if (index < 0) { index = 0; @@ -566,22 +566,22 @@ RadarListDelete(RadarList list, /* ********************************************************************************** * - * RadarListTruncate -- + * ZnListTruncate -- * Suppress the entries from position 'index' inclusive to the end. * ********************************************************************************** */ void -RadarListTruncate(RadarList list, - int index) +ZnListTruncate(ZnList list, + int index) { - _RadarList *cur_list = (_RadarList *) list; + _ZnList *cur_list = (_ZnList *) list; - if (!((_RadarList *) list)->used_size) { + if (!((_ZnList *) list)->used_size) { return; } - if (index >= ((_RadarList *) list)->used_size) { + if (index >= ((_ZnList *) list)->used_size) { return; } if (index < 0) { @@ -595,12 +595,12 @@ RadarListTruncate(RadarList list, /* ********************************************************************************** * - * RadarListDo -- + * ZnListDo -- * Apply the function 'to_do' to each entry in the list. * Stop either at end of list or if 'to_do' returns a * non nul result. 'to_do' is a function with two * parameters. The first is bound in turn to each value of - * the list, the second is the data passed to RadarListDo. + * the list, the second is the data passed to ZnListDo. * If the scan stops at the end of the list, the function * returns -1, else it returns the index at which it has * stopped. @@ -609,11 +609,11 @@ RadarListTruncate(RadarList list, */ int -RadarListDo(RadarList list, - void *data, - int (*to_do)(void *value, void *data)) +ZnListDo(ZnList list, + void *data, + int (*to_do)(void *value, void *data)) { - _RadarList *cur_list = (_RadarList *) list; + _ZnList *cur_list = (_ZnList *) list; int i; for (i = 0; diff --git a/generic/List.h b/generic/List.h index 46ee00e..1eab580 100644 --- a/generic/List.h +++ b/generic/List.h @@ -53,8 +53,8 @@ extern "C" { ********************************************************************************** */ -#define RadarListHead 0 -#define RadarListTail (~(1 << ((8*sizeof(int)) - 1))) +#define ZnListHead 0 +#define ZnListTail (~(1 << ((8*sizeof(int)) - 1))) /* @@ -65,7 +65,7 @@ extern "C" { ********************************************************************************** */ -typedef void *RadarList; +typedef void *ZnList; /* @@ -76,38 +76,38 @@ typedef void *RadarList; ********************************************************************************** */ -RadarList RadarListNew(int /* initial_size */, - int /* element_size */); -RadarList RadarListDuplicate(RadarList /* list */); -void RadarListEmpty(RadarList /* list */); -RadarList RadarListFromArray(void */* array */, - int /* array_size */, - int /* element_size */); -void *RadarListArray(RadarList /* list */); -void RadarListFree(RadarList /* list */); -int RadarListSize(RadarList /* list */); -void RadarListAssertSize(RadarList /* list */, - int /* size */); -void RadarListCopy(RadarList /* to */, - RadarList /* from */); -void RadarListAppend(RadarList /* to */, - RadarList /* from */); -void RadarListAdd(RadarList /* list */, - void */* value */, - int /* index */); -void *RadarListAt(RadarList /* list */, - int /* index */); -void RadarListAtPut(RadarList /* list */, - void */* value */, - int /* index */); -void RadarListDelete(RadarList /* list */, - int /* index */); -void RadarListTruncate(RadarList /* list */, - int /* index */); -int RadarListDo(RadarList /* list */, - void *data, - int (*/* to_do */)(void */* value */, - void */*data*/)); +ZnList ZnListNew(int /* initial_size */, + int /* element_size */); +ZnList ZnListDuplicate(ZnList /* list */); +void ZnListEmpty(ZnList /* list */); +ZnList ZnListFromArray(void */* array */, + int /* array_size */, + int /* element_size */); +void *ZnListArray(ZnList /* list */); +void ZnListFree(ZnList /* list */); +int ZnListSize(ZnList /* list */); +void ZnListAssertSize(ZnList /* list */, + int /* size */); +void ZnListCopy(ZnList /* to */, + ZnList /* from */); +void ZnListAppend(ZnList /* to */, + ZnList /* from */); +void ZnListAdd(ZnList /* list */, + void */* value */, + int /* index */); +void *ZnListAt(ZnList /* list */, + int /* index */); +void ZnListAtPut(ZnList /* list */, + void */* value */, + int /* index */); +void ZnListDelete(ZnList /* list */, + int /* index */); +void ZnListTruncate(ZnList /* list */, + int /* index */); +int ZnListDo(ZnList /* list */, + void *data, + int (*/* to_do */)(void */* value */, + void */*data*/)); #ifdef __CPLUSPLUS__ diff --git a/generic/Map.c b/generic/Map.c index 45644d4..a9a6ed7 100644 --- a/generic/Map.c +++ b/generic/Map.c @@ -33,7 +33,7 @@ #include "Geo.h" #include "Draw.h" #include "WidgetInfo.h" -#include "tkRadar.h" +#include "tkZinc.h" #ifdef PERFOS #include "perfos.h" #endif @@ -59,66 +59,66 @@ typedef struct _MapItemStruct { ItemStruct header; /* Public data */ - RadarBool filled; - Pixmap fill_pattern; - RadarColor color; - RadarFont text_font; /* null value -> use radar_map_text_font */ - char *map_info_name; - RadarList symbol_patterns; + ZnBool filled; + Pixmap fill_pattern; + ZnColor color; + ZnFont text_font; /* null value -> use zn_map_text_font */ + char *map_info_name; + ZnList symbol_patterns; /* Private data */ - MapInfoId map_info; - RadarList vectors; - RadarList dashed_vectors; - RadarList dotted_vectors; - RadarList mixed_vectors; - RadarList arcs; - RadarList dashed_arcs; - RadarList dotted_arcs; - RadarList mixed_arcs; - RadarList marks; - RadarList symbols; - RadarList texts; + MapInfoId 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 PERFOS - Chrono chrono_trans; - Chrono chrono_draw; + Chrono chrono_trans; + Chrono chrono_draw; #endif } MapItemStruct, *MapItem; -static RadarAttrConfig map_attrs[] = { - { RADAR_CONFIG_COLOR, "-color", NULL, - Tk_Offset(MapItemStruct, color), 0, RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_BOOL, "-composerotation", NULL, +static ZnAttrConfig map_attrs[] = { + { ZN_CONFIG_COLOR, "-color", NULL, + Tk_Offset(MapItemStruct, color), 0, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_BOOL, "-composerotation", NULL, Tk_Offset(MapItemStruct, 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(MapItemStruct, header.flags), COMPOSE_SCALE_BIT, - RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_BOOL, "-filled", NULL, - Tk_Offset(MapItemStruct, filled), 1, RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_PATTERN, "-fillpattern", NULL, - Tk_Offset(MapItemStruct, fill_pattern), 0, RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_FONT, "-font", NULL, - Tk_Offset(MapItemStruct, text_font), 0, RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_MAP_INFO, "-mapinfo", NULL, + ZN_COORDS_FLAG, False }, + { ZN_CONFIG_BOOL, "-filled", NULL, + Tk_Offset(MapItemStruct, filled), 1, ZN_COORDS_FLAG, False }, + { ZN_CONFIG_PATTERN, "-fillpattern", NULL, + Tk_Offset(MapItemStruct, fill_pattern), 0, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_FONT, "-font", NULL, + Tk_Offset(MapItemStruct, text_font), 0, ZN_COORDS_FLAG, False }, + { ZN_CONFIG_MAP_INFO, "-mapinfo", NULL, Tk_Offset(MapItemStruct, map_info_name), 0, - RADAR_COORDS_FLAG|RADAR_MAP_INFO_FLAG, False }, - { RADAR_CONFIG_PRI, "-priority", NULL, + ZN_COORDS_FLAG|ZN_MAP_INFO_FLAG, False }, + { ZN_CONFIG_PRI, "-priority", NULL, Tk_Offset(MapItemStruct, header.priority), 0, - RADAR_DRAW_FLAG|RADAR_REPICK_FLAG, False }, - { RADAR_CONFIG_BOOL, "-sensitive", NULL, - Tk_Offset(MapItemStruct, header.flags), SENSITIVE_BIT, RADAR_REPICK_FLAG, False }, - { RADAR_CONFIG_PATTERNS, "-symbols", NULL, + ZN_DRAW_FLAG|ZN_REPICK_FLAG, False }, + { ZN_CONFIG_BOOL, "-sensitive", NULL, + Tk_Offset(MapItemStruct, header.flags), SENSITIVE_BIT, ZN_REPICK_FLAG, False }, + { ZN_CONFIG_PATTERNS, "-symbols", NULL, Tk_Offset(MapItemStruct, symbol_patterns), 0, - RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_TAGS, "-tags", NULL, + ZN_COORDS_FLAG, False }, + { ZN_CONFIG_TAGS, "-tags", NULL, Tk_Offset(MapItemStruct, header.tags), 0, 0, False }, - { RADAR_CONFIG_BOOL, "-visible", NULL, + { ZN_CONFIG_BOOL, "-visible", NULL, Tk_Offset(MapItemStruct, 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 } }; @@ -129,7 +129,7 @@ UpdateMapInfo(ClientData client_data, Item item = (Item) client_data; /*printf("updating a map 'cause of a change in mapinfo\n");*/ - ITEM.Invalidate(item, RADAR_COORDS_FLAG); + ITEM.Invalidate(item, ZN_COORDS_FLAG); } @@ -137,51 +137,51 @@ static void FreeLists(MapItem map) { if (map->vectors) { - RadarListFree(map->vectors); + ZnListFree(map->vectors); } map->vectors = NULL; if (map->dashed_vectors) { - RadarListFree(map->dashed_vectors); + ZnListFree(map->dashed_vectors); } map->dashed_vectors = NULL; if (map->dotted_vectors) { - RadarListFree(map->dotted_vectors); + ZnListFree(map->dotted_vectors); } map->dotted_vectors = NULL; if (map->mixed_vectors) { - RadarListFree(map->mixed_vectors); + ZnListFree(map->mixed_vectors); } map->mixed_vectors = NULL; if (map->arcs) { - RadarListFree(map->arcs); + ZnListFree(map->arcs); } map->arcs = NULL; if (map->dashed_arcs) { - RadarListFree(map->dashed_arcs); + ZnListFree(map->dashed_arcs); } map->dashed_arcs = NULL; if (map->dotted_arcs) { - RadarListFree(map->dotted_arcs); + ZnListFree(map->dotted_arcs); } map->dotted_arcs = NULL; if (map->mixed_arcs) { - RadarListFree(map->mixed_arcs); + ZnListFree(map->mixed_arcs); } map->mixed_arcs = NULL; if (map->marks) { - RadarListFree(map->marks); + ZnListFree(map->marks); } map->marks = NULL; if (map->symbols) { - RadarListFree(map->symbols); + ZnListFree(map->symbols); } map->symbols = NULL; if (map->texts) { - RadarListFree(map->texts); + ZnListFree(map->texts); } map->texts = NULL; } @@ -209,9 +209,9 @@ Init(Item item, item->part_sensitive = 0; item->priority = DEFAULT_MAP_PRIORITY; map->filled = False; - map->fill_pattern = RadarUnspecifiedPattern; + map->fill_pattern = ZnUnspecifiedPattern; map->symbol_patterns = NULL; - map->color = RadarGetColorByValue(wi->win, wi->fore_color); + map->color = ZnGetColorByValue(wi->win, wi->fore_color); map->text_font = Tk_GetFont(wi->interp, wi->win, Tk_NameOfFont(wi->map_text_font)); map->map_info_name = ""; map->map_info = NULL; @@ -234,7 +234,7 @@ Init(Item item, RazChronos(); #endif - return RADAR_OK; + return ZN_OK; } @@ -253,55 +253,55 @@ Clone(Item item) WidgetInfo *wi = item->wi; if (map->vectors) { - map->vectors = RadarListDuplicate(map->vectors); + map->vectors = ZnListDuplicate(map->vectors); } if (map->dashed_vectors) { - map->dashed_vectors = RadarListDuplicate(map->dashed_vectors); + map->dashed_vectors = ZnListDuplicate(map->dashed_vectors); } if (map->dotted_vectors) { - map->dotted_vectors = RadarListDuplicate(map->dotted_vectors); + map->dotted_vectors = ZnListDuplicate(map->dotted_vectors); } if (map->mixed_vectors) { - map->mixed_vectors = RadarListDuplicate(map->mixed_vectors); + map->mixed_vectors = ZnListDuplicate(map->mixed_vectors); } if (map->arcs) { - map->arcs = RadarListDuplicate(map->arcs); + map->arcs = ZnListDuplicate(map->arcs); } if (map->dashed_arcs) { - map->dashed_arcs = RadarListDuplicate(map->dashed_arcs); + map->dashed_arcs = ZnListDuplicate(map->dashed_arcs); } if (map->dotted_arcs) { - map->dotted_arcs = RadarListDuplicate(map->dotted_arcs); + map->dotted_arcs = ZnListDuplicate(map->dotted_arcs); } if (map->mixed_arcs) { - map->mixed_arcs = RadarListDuplicate(map->mixed_arcs); + map->mixed_arcs = ZnListDuplicate(map->mixed_arcs); } if (map->marks) { - map->marks = RadarListDuplicate(map->marks); + map->marks = ZnListDuplicate(map->marks); } if (map->symbols) { - map->symbols = RadarListDuplicate(map->symbols); + map->symbols = ZnListDuplicate(map->symbols); } if (map->texts) { - map->texts = RadarListDuplicate(map->texts); + map->texts = ZnListDuplicate(map->texts); } if (strlen(map->map_info_name) != 0) { char *text; - text = RadarMalloc((strlen(map->map_info_name) + 1) * sizeof(char)); + text = ZnMalloc((strlen(map->map_info_name) + 1) * sizeof(char)); strcpy(text, map->map_info_name); map->map_info_name = text; - map->map_info = Radar_GetMapInfo(wi->interp, map->map_info_name, - UpdateMapInfo, (ClientData) map); + map->map_info = ZnGetMapInfo(wi->interp, map->map_info_name, + UpdateMapInfo, (ClientData) map); } - map->color = RadarGetColorByValue(wi->win, map->color); + map->color = ZnGetColorByValue(wi->win, map->color); map->text_font = Tk_GetFont(wi->interp, wi->win, Tk_NameOfFont(map->text_font)); - if (map->fill_pattern != RadarUnspecifiedPattern) { + if (map->fill_pattern != ZnUnspecifiedPattern) { map->fill_pattern = Tk_GetBitmap(wi->interp, wi->win, Tk_NameOfBitmap(wi->dpy, map->fill_pattern)); } @@ -309,10 +309,10 @@ Clone(Item item) Pixmap *pats, *new_pats; int i, num_pats; - pats = (Pixmap *) RadarListArray(map->symbol_patterns); - num_pats = RadarListSize(map->symbol_patterns); - map->symbol_patterns = RadarListNew(num_pats, sizeof(Pixmap)); - new_pats = (Pixmap *) RadarListArray(map->symbol_patterns); + pats = (Pixmap *) ZnListArray(map->symbol_patterns); + num_pats = ZnListSize(map->symbol_patterns); + map->symbol_patterns = ZnListNew(num_pats, sizeof(Pixmap)); + new_pats = (Pixmap *) ZnListArray(map->symbol_patterns); for (i = 0; i < num_pats; i++) { new_pats[i] = Tk_GetBitmap(wi->interp, wi->win, Tk_NameOfBitmap(wi->dpy, pats[i])); @@ -335,27 +335,27 @@ Destroy(Item item) MapItem map = (MapItem) item; FreeLists(map); - RadarFreeColor(map->color); + ZnFreeColor(map->color); Tk_FreeFont(map->text_font); - if (map->fill_pattern != RadarUnspecifiedPattern) { + if (map->fill_pattern != ZnUnspecifiedPattern) { Tk_FreeBitmap(item->wi->dpy, map->fill_pattern); } if (map->symbol_patterns) { Pixmap *pats; int i, num_pats; - pats = (Pixmap *) RadarListArray(map->symbol_patterns); - num_pats = RadarListSize(map->symbol_patterns); + pats = (Pixmap *) ZnListArray(map->symbol_patterns); + num_pats = ZnListSize(map->symbol_patterns); for (i = 0; i < num_pats; i++) { Tk_FreeBitmap(item->wi->dpy, pats[i]); } - RadarListFree(map->symbol_patterns); + ZnListFree(map->symbol_patterns); } if (strlen(map->map_info_name) != 0) { - RadarFree(map->map_info_name); + ZnFree(map->map_info_name); } if (map->map_info != NULL) { - Radar_FreeMapInfo(map->map_info, UpdateMapInfo, (ClientData) map); + ZnFreeMapInfo(map->map_info, UpdateMapInfo, (ClientData) map); } } @@ -370,23 +370,23 @@ Destroy(Item item) static int Configure(Item item, int argc, - RadarAttrList argv, + ZnAttrList argv, int *flags) { WidgetInfo *wi = item->wi; MapItem map = (MapItem) 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_MAP_INFO_FLAG)) { + if (ISSET(*flags, ZN_MAP_INFO_FLAG)) { MapInfoId map_info; - RadarBool error = False; + ZnBool error = False; if (strlen(map->map_info_name) != 0) { - map_info = Radar_GetMapInfo(wi->interp, map->map_info_name, - UpdateMapInfo, (ClientData) map); + map_info = ZnGetMapInfo(wi->interp, map->map_info_name, + UpdateMapInfo, (ClientData) map); if (!map_info) { error = True; } @@ -396,16 +396,16 @@ Configure(Item item, } if (!error) { if (map->map_info != NULL) { - Radar_FreeMapInfo(map->map_info, UpdateMapInfo, (ClientData) map); + ZnFreeMapInfo(map->map_info, UpdateMapInfo, (ClientData) map); } map->map_info = map_info; } else { - return RADAR_ERROR; + return ZN_ERROR; } } - return RADAR_OK; + return ZN_OK; } @@ -419,13 +419,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,7 +439,7 @@ Query(Item item, static void ComputeCoordinates(Item item, - RadarBool force) + ZnBool force) { WidgetInfo *wi = item->wi; MapItem map = (MapItem) item; @@ -459,20 +459,20 @@ ComputeCoordinates(Item item, unsigned int num_dotted_arcs; unsigned int num_mixed_arcs; unsigned int num_marks; - RadarPoint *vectors, *dashed_vectors, *dotted_vectors; - RadarPoint *mixed_vectors, *marks; + ZnPoint *vectors, *dashed_vectors, *dotted_vectors; + ZnPoint *mixed_vectors, *marks; XArc *arcs, *dashed_arcs, *dotted_arcs, *mixed_arcs; - RadarPoint *symbols, *texts; - RadarPoint from, to, center; - RadarPoint tmp_from, tmp_to; + ZnPoint *symbols, *texts; + ZnPoint from, to, center; + ZnPoint tmp_from, tmp_to; XArc arc; - RadarBBox bbox, bbox_inter, radar_bbox; + ZnBBox bbox, bbox_inter, zn_bbox; int x_from_w, y_from_w, x_to_w, y_to_w; int radius, start_angle, extend; unsigned int radius_w; MapInfoPoint new_marks; unsigned int n_new_marks; - RadarFont text_font; + ZnFont text_font; int sym_w2=0, sym_h2=0; ResetBBox(&item->item_bounding_box); @@ -481,9 +481,9 @@ ComputeCoordinates(Item item, return; } - radar_bbox.orig.x = radar_bbox.orig.y = 0; - radar_bbox.corner.x = wi->width; - radar_bbox.corner.y = wi->height; + zn_bbox.orig.x = zn_bbox.orig.y = 0; + zn_bbox.corner.x = wi->width; + zn_bbox.corner.y = wi->height; map_info = map->map_info; @@ -586,66 +586,66 @@ ComputeCoordinates(Item item, * clipping and the filled attribute. */ if (!map->vectors) { - map->vectors = RadarListNew(num_points, sizeof(RadarPoint)); + map->vectors = ZnListNew(num_points, sizeof(ZnPoint)); } - RadarListAssertSize(map->vectors, num_points); + ZnListAssertSize(map->vectors, num_points); if (!map->dashed_vectors) { - map->dashed_vectors = RadarListNew(num_dashed_points, sizeof(RadarPoint)); + map->dashed_vectors = ZnListNew(num_dashed_points, sizeof(ZnPoint)); } - RadarListAssertSize(map->dashed_vectors, num_dashed_points); + ZnListAssertSize(map->dashed_vectors, num_dashed_points); if (!map->dotted_vectors) { - map->dotted_vectors = RadarListNew(num_dotted_points, sizeof(RadarPoint)); + map->dotted_vectors = ZnListNew(num_dotted_points, sizeof(ZnPoint)); } - RadarListAssertSize(map->dotted_vectors, num_dotted_points); + ZnListAssertSize(map->dotted_vectors, num_dotted_points); if (!map->mixed_vectors) { - map->mixed_vectors = RadarListNew(num_mixed_points, sizeof(RadarPoint)); + map->mixed_vectors = ZnListNew(num_mixed_points, sizeof(ZnPoint)); } - RadarListAssertSize(map->mixed_vectors, num_mixed_points); + ZnListAssertSize(map->mixed_vectors, num_mixed_points); if (!map->arcs) { - map->arcs = RadarListNew(num_arcs, sizeof(XArc)); + map->arcs = ZnListNew(num_arcs, sizeof(XArc)); } - RadarListAssertSize(map->arcs, num_arcs); + ZnListAssertSize(map->arcs, num_arcs); if (!map->dashed_arcs) { - map->dashed_arcs = RadarListNew(num_dashed_arcs, sizeof(XArc)); + map->dashed_arcs = ZnListNew(num_dashed_arcs, sizeof(XArc)); } - RadarListAssertSize(map->dashed_arcs, num_dashed_arcs); + ZnListAssertSize(map->dashed_arcs, num_dashed_arcs); if (!map->dotted_arcs) { - map->dotted_arcs = RadarListNew(num_dotted_arcs, sizeof(XArc)); + map->dotted_arcs = ZnListNew(num_dotted_arcs, sizeof(XArc)); } - RadarListAssertSize(map->dotted_arcs, num_dotted_arcs); + ZnListAssertSize(map->dotted_arcs, num_dotted_arcs); if (!map->mixed_arcs) { - map->mixed_arcs = RadarListNew(num_mixed_arcs, sizeof(XArc)); + map->mixed_arcs = ZnListNew(num_mixed_arcs, sizeof(XArc)); } - RadarListAssertSize(map->mixed_arcs, num_mixed_arcs); + ZnListAssertSize(map->mixed_arcs, num_mixed_arcs); if (!map->marks) { - map->marks = RadarListNew(num_marks, sizeof(RadarPoint)); + map->marks = ZnListNew(num_marks, sizeof(ZnPoint)); } - RadarListAssertSize(map->marks, num_marks); + ZnListAssertSize(map->marks, num_marks); if (!map->symbols) { - map->symbols = RadarListNew(MapInfoNumSymbols(map_info), sizeof(RadarPoint)); + map->symbols = ZnListNew(MapInfoNumSymbols(map_info), sizeof(ZnPoint)); } - RadarListAssertSize(map->symbols, MapInfoNumSymbols(map_info)); + ZnListAssertSize(map->symbols, MapInfoNumSymbols(map_info)); if (!map->texts) { - map->texts = RadarListNew(MapInfoNumTexts(map_info), sizeof(RadarPoint)); + map->texts = ZnListNew(MapInfoNumTexts(map_info), sizeof(ZnPoint)); } - RadarListAssertSize(map->texts, MapInfoNumTexts(map_info)); + ZnListAssertSize(map->texts, MapInfoNumTexts(map_info)); /* * Ask the pointers to the actual arrays. */ - vectors = (RadarPoint *) RadarListArray(map->vectors); - dashed_vectors = (RadarPoint *) RadarListArray(map->dashed_vectors); - dotted_vectors = (RadarPoint *) RadarListArray(map->dotted_vectors); - mixed_vectors = (RadarPoint *) RadarListArray(map->mixed_vectors); - arcs = (XArc *) RadarListArray(map->arcs); - dashed_arcs = (XArc *) RadarListArray(map->dashed_arcs); - dotted_arcs = (XArc *) RadarListArray(map->dotted_arcs); - mixed_arcs = (XArc *) RadarListArray(map->mixed_arcs); - marks = (RadarPoint *) RadarListArray(map->marks); - symbols = (RadarPoint *) RadarListArray(map->symbols); - texts = (RadarPoint *) RadarListArray(map->texts); - - if (num_marks && (wi->map_distance_symbol != RadarUnspecifiedPattern)) { + 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); + + if (num_marks && (wi->map_distance_symbol != ZnUnspecifiedPattern)) { Tk_SizeOfBitmap(wi->dpy, wi->map_distance_symbol, &sym_w2, &sym_h2); sym_w2 = (sym_w2+1)/2; sym_h2 = (sym_h2+1)/2; @@ -676,8 +676,8 @@ ComputeCoordinates(Item item, tmp_from.y = y_from_w; tmp_to.x = x_to_w; tmp_to.y = y_to_w; - RadarTransformPoint(wi->current_transfo, &tmp_from, &from); - RadarTransformPoint(wi->current_transfo, &tmp_to, &to); + ZnTransformPoint(wi->current_transfo, &tmp_from, &from); + ZnTransformPoint(wi->current_transfo, &tmp_to, &to); /* * Skip zero length and outside segments. @@ -687,7 +687,7 @@ ComputeCoordinates(Item item, } if (!map->filled) { - if (LineInBBox(&from, &to, &radar_bbox) < 0) { + if (LineInBBox(&from, &to, &zn_bbox) < 0) { continue; } } @@ -729,17 +729,17 @@ ComputeCoordinates(Item item, num_points++; vectors[num_points] = to; num_points++; - if (wi->map_distance_symbol != RadarUnspecifiedPattern) { + if (wi->map_distance_symbol != ZnUnspecifiedPattern) { MapInfoGetMarks(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 RadarPoint. - * Will use then RadarTransformPoints. + * 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; - RadarTransformPoint(wi->current_transfo, &tmp_from, &marks[num_marks]); + ZnTransformPoint(wi->current_transfo, &tmp_from, &marks[num_marks]); AddPointToBBox(&item->item_bounding_box, marks[num_marks].x-sym_w2, marks[num_marks].y-sym_h2); AddPointToBBox(&item->item_bounding_box, @@ -754,17 +754,17 @@ ComputeCoordinates(Item item, cnt = MapInfoNumArcs(map_info); for (i = 0; i < cnt; i++) { - RadarPoint xp; + ZnPoint xp; MapInfoGetArc(map_info, i, NULL, &line_style, &line_width, &x_from_w, &y_from_w, &radius_w, &start_angle, &extend); tmp_from.x = x_from_w; tmp_from.y = y_from_w; - RadarTransformPoint(wi->current_transfo, &tmp_from, ¢er); + ZnTransformPoint(wi->current_transfo, &tmp_from, ¢er); tmp_from.x += radius_w; tmp_from.y = 0; - RadarTransformPoint(wi->current_transfo, &tmp_from, &xp); + ZnTransformPoint(wi->current_transfo, &tmp_from, &xp); radius = xp.x - center.x; bbox.orig.x = center.x - radius; @@ -779,7 +779,7 @@ ComputeCoordinates(Item item, continue; } - IntersectBBox(&radar_bbox, &bbox, &bbox_inter); + IntersectBBox(&zn_bbox, &bbox, &bbox_inter); if (IsEmptyBBox(&bbox_inter)) { continue; } @@ -845,10 +845,10 @@ ComputeCoordinates(Item item, /* * Truncate arc lists to the real size. */ - RadarListAssertSize(map->arcs, num_arcs); - RadarListAssertSize(map->dashed_arcs, num_dashed_arcs); - RadarListAssertSize(map->dotted_arcs, num_dotted_arcs); - RadarListAssertSize(map->mixed_arcs, num_mixed_arcs); + ZnListAssertSize(map->arcs, num_arcs); + ZnListAssertSize(map->dashed_arcs, num_dashed_arcs); + ZnListAssertSize(map->dotted_arcs, num_dotted_arcs); + ZnListAssertSize(map->mixed_arcs, num_mixed_arcs); #ifdef PERFOS StopUCChrono(map->chrono_trans); @@ -859,17 +859,17 @@ ComputeCoordinates(Item item, /* If map is filled, only the vectors description is valid. */ if (!map->filled) { if (map->symbol_patterns) { - Pixmap sym, *syms = (Pixmap *) RadarListArray(map->symbol_patterns); - int num_syms = RadarListSize(map->symbol_patterns); + Pixmap sym, *syms = (Pixmap *) ZnListArray(map->symbol_patterns); + int num_syms = ZnListSize(map->symbol_patterns); cnt = MapInfoNumSymbols(map_info); for (i = 0; i < cnt; i++) { MapInfoGetSymbol(map_info, i, NULL, &x_from_w, &y_from_w, &symbol); tmp_from.x = x_from_w; tmp_from.y = y_from_w; - RadarTransformPoint(wi->current_transfo, &tmp_from, &symbols[i]); + ZnTransformPoint(wi->current_transfo, &tmp_from, &symbols[i]); sym = syms[symbol%num_syms]; - if (sym != RadarUnspecifiedPattern) { + if (sym != ZnUnspecifiedPattern) { Tk_SizeOfBitmap(wi->dpy, sym, &sym_w2, &sym_h2); sym_w2 = (sym_w2+1)/2; sym_h2 = (sym_h2+1)/2; @@ -879,7 +879,7 @@ ComputeCoordinates(Item item, symbols[i].x+sym_w2, symbols[i].y+sym_h2); } } - RadarListAssertSize(map->symbols, cnt); + ZnListAssertSize(map->symbols, cnt); } cnt = MapInfoNumTexts(map_info); @@ -889,7 +889,7 @@ ComputeCoordinates(Item item, &text_style, &line_style, &x_from_w, &y_from_w, &text); tmp_from.x = x_from_w; tmp_from.y = y_from_w; - RadarTransformPoint(wi->current_transfo, &tmp_from, &texts[i]); + ZnTransformPoint(wi->current_transfo, &tmp_from, &texts[i]); AddStringToBBox(&item->item_bounding_box, text, text_font, texts[i].x, texts[i].y); @@ -930,30 +930,30 @@ ComputeCoordinates(Item item, } } } - RadarListAssertSize(map->texts, cnt); + ZnListAssertSize(map->texts, cnt); } /* * Truncate line lists to the real size. */ - RadarListAssertSize(map->vectors, num_points); - RadarListAssertSize(map->dashed_vectors, num_dashed_points); - RadarListAssertSize(map->dotted_vectors, num_dotted_points); - RadarListAssertSize(map->mixed_vectors, num_mixed_points); - RadarListAssertSize(map->marks, num_marks); + ZnListAssertSize(map->vectors, num_points); + ZnListAssertSize(map->dashed_vectors, num_dashed_points); + ZnListAssertSize(map->dotted_vectors, num_dotted_points); + ZnListAssertSize(map->mixed_vectors, num_mixed_points); + ZnListAssertSize(map->marks, num_marks); AddPointsToBBox(&item->item_bounding_box, - (RadarPoint *) RadarListArray(map->vectors), - RadarListSize(map->vectors)); + (ZnPoint *) ZnListArray(map->vectors), + ZnListSize(map->vectors)); AddPointsToBBox(&item->item_bounding_box, - (RadarPoint *) RadarListArray(map->dashed_vectors), - RadarListSize(map->dashed_vectors)); + (ZnPoint *) ZnListArray(map->dashed_vectors), + ZnListSize(map->dashed_vectors)); AddPointsToBBox(&item->item_bounding_box, - (RadarPoint *) RadarListArray(map->dotted_vectors), - RadarListSize(map->dotted_vectors)); + (ZnPoint *) ZnListArray(map->dotted_vectors), + ZnListSize(map->dotted_vectors)); AddPointsToBBox(&item->item_bounding_box, - (RadarPoint *) RadarListArray(map->mixed_vectors), - RadarListSize(map->mixed_vectors)); + (ZnPoint *) ZnListArray(map->mixed_vectors), + ZnListSize(map->mixed_vectors)); } @@ -968,11 +968,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; } @@ -992,7 +992,7 @@ Draw(Item item) WidgetInfo *wi = item->wi; MapItem map = (MapItem) item; MapInfoId map_info; - RadarPoint *points; + ZnPoint *points; XPoint *xpoints; char *text; char tmp_str[] = "."; @@ -1006,11 +1006,11 @@ Draw(Item item) map_info = map->map_info; - values.foreground = RadarPixel(map->color); + values.foreground = ZnPixel(map->color); if (map->filled) { - if (RadarListSize(map->vectors) || RadarListSize(map->arcs)) { - if (map->fill_pattern == RadarUnspecifiedPattern) { /* Fill solid */ + if (ZnListSize(map->vectors) || ZnListSize(map->arcs)) { + if (map->fill_pattern == ZnUnspecifiedPattern) { /* Fill solid */ values.fill_style = FillSolid; XChangeGC(wi->dpy, wi->gc, GCFillStyle | GCForeground, &values); } @@ -1021,10 +1021,10 @@ Draw(Item item) GCFillStyle | GCStipple | GCForeground, &values); } - cnt = RadarListSize(map->vectors); + cnt = ZnListSize(map->vectors); if (cnt) { xpoints = (XPoint *) alloca(cnt * sizeof(XPoint)); - points = (RadarPoint *) RadarListArray(map->vectors); + points = (ZnPoint *) ZnListArray(map->vectors); for (i = 0; i < cnt; i++) { xpoints[i].x = points[i].x; xpoints[i].y = points[i].y; @@ -1033,9 +1033,9 @@ Draw(Item item) Nonconvex, CoordModeOrigin); } - if (RadarListSize(map->arcs)) { + if (ZnListSize(map->arcs)) { XFillArcs(wi->dpy, wi->draw_buffer, wi->gc, - (XArc *) RadarListArray(map->arcs), RadarListSize(map->arcs)); + (XArc *) ZnListArray(map->arcs), ZnListSize(map->arcs)); } } } @@ -1044,7 +1044,7 @@ Draw(Item item) #ifdef PERFOS StartUCChrono(map->chrono_draw); #endif - if (RadarListSize(map->vectors)) { + if (ZnListSize(map->vectors)) { SetLineStyle(wi->dpy, wi->gc, LINE_SIMPLE); values.fill_style = FillSolid; values.line_width = 0; @@ -1054,10 +1054,10 @@ Draw(Item item) /* !! WARNING !! XDrawSegments can't handle an unlimited number of segments in releases R4 and older */ /* XDrawSegments(wi->dpy, wi->draw_buffer, wi->gc, - (XSegment *) RadarListArray(map->vectors), - RadarListSize(map->vectors)/2);*/ - cnt = RadarListSize(map->vectors); - points = (RadarPoint *) RadarListArray(map->vectors); + (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 (LineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) { MapInfoGetLine(map_info, i/2, NULL, NULL, &line_width, NULL, @@ -1073,7 +1073,7 @@ Draw(Item item) } } - if (RadarListSize(map->dashed_vectors)) { + if (ZnListSize(map->dashed_vectors)) { SetLineStyle(wi->dpy, wi->gc, LINE_DASHED); values.fill_style = FillSolid; values.line_width = 0; @@ -1082,9 +1082,9 @@ Draw(Item item) /* !! WARNING !! XDrawSegments can't handle an unlimited number of segments in releases R4 and older */ /* XDrawSegments(wi->dpy, wi->draw_buffer, wi->gc, - (XSegment *) RadarListArray(map->dashed_vectors), RadarListSize(map->dashed_vectors)/2);*/ - cnt = RadarListSize(map->dashed_vectors); - points = (RadarPoint *) RadarListArray(map->dashed_vectors); + (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 (LineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) { MapInfoGetLine(map_info, i/2, NULL, NULL, &line_width, NULL, NULL, NULL, NULL); @@ -1099,7 +1099,7 @@ Draw(Item item) } } - if (RadarListSize(map->dotted_vectors)) { + if (ZnListSize(map->dotted_vectors)) { SetLineStyle(wi->dpy, wi->gc, LINE_DOTTED); values.fill_style = FillSolid; values.line_width = 0; @@ -1109,9 +1109,9 @@ Draw(Item item) /* !! WARNING !! XDrawSegments can't handle an unlimited number of segments in releases R4 and older */ /* XDrawSegments(wi->dpy, wi->draw_buffer, wi->gc, - (XSegment *) RadarListArray(map->dotted_vectors), RadarListSize(map->dotted_vectors)/2);*/ - cnt = RadarListSize(map->dotted_vectors); - points = (RadarPoint *) RadarListArray(map->dotted_vectors); + (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 (LineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) { MapInfoGetLine(map_info, i/2, NULL, NULL, &line_width, NULL, NULL, NULL, NULL); @@ -1126,7 +1126,7 @@ Draw(Item item) } } - if (RadarListSize(map->mixed_vectors)) { + if (ZnListSize(map->mixed_vectors)) { SetLineStyle(wi->dpy, wi->gc, LINE_MIXED); values.fill_style = FillSolid; values.line_width = 0; @@ -1135,9 +1135,9 @@ Draw(Item item) /* !! WARNING !! XDrawSegments can't handle an unlimited number of segments in releases R4 and older */ /*XDrawSegments(wi->dpy, wi->draw_buffer, wi->gc, - (XSegment *) RadarListArray(map->mixed_vectors), RadarListSize(map->mixed_vectors)/2);*/ - cnt = RadarListSize(map->mixed_vectors); - points = (RadarPoint *) RadarListArray(map->mixed_vectors); + (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 (LineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) { MapInfoGetLine(map_info, i/2, NULL, NULL, &line_width, NULL, NULL, NULL, NULL); @@ -1152,7 +1152,7 @@ Draw(Item item) } } - if (RadarListSize(map->arcs)) { + if (ZnListSize(map->arcs)) { SetLineStyle(wi->dpy, wi->gc, LINE_SIMPLE); values.fill_style = FillSolid; @@ -1163,10 +1163,10 @@ Draw(Item item) in releases R4 and older */ XDrawArcs(wi->dpy, wi->draw_buffer, wi->gc, - (XArc *) RadarListArray(map->arcs), RadarListSize(map->arcs)); + (XArc *) ZnListArray(map->arcs), ZnListSize(map->arcs)); } - if (RadarListSize(map->dashed_arcs)) { + if (ZnListSize(map->dashed_arcs)) { SetLineStyle(wi->dpy, wi->gc, LINE_DASHED); values.fill_style = FillSolid; @@ -1177,11 +1177,11 @@ Draw(Item item) in releases R4 and older */ XDrawArcs(wi->dpy, wi->draw_buffer, wi->gc, - (XArc *) RadarListArray(map->dashed_arcs), - RadarListSize(map->dashed_arcs)); + (XArc *) ZnListArray(map->dashed_arcs), + ZnListSize(map->dashed_arcs)); } - if (RadarListSize(map->dotted_arcs)) { + if (ZnListSize(map->dotted_arcs)) { SetLineStyle(wi->dpy, wi->gc, LINE_DOTTED); values.fill_style = FillSolid; @@ -1192,11 +1192,11 @@ Draw(Item item) in releases R4 and older */ XDrawArcs(wi->dpy, wi->draw_buffer, wi->gc, - (XArc *) RadarListArray(map->dotted_arcs), - RadarListSize(map->dotted_arcs)); + (XArc *) ZnListArray(map->dotted_arcs), + ZnListSize(map->dotted_arcs)); } - if (RadarListSize(map->mixed_arcs)) { + if (ZnListSize(map->mixed_arcs)) { SetLineStyle(wi->dpy, wi->gc, LINE_MIXED); values.fill_style = FillSolid; @@ -1207,21 +1207,21 @@ Draw(Item item) in releases R4 and older */ XDrawArcs(wi->dpy, wi->draw_buffer, wi->gc, - (XArc *) RadarListArray(map->mixed_arcs), - RadarListSize(map->mixed_arcs)); + (XArc *) ZnListArray(map->mixed_arcs), + ZnListSize(map->mixed_arcs)); } - if (RadarListSize(map->texts)) { + if (ZnListSize(map->texts)) { /* For the Tk widget we don't have to bother with old * compatibility issues. */ - values.font = RadarFontId(map->text_font); + values.font = ZnFontId(map->text_font); values.fill_style = FillSolid; XChangeGC(wi->dpy, wi->gc, GCFillStyle | GCFont | GCForeground, &values); - cnt = RadarListSize(map->texts); - points = (RadarPoint *) RadarListArray(map->texts); + cnt = ZnListSize(map->texts); + points = (ZnPoint *) ZnListArray(map->texts); for (i = 0; i < cnt; i++) { MapInfoGetText(map_info, i, NULL, NULL, NULL, NULL, NULL, &text); XDrawString(wi->dpy, wi->draw_buffer, wi->gc, @@ -1229,7 +1229,7 @@ Draw(Item item) } } - if (RadarListSize(map->symbols) || RadarListSize(map->marks)) { + if (ZnListSize(map->symbols) || ZnListSize(map->marks)) { int w, h, ox, oy; Pixmap sym; @@ -1237,15 +1237,15 @@ Draw(Item item) XChangeGC(wi->dpy, wi->gc, GCFillStyle, &values); if (map->symbol_patterns) { - Pixmap *syms = (Pixmap *) RadarListArray(map->symbol_patterns); - int num_syms = RadarListSize(map->symbol_patterns); + Pixmap *syms = (Pixmap *) ZnListArray(map->symbol_patterns); + int num_syms = ZnListSize(map->symbol_patterns); - cnt = RadarListSize(map->symbols); - points = (RadarPoint *) RadarListArray(map->symbols); + cnt = ZnListSize(map->symbols); + points = (ZnPoint *) ZnListArray(map->symbols); for (i = 0; i < cnt; i++) { MapInfoGetSymbol(map_info, i, NULL, NULL, NULL, &(tmp_str[0])); sym = syms[tmp_str[0]%num_syms]; - if (sym != RadarUnspecifiedPattern) { + if (sym != ZnUnspecifiedPattern) { Tk_SizeOfBitmap(wi->dpy, sym, &w, &h); ox = points[i].x-w/2; oy = points[i].y-h/2; @@ -1259,10 +1259,10 @@ Draw(Item item) } } - if (wi->map_distance_symbol != RadarUnspecifiedPattern) { + if (wi->map_distance_symbol != ZnUnspecifiedPattern) { Tk_SizeOfBitmap(wi->dpy, wi->map_distance_symbol, &w, &h); - cnt = RadarListSize(map->marks); - points = (RadarPoint *) RadarListArray(map->marks); + cnt = ZnListSize(map->marks); + points = (ZnPoint *) ZnListArray(map->marks); values.stipple = wi->map_distance_symbol; XChangeGC(wi->dpy, wi->gc, GCStipple, &values); for (i = 0; i < cnt; i++) { @@ -1292,12 +1292,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)); } @@ -1315,7 +1315,7 @@ IsSensitive(Item item, */ static double Pick(Item item, - RadarPoint *p, + ZnPoint *p, Item start_item, int aperture, Item *a_item, @@ -1334,15 +1334,15 @@ 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) { Tcl_AppendResult(item->wi->interp, " maps doesn't support the coords command", NULL); - return RADAR_ERROR; + return ZN_ERROR; } @@ -1392,4 +1392,4 @@ static ItemClassStruct MAP_ITEM_CLASS = { PostScript }; -RadarItemClassId RadarMap = (RadarItemClassId) &MAP_ITEM_CLASS; +ZnItemClassId ZnMap = (ZnItemClassId) &MAP_ITEM_CLASS; diff --git a/generic/MapInfo.c b/generic/MapInfo.c index be4c4ae..30d20cd 100644 --- a/generic/MapInfo.c +++ b/generic/MapInfo.c @@ -57,7 +57,7 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ " *----------------------------------------------------------------------- */ typedef struct { - RadarPtr tag; + ZnPtr tag; MapInfoLineStyle style; int width; MapInfoPointStruct center; @@ -67,7 +67,7 @@ typedef struct { } MapInfoArcStruct, *MapInfoArc; typedef struct { - RadarPtr tag; + ZnPtr tag; MapInfoLineStyle style; int width; MapInfoPointStruct from; @@ -77,13 +77,13 @@ typedef struct { } MapInfoLineStruct, *MapInfoLine; typedef struct { - RadarPtr tag; + ZnPtr tag; MapInfoPointStruct at; char symbol[2]; } MapInfoSymbolStruct, *MapInfoSymbol; typedef struct { - RadarPtr tag; + ZnPtr tag; MapInfoTextStyle text_style; MapInfoLineStyle line_style; MapInfoPointStruct at; @@ -92,10 +92,10 @@ typedef struct { typedef struct { char *name; - RadarList lines; - RadarList symbols; - RadarList texts; - RadarList arcs; + ZnList lines; + ZnList symbols; + ZnList texts; + ZnList arcs; } MapInfoStruct, *MapInfo; @@ -148,7 +148,7 @@ ComputeLineMarks(MapInfoLine marked_line) } if (marked_line->num_marks) { - marked_line->marks = (MapInfoPoint) RadarMalloc(marked_line->num_marks * sizeof(MapInfoPointStruct)); + marked_line->marks = (MapInfoPoint) ZnMalloc(marked_line->num_marks * sizeof(MapInfoPointStruct)); } for (j = 0; j < marked_line->num_marks; j++) { @@ -163,12 +163,12 @@ MapInfoCreate(char *name) { MapInfo new_map; - new_map = (MapInfo) RadarMalloc(sizeof(MapInfoStruct)); + new_map = (MapInfo) ZnMalloc(sizeof(MapInfoStruct)); memset((char *) new_map, 0, sizeof(MapInfoStruct)); if (!name) { name = ""; } - new_map->name = (char *) RadarMalloc(strlen(name)+1); + new_map->name = (char *) ZnMalloc(strlen(name)+1); strcpy(new_map->name, name); return((MapInfoId) new_map); @@ -201,15 +201,15 @@ MapInfoDuplicate(MapInfoId map_info) new_map = (MapInfo) MapInfoCreate(cur_map->name); if (cur_map->lines) { - new_map->lines = RadarListDuplicate(cur_map->lines); + new_map->lines = ZnListDuplicate(cur_map->lines); - cur_lines = (MapInfoLine) RadarListArray(cur_map->lines); - new_lines = (MapInfoLine) RadarListArray(new_map->lines); - num_lines = RadarListSize(cur_map->lines); + cur_lines = (MapInfoLine) ZnListArray(cur_map->lines); + new_lines = (MapInfoLine) ZnListArray(new_map->lines); + num_lines = ZnListSize(cur_map->lines); for (i = 0; i < num_lines; i++) { if (new_lines[i].style == MapInfoLineMarked) { - new_lines[i].marks = (MapInfoPoint) RadarMalloc(new_lines[i].num_marks * + new_lines[i].marks = (MapInfoPoint) ZnMalloc(new_lines[i].num_marks * sizeof(MapInfoPointStruct)); memcpy((char *) new_lines[i].marks, (char *) cur_lines[i].marks, @@ -218,22 +218,22 @@ MapInfoDuplicate(MapInfoId map_info) } } if (cur_map->symbols) { - new_map->symbols = RadarListDuplicate(cur_map->symbols); + new_map->symbols = ZnListDuplicate(cur_map->symbols); } if (cur_map->texts) { - new_map->texts = RadarListDuplicate(cur_map->texts); + new_map->texts = ZnListDuplicate(cur_map->texts); - cur_texts = (MapInfoText) RadarListArray(cur_map->texts); - new_texts = (MapInfoText) RadarListArray(new_map->texts); - num_texts = RadarListSize(cur_map->texts); + cur_texts = (MapInfoText) ZnListArray(cur_map->texts); + new_texts = (MapInfoText) ZnListArray(new_map->texts); + num_texts = ZnListSize(cur_map->texts); for (i = 0; i < num_texts; i++) { - new_texts[i].text = (char *) RadarMalloc(strlen(cur_texts[i].text) + 1); + new_texts[i].text = (char *) ZnMalloc(strlen(cur_texts[i].text) + 1); strcpy(new_texts[i].text, cur_texts[i].text); } } if (cur_map->arcs) { - new_map->arcs = RadarListDuplicate(cur_map->arcs); + new_map->arcs = ZnListDuplicate(cur_map->arcs); } return((MapInfoId) new_map); @@ -250,39 +250,39 @@ MapInfoDelete(MapInfoId map_info) if (cur_map) { if (cur_map->texts) { - num_texts = RadarListSize(cur_map->texts); - cur_texts = (MapInfoText) RadarListArray(cur_map->texts); + num_texts = ZnListSize(cur_map->texts); + cur_texts = (MapInfoText) ZnListArray(cur_map->texts); for (i = 0; i < num_texts; i++) { - RadarFree((char *) cur_texts[i].text); + ZnFree((char *) cur_texts[i].text); } - RadarListFree(cur_map->texts); + ZnListFree(cur_map->texts); } if (cur_map->lines) { - num_lines = RadarListSize(cur_map->lines); - cur_lines = (MapInfoLine) RadarListArray(cur_map->lines); + num_lines = ZnListSize(cur_map->lines); + cur_lines = (MapInfoLine) ZnListArray(cur_map->lines); for (i = 0; i < num_lines; i++) { if (cur_lines[i].style == MapInfoLineMarked) { - RadarFree((char *) cur_lines[i].marks); + ZnFree((char *) cur_lines[i].marks); } } - RadarListFree(cur_map->lines); + ZnListFree(cur_map->lines); } if (cur_map->symbols) { - RadarListFree(cur_map->symbols); + ZnListFree(cur_map->symbols); } if (cur_map->arcs) { - RadarListFree(cur_map->arcs); + ZnListFree(cur_map->arcs); } - RadarFree(cur_map->name); - RadarFree(cur_map); + ZnFree(cur_map->name); + ZnFree(cur_map); } } @@ -293,16 +293,16 @@ MapInfoEmpty(MapInfoId map_info) if (cur_map) { if (cur_map->texts) { - RadarListEmpty(cur_map->texts); + ZnListEmpty(cur_map->texts); } if (cur_map->lines) { - RadarListEmpty(cur_map->lines); + ZnListEmpty(cur_map->lines); } if (cur_map->symbols) { - RadarListEmpty(cur_map->symbols); + ZnListEmpty(cur_map->symbols); } if (cur_map->arcs) { - RadarListEmpty(cur_map->arcs); + ZnListEmpty(cur_map->arcs); } } } @@ -311,7 +311,7 @@ MapInfoEmpty(MapInfoId map_info) void MapInfoAddLine(MapInfoId map_info, unsigned int index, - RadarPtr tag, + ZnPtr tag, MapInfoLineStyle line_style, int line_width, int x_from, @@ -324,7 +324,7 @@ MapInfoAddLine(MapInfoId map_info, if (cur_map) { if (!cur_map->lines) { - cur_map->lines = RadarListNew(16, sizeof(MapInfoLineStruct)); + cur_map->lines = ZnListNew(16, sizeof(MapInfoLineStruct)); } line_struct.style = line_style; @@ -344,7 +344,7 @@ MapInfoAddLine(MapInfoId map_info, ComputeLineMarks(&line_struct); } - RadarListAdd(cur_map->lines, &line_struct, index); + ZnListAdd(cur_map->lines, &line_struct, index); } } @@ -352,7 +352,7 @@ MapInfoAddLine(MapInfoId map_info, void MapInfoReplaceLine(MapInfoId map_info, unsigned int index, - RadarPtr tag, + ZnPtr tag, MapInfoLineStyle line_style, int line_width, int x_from, @@ -364,10 +364,10 @@ MapInfoReplaceLine(MapInfoId map_info, MapInfoLine line_ptr; if (cur_map && cur_map->lines) { - line_ptr = (MapInfoLine) RadarListAt(cur_map->lines, index); + line_ptr = (MapInfoLine) ZnListAt(cur_map->lines, index); if (line_ptr) { if (line_ptr->style == MapInfoLineMarked) { - RadarFree((char *) line_ptr->marks); + ZnFree((char *) line_ptr->marks); } line_ptr->style = line_style; @@ -399,13 +399,13 @@ MapInfoRemoveLine(MapInfoId map_info, MapInfoLine line_ptr; if (cur_map && cur_map->lines) { - line_ptr = (MapInfoLine) RadarListAt(cur_map->lines, index); + line_ptr = (MapInfoLine) ZnListAt(cur_map->lines, index); if (line_ptr) { if (line_ptr->style == MapInfoLineMarked) { - RadarFree((char *) line_ptr->marks); + ZnFree((char *) line_ptr->marks); } - RadarListDelete(cur_map->lines, index); + ZnListDelete(cur_map->lines, index); } } } @@ -414,7 +414,7 @@ MapInfoRemoveLine(MapInfoId map_info, void MapInfoGetLine(MapInfoId map_info, unsigned int index, - RadarPtr *tag, + ZnPtr *tag, MapInfoLineStyle *line_style, int *line_width, int *x_from, @@ -426,7 +426,7 @@ MapInfoGetLine(MapInfoId map_info, MapInfoLine line_ptr; if (cur_map && cur_map->lines) { - line_ptr = (MapInfoLine) RadarListAt(cur_map->lines, index); + line_ptr = (MapInfoLine) ZnListAt(cur_map->lines, index); if (line_ptr) { if (tag) { *tag = line_ptr->tag; @@ -469,7 +469,7 @@ MapInfoGetMarks(MapInfoId map_info, MapInfoLine line_ptr; if (cur_map && cur_map->lines) { - line_ptr = (MapInfoLine) RadarListAt(cur_map->lines, index); + line_ptr = (MapInfoLine) ZnListAt(cur_map->lines, index); if (line_ptr && line_ptr->style == MapInfoLineMarked) { if (marks) { *marks = line_ptr->marks; @@ -488,7 +488,7 @@ MapInfoNumLines(MapInfoId map_info) MapInfo cur_map = (MapInfo) map_info; if (cur_map && cur_map->lines) { - return RadarListSize(cur_map->lines); + return ZnListSize(cur_map->lines); } else { return 0; @@ -499,7 +499,7 @@ MapInfoNumLines(MapInfoId map_info) void MapInfoAddSymbol(MapInfoId map_info, unsigned int index, - RadarPtr tag, + ZnPtr tag, int x, int y, char symbol) @@ -509,7 +509,7 @@ MapInfoAddSymbol(MapInfoId map_info, if (cur_map) { if (!cur_map->symbols) { - cur_map->symbols = RadarListNew(16, sizeof(MapInfoSymbolStruct)); + cur_map->symbols = ZnListNew(16, sizeof(MapInfoSymbolStruct)); } symbol_struct.tag = tag; @@ -518,7 +518,7 @@ MapInfoAddSymbol(MapInfoId map_info, symbol_struct.symbol[0] = symbol; symbol_struct.symbol[1] = '\0'; - RadarListAdd(cur_map->symbols, &symbol_struct, index); + ZnListAdd(cur_map->symbols, &symbol_struct, index); } } @@ -526,7 +526,7 @@ MapInfoAddSymbol(MapInfoId map_info, void MapInfoReplaceSymbol(MapInfoId map_info, unsigned int index, - RadarPtr tag, + ZnPtr tag, int x, int y, char symbol) @@ -541,7 +541,7 @@ MapInfoReplaceSymbol(MapInfoId map_info, symbol_struct.symbol[0] = symbol; symbol_struct.symbol[1] = '\0'; - RadarListAtPut(cur_map->symbols, &symbol_struct, index); + ZnListAtPut(cur_map->symbols, &symbol_struct, index); } } @@ -553,7 +553,7 @@ MapInfoRemoveSymbol(MapInfoId map_info, MapInfo cur_map = (MapInfo) map_info; if (cur_map && cur_map->symbols) { - RadarListDelete(cur_map->symbols, index); + ZnListDelete(cur_map->symbols, index); } } @@ -561,7 +561,7 @@ MapInfoRemoveSymbol(MapInfoId map_info, void MapInfoGetSymbol(MapInfoId map_info, unsigned int index, - RadarPtr *tag, + ZnPtr *tag, int *x, int *y, char *symbol) @@ -570,7 +570,7 @@ MapInfoGetSymbol(MapInfoId map_info, MapInfoSymbol symbol_ptr; if (cur_map && cur_map->symbols) { - symbol_ptr = (MapInfoSymbol) RadarListAt(cur_map->symbols, index); + symbol_ptr = (MapInfoSymbol) ZnListAt(cur_map->symbols, index); if (symbol_ptr) { if (tag) { *tag = symbol_ptr->tag; @@ -595,7 +595,7 @@ MapInfoNumSymbols(MapInfoId map_info) MapInfo cur_map = (MapInfo) map_info; if (cur_map && cur_map->symbols) { - return RadarListSize(cur_map->symbols); + return ZnListSize(cur_map->symbols); } else { return 0; @@ -606,7 +606,7 @@ MapInfoNumSymbols(MapInfoId map_info) void MapInfoAddText(MapInfoId map_info, unsigned int index, - RadarPtr tag, + ZnPtr tag, MapInfoTextStyle text_style, MapInfoLineStyle line_style, int x, @@ -618,7 +618,7 @@ MapInfoAddText(MapInfoId map_info, if (cur_map) { if (!cur_map->texts) { - cur_map->texts = RadarListNew(16, sizeof(MapInfoTextStruct)); + cur_map->texts = ZnListNew(16, sizeof(MapInfoTextStruct)); } text_struct.tag = tag; @@ -626,10 +626,10 @@ MapInfoAddText(MapInfoId map_info, text_struct.line_style = NOT_MARKED_STYLE(line_style); text_struct.at.x = x; text_struct.at.y = y; - text_struct.text = (char *) RadarMalloc(strlen(text) + 1); + text_struct.text = (char *) ZnMalloc(strlen(text) + 1); strcpy(text_struct.text, text); - RadarListAdd(cur_map->texts, &text_struct, index); + ZnListAdd(cur_map->texts, &text_struct, index); } } @@ -637,7 +637,7 @@ MapInfoAddText(MapInfoId map_info, void MapInfoReplaceText(MapInfoId map_info, unsigned int index, - RadarPtr tag, + ZnPtr tag, MapInfoTextStyle text_style, MapInfoLineStyle line_style, int x, @@ -648,16 +648,16 @@ MapInfoReplaceText(MapInfoId map_info, MapInfoText text_ptr; if (cur_map && cur_map->texts) { - text_ptr = (MapInfoText) RadarListAt(cur_map->texts, index); + text_ptr = (MapInfoText) ZnListAt(cur_map->texts, index); if (text_ptr) { - RadarFree(text_ptr->text); + ZnFree(text_ptr->text); 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 = (char *) RadarMalloc(strlen(text) + 1); + text_ptr->text = (char *) ZnMalloc(strlen(text) + 1); strcpy(text_ptr->text, text); } } @@ -672,11 +672,11 @@ MapInfoRemoveText(MapInfoId map_info, MapInfoText text_ptr; if (cur_map && cur_map->texts) { - text_ptr = (MapInfoText) RadarListAt(cur_map->texts, index); + text_ptr = (MapInfoText) ZnListAt(cur_map->texts, index); if (text_ptr) { - RadarFree(text_ptr->text); + ZnFree(text_ptr->text); - RadarListDelete(cur_map->texts, index); + ZnListDelete(cur_map->texts, index); } } } @@ -685,7 +685,7 @@ MapInfoRemoveText(MapInfoId map_info, void MapInfoGetText(MapInfoId map_info, unsigned int index, - RadarPtr *tag, + ZnPtr *tag, MapInfoTextStyle *text_style, MapInfoLineStyle *line_style, int *x, @@ -696,7 +696,7 @@ MapInfoGetText(MapInfoId map_info, MapInfoText text_ptr; if (cur_map && cur_map->texts) { - text_ptr = (MapInfoText) RadarListAt(cur_map->texts, index); + text_ptr = (MapInfoText) ZnListAt(cur_map->texts, index); if (text_ptr) { if (tag) { *tag = text_ptr->tag; @@ -727,7 +727,7 @@ MapInfoNumTexts(MapInfoId map_info) MapInfo cur_map = (MapInfo) map_info; if (cur_map && cur_map->texts) { - return RadarListSize(cur_map->texts); + return ZnListSize(cur_map->texts); } else { return 0; @@ -738,7 +738,7 @@ MapInfoNumTexts(MapInfoId map_info) void MapInfoAddArc(MapInfoId map_info, unsigned int index, - RadarPtr tag, + ZnPtr tag, MapInfoLineStyle line_style, int line_width, int center_x, @@ -752,7 +752,7 @@ MapInfoAddArc(MapInfoId map_info, if (cur_map) { if (!cur_map->arcs) { - cur_map->arcs = RadarListNew(16, sizeof(MapInfoArcStruct)); + cur_map->arcs = ZnListNew(16, sizeof(MapInfoArcStruct)); } arc_struct.style = NOT_MARKED_STYLE(line_style); @@ -769,7 +769,7 @@ MapInfoAddArc(MapInfoId map_info, arc_struct.start_angle = start_angle; arc_struct.extend = extend; - RadarListAdd(cur_map->arcs, &arc_struct, index); + ZnListAdd(cur_map->arcs, &arc_struct, index); } } @@ -777,7 +777,7 @@ MapInfoAddArc(MapInfoId map_info, void MapInfoReplaceArc(MapInfoId map_info, unsigned int index, - RadarPtr tag, + ZnPtr tag, MapInfoLineStyle line_style, int line_width, int center_x, @@ -790,7 +790,7 @@ MapInfoReplaceArc(MapInfoId map_info, MapInfoArc arc_ptr; if (cur_map && cur_map->arcs) { - arc_ptr = (MapInfoArc) RadarListAt(cur_map->arcs, index); + arc_ptr = (MapInfoArc) ZnListAt(cur_map->arcs, index); if (arc_ptr) { arc_ptr->style = NOT_MARKED_STYLE(line_style); if (line_width == 1) { @@ -818,9 +818,9 @@ MapInfoRemoveArc(MapInfoId map_info, MapInfoArc arc_ptr; if (cur_map && cur_map->arcs) { - arc_ptr = (MapInfoArc) RadarListAt(cur_map->arcs, index); + arc_ptr = (MapInfoArc) ZnListAt(cur_map->arcs, index); if (arc_ptr) { - RadarListDelete(cur_map->arcs, index); + ZnListDelete(cur_map->arcs, index); } } } @@ -829,7 +829,7 @@ MapInfoRemoveArc(MapInfoId map_info, void MapInfoGetArc(MapInfoId map_info, unsigned int index, - RadarPtr *tag, + ZnPtr *tag, MapInfoLineStyle *line_style, int *line_width, int *center_x, @@ -842,7 +842,7 @@ MapInfoGetArc(MapInfoId map_info, MapInfoArc arc_ptr; if (cur_map && cur_map->arcs) { - arc_ptr = (MapInfoArc) RadarListAt(cur_map->arcs, index); + arc_ptr = (MapInfoArc) ZnListAt(cur_map->arcs, index); if (arc_ptr) { if (tag) { *tag = arc_ptr->tag; @@ -883,7 +883,7 @@ MapInfoNumArcs(MapInfoId map_info) MapInfo cur_map = (MapInfo) map_info; if (cur_map && cur_map->arcs) { - return RadarListSize(cur_map->arcs); + return ZnListSize(cur_map->arcs); } else { return 0; @@ -902,8 +902,8 @@ MapInfoScale(MapInfoId map_info, MapInfoArc arc_ptr; if (mp && mp->lines) { - num = RadarListSize(mp->lines); - line_ptr = (MapInfoLine) RadarListArray(mp->lines); + num = ZnListSize(mp->lines); + line_ptr = (MapInfoLine) ZnListArray(mp->lines); for (i = 0; i < num; i++, line_ptr++) { line_ptr->from.x *= factor; line_ptr->from.y *= factor; @@ -912,24 +912,24 @@ MapInfoScale(MapInfoId map_info, } } if (mp && mp->symbols) { - num = RadarListSize(mp->symbols); - sym_ptr = (MapInfoSymbol) RadarListArray(mp->symbols); + num = ZnListSize(mp->symbols); + sym_ptr = (MapInfoSymbol) ZnListArray(mp->symbols); for (i = 0; i < num; i++, sym_ptr++) { sym_ptr->at.x *= factor; sym_ptr->at.y *= factor; } } if (mp && mp->texts) { - num = RadarListSize(mp->texts); - text_ptr = (MapInfoText) RadarListArray(mp->texts); + num = ZnListSize(mp->texts); + text_ptr = (MapInfoText) ZnListArray(mp->texts); for (i = 0; i < num; i++, text_ptr++) { text_ptr->at.x *= factor; text_ptr->at.y *= factor; } } if (mp && mp->arcs) { - num = RadarListSize(mp->arcs); - arc_ptr = (MapInfoArc) RadarListArray(mp->arcs); + num = ZnListSize(mp->arcs); + arc_ptr = (MapInfoArc) ZnListArray(mp->arcs); for (i = 0; i < num; i++, arc_ptr++) { arc_ptr->center.x *= factor; arc_ptr->center.y *= factor; @@ -951,8 +951,8 @@ MapInfoTranslate(MapInfoId map_info, MapInfoArc arc_ptr; if (mp && mp->lines) { - num = RadarListSize(mp->lines); - line_ptr = (MapInfoLine) RadarListArray(mp->lines); + num = ZnListSize(mp->lines); + line_ptr = (MapInfoLine) ZnListArray(mp->lines); for (i = 0; i < num; i++, line_ptr++) { line_ptr->from.x += x; line_ptr->from.y += y; @@ -961,24 +961,24 @@ MapInfoTranslate(MapInfoId map_info, } } if (mp && mp->symbols) { - num = RadarListSize(mp->symbols); - sym_ptr = (MapInfoSymbol) RadarListArray(mp->symbols); + num = ZnListSize(mp->symbols); + sym_ptr = (MapInfoSymbol) ZnListArray(mp->symbols); for (i = 0; i < num; i++, sym_ptr++) { sym_ptr->at.x += x; sym_ptr->at.y += y; } } if (mp && mp->texts) { - num = RadarListSize(mp->texts); - text_ptr = (MapInfoText) RadarListArray(mp->texts); + num = ZnListSize(mp->texts); + text_ptr = (MapInfoText) ZnListArray(mp->texts); for (i = 0; i < num; i++, text_ptr++) { text_ptr->at.x += x; text_ptr->at.y += y; } } if (mp && mp->arcs) { - num = RadarListSize(mp->arcs); - arc_ptr = (MapInfoArc) RadarListArray(mp->arcs); + num = ZnListSize(mp->arcs); + arc_ptr = (MapInfoArc) ZnListArray(mp->arcs); for (i = 0; i < num; i++, arc_ptr++) { arc_ptr->center.x += x; arc_ptr->center.y += y; @@ -1052,13 +1052,13 @@ ReorderVidomap(VideoMap *vm) static void FillMap(MapInfoId map, VideoMap *vm) { unsigned int i; - RadarBool has_start_pos = False; + ZnBool has_start_pos = False; int x_cur=0, y_cur=0; char ch; int text_x=0, text_y=0; char text[TEXT_SIZE]; - RadarBool in_text = False; - RadarBool in_mod_text = False; + ZnBool in_text = False; + ZnBool in_mod_text = False; unsigned int text_size=0; for (i = 0; i < vm->num_elements; i++) { @@ -1091,7 +1091,7 @@ static void FillMap(MapInfoId map, VideoMap *vm) case 't': case 'T': if (!has_start_pos) { - RadarWarning("Bloc carte incorrect, il est elimine"); + ZnWarning("Bloc carte incorrect, il est elimine"); return; } @@ -1122,7 +1122,7 @@ static void FillMap(MapInfoId map, VideoMap *vm) case 'v': case 'V': if (!has_start_pos) { - RadarWarning("Bloc carte incorrect, il est elimine"); + ZnWarning("Bloc carte incorrect, il est elimine"); return; } @@ -1195,7 +1195,7 @@ MapInfoGetVideomap(MapInfoId map, /* Open the specified map file. */ file = fopen(filename, "r"); if (file == NULL) { - return RADAR_ERROR; + return ZN_ERROR; } /* Load the map */ @@ -1227,11 +1227,11 @@ MapInfoGetVideomap(MapInfoId map, while ((cur_id == ntohi(current_vm.id)) && !feof(file)); fclose(file); - return RADAR_OK; + return ZN_OK; error: fclose(file); - return RADAR_ERROR; + return ZN_ERROR; } /* @@ -1245,13 +1245,13 @@ error: *----------------------------------------------------------------------- */ -RadarList +ZnList MapInfoVideomapIds(char *filename) { FILE *file; VideoMap current_vm; int cur_id; - RadarList ids; + ZnList ids; /* Open the specified map file. */ file = fopen(filename, "r"); @@ -1263,9 +1263,9 @@ MapInfoVideomapIds(char *filename) goto error; } cur_id = ntohi(current_vm.id); - ids = RadarListNew(16, sizeof(int)); + ids = ZnListNew(16, sizeof(int)); /*printf("id %d\n", cur_id);*/ - RadarListAdd(ids, &cur_id, RadarListTail); + ZnListAdd(ids, &cur_id, ZnListTail); do { if (fread(¤t_vm, sizeof(VideoMap), 1, file) < 0) { @@ -1274,7 +1274,7 @@ MapInfoVideomapIds(char *filename) if (cur_id != ntohi(current_vm.id)) { cur_id = ntohi(current_vm.id); /*printf("id %d\n", cur_id);*/ - RadarListAdd(ids, &cur_id, RadarListTail); + ZnListAdd(ids, &cur_id, ZnListTail); } } while (!feof(file)); @@ -1284,6 +1284,6 @@ MapInfoVideomapIds(char *filename) error: fclose(file); - RadarListFree(ids); + ZnListFree(ids); return NULL; } diff --git a/generic/MapInfo.h b/generic/MapInfo.h index 1c14bea..c8b7fb3 100644 --- a/generic/MapInfo.h +++ b/generic/MapInfo.h @@ -78,19 +78,19 @@ MapInfoEmpty(MapInfoId /* map_info */); void MapInfoDelete(MapInfoId /* map_info */); void -MapInfoAddLine(MapInfoId /* map_info */, - unsigned int /* index */, - RadarPtr /* tag */, - MapInfoLineStyle /* line_style */, - int /* line_width */, - int /* x_from */, - int /* y_from */, - int /* x_to */, - int /* y_to */); +MapInfoAddLine(MapInfoId /* map_info */, + unsigned int /* index */, + ZnPtr /* tag */, + MapInfoLineStyle /* line_style */, + int /* line_width */, + int /* x_from */, + int /* y_from */, + int /* x_to */, + int /* y_to */); void MapInfoReplaceLine(MapInfoId /* map_info */, unsigned int /* index */, - RadarPtr /* tag */, + ZnPtr /* tag */, MapInfoLineStyle /* line_style */, int /* line_width */, int /* x_from */, @@ -101,15 +101,15 @@ void MapInfoRemoveLine(MapInfoId /* map_info */, unsigned int /* index */); void -MapInfoGetLine(MapInfoId /* map_info */, - unsigned int /* index */, - RadarPtr */* tag */, - MapInfoLineStyle */* line_style */, - int */* line_width */, - int */* x_from */, - int */* y_from */, - int */* x_to */, - int */* y_to */); +MapInfoGetLine(MapInfoId /* map_info */, + unsigned int /* index */, + ZnPtr */* tag */, + MapInfoLineStyle */* line_style */, + int */* line_width */, + int */* x_from */, + int */* y_from */, + int */* x_to */, + int */* y_to */); void MapInfoGetMarks(MapInfoId /* map_info */, unsigned int /* index */, @@ -120,14 +120,14 @@ MapInfoNumLines(MapInfoId /* map_info */); void MapInfoAddSymbol(MapInfoId /* map_info */, unsigned int /* index */, - RadarPtr /* tag */, + ZnPtr /* tag */, int /* x */, int /* y */, char /* symbol */); void MapInfoReplaceSymbol(MapInfoId /* map_info */, unsigned int /* index */, - RadarPtr /* tag */, + ZnPtr /* tag */, int /* x */, int /* y */, char /* symbol */); @@ -137,7 +137,7 @@ MapInfoRemoveSymbol(MapInfoId /* map_info */, void MapInfoGetSymbol(MapInfoId /* map_info */, unsigned int /* index */, - RadarPtr */* tag */, + ZnPtr */* tag */, int */* x */, int */* y */, char */* symbol */); @@ -146,7 +146,7 @@ MapInfoNumSymbols(MapInfoId /* map_info */); void MapInfoAddText(MapInfoId /* map_info */, unsigned int /* index */, - RadarPtr /* tag */, + ZnPtr /* tag */, MapInfoTextStyle /* text_style */, MapInfoLineStyle /* line_style */, int /* x */, @@ -155,7 +155,7 @@ MapInfoAddText(MapInfoId /* map_info */, void MapInfoReplaceText(MapInfoId /* map_info */, unsigned int /* index */, - RadarPtr /* tag */, + ZnPtr /* tag */, MapInfoTextStyle /* text_style */, MapInfoLineStyle /* line_style */, int /* x */, @@ -167,7 +167,7 @@ MapInfoRemoveText(MapInfoId /* map_info */, void MapInfoGetText(MapInfoId /* map_info */, unsigned int /* index */, - RadarPtr */* tag */, + ZnPtr */* tag */, MapInfoTextStyle */* text_style */, MapInfoLineStyle */* line_style */, int */* x */, @@ -178,7 +178,7 @@ MapInfoNumTexts(MapInfoId /* map_info */); void MapInfoAddArc(MapInfoId /* map_info */, unsigned int /* index */, - RadarPtr /* tag */, + ZnPtr /* tag */, MapInfoLineStyle /* line_style */, int /* line_width */, int /* center_x */, @@ -189,7 +189,7 @@ MapInfoAddArc(MapInfoId /* map_info */, void MapInfoReplaceArc(MapInfoId /* map_info */, unsigned int /* index */, - RadarPtr /* tag */, + ZnPtr /* tag */, MapInfoLineStyle /* line_style */, int /* line_width */, int /* center_x */, @@ -203,7 +203,7 @@ MapInfoRemoveArc(MapInfoId /* map_info */, void MapInfoGetArc(MapInfoId /* map_info */, unsigned int /* index */, - RadarPtr */* tag */, + ZnPtr */* tag */, MapInfoLineStyle */* line_style */, int */* line_width */, int */* center_x */, @@ -227,7 +227,7 @@ MapInfoGetVideomap(MapInfoId /* map_info */, char */* filename */, int /* map_index */); -RadarList +ZnList MapInfoVideomapIds(char */* filename */); #ifdef __CPLUSPLUS__ diff --git a/generic/OverlapMan.c b/generic/OverlapMan.c index 97b0648..e986efa 100644 --- a/generic/OverlapMan.c +++ b/generic/OverlapMan.c @@ -85,14 +85,14 @@ typedef struct _INFOS { BOOLEAN Refresh; } INFOS; -typedef struct _RADARS { +typedef struct _ZINCS { void *rw; void *(*_next_track)(); void (*_set_label_angle)(); INFOS *infos; int NBinfos; int NBalloc_infos; -} RADARS; +} ZINCS; /* @@ -100,10 +100,10 @@ typedef struct _RADARS { * */ -static RADARS *wr = NULL; +static ZINCS *wr = NULL; -static int NBradars=0; -static int NBalloc_radars=0; +static int NBzincs=0; +static int NBalloc_zincs=0; static INFOS info1; static double K0 = 2100.0; /* Repulsion factor */ @@ -169,7 +169,7 @@ Mrealloc(void *p, **************************************************************************** * * FindPosW -- - * Find the radar position in the database, + * Find the zinc position in the database, * if not found, gets the positon to insert in. * **************************************************************************** @@ -179,7 +179,7 @@ FindPosW(void *w, int *mid) { int left=0; - int right=NBradars-1; + int right=NBzincs-1; if (w < wr[0].rw) { *mid = 0; @@ -218,7 +218,7 @@ FindPosW(void *w, **************************************************************************** * * AllocW -- - * Allocate cells in database for the specified radar. + * Allocate cells in database for the specified zinc. * **************************************************************************** */ @@ -228,17 +228,17 @@ AllocW(void *w, { int i; - if (NBradars == NBalloc_radars) { - NBalloc_radars += NB_ALLOC; - wr = (RADARS *) Mrealloc((void *) wr, sizeof(RADARS) * NBalloc_radars); + if (NBzincs == NBalloc_zincs) { + NBalloc_zincs += NB_ALLOC; + wr = (ZINCS *) Mrealloc((void *) wr, sizeof(ZINCS) * NBalloc_zincs); } - for (i = NBradars-1; i >= pos; i--) { - memcpy((char *) &wr[i+1], (char *) &wr[i], sizeof(RADARS)); + for (i = NBzincs-1; i >= pos; i--) { + memcpy((char *) &wr[i+1], (char *) &wr[i], sizeof(ZINCS)); } - /*memcpy((char *)&wr[pos+1], (char *)&wr[pos], (NBradars-pos) * sizeof(RADARS) );*/ + /*memcpy((char *)&wr[pos+1], (char *)&wr[pos], (NBzincs-pos) * sizeof(ZINCS) );*/ - NBradars++; + NBzincs++; wr[pos].rw = w; wr[pos].infos = NULL; wr[pos].NBinfos = 0; @@ -319,7 +319,7 @@ DegreesToRadians(int x) **************************************************************************** * * OmRegister -- - * Create a database entry for the specified radar. + * Create a database entry for the specified zinc. * **************************************************************************** */ @@ -332,7 +332,7 @@ OmRegister(void *w, int iw=0; BOOLEAN found=FALSE; - if (NBradars > 0) { + if (NBzincs > 0) { found = FindPosW(w, &iw); } if (found == FALSE) { @@ -347,7 +347,7 @@ OmRegister(void *w, **************************************************************************** * * OmUnregister -- - * Cancel database information about the specified radar. + * Cancel database information about the specified zinc. * **************************************************************************** */ @@ -358,8 +358,8 @@ OmUnregister(void *w) if (FindPosW(w, &i) == TRUE) { free(wr[i].infos); - memcpy((char *) &wr[i], (char *) &wr[i+1], (NBradars-i-1)*sizeof(RADARS)); - NBradars--; + memcpy((char *) &wr[i], (char *) &wr[i+1], (NBzincs-i-1)*sizeof(ZINCS)); + NBzincs--; } } @@ -507,7 +507,7 @@ PutTrackLoaded(int iw) *************************************************************************** * * ReadTracks -- - * Get track labels information from radar. + * Get track labels information from zinc. * *************************************************************************** */ @@ -941,7 +941,7 @@ RefineSetup(int iw, *************************************************************************** */ void -OmProcessOverlap(void *radar, +OmProcessOverlap(void *zinc, int width, int height, double scale) @@ -949,7 +949,7 @@ OmProcessOverlap(void *radar, double acceleration = 0.0; int ip, iw; - if (NBradars != 0 && FindPosW(radar, &iw) == TRUE) { + if (NBzincs != 0 && FindPosW(zinc, &iw) == TRUE) { ReadTracks(iw); for (ip = 0; ip < wr[iw].NBinfos; ip++) { diff --git a/generic/OverlapMan.h b/generic/OverlapMan.h index fb844d9..52ae439 100644 --- a/generic/OverlapMan.h +++ b/generic/OverlapMan.h @@ -36,7 +36,7 @@ /* - * This is the interface with the radar widget. To substitute + * This is the interface with the zinc widget. To substitute * a different overlap manager, it is necessary to conform to * this API. */ @@ -56,7 +56,7 @@ OmRegister(void *w, void OmUnregister(void *w); void -OmProcessOverlap(void *radar, +OmProcessOverlap(void *zinc, int width, int height, double scale); diff --git a/generic/PostScript.c b/generic/PostScript.c index 3f2b7a7..025b156 100644 --- a/generic/PostScript.c +++ b/generic/PostScript.c @@ -56,7 +56,7 @@ ********************************************************************************** */ -static const char rcsid[] = "$Id$"; +static const char rcsid[] = "$Id$"; static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ " $"; @@ -92,7 +92,7 @@ static void EmitPostScript(WidgetInfo *wi, FILE *file, char *title, - RadarBool landscape, + ZnBool landscape, int color_mode, int x_world, int y_world, @@ -105,7 +105,7 @@ EmitPostScript(WidgetInfo *wi, { PostScriptInfo ps_info; /* double scale;*/ - RadarBBox damaged_area, bbox; + ZnBBox damaged_area, bbox; Item current_item; struct passwd *pwd_info; time_t now; @@ -113,7 +113,7 @@ EmitPostScript(WidgetInfo *wi, XFontStruct *fs; int i; - ps_info = (PostScriptInfo) RadarMalloc(sizeof(PostScriptStruct)); + ps_info = (PostScriptInfo) ZnMalloc(sizeof(PostScriptStruct)); ps_info->file = file; ps_info->title = title; ps_info->landscape = landscape; @@ -126,7 +126,7 @@ EmitPostScript(WidgetInfo *wi, ps_info->page_bbox.orig.y = bbox_oy; ps_info->page_bbox.corner.x = bbox_cx; ps_info->page_bbox.corner.y = bbox_cy; - ps_info->fonts = RadarListNew(8, sizeof(XFontStruct *)); + ps_info->fonts = ZnListNew(8, sizeof(XFontStruct *)); /* * Setup the new transform. @@ -135,13 +135,13 @@ EmitPostScript(WidgetInfo *wi, damaged_area = wi->damaged_area; wi->scale = ps_info->world_width / (ps_info->page_bbox.orig.x - ps_info->page_bbox.corner.x); - ITEM_P.InvalidateItems(wi, RadarAny);*/ + ITEM_P.InvalidateItems(wi, ZnAny);*/ /* * Emit Encapsulated PostScript Header. */ fprintf(ps_info->file, "%%!PS-Adobe-3.0 EPSF-3.0\n"); - fprintf(ps_info->file, "%%%%Creator: Radar Widget\n"); + fprintf(ps_info->file, "%%%%Creator: Zn Widget\n"); pwd_info = getpwuid(getuid()); fprintf(ps_info->file, "%%%%For: %s\n", pwd_info ? pwd_info->pw_gecos : "Unknown"); fprintf(ps_info->file, "%%%%Title: (%s)\n", ps_info->title); @@ -160,7 +160,7 @@ EmitPostScript(WidgetInfo *wi, fprintf(ps_info->file, "%%%%LanguageLevel: 1\n"); fprintf(ps_info->file, "%%%%DocumentNeededResources: (atend)\n"); fprintf(ps_info->file, - "%%%%DocumentSuppliedResources: procset Radar-Widget-Prolog %f %d\n", + "%%%%DocumentSuppliedResources: procset Zinc-Widget-Prolog %f %d\n", PROLOG_VERSION, PROLOG_REVISION); fprintf(ps_info->file, "%%%%EndComments\n\n\n"); @@ -168,7 +168,7 @@ EmitPostScript(WidgetInfo *wi, * Emit the prolog. */ fprintf(ps_info->file, "%%%%BeginProlog\n"); - fprintf(ps_info->file, "%%%%BeginResource: procset Radar-Widget-Prolog %f %d\n", + fprintf(ps_info->file, "%%%%BeginResource: procset Zinc-Widget-Prolog %f %d\n", PROLOG_VERSION, PROLOG_REVISION); fwrite(ps_prolog, 1, sizeof(ps_prolog), ps_info->file); fprintf(ps_info->file, "%%%%EndResource\n"); @@ -191,7 +191,7 @@ EmitPostScript(WidgetInfo *wi, * Iterate through all items emitting PostScript for each. */ current_item = ((GroupItem) wi->top_group)->tail; - while (current_item != RADAR_NO_ITEM) { + while (current_item != ZN_NO_ITEM) { if (ISSET(current_item->flags, VISIBLE_BIT)) { IntersectBBox(&ps_info->page_bbox, ¤t_item->item_bounding_box, &bbox); if (!IsEmptyBBox(&bbox)) { @@ -211,8 +211,8 @@ EmitPostScript(WidgetInfo *wi, */ fprintf(ps_info->file, "%%%%Trailer\n"); s = "%%DocumentNeededResources: font "; - for (fs = (XFontStruct *) RadarListArray(ps_info->fonts), - i = RadarListSize(ps_info->fonts); i > 0; i--, fs++) { + for (fs = (XFontStruct *) ZnListArray(ps_info->fonts), + i = ZnListSize(ps_info->fonts); i > 0; i--, fs++) { fprintf(ps_info->file, "%s", s); s = "%%+ font"; } @@ -222,12 +222,12 @@ EmitPostScript(WidgetInfo *wi, * Restore the original transform. */ /*wi->scale = scale; - ITEM_P.InvalidateItems(wi, RadarAny);*/ + ITEM_P.InvalidateItems(wi, ZnAny);*/ wi->damaged_area = damaged_area; - RadarListFree(ps_info->fonts); - RadarFree(ps_info); + ZnListFree(ps_info->fonts); + ZnFree(ps_info); } diff --git a/generic/PostScript.h b/generic/PostScript.h index e92514b..a7cd084 100644 --- a/generic/PostScript.h +++ b/generic/PostScript.h @@ -44,14 +44,14 @@ typedef struct _PostScriptStruct { FILE *file; char *title; - RadarBool landscape; + ZnBool landscape; int color_mode; int x_world; int y_world; int world_width; int world_height; - RadarBBox page_bbox; - RadarList fonts; + ZnBBox page_bbox; + ZnList fonts; } PostScriptStruct, *PostScriptInfo; @@ -68,7 +68,7 @@ struct _WidgetInfo; extern struct _POSTSCRIPT_P { void (*EmitPostScript)(struct _WidgetInfo *wi, FILE *file, char *title, - RadarBool landscape, int color_mode, + ZnBool landscape, int color_mode, int x_world, int y_world, int world_width, int world_height, int bbox_ox, int bbox_oy, int bbox_cx, int bbox_cy); diff --git a/generic/Rectangle.c b/generic/Rectangle.c index f573f3f..f9a53f3 100644 --- a/generic/Rectangle.c +++ b/generic/Rectangle.c @@ -59,65 +59,65 @@ typedef struct _RectangleItemStruct { ItemStruct header; /* Public data */ - RadarPoint coords[2]; + ZnPoint coords[2]; unsigned char flags; ReliefStyle relief; LineStyle line_style; int line_width; - RadarColor line_color; + ZnColor line_color; Pixmap fill_pattern; Pixmap line_pattern; - RadarColor fill_color; + ZnColor fill_color; char *tile_name; /* Private data */ - RadarPoint dev[4]; - RadarImage tile; - RadarColorGradient gradient; + ZnPoint dev[4]; + ZnImage tile; + ZnColorGradient gradient; } RectangleItemStruct, *RectangleItem; -static RadarAttrConfig rect_attrs[] = { - { RADAR_CONFIG_BOOL, "-composerotation", NULL, +static ZnAttrConfig rect_attrs[] = { + { ZN_CONFIG_BOOL, "-composerotation", NULL, Tk_Offset(RectangleItemStruct, 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(RectangleItemStruct, header.flags), COMPOSE_SCALE_BIT, - RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_COLOR, "-fillcolor", NULL, + ZN_COORDS_FLAG, False }, + { ZN_CONFIG_COLOR, "-fillcolor", NULL, Tk_Offset(RectangleItemStruct, fill_color), 0, - RADAR_DRAW_FLAG|RADAR_BORDER_FLAG, False }, - { RADAR_CONFIG_BOOL, "-filled", NULL, - Tk_Offset(RectangleItemStruct, flags), FILLED_BIT, RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_PATTERN, "-fillpattern", NULL, - Tk_Offset(RectangleItemStruct, fill_pattern), 0, RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_COLOR, "-linecolor", NULL, + ZN_DRAW_FLAG|ZN_BORDER_FLAG, False }, + { ZN_CONFIG_BOOL, "-filled", NULL, + Tk_Offset(RectangleItemStruct, flags), FILLED_BIT, ZN_COORDS_FLAG, False }, + { ZN_CONFIG_PATTERN, "-fillpattern", NULL, + Tk_Offset(RectangleItemStruct, fill_pattern), 0, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_COLOR, "-linecolor", NULL, Tk_Offset(RectangleItemStruct, line_color), 0, - RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_PATTERN, "-linepattern", NULL, - Tk_Offset(RectangleItemStruct, line_pattern), 0, RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_LINE_STYLE, "-linestyle", NULL, - Tk_Offset(RectangleItemStruct, line_style), 0, RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_DIM, "-linewidth", NULL, - Tk_Offset(RectangleItemStruct, line_width), 0, RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_PRI, "-priority", NULL, + ZN_DRAW_FLAG, False }, + { ZN_CONFIG_PATTERN, "-linepattern", NULL, + Tk_Offset(RectangleItemStruct, line_pattern), 0, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_LINE_STYLE, "-linestyle", NULL, + Tk_Offset(RectangleItemStruct, line_style), 0, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_DIM, "-linewidth", NULL, + Tk_Offset(RectangleItemStruct, line_width), 0, ZN_COORDS_FLAG, False }, + { ZN_CONFIG_PRI, "-priority", NULL, Tk_Offset(RectangleItemStruct, header.priority), 0, - RADAR_DRAW_FLAG|RADAR_REPICK_FLAG, False }, - { RADAR_CONFIG_RELIEF, "-relief", NULL, Tk_Offset(RectangleItemStruct, relief), 0, - RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_BOOL, "-sensitive", NULL, + ZN_DRAW_FLAG|ZN_REPICK_FLAG, False }, + { ZN_CONFIG_RELIEF, "-relief", NULL, Tk_Offset(RectangleItemStruct, relief), 0, + ZN_DRAW_FLAG, False }, + { ZN_CONFIG_BOOL, "-sensitive", NULL, Tk_Offset(RectangleItemStruct, header.flags), SENSITIVE_BIT, - RADAR_REPICK_FLAG, False }, - { RADAR_CONFIG_TAGS, "-tags", NULL, + ZN_REPICK_FLAG, False }, + { ZN_CONFIG_TAGS, "-tags", NULL, Tk_Offset(RectangleItemStruct, header.tags), 0, 0, False }, - { RADAR_CONFIG_IMAGE, "-tile", NULL, + { ZN_CONFIG_IMAGE, "-tile", NULL, Tk_Offset(RectangleItemStruct, 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(RectangleItemStruct, 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 } }; @@ -140,7 +140,7 @@ RectTileChange(ClientData client_data, RectangleItem rect = (RectangleItem) client_data; InvalidateImage(rect->tile); - ITEM.Invalidate((Item) rect, RADAR_COORDS_FLAG); + ITEM.Invalidate((Item) rect, ZN_COORDS_FLAG); } @@ -175,10 +175,10 @@ Init(Item item, if (*argc < 1) { Tcl_AppendResult(wi->interp, " rectangle 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)) { rect_error: #ifdef PTK if (elems != NULL && freeProc) { @@ -186,22 +186,22 @@ Init(Item item, } #endif Tcl_AppendResult(wi->interp, " malformed rectangle coords", NULL); - return RADAR_ERROR; + return ZN_ERROR; } - if (Tcl_GetDouble(wi->interp, elems[0], &rect->coords[0].x) == RADAR_ERROR) { + if (Tcl_GetDouble(wi->interp, elems[0], &rect->coords[0].x) == ZN_ERROR) { rect_error2: #ifndef PTK Tcl_Free((char *) elems); #endif goto rect_error; }; - if (Tcl_GetDouble(wi->interp, elems[1], &rect->coords[0].y) == RADAR_ERROR) { + if (Tcl_GetDouble(wi->interp, elems[1], &rect->coords[0].y) == ZN_ERROR) { goto rect_error2; }; - if (Tcl_GetDouble(wi->interp, elems[2], &rect->coords[1].x) == RADAR_ERROR) { + if (Tcl_GetDouble(wi->interp, elems[2], &rect->coords[1].x) == ZN_ERROR) { goto rect_error2; }; - if (Tcl_GetDouble(wi->interp, elems[3], &rect->coords[1].y) == RADAR_ERROR) { + if (Tcl_GetDouble(wi->interp, elems[3], &rect->coords[1].y) == ZN_ERROR) { goto rect_error2; }; (*args)++; @@ -218,14 +218,14 @@ Init(Item item, rect->relief = RELIEF_FLAT; rect->line_style = LINE_SIMPLE; rect->line_width = 1; - rect->line_pattern = RadarUnspecifiedPattern; + rect->line_pattern = ZnUnspecifiedPattern; rect->tile_name = ""; - rect->tile = RadarUnspecifiedImage; - rect->fill_pattern = RadarUnspecifiedPattern; - rect->line_color = RadarGetColorByValue(wi->win, wi->fore_color); - rect->fill_color = RadarGetColorByValue(wi->win, wi->fore_color); + rect->tile = ZnUnspecifiedImage; + rect->fill_pattern = ZnUnspecifiedPattern; + rect->line_color = ZnGetColorByValue(wi->win, wi->fore_color); + rect->fill_color = ZnGetColorByValue(wi->win, wi->fore_color); - return RADAR_OK; + return ZN_OK; } @@ -244,25 +244,25 @@ Clone(Item item) char *text; if (rect->gradient) { - rect->gradient = RadarGetColorGradientByValue(rect->gradient); + rect->gradient = ZnGetColorGradientByValue(rect->gradient); } if (strlen(rect->tile_name) != 0) { - text = RadarMalloc((strlen(rect->tile_name) + 1) * sizeof(char)); + text = ZnMalloc((strlen(rect->tile_name) + 1) * sizeof(char)); strcpy(text, rect->tile_name); rect->tile_name = text; rect->tile = Tk_GetImage(wi->interp, wi->win, rect->tile_name, RectTileChange, (ClientData) rect); } - if (rect->line_pattern != RadarUnspecifiedPattern) { + if (rect->line_pattern != ZnUnspecifiedPattern) { rect->line_pattern = Tk_GetBitmap(wi->interp, wi->win, Tk_NameOfBitmap(wi->dpy, rect->line_pattern)); } - if (rect->fill_pattern != RadarUnspecifiedPattern) { + if (rect->fill_pattern != ZnUnspecifiedPattern) { rect->fill_pattern = Tk_GetBitmap(wi->interp, wi->win, Tk_NameOfBitmap(wi->dpy, rect->fill_pattern)); } - rect->line_color = RadarGetColorByValue(wi->win, rect->line_color); - rect->fill_color = RadarGetColorByValue(wi->win, rect->fill_color); + rect->line_color = ZnGetColorByValue(wi->win, rect->line_color); + rect->fill_color = ZnGetColorByValue(wi->win, rect->fill_color); } @@ -280,23 +280,23 @@ Destroy(Item item) RectangleItem rect = (RectangleItem) item; if (strlen(rect->tile_name) != 0) { - RadarFree(rect->tile_name); + ZnFree(rect->tile_name); } - if (rect->tile != RadarUnspecifiedImage) { + if (rect->tile != ZnUnspecifiedImage) { Tk_FreeImage(rect->tile); - rect->tile = RadarUnspecifiedImage; + rect->tile = ZnUnspecifiedImage; } if (rect->gradient) { - RadarFreeColorGradient(rect->gradient); + ZnFreeColorGradient(rect->gradient); } - if (rect->line_pattern != RadarUnspecifiedPattern) { + if (rect->line_pattern != ZnUnspecifiedPattern) { Tk_FreeBitmap(wi->dpy, rect->line_pattern); } - if (rect->fill_pattern != RadarUnspecifiedPattern) { + if (rect->fill_pattern != ZnUnspecifiedPattern) { Tk_FreeBitmap(wi->dpy, rect->fill_pattern); } - RadarFreeColor(rect->fill_color); - RadarFreeColor(rect->line_color); + ZnFreeColor(rect->fill_color); + ZnFreeColor(rect->line_color); } @@ -310,26 +310,26 @@ Destroy(Item item) static int Configure(Item item, int argc, - RadarAttrList argv, + ZnAttrList argv, int *flags) { WidgetInfo *wi = item->wi; RectangleItem rect = (RectangleItem) 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 (rect->gradient && - (ISSET(*flags, RADAR_BORDER_FLAG) || (rect->relief == RELIEF_FLAT))) { - RadarFreeColorGradient(rect->gradient); + (ISSET(*flags, ZN_BORDER_FLAG) || (rect->relief == RELIEF_FLAT))) { + ZnFreeColorGradient(rect->gradient); rect->gradient = NULL; } if ((rect->relief != RELIEF_FLAT) && !rect->gradient) { - rect->gradient = RadarGetReliefGradient(wi->interp, wi->win, - RadarNameOfColor(rect->fill_color)); + rect->gradient = ZnGetReliefGradient(wi->interp, wi->win, + ZnNameOfColor(rect->fill_color)); } - if (ISSET(*flags, RADAR_TILE_FLAG)) { + if (ISSET(*flags, ZN_TILE_FLAG)) { Tk_Image tile; if (strcmp(rect->tile_name, "") != 0) { @@ -340,19 +340,19 @@ 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 (rect->tile != RadarUnspecifiedImage) { + if (rect->tile != ZnUnspecifiedImage) { Tk_FreeImage(rect->tile); } rect->tile = tile; } - return RADAR_OK; + return ZN_OK; } @@ -366,13 +366,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; } @@ -385,11 +385,11 @@ Query(Item item, */ static void ComputeCoordinates(Item item, - RadarBool force) + ZnBool force) { WidgetInfo *wi = item->wi; RectangleItem rect = (RectangleItem) item; - RadarPoint p[4]; + ZnPoint p[4]; ResetBBox(&item->item_bounding_box); if (!rect->line_width && ISCLEAR(rect->flags, FILLED_BIT)) { @@ -402,7 +402,7 @@ ComputeCoordinates(Item item, p[1].y = p[0].y; p[3].x = p[0].x; p[3].y = p[2].y; - RadarTransformPoints(wi->current_transfo, p, rect->dev, 4); + ZnTransformPoints(wi->current_transfo, p, rect->dev, 4); /* * Add all points to the bounding box. Then expand by the line @@ -428,11 +428,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) { RectangleItem rect = (RectangleItem) item; int result; @@ -444,7 +444,7 @@ ToArea(Item item, } else if (rect->line_width > 0) { int i; - RadarPoint pts[5]; + ZnPoint pts[5]; for (i = 0; i < 4; i++) { pts[i] = rect->dev[i]; @@ -472,8 +472,8 @@ Draw(Item item) RectangleItem rect = (RectangleItem) item; XGCValues values; int i, gc_mask; - RadarBool aligned; - RadarDim delta; + ZnBool aligned; + ZnDim delta; XRectangle r; XPoint xp[5]; @@ -514,8 +514,8 @@ Draw(Item item) * Fill if requested. */ if (ISSET(rect->flags, FILLED_BIT)) { - values.foreground = RadarPixel(rect->fill_color); - if (rect->tile != RadarUnspecifiedImage) { /* Fill tiled */ + values.foreground = ZnPixel(rect->fill_color); + if (rect->tile != ZnUnspecifiedImage) { /* Fill tiled */ Pixmap pmap = GetImagePixmap(wi->win, rect->tile); values.fill_style = FillTiled; values.tile = pmap; @@ -524,7 +524,7 @@ Draw(Item item) XChangeGC(wi->dpy, wi->gc, GCTileStipXOrigin|GCTileStipYOrigin|GCFillStyle|GCTile, &values); } - else if (rect->fill_pattern != RadarUnspecifiedPattern) { /* Fill stippled */ + else if (rect->fill_pattern != ZnUnspecifiedPattern) { /* Fill stippled */ values.fill_style = FillStippled; values.stipple = rect->fill_pattern; values.ts_x_origin = (int) item->item_bounding_box.orig.x; @@ -554,7 +554,7 @@ Draw(Item item) &r, rect->line_width); } else { - RadarPoint p[5]; + 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; @@ -567,14 +567,14 @@ Draw(Item item) else { SetLineStyle(wi->dpy, wi->gc, rect->line_style); gc_mask = GCFillStyle|GCLineWidth|GCForeground|GCJoinStyle; - values.foreground = RadarPixel(rect->line_color); + values.foreground = ZnPixel(rect->line_color); values.line_width = (rect->line_width == 1) ? 0 : rect->line_width; values.join_style = JoinMiter; if (!aligned) { gc_mask |= GCCapStyle; values.cap_style = CapProjecting; } - if (rect->line_pattern == RadarUnspecifiedPattern) { + if (rect->line_pattern == ZnUnspecifiedPattern) { values.fill_style = FillSolid; XChangeGC(wi->dpy, wi->gc, gc_mask, &values); } @@ -603,12 +603,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)); } @@ -621,7 +621,7 @@ IsSensitive(Item item, */ static double Pick(Item item, - RadarPoint *p, + ZnPoint *p, Item start_item, int aperture, Item *a_item, @@ -642,7 +642,7 @@ Pick(Item item, if (rect->line_width > 1) { double dist; int i; - RadarPoint pts[5]; + ZnPoint pts[5]; for (i = 0; i < 4; i++) { pts[i] = rect->dev[i]; @@ -682,14 +682,14 @@ PostScript(Item item, * ********************************************************************************** */ -static RadarBool -GetClipVertices(Item item, - RadarPoint **points, - int *num_points) +static ZnBool +GetClipVertices(Item item, + ZnPoint **points, + int *num_points) { RectangleItem rect = (RectangleItem) item; double delta; - RadarBool aligned; + ZnBool aligned; delta = rect->dev[0].y - rect->dev[1].y; delta = ABS(delta); @@ -699,8 +699,8 @@ GetClipVertices(Item item, aligned |= delta < PRECISION_LIMIT; if (aligned) { - RadarListAssertSize(item->wi->work_pts, 2); - *points = (RadarPoint *) RadarListArray(item->wi->work_pts); + ZnListAssertSize(item->wi->work_pts, 2); + *points = (ZnPoint *) ZnListArray(item->wi->work_pts); *num_points = 2; if (rect->dev[0].x < rect->dev[2].x) { @@ -738,34 +738,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) { RectangleItem rect = (RectangleItem) item; if ((cmd == COORDS_ADD) || (cmd == COORDS_ADD_LAST) || (cmd == COORDS_REMOVE)) { Tcl_AppendResult(item->wi->interp, " rectangles 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 rectangles", NULL); - return RADAR_ERROR; + return ZN_ERROR; } rect->coords[0] = (*pts)[0]; rect->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; @@ -774,10 +774,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; } rect->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; @@ -794,7 +794,7 @@ Coords(Item item, *pts = &rect->coords[index]; } - return RADAR_OK; + return ZN_OK; } @@ -829,4 +829,4 @@ static ItemClassStruct RECTANGLE_ITEM_CLASS = { PostScript }; -RadarItemClassId RadarRectangle = (RadarItemClassId) &RECTANGLE_ITEM_CLASS; +ZnItemClassId ZnRectangle = (ZnItemClassId) &RECTANGLE_ITEM_CLASS; 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; diff --git a/generic/Tabular.c b/generic/Tabular.c index 9f71c56..0385203 100644 --- a/generic/Tabular.c +++ b/generic/Tabular.c @@ -48,49 +48,49 @@ typedef struct _TabularItemStruct { ItemStruct header; /* Public data */ - RadarPoint pos; - RadarAnchor anchor; - RadarAnchor connection_anchor; + ZnPoint pos; + ZnAnchor anchor; + ZnAnchor connection_anchor; /* Private data */ FieldSetStruct field_set; } TabularItemStruct, *TabularItem; -static RadarAttrConfig tabular_attrs[] = { - { RADAR_CONFIG_ANCHOR, "-anchor", NULL, - Tk_Offset(TabularItemStruct, anchor), 0, RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_BOOL, "-composerotation", NULL, +static ZnAttrConfig tabular_attrs[] = { + { ZN_CONFIG_ANCHOR, "-anchor", NULL, + Tk_Offset(TabularItemStruct, anchor), 0, ZN_COORDS_FLAG, False }, + { ZN_CONFIG_BOOL, "-composerotation", NULL, Tk_Offset(TabularItemStruct, 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(TabularItemStruct, header.flags), COMPOSE_SCALE_BIT, - RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_ITEM, "-connecteditem", NULL, + ZN_COORDS_FLAG, False }, + { ZN_CONFIG_ITEM, "-connecteditem", NULL, Tk_Offset(TabularItemStruct, header.connected_item), 0, - RADAR_COORDS_FLAG|RADAR_ITEM_FLAG, False }, - { RADAR_CONFIG_ANCHOR, "-connectionanchor", NULL, - Tk_Offset(TabularItemStruct, connection_anchor), 0, RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_LABEL_FORMAT, "-labelformat", NULL, + ZN_COORDS_FLAG|ZN_ITEM_FLAG, False }, + { ZN_CONFIG_ANCHOR, "-connectionanchor", NULL, + Tk_Offset(TabularItemStruct, connection_anchor), 0, ZN_COORDS_FLAG, False }, + { ZN_CONFIG_LABEL_FORMAT, "-labelformat", NULL, Tk_Offset(TabularItemStruct, field_set.label_format), 0, - RADAR_COORDS_FLAG|RADAR_CLFC_FLAG, False }, - { RADAR_CONFIG_UINT, "-numfields", NULL, + ZN_COORDS_FLAG|ZN_CLFC_FLAG, False }, + { ZN_CONFIG_UINT, "-numfields", NULL, Tk_Offset(TabularItemStruct, field_set.num_fields), 0, 0, True }, - { RADAR_CONFIG_POINT, "-position", NULL, - Tk_Offset(TabularItemStruct, pos), 0, RADAR_COORDS_FLAG, False}, - { RADAR_CONFIG_PRI, "-priority", NULL, + { ZN_CONFIG_POINT, "-position", NULL, + Tk_Offset(TabularItemStruct, pos), 0, ZN_COORDS_FLAG, False}, + { ZN_CONFIG_PRI, "-priority", NULL, Tk_Offset(TabularItemStruct, 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(TabularItemStruct, header.flags), SENSITIVE_BIT, - RADAR_REPICK_FLAG, False }, - { RADAR_CONFIG_TAGS, "-tags", NULL, + ZN_REPICK_FLAG, False }, + { ZN_CONFIG_TAGS, "-tags", NULL, Tk_Offset(TabularItemStruct, header.tags), 0, 0, False }, - { RADAR_CONFIG_BOOL, "-visible", NULL, + { ZN_CONFIG_BOOL, "-visible", NULL, Tk_Offset(TabularItemStruct, 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 } }; @@ -117,8 +117,8 @@ Init(Item item, SET(item->flags, COMPOSE_SCALE_BIT); SET(item->flags, COMPOSE_ROTATION_BIT); - tab->anchor = RadarAnchorNW; - tab->connection_anchor = RadarAnchorSW; + tab->anchor = ZnAnchorNW; + tab->connection_anchor = ZnAnchorSW; tab->pos.x = tab->pos.y = 0.0; field_set->wi = wi; @@ -128,19 +128,19 @@ Init(Item item, * Then try to see if some fields are needed. */ if ((*argc > 0) && (LangString((*args)[0])[0] != '-') && - (Tcl_GetInt(wi->interp, (args[0])[0], &field_set->num_fields) != RADAR_ERROR)) { + (Tcl_GetInt(wi->interp, (args[0])[0], &field_set->num_fields) != ZN_ERROR)) { *args += 1; *argc -= 1; ITEM_P.InitFields(field_set); } else { Tcl_AppendResult(wi->interp, " number of fields expected", NULL); - return RADAR_ERROR; + return ZN_ERROR; } item->part_sensitive = 0; - return RADAR_OK; + return ZN_OK; } @@ -182,21 +182,21 @@ Destroy(Item item) static int Configure(Item item, int argc, - RadarAttrList argv, + ZnAttrList argv, int *flags) { - Item old_connected; + Item old_connected; old_connected = item->connected_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_ITEM_FLAG)) { + if (ISSET(*flags, ZN_ITEM_FLAG)) { /* * If the new connected item is not appropriate back up * to the old one. */ - if ((item->connected_item == RADAR_NO_ITEM) || + if ((item->connected_item == ZN_NO_ITEM) || (item->connected_item->class->has_anchors && (item->parent == item->connected_item->parent))) { ITEM.UpdateItemDependency(item, old_connected); @@ -206,7 +206,7 @@ Configure(Item item, } } - return RADAR_OK; + return ZN_OK; } @@ -220,13 +220,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; } @@ -239,12 +239,12 @@ Query(Item item, */ static void ComputeCoordinates(Item item, - RadarBool force) + ZnBool force) { TabularItem tab = (TabularItem) item; WidgetInfo *wi = item->wi; FieldSet field_set = &tab->field_set; - RadarDim width, height; + ZnDim width, height; ResetBBox(&item->item_bounding_box); if (field_set->label_format) { @@ -254,13 +254,13 @@ ComputeCoordinates(Item item, * The connected item support anchors, this is checked by * configure. */ - if (item->connected_item != RADAR_NO_ITEM) { + if (item->connected_item != ZN_NO_ITEM) { item->connected_item->class->GetAnchor(item->connected_item, tab->connection_anchor, &field_set->label_pos); } else { - RadarTransformPoint(wi->current_transfo, &tab->pos, + ZnTransformPoint(wi->current_transfo, &tab->pos, &field_set->label_pos); } @@ -292,11 +292,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 ITEM_P.FieldsToArea(&((TabularItem) item)->field_set, area); } @@ -323,12 +323,12 @@ Draw(Item item) * ********************************************************************************** */ -static RadarBool +static ZnBool IsSensitive(Item item, int item_part) { if (ISCLEAR(item->flags, SENSITIVE_BIT) || - !item->parent->class->IsSensitive(item->parent, RADAR_NO_PART)) { + !item->parent->class->IsSensitive(item->parent, ZN_NO_PART)) { return False; } return ITEM_P.IsFieldSensitive(&((TabularItem) item)->field_set, item_part); @@ -345,7 +345,7 @@ IsSensitive(Item item, */ static double Pick(Item item, - RadarPoint *p, + ZnPoint *p, Item start_item, int aperture, Item *a_item, @@ -400,11 +400,11 @@ GetFieldSet(Item item) */ static void GetAnchor(Item item, - RadarAnchor anchor, - RadarPoint *p) + ZnAnchor anchor, + ZnPoint *p) { FieldSet field_set = &((TabularItem) item)->field_set; - RadarDim width, height; + ZnDim width, height; if (field_set->label_format) { ITEM_P.GetLabelBBox(field_set, &width, &height); @@ -424,21 +424,21 @@ GetAnchor(Item item, * ********************************************************************************** */ -static RadarBool -GetClipVertices(Item item, - RadarPoint **points, - int *num_points) +static ZnBool +GetClipVertices(Item item, + ZnPoint **points, + int *num_points) { FieldSet field_set = &((TabularItem) item)->field_set; - RadarDim width, height; + ZnDim width, height; *points = NULL; *num_points = 0; if (field_set->label_format) { ITEM_P.GetLabelBBox(field_set, &width, &height); - RadarListAssertSize(item->wi->work_pts, 2); - *points = (RadarPoint *) RadarListArray(item->wi->work_pts); + ZnListAssertSize(item->wi->work_pts, 2); + *points = (ZnPoint *) ZnListArray(item->wi->work_pts); *num_points = 2; (*points)[0] = field_set->label_pos; (*points)[1].x = field_set->label_pos.x + width; @@ -460,33 +460,33 @@ 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) { TabularItem tabular = (TabularItem) item; if ((cmd == COORDS_ADD) || (cmd == COORDS_ADD_LAST) || (cmd == COORDS_REMOVE)) { Tcl_AppendResult(item->wi->interp, " tabulars 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 tabulars", NULL); - return RADAR_ERROR; + return ZN_ERROR; } tabular->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 = &tabular->pos; } - return RADAR_OK; + return ZN_OK; } @@ -521,4 +521,4 @@ static ItemClassStruct TABULAR_ITEM_CLASS = { PostScript }; -RadarItemClassId RadarTabular = (RadarItemClassId) &TABULAR_ITEM_CLASS; +ZnItemClassId ZnTabular = (ZnItemClassId) &TABULAR_ITEM_CLASS; diff --git a/generic/Text.c b/generic/Text.c index 6b0b4d0..b01348b 100644 --- a/generic/Text.c +++ b/generic/Text.c @@ -65,7 +65,7 @@ typedef struct _TextLineInfo { char *start; /* Index of first char in line */ int num_chars; /* Number of displayed chars in line */ - RadarPoint text_origin; /* X pos for drawing the line */ + ZnPoint text_origin; /* X pos for drawing the line */ int width; /* Line width in pixels */ } TextLineInfoStruct, *TextLineInfo; @@ -73,83 +73,83 @@ typedef struct _TextItemStruct { ItemStruct header; /* Public data */ - RadarPoint pos; - RadarAnchor anchor; - RadarAnchor connection_anchor; - RadarColor color; - RadarColor fill_color; + ZnPoint pos; + ZnAnchor anchor; + ZnAnchor connection_anchor; + ZnColor color; + ZnColor fill_color; char *text; Pixmap fill_pattern; - RadarFont font; - RadarJustify alignment; + ZnFont font; + ZnJustify alignment; int width; int spacing; unsigned char flags; /* Private data */ - RadarPoint pos_dev; + ZnPoint pos_dev; int insert_index; int sel_start; int sel_end; - RadarList text_info; + ZnList text_info; int max_width; } TextItemStruct, *TextItem; -static RadarAttrConfig text_attrs[] = { - { RADAR_CONFIG_JUSTIFY, "-alignment", NULL, +static ZnAttrConfig text_attrs[] = { + { ZN_CONFIG_JUSTIFY, "-alignment", NULL, Tk_Offset(TextItemStruct, alignment), 0, - RADAR_COORDS_FLAG|RADAR_LAYOUT_FLAG, False }, - { RADAR_CONFIG_ANCHOR, "-anchor", NULL, - Tk_Offset(TextItemStruct, anchor), 0, RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_COLOR, "-color", NULL, - Tk_Offset(TextItemStruct, color), 0, RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_BOOL, "-composerotation", NULL, + ZN_COORDS_FLAG|ZN_LAYOUT_FLAG, False }, + { ZN_CONFIG_ANCHOR, "-anchor", NULL, + Tk_Offset(TextItemStruct, anchor), 0, ZN_COORDS_FLAG, False }, + { ZN_CONFIG_COLOR, "-color", NULL, + Tk_Offset(TextItemStruct, color), 0, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_BOOL, "-composerotation", NULL, Tk_Offset(TextItemStruct, 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(TextItemStruct, header.flags), COMPOSE_SCALE_BIT, - RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_ITEM, "-connecteditem", NULL, + ZN_COORDS_FLAG, False }, + { ZN_CONFIG_ITEM, "-connecteditem", NULL, Tk_Offset(TextItemStruct, header.connected_item), 0, - RADAR_COORDS_FLAG|RADAR_ITEM_FLAG, False }, - { RADAR_CONFIG_ANCHOR, "-connectionanchor", NULL, - Tk_Offset(TextItemStruct, connection_anchor), 0, RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_COLOR, "-fillcolor", NULL, - Tk_Offset(TextItemStruct, fill_color), 0, RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_PATTERN, "-fillpattern", NULL, - Tk_Offset(TextItemStruct, fill_pattern), 0, RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_FONT, "-font", NULL, + ZN_COORDS_FLAG|ZN_ITEM_FLAG, False }, + { ZN_CONFIG_ANCHOR, "-connectionanchor", NULL, + Tk_Offset(TextItemStruct, connection_anchor), 0, ZN_COORDS_FLAG, False }, + { ZN_CONFIG_COLOR, "-fillcolor", NULL, + Tk_Offset(TextItemStruct, fill_color), 0, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_PATTERN, "-fillpattern", NULL, + Tk_Offset(TextItemStruct, fill_pattern), 0, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_FONT, "-font", NULL, Tk_Offset(TextItemStruct, font), 0, - RADAR_COORDS_FLAG|RADAR_LAYOUT_FLAG, False }, - { RADAR_CONFIG_BOOL, "-overstriked", NULL, - Tk_Offset(TextItemStruct, flags), OVERSTRIKED, RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_POINT, "-position", NULL, Tk_Offset(TextItemStruct, pos), 0, - RADAR_COORDS_FLAG, False}, - { RADAR_CONFIG_PRI, "-priority", NULL, + ZN_COORDS_FLAG|ZN_LAYOUT_FLAG, False }, + { ZN_CONFIG_BOOL, "-overstriked", NULL, + Tk_Offset(TextItemStruct, flags), OVERSTRIKED, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_POINT, "-position", NULL, Tk_Offset(TextItemStruct, pos), 0, + ZN_COORDS_FLAG, False}, + { ZN_CONFIG_PRI, "-priority", NULL, Tk_Offset(TextItemStruct, 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(TextItemStruct, header.flags), SENSITIVE_BIT, - RADAR_REPICK_FLAG, False }, - { RADAR_CONFIG_DIM, "-spacing", NULL, + ZN_REPICK_FLAG, False }, + { ZN_CONFIG_DIM, "-spacing", NULL, Tk_Offset(TextItemStruct, spacing), 0, - RADAR_COORDS_FLAG|RADAR_LAYOUT_FLAG, False }, - { RADAR_CONFIG_TAGS, "-tags", NULL, + ZN_COORDS_FLAG|ZN_LAYOUT_FLAG, False }, + { ZN_CONFIG_TAGS, "-tags", NULL, Tk_Offset(TextItemStruct, header.tags), 0, 0, False }, - { RADAR_CONFIG_TEXT, "-text", NULL, + { ZN_CONFIG_TEXT, "-text", NULL, Tk_Offset(TextItemStruct, text), 0, - RADAR_COORDS_FLAG|RADAR_LAYOUT_FLAG, False }, - { RADAR_CONFIG_BOOL, "-underlined", NULL, - Tk_Offset(TextItemStruct, flags), UNDERLINED, RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_BOOL, "-visible", NULL, + ZN_COORDS_FLAG|ZN_LAYOUT_FLAG, False }, + { ZN_CONFIG_BOOL, "-underlined", NULL, + Tk_Offset(TextItemStruct, flags), UNDERLINED, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_BOOL, "-visible", NULL, Tk_Offset(TextItemStruct, header.flags), VISIBLE_BIT, - RADAR_DRAW_FLAG|RADAR_REPICK_FLAG|RADAR_VIS_FLAG, False }, - { RADAR_CONFIG_INT, "-width", NULL, + ZN_DRAW_FLAG|ZN_REPICK_FLAG|ZN_VIS_FLAG, False }, + { ZN_CONFIG_INT, "-width", NULL, Tk_Offset(TextItemStruct, width), 0, - RADAR_COORDS_FLAG|RADAR_LAYOUT_FLAG, False }, + ZN_COORDS_FLAG|ZN_LAYOUT_FLAG, False }, - { RADAR_CONFIG_END, NULL, NULL, 0, 0, 0 } + { ZN_CONFIG_END, NULL, NULL, 0, 0, 0 } }; @@ -179,12 +179,12 @@ Init(Item item, text->pos.x = text->pos.y = 0.0; text->text = ""; - text->fill_pattern = RadarUnspecifiedPattern; - text->anchor = RadarAnchorNW; - text->connection_anchor = RadarAnchorSW; - text->color = RadarGetColorByValue(wi->win, wi->fore_color); - text->fill_color = RadarGetColorByValue(wi->win, wi->back_color); - text->alignment = RadarJustifyLeft; + text->fill_pattern = ZnUnspecifiedPattern; + text->anchor = ZnAnchorNW; + text->connection_anchor = ZnAnchorSW; + text->color = ZnGetColorByValue(wi->win, wi->fore_color); + text->fill_color = ZnGetColorByValue(wi->win, wi->back_color); + text->alignment = ZnJustifyLeft; text->font = Tk_GetFont(wi->interp, wi->win, Tk_NameOfFont(wi->font)); text->width = 0; text->spacing = 0; @@ -196,7 +196,7 @@ Init(Item item, CLEAR(text->flags, OVERSTRIKED); CLEAR(text->flags, HAS_FOCUS); - return RADAR_OK; + return ZN_OK; } @@ -215,27 +215,27 @@ Clone(Item item) char *str; if (strlen(text->text) != 0) { - str = RadarMalloc((strlen(text->text) + 1) * sizeof(char)); + str = ZnMalloc((strlen(text->text) + 1) * sizeof(char)); strcpy(str, text->text); text->text = str; } - if (text->fill_pattern != RadarUnspecifiedPattern) { + if (text->fill_pattern != ZnUnspecifiedPattern) { text->fill_pattern = Tk_GetBitmap(wi->interp, wi->win, Tk_NameOfBitmap(wi->dpy, text->fill_pattern)); } - text->color = RadarGetColorByValue(wi->win, text->color); - text->fill_color = RadarGetColorByValue(wi->win, text->fill_color); + text->color = ZnGetColorByValue(wi->win, text->color); + text->fill_color = ZnGetColorByValue(wi->win, text->fill_color); text->font = Tk_GetFont(wi->interp, wi->win, Tk_NameOfFont(text->font)); if (text->text_info) { - text->text_info = RadarListDuplicate(text->text_info); + text->text_info = ZnListDuplicate(text->text_info); } else { /* * Needed in case the layout of the model has not been * done yet. */ - SET(item->inv_flags, RADAR_LAYOUT_FLAG); + SET(item->inv_flags, ZN_LAYOUT_FLAG); } } @@ -254,18 +254,18 @@ Destroy(Item item) TextItem text = (TextItem) item; if (strlen(text->text) != 0) { - RadarFree(text->text); + ZnFree(text->text); } - if (text->fill_pattern != RadarUnspecifiedPattern) { + if (text->fill_pattern != ZnUnspecifiedPattern) { Tk_FreeBitmap(wi->dpy, text->fill_pattern); - text->fill_pattern = RadarUnspecifiedPattern; + text->fill_pattern = ZnUnspecifiedPattern; } - RadarFreeColor(text->color); - RadarFreeColor(text->fill_color); + ZnFreeColor(text->color); + ZnFreeColor(text->fill_color); Tk_FreeFont(text->font); if (text->text_info) { - RadarListFree(text->text_info); + ZnListFree(text->text_info); } } @@ -280,21 +280,21 @@ Destroy(Item item) static int Configure(Item item, int argc, - RadarAttrList argv, + ZnAttrList argv, int *flags) { - Item old_connected; + Item old_connected; old_connected = item->connected_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_ITEM_FLAG)) { + if (ISSET(*flags, ZN_ITEM_FLAG)) { /* * If the new connected item is not appropriate back up * to the old one. */ - if ((item->connected_item == RADAR_NO_ITEM) || + if ((item->connected_item == ZN_NO_ITEM) || (item->connected_item->class->has_anchors && (item->parent == item->connected_item->parent))) { ITEM.UpdateItemDependency(item, old_connected); @@ -304,7 +304,7 @@ Configure(Item item, } } - return RADAR_OK; + return ZN_OK; } @@ -318,13 +318,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; } @@ -337,7 +337,7 @@ Query(Item item, */ static void ComputeCoordinates(Item item, - RadarBool force) + ZnBool force) { WidgetInfo *wi = item->wi; TextItem text = (TextItem) item; @@ -359,19 +359,19 @@ ComputeCoordinates(Item item, * The layout need not be done each time the item is moved, scaled * or rotated. */ - if (ISSET(item->inv_flags, RADAR_LAYOUT_FLAG)) { + if (ISSET(item->inv_flags, ZN_LAYOUT_FLAG)) { char *scan; int wrap, line_index, prev_num_lines; /*printf("layout\n");*/ text->max_width = 0; if (text->text_info != NULL) { - prev_num_lines = RadarListSize(text->text_info); - RadarListEmpty(text->text_info); + prev_num_lines = ZnListSize(text->text_info); + ZnListEmpty(text->text_info); } else { prev_num_lines = 0; - text->text_info = RadarListNew(1, sizeof(TextLineInfoStruct)); + text->text_info = ZnListNew(1, sizeof(TextLineInfoStruct)); } if (text->width > 0) { @@ -416,7 +416,7 @@ ComputeCoordinates(Item item, * It is needed to enable selection and cursor * insertion to behave correctly. */ - RadarListAdd(text->text_info, &info, RadarListTail); + ZnListAdd(text->text_info, &info, ZnListTail); /*printf("adding a line : %s, num_chars : %d, width : %d\n", info.start, info.num_chars, info.width);*/ @@ -433,18 +433,18 @@ ComputeCoordinates(Item item, * in text natural units NOT transformed units. */ cur_dy = fm.ascent; - num_lines = RadarListSize(text->text_info); - infos = (TextLineInfo) RadarListArray(text->text_info); + num_lines = ZnListSize(text->text_info); + infos = (TextLineInfo) ZnListArray(text->text_info); for (i = 0; i < num_lines; i++) { switch (text->alignment) { - case RadarJustifyLeft: + case ZnJustifyLeft: infos[i].text_origin.x = 0; break; - case RadarJustifyCenter: + case ZnJustifyCenter: infos[i].text_origin.x = (text->max_width + 1 - infos[i].width)/2; break; - case RadarJustifyRight: + case ZnJustifyRight: infos[i].text_origin.x = text->max_width + 1 - infos[i].width; break; } @@ -455,20 +455,20 @@ ComputeCoordinates(Item item, } } /* ISSET(item->inv_flags, INV_TEXT_LAYOUT) */ - num_lines = RadarListSize(text->text_info); + num_lines = ZnListSize(text->text_info); height = num_lines * font_height + (num_lines-1) * text->spacing; /* * The connected item support anchors, this is checked by * configure. */ - if (item->connected_item != RADAR_NO_ITEM) { + if (item->connected_item != ZN_NO_ITEM) { item->connected_item->class->GetAnchor(item->connected_item, text->connection_anchor, &text->pos_dev); } else { - RadarTransformPoint(wi->current_transfo, &text->pos, &text->pos_dev); + ZnTransformPoint(wi->current_transfo, &text->pos, &text->pos_dev); } Anchor2Origin(&text->pos_dev, text->max_width, height, text->anchor, @@ -502,24 +502,24 @@ 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) { TextItem text = (TextItem) item; int inside = -1; - RadarBool first_done = False; + ZnBool first_done = False; int num_lines, i; TextLineInfo lines, lines_ptr; Tk_FontMetrics fm; int font_height; - RadarBBox line_bbox; - RadarPoint o; + ZnBBox line_bbox; + ZnPoint o; - lines = (TextLineInfo) RadarListArray(text->text_info); - num_lines = RadarListSize(text->text_info); + lines = (TextLineInfo) ZnListArray(text->text_info); + num_lines = ZnListSize(text->text_info); Tk_GetFontMetrics(text->font, &fm); font_height = fm.descent + fm.ascent; if (text->spacing > 0) { @@ -573,8 +573,8 @@ Draw(Item item) int sel_first_line = -1, sel_last_line = -1, cursor_line = -1; int sel_start_offset, sel_stop_offset, cursor_offset; - lines = (TextLineInfo) RadarListArray(text->text_info); - num_lines = RadarListSize(text->text_info); + lines = (TextLineInfo) ZnListArray(text->text_info); + num_lines = ZnListSize(text->text_info); Tk_GetFontMetrics(text->font, &fm); font_height = fm.ascent+fm.descent; @@ -631,7 +631,7 @@ Draw(Item item) if ((sel_first_line >= 0) && got_selection) { int x, y; - values.foreground = RadarPixel(text->fill_color); + values.foreground = ZnPixel(text->fill_color); values.fill_style = FillSolid; XChangeGC(wi->dpy, wi->gc, GCFillStyle | GCForeground, &values); @@ -663,10 +663,10 @@ Draw(Item item) /* * Setup the gc to render the text and draw it. */ - values.font = RadarFontId(text->font); - values.foreground = RadarPixel(text->color); + values.font = ZnFontId(text->font); + values.foreground = ZnPixel(text->color); gc_mask = GCFont | GCForeground; - if (text->fill_pattern != RadarUnspecifiedPattern) { + if (text->fill_pattern != ZnUnspecifiedPattern) { values.fill_style = FillStippled; values.stipple = text->fill_pattern; gc_mask |= GCFillStyle | GCStipple; @@ -735,12 +735,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)); } @@ -753,7 +753,7 @@ IsSensitive(Item item, */ static double Pick(Item item, - RadarPoint *p, + ZnPoint *p, Item start_item, int aperture, Item *a_item, @@ -765,11 +765,11 @@ Pick(Item item, TextLineInfo lines, lines_ptr; Tk_FontMetrics fm; int font_height; - RadarBBox line_bbox; - RadarPoint o; + ZnBBox line_bbox; + ZnPoint o; - lines = (TextLineInfo) RadarListArray(text->text_info); - num_lines = RadarListSize(text->text_info); + lines = (TextLineInfo) ZnListArray(text->text_info); + num_lines = ZnListSize(text->text_info); dist = 1.0e40; Tk_GetFontMetrics(text->font, &fm); font_height = fm.descent + fm.ascent; @@ -818,8 +818,8 @@ PostScript(Item item, */ static void GetAnchor(Item item, - RadarAnchor anchor, - RadarPoint *p) + ZnAnchor anchor, + ZnPoint *p) { TextItem text = (TextItem) item; @@ -843,13 +843,13 @@ GetAnchor(Item item, * ********************************************************************************** */ -static RadarBool -GetClipVertices(Item item, - RadarPoint **points, - int *num_points) +static ZnBool +GetClipVertices(Item item, + ZnPoint **points, + int *num_points) { - RadarListAssertSize(item->wi->work_pts, 2); - *points = (RadarPoint *) RadarListArray(item->wi->work_pts); + ZnListAssertSize(item->wi->work_pts, 2); + *points = (ZnPoint *) ZnListArray(item->wi->work_pts); *num_points = 2; (*points)[0] = item->item_bounding_box.orig; (*points)[1] = item->item_bounding_box.corner; @@ -869,33 +869,33 @@ 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) { TextItem text = (TextItem) item; if ((cmd == COORDS_ADD) || (cmd == COORDS_ADD_LAST) || (cmd == COORDS_REMOVE)) { Tcl_AppendResult(item->wi->interp, " texts 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 texts", NULL); - return RADAR_ERROR; + return ZN_ERROR; } text->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 = &text->pos; } - return RADAR_OK; + return ZN_OK; } @@ -930,4 +930,4 @@ static ItemClassStruct TEXT_ITEM_CLASS = { PostScript }; -RadarItemClassId RadarText = (RadarItemClassId) &TEXT_ITEM_CLASS; +ZnItemClassId ZnText = (ZnItemClassId) &TEXT_ITEM_CLASS; diff --git a/generic/Track.c b/generic/Track.c index bcfdcf5..a5e17dc 100644 --- a/generic/Track.c +++ b/generic/Track.c @@ -58,9 +58,9 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ " */ typedef struct { - RadarPoint world; /* world coord of pos */ - RadarPoint dev; /* dev coord of pos */ - RadarBool visible; + ZnPoint world; /* world coord of pos */ + ZnPoint dev; /* dev coord of pos */ + ZnBool visible; } HistoryStruct, *History; typedef struct _TrackItemStruct { @@ -69,232 +69,232 @@ typedef struct _TrackItemStruct { /* Public data */ unsigned char flags; Pixmap symbol; /* item symbol */ - RadarColor symbol_color; + ZnColor symbol_color; int label_angle; /* Label angle from track. */ int label_distance; /* Label distance from track. */ int label_dx; /* Label dx/dy from track. */ int label_dy; - RadarAnchor label_anchor; + ZnAnchor label_anchor; LeaderAnchors leader_anchors; /* Spec of the leader attachment */ - RadarColor leader_color; /* leader color */ + ZnColor leader_color; /* leader color */ LineStyle leader_style; LineShape leader_shape; LineEnd leader_first_end; LineEnd leader_last_end; int leader_width; int marker_size; /* world size of error circle */ - RadarColor marker_color; /* error circle color */ + ZnColor marker_color; /* error circle color */ LineStyle marker_style; /* error circle style */ Pixmap marker_fill_pattern; /* error circle fill pattern */ - RadarColor connection_color; /* connection color */ + ZnColor connection_color; /* connection color */ LineStyle connection_style; int connection_width; - RadarColor speed_vector_color; /* s. v. color */ + ZnColor speed_vector_color; /* s. v. color */ int visible_history_size; /* Number of visible positions */ - RadarPoint pos; /* item world coordinates */ - RadarPoint speed_vector; /* s. v. slope in world coord */ + ZnPoint pos; /* item world coordinates */ + ZnPoint speed_vector; /* s. v. slope in world coord */ /* Private data */ FieldSetStruct field_set; - RadarPoint dev; /* device coords of current pos */ - RadarPoint speed_vector_dev; /* s. v. end in device coord */ - RadarDim marker_size_dev; /* dev size of error circle */ - RadarList history; /* pos list */ - RadarList 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 RadarAttrConfig track_attrs[] = { - { RADAR_CONFIG_BOOL, "-circlehistory", NULL, - Tk_Offset(TrackItemStruct, flags), CIRCLE_HISTORY_BIT, RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_BOOL, "-composerotation", NULL, +static ZnAttrConfig track_attrs[] = { + { ZN_CONFIG_BOOL, "-circlehistory", NULL, + Tk_Offset(TrackItemStruct, flags), CIRCLE_HISTORY_BIT, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_BOOL, "-composerotation", NULL, Tk_Offset(TrackItemStruct, 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(TrackItemStruct, header.flags), COMPOSE_SCALE_BIT, - RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_ITEM, "-connecteditem", NULL, + ZN_COORDS_FLAG, False }, + { ZN_CONFIG_ITEM, "-connecteditem", NULL, Tk_Offset(TrackItemStruct, header.connected_item), 0, - RADAR_COORDS_FLAG|RADAR_ITEM_FLAG, False }, - { RADAR_CONFIG_COLOR, "-connectioncolor", NULL, - Tk_Offset(TrackItemStruct, connection_color), 0, RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_BOOL, "-connectionsensitive", NULL, - Tk_Offset(TrackItemStruct, header.part_sensitive), PART_NUMBER_TO_BIT(RADAR_CONNECTION), - RADAR_REPICK_FLAG, False }, - { RADAR_CONFIG_LINE_STYLE, "-connectionstyle", NULL, - Tk_Offset(TrackItemStruct, connection_style), 0, RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_DIM, "-connectionwidth", NULL, - Tk_Offset(TrackItemStruct, connection_width), 0, RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_BOOL, "-filledhistory", NULL, - Tk_Offset(TrackItemStruct, flags), FILLED_HISTORY_BIT, RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_BOOL, "-filledmarker", NULL, - Tk_Offset(TrackItemStruct, flags), MARKER_FILLED_BIT, RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_BOOL, "-frozenlabel", NULL, - Tk_Offset(TrackItemStruct, flags), FROZEN_LABEL_BIT, RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_ANCHOR, "-labelanchor", NULL, - Tk_Offset(TrackItemStruct, label_anchor), 0, RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_ANGLE, "-labelangle", NULL, + ZN_COORDS_FLAG|ZN_ITEM_FLAG, False }, + { ZN_CONFIG_COLOR, "-connectioncolor", NULL, + Tk_Offset(TrackItemStruct, connection_color), 0, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_BOOL, "-connectionsensitive", NULL, + Tk_Offset(TrackItemStruct, header.part_sensitive), PART_NUMBER_TO_BIT(ZN_CONNECTION), + ZN_REPICK_FLAG, False }, + { ZN_CONFIG_LINE_STYLE, "-connectionstyle", NULL, + Tk_Offset(TrackItemStruct, connection_style), 0, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_DIM, "-connectionwidth", NULL, + Tk_Offset(TrackItemStruct, connection_width), 0, ZN_COORDS_FLAG, False }, + { ZN_CONFIG_BOOL, "-filledhistory", NULL, + Tk_Offset(TrackItemStruct, flags), FILLED_HISTORY_BIT, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_BOOL, "-filledmarker", NULL, + Tk_Offset(TrackItemStruct, flags), MARKER_FILLED_BIT, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_BOOL, "-frozenlabel", NULL, + Tk_Offset(TrackItemStruct, flags), FROZEN_LABEL_BIT, ZN_COORDS_FLAG, False }, + { ZN_CONFIG_ANCHOR, "-labelanchor", NULL, + Tk_Offset(TrackItemStruct, label_anchor), 0, ZN_COORDS_FLAG, False }, + { ZN_CONFIG_ANGLE, "-labelangle", NULL, Tk_Offset(TrackItemStruct, label_angle), 0, - RADAR_COORDS_FLAG|RADAR_POLAR_FLAG, False }, - { RADAR_CONFIG_DIM, "-labeldistance", NULL, + ZN_COORDS_FLAG|ZN_POLAR_FLAG, False }, + { ZN_CONFIG_DIM, "-labeldistance", NULL, Tk_Offset(TrackItemStruct, label_distance), 0, - RADAR_COORDS_FLAG|RADAR_POLAR_FLAG, False }, - { RADAR_CONFIG_DIM, "-labeldx", NULL, + ZN_COORDS_FLAG|ZN_POLAR_FLAG, False }, + { ZN_CONFIG_DIM, "-labeldx", NULL, Tk_Offset(TrackItemStruct, label_dx), 0, - RADAR_COORDS_FLAG|RADAR_CARTESIAN_FLAG, False }, - { RADAR_CONFIG_DIM, "-labeldy", NULL, + ZN_COORDS_FLAG|ZN_CARTESIAN_FLAG, False }, + { ZN_CONFIG_DIM, "-labeldy", NULL, Tk_Offset(TrackItemStruct, label_dy), 0, - RADAR_COORDS_FLAG|RADAR_CARTESIAN_FLAG, False }, - { RADAR_CONFIG_LABEL_FORMAT, "-labelformat", NULL, + ZN_COORDS_FLAG|ZN_CARTESIAN_FLAG, False }, + { ZN_CONFIG_LABEL_FORMAT, "-labelformat", NULL, Tk_Offset(TrackItemStruct, field_set.label_format), 0, - RADAR_COORDS_FLAG|RADAR_CLFC_FLAG, False }, - { RADAR_CONFIG_LEADER_ANCHORS, "-leaderanchors", NULL, - Tk_Offset(TrackItemStruct, leader_anchors), 0, RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_COLOR, "-leadercolor", NULL, - Tk_Offset(TrackItemStruct, leader_color), 0, RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_LINE_END, "-leaderfirstend", NULL, - Tk_Offset(TrackItemStruct, leader_first_end), 0, RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_LINE_END, "-leaderlastend", NULL, - Tk_Offset(TrackItemStruct, leader_last_end), 0, RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_BOOL, "-leadersensitive", NULL, - Tk_Offset(TrackItemStruct, header.part_sensitive), PART_NUMBER_TO_BIT(RADAR_LEADER), - RADAR_REPICK_FLAG, False }, - { RADAR_CONFIG_LINE_STYLE, "-leaderstyle", NULL, - Tk_Offset(TrackItemStruct, leader_style), 0, RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_LINE_SHAPE, "-leadershape", NULL, - Tk_Offset(TrackItemStruct, leader_shape), 0, RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_DIM, "-leaderwidth", NULL, - Tk_Offset(TrackItemStruct, leader_width), 0, RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_COLOR, "-markercolor", NULL, - Tk_Offset(TrackItemStruct, marker_color), 0, RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_PATTERN, "-markerfillpattern", NULL, - Tk_Offset(TrackItemStruct, marker_fill_pattern), 0, RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_DIM, "-markersize", NULL, - Tk_Offset(TrackItemStruct, marker_size), 0, RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_LINE_STYLE, "-markerstyle", NULL, - Tk_Offset(TrackItemStruct, marker_style), 0, RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_BOOL, "-mixedhistory", NULL, - Tk_Offset(TrackItemStruct, flags), DOT_MIXED_HISTORY_BIT, RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_UINT, "-numfields", NULL, + ZN_COORDS_FLAG|ZN_CLFC_FLAG, False }, + { ZN_CONFIG_LEADER_ANCHORS, "-leaderanchors", NULL, + Tk_Offset(TrackItemStruct, leader_anchors), 0, ZN_COORDS_FLAG, False }, + { ZN_CONFIG_COLOR, "-leadercolor", NULL, + Tk_Offset(TrackItemStruct, leader_color), 0, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_LINE_END, "-leaderfirstend", NULL, + Tk_Offset(TrackItemStruct, leader_first_end), 0, ZN_COORDS_FLAG, False }, + { ZN_CONFIG_LINE_END, "-leaderlastend", NULL, + Tk_Offset(TrackItemStruct, leader_last_end), 0, ZN_COORDS_FLAG, False }, + { ZN_CONFIG_BOOL, "-leadersensitive", NULL, + Tk_Offset(TrackItemStruct, header.part_sensitive), PART_NUMBER_TO_BIT(ZN_LEADER), + ZN_REPICK_FLAG, False }, + { ZN_CONFIG_LINE_STYLE, "-leaderstyle", NULL, + Tk_Offset(TrackItemStruct, leader_style), 0, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_LINE_SHAPE, "-leadershape", NULL, + Tk_Offset(TrackItemStruct, leader_shape), 0, ZN_COORDS_FLAG, False }, + { ZN_CONFIG_DIM, "-leaderwidth", NULL, + Tk_Offset(TrackItemStruct, leader_width), 0, ZN_COORDS_FLAG, False }, + { ZN_CONFIG_COLOR, "-markercolor", NULL, + Tk_Offset(TrackItemStruct, marker_color), 0, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_PATTERN, "-markerfillpattern", NULL, + Tk_Offset(TrackItemStruct, marker_fill_pattern), 0, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_DIM, "-markersize", NULL, + Tk_Offset(TrackItemStruct, marker_size), 0, ZN_COORDS_FLAG, False }, + { ZN_CONFIG_LINE_STYLE, "-markerstyle", NULL, + Tk_Offset(TrackItemStruct, marker_style), 0, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_BOOL, "-mixedhistory", NULL, + Tk_Offset(TrackItemStruct, flags), DOT_MIXED_HISTORY_BIT, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_UINT, "-numfields", NULL, Tk_Offset(TrackItemStruct, field_set.num_fields), 0, 0, True }, - { RADAR_CONFIG_POINT, "-position", NULL, Tk_Offset(TrackItemStruct, pos), 0, - RADAR_COORDS_FLAG|RADAR_MOVED_FLAG, False}, - { RADAR_CONFIG_PRI, "-priority", NULL, + { ZN_CONFIG_POINT, "-position", NULL, Tk_Offset(TrackItemStruct, pos), 0, + ZN_COORDS_FLAG|ZN_MOVED_FLAG, False}, + { ZN_CONFIG_PRI, "-priority", NULL, Tk_Offset(TrackItemStruct, header.priority), 0, - RADAR_DRAW_FLAG|RADAR_REPICK_FLAG, False }, - { RADAR_CONFIG_BOOL, "-sensitive", NULL, - Tk_Offset(TrackItemStruct, header.flags), SENSITIVE_BIT, RADAR_REPICK_FLAG, False }, - { RADAR_CONFIG_POINT, "-speedvector", NULL, Tk_Offset(TrackItemStruct, speed_vector), 0, - RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_COLOR, "-speedvectorcolor", NULL, - Tk_Offset(TrackItemStruct, speed_vector_color), 0, RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_BOOL, "-speedvectorsensitive", NULL, - Tk_Offset(TrackItemStruct, header.part_sensitive), PART_NUMBER_TO_BIT(RADAR_SPEED_VECTOR), - RADAR_REPICK_FLAG, False }, - { RADAR_CONFIG_PATTERN, "-symbol", NULL, - Tk_Offset(TrackItemStruct, symbol), 0, RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_COLOR, "-symbolcolor", NULL, - Tk_Offset(TrackItemStruct, symbol_color), 0, RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_BOOL, "-symbolsensitive", NULL, - Tk_Offset(TrackItemStruct, header.part_sensitive), PART_NUMBER_TO_BIT(RADAR_CURRENT_POSITION), - RADAR_REPICK_FLAG, False }, - { RADAR_CONFIG_TAGS, "-tags", NULL, + ZN_DRAW_FLAG|ZN_REPICK_FLAG, False }, + { ZN_CONFIG_BOOL, "-sensitive", NULL, + Tk_Offset(TrackItemStruct, header.flags), SENSITIVE_BIT, ZN_REPICK_FLAG, False }, + { ZN_CONFIG_POINT, "-speedvector", NULL, Tk_Offset(TrackItemStruct, speed_vector), 0, + ZN_COORDS_FLAG, False }, + { ZN_CONFIG_COLOR, "-speedvectorcolor", NULL, + Tk_Offset(TrackItemStruct, speed_vector_color), 0, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_BOOL, "-speedvectorsensitive", NULL, + Tk_Offset(TrackItemStruct, header.part_sensitive), PART_NUMBER_TO_BIT(ZN_SPEED_VECTOR), + ZN_REPICK_FLAG, False }, + { ZN_CONFIG_PATTERN, "-symbol", NULL, + Tk_Offset(TrackItemStruct, symbol), 0, ZN_COORDS_FLAG, False }, + { ZN_CONFIG_COLOR, "-symbolcolor", NULL, + Tk_Offset(TrackItemStruct, symbol_color), 0, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_BOOL, "-symbolsensitive", NULL, + Tk_Offset(TrackItemStruct, header.part_sensitive), PART_NUMBER_TO_BIT(ZN_CURRENT_POSITION), + ZN_REPICK_FLAG, False }, + { ZN_CONFIG_TAGS, "-tags", NULL, Tk_Offset(TrackItemStruct, header.tags), 0, 0, False }, - { RADAR_CONFIG_BOOL, "-visible", NULL, + { ZN_CONFIG_BOOL, "-visible", NULL, Tk_Offset(TrackItemStruct, header.flags), VISIBLE_BIT, - RADAR_DRAW_FLAG|RADAR_REPICK_FLAG|RADAR_VIS_FLAG, False }, - { RADAR_CONFIG_UINT, "-visiblehistorysize", NULL, - Tk_Offset(TrackItemStruct, visible_history_size), 0, RADAR_DRAW_FLAG, False }, + ZN_DRAW_FLAG|ZN_REPICK_FLAG|ZN_VIS_FLAG, False }, + { ZN_CONFIG_UINT, "-visiblehistorysize", NULL, + Tk_Offset(TrackItemStruct, visible_history_size), 0, ZN_DRAW_FLAG, False }, - { RADAR_CONFIG_END, NULL, NULL, 0, 0, 0 } + { ZN_CONFIG_END, NULL, NULL, 0, 0, 0 } }; -static RadarAttrConfig wp_attrs[] = { - { RADAR_CONFIG_BOOL, "-composerotation", NULL, +static ZnAttrConfig wp_attrs[] = { + { ZN_CONFIG_BOOL, "-composerotation", NULL, Tk_Offset(TrackItemStruct, 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(TrackItemStruct, header.flags), COMPOSE_SCALE_BIT, - RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_ITEM, "-connecteditem", NULL, + ZN_COORDS_FLAG, False }, + { ZN_CONFIG_ITEM, "-connecteditem", NULL, Tk_Offset(TrackItemStruct, header.connected_item), 0, - RADAR_COORDS_FLAG|RADAR_ITEM_FLAG, False }, - { RADAR_CONFIG_COLOR, "-connectioncolor", NULL, - Tk_Offset(TrackItemStruct, connection_color), 0, RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_BOOL, "-connectionsensitive", NULL, - Tk_Offset(TrackItemStruct, header.part_sensitive), PART_NUMBER_TO_BIT(RADAR_CONNECTION), - RADAR_REPICK_FLAG, False }, - { RADAR_CONFIG_LINE_STYLE, "-connectionstyle", NULL, - Tk_Offset(TrackItemStruct, connection_style), 0, RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_DIM, "-connectionwidth", NULL, - Tk_Offset(TrackItemStruct, connection_width), 0, RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_BOOL, "-filledmarker", NULL, - Tk_Offset(TrackItemStruct, flags), MARKER_FILLED_BIT, RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_ANCHOR, "-labelanchor", NULL, - Tk_Offset(TrackItemStruct, label_anchor), 0, RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_ANGLE, "-labelangle", NULL, + ZN_COORDS_FLAG|ZN_ITEM_FLAG, False }, + { ZN_CONFIG_COLOR, "-connectioncolor", NULL, + Tk_Offset(TrackItemStruct, connection_color), 0, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_BOOL, "-connectionsensitive", NULL, + Tk_Offset(TrackItemStruct, header.part_sensitive), PART_NUMBER_TO_BIT(ZN_CONNECTION), + ZN_REPICK_FLAG, False }, + { ZN_CONFIG_LINE_STYLE, "-connectionstyle", NULL, + Tk_Offset(TrackItemStruct, connection_style), 0, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_DIM, "-connectionwidth", NULL, + Tk_Offset(TrackItemStruct, connection_width), 0, ZN_COORDS_FLAG, False }, + { ZN_CONFIG_BOOL, "-filledmarker", NULL, + Tk_Offset(TrackItemStruct, flags), MARKER_FILLED_BIT, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_ANCHOR, "-labelanchor", NULL, + Tk_Offset(TrackItemStruct, label_anchor), 0, ZN_COORDS_FLAG, False }, + { ZN_CONFIG_ANGLE, "-labelangle", NULL, Tk_Offset(TrackItemStruct, label_angle), 0, - RADAR_COORDS_FLAG|RADAR_POLAR_FLAG, False }, - { RADAR_CONFIG_DIM, "-labeldistance", NULL, + ZN_COORDS_FLAG|ZN_POLAR_FLAG, False }, + { ZN_CONFIG_DIM, "-labeldistance", NULL, Tk_Offset(TrackItemStruct, label_distance), 0, - RADAR_COORDS_FLAG|RADAR_POLAR_FLAG, False }, - { RADAR_CONFIG_DIM, "-labeldx", NULL, + ZN_COORDS_FLAG|ZN_POLAR_FLAG, False }, + { ZN_CONFIG_DIM, "-labeldx", NULL, Tk_Offset(TrackItemStruct, label_dx), 0, - RADAR_COORDS_FLAG|RADAR_CARTESIAN_FLAG, False }, - { RADAR_CONFIG_DIM, "-labeldy", NULL, + ZN_COORDS_FLAG|ZN_CARTESIAN_FLAG, False }, + { ZN_CONFIG_DIM, "-labeldy", NULL, Tk_Offset(TrackItemStruct, label_dy), 0, - RADAR_COORDS_FLAG|RADAR_CARTESIAN_FLAG, False }, - { RADAR_CONFIG_LABEL_FORMAT, "-labelformat", NULL, + ZN_COORDS_FLAG|ZN_CARTESIAN_FLAG, False }, + { ZN_CONFIG_LABEL_FORMAT, "-labelformat", NULL, Tk_Offset(TrackItemStruct, field_set.label_format), 0, - RADAR_COORDS_FLAG|RADAR_CLFC_FLAG, False }, - { RADAR_CONFIG_LEADER_ANCHORS, "-leaderanchors", NULL, - Tk_Offset(TrackItemStruct, leader_anchors), 0, RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_COLOR, "-leadercolor", NULL, - Tk_Offset(TrackItemStruct, leader_color), 0, RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_LINE_END, "-leaderfirstend", NULL, - Tk_Offset(TrackItemStruct, leader_first_end), 0, RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_LINE_END, "-leaderlastend", NULL, - Tk_Offset(TrackItemStruct, leader_last_end), 0, RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_BOOL, "-leadersensitive", NULL, - Tk_Offset(TrackItemStruct, header.part_sensitive), PART_NUMBER_TO_BIT(RADAR_LEADER), - RADAR_REPICK_FLAG, False }, - { RADAR_CONFIG_LINE_SHAPE, "-leadershape", NULL, - Tk_Offset(TrackItemStruct, leader_shape), 0, RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_LINE_STYLE, "-leaderstyle", NULL, - Tk_Offset(TrackItemStruct, leader_style), 0, RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_DIM, "-leaderwidth", NULL, - Tk_Offset(TrackItemStruct, leader_width), 0, RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_COLOR, "-markercolor", NULL, - Tk_Offset(TrackItemStruct, marker_color), 0, RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_PATTERN, "-markerfillpattern", NULL, - Tk_Offset(TrackItemStruct, marker_fill_pattern), 0, RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_DIM, "-markersize", NULL, - Tk_Offset(TrackItemStruct, marker_size), 0, RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_LINE_STYLE, "-markerstyle", NULL, - Tk_Offset(TrackItemStruct, marker_style), 0, RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_UINT, "-numfields", NULL, + ZN_COORDS_FLAG|ZN_CLFC_FLAG, False }, + { ZN_CONFIG_LEADER_ANCHORS, "-leaderanchors", NULL, + Tk_Offset(TrackItemStruct, leader_anchors), 0, ZN_COORDS_FLAG, False }, + { ZN_CONFIG_COLOR, "-leadercolor", NULL, + Tk_Offset(TrackItemStruct, leader_color), 0, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_LINE_END, "-leaderfirstend", NULL, + Tk_Offset(TrackItemStruct, leader_first_end), 0, ZN_COORDS_FLAG, False }, + { ZN_CONFIG_LINE_END, "-leaderlastend", NULL, + Tk_Offset(TrackItemStruct, leader_last_end), 0, ZN_COORDS_FLAG, False }, + { ZN_CONFIG_BOOL, "-leadersensitive", NULL, + Tk_Offset(TrackItemStruct, header.part_sensitive), PART_NUMBER_TO_BIT(ZN_LEADER), + ZN_REPICK_FLAG, False }, + { ZN_CONFIG_LINE_SHAPE, "-leadershape", NULL, + Tk_Offset(TrackItemStruct, leader_shape), 0, ZN_COORDS_FLAG, False }, + { ZN_CONFIG_LINE_STYLE, "-leaderstyle", NULL, + Tk_Offset(TrackItemStruct, leader_style), 0, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_DIM, "-leaderwidth", NULL, + Tk_Offset(TrackItemStruct, leader_width), 0, ZN_COORDS_FLAG, False }, + { ZN_CONFIG_COLOR, "-markercolor", NULL, + Tk_Offset(TrackItemStruct, marker_color), 0, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_PATTERN, "-markerfillpattern", NULL, + Tk_Offset(TrackItemStruct, marker_fill_pattern), 0, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_DIM, "-markersize", NULL, + Tk_Offset(TrackItemStruct, marker_size), 0, ZN_COORDS_FLAG, False }, + { ZN_CONFIG_LINE_STYLE, "-markerstyle", NULL, + Tk_Offset(TrackItemStruct, marker_style), 0, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_UINT, "-numfields", NULL, Tk_Offset(TrackItemStruct, field_set.num_fields), 0, 0, True }, - { RADAR_CONFIG_POINT, "-position", NULL, Tk_Offset(TrackItemStruct, pos), 0, - RADAR_COORDS_FLAG, False}, - { RADAR_CONFIG_PRI, "-priority", NULL, + { ZN_CONFIG_POINT, "-position", NULL, Tk_Offset(TrackItemStruct, pos), 0, + ZN_COORDS_FLAG, False}, + { ZN_CONFIG_PRI, "-priority", NULL, Tk_Offset(TrackItemStruct, header.priority), 0, - RADAR_DRAW_FLAG|RADAR_REPICK_FLAG, False }, - { RADAR_CONFIG_BOOL, "-sensitive", NULL, - Tk_Offset(TrackItemStruct, header.flags), SENSITIVE_BIT, RADAR_REPICK_FLAG, False }, - { RADAR_CONFIG_PATTERN, "-symbol", NULL, - Tk_Offset(TrackItemStruct, symbol), 0, RADAR_COORDS_FLAG, False }, - { RADAR_CONFIG_COLOR, "-symbolcolor", NULL, - Tk_Offset(TrackItemStruct, symbol_color), 0, RADAR_DRAW_FLAG, False }, - { RADAR_CONFIG_BOOL, "-symbolsensitive", NULL, - Tk_Offset(TrackItemStruct, header.part_sensitive), PART_NUMBER_TO_BIT(RADAR_CURRENT_POSITION), - RADAR_REPICK_FLAG, False }, - { RADAR_CONFIG_TAGS, "-tags", NULL, + ZN_DRAW_FLAG|ZN_REPICK_FLAG, False }, + { ZN_CONFIG_BOOL, "-sensitive", NULL, + Tk_Offset(TrackItemStruct, header.flags), SENSITIVE_BIT, ZN_REPICK_FLAG, False }, + { ZN_CONFIG_PATTERN, "-symbol", NULL, + Tk_Offset(TrackItemStruct, symbol), 0, ZN_COORDS_FLAG, False }, + { ZN_CONFIG_COLOR, "-symbolcolor", NULL, + Tk_Offset(TrackItemStruct, symbol_color), 0, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_BOOL, "-symbolsensitive", NULL, + Tk_Offset(TrackItemStruct, header.part_sensitive), PART_NUMBER_TO_BIT(ZN_CURRENT_POSITION), + ZN_REPICK_FLAG, False }, + { ZN_CONFIG_TAGS, "-tags", NULL, Tk_Offset(TrackItemStruct, header.tags), 0, 0, False }, - { RADAR_CONFIG_BOOL, "-visible", NULL, + { ZN_CONFIG_BOOL, "-visible", NULL, Tk_Offset(TrackItemStruct, 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 } }; @@ -309,9 +309,9 @@ static RadarAttrConfig wp_attrs[] = { * ********************************************************************************** */ -static RadarReal -ProjectionToAngle(RadarDim dx, - RadarDim dy) +static ZnReal +ProjectionToAngle(ZnDim dx, + ZnDim dy) { if (dx == 0) { if (dy < 0) { @@ -334,7 +334,7 @@ ProjectionToAngle(RadarDim dx, } static void -PointPolarToCartesian(RadarReal heading, +PointPolarToCartesian(ZnReal heading, int rho, int theta, int *delta_x, @@ -373,35 +373,35 @@ Init(Item item, SET(item->flags, SENSITIVE_BIT); SET(item->flags, COMPOSE_ROTATION_BIT); SET(item->flags, COMPOSE_SCALE_BIT); - SET(item->part_sensitive, PART_NUMBER_TO_BIT(RADAR_CURRENT_POSITION)); - SET(item->part_sensitive, PART_NUMBER_TO_BIT(RADAR_LEADER)); - SET(item->part_sensitive, PART_NUMBER_TO_BIT(RADAR_CONNECTION)); - SET(item->part_sensitive, PART_NUMBER_TO_BIT(RADAR_SPEED_VECTOR)); - track->symbol_color = RadarGetColorByValue(wi->win, wi->fore_color); + SET(item->part_sensitive, PART_NUMBER_TO_BIT(ZN_CURRENT_POSITION)); + SET(item->part_sensitive, PART_NUMBER_TO_BIT(ZN_LEADER)); + SET(item->part_sensitive, PART_NUMBER_TO_BIT(ZN_CONNECTION)); + SET(item->part_sensitive, PART_NUMBER_TO_BIT(ZN_SPEED_VECTOR)); + track->symbol_color = ZnGetColorByValue(wi->win, wi->fore_color); track->symbol = Tk_GetBitmap(wi->interp, wi->win, Tk_GetUid("AtcSymbol15")); - track->label_anchor = RadarAnchorCenter; + track->label_anchor = ZnAnchorCenter; track->label_angle = DEFAULT_LABEL_ANGLE; track->label_distance = DEFAULT_LABEL_DISTANCE; SET(track->flags, POLAR_BIT); CLEAR(track->flags, FROZEN_LABEL_BIT); track->leader_anchors = NULL; - track->leader_color = RadarGetColorByValue(wi->win, wi->fore_color); + track->leader_color = ZnGetColorByValue(wi->win, wi->fore_color); track->leader_style = LINE_SIMPLE; track->leader_shape = LINE_STRAIGHT; track->leader_width = DEFAULT_LINE_WIDTH; - track->connection_color = RadarGetColorByValue(wi->win, wi->fore_color); + track->connection_color = ZnGetColorByValue(wi->win, wi->fore_color); track->connection_style = LINE_SIMPLE; track->connection_width = DEFAULT_LINE_WIDTH; - track->marker_color = RadarGetColorByValue(wi->win, wi->fore_color); + track->marker_color = ZnGetColorByValue(wi->win, wi->fore_color); track->marker_style = LINE_SIMPLE; - track->marker_fill_pattern = RadarUnspecifiedPattern; - track->speed_vector_color = RadarGetColorByValue(wi->win, wi->fore_color); + track->marker_fill_pattern = ZnUnspecifiedPattern; + track->speed_vector_color = ZnGetColorByValue(wi->win, wi->fore_color); CLEAR(track->flags, MARKER_FILLED_BIT); SET(track->flags, FILLED_HISTORY_BIT); CLEAR(track->flags, DOT_MIXED_HISTORY_BIT); CLEAR(track->flags, CIRCLE_HISTORY_BIT); - if (item->class == RadarTrack) { + if (item->class == ZnTrack) { item->priority = DEFAULT_TRACK_PRIORITY; track->visible_history_size = DEFAULT_VISIBLE_HISTORY_SIZE; track->marker_size = DEFAULT_MARKER_SIZE; @@ -421,14 +421,14 @@ Init(Item item, * Then try to see if some fields are needed. */ if ((*argc > 0) && (LangString((*args)[0])[0] != '-') && - (Tcl_GetInt(wi->interp, (args[0])[0], &field_set->num_fields) != RADAR_ERROR)) { + (Tcl_GetInt(wi->interp, (args[0])[0], &field_set->num_fields) != ZN_ERROR)) { *args += 1; *argc -= 1; ITEM_P.InitFields(field_set); } else { Tcl_AppendResult(wi->interp, " number of fields expected", NULL); - return RADAR_ERROR; + return ZN_ERROR; } track->pos.x = 0; @@ -446,7 +446,7 @@ Init(Item item, track->marker_size_dev = 0; track->leader_points = NULL; - return RADAR_OK; + return ZN_OK; } @@ -464,7 +464,7 @@ Clone(Item item) WidgetInfo *wi = item->wi; if (track->history) { - track->history = RadarListDuplicate(track->history); + track->history = ZnListDuplicate(track->history); } track->dev.x = 0; track->dev.y = 0; @@ -472,7 +472,7 @@ Clone(Item item) track->speed_vector_dev.y = 0; track->marker_size_dev = 0; if (track->leader_points) { - track->leader_points = RadarListDuplicate(track->leader_points); + track->leader_points = ZnListDuplicate(track->leader_points); } if (track->leader_first_end) { LineEndDuplicate(track->leader_first_end); @@ -486,16 +486,16 @@ Clone(Item item) /* * We get all shared resources, colors bitmaps. */ - track->symbol_color = RadarGetColorByValue(wi->win, track->symbol_color); - track->leader_color = RadarGetColorByValue(wi->win, track->leader_color); - track->connection_color = RadarGetColorByValue(wi->win, track->connection_color); - track->marker_color = RadarGetColorByValue(wi->win, track->marker_color); - track->speed_vector_color = RadarGetColorByValue(wi->win, track->speed_vector_color); - if (track->symbol != RadarUnspecifiedPattern) { + track->symbol_color = ZnGetColorByValue(wi->win, track->symbol_color); + track->leader_color = ZnGetColorByValue(wi->win, track->leader_color); + track->connection_color = ZnGetColorByValue(wi->win, track->connection_color); + track->marker_color = ZnGetColorByValue(wi->win, track->marker_color); + track->speed_vector_color = ZnGetColorByValue(wi->win, track->speed_vector_color); + if (track->symbol != ZnUnspecifiedPattern) { track->symbol = Tk_GetBitmap(wi->interp, wi->win, Tk_NameOfBitmap(wi->dpy, track->symbol)); } - if (track->marker_fill_pattern != RadarUnspecifiedPattern) { + if (track->marker_fill_pattern != ZnUnspecifiedPattern) { track->marker_fill_pattern = Tk_GetBitmap(wi->interp, wi->win, Tk_NameOfBitmap(wi->dpy, track->marker_fill_pattern)); } @@ -516,7 +516,7 @@ Destroy(Item item) WidgetInfo *wi = item->wi; if (track->leader_points) { - RadarListFree(track->leader_points); + ZnListFree(track->leader_points); } if (track->leader_first_end) { LineEndDelete(track->leader_first_end); @@ -526,21 +526,21 @@ Destroy(Item item) } if (track->history) { - RadarListFree(track->history); + ZnListFree(track->history); } /* * Release shared resources. */ - RadarFreeColor(track->symbol_color); - RadarFreeColor(track->leader_color); - RadarFreeColor(track->connection_color); - RadarFreeColor(track->marker_color); - RadarFreeColor(track->speed_vector_color); - if (track->symbol != RadarUnspecifiedPattern) { + ZnFreeColor(track->symbol_color); + ZnFreeColor(track->leader_color); + ZnFreeColor(track->connection_color); + ZnFreeColor(track->marker_color); + ZnFreeColor(track->speed_vector_color); + if (track->symbol != ZnUnspecifiedPattern) { Tk_FreeBitmap(wi->dpy, track->symbol); } - if (track->marker_fill_pattern != RadarUnspecifiedPattern) { + if (track->marker_fill_pattern != ZnUnspecifiedPattern) { Tk_FreeBitmap(wi->dpy, track->marker_fill_pattern); } @@ -557,7 +557,7 @@ Destroy(Item item) */ static void AddToHistory(TrackItem track, - RadarPoint old_pos) + ZnPoint old_pos) { WidgetInfo *wi = ((Item) track)->wi; @@ -569,15 +569,15 @@ AddToHistory(TrackItem track, hist.world = old_pos; hist.dev = track->dev; hist.visible = True; - RadarListAdd(track->history, &hist, RadarListHead); - RadarListTruncate(track->history, wi->track_managed_history_size); + ZnListAdd(track->history, &hist, ZnListHead); + ZnListTruncate(track->history, wi->track_managed_history_size); } } else { /* We do not shift the first time we move as the preceding position * is not valid. */ /*printf("creating history\n");*/ - track->history = RadarListNew(wi->track_managed_history_size+1, + track->history = ZnListNew(wi->track_managed_history_size+1, sizeof(HistoryStruct)); } } @@ -585,19 +585,19 @@ AddToHistory(TrackItem track, static int Configure(Item item, int argc, - RadarAttrList argv, + ZnAttrList argv, int *flags) { TrackItem track = (TrackItem) item; WidgetInfo *wi = item->wi; Item old_connected; - RadarPoint old_pos; + ZnPoint old_pos; old_pos = track->pos; old_connected = item->connected_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; } /* @@ -608,21 +608,21 @@ Configure(Item item, /* * Adapt to the new label locating system. */ - if (ISSET(*flags, RADAR_POLAR_FLAG)) { + if (ISSET(*flags, ZN_POLAR_FLAG)) { SET(track->flags, POLAR_BIT); } - else if (ISSET(*flags, RADAR_CARTESIAN_FLAG)) { + else if (ISSET(*flags, ZN_CARTESIAN_FLAG)) { CLEAR(track->flags, POLAR_BIT); } - if (ISSET(*flags, RADAR_ITEM_FLAG)) { + if (ISSET(*flags, ZN_ITEM_FLAG)) { /* * If the new connected item is not appropriate back up * to the old one. */ - if ((item->connected_item == RADAR_NO_ITEM) || - (((item->connected_item->class == RadarTrack) || - (item->connected_item->class == RadarWayPoint)) && + if ((item->connected_item == ZN_NO_ITEM) || + (((item->connected_item->class == ZnTrack) || + (item->connected_item->class == ZnWayPoint)) && (item->parent == item->connected_item->parent))) { ITEM.UpdateItemDependency(item, old_connected); } @@ -632,22 +632,22 @@ Configure(Item item, } #ifdef OM - if (ISSET(*flags, RADAR_VIS_FLAG)) { + if (ISSET(*flags, ZN_VIS_FLAG)) { /* Record the change to trigger the overlap manager latter */ - if ((item->class == RadarTrack) && ISSET(item->flags, VISIBLE_BIT)) { + if ((item->class == ZnTrack) && ISSET(item->flags, VISIBLE_BIT)) { ((GroupItem) item->parent)->call_om = True; } } #endif /* If the current position has changed, shift the past pos. */ - if (ISSET(*flags, RADAR_MOVED_FLAG)) { - if (item->class == RadarTrack) { + if (ISSET(*flags, ZN_MOVED_FLAG)) { + if (item->class == ZnTrack) { AddToHistory(track, old_pos); } } - return RADAR_OK; + return ZN_OK; } @@ -661,13 +661,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; } @@ -681,18 +681,18 @@ Query(Item item, static void ComputeCoordinates(Item item, - RadarBool force) + ZnBool force) { WidgetInfo *wi = item->wi; TrackItem track = (TrackItem) item; FieldSet field_set = &track->field_set; Item c_item; History hist; - RadarPoint old_label_pos, old_pos, p, xp; - RadarDim old_label_width, old_label_height; - RadarReal rotation; - RadarBBox bbox; - RadarPoint *points; + ZnPoint old_label_pos, old_pos, p, xp; + ZnDim old_label_width, old_label_height; + ZnReal rotation; + ZnBBox bbox; + ZnPoint *points; int num_acc_pos, i; int num_points, alignment; int w2=0, h2=0, w=0, h=0; @@ -705,15 +705,15 @@ ComputeCoordinates(Item item, /* * Suppress history if history management was turned off. */ - if ((item->class == RadarTrack) && !wi->track_manage_history) { - RadarListEmpty(track->history); + if ((item->class == ZnTrack) && !wi->track_manage_history) { + ZnListEmpty(track->history); } old_pos = track->dev; - RadarTransformPoint(wi->current_transfo, &track->pos, &track->dev); + ZnTransformPoint(wi->current_transfo, &track->pos, &track->dev); /*printf("track pos %g %g --> %g %g\n", track->pos.x, track->pos.y, track->dev.x, track->dev.y);*/ - if (track->symbol != RadarUnspecifiedPattern) { + if (track->symbol != ZnUnspecifiedPattern) { Tk_SizeOfBitmap(wi->dpy, track->symbol, &w, &h); /*printf("taille symbole %d %d\n", w, h);*/ w2 = (w+1)/2; @@ -731,12 +731,12 @@ ComputeCoordinates(Item item, care :-). In fact it is even worse as we use the overall information from the symbol font. */ - if ((item->class == RadarTrack) && track->history) { + if ((item->class == ZnTrack) && track->history) { ResetBBox(&bbox); - num_acc_pos = RadarListSize(track->history); - hist = RadarListArray(track->history); + num_acc_pos = ZnListSize(track->history); + hist = ZnListArray(track->history); for (i = 0; i < num_acc_pos; i++) { - RadarTransformPoint(wi->current_transfo, &hist[i].world, &hist[i].dev); + ZnTransformPoint(wi->current_transfo, &hist[i].world, &hist[i].dev); if ((i < track->visible_history_size) && (hist[i].visible)) { bbox.orig.x = hist[i].dev.x - w2; bbox.orig.y = hist[i].dev.y - h2; @@ -750,10 +750,10 @@ ComputeCoordinates(Item item, /* * Compute the speed vector end. */ - if (item->class == RadarTrack) { + if (item->class == ZnTrack) { p.x = track->pos.x + track->speed_vector.x * wi->speed_vector_length; p.y = track->pos.y + track->speed_vector.y * wi->speed_vector_length; - RadarTransformPoint(wi->current_transfo, &p, &track->speed_vector_dev); + ZnTransformPoint(wi->current_transfo, &p, &track->speed_vector_dev); AddPointToBBox(&item->item_bounding_box, track->speed_vector_dev.x, track->speed_vector_dev.y); } @@ -762,7 +762,7 @@ ComputeCoordinates(Item item, * Take care of the connection between items. */ c_item = item->connected_item; - if ((c_item != RADAR_NO_ITEM) && (track->connection_width > 0)) { + if ((c_item != ZN_NO_ITEM) && (track->connection_width > 0)) { ResetBBox(&bbox); w2 = track->connection_width/2; AddPointToBBox(&item->item_bounding_box, track->dev.x-w2, track->dev.y-w2); @@ -775,23 +775,23 @@ ComputeCoordinates(Item item, */ p.x = track->pos.x + track->marker_size; p.y = track->pos.y; - RadarTransformPoint(wi->current_transfo, &p, &xp); + ZnTransformPoint(wi->current_transfo, &p, &xp); xp.x = xp.x - track->dev.x; xp.y = xp.y - track->dev.y; track->marker_size_dev = sqrt(xp.x*xp.x + xp.y*xp.y); if (track->marker_size_dev > PRECISION_LIMIT) { AddPointToBBox(&item->item_bounding_box, - track->dev.x - (RadarPos) track->marker_size_dev, - track->dev.y - (RadarPos) track->marker_size_dev); + track->dev.x - (ZnPos) track->marker_size_dev, + track->dev.y - (ZnPos) track->marker_size_dev); AddPointToBBox(&item->item_bounding_box, - track->dev.x + (RadarPos) track->marker_size_dev, - track->dev.y + (RadarPos) 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) { - RadarDim bb_width, bb_height, dist; - RadarPoint leader_end; + ZnDim bb_width, bb_height, dist; + ZnPoint leader_end; ITEM_P.GetLabelBBox(field_set, &bb_width, &bb_height); /* @@ -803,9 +803,9 @@ ComputeCoordinates(Item item, * Adjust the min dist spec given in label_distance by * the size of the label. */ - if ((track->label_anchor == RadarAnchorN) || - (track->label_anchor == RadarAnchorCenter) || - (track->label_anchor == RadarAnchorS)) { + if ((track->label_anchor == ZnAnchorN) || + (track->label_anchor == ZnAnchorCenter) || + (track->label_anchor == ZnAnchorS)) { dist = sqrt(bb_width*bb_width/4+bb_height*bb_height/4); } else { @@ -815,7 +815,7 @@ ComputeCoordinates(Item item, /* * Compute heading after applying the transform. */ - RadarTransfoDecompose(wi->current_transfo, NULL, NULL, &rotation, NULL); + ZnTransfoDecompose(wi->current_transfo, NULL, NULL, &rotation, NULL); /*printf("rotation=%g, heading=%g, angle=%d\n", rotation, ProjectionToAngle(track->speed_vector.x, track->speed_vector.y), track->label_angle);*/ @@ -832,15 +832,15 @@ ComputeCoordinates(Item item, AddPointToBBox(&item->item_bounding_box, field_set->label_pos.x, field_set->label_pos.y); AddPointToBBox(&item->item_bounding_box, - field_set->label_pos.x + (RadarPos) bb_width, - field_set->label_pos.y + (RadarPos) bb_height); + field_set->label_pos.x + (ZnPos) bb_width, + field_set->label_pos.y + (ZnPos) bb_height); /* * Process the leader. */ if (track->leader_width > 0) { int left_x, left_y, right_x, right_y; - RadarPoint end_points[LINE_END_POINTS]; + ZnPoint end_points[LINE_END_POINTS]; /* * Compute the actual leader end in the label. @@ -886,13 +886,13 @@ ComputeCoordinates(Item item, /* Setup leader shape points */ if (!track->leader_points) { - track->leader_points = RadarListNew(LINE_SHAPE_POINTS, sizeof(RadarPoint)); + track->leader_points = ZnListNew(LINE_SHAPE_POINTS, sizeof(ZnPoint)); } GetLineShape(&track->dev, &leader_end, track->leader_width, track->leader_shape, &bbox, track->leader_points); AddBBoxToBBox(&item->item_bounding_box, &bbox); - points = (RadarPoint *) RadarListArray(track->leader_points); - num_points = RadarListSize(track->leader_points); + points = (ZnPoint *) ZnListArray(track->leader_points); + num_points = ZnListSize(track->leader_points); /* Setup leader ends */ if (track->leader_first_end != NULL) { @@ -920,7 +920,7 @@ ComputeCoordinates(Item item, #ifdef OM /* Record the move to trigger the overlap manager latter */ - if (item->class == RadarTrack) { + if (item->class == ZnTrack) { ((GroupItem) item->parent)->call_om = True; } #endif @@ -938,24 +938,24 @@ 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) { WidgetInfo *wi = item->wi; TrackItem track = (TrackItem) item; int inside; int width, height; - RadarDim lwidth, lheight; - RadarBBox bbox; + ZnDim lwidth, lheight; + ZnBBox bbox; /* * Try the current position. */ ResetBBox(&bbox); - if (track->symbol != RadarUnspecifiedPattern) { + if (track->symbol != ZnUnspecifiedPattern) { Tk_SizeOfBitmap(wi->dpy, track->symbol, &width, &height); bbox.orig.x = track->dev.x-(width+1)/2; bbox.orig.y = track->dev.y-(height+1)/2; @@ -982,12 +982,12 @@ ToArea(Item item, * Try the leader. */ if (track->field_set.label_format && (track->leader_width > 0)) { - RadarPoint end_points[LINE_END_POINTS]; - RadarPoint *points; + ZnPoint end_points[LINE_END_POINTS]; + ZnPoint *points; int num_points; - points = (RadarPoint *) RadarListArray(track->leader_points); - num_points = RadarListSize(track->leader_points); + points = (ZnPoint *) ZnListArray(track->leader_points); + num_points = ZnListSize(track->leader_points); width = track->leader_width > 1 ? track->leader_width : 0; if (PolylineInBBox(points, num_points, width, CapRound, JoinRound, area) != inside) { @@ -1015,7 +1015,7 @@ ToArea(Item item, /* * Try the speed vector. */ - if (item->class == RadarTrack) { + if (item->class == ZnTrack) { if (LineInBBox(&track->dev, &track->speed_vector_dev, area) != inside) { printf("track speed vector\n"); return 0; @@ -1025,8 +1025,8 @@ ToArea(Item item, /* * Try the connection. */ - if ((item->connected_item != RADAR_NO_ITEM) && (track->connection_width > 0)) { - RadarPoint pts[2]; + if ((item->connected_item != ZN_NO_ITEM) && (track->connection_width > 0)) { + ZnPoint pts[2]; pts[0] = track->dev; pts[1] = ((TrackItem) item->connected_item)->dev; @@ -1065,10 +1065,10 @@ Draw(Item item) /* Draw the marker */ if (track->marker_size_dev != 0) { SetLineStyle(wi->dpy, wi->gc, track->marker_style); - values.foreground = RadarPixel(track->marker_color); + values.foreground = ZnPixel(track->marker_color); values.line_width = 0; if (ISSET(track->flags, MARKER_FILLED_BIT)) { - if (track->marker_fill_pattern == RadarUnspecifiedPattern) { + if (track->marker_fill_pattern == ZnUnspecifiedPattern) { /* Fill solid */ values.fill_style = FillSolid; XChangeGC(wi->dpy, wi->gc, GCFillStyle | GCLineWidth | GCForeground, &values); @@ -1081,16 +1081,16 @@ Draw(Item item) GCFillStyle | GCStipple | GCLineWidth | GCForeground, &values); } XFillArc(wi->dpy, wi->draw_buffer, wi->gc, - track->dev.x - (RadarPos) track->marker_size_dev, - track->dev.y - (RadarPos) track->marker_size_dev, + track->dev.x - (ZnPos) track->marker_size_dev, + track->dev.y - (ZnPos) track->marker_size_dev, track->marker_size_dev * 2, track->marker_size_dev * 2, 0, 360 * 64); } else { XChangeGC(wi->dpy, wi->gc, GCLineWidth | GCForeground, &values); XDrawArc(wi->dpy, wi->draw_buffer, wi->gc, - track->dev.x - (RadarPos) track->marker_size_dev, - track->dev.y - (RadarPos) track->marker_size_dev, + track->dev.x - (ZnPos) track->marker_size_dev, + track->dev.y - (ZnPos) track->marker_size_dev, track->marker_size_dev * 2, track->marker_size_dev * 2, 0, 360 * 64); } @@ -1100,8 +1100,8 @@ Draw(Item item) * Draw the connection. */ c_item = item->connected_item; - if ((c_item != RADAR_NO_ITEM) && (track->connection_width > 0)) { - RadarPoint pts[2]; + if ((c_item != ZN_NO_ITEM) && (track->connection_width > 0)) { + ZnPoint pts[2]; pts[0] = track->dev; pts[1] = ((TrackItem) item->connected_item)->dev; @@ -1113,8 +1113,8 @@ Draw(Item item) /* * Draw the speed vector. */ - if (item->class == RadarTrack) { - values.foreground = RadarPixel(track->speed_vector_color); + if (item->class == ZnTrack) { + values.foreground = ZnPixel(track->speed_vector_color); values.line_width = 0; values.line_style = LineSolid; values.fill_style = FillSolid; @@ -1128,13 +1128,13 @@ Draw(Item item) * Draw the leader. */ if (track->field_set.label_format && track->leader_width > 0) { - RadarPoint end_points[LINE_END_POINTS]; + ZnPoint end_points[LINE_END_POINTS]; XPoint xpoints[LINE_END_POINTS]; - RadarPoint *points; + ZnPoint *points; int num_points; - points = (RadarPoint *) RadarListArray(track->leader_points); - num_points = RadarListSize(track->leader_points); + points = (ZnPoint *) ZnListArray(track->leader_points); + num_points = ZnListSize(track->leader_points); DrawLineShape(wi->dpy, wi->draw_buffer, wi->gc, points, num_points, track->leader_style, track->leader_color, @@ -1162,24 +1162,24 @@ Draw(Item item) } tmp_str[0] = track->symbol; - values.foreground = RadarPixel(track->symbol_color); + values.foreground = ZnPixel(track->symbol_color); values.fill_style = FillSolid; XChangeGC(wi->dpy, wi->gc, GCForeground|GCFillStyle, &values); - if (track->symbol != RadarUnspecifiedPattern) { + if (track->symbol != ZnUnspecifiedPattern) { Tk_SizeOfBitmap(wi->dpy, track->symbol, &width, &height); } /* * Draw the history, current pos excepted. */ - if ((item->class == RadarTrack) && track->history) { + if ((item->class == ZnTrack) && track->history) { if (ISCLEAR(track->flags, FILLED_HISTORY_BIT)) { values.line_width = 0; values.line_style = LineSolid; XChangeGC(wi->dpy, wi->gc, GCLineWidth | GCLineStyle, &values); } - num_acc_pos = RadarListSize(track->history); - hist = RadarListArray(track->history); + num_acc_pos = ZnListSize(track->history); + hist = ZnListArray(track->history); side_size = MAX(width, height); for (i = 0, nb_hist = 0; i < MIN(track->visible_history_size, num_acc_pos); i++) { @@ -1223,7 +1223,7 @@ Draw(Item item) /* * Draw the current position using a pattern for Tk. */ - if (track->symbol != RadarUnspecifiedPattern) { + if (track->symbol != ZnUnspecifiedPattern) { int x = track->dev.x - (width+1)/2; int y = track->dev.y - (height+1)/2; values.fill_style = FillStippled; @@ -1249,16 +1249,16 @@ Draw(Item item) * ********************************************************************************** */ -static RadarBool +static ZnBool IsSensitive(Item item, int item_part) { if (ISCLEAR(item->flags, SENSITIVE_BIT) || - !item->parent->class->IsSensitive(item->parent, RADAR_NO_PART)) { + !item->parent->class->IsSensitive(item->parent, ZN_NO_PART)) { return False; } - if (item_part < RADAR_NO_PART) { + if (item_part < ZN_NO_PART) { return ISSET(item->part_sensitive, PART_NUMBER_TO_BIT(item_part)); } else if (item_part >= 0) { @@ -1277,7 +1277,7 @@ IsSensitive(Item item, */ static double Pick(Item item, - RadarPoint *p, + ZnPoint *p, Item start_item, int aperture, Item *a_item, @@ -1286,9 +1286,9 @@ Pick(Item item, WidgetInfo *wi= item->wi; TrackItem track = (TrackItem) item; Item c_item; - RadarBBox bbox; + ZnBBox bbox; double dist=0, new_dist; - RadarPoint *points; + ZnPoint *points; int num_points, i; int width=0, height=0; double width_2; @@ -1306,7 +1306,7 @@ Pick(Item item, * Try the current position symbol. */ ResetBBox(&bbox); - if (track->symbol != RadarUnspecifiedPattern) { + if (track->symbol != ZnUnspecifiedPattern) { Tk_SizeOfBitmap(wi->dpy, track->symbol, &width, &height); bbox.orig.x = track->dev.x-(width+1)/2; bbox.orig.y = track->dev.y-(height+1)/2; @@ -1316,7 +1316,7 @@ Pick(Item item, new_dist = RectangleToPointDist(&bbox, p); if (new_dist < dist) { - best_part = RADAR_CURRENT_POSITION; + best_part = ZN_CURRENT_POSITION; dist = new_dist; } if (dist <= 0.0) { @@ -1327,16 +1327,16 @@ Pick(Item item, * Try the leader. */ if (track->field_set.label_format && (track->leader_width > 0)) { - RadarPoint end_points[LINE_END_POINTS]; + ZnPoint end_points[LINE_END_POINTS]; width_2 = (track->leader_width>1) ? ((double) track->leader_width)/2.0 : 0; - points = (RadarPoint *) RadarListArray(track->leader_points); - num_points = RadarListSize(track->leader_points)-1; + points = (ZnPoint *) ZnListArray(track->leader_points); + num_points = ZnListSize(track->leader_points)-1; for (i = 0; i < num_points; i++) { new_dist = LineToPointDist(&points[i], &points[i+1], p); new_dist -= width_2; if (new_dist < dist) { - best_part = RADAR_LEADER; + best_part = ZN_LEADER; dist = new_dist; } if (dist <= 0.0) { @@ -1348,7 +1348,7 @@ Pick(Item item, CapRound, track->leader_first_end, end_points); new_dist = PolygonToPointDist(end_points, LINE_END_POINTS, p); if (new_dist < dist) { - best_part = RADAR_LEADER; + best_part = ZN_LEADER; dist = new_dist; } if (dist <= 0.0) { @@ -1360,7 +1360,7 @@ Pick(Item item, CapRound, track->leader_last_end, end_points); new_dist = PolygonToPointDist(end_points, LINE_END_POINTS, p); if (new_dist < dist) { - best_part = RADAR_LEADER; + best_part = ZN_LEADER; dist = new_dist; } if (dist <= 0.0) { @@ -1372,10 +1372,10 @@ Pick(Item item, /* * Try the speed vector. */ - if (item->class == RadarTrack) { + if (item->class == ZnTrack) { new_dist = LineToPointDist(&track->dev, &track->speed_vector_dev, p); if (new_dist < dist) { - best_part = RADAR_SPEED_VECTOR; + best_part = ZN_SPEED_VECTOR; dist = new_dist; } if (dist <= 0.0) { @@ -1387,8 +1387,8 @@ Pick(Item item, * Try the connection. */ c_item = item->connected_item; - if ((c_item != RADAR_NO_ITEM) && (track->connection_width > 0)) { - RadarPoint pts[2]; + if ((c_item != ZN_NO_ITEM) && (track->connection_width > 0)) { + ZnPoint pts[2]; pts[0] = track->dev; pts[1] = ((TrackItem) item->connected_item)->dev; @@ -1396,7 +1396,7 @@ Pick(Item item, CapRound, JoinRound, p); if (new_dist < dist) { dist = new_dist; - best_part = RADAR_CONNECTION; + best_part = ZN_CONNECTION; } if (dist <= 0.0) { report0: @@ -1458,28 +1458,28 @@ SendTrackToOm(void *ptr, WidgetInfo *wi = (WidgetInfo *) ptr; Item current_item = (Item) item; TrackItem track; - RadarBBox radar_bbox, bbox; - RadarBool to_be_sent; + ZnBBox zn_bbox, bbox; + ZnBool to_be_sent; - radar_bbox.orig.x = radar_bbox.orig.y = 0; - radar_bbox.corner.x = wi->width; - radar_bbox.corner.y = wi->height; + zn_bbox.orig.x = zn_bbox.orig.y = 0; + zn_bbox.corner.x = wi->width; + zn_bbox.corner.y = wi->height; - if (current_item == RADAR_NO_ITEM) { + if (current_item == ZN_NO_ITEM) { current_item = ((GroupItem) wi->top_group)->head; } else { current_item = current_item->next; } - while (current_item != RADAR_NO_ITEM) { - to_be_sent = current_item->class == RadarTrack; + while (current_item != ZN_NO_ITEM) { + to_be_sent = current_item->class == ZnTrack; /* We send invisibles items because the current algorithm take care of the age of the tracks. to_be_sent &= ISSET(current_item->flags, VISIBLE_BIT);*/ - IntersectBBox(&radar_bbox, ¤t_item->item_bounding_box, &bbox); + IntersectBBox(&zn_bbox, ¤t_item->item_bounding_box, &bbox); to_be_sent &= !IsEmptyBBox(&bbox); if (to_be_sent) { @@ -1499,7 +1499,7 @@ SendTrackToOm(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) { - RadarDim bb_width, bb_height; + ZnDim bb_width, bb_height; ITEM_P.GetLabelBBox(&track->field_set, &bb_width, &bb_height); *label_width = bb_width; @@ -1539,7 +1539,7 @@ SetLabelAngleFromOm(void *ptr, /* No longer in use. */ if ((theta >= 0) && (track->label_angle != theta)) { track->label_angle = theta; - ITEM.Invalidate((Item) item, RADAR_COORDS_FLAG); + ITEM.Invalidate((Item) item, ZN_COORDS_FLAG); } } @@ -1556,19 +1556,19 @@ void QueryLabelPosition(void *ptr, /* No longer in use. */ void *item, int theta, - int* x, - int* y, - int* w, - int* h) + int *x, + int *y, + int *w, + int *h) { Item it = (Item) item; WidgetInfo *wi = it->wi; TrackItem track = (TrackItem) it; if (track->field_set.label_format) { - RadarDim bb_width, bb_height; + ZnDim bb_width, bb_height; int delta_x, delta_y; - RadarReal heading; + ZnReal heading; /* * !! BUG !! This doesn't work if the current transform has some rotation. @@ -1580,8 +1580,8 @@ QueryLabelPosition(void *ptr, /* No longer in use. */ * !! BUG !! This assume a label placing relative to the center anchor. * We must fix this by taking into account the label anchor. */ - *x = track->dev.x + (RadarPos) (delta_x - bb_width/2); - *y = track->dev.y - (RadarPos) (delta_y + bb_height/2); + *x = track->dev.x + (ZnPos) (delta_x - bb_width/2); + *y = track->dev.y - (ZnPos) (delta_y + bb_height/2); *y = wi->height - *y; *w = bb_width; *h = bb_height; @@ -1602,7 +1602,7 @@ QueryLabelPosition(void *ptr, /* No longer in use. */ void SetHistoryVisibility(Item item, int index, - RadarBool visible) + ZnBool visible) { } @@ -1620,12 +1620,12 @@ TruncHistory(Item item) TrackItem track = (TrackItem) item; if (track->history) { - int size = RadarListSize (track->history); - History hist_tbl = RadarListArray (track->history); + int size = ZnListSize (track->history); + History hist_tbl = ZnListArray (track->history); while (size--) { hist_tbl[size].visible = False; } - ITEM.Invalidate(item, RADAR_COORDS_FLAG); + ITEM.Invalidate(item, ZN_COORDS_FLAG); } } @@ -1653,11 +1653,11 @@ GetFieldSet(Item item) */ static void GetAnchor(Item item, - RadarAnchor anchor, - RadarPoint *p) + ZnAnchor anchor, + ZnPoint *p) { FieldSet field_set = &((TrackItem) item)->field_set; - RadarDim width, height; + ZnDim width, height; if (field_set->label_format) { ITEM_P.GetLabelBBox(field_set, &width, &height); @@ -1678,37 +1678,37 @@ GetAnchor(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) { TrackItem track = (TrackItem) item; if ((cmd == COORDS_ADD) || (cmd == COORDS_ADD_LAST) || (cmd == COORDS_REMOVE)) { Tcl_AppendResult(item->wi->interp, " ", item->class->name, "s 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 ", item->class->name, "s", NULL); - return RADAR_ERROR; + return ZN_ERROR; } - if (item->class == RadarTrack) { + if (item->class == ZnTrack) { AddToHistory(track, track->pos); } track->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 = &track->pos; } - return RADAR_OK; + return ZN_OK; } @@ -1767,5 +1767,5 @@ static ItemClassStruct WAY_POINT_ITEM_CLASS = { PostScript }; -RadarItemClassId RadarTrack = (RadarItemClassId) &TRACK_ITEM_CLASS; -RadarItemClassId RadarWayPoint = (RadarItemClassId) &WAY_POINT_ITEM_CLASS; +ZnItemClassId ZnTrack = (ZnItemClassId) &TRACK_ITEM_CLASS; +ZnItemClassId ZnWayPoint = (ZnItemClassId) &WAY_POINT_ITEM_CLASS; diff --git a/generic/Track.h b/generic/Track.h index 57d52a9..dc53204 100644 --- a/generic/Track.h +++ b/generic/Track.h @@ -49,7 +49,7 @@ void *SendTrackToOm(void *ptr, void *item, int *x, int *y, void SetLabelAngleFromOm(void *ptr, void *item, int theta); void QueryLabelPosition(void *ptr, void *item, int theta, int *x, int *y, int *w, int *h); -void SetHistoryVisibility(Item item, int index, RadarBool visibility); +void SetHistoryVisibility(Item item, int index, ZnBool visibility); void TruncHistory(Item item); diff --git a/generic/Transfo.c b/generic/Transfo.c index aa50303..0d7e95e 100644 --- a/generic/Transfo.c +++ b/generic/Transfo.c @@ -77,19 +77,19 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ " /* ************************************************************************* * - * RadarTransfoNew -- + * ZnTransfoNew -- * Create a new transformation and return it initialized to * identity. * ************************************************************************* */ -RadarTransfo * -RadarTransfoNew() +ZnTransfo * +ZnTransfoNew() { - RadarTransfo *t; + ZnTransfo *t; - t = (RadarTransfo *) malloc(sizeof(RadarTransfo)); - RadarTransfoSetIdentity(t); + t = (ZnTransfo *) malloc(sizeof(ZnTransfo)); + ZnTransfoSetIdentity(t); return t; } @@ -98,22 +98,22 @@ RadarTransfoNew() /* ************************************************************************* * - * RadarTransfoDuplicate -- + * ZnTransfoDuplicate -- * Create a new transformation identical to the model t. * ************************************************************************* */ -RadarTransfo * -RadarTransfoDuplicate(RadarTransfo *t) +ZnTransfo * +ZnTransfoDuplicate(ZnTransfo *t) { - RadarTransfo *nt; + ZnTransfo *nt; - nt = (RadarTransfo *) RadarMalloc(sizeof(RadarTransfo)); + nt = (ZnTransfo *) ZnMalloc(sizeof(ZnTransfo)); if (t) { *nt = *t; } else { - RadarTransfoSetIdentity(nt); + ZnTransfoSetIdentity(nt); } return nt; @@ -123,28 +123,28 @@ RadarTransfoDuplicate(RadarTransfo *t) /* ************************************************************************* * - * RadarTransfoFree -- + * ZnTransfoFree -- * Delete a transformation and free its memory. * ************************************************************************* */ void -RadarTransfoFree(RadarTransfo *t) +ZnTransfoFree(ZnTransfo *t) { - RadarFree(t); + ZnFree(t); } /* ************************************************************************* * - * RadarPrintTransfo -- + * ZnPrintTransfo -- * Print the transfo matrix on stdout. * ************************************************************************* */ void -RadarPrintTransfo(RadarTransfo *t) +ZnPrintTransfo(ZnTransfo *t) { printf("(%5g %5g\n %5g %5g\n %5g %5g)\n", t->_[0][0], t->_[0][1], @@ -156,16 +156,16 @@ RadarPrintTransfo(RadarTransfo *t) /* ************************************************************************* * - * RadarTransfoIsIdentity -- + * ZnTransfoIsIdentity -- * Tell if the given transfo is (close to) identity. * ************************************************************************* */ -RadarBool -RadarTransfoIsIdentity(RadarTransfo *t) +ZnBool +ZnTransfoIsIdentity(ZnTransfo *t) { - RadarReal tmp; - RadarBool res = False; + ZnReal tmp; + ZnBool res = False; tmp = t->_[0][0] - 1.0; res = res & ((tmp < PRECISION_LIMIT) && (tmp > -PRECISION_LIMIT)); @@ -186,22 +186,22 @@ RadarTransfoIsIdentity(RadarTransfo *t) /* ************************************************************************* * - * RadarTransfoSetIdentity -- + * ZnTransfoSetIdentity -- * Initialize the given transfo to identity. * ************************************************************************* */ void -RadarTransfoSetIdentity(RadarTransfo *t) +ZnTransfoSetIdentity(ZnTransfo *t) { - *t = ((RadarTransfo) {{{1, 0}, {0, 1}, {0, 0}}}); + *t = ((ZnTransfo) {{{1, 0}, {0, 1}, {0, 0}}}); } /* ************************************************************************* * - * RadarTransfoCompose -- + * 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 @@ -211,13 +211,13 @@ RadarTransfoSetIdentity(RadarTransfo *t) * ************************************************************************* */ -RadarTransfo * -RadarTransfoCompose(RadarTransfo *res, - RadarTransfo *t1, - RadarTransfo *t2) +ZnTransfo * +ZnTransfoCompose(ZnTransfo *res, + ZnTransfo *t1, + ZnTransfo *t2) { if ((t1 != NULL) && (t2 != NULL)) { - register RadarReal tmp; + register ZnReal tmp; tmp = t1->_[0][0]; res->_[0][0] = tmp*t2->_[0][0] + t1->_[0][1]*t2->_[1][0]; @@ -240,7 +240,7 @@ RadarTransfoCompose(RadarTransfo *res, } } else { - RadarTransfoSetIdentity(res); + ZnTransfoSetIdentity(res); } return res; @@ -250,7 +250,7 @@ RadarTransfoCompose(RadarTransfo *res, /* ************************************************************************* * - * RadarTransfoInvert -- + * 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 @@ -260,11 +260,11 @@ RadarTransfoCompose(RadarTransfo *res, * ************************************************************************* */ -RadarTransfo * -RadarTransfoInvert(RadarTransfo *t, - RadarTransfo *inv) +ZnTransfo * +ZnTransfoInvert(ZnTransfo *t, + ZnTransfo *inv) { - RadarReal pos, neg, temp, det_l; + ZnReal pos, neg, temp, det_l; if (t == NULL) { return NULL; @@ -293,7 +293,7 @@ RadarTransfoInvert(RadarTransfo *t, temp = det_l / (pos - neg); /* Why divide by (pos - neg) ?? */ if (ABS(temp) < PRECISION_LIMIT) { - RadarWarning("RadarTransfoInvert : singular matrix"); + ZnWarning("ZnTransfoInvert : singular matrix"); return NULL; } @@ -319,7 +319,7 @@ RadarTransfoInvert(RadarTransfo *t, /* ************************************************************************* * - * RadarTransfoDecompose -- + * ZnTransfoDecompose -- * Decompose an affine matrix into translation, scale, shear and * rotation. The different values are stored in the locations * pointed to by the pointer parameters. If some values are not @@ -330,14 +330,14 @@ RadarTransfoInvert(RadarTransfo *t, ************************************************************************* */ void -RadarTransfoDecompose(RadarTransfo *t, - RadarPoint *scale, - RadarPoint *trans, - RadarReal *rotation, - RadarReal *shearxy) +ZnTransfoDecompose(ZnTransfo *t, + ZnPoint *scale, + ZnPoint *trans, + ZnReal *rotation, + ZnReal *shearxy) { - RadarTransfo local; - RadarReal shear, len, rot, det; + ZnTransfo local; + ZnReal shear, len, rot, det; if (t == NULL) { /* Identity transform */ @@ -361,12 +361,12 @@ RadarTransfoDecompose(RadarTransfo *t, det = (t->_[0][0]*t->_[1][1] - t->_[0][1]*t->_[1][0]); if (ABS(det) < PRECISION_LIMIT) { - RadarWarning("RadarTransfoDecompose : singular matrix"); + ZnWarning("ZnTransfoDecompose : singular matrix"); return; } local = *t; - //RadarPrintTransfo(&local); + //ZnPrintTransfo(&local); /* Get translation part if needed */ if (trans) { trans->x = ABS(local._[2][0]) < PRECISION_LIMIT ? 0 : local._[2][0]; @@ -405,7 +405,7 @@ RadarTransfoDecompose(RadarTransfo *t, //printf("shear %f\n", *shearxy); } //printf("Matrix after scale & shear extracted\n"); - //RadarPrintTransfo(&local); + //ZnPrintTransfo(&local); /* Get rotation */ /* Check for a coordinate system flip. If det of upper-left 2x2 * is -1, there is a reflection. If the rotation is < 180° negate @@ -444,17 +444,17 @@ RadarTransfoDecompose(RadarTransfo *t, /* ************************************************************************* * - * RadarTransfoEqual -- + * ZnTransfoEqual -- * Return True if t1 and t2 are equal (i.e they have the same * rotation, shear scales and translations). If include_translation * is True the translations are considered in the test. * ************************************************************************* */ -RadarBool -RadarTransfoEqual(RadarTransfo *t1, - RadarTransfo *t2, - RadarBool include_translation) +ZnBool +ZnTransfoEqual(ZnTransfo *t1, + ZnTransfo *t2, + ZnBool include_translation) { if (include_translation) { return (t1->_[0][0] == t2->_[0][0] && @@ -476,14 +476,14 @@ RadarTransfoEqual(RadarTransfo *t1, /* ************************************************************************* * - * RadarTransfoHasShear -- + * ZnTransfoHasShear -- * Return True if t has a shear factor in x or y or describe a * rotation or both. * ************************************************************************* */ -RadarBool -RadarTransfoHasShear(RadarTransfo *t) +ZnBool +ZnTransfoHasShear(ZnTransfo *t) { return t->_[0][1] != 0.0 || t->_[1][0] != 0.0; } @@ -492,13 +492,13 @@ RadarTransfoHasShear(RadarTransfo *t) /* ************************************************************************* * - * RadarTransfoIsTranslation -- + * ZnTransfoIsTranslation -- * Return True if t is a pure translation. * ************************************************************************* */ -RadarBool -RadarTransfoIsTranslation(RadarTransfo *t) +ZnBool +ZnTransfoIsTranslation(ZnTransfo *t) { return (t->_[0][0] == 0.0 && t->_[0][1] == 0.0 && @@ -510,7 +510,7 @@ RadarTransfoIsTranslation(RadarTransfo *t) /* ************************************************************************* * - * RadarTransformPoint -- + * ZnTransformPoint -- * Apply the transformation to the point. The point is * modified and returned as the value of the function. * A NULL transformation means identity. This is only used @@ -519,10 +519,10 @@ RadarTransfoIsTranslation(RadarTransfo *t) * ************************************************************************* */ -RadarPoint * -RadarTransformPoint(RadarTransfo *t, - register RadarPoint *p, - RadarPoint *xp) +ZnPoint * +ZnTransformPoint(ZnTransfo *t, + register ZnPoint *p, + ZnPoint *xp) { if (t == NULL) { xp->x = p->x; @@ -539,7 +539,7 @@ RadarTransformPoint(RadarTransfo *t, /* ************************************************************************* * - * RadarTransformPoints -- + * ZnTransformPoints -- * Apply the transformation to the points in p returning points in xp. * The number of points is in num. * A NULL transformation means identity. This is only used @@ -549,13 +549,13 @@ RadarTransformPoint(RadarTransfo *t, ************************************************************************* */ void -RadarTransformPoints(RadarTransfo *t, - RadarPoint *p, - RadarPoint *xp, - int num) +ZnTransformPoints(ZnTransfo *t, + ZnPoint *p, + ZnPoint *xp, + int num) { if (t == NULL) { - memcpy(xp, p, sizeof(RadarPoint)*num); + memcpy(xp, p, sizeof(ZnPoint)*num); } else { int i; @@ -571,20 +571,20 @@ RadarTransformPoints(RadarTransfo *t, /* ************************************************************************* * - * RadarTranslate -- + * ZnTranslate -- * Translate the given transformation by delta_x, delta_y. Returns * the resulting transformation. * - * RadarSetTranslation -- + * ZnSetTranslation -- * Set the translation instead of combining it into the * transformation. * ************************************************************************* */ -RadarTransfo * -RadarTranslate(RadarTransfo *t, - RadarReal delta_x, - RadarReal delta_y) +ZnTransfo * +ZnTranslate(ZnTransfo *t, + ZnReal delta_x, + ZnReal delta_y) { t->_[2][0] = t->_[2][0] + delta_x; t->_[2][1] = t->_[2][1] + delta_y; @@ -592,10 +592,10 @@ RadarTranslate(RadarTransfo *t, return t; } -RadarTransfo * -RadarSetTranslation(RadarTransfo *t, - RadarReal delta_x, - RadarReal delta_y) +ZnTransfo * +ZnSetTranslation(ZnTransfo *t, + ZnReal delta_x, + ZnReal delta_y) { t->_[2][0] = delta_x; t->_[2][1] = delta_y; @@ -607,16 +607,16 @@ RadarSetTranslation(RadarTransfo *t, /* ************************************************************************* * - * RadarScale -- + * ZnScale -- * Scale the given transformation by scale_x, scale_y. Returns the * resulting transformation. * ************************************************************************* */ -RadarTransfo * -RadarScale(RadarTransfo *t, - register RadarReal scale_x, - register RadarReal scale_y) +ZnTransfo * +ZnScale(ZnTransfo *t, + register ZnReal scale_x, + register ZnReal scale_y) { t->_[0][0] = t->_[0][0]*scale_x; t->_[0][1] = t->_[0][1]*scale_y; @@ -632,20 +632,20 @@ RadarScale(RadarTransfo *t, /* ************************************************************************* * - * RadarRotateRad -- + * ZnRotateRad -- * Rotate the given transformation by angle radians * counter-clockwise around the origin. Returns the resulting * transformation. * ************************************************************************* */ -RadarTransfo * -RadarRotateRad(RadarTransfo *t, - RadarReal angle) +ZnTransfo * +ZnRotateRad(ZnTransfo *t, + ZnReal angle) { - register RadarReal c = cos(angle); - register RadarReal s = sin(angle); - register RadarReal tmp; + register ZnReal c = cos(angle); + register ZnReal s = sin(angle); + register ZnReal tmp; tmp = t->_[0][0]; t->_[0][0] = tmp*c - t->_[0][1]*s; @@ -664,18 +664,18 @@ RadarRotateRad(RadarTransfo *t, /* ************************************************************************* * - * RadarRotateDeg -- + * ZnRotateDeg -- * Rotate the given transformation by angle degrees * counter-clockwise around the origin. Returns the resulting * transformation. * ************************************************************************* */ -RadarTransfo * -RadarRotateDeg(RadarTransfo *t, - RadarReal angle) +ZnTransfo * +ZnRotateDeg(ZnTransfo *t, + ZnReal angle) { - return RadarRotateRad(t, DegreesToRadian(angle)); + return ZnRotateRad(t, DegreesToRadian(angle)); } diff --git a/generic/Transfo.h b/generic/Transfo.h index 46ce803..9ce9b8e 100644 --- a/generic/Transfo.h +++ b/generic/Transfo.h @@ -42,71 +42,71 @@ * So a[0][1] is upper right corner of matrix a and a[2][0] * is lower left corner. */ -typedef struct _RadarTransfo { - RadarReal _[3][2]; -} RadarTransfo; +typedef struct _ZnTransfo { + ZnReal _[3][2]; +} ZnTransfo; -RadarTransfo * -RadarTransfoNew(void); -RadarTransfo * -RadarTransfoDuplicate(RadarTransfo *t); +ZnTransfo * +ZnTransfoNew(void); +ZnTransfo * +ZnTransfoDuplicate(ZnTransfo *t); void -RadarTransfoFree(RadarTransfo *t); +ZnTransfoFree(ZnTransfo *t); void -RadarPrintTransfo(RadarTransfo *t); +ZnPrintTransfo(ZnTransfo *t); void -RadarTransfoSetIdentity(RadarTransfo *t); -RadarBool -RadarTransfoIsIdentity(RadarTransfo *t); -RadarTransfo * -RadarTransfoCompose(RadarTransfo *res, - RadarTransfo *t1, - RadarTransfo *t2); -RadarTransfo * -RadarTransfoInvert(RadarTransfo *t, - RadarTransfo *inv); +ZnTransfoSetIdentity(ZnTransfo *t); +ZnBool +ZnTransfoIsIdentity(ZnTransfo *t); +ZnTransfo * +ZnTransfoCompose(ZnTransfo *res, + ZnTransfo *t1, + ZnTransfo *t2); +ZnTransfo * +ZnTransfoInvert(ZnTransfo *t, + ZnTransfo *inv); void -RadarTransfoDecompose(RadarTransfo *t, - RadarPoint *scale, - RadarPoint *trans, - RadarReal *rotation, - RadarReal *shearxy); -RadarBool -RadarTransfoEqual(RadarTransfo *t1, - RadarTransfo *t2, - RadarBool include_translation); -RadarBool -RadarTransfoHasShear(RadarTransfo *t); -RadarBool -RadarTransfoIsTranslation(RadarTransfo *t); -RadarPoint * -RadarTransformPoint(RadarTransfo *t, - RadarPoint *p, - RadarPoint *xp); +ZnTransfoDecompose(ZnTransfo *t, + ZnPoint *scale, + ZnPoint *trans, + ZnReal *rotation, + ZnReal *shearxy); +ZnBool +ZnTransfoEqual(ZnTransfo *t1, + ZnTransfo *t2, + ZnBool include_translation); +ZnBool +ZnTransfoHasShear(ZnTransfo *t); +ZnBool +ZnTransfoIsTranslation(ZnTransfo *t); +ZnPoint * +ZnTransformPoint(ZnTransfo *t, + ZnPoint *p, + ZnPoint *xp); void -RadarTransformPoints(RadarTransfo *t, - RadarPoint *p, - RadarPoint *xp, - int num); -RadarTransfo * -RadarTranslate(RadarTransfo *t, - RadarReal delta_x, - RadarReal delta_y); -RadarTransfo * -RadarSetTranslation(RadarTransfo *t, - RadarReal delta_x, - RadarReal delta_y); -RadarTransfo * -RadarScale(RadarTransfo *t, - RadarReal scale_x, - RadarReal scale_y); -RadarTransfo * -RadarRotateRad(RadarTransfo *t, - RadarReal angle); -RadarTransfo * -RadarRotateDeg(RadarTransfo *t, - RadarReal angle); +ZnTransformPoints(ZnTransfo *t, + ZnPoint *p, + ZnPoint *xp, + int num); +ZnTransfo * +ZnTranslate(ZnTransfo *t, + ZnReal delta_x, + ZnReal delta_y); +ZnTransfo * +ZnSetTranslation(ZnTransfo *t, + ZnReal delta_x, + ZnReal delta_y); +ZnTransfo * +ZnScale(ZnTransfo *t, + ZnReal scale_x, + ZnReal scale_y); +ZnTransfo * +ZnRotateRad(ZnTransfo *t, + ZnReal angle); +ZnTransfo * +ZnRotateDeg(ZnTransfo *t, + ZnReal angle); #endif /* _Transfo_h */ diff --git a/generic/WidgetInfo.h b/generic/WidgetInfo.h index 3220611..51e957b 100644 --- a/generic/WidgetInfo.h +++ b/generic/WidgetInfo.h @@ -1,5 +1,5 @@ /* - * WidgetInfo.h -- Radar Widget record. + * WidgetInfo.h -- Zinc Widget record. * * Authors : Patrick Lecoanet. * Creation date : Mon Feb 1 12:13:24 1999 @@ -52,13 +52,13 @@ typedef struct _WidgetInfo { Tcl_Interp *interp; /* Interpreter associated with widget. */ - Tcl_Command cmd; /* Token for radar widget command. */ + Tcl_Command cmd; /* Token for zinc widget command. */ Tcl_HashTable *tag_table; /* Hash table for object tags. */ 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. */ Tk_BindingTable binding_table; /* Table of all bindings currently defined - * for this radar. NULL means that no + * 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 @@ -72,9 +72,9 @@ typedef struct _WidgetInfo { int new_part; XEvent pick_event; /* Event used to forge fake events and to do * repicks. */ - RadarBool update_pending; /* True means there is a pending graphic + ZnBool update_pending; /* True means there is a pending graphic * update. */ - RadarBBox exposed_area; /* Window area that need to be rexposed. + 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[NUM_ALPHA_STEPS]; @@ -90,7 +90,7 @@ typedef struct _WidgetInfo { /* Tracks global resources */ int track_managed_history_size; /* Size of history for tracks */ - RadarBool track_manage_history; /* Tell if the tracks manage their */ + ZnBool track_manage_history; /* Tell if the tracks manage their */ /* histories. */ int speed_vector_length; /* How long (in time) are speedvectors*/ #ifdef OM @@ -99,55 +99,55 @@ typedef struct _WidgetInfo { #endif /* Maps global resources */ - RadarFont map_text_font; /* Font for texts in Map items */ + ZnFont map_text_font; /* Font for texts in Map items */ Pixmap map_distance_symbol; /* display distance marks along Map */ /* lines. */ /* Transformer */ - RadarTransfo *current_transfo; - RadarList transfo_stack; + ZnTransfo *current_transfo; + ZnList transfo_stack; ClipState *current_clip; - RadarList clip_stack; + ZnList clip_stack; /* Others */ - RadarColor fore_color; /* Default foreground used in new items */ - RadarColor back_color; /* Color of the radar background. */ - RadarColor bbox_color; /* Color used to draw bboxes (debug). */ - Cursor cursor; /* Cursor displayed in radar window. */ - RadarBool draw_bboxes; /* Draw item's bboxes (debug). */ + ZnColor fore_color; /* Default foreground used in new items */ + ZnColor back_color; /* Color of the widget background. */ + ZnColor bbox_color; /* Color used to draw bboxes (debug). */ + Cursor cursor; /* Cursor displayed in zinc window. */ + ZnBool draw_bboxes; /* Draw item's bboxes (debug). */ int pick_aperture; /* size of pick aperture in pixels */ - RadarFont font; /* Default font used in new items */ - RadarBool reshape; /* Use the Shape Extension on the window.*/ - RadarBool full_reshape; /* Use it on the top level window. */ + ZnFont font; /* Default font used in new items */ + ZnBool reshape; /* Use the Shape Extension on the window.*/ + ZnBool full_reshape; /* Use it on the top level window. */ char *tile_name; - RadarImage tile; + ZnImage tile; - /* Radar private resources */ + /* Zinc private resources */ int width; /* Actual window dimension. */ int height; /* Graphic variables */ Display *dpy; /* The display of the widget window. */ Screen *screen; - RadarWindow win; /* The window of the widget. */ - RadarBool realized; + ZnWindow win; /* The window of the widget. */ + ZnBool realized; Pixmap draw_buffer; /* Pixmap for double buffering */ - RadarBBox damaged_area; /* The current damaged rectangle */ + ZnBBox damaged_area; /* The current damaged rectangle */ Region damaged_region; GC gc; - RadarBool has_x_shm; /* Tell if the SHM X11 ext is avail. */ - RadarBool has_x_shape; /* Tell if she Shape X ext. is avail. */ - RadarBool has_x_input; /* Tell if she X input ext. is avail. */ + ZnBool has_x_shm; /* Tell if the SHM X11 ext is avail. */ + ZnBool has_x_shape; /* Tell if she Shape X ext. is avail. */ + ZnBool has_x_input; /* Tell if she X input ext. is avail. */ int events_flags; /* NEED_REPICK et al */ Window real_top; Item top_group; - RadarList work_item_list; /* Temporary item list used in internal + ZnList work_item_list; /* Temporary item list used in internal * works. */ - RadarList work_pts; /* Temporary point list. */ + ZnList work_pts; /* Temporary point list. */ /* Perf measurement variables. */ - RadarBool monitoring; + ZnBool monitoring; int num_updates; int last_time; int total_time; diff --git a/generic/perfos.c b/generic/perfos.c index a96580e..1b88255 100644 --- a/generic/perfos.c +++ b/generic/perfos.c @@ -77,7 +77,7 @@ static const char rcsid[] = "$Id$"; #ifdef PERFOS -static RadarList Chronos = NULL; +static ZnList Chronos = NULL; /* ********************************************************************************** @@ -276,8 +276,8 @@ PrintChronos(void) int i, cnt; Chrono *chrs; - cnt = RadarListSize(Chronos); - chrs = (Chrono *) RadarListArray(Chronos); + cnt = ZnListSize(Chronos); + chrs = (Chrono *) ZnListArray(Chronos); for (i = 0; i < cnt; i++) { if (chrs[i]->actions != 0) { printf("%s : %d ms on %d times\n", @@ -302,8 +302,8 @@ RazChronos(void) int i, cnt; Chrono *chrs; - cnt = RadarListSize(Chronos); - chrs = (Chrono *) RadarListArray(Chronos); + cnt = ZnListSize(Chronos); + chrs = (Chrono *) ZnListArray(Chronos); for (i = 0; i < cnt; i++) { chrs[i]->actions = 0; chrs[i]->total_delay = 0; @@ -325,7 +325,7 @@ NewChrono(char *message) Chrono new; if (!Chronos) { - Chronos = RadarListNew(8, sizeof(Chrono)); + Chronos = ZnListNew(8, sizeof(Chrono)); } new = (Chrono) malloc(sizeof(ChronoRec)); @@ -333,7 +333,7 @@ NewChrono(char *message) new->total_delay = 0; new->message = message; - RadarListAdd(Chronos, &new, RadarListTail); + ZnListAdd(Chronos, &new, ZnListTail); return new; } @@ -350,7 +350,7 @@ FreeChrono(Chrono chrono) { free(chrono); - RadarListDelete(Chronos, RadarListHead, &chrono); + ZnListDelete(Chronos, ZnListHead, &chrono); } #endif /* PERFOS */ diff --git a/generic/tkZinc.c b/generic/tkZinc.c index eac81c6..5071330 100644 --- a/generic/tkZinc.c +++ b/generic/tkZinc.c @@ -1,5 +1,5 @@ /* - * tkRadar.c -- Radar widget for the Tk Toolkit. Main module. + * tkZinc.c -- Zinc widget for the Tk Toolkit. Main module. * * Authors : Patrick Lecoanet. * Creation date : Mon Feb 1 12:13:24 1999 @@ -43,7 +43,7 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ " #include "Geo.h" #include "Item.h" #include "WidgetInfo.h" -#include "tkRadar.h" +#include "tkZinc.h" #include "MapInfo.h" #include "patchlvl.h" #include "OverlapMan.h" @@ -67,8 +67,8 @@ typedef struct TagSearch { Item current; Item previous; /* Needed to detect changes in the linked * list between calls. */ - RadarList item_stack; - RadarBool over; + ZnList item_stack; + ZnBool over; } TagSearch; @@ -109,9 +109,9 @@ static unsigned char dither4x4[4][4] = { }; static unsigned char bitmaps[NUM_ALPHA_STEPS][8]; -static RadarBool inited = False; -static Tk_Uid all_uid; -static Tk_Uid current_uid; +static ZnBool inited = False; +static Tk_Uid all_uid; +static Tk_Uid current_uid; /* @@ -203,19 +203,19 @@ static int Configure _ANSI_ARGS_((Tcl_Interp *interp, WidgetInfo *wi, int argc, Arg *args, int flags)); static void Redisplay _ANSI_ARGS_((ClientData client_data)); static void Destroy _ANSI_ARGS_((char *mem_ptr)); -static void InitRadar _ANSI_ARGS_((Tcl_Interp *interp)); +static void InitZinc _ANSI_ARGS_((Tcl_Interp *interp)); /* *---------------------------------------------------------------------- * - * RadarGetAlphaStipple -- + * ZnGetAlphaStipple -- * Need to be handled per screen/dpy toolkit wide, not on a * widget basis. * *---------------------------------------------------------------------- */ Pixmap -RadarGetAlphaStipple(WidgetInfo *wi, +ZnGetAlphaStipple(WidgetInfo *wi, unsigned char val) { if (val >= 255) @@ -227,26 +227,26 @@ RadarGetAlphaStipple(WidgetInfo *wi, /* *---------------------------------------------------------------------- * - * RadarGetInactiveStipple -- + * ZnGetInactiveStipple -- * *---------------------------------------------------------------------- */ Pixmap -RadarGetInactiveStipple(WidgetInfo *wi) +ZnGetInactiveStipple(WidgetInfo *wi) { - return RadarGetAlphaStipple(wi, 128); + return ZnGetAlphaStipple(wi, 128); } /* *---------------------------------------------------------------------- * - * RadarNeedRedisplay -- + * ZnNeedRedisplay -- * *---------------------------------------------------------------------- */ void -RadarNeedRedisplay(WidgetInfo *wi) +ZnNeedRedisplay(WidgetInfo *wi) { if (!wi->update_pending) { /*printf("scheduling an update\n");*/ @@ -259,20 +259,20 @@ RadarNeedRedisplay(WidgetInfo *wi) /* *---------------------------------------------------------------------- * - * RadarCmd -- + * ZincCmd -- * - * This procedure is invoked to process the "radar" Tcl - * command. It creates a new "radar" widget. + * This procedure is invoked to process the "zinc" Tcl + * command. It creates a new "zinc" widget. * *---------------------------------------------------------------------- */ int -RadarCmd(ClientData client_data, /* Main window associated with +ZincCmd(ClientData client_data, /* Main window associated with * interpreter. */ - Tcl_Interp *interp, /* Current interpreter. */ - int argc, /* Number of arguments. */ - Arg *args) /* Argument strings. */ + Tcl_Interp *interp, /* Current interpreter. */ + int argc, /* Number of arguments. */ + Arg *args) /* Argument strings. */ { Tk_Window main = (Tk_Window) client_data; WidgetInfo *wi; @@ -281,29 +281,29 @@ RadarCmd(ClientData client_data, /* Main window associated with int major_op, first_err, first_evt; if (!inited) { - InitRadar(interp); + InitZinc(interp); } if (argc == 1) { - Tcl_AppendResult(interp, XRADARVERSION, NULL); + Tcl_AppendResult(interp, ZINCVERSION, NULL); return TCL_OK; } if (argc < 2) { Tcl_AppendResult(interp, "wrong # args: should be \"", LangString(args[0]), " pathName ?options?\"", NULL); - return RADAR_ERROR; + return ZN_ERROR; } tkwin = Tk_CreateWindowFromPath(interp, main, LangString(args[1]), NULL); if (tkwin == NULL) { - return RADAR_ERROR; + return ZN_ERROR; } - Tk_SetClass(tkwin, "Radar"); + Tk_SetClass(tkwin, "Zinc"); /* * Allocate and initialize the widget record. */ - wi = (WidgetInfo *) RadarMalloc(sizeof(WidgetInfo)); + wi = (WidgetInfo *) ZnMalloc(sizeof(WidgetInfo)); wi->win = tkwin; wi->interp = interp; wi->dpy = Tk_Display(tkwin); @@ -347,16 +347,16 @@ RadarCmd(ClientData client_data, /* Main window associated with wi->track_manage_history = False; wi->track_managed_history_size = 0; wi->speed_vector_length = 0; - wi->tile = RadarUnspecifiedImage; + wi->tile = ZnUnspecifiedImage; wi->tile_name = ""; - wi->tag_table = (Tcl_HashTable *) RadarMalloc(sizeof(Tcl_HashTable)); + wi->tag_table = (Tcl_HashTable *) ZnMalloc(sizeof(Tcl_HashTable)); Tcl_InitHashTable(wi->tag_table, TCL_ONE_WORD_KEYS); - wi->id_table = (Tcl_HashTable *) RadarMalloc(sizeof(Tcl_HashTable)); + wi->id_table = (Tcl_HashTable *) ZnMalloc(sizeof(Tcl_HashTable)); Tcl_InitHashTable(wi->id_table, TCL_ONE_WORD_KEYS); - wi->t_table = (Tcl_HashTable *) RadarMalloc(sizeof(Tcl_HashTable)); + wi->t_table = (Tcl_HashTable *) ZnMalloc(sizeof(Tcl_HashTable)); Tcl_InitHashTable(wi->t_table, TCL_ONE_WORD_KEYS); wi->obj_id = 1; - wi->top_group = ITEM_P.CreateItem(wi, RadarGroup, 0, NULL); + wi->top_group = ITEM_P.CreateItem(wi, ZnGroup, 0, NULL); #ifdef OM wi->om_group_id = 0; wi->om_group = wi->top_group; @@ -366,7 +366,7 @@ RadarCmd(ClientData client_data, /* Main window associated with wi->draw_buffer = 0; wi->events_flags = 0; wi->pick_aperture = 0; - wi->new_item = wi->current_item = RADAR_NO_ITEM; + wi->new_item = wi->current_item = ZN_NO_ITEM; wi->new_part = wi->current_part = 0; wi->monitoring = False; @@ -374,11 +374,11 @@ RadarCmd(ClientData client_data, /* Main window associated with wi->last_time = wi->total_time = 0; wi->work_item_list = NULL; - wi->work_pts = RadarListNew(8, sizeof(RadarPoint)); + wi->work_pts = ZnListNew(8, sizeof(ZnPoint)); - wi->clip_stack = RadarListNew(8, sizeof(ClipState)); + wi->clip_stack = ZnListNew(8, sizeof(ClipState)); ITEM_P.ResetClipStack(wi); - wi->transfo_stack = RadarListNew(8, sizeof(RadarTransfo)); + wi->transfo_stack = ZnListNew(8, sizeof(ZnTransfo)); ITEM_P.ResetTransformStack(wi); for (num = 0; num < NUM_ALPHA_STEPS; num++) { @@ -398,7 +398,7 @@ RadarCmd(ClientData client_data, /* Main window associated with if (Configure(interp, wi, argc-2, args+2, 0) != TCL_OK) { Tk_DestroyWindow(tkwin); - return RADAR_ERROR; + return ZN_ERROR; } ResetBBox(&wi->exposed_area); @@ -445,7 +445,7 @@ EncodeItemPart(Item item, field_set = item->class->GetFieldSet(item); return (ClientData) (((char *) field_set->fields)+(part%field_set->num_fields)); } - else if (part == RADAR_NO_PART) { + else if (part == ZN_NO_PART) { return item; } return (ClientData) (((char *) item)-part); @@ -455,12 +455,12 @@ EncodeItemPart(Item item, /* *---------------------------------------------------------------------- * - * RadarSearchWithTagOrId - * RadarNextWithTagOrId -- + * ZnSearchWithTagOrId + * ZnNextWithTagOrId -- * * These two functions implement an alternative way for * collecting items that match a tag or id. It has to - * be used instead of RadarItemsWithTagOrId when it is + * be used instead of ZnItemsWithTagOrId when it is * mandatory for the returned items to be sorted in display * list order. * @@ -470,35 +470,35 @@ EncodeItemPart(Item item, * NOTE: * These routines are a temporary solution primarily used in * raise and lower. It should be eventually replaced by a solution - * involving only RadarItemsWithTagOrId. Especially when we'll + * involving only ZnItemsWithTagOrId. Especially when we'll * be about to implement expressions with tags (&& || ^ !, etc). * May be the best way is to sort the resulting list after * query and selection. Need to investigate how this will be * done. * Or may be it should be the other way round, discards - * RadarItemsWithTagOrId and the tag table altogether. It + * ZnItemsWithTagOrId and the tag table altogether. It * depends on the cost of the various operations. * *---------------------------------------------------------------------- */ static Item -RadarSearchWithTagOrId(WidgetInfo *wi, - char *tag, - Item group, - TagSearch *tag_search) +ZnSearchWithTagOrId(WidgetInfo *wi, + char *tag, + Item group, + TagSearch *tag_search) { Tk_Uid uid, *tags; int id, i, num_tags; char *end; Tcl_HashEntry *entry; - Item item = RADAR_NO_ITEM; + Item item = ZN_NO_ITEM; /* * First init the search iterator. */ tag_search->wi = wi; tag_search->over = False; - tag_search->item_stack = RadarListNew(16, sizeof(Item)); + tag_search->item_stack = ZnListNew(16, sizeof(Item)); tag_search->group = (GroupItem) group; /* @@ -522,16 +522,16 @@ RadarSearchWithTagOrId(WidgetInfo *wi, tag_search->tag = uid = Tk_GetUid(tag); if (uid == all_uid) { tag_search->current = tag_search->group->head; - tag_search->previous = RADAR_NO_ITEM; + tag_search->previous = ZN_NO_ITEM; return tag_search->current; } item = tag_search->group->head; do { - while (item != RADAR_NO_ITEM) { + while (item != ZN_NO_ITEM) { if (item->tags) { - tags = (Tk_Uid *) RadarListArray(item->tags); - num_tags = RadarListSize(item->tags); + tags = (Tk_Uid *) ZnListArray(item->tags); + num_tags = ZnListSize(item->tags); for (i = 0; i < num_tags; i++, tags++) { if (*tags == uid) { tag_search->current = item; @@ -540,48 +540,48 @@ RadarSearchWithTagOrId(WidgetInfo *wi, } } } - if (item->class == RadarGroup) { + if (item->class == ZnGroup) { /* * Explore the hierarchy depth first using the item stack * to save the current node. */ - /*printf("RadarSearchWithTagOrId diving for tag\n");*/ + /*printf("ZnSearchWithTagOrId diving for tag\n");*/ tag_search->group = (GroupItem) item; item = item->next; - RadarListAdd(tag_search->item_stack, &item, RadarListTail); + ZnListAdd(tag_search->item_stack, &item, ZnListTail); item = tag_search->group->head; } else { item = item->next; } } - /*printf("RadarSearchWithTagOrId backup for tag\n");*/ - while ((item == RADAR_NO_ITEM) && RadarListSize(tag_search->item_stack)) { - item = *(Item *) RadarListAt(tag_search->item_stack, RadarListTail); - RadarListDelete(tag_search->item_stack, RadarListTail); + /*printf("ZnSearchWithTagOrId backup for tag\n");*/ + while ((item == ZN_NO_ITEM) && ZnListSize(tag_search->item_stack)) { + item = *(Item *) ZnListAt(tag_search->item_stack, ZnListTail); + ZnListDelete(tag_search->item_stack, ZnListTail); } - if (item != RADAR_NO_ITEM) { + if (item != ZN_NO_ITEM) { tag_search->group = (GroupItem) item->parent; } - } while (item != RADAR_NO_ITEM); + } while (item != ZN_NO_ITEM); tag_search->over = True; - RadarListFree(tag_search->item_stack); + ZnListFree(tag_search->item_stack); return NULL; } static Item -RadarNextWithTagOrId(TagSearch *tag_search) +ZnNextWithTagOrId(TagSearch *tag_search) { Item item, previous; Tk_Uid uid, *tags; int i, num_tags; if (tag_search->over) { - return RADAR_NO_ITEM; + return ZN_NO_ITEM; } previous = tag_search->previous; - if (previous == RADAR_NO_ITEM) { + if (previous == ZN_NO_ITEM) { item = tag_search->group->head; } else { @@ -598,17 +598,17 @@ RadarNextWithTagOrId(TagSearch *tag_search) */ } - else if (item->class == RadarGroup){ + else if (item->class == ZnGroup){ /* * Explore the hierarchy depth first using the item stack * to save the current node. */ tag_search->group = (GroupItem) item; item = item->next; - /*printf("RadarNextWithTagOrId diving for all, pushing %d\n", + /*printf("ZnNextWithTagOrId diving for all, pushing %d\n", item?item->id:0);*/ - RadarListAdd(tag_search->item_stack, &item, RadarListTail); - previous = RADAR_NO_ITEM; + ZnListAdd(tag_search->item_stack, &item, ZnListTail); + previous = ZN_NO_ITEM; item = tag_search->group->head; } else { @@ -616,19 +616,19 @@ RadarNextWithTagOrId(TagSearch *tag_search) item = previous->next; } - if (item == RADAR_NO_ITEM) { - /*printf("RadarNextWithTagOrId backup for all\n");*/ - while ((item == RADAR_NO_ITEM) && RadarListSize(tag_search->item_stack)) { + if (item == ZN_NO_ITEM) { + /*printf("ZnNextWithTagOrId backup for all\n");*/ + while ((item == ZN_NO_ITEM) && ZnListSize(tag_search->item_stack)) { /* * End of list at this level, back up one level. */ - item = *(Item *) RadarListAt(tag_search->item_stack, RadarListTail); - RadarListDelete(tag_search->item_stack, RadarListTail); + item = *(Item *) ZnListAt(tag_search->item_stack, ZnListTail); + ZnListDelete(tag_search->item_stack, ZnListTail); } - if (item != RADAR_NO_ITEM) { + if (item != ZN_NO_ITEM) { tag_search->group = (GroupItem) item->parent; previous = item->previous; - /*printf("RadarNextWithTagOrId popping %d, previous %d, next %d\n", + /*printf("ZnNextWithTagOrId popping %d, previous %d, next %d\n", item->id, (item->previous)?item->previous->id:0, (item->next)?item->next->id:0);*/ } @@ -637,8 +637,8 @@ RadarNextWithTagOrId(TagSearch *tag_search) * Or finish the search if at top. */ tag_search->over = True; - RadarListFree(tag_search->item_stack); - return RADAR_NO_ITEM; + ZnListFree(tag_search->item_stack); + return ZN_NO_ITEM; } } @@ -649,7 +649,7 @@ RadarNextWithTagOrId(TagSearch *tag_search) if (uid == all_uid) { tag_search->previous = previous; tag_search->current = item; - /*printf("RadarNextWithTagOrId returning %d\n", item->id);*/ + /*printf("ZnNextWithTagOrId returning %d\n", item->id);*/ return item; } @@ -657,10 +657,10 @@ RadarNextWithTagOrId(TagSearch *tag_search) * Now, look for the requested tag in an item. */ do { - while (item != RADAR_NO_ITEM) { + while (item != ZN_NO_ITEM) { if (item->tags) { - tags = (Tk_Uid *) RadarListArray(item->tags); - num_tags = RadarListSize(item->tags); + tags = (Tk_Uid *) ZnListArray(item->tags); + num_tags = ZnListSize(item->tags); for (i = 0; i < num_tags; i++, tags++) { if (*tags == uid) { tag_search->current = item; @@ -669,45 +669,45 @@ RadarNextWithTagOrId(TagSearch *tag_search) } } } - if (item->class == RadarGroup) { + if (item->class == ZnGroup) { /* * Explore the hierarchy depth first using the item stack * to save the current node. */ - /*printf("RadarNextWithTagOrId diving for tag\n");*/ + /*printf("ZnNextWithTagOrId diving for tag\n");*/ tag_search->group = (GroupItem) item; item = item->next; - RadarListAdd(tag_search->item_stack, &item, RadarListTail); + ZnListAdd(tag_search->item_stack, &item, ZnListTail); item = tag_search->group->head; } else { item = item->next; } } - /*printf("RadarNextWithTagOrId backup for tag\n");*/ - while ((item == RADAR_NO_ITEM) && RadarListSize(tag_search->item_stack)) { - item = *(Item *) RadarListAt(tag_search->item_stack, RadarListTail); - RadarListDelete(tag_search->item_stack, RadarListTail); + /*printf("ZnNextWithTagOrId backup for tag\n");*/ + while ((item == ZN_NO_ITEM) && ZnListSize(tag_search->item_stack)) { + item = *(Item *) ZnListAt(tag_search->item_stack, ZnListTail); + ZnListDelete(tag_search->item_stack, ZnListTail); } - if (item != RADAR_NO_ITEM) { + if (item != ZN_NO_ITEM) { tag_search->group = (GroupItem) item->parent; } - } while (item != RADAR_NO_ITEM); + } while (item != ZN_NO_ITEM); /* * Out of fuel. */ tag_search->over = True; - RadarListFree(tag_search->item_stack); - return RADAR_NO_ITEM; + ZnListFree(tag_search->item_stack); + return ZN_NO_ITEM; } void -RadarDoneWithSearch(TagSearch *tag_search) +ZnDoneWithSearch(TagSearch *tag_search) { if (!tag_search->over) { tag_search->over = True; - RadarListFree(tag_search->item_stack); + ZnListFree(tag_search->item_stack); } } @@ -715,7 +715,7 @@ RadarDoneWithSearch(TagSearch *tag_search) /* *---------------------------------------------------------------------- * - * RadarItemsWithTagOrId -- + * ZnItemsWithTagOrId -- * * Collect the item(s) with the given tag or id. The function * return the the first item matched in item and the whole @@ -731,16 +731,16 @@ RadarDoneWithSearch(TagSearch *tag_search) *---------------------------------------------------------------------- */ int -RadarItemsWithTagOrId(WidgetInfo *wi, - char *tag_or_id, - Item *item, - Item **item_list) +ZnItemsWithTagOrId(WidgetInfo *wi, + char *tag_or_id, + Item *item, + Item **item_list) { unsigned long id; char *end; Tcl_HashEntry *entry; Tk_Uid tag_uid; - RadarList items; + ZnList items; int num_items; if (isdigit(*tag_or_id)) { @@ -767,7 +767,7 @@ RadarItemsWithTagOrId(WidgetInfo *wi, /* * If it is 'all' then build a list of all the items - * in the radar display list. + * in the display list. * BE CAREFUL this won't work recursively !! A tag * search for 'all' can't be started if the result * of a previous one is still in use in the same widget. @@ -777,22 +777,22 @@ RadarItemsWithTagOrId(WidgetInfo *wi, TagSearch ts; if (wi->work_item_list) { - RadarListEmpty(wi->work_item_list); + ZnListEmpty(wi->work_item_list); } else { - wi->work_item_list = RadarListNew(128, sizeof(Item)); + wi->work_item_list = ZnListNew(128, sizeof(Item)); } - for (current = RadarSearchWithTagOrId(wi, all_uid, wi->top_group, &ts); - current != NULL; current = RadarNextWithTagOrId(&ts)) { - RadarListAdd(wi->work_item_list, ¤t, RadarListTail); + for (current = ZnSearchWithTagOrId(wi, all_uid, wi->top_group, &ts); + current != NULL; current = ZnNextWithTagOrId(&ts)) { + ZnListAdd(wi->work_item_list, ¤t, ZnListTail); } - if (RadarListSize(wi->work_item_list) != 0) { - *item = *((Item *) RadarListAt(wi->work_item_list, 0)); + if (ZnListSize(wi->work_item_list) != 0) { + *item = *((Item *) ZnListAt(wi->work_item_list, 0)); if (item_list) { - *item_list = (Item *) RadarListArray(wi->work_item_list); + *item_list = (Item *) ZnListArray(wi->work_item_list); } } - return RadarListSize(wi->work_item_list); + return ZnListSize(wi->work_item_list); } /* @@ -800,15 +800,15 @@ RadarItemsWithTagOrId(WidgetInfo *wi, */ entry = Tcl_FindHashEntry(wi->tag_table, tag_uid); if (entry) { - items = (RadarList) Tcl_GetHashValue(entry); - num_items = RadarListSize(items); + items = (ZnList) Tcl_GetHashValue(entry); + num_items = ZnListSize(items); if (num_items) { if (item_list) { - *item_list = (Item *) RadarListArray(items); + *item_list = (Item *) ZnListArray(items); *item = (*item_list)[0]; } else { - *item = *((Item *) RadarListAt(items, 0)); + *item = *((Item *) ZnListAt(items, 0)); } } return num_items; @@ -843,7 +843,7 @@ DoItem(Tcl_Interp *interp, char msg[INTEGER_SPACE]; sprintf(msg, "%d", item->id); Tcl_AppendElement(interp, msg); - if (part != RADAR_NO_PART) { + if (part != ZN_NO_PART) { sprintf(msg, "%d", part); Tcl_AppendElement(interp, msg); } @@ -864,15 +864,15 @@ DoItem(Tcl_Interp *interp, * *---------------------------------------------------------------------- */ -static RadarBool +static ZnBool IsHeirOf(Item item, Item group) { - while ((item != RADAR_NO_ITEM) && (item->parent != group)) { + while ((item != ZN_NO_ITEM) && (item->parent != group)) { item = item->parent; } - return (item != RADAR_NO_ITEM); + return (item != ZN_NO_ITEM); } @@ -881,14 +881,14 @@ IsHeirOf(Item item, * * FindArea -- * Search the items that are enclosed or overlapping a given - * area of the radar. It is used by FindItems. + * 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 RADAR_ERROR is returned. + * and ZN_ERROR is returned. * *---------------------------------------------------------------------- */ @@ -900,20 +900,20 @@ FindArea(Tcl_Interp *interp, Item group, int enclosed) { - RadarPos pos; - RadarBBox area; + ZnPos pos; + ZnBBox area; - if (Tcl_GetDouble(interp, args[0], &area.orig.x) == RADAR_ERROR) { - return RADAR_ERROR; + if (Tcl_GetDouble(interp, args[0], &area.orig.x) == ZN_ERROR) { + return ZN_ERROR; } - if (Tcl_GetDouble(interp, args[1], &area.orig.y) == RADAR_ERROR) { - return RADAR_ERROR; + if (Tcl_GetDouble(interp, args[1], &area.orig.y) == ZN_ERROR) { + return ZN_ERROR; } - if (Tcl_GetDouble(interp, args[2], &area.corner.x) == RADAR_ERROR) { - return RADAR_ERROR; + if (Tcl_GetDouble(interp, args[2], &area.corner.x) == ZN_ERROR) { + return ZN_ERROR; } - if (Tcl_GetDouble(interp, args[3], &area.corner.y) == RADAR_ERROR) { - return RADAR_ERROR; + if (Tcl_GetDouble(interp, args[3], &area.corner.y) == ZN_ERROR) { + return ZN_ERROR; } if (area.corner.x < area.orig.x) { pos = area.orig.x; @@ -937,7 +937,7 @@ FindArea(Tcl_Interp *interp, */ wi->top_group->class->ToArea(wi->top_group, &area, tag_uid, enclosed, False); - return RADAR_OK; + return ZN_OK; } @@ -985,17 +985,17 @@ FindItems(Tcl_Interp *interp, if ((argc != 2) && (argc != 3)) { Tcl_AppendResult(interp, "wrong # args: should be \"", cmd_name, option, " above tagOrId ?inGroup?", NULL); - return RADAR_ERROR; + return ZN_ERROR; } if (argc == 3) { - num_items = RadarItemsWithTagOrId(wi, LangString(args[2]), &group, NULL); - if ((num_items == 0) || (group->class != RadarGroup)) { - return RADAR_ERROR; + num_items = ZnItemsWithTagOrId(wi, LangString(args[2]), &group, NULL); + if ((num_items == 0) || (group->class != ZnGroup)) { + return ZN_ERROR; } } - item = RadarSearchWithTagOrId(wi, LangString(args[1]), group, &ts); - if ((item != RADAR_NO_ITEM) && (item->previous != RADAR_NO_ITEM)) { - DoItem(interp, item->previous, RADAR_NO_PART, tag_uid); + item = ZnSearchWithTagOrId(wi, LangString(args[1]), group, &ts); + if ((item != ZN_NO_ITEM) && (item->previous != ZN_NO_ITEM)) { + DoItem(interp, item->previous, ZN_NO_PART, tag_uid); } } @@ -1006,12 +1006,12 @@ FindItems(Tcl_Interp *interp, if ((argc != 1) && (argc != 2)) { Tcl_AppendResult(interp, "wrong # args: should be \"", cmd_name, option, " all ?inGroup?", NULL); - return RADAR_ERROR; + return ZN_ERROR; } if (argc == 2) { - num_items = RadarItemsWithTagOrId(wi, LangString(args[1]), &group, NULL); - if ((num_items == 0) || (group->class != RadarGroup)) { - return RADAR_ERROR; + num_items = ZnItemsWithTagOrId(wi, LangString(args[1]), &group, NULL); + if ((num_items == 0) || (group->class != ZnGroup)) { + return ZN_ERROR; } } @@ -1019,9 +1019,9 @@ FindItems(Tcl_Interp *interp, * Go through the item list and collect all item ids. They * are sorted from most visible to least visible. */ - for (item = RadarSearchWithTagOrId(wi, all_uid, group, &ts); - item != RADAR_NO_ITEM; item = RadarNextWithTagOrId(&ts)) { - DoItem(interp, item, RADAR_NO_PART, tag_uid); + for (item = ZnSearchWithTagOrId(wi, all_uid, group, &ts); + item != ZN_NO_ITEM; item = ZnNextWithTagOrId(&ts)) { + DoItem(interp, item, ZN_NO_PART, tag_uid); } } @@ -1030,34 +1030,34 @@ FindItems(Tcl_Interp *interp, */ else if ((c == 'a') && (strncmp(LangString(args[0]), "atpoint", length) == 0)) { int halo = 1; - RadarPoint p; - int part = RADAR_NO_PART; - Item start_item = RADAR_NO_ITEM; + ZnPoint p; + int part = ZN_NO_PART; + Item start_item = ZN_NO_ITEM; if ((argc < 3) || (argc > 5)) { Tcl_AppendResult(interp, "wrong # args: should be \"", cmd_name, option, " atpoint x y ?halo? ?start?", NULL); - return RADAR_ERROR; + return ZN_ERROR; } - if (Tcl_GetDouble(interp, args[1], &p.x) == RADAR_ERROR) { - return RADAR_ERROR; + if (Tcl_GetDouble(interp, args[1], &p.x) == ZN_ERROR) { + return ZN_ERROR; } - if (Tcl_GetDouble(interp, args[2], &p.y) == RADAR_ERROR) { - return RADAR_ERROR; + if (Tcl_GetDouble(interp, args[2], &p.y) == ZN_ERROR) { + return ZN_ERROR; } p.x -= wi->border_width; p.y -= wi->border_width; if (argc > 3) { - if (Tcl_GetInt(interp, args[3], &halo) == RADAR_ERROR) { - return RADAR_ERROR; + if (Tcl_GetInt(interp, args[3], &halo) == ZN_ERROR) { + return ZN_ERROR; } if (halo < 0) { halo = 0; } } if (argc > 4) { - start_item = RadarSearchWithTagOrId(wi, LangString(args[4]), group, &ts); - if (start_item != RADAR_NO_ITEM) { + start_item = ZnSearchWithTagOrId(wi, LangString(args[4]), group, &ts); + if (start_item != ZN_NO_ITEM) { start_item = start_item->next; } } @@ -1070,7 +1070,7 @@ FindItems(Tcl_Interp *interp, */ wi->top_group->class->Pick(wi->top_group, &p, start_item, halo, &item, &part); - if (item != RADAR_NO_ITEM) { + if (item != ZN_NO_ITEM) { DoItem(interp, item, part, tag_uid); /*printf("first %d %d\n", item->id, part);*/ return TCL_OK; @@ -1086,15 +1086,15 @@ FindItems(Tcl_Interp *interp, if ((argc != 2) && (argc != 3)) { Tcl_AppendResult(interp, "wrong # args: should be \"", cmd_name, option, " atpriority pri ?inGroup?", NULL); - return RADAR_ERROR; + return ZN_ERROR; } - if (Tcl_GetInt(interp, args[1], &pri) == RADAR_ERROR) { - return RADAR_ERROR; + if (Tcl_GetInt(interp, args[1], &pri) == ZN_ERROR) { + return ZN_ERROR; } if (argc == 3) { - num_items = RadarItemsWithTagOrId(wi, LangString(args[2]), &group, NULL); - if ((num_items == 0) || (group->class != RadarGroup)) { - return RADAR_ERROR; + num_items = ZnItemsWithTagOrId(wi, LangString(args[2]), &group, NULL); + if ((num_items == 0) || (group->class != ZnGroup)) { + return ZN_ERROR; } } @@ -1102,10 +1102,10 @@ FindItems(Tcl_Interp *interp, * Go through the item table and collect all items with * the given priority. */ - for (item = RadarSearchWithTagOrId(wi, all_uid, group, &ts); - item != RADAR_NO_ITEM; item = RadarNextWithTagOrId(&ts)) { + for (item = ZnSearchWithTagOrId(wi, all_uid, group, &ts); + item != ZN_NO_ITEM; item = ZnNextWithTagOrId(&ts)) { if (item->priority == pri) { - DoItem(interp, item, RADAR_NO_PART, tag_uid); + DoItem(interp, item, ZN_NO_PART, tag_uid); } } } @@ -1119,21 +1119,21 @@ FindItems(Tcl_Interp *interp, if ((argc != 2) && (argc != 3)) { Tcl_AppendResult(interp, "wrong # args: should be \"", cmd_name, option, " below tagOrId $inGroup?", NULL); - return RADAR_ERROR; + return ZN_ERROR; } if (argc == 3) { - num_items = RadarItemsWithTagOrId(wi, LangString(args[2]), &group, NULL); - if ((num_items == 0) || (group->class != RadarGroup)) { - return RADAR_ERROR; + num_items = ZnItemsWithTagOrId(wi, LangString(args[2]), &group, NULL); + if ((num_items == 0) || (group->class != ZnGroup)) { + return ZN_ERROR; } } - item = RADAR_NO_ITEM; - for (next = RadarSearchWithTagOrId(wi, LangString(args[1]), group, &ts); - next != RADAR_NO_ITEM; item = RadarNextWithTagOrId(&ts)) { + item = ZN_NO_ITEM; + for (next = ZnSearchWithTagOrId(wi, LangString(args[1]), group, &ts); + next != ZN_NO_ITEM; item = ZnNextWithTagOrId(&ts)) { item = next; } - if ((item != RADAR_NO_ITEM) && (item->next != RADAR_NO_ITEM)) { - DoItem(interp, item->next, RADAR_NO_PART, tag_uid); + if ((item != ZN_NO_ITEM) && (item->next != ZN_NO_ITEM)) { + DoItem(interp, item->next, ZN_NO_PART, tag_uid); } } @@ -1144,12 +1144,12 @@ FindItems(Tcl_Interp *interp, if ((argc != 5) && (argc != 6)) { Tcl_AppendResult(interp, "wrong # args: should be \"", cmd_name, option, " enclosed x1 y1 x2 y2 ?inGroup?", NULL); - return RADAR_ERROR; + return ZN_ERROR; } if (argc == 6) { - num_items = RadarItemsWithTagOrId(wi, LangString(args[5]), &group, NULL); - if ((num_items == 0) || (group->class != RadarGroup)) { - return RADAR_ERROR; + num_items = ZnItemsWithTagOrId(wi, LangString(args[5]), &group, NULL); + if ((num_items == 0) || (group->class != ZnGroup)) { + return ZN_ERROR; } } return FindArea(interp, wi, args+1, tag_uid, group, True); @@ -1162,12 +1162,12 @@ FindItems(Tcl_Interp *interp, if ((argc != 5) && (argc != 6)) { Tcl_AppendResult(interp, "wrong # args: should be \"", cmd_name, option, " overlapping x1 y1 x2 y2 ?inGroup?", NULL); - return RADAR_ERROR; + return ZN_ERROR; } if (argc == 6) { - num_items = RadarItemsWithTagOrId(wi, LangString(args[5]), &group, NULL); - if ((num_items == 0) || (group->class != RadarGroup)) { - return RADAR_ERROR; + num_items = ZnItemsWithTagOrId(wi, LangString(args[5]), &group, NULL); + if ((num_items == 0) || (group->class != ZnGroup)) { + return ZN_ERROR; } } return FindArea(interp, wi, args+1, tag_uid, group, False); @@ -1183,21 +1183,21 @@ FindItems(Tcl_Interp *interp, if ((argc != 2) && (argc != 3)) { Tcl_AppendResult(interp, "wrong # args: should be \"", cmd_name, option, " withtag tagOrId ?inGroup?", NULL); - return RADAR_ERROR; + return ZN_ERROR; } if (argc == 3) { - num_items = RadarItemsWithTagOrId(wi, LangString(args[2]), &group, NULL); - if ((num_items == 0) || (group->class != RadarGroup)) { - return RADAR_ERROR; + num_items = ZnItemsWithTagOrId(wi, LangString(args[2]), &group, NULL); + if ((num_items == 0) || (group->class != ZnGroup)) { + return ZN_ERROR; } } - num_items = RadarItemsWithTagOrId(wi, LangString(args[1]), &item, &items); + num_items = ZnItemsWithTagOrId(wi, LangString(args[1]), &item, &items); if (num_items == 0) { - return RADAR_ERROR; + return ZN_ERROR; } for (i = 0; i < num_items; i++) { if (IsHeirOf(items[i], group)) { - DoItem(interp, items[i], RADAR_NO_PART, tag_uid); + DoItem(interp, items[i], ZN_NO_PART, tag_uid); } } } @@ -1211,18 +1211,18 @@ FindItems(Tcl_Interp *interp, if ((argc != 2) && (argc != 3)) { Tcl_AppendResult(interp, "wrong # args: should be \"", cmd_name, option, " withtype itemType ?inGroup?", NULL); - return RADAR_ERROR; + return ZN_ERROR; } cls = (ItemClass) ITEM_P.LookupItemClass(LangString(args[1])); if (!cls) { Tcl_AppendResult(interp, "unknown item type \"", LangString(args[1]), "\"", NULL); - return RADAR_ERROR; + return ZN_ERROR; } if (argc == 3) { - num_items = RadarItemsWithTagOrId(wi, LangString(args[2]), &group, NULL); - if ((num_items == 0) || (group->class != RadarGroup)) { - return RADAR_ERROR; + num_items = ZnItemsWithTagOrId(wi, LangString(args[2]), &group, NULL); + if ((num_items == 0) || (group->class != ZnGroup)) { + return ZN_ERROR; } } @@ -1230,10 +1230,10 @@ FindItems(Tcl_Interp *interp, * Go through the item table and collect all items with * the given item type. */ - for (item = RadarSearchWithTagOrId(wi, all_uid, group, &ts); - item != RADAR_NO_ITEM; item = RadarNextWithTagOrId(&ts)) { + for (item = ZnSearchWithTagOrId(wi, all_uid, group, &ts); + item != ZN_NO_ITEM; item = ZnNextWithTagOrId(&ts)) { if (item->class == cls) { - DoItem(interp, item, RADAR_NO_PART, tag_uid); + DoItem(interp, item, ZN_NO_PART, tag_uid); } } } @@ -1241,7 +1241,7 @@ FindItems(Tcl_Interp *interp, Tcl_AppendResult(interp, "bad search command \"", LangString(args[0]), "\": must be above, all, atpoint, atpriority, below, " "enclosed, overlapping, withtag or withtype", NULL); - return RADAR_ERROR; + return ZN_ERROR; } return TCL_OK; @@ -1258,18 +1258,18 @@ FindItems(Tcl_Interp *interp, int ParseCoordList(WidgetInfo *wi, Arg arg, - RadarPoint **pts, + ZnPoint **pts, int *num_pts) { Arg *elems; int i, result, num_elems; - RadarPoint *p; + ZnPoint *p; #ifdef PTK LangFreeProc *freeProc = NULL; #endif result = Lang_SplitList(wi->interp, arg, &num_elems, &elems, &freeProc); - if ((result == RADAR_ERROR) || ((num_elems%2) != 0)) { + if ((result == ZN_ERROR) || ((num_elems%2) != 0)) { coord_error: #ifdef PTK if (elems != NULL && freeProc) { @@ -1277,21 +1277,21 @@ ParseCoordList(WidgetInfo *wi, } #endif Tcl_AppendResult(wi->interp, " malformed coord list", NULL); - return RADAR_ERROR; + return ZN_ERROR; } *num_pts = num_elems/2; - RadarListAssertSize(wi->work_pts, *num_pts); - *pts = p = (RadarPoint *) RadarListArray(wi->work_pts); + ZnListAssertSize(wi->work_pts, *num_pts); + *pts = p = (ZnPoint *) ZnListArray(wi->work_pts); for (i = 0; i < num_elems; i += 2, p++) { - if (Tcl_GetDouble(wi->interp, elems[i], &p->x) == RADAR_ERROR) { + if (Tcl_GetDouble(wi->interp, elems[i], &p->x) == ZN_ERROR) { coord_error2: #ifndef PTK Tcl_Free((char *) elems); #endif goto coord_error; } - if (Tcl_GetDouble(wi->interp, elems[i+1], &p->y) == RADAR_ERROR) { + if (Tcl_GetDouble(wi->interp, elems[i+1], &p->y) == ZN_ERROR) { goto coord_error2; } } @@ -1303,7 +1303,7 @@ ParseCoordList(WidgetInfo *wi, } #endif - return RADAR_OK; + return ZN_OK; } @@ -1319,7 +1319,7 @@ Coords(WidgetInfo *wi, int argc, Arg *args) { - RadarPoint *points; + ZnPoint *points; Item item; int num_points, num = 0, i; int cmd = COORDS_READ; @@ -1327,16 +1327,16 @@ Coords(WidgetInfo *wi, char *end, c; char msg[INTEGER_SPACE]; - num = RadarItemsWithTagOrId(wi, LangString(args[2]), &item, NULL); + num = ZnItemsWithTagOrId(wi, LangString(args[2]), &item, NULL); if (num == 0) { - return RADAR_ERROR; + return ZN_ERROR; } num_points = 0; if (argc == 3) { /* Get all coords. */ cmd = COORDS_READ_ALL; - if (item->class->Coords(item, 0, cmd, &points, &num_points) == RADAR_ERROR) { - return RADAR_ERROR; + if (item->class->Coords(item, 0, cmd, &points, &num_points) == ZN_ERROR) { + return ZN_ERROR; } for (i = 0; i < num_points; i++, points++) { sprintf(msg, "%g", points->x); @@ -1344,7 +1344,7 @@ Coords(WidgetInfo *wi, sprintf(msg, "%g", points->y); Tcl_AppendElement(wi->interp, msg); } - return RADAR_OK; + return ZN_OK; } i = 3; @@ -1353,7 +1353,7 @@ Coords(WidgetInfo *wi, if ((argc != 5) && (argc != 6)) { Tcl_AppendResult(wi->interp, "wrong # args: should be \"", LangString(args[0]), "\" coords tagOrId add ?index? coordList", NULL); - return RADAR_ERROR; + return ZN_ERROR; } cmd = COORDS_ADD; i++; @@ -1362,7 +1362,7 @@ Coords(WidgetInfo *wi, if (argc != 5) { Tcl_AppendResult(wi->interp, "wrong # args: should be \"", LangString(args[0]), "\" coords tagOrId remove index", NULL); - return RADAR_ERROR; + return ZN_ERROR; } cmd = COORDS_REMOVE; i++; @@ -1373,45 +1373,45 @@ Coords(WidgetInfo *wi, if (((argc == 5) && (cmd != COORDS_ADD)) || (argc == 6)) { Tcl_AppendResult(wi->interp, " incorrect coord index \"", args[i], "\"", NULL); - return RADAR_ERROR; + return ZN_ERROR; } - else if (ParseCoordList(wi, args[i], &points, &num_points) == RADAR_ERROR) { - return RADAR_ERROR; + else if (ParseCoordList(wi, args[i], &points, &num_points) == ZN_ERROR) { + return ZN_ERROR; } if (cmd == COORDS_ADD) { /* Append coords. */ cmd = COORDS_ADD_LAST; - if (item->class->Coords(item, 0, cmd, &points, &num_points) == RADAR_ERROR) { - return RADAR_ERROR; + if (item->class->Coords(item, 0, cmd, &points, &num_points) == ZN_ERROR) { + return ZN_ERROR; } } else { /* Set all coords. */ cmd = COORDS_REPLACE_ALL; - if (item->class->Coords(item, 0, cmd, &points, &num_points) == RADAR_ERROR) { - return RADAR_ERROR; + if (item->class->Coords(item, 0, cmd, &points, &num_points) == ZN_ERROR) { + return ZN_ERROR; } } - return RADAR_OK; + return ZN_OK; } if (argc == (i+2)) { /* Set a single coord or add coords at index. */ - if (ParseCoordList(wi, args[i+1], &points, &num_points) == RADAR_ERROR) { - return RADAR_ERROR; + if (ParseCoordList(wi, args[i+1], &points, &num_points) == ZN_ERROR) { + return ZN_ERROR; } if (argc == 5) { num_points = 1; cmd = COORDS_REPLACE; } - if (item->class->Coords(item, index, cmd, &points, &num_points) == RADAR_ERROR) { - return RADAR_ERROR; + if (item->class->Coords(item, index, cmd, &points, &num_points) == ZN_ERROR) { + return ZN_ERROR; } } else { /* Read a single coord or remove a coord. */ - if (item->class->Coords(item, index, cmd, &points, &num_points) == RADAR_ERROR) { - return RADAR_ERROR; + if (item->class->Coords(item, index, cmd, &points, &num_points) == ZN_ERROR) { + return ZN_ERROR; } if (num_points) { sprintf(msg, "%g", points->x); @@ -1420,7 +1420,7 @@ Coords(WidgetInfo *wi, Tcl_AppendElement(wi->interp, msg); } } - return RADAR_OK; + return ZN_OK; } @@ -1442,7 +1442,7 @@ Coords(WidgetInfo *wi, *---------------------------------------------------------------------- */ static int -WidgetCmd(ClientData client_data, /* Information about Radar widget. */ +WidgetCmd(ClientData client_data, /* Information about the widget. */ Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ Arg *args) /* Argument strings. */ @@ -1452,16 +1452,16 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ int result; int length; Item item, *items; - RadarList item_list; + ZnList item_list; int num = 0, i, j; char msg[INTEGER_SPACE]; char *end, *end2; - RadarTransfo *t = NULL; + ZnTransfo *t = NULL; if (argc < 2) { Tcl_AppendResult(interp, "wrong # of args: \"", LangString(args[0]), " subcommand ?args?.\"", NULL); - return RADAR_ERROR; + return ZN_ERROR; } Tcl_Preserve((ClientData) wi); @@ -1478,9 +1478,9 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ if (argc == 2) { /* create subcommand alone, return the list of known * object types. */ - ItemClass *classes = RadarListArray(ITEM_P.ItemClassList()); + ItemClass *classes = ZnListArray(ITEM_P.ItemClassList()); - num = RadarListSize(ITEM_P.ItemClassList()); + num = ZnListSize(ITEM_P.ItemClassList()); for (i = 0; i < num; i++) { Tcl_AppendElement(interp, classes[i]->name); } @@ -1500,8 +1500,8 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ "\"", NULL); goto error; } - num = RadarItemsWithTagOrId(wi, LangString(args[3]), &group, NULL); - if (!num || (group->class != RadarGroup)) { + num = ZnItemsWithTagOrId(wi, LangString(args[3]), &group, NULL); + if (!num || (group->class != ZnGroup)) { Tcl_AppendResult(interp, ", group item expected, got \"", LangString(args[3]), "\"", NULL); goto error; @@ -1510,11 +1510,11 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ argc -= 4; args += 4; item = ITEM_P.CreateItem(wi, cls, &argc, &args); - if (item == RADAR_NO_ITEM) { + if (item == ZN_NO_ITEM) { goto error; } - ITEM.InsertItem(item, group, RADAR_NO_ITEM, True); - if (ITEM.ConfigureItem(item, -1, argc, args, True) == RADAR_ERROR) { + ITEM.InsertItem(item, group, ZN_NO_ITEM, True); + if (ITEM.ConfigureItem(item, -1, argc, args, True) == ZN_ERROR) { goto error; } sprintf(msg, "%d", item->id); @@ -1540,14 +1540,14 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ */ else if ((c == 'a') && (strcmp(LangString(args[1]), "anchorxy") == 0)) { Tk_Anchor anchor; - RadarPoint p; + ZnPoint p; if (argc != 4) { Tcl_AppendResult(interp, "wrong # args: should be \"", LangString(args[0]), "\" anchorxy tagOrId anchor", NULL); goto error; } - num = RadarItemsWithTagOrId(wi, LangString(args[2]), &item, NULL); + num = ZnItemsWithTagOrId(wi, LangString(args[2]), &item, NULL); if ((num == 0) || !item->class->has_anchors) { Tcl_AppendResult(interp, "unkown item or doesn't support anchors \"", LangString(args[2]), NULL); @@ -1580,9 +1580,9 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ * bbox */ else if ((c == 'b') && (strncmp(LangString(args[1]), "bbox", length) == 0)) { - RadarBBox bbox; + ZnBBox bbox; int i; - RadarBool found = False; + ZnBool found = False; if (argc < 3) { Tcl_AppendResult(interp, "wrong # args: should be \"", LangString(args[0]), @@ -1595,7 +1595,7 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ ITEM_P.Update(wi); ResetBBox(&bbox); for (i = 0; i < argc; i++) { - num = RadarItemsWithTagOrId(wi, LangString(args[i]), &item, &items); + num = ZnItemsWithTagOrId(wi, LangString(args[i]), &item, &items); found |= (num != 0); for (j = 0; j < num; j++) { AddBBoxToBBox(&bbox, &items[j]->item_bounding_box); @@ -1618,7 +1618,7 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ */ else if ((c == 'b') && (strncmp(LangString(args[1]), "bind", length) == 0)) { ClientData elem = 0; - int part = RADAR_NO_PART; + int part = ZN_NO_PART; if ((argc < 3) || (argc > 5)) { Tcl_AppendResult(interp, "wrong # args: should be \"", LangString(args[0]), @@ -1670,7 +1670,7 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ } if (argc == 5) { - int append = 0; + int append = 0; unsigned long mask; if (LangString(args[4])[0] == 0) { @@ -1738,43 +1738,43 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ else if ((c == 'c') && (strncmp(LangString(args[1]), "chggroup", length) == 0)) { Item grp; int adjust=0; - RadarTransfo inv, t, t2, *this_one; + ZnTransfo inv, t, t2, *this_one; if ((argc != 4) && (argc != 5)) { Tcl_AppendResult(interp, "wrong # args: should be \"", LangString(args[0]), "\" chggroup tagOrIg group ?adjustTransform?", NULL); goto error; } - num = RadarItemsWithTagOrId(wi, LangString(args[2]), &item, NULL); + num = ZnItemsWithTagOrId(wi, LangString(args[2]), &item, NULL); if (num == 0) { goto error; } - num = RadarItemsWithTagOrId(wi, LangString(args[3]), &grp, NULL); + num = ZnItemsWithTagOrId(wi, LangString(args[3]), &grp, NULL); if (num == 0) { goto error; } if (argc == 5) { - if (Tcl_GetBoolean(interp, args[4], &adjust) != RADAR_OK) { + if (Tcl_GetBoolean(interp, args[4], &adjust) != ZN_OK) { goto error; } } - if ((item->parent == grp) || (item->parent == RADAR_NO_ITEM)) { + if ((item->parent == grp) || (item->parent == ZN_NO_ITEM)) { goto done; } if (adjust) { ITEM.GetTransform(grp, &t); - RadarTransfoInvert(&t, &inv); + ZnTransfoInvert(&t, &inv); ITEM.GetTransform(item->parent, &t); - RadarTransfoCompose(&t2, &t, &inv); + ZnTransfoCompose(&t2, &t, &inv); this_one = &t2; if (item->transfo) { - RadarTransfoCompose(&t, item->transfo, &t2); + ZnTransfoCompose(&t, item->transfo, &t2); this_one = &t; } } ITEM.RemoveItem(item); - ITEM.InsertItem(item, grp, RADAR_NO_ITEM, True); - ITEM.Invalidate(item, RADAR_COORDS_FLAG); + ITEM.InsertItem(item, grp, ZN_NO_ITEM, True); + ITEM.Invalidate(item, ZN_COORDS_FLAG); if (adjust) { ITEM.SetTransfo(item, this_one); } @@ -1789,7 +1789,7 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ "\" clone tagOrId ?args?", NULL); goto error; } - num = RadarItemsWithTagOrId(wi, LangString(args[2]), &item, &items); + num = ZnItemsWithTagOrId(wi, LangString(args[2]), &item, &items); if (num == 0) { goto error; } @@ -1797,8 +1797,8 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ args += 3; for (i = 0; i < num; i++) { item = ITEM.CloneItem(items[i]); - ITEM.InsertItem(item, items[i]->parent, RADAR_NO_ITEM, True); - if (ITEM.ConfigureItem(item, -1, argc, args, False) == RADAR_ERROR) { + ITEM.InsertItem(item, items[i]->parent, ZN_NO_ITEM, True); + if (ITEM.ConfigureItem(item, -1, argc, args, False) == ZN_ERROR) { goto error; } sprintf(msg, "%d", item->id); @@ -1832,7 +1832,7 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ "\" coords tagOrId ?add/remove? ?index? ?coordList?", NULL); goto error; } - if (Coords(wi, argc, args) == RADAR_ERROR) { + if (Coords(wi, argc, args) == ZN_ERROR) { goto error; } } @@ -1868,16 +1868,16 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ tag = Tk_GetUid(LangString(args[2])); } entry = Tcl_FindHashEntry(wi->tag_table, tag); - item_list = (RadarList) Tcl_GetHashValue(entry); - items = (Item *) RadarListArray(item_list); - for (i = RadarListSize(item_list)-1; i >= 0; i++) { + item_list = (ZnList) Tcl_GetHashValue(entry); + items = (Item *) ZnListArray(item_list); + for (i = ZnListSize(item_list)-1; i >= 0; i++) { ITEM.RemoveTag(items[i], (char *) tag); } /* * The RemoveTag method *must* remove the tag table * entry when it gets empty. Otherwise a tag probe * we bring back an empty item list and this would - * not be reported as an error by RadarItemsWithTagOrId. + * not be reported as an error by ZnItemsWithTagOrId. */ } @@ -1905,16 +1905,16 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ "\" gettags tagOrId", NULL); goto error; } - num = RadarItemsWithTagOrId(wi, LangString(args[2]), &item, NULL); + num = ZnItemsWithTagOrId(wi, LangString(args[2]), &item, NULL); if (num == 0) { goto error; } - if (!item->tags || !RadarListSize(item->tags)) { + if (!item->tags || !ZnListSize(item->tags)) { goto done; } else { - num = RadarListSize(item->tags); - tags = (Tk_Uid *) RadarListArray(item->tags); + num = ZnListSize(item->tags); + tags = (Tk_Uid *) ZnListArray(item->tags); for (i = 0; i < num; i++) { Tcl_AppendElement(interp, tags[i]); } @@ -1930,11 +1930,11 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ "\" grouph tagOrId", NULL); goto error; } - num = RadarItemsWithTagOrId(wi, LangString(args[2]), &item, NULL); + num = ZnItemsWithTagOrId(wi, LangString(args[2]), &item, NULL); if (num == 0) { goto error; } - if (item->parent != RADAR_NO_ITEM) { + if (item->parent != ZN_NO_ITEM) { sprintf(msg, "%d", item->parent->id); Tcl_SetResult(interp, msg, TCL_VOLATILE); } @@ -1952,7 +1952,7 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ "\" hasanchors tagOrId", NULL); goto error; } - num = RadarItemsWithTagOrId(wi, LangString(args[2]), &item, NULL); + num = ZnItemsWithTagOrId(wi, LangString(args[2]), &item, NULL); if (num == 0) { goto error; } @@ -1968,7 +1968,7 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ "\" hasfields tagOrId", NULL); goto error; } - num = RadarItemsWithTagOrId(wi, LangString(args[2]), &item, NULL); + num = ZnItemsWithTagOrId(wi, LangString(args[2]), &item, NULL); if (num == 0) { goto error; } @@ -1984,7 +1984,7 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ "\" hasparts tagOrId", NULL); goto error; } - num = RadarItemsWithTagOrId(wi, LangString(args[2]), &item, NULL); + num = ZnItemsWithTagOrId(wi, LangString(args[2]), &item, NULL); if (num == 0) { goto error; } @@ -2003,17 +2003,17 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ "\" hastag tagOrId tag", NULL); goto error; } - num = RadarItemsWithTagOrId(wi, LangString(args[2]), &item, NULL); + num = ZnItemsWithTagOrId(wi, LangString(args[2]), &item, NULL); if (num == 0) { goto error; } - if (!item->tags || !RadarListSize(item->tags)) { + if (!item->tags || !ZnListSize(item->tags)) { Tcl_AppendResult(interp, "0", NULL); } else { - num = RadarListSize(item->tags); + num = ZnListSize(item->tags); tag_uid = Tk_GetUid(LangString(args[3])); - tags = (Tk_Uid *) RadarListArray(item->tags); + tags = (Tk_Uid *) ZnListArray(item->tags); for (i = 0; i < num; i++) { if (tags[i] == tag_uid) { Tcl_SetResult(interp, "1", TCL_STATIC); @@ -2040,7 +2040,7 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ "\" itemcget tagOrId ?field? option", NULL); goto error; } - num = RadarItemsWithTagOrId(wi, LangString(args[2]), &item, NULL); + num = ZnItemsWithTagOrId(wi, LangString(args[2]), &item, NULL); if (num == 0) { goto error; } @@ -2064,7 +2064,7 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ goto itemcget_syntax; } largv[0] = LangCopyArg(args[3]); - if (ITEM.QueryItem(item, field, 1, largv) != RADAR_OK) { + if (ITEM.QueryItem(item, field, 1, largv) != ZN_OK) { #ifdef PTK LangFreeVec(1, largv); #endif @@ -2085,7 +2085,7 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ "\" itemconfigure tagOrId ?field? option value ?option value? ...", NULL); goto error; } - num = RadarItemsWithTagOrId(wi, LangString(args[2]), &item, &items); + num = ZnItemsWithTagOrId(wi, LangString(args[2]), &item, &items); if (num == 0) { goto error; } @@ -2105,7 +2105,7 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ argc -= 3; args += 3; if (argc < 2) { - if (ITEM.AttributesInfo(item, field, argc, args) == RADAR_ERROR) { + if (ITEM.AttributesInfo(item, field, argc, args) == ZN_ERROR) { goto error; } goto done; @@ -2117,7 +2117,7 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ * Don't report errors when configuring many items/fields. All * options are not supported by all item types. */ - if ((num == 1) && (result == RADAR_ERROR)) { + if ((num == 1) && (result == ZN_ERROR)) { goto error; } } @@ -2126,7 +2126,7 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ * lower */ else if ((c == 'l') && (strncmp(LangString(args[1]), "lower", length) == 0)) { - Item mark = RADAR_NO_ITEM; + Item mark = ZN_NO_ITEM; TagSearch search; if (argc < 3) { @@ -2135,27 +2135,27 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ goto error; } if (argc == 4) { - for (item = RadarSearchWithTagOrId(wi, LangString(args[3]), wi->top_group, &search); - item != RADAR_NO_ITEM; - item = RadarNextWithTagOrId(&search)) { + for (item = ZnSearchWithTagOrId(wi, LangString(args[3]), wi->top_group, &search); + item != ZN_NO_ITEM; + item = ZnNextWithTagOrId(&search)) { mark = item; } - if (mark == RADAR_NO_ITEM) { + if (mark == ZN_NO_ITEM) { Tcl_AppendResult(interp, "unkown tag or item \"", LangString(args[3]), "\"", NULL); goto error; } } - item = RadarSearchWithTagOrId(wi, LangString(args[2]), wi->top_group, &search); - if (item == RADAR_NO_ITEM) { + item = ZnSearchWithTagOrId(wi, LangString(args[2]), wi->top_group, &search); + if (item == ZN_NO_ITEM) { Tcl_AppendResult(interp, "unkown tag or item \"", LangString(args[2]), "\"", NULL); goto error; } - if (mark == RADAR_NO_ITEM) { + if (mark == ZN_NO_ITEM) { mark = ((GroupItem) item->parent)->tail; } - for (; item != RADAR_NO_ITEM; item = RadarNextWithTagOrId(&search)) { + for (; item != ZN_NO_ITEM; item = ZnNextWithTagOrId(&search)) { if (item != mark) { ITEM.UpdateItemPriority(item, mark, False); mark = item; @@ -2167,7 +2167,7 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ * monitor */ else if ((c == 'm') && (strncmp(LangString(args[1]), "monitor", length) == 0)) { - RadarBool on_off; + ZnBool on_off; if ((argc != 2) && (argc != 3)) { Tcl_AppendResult(interp, "wrong # args: should be \"", LangString(args[0]), @@ -2175,7 +2175,7 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ goto error; } if (argc == 3) { - if (Tcl_GetBoolean(interp, args[2], &on_off) != RADAR_OK) { + if (Tcl_GetBoolean(interp, args[2], &on_off) != ZN_OK) { goto error; } wi->monitoring = on_off; @@ -2199,7 +2199,7 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ * raise */ else if ((c == 'r') && (strncmp(LangString(args[1]), "raise", length) == 0)) { - Item mark = RADAR_NO_ITEM; + Item mark = ZN_NO_ITEM; TagSearch search; if (argc < 3) { @@ -2211,24 +2211,24 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ /* * Find the topmost item with the tag. */ - mark = RadarSearchWithTagOrId(wi, LangString(args[3]), wi->top_group, &search); - if (mark == RADAR_NO_ITEM) { + mark = ZnSearchWithTagOrId(wi, LangString(args[3]), wi->top_group, &search); + if (mark == ZN_NO_ITEM) { Tcl_AppendResult(interp, "unkown tag or item \"", LangString(args[3]), "\"", NULL); goto error; } - RadarDoneWithSearch(&search); + ZnDoneWithSearch(&search); } - item = RadarSearchWithTagOrId(wi, LangString(args[2]), wi->top_group, &search); - if (item == RADAR_NO_ITEM) { + item = ZnSearchWithTagOrId(wi, LangString(args[2]), wi->top_group, &search); + if (item == ZN_NO_ITEM) { Tcl_AppendResult(interp, "unkown tag or item \"", LangString(args[2]), "\"", NULL); goto error; } - if (mark == RADAR_NO_ITEM) { + if (mark == ZN_NO_ITEM) { mark = ((GroupItem) item->parent)->head; } - for (; item != RADAR_NO_ITEM; item = RadarNextWithTagOrId(&search)) { + for (; item != ZN_NO_ITEM; item = ZnNextWithTagOrId(&search)) { if (item != mark) { ITEM.UpdateItemPriority(item, mark, True); } @@ -2247,7 +2247,7 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ argc -= 2; args += 2; for (j = 0; j < argc; j++) { - num = RadarItemsWithTagOrId(wi, LangString(args[j]), &item, &items); + num = ZnItemsWithTagOrId(wi, LangString(args[j]), &item, &items); if (num == 0) { goto error; } @@ -2268,8 +2268,8 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ * rotate */ else if ((c == 'r') && (strncmp(LangString(args[1]), "rotate", length) == 0)) { - RadarReal angle; - RadarPoint p; + ZnReal angle; + ZnPoint p; if ((argc != 4) && (argc != 6)) { Tcl_AppendResult(interp, "wrong # args: should be \"", LangString(args[0]), @@ -2278,14 +2278,14 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ } if (argc == 6) { - if (Tcl_GetDouble(interp, args[4], &p.x) == RADAR_ERROR) { + if (Tcl_GetDouble(interp, args[4], &p.x) == ZN_ERROR) { goto error; } - if (Tcl_GetDouble(interp, args[5], &p.y) == RADAR_ERROR) { + if (Tcl_GetDouble(interp, args[5], &p.y) == ZN_ERROR) { goto error; } } - num = RadarItemsWithTagOrId(wi, LangString(args[2]), &item, &items); + num = ZnItemsWithTagOrId(wi, LangString(args[2]), &item, &items); if (num == 0) { Tcl_HashEntry *e; e = Tcl_FindHashEntry(wi->t_table, LangString(args[2])); @@ -2296,19 +2296,19 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ "an id or a transform name", (char *) NULL); goto error; } - t = (RadarTransfo *) Tcl_GetHashValue(e); + t = (ZnTransfo *) Tcl_GetHashValue(e); } - if (Tcl_GetDouble(interp, args[3], &angle) == RADAR_ERROR) { + if (Tcl_GetDouble(interp, args[3], &angle) == ZN_ERROR) { goto error; } if (t) { if (argc == 6) { - RadarTranslate(t, -p.x, -p.y); + ZnTranslate(t, -p.x, -p.y); } - RadarRotateRad(t, angle); + ZnRotateRad(t, angle); if (argc == 6) { - RadarTranslate(t, p.x, p.y); + ZnTranslate(t, p.x, p.y); } } if (num != 0) { @@ -2322,7 +2322,7 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ * scale */ else if ((c == 's') && (strncmp(LangString(args[1]), "scale", length) == 0)) { - RadarPoint scale; + ZnPoint scale; if (argc != 5) { Tcl_AppendResult(interp, @@ -2331,7 +2331,7 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ goto error; } if (argc == 5) { - num = RadarItemsWithTagOrId(wi, LangString(args[2]), &item, &items); + num = ZnItemsWithTagOrId(wi, LangString(args[2]), &item, &items); if (num == 0) { Tcl_HashEntry *e; e = Tcl_FindHashEntry(wi->t_table, LangString(args[2])); @@ -2342,17 +2342,17 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ "an id or a transform name", (char *) NULL); goto error; } - t = (RadarTransfo *) Tcl_GetHashValue(e); + t = (ZnTransfo *) Tcl_GetHashValue(e); } } - if (Tcl_GetDouble(interp, args[argc-2], &scale.x) == RADAR_ERROR) { + if (Tcl_GetDouble(interp, args[argc-2], &scale.x) == ZN_ERROR) { goto error; } - if (Tcl_GetDouble(interp, args[argc-1], &scale.y) == RADAR_ERROR) { + if (Tcl_GetDouble(interp, args[argc-1], &scale.y) == ZN_ERROR) { goto error; } if (t) { - RadarScale(t, scale.x, scale.y); + ZnScale(t, scale.x, scale.y); } if (num != 0) { for (i = 0; i < num; i++) { @@ -2386,8 +2386,8 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ "\" must be a transform name", (char *) NULL); goto error; } - t = (RadarTransfo *) Tcl_GetHashValue(e); - RadarTransfoFree(t); + t = (ZnTransfo *) Tcl_GetHashValue(e); + ZnTransfoFree(t); Tcl_DeleteHashEntry(e); } @@ -2396,9 +2396,9 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ */ else if ((c == 't') && (strncmp(LangString(args[1]), "transform", length) == 0)) { int num_points; - RadarPoint *p, xp; - RadarTransfo t, t2, inv, *this_one; - Item from, to; + ZnPoint *p, xp; + ZnTransfo t, t2, inv, *this_one; + Item from, to; if ((argc != 4) && (argc != 5)) { Tcl_AppendResult(interp, @@ -2408,12 +2408,12 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ } if (argc == 5) { - num = RadarItemsWithTagOrId(wi, LangString(args[2]), &from, &items); + num = ZnItemsWithTagOrId(wi, LangString(args[2]), &from, &items); if (num == 0) { goto error; } } - num = RadarItemsWithTagOrId(wi, LangString(args[argc-2]), &to, &items); + num = ZnItemsWithTagOrId(wi, LangString(args[argc-2]), &to, &items); if (num == 0) { Tcl_HashEntry *e; /* @@ -2427,22 +2427,22 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ "an id or a transform name", (char *) NULL); goto error; } - inv = *((RadarTransfo *) Tcl_GetHashValue(e)); + inv = *((ZnTransfo *) Tcl_GetHashValue(e)); } else { ITEM.GetTransform(to, &t); - RadarTransfoInvert(&t, &inv); + ZnTransfoInvert(&t, &inv); } this_one = &inv; if (argc == 5) { ITEM.GetTransform(from, &t); - RadarTransfoCompose(&t2, &t, &inv); + ZnTransfoCompose(&t2, &t, &inv); this_one = &t2; } - /*RadarPrintTransfo(&t); - RadarPrintTransfo(&inv);*/ + /*ZnPrintTransfo(&t); + ZnPrintTransfo(&inv);*/ - if (ParseCoordList(wi, args[argc-1], &p, &num_points) == RADAR_ERROR) { + if (ParseCoordList(wi, args[argc-1], &p, &num_points) == ZN_ERROR) { Tcl_AppendResult(interp, " invalid coord list \"", args[argc-1], "\"", NULL); goto error; @@ -2455,7 +2455,7 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ p->x -= wi->border_width; p->y -= wi->border_width; } - RadarTransformPoint(this_one, p, &xp); + ZnTransformPoint(this_one, p, &xp); /*printf("p->x=%g, p->y=%g, xp.x=%g, xp.y=%g\n", p->x, p->y, xp.x, xp.y);*/ sprintf(msg, "%g", xp.x); Tcl_AppendElement(interp, msg); @@ -2468,7 +2468,7 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ * translate */ else if ((c == 't') && (strncmp(LangString(args[1]), "translate", length) == 0)) { - RadarPoint trans; + ZnPoint trans; if (argc != 5) { Tcl_AppendResult(interp, @@ -2478,7 +2478,7 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ } num = 0; if (argc == 5) { - num = RadarItemsWithTagOrId(wi, LangString(args[2]), &item, &items); + num = ZnItemsWithTagOrId(wi, LangString(args[2]), &item, &items); if (num == 0) { Tcl_HashEntry *e; e = Tcl_FindHashEntry(wi->t_table, LangString(args[2])); @@ -2489,17 +2489,17 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ "an id or a transform name", (char *) NULL); goto error; } - t = (RadarTransfo *) Tcl_GetHashValue(e); + t = (ZnTransfo *) Tcl_GetHashValue(e); } } - if (Tcl_GetDouble(interp, args[argc-2], &trans.x) == RADAR_ERROR) { + if (Tcl_GetDouble(interp, args[argc-2], &trans.x) == ZN_ERROR) { goto error; } - if (Tcl_GetDouble(interp, args[argc-1], &trans.y) == RADAR_ERROR) { + if (Tcl_GetDouble(interp, args[argc-1], &trans.y) == ZN_ERROR) { goto error; } if (t) { - RadarTranslate(t, trans.x, trans.y); + ZnTranslate(t, trans.x, trans.y); } if (num != 0) { for (i = 0; i < num; i++) { @@ -2519,7 +2519,7 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ goto error; } if (argc == 3) { - num = RadarItemsWithTagOrId(wi, LangString(args[2]), &item, &items); + num = ZnItemsWithTagOrId(wi, LangString(args[2]), &item, &items); if (num == 0) { Tcl_HashEntry *e; e = Tcl_FindHashEntry(wi->t_table, LangString(args[2])); @@ -2530,11 +2530,11 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ "an id or a transform name", (char *) NULL); goto error; } - t = (RadarTransfo *) Tcl_GetHashValue(e); + t = (ZnTransfo *) Tcl_GetHashValue(e); } } if (t) { - RadarTransfoSetIdentity(t); + ZnTransfoSetIdentity(t); } if (num != 0) { for (i = 0; i < num; i++) { @@ -2561,8 +2561,8 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ "\" must be a transform name", (char *) NULL); goto error; } - t = (RadarTransfo *) Tcl_GetHashValue(e); - num = RadarItemsWithTagOrId(wi, LangString(args[2]), &item, &items); + t = (ZnTransfo *) Tcl_GetHashValue(e); + num = ZnItemsWithTagOrId(wi, LangString(args[2]), &item, &items); if (num == 0) { goto error; } @@ -2576,8 +2576,8 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ */ else if ((c == 't') && (strncmp(LangString(args[1]), "tsave", length) == 0)) { Tcl_HashEntry *e; - int new, invert=0; - RadarTransfo *inv; + int new, invert=0; + ZnTransfo *inv; if ((argc != 4) && (argc != 5)) { Tcl_AppendResult(interp, @@ -2585,26 +2585,26 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ "\" tsave tagOrId tName ?invert?", NULL); goto error; } - num = RadarItemsWithTagOrId(wi, LangString(args[2]), &item, &items); + num = ZnItemsWithTagOrId(wi, LangString(args[2]), &item, &items); if (num == 0) { goto error; } if (argc == 5) { - if (Tcl_GetBoolean(interp, args[4], &invert) != RADAR_OK) { + if (Tcl_GetBoolean(interp, args[4], &invert) != ZN_OK) { goto error; } } t = item->transfo; e = Tcl_CreateHashEntry(wi->t_table, LangString(args[argc-1]), &new); if (!new) { - RadarTransfoFree((RadarTransfo *) Tcl_GetHashValue(e)); + ZnTransfoFree((ZnTransfo *) Tcl_GetHashValue(e)); } if (invert) { - inv = RadarTransfoNew(); - RadarTransfoInvert(t, inv); + inv = ZnTransfoNew(); + ZnTransfoInvert(t, inv); } else { - inv = RadarTransfoDuplicate(t); + inv = ZnTransfoDuplicate(t); } Tcl_SetHashValue(e, inv); } @@ -2618,7 +2618,7 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ "\" type tagOrId", NULL); goto error; } - num = RadarItemsWithTagOrId(wi, LangString(args[2]), &item, NULL); + num = ZnItemsWithTagOrId(wi, LangString(args[2]), &item, NULL); if (num == 0) { goto error; } @@ -2639,7 +2639,7 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ } done: if (wi->work_item_list) { - RadarListFree(wi->work_item_list); + ZnListFree(wi->work_item_list); wi->work_item_list = NULL; } Tcl_Release((ClientData) wi); @@ -2647,11 +2647,11 @@ WidgetCmd(ClientData client_data, /* Information about Radar widget. */ error: if (wi->work_item_list) { - RadarListFree(wi->work_item_list); + ZnListFree(wi->work_item_list); wi->work_item_list = NULL; } Tcl_Release((ClientData) wi); - return RADAR_ERROR; + return ZN_ERROR; } @@ -2672,14 +2672,14 @@ TileChange(ClientData client_data, int image_height) { WidgetInfo *wi = (WidgetInfo *) client_data; - RadarBBox bbox; + ZnBBox bbox; InvalidateImage(wi->tile); bbox.orig.x = bbox.orig.y = 0; bbox.corner.x = wi->width; bbox.corner.y = wi->height; ITEM_P.Damage(wi, &bbox); - RadarNeedRedisplay(wi); + ZnNeedRedisplay(wi); } @@ -2693,7 +2693,7 @@ TileChange(ClientData client_data, * reconfigure) a Act widget. * * Results: - * The return value is a standard Tcl result. If RADAR_ERROR is + * The return value is a standard Tcl result. If ZN_ERROR is * returned, then interp->result contains an error message. * * Side effects: @@ -2712,11 +2712,11 @@ Configure(Tcl_Interp *interp, /* Used for error reporting. */ { #define CONFIG_PROBE(offset) (ISSET(config_specs[offset].specFlags, \ TK_CONFIG_OPTION_SPECIFIED)) - RadarBBox bbox; + ZnBBox bbox; if (Tk_ConfigureWidget(interp, wi->win, config_specs, argc, args, (char *) wi, flags) != TCL_OK) { - return RADAR_ERROR; + return ZN_ERROR; } /* @@ -2734,10 +2734,10 @@ Configure(Tcl_Interp *interp, /* Used for error reporting. */ bbox.corner.x = wi->width; bbox.corner.y = wi->height; ITEM_P.Damage(wi, &bbox); - RadarNeedRedisplay(wi); + ZnNeedRedisplay(wi); } if (CONFIG_PROBE(RELIEF_SPEC)) { - RadarNeedRedisplay(wi); + ZnNeedRedisplay(wi); } /* @@ -2755,15 +2755,15 @@ Configure(Tcl_Interp *interp, /* Used for error reporting. */ bbox.corner.y = wi->height; ITEM_P.Damage(wi, &bbox); ITEM_P.ResetTransformStack(wi); - ITEM.Invalidate(wi->top_group, RADAR_TRANSFO_FLAG); + ITEM.Invalidate(wi->top_group, ZN_TRANSFO_FLAG); } if (CONFIG_PROBE(SPEED_VECTOR_LENGTH_SPEC) || CONFIG_PROBE(MANAGE_HISTORY_SPEC) || CONFIG_PROBE(MANAGED_HISTORY_SIZE_SPEC)) { - ITEM.InvalidateItems(wi->top_group, RadarTrack); + ITEM.InvalidateItems(wi->top_group, ZnTrack); } if (CONFIG_PROBE(MAP_DISTANCE_SYMBOL_SPEC)) { - ITEM.InvalidateItems(wi->top_group, RadarMap); + ITEM.InvalidateItems(wi->top_group, ZnMap); } /* @@ -2776,7 +2776,7 @@ Configure(Tcl_Interp *interp, /* Used for error reporting. */ } if (CONFIG_PROBE(TILE_SPEC)) { - if (wi->tile != RadarUnspecifiedImage) { + if (wi->tile != ZnUnspecifiedImage) { Tk_FreeImage(wi->tile); } wi->tile = Tk_GetImage(wi->interp, wi->win, wi->tile_name, @@ -2785,7 +2785,7 @@ Configure(Tcl_Interp *interp, /* Used for error reporting. */ bbox.corner.x = wi->width; bbox.corner.y = wi->height; ITEM_P.Damage(wi, &bbox); - RadarNeedRedisplay(wi); + ZnNeedRedisplay(wi); } /* @@ -2796,15 +2796,15 @@ Configure(Tcl_Interp *interp, /* Used for error reporting. */ Tcl_HashEntry *entry; Item grp; - if (wi->om_group != RADAR_NO_ITEM) { + if (wi->om_group != ZN_NO_ITEM) { OmUnregister((void *) wi); - wi->om_group = RADAR_NO_ITEM; + 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 = (Item) Tcl_GetHashValue(entry); - if (grp->class == RadarGroup) { + if (grp->class == ZnGroup) { OmRegister((void *) wi, SendTrackToOm, SetLabelAngleFromOm, QueryLabelPosition); wi->om_group = grp; @@ -2824,7 +2824,7 @@ Configure(Tcl_Interp *interp, /* Used for error reporting. */ * Event -- * * This procedure is invoked by the Tk dispatcher for various - * events on Radars. + * events on Zincs. * * Results: * None. @@ -2854,7 +2854,7 @@ Event(ClientData client_data, /* Information about widget. */ * Get the work GC and suppress GraphicExpose * and NoExpose events reception. */ - wi->gc = XCreateGC(wi->dpy, RadarWindowId(wi->win), 0, NULL); + wi->gc = XCreateGC(wi->dpy, ZnWindowId(wi->win), 0, NULL); XSetGraphicsExposures(wi->dpy, wi->gc, False); /* * Set the real top window above us. @@ -2868,10 +2868,10 @@ Event(ClientData client_data, /* Information about widget. */ while (!Tk_IsTopLevel(top_level)) { top_level = Tk_Parent(top_level); } - XQueryTree(wi->dpy, RadarWindowId(top_level), &root, &parent, + XQueryTree(wi->dpy, ZnWindowId(top_level), &root, &parent, &children, &num_children); if (root == parent) { - wi->real_top = RadarWindowId(top_level); + wi->real_top = ZnWindowId(top_level); } else { wi->real_top = parent; @@ -2881,8 +2881,8 @@ Event(ClientData client_data, /* Information about widget. */ } } else if (event_ptr->type == Expose) { - RadarBBox bbox; - RadarDim width, height; + ZnBBox bbox; + ZnDim width, height; bbox.orig.x = ((XExposeEvent*) event_ptr)->x - wi->border_width; bbox.orig.y = ((XExposeEvent*) event_ptr)->y - wi->border_width; @@ -2910,7 +2910,7 @@ Event(ClientData client_data, /* Information about widget. */ AddBBoxToBBox(&wi->exposed_area, &bbox); if ((((XExposeEvent*) event_ptr)->count == 0) && !IsEmptyBBox(&wi->exposed_area)) { - RadarNeedRedisplay(wi); + ZnNeedRedisplay(wi); } } /* @@ -2920,8 +2920,8 @@ Event(ClientData client_data, /* Information about widget. */ * need such change, it can bind a handler on . */ else if (event_ptr->type == ConfigureNotify) { - RadarDim w, h; - RadarBBox bbox; + ZnDim w, h; + ZnBBox bbox; /* w = ((XConfigureEvent*) event_ptr)->width-2*wi->border_width; h = ((XConfigureEvent*) event_ptr)->height-2*wi->border_width;*/ @@ -2938,7 +2938,7 @@ Event(ClientData client_data, /* Information about widget. */ ITEM_P.ResetTransformStack(wi); ITEM_P.Damage(wi, &bbox); - ITEM.Invalidate(wi->top_group, RADAR_TRANSFO_FLAG); + ITEM.Invalidate(wi->top_group, ZN_TRANSFO_FLAG); /* * Reallocate the double buffer pixmap. @@ -2958,7 +2958,7 @@ Event(ClientData client_data, /* Information about widget. */ bbox.corner.x = Tk_Width(wi->win); bbox.corner.y = Tk_Height(wi->win); AddBBoxToBBox(&wi->exposed_area, &bbox); - RadarNeedRedisplay(wi); + ZnNeedRedisplay(wi); } } /* @@ -3010,7 +3010,7 @@ DoEvent(WidgetInfo *wi, int num, num_tags, i, len, ptr; ClientData *tag_list = NULL; Item item; - RadarBool bind_part, bind_item; + ZnBool bind_part, bind_item; #define BIND_ITEM(test) \ if (bind_item && (test)) { \ @@ -3044,7 +3044,7 @@ DoEvent(WidgetInfo *wi, num = 0; num_tags = 0; its = items; - bind_part = ((wi->current_part != RADAR_NO_PART) && + bind_part = ((wi->current_part != ZN_NO_PART) && (wi->current_item->class->has_parts || wi->current_item->class->has_fields)); /* @@ -3069,20 +3069,20 @@ DoEvent(WidgetInfo *wi, if (bind_part) { num++; if (!workspace) { - workspace = RadarMalloc(worksize); + workspace = ZnMalloc(worksize); } } if (item->tags) { - num_tags = RadarListSize(item->tags); + num_tags = ZnListSize(item->tags); if (bind_item) { num += num_tags; } if (bind_part) { num += num_tags; } - tag_list = (ClientData *) RadarListArray(item->tags); + tag_list = (ClientData *) ZnListArray(item->tags); if (num > NUM_STATIC) { - its = (ClientData *) RadarMalloc(num*sizeof(ClientData)); + its = (ClientData *) ZnMalloc(num*sizeof(ClientData)); } } @@ -3098,7 +3098,7 @@ DoEvent(WidgetInfo *wi, len = strlen(tag_list[i])+ INTEGER_SPACE; if (worksize < len) { worksize = len + 10; - workspace = RadarRealloc(workspace, len); + workspace = ZnRealloc(workspace, len); } sprintf(workspace, "%s:%d", (char *) tag_list[i], wi->current_part); its[ptr] = Tk_GetUid(workspace); @@ -3120,7 +3120,7 @@ DoEvent(WidgetInfo *wi, Tk_BindEvent(wi->binding_table, event_ptr, wi->win, num, its); } if (its != items) { - RadarFree(its); + ZnFree(its); } #undef BIND_ITEM @@ -3143,7 +3143,7 @@ DoEvent(WidgetInfo *wi, * 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 radar, so callers should protect themselves + * delete the widget, so callers should protect themselves * with Tcl_Preserve and Tcl_Release. * * Note: @@ -3172,8 +3172,8 @@ PickCurrentItem(WidgetInfo *wi, } /* - * Save information about this event in the radar. The event in - * the radar is used for two purposes: + * Save information about this event in the widget. The saved event + * is used for two purposes: * * 1. Event bindings: if the current item changes, fake events are * generated to allow item-enter and item-leave bindings to trigger. @@ -3223,7 +3223,7 @@ PickCurrentItem(WidgetInfo *wi, * object, so the check for closest item can be skipped. */ if (wi->pick_event.type != LeaveNotify) { - RadarPoint p; + ZnPoint p; p.x = wi->pick_event.xcrossing.x-wi->border_width; p.y = wi->pick_event.xcrossing.y-wi->border_width; @@ -3231,7 +3231,7 @@ PickCurrentItem(WidgetInfo *wi, &wi->new_item, &wi->new_part); } else { - wi->new_item = RADAR_NO_ITEM; + wi->new_item = ZN_NO_ITEM; } if ((wi->new_item == wi->current_item) && (wi->new_part == wi->current_part) && @@ -3251,7 +3251,7 @@ PickCurrentItem(WidgetInfo *wi, * calling leave when the grab is released. */ if (((wi->new_item != wi->current_item) || (wi->new_part != wi->current_part)) && - (wi->current_item != RADAR_NO_ITEM) && + (wi->current_item != ZN_NO_ITEM) && wi->current_item->class->IsSensitive(wi->current_item, wi->current_part) && !(wi->events_flags & LEFT_GRABBED_ITEM) && !prev_left_grabbed_item) { @@ -3305,18 +3305,18 @@ PickCurrentItem(WidgetInfo *wi, */ if (wi->current_item != wi->new_item) { wi->current_item = wi->new_item; - wi->new_item = RADAR_NO_ITEM; + wi->new_item = ZN_NO_ITEM; } wi->current_part = wi->new_part; - if ((wi->current_item != RADAR_NO_ITEM) && + if ((wi->current_item != ZN_NO_ITEM) && wi->current_item->class->IsSensitive(wi->current_item, wi->current_part)) { XEvent event; /* * Add the tag 'current' to the current item under the pointer. */ - DoItem((Tcl_Interp *) NULL, wi->current_item, RADAR_NO_PART, current_uid); + DoItem((Tcl_Interp *) NULL, wi->current_item, ZN_NO_PART, current_uid); /* * Then emit a fake Enter event on it. */ @@ -3435,7 +3435,7 @@ Bind(ClientData client_data, /* Information about widget. */ } /*printf("=event=\n");*/ - if ((wi->current_item != RADAR_NO_ITEM) && + if ((wi->current_item != ZN_NO_ITEM) && wi->current_item->class->IsSensitive(wi->current_item, wi->current_part)) { DoEvent(wi, event_ptr); } @@ -3480,19 +3480,19 @@ 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 a Radar at a safe time + * to clean up the internal structure of the widget at a safe time * (when no-one is using it anymore). * * Results: * None. * * Side effects: - * Everything associated with the Radar is freed up. + * Everything associated with the widget is freed up. * *---------------------------------------------------------------------- */ static void -Destroy(char *mem_ptr) /* Info about Radar widget. */ +Destroy(char *mem_ptr) /* Info about the widget. */ { WidgetInfo *wi = (WidgetInfo *) mem_ptr; unsigned int num; @@ -3510,7 +3510,7 @@ Destroy(char *mem_ptr) /* Info about Radar widget. */ * Unregister form the overlap manager. */ #ifdef OM - if (wi->om_group != RADAR_NO_ITEM) { + if (wi->om_group != ZN_NO_ITEM) { OmUnregister((void *) wi); } #endif @@ -3526,27 +3526,27 @@ Destroy(char *mem_ptr) /* Info about Radar widget. */ Tcl_DeleteHashTable(wi->id_table); - RadarFree(wi->id_table); + ZnFree(wi->id_table); /* * Free the table contents before the table. */ entry = Tcl_FirstHashEntry(wi->tag_table, &search); while (entry != NULL) { - RadarListFree((RadarList) Tcl_GetHashValue(entry)); + ZnListFree((ZnList) Tcl_GetHashValue(entry)); entry = Tcl_NextHashEntry(&search); } Tcl_DeleteHashTable(wi->tag_table); - RadarFree(wi->tag_table); + ZnFree(wi->tag_table); /* * Free the table contents before the table. */ entry = Tcl_FirstHashEntry(wi->t_table, &search); while (entry != NULL) { - RadarTransfoFree((RadarTransfo *) Tcl_GetHashValue(entry)); + ZnTransfoFree((ZnTransfo *) Tcl_GetHashValue(entry)); entry = Tcl_NextHashEntry(&search); } Tcl_DeleteHashTable(wi->t_table); - RadarFree(wi->t_table); + ZnFree(wi->t_table); if (wi->binding_table != NULL) { Tk_DeleteBindingTable(wi->binding_table); @@ -3554,9 +3554,9 @@ Destroy(char *mem_ptr) /* Info about Radar widget. */ /* Free the tile */ if (strlen(wi->tile_name) != 0) { - RadarFree(wi->tile_name); + ZnFree(wi->tile_name); } - if (wi->tile != RadarUnspecifiedImage) { + if (wi->tile != ZnUnspecifiedImage) { Tk_FreeImage(wi->tile); } @@ -3570,12 +3570,12 @@ Destroy(char *mem_ptr) /* Info about Radar widget. */ /* * Should be empty by now. */ - RadarListFree(wi->transfo_stack); - RadarListFree(wi->clip_stack); + ZnListFree(wi->transfo_stack); + ZnListFree(wi->clip_stack); - RadarListFree(wi->work_pts); + ZnListFree(wi->work_pts); - RadarFree(wi); + ZnFree(wi); /*printf("Destroy ending\n");*/ } @@ -3585,7 +3585,7 @@ Destroy(char *mem_ptr) /* Info about Radar widget. */ * * Redisplay -- * - * This procedure redraws the contents of a Radar window. + * 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. * @@ -3599,10 +3599,10 @@ Destroy(char *mem_ptr) /* Info about Radar widget. */ */ static void -Redisplay(ClientData client_data) /* Information about radar. */ +Redisplay(ClientData client_data) /* Information about the widget. */ { WidgetInfo *wi = (WidgetInfo *) client_data; - RadarBBox merge; + ZnBBox merge; Tk_Window tkwin; XRectangle r; struct timeval start, end; @@ -3617,11 +3617,11 @@ Redisplay(ClientData client_data) /* Information about radar. */ * Give the overlap manager a chance to do its work. */ #ifdef OM - if ((wi->om_group != RADAR_NO_ITEM) && + if ((wi->om_group != ZN_NO_ITEM) && ((GroupItem) wi->om_group)->call_om) { - RadarPoint scale={1.0,1.0}; + ZnPoint scale={1.0,1.0}; if (wi->om_group->transfo) { - RadarTransfoDecompose(wi->om_group->transfo, &scale, + ZnTransfoDecompose(wi->om_group->transfo, &scale, NULL, NULL, NULL); } OmProcessOverlap((void *) wi, wi->width, wi->height, scale.x); @@ -3659,8 +3659,8 @@ Redisplay(ClientData client_data) /* Information about radar. */ } } } - while (ISSET(wi->top_group->inv_flags, RADAR_COORDS_FLAG) || - ISSET(wi->top_group->inv_flags, RADAR_TRANSFO_FLAG) || + while (ISSET(wi->top_group->inv_flags, ZN_COORDS_FLAG) || + ISSET(wi->top_group->inv_flags, ZN_TRANSFO_FLAG) || ISSET(wi->events_flags, INTERNAL_NEED_REPICK)); /* @@ -3677,7 +3677,7 @@ Redisplay(ClientData client_data) /* Information about radar. */ BBox2XRect(&merge, &r); /*printf("redisplay %d %d %d %d\n", r.x, r.y, r.width, r.height);*/ XCopyArea(wi->dpy, - wi->draw_buffer, RadarWindowId(wi->win), wi->gc, + wi->draw_buffer, ZnWindowId(wi->win), wi->gc, r.x, r.y, r.width, r.height, r.x+wi->border_width, r.y+wi->border_width); } /* @@ -3685,7 +3685,7 @@ Redisplay(ClientData client_data) /* Information about radar. */ */ if (wi->border_width > 0) { /*printf("win size %d %d\n", Tk_Width(wi->win), Tk_Height(wi->win));*/ - Tk_Draw3DRectangle(wi->win, RadarWindowId(wi->win), + Tk_Draw3DRectangle(wi->win, ZnWindowId(wi->win), wi->bg_border, 0, 0, Tk_Width(wi->win), Tk_Height(wi->win), wi->border_width, wi->relief); @@ -3716,7 +3716,7 @@ Redisplay(ClientData client_data) /* Information about radar. */ */ static Tcl_HashTable mapInfoTable; -static RadarBool map_info_inited = False; +static ZnBool map_info_inited = False; typedef struct { ClientData client_data; @@ -3725,8 +3725,8 @@ typedef struct { typedef struct { MapInfoId map_info; - RadarBool deleted; - RadarList clients; + ZnBool deleted; + ZnList clients; } MapInfoMaster; static void @@ -3743,17 +3743,17 @@ UpdateMapInfoClients(MapInfoMaster *master) int i, num; MapInfoClient *client; - num = RadarListSize(master->clients); - client = (MapInfoClient *) RadarListArray(master->clients); + num = ZnListSize(master->clients); + client = (MapInfoClient *) ZnListArray(master->clients); for (i = 0; i < num; i++, client++) { (*client->proc)(client->client_data, master->map_info); } } int -Radar_CreateMapInfo(Tcl_Interp *interp, - char *name, - MapInfoId *map_info) +ZnCreateMapInfo(Tcl_Interp *interp, + char *name, + MapInfoId *map_info) { Tk_Uid uid = Tk_GetUid(name); Tcl_HashEntry *entry; @@ -3779,10 +3779,10 @@ Radar_CreateMapInfo(Tcl_Interp *interp, } } else { - master = (MapInfoMaster *) RadarMalloc(sizeof(MapInfoMaster)); + master = (MapInfoMaster *) ZnMalloc(sizeof(MapInfoMaster)); master->map_info = MapInfoCreate(name); master->deleted = False; - master->clients = RadarListNew(1, sizeof(MapInfoClient)); + master->clients = ZnListNew(1, sizeof(MapInfoClient)); Tcl_SetHashValue(entry, master); } if (map_info) { @@ -3792,9 +3792,9 @@ Radar_CreateMapInfo(Tcl_Interp *interp, } int -Radar_DuplicateMapInfo(Tcl_Interp *interp, - char *name, - MapInfoId map_info) +ZnDuplicateMapInfo(Tcl_Interp *interp, + char *name, + MapInfoId map_info) { Tk_Uid uid = Tk_GetUid(name); Tcl_HashEntry *entry; @@ -3808,12 +3808,12 @@ Radar_DuplicateMapInfo(Tcl_Interp *interp, entry = Tcl_CreateHashEntry(&mapInfoTable, uid, &new); if (!new) { Tcl_AppendResult(interp, "duplicate mapinfo \"", name, "\" already exists", NULL); - return RADAR_ERROR; + return ZN_ERROR; } - master = (MapInfoMaster *) RadarMalloc(sizeof(MapInfoMaster)); + master = (MapInfoMaster *) ZnMalloc(sizeof(MapInfoMaster)); master->map_info = MapInfoDuplicate(map_info); master->deleted = False; - master->clients = RadarListNew(1, sizeof(MapInfoClient)); + master->clients = ZnListNew(1, sizeof(MapInfoClient)); Tcl_SetHashValue(entry, master); return TCL_OK; @@ -3845,8 +3845,8 @@ LookupMapInfoMaster(Tcl_Interp *interp, } int -Radar_DeleteMapInfo(Tcl_Interp *interp, - char *name) +ZnDeleteMapInfo(Tcl_Interp *interp, + char *name) { MapInfoMaster *master; Tk_Uid uid = Tk_GetUid(name); @@ -3858,30 +3858,30 @@ Radar_DeleteMapInfo(Tcl_Interp *interp, entry = Tcl_FindHashEntry(&mapInfoTable, uid); if (entry == NULL) { - return RADAR_ERROR; + return ZN_ERROR; } master = (MapInfoMaster *) Tcl_GetHashValue(entry); - if (RadarListSize(master->clients) != 0) { + if (ZnListSize(master->clients) != 0) { master->deleted = True; MapInfoEmpty(master->map_info); UpdateMapInfoClients(master); } else { MapInfoDelete(master->map_info); - RadarListFree(master->clients); + ZnListFree(master->clients); Tcl_DeleteHashEntry(entry); - RadarFree(master); + ZnFree(master); } return TCL_OK; } MapInfoId -Radar_GetMapInfo(Tcl_Interp *interp, - char *name, - MapInfoChangeProc proc, - ClientData client_data) +ZnGetMapInfo(Tcl_Interp *interp, + char *name, + MapInfoChangeProc proc, + ClientData client_data) { MapInfoMaster *master; MapInfoClient client; @@ -3892,15 +3892,15 @@ Radar_GetMapInfo(Tcl_Interp *interp, } client.proc = proc; client.client_data = client_data; - RadarListAdd(master->clients, &client, RadarListTail); + ZnListAdd(master->clients, &client, ZnListTail); return master->map_info; } void -Radar_FreeMapInfo(MapInfoId map_info, - MapInfoChangeProc proc, - ClientData client_data) +ZnFreeMapInfo(MapInfoId map_info, + MapInfoChangeProc proc, + ClientData client_data) { Tk_Uid uid = Tk_GetUid(MapInfoName(map_info)); Tcl_HashEntry *entry; @@ -3917,19 +3917,19 @@ Radar_FreeMapInfo(MapInfoId map_info, return; } master = (MapInfoMaster *) Tcl_GetHashValue(entry); - client = (MapInfoClient *) RadarListArray(master->clients); - num = RadarListSize(master->clients); + client = (MapInfoClient *) ZnListArray(master->clients); + num = ZnListSize(master->clients); for (i = 0; i < num; i++, client++) { if ((client->client_data == client_data) && (client->proc == proc)) { - RadarListDelete(master->clients, i); + ZnListDelete(master->clients, i); return; } } } void -Radar_UpdateMapInfoClients(MapInfoId map_info) +ZnUpdateMapInfoClients(MapInfoId map_info) { Tk_Uid uid = Tk_GetUid(MapInfoName(map_info)); Tcl_HashEntry *entry; @@ -3986,7 +3986,7 @@ MapInfoLineStyleFromString(Tcl_Interp *interp, } Tcl_AppendResult(interp, " incorrect mapinfo line style \"", str,"\"", NULL); - return RADAR_ERROR; + return ZN_ERROR; } static char * @@ -4010,7 +4010,7 @@ MapInfoTextStyleFromString(Tcl_Interp *interp, } Tcl_AppendResult(interp, " incorrect mapinfo text style \"", str,"\"", NULL); - return RADAR_ERROR; + return ZN_ERROR; } int @@ -4025,13 +4025,13 @@ MapInfoCmd(ClientData client_data, char msg[INTEGER_SPACE*7]; if (!inited) { - InitRadar(interp); + InitZinc(interp); } if (argc < 2) { Tcl_AppendResult(interp, "wrong # of args: \"", LangString(args[0]), " subcommand ?args?.\"", NULL); - return RADAR_ERROR; + return ZN_ERROR; } c = LangString(args[2])[0]; @@ -4045,10 +4045,10 @@ MapInfoCmd(ClientData client_data, if (argc != 3) { Tcl_AppendResult(interp, "wrong # args: should be \"", LangString(args[0]), " name create\"", NULL); - return RADAR_ERROR; + return ZN_ERROR; } - if (Radar_CreateMapInfo(interp, LangString(args[1]), NULL) == RADAR_ERROR) { - return RADAR_ERROR; + if (ZnCreateMapInfo(interp, LangString(args[1]), NULL) == ZN_ERROR) { + return ZN_ERROR; } } @@ -4059,10 +4059,10 @@ MapInfoCmd(ClientData client_data, if (argc != 3) { Tcl_AppendResult(interp, "wrong # args: should be \"", LangString(args[0]), "\" mapInfo delete", NULL); - return RADAR_ERROR; + return ZN_ERROR; } - if (Radar_DeleteMapInfo(interp, LangString(args[1])) == RADAR_ERROR) { - return RADAR_ERROR; + if (ZnDeleteMapInfo(interp, LangString(args[1])) == ZN_ERROR) { + return ZN_ERROR; } } @@ -4073,14 +4073,14 @@ MapInfoCmd(ClientData client_data, if (argc != 4) { Tcl_AppendResult(interp, "wrong # args: should be \"", LangString(args[0]), "\" mapInfo duplicate name", NULL); - return RADAR_ERROR; + return ZN_ERROR; } master = LookupMapInfoMaster(interp, LangString(args[1])); if (master == NULL) { - return RADAR_ERROR; + return ZN_ERROR; } - if (Radar_DuplicateMapInfo(interp, LangString(args[3]), master->map_info) == RADAR_ERROR) { - return RADAR_ERROR; + if (ZnDuplicateMapInfo(interp, LangString(args[3]), master->map_info) == ZN_ERROR) { + return ZN_ERROR; } } @@ -4102,15 +4102,15 @@ MapInfoCmd(ClientData client_data, Tcl_AppendResult(interp, "wrong # args: should be \"", LangString(args[0]), "\" mapInfo ", LangString(args[2]), " type", imsg, " ?args?", NULL); - return RADAR_ERROR; + return ZN_ERROR; } master = LookupMapInfoMaster(interp, LangString(args[1])); if (master == NULL) { - return RADAR_ERROR; + return ZN_ERROR; } if (c != 'a') { - if (Tcl_GetInt(interp, args[4], &index) == RADAR_ERROR) { - return RADAR_ERROR; + if (Tcl_GetInt(interp, args[4], &index) == ZN_ERROR) { + return ZN_ERROR; } if (index < 0) { index = 0; @@ -4123,22 +4123,22 @@ MapInfoCmd(ClientData client_data, Tcl_AppendResult(interp, "wrong # args: should be \"", LangString(args[0]), "\" mapInfo ", LangString(args[2]), " line", imsg, " style width x1 y1 x2 y2", NULL); - return RADAR_ERROR; + return ZN_ERROR; } if (MapInfoLineStyleFromString(interp, LangString(args[num_param]), - &line_style) == RADAR_ERROR) { - return RADAR_ERROR; + &line_style) == ZN_ERROR) { + return ZN_ERROR; } for (i = 0; i < 5; i++) { - if (Tcl_GetInt(interp, args[num_param+i+1], &coords[i]) == RADAR_ERROR) { - return RADAR_ERROR; + if (Tcl_GetInt(interp, args[num_param+i+1], &coords[i]) == ZN_ERROR) { + return ZN_ERROR; } } if (coords[0] < 0) { coords[0] = 0; } if (c == 'a') { - MapInfoAddLine(master->map_info, RadarListTail, NULL, line_style, + MapInfoAddLine(master->map_info, ZnListTail, NULL, line_style, coords[0], coords[1], coords[2], coords[3], coords[4]); } else { @@ -4151,18 +4151,18 @@ MapInfoCmd(ClientData client_data, Tcl_AppendResult(interp, "wrong # args: should be \"", LangString(args[0]), "\" mapInfo ", LangString(args[2]), " symbol", imsg, " x y intVal", NULL); - return RADAR_ERROR; + return ZN_ERROR; } for (i = 0; i < 3; i++) { - if (Tcl_GetInt(interp, args[num_param+i], &coords[i]) == RADAR_ERROR) { - return RADAR_ERROR; + if (Tcl_GetInt(interp, args[num_param+i], &coords[i]) == ZN_ERROR) { + return ZN_ERROR; } } if (coords[2] < 0) { coords[2] = 0; } if (c == 'a') { - MapInfoAddSymbol(master->map_info, RadarListTail, NULL, coords[0], + MapInfoAddSymbol(master->map_info, ZnListTail, NULL, coords[0], coords[1], coords[2]); } else { @@ -4175,23 +4175,23 @@ MapInfoCmd(ClientData client_data, Tcl_AppendResult(interp, "wrong # args: should be \"", LangString(args[0]), "\" mapInfo ", LangString(args[2]), " text", imsg, " textStyle lineStyle x y string", NULL); - return RADAR_ERROR; + return ZN_ERROR; } if (MapInfoTextStyleFromString(interp, LangString(args[num_param]), - &text_style) == RADAR_ERROR) { - return RADAR_ERROR; + &text_style) == ZN_ERROR) { + return ZN_ERROR; } if (MapInfoLineStyleFromString(interp, LangString(args[num_param+1]), - &line_style) == RADAR_ERROR) { - return RADAR_ERROR; + &line_style) == ZN_ERROR) { + return ZN_ERROR; } for (i = 0; i < 2; i++) { - if (Tcl_GetInt(interp, args[num_param+i+2], &coords[i]) == RADAR_ERROR) { - return RADAR_ERROR; + if (Tcl_GetInt(interp, args[num_param+i+2], &coords[i]) == ZN_ERROR) { + return ZN_ERROR; } } if (c == 'a') { - MapInfoAddText(master->map_info, RadarListTail, NULL, text_style, + MapInfoAddText(master->map_info, ZnListTail, NULL, text_style, line_style, coords[0], coords[1], LangString(args[num_param+4])); } else { @@ -4206,22 +4206,22 @@ MapInfoCmd(ClientData client_data, Tcl_AppendResult(interp, "wrong # args: should be \"", LangString(args[0]), "\" mapInfo ", LangString(args[2]), " arc", imsg, " style width cx cy radius start extent", NULL); - return RADAR_ERROR; + return ZN_ERROR; } if (MapInfoLineStyleFromString(interp, LangString(args[num_param]), - &line_style) == RADAR_ERROR) { - return RADAR_ERROR; + &line_style) == ZN_ERROR) { + return ZN_ERROR; } for (i = 0; i < 6; i++) { - if (Tcl_GetInt(interp, args[num_param+i+1], &coords[i]) == RADAR_ERROR) { - return RADAR_ERROR; + if (Tcl_GetInt(interp, args[num_param+i+1], &coords[i]) == ZN_ERROR) { + return ZN_ERROR; } } if (coords[0] < 0) { coords[0] = 0; } if (c == 'a') { - MapInfoAddArc(master->map_info, RadarListTail, NULL, line_style, + MapInfoAddArc(master->map_info, ZnListTail, NULL, line_style, coords[0], coords[1], coords[2], coords[3], coords[4], coords[5]); } @@ -4241,11 +4241,11 @@ MapInfoCmd(ClientData client_data, if (argc != 4) { Tcl_AppendResult(interp, "wrong # args: should be \"", LangString(args[0]), "\" mapInfo count type", NULL); - return RADAR_ERROR; + return ZN_ERROR; } master = LookupMapInfoMaster(interp, LangString(args[1])); if (master == NULL) { - return RADAR_ERROR; + return ZN_ERROR; } args += 3; argc -= 3; @@ -4275,14 +4275,14 @@ MapInfoCmd(ClientData client_data, if (argc != 5) { Tcl_AppendResult(interp, "wrong # args: should be \"", LangString(args[0]), "\" mapInfo get type index", NULL); - return RADAR_ERROR; + return ZN_ERROR; } master = LookupMapInfoMaster(interp, LangString(args[1])); if (master == NULL) { - return RADAR_ERROR; + return ZN_ERROR; } - if (Tcl_GetInt(interp, args[4], &index) == RADAR_ERROR) { - return RADAR_ERROR; + if (Tcl_GetInt(interp, args[4], &index) == ZN_ERROR) { + return ZN_ERROR; } if (index < 0) { index = 0; @@ -4366,14 +4366,14 @@ MapInfoCmd(ClientData client_data, if (argc != 5) { Tcl_AppendResult(interp, "wrong # args: should be \"", LangString(args[0]), "\" mapInfo remove type index", NULL); - return RADAR_ERROR; + return ZN_ERROR; } master = LookupMapInfoMaster(interp, LangString(args[1])); if (master == NULL) { - return RADAR_ERROR; + return ZN_ERROR; } - if (Tcl_GetInt(interp, args[4], &index) == RADAR_ERROR) { - return RADAR_ERROR; + if (Tcl_GetInt(interp, args[4], &index) == ZN_ERROR) { + return ZN_ERROR; } if (index < 0) { index = 0; @@ -4406,14 +4406,14 @@ MapInfoCmd(ClientData client_data, if (argc != 4) { Tcl_AppendResult(interp, "wrong # args: should be \"", LangString(args[0]), "\" mapInfo scale factor", NULL); - return RADAR_ERROR; + return ZN_ERROR; } master = LookupMapInfoMaster(interp, LangString(args[1])); if (master == NULL) { - return RADAR_ERROR; + return ZN_ERROR; } - if (Tcl_GetDouble(interp, args[3], &factor) == RADAR_ERROR) { - return RADAR_ERROR; + if (Tcl_GetDouble(interp, args[3], &factor) == ZN_ERROR) { + return ZN_ERROR; } MapInfoScale(master->map_info, factor); UpdateMapInfoClients(master); @@ -4428,17 +4428,17 @@ MapInfoCmd(ClientData client_data, if (argc != 5) { Tcl_AppendResult(interp, "wrong # args: should be \"", LangString(args[0]), "\" mapInfo translate xAmount yAmount", NULL); - return RADAR_ERROR; + return ZN_ERROR; } master = LookupMapInfoMaster(interp, LangString(args[1])); if (master == NULL) { - return RADAR_ERROR; + return ZN_ERROR; } - if (Tcl_GetInt(interp, args[3], &x) == RADAR_ERROR) { - return RADAR_ERROR; + if (Tcl_GetInt(interp, args[3], &x) == ZN_ERROR) { + return ZN_ERROR; } - if (Tcl_GetInt(interp, args[4], &y) == RADAR_ERROR) { - return RADAR_ERROR; + if (Tcl_GetInt(interp, args[4], &y) == ZN_ERROR) { + return ZN_ERROR; } MapInfoTranslate(master->map_info, x, y); UpdateMapInfoClients(master); @@ -4448,7 +4448,7 @@ MapInfoCmd(ClientData client_data, Tcl_AppendResult(interp, "invalid command \"", LangString(args[2]), "\": must be create, delete, duplicate, add, count, " "get, replace, remove, scale, translate", NULL); - return RADAR_ERROR; + return ZN_ERROR; } return TCL_OK; @@ -4469,20 +4469,20 @@ VideomapCmd(ClientData client_data, int argc, /* Number of arguments. */ Arg *args) { - RadarList ids; + ZnList ids; char c; int length; int *id_array, id_num, i; char num_str[INTEGER_SPACE]; if (!inited) { - InitRadar(interp); + InitZinc(interp); } if (argc < 2) { Tcl_AppendResult(interp, "wrong # args: should be \"", LangString(args[0]), " filename\"", NULL); - return RADAR_ERROR; + return ZN_ERROR; } c = LangString(args[1])[0]; @@ -4495,21 +4495,21 @@ VideomapCmd(ClientData client_data, if (argc != 3) { Tcl_AppendResult(interp, "wrong # args: should be \"", LangString(args[0]), " ids filename\"", NULL); - return RADAR_ERROR; + return ZN_ERROR; } ids = MapInfoVideomapIds(LangString(args[2])); if (ids == NULL) { Tcl_AppendResult(interp, "unable to look at videomap file \"", LangString(args[2]), "\"", NULL); - return RADAR_ERROR; + return ZN_ERROR; } - id_array = (int *) RadarListArray(ids); - id_num = RadarListSize(ids); + id_array = (int *) ZnListArray(ids); + id_num = ZnListSize(ids); for (i = 0; i < id_num; i++) { sprintf(num_str, "%d", id_array[i]); Tcl_AppendElement(interp, num_str); } - RadarListFree(ids); + ZnListFree(ids); } /* @@ -4522,23 +4522,23 @@ VideomapCmd(ClientData client_data, if (argc != 5) { Tcl_AppendResult(interp, "wrong # args: should be \"", LangString(args[0]), "\" load filename index mapInfo", NULL); - return RADAR_ERROR; + return ZN_ERROR; } - if (Tcl_GetInt(interp, args[3], &index) == RADAR_ERROR) { - return RADAR_ERROR; + if (Tcl_GetInt(interp, args[3], &index) == ZN_ERROR) { + return ZN_ERROR; } if (index < 0) { index = 0; } - if (Radar_CreateMapInfo(interp, LangString(args[4]), &map_info) == RADAR_ERROR) { - return RADAR_ERROR; + if (ZnCreateMapInfo(interp, LangString(args[4]), &map_info) == ZN_ERROR) { + return ZN_ERROR; } - if (MapInfoGetVideomap(map_info, LangString(args[2]), index) == RADAR_ERROR) { + if (MapInfoGetVideomap(map_info, LangString(args[2]), index) == ZN_ERROR) { Tcl_AppendResult(interp, "unable to load videomap file \"", LangString(args[2]), ":", LangString(args[3]), "\"", NULL); - return RADAR_ERROR; + return ZN_ERROR; } - Radar_UpdateMapInfoClients(map_info); + ZnUpdateMapInfoClients(map_info); } return TCL_OK; @@ -4546,7 +4546,7 @@ VideomapCmd(ClientData client_data, static void -InitRadar(Tcl_Interp *interp) { +InitZinc(Tcl_Interp *interp) { unsigned int i, x, y, bit; char name[INTEGER_SPACE + 20]; @@ -4599,7 +4599,7 @@ InitRadar(Tcl_Interp *interp) { /* *---------------------------------------------------------------------- * - * Tkradar_Init -- + * Tkzinc_Init -- * * This procedure is invoked by Tcl_AppInit in tkAppInit.c to * initialize the widget. @@ -4607,21 +4607,21 @@ InitRadar(Tcl_Interp *interp) { *---------------------------------------------------------------------- */ int -Tkradar_Init(Tcl_Interp *interp) /* Used for error reporting. */ +Tkzinc_Init(Tcl_Interp *interp) /* Used for error reporting. */ { if (!Tk_MainWindow(interp)) { printf("Tk main window not created"); - return RADAR_ERROR; + return ZN_ERROR; } /* * Create additional commands */ - if (Tcl_PkgProvide(interp, "radar", "3.0") == RADAR_ERROR) { - return RADAR_ERROR; + if (Tcl_PkgProvide(interp, "zinc", "3.0") == ZN_ERROR) { + return ZN_ERROR; } - Tcl_CreateCommand(interp, "radar", RadarCmd, + Tcl_CreateCommand(interp, "zinc", ZincCmd, (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL); Tcl_CreateCommand(interp, "mapinfo", MapInfoCmd, (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL); @@ -4632,7 +4632,7 @@ Tkradar_Init(Tcl_Interp *interp) /* Used for error reporting. */ } int -Tkradar_debug_Init(Tcl_Interp *interp) /* Used for error reporting. */ +Tkzinc_debug_Init(Tcl_Interp *interp) /* Used for error reporting. */ { - return Tkradar_Init(interp); + return Tkzinc_Init(interp); } diff --git a/generic/tkZinc.h b/generic/tkZinc.h index 508da6b..6aee547 100644 --- a/generic/tkZinc.h +++ b/generic/tkZinc.h @@ -1,5 +1,5 @@ /* - * tkRadar.h -- Header file for Tk radar widget. + * tkZinc.h -- Header file for Tk zinc widget. * * Authors : Patrick Lecoanet. * Creation date : Mon Mar 15 14:02:03 1999 @@ -27,8 +27,8 @@ */ -#ifndef _tkRadar_h -#define _tkRadar_h +#ifndef _tkZinc_h +#define _tkZinc_h #include "WidgetInfo.h" #include "Item.h" @@ -36,24 +36,24 @@ #include "MapInfo.h" -int RadarItemsWithTagOrId(WidgetInfo *wi, char *tag_or_id, Item *item, - Item **item_list); -int ParseCoordList(WidgetInfo *wi, Arg arg, RadarPoint **pts, +int ZnItemsWithTagOrId(WidgetInfo *wi, char *tag_or_id, Item *item, + Item **item_list); +int ParseCoordList(WidgetInfo *wi, Arg arg, ZnPoint **pts, int *num_pts); void DoItem(Tcl_Interp *interp, Item item, int part, Tk_Uid tag_uid); -void RadarNeedRedisplay(WidgetInfo *wi); +void ZnNeedRedisplay(WidgetInfo *wi); typedef void (*MapInfoChangeProc)(ClientData client_data, MapInfoId map_info); -int Radar_CreateMapInfo(Tcl_Interp *interp, char *name, MapInfoId *map_info); -int Radar_DuplicateMapInfo(Tcl_Interp *interp, char *name, MapInfoId map_info); -int Radar_DeleteMapInfo(Tcl_Interp *interp, char *name); -MapInfoId Radar_GetMapInfo(Tcl_Interp *interp, char *name, MapInfoChangeProc proc, - ClientData client_data); -void Radar_FreeMapInfo(MapInfoId map_info, MapInfoChangeProc proc, +int ZnCreateMapInfo(Tcl_Interp *interp, char *name, MapInfoId *map_info); +int ZnDuplicateMapInfo(Tcl_Interp *interp, char *name, MapInfoId map_info); +int ZnDeleteMapInfo(Tcl_Interp *interp, char *name); +MapInfoId ZnGetMapInfo(Tcl_Interp *interp, char *name, MapInfoChangeProc proc, ClientData client_data); -void Radar_UpdateMapInfoClients(MapInfoId map_info); +void ZnFreeMapInfo(MapInfoId map_info, MapInfoChangeProc proc, + ClientData client_data); +void ZnUpdateMapInfoClients(MapInfoId map_info); -#endif /* _tkRadar_h */ +#endif /* _tkZinc_h */ diff --git a/generic/version.c b/generic/version.c index 4965af1..4821719 100644 --- a/generic/version.c +++ b/generic/version.c @@ -29,5 +29,5 @@ #include "patchlvl.h" -static const char rcs_id[] = "$PatchLevel: " XRADARVERSION " " __DATE__ " " __TIME__ " $"; -const char * const xradar_version = XRADARVERSION; +static const char rcs_id[] = "$PatchLevel: " ZINCVERSION " " __DATE__ " " __TIME__ " $"; +const char * const zinc_version = ZINCVERSION; diff --git a/patchlvl.h b/patchlvl.h index 25461cf..6f084ee 100644 --- a/patchlvl.h +++ b/patchlvl.h @@ -1,5 +1,5 @@ /* - * XRADARVERSION is a string for the version specifier. The leading + * ZINCVERSION is a string for the version specifier. The leading * number is the major version number, the letter is the revision ("a" * for alpha release, "b" for beta release, "c", and so on), and the * trailing number is the patchlevel. @@ -8,9 +8,9 @@ /* * Keep these in sync with VERSION in Makefile.in */ -#ifndef XRADARVERSION -#define XRADARVER 3 -#define XRADARREV 1 -#define XRADARPLVL 8 -#define XRADARVERSION "xradar-version-318" +#ifndef ZINCVERSION +#define ZINCVER 3 +#define ZINCREV 1 +#define ZINCPLVL 9 +#define ZINCVERSION "zinc-version-319" #endif diff --git a/sandbox/testarc.tcl b/sandbox/testarc.tcl index 6c3f777..deaf98b 100644 --- a/sandbox/testarc.tcl +++ b/sandbox/testarc.tcl @@ -1,6 +1,6 @@ #!/usr/bin/wish -f -load tkradar3.1.so +load tkzinc3.1.so package require Img set top 1 @@ -9,7 +9,7 @@ image create photo logo -file /usr/share/toccata/images/logo.gif #image create photo papier -file /usr/share/toccata/images/dgtexture-dragstrip.xpm image create photo penguin -file /usr/X11R6/include/X11/pixmaps/xpenguin_color.xpm -set r [radar .r -backcolor gray -relief sunken] +set r [zinc .r -backcolor gray -relief sunken] pack .r -expand t -fill both .r configure -width 800 -height 500 #.r configure -drawbboxes t diff --git a/sandbox/testicon.tcl b/sandbox/testicon.tcl index 489478c..5c790e4 100644 --- a/sandbox/testicon.tcl +++ b/sandbox/testicon.tcl @@ -1,6 +1,6 @@ #!/usr/bin/wish -f -load tkradar3.1.so +load tkzinc3.1.so package require Img set top 1 @@ -8,7 +8,7 @@ set top 1 image create photo penguin -file /usr/X11R6/include/X11/pixmaps/xpenguin_color.xpm set mask "/usr/X11R6/include/X11/bitmaps/fvwm.xbm" -set r [radar .r -backcolor gray -relief sunken] +set r [zinc .r -backcolor gray -relief sunken] pack .r -expand t -fill both .r configure -width 800 -height 500 #.r configure -drawbboxes t diff --git a/sandbox/testpoly.tcl b/sandbox/testpoly.tcl index 0341bf9..1d64a5e 100644 --- a/sandbox/testpoly.tcl +++ b/sandbox/testpoly.tcl @@ -1,6 +1,6 @@ #!/usr/bin/wish -f -load tkradar3.1.so +load tkzinc3.1.so package require Img set top 1 @@ -33,7 +33,7 @@ set show {\ image create photo logo -file /usr/share/toccata/images/logo.gif #image create photo papier -file /usr/share/toccata/images/dgtexture-dragstrip.xpm -set r [radar .r -backcolor gray -relief sunken] +set r [zinc .r -backcolor gray -relief sunken] pack .r -expand t -fill both .r configure -width 1024 -height 800 .r scale $top 1 -1 diff --git a/sandbox/testtext.tcl b/sandbox/testtext.tcl index 747f598..44df4e8 100644 --- a/sandbox/testtext.tcl +++ b/sandbox/testtext.tcl @@ -1,12 +1,12 @@ #!/usr/bin/wish -f -load tkradar3.1.so +load tkzinc3.1.so package require Img set top 1 set mask "/usr/X11R6/include/X11/bitmaps/fvwm.xbm" -set r [radar .r -backcolor gray -relief sunken] +set r [zinc .r -backcolor gray -relief sunken] pack .r -expand t -fill both .r configure -width 800 -height 500 .r configure -drawbboxes t diff --git a/sandbox/testzinc.pl b/sandbox/testzinc.pl index ebcb40c..28efa43 100644 --- a/sandbox/testzinc.pl +++ b/sandbox/testzinc.pl @@ -15,113 +15,113 @@ $logo = $mw->Photo(-file => "/home/etienne/images/logo.gif"); # MainLoop; # exit; ################################################### -# creation radar +# creation zinc ################################################### -#$mw->Radar()->pack; +#$mw->Zinc()->pack; #MainLoop; exit; -$radar = $mw->Radar(-backcolor => 'skyblue', -relief => 'sunken'); -$radar->pack(-expand => t, -fill => 'both'); +$zinc = $mw->Zinc(-backcolor => 'skyblue', -relief => 'sunken'); +$zinc->pack(-expand => t, -fill => 'both'); -$radar->configure(-width => 800, -height => 500); -$color = $radar->cget("-backcolor"); print "radar backcolor=$color\n"; +$zinc->configure(-width => 800, -height => 500); +$color = $zinc->cget("-backcolor"); print "zinc backcolor=$color\n"; ################################################### # creation track ################################################### -$track = $radar->add("track", 10); -#$radar->itemconfigure($track, -tags => 'toto'); - -$radar->itemconfigure($track, -position => [1, 1]); -$radar->itemconfigure($track, -position => [10, 10]); -$radar->itemconfigure($track, -position => [20, 20]); -$radar->itemconfigure($track, -position => [30, 30]); -$radar->itemconfigure($track, -position => [40, 40]); -$radar->itemconfigure($track, -position => [50, 50]); -$radar->itemconfigure($track, -position => [60, 50]); -$radar->itemconfigure($track, -speedvector => [20, 0]); -$radar->itemconfigure($track, -symbolcolor => 'red', -labeldistance => 60); -$radar->itemconfigure($track, -markersize => 10, -filledmarker => 1, +$track = $zinc->add("track", 10); +#$zinc->itemconfigure($track, -tags => 'toto'); + +$zinc->itemconfigure($track, -position => [1, 1]); +$zinc->itemconfigure($track, -position => [10, 10]); +$zinc->itemconfigure($track, -position => [20, 20]); +$zinc->itemconfigure($track, -position => [30, 30]); +$zinc->itemconfigure($track, -position => [40, 40]); +$zinc->itemconfigure($track, -position => [50, 50]); +$zinc->itemconfigure($track, -position => [60, 50]); +$zinc->itemconfigure($track, -speedvector => [20, 0]); +$zinc->itemconfigure($track, -symbolcolor => 'red', -labeldistance => 60); +$zinc->itemconfigure($track, -markersize => 10, -filledmarker => 1, -markercolor => "green"); -print "radar itemconfigure :\n\n"; -for $attr ($radar->itemconfigure($track)) { +print "zinc itemconfigure :\n\n"; +for $attr ($zinc->itemconfigure($track)) { print " ( ",join(',', @$attr)," )\n" ; } print "\n"; -$size = $radar->itemcget($track, -markersize); print "track markersize=$size\n"; -(@coords) = $radar->itemcget($track, "-position"); +$size = $zinc->itemcget($track, -markersize); print "track markersize=$size\n"; +(@coords) = $zinc->itemcget($track, "-position"); print "track position=",$coords[0],"+",$coords[1],"\n"; -$radar->itemconfigure($track, -labelformat => +$zinc->itemconfigure($track, -labelformat => "150x60|40+20|40+20|40+20,0:40x20+0+0,1:40x20+40+0,2:150x60+0+0"); -$radar->itemconfigure($track, 0, -filled => 1 , -backcolor => "red", +$zinc->itemconfigure($track, 0, -filled => 1 , -backcolor => "red", -border => "contour"); -$radar->itemconfigure($track, 0, -text => "TO"); -$radar->itemconfigure($track, 1, -filled => 1 , -backcolor => "green", +$zinc->itemconfigure($track, 0, -text => "TO"); +$zinc->itemconfigure($track, 1, -filled => 1 , -backcolor => "green", -border => "contour"); -$radar->itemconfigure($track, 1, -filled => 1 , -backcolor => "green", +$zinc->itemconfigure($track, 1, -filled => 1 , -backcolor => "green", -border => "contour"); -$radar->itemconfigure($track, 2, -image => $logo , -alignment => "center"); -$mk = $radar->itemcget($track, -markercolor); +$zinc->itemconfigure($track, 2, -image => $logo , -alignment => "center"); +$mk = $zinc->itemcget($track, -markercolor); -$radar->itemconfigure($track, 0, -reliefthickness => 2, -relief => "sunken", +$zinc->itemconfigure($track, 0, -reliefthickness => 2, -relief => "sunken", -bordercolor => "red", -border => "noborder"); -$radar->bind($track.":-3", "", - sub {$radar->itemconfigure($track, -speedvectorcolor => 'red')}); -$radar->bind($track.":-3", "", - sub {$radar->itemconfigure($track, -speedvectorcolor => 'black')}); +$zinc->bind($track.":-3", "", + sub {$zinc->itemconfigure($track, -speedvectorcolor => 'red')}); +$zinc->bind($track.":-3", "", + sub {$zinc->itemconfigure($track, -speedvectorcolor => 'black')}); ################################################### # creation way point ################################################### print "creating way point\n"; -my $wp = $radar->add("waypoint", 10); -$radar->itemconfigure($wp, +my $wp = $zinc->add("waypoint", 10); +$zinc->itemconfigure($wp, -symbolcolor => "green", -position => [0, 80], -labelformat => "80x40|40+20|40+20|40+20,0:40x20+0+0,1:40x20+40+0,2:80x40+0+0" ); -$radar->itemconfigure($wp, 0 ,-filled => 1 ,-backcolor => "tan",-text => "TO"); -$radar->itemconfigure($wp, 1 ,-filled => 1 ,-backcolor => "wheat",-text => "TO"); -$radar->itemconfigure($wp, 2 ,-border => "contour"); -$radar->bind($wp, "", [ \&borders, "on"]); -$radar->bind($wp, "", [ \&borders, "off"]); +$zinc->itemconfigure($wp, 0 ,-filled => 1 ,-backcolor => "tan",-text => "TO"); +$zinc->itemconfigure($wp, 1 ,-filled => 1 ,-backcolor => "wheat",-text => "TO"); +$zinc->itemconfigure($wp, 2 ,-border => "contour"); +$zinc->bind($wp, "", [ \&borders, "on"]); +$zinc->bind($wp, "", [ \&borders, "off"]); ################################################### # creation 2nd track ################################################### print "creating second track\n"; -$track2 = $radar->add("track", 10, -speedvector => [-20, 0], -position => [0, 50]); -$radar->itemconfigure($track2, -connecteditem => $track); +$track2 = $zinc->add("track", 10, -speedvector => [-20, 0], -position => [0, 50]); +$zinc->itemconfigure($track2, -connecteditem => $track); ################################################### # creation macro ################################################### print "creating macro\n"; -$macro = $radar->add("macro", 10, +$macro = $zinc->add("macro", 10, -labelformat => "80x40|40+20|40+20|40+20,0:40x20+0+0,1:40x20+40+0" ); -$radar->itemconfigure($macro, 0 , -text => "une"); -$radar->itemconfigure($macro, 1, -text => "macro"); -$radar->itemconfigure($macro, -connecteditem => $track); -$radar->bind($macro.":0", "", [ \&borders, "on"]); -$radar->bind($macro.":0", "", [ \&borders, "off"]); +$zinc->itemconfigure($macro, 0 , -text => "une"); +$zinc->itemconfigure($macro, 1, -text => "macro"); +$zinc->itemconfigure($macro, -connecteditem => $track); +$zinc->bind($macro.":0", "", [ \&borders, "on"]); +$zinc->bind($macro.":0", "", [ \&borders, "off"]); ################################################### # creation ministrip ################################################### print "creating ministrip\n"; -$ministrip = $radar->add("ministrip", 10, +$ministrip = $zinc->add("ministrip", 10, -labelformat => "80x40|40+20|40+20|40+20,0:40x20+0+0,1:40x20+40+0", -position => [100, 10] ); -$radar->itemconfigure($ministrip, 0 , -text => 'ministrip'); +$zinc->itemconfigure($ministrip, 0 , -text => 'ministrip'); ################################################### # creation map @@ -133,41 +133,41 @@ $mw->videomap("load", "/home/etienne/tmp/hegias_parouest_TE.vid", 0, "paris-oues print "videomap ids : ", join('|', $mw->videomap("ids", "/home/etienne/tmp/videomap_orly")),"\n"; -$map = $radar->add("map", -color => red); -$radar->itemconfigure($map,-mapinfo => orly); +$map = $zinc->add("map", -color => red); +$zinc->itemconfigure($map,-mapinfo => orly); -$map2 = $radar->add("map", -color => green, -filled => 1, -priority => 0, +$map2 = $zinc->add("map", -color => green, -filled => 1, -priority => 0, -fillpattern => AlphaStipple6); -#$radar->itemconfigure($map2, -mapinfo => paris-ouest); +#$zinc->itemconfigure($map2, -mapinfo => paris-ouest); -$map3 = $radar->add("map", -color => orange); -$radar->itemconfigure($map3,-mapinfo => "paris-w"); +$map3 = $zinc->add("map", -color => orange); +$zinc->itemconfigure($map3,-mapinfo => "paris-w"); ################################################### #creation rectangle, arc, curve ################################################### -$rect = $radar->add(rectangle, -50, -50, 50, -80, -linecolor => bisque); -$radar->bind($rect, '', sub { $radar->itemconfigure($rect, -linecolor => red)}); -$radar->bind($rect, '', sub { $radar->itemconfigure($rect, -linecolor => bisque)}); +$rect = $zinc->add(rectangle, -50, -50, 50, -80, -linecolor => bisque); +$zinc->bind($rect, '', sub { $zinc->itemconfigure($rect, -linecolor => red)}); +$zinc->bind($rect, '', sub { $zinc->itemconfigure($rect, -linecolor => bisque)}); -$arc = $radar->add(arc, -100, 80, -50, 30, -linecolor => bisque, +$arc = $zinc->add(arc, -100, 80, -50, 30, -linecolor => bisque, -tags => ["arc"]); -#$radar->addtag("fleche",'withtag', $arc); -#$radar->addtag("carquois",'withtag', $arc); -$radar->add(rectangle, -101, 81, -49, 29, -linecolor => green); -$radar->raise($arc); -$radar->bind($arc, '', sub {$radar->itemconfigure($arc, -linecolor => red)}); -$radar->bind($arc, '', sub {$radar->itemconfigure($arc, -linecolor => bisque)}); -print "arc tags=", join('|',$radar->gettags($arc)),"\n"; - -$radar->itemconfigure($arc, -startangle => 0, -extent => 360); - -$mp = $radar->add(curve, -300, 0, -250, 100, -80, 20); -$radar->itemconfigure($mp, -filled => 1, -linewidth => 4, -linecolor => yellow, +#$zinc->addtag("fleche",'withtag', $arc); +#$zinc->addtag("carquois",'withtag', $arc); +$zinc->add(rectangle, -101, 81, -49, 29, -linecolor => green); +$zinc->raise($arc); +$zinc->bind($arc, '', sub {$zinc->itemconfigure($arc, -linecolor => red)}); +$zinc->bind($arc, '', sub {$zinc->itemconfigure($arc, -linecolor => bisque)}); +print "arc tags=", join('|',$zinc->gettags($arc)),"\n"; + +$zinc->itemconfigure($arc, -startangle => 0, -extent => 360); + +$mp = $zinc->add(curve, -300, 0, -250, 100, -80, 20); +$zinc->itemconfigure($mp, -filled => 1, -linewidth => 4, -linecolor => yellow, -fillcolor => tan, -fillpattern => AlphaStipple8); -$radar->itemconfigure($mp, -marker => AtcSymbol9 , -markercolor => red); +$zinc->itemconfigure($mp, -marker => AtcSymbol9 , -markercolor => red); ################################################### # Map info @@ -176,7 +176,7 @@ $mw->mapinfo('mpessai', 'create'); $mw->mapinfo('mpessai', add, text, normal, simple, 0, 200, "Et voilą"); $mw->mapinfo(mpessai, add, line, simple, 0, 0, 0, 0, 200); #$mw->mapinfo('mpessai', add, line, simple, 5, -100, 100, 0, 0); -$radar->itemconfigure($map3, -mapinfo => mpessai); +$zinc->itemconfigure($map3, -mapinfo => mpessai); print "mapinfo count line : ", $mw->mapinfo(mpessai, count, line),"\n"; print "mapinfo get line 3: ", join('|',$mw->mapinfo(mpessai, get, line, 0)),"\n"; @@ -184,28 +184,28 @@ print "mapinfo get line 3: ", join('|',$mw->mapinfo(mpessai, get, line, 0)),"\n" # tests diverses methodes ################################################### -for ($radar->find('all')) { - print $_, " -> ", $radar->type($_),"\n"; +for ($zinc->find('all')) { + print $_, " -> ", $zinc->type($_),"\n"; } -$radar->Tk::bind("<2>", [sub { +$zinc->Tk::bind("<2>", [sub { print $_[1], "@" ,$_[2], ", closest: ", - join(' ',$radar->find('closest', $_[1], $_[2])),"\n"; + join(' ',$zinc->find('closest', $_[1], $_[2])),"\n"; }, Ev('x'), Ev('y')]); -$radar->Tk::bind('', +$zinc->Tk::bind('', [ sub {($origx, $origy) = ($_[1], $_[2]); }, Ev('x'), Ev('y') ]); -$radar->Tk::bind('', +$zinc->Tk::bind('', [ sub {&finditems($_[1], $_[2]); }, Ev('x'), Ev('y') ]); -$radar->Tk::bind("<2>", sub {$radar->translate('all', 10,10); }); -$radar->Tk::bind("<3>", sub {$radar->scale(1.1, 1.1); }); +$zinc->Tk::bind("<2>", sub {$zinc->translate('all', 10,10); }); +$zinc->Tk::bind("<3>", sub {$zinc->scale(1.1, 1.1); }); @position = [20, 40, 50, 80]; -#@xy = $radar -> worldcoords (0, @position); -@xy = $radar -> worldcoords (0, [10, 23, 45, 65]); +#@xy = $zinc -> worldcoords (0, @position); +@xy = $zinc -> worldcoords (0, [10, 23, 45, 65]); print ("x = ",$xy[0]," y = ",$xy[1],"\n"); @@ -214,16 +214,16 @@ MainLoop; sub borders { my($widget, $onoff) = @_; - my $part = $radar->currentpart; + my $part = $zinc->currentpart; my $contour = "noborder"; $contour = "contour" if ($onoff eq 'on'); - $radar->itemconfigure('current', $part, -border => $contour) if ($part >= 0); + $zinc->itemconfigure('current', $part, -border => $contour) if ($part >= 0); } sub finditems { my($cornerx, $cornery) = @_; print "--- enclosed --->", - join('|', $radar->find('enclosed',$origx, $origy, $cornerx, $cornery)),"\n"; + join('|', $zinc->find('enclosed',$origx, $origy, $cornerx, $cornery)),"\n"; print "--- overlapping --->", - join('|',$radar->find('overlapping',$origx, $origy, $cornerx, $cornery)),"\n\n"; + join('|',$zinc->find('overlapping',$origx, $origy, $cornerx, $cornery)),"\n\n"; } diff --git a/sandbox/zinc.tcl b/sandbox/zinc.tcl index a828934..0151046 100644 --- a/sandbox/zinc.tcl +++ b/sandbox/zinc.tcl @@ -1,6 +1,6 @@ #!/usr/bin/wish -f -load tkradar3.1.so +load tkzinc3.1.so package require Img set top 1 @@ -9,14 +9,14 @@ image create photo logo -file /usr/share/toccata/images/logo.gif image create photo logosmall -file /usr/share/toccata/images/logo-small.gif #image create photo papier -file /usr/share/toccata/images/dgtexture-dragstrip.xpm -set r [radar .r -backcolor gray -relief sunken] +set r [zinc .r -backcolor gray -relief sunken] pack .r -expand t -fill both set scale 1.0 set centerX 0.0 set centerY 0.0 -set radarWidth 800 -set radarHeight 500 -.r configure -width $radarWidth -height $radarHeight +set zincWidth 800 +set zincHeight 500 +.r configure -width $zincWidth -height $zincHeight #.r configure -drawbboxes t set view [.r add group $top -tags "controls"] @@ -45,27 +45,27 @@ grid .rc.shrink -row 1 -column 0 grid .rc.reset -row 1 -column 2 -sticky ew pack .rc -bind .r "RadarStyleConfig %W %w %h" +bind .r "ZincStyleConfig %W %w %h" -proc RadarStyleConfig {radar w h} { - global radarWidth radarHeight +proc ZincStyleConfig {zinc w h} { + global zincWidth zincHeight - set bw [$radar cget -borderwidth] - set radarWidth [expr $w - 2*$bw] - set radarHeight [expr $h - 2*$bw] - updateTransform $radar + set bw [$zinc cget -borderwidth] + set zincWidth [expr $w - 2*$bw] + set zincHeight [expr $h - 2*$bw] + updateTransform $zinc } -proc updateTransform {radar} { - global radarWidth radarHeight +proc updateTransform {zinc} { + global zincWidth zincHeight global scale centerX centerY global top - $radar treset $top - $radar scale $top 1 -1 - $radar translate $top [expr -$centerX] [expr -$centerY] - $radar scale $top $scale $scale - $radar translate $top [expr $radarWidth/2] [expr $radarHeight/2] + $zinc treset $top + $zinc scale $top 1 -1 + $zinc translate $top [expr -$centerX] [expr -$centerY] + $zinc scale $top $scale $scale + $zinc translate $top [expr $zincWidth/2] [expr $zincHeight/2] } # diff --git a/tkAppInit.c b/tkAppInit.c index 98fb6e3..4a27b4f 100644 --- a/tkAppInit.c +++ b/tkAppInit.c @@ -88,7 +88,7 @@ Tcl_AppInit(interp) * Call the init procedures for included packages. Each call should * look like this: */ - if (Tkradar_Init(interp) == TCL_ERROR) { + if (Tkzinc_Init(interp) == TCL_ERROR) { return TCL_ERROR; } -- cgit v1.1