summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorjoye <joye>2014-07-07 19:48:17 (GMT)
committerjoye <joye>2014-07-07 19:48:17 (GMT)
commitbb2ce35d03eeec373740bc66fdd07bc727dc65be (patch)
treea48585236265b1a4ebc463ee1c773b0d9c678238 /src
parent10c37eda06bed742efb7981146519105dc9def5c (diff)
downloadblt-bb2ce35d03eeec373740bc66fdd07bc727dc65be.zip
blt-bb2ce35d03eeec373740bc66fdd07bc727dc65be.tar.gz
blt-bb2ce35d03eeec373740bc66fdd07bc727dc65be.tar.bz2
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r--src/bltGrElem.C14
-rw-r--r--src/bltGrElem.h8
-rw-r--r--src/bltGrElemBar.C24
-rw-r--r--src/bltGrElemLine.C28
-rw-r--r--src/bltGrElemOption.C6
5 files changed, 42 insertions, 38 deletions
diff --git a/src/bltGrElem.C b/src/bltGrElem.C
index dd683fa..9981d4b 100644
--- a/src/bltGrElem.C
+++ b/src/bltGrElem.C
@@ -102,7 +102,7 @@ ElemValuesVector::ElemValuesVector(Element* ptr, const char* vecName)
{
elemPtr_ = ptr;
Graph* graphPtr = elemPtr_->graphPtr_;
- source_.vector = Blt_AllocVectorId(graphPtr->interp_, vecName);
+ source_ = Blt_AllocVectorId(graphPtr->interp_, vecName);
}
ElemValuesVector::~ElemValuesVector()
@@ -115,7 +115,7 @@ int ElemValuesVector::getVector()
Graph* graphPtr = elemPtr_->graphPtr_;
Blt_Vector *vecPtr;
- if (Blt_GetVectorById(graphPtr->interp_, source_.vector, &vecPtr) != TCL_OK)
+ if (Blt_GetVectorById(graphPtr->interp_, source_, &vecPtr) != TCL_OK)
return TCL_ERROR;
if (fetchValues(vecPtr) != TCL_OK) {
@@ -123,7 +123,7 @@ int ElemValuesVector::getVector()
return TCL_ERROR;
}
- Blt_SetVectorChangedProc(source_.vector, VectorChangedProc, this);
+ Blt_SetVectorChangedProc(source_, VectorChangedProc, this);
return TCL_OK;
}
@@ -159,10 +159,10 @@ int ElemValuesVector::fetchValues(Blt_Vector* vector)
void ElemValuesVector::freeSource()
{
- if (source_.vector) {
- Blt_SetVectorChangedProc(source_.vector, NULL, NULL);
- Blt_FreeVectorId(source_.vector);
- source_.vector = NULL;
+ if (source_) {
+ Blt_SetVectorChangedProc(source_, NULL, NULL);
+ Blt_FreeVectorId(source_);
+ source_ = NULL;
}
}
diff --git a/src/bltGrElem.h b/src/bltGrElem.h
index 2c980f2..00567de 100644
--- a/src/bltGrElem.h
+++ b/src/bltGrElem.h
@@ -59,17 +59,21 @@ namespace Blt {
class Postscript;
class ElemValues {
+ protected:
+ double min_;
+ double max_;
+
public:
double* values_;
int nValues_;
- double min_;
- double max_;
public:
ElemValues();
virtual ~ElemValues();
void reset();
+ double min() {return min_;}
+ double max() {return max_;}
};
class ElemValuesSource : public ElemValues
diff --git a/src/bltGrElemBar.C b/src/bltGrElemBar.C
index 5cf0956..33d9e86 100644
--- a/src/bltGrElemBar.C
+++ b/src/bltGrElemBar.C
@@ -488,11 +488,11 @@ void BarElement::extents(Region2d *regPtr)
barWidth = ops->barWidth;
double middle = 0.5;
- regPtr->left = ops->coords.x->min_ - middle;
- regPtr->right = ops->coords.x->max_ + middle;
+ regPtr->left = ops->coords.x->min() - middle;
+ regPtr->right = ops->coords.x->max() + middle;
- regPtr->top = ops->coords.y->min_;
- regPtr->bottom = ops->coords.y->max_;
+ regPtr->top = ops->coords.y->min();
+ regPtr->bottom = ops->coords.y->max();
if (regPtr->bottom < gops->baseline)
regPtr->bottom = gops->baseline;
@@ -544,15 +544,15 @@ void BarElement::extents(Region2d *regPtr)
else {
if ((ops->xHigh) &&
(ops->xHigh->nValues_ > 0) &&
- (ops->xHigh->max_ > regPtr->right))
- regPtr->right = ops->xHigh->max_;
+ (ops->xHigh->max() > regPtr->right))
+ regPtr->right = ops->xHigh->max();
if (ops->xLow && (ops->xLow->nValues_ > 0)) {
double left;
- if ((ops->xLow->min_ <= 0.0) && (axisxops->logScale))
+ if ((ops->xLow->min() <= 0.0) && (axisxops->logScale))
left = FindElemValuesMinimum(ops->xLow, DBL_MIN);
else
- left = ops->xLow->min_;
+ left = ops->xLow->min();
if (left < regPtr->left)
regPtr->left = left;
@@ -584,16 +584,16 @@ void BarElement::extents(Region2d *regPtr)
else {
if ((ops->yHigh) &&
(ops->yHigh->nValues_ > 0) &&
- (ops->yHigh->max_ > regPtr->bottom))
- regPtr->bottom = ops->yHigh->max_;
+ (ops->yHigh->max() > regPtr->bottom))
+ regPtr->bottom = ops->yHigh->max();
if (ops->yLow && ops->yLow->nValues_ > 0) {
double top;
- if ((ops->yLow->min_ <= 0.0) &&
+ if ((ops->yLow->min() <= 0.0) &&
(axisyops->logScale))
top = FindElemValuesMinimum(ops->yLow, DBL_MIN);
else
- top = ops->yLow->min_;
+ top = ops->yLow->min();
if (top < regPtr->top)
regPtr->top = top;
diff --git a/src/bltGrElemLine.C b/src/bltGrElemLine.C
index c028913..0610adb 100644
--- a/src/bltGrElemLine.C
+++ b/src/bltGrElemLine.C
@@ -398,19 +398,19 @@ void LineElement::extents(Region2d *extsPtr)
return;
int np = NUMBEROFPOINTS(ops);
- extsPtr->right = ops->coords.x->max_;
+ extsPtr->right = ops->coords.x->max();
AxisOptions* axisxops = (AxisOptions*)ops->xAxis->ops();
- if ((ops->coords.x->min_ <= 0.0) && (axisxops->logScale))
+ if ((ops->coords.x->min() <= 0.0) && (axisxops->logScale))
extsPtr->left = FindElemValuesMinimum(ops->coords.x, DBL_MIN);
else
- extsPtr->left = ops->coords.x->min_;
+ extsPtr->left = ops->coords.x->min();
- extsPtr->bottom = ops->coords.y->max_;
+ extsPtr->bottom = ops->coords.y->max();
AxisOptions* axisyops = (AxisOptions*)ops->yAxis->ops();
- if ((ops->coords.y->min_ <= 0.0) && (axisyops->logScale))
+ if ((ops->coords.y->min() <= 0.0) && (axisyops->logScale))
extsPtr->top = FindElemValuesMinimum(ops->coords.y, DBL_MIN);
else
- extsPtr->top = ops->coords.y->min_;
+ extsPtr->top = ops->coords.y->min();
// Correct the data limits for error bars
if (ops->xError && ops->xError->nValues_ > 0) {
@@ -436,15 +436,15 @@ void LineElement::extents(Region2d *extsPtr)
else {
if (ops->xHigh &&
(ops->xHigh->nValues_ > 0) &&
- (ops->xHigh->max_ > extsPtr->right)) {
- extsPtr->right = ops->xHigh->max_;
+ (ops->xHigh->max() > extsPtr->right)) {
+ extsPtr->right = ops->xHigh->max();
}
if (ops->xLow && ops->xLow->nValues_ > 0) {
double left;
- if ((ops->xLow->min_ <= 0.0) && (axisxops->logScale))
+ if ((ops->xLow->min() <= 0.0) && (axisxops->logScale))
left = FindElemValuesMinimum(ops->xLow, DBL_MIN);
else
- left = ops->xLow->min_;
+ left = ops->xLow->min();
if (left < extsPtr->left)
extsPtr->left = left;
@@ -473,15 +473,15 @@ void LineElement::extents(Region2d *extsPtr)
}
else {
if (ops->yHigh && (ops->yHigh->nValues_ > 0) &&
- (ops->yHigh->max_ > extsPtr->bottom))
- extsPtr->bottom = ops->yHigh->max_;
+ (ops->yHigh->max() > extsPtr->bottom))
+ extsPtr->bottom = ops->yHigh->max();
if (ops->yLow && ops->yLow->nValues_ > 0) {
double top;
- if ((ops->yLow->min_ <= 0.0) && (axisyops->logScale))
+ if ((ops->yLow->min() <= 0.0) && (axisyops->logScale))
top = FindElemValuesMinimum(ops->yLow, DBL_MIN);
else
- top = ops->yLow->min_;
+ top = ops->yLow->min();
if (top < extsPtr->top)
extsPtr->top = top;
diff --git a/src/bltGrElemOption.C b/src/bltGrElemOption.C
index 04dd669..73a6a44 100644
--- a/src/bltGrElemOption.C
+++ b/src/bltGrElemOption.C
@@ -121,7 +121,7 @@ static Tcl_Obj* ValuesGetProc(ClientData clientData, Tk_Window tkwin,
if (!valuesPtr)
return Tcl_NewStringObj("", -1);
- int cnt = valuesPtr->nValues_;
+ int cnt = valuesPtr->nValues();
if (!cnt)
return Tcl_NewListObj(0, (Tcl_Obj**)NULL);
@@ -200,10 +200,10 @@ static Tcl_Obj* PairsGetProc(ClientData clientData, Tk_Window tkwin,
if (!coordsPtr ||
!coordsPtr->x || !coordsPtr->y ||
- !coordsPtr->x->nValues_ || !coordsPtr->y->nValues_)
+ !coordsPtr->x->nValues() || !coordsPtr->y->nValues())
return Tcl_NewListObj(0, (Tcl_Obj**)NULL);
- int cnt = MIN(coordsPtr->x->nValues_, coordsPtr->y->nValues_);
+ int cnt = MIN(coordsPtr->x->nValues(), coordsPtr->y->nValues());
Tcl_Obj** ll = new Tcl_Obj*[2*cnt];
for (int ii=0, jj=0; ii<cnt; ii++) {
ll[jj++] = Tcl_NewDoubleObj(coordsPtr->x->values_[ii]);