(interp, msgPtr, argc, argv, flags)
| 359 | * etc. get set for msgPtr; old resources get freed, if there |
| 360 | * were any. |
| 361 | * |
| 362 | *---------------------------------------------------------------------- |
| 363 | */ |
| 364 | |
| 365 | static int |
| 366 | ConfigureMessage(interp, msgPtr, argc, argv, flags) |
| 367 | Tcl_Interp *interp; /* Used for error reporting. */ |
| 368 | register Message *msgPtr; /* Information about widget; may or may |
| 369 | * not already have values for some fields. */ |
| 370 | int argc; /* Number of valid entries in argv. */ |
| 371 | char **argv; /* Arguments. */ |
| 372 | int flags; /* Flags to pass to Tk_ConfigureWidget. */ |
| 373 | { |
| 374 | XGCValues gcValues; |
| 375 | GC newGC; |
| 376 | |
| 377 | /* |
| 378 | * Eliminate any existing trace on a variable monitored by the message. |
| 379 | */ |
| 380 | |
| 381 | if (msgPtr->textVarName != NULL) { |
| 382 | Tcl_UntraceVar(interp, msgPtr->textVarName, |
| 383 | TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, |
| 384 | MessageTextVarProc, (ClientData) msgPtr); |
| 385 | } |
| 386 | |
| 387 | if (Tk_ConfigureWidget(interp, msgPtr->tkwin, configSpecs, |
| 388 | argc, argv, (char *) msgPtr, flags) != TCL_OK) { |
| 389 | return TCL_ERROR; |
| 390 | } |
| 391 | |
| 392 | /* |
| 393 | * If the message is to display the value of a variable, then set up |
| 394 | * a trace on the variable's value, create the variable if it doesn't |
| 395 | * exist, and fetch its current value. |
| 396 | */ |
| 397 | |
| 398 | if (msgPtr->textVarName != NULL) { |
| 399 | char *value; |
| 400 | |
| 401 | value = Tcl_GetVar(interp, msgPtr->textVarName, TCL_GLOBAL_ONLY); |
| 402 | if (value == NULL) { |
| 403 | Tcl_SetVar(interp, msgPtr->textVarName, msgPtr->string, |
| 404 | TCL_GLOBAL_ONLY); |
| 405 | } else { |
| 406 | if (msgPtr->string != NULL) { |
| 407 | ckfree(msgPtr->string); |
| 408 | } |
| 409 | msgPtr->string = ckalloc((unsigned) (strlen(value) + 1)); |
| 410 | strcpy(msgPtr->string, value); |
| 411 | } |
| 412 | Tcl_TraceVar(interp, msgPtr->textVarName, |
| 413 | TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, |
| 414 | MessageTextVarProc, (ClientData) msgPtr); |
| 415 | } |
| 416 | |
| 417 | /* |
| 418 | * A few other options need special processing, such as setting |
no test coverage detected