aboutsummaryrefslogtreecommitdiff
path: root/generic/Map.c
diff options
context:
space:
mode:
authorlecoanet2003-04-16 09:49:22 +0000
committerlecoanet2003-04-16 09:49:22 +0000
commit3261805fee19e346b4d1f84b23816daa1628764a (patch)
tree63ca1d7e4b0a3d9ae49cc0888e58033c3ef3fe22 /generic/Map.c
parenteed2656db0adae2c234c3d74af0913746ed5c444 (diff)
downloadtkzinc-3261805fee19e346b4d1f84b23816daa1628764a.zip
tkzinc-3261805fee19e346b4d1f84b23816daa1628764a.tar.gz
tkzinc-3261805fee19e346b4d1f84b23816daa1628764a.tar.bz2
tkzinc-3261805fee19e346b4d1f84b23816daa1628764a.tar.xz
Update from the Windows port and general cleanup/restructure
Diffstat (limited to 'generic/Map.c')
-rw-r--r--generic/Map.c579
1 files changed, 302 insertions, 277 deletions
diff --git a/generic/Map.c b/generic/Map.c
index 4d6244f..be00b17 100644
--- a/generic/Map.c
+++ b/generic/Map.c
@@ -37,7 +37,6 @@
#include "Image.h"
#include <memory.h>
-#include <malloc.h>
#include <stdio.h>
@@ -54,18 +53,18 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ "
*/
typedef struct _MapItemStruct {
- ItemStruct header;
+ ZnItemStruct header;
/* Public data */
ZnBool filled;
ZnImage fill_pattern;
ZnGradient *color;
- ZnFont text_font; /* null value -> use zn_map_text_font */
+ Tk_Font text_font; /* null value -> use zn_map_text_font */
char *map_info_name;
ZnList symbol_patterns;
/* Private data */
- MapInfoId map_info;
+ ZnMapInfoId map_info;
ZnList vectors;
ZnList dashed_vectors;
ZnList dotted_vectors;
@@ -77,7 +76,7 @@ typedef struct _MapItemStruct {
ZnList marks;
ZnList symbols;
ZnList texts;
-#ifdef GLX
+#ifdef GL
ZnTexFontInfo *tfi;
#endif
} MapItemStruct, *MapItem;
@@ -87,13 +86,13 @@ static ZnAttrConfig map_attrs[] = {
{ ZN_CONFIG_GRADIENT, "-color", NULL,
Tk_Offset(MapItemStruct, color), 0, ZN_DRAW_FLAG, False },
{ ZN_CONFIG_BOOL, "-composealpha", NULL,
- Tk_Offset(MapItemStruct, header.flags), COMPOSE_ALPHA_BIT,
+ Tk_Offset(MapItemStruct, header.flags), ZN_COMPOSE_ALPHA_BIT,
ZN_DRAW_FLAG, False },
{ ZN_CONFIG_BOOL, "-composerotation", NULL,
- Tk_Offset(MapItemStruct, header.flags), COMPOSE_ROTATION_BIT,
+ Tk_Offset(MapItemStruct, header.flags), ZN_COMPOSE_ROTATION_BIT,
ZN_COORDS_FLAG, False },
{ ZN_CONFIG_BOOL, "-composescale", NULL,
- Tk_Offset(MapItemStruct, header.flags), COMPOSE_SCALE_BIT,
+ Tk_Offset(MapItemStruct, header.flags), ZN_COMPOSE_SCALE_BIT,
ZN_COORDS_FLAG, False },
{ ZN_CONFIG_BOOL, "-filled", NULL,
Tk_Offset(MapItemStruct, filled), 1, ZN_COORDS_FLAG, False },
@@ -108,28 +107,28 @@ static ZnAttrConfig map_attrs[] = {
Tk_Offset(MapItemStruct, header.priority), 0,
ZN_DRAW_FLAG|ZN_REPICK_FLAG, False },
{ ZN_CONFIG_BOOL, "-sensitive", NULL,
- Tk_Offset(MapItemStruct, header.flags), SENSITIVE_BIT, ZN_REPICK_FLAG, False },
+ Tk_Offset(MapItemStruct, header.flags), ZN_SENSITIVE_BIT, ZN_REPICK_FLAG, False },
{ ZN_CONFIG_BITMAP_LIST, "-symbols", NULL,
Tk_Offset(MapItemStruct, symbol_patterns), 0,
ZN_COORDS_FLAG, False },
{ ZN_CONFIG_TAG_LIST, "-tags", NULL,
Tk_Offset(MapItemStruct, header.tags), 0, 0, False },
{ ZN_CONFIG_BOOL, "-visible", NULL,
- Tk_Offset(MapItemStruct, header.flags), VISIBLE_BIT,
+ Tk_Offset(MapItemStruct, header.flags), ZN_VISIBLE_BIT,
ZN_DRAW_FLAG|ZN_REPICK_FLAG|ZN_VIS_FLAG, False },
- { ZN_CONFIG_END, NULL, NULL, 0, 0, 0 }
+ { ZN_CONFIG_END, NULL, NULL, 0, 0, 0, False }
};
void
UpdateMapInfo(ClientData client_data,
- MapInfoId map_info)
+ ZnMapInfoId map_info __unused)
{
- Item item = (Item) client_data;
+ ZnItem item = (ZnItem) client_data;
/*printf("updating a map 'cause of a change in mapinfo\n");*/
- ITEM.Invalidate(item, ZN_COORDS_FLAG);
+ ZnITEM.Invalidate(item, ZN_COORDS_FLAG);
}
@@ -195,27 +194,27 @@ FreeLists(MapItem map)
**********************************************************************************
*/
static int
-Init(Item item,
- int *argc,
- Tcl_Obj *CONST *args[])
+Init(ZnItem item,
+ int *argc __unused,
+ Tcl_Obj *CONST *args[] __unused)
{
MapItem map = (MapItem) item;
- WidgetInfo *wi = item->wi;
+ ZnWInfo *wi = item->wi;
- SET(item->flags, VISIBLE_BIT);
- CLEAR(item->flags, SENSITIVE_BIT);
- SET(item->flags, COMPOSE_ALPHA_BIT);
- SET(item->flags, COMPOSE_ROTATION_BIT);
- SET(item->flags, COMPOSE_SCALE_BIT);
+ SET(item->flags, ZN_VISIBLE_BIT);
+ CLEAR(item->flags, ZN_SENSITIVE_BIT);
+ SET(item->flags, ZN_COMPOSE_ALPHA_BIT);
+ SET(item->flags, ZN_COMPOSE_ROTATION_BIT);
+ SET(item->flags, ZN_COMPOSE_SCALE_BIT);
item->part_sensitive = 0;
- item->priority = DEFAULT_MAP_PRIORITY;
+ item->priority = 0;
map->filled = False;
map->fill_pattern = ZnUnspecifiedImage;
map->symbol_patterns = NULL;
map->color = ZnGetGradientByValue(wi->fore_color);
map->text_font = Tk_GetFont(wi->interp, wi->win,
Tk_NameOfFont(wi->map_text_font));
-#ifdef GLX
+#ifdef GL
map->tfi = ZnGetTexFont(wi, map->text_font);
#endif
@@ -234,7 +233,7 @@ Init(Item item,
map->symbols = NULL;
map->texts = NULL;
- return ZN_OK;
+ return TCL_OK;
}
@@ -247,10 +246,10 @@ Init(Item item,
*/
static void
-Clone(Item item)
+Clone(ZnItem item)
{
MapItem map = (MapItem) item;
- WidgetInfo *wi = item->wi;
+ ZnWInfo *wi = item->wi;
if (map->vectors) {
map->vectors = ZnListDuplicate(map->vectors);
@@ -301,7 +300,7 @@ Clone(Item item)
map->color = ZnGetGradientByValue(map->color);
map->text_font = Tk_GetFont(wi->interp, wi->win, Tk_NameOfFont(map->text_font));
-#ifdef GLX
+#ifdef GL
map->tfi = ZnGetTexFont(wi, map->text_font);
#endif
if (map->fill_pattern != ZnUnspecifiedImage) {
@@ -309,7 +308,7 @@ Clone(Item item)
}
if (map->symbol_patterns) {
ZnImage *pats, *new_pats;
- int i, num_pats;
+ unsigned int i, num_pats;
pats = ZnListArray(map->symbol_patterns);
num_pats = ZnListSize(map->symbol_patterns);
@@ -331,14 +330,14 @@ Clone(Item item)
**********************************************************************************
*/
static void
-Destroy(Item item)
+Destroy(ZnItem item)
{
MapItem map = (MapItem) item;
FreeLists(map);
ZnFreeGradient(map->color);
Tk_FreeFont(map->text_font);
-#ifdef GLX
+#ifdef GL
if (map->tfi) {
ZnFreeTexFont(map->tfi);
}
@@ -375,34 +374,34 @@ Destroy(Item item)
**********************************************************************************
*/
static int
-Configure(Item item,
+Configure(ZnItem item,
int argc,
Tcl_Obj *CONST argv[],
int *flags)
{
- WidgetInfo *wi = item->wi;
+ ZnWInfo *wi = item->wi;
MapItem map = (MapItem) item;
-#ifdef GLX
- ZnFont old_font = map->text_font;
+#ifdef GL
+ Tk_Font old_font = map->text_font;
#endif
- if (ZnConfigureAttributes(wi, item, map_attrs, argc, argv, flags) == ZN_ERROR) {
- return ZN_ERROR;
+ if (ZnConfigureAttributes(wi, item, map_attrs, argc, argv, flags) == TCL_ERROR) {
+ return TCL_ERROR;
}
-#ifdef GLX
+#ifdef GL
if (old_font != map->text_font) {
if (map->tfi) {
ZnFreeTexFont(map->tfi);
}
map->tfi = ZnGetTexFont(wi, map->text_font);
if (!map->tfi) {
- return ZN_ERROR;
+ return TCL_ERROR;
}
}
#endif
if (ISSET(*flags, ZN_MAP_INFO_FLAG)) {
- MapInfoId map_info;
+ ZnMapInfoId map_info;
ZnBool error = False;
if (map->map_info_name) {
@@ -422,11 +421,11 @@ Configure(Item item,
map->map_info = map_info;
}
else {
- return ZN_ERROR;
+ return TCL_ERROR;
}
}
- return ZN_OK;
+ return TCL_OK;
}
@@ -438,15 +437,15 @@ Configure(Item item,
**********************************************************************************
*/
static int
-Query(Item item,
- int argc,
+Query(ZnItem item,
+ int argc __unused,
Tcl_Obj *CONST argv[])
{
- if (ZnQueryAttribute(item->wi, item, map_attrs, argv[0]) == ZN_ERROR) {
- return ZN_ERROR;
+ if (ZnQueryAttribute(item->wi, item, map_attrs, argv[0]) == TCL_ERROR) {
+ return TCL_ERROR;
}
- return ZN_OK;
+ return TCL_OK;
}
@@ -459,15 +458,15 @@ Query(Item item,
*/
static void
-ComputeCoordinates(Item item,
- ZnBool force)
+ComputeCoordinates(ZnItem item,
+ ZnBool force __unused)
{
- WidgetInfo *wi = item->wi;
+ ZnWInfo *wi = item->wi;
MapItem map = (MapItem) item;
- MapInfoId map_info;
- MapInfoLineStyle line_style;
+ ZnMapInfoId map_info;
+ ZnMapInfoLineStyle line_style;
int line_width;
- MapInfoTextStyle text_style;
+ ZnMapInfoTextStyle text_style;
char symbol;
char *text;
unsigned int i, j, cnt;
@@ -490,13 +489,13 @@ ComputeCoordinates(Item item,
ZnBBox bbox, bbox_inter, zn_bbox;
int x_from_w, y_from_w, x_to_w, y_to_w;
int radius, start_angle, extend;
- unsigned int radius_w;
- MapInfoPoint new_marks;
+ int radius_w;
+ ZnMapInfoPoint new_marks;
unsigned int n_new_marks;
- ZnFont text_font;
+ Tk_Font text_font;
int sym_w2=0, sym_h2=0;
- ResetBBox(&item->item_bounding_box);
+ ZnResetBBox(&item->item_bounding_box);
if (map->map_info == NULL) {
return;
@@ -530,67 +529,67 @@ ComputeCoordinates(Item item,
* First discover how many component of each kind
* there is in the MapInfo.
*/
- cnt = MapInfoNumLines(map_info);
+ cnt = ZnMapInfoNumLines(map_info);
for (i = 0; i < cnt; i++) {
- MapInfoGetLine(map_info, i, NULL, &line_style, NULL, NULL, NULL, NULL, NULL);
+ ZnMapInfoGetLine(map_info, i, NULL, &line_style, NULL, NULL, NULL, NULL, NULL);
switch (line_style) {
- case MapInfoLineSimple:
+ case ZnMapInfoLineSimple:
num_points += 2;
break;
- case MapInfoLineDashed:
+ case ZnMapInfoLineDashed:
num_dashed_points += 2;
break;
- case MapInfoLineDotted:
+ case ZnMapInfoLineDotted:
num_dotted_points += 2;
break;
- case MapInfoLineMixed:
+ case ZnMapInfoLineMixed:
num_mixed_points += 2;
break;
- case MapInfoLineMarked:
+ case ZnMapInfoLineMarked:
num_points += 2;
- MapInfoGetMarks(map_info, i, NULL, &n_new_marks);
+ ZnMapInfoGetMarks(map_info, i, NULL, &n_new_marks);
num_marks += n_new_marks;
break;
}
}
- cnt = MapInfoNumTexts(map_info);
+ cnt = ZnMapInfoNumTexts(map_info);
for (i = 0; i < cnt; i++) {
- MapInfoGetText(map_info, i, NULL, &text_style, &line_style, NULL, NULL, NULL);
- if (text_style == MapInfoUnderlinedText) {
+ ZnMapInfoGetText(map_info, i, NULL, &text_style, &line_style, NULL, NULL, NULL);
+ if (text_style == ZnMapInfoUnderlinedText) {
switch (line_style) {
- case MapInfoLineSimple:
- case MapInfoLineMarked:
+ case ZnMapInfoLineSimple:
+ case ZnMapInfoLineMarked:
num_points += 2;
break;
- case MapInfoLineDotted:
+ case ZnMapInfoLineDotted:
num_dotted_points += 2;
break;
- case MapInfoLineMixed:
+ case ZnMapInfoLineMixed:
num_mixed_points += 2;
break;
- case MapInfoLineDashed:
+ case ZnMapInfoLineDashed:
num_dashed_points += 2;
break;
}
}
}
- cnt = MapInfoNumArcs(map_info);
+ cnt = ZnMapInfoNumArcs(map_info);
for (i = 0; i < cnt; i++) {
- MapInfoGetArc(map_info, i, NULL, &line_style, NULL, NULL, NULL, NULL, NULL, NULL);
+ ZnMapInfoGetArc(map_info, i, NULL, &line_style, NULL, NULL, NULL, NULL, NULL, NULL);
switch (line_style) {
- case MapInfoLineSimple:
- case MapInfoLineMarked:
+ case ZnMapInfoLineSimple:
+ case ZnMapInfoLineMarked:
num_arcs += 2;
break;
- case MapInfoLineDotted:
+ case ZnMapInfoLineDotted:
num_dotted_arcs += 2;
break;
- case MapInfoLineMixed:
+ case ZnMapInfoLineMixed:
num_mixed_arcs += 2;
break;
- case MapInfoLineDashed:
+ case ZnMapInfoLineDashed:
num_dashed_arcs += 2;
break;
}
@@ -639,13 +638,13 @@ ComputeCoordinates(Item item,
}
ZnListAssertSize(map->marks, num_marks);
if (!map->symbols) {
- map->symbols = ZnListNew(MapInfoNumSymbols(map_info), sizeof(ZnPoint));
+ map->symbols = ZnListNew(ZnMapInfoNumSymbols(map_info), sizeof(ZnPoint));
}
- ZnListAssertSize(map->symbols, MapInfoNumSymbols(map_info));
+ ZnListAssertSize(map->symbols, ZnMapInfoNumSymbols(map_info));
if (!map->texts) {
- map->texts = ZnListNew(MapInfoNumTexts(map_info), sizeof(ZnPoint));
+ map->texts = ZnListNew(ZnMapInfoNumTexts(map_info), sizeof(ZnPoint));
}
- ZnListAssertSize(map->texts, MapInfoNumTexts(map_info));
+ ZnListAssertSize(map->texts, ZnMapInfoNumTexts(map_info));
/*
* Ask the pointers to the actual arrays.
@@ -668,7 +667,7 @@ ComputeCoordinates(Item item,
sym_h2 = (sym_h2+1)/2;
}
/*printf("Map: %d %d %d %d %d, texts: %d, symbols: %d\n", num_points, num_dashed_points, num_dotted_points,
- num_mixed_points, num_marks, MapInfoNumTexts(map_info), MapInfoNumSymbols(map_info));*/
+ num_mixed_points, num_marks, ZnMapInfoNumTexts(map_info), ZnMapInfoNumSymbols(map_info));*/
/*
* Reset the counts of points to compute the actual
* counts taking into account the clipping and the
@@ -684,9 +683,9 @@ ComputeCoordinates(Item item,
num_dotted_arcs = 0;
num_mixed_arcs = 0;
- cnt = MapInfoNumLines(map_info);
+ cnt = ZnMapInfoNumLines(map_info);
for (i = 0; i < cnt; i++) {
- MapInfoGetLine(map_info, i, NULL, &line_style, &line_width,
+ ZnMapInfoGetLine(map_info, i, NULL, &line_style, &line_width,
&x_from_w, &y_from_w, &x_to_w, &y_to_w);
tmp_from.x = x_from_w;
@@ -704,19 +703,19 @@ ComputeCoordinates(Item item,
}
if (!map->filled) {
- if (LineInBBox(&from, &to, &zn_bbox) < 0) {
+ if (ZnLineInBBox(&from, &to, &zn_bbox) < 0) {
continue;
}
}
switch (line_style) {
- case MapInfoLineSimple:
+ case ZnMapInfoLineSimple:
vectors[num_points] = from;
num_points++;
vectors[num_points] = to;
num_points++;
break;
- case MapInfoLineDashed:
+ case ZnMapInfoLineDashed:
if (!map->filled) {
dashed_vectors[num_dashed_points] = from;
num_dashed_points++;
@@ -724,7 +723,7 @@ ComputeCoordinates(Item item,
num_dashed_points++;
}
break;
- case MapInfoLineDotted:
+ case ZnMapInfoLineDotted:
if (!map->filled) {
dotted_vectors[num_dotted_points] = from;
num_dotted_points++;
@@ -732,7 +731,7 @@ ComputeCoordinates(Item item,
num_dotted_points++;
}
break;
- case MapInfoLineMixed:
+ case ZnMapInfoLineMixed:
if (!map->filled) {
mixed_vectors[num_mixed_points] = from;
num_mixed_points++;
@@ -740,14 +739,14 @@ ComputeCoordinates(Item item,
num_mixed_points++;
}
break;
- case MapInfoLineMarked:
+ case ZnMapInfoLineMarked:
if (!map->filled) {
vectors[num_points] = from;
num_points++;
vectors[num_points] = to;
num_points++;
if (wi->map_distance_symbol != ZnUnspecifiedImage) {
- MapInfoGetMarks(map_info, i, &new_marks, &n_new_marks);
+ ZnMapInfoGetMarks(map_info, i, &new_marks, &n_new_marks);
for (j = 0; j < n_new_marks; j++) {
/*
* The transform can be put outside the loop when
@@ -757,10 +756,10 @@ ComputeCoordinates(Item item,
tmp_from.x = new_marks[j].x;
tmp_from.y = new_marks[j].y;
ZnTransformPoint(wi->current_transfo, &tmp_from, &marks[num_marks]);
- AddPointToBBox(&item->item_bounding_box,
- marks[num_marks].x-sym_w2, marks[num_marks].y-sym_h2);
- AddPointToBBox(&item->item_bounding_box,
- marks[num_marks].x+sym_w2, marks[num_marks].x+sym_h2);
+ ZnAddPointToBBox(&item->item_bounding_box,
+ marks[num_marks].x-sym_w2, marks[num_marks].y-sym_h2);
+ ZnAddPointToBBox(&item->item_bounding_box,
+ marks[num_marks].x+sym_w2, marks[num_marks].x+sym_h2);
num_marks++;
}
}
@@ -769,11 +768,11 @@ ComputeCoordinates(Item item,
}
}
- cnt = MapInfoNumArcs(map_info);
+ cnt = ZnMapInfoNumArcs(map_info);
for (i = 0; i < cnt; i++) {
ZnPoint xp;
- MapInfoGetArc(map_info, i, NULL, &line_style, &line_width,
+ ZnMapInfoGetArc(map_info, i, NULL, &line_style, &line_width,
&x_from_w, &y_from_w, &radius_w, &start_angle, &extend);
tmp_from.x = x_from_w;
@@ -782,7 +781,7 @@ ComputeCoordinates(Item item,
tmp_from.x += radius_w;
tmp_from.y = 0;
ZnTransformPoint(wi->current_transfo, &tmp_from, &xp);
- radius = xp.x - center.x;
+ radius = ((int) (xp.x - center.x));
bbox.orig.x = center.x - radius;
bbox.orig.y = center.y - radius;
@@ -796,21 +795,21 @@ ComputeCoordinates(Item item,
continue;
}
- IntersectBBox(&zn_bbox, &bbox, &bbox_inter);
- if (IsEmptyBBox(&bbox_inter)) {
+ ZnIntersectBBox(&zn_bbox, &bbox, &bbox_inter);
+ if (ZnIsEmptyBBox(&bbox_inter)) {
continue;
}
- arc.x = center.x - radius;
- arc.y = center.y - radius;
+ arc.x = (int) (center.x - radius);
+ arc.y = (int) (center.y - radius);
arc.width = 2 * radius;
arc.height = arc.width;
arc.angle1 = start_angle*64;
arc.angle2 = extend*64;
switch (line_style) {
- case MapInfoLineSimple:
- case MapInfoLineMarked:
+ case ZnMapInfoLineSimple:
+ case ZnMapInfoLineMarked:
arcs[num_arcs] = arc;
num_arcs++;
@@ -818,9 +817,9 @@ ComputeCoordinates(Item item,
bbox.orig.y = arc.y;
bbox.corner.x = bbox.orig.x + arc.width + 1;
bbox.corner.y = bbox.orig.y + arc.height + 1;
- AddBBoxToBBox(&item->item_bounding_box, &bbox);
+ ZnAddBBoxToBBox(&item->item_bounding_box, &bbox);
break;
- case MapInfoLineDashed:
+ case ZnMapInfoLineDashed:
if (!map->filled) {
dashed_arcs[num_dashed_arcs] = arc;
num_dashed_arcs++;
@@ -829,10 +828,10 @@ ComputeCoordinates(Item item,
bbox.orig.y = arc.y;
bbox.corner.x = bbox.orig.x + arc.width + 1;
bbox.corner.y = bbox.orig.y + arc.height + 1;
- AddBBoxToBBox(&item->item_bounding_box, &bbox);
+ ZnAddBBoxToBBox(&item->item_bounding_box, &bbox);
}
break;
- case MapInfoLineDotted:
+ case ZnMapInfoLineDotted:
if (!map->filled) {
dotted_arcs[num_dotted_arcs] = arc;
num_dotted_arcs++;
@@ -841,10 +840,10 @@ ComputeCoordinates(Item item,
bbox.orig.y = arc.y;
bbox.corner.x = bbox.orig.x + arc.width + 1;
bbox.corner.y = bbox.orig.y + arc.height + 1;
- AddBBoxToBBox(&item->item_bounding_box, &bbox);
+ ZnAddBBoxToBBox(&item->item_bounding_box, &bbox);
}
break;
- case MapInfoLineMixed:
+ case ZnMapInfoLineMixed:
if (!map->filled) {
mixed_arcs[num_mixed_arcs] = arc;
num_mixed_arcs++;
@@ -853,7 +852,7 @@ ComputeCoordinates(Item item,
bbox.orig.y = arc.y;
bbox.corner.x = bbox.orig.x + arc.width + 1;
bbox.corner.y = bbox.orig.y + arc.height + 1;
- AddBBoxToBBox(&item->item_bounding_box, &bbox);
+ ZnAddBBoxToBBox(&item->item_bounding_box, &bbox);
}
break;
}
@@ -873,9 +872,9 @@ ComputeCoordinates(Item item,
ZnImage sym, *syms = ZnListArray(map->symbol_patterns);
int num_syms = ZnListSize(map->symbol_patterns);
- cnt = MapInfoNumSymbols(map_info);
+ cnt = ZnMapInfoNumSymbols(map_info);
for (i = 0; i < cnt; i++) {
- MapInfoGetSymbol(map_info, i, NULL, &x_from_w, &y_from_w, &symbol);
+ ZnMapInfoGetSymbol(map_info, i, NULL, &x_from_w, &y_from_w, &symbol);
tmp_from.x = x_from_w;
tmp_from.y = y_from_w;
ZnTransformPoint(wi->current_transfo, &tmp_from, &symbols[i]);
@@ -884,28 +883,28 @@ ComputeCoordinates(Item item,
ZnSizeOfImage(sym, &sym_w2, &sym_h2);
sym_w2 = (sym_w2+1)/2;
sym_h2 = (sym_h2+1)/2;
- AddPointToBBox(&item->item_bounding_box,
- symbols[i].x-sym_w2, symbols[i].y-sym_h2);
- AddPointToBBox(&item->item_bounding_box,
- symbols[i].x+sym_w2, symbols[i].y+sym_h2);
+ ZnAddPointToBBox(&item->item_bounding_box,
+ symbols[i].x-sym_w2, symbols[i].y-sym_h2);
+ ZnAddPointToBBox(&item->item_bounding_box,
+ symbols[i].x+sym_w2, symbols[i].y+sym_h2);
}
}
ZnListAssertSize(map->symbols, cnt);
}
- cnt = MapInfoNumTexts(map_info);
+ cnt = ZnMapInfoNumTexts(map_info);
text_font = map->text_font ? map->text_font : wi->map_text_font;
for (i = 0; i < cnt; i++) {
- MapInfoGetText(map_info, i, NULL,
+ ZnMapInfoGetText(map_info, i, NULL,
&text_style, &line_style, &x_from_w, &y_from_w, &text);
tmp_from.x = x_from_w;
tmp_from.y = y_from_w;
ZnTransformPoint(wi->current_transfo, &tmp_from, &texts[i]);
- AddStringToBBox(&item->item_bounding_box, text, text_font,
- texts[i].x, texts[i].y);
+ ZnAddStringToBBox(&item->item_bounding_box, text, text_font,
+ texts[i].x, texts[i].y);
- if (text_style == MapInfoUnderlinedText) {
- GetStringBBox(text, text_font, texts[i].x, texts[i].y, &bbox);
+ if (text_style == ZnMapInfoUnderlinedText) {
+ ZnGetStringBBox(text, text_font, texts[i].x, texts[i].y, &bbox);
from.x = bbox.orig.x;
from.y = bbox.corner.y;
@@ -913,26 +912,26 @@ ComputeCoordinates(Item item,
to.y = bbox.corner.y;
switch (line_style) {
- case MapInfoLineSimple:
- case MapInfoLineMarked:
+ case ZnMapInfoLineSimple:
+ case ZnMapInfoLineMarked:
vectors[num_points] = from;
num_points++;
vectors[num_points] = to;
num_points++;
break;
- case MapInfoLineDashed:
+ case ZnMapInfoLineDashed:
dashed_vectors[num_dashed_points] = from;
num_dashed_points++;
dashed_vectors[num_dashed_points] = to;
num_dashed_points++;
break;
- case MapInfoLineDotted:
+ case ZnMapInfoLineDotted:
dotted_vectors[num_dotted_points] = from;
num_dotted_points++;
dotted_vectors[num_dotted_points] = to;
num_dotted_points++;
break;
- case MapInfoLineMixed:
+ case ZnMapInfoLineMixed:
mixed_vectors[num_mixed_points] = from;
num_mixed_points++;
mixed_vectors[num_mixed_points] = to;
@@ -953,18 +952,18 @@ ComputeCoordinates(Item item,
ZnListAssertSize(map->mixed_vectors, num_mixed_points);
ZnListAssertSize(map->marks, num_marks);
- AddPointsToBBox(&item->item_bounding_box,
- (ZnPoint *) ZnListArray(map->vectors),
- ZnListSize(map->vectors));
- AddPointsToBBox(&item->item_bounding_box,
- (ZnPoint *) ZnListArray(map->dashed_vectors),
- ZnListSize(map->dashed_vectors));
- AddPointsToBBox(&item->item_bounding_box,
- (ZnPoint *) ZnListArray(map->dotted_vectors),
- ZnListSize(map->dotted_vectors));
- AddPointsToBBox(&item->item_bounding_box,
- (ZnPoint *) ZnListArray(map->mixed_vectors),
- ZnListSize(map->mixed_vectors));
+ ZnAddPointsToBBox(&item->item_bounding_box,
+ (ZnPoint *) ZnListArray(map->vectors),
+ ZnListSize(map->vectors));
+ ZnAddPointsToBBox(&item->item_bounding_box,
+ (ZnPoint *) ZnListArray(map->dashed_vectors),
+ ZnListSize(map->dashed_vectors));
+ ZnAddPointsToBBox(&item->item_bounding_box,
+ (ZnPoint *) ZnListArray(map->dotted_vectors),
+ ZnListSize(map->dotted_vectors));
+ ZnAddPointsToBBox(&item->item_bounding_box,
+ (ZnPoint *) ZnListArray(map->mixed_vectors),
+ ZnListSize(map->mixed_vectors));
}
@@ -979,8 +978,8 @@ ComputeCoordinates(Item item,
*/
static int
-ToArea(Item item,
- ZnToArea ta)
+ToArea(ZnItem item __unused,
+ ZnToArea ta __unused)
{
return -1;
}
@@ -995,13 +994,14 @@ ToArea(Item item,
*/
static void
-Draw(Item item)
+Draw(ZnItem item)
{
- WidgetInfo *wi = item->wi;
+ ZnWInfo *wi = item->wi;
MapItem map = (MapItem) item;
- MapInfoId map_info;
+ ZnMapInfoId map_info;
ZnPoint *points;
XPoint *xpoints;
+ XArc *arcs;
char *text;
char tmp_str[] = ".";
XGCValues values;
@@ -1014,7 +1014,7 @@ Draw(Item item)
map_info = map->map_info;
- values.foreground = ZnPixel(ZnGetGradientColor(map->color, 0, NULL));
+ values.foreground = ZnPixel(ZnGetGradientColor(map->color, 0.0, NULL));
if (map->filled) {
if (ZnListSize(map->vectors) || ZnListSize(map->arcs)) {
@@ -1024,7 +1024,7 @@ Draw(Item item)
}
else { /* Fill stippled */
values.fill_style = FillStippled;
- values.stipple = ZnImagePixmap(map->fill_pattern, NULL);
+ values.stipple = ZnImagePixmap(map->fill_pattern);
XChangeGC(wi->dpy, wi->gc,
GCFillStyle | GCStipple | GCForeground, &values);
}
@@ -1035,23 +1035,28 @@ Draw(Item item)
xpoints = (XPoint *) ZnListArray(wi->work_xpts);
points = (ZnPoint *) ZnListArray(map->vectors);
for (i = 0; i < cnt; i++) {
- xpoints[i].x = points[i].x;
- xpoints[i].y = points[i].y;
+ xpoints[i].x = (int) points[i].x;
+ xpoints[i].y = (int) points[i].y;
}
- XFillPolygon(wi->dpy, wi->draw_buffer, wi->gc, xpoints, cnt,
+ XFillPolygon(wi->dpy, wi->draw_buffer, wi->gc, xpoints, (int) cnt,
Nonconvex, CoordModeOrigin);
}
if (ZnListSize(map->arcs)) {
- XFillArcs(wi->dpy, wi->draw_buffer, wi->gc,
- (XArc *) ZnListArray(map->arcs), ZnListSize(map->arcs));
+ arcs = ZnListArray(map->arcs);
+ cnt = ZnListSize(map->arcs);
+ for (i = 0; i < cnt; i++, arcs++) {
+ XFillArc(wi->dpy, wi->draw_buffer, wi->gc,
+ arcs->x, arcs->y, arcs->width, arcs->height,
+ arcs->angle1, arcs->angle2);
+ }
}
}
}
else { /* Not filled */
if (ZnListSize(map->vectors)) {
- ZnSetLineStyle(wi, LINE_SIMPLE);
+ ZnSetLineStyle(wi, ZN_LINE_SIMPLE);
values.fill_style = FillSolid;
values.line_width = 0;
XChangeGC(wi->dpy, wi->gc,
@@ -1065,21 +1070,24 @@ Draw(Item item)
cnt = ZnListSize(map->vectors);
points = (ZnPoint *) ZnListArray(map->vectors);
for (i = 0; i < cnt; i += 2) {
- if (LineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
- MapInfoGetLine(map_info, i/2, NULL, NULL, &line_width, NULL,
+ if (ZnLineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
+ ZnMapInfoGetLine(map_info, i/2, NULL, NULL, &line_width, NULL,
NULL, NULL, NULL);
if (line_width != values.line_width) {
values.line_width = line_width;
XChangeGC(wi->dpy, wi->gc, GCLineWidth, &values);
}
XDrawLine(wi->dpy, wi->draw_buffer, wi->gc,
- points[i].x, points[i].y, points[i+1].x, points[i+1].y);
+ (int) points[i].x,
+ (int) points[i].y,
+ (int) points[i+1].x,
+ (int) points[i+1].y);
}
}
}
if (ZnListSize(map->dashed_vectors)) {
- ZnSetLineStyle(wi, LINE_DASHED);
+ ZnSetLineStyle(wi, ZN_LINE_DASHED);
values.fill_style = FillSolid;
values.line_width = 0;
XChangeGC(wi->dpy, wi->gc, GCFillStyle | GCLineWidth | GCForeground, &values);
@@ -1091,20 +1099,23 @@ Draw(Item item)
cnt = ZnListSize(map->dashed_vectors);
points = (ZnPoint *) ZnListArray(map->dashed_vectors);
for (i = 0; i < cnt; i += 2) {
- if (LineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
- MapInfoGetLine(map_info, i/2, NULL, NULL, &line_width, NULL, NULL, NULL, NULL);
+ if (ZnLineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
+ ZnMapInfoGetLine(map_info, i/2, NULL, NULL, &line_width, NULL, NULL, NULL, NULL);
if (line_width != values.line_width) {
values.line_width = line_width;
XChangeGC(wi->dpy, wi->gc, GCLineWidth, &values);
}
XDrawLine(wi->dpy, wi->draw_buffer, wi->gc,
- points[i].x, points[i].y, points[i+1].x, points[i+1].y);
+ (int) points[i].x,
+ (int) points[i].y,
+ (int) points[i+1].x,
+ (int) points[i+1].y);
}
}
}
if (ZnListSize(map->dotted_vectors)) {
- ZnSetLineStyle(wi, LINE_DOTTED);
+ ZnSetLineStyle(wi, ZN_LINE_DOTTED);
values.fill_style = FillSolid;
values.line_width = 0;
XChangeGC(wi->dpy, wi->gc,
@@ -1117,20 +1128,23 @@ Draw(Item item)
cnt = ZnListSize(map->dotted_vectors);
points = (ZnPoint *) ZnListArray(map->dotted_vectors);
for (i = 0; i < cnt; i += 2) {
- if (LineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
- MapInfoGetLine(map_info, i/2, NULL, NULL, &line_width, NULL, NULL, NULL, NULL);
+ if (ZnLineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
+ ZnMapInfoGetLine(map_info, i/2, NULL, NULL, &line_width, NULL, NULL, NULL, NULL);
if (line_width != values.line_width) {
values.line_width = line_width;
XChangeGC(wi->dpy, wi->gc, GCLineWidth, &values);
}
XDrawLine(wi->dpy, wi->draw_buffer, wi->gc,
- points[i].x, points[i].y, points[i+1].x, points[i+1].y);
+ (int) points[i].x,
+ (int) points[i].y,
+ (int) points[i+1].x,
+ (int) points[i+1].y);
}
}
}
if (ZnListSize(map->mixed_vectors)) {
- ZnSetLineStyle(wi, LINE_MIXED);
+ ZnSetLineStyle(wi, ZN_LINE_MIXED);
values.fill_style = FillSolid;
values.line_width = 0;
XChangeGC(wi->dpy, wi->gc, GCFillStyle | GCLineWidth | GCForeground, &values);
@@ -1142,82 +1156,86 @@ Draw(Item item)
cnt = ZnListSize(map->mixed_vectors);
points = (ZnPoint *) ZnListArray(map->mixed_vectors);
for (i = 0; i < cnt; i += 2) {
- if (LineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
- MapInfoGetLine(map_info, i/2, NULL, NULL, &line_width, NULL, NULL, NULL, NULL);
+ if (ZnLineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
+ ZnMapInfoGetLine(map_info, i/2, NULL, NULL, &line_width, NULL, NULL, NULL, NULL);
if (line_width != values.line_width) {
values.line_width = line_width;
XChangeGC(wi->dpy, wi->gc, GCLineWidth, &values);
}
XDrawLine(wi->dpy, wi->draw_buffer, wi->gc,
- points[i].x, points[i].y, points[i+1].x, points[i+1].y);
+ (int) points[i].x,
+ (int) points[i].y,
+ (int) points[i+1].x,
+ (int) points[i+1].y);
}
}
}
if (ZnListSize(map->arcs)) {
- ZnSetLineStyle(wi, LINE_SIMPLE);
+ ZnSetLineStyle(wi, ZN_LINE_SIMPLE);
values.fill_style = FillSolid;
values.line_width = 0;
XChangeGC(wi->dpy, wi->gc, GCFillStyle | GCLineWidth | GCForeground, &values);
-
- /* !! WARNING !! XDrawArcs can't handle an unlimited number of arcs
- in releases R4 and older */
-
- XDrawArcs(wi->dpy, wi->draw_buffer, wi->gc,
- (XArc *) ZnListArray(map->arcs), ZnListSize(map->arcs));
+ arcs = ZnListArray(map->arcs);
+ cnt = ZnListSize(map->arcs);
+ for (i = 0; i < cnt; i++, arcs++) {
+ XDrawArc(wi->dpy, wi->draw_buffer, wi->gc,
+ arcs->x, arcs->y, arcs->width, arcs->height,
+ arcs->angle1, arcs->angle2);
+ }
}
if (ZnListSize(map->dashed_arcs)) {
- ZnSetLineStyle(wi, LINE_DASHED);
+ ZnSetLineStyle(wi, ZN_LINE_DASHED);
values.fill_style = FillSolid;
values.line_width = 0;
XChangeGC(wi->dpy, wi->gc, GCFillStyle | GCLineWidth | GCForeground, &values);
-
- /* !! WARNING !! XDrawArcs can't handle an unlimited number of arcs
- in releases R4 and older */
-
- XDrawArcs(wi->dpy, wi->draw_buffer, wi->gc,
- (XArc *) ZnListArray(map->dashed_arcs),
- ZnListSize(map->dashed_arcs));
+ arcs = ZnListArray(map->arcs);
+ cnt = ZnListSize(map->arcs);
+ for (i = 0; i < cnt; i++, arcs++) {
+ XDrawArc(wi->dpy, wi->draw_buffer, wi->gc,
+ arcs->x, arcs->y, arcs->width, arcs->height,
+ arcs->angle1, arcs->angle2);
+ }
}
if (ZnListSize(map->dotted_arcs)) {
- ZnSetLineStyle(wi, LINE_DOTTED);
+ ZnSetLineStyle(wi, ZN_LINE_DOTTED);
values.fill_style = FillSolid;
values.line_width = 0;
XChangeGC(wi->dpy, wi->gc, GCFillStyle | GCLineWidth | GCForeground, &values);
-
- /* !! WARNING !! XDrawArcs can't handle an unlimited number of arcs
- in releases R4 and older */
-
- XDrawArcs(wi->dpy, wi->draw_buffer, wi->gc,
- (XArc *) ZnListArray(map->dotted_arcs),
- ZnListSize(map->dotted_arcs));
+ arcs = ZnListArray(map->arcs);
+ cnt = ZnListSize(map->arcs);
+ for (i = 0; i < cnt; i++, arcs++) {
+ XDrawArc(wi->dpy, wi->draw_buffer, wi->gc,
+ arcs->x, arcs->y, arcs->width, arcs->height,
+ arcs->angle1, arcs->angle2);
+ }
}
if (ZnListSize(map->mixed_arcs)) {
- ZnSetLineStyle(wi, LINE_MIXED);
+ ZnSetLineStyle(wi, ZN_LINE_MIXED);
values.fill_style = FillSolid;
values.line_width = 0;
XChangeGC(wi->dpy, wi->gc, GCFillStyle | GCLineWidth | GCForeground, &values);
-
- /* !! WARNING !! XDrawArcs can't handle an unlimited number of arcs
- in releases R4 and older */
-
- XDrawArcs(wi->dpy, wi->draw_buffer, wi->gc,
- (XArc *) ZnListArray(map->mixed_arcs),
- ZnListSize(map->mixed_arcs));
+ arcs = ZnListArray(map->arcs);
+ cnt = ZnListSize(map->arcs);
+ for (i = 0; i < cnt; i++, arcs++) {
+ XDrawArc(wi->dpy, wi->draw_buffer, wi->gc,
+ arcs->x, arcs->y, arcs->width, arcs->height,
+ arcs->angle1, arcs->angle2);
+ }
}
if (ZnListSize(map->texts)) {
/* For the Tk widget we don't have to bother with old
* compatibility issues.
*/
- values.font = ZnFontId(map->text_font);
+ values.font = Tk_FontId(map->text_font);
values.fill_style = FillSolid;
XChangeGC(wi->dpy, wi->gc,
GCFillStyle | GCFont | GCForeground, &values);
@@ -1225,14 +1243,16 @@ Draw(Item item)
cnt = ZnListSize(map->texts);
points = (ZnPoint *) ZnListArray(map->texts);
for (i = 0; i < cnt; i++) {
- MapInfoGetText(map_info, i, NULL, NULL, NULL, NULL, NULL, &text);
- XDrawString(wi->dpy, wi->draw_buffer, wi->gc,
- points[i].x, points[i].y, text, strlen(text));
+ ZnMapInfoGetText(map_info, i, NULL, NULL, NULL, NULL, NULL, &text);
+ Tk_DrawChars(wi->dpy, wi->draw_buffer, wi->gc,
+ map->text_font, text, (int) strlen(text),
+ (int) points[i].x, (int) points[i].y);
}
}
if (ZnListSize(map->symbols) || ZnListSize(map->marks)) {
- int w, h, ox, oy;
+ int ox, oy;
+ unsigned int w, h;
ZnImage sym;
values.fill_style = FillStippled;
@@ -1245,13 +1265,13 @@ Draw(Item item)
cnt = ZnListSize(map->symbols);
points = ZnListArray(map->symbols);
for (i = 0; i < cnt; i++) {
- MapInfoGetSymbol(map_info, i, NULL, NULL, NULL, &(tmp_str[0]));
+ ZnMapInfoGetSymbol(map_info, i, NULL, NULL, NULL, &(tmp_str[0]));
sym = syms[tmp_str[0]%num_syms];
if (sym != ZnUnspecifiedImage) {
ZnSizeOfImage(sym, &w ,&h);
- ox = points[i].x-w/2;
- oy = points[i].y-h/2;
- values.stipple = ZnImagePixmap(sym, NULL);
+ ox = ((int) points[i].x) - w/2;
+ oy = ((int) points[i].y) - h/2;
+ values.stipple = ZnImagePixmap(sym);
values.ts_x_origin = ox;
values.ts_y_origin = oy;
XChangeGC(wi->dpy, wi->gc,
@@ -1265,11 +1285,11 @@ Draw(Item item)
ZnSizeOfImage(wi->map_distance_symbol, &w, &h);
cnt = ZnListSize(map->marks);
points = ZnListArray(map->marks);
- values.stipple = ZnImagePixmap(wi->map_distance_symbol, NULL);
+ values.stipple = ZnImagePixmap(wi->map_distance_symbol);
XChangeGC(wi->dpy, wi->gc, GCStipple, &values);
for (i = 0; i < cnt; i++) {
- ox = points[i].x-w/2;
- oy = points[i].y-h/2;
+ ox = ((int) points[i].x) - w/2;
+ oy = ((int) points[i].y) - h/2;
values.ts_x_origin = ox;
values.ts_y_origin = oy;
XChangeGC(wi->dpy, wi->gc, GCTileStipXOrigin|GCTileStipYOrigin, &values);
@@ -1288,27 +1308,27 @@ Draw(Item item)
*
**********************************************************************************
*/
+#ifdef GL
static void
-Render(Item item)
+Render(ZnItem item)
{
-#ifdef GLX
- WidgetInfo *wi = item->wi;
+ ZnWInfo *wi = item->wi;
MapItem map = (MapItem) item;
- MapInfoId map_info;
+ ZnMapInfoId map_info;
ZnPoint *points, p;
char *text;
char tmp_str[] = ".";
unsigned int i, cnt;
- int line_width, new_width;
XColor *color;
- int alpha, w, h;
-
+ int line_width, new_width, w, h;
+ unsigned short alpha;
+
if (!map->map_info) {
return;
}
map_info = map->map_info;
- color = ZnGetGradientColor(map->color, 0, &alpha);
+ color = ZnGetGradientColor(map->color, 0.0, &alpha);
alpha = ZnComposeAlpha(alpha, wi->alpha);
glColor4us(color->red, color->green, color->blue, alpha);
if (map->filled) {
@@ -1316,11 +1336,11 @@ Render(Item item)
if (map->fill_pattern != ZnUnspecifiedImage) {
/* Fill stippled */
glEnable(GL_POLYGON_STIPPLE);
- glPolygonStipple(ZnImagePattern(map->fill_pattern, NULL));
+ glPolygonStipple(ZnImageMask(map->fill_pattern, NULL));
}
cnt = ZnListSize(map->vectors);
if (cnt) {
- /* TODO_GLX: Need to have a tesselated polygon */
+ /* TODO_GL: Need to have a tesselated polygon */
}
if (ZnListSize(map->arcs)) {
}
@@ -1330,42 +1350,42 @@ Render(Item item)
else { /* Not filled */
if (ZnListSize(map->vectors)) {
line_width = 1;
- glLineWidth(line_width);
- ZnSetLineStyle(wi, LINE_SIMPLE);
+ glLineWidth((GLfloat) line_width);
+ ZnSetLineStyle(wi, ZN_LINE_SIMPLE);
cnt = ZnListSize(map->vectors);
points = ZnListArray(map->vectors);
glBegin(GL_LINES);
for (i = 0; i < cnt; i += 2) {
- if (LineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
- MapInfoGetLine(map_info, i/2, NULL, NULL, &new_width, NULL,
+ if (ZnLineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
+ ZnMapInfoGetLine(map_info, i/2, NULL, NULL, &new_width, NULL,
NULL, NULL, NULL);
if (new_width != line_width) {
line_width = new_width;
- glLineWidth(line_width);
+ glLineWidth((GLfloat) line_width);
}
- glVertex2f(points[i].x, points[i].y);
- glVertex2f(points[i+1].x, points[i+1].y);
+ glVertex2d(points[i].x, points[i].y);
+ glVertex2d(points[i+1].x, points[i+1].y);
}
}
glEnd();
}
if (ZnListSize(map->dashed_vectors)) {
line_width = 1;
- glLineWidth(line_width);
- ZnSetLineStyle(wi, LINE_DASHED);
+ glLineWidth((GLfloat) line_width);
+ ZnSetLineStyle(wi, ZN_LINE_DASHED);
cnt = ZnListSize(map->dashed_vectors);
points = ZnListArray(map->dashed_vectors);
glBegin(GL_LINES);
for (i = 0; i < cnt; i += 2) {
- if (LineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
- MapInfoGetLine(map_info, i/2, NULL, NULL, &new_width, NULL,
+ if (ZnLineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
+ ZnMapInfoGetLine(map_info, i/2, NULL, NULL, &new_width, NULL,
NULL, NULL, NULL);
if (new_width != line_width) {
line_width = new_width;
- glLineWidth(line_width);
+ glLineWidth((GLfloat) line_width);
}
- glVertex2f(points[i].x, points[i].y);
- glVertex2f(points[i+1].x, points[i+1].y);
+ glVertex2d(points[i].x, points[i].y);
+ glVertex2d(points[i+1].x, points[i+1].y);
}
}
glEnd();
@@ -1373,21 +1393,21 @@ Render(Item item)
}
if (ZnListSize(map->dotted_vectors)) {
line_width = 1;
- glLineWidth(line_width);
- ZnSetLineStyle(wi, LINE_DOTTED);
+ glLineWidth((GLfloat) line_width);
+ ZnSetLineStyle(wi, ZN_LINE_DOTTED);
cnt = ZnListSize(map->dotted_vectors);
points = ZnListArray(map->dotted_vectors);
glBegin(GL_LINES);
for (i = 0; i < cnt; i += 2) {
- if (LineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
- MapInfoGetLine(map_info, i/2, NULL, NULL, &new_width, NULL,
+ if (ZnLineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
+ ZnMapInfoGetLine(map_info, i/2, NULL, NULL, &new_width, NULL,
NULL, NULL, NULL);
if (new_width != line_width) {
line_width = new_width;
- glLineWidth(line_width);
+ glLineWidth((GLfloat) line_width);
}
- glVertex2f(points[i].x, points[i].y);
- glVertex2f(points[i+1].x, points[i+1].y);
+ glVertex2d(points[i].x, points[i].y);
+ glVertex2d(points[i+1].x, points[i+1].y);
}
}
glEnd();
@@ -1395,21 +1415,21 @@ Render(Item item)
}
if (ZnListSize(map->mixed_vectors)) {
line_width = 1;
- glLineWidth(line_width);
- ZnSetLineStyle(wi, LINE_MIXED);
+ glLineWidth((GLfloat) line_width);
+ ZnSetLineStyle(wi, ZN_LINE_MIXED);
cnt = ZnListSize(map->mixed_vectors);
points = ZnListArray(map->mixed_vectors);
glBegin(GL_LINES);
for (i = 0; i < cnt; i += 2) {
- if (LineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
- MapInfoGetLine(map_info, i/2, NULL, NULL, &new_width, NULL,
+ if (ZnLineInBBox(&points[i], &points[i+1], &wi->damaged_area) >= 0) {
+ ZnMapInfoGetLine(map_info, i/2, NULL, NULL, &new_width, NULL,
NULL, NULL, NULL);
if (new_width != line_width) {
line_width = new_width;
- glLineWidth(line_width);
+ glLineWidth((GLfloat) line_width);
}
- glVertex2f(points[i].x, points[i].y);
- glVertex2f(points[i+1].x, points[i+1].y);
+ glVertex2d(points[i].x, points[i].y);
+ glVertex2d(points[i+1].x, points[i+1].y);
}
}
glEnd();
@@ -1418,25 +1438,25 @@ Render(Item item)
if (ZnListSize(map->arcs)) {
line_width = 1;
- glLineWidth(line_width);
+ glLineWidth((GLfloat) line_width);
}
if (ZnListSize(map->dashed_arcs)) {
line_width = 1;
- glLineWidth(line_width);
+ glLineWidth((GLfloat) line_width);
glLineStipple(1, 0xF0F0);
glEnable(GL_LINE_STIPPLE);
glDisable(GL_LINE_STIPPLE);
}
if (ZnListSize(map->dotted_arcs)) {
line_width = 1;
- glLineWidth(line_width);
+ glLineWidth((GLfloat) line_width);
glLineStipple(1, 0x18C3);
glEnable(GL_LINE_STIPPLE);
glDisable(GL_LINE_STIPPLE);
}
if (ZnListSize(map->mixed_arcs)) {
line_width = 1;
- glLineWidth(line_width);
+ glLineWidth((GLfloat) line_width);
glLineStipple(1, 0x27FF);
glEnable(GL_LINE_STIPPLE);
glDisable(GL_LINE_STIPPLE);
@@ -1451,8 +1471,8 @@ Render(Item item)
points = ZnListArray(map->texts);
for (i = 0; i < cnt; i++, points++) {
glPushMatrix();
- MapInfoGetText(map_info, i, NULL, NULL, NULL, NULL, NULL, &text);
- glTranslatef(points->x, points->y, 0.0);
+ ZnMapInfoGetText(map_info, i, NULL, NULL, NULL, NULL, NULL, &text);
+ glTranslated(points->x, points->y, 0.0);
ZnRenderString(map->tfi, text, strlen(text));
glPopMatrix();
}
@@ -1466,7 +1486,7 @@ Render(Item item)
cnt = ZnListSize(map->symbols);
points = ZnListArray(map->symbols);
for (i = 0; i < cnt; i++) {
- MapInfoGetSymbol(map_info, i, NULL, NULL, NULL, &(tmp_str[0]));
+ ZnMapInfoGetSymbol(map_info, i, NULL, NULL, NULL, &(tmp_str[0]));
sym = syms[tmp_str[0]%num_syms];
if (sym != ZnUnspecifiedImage) {
ZnSizeOfImage(sym, &w, &h);
@@ -1488,8 +1508,13 @@ Render(Item item)
}
}
}
-#endif
}
+#else
+static void
+Render(ZnItem item __unused)
+{
+}
+#endif
/*
@@ -1500,10 +1525,10 @@ Render(Item item)
**********************************************************************************
*/
static ZnBool
-IsSensitive(Item item,
- int item_part)
+IsSensitive(ZnItem item,
+ int item_part __unused)
{
- return (ISSET(item->flags, SENSITIVE_BIT) &&
+ return (ISSET(item->flags, ZN_SENSITIVE_BIT) &&
item->parent->class->IsSensitive(item->parent, ZN_NO_PART));
}
@@ -1521,8 +1546,8 @@ IsSensitive(Item item,
**********************************************************************************
*/
static double
-Pick(Item item,
- ZnPick ps)
+Pick(ZnItem item __unused,
+ ZnPick ps __unused)
{
return 1e40;
}
@@ -1537,17 +1562,17 @@ Pick(Item item,
**********************************************************************************
*/
static int
-Coords(Item item,
- int contour,
- int index,
- int cmd,
- ZnPoint **pts,
- char **controls,
- int *num_pts)
+Coords(ZnItem item,
+ int contour __unused,
+ int index __unused,
+ int cmd __unused,
+ ZnPoint **pts __unused,
+ char **controls __unused,
+ unsigned int *num_pts __unused)
{
Tcl_AppendResult(item->wi->interp,
" maps doesn't support the coords command", NULL);
- return ZN_ERROR;
+ return TCL_ERROR;
}
@@ -1559,8 +1584,8 @@ Coords(Item item,
**********************************************************************************
*/
static void
-PostScript(Item item,
- PostScriptInfo ps_info)
+PostScript(ZnItem item __unused,
+ ZnPostScriptInfo ps_info __unused)
{
}
@@ -1573,7 +1598,7 @@ PostScript(Item item,
**********************************************************************************
*/
-static ItemClassStruct MAP_ITEM_CLASS = {
+static ZnItemClassStruct MAP_ITEM_CLASS = {
sizeof(MapItemStruct),
0, /* num_parts */
False, /* has_anchors */