summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjoye <joye>2014-03-21 16:48:21 (GMT)
committerjoye <joye>2014-03-21 16:48:21 (GMT)
commit0e40031f5aa3a026e8f343d8bf8bd68095954d65 (patch)
treecc44a801fad691eb1203e5d5a69c9158e66b936b
parent0e28864ad17db5075a3fe5d2da99f0f719c717ff (diff)
downloadblt-0e40031f5aa3a026e8f343d8bf8bd68095954d65.zip
blt-0e40031f5aa3a026e8f343d8bf8bd68095954d65.tar.gz
blt-0e40031f5aa3a026e8f343d8bf8bd68095954d65.tar.bz2
*** empty log message ***
-rw-r--r--src/bltGrElemBar.C224
-rw-r--r--src/bltGrElemLine.C326
-rw-r--r--src/bltGrElemOp.C67
-rw-r--r--src/bltGrElemOp.h128
4 files changed, 288 insertions, 457 deletions
diff --git a/src/bltGrElemBar.C b/src/bltGrElemBar.C
index 3bf2467..163f696 100644
--- a/src/bltGrElemBar.C
+++ b/src/bltGrElemBar.C
@@ -51,140 +51,100 @@ typedef struct {
} BarRegion;
typedef struct {
- const char *name; /* Pen style identifier. If NULL, pen
- * was statically allocated. */
- ClassId classId; /* Type of pen */
- const char *typeId; /* String token identifying the type of
- * pen */
- unsigned int flags; /* Indicates if the pen element is
- * active or normal */
- int refCount; /* Reference count for elements using
- * this pen. */
+ const char *name;
+ ClassId classId;
+ const char *typeId;
+ unsigned int flags;
+ int refCount;
Tcl_HashEntry *hashPtr;
- Tk_OptionTable optionTable; /* Configuration specifications */
+ Tk_OptionTable optionTable;
PenConfigureProc *configProc;
PenDestroyProc *destroyProc;
- Graph* graphPtr; /* Graph that the pen is associated
- * with. */
- /* Barchart specific pen fields start here. */
- XColor* outlineColor; /* Outline (foreground) color of bar */
- Tk_3DBorder fill; /* 3D border and fill (background)
- * color */
- int borderWidth; /* 3D border width of bar */
- int relief; /* Relief of the bar */
- Pixmap stipple; /* Stipple */
- GC fillGC; /* Graphics context */
- GC outlineGC; /* GC for outline of bar. */
-
- /* Error bar attributes. */
- int errorBarShow; /* Describes which error bars to
- * display: none, x, y, or * both. */
-
- int errorBarLineWidth; /* Width of the error bar segments. */
+ Graph* graphPtr;
+ // Barchart specific pen fields start here
+ XColor* outlineColor;
+ Tk_3DBorder fill;
+ int borderWidth;
+ int relief;
+ Pixmap stipple;
+ GC fillGC;
+ GC outlineGC;
+
+ // Error bar attributes
+ int errorBarShow;
+ int errorBarLineWidth;
int errorBarCapWidth;
- XColor* errorBarColor; /* Color of the error bar. */
-
- GC errorBarGC; /* Error bar graphics context. */
-
- /* Show value attributes. */
- int valueShow; /* Indicates whether to display data
- * value. Values are x, y, or none. */
+ XColor* errorBarColor;
+ GC errorBarGC;
- const char *valueFormat; /* A printf format string. */
- TextStyle valueStyle; /* Text attributes (color, font,
- * rotation, etc.) of the value. */
-
+ // Show value attributes
+ int valueShow;
+ const char *valueFormat;
+ TextStyle valueStyle;
} BarPen;
typedef struct {
- Weight weight; /* Weight range where this pen is
- * valid. */
- BarPen* penPtr; /* Pen to use. */
-
- XRectangle *bars; /* Indicates starting location in bar
- * array for this pen. */
- int nBars; /* # of bar segments for this pen. */
-
- GraphSegments xeb, yeb; /* X and Y error bars. */
-
- int symbolSize; /* Size of the pen's symbol scaled to
- * the current graph size. */
- int errorBarCapWidth; /* Length of the cap ends on each error
- * bar. */
-
+ Weight weight;
+ BarPen* penPtr;
+ XRectangle *bars;
+ int nBars;
+ GraphSegments xeb;
+ GraphSegments yeb;
+ int symbolSize;
+ int errorBarCapWidth;
} BarStyle;
typedef struct {
- GraphObj obj; /* Must be first field in element. */
+ GraphObj obj;
unsigned int flags;
int hide;
Tcl_HashEntry *hashPtr;
- /* Fields specific to elements. */
- const char *label; /* Label displayed in legend */
- unsigned short row, col; /* Position of the entry in the
- * legend. */
- int legendRelief; /* Relief of label in legend. */
- Axis2d axes; /* X-axis and Y-axis mapping the
- * element */
- ElemValues x, y, w; /* Contains array of floating point
- * graph coordinate values. Also holds
- * min/max and the number of
- * coordinates */
- int *activeIndices; /* Array of indices (malloc-ed) which
- * indicate which data points are active
- * (drawn * with "active" colors). */
- int nActiveIndices; /* Number of active data points.
- * Special case: if nActiveIndices < 0
- * and the active bit is set in "flags",
- * then all data * points are drawn
- * active. */
+ // Fields specific to elements
+ const char *label;
+ unsigned short row;
+ unsigned short col;
+ int legendRelief;
+ Axis2d axes;
+ ElemCoords coords;
+ ElemValues w;
+ int *activeIndices;
+ int nActiveIndices;
ElementProcs *procsPtr;
- Tk_OptionTable optionTable; /* Configuration specifications. */
- BarPen *activePenPtr; /* Standard Pens */
+ Tk_OptionTable optionTable;
+ BarPen *activePenPtr;
BarPen *normalPenPtr;
BarPen *builtinPenPtr;
- Blt_Chain stylePalette; /* Palette of pens. */
-
- /* Symbol scaling */
- int scaleSymbols; /* If non-zero, the symbols will scale
- * in size as the graph is zoomed
- * in/out. */
- double xRange, yRange; /* Initial X-axis and Y-axis ranges:
- * used to scale the size of element's
- * symbol. */
+ Blt_Chain stylePalette;
+
+ // Symbol scaling
+ int scaleSymbols;
+ double xRange;
+ double yRange;
int state;
Blt_ChainLink link;
- /* Fields specific to the barchart element */
-
+ // Fields specific to the barchart element
double barWidth;
const char *groupName;
-
int *barToData;
- XRectangle *bars; /* Array of rectangles comprising the bar
- * segments of the element. */
+ XRectangle *bars;
int *activeToData;
XRectangle *activeRects;
-
- int nBars; /* # of visible bar segments for
- * element */
+ int nBars;
int nActive;
-
- int xPad; /* Spacing on either side of bar */
-
- ElemValues xError; /* Relative/symmetric X error values. */
- ElemValues yError; /* Relative/symmetric Y error values. */
- ElemValues xHigh, xLow; /* Absolute/asymmetric X-coordinate
- * high/low error values. */
- ElemValues yHigh, yLow; /* Absolute/asymmetric Y-coordinate
- * high/low error values. */
+ int xPad;
+ ElemValues xError;
+ ElemValues yError;
+ ElemValues xHigh;
+ ElemValues xLow;
+ ElemValues yHigh;
+ ElemValues yLow;
BarPen builtinPen;
-
- GraphSegments xeb, yeb;
-
- int errorBarCapWidth; /* Length of cap on error bars */
+ GraphSegments xeb;
+ GraphSegments yeb;
+ int errorBarCapWidth;
} BarElement;
// Defs
@@ -311,20 +271,18 @@ static Tk_OptionSpec optionSpecs[] = {
"0", -1, Tk_Offset(BarElement, builtinPen.valueStyle.angle), 0, NULL, 0},
{TK_OPTION_CUSTOM, "-weights", "weights", "Weights",
NULL, -1, Tk_Offset(BarElement, w), 0, &valuesObjOption, 0},
- {TK_OPTION_CUSTOM, "-x", "x", "X",
- NULL, -1, Tk_Offset(BarElement, x), 0, &valuesObjOption, MAP_ITEM},
+ {TK_OPTION_SYNONYM, "-x", NULL, NULL, NULL, -1, 0, 0, "-xdata", 0},
{TK_OPTION_CUSTOM, "-xdata", "xData", "XData",
- NULL, -1, Tk_Offset(BarElement, x), 0, &valuesObjOption, MAP_ITEM},
+ NULL, -1, Tk_Offset(BarElement, coords.x), 0, &valuesObjOption, MAP_ITEM},
{TK_OPTION_CUSTOM, "-xerror", "xError", "XError",
NULL, -1, Tk_Offset(BarElement, xError), 0, &valuesObjOption, MAP_ITEM},
{TK_OPTION_CUSTOM, "-xhigh", "xHigh", "XHigh",
NULL, -1, Tk_Offset(BarElement, xHigh), 0, &valuesObjOption, 0},
{TK_OPTION_CUSTOM, "-xlow", "xLow", "XLow",
NULL, -1, Tk_Offset(BarElement, xLow), 0, &valuesObjOption, 0},
- {TK_OPTION_CUSTOM, "-y", "y", "Y",
- NULL, -1, Tk_Offset(BarElement, y), 0, &valuesObjOption, MAP_ITEM},
+ {TK_OPTION_SYNONYM, "-y", NULL, NULL, NULL, -1, 0, 0, "-ydata", 0},
{TK_OPTION_CUSTOM, "-ydata", "yData", "YData",
- NULL, -1, Tk_Offset(BarElement, y), 0, &valuesObjOption, MAP_ITEM},
+ NULL, -1, Tk_Offset(BarElement, coords.y), 0, &valuesObjOption, MAP_ITEM},
{TK_OPTION_CUSTOM, "-yerror", "yError", "YError",
NULL, -1, Tk_Offset(BarElement, yError), 0, &valuesObjOption, MAP_ITEM},
{TK_OPTION_CUSTOM, "-yhigh", "yHigh", "YHigh",
@@ -594,11 +552,11 @@ static void GetBarExtentsProc(Element *basePtr, Region2d *regPtr)
barWidth = elemPtr->barWidth;
middle = 0.5;
- regPtr->left = elemPtr->x.min - middle;
- regPtr->right = elemPtr->x.max + middle;
+ regPtr->left = elemPtr->coords.x.min - middle;
+ regPtr->right = elemPtr->coords.x.max + middle;
- regPtr->top = elemPtr->y.min;
- regPtr->bottom = elemPtr->y.max;
+ regPtr->top = elemPtr->coords.y.min;
+ regPtr->bottom = elemPtr->coords.y.max;
if (regPtr->bottom < graphPtr->baseline) {
regPtr->bottom = graphPtr->baseline;
}
@@ -613,7 +571,7 @@ static void GetBarExtentsProc(Element *basePtr, Region2d *regPtr)
}
/* Warning: You get what you deserve if the x-axis is logScale */
if (elemPtr->axes.x->logScale) {
- regPtr->left = Blt_FindElemValuesMinimum(&elemPtr->x, DBL_MIN) +
+ regPtr->left = Blt_FindElemValuesMinimum(&elemPtr->coords.x, DBL_MIN) +
middle;
}
/* Fix y-min limits for barchart */
@@ -635,11 +593,11 @@ static void GetBarExtentsProc(Element *basePtr, Region2d *regPtr)
for (i = 0; i < nPoints; i++) {
double x;
- x = elemPtr->x.values[i] + elemPtr->xError.values[i];
+ x = elemPtr->coords.x.values[i] + elemPtr->xError.values[i];
if (x > regPtr->right) {
regPtr->right = x;
}
- x = elemPtr->x.values[i] - elemPtr->xError.values[i];
+ x = elemPtr->coords.x.values[i] - elemPtr->xError.values[i];
if (elemPtr->axes.x->logScale) {
if (x < 0.0) {
x = -x; /* Mirror negative values, instead of
@@ -678,11 +636,11 @@ static void GetBarExtentsProc(Element *basePtr, Region2d *regPtr)
for (i = 0; i < nPoints; i++) {
double y;
- y = elemPtr->y.values[i] + elemPtr->yError.values[i];
+ y = elemPtr->coords.y.values[i] + elemPtr->yError.values[i];
if (y > regPtr->bottom) {
regPtr->bottom = y;
}
- y = elemPtr->y.values[i] - elemPtr->yError.values[i];
+ y = elemPtr->coords.y.values[i] - elemPtr->yError.values[i];
if (elemPtr->axes.y->logScale) {
if (y < 0.0) {
y = -y; /* Mirror negative values, instead of
@@ -773,8 +731,8 @@ static void ClosestBarProc(Graph* graphPtr, Element *basePtr)
searchPtr->elemPtr = (Element *)elemPtr;
searchPtr->dist = minDist;
searchPtr->index = imin;
- searchPtr->point.x = (double)elemPtr->x.values[imin];
- searchPtr->point.y = (double)elemPtr->y.values[imin];
+ searchPtr->point.x = (double)elemPtr->coords.x.values[imin];
+ searchPtr->point.y = (double)elemPtr->coords.y.values[imin];
}
}
@@ -997,8 +955,8 @@ static void MapErrorBars(Graph* graphPtr, BarElement* elemPtr,
double high, low;
BarStyle *stylePtr;
- x = elemPtr->x.values[i];
- y = elemPtr->y.values[i];
+ x = elemPtr->coords.x.values[i];
+ y = elemPtr->coords.y.values[i];
stylePtr = dataToStyle[i];
if ((isfinite(x)) && (isfinite(y))) {
if (elemPtr->xError.nValues > 0) {
@@ -1061,8 +1019,8 @@ static void MapErrorBars(Graph* graphPtr, BarElement* elemPtr,
double high, low;
BarStyle *stylePtr;
- x = elemPtr->x.values[i];
- y = elemPtr->y.values[i];
+ x = elemPtr->coords.x.values[i];
+ y = elemPtr->coords.y.values[i];
stylePtr = dataToStyle[i];
if ((isfinite(x)) && (isfinite(y))) {
if (elemPtr->yError.nValues > 0) {
@@ -1139,7 +1097,7 @@ static void MapBarProc(Graph* graphPtr, Element *basePtr)
bars = (XRectangle*)calloc(nPoints, sizeof(XRectangle));
barToData = (int*)calloc(nPoints, sizeof(int));
- x = elemPtr->x.values, y = elemPtr->y.values;
+ x = elemPtr->coords.x.values, y = elemPtr->coords.y.values;
count = 0;
for (rp = bars, i = 0; i < nPoints; i++) {
Point2d c1, c2; /* Two opposite corners of the rectangle
@@ -1477,8 +1435,8 @@ static void DrawBarValues(Graph* graphPtr, Drawable drawable,
double x, y;
char string[TCL_DOUBLE_SPACE * 2 + 2];
- x = elemPtr->x.values[barToData[count]];
- y = elemPtr->y.values[barToData[count]];
+ x = elemPtr->coords.x.values[barToData[count]];
+ y = elemPtr->coords.y.values[barToData[count]];
count++;
if (penPtr->valueShow == SHOW_X) {
@@ -1665,8 +1623,8 @@ static void BarValuesToPostScript(Graph* graphPtr, Blt_Ps ps,
fmt = "%g";
for (rp = bars, rend = rp + nBars; rp < rend; rp++) {
- x = elemPtr->x.values[barToData[count]];
- y = elemPtr->y.values[barToData[count]];
+ x = elemPtr->coords.x.values[barToData[count]];
+ y = elemPtr->coords.y.values[barToData[count]];
count++;
if (penPtr->valueShow == SHOW_X) {
sprintf_s(string, TCL_DOUBLE_SPACE, fmt, x);
@@ -1805,7 +1763,7 @@ void Blt_InitBarSetTable(Graph* graphPtr)
}
nSegs++;
nPoints = NUMBEROFPOINTS(elemPtr);
- for (x = elemPtr->x.values, xend = x + nPoints; x < xend; x++) {
+ for (x = elemPtr->coords.x.values, xend = x + nPoints; x < xend; x++) {
Tcl_HashEntry *hPtr;
BarSetKey key;
int isNew;
@@ -1917,7 +1875,7 @@ void Blt_ComputeBarStacks(Graph* graphPtr)
if ((elemPtr->hide) || (elemPtr->obj.classId != CID_ELEM_BAR)) {
continue;
}
- for (x = elemPtr->x.values, y = elemPtr->y.values,
+ for (x = elemPtr->coords.x.values, y = elemPtr->coords.y.values,
xend = x + NUMBEROFPOINTS(elemPtr); x < xend; x++, y++) {
BarSetKey key;
Tcl_HashEntry *hPtr;
diff --git a/src/bltGrElemLine.C b/src/bltGrElemLine.C
index d9ec49f..e006416 100644
--- a/src/bltGrElemLine.C
+++ b/src/bltGrElemLine.C
@@ -66,14 +66,13 @@ typedef enum {
} Smoothing;
typedef struct {
- Point2d *screenPts; /* Array of transformed coordinates */
- int nScreenPts; /* Number of coordinates */
- int *styleMap; /* Index of pen styles */
- int *map; /* Maps segments/traces to data
- * points */
+ Point2d *screenPts;
+ int nScreenPts;
+ int *styleMap;
+ int *map;
} MapInfo;
-/* Symbol types for line elements */
+// Symbol types for line elements
typedef enum {
SYMBOL_NONE, SYMBOL_SQUARE, SYMBOL_CIRCLE, SYMBOL_DIAMOND, SYMBOL_PLUS,
SYMBOL_CROSS, SYMBOL_SPLUS, SYMBOL_SCROSS, SYMBOL_TRIANGLE, SYMBOL_ARROW,
@@ -81,214 +80,139 @@ typedef enum {
} SymbolType;
typedef struct {
- SymbolType type; /* Type of symbol to be drawn/printed */
-
- int size; /* Requested size of symbol in pixels */
-
- XColor* outlineColor; /* Outline color */
-
- int outlineWidth; /* Width of the outline */
-
- GC outlineGC; /* Outline graphics context */
-
- XColor* fillColor; /* Normal fill color */
-
- GC fillGC; /* Fill graphics context */
-
- Tk_Image image; /* This is used of image symbols. */
-
- /* The last two fields are used only for bitmap symbols. */
+ SymbolType type;
+ int size;
+ XColor* outlineColor;
+ int outlineWidth;
+ GC outlineGC;
+ XColor* fillColor;
+ GC fillGC;
- Pixmap bitmap; /* Bitmap to determine
- * foreground/background pixels of the
- * symbol */
- Pixmap mask; /* Bitmap representing the transparent
- * pixels of the symbol */
+ // The last two fields are used only for bitmap symbols
+ Pixmap bitmap;
+ Pixmap mask;
} Symbol;
typedef struct {
- int start; /* Index into the X-Y coordinate arrays
- * indicating where trace starts. */
- GraphPoints screenPts; /* Array of screen coordinates
- * (malloc-ed) representing the
- * trace. */
+ int start;
+ GraphPoints screenPts;
} bltTrace;
typedef struct {
- const char* name; /* Pen style identifier. If NULL pen
- * was statically allocated. */
- ClassId classId; /* Type of pen */
- const char* typeId; /* String token identifying the type of
- * pen */
- unsigned int flags; /* Indicates if the pen element is
- * active or normal */
- int refCount; /* Reference count for elements using
- * this pen. */
+ const char* name;
+ ClassId classId;
+ const char* typeId;
+ unsigned int flags;
+ int refCount;
Tcl_HashEntry *hashPtr;
- Tk_OptionTable optionTable; /* Configuration specifications */
+ Tk_OptionTable optionTable;
PenConfigureProc *configProc;
PenDestroyProc *destroyProc;
- Graph* graphPtr; /* Graph that the pen is associated
- * with. */
-
- /* Symbol attributes. */
- Symbol symbol; /* Element symbol type */
-
- /* Trace attributes. */
- int traceWidth; /* Width of the line segments. If
- * lineWidth is 0, no line will be
- * drawn, only symbols. */
-
- Blt_Dashes traceDashes; /* Dash on-off list value */
+ Graph* graphPtr;
- XColor* traceColor; /* Line segment color */
+ // Symbol attributes
+ Symbol symbol;
- XColor* traceOffColor; /* Line segment dash gap color */
-
- GC traceGC; /* Line segment graphics context */
+ // Trace attributes.
+ int traceWidth;
+ Blt_Dashes traceDashes;
+ XColor* traceColor;
+ XColor* traceOffColor;
+ GC traceGC;
- /* Error bar attributes. */
- int errorBarShow; /* Describes which error bars to display:
- * none, x, y, or * both. */
-
- int errorBarLineWidth; /* Width of the error bar segments. */
-
- int errorBarCapWidth; /* Width of the cap on error bars. */
-
- XColor* errorBarColor; /* Color of the error bar. */
-
- GC errorBarGC; /* Error bar graphics context. */
-
- /* Show value attributes. */
- int valueShow; /* Indicates whether to display data
- * value. Values are x, y, both, or
- * none. */
- const char* valueFormat; /* A printf format string. */
-
- TextStyle valueStyle; /* Text attributes (color, font,
- * rotation, etc.) of the value. */
+ // Error bar attributes
+ int errorBarShow;
+ int errorBarLineWidth;
+ int errorBarCapWidth;
+ XColor* errorBarColor;
+ GC errorBarGC;
+
+ // Show value attributes
+ int valueShow;
+ const char* valueFormat;
+ TextStyle valueStyle;
} LinePen;
typedef struct {
- Weight weight; /* Weight range where this pen is
- * valid. */
- LinePen* penPtr; /* Pen to use. */
+ Weight weight;
+ LinePen* penPtr;
GraphPoints symbolPts;
-
- GraphSegments lines; /* Points to start of the line segments
- * for this pen. */
- GraphSegments xeb, yeb; /* X and Y axis error bars. */
-
- int symbolSize; /* Size of the pen's symbol scaled to
- * the current graph size. */
- int errorBarCapWidth; /* Length of the cap ends on each error
- * bar. */
+ GraphSegments lines;
+ GraphSegments xeb;
+ GraphSegments yeb;
+ int symbolSize;
+ int errorBarCapWidth;
} LineStyle;
typedef struct {
- GraphObj obj; /* Must be first field in element. */
+ GraphObj obj;
unsigned int flags;
int hide;
Tcl_HashEntry *hashPtr;
- /* Fields specific to elements. */
- const char* label; /* Label displayed in legend */
- unsigned short row, col; /* Position of the entry in the
- * legend. */
- int legendRelief; /* Relief of label in legend. */
- Axis2d axes; /* X-axis and Y-axis mapping the
- * element */
- ElemValues x, y, w; /* Contains array of floating point
- * graph coordinate values. Also holds
- * min/max * and the number of
- * coordinates */
- int *activeIndices; /* Array of indices (malloc-ed) which
- * indicate which data points are active
- * (drawn * with "active" colors). */
- int nActiveIndices; /* Number of active data points.
- * Special case: if nActiveIndices < 0
- * and the * active bit is set in
- * "flags", then all data points are
- * drawn active. */
+ // Fields specific to elements
+ const char* label;
+ unsigned short row;
+ unsigned short col;
+ int legendRelief;
+ Axis2d axes;
+ ElemCoords coords;
+ ElemValues w;
+ int *activeIndices;
+ int nActiveIndices;
ElementProcs *procsPtr;
- Tk_OptionTable optionTable; /* Configuration specifications. */
- LinePen *activePenPtr; /* Standard Pens */
+ Tk_OptionTable optionTable;
+ LinePen *activePenPtr;
LinePen *normalPenPtr;
LinePen *builtinPenPtr;
- Blt_Chain stylePalette; /* Palette of pens. */
-
- /* Symbol scaling */
- int scaleSymbols; /* If non-zero, the symbols will scale
- * in size as the graph is zoomed
- * in/out. */
-
- double xRange, yRange; /* Initial X-axis and Y-axis ranges:
- * used to scale the size of element's
- * symbol. */
+ Blt_Chain stylePalette;
+ int scaleSymbols;
+ double xRange;
+ double yRange;
int state;
- Blt_ChainLink link; /* Element's link in display list. */
-
- /* The line element specific fields start here. */
+ Blt_ChainLink link;
- ElemValues xError; /* Relative/symmetric X error values. */
- ElemValues yError; /* Relative/symmetric Y error values. */
- ElemValues xHigh, xLow; /* Absolute/asymmetric X-coordinate
- * high/low error values. */
- ElemValues yHigh, yLow; /* Absolute/asymmetric Y-coordinate
- * high/low error values. */
+ // The line element specific fields start here
+ ElemValues xError;
+ ElemValues yError;
+ ElemValues xHigh;
+ ElemValues xLow;
+ ElemValues yHigh;
+ ElemValues yLow;
LinePen builtinPen;
- int errorBarCapWidth; /* Length of cap on error bars */
-
- /* Line smoothing */
- Smoothing reqSmooth; /* Requested smoothing function to use
- * for connecting the data points */
- Smoothing smooth; /* Smoothing function used. */
- double rTolerance; /* Tolerance to reduce the number of
- * points displayed. */
+ int errorBarCapWidth;
- /* Drawing-related data structures. */
+ // Line smoothing
+ Smoothing reqSmooth;
+ Smoothing smooth;
+ double rTolerance;
- /* Area-under-curve fill attributes. */
+ // Area-under-curve fill attributes
XColor* fillFgColor;
XColor* fillBgColor;
GC fillGC;
-
- Tk_3DBorder fillBg; /* Background for fill area. */
-
- Point2d *fillPts; /* Array of points used to draw polygon
- * to fill area under the curve */
+ Tk_3DBorder fillBg;
+ Point2d *fillPts;
int nFillPts;
- /* Symbol points */
+ // Symbol points
GraphPoints symbolPts;
- /* Active symbol points */
+ // Active symbol points
GraphPoints activePts;
- GraphSegments xeb, yeb; /* Point to start of this pen's X-error
- * bar segments in the element's
- * array. */
+ GraphSegments xeb;
+ GraphSegments yeb;
+
int reqMaxSymbols;
int symbolInterval;
int symbolCounter;
- /* X-Y graph-specific fields */
-
- int penDir; /* Indicates if a change in the pen
- * direction should be considered a
- * retrace (line segment is not
- * drawn). */
- Blt_Chain traces; /* List of traces (a trace is a series
- * of contiguous line segments). New
- * traces are generated when either
- * the next segment changes the pen
- * direction, or the end point is
- * clipped by the plotting area. */
+ // X-Y graph-specific fields
+ int penDir;
+ Blt_Chain traces;
- /* Stripchart-specific fields */
-
- GraphSegments lines; /* Holds the the line segments of the
- * element trace. The segments are
- * grouped by pen style. */
+ // Stripchart-specific fields
+ GraphSegments lines;
} LineElement;
// Defs
@@ -572,20 +496,18 @@ static Tk_OptionSpec optionSpecs[] = {
"0", -1, Tk_Offset(LineElement, builtinPen.valueStyle.angle), 0, NULL, 0},
{TK_OPTION_CUSTOM, "-weights", "weights", "Weights",
NULL, -1, Tk_Offset(LineElement, w), 0, &valuesObjOption, 0},
- {TK_OPTION_CUSTOM, "-x", "x", "X",
- NULL, -1, Tk_Offset(LineElement, x), 0, &valuesObjOption, MAP_ITEM},
+ {TK_OPTION_SYNONYM, "-x", NULL, NULL, NULL, -1, 0, 0, "-xdata", 0},
{TK_OPTION_CUSTOM, "-xdata", "xData", "XData",
- NULL, -1, Tk_Offset(LineElement, x), 0, &valuesObjOption, MAP_ITEM},
+ NULL, -1, Tk_Offset(LineElement, coords.x), 0, &valuesObjOption, MAP_ITEM},
{TK_OPTION_CUSTOM, "-xerror", "xError", "XError",
NULL, -1, Tk_Offset(LineElement, xError), 0, &valuesObjOption, MAP_ITEM},
{TK_OPTION_CUSTOM, "-xhigh", "xHigh", "XHigh",
NULL, -1, Tk_Offset(LineElement, xHigh), 0, &valuesObjOption, 0},
{TK_OPTION_CUSTOM, "-xlow", "xLow", "XLow",
NULL, -1, Tk_Offset(LineElement, xLow), 0, &valuesObjOption, 0},
- {TK_OPTION_CUSTOM, "-y", "y", "Y",
- NULL, -1, Tk_Offset(LineElement, y), 0, &valuesObjOption, MAP_ITEM},
+ {TK_OPTION_SYNONYM, "-y", NULL, NULL, NULL, -1, 0, 0, "-ydata", 0},
{TK_OPTION_CUSTOM, "-ydata", "yData", "YData",
- NULL, -1, Tk_Offset(LineElement, y), 0, &valuesObjOption, MAP_ITEM},
+ NULL, -1, Tk_Offset(LineElement, coords.y), 0, &valuesObjOption, MAP_ITEM},
{TK_OPTION_CUSTOM, "-yerror", "yError", "YError",
NULL, -1, Tk_Offset(LineElement, yError), 0, &valuesObjOption, MAP_ITEM},
{TK_OPTION_CUSTOM, "-yhigh", "yHigh", "YHigh",
@@ -890,10 +812,6 @@ static int ConfigurePenProc(Graph* graphPtr, Pen* basePtr)
static void DestroySymbol(Display *display, Symbol *symbolPtr)
{
- if (symbolPtr->image) {
- Tk_FreeImage(symbolPtr->image);
- symbolPtr->image = NULL;
- }
if (symbolPtr->bitmap != None) {
Tk_FreeBitmap(display, symbolPtr->bitmap);
symbolPtr->bitmap = None;
@@ -969,8 +887,8 @@ static void GetScreenPoints(Graph* graphPtr, LineElement* elemPtr,
{
int np = NUMBEROFPOINTS(elemPtr);
- double* x = elemPtr->x.values;
- double* y = elemPtr->y.values;
+ double* x = elemPtr->coords.x.values;
+ double* y = elemPtr->coords.y.values;
Point2d *points = (Point2d*)malloc(sizeof(Point2d) * np);
int* map = (int*)malloc(sizeof(int) * np);
@@ -1305,8 +1223,8 @@ static void MapActiveSymbols(Graph* graphPtr, LineElement* elemPtr)
if (iPoint >= np) {
continue; /* Index not available */
}
- x = elemPtr->x.values[iPoint];
- y = elemPtr->y.values[iPoint];
+ x = elemPtr->coords.x.values[iPoint];
+ y = elemPtr->coords.y.values[iPoint];
points[count] = Blt_Map2D(graphPtr, x, y, &elemPtr->axes);
map[count] = iPoint;
if (PointInRegion(&exts, points[count].x, points[count].y)) {
@@ -1786,8 +1704,8 @@ static void MapErrorBars(Graph* graphPtr, LineElement* elemPtr,
double high, low;
LineStyle *stylePtr;
- x = elemPtr->x.values[i];
- y = elemPtr->y.values[i];
+ x = elemPtr->coords.x.values[i];
+ y = elemPtr->coords.y.values[i];
stylePtr = styleMap[i];
if ((isfinite(x)) && (isfinite(y))) {
if (elemPtr->xError.nValues > 0) {
@@ -1850,8 +1768,8 @@ static void MapErrorBars(Graph* graphPtr, LineElement* elemPtr,
double high, low;
LineStyle *stylePtr;
- x = elemPtr->x.values[i];
- y = elemPtr->y.values[i];
+ x = elemPtr->coords.x.values[i];
+ y = elemPtr->coords.y.values[i];
stylePtr = styleMap[i];
if ((isfinite(x)) && (isfinite(y))) {
if (elemPtr->yError.nValues > 0) {
@@ -2184,8 +2102,8 @@ static void ClosestPoint(LineElement* elemPtr, ClosestSearch *searchPtr)
searchPtr->elemPtr = (Element *)elemPtr;
searchPtr->dist = dMin;
searchPtr->index = iClose;
- searchPtr->point.x = elemPtr->x.values[iClose];
- searchPtr->point.y = elemPtr->y.values[iClose];
+ searchPtr->point.x = elemPtr->coords.x.values[iClose];
+ searchPtr->point.y = elemPtr->coords.y.values[iClose];
}
}
@@ -2201,17 +2119,17 @@ static void GetLineExtentsProc(Element *basePtr, Region2d *extsPtr)
if (np < 1) {
return;
}
- extsPtr->right = elemPtr->x.max;
- if ((elemPtr->x.min <= 0.0) && (elemPtr->axes.x->logScale)) {
- extsPtr->left = Blt_FindElemValuesMinimum(&elemPtr->x, DBL_MIN);
+ extsPtr->right = elemPtr->coords.x.max;
+ if ((elemPtr->coords.x.min <= 0.0) && (elemPtr->axes.x->logScale)) {
+ extsPtr->left = Blt_FindElemValuesMinimum(&elemPtr->coords.x, DBL_MIN);
} else {
- extsPtr->left = elemPtr->x.min;
+ extsPtr->left = elemPtr->coords.x.min;
}
- extsPtr->bottom = elemPtr->y.max;
- if ((elemPtr->y.min <= 0.0) && (elemPtr->axes.y->logScale)) {
- extsPtr->top = Blt_FindElemValuesMinimum(&elemPtr->y, DBL_MIN);
+ extsPtr->bottom = elemPtr->coords.y.max;
+ if ((elemPtr->coords.y.min <= 0.0) && (elemPtr->axes.y->logScale)) {
+ extsPtr->top = Blt_FindElemValuesMinimum(&elemPtr->coords.y, DBL_MIN);
} else {
- extsPtr->top = elemPtr->y.min;
+ extsPtr->top = elemPtr->coords.y.min;
}
/* Correct the data limits for error bars */
@@ -2223,11 +2141,11 @@ static void GetLineExtentsProc(Element *basePtr, Region2d *extsPtr)
for (i = 0; i < np; i++) {
double x;
- x = elemPtr->x.values[i] + elemPtr->xError.values[i];
+ x = elemPtr->coords.x.values[i] + elemPtr->xError.values[i];
if (x > extsPtr->right) {
extsPtr->right = x;
}
- x = elemPtr->x.values[i] - elemPtr->xError.values[i];
+ x = elemPtr->coords.x.values[i] - elemPtr->xError.values[i];
if (elemPtr->axes.x->logScale) {
if (x < 0.0) {
x = -x; /* Mirror negative values, instead of
@@ -2267,11 +2185,11 @@ static void GetLineExtentsProc(Element *basePtr, Region2d *extsPtr)
for (i = 0; i < np; i++) {
double y;
- y = elemPtr->y.values[i] + elemPtr->yError.values[i];
+ y = elemPtr->coords.y.values[i] + elemPtr->yError.values[i];
if (y > extsPtr->bottom) {
extsPtr->bottom = y;
}
- y = elemPtr->y.values[i] - elemPtr->yError.values[i];
+ y = elemPtr->coords.y.values[i] - elemPtr->yError.values[i];
if (elemPtr->axes.y->logScale) {
if (y < 0.0) {
y = -y; /* Mirror negative values, instead of
@@ -3058,7 +2976,7 @@ static void DrawValues(Graph* graphPtr, Drawable drawable,
fmt = "%g";
}
count = 0;
- xval = elemPtr->x.values, yval = elemPtr->y.values;
+ xval = elemPtr->coords.x.values, yval = elemPtr->coords.y.values;
// be sure to update style->gc, things might have changed
penPtr->valueStyle.flags |= UPDATE_GC;
@@ -3419,8 +3337,8 @@ static void ValuesToPostScript(Blt_Ps ps, LineElement* elemPtr, LinePen* penPtr,
for (pp = symbolPts, endp = symbolPts + nSymbolPts; pp < endp; pp++) {
double x, y;
- x = elemPtr->x.values[pointToData[count]];
- y = elemPtr->y.values[pointToData[count]];
+ x = elemPtr->coords.x.values[pointToData[count]];
+ y = elemPtr->coords.y.values[pointToData[count]];
count++;
if (penPtr->valueShow == SHOW_X) {
sprintf_s(string, TCL_DOUBLE_SPACE, fmt, x);
diff --git a/src/bltGrElemOp.C b/src/bltGrElemOp.C
index 7047305..6ea3f95 100644
--- a/src/bltGrElemOp.C
+++ b/src/bltGrElemOp.C
@@ -87,7 +87,6 @@ static int ValuesSetProc(ClientData clientData, Tcl_Interp* interp,
int objc;
if (Tcl_ListObjGetElements(interp, *objPtr, &objc, &objv) != TCL_OK)
return TCL_ERROR;
- elemPtr->flags |= MAP_ITEM;
FreeDataValues(valuesPtr);
if (objc == 0)
@@ -173,21 +172,21 @@ static int PairsSetProc(ClientData clientData, Tcl_Interp* interp,
size_t newSize = nValues * sizeof(double);
Element* elemPtr = (Element*)widgRec;
- FreeDataValues(&elemPtr->x);
- FreeDataValues(&elemPtr->y);
+ FreeDataValues(&elemPtr->coords.x);
+ FreeDataValues(&elemPtr->coords.y);
if (newSize > 0) {
- elemPtr->x.values = (double*)malloc(newSize);
- elemPtr->y.values = (double*)malloc(newSize);
- elemPtr->x.nValues = elemPtr->y.nValues = nValues;
+ elemPtr->coords.x.values = (double*)malloc(newSize);
+ elemPtr->coords.y.values = (double*)malloc(newSize);
+ elemPtr->coords.x.nValues = elemPtr->coords.y.nValues = nValues;
int ii=0;
for (double* p = values; ii<nValues; ii++) {
- elemPtr->x.values[ii] = *p++;
- elemPtr->y.values[ii] = *p++;
+ elemPtr->coords.x.values[ii] = *p++;
+ elemPtr->coords.y.values[ii] = *p++;
}
free(values);
- FindRange(&elemPtr->x);
- FindRange(&elemPtr->y);
+ FindRange(&elemPtr->coords.x);
+ FindRange(&elemPtr->coords.y);
}
return TCL_OK;
@@ -203,8 +202,8 @@ static Tcl_Obj* PairsGetProc(ClientData clientData, Tk_Window tkwin,
Tcl_Obj** ll = (Tcl_Obj**)calloc(2*cnt,sizeof(Tcl_Obj*));
for (int ii=0, jj=0; ii<cnt; ii++) {
- ll[jj++] = Tcl_NewDoubleObj(elemPtr->x.values[ii]);
- ll[jj++] = Tcl_NewDoubleObj(elemPtr->y.values[ii]);
+ ll[jj++] = Tcl_NewDoubleObj(elemPtr->coords.x.values[ii]);
+ ll[jj++] = Tcl_NewDoubleObj(elemPtr->coords.y.values[ii]);
}
Tcl_Obj* listObjPtr = Tcl_NewListObj(2*cnt, ll);
free(ll);
@@ -346,8 +345,8 @@ static void DestroyElement(Element* elemPtr)
Blt_DeleteBindings(graphPtr->bindTable, elemPtr);
Blt_Legend_RemoveElement(graphPtr, elemPtr);
- FreeDataValues(&elemPtr->x);
- FreeDataValues(&elemPtr->y);
+ FreeDataValues(&elemPtr->coords.x);
+ FreeDataValues(&elemPtr->coords.y);
/* Remove it also from the element display list */
if (elemPtr->link) {
@@ -561,23 +560,21 @@ static int ClosestOp(Graph* graphPtr, Tcl_Interp* interp,
searchPtr->index = -1;
searchPtr->dist = (double)(searchPtr->halo + 1);
- char* string = Tcl_GetString(objv[5]);
- if (string && string[0] != '\0') {
+ if (objc>5) {
Element* elemPtr;
if (Blt_GetElement(interp, graphPtr, objv[5], &elemPtr) != TCL_OK)
- return TCL_ERROR; /* Can't find named element */
+ return TCL_ERROR;
if (elemPtr && !elemPtr->hide &&
!(elemPtr->flags & (MAP_ITEM|DELETE_PENDING)))
(*elemPtr->procsPtr->closestProc) (graphPtr, elemPtr);
}
else {
- /*
- * Find the closest point from the set of displayed elements,
- * searching the display list from back to front. That way if
- * the points from two different elements overlay each other
- * exactly, the last one picked will be the topmost.
- */
+ // Find the closest point from the set of displayed elements,
+ // searching the display list from back to front. That way if
+ // the points from two different elements overlay each other
+ // exactly, the last one picked will be the topmost.
+
for (Blt_ChainLink link=Blt_Chain_LastLink(graphPtr->elements.displayList);
link != NULL; link = Blt_Chain_PrevLink(link)) {
Element* elemPtr = (Element*)Blt_Chain_GetValue(link);
@@ -588,19 +585,15 @@ static int ClosestOp(Graph* graphPtr, Tcl_Interp* interp,
}
if (searchPtr->dist < (double)searchPtr->halo) {
- // Return a list of name value pairs.
Tcl_Obj* listObjPtr = Tcl_NewListObj(0, (Tcl_Obj **)NULL);
Tcl_ListObjAppendElement(interp, listObjPtr, Tcl_NewStringObj("name", -1));
- Tcl_ListObjAppendElement(interp, listObjPtr,
- Tcl_NewStringObj(searchPtr->elemPtr->obj.name, -1));
+ Tcl_ListObjAppendElement(interp, listObjPtr, Tcl_NewStringObj(searchPtr->elemPtr->obj.name, -1));
Tcl_ListObjAppendElement(interp, listObjPtr, Tcl_NewStringObj("index", -1));
Tcl_ListObjAppendElement(interp, listObjPtr, Tcl_NewIntObj(searchPtr->index));
Tcl_ListObjAppendElement(interp, listObjPtr, Tcl_NewStringObj("x", -1));
- Tcl_ListObjAppendElement(interp, listObjPtr,
- Tcl_NewDoubleObj(searchPtr->point.x));
+ Tcl_ListObjAppendElement(interp, listObjPtr, Tcl_NewDoubleObj(searchPtr->point.x));
Tcl_ListObjAppendElement(interp, listObjPtr, Tcl_NewStringObj("y", -1));
- Tcl_ListObjAppendElement(interp, listObjPtr,
- Tcl_NewDoubleObj(searchPtr->point.y));
+ Tcl_ListObjAppendElement(interp, listObjPtr, Tcl_NewDoubleObj(searchPtr->point.y));
Tcl_ListObjAppendElement(interp, listObjPtr, Tcl_NewStringObj("dist", -1));
Tcl_ListObjAppendElement(interp, listObjPtr, Tcl_NewDoubleObj(searchPtr->dist));
Tcl_SetObjResult(interp, listObjPtr);
@@ -987,16 +980,13 @@ static void VectorChangedProc(Tcl_Interp* interp, ClientData clientData,
{
ElemValues *valuesPtr = (ElemValues*)clientData;
- if (notify == BLT_VECTOR_NOTIFY_DESTROY) {
+ if (notify == BLT_VECTOR_NOTIFY_DESTROY)
FreeDataValues(valuesPtr);
- }
else {
Blt_Vector *vector;
-
Blt_GetVectorById(interp, valuesPtr->vectorSource.vector, &vector);
- if (FetchVectorValues(NULL, valuesPtr, vector) != TCL_OK) {
+ if (FetchVectorValues(NULL, valuesPtr, vector) != TCL_OK)
return;
- }
}
{
Element* elemPtr = valuesPtr->elemPtr;
@@ -1224,13 +1214,14 @@ int Blt_GetElement(Tcl_Interp* interp, Graph* graphPtr, Tcl_Obj *objPtr,
char *name;
name = Tcl_GetString(objPtr);
+ if (!name || !name[0])
+ return TCL_ERROR;
hPtr = Tcl_FindHashEntry(&graphPtr->elements.table, name);
- if (hPtr == NULL) {
- if (interp) {
+ if (!hPtr) {
+ if (interp)
Tcl_AppendResult(interp, "can't find element \"", name,
"\" in \"", Tk_PathName(graphPtr->tkwin), "\"",
NULL);
- }
return TCL_ERROR;
}
*elemPtrPtr = (Element*)Tcl_GetHashValue(hPtr);
diff --git a/src/bltGrElemOp.h b/src/bltGrElemOp.h
index 0de671f..9faa9c8 100644
--- a/src/bltGrElemOp.h
+++ b/src/bltGrElemOp.h
@@ -60,11 +60,9 @@ extern "C" {
* foreground and background colors. */
#define SCALE_SYMBOL (1<<10)
-#define NUMBEROFPOINTS(e) MIN((e)->x.nValues, (e)->y.nValues)
+#define NUMBEROFPOINTS(e) MIN((e)->coords.x.nValues, (e)->coords.y.nValues)
-#define NORMALPEN(e) ((((e)->normalPenPtr == NULL) ? \
- (e)->builtinPenPtr : \
- (e)->normalPenPtr))
+#define NORMALPEN(e) ((((e)->normalPenPtr == NULL) ? (e)->builtinPenPtr : (e)->normalPenPtr))
typedef struct {
double min, max, range;
@@ -78,66 +76,50 @@ typedef struct {
((l).min = (lo), (l).max = (hi), SetRange(l))
typedef struct {
- Segment2d* segments; /* Point to start of this pen's X-error bar
- * segments in the element's array. */
+ Segment2d* segments;
int nSegments;
} ErrorBarSegments;
struct _Pen {
- const char *name; /* Pen style identifier. If NULL pen
- * was statically allocated. */
- ClassId classId; /* Type element using this pen. */
- const char *typeId; /* String token identifying the type of
- * pen. */
- unsigned int flags; /* Indicates if the pen element is
- * active or normal. */
- int refCount; /* Reference count for elements using
- * this pen. */
+ const char *name;
+ ClassId classId;
+ const char *typeId;
+ unsigned int flags;
+ int refCount;
Tcl_HashEntry *hashPtr;
- Tk_OptionTable optionTable; /* Configuration specifications */
+ Tk_OptionTable optionTable;
PenConfigureProc *configProc;
PenDestroyProc *destroyProc;
- Graph *graphPtr; /* Graph that the pen is associated*/
+ Graph *graphPtr;
};
-/*
- * An element has one or more vectors plus several attributes, such as line
- * style, thickness, color, and symbol type. It has an identifier which
- * distinguishes it among the list of all elements.
- */
typedef struct {
- Weight weight; /* Weight range where this pen is valid. */
- Pen* penPtr; /* Pen to use. */
+ Weight weight;
+ Pen* penPtr;
} PenStyle;
typedef struct {
- XColor* color; /* Color of error bar */
- int lineWidth; /* Width of the error bar segments. */
+ XColor* color;
+ int lineWidth;
GC gc;
- int show; /* Flags for errorbars: none, x, y, or both */
+ int show;
} ErrorBarAttributes;
typedef void (ElementDrawProc) (Graph *graphPtr, Drawable drawable,
Element* elemPtr);
-
typedef void (ElementToPostScriptProc) (Graph *graphPtr, Blt_Ps ps,
Element* elemPtr);
-
typedef void (ElementDestroyProc) (Graph *graphPtr, Element* elemPtr);
-
typedef int (ElementConfigProc) (Graph *graphPtr, Element* elemPtr);
-
typedef void (ElementMapProc) (Graph *graphPtr, Element* elemPtr);
-
typedef void (ElementExtentsProc) (Element* elemPtr, Region2d *extsPtr);
-
typedef void (ElementClosestProc) (Graph *graphPtr, Element* elemPtr);
-
typedef void (ElementDrawSymbolProc) (Graph *graphPtr, Drawable drawable,
- Element* elemPtr, int x, int y, int symbolSize);
-
-typedef void (ElementSymbolToPostScriptProc) (Graph *graphPtr,
- Blt_Ps ps, Element* elemPtr, double x, double y, int symSize);
+ Element* elemPtr, int x, int y,
+ int symbolSize);
+typedef void (ElementSymbolToPostScriptProc) (Graph *graphPtr, Blt_Ps ps,
+ Element* elemPtr, double x,
+ double y, int symSize);
typedef struct {
ElementClosestProc *closestProc;
@@ -157,17 +139,9 @@ typedef struct {
Blt_VectorId vector;
} VectorDataSource;
-/*
- * The data structure below contains information pertaining to a line vector.
- * It consists of an array of floating point data values and for convenience,
- * the number and minimum/maximum values.
- */
typedef struct {
- int type; /* Selects the type of data populating this
- * vector: ELEM_SOURCE_VECTOR,
- * ELEM_SOURCE_TABLE, or ELEM_SOURCE_VALUES
- */
- Element* elemPtr; /* Element associated with vector. */
+ int type;
+ Element* elemPtr;
VectorDataSource vectorSource;
double *values;
int nValues;
@@ -175,48 +149,38 @@ typedef struct {
double min, max;
} ElemValues;
+typedef struct {
+ ElemValues x;
+ ElemValues y;
+} ElemCoords;
+
struct _Element {
- GraphObj obj; /* Must be first field in element. */
+ GraphObj obj;
unsigned int flags;
int hide;
Tcl_HashEntry *hashPtr;
- /* Fields specific to elements. */
- const char *label; /* Label displayed in legend */
- unsigned short row, col; /* Position of the entry in the
- * legend. */
- int legendRelief; /* Relief of label in legend. */
- Axis2d axes; /* X-axis and Y-axis mapping the
- * element */
- ElemValues x, y, w; /* Contains array of floating point
- * graph coordinate values. Also holds
- * min/max and the number of
- * coordinates */
- int *activeIndices; /* Array of indices (malloc-ed) which
- * indicate which data points are
- * active (drawn with "active"
- * colors). */
- int nActiveIndices; /* Number of active data points.
- * Special case: if nActiveIndices < 0
- * and the active bit is set in
- * "flags", then all data points are
- * drawn active. */
+ // Fields specific to elements
+ const char *label;
+ unsigned short row;
+ unsigned short col;
+ int legendRelief;
+ Axis2d axes;
+ ElemCoords coords;
+ ElemValues w;
+ int *activeIndices;
+ int nActiveIndices;
ElementProcs *procsPtr;
- Tk_OptionTable optionTable; /* Configuration specifications. */
- Pen *activePenPtr; /* Standard Pens */
+ Tk_OptionTable optionTable;
+ Pen *activePenPtr;
Pen *normalPenPtr;
Pen *builtinPenPtr;
- Blt_Chain stylePalette; /* Palette of pens. */
-
- /* Symbol scaling */
- int scaleSymbols; /* If non-zero, the symbols will scale
- * in size as the graph is zoomed
- * in/out. */
- double xRange, yRange; /* Initial X-axis and Y-axis ranges:
- * used to scale the size of element's
- * symbol. */
+ Blt_Chain stylePalette;
+ int scaleSymbols;
+ double xRange;
+ double yRange;
int state;
- Blt_ChainLink link; /* Element's link in display list. */
+ Blt_ChainLink link;
};
extern const char* fillObjOption[];
@@ -235,4 +199,4 @@ extern void Blt_FreeDataValues(ElemValues *evPtr);
extern int Blt_GetElement(Tcl_Interp* interp, Graph *graphPtr,
Tcl_Obj *objPtr, Element **elemPtrPtr);
-#endif /* _BLT_GR_ELEM_H */
+#endif