From e397c807bc33cf9af19714912ffb69a30b4014b6 Mon Sep 17 00:00:00 2001 From: joye Date: Mon, 17 Mar 2014 19:19:01 +0000 Subject: *** empty log message *** --- bltGrMarkerBitmap.C | 4 +- src/bltGrAxis.C | 101 +---------------------------------------------- src/bltGrElemBar.C | 7 ++-- src/bltGrElemLine.C | 7 ++-- src/bltGrMarker.h | 3 +- src/bltGrMarkerLine.C | 4 +- src/bltGrMarkerPolygon.C | 4 +- src/bltGrMarkerText.C | 4 +- 8 files changed, 17 insertions(+), 117 deletions(-) diff --git a/bltGrMarkerBitmap.C b/bltGrMarkerBitmap.C index bc5da82..9d7a0af 100644 --- a/bltGrMarkerBitmap.C +++ b/bltGrMarkerBitmap.C @@ -60,9 +60,9 @@ static Tk_OptionSpec optionSpecs[] = { {TK_OPTION_BOOLEAN, "-hide", "hide", "Hide", "no", -1, Tk_Offset(BitmapMarker, hide), 0, NULL, 0}, {TK_OPTION_CUSTOM, "-mapx", "mapX", "MapX", - "x", -1, Tk_Offset(BitmapMarker, axes.x), 0, &xAxisObjOption, 0}, + "x", -1, Tk_Offset(BitmapMarker, axes.x), 0, &axisObjOption, 0}, {TK_OPTION_CUSTOM, "-mapy", "mapY", "MapY", - "y", -1, Tk_Offset(BitmapMarker, axes.y), 0, &yAxisObjOption, 0}, + "y", -1, Tk_Offset(BitmapMarker, axes.y), 0, &axisObjOption, 0}, {TK_OPTION_SYNONYM, "-outline", NULL, NULL, NULL, -1, 0, 0, "-foreground", 0}, {TK_OPTION_DOUBLE, "-rotate", "rotate", "Rotate", "0", -1, Tk_Offset(BitmapMarker, reqAngle), 0, NULL, 0}, diff --git a/src/bltGrAxis.C b/src/bltGrAxis.C index 2729300..f9f09ac 100644 --- a/src/bltGrAxis.C +++ b/src/bltGrAxis.C @@ -74,7 +74,6 @@ static AxisName axisNames[] = { { "x2", CID_AXIS_X, MARGIN_TOP, MARGIN_RIGHT }, { "y2", CID_AXIS_Y, MARGIN_RIGHT, MARGIN_TOP } } ; -static int nAxisNames = sizeof(axisNames) / sizeof(AxisName); // Defs @@ -109,15 +108,9 @@ static Tk_CustomOptionSetProc AxisSetProc; static Tk_CustomOptionGetProc AxisGetProc; static Tk_CustomOptionRestoreProc AxisRestoreProc; static Tk_CustomOptionFreeProc AxisFreeProc; -Tk_ObjCustomOption xAxisObjOption = +Tk_ObjCustomOption axisObjOption = { - "xaxis", AxisSetProc, AxisGetProc, AxisRestoreProc, AxisFreeProc, - (ClientData)CID_AXIS_X - }; -Tk_ObjCustomOption yAxisObjOption = - { - "yaxis", AxisSetProc, AxisGetProc, AxisRestoreProc, AxisFreeProc, - (ClientData)CID_AXIS_Y + "axis", AxisSetProc, AxisGetProc, AxisRestoreProc, AxisFreeProc, NULL }; static int AxisSetProc(ClientData clientData, Tcl_Interp* interp, @@ -196,94 +189,6 @@ static Tcl_Obj* LimitGetProc(ClientData clientData, Tk_Window tkwin, return objPtr; } -static Tk_CustomOptionSetProc UseSetProc; -static Tk_CustomOptionGetProc UseGetProc; -Tk_ObjCustomOption useObjOption = - { - "use", UseSetProc, UseGetProc, NULL, NULL, NULL - }; - -static int UseSetProc(ClientData clientData, Tcl_Interp* interp, - Tk_Window tkwin, Tcl_Obj** objPtr, char* widgRec, - int offset, char* save, int flags) -{ - Axis* axisPtr = (Axis*)(widgRec); - - Graph* graphPtr = axisPtr->obj.graphPtr; - - // Clear the axis class if it's not currently used by an element - if (axisPtr->refCount == 0) - Blt_GraphSetObjectClass(&axisPtr->obj, CID_NONE); - - // Remove the axis from the margin's use list and clear its use flag. - if (axisPtr->link) - Blt_Chain_UnlinkLink(axisPtr->chain, axisPtr->link); - - axisPtr->use =0; - const char *string = Tcl_GetString(*objPtr); - if (!string || (string[0] == '\0')) { - graphPtr->flags |= (GET_AXIS_GEOMETRY | LAYOUT_NEEDED | RESET_AXES); - // When any axis changes, we need to layout the entire graph. - graphPtr->flags |= (MAP_WORLD | REDRAW_WORLD); - Blt_EventuallyRedrawGraph(graphPtr); - - return TCL_OK; - } - - AxisName *p, *pend; - for (p = axisNames, pend = axisNames + nAxisNames; p < pend; p++) { - if (strcmp(p->name, string) == 0) { - break; /* Found the axis name. */ - } - } - if (p == pend) { - Tcl_AppendResult(interp, "unknown axis type \"", string, "\": " - "should be x, y, x1, y2, or \"\".", NULL); - return TCL_ERROR; - } - - // Check the axis class - // Can't use the axis if it's already being used as another type. - if (axisPtr->obj.classId == CID_NONE) - Blt_GraphSetObjectClass(&axisPtr->obj, p->classId); - else if (axisPtr->obj.classId != p->classId) { - Tcl_AppendResult(interp, "wrong type for axis \"", - axisPtr->obj.name, "\": can't use ", - axisPtr->obj.className, " type axis.", NULL); - return TCL_ERROR; - } - - int margin = (graphPtr->inverted) ? p->invertMargin : p->margin; - Blt_Chain chain = graphPtr->margins[margin].axes; - // Move the axis from the old margin's "use" list to the new. - if (axisPtr->link) - Blt_Chain_AppendLink(chain, axisPtr->link); - else - axisPtr->link = Blt_Chain_Append(chain, axisPtr); - - axisPtr->chain = chain; - axisPtr->use =1; - axisPtr->margin = margin; - - graphPtr->flags |= (GET_AXIS_GEOMETRY | LAYOUT_NEEDED | RESET_AXES); - // When any axis changes, we need to layout the entire graph. - graphPtr->flags |= (MAP_WORLD | REDRAW_WORLD); - Blt_EventuallyRedrawGraph(graphPtr); - - return TCL_OK; -} - -static Tcl_Obj* UseGetProc(ClientData clientData, Tk_Window tkwin, - char *widgRec, int offset) -{ - Axis* axisPtr = (Axis*)(widgRec); - - if (axisPtr->margin == MARGIN_NONE) - return Tcl_NewStringObj("", -1); - - return Tcl_NewStringObj(axisNames[axisPtr->margin].name, -1); -} - static Tk_CustomOptionSetProc TicksSetProc; static Tk_CustomOptionGetProc TicksGetProc; static Tk_CustomOptionRestoreProc TicksRestoreProc; @@ -498,8 +403,6 @@ static Tk_OptionSpec optionSpecs[] = { STD_NORMAL_FOREGROUND, -1, Tk_Offset(Axis, titleColor), 0, NULL, 0}, {TK_OPTION_FONT, "-titlefont", "titleFont", "TitleFont", STD_FONT_NORMAL, -1, Tk_Offset(Axis, titleFont), 0, NULL, 0}, - {TK_OPTION_CUSTOM, "-use", "use", "Use", - NULL, -1, 0, TK_OPTION_NULL_OK, &useObjOption, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, -1, 0, 0, NULL, 0} }; diff --git a/src/bltGrElemBar.C b/src/bltGrElemBar.C index b808d11..28f956c 100644 --- a/src/bltGrElemBar.C +++ b/src/bltGrElemBar.C @@ -230,8 +230,7 @@ static Tk_ObjCustomOption styleObjOption = extern Tk_ObjCustomOption barPenObjOption; extern Tk_ObjCustomOption pairsObjOption; extern Tk_ObjCustomOption valuesObjOption; -extern Tk_ObjCustomOption xAxisObjOption; -extern Tk_ObjCustomOption yAxisObjOption; +extern Tk_ObjCustomOption axisObjOption; static Tk_OptionSpec optionSpecs[] = { {TK_OPTION_CUSTOM, "-activepen", "activePen", "ActivePen", @@ -272,9 +271,9 @@ static Tk_OptionSpec optionSpecs[] = { {TK_OPTION_RELIEF, "-legendrelief", "legendRelief", "LegendRelief", "flat", -1, Tk_Offset(BarElement, legendRelief), 0, NULL, 0}, {TK_OPTION_CUSTOM, "-mapx", "mapX", "MapX", - "x", -1, Tk_Offset(BarElement, axes.x), 0, &xAxisObjOption, MAP_ITEM}, + "x", -1, Tk_Offset(BarElement, axes.x), 0, &axisObjOption, MAP_ITEM}, {TK_OPTION_CUSTOM, "-mapy", "mapY", "MapY", - "y", -1, Tk_Offset(BarElement, axes.y), 0, &yAxisObjOption, MAP_ITEM}, + "y", -1, Tk_Offset(BarElement, axes.y), 0, &axisObjOption, MAP_ITEM}, {TK_OPTION_SYNONYM, "-outline", NULL, NULL, NULL, -1, 0, 0, "-foreground", 0}, {TK_OPTION_CUSTOM, "-pen", "pen", "Pen", NULL, -1, Tk_Offset(BarElement, normalPenPtr), diff --git a/src/bltGrElemLine.C b/src/bltGrElemLine.C index 5fd28c1..701ddb1 100644 --- a/src/bltGrElemLine.C +++ b/src/bltGrElemLine.C @@ -487,8 +487,7 @@ static Tcl_Obj* SymbolGetProc(ClientData clientData, Tk_Window tkwin, extern Tk_ObjCustomOption linePenObjOption; extern Tk_ObjCustomOption pairsObjOption; extern Tk_ObjCustomOption valuesObjOption; -extern Tk_ObjCustomOption xAxisObjOption; -extern Tk_ObjCustomOption yAxisObjOption; +extern Tk_ObjCustomOption axisObjOption; static Tk_OptionSpec optionSpecs[] = { {TK_OPTION_CUSTOM, "-activepen", "activePen", "ActivePen", @@ -530,9 +529,9 @@ static Tk_OptionSpec optionSpecs[] = { {TK_OPTION_PIXELS, "-linewidth", "lineWidth", "LineWidth", "1", -1, Tk_Offset(LineElement, builtinPen.traceWidth), 0, NULL, 0}, {TK_OPTION_CUSTOM, "-mapx", "mapX", "MapX", - "x", -1, Tk_Offset(LineElement, axes.x), 0, &xAxisObjOption, MAP_ITEM}, + "x", -1, Tk_Offset(LineElement, axes.x), 0, &axisObjOption, MAP_ITEM}, {TK_OPTION_CUSTOM, "-mapy", "mapY", "MapY", - "y", -1, Tk_Offset(LineElement, axes.y), 0, &yAxisObjOption, MAP_ITEM}, + "y", -1, Tk_Offset(LineElement, axes.y), 0, &axisObjOption, MAP_ITEM}, {TK_OPTION_INT, "-maxsymbols", "maxSymbols", "MaxSymbols", "0", -1, Tk_Offset(LineElement, reqMaxSymbols), 0, NULL, 0}, {TK_OPTION_COLOR, "-offdash", "offDash", "OffDash", diff --git a/src/bltGrMarker.h b/src/bltGrMarker.h index 9f1ebd0..fe9401c 100644 --- a/src/bltGrMarker.h +++ b/src/bltGrMarker.h @@ -95,7 +95,6 @@ int Blt_BoxesDontOverlap(Graph* graphPtr, Region2d *extsPtr); extern Tk_ObjCustomOption coordsObjOption; extern Tk_ObjCustomOption capStyleObjOption; extern Tk_ObjCustomOption joinStyleObjOption; -extern Tk_ObjCustomOption xAxisObjOption; -extern Tk_ObjCustomOption yAxisObjOption; +extern Tk_ObjCustomOption axisObjOption; #endif diff --git a/src/bltGrMarkerLine.C b/src/bltGrMarkerLine.C index edda9ec..f33a376 100644 --- a/src/bltGrMarkerLine.C +++ b/src/bltGrMarkerLine.C @@ -58,9 +58,9 @@ static Tk_OptionSpec optionSpecs[] = { {TK_OPTION_BOOLEAN, "-hide", "hide", "Hide", "no", -1, Tk_Offset(LineMarker, hide), 0, NULL, 0}, {TK_OPTION_CUSTOM, "-mapx", "mapX", "MapX", - "x", -1, Tk_Offset(LineMarker, axes.x), 0, &xAxisObjOption, 0}, + "x", -1, Tk_Offset(LineMarker, axes.x), 0, &axisObjOption, 0}, {TK_OPTION_CUSTOM, "-mapy", "mapY", "MapY", - "y", -1, Tk_Offset(LineMarker, axes.y), 0, &yAxisObjOption, 0}, + "y", -1, Tk_Offset(LineMarker, axes.y), 0, &axisObjOption, 0}, {TK_OPTION_COLOR, "-outline", "outline", "Outline", STD_NORMAL_FOREGROUND, -1, Tk_Offset(LineMarker, outlineColor), TK_OPTION_NULL_OK, NULL, 0}, diff --git a/src/bltGrMarkerPolygon.C b/src/bltGrMarkerPolygon.C index db4a80d..51110e2 100644 --- a/src/bltGrMarkerPolygon.C +++ b/src/bltGrMarkerPolygon.C @@ -58,9 +58,9 @@ static Tk_OptionSpec optionSpecs[] = { {TK_OPTION_BOOLEAN, "-hide", "hide", "Hide", "no", -1, Tk_Offset(PolygonMarker, hide), 0, NULL, 0}, {TK_OPTION_CUSTOM, "-mapx", "mapX", "MapX", - "x", -1, Tk_Offset(PolygonMarker, axes.x), 0, &xAxisObjOption, 0}, + "x", -1, Tk_Offset(PolygonMarker, axes.x), 0, &axisObjOption, 0}, {TK_OPTION_CUSTOM, "-mapy", "mapY", "MapY", - "y", -1, Tk_Offset(PolygonMarker, axes.y), 0, &yAxisObjOption, 0}, + "y", -1, Tk_Offset(PolygonMarker, axes.y), 0, &axisObjOption, 0}, {TK_OPTION_COLOR, "-outline", "outline", "Outline", STD_NORMAL_FOREGROUND, -1, Tk_Offset(PolygonMarker, outline), TK_OPTION_NULL_OK, NULL, 0}, diff --git a/src/bltGrMarkerText.C b/src/bltGrMarkerText.C index 6060c08..e51c1eb 100644 --- a/src/bltGrMarkerText.C +++ b/src/bltGrMarkerText.C @@ -60,9 +60,9 @@ static Tk_OptionSpec optionSpecs[] = { {TK_OPTION_BOOLEAN, "-hide", "hide", "Hide", "no", -1, Tk_Offset(TextMarker, hide), 0, NULL, 0}, {TK_OPTION_CUSTOM, "-mapx", "mapX", "MapX", - "x", -1, Tk_Offset(TextMarker, axes.x), 0, &xAxisObjOption, 0}, + "x", -1, Tk_Offset(TextMarker, axes.x), 0, &axisObjOption, 0}, {TK_OPTION_CUSTOM, "-mapy", "mapY", "MapY", - "y", -1, Tk_Offset(TextMarker, axes.y), 0, &yAxisObjOption, 0}, + "y", -1, Tk_Offset(TextMarker, axes.y), 0, &axisObjOption, 0}, {TK_OPTION_SYNONYM, "-outline", NULL, NULL, NULL, -1, 0, 0, "-foreground", 0}, {TK_OPTION_PIXELS, "-padx", "padX", "PadX", "4", -1, Tk_Offset(TextMarker, style.xPad), 0, NULL, 0}, -- cgit v0.12