(clientData, interp, argc, argv)
| 331 | * |
| 332 | *-------------------------------------------------------------- |
| 333 | */ |
| 334 | |
| 335 | static int |
| 336 | ScaleWidgetCmd(clientData, interp, argc, argv) |
| 337 | ClientData clientData; /* Information about scale |
| 338 | * widget. */ |
| 339 | Tcl_Interp *interp; /* Current interpreter. */ |
| 340 | int argc; /* Number of arguments. */ |
| 341 | char **argv; /* Argument strings. */ |
| 342 | { |
| 343 | register Scale *scalePtr = (Scale *) clientData; |
| 344 | int result = TCL_OK; |
| 345 | int length; |
| 346 | char c; |
| 347 | |
| 348 | if (argc < 2) { |
| 349 | Tcl_AppendResult(interp, "wrong # args: should be \"", |
| 350 | argv[0], " option ?arg arg ...?\"", (char *) NULL); |
| 351 | return TCL_ERROR; |
| 352 | } |
| 353 | Tk_Preserve((ClientData) scalePtr); |
| 354 | c = argv[1][0]; |
| 355 | length = strlen(argv[1]); |
| 356 | if ((c == 'c') && (strncmp(argv[1], "configure", length) == 0)) { |
| 357 | if (argc == 2) { |
| 358 | result = Tk_ConfigureInfo(interp, scalePtr->tkwin, configSpecs, |
| 359 | (char *) scalePtr, (char *) NULL, 0); |
| 360 | } else if (argc == 3) { |
| 361 | result = Tk_ConfigureInfo(interp, scalePtr->tkwin, configSpecs, |
| 362 | (char *) scalePtr, argv[2], 0); |
| 363 | } else { |
| 364 | result = ConfigureScale(interp, scalePtr, argc-2, argv+2, |
| 365 | TK_CONFIG_ARGV_ONLY); |
| 366 | } |
| 367 | } else if ((c == 'g') && (strncmp(argv[1], "get", length) == 0)) { |
| 368 | if (argc != 2) { |
| 369 | Tcl_AppendResult(interp, "wrong # args: should be \"", |
| 370 | argv[0], " get\"", (char *) NULL); |
| 371 | goto error; |
| 372 | } |
| 373 | sprintf(interp->result, "%d", scalePtr->value); |
| 374 | } else if ((c == 's') && (strncmp(argv[1], "set", length) == 0)) { |
| 375 | int value; |
| 376 | |
| 377 | if (argc != 3) { |
| 378 | Tcl_AppendResult(interp, "wrong # args: should be \"", |
| 379 | argv[0], " set value\"", (char *) NULL); |
| 380 | goto error; |
| 381 | } |
| 382 | if (Tcl_GetInt(interp, argv[2], &value) != TCL_OK) { |
| 383 | goto error; |
| 384 | } |
| 385 | if (scalePtr->state == tkNormalUid) { |
| 386 | if ((value < scalePtr->fromValue) |
| 387 | ^ (scalePtr->toValue < scalePtr->fromValue)) { |
| 388 | value = scalePtr->fromValue; |
| 389 | } |
| 390 | if ((value > scalePtr->toValue) |
nothing calls this directly
no test coverage detected