summaryrefslogtreecommitdiffstats
path: root/src
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
parent07f16ca011f6a77ff9c20329c50b0610cbd3f6ef (diff)
downloadblt-66e5b9e3c19357650e5c6cb5653bdfcfbebed9a6.zip
blt-66e5b9e3c19357650e5c6cb5653bdfcfbebed9a6.tar.gz
blt-66e5b9e3c19357650e5c6cb5653bdfcfbebed9a6.tar.bz2
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r--src/bltConfig.C104
-rw-r--r--src/bltConfig.h4
-rw-r--r--src/bltGrAxis.C5
3 files changed, 53 insertions, 60 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,
diff --git a/src/bltConfig.h b/src/bltConfig.h
index 2d2f6d8..1c6f47e 100644
--- a/src/bltConfig.h
+++ b/src/bltConfig.h
@@ -128,9 +128,6 @@ typedef enum {
BLT_CONFIG_WINDOW,
BLT_CONFIG_CUSTOM,
BLT_CONFIG_END,
-
- BLT_CONFIG_OBJ,
- BLT_CONFIG_BACKGROUND
} Blt_ConfigTypes;
/*
@@ -183,6 +180,7 @@ extern Blt_OptionParseProc ObjToBitmaskProc;
extern Blt_OptionPrintProc BitmaskToObjProc;
extern Blt_CustomOption listOption;
extern Blt_CustomOption backgroundOption;
+extern Blt_CustomOption objectOption;
extern void Blt_SetDashes (Display *display, GC gc, Blt_Dashes *dashesPtr);
diff --git a/src/bltGrAxis.C b/src/bltGrAxis.C
index 64c2357..86a90a3 100644
--- a/src/bltGrAxis.C
+++ b/src/bltGrAxis.C
@@ -332,9 +332,10 @@ static Blt_ConfigSpec configSpecs[] = {
ALL_GRAPHS | BLT_CONFIG_DONT_SET_DEFAULT},
{BLT_CONFIG_DOUBLE, "-rotate", "rotate", "Rotate", DEF_AXIS_ANGLE,
Tk_Offset(Axis, tickAngle), ALL_GRAPHS | BLT_CONFIG_DONT_SET_DEFAULT},
- {BLT_CONFIG_OBJ, "-scrollcommand", "scrollCommand", "ScrollCommand",
+ {BLT_CONFIG_CUSTOM, "-scrollcommand", "scrollCommand", "ScrollCommand",
(char *)NULL, Tk_Offset(Axis, scrollCmdObjPtr),
- ALL_GRAPHS | BLT_CONFIG_NULL_OK},
+ ALL_GRAPHS | BLT_CONFIG_NULL_OK,
+ &objectOption},
{BLT_CONFIG_PIXELS, "-scrollincrement", "scrollIncrement",
"ScrollIncrement", DEF_AXIS_SCROLL_INCREMENT,
Tk_Offset(Axis, scrollUnits), ALL_GRAPHS|BLT_CONFIG_DONT_SET_DEFAULT},