summaryrefslogtreecommitdiffstats
path: root/src/bltConfig.C
diff options
context:
space:
mode:
authorjoye <joye>2014-01-13 21:47:03 (GMT)
committerjoye <joye>2014-01-13 21:47:03 (GMT)
commit66e5b9e3c19357650e5c6cb5653bdfcfbebed9a6 (patch)
tree7080a7641b4fc06c1e6a361ec63acf017bea7061 /src/bltConfig.C
parent07f16ca011f6a77ff9c20329c50b0610cbd3f6ef (diff)
downloadblt-66e5b9e3c19357650e5c6cb5653bdfcfbebed9a6.zip
blt-66e5b9e3c19357650e5c6cb5653bdfcfbebed9a6.tar.gz
blt-66e5b9e3c19357650e5c6cb5653bdfcfbebed9a6.tar.bz2
*** empty log message ***
Diffstat (limited to 'src/bltConfig.C')
-rw-r--r--src/bltConfig.C104
1 files changed, 49 insertions, 55 deletions
diff --git a/src/bltConfig.C b/src/bltConfig.C
index fdcf208..3f9f0b3 100644
--- a/src/bltConfig.C
+++ b/src/bltConfig.C
@@ -458,6 +458,55 @@ static void BackgroundFreeProc(ClientData clientData, Display* display,
*backgroundPtr = NULL;
}
+/* OBJECT */
+
+static Blt_OptionParseProc ObjToObjectProc;
+static Blt_OptionPrintProc ObjectToObjProc;
+static Blt_OptionFreeProc ObjectFreeProc;
+Blt_CustomOption objectOption =
+{
+ ObjToObjectProc, ObjectToObjProc, ObjectFreeProc, (ClientData)0
+};
+
+static int ObjToObjectProc(ClientData clientData, Tcl_Interp *interp,
+ Tk_Window tkwin, Tcl_Obj *objPtr, char *widgRec,
+ int offset, int flags)
+{
+ Tcl_Obj** objectPtr;
+
+ objectPtr = (Tcl_Obj**)(widgRec + offset);
+
+ Tcl_IncrRefCount(objPtr);
+ if (*objectPtr != NULL)
+ Tcl_DecrRefCount(*objectPtr);
+ *objectPtr = objPtr;
+
+ return TCL_OK;
+}
+
+static Tcl_Obj* ObjectToObjProc(ClientData clientData, Tcl_Interp *interp,
+ Tk_Window tkwin, char *widgRec,
+ int offset, int flags)
+{
+ Tcl_Obj** objectPtr;
+
+ objectPtr = (Tcl_Obj**)(widgRec + offset);
+
+ return *objectPtr;
+}
+
+static void ObjectFreeProc(ClientData clientData, Display* display,
+ char *widgRec, int offset)
+{
+ Tcl_Obj** objectPtr;
+
+ objectPtr = (Tcl_Obj**)(widgRec + offset);
+ if (*objectPtr != NULL) {
+ Tcl_DecrRefCount(*objectPtr);
+ *objectPtr = NULL;
+ }
+}
+
/* Configuration option helper routines */
/*
@@ -752,16 +801,6 @@ DoConfig(
}
break;
- case BLT_CONFIG_OBJ:
- {
- Tcl_IncrRefCount(objPtr);
- if (*(Tcl_Obj **)ptr != NULL) {
- Tcl_DecrRefCount(*(Tcl_Obj **)ptr);
- }
- *(Tcl_Obj **)ptr = objPtr;
- }
- break;
-
case BLT_CONFIG_PIXELS:
{
int value;
@@ -774,25 +813,6 @@ DoConfig(
}
break;
- case BLT_CONFIG_BACKGROUND:
- {
- Blt_Background style;
-
- if (objIsEmpty) {
- style = NULL;
- } else {
- style = Blt_GetBackgroundFromObj(interp, tkwin, objPtr);
- if (style == NULL) {
- return TCL_ERROR;
- }
- }
- if (*(Blt_Background *)ptr != NULL) {
- Blt_FreeBackground(*(Blt_Background *)ptr);
- }
- *(Blt_Background *)ptr = style;
- }
- break;
-
default:
Tcl_AppendResult(interp, "bad config table: unknown type ",
Blt_Itoa(sp->type), (char *)NULL);
@@ -916,18 +936,6 @@ FormatConfigValue(
}
break;
- case BLT_CONFIG_OBJ:
- if (*(Tcl_Obj **)ptr != NULL) {
- return *(Tcl_Obj **)ptr;
- }
- break;
-
- case BLT_CONFIG_BACKGROUND:
- if (*(Blt_Background *)ptr != NULL) {
- string = Blt_NameOfBackground(*(Blt_Background *)ptr);
- }
- break;
-
default:
string = "?? unknown type ??";
}
@@ -1505,20 +1513,6 @@ Blt_FreeOptions(
}
break;
- case BLT_CONFIG_OBJ:
- if (*(Tcl_Obj **)ptr != NULL) {
- Tcl_DecrRefCount(*(Tcl_Obj **)ptr);
- *(Tcl_Obj **)ptr = NULL;
- }
- break;
-
- case BLT_CONFIG_BACKGROUND:
- if (*((Blt_Background *)ptr) != NULL) {
- Blt_FreeBackground(*((Blt_Background *)ptr));
- *((Blt_Background *)ptr) = NULL;
- }
- break;
-
case BLT_CONFIG_CUSTOM:
if ((sp->customPtr->freeProc != NULL) && (*(char **)ptr != NULL)) {
(*sp->customPtr->freeProc)(sp->customPtr->clientData,