diff options
Diffstat (limited to 'generic/Item.c')
-rw-r--r-- | generic/Item.c | 47 |
1 files changed, 37 insertions, 10 deletions
diff --git a/generic/Item.c b/generic/Item.c index ae71348..f6ed14d 100644 --- a/generic/Item.c +++ b/generic/Item.c @@ -97,6 +97,8 @@ static char *attribute_type_strings[] = { "fillrule", "short", "unsignedshort" + "char" + "unsignedchar" }; @@ -770,6 +772,34 @@ ZnConfigureAttributes(ZnWInfo *wi, } } break; + case ZN_CONFIG_CHAR: + case ZN_CONFIG_UCHAR: + case ZN_CONFIG_ALPHA: + { + int integer; + if (Tcl_GetIntFromObj(wi->interp, args[i+1], &integer) == TCL_ERROR) { + return TCL_ERROR; + } + switch (desc->type) { + case ZN_CONFIG_UCHAR: + if (integer < 0) { + integer = 0; + } + case ZN_CONFIG_ALPHA: + if (integer < 0) { + integer = 0; + } + if (integer > 100) { + integer = 100; + } + break; + } + if (integer != *((char *) valp)) { + *((char *) valp) = integer; + *flags |= desc->flags; + } + break; + } case ZN_CONFIG_SHORT: case ZN_CONFIG_USHORT: { @@ -806,7 +836,6 @@ ZnConfigureAttributes(ZnWInfo *wi, case ZN_CONFIG_INT: case ZN_CONFIG_UINT: case ZN_CONFIG_ANGLE: - case ZN_CONFIG_ALPHA: { int integer; if (Tcl_GetIntFromObj(wi->interp, args[i+1], &integer) == TCL_ERROR) { @@ -823,14 +852,6 @@ ZnConfigureAttributes(ZnWInfo *wi, integer = 0; } break; - case ZN_CONFIG_ALPHA: - if (integer < 0) { - integer = 0; - } - if (integer > 100) { - integer = 100; - } - break; } if (integer != *((int *) valp)) { *((int *) valp) = integer; @@ -1110,6 +1131,13 @@ AttributeToObj(ZnWInfo *wi, str = Tk_PathName(*((Tk_Window *) valp)); } break; + case ZN_CONFIG_CHAR: + Tcl_SetIntObj(result, *((char *) valp)); + return; + case ZN_CONFIG_UCHAR: + case ZN_CONFIG_ALPHA: + Tcl_SetIntObj(result, *((unsigned char *) valp)); + return; case ZN_CONFIG_USHORT: case ZN_CONFIG_PRI: Tcl_SetIntObj(result, *((unsigned short *) valp)); @@ -1122,7 +1150,6 @@ AttributeToObj(ZnWInfo *wi, return; case ZN_CONFIG_INT: case ZN_CONFIG_ANGLE: - case ZN_CONFIG_ALPHA: Tcl_SetIntObj(result, *((int *) valp)); return; case ZN_CONFIG_DIM: |