summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorjoye <joye>2014-04-23 20:05:14 (GMT)
committerjoye <joye>2014-04-23 20:05:14 (GMT)
commit2bd1ae5bb594610acf9cb8536e522fe1d1d2a23a (patch)
treedf2214d6ad5b030f64310f1a8190288831c01a40 /src
parent6e381380d14d3ee0fbc4caecc53442f49cb5e101 (diff)
downloadblt-2bd1ae5bb594610acf9cb8536e522fe1d1d2a23a.zip
blt-2bd1ae5bb594610acf9cb8536e522fe1d1d2a23a.tar.gz
blt-2bd1ae5bb594610acf9cb8536e522fe1d1d2a23a.tar.bz2
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r--src/bltGrAxisOp.C9
-rw-r--r--src/bltGrAxisOp.h2
-rw-r--r--src/bltGrXAxisOp.C3
-rw-r--r--src/bltGraphOp.C27
4 files changed, 20 insertions, 21 deletions
diff --git a/src/bltGrAxisOp.C b/src/bltGrAxisOp.C
index 029fa6b..1b34f6f 100644
--- a/src/bltGrAxisOp.C
+++ b/src/bltGrAxisOp.C
@@ -411,15 +411,6 @@ int Blt_AxisOp(Graph* graphPtr, Tcl_Interp* interp,
// Support
-Axis *Blt_GetFirstAxis(Blt_Chain chain)
-{
- Blt_ChainLink link = Blt_Chain_FirstLink(chain);
- if (!link)
- return NULL;
-
- return (Axis*)Blt_Chain_GetValue(link);
-}
-
double AdjustViewport(double offset, double windowSize)
{
// Canvas-style scrolling allows the world to be scrolled within the window.
diff --git a/src/bltGrAxisOp.h b/src/bltGrAxisOp.h
index a558644..4d7affb 100644
--- a/src/bltGrAxisOp.h
+++ b/src/bltGrAxisOp.h
@@ -59,6 +59,4 @@ extern int AxisTypeOp(Axis* axisPtr, Tcl_Interp* interp,
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/bltGrXAxisOp.C b/src/bltGrXAxisOp.C
index 0a2090f..d9366d3 100644
--- a/src/bltGrXAxisOp.C
+++ b/src/bltGrXAxisOp.C
@@ -54,7 +54,8 @@ static Axis* GetAxisFromCmd(ClientData clientData, Tcl_Obj* obj)
else
return NULL;
- return Blt_GetFirstAxis(ops->margins[margin].axes);
+ Blt_ChainLink link = Blt_Chain_FirstLink(ops->margins[margin].axes);
+ return (Axis*)Blt_Chain_GetValue(link);
}
static int CgetOp(ClientData clientData, Tcl_Interp* interp,
diff --git a/src/bltGraphOp.C b/src/bltGraphOp.C
index 9b590f6..2cb93d4 100644
--- a/src/bltGraphOp.C
+++ b/src/bltGraphOp.C
@@ -61,6 +61,7 @@ using namespace Blt;
static Tcl_ObjCmdProc BarchartObjCmd;
static Tcl_ObjCmdProc GraphObjCmd;
+static Axis* GetFirstAxis(Blt_Chain chain);
#define ROUND(x) ((int)((x) + (((x)<0.0) ? -0.5 : 0.5)))
@@ -307,13 +308,11 @@ static int InvtransformOp(ClientData clientData, Tcl_Interp* interp, int objc,
if (graphPtr->flags & RESET_AXES)
graphPtr->resetAxes();
- /* Perform the reverse transformation, converting from window coordinates
- * to graph data coordinates. Note that the point is always mapped to the
- * bottom and left axes (which may not be what the user wants). */
-
- /* Pick the first pair of axes */
- Axis* xAxis = Blt_GetFirstAxis(graphPtr->axisChain_[0]);
- Axis* yAxis = Blt_GetFirstAxis(graphPtr->axisChain_[1]);
+ // Perform the reverse transformation, converting from window coordinates
+ // to graph data coordinates. Note that the point is always mapped to the
+ // bottom and left axes (which may not be what the user wants)
+ Axis* xAxis = GetFirstAxis(graphPtr->axisChain_[0]);
+ Axis* yAxis = GetFirstAxis(graphPtr->axisChain_[1]);
Point2d point = graphPtr->invMap2D(x, y, xAxis, yAxis);
Tcl_Obj* listObjPtr = Tcl_NewListObj(0, (Tcl_Obj **)NULL);
@@ -341,8 +340,8 @@ static int TransformOp(ClientData clientData, Tcl_Interp* interp, int objc,
* the points are always mapped onto the bottom and left axes (which may
* not be the what the user wants).
*/
- Axis* xAxis = Blt_GetFirstAxis(graphPtr->axisChain_[0]);
- Axis* yAxis = Blt_GetFirstAxis(graphPtr->axisChain_[1]);
+ Axis* xAxis = GetFirstAxis(graphPtr->axisChain_[0]);
+ Axis* yAxis = GetFirstAxis(graphPtr->axisChain_[1]);
Point2d point = graphPtr->map2D(x, y, xAxis, yAxis);
@@ -506,3 +505,13 @@ void DestroyGraph(char* dataPtr)
Graph* graphPtr = (Graph*)dataPtr;
delete graphPtr;
}
+
+static Axis* GetFirstAxis(Blt_Chain chain)
+{
+ Blt_ChainLink link = Blt_Chain_FirstLink(chain);
+ if (!link)
+ return NULL;
+
+ return (Axis*)Blt_Chain_GetValue(link);
+}
+