summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorjoye <joye>2014-04-08 22:26:02 (GMT)
committerjoye <joye>2014-04-08 22:26:02 (GMT)
commit8fe1a962c2e3f8a0ca305af266a05b55c418afff (patch)
tree49bb3a70417717337b9c73a36c3260af39e65be1 /src
parent457cab855a600784b092d47e795812329cf5fdd8 (diff)
downloadblt-8fe1a962c2e3f8a0ca305af266a05b55c418afff.zip
blt-8fe1a962c2e3f8a0ca305af266a05b55c418afff.tar.gz
blt-8fe1a962c2e3f8a0ca305af266a05b55c418afff.tar.bz2
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r--src/bltGrAxis.C2
-rw-r--r--src/bltGrLegd.C5
-rw-r--r--src/bltGrLegd.h2
-rw-r--r--src/bltGraph.C42
4 files changed, 19 insertions, 32 deletions
diff --git a/src/bltGrAxis.C b/src/bltGrAxis.C
index 9ac8062..5157153 100644
--- a/src/bltGrAxis.C
+++ b/src/bltGrAxis.C
@@ -3050,7 +3050,7 @@ void Blt_LayoutGraph(Graph* graphPtr)
* Step 2: Add the legend to the appropiate margin.
*/
if (!Blt_Legend_IsHidden(graphPtr)) {
- switch (Blt_Legend_Site(graphPtr)) {
+ switch (graphPtr->legend->site()) {
case LEGEND_RIGHT:
right += graphPtr->legend->width() + 2;
break;
diff --git a/src/bltGrLegd.C b/src/bltGrLegd.C
index 3e712bb..d4d03db 100644
--- a/src/bltGrLegd.C
+++ b/src/bltGrLegd.C
@@ -1133,11 +1133,6 @@ int SelectRange(Legend* legendPtr, Element *fromPtr, Element *toPtr)
return TCL_OK;
}
-int Blt_Legend_Site(Graph* graphPtr)
-{
- return graphPtr->legend->site_;
-}
-
int Blt_Legend_IsHidden(Graph* graphPtr)
{
Legend* legendPtr = graphPtr->legend;
diff --git a/src/bltGrLegd.h b/src/bltGrLegd.h
index 461f10e..91237ca 100644
--- a/src/bltGrLegd.h
+++ b/src/bltGrLegd.h
@@ -158,11 +158,11 @@ class Legend {
void draw(Drawable drawable);
int width() {return width_;}
int height() {return height_;}
+ int site() {return site_;}
};
extern int Blt_LegendOp(Graph *graphPtr, Tcl_Interp* interp, int objc,
Tcl_Obj* const objv[]);
-extern int Blt_Legend_Site(Graph *graphPtr);
extern int Blt_Legend_IsHidden(Graph *graphPtr);
extern int Blt_Legend_IsRaised(Graph *graphPtr);
extern int Blt_Legend_X(Graph *graphPtr);
diff --git a/src/bltGraph.C b/src/bltGraph.C
index ab73707..2b270e5 100644
--- a/src/bltGraph.C
+++ b/src/bltGraph.C
@@ -616,8 +616,8 @@ static void DisplayGraph(ClientData clientData)
Blt::DrawMarkers(graphPtr, drawable, MARKER_ABOVE);
Blt_DrawActiveElements(graphPtr, drawable);
/* Don't draw legend in the plot area. */
- int site = Blt_Legend_Site(graphPtr);
- if ((site & LEGEND_PLOTAREA_MASK) && (Blt_Legend_IsRaised(graphPtr)))
+ if ((graphPtr->legend->site() & LEGEND_PLOTAREA_MASK) &&
+ (Blt_Legend_IsRaised(graphPtr)))
graphPtr->legend->draw(drawable);
/* Draw 3D border just inside of the focus highlight ring. */
@@ -729,23 +729,17 @@ static int ExtentsOp(Graph* graphPtr, Tcl_Interp* interp, int objc,
char c = string[0];
if ((c == 'p') && (length > 4) &&
(strncmp("plotheight", string, length) == 0)) {
- int height;
-
- height = graphPtr->bottom - graphPtr->top + 1;
+ int height = graphPtr->bottom - graphPtr->top + 1;
Tcl_SetIntObj(Tcl_GetObjResult(interp), height);
}
else if ((c == 'p') && (length > 4) &&
(strncmp("plotwidth", string, length) == 0)) {
- int width;
-
- width = graphPtr->right - graphPtr->left + 1;
+ int width = graphPtr->right - graphPtr->left + 1;
Tcl_SetIntObj(Tcl_GetObjResult(interp), width);
}
else if ((c == 'p') && (length > 4) &&
(strncmp("plotarea", string, length) == 0)) {
- Tcl_Obj* listObjPtr;
-
- listObjPtr = Tcl_NewListObj(0, (Tcl_Obj **)NULL);
+ Tcl_Obj* listObjPtr = Tcl_NewListObj(0, (Tcl_Obj **)NULL);
Tcl_ListObjAppendElement(interp, listObjPtr,
Tcl_NewIntObj(graphPtr->left));
Tcl_ListObjAppendElement(interp, listObjPtr,
@@ -758,9 +752,7 @@ static int ExtentsOp(Graph* graphPtr, Tcl_Interp* interp, int objc,
}
else if ((c == 'l') && (length > 2) &&
(strncmp("legend", string, length) == 0)) {
- Tcl_Obj* listObjPtr;
-
- listObjPtr = Tcl_NewListObj(0, (Tcl_Obj **)NULL);
+ Tcl_Obj* listObjPtr = Tcl_NewListObj(0, (Tcl_Obj **)NULL);
Tcl_ListObjAppendElement(interp, listObjPtr,
Tcl_NewIntObj(Blt_Legend_X(graphPtr)));
Tcl_ListObjAppendElement(interp, listObjPtr,
@@ -772,7 +764,7 @@ static int ExtentsOp(Graph* graphPtr, Tcl_Interp* interp, int objc,
Tcl_SetObjResult(interp, listObjPtr);
}
else if ((c == 'l') && (length > 2) &&
- (strncmp("leftmargin", string, length) == 0)) {
+ (strncmp("leftmargin", string, length) == 0)) {
Tcl_SetIntObj(Tcl_GetObjResult(interp), graphPtr->leftMargin.width);
}
else if ((c == 'r') && (length > 1) &&
@@ -803,13 +795,14 @@ topmargin, bottommargin, plotarea, or legend", (char*)NULL);
static int InsideOp(Graph* graphPtr, Tcl_Interp* interp, int objc,
Tcl_Obj* const objv[])
{
- int x, y;
- if (Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK) {
+ int x;
+ if (Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK)
return TCL_ERROR;
- }
- if (Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK) {
+
+ int y;
+ if (Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK)
return TCL_ERROR;
- }
+
Region2d exts;
Blt_GraphExtents(graphPtr, &exts);
int result = PointInRegion(&exts, x, y);
@@ -1170,8 +1163,7 @@ static void DrawMargins(Graph* graphPtr, Drawable drawable)
Tk_Draw3DRectangle(graphPtr->tkwin, drawable, graphPtr->normalBg,
x, y, w, h, graphPtr->plotBW, graphPtr->plotRelief);
}
- int site = Blt_Legend_Site(graphPtr);
- if (site & LEGEND_MARGIN_MASK)
+ if (graphPtr->legend->site() & LEGEND_MARGIN_MASK)
graphPtr->legend->draw(drawable);
if (graphPtr->title != NULL) {
@@ -1199,8 +1191,8 @@ static void DrawPlot(Graph* graphPtr, Drawable drawable)
Blt_DrawGrids(graphPtr, drawable);
Blt::DrawMarkers(graphPtr, drawable, MARKER_UNDER);
- int site = Blt_Legend_Site(graphPtr);
- if ((site & LEGEND_PLOTAREA_MASK) && (!Blt_Legend_IsRaised(graphPtr)))
+ if ((graphPtr->legend->site() & LEGEND_PLOTAREA_MASK) &&
+ (!Blt_Legend_IsRaised(graphPtr)))
graphPtr->legend->draw(drawable);
Blt_DrawAxisLimits(graphPtr, drawable);
@@ -1235,7 +1227,7 @@ void Blt_DrawGraph(Graph* graphPtr, Drawable drawable)
Blt_DrawActiveElements(graphPtr, drawable);
/* Don't draw legend in the plot area. */
- if ((Blt_Legend_Site(graphPtr) & LEGEND_PLOTAREA_MASK) &&
+ if ((graphPtr->legend->site() & LEGEND_PLOTAREA_MASK) &&
(Blt_Legend_IsRaised(graphPtr)))
graphPtr->legend->draw(drawable);