aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--generic/tkZinc.c51
1 files changed, 33 insertions, 18 deletions
diff --git a/generic/tkZinc.c b/generic/tkZinc.c
index 5071330..b47abe1 100644
--- a/generic/tkZinc.c
+++ b/generic/tkZinc.c
@@ -165,7 +165,9 @@ static Tk_ConfigSpec config_specs[] = {
"DrawBBoxes", "0", Tk_Offset(WidgetInfo, draw_bboxes), 0},
{TK_CONFIG_COLOR, "-bboxcolor", "bboxColor", "BBoxColor",
"Pink", Tk_Offset(WidgetInfo, bbox_color), 0},
-
+ {TK_CONFIG_INT, "-lightangle", "lightAngle", "LightAngle",
+ "120", Tk_Offset(WidgetInfo, light_angle), 0},
+
{TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0}
};
@@ -192,6 +194,7 @@ static Tk_ConfigSpec config_specs[] = {
#define WIDTH_SPEC 17
#define BBOXES_SPEC 18
#define BBOXES_COLOR_SPEC 19
+#define LIGHT_ANGLE_SPEC 20
static void CmdDeleted _ANSI_ARGS_((ClientData client_data));
@@ -274,16 +277,16 @@ ZincCmd(ClientData client_data, /* Main window associated with
int argc, /* Number of arguments. */
Arg *args) /* Argument strings. */
{
- Tk_Window main = (Tk_Window) client_data;
+ Tk_Window top_w = (Tk_Window) client_data;
WidgetInfo *wi;
Tk_Window tkwin;
unsigned int num;
int major_op, first_err, first_evt;
-
+
if (!inited) {
InitZinc(interp);
}
-
+
if (argc == 1) {
Tcl_AppendResult(interp, ZINCVERSION, NULL);
return TCL_OK;
@@ -294,7 +297,7 @@ ZincCmd(ClientData client_data, /* Main window associated with
return ZN_ERROR;
}
- tkwin = Tk_CreateWindowFromPath(interp, main, LangString(args[1]), NULL);
+ tkwin = Tk_CreateWindowFromPath(interp, top_w, LangString(args[1]), NULL);
if (tkwin == NULL) {
return ZN_ERROR;
}
@@ -336,6 +339,7 @@ ZincCmd(ClientData client_data, /* Main window associated with
wi->fore_color = NULL;
wi->bbox_color = NULL;
wi->draw_bboxes = 0;
+ wi->light_angle = 120;
wi->border_width = 0;
wi->relief = TK_RELIEF_FLAT;
wi->opt_width = None;
@@ -348,15 +352,19 @@ ZincCmd(ClientData client_data, /* Main window associated with
wi->track_managed_history_size = 0;
wi->speed_vector_length = 0;
wi->tile = ZnUnspecifiedImage;
- wi->tile_name = "";
+ wi->tile_name = NULL;
+
wi->tag_table = (Tcl_HashTable *) ZnMalloc(sizeof(Tcl_HashTable));
Tcl_InitHashTable(wi->tag_table, TCL_ONE_WORD_KEYS);
wi->id_table = (Tcl_HashTable *) ZnMalloc(sizeof(Tcl_HashTable));
Tcl_InitHashTable(wi->id_table, TCL_ONE_WORD_KEYS);
wi->t_table = (Tcl_HashTable *) ZnMalloc(sizeof(Tcl_HashTable));
- Tcl_InitHashTable(wi->t_table, TCL_ONE_WORD_KEYS);
+ Tcl_InitHashTable(wi->t_table, TCL_ONE_WORD_KEYS);
+
wi->obj_id = 1;
+
wi->top_group = ITEM_P.CreateItem(wi, ZnGroup, 0, NULL);
+
#ifdef OM
wi->om_group_id = 0;
wi->om_group = wi->top_group;
@@ -372,6 +380,7 @@ ZincCmd(ClientData client_data, /* Main window associated with
wi->monitoring = False;
wi->num_updates = 0;
wi->last_time = wi->total_time = 0;
+ wi->num_items = 0;
wi->work_item_list = NULL;
wi->work_pts = ZnListNew(8, sizeof(ZnPoint));
@@ -380,7 +389,7 @@ ZincCmd(ClientData client_data, /* Main window associated with
ITEM_P.ResetClipStack(wi);
wi->transfo_stack = ZnListNew(8, sizeof(ZnTransfo));
ITEM_P.ResetTransformStack(wi);
-
+
for (num = 0; num < NUM_ALPHA_STEPS; num++) {
char name[INTEGER_SPACE+12];
@@ -1786,7 +1795,7 @@ WidgetCmd(ClientData client_data, /* Information about the widget. */
else if ((c == 'c') && (strncmp(LangString(args[1]), "clone", length) == 0)) {
if (argc < 3) {
Tcl_AppendResult(interp, "wrong # args: should be \"", LangString(args[0]),
- "\" clone tagOrId ?args?", NULL);
+ "\" clone tagOrId ?option value ...?", NULL);
goto error;
}
num = ZnItemsWithTagOrId(wi, LangString(args[2]), &item, &items);
@@ -1927,7 +1936,7 @@ WidgetCmd(ClientData client_data, /* Information about the widget. */
else if ((c == 'g') && (strncmp(LangString(args[1]), "group", length) == 0)) {
if (argc != 3) {
Tcl_AppendResult(interp, "wrong # args: should be \"", LangString(args[0]),
- "\" grouph tagOrId", NULL);
+ "\" group tagOrId", NULL);
goto error;
}
num = ZnItemsWithTagOrId(wi, LangString(args[2]), &item, NULL);
@@ -2204,7 +2213,7 @@ WidgetCmd(ClientData client_data, /* Information about the widget. */
if (argc < 3) {
Tcl_AppendResult(interp, "wrong # args: should be \"", LangString(args[0]),
- "\" raise tagOrId ?belowThis?", NULL);
+ "\" raise tagOrId ?aboveThis?", NULL);
goto error;
}
if (argc == 4) {
@@ -2674,7 +2683,7 @@ TileChange(ClientData client_data,
WidgetInfo *wi = (WidgetInfo *) client_data;
ZnBBox bbox;
- InvalidateImage(wi->tile);
+ InvalidateImage(wi->tile_name);
bbox.orig.x = bbox.orig.y = 0;
bbox.corner.x = wi->width;
bbox.corner.y = wi->height;
@@ -2713,7 +2722,7 @@ Configure(Tcl_Interp *interp, /* Used for error reporting. */
#define CONFIG_PROBE(offset) (ISSET(config_specs[offset].specFlags, \
TK_CONFIG_OPTION_SPECIFIED))
ZnBBox bbox;
-
+
if (Tk_ConfigureWidget(interp, wi->win, config_specs,
argc, args, (char *) wi, flags) != TCL_OK) {
return ZN_ERROR;
@@ -2729,7 +2738,7 @@ Configure(Tcl_Interp *interp, /* Used for error reporting. */
wi->back_color = Tk_3DBorderColor(wi->bg_border);
Tk_SetBackgroundFromBorder(wi->win, wi->bg_border);
- if (CONFIG_PROBE(BACK_COLOR_SPEC)) {
+ if (CONFIG_PROBE(BACK_COLOR_SPEC) || CONFIG_PROBE(LIGHT_ANGLE_SPEC)) {
bbox.orig.x = bbox.orig.y = 0;
bbox.corner.x = wi->width;
bbox.corner.y = wi->height;
@@ -3405,7 +3414,10 @@ Bind(ClientData client_data, /* Information about widget. */
wi->state = event_ptr->xbutton.state;
PickCurrentItem(wi, event_ptr);
wi->state ^= mask;
- DoEvent(wi, event_ptr);
+ if ((wi->current_item != ZN_NO_ITEM) &&
+ wi->current_item->class->IsSensitive(wi->current_item, wi->current_part)) {
+ DoEvent(wi, event_ptr);
+ }
}
else {
/*
@@ -3514,6 +3526,11 @@ Destroy(char *mem_ptr) /* Info about the widget. */
OmUnregister((void *) wi);
}
#endif
+
+ /*
+ * Print remaining items.
+ */
+ printf("Remaining item count: %d\n", wi->num_items);
/* Free all items. */
ITEM.DestroyItem(wi->top_group);
@@ -3553,11 +3570,9 @@ Destroy(char *mem_ptr) /* Info about the widget. */
}
/* Free the tile */
- if (strlen(wi->tile_name) != 0) {
- ZnFree(wi->tile_name);
- }
if (wi->tile != ZnUnspecifiedImage) {
Tk_FreeImage(wi->tile);
+ wi->tile = ZnUnspecifiedImage;
}
/* Free the double buffer pixmap */