From 11ca842ed6b82d297eb8a94ef5640d2bf8fa95d7 Mon Sep 17 00:00:00 2001 From: joye Date: Wed, 8 Jan 2014 21:37:27 +0000 Subject: *** empty log message *** --- src/bltConfig.C | 121 ---------------------------------------------------- src/bltConfig.h | 18 -------- src/bltGrAxis.C | 9 ++-- src/bltGrElemLine.C | 10 +++-- src/bltGrHairs.C | 5 ++- src/bltGrLegd.C | 2 +- src/bltGrMarker.C | 8 ++-- 7 files changed, 19 insertions(+), 154 deletions(-) diff --git a/src/bltConfig.C b/src/bltConfig.C index da4fd4e..8a81d29 100644 --- a/src/bltConfig.C +++ b/src/bltConfig.C @@ -312,106 +312,6 @@ Blt_GetFillFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int *fillPtr) return TCL_OK; } -/* - *--------------------------------------------------------------------------- - * - * Blt_GetDashesFromObj -- - * - * Converts a TCL list of dash values into a dash list ready for - * use with XSetDashes. - * - * A valid list dash values can have zero through 11 elements - * (PostScript limit). Values must be between 1 and 255. Although - * a list of 0 (like the empty string) means no dashes. - * - * Results: - * A standard TCL result. If the list represented a valid dash - * list TCL_OK is returned and *dashesPtr* will contain the - * valid dash list. Otherwise, TCL_ERROR is returned and - * interp->result will contain an error message. - * - * - *--------------------------------------------------------------------------- - */ -int -Blt_GetDashesFromObj( - Tcl_Interp *interp, - Tcl_Obj *objPtr, - Blt_Dashes *dashesPtr) -{ - const char *string; - char c; - - string = Tcl_GetString(objPtr); - if (string == NULL) { - dashesPtr->values[0] = 0; - return TCL_OK; - } - c = string[0]; - if (c == '\0') { - dashesPtr->values[0] = 0; - } else if ((c == 'd') && (strcmp(string, "dot") == 0)) { - /* 1 */ - dashesPtr->values[0] = 1; - dashesPtr->values[1] = 0; - } else if ((c == 'd') && (strcmp(string, "dash") == 0)) { - /* 5 2 */ - dashesPtr->values[0] = 5; - dashesPtr->values[1] = 2; - dashesPtr->values[2] = 0; - } else if ((c == 'd') && (strcmp(string, "dashdot") == 0)) { - /* 2 4 2 */ - dashesPtr->values[0] = 2; - dashesPtr->values[1] = 4; - dashesPtr->values[2] = 2; - dashesPtr->values[3] = 0; - } else if ((c == 'd') && (strcmp(string, "dashdotdot") == 0)) { - /* 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; -} - /* Configuration option helper routines */ /* @@ -724,14 +624,6 @@ DoConfig( } break; - case BLT_CONFIG_DASHES: - if (Blt_GetDashesFromObj(interp, objPtr, (Blt_Dashes *)ptr) - != TCL_OK) { - return TCL_ERROR; - } - break; - - case BLT_CONFIG_FILL: if (Blt_GetFillFromObj(interp, objPtr, (int *)ptr) != TCL_OK) { return TCL_ERROR; @@ -927,19 +819,6 @@ FormatConfigValue( return Tcl_NewBooleanObj((flag != 0)); } - case BLT_CONFIG_DASHES: - { - unsigned char *p; - Tcl_Obj *listObjPtr; - Blt_Dashes *dashesPtr = (Blt_Dashes *)ptr; - - listObjPtr = Tcl_NewListObj(0, (Tcl_Obj **)NULL); - for(p = dashesPtr->values; *p != 0; p++) { - Tcl_ListObjAppendElement(interp, listObjPtr, Tcl_NewIntObj(*p)); - } - return listObjPtr; - } - case BLT_CONFIG_FILL: string = Blt_NameOfFill(*(int *)ptr); break; diff --git a/src/bltConfig.h b/src/bltConfig.h index 1ee607f..5fd65fc 100644 --- a/src/bltConfig.h +++ b/src/bltConfig.h @@ -130,7 +130,6 @@ typedef enum { BLT_CONFIG_END, BLT_CONFIG_BITMASK, - BLT_CONFIG_DASHES, BLT_CONFIG_FILL, BLT_CONFIG_LIST, BLT_CONFIG_OBJ, @@ -203,20 +202,6 @@ typedef struct { extern Blt_CustomOption stateOption; extern Blt_CustomOption dashesOption; -/* - * Blt_Limits -- - * - * Defines the bounding of a size (width or height) in the paneset. It may - * be related to the widget, pane or paneset size. - */ -typedef struct { - int flags; /* Flags indicate whether using default - * values for limits or not. See flags - * below. */ - int max, min; /* Values for respective limits. */ - int nom; /* Nominal starting value. */ -} Blt_Limits; - extern void Blt_SetDashes (Display *display, GC gc, Blt_Dashes *dashesPtr); extern int Blt_ConfigureInfoFromObj(Tcl_Interp *interp, Tk_Window tkwin, @@ -242,7 +227,4 @@ extern void Blt_FreeOptions(Blt_ConfigSpec *specs, char *widgRec, extern int Blt_GetFillFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int *fillPtr); -extern int Blt_GetDashesFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, - Blt_Dashes *dashesPtr); - #endif /* BLT_CONFIG_H */ diff --git a/src/bltGrAxis.C b/src/bltGrAxis.C index f318021..0587187 100644 --- a/src/bltGrAxis.C +++ b/src/bltGrAxis.C @@ -41,6 +41,7 @@ #include "bltGraph.h" #include "bltOp.h" #include "bltGrElem.h" +#include "bltConfig.h" #define MAXTICKS 10001 @@ -239,9 +240,9 @@ static Blt_ConfigSpec configSpecs[] = (Blt_CustomOption *)AXIS_GRID}, {BLT_CONFIG_COLOR, "-gridcolor", "gridColor", "GridColor", DEF_AXIS_GRIDCOLOR, Tk_Offset(Axis, major.color), ALL_GRAPHS}, - {BLT_CONFIG_DASHES, "-griddashes", "gridDashes", "GridDashes", + {BLT_CONFIG_CUSTOM, "-griddashes", "gridDashes", "GridDashes", DEF_AXIS_GRIDDASHES, Tk_Offset(Axis, major.dashes), - BLT_CONFIG_NULL_OK | ALL_GRAPHS}, + BLT_CONFIG_NULL_OK | ALL_GRAPHS, &dashesOption}, {BLT_CONFIG_PIXELS, "-gridlinewidth", "gridLineWidth", "GridLineWidth", DEF_AXIS_GRIDLINEWIDTH, Tk_Offset(Axis, major.lineWidth), @@ -252,9 +253,9 @@ static Blt_ConfigSpec configSpecs[] = (Blt_CustomOption *)AXIS_GRIDMINOR}, {BLT_CONFIG_COLOR, "-gridminorcolor", "gridMinorColor", "GridColor", DEF_AXIS_GRIDMINOR_COLOR, Tk_Offset(Axis, minor.color), ALL_GRAPHS}, - {BLT_CONFIG_DASHES, "-gridminordashes", "gridMinorDashes", "GridDashes", + {BLT_CONFIG_CUSTOM, "-gridminordashes", "gridMinorDashes", "GridDashes", DEF_AXIS_GRIDDASHES, Tk_Offset(Axis, minor.dashes), - BLT_CONFIG_NULL_OK | ALL_GRAPHS}, + BLT_CONFIG_NULL_OK | ALL_GRAPHS, &dashesOption}, {BLT_CONFIG_PIXELS, "-gridminorlinewidth", "gridMinorLineWidth", "GridLineWidth", DEF_AXIS_GRIDLINEWIDTH, Tk_Offset(Axis, minor.lineWidth), diff --git a/src/bltGrElemLine.C b/src/bltGrElemLine.C index da92422..ec85da8 100644 --- a/src/bltGrElemLine.C +++ b/src/bltGrElemLine.C @@ -448,8 +448,9 @@ static Blt_ConfigSpec lineElemConfigSpecs[] = Tk_Offset(LineElement, obj.tags), BLT_CONFIG_NULL_OK}, {BLT_CONFIG_COLOR, "-color", "color", "Color", DEF_LINE_PEN_COLOR, Tk_Offset(LineElement, builtinPen.traceColor), 0}, - {BLT_CONFIG_DASHES, "-dashes", "dashes", "Dashes", DEF_LINE_DASHES, - Tk_Offset(LineElement, builtinPen.traceDashes), BLT_CONFIG_NULL_OK}, + {BLT_CONFIG_CUSTOM, "-dashes", "dashes", "Dashes", DEF_LINE_DASHES, + Tk_Offset(LineElement, builtinPen.traceDashes), BLT_CONFIG_NULL_OK, + &dashesOption}, {BLT_CONFIG_CUSTOM, "-data", "data", "Data", DEF_LINE_DATA, 0, 0, &bltValuePairsOption}, {BLT_CONFIG_CUSTOM, "-errorbarcolor", "errorBarColor", "ErrorBarColor", @@ -574,8 +575,9 @@ static Blt_ConfigSpec linePenConfigSpecs[] = Tk_Offset(LinePen, traceColor), ACTIVE_PEN}, {BLT_CONFIG_COLOR, "-color", "color", "Color", DEF_PEN_NORMAL_COLOR, Tk_Offset(LinePen, traceColor), NORMAL_PEN}, - {BLT_CONFIG_DASHES, "-dashes", "dashes", "Dashes", DEF_PEN_DASHES, - Tk_Offset(LinePen, traceDashes), BLT_CONFIG_NULL_OK | ALL_PENS}, + {BLT_CONFIG_CUSTOM, "-dashes", "dashes", "Dashes", DEF_PEN_DASHES, + Tk_Offset(LinePen, traceDashes), BLT_CONFIG_NULL_OK | ALL_PENS, + &dashesOption}, {BLT_CONFIG_CUSTOM, "-errorbarcolor", "errorBarColor", "ErrorBarColor", DEF_LINE_ERRORBAR_COLOR, Tk_Offset(LinePen, errorBarColor), ALL_PENS, &bltColorOption}, diff --git a/src/bltGrHairs.C b/src/bltGrHairs.C index 7983766..d4b6411 100644 --- a/src/bltGrHairs.C +++ b/src/bltGrHairs.C @@ -37,6 +37,7 @@ #include "bltInt.h" #include "bltGraph.h" #include "bltOp.h" +#include "bltConfig.h" typedef int (GraphCrosshairProc)(Graph *graphPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv); @@ -85,8 +86,8 @@ static Blt_ConfigSpec configSpecs[] = { {BLT_CONFIG_COLOR, "-color", "color", "Color", DEF_HAIRS_FOREGROUND, Tk_Offset(Crosshairs, colorPtr), 0}, - {BLT_CONFIG_DASHES, "-dashes", "dashes", "Dashes", DEF_HAIRS_DASHES, - Tk_Offset(Crosshairs, dashes), BLT_CONFIG_NULL_OK}, + {BLT_CONFIG_CUSTOM, "-dashes", "dashes", "Dashes", DEF_HAIRS_DASHES, + Tk_Offset(Crosshairs, dashes), BLT_CONFIG_NULL_OK, &dashesOption}, {BLT_CONFIG_BOOLEAN, "-hide", "hide", "Hide", DEF_HAIRS_HIDE, Tk_Offset(Crosshairs, hidden), BLT_CONFIG_DONT_SET_DEFAULT}, {BLT_CONFIG_PIXELS, "-linewidth", "lineWidth", "Linewidth", diff --git a/src/bltGrLegd.C b/src/bltGrLegd.C index 792772d..febcfe8 100644 --- a/src/bltGrLegd.C +++ b/src/bltGrLegd.C @@ -275,7 +275,7 @@ static Blt_ConfigSpec configSpecs[] = "ExportSelection", DEF_LEGEND_EXPORTSELECTION, Tk_Offset(Legend, flags), BLT_CONFIG_DONT_SET_DEFAULT, (Blt_CustomOption *)SELECT_EXPORT}, - {BLT_CONFIG_DASHES, "-focusdashes", "focusDashes", "FocusDashes", + {BLT_CONFIG_CUSTOM, "-focusdashes", "focusDashes", "FocusDashes", DEF_LEGEND_FOCUSDASHES, Tk_Offset(Legend, focusDashes), BLT_CONFIG_NULL_OK, &dashesOption}, {BLT_CONFIG_COLOR, "-focusforeground", "focusForeground", "FocusForeground", diff --git a/src/bltGrMarker.C b/src/bltGrMarker.C index e536d4f..2a844eb 100644 --- a/src/bltGrMarker.C +++ b/src/bltGrMarker.C @@ -396,8 +396,8 @@ static Blt_ConfigSpec lineConfigSpecs[] = Tk_Offset(LineMarker, capStyle), BLT_CONFIG_DONT_SET_DEFAULT}, {BLT_CONFIG_CUSTOM, "-coords", "coords", "Coords", DEF_MARKER_COORDS, Tk_Offset(LineMarker, worldPts), BLT_CONFIG_NULL_OK, &coordsOption}, - {BLT_CONFIG_DASHES, "-dashes", "dashes", "Dashes", DEF_MARKER_DASHES, - Tk_Offset(LineMarker, dashes), BLT_CONFIG_NULL_OK}, + {BLT_CONFIG_CUSTOM, "-dashes", "dashes", "Dashes", DEF_MARKER_DASHES, + Tk_Offset(LineMarker, dashes), BLT_CONFIG_NULL_OK, &dashesOption}, {BLT_CONFIG_PIXELS, "-dashoffset", "dashOffset", "DashOffset", DEF_MARKER_DASH_OFFSET, Tk_Offset(LineMarker, dashes.offset), BLT_CONFIG_DONT_SET_DEFAULT}, @@ -551,8 +551,8 @@ static Blt_ConfigSpec polygonConfigSpecs[] = Tk_Offset(PolygonMarker, capStyle), BLT_CONFIG_DONT_SET_DEFAULT}, {BLT_CONFIG_CUSTOM, "-coords", "coords", "Coords", DEF_MARKER_COORDS, Tk_Offset(PolygonMarker, worldPts), BLT_CONFIG_NULL_OK, &coordsOption}, - {BLT_CONFIG_DASHES, "-dashes", "dashes", "Dashes", DEF_MARKER_DASHES, - Tk_Offset(PolygonMarker, dashes), BLT_CONFIG_NULL_OK}, + {BLT_CONFIG_CUSTOM, "-dashes", "dashes", "Dashes", DEF_MARKER_DASHES, + Tk_Offset(PolygonMarker, dashes), BLT_CONFIG_NULL_OK, &dashesOption}, {BLT_CONFIG_STRING, "-element", "element", "Element", DEF_MARKER_ELEMENT, Tk_Offset(PolygonMarker, elemName), BLT_CONFIG_NULL_OK}, {BLT_CONFIG_CUSTOM, "-fill", "fill", "Fill", DEF_MARKER_FILL_COLOR, -- cgit v0.12