aboutsummaryrefslogtreecommitdiff
path: root/generic/tkZinc.c
diff options
context:
space:
mode:
authorlecoanet2002-09-02 12:26:58 +0000
committerlecoanet2002-09-02 12:26:58 +0000
commit1465e32d6f48b47c212651399bc8afe8633dd8f2 (patch)
tree549d3975da021ef652c048d18e22b39e14ded321 /generic/tkZinc.c
parent4d700b3604fdd19d0d2078e286a2e9f0426d677a (diff)
downloadtkzinc-1465e32d6f48b47c212651399bc8afe8633dd8f2.zip
tkzinc-1465e32d6f48b47c212651399bc8afe8633dd8f2.tar.gz
tkzinc-1465e32d6f48b47c212651399bc8afe8633dd8f2.tar.bz2
tkzinc-1465e32d6f48b47c212651399bc8afe8633dd8f2.tar.xz
* (Contour): Lorsque l'on utilise contour sur un item ne
supportant pas la commande, au lieu d'une erreur, la commande retourne le nombre de contours (0 ou 1 en l'occurence). Si la commande est appel�e sans sous-commande bool�enne, elle retourne le nombre de contours de l'item. * (Contour): Corrige un message d'erreur vide en cas d'item ou de tag non trouv�. * (WidgetObjCmd): Corrige le traitement des erreurs dans la commande gname
Diffstat (limited to 'generic/tkZinc.c')
-rw-r--r--generic/tkZinc.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/generic/tkZinc.c b/generic/tkZinc.c
index a21f8f6..b8d14aa 100644
--- a/generic/tkZinc.c
+++ b/generic/tkZinc.c
@@ -2451,16 +2451,31 @@ Contour(WidgetInfo *wi,
result = ZnItemWithTagOrId(wi, args[2], &item, search_var);
if ((result == ZN_ERROR) || (item == ZN_NO_ITEM)){
+ Tcl_AppendResult(wi->interp, "unknown item \"", Tcl_GetString(args[2]),
+ "\"", NULL);
return ZN_ERROR;
}
if (!item->class->Contour) {
- Tcl_AppendResult(wi->interp, "class: \"", item->class->name,
- "\" doesn't handle the contour method", NULL);
- return ZN_ERROR;
+ if (item->class->GetClipVertices ||
+ item->class->GetContours) {
+ Tcl_SetObjResult(wi->interp, Tcl_NewIntObj(1));
+ }
+ else {
+ Tcl_SetObjResult(wi->interp, Tcl_NewIntObj(0));
+ }
+ return ZN_OK;
+ }
+ if (argc == 3) {
+ /*
+ * Requesting the number of contours.
+ */
+ Tcl_SetObjResult(wi->interp, Tcl_NewIntObj(item->class->Contour(item, -1, NULL)));
+
}
-
if (Tcl_GetIndexFromObj(wi->interp, args[3], op_strings,
"polygon operator", 0, &index) != ZN_OK) {
+ Tcl_AppendResult(wi->interp, "unknown contour operator \"", Tcl_GetString(args[3]),
+ "\"", NULL);
return ZN_ERROR;
}
cmd = ops[index];
@@ -2552,7 +2567,7 @@ Contour(WidgetInfo *wi,
}
}
- item->class->Contour(item, cmd, &poly);
+ Tcl_SetObjResult(wi->interp, Tcl_NewIntObj(item->class->Contour(item, cmd, &poly)));
if (!simple) {
POLY_FREE(&poly);
@@ -3216,9 +3231,9 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
case ZN_W_CONTOUR:
{
#ifdef GPC
- if (argc != 5) {
+ if ((argc != 5) && (argc != 3)) {
Tcl_WrongNumArgs(interp, 1, args,
- "contour tagOrId operator coordListOrTagOrId");
+ "contour tagOrId ?operator coordListOrTagOrId?");
goto error;
}
if (Contour(wi, argc, args, &search_var) == ZN_ERROR) {
@@ -3580,8 +3595,6 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
ok = ZnNameGradient(interp, wi->win, Tcl_GetString(args[2]),
Tcl_GetString(args[3]));
if (!ok) {
- Tcl_AppendResult(interp, "gradient name \"", Tcl_GetString(args[3]),
- "\", already in use or incorrect specification", NULL);
goto error;
}
}