From 563c5a692a80087669d4ed6525904ca1382e04be Mon Sep 17 00:00:00 2001 From: joye Date: Wed, 21 May 2014 17:48:12 +0000 Subject: *** empty log message *** --- src/bltGrAxis.C | 94 ++++++++++++++++++++++++++++--------------------------- src/bltGrAxis.h | 1 - src/bltGrAxisOp.C | 3 +- tests/axis.tcl | 91 +++++++++++++++++++++++++++++++++++++++++++---------- 4 files changed, 124 insertions(+), 65 deletions(-) diff --git a/src/bltGrAxis.C b/src/bltGrAxis.C index e6af80b..3c61a00 100644 --- a/src/bltGrAxis.C +++ b/src/bltGrAxis.C @@ -59,89 +59,91 @@ extern double AdjustViewport(double offset, double windowSize); static Tk_OptionSpec optionSpecs[] = { {TK_OPTION_COLOR, "-activeforeground", "activeForeground", "ActiveForeground", STD_ACTIVE_FOREGROUND, -1, Tk_Offset(AxisOptions, activeFgColor), - 0, NULL, 0}, + 0, NULL, CACHE}, {TK_OPTION_RELIEF, "-activerelief", "activeRelief", "Relief", - "flat", -1, Tk_Offset(AxisOptions, activeRelief), 0, NULL, 0}, + "flat", -1, Tk_Offset(AxisOptions, activeRelief), 0, NULL, CACHE}, {TK_OPTION_DOUBLE, "-autorange", "autoRange", "AutoRange", - "0", -1, Tk_Offset(AxisOptions, windowSize), 0, NULL, 0}, + "0", -1, Tk_Offset(AxisOptions, windowSize), 0, NULL, RESET}, {TK_OPTION_BORDER, "-background", "background", "Background", - NULL, -1, Tk_Offset(AxisOptions, normalBg), TK_OPTION_NULL_OK, NULL, 0}, + NULL, -1, Tk_Offset(AxisOptions, normalBg), TK_OPTION_NULL_OK, NULL, CACHE}, {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, -1, 0, 0, "-background", 0}, {TK_OPTION_CUSTOM, "-bindtags", "bindTags", "BindTags", "all", -1, Tk_Offset(AxisOptions, tags), TK_OPTION_NULL_OK, &listObjOption, 0}, {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, -1, 0, 0, "-borderwidth", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", - "0", -1, Tk_Offset(AxisOptions, borderWidth), 0, NULL, 0}, + "0", -1, Tk_Offset(AxisOptions, borderWidth), 0, NULL, LAYOUT}, {TK_OPTION_BOOLEAN, "-checklimits", "checkLimits", "CheckLimits", - "no", -1, Tk_Offset(AxisOptions, checkLimits), 0, NULL, 0}, + "no", -1, Tk_Offset(AxisOptions, checkLimits), 0, NULL, RESET}, {TK_OPTION_COLOR, "-color", "color", "Color", - STD_NORMAL_FOREGROUND, -1, Tk_Offset(AxisOptions, tickColor), 0, NULL, 0}, + STD_NORMAL_FOREGROUND, -1, Tk_Offset(AxisOptions, tickColor), + 0, NULL, CACHE}, {TK_OPTION_STRING, "-command", "command", "Command", NULL, -1, Tk_Offset(AxisOptions, formatCmd), TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_BOOLEAN, "-descending", "descending", "Descending", - "no", -1, Tk_Offset(AxisOptions, descending), 0, NULL, 0}, + "no", -1, Tk_Offset(AxisOptions, descending), 0, NULL, RESET}, {TK_OPTION_BOOLEAN, "-exterior", "exterior", "exterior", - "yes", -1, Tk_Offset(AxisOptions, exterior), 0, NULL, 0}, + "yes", -1, Tk_Offset(AxisOptions, exterior), 0, NULL, LAYOUT}, {TK_OPTION_SYNONYM, "-fg", NULL, NULL, NULL, -1, 0, 0, "-color", 0}, {TK_OPTION_SYNONYM, "-foreground", NULL, NULL, NULL, -1, 0, 0, "-color", 0}, {TK_OPTION_BOOLEAN, "-grid", "grid", "Grid", - "yes", -1, Tk_Offset(AxisOptions, showGrid), 0, NULL, 0}, + "yes", -1, Tk_Offset(AxisOptions, showGrid), 0, NULL, CACHE}, {TK_OPTION_COLOR, "-gridcolor", "gridColor", "GridColor", - "gray64", -1, Tk_Offset(AxisOptions, major.color), 0, NULL, 0}, + "gray64", -1, Tk_Offset(AxisOptions, major.color), 0, NULL, CACHE}, {TK_OPTION_CUSTOM, "-griddashes", "gridDashes", "GridDashes", "dot", -1, Tk_Offset(AxisOptions, major.dashes), - TK_OPTION_NULL_OK, &dashesObjOption, 0}, + TK_OPTION_NULL_OK, &dashesObjOption, CACHE}, {TK_OPTION_PIXELS, "-gridlinewidth", "gridLineWidth", "GridLineWidth", - "0", -1, Tk_Offset(AxisOptions, major.lineWidth), 0, NULL, 0}, + "0", -1, Tk_Offset(AxisOptions, major.lineWidth), 0, NULL, CACHE}, {TK_OPTION_BOOLEAN, "-gridminor", "gridMinor", "GridMinor", - "yes", -1, Tk_Offset(AxisOptions, showGridMinor), 0, NULL, 0}, + "yes", -1, Tk_Offset(AxisOptions, showGridMinor), 0, NULL, CACHE}, {TK_OPTION_COLOR, "-gridminorcolor", "gridMinorColor", "GridMinorColor", - "gray64", -1, Tk_Offset(AxisOptions, minor.color), 0, NULL, 0}, + "gray64", -1, Tk_Offset(AxisOptions, minor.color), 0, NULL, CACHE}, {TK_OPTION_CUSTOM, "-gridminordashes", "gridMinorDashes", "GridMinorDashes", "dot", -1, Tk_Offset(AxisOptions, minor.dashes), - TK_OPTION_NULL_OK, &dashesObjOption, 0}, + TK_OPTION_NULL_OK, &dashesObjOption, CACHE}, {TK_OPTION_PIXELS, "-gridminorlinewidth", "gridMinorLineWidth", "GridMinorLineWidth", - "0", -1, Tk_Offset(AxisOptions, minor.lineWidth), 0, NULL, 0}, + "0", -1, Tk_Offset(AxisOptions, minor.lineWidth), 0, NULL, CACHE}, {TK_OPTION_BOOLEAN, "-hide", "hide", "Hide", - "no", -1, Tk_Offset(AxisOptions, hide), 0, NULL, 0}, + "no", -1, Tk_Offset(AxisOptions, hide), 0, NULL, LAYOUT}, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", - "c", -1, Tk_Offset(AxisOptions, titleJustify), 0, NULL, 0}, + "c", -1, Tk_Offset(AxisOptions, titleJustify), 0, NULL, LAYOUT}, {TK_OPTION_BOOLEAN, "-labeloffset", "labelOffset", "LabelOffset", - "no", -1, Tk_Offset(AxisOptions, labelOffset), 0, NULL, 0}, + "no", -1, Tk_Offset(AxisOptions, labelOffset), 0, NULL, LAYOUT}, {TK_OPTION_COLOR, "-limitscolor", "limitsColor", "LimitsColor", STD_NORMAL_FOREGROUND, -1, Tk_Offset(AxisOptions, limitsTextStyle.color), - 0, NULL, 0}, + 0, NULL, CACHE}, {TK_OPTION_FONT, "-limitsfont", "limitsFont", "LimitsFont", STD_FONT_SMALL, -1, Tk_Offset(AxisOptions, limitsTextStyle.font), - 0, NULL, 0}, + 0, NULL, LAYOUT}, {TK_OPTION_STRING, "-limitsformat", "limitsFormat", "LimitsFormat", - NULL, -1, Tk_Offset(AxisOptions, limitsFormat), TK_OPTION_NULL_OK, NULL, 0}, + NULL, -1, Tk_Offset(AxisOptions, limitsFormat), + TK_OPTION_NULL_OK, NULL, LAYOUT}, {TK_OPTION_PIXELS, "-linewidth", "lineWidth", "LineWidth", - "1", -1, Tk_Offset(AxisOptions, lineWidth), 0, NULL, 0}, + "1", -1, Tk_Offset(AxisOptions, lineWidth), 0, NULL, LAYOUT}, {TK_OPTION_BOOLEAN, "-logscale", "logScale", "LogScale", - "no", -1, Tk_Offset(AxisOptions, logScale), 0, NULL, 0}, + "no", -1, Tk_Offset(AxisOptions, logScale), 0, NULL, RESET}, {TK_OPTION_BOOLEAN, "-loosemin", "looseMin", "LooseMin", - "no", -1, Tk_Offset(AxisOptions, looseMin), 0, NULL, 0}, + "no", -1, Tk_Offset(AxisOptions, looseMin), 0, NULL, RESET}, {TK_OPTION_BOOLEAN, "-loosemax", "looseMax", "LooseMax", - "no", -1, Tk_Offset(AxisOptions, looseMax), 0, NULL, 0}, + "no", -1, Tk_Offset(AxisOptions, looseMax), 0, NULL, RESET}, {TK_OPTION_CUSTOM, "-majorticks", "majorTicks", "MajorTicks", NULL, -1, Tk_Offset(AxisOptions, t1UPtr), - TK_OPTION_NULL_OK, &ticksObjOption, 0}, + TK_OPTION_NULL_OK, &ticksObjOption, RESET}, {TK_OPTION_CUSTOM, "-max", "max", "Max", NULL, -1, Tk_Offset(AxisOptions, reqMax), - TK_OPTION_NULL_OK, &limitObjOption, 0}, + TK_OPTION_NULL_OK, &limitObjOption, RESET}, {TK_OPTION_CUSTOM, "-min", "min", "Min", NULL, -1, Tk_Offset(AxisOptions, reqMin), - TK_OPTION_NULL_OK, &limitObjOption, 0}, + TK_OPTION_NULL_OK, &limitObjOption, RESET}, {TK_OPTION_CUSTOM, "-minorticks", "minorTicks", "MinorTicks", NULL, -1, Tk_Offset(AxisOptions, t2UPtr), - TK_OPTION_NULL_OK, &ticksObjOption, 0}, + TK_OPTION_NULL_OK, &ticksObjOption, RESET}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", - "flat", -1, Tk_Offset(AxisOptions, relief), 0, NULL, 0}, + "flat", -1, Tk_Offset(AxisOptions, relief), 0, NULL, CACHE}, {TK_OPTION_DOUBLE, "-rotate", "rotate", "Rotate", - "0", -1, Tk_Offset(AxisOptions, tickAngle), 0, NULL, 0}, + "0", -1, Tk_Offset(AxisOptions, tickAngle), 0, NULL, LAYOUT}, {TK_OPTION_CUSTOM, "-scrollcommand", "scrollCommand", "ScrollCommand", NULL, -1, Tk_Offset(AxisOptions, scrollCmdObjPtr), TK_OPTION_NULL_OK, &objectObjOption, 0}, @@ -154,29 +156,30 @@ static Tk_OptionSpec optionSpecs[] = { NULL, -1, Tk_Offset(AxisOptions, reqScrollMin), TK_OPTION_NULL_OK, &limitObjOption, 0}, {TK_OPTION_DOUBLE, "-shiftby", "shiftBy", "ShiftBy", - "0", -1, Tk_Offset(AxisOptions, shiftBy), 0, NULL, 0}, + "0", -1, Tk_Offset(AxisOptions, shiftBy), 0, NULL, RESET}, {TK_OPTION_BOOLEAN, "-showticks", "showTicks", "ShowTicks", - "yes", -1, Tk_Offset(AxisOptions, showTicks), 0, NULL, 0}, + "yes", -1, Tk_Offset(AxisOptions, showTicks), 0, NULL, LAYOUT}, {TK_OPTION_DOUBLE, "-stepsize", "stepSize", "StepSize", - "0", -1, Tk_Offset(AxisOptions, reqStep), 0, NULL, 0}, + "0", -1, Tk_Offset(AxisOptions, reqStep), 0, NULL, RESET}, {TK_OPTION_INT, "-subdivisions", "subdivisions", "Subdivisions", - "2", -1, Tk_Offset(AxisOptions, reqNumMinorTicks), 0, NULL, 0}, + "2", -1, Tk_Offset(AxisOptions, reqNumMinorTicks), 0, NULL, RESET}, {TK_OPTION_ANCHOR, "-tickanchor", "tickAnchor", "Anchor", - "c", -1, Tk_Offset(AxisOptions, reqTickAnchor), 0, NULL, 0}, + "c", -1, Tk_Offset(AxisOptions, reqTickAnchor), 0, NULL, LAYOUT}, {TK_OPTION_FONT, "-tickfont", "tickFont", "Font", - STD_FONT_SMALL, -1, Tk_Offset(AxisOptions, tickFont), 0, NULL, 0}, + STD_FONT_SMALL, -1, Tk_Offset(AxisOptions, tickFont), 0, NULL, LAYOUT}, {TK_OPTION_PIXELS, "-ticklength", "tickLength", "TickLength", - "8", -1, Tk_Offset(AxisOptions, tickLength), 0, NULL, 0}, + "8", -1, Tk_Offset(AxisOptions, tickLength), 0, NULL, LAYOUT}, {TK_OPTION_INT, "-tickdefault", "tickDefault", "TickDefault", - "4", -1, Tk_Offset(AxisOptions, reqNumMajorTicks), 0, NULL, 0}, + "4", -1, Tk_Offset(AxisOptions, reqNumMajorTicks), 0, NULL, RESET}, {TK_OPTION_STRING, "-title", "title", "Title", - NULL, -1, Tk_Offset(AxisOptions, title), TK_OPTION_NULL_OK, NULL, 0}, + NULL, -1, Tk_Offset(AxisOptions, title), TK_OPTION_NULL_OK, NULL, LAYOUT}, {TK_OPTION_BOOLEAN, "-titlealternate", "titleAlternate", "TitleAlternate", - "no", -1, Tk_Offset(AxisOptions, titleAlternate), 0, NULL, 0}, + "no", -1, Tk_Offset(AxisOptions, titleAlternate), 0, NULL, LAYOUT}, {TK_OPTION_COLOR, "-titlecolor", "titleColor", "TitleColor", - STD_NORMAL_FOREGROUND, -1, Tk_Offset(AxisOptions, titleColor), 0, NULL, 0}, + STD_NORMAL_FOREGROUND, -1, Tk_Offset(AxisOptions, titleColor), + 0, NULL, CACHE}, {TK_OPTION_FONT, "-titlefont", "titleFont", "TitleFont", - STD_FONT_NORMAL, -1, Tk_Offset(AxisOptions, titleFont), 0, NULL, 0}, + STD_FONT_NORMAL, -1, Tk_Offset(AxisOptions, titleFont), 0, NULL, LAYOUT}, {TK_OPTION_END, NULL, NULL, NULL, NULL, -1, 0, 0, NULL, 0} }; @@ -195,7 +198,6 @@ Axis::Axis(Graph* graphPtr, const char* name, int margin, Tcl_HashEntry* hPtr) use_ =0; active_ =0; - flags =0; link =NULL; chain =NULL; diff --git a/src/bltGrAxis.h b/src/bltGrAxis.h index d2eb4dc..ad90e37 100644 --- a/src/bltGrAxis.h +++ b/src/bltGrAxis.h @@ -165,7 +165,6 @@ class Axis { int use_; int active_; - unsigned int flags; Blt_ChainLink link; Blt_Chain chain; diff --git a/src/bltGrAxisOp.C b/src/bltGrAxisOp.C index c5fb792..262e2b0 100644 --- a/src/bltGrAxisOp.C +++ b/src/bltGrAxisOp.C @@ -75,11 +75,10 @@ int AxisObjConfigure(Axis* axisPtr, Tcl_Interp* interp, Tk_RestoreSavedOptions(&savedOptions); } - axisPtr->flags |= MAP_ITEM; if (axisPtr->configure() != TCL_OK) return TCL_ERROR; - graphPtr->flags |= RESET; + graphPtr->flags |= mask; graphPtr->eventuallyRedraw(); break; diff --git a/tests/axis.tcl b/tests/axis.tcl index a55ff9e..ffddcb1 100644 --- a/tests/axis.tcl +++ b/tests/axis.tcl @@ -4,26 +4,85 @@ set w .line set graph [bltLineGraph $w] $graph axis configure x -title "X Axis" -limitsformat "%g" +#$graph axis configure y -bd 4 +bltCmd $graph axis activate y echo "Testing Axis..." bltCmd $graph axis configure x -#bltCmd $graph axis activate -#bltCmd $graph axis bind -#bltCmd $graph axis cget -#bltCmd $graph axis configure -#bltCmd $graph axis create -#bltCmd $graph axis deactivate -#bltCmd $graph axis delete -#bltCmd $graph axis focus -#bltCmd $graph axis get -#bltCmd $graph axis invtransform -#bltCmd $graph axis limits -#bltCmd $graph axis margin -#bltCmd $graph axis names -#bltCmd $graph axis transform -#bltCmd $graph axis type -#bltCmd $graph axis view +bltTest3 $graph axis y -activeforeground red +##bltTest3 $graph axis y -activerelief groove +#bltTest3 $graph axis x -autorange 10 +bltTest3 $graph axis x -background yellow +bltTest3 $graph axis x -bg cyan +#bltTest3 $graph axis x -bindtags +##bltTest3 $graph axis x -bd 2 +##bltTest3 $graph axis x -borderwidth 4 +#bltTest3 $graph axis x -checklimits +bltTest3 $graph axis x -color red +#bltTest3 $graph axis x -command +bltTest3 $graph axis x -descending yes +bltTest3 $graph axis x -exterior no +bltTest3 $graph axis x -fg magenta +bltTest3 $graph axis x -foreground yellow +bltTest3 $graph axis x -grid no +bltTest3 $graph axis x -gridcolor blue +bltTest3 $graph axis x -griddashes {8 3} +bltTest3 $graph axis x -gridlinewidth 2 +bltTest3 $graph axis x -gridminor no +bltTest3 $graph axis x -gridminorcolor blue +bltTest3 $graph axis x -gridminordashes {8 3} +bltTest3 $graph axis x -gridminorlinewidth 2 +bltTest3 $graph axis x -hide yes +##bltTest3 $graph axis x -justify left +bltTest3 $graph axis x -labeloffset yes +bltTest3 $graph axis x -limitscolor red +bltTest3 $graph axis x -limitsfont "times 18 bold italic" +bltTest3 $graph axis x -limitsformat "%e" +bltTest3 $graph axis x -linewidth 2 +bltTest3 $graph axis x -logscale yes +#bltTest3 $graph axis x -loosemin +#bltTest3 $graph axis x -loosemax +#bltTest3 $graph axis x -majorticks +#bltTest3 $graph axis x -max +#bltTest3 $graph axis x -min +#bltTest3 $graph axis x -minorticks +##bltTest3 $graph axis x -relief groove +bltTest3 $graph axis x -rotate 45 +#bltTest3 $graph axis x -scrollcommand +#bltTest3 $graph axis x -scrollincrement +#bltTest3 $graph axis x -scrollmax +#bltTest3 $graph axis x -scrollmin +##bltTest3 $graph axis x -shiftby 10 +bltTest3 $graph axis x -showticks no +bltTest3 $graph axis x -stepsize 10 +bltTest3 $graph axis x -subdivisions 4 +##bltTest3 $graph axis x -tickanchor n +bltTest3 $graph axis x -tickfont {times 12 bold italic} +bltTest3 $graph axis x -ticklength 20 +bltTest3 $graph axis x -tickdefault 10 +bltTest3 $graph axis x -title {This is a Title} +bltTest3 $graph axis x -titlealternate yes +bltTest3 $graph axis x -titlecolor yellow +bltTest3 $graph axis x -titlefont {times 24 bold italic} + +#bltCmd $graph axis activate foo +#bltCmd $graph axis bind x +bltCmd $graph axis cget x -color +bltCmd $graph axis configure x +bltCmd $graph axis configure x -color +#bltCmd $graph axis create foo +#bltCmd $graph axis deactivate foo +#bltCmd $graph axis delete foo +#bltCmd $graph axis focus x +#bltCmd $graph axis get x +#bltCmd $graph axis invtransform x +#bltCmd $graph axis limits x +#bltCmd $graph axis margin x +#bltCmd $graph axis names x +#bltCmd $graph axis transform x +#bltCmd $graph axis type x +#bltCmd $graph axis view x echo "done" bltPlotDestroy $w -- cgit v0.12