diff options
author | joye <joye> | 2014-03-12 20:32:16 (GMT) |
---|---|---|
committer | joye <joye> | 2014-03-12 20:32:16 (GMT) |
commit | d5e93bc941aeab65e85d86cf9f7e26c6731d23b9 (patch) | |
tree | 8644ca54d9b8cc628955fcd383838f68e7407744 /src/bltConfig.C | |
parent | b2cc081ac82e307a87a3078b0a2cd97fa3c373a2 (diff) | |
download | blt-d5e93bc941aeab65e85d86cf9f7e26c6731d23b9.zip blt-d5e93bc941aeab65e85d86cf9f7e26c6731d23b9.tar.gz blt-d5e93bc941aeab65e85d86cf9f7e26c6731d23b9.tar.bz2 |
*** empty log message ***
Diffstat (limited to 'src/bltConfig.C')
-rw-r--r-- | src/bltConfig.C | 157 |
1 files changed, 0 insertions, 157 deletions
diff --git a/src/bltConfig.C b/src/bltConfig.C index 0f938c7..3576174 100644 --- a/src/bltConfig.C +++ b/src/bltConfig.C @@ -278,163 +278,6 @@ static Tcl_Obj* ListGetProc(ClientData clientData, Tk_Window tkwin, return listObjPtr; }; -/* STATE */ - -static Blt_OptionParseProc ObjToStateProc; -static Blt_OptionPrintProc StateToObjProc; -Blt_CustomOption stateOption = -{ - ObjToStateProc, StateToObjProc, NULL, (ClientData)0 -}; - -static int ObjToStateProc(ClientData clientData, Tcl_Interp *interp, - Tk_Window tkwin, Tcl_Obj *objPtr, char *widgRec, - int offset, int flags) -{ - const char* string; - int length; - int* statePtr; - - statePtr = (int*)(widgRec + offset); - - string = Tcl_GetStringFromObj(objPtr, &length); - if (!strncmp(string, "normal", length)) { - *statePtr = BLT_STATE_NORMAL; - } else if (!strncmp(string, "disabled", length)) { - *statePtr = BLT_STATE_DISABLED; - } else if (!strncmp(string, "active", length)) { - *statePtr = BLT_STATE_ACTIVE; - } else { - Tcl_AppendResult(interp, "bad state \"", string, - "\": should be normal, active, or disabled", (char *)NULL); - return TCL_ERROR; - } - return TCL_OK; -} - -static Tcl_Obj* StateToObjProc(ClientData clientData, Tcl_Interp *interp, - Tk_Window tkwin, char *widgRec, - int offset, int flags) -{ - int* statePtr; - - statePtr = (int*)(widgRec + offset); - switch (*statePtr) { - case BLT_STATE_ACTIVE: - return Tcl_NewStringObj("active", -1); - case BLT_STATE_DISABLED: - return Tcl_NewStringObj("disabled", -1); - case BLT_STATE_NORMAL: - return Tcl_NewStringObj("normal", -1); - } - return Tcl_NewStringObj("unknown", -1); -} - -/* DASHES */ - -static Blt_OptionParseProc ObjToDashesProc; -static Blt_OptionPrintProc DashesToObjProc; -Blt_CustomOption dashesOption = -{ - ObjToDashesProc, DashesToObjProc, NULL, (ClientData)0 -}; - -static int ObjToDashesProc(ClientData clientData, Tcl_Interp *interp, - Tk_Window tkwin, Tcl_Obj *objPtr, char *widgRec, - int offset, int flags) -{ - const char* string; - int length; - Blt_Dashes* dashesPtr; - - dashesPtr = (Blt_Dashes*)(widgRec + offset); - - string = Tcl_GetStringFromObj(objPtr, &length); - if (string == NULL) { - dashesPtr->values[0] = 0; - return TCL_OK; - } - - if (!string[0]) { - dashesPtr->values[0] = 0; - } else if (!strncmp(string, "dot", length)) { - /* 1 */ - dashesPtr->values[0] = 1; - dashesPtr->values[1] = 0; - } else if (!strncmp(string, "dash", length)) { - /* 5 2 */ - dashesPtr->values[0] = 5; - dashesPtr->values[1] = 2; - dashesPtr->values[2] = 0; - } else if (!strncmp(string, "dashdot", length)) { - /* 2 4 2 */ - dashesPtr->values[0] = 2; - dashesPtr->values[1] = 4; - dashesPtr->values[2] = 2; - dashesPtr->values[3] = 0; - } else if (!strncmp(string, "dashdotdot", length)) { - /* 2 4 2 2 */ - dashesPtr->values[0] = 2; - dashesPtr->values[1] = 4; - dashesPtr->values[2] = 2; - dashesPtr->values[3] = 2; - dashesPtr->values[4] = 0; - } else { - int objc; - Tcl_Obj **objv; - int i; - - if (Tcl_ListObjGetElements(interp, objPtr, &objc, &objv) != TCL_OK) { - return TCL_ERROR; - } - if (objc > 11) { /* This is the postscript limit */ - Tcl_AppendResult(interp, "too many values in dash list \"", - string, "\"", (char *)NULL); - return TCL_ERROR; - } - for (i = 0; i < objc; i++) { - int value; - - if (Tcl_GetIntFromObj(interp, objv[i], &value) != TCL_OK) { - return TCL_ERROR; - } - /* - * Backward compatibility: - * Allow list of 0 to turn off dashes - */ - if ((value == 0) && (objc == 1)) { - break; - } - if ((value < 1) || (value > 255)) { - Tcl_AppendResult(interp, "dash value \"", - Tcl_GetString(objv[i]), "\" is out of range", - (char *)NULL); - return TCL_ERROR; - } - dashesPtr->values[i] = (unsigned char)value; - } - /* Make sure the array ends with a NUL byte */ - dashesPtr->values[i] = 0; - } - return TCL_OK; -} - -static Tcl_Obj* DashesToObjProc(ClientData clientData, Tcl_Interp *interp, - Tk_Window tkwin, char *widgRec, - int offset, int flags) -{ - Blt_Dashes* dashesPtr = (Blt_Dashes*)(widgRec + offset); - - unsigned char *p; - Tcl_Obj *listObjPtr; - - listObjPtr = Tcl_NewListObj(0, (Tcl_Obj **)NULL); - for(p = dashesPtr->values; *p != 0; p++) { - Tcl_ListObjAppendElement(interp, listObjPtr, Tcl_NewIntObj(*p)); - } - return listObjPtr; -} - /* BITMASK */ int ObjToBitmaskProc(ClientData clientData, Tcl_Interp *interp, |