From 64089dca388f5a9a8235a94b4372763875132219 Mon Sep 17 00:00:00 2001 From: lecoanet Date: Wed, 2 Feb 2000 14:01:15 +0000 Subject: Passage en Zinc --- generic/tkZinc.c | 1106 +++++++++++++++++++++++++++--------------------------- 1 file changed, 553 insertions(+), 553 deletions(-) (limited to 'generic/tkZinc.c') 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); } -- cgit v1.1