summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjoye <joye>2014-04-23 19:33:58 (GMT)
committerjoye <joye>2014-04-23 19:33:58 (GMT)
commit6e381380d14d3ee0fbc4caecc53442f49cb5e101 (patch)
tree6972755e135983b2a946cc87001bc53b11283139
parent3d6f1d5636fd4fb4acc254dd3fbcde448228e0aa (diff)
downloadblt-6e381380d14d3ee0fbc4caecc53442f49cb5e101.zip
blt-6e381380d14d3ee0fbc4caecc53442f49cb5e101.tar.gz
blt-6e381380d14d3ee0fbc4caecc53442f49cb5e101.tar.bz2
*** empty log message ***
-rw-r--r--src/bltGrAxisOp.C497
-rw-r--r--src/bltGrAxisOp.h21
-rw-r--r--src/bltGrElemLineSpline.C1
-rw-r--r--src/bltGrElemOp.C5
-rw-r--r--src/bltGrElemOp.h2
-rw-r--r--src/bltGrHairsOp.C8
-rw-r--r--src/bltGrLegdOp.C5
-rw-r--r--src/bltGrMarkerOp.C9
-rw-r--r--src/bltGrPenOp.C9
-rw-r--r--src/bltGrPenOp.h3
-rw-r--r--src/bltGrPostscriptOp.C10
-rw-r--r--src/bltGrPostscriptOp.h2
-rw-r--r--src/bltGrXAxisOp.C131
-rw-r--r--src/bltGraph.C2
-rw-r--r--src/bltGraphBar.C6
-rw-r--r--src/bltGraphLine.C6
-rw-r--r--src/bltGraphOp.C77
-rw-r--r--src/bltGraphOp.h5
-rw-r--r--src/bltOp.C25
-rw-r--r--src/bltOp.h9
20 files changed, 405 insertions, 428 deletions
diff --git a/src/bltGrAxisOp.C b/src/bltGrAxisOp.C
index 20c3c63..029fa6b 100644
--- a/src/bltGrAxisOp.C
+++ b/src/bltGrAxisOp.C
@@ -29,7 +29,6 @@
extern "C" {
#include "bltInt.h"
-#include "bltOp.h"
#include "bltBind.h"
};
@@ -52,7 +51,7 @@ static double Clamp(double x)
return (x < 0.0) ? 0.0 : (x > 1.0) ? 1.0 : x;
}
-int AxisObjConfigure(Tcl_Interp* interp, Axis* axisPtr,
+int AxisObjConfigure(Axis* axisPtr, Tcl_Interp* interp,
int objc, Tcl_Obj* const objv[])
{
Graph* graphPtr = axisPtr->graphPtr_;
@@ -95,245 +94,6 @@ int AxisObjConfigure(Tcl_Interp* interp, Axis* axisPtr,
}
}
-// Common Ops
-
-int AxisCgetOp(Tcl_Interp* interp, Axis* axisPtr,
- int objc, Tcl_Obj* const objv[])
-{
- Graph* graphPtr = axisPtr->graphPtr_;
-
- if (objc != 4) {
- Tcl_WrongNumArgs(interp, 2, objv, "cget option");
- return TCL_ERROR;
- }
-
- Tcl_Obj* objPtr = Tk_GetOptionValue(interp, (char*)axisPtr->ops(),
- axisPtr->optionTable(),
- objv[3], graphPtr->tkwin_);
- if (!objPtr)
- return TCL_ERROR;
- else
- Tcl_SetObjResult(interp, objPtr);
- return TCL_OK;
-}
-
-int AxisConfigureOp(Tcl_Interp* interp, Axis* axisPtr,
- int objc, Tcl_Obj* const objv[])
-{
- Graph* graphPtr = axisPtr->graphPtr_;
-
- if (objc <= 4) {
- Tcl_Obj* objPtr = Tk_GetOptionInfo(interp, (char*)axisPtr->ops(),
- axisPtr->optionTable(),
- (objc == 4) ? objv[3] : NULL,
- graphPtr->tkwin_);
- if (!objPtr)
- return TCL_ERROR;
- else
- Tcl_SetObjResult(interp, objPtr);
- return TCL_OK;
- }
- else
- return AxisObjConfigure(interp, axisPtr, objc-3, objv+3);
-}
-
-int AxisActivateOp(Tcl_Interp* interp, Axis* axisPtr,
- int objc, Tcl_Obj* const objv[])
-{
- AxisOptions* ops = (AxisOptions*)axisPtr->ops();
- Graph* graphPtr = axisPtr->graphPtr_;
- const char *string;
-
- string = Tcl_GetString(objv[2]);
- if (string[0] == 'a')
- axisPtr->flags |= ACTIVE;
- else
- axisPtr->flags &= ~ACTIVE;
-
- if (!ops->hide && axisPtr->use_) {
- graphPtr->flags |= DRAW_MARGINS | CACHE_DIRTY;
- graphPtr->eventuallyRedraw();
- }
-
- return TCL_OK;
-}
-
-int AxisInvTransformOp(Tcl_Interp* interp, Axis* axisPtr,
- int objc, Tcl_Obj* const objv[])
-{
- Graph* graphPtr = axisPtr->graphPtr_;
-
- if (graphPtr->flags & RESET_AXES)
- graphPtr->resetAxes();
-
- int sy;
- if (Tcl_GetIntFromObj(interp, objv[3], &sy) != TCL_OK)
- return TCL_ERROR;
-
- // Is the axis vertical or horizontal?
- // Check the site where the axis was positioned. If the axis is
- // virtual, all we have to go on is how it was mapped to an
- // element (using either -mapx or -mapy options).
- double y = axisPtr->isHorizontal() ?
- axisPtr->invHMap(sy) : axisPtr->invVMap(sy);
-
- Tcl_SetDoubleObj(Tcl_GetObjResult(interp), y);
- return TCL_OK;
-}
-
-int AxisLimitsOp(Tcl_Interp* interp, Axis* axisPtr,
- int objc, Tcl_Obj* const objv[])
-{
- AxisOptions* ops = (AxisOptions*)axisPtr->ops();
- Graph* graphPtr = axisPtr->graphPtr_;
-
- if (graphPtr->flags & RESET_AXES)
- graphPtr->resetAxes();
-
- double min, max;
- if (ops->logScale) {
- min = EXP10(axisPtr->axisRange_.min);
- max = EXP10(axisPtr->axisRange_.max);
- }
- else {
- min = axisPtr->axisRange_.min;
- max = axisPtr->axisRange_.max;
- }
-
- Tcl_Obj *listObjPtr = Tcl_NewListObj(0, (Tcl_Obj **)NULL);
- Tcl_ListObjAppendElement(interp, listObjPtr, Tcl_NewDoubleObj(min));
- Tcl_ListObjAppendElement(interp, listObjPtr, Tcl_NewDoubleObj(max));
-
- Tcl_SetObjResult(interp, listObjPtr);
- return TCL_OK;
-}
-
-int AxisMarginOp(Tcl_Interp* interp, Axis* axisPtr,
- int objc, Tcl_Obj* const objv[])
-{
- const char *marginName = "";
- if (axisPtr->use_)
- marginName = axisNames[axisPtr->margin_].name;
-
- Tcl_SetStringObj(Tcl_GetObjResult(interp), marginName, -1);
- return TCL_OK;
-}
-
-int AxisTransformOp(Tcl_Interp* interp, Axis* axisPtr,
- int objc, Tcl_Obj* const objv[])
-{
- Graph* graphPtr = axisPtr->graphPtr_;
-
- if (graphPtr->flags & RESET_AXES)
- graphPtr->resetAxes();
-
- double x;
- if (Blt_ExprDoubleFromObj(interp, objv[3], &x) != TCL_OK)
- return TCL_ERROR;
-
- if (axisPtr->isHorizontal())
- x = axisPtr->hMap(x);
- else
- x = axisPtr->vMap(x);
-
- Tcl_SetIntObj(Tcl_GetObjResult(interp), (int)x);
- return TCL_OK;
-}
-
-int AxisTypeOp(Tcl_Interp* interp, Axis* axisPtr,
- int objc, Tcl_Obj* const objv[])
-{
- const char *typeName;
-
- typeName = "";
- if (axisPtr->use_) {
- if (axisNames[axisPtr->margin_].classId == CID_AXIS_X)
- typeName = "x";
- else if (axisNames[axisPtr->margin_].classId == CID_AXIS_Y)
- typeName = "y";
- }
- Tcl_SetStringObj(Tcl_GetObjResult(interp), typeName, -1);
- return TCL_OK;
-}
-
-int AxisViewOp(Tcl_Interp* interp, Axis* axisPtr,
- int objc, Tcl_Obj* const objv[])
-{
- AxisOptions* ops = (AxisOptions*)axisPtr->ops();
- Graph* graphPtr = axisPtr->graphPtr_;
- double worldMin = axisPtr->valueRange_.min;
- double worldMax = axisPtr->valueRange_.max;
- /* Override data dimensions with user-selected limits. */
- if (!isnan(axisPtr->scrollMin_))
- worldMin = axisPtr->scrollMin_;
-
- if (!isnan(axisPtr->scrollMax_))
- worldMax = axisPtr->scrollMax_;
-
- double viewMin = axisPtr->min_;
- double viewMax = axisPtr->max_;
- /* Bound the view within scroll region. */
- if (viewMin < worldMin)
- viewMin = worldMin;
-
- if (viewMax > worldMax)
- viewMax = worldMax;
-
- if (ops->logScale) {
- worldMin = log10(worldMin);
- worldMax = log10(worldMax);
- viewMin = log10(viewMin);
- viewMax = log10(viewMax);
- }
- double worldWidth = worldMax - worldMin;
- double viewWidth = viewMax - viewMin;
-
- /* Unlike horizontal axes, vertical axis values run opposite of the
- * scrollbar first/last values. So instead of pushing the axis minimum
- * around, we move the maximum instead. */
- double axisOffset;
- double axisScale;
- if (axisPtr->isHorizontal() != ops->descending) {
- axisOffset = viewMin - worldMin;
- axisScale = graphPtr->hScale_;
- } else {
- axisOffset = worldMax - viewMax;
- axisScale = graphPtr->vScale_;
- }
- if (objc == 4) {
- double first = Clamp(axisOffset / worldWidth);
- double last = Clamp((axisOffset + viewWidth) / worldWidth);
- Tcl_Obj *listObjPtr = Tcl_NewListObj(0, NULL);
- Tcl_ListObjAppendElement(interp, listObjPtr, Tcl_NewDoubleObj(first));
- Tcl_ListObjAppendElement(interp, listObjPtr, Tcl_NewDoubleObj(last));
- Tcl_SetObjResult(interp, listObjPtr);
- return TCL_OK;
- }
- double fract = axisOffset / worldWidth;
- if (GetAxisScrollInfo(interp, objc, objv, &fract, viewWidth / worldWidth,
- ops->scrollUnits, axisScale) != TCL_OK)
- return TCL_ERROR;
-
- if (axisPtr->isHorizontal() != ops->descending) {
- ops->reqMin = (fract * worldWidth) + worldMin;
- ops->reqMax = ops->reqMin + viewWidth;
- }
- else {
- ops->reqMax = worldMax - (fract * worldWidth);
- ops->reqMin = ops->reqMax - viewWidth;
- }
- if (ops->logScale) {
- ops->reqMin = EXP10(ops->reqMin);
- ops->reqMax = EXP10(ops->reqMax);
- }
- graphPtr->flags |= (GET_AXIS_GEOMETRY | LAYOUT_NEEDED | RESET_AXES);
- graphPtr->eventuallyRedraw();
-
- return TCL_OK;
-}
-
-// Axis
-
static int CgetOp(ClientData clientData, Tcl_Interp* interp,
int objc, Tcl_Obj* const objv[])
{
@@ -345,7 +105,7 @@ static int CgetOp(ClientData clientData, Tcl_Interp* interp,
if (graphPtr->getAxis(objv[3], &axisPtr) != TCL_OK)
return TCL_ERROR;
- return AxisCgetOp(interp, axisPtr, objc-1, objv+1);
+ return AxisCgetOp(axisPtr, interp, objc-1, objv+1);
}
static int ConfigureOp(ClientData clientData, Tcl_Interp* interp,
@@ -359,7 +119,7 @@ static int ConfigureOp(ClientData clientData, Tcl_Interp* interp,
if (graphPtr->getAxis(objv[3], &axisPtr) != TCL_OK)
return TCL_ERROR;
- return AxisConfigureOp(interp, axisPtr, objc-1, objv+1);
+ return AxisConfigureOp(axisPtr, interp, objc-1, objv+1);
}
static int ActivateOp(ClientData clientData, Tcl_Interp* interp,
@@ -373,7 +133,7 @@ static int ActivateOp(ClientData clientData, Tcl_Interp* interp,
if (graphPtr->getAxis(objv[3], &axisPtr) != TCL_OK)
return TCL_ERROR;
- return AxisActivateOp(interp, axisPtr, objc, objv);
+ return AxisActivateOp(axisPtr, interp, objc, objv);
}
static int BindOp(ClientData clientData, Tcl_Interp* interp,
@@ -488,7 +248,7 @@ static int InvTransformOp(ClientData clientData, Tcl_Interp* interp,
if (graphPtr->getAxis(objv[3], &axisPtr) != TCL_OK)
return TCL_ERROR;
- return AxisInvTransformOp(interp, axisPtr, objc-1, objv+1);
+ return AxisInvTransformOp(axisPtr, interp, objc-1, objv+1);
}
static int LimitsOp(ClientData clientData, Tcl_Interp* interp,
@@ -502,7 +262,7 @@ static int LimitsOp(ClientData clientData, Tcl_Interp* interp,
if (graphPtr->getAxis(objv[3], &axisPtr) != TCL_OK)
return TCL_ERROR;
- return AxisLimitsOp(interp, axisPtr, objc-1, objv+1);
+ return AxisLimitsOp(axisPtr, interp, objc-1, objv+1);
}
static int MarginOp(ClientData clientData, Tcl_Interp* interp,
@@ -516,7 +276,7 @@ static int MarginOp(ClientData clientData, Tcl_Interp* interp,
if (graphPtr->getAxis(objv[3], &axisPtr) != TCL_OK)
return TCL_ERROR;
- return AxisMarginOp(interp, axisPtr, objc-1, objv+1);
+ return AxisMarginOp(axisPtr, interp, objc-1, objv+1);
}
static int NamesOp(ClientData clientData, Tcl_Interp* interp,
@@ -561,7 +321,7 @@ static int TransformOp(ClientData clientData, Tcl_Interp* interp,
if (graphPtr->getAxis(objv[3], &axisPtr) != TCL_OK)
return TCL_ERROR;
- return AxisTransformOp(interp, axisPtr, objc-1, objv+1);
+ return AxisTransformOp(axisPtr, interp, objc-1, objv+1);
}
static int TypeOp(ClientData clientData, Tcl_Interp* interp,
@@ -575,7 +335,7 @@ static int TypeOp(ClientData clientData, Tcl_Interp* interp,
if (graphPtr->getAxis(objv[3], &axisPtr) != TCL_OK)
return TCL_ERROR;
- return AxisTypeOp(interp, axisPtr, objc-1, objv+1);
+ return AxisTypeOp(axisPtr, interp, objc-1, objv+1);
}
static int ViewOp(ClientData clientData, Tcl_Interp* interp,
@@ -589,7 +349,7 @@ static int ViewOp(ClientData clientData, Tcl_Interp* interp,
if (graphPtr->getAxis(objv[3], &axisPtr) != TCL_OK)
return TCL_ERROR;
- return AxisViewOp(interp, axisPtr, objc-1, objv+1);
+ return AxisViewOp(axisPtr, interp, objc-1, objv+1);
}
const TkEnsemble axisEnsemble[] = {
@@ -743,3 +503,240 @@ static int GetAxisScrollInfo(Tcl_Interp* interp,
return TCL_OK;
}
+// Common Ops
+
+int AxisCgetOp(Axis* axisPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
+{
+ Graph* graphPtr = axisPtr->graphPtr_;
+
+ if (objc != 4) {
+ Tcl_WrongNumArgs(interp, 2, objv, "cget option");
+ return TCL_ERROR;
+ }
+
+ Tcl_Obj* objPtr = Tk_GetOptionValue(interp, (char*)axisPtr->ops(),
+ axisPtr->optionTable(),
+ objv[3], graphPtr->tkwin_);
+ if (!objPtr)
+ return TCL_ERROR;
+ else
+ Tcl_SetObjResult(interp, objPtr);
+ return TCL_OK;
+}
+
+int AxisConfigureOp(Axis* axisPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
+{
+ Graph* graphPtr = axisPtr->graphPtr_;
+
+ if (objc <= 4) {
+ Tcl_Obj* objPtr = Tk_GetOptionInfo(interp, (char*)axisPtr->ops(),
+ axisPtr->optionTable(),
+ (objc == 4) ? objv[3] : NULL,
+ graphPtr->tkwin_);
+ if (!objPtr)
+ return TCL_ERROR;
+ else
+ Tcl_SetObjResult(interp, objPtr);
+ return TCL_OK;
+ }
+ else
+ return AxisObjConfigure(axisPtr, interp, objc-3, objv+3);
+}
+
+int AxisActivateOp(Axis* axisPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
+{
+ AxisOptions* ops = (AxisOptions*)axisPtr->ops();
+ Graph* graphPtr = axisPtr->graphPtr_;
+ const char *string;
+
+ string = Tcl_GetString(objv[2]);
+ if (string[0] == 'a')
+ axisPtr->flags |= ACTIVE;
+ else
+ axisPtr->flags &= ~ACTIVE;
+
+ if (!ops->hide && axisPtr->use_) {
+ graphPtr->flags |= DRAW_MARGINS | CACHE_DIRTY;
+ graphPtr->eventuallyRedraw();
+ }
+
+ return TCL_OK;
+}
+
+int AxisInvTransformOp(Axis* axisPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
+{
+ Graph* graphPtr = axisPtr->graphPtr_;
+
+ if (graphPtr->flags & RESET_AXES)
+ graphPtr->resetAxes();
+
+ int sy;
+ if (Tcl_GetIntFromObj(interp, objv[3], &sy) != TCL_OK)
+ return TCL_ERROR;
+
+ // Is the axis vertical or horizontal?
+ // Check the site where the axis was positioned. If the axis is
+ // virtual, all we have to go on is how it was mapped to an
+ // element (using either -mapx or -mapy options).
+ double y = axisPtr->isHorizontal() ?
+ axisPtr->invHMap(sy) : axisPtr->invVMap(sy);
+
+ Tcl_SetDoubleObj(Tcl_GetObjResult(interp), y);
+ return TCL_OK;
+}
+
+int AxisLimitsOp(Axis* axisPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
+{
+ AxisOptions* ops = (AxisOptions*)axisPtr->ops();
+ Graph* graphPtr = axisPtr->graphPtr_;
+
+ if (graphPtr->flags & RESET_AXES)
+ graphPtr->resetAxes();
+
+ double min, max;
+ if (ops->logScale) {
+ min = EXP10(axisPtr->axisRange_.min);
+ max = EXP10(axisPtr->axisRange_.max);
+ }
+ else {
+ min = axisPtr->axisRange_.min;
+ max = axisPtr->axisRange_.max;
+ }
+
+ Tcl_Obj *listObjPtr = Tcl_NewListObj(0, (Tcl_Obj **)NULL);
+ Tcl_ListObjAppendElement(interp, listObjPtr, Tcl_NewDoubleObj(min));
+ Tcl_ListObjAppendElement(interp, listObjPtr, Tcl_NewDoubleObj(max));
+
+ Tcl_SetObjResult(interp, listObjPtr);
+ return TCL_OK;
+}
+
+int AxisMarginOp(Axis* axisPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
+{
+ const char *marginName = "";
+ if (axisPtr->use_)
+ marginName = axisNames[axisPtr->margin_].name;
+
+ Tcl_SetStringObj(Tcl_GetObjResult(interp), marginName, -1);
+ return TCL_OK;
+}
+
+int AxisTransformOp(Axis* axisPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
+{
+ Graph* graphPtr = axisPtr->graphPtr_;
+
+ if (graphPtr->flags & RESET_AXES)
+ graphPtr->resetAxes();
+
+ double x;
+ if (Blt_ExprDoubleFromObj(interp, objv[3], &x) != TCL_OK)
+ return TCL_ERROR;
+
+ if (axisPtr->isHorizontal())
+ x = axisPtr->hMap(x);
+ else
+ x = axisPtr->vMap(x);
+
+ Tcl_SetIntObj(Tcl_GetObjResult(interp), (int)x);
+ return TCL_OK;
+}
+
+int AxisTypeOp(Axis* axisPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
+{
+ const char *typeName;
+
+ typeName = "";
+ if (axisPtr->use_) {
+ if (axisNames[axisPtr->margin_].classId == CID_AXIS_X)
+ typeName = "x";
+ else if (axisNames[axisPtr->margin_].classId == CID_AXIS_Y)
+ typeName = "y";
+ }
+ Tcl_SetStringObj(Tcl_GetObjResult(interp), typeName, -1);
+ return TCL_OK;
+}
+
+int AxisViewOp(Axis* axisPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
+{
+ AxisOptions* ops = (AxisOptions*)axisPtr->ops();
+ Graph* graphPtr = axisPtr->graphPtr_;
+ double worldMin = axisPtr->valueRange_.min;
+ double worldMax = axisPtr->valueRange_.max;
+ /* Override data dimensions with user-selected limits. */
+ if (!isnan(axisPtr->scrollMin_))
+ worldMin = axisPtr->scrollMin_;
+
+ if (!isnan(axisPtr->scrollMax_))
+ worldMax = axisPtr->scrollMax_;
+
+ double viewMin = axisPtr->min_;
+ double viewMax = axisPtr->max_;
+ /* Bound the view within scroll region. */
+ if (viewMin < worldMin)
+ viewMin = worldMin;
+
+ if (viewMax > worldMax)
+ viewMax = worldMax;
+
+ if (ops->logScale) {
+ worldMin = log10(worldMin);
+ worldMax = log10(worldMax);
+ viewMin = log10(viewMin);
+ viewMax = log10(viewMax);
+ }
+ double worldWidth = worldMax - worldMin;
+ double viewWidth = viewMax - viewMin;
+
+ /* Unlike horizontal axes, vertical axis values run opposite of the
+ * scrollbar first/last values. So instead of pushing the axis minimum
+ * around, we move the maximum instead. */
+ double axisOffset;
+ double axisScale;
+ if (axisPtr->isHorizontal() != ops->descending) {
+ axisOffset = viewMin - worldMin;
+ axisScale = graphPtr->hScale_;
+ } else {
+ axisOffset = worldMax - viewMax;
+ axisScale = graphPtr->vScale_;
+ }
+ if (objc == 4) {
+ double first = Clamp(axisOffset / worldWidth);
+ double last = Clamp((axisOffset + viewWidth) / worldWidth);
+ Tcl_Obj *listObjPtr = Tcl_NewListObj(0, NULL);
+ Tcl_ListObjAppendElement(interp, listObjPtr, Tcl_NewDoubleObj(first));
+ Tcl_ListObjAppendElement(interp, listObjPtr, Tcl_NewDoubleObj(last));
+ Tcl_SetObjResult(interp, listObjPtr);
+ return TCL_OK;
+ }
+ double fract = axisOffset / worldWidth;
+ if (GetAxisScrollInfo(interp, objc, objv, &fract, viewWidth / worldWidth,
+ ops->scrollUnits, axisScale) != TCL_OK)
+ return TCL_ERROR;
+
+ if (axisPtr->isHorizontal() != ops->descending) {
+ ops->reqMin = (fract * worldWidth) + worldMin;
+ ops->reqMax = ops->reqMin + viewWidth;
+ }
+ else {
+ ops->reqMax = worldMax - (fract * worldWidth);
+ ops->reqMin = ops->reqMax - viewWidth;
+ }
+ if (ops->logScale) {
+ ops->reqMin = EXP10(ops->reqMin);
+ ops->reqMax = EXP10(ops->reqMax);
+ }
+ graphPtr->flags |= (GET_AXIS_GEOMETRY | LAYOUT_NEEDED | RESET_AXES);
+ graphPtr->eventuallyRedraw();
+
+ return TCL_OK;
+}
+
diff --git a/src/bltGrAxisOp.h b/src/bltGrAxisOp.h
index d4a2686..a558644 100644
--- a/src/bltGrAxisOp.h
+++ b/src/bltGrAxisOp.h
@@ -37,9 +37,28 @@
extern const TkEnsemble axisEnsemble[];
-extern int AxisObjConfigure(Tcl_Interp* interp, Axis* axisPtr,
+extern int AxisObjConfigure(Axis* axisPtr, Tcl_Interp* interp,
int objc, Tcl_Obj* const objv[]);
+extern int AxisCgetOp(Axis* axisPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[]);
+extern int AxisConfigureOp(Axis* axisPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[]);
+extern int AxisActivateOp(Axis* axisPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[]);
+extern int AxisInvTransformOp(Axis* axisPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[]);
+extern int AxisLimitsOp(Axis* axisPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[]);
+extern int AxisMarginOp(Axis* axisPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[]);
+extern int AxisTransformOp(Axis* axisPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[]);
+extern int AxisTypeOp(Axis* axisPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[]);
+extern int AxisViewOp(Axis* axisPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[]);
+
extern Axis *Blt_GetFirstAxis(Blt_Chain chain);
#endif
diff --git a/src/bltGrElemLineSpline.C b/src/bltGrElemLineSpline.C
index 5b9f365..419afe3 100644
--- a/src/bltGrElemLineSpline.C
+++ b/src/bltGrElemLineSpline.C
@@ -35,7 +35,6 @@
extern "C" {
#include "bltInt.h"
-#include "bltOp.h"
};
#include "bltSpline.h"
diff --git a/src/bltGrElemOp.C b/src/bltGrElemOp.C
index f2305c6..15b6d24 100644
--- a/src/bltGrElemOp.C
+++ b/src/bltGrElemOp.C
@@ -29,7 +29,6 @@
extern "C" {
#include "bltInt.h"
-#include "bltOp.h"
#include "bltBind.h"
};
@@ -47,7 +46,7 @@ static int GetIndex(Tcl_Interp* interp, Element* elemPtr,
Tcl_Obj *objPtr, int *indexPtr);
static Tcl_Obj *DisplayListObj(Graph* graphPtr);
-int ElementObjConfigure(Tcl_Interp* interp, Element* elemPtr,
+int ElementObjConfigure( Element* elemPtr, Tcl_Interp* interp,
int objc, Tcl_Obj* const objv[])
{
Graph* graphPtr = elemPtr->graphPtr_;
@@ -137,7 +136,7 @@ static int ConfigureOp(ClientData clientData, Tcl_Interp* interp,
return TCL_OK;
}
else
- return ElementObjConfigure(interp, elemPtr, objc-4, objv+4);
+ return ElementObjConfigure(elemPtr, interp, objc-4, objv+4);
}
static int ActivateOp(ClientData clientData, Tcl_Interp* interp,
diff --git a/src/bltGrElemOp.h b/src/bltGrElemOp.h
index d7b522b..96f83f1 100644
--- a/src/bltGrElemOp.h
+++ b/src/bltGrElemOp.h
@@ -37,6 +37,6 @@
extern const TkEnsemble elementEnsemble[];
-extern int ElementObjConfigure(Tcl_Interp* interp, Element* elemPtr,
+extern int ElementObjConfigure(Element* elemPtr, Tcl_Interp* interp,
int objc, Tcl_Obj* const objv[]);
#endif
diff --git a/src/bltGrHairsOp.C b/src/bltGrHairsOp.C
index f4a975a..9b0cffd 100644
--- a/src/bltGrHairsOp.C
+++ b/src/bltGrHairsOp.C
@@ -30,17 +30,13 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-extern "C" {
-#include "bltOp.h"
-}
-
#include "bltGraph.h"
#include "bltGrHairs.h"
#include "bltGrHairsOp.h"
using namespace Blt;
-static int CrosshairsObjConfigure(Tcl_Interp* interp, Graph* graphPtr,
+static int CrosshairsObjConfigure(Graph* graphPtr, Tcl_Interp* interp,
int objc, Tcl_Obj* const objv[])
{
Crosshairs* chPtr = graphPtr->crosshairs_;
@@ -117,7 +113,7 @@ static int ConfigureOp(ClientData clientData, Tcl_Interp* interp,
return TCL_OK;
}
else
- return CrosshairsObjConfigure(interp, graphPtr, objc-3, objv+3);
+ return CrosshairsObjConfigure(graphPtr, interp, objc-3, objv+3);
}
static int OnOp(ClientData clientData, Tcl_Interp* interp,
diff --git a/src/bltGrLegdOp.C b/src/bltGrLegdOp.C
index 8297577..6fc9876 100644
--- a/src/bltGrLegdOp.C
+++ b/src/bltGrLegdOp.C
@@ -33,7 +33,6 @@
#endif
extern "C" {
-#include "bltOp.h"
#include "bltBind.h"
};
@@ -46,7 +45,7 @@ using namespace Blt;
static Tk_LostSelProc LostSelectionProc;
-static int LegendObjConfigure(Tcl_Interp* interp, Graph* graphPtr,
+static int LegendObjConfigure(Graph* graphPtr, Tcl_Interp* interp,
int objc, Tcl_Obj* const objv[])
{
Legend* legendPtr = graphPtr->legend_;
@@ -126,7 +125,7 @@ static int ConfigureOp(ClientData clientData, Tcl_Interp* interp,
return TCL_OK;
}
else
- return LegendObjConfigure(interp, graphPtr, objc-3, objv+3);
+ return LegendObjConfigure(graphPtr, interp, objc-3, objv+3);
}
static int ActivateOp(ClientData clientData, Tcl_Interp* interp,
diff --git a/src/bltGrMarkerOp.C b/src/bltGrMarkerOp.C
index 4840259..eb694f1 100644
--- a/src/bltGrMarkerOp.C
+++ b/src/bltGrMarkerOp.C
@@ -29,7 +29,6 @@
extern "C" {
#include "bltInt.h"
-#include "bltOp.h"
#include "bltBind.h"
};
@@ -50,8 +49,8 @@ static int GetMarkerFromObj(Tcl_Interp* interp, Graph* graphPtr,
#define FIND_ENCLOSED (1<<0)
#define FIND_OVERLAPPING (1<<1)
-static int MarkerObjConfigure( Tcl_Interp* interp, Graph* graphPtr,
- Marker* markerPtr,
+static int MarkerObjConfigure( Graph* graphPtr,Marker* markerPtr,
+ Tcl_Interp* interp,
int objc, Tcl_Obj* const objv[])
{
Tk_SavedOptions savedOptions;
@@ -141,7 +140,7 @@ static int CreateMarker(Graph* graphPtr, Tcl_Interp* interp,
Tcl_SetHashValue(hPtr, markerPtr);
- if ((Tk_InitOptions(graphPtr->interp_, (char*)markerPtr->ops(), markerPtr->optionTable(), graphPtr->tkwin_) != TCL_OK) || (MarkerObjConfigure(interp, graphPtr, markerPtr, objc-offset, objv+offset) != TCL_OK)) {
+ if ((Tk_InitOptions(graphPtr->interp_, (char*)markerPtr->ops(), markerPtr->optionTable(), graphPtr->tkwin_) != TCL_OK) || (MarkerObjConfigure(graphPtr, markerPtr, interp, objc-offset, objv+offset) != TCL_OK)) {
delete markerPtr;
return TCL_ERROR;
}
@@ -198,7 +197,7 @@ static int ConfigureOp(ClientData clientData, Tcl_Interp* interp,
return TCL_OK;
}
else
- return MarkerObjConfigure(interp, graphPtr, markerPtr, objc-4, objv+4);
+ return MarkerObjConfigure(graphPtr, markerPtr, interp, objc-4, objv+4);
}
static int BindOp(ClientData clientData, Tcl_Interp* interp,
diff --git a/src/bltGrPenOp.C b/src/bltGrPenOp.C
index ad406d1..70cc736 100644
--- a/src/bltGrPenOp.C
+++ b/src/bltGrPenOp.C
@@ -27,10 +27,6 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-extern "C" {
-#include "bltOp.h"
-};
-
#include "bltGraph.h"
#include "bltGrPen.h"
#include "bltGrPenOp.h"
@@ -39,7 +35,8 @@ extern "C" {
using namespace Blt;
-int PenObjConfigure(Tcl_Interp* interp, Graph* graphPtr, Pen* penPtr,
+int PenObjConfigure(Graph* graphPtr, Pen* penPtr,
+ Tcl_Interp* interp,
int objc, Tcl_Obj* const objv[])
{
Tk_SavedOptions savedOptions;
@@ -127,7 +124,7 @@ static int ConfigureOp(ClientData clientData, Tcl_Interp* interp,
return TCL_OK;
}
else
- return PenObjConfigure(interp, graphPtr, penPtr, objc-4, objv+4);
+ return PenObjConfigure(graphPtr, penPtr, interp, objc-4, objv+4);
}
static int CreateOp(ClientData clientData, Tcl_Interp* interp,
diff --git a/src/bltGrPenOp.h b/src/bltGrPenOp.h
index a1d7357..f23291c 100644
--- a/src/bltGrPenOp.h
+++ b/src/bltGrPenOp.h
@@ -37,6 +37,7 @@
extern const TkEnsemble penEnsemble[];
-extern int PenObjConfigure(Tcl_Interp* interp, Graph* graphPtr, Pen* penPtr,
+extern int PenObjConfigure(Graph* graphPtr, Pen* penPtr,
+ Tcl_Interp* interp,
int objc, Tcl_Obj* const objv[]);
#endif
diff --git a/src/bltGrPostscriptOp.C b/src/bltGrPostscriptOp.C
index 9b2d979..9d1da56 100644
--- a/src/bltGrPostscriptOp.C
+++ b/src/bltGrPostscriptOp.C
@@ -27,10 +27,6 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-extern "C" {
-#include "bltOp.h"
-};
-
#include "bltGraph.h"
#include "bltGrPageSetup.h"
#include "bltGrPageSetupOp.h"
@@ -38,7 +34,7 @@ extern "C" {
using namespace Blt;
-int PageSetupObjConfigure(Tcl_Interp* interp, Graph* graphPtr,
+int PageSetupObjConfigure(Graph* graphPtr, Tcl_Interp* interp,
int objc, Tcl_Obj* const objv[])
{
PageSetup* setupPtr = graphPtr->pageSetup_;
@@ -113,7 +109,7 @@ static int ConfigureOp(ClientData clientData, Tcl_Interp* interp,
return TCL_OK;
}
else
- return PageSetupObjConfigure(interp, graphPtr, objc-3, objv+3);
+ return PageSetupObjConfigure(graphPtr, interp, objc-3, objv+3);
}
static int OutputOp(ClientData clientData, Tcl_Interp* interp,
@@ -139,7 +135,7 @@ static int OutputOp(ClientData clientData, Tcl_Interp* interp,
PostScript *psPtr = Blt_Ps_Create(graphPtr->interp_, graphPtr->pageSetup_);
- if (PageSetupObjConfigure(interp, graphPtr, objc-3, objv+3) != TCL_OK) {
+ if (PageSetupObjConfigure(graphPtr, interp, objc-3, objv+3) != TCL_OK) {
if (channel)
Tcl_Close(interp, channel);
Blt_Ps_Free(psPtr);
diff --git a/src/bltGrPostscriptOp.h b/src/bltGrPostscriptOp.h
index e5e0f30..4257138 100644
--- a/src/bltGrPostscriptOp.h
+++ b/src/bltGrPostscriptOp.h
@@ -37,7 +37,7 @@
extern const TkEnsemble pageSetupEnsemble[];
-extern int PageSetupObjConfigure(Tcl_Interp* interp, Graph* graphPtr,
+extern int PageSetupObjConfigure(Graph* graphPtr, Tcl_Interp* interp,
int objc, Tcl_Obj* const objv[]);
#endif
diff --git a/src/bltGrXAxisOp.C b/src/bltGrXAxisOp.C
index c752d2e..0a2090f 100644
--- a/src/bltGrXAxisOp.C
+++ b/src/bltGrXAxisOp.C
@@ -27,11 +27,6 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-extern "C" {
-#include "bltOp.h"
-#include "bltBind.h"
-};
-
#include "bltGraph.h"
#include "bltGrXAxisOp.h"
#include "bltGrAxis.h"
@@ -39,42 +34,83 @@ extern "C" {
using namespace Blt;
-extern int AxisCgetOp(Tcl_Interp* interp, Axis* axisPtr,
- int objc, Tcl_Obj* const objv[]);
-extern int AxisConfigureOp(Tcl_Interp* interp, Axis* axisPtr,
- int objc, Tcl_Obj* const objv[]);
-extern int AxisActivateOp(Tcl_Interp* interp, Axis* axisPtr,
- int objc, Tcl_Obj* const objv[]);
-extern int AxisInvTransformOp(Tcl_Interp* interp, Axis* axisPtr,
- int objc, Tcl_Obj* const objv[]);
-extern int AxisLimitsOp(Tcl_Interp* interp, Axis* axisPtr,
- int objc, Tcl_Obj* const objv[]);
-extern int AxisMarginOp(Tcl_Interp* interp, Axis* axisPtr,
- int objc, Tcl_Obj* const objv[]);
-extern int AxisTransformOp(Tcl_Interp* interp, Axis* axisPtr,
- int objc, Tcl_Obj* const objv[]);
-extern int AxisTypeOp(Tcl_Interp* interp, Axis* axisPtr,
- int objc, Tcl_Obj* const objv[]);
-extern int AxisViewOp(Tcl_Interp* interp, Axis* axisPtr,
- int objc, Tcl_Obj* const objv[]);
-
static int lastMargin;
+static Axis* GetAxisFromCmd(ClientData clientData, Tcl_Obj* obj)
+{
+ Graph* graphPtr = (Graph*)clientData;
+ GraphOptions* ops = (GraphOptions*)graphPtr->ops_;
+
+ int margin;
+ const char* name = Tcl_GetString(obj);
+ if (!strcmp(name,"xaxis"))
+ margin = (ops->inverted) ? MARGIN_LEFT : MARGIN_BOTTOM;
+ else if (!strcmp(name,"yaxis"))
+ margin = (ops->inverted) ? MARGIN_BOTTOM : MARGIN_LEFT;
+ else if (!strcmp(name,"x2axis"))
+ margin = (ops->inverted) ? MARGIN_RIGHT : MARGIN_TOP;
+ else if (!strcmp(name,"y2axis"))
+ margin = (ops->inverted) ? MARGIN_TOP : MARGIN_RIGHT;
+ else
+ return NULL;
-// Ops
+ return Blt_GetFirstAxis(ops->margins[margin].axes);
+}
-static int BindOp(Tcl_Interp* interp, Axis* axisPtr,
+static int CgetOp(ClientData clientData, Tcl_Interp* interp,
int objc, Tcl_Obj* const objv[])
{
- Graph* graphPtr = axisPtr->graphPtr_;
+ Axis* axisPtr = GetAxisFromCmd(clientData, objv[1]);
+ return AxisCgetOp(axisPtr, interp, objc, objv);
+}
+static int ConfigureOp(ClientData clientData, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
+{
+ Axis* axisPtr = GetAxisFromCmd(clientData, objv[1]);
+ return AxisConfigureOp(axisPtr, interp, objc, objv);
+}
+
+static int ActivateOp(ClientData clientData, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
+{
+ Axis* axisPtr = GetAxisFromCmd(clientData, objv[1]);
+ return AxisActivateOp(axisPtr, interp, objc, objv);
+}
+
+static int BindOp(ClientData clientData, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
+{
+ Graph* graphPtr = (Graph*)clientData;
+ Axis* axisPtr = GetAxisFromCmd(clientData, objv[1]);
return Blt_ConfigureBindingsFromObj(interp, graphPtr->bindTable_, graphPtr->axisTag(axisPtr->name_), objc-3, objv+3);
}
-
-static int UseOp(Tcl_Interp* interp, Axis* axisPtr,
+
+static int InvTransformOp(ClientData clientData, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
+{
+ Axis* axisPtr = GetAxisFromCmd(clientData, objv[1]);
+ return AxisInvTransformOp(axisPtr, interp, objc-1, objv+1);
+}
+
+static int LimitsOp(ClientData clientData, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
+{
+ Axis* axisPtr = GetAxisFromCmd(clientData, objv[1]);
+ return AxisLimitsOp(axisPtr, interp, objc-1, objv+1);
+}
+
+static int TransformOp(ClientData clientData, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
+{
+ Axis* axisPtr = GetAxisFromCmd(clientData, objv[1]);
+ return AxisTransformOp(axisPtr, interp, objc-1, objv+1);
+}
+
+static int UseOp(ClientData clientData, Tcl_Interp* interp,
int objc, Tcl_Obj* const objv[])
{
- Graph* graphPtr = (Graph *)axisPtr;
+ Graph* graphPtr = (Graph*)clientData;
GraphOptions* gops = (GraphOptions*)graphPtr->ops_;
Blt_Chain chain = gops->margins[lastMargin].axes;
@@ -149,32 +185,25 @@ static int UseOp(Tcl_Interp* interp, Axis* axisPtr,
return TCL_OK;
}
-static int CgetOp(ClientData clientData,Tcl_Interp* interp,
+static int ViewOp(ClientData clientData, Tcl_Interp* interp,
int objc, Tcl_Obj* const objv[])
{
- Graph* graphPtr = (Graph*)clientData;
- GraphOptions* gops = (GraphOptions*)graphPtr->ops_;
- int margin = (gops->inverted) ? MARGIN_LEFT : MARGIN_BOTTOM;
- Axis* axisPtr = Blt_GetFirstAxis(gops->margins[margin].axes);
-
- return AxisCgetOp(interp, axisPtr, objc, objv);
-}
-
-static int ConfigureOp(ClientData clientData, Tcl_Interp* interp,
- int objc, Tcl_Obj* const objv[])
-{
- Graph* graphPtr = (Graph*)clientData;
- GraphOptions* gops = (GraphOptions*)graphPtr->ops_;
- int margin = (gops->inverted) ? MARGIN_LEFT : MARGIN_BOTTOM;
- Axis* axisPtr = Blt_GetFirstAxis(gops->margins[margin].axes);
-
- return AxisConfigureOp(interp, axisPtr, objc, objv);
+ Axis* axisPtr = GetAxisFromCmd(clientData, objv[1]);
+ return AxisViewOp(axisPtr, interp, objc-1, objv+1);
}
const TkEnsemble xaxisEnsemble[] = {
- { "cget", CgetOp,0 },
- { "configure", ConfigureOp,0 },
- { 0,0,0 }
+ {"activate", ActivateOp, 0},
+ {"bind", BindOp, 0},
+ {"cget", CgetOp, 0},
+ {"configure", ConfigureOp, 0},
+ {"deactivate", ActivateOp, 0},
+ {"invtransform", InvTransformOp, 0},
+ {"limits", LimitsOp, 0},
+ {"transform", TransformOp, 0},
+ {"use", UseOp, 0},
+ {"view", ViewOp, 0},
+ { 0,0,0 }
};
/*
diff --git a/src/bltGraph.C b/src/bltGraph.C
index 4b2f4bb..c0d415b 100644
--- a/src/bltGraph.C
+++ b/src/bltGraph.C
@@ -969,7 +969,7 @@ int Graph::createAxis(int objc, Tcl_Obj* const objv[])
Tcl_SetHashValue(hPtr, axisPtr);
- if ((Tk_InitOptions(interp_, (char*)axisPtr->ops(), axisPtr->optionTable(), tkwin_) != TCL_OK) || (AxisObjConfigure(interp_, axisPtr, objc-4, objv+4) != TCL_OK)) {
+ if ((Tk_InitOptions(interp_, (char*)axisPtr->ops(), axisPtr->optionTable(), tkwin_) != TCL_OK) || (AxisObjConfigure(axisPtr, interp_, objc-4, objv+4) != TCL_OK)) {
delete axisPtr;
return TCL_ERROR;
}
diff --git a/src/bltGraphBar.C b/src/bltGraphBar.C
index 7b27cb6..db0343a 100644
--- a/src/bltGraphBar.C
+++ b/src/bltGraphBar.C
@@ -213,7 +213,7 @@ BarGraph::BarGraph(ClientData clientData, Tcl_Interp* interp,
return;
}
- if ((Tk_InitOptions(interp_, (char*)ops_, optionTable_, tkwin_) != TCL_OK) || (GraphObjConfigure(interp_, this, objc-2, objv+2) != TCL_OK)) {
+ if ((Tk_InitOptions(interp_, (char*)ops_, optionTable_, tkwin_) != TCL_OK) || (GraphObjConfigure(this, interp_, objc-2, objv+2) != TCL_OK)) {
valid_ =0;
return;
}
@@ -255,7 +255,7 @@ int BarGraph::createPen(const char* penName, int objc, Tcl_Obj* const objv[])
Tcl_SetHashValue(hPtr, penPtr);
- if ((Tk_InitOptions(interp_, (char*)penPtr->ops(), penPtr->optionTable(), tkwin_) != TCL_OK) || (PenObjConfigure(interp_, this, penPtr, objc-4, objv+4) != TCL_OK)) {
+ if ((Tk_InitOptions(interp_, (char*)penPtr->ops(), penPtr->optionTable(), tkwin_) != TCL_OK) || (PenObjConfigure(this, penPtr, interp_, objc-4, objv+4) != TCL_OK)) {
delete penPtr;
return TCL_ERROR;
}
@@ -291,7 +291,7 @@ int BarGraph::createElement(int objc, Tcl_Obj* const objv[])
Tcl_SetHashValue(hPtr, elemPtr);
- if ((Tk_InitOptions(interp_, (char*)elemPtr->ops(), elemPtr->optionTable(), tkwin_) != TCL_OK) || (ElementObjConfigure(interp_, elemPtr, objc-4, objv+4) != TCL_OK)) {
+ if ((Tk_InitOptions(interp_, (char*)elemPtr->ops(), elemPtr->optionTable(), tkwin_) != TCL_OK) || (ElementObjConfigure(elemPtr, interp_, objc-4, objv+4) != TCL_OK)) {
delete elemPtr;
return TCL_ERROR;
}
diff --git a/src/bltGraphLine.C b/src/bltGraphLine.C
index 3c2dcfa..23976a4 100644
--- a/src/bltGraphLine.C
+++ b/src/bltGraphLine.C
@@ -197,7 +197,7 @@ LineGraph::LineGraph(ClientData clientData, Tcl_Interp* interp,
Blt_Ts_InitStyle(ops->titleTextStyle);
ops->titleTextStyle.anchor = TK_ANCHOR_N;
- if ((Tk_InitOptions(interp_, (char*)ops_, optionTable_, tkwin_) != TCL_OK) || (GraphObjConfigure(interp_, this, objc-2, objv+2) != TCL_OK)) {
+ if ((Tk_InitOptions(interp_, (char*)ops_, optionTable_, tkwin_) != TCL_OK) || (GraphObjConfigure(this, interp_, objc-2, objv+2) != TCL_OK)) {
valid_ =0;
return;
}
@@ -228,7 +228,7 @@ int LineGraph::createPen(const char* penName, int objc, Tcl_Obj* const objv[])
Tcl_SetHashValue(hPtr, penPtr);
- if ((Tk_InitOptions(interp_, (char*)penPtr->ops(), penPtr->optionTable(), tkwin_) != TCL_OK) || (PenObjConfigure(interp_, this, penPtr, objc-4, objv+4) != TCL_OK)) {
+ if ((Tk_InitOptions(interp_, (char*)penPtr->ops(), penPtr->optionTable(), tkwin_) != TCL_OK) || (PenObjConfigure(this, penPtr, interp_, objc-4, objv+4) != TCL_OK)) {
delete penPtr;
return TCL_ERROR;
}
@@ -264,7 +264,7 @@ int LineGraph::createElement(int objc, Tcl_Obj* const objv[])
Tcl_SetHashValue(hPtr, elemPtr);
- if ((Tk_InitOptions(interp_, (char*)elemPtr->ops(), elemPtr->optionTable(), tkwin_) != TCL_OK) || (ElementObjConfigure(interp_, elemPtr, objc-4, objv+4) != TCL_OK)) {
+ if ((Tk_InitOptions(interp_, (char*)elemPtr->ops(), elemPtr->optionTable(), tkwin_) != TCL_OK) || (ElementObjConfigure(elemPtr, interp_, objc-4, objv+4) != TCL_OK)) {
delete elemPtr;
return TCL_ERROR;
}
diff --git a/src/bltGraphOp.C b/src/bltGraphOp.C
index 3be9ab7..9b590f6 100644
--- a/src/bltGraphOp.C
+++ b/src/bltGraphOp.C
@@ -27,10 +27,14 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#include <tk.h>
+#ifdef USE_TK_STUBS
+#include <tkInt.h>
+#endif
+
extern "C" {
#include "bltInt.h"
#include "bltList.h"
-#include "bltOp.h"
}
#include "bltGraphLine.h"
@@ -99,7 +103,7 @@ static int BarchartObjCmd(ClientData clientData, Tcl_Interp* interp, int objc,
return graphPtr->valid_ ? TCL_OK : TCL_ERROR;
}
-int GraphObjConfigure(Tcl_Interp* interp, Graph* graphPtr,
+int GraphObjConfigure(Graph* graphPtr, Tcl_Interp* interp,
int objc, Tcl_Obj* const objv[])
{
Tk_SavedOptions savedOptions;
@@ -173,55 +177,10 @@ static int ConfigureOp(ClientData clientData, Tcl_Interp* interp,
return TCL_OK;
}
else
- return GraphObjConfigure(interp, graphPtr, objc-2, objv+2);
+ return GraphObjConfigure(graphPtr, interp, objc-2, objv+2);
}
/*
-static int XAxisOp(ClientData clientData, Tcl_Interp* interp, int objc,
- Tcl_Obj* const objv[])
-{
- Graph* graphPtr = (Graph*)clientData;
- GraphOptions* ops = (GraphOptions*)graphPtr->ops_;
- int margin = (ops->inverted) ? MARGIN_LEFT : MARGIN_BOTTOM;
- return Blt_XAxisOp(interp, graphPtr, margin, objc, objv);
-}
-
-static int X2AxisOp(ClientData clientData, Tcl_Interp* interp, int objc,
- Tcl_Obj* const objv[])
-{
- Graph* graphPtr = (Graph*)clientData;
- GraphOptions* ops = (GraphOptions*)graphPtr->ops_;
- int margin = (ops->inverted) ? MARGIN_RIGHT : MARGIN_TOP;
- return Blt_XAxisOp(interp, graphPtr, margin, objc, objv);
-}
-
-static int YAxisOp(ClientData clientData, Tcl_Interp* interp, int objc,
- Tcl_Obj* const objv[])
-{
- Graph* graphPtr = (Graph*)clientData;
- GraphOptions* ops = (GraphOptions*)graphPtr->ops_;
- int margin = (ops->inverted) ? MARGIN_BOTTOM : MARGIN_LEFT;
- return Blt_XAxisOp(interp, graphPtr, margin, objc, objv);
-}
-
-static int Y2AxisOp(ClientData clientData, Tcl_Interp* interp, int objc,
- Tcl_Obj* const objv[])
-{
- Graph* graphPtr = (Graph*)clientData;
- GraphOptions* ops = (GraphOptions*)graphPtr->ops_;
- int margin = (ops->inverted) ? MARGIN_TOP : MARGIN_RIGHT;
- return Blt_XAxisOp(interp, graphPtr, margin, objc, objv);
-}
-
-static int ElementOp(ClientData clientData, Tcl_Interp* interp, int objc,
- Tcl_Obj* const objv[])
-{
- Graph* graphPtr = (Graph*)clientData;
- return Blt_ElementOp(graphPtr, interp, objc, objv);
-}
-*/
-
-/*
*---------------------------------------------------------------------------
*
* ExtentsOp --
@@ -418,11 +377,31 @@ static const TkEnsemble graphEnsemble[] = {
{ 0,0,0 }
};
+static int InvokeEnsemble(const TkEnsemble* ensemble, int cmdIndex,
+ void* clientData, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
+{
+ while (cmdIndex < objc) {
+ int index;
+ if (Tcl_GetIndexFromObjStruct(interp, objv[cmdIndex], ensemble, sizeof(ensemble[0]), "command", 0, &index) != TCL_OK)
+ return TCL_ERROR;
+
+ if (ensemble[index].proc)
+ return ensemble[index].proc(clientData, interp, objc, objv);
+
+ ensemble = ensemble[index].subensemble;
+ ++cmdIndex;
+ }
+
+ Tcl_WrongNumArgs(interp, cmdIndex, objv, "option ?arg ...?");
+ return TCL_ERROR;
+}
+
int GraphInstCmdProc(ClientData clientData, Tcl_Interp* interp,
int objc, Tcl_Obj* const objv[])
{
Tcl_Preserve(clientData);
- int result = BltInvokeEnsemble(graphEnsemble, 1, clientData, interp, objc, objv);
+ int result = InvokeEnsemble(graphEnsemble, 1, clientData, interp, objc, objv);
Tcl_Release(clientData);
return result;
}
diff --git a/src/bltGraphOp.h b/src/bltGraphOp.h
index 6fbfbdf..dea4787 100644
--- a/src/bltGraphOp.h
+++ b/src/bltGraphOp.h
@@ -32,11 +32,12 @@
#include <tk.h>
-extern int GraphObjConfigure(Tcl_Interp* interp, Graph* graphPtr,
+extern int GraphObjConfigure(Graph* graphPtr, Tcl_Interp* interp,
int objc, Tcl_Obj* const objv[]);
extern int GraphInstCmdProc(ClientData clientData, Tcl_Interp* interp,
- int objc, Tcl_Obj* const objv[]);
+ int objc, Tcl_Obj* const objv[]);
+
extern Tcl_CmdDeleteProc GraphInstCmdDeleteProc;
extern Tk_EventProc GraphEventProc;
extern Tcl_IdleProc DisplayGraph;
diff --git a/src/bltOp.C b/src/bltOp.C
index 0f56a0e..429e8f9 100644
--- a/src/bltOp.C
+++ b/src/bltOp.C
@@ -33,31 +33,6 @@ extern "C" {
#include "bltOp.h"
};
-#include <tk.h>
-#ifdef USE_TK_STUBS
-#include <tkInt.h>
-#endif
-
-int BltInvokeEnsemble(const TkEnsemble* ensemble, int cmdIndex,
- void* clientData, Tcl_Interp* interp,
- int objc, Tcl_Obj* const objv[])
-{
- while (cmdIndex < objc) {
- int index;
- if (Tcl_GetIndexFromObjStruct(interp, objv[cmdIndex], ensemble, sizeof(ensemble[0]), "command", 0, &index) != TCL_OK)
- return TCL_ERROR;
-
- if (ensemble[index].proc)
- return ensemble[index].proc(clientData, interp, objc, objv);
-
- ensemble = ensemble[index].subensemble;
- ++cmdIndex;
- }
-
- Tcl_WrongNumArgs(interp, cmdIndex, objv, "option ?arg ...?");
- return TCL_ERROR;
-}
-
static int BinaryOpSearch(Blt_OpSpec *specs, int nSpecs,
const char *string, int length)
{
diff --git a/src/bltOp.h b/src/bltOp.h
index 17169c2..2311714 100644
--- a/src/bltOp.h
+++ b/src/bltOp.h
@@ -56,15 +56,6 @@ typedef enum {
#define BLT_OP_BINARY_SEARCH 0
#define BLT_OP_LINEAR_SEARCH 1
-#include <tk.h>
-#ifdef USE_TK_STUBS
-#include <tkInt.h>
-#endif
-
-int BltInvokeEnsemble(const TkEnsemble* ensemble, int cmdIndex,
- void* clientData, Tcl_Interp* interp,
- int objc, Tcl_Obj* const objv[]);
-
void *Blt_GetOpFromObj(Tcl_Interp* interp, int nSpecs,
Blt_OpSpec *specs, int operPos, int objc,
Tcl_Obj* const objv[], int flags);