From 457cab855a600784b092d47e795812329cf5fdd8 Mon Sep 17 00:00:00 2001 From: joye Date: Tue, 8 Apr 2014 22:19:45 +0000 Subject: *** empty log message *** --- src/bltGrAxis.C | 8 ++++---- src/bltGrLegd.C | 10 ---------- src/bltGrLegd.h | 4 ++-- src/bltGraph.C | 28 ++++++++++++++++++---------- 4 files changed, 24 insertions(+), 26 deletions(-) diff --git a/src/bltGrAxis.C b/src/bltGrAxis.C index 83ada85..9ac8062 100644 --- a/src/bltGrAxis.C +++ b/src/bltGrAxis.C @@ -3052,16 +3052,16 @@ void Blt_LayoutGraph(Graph* graphPtr) if (!Blt_Legend_IsHidden(graphPtr)) { switch (Blt_Legend_Site(graphPtr)) { case LEGEND_RIGHT: - right += Blt_Legend_Width(graphPtr) + 2; + right += graphPtr->legend->width() + 2; break; case LEGEND_LEFT: - left += Blt_Legend_Width(graphPtr) + 2; + left += graphPtr->legend->width() + 2; break; case LEGEND_TOP: - top += Blt_Legend_Height(graphPtr) + 2; + top += graphPtr->legend->height() + 2; break; case LEGEND_BOTTOM: - bottom += Blt_Legend_Height(graphPtr) + 2; + bottom += graphPtr->legend->height() + 2; break; case LEGEND_XY: case LEGEND_PLOT: diff --git a/src/bltGrLegd.C b/src/bltGrLegd.C index 7a5d76b..3e712bb 100644 --- a/src/bltGrLegd.C +++ b/src/bltGrLegd.C @@ -1138,16 +1138,6 @@ int Blt_Legend_Site(Graph* graphPtr) return graphPtr->legend->site_; } -int Blt_Legend_Width(Graph* graphPtr) -{ - return graphPtr->legend->width_; -} - -int Blt_Legend_Height(Graph* graphPtr) -{ - return graphPtr->legend->height_; -} - int Blt_Legend_IsHidden(Graph* graphPtr) { Legend* legendPtr = graphPtr->legend; diff --git a/src/bltGrLegd.h b/src/bltGrLegd.h index df3c976..461f10e 100644 --- a/src/bltGrLegd.h +++ b/src/bltGrLegd.h @@ -156,13 +156,13 @@ class Legend { void configure(); void map(int, int); void draw(Drawable drawable); + int width() {return width_;} + int height() {return height_;} }; 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_Width(Graph *graphPtr); -extern int Blt_Legend_Height(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 7e5ed20..ab73707 100644 --- a/src/bltGraph.C +++ b/src/bltGraph.C @@ -733,13 +733,15 @@ static int ExtentsOp(Graph* graphPtr, Tcl_Interp* interp, int objc, height = graphPtr->bottom - graphPtr->top + 1; Tcl_SetIntObj(Tcl_GetObjResult(interp), height); - } else if ((c == 'p') && (length > 4) && + } + else if ((c == 'p') && (length > 4) && (strncmp("plotwidth", string, length) == 0)) { int width; width = graphPtr->right - graphPtr->left + 1; Tcl_SetIntObj(Tcl_GetObjResult(interp), width); - } else if ((c == 'p') && (length > 4) && + } + else if ((c == 'p') && (length > 4) && (strncmp("plotarea", string, length) == 0)) { Tcl_Obj* listObjPtr; @@ -753,7 +755,8 @@ static int ExtentsOp(Graph* graphPtr, Tcl_Interp* interp, int objc, Tcl_ListObjAppendElement(interp, listObjPtr, Tcl_NewIntObj(graphPtr->bottom - graphPtr->top+1)); Tcl_SetObjResult(interp, listObjPtr); - } else if ((c == 'l') && (length > 2) && + } + else if ((c == 'l') && (length > 2) && (strncmp("legend", string, length) == 0)) { Tcl_Obj* listObjPtr; @@ -763,23 +766,28 @@ static int ExtentsOp(Graph* graphPtr, Tcl_Interp* interp, int objc, Tcl_ListObjAppendElement(interp, listObjPtr, Tcl_NewIntObj(Blt_Legend_Y(graphPtr))); Tcl_ListObjAppendElement(interp, listObjPtr, - Tcl_NewIntObj(Blt_Legend_Width(graphPtr))); + Tcl_NewIntObj(graphPtr->legend->width())); Tcl_ListObjAppendElement(interp, listObjPtr, - Tcl_NewIntObj(Blt_Legend_Height(graphPtr))); + Tcl_NewIntObj(graphPtr->legend->height())); Tcl_SetObjResult(interp, listObjPtr); - } else if ((c == 'l') && (length > 2) && + } + else if ((c == 'l') && (length > 2) && (strncmp("leftmargin", string, length) == 0)) { Tcl_SetIntObj(Tcl_GetObjResult(interp), graphPtr->leftMargin.width); - } else if ((c == 'r') && (length > 1) && + } + else if ((c == 'r') && (length > 1) && (strncmp("rightmargin", string, length) == 0)) { Tcl_SetIntObj(Tcl_GetObjResult(interp), graphPtr->rightMargin.width); - } else if ((c == 't') && (length > 1) && + } + else if ((c == 't') && (length > 1) && (strncmp("topmargin", string, length) == 0)) { Tcl_SetIntObj(Tcl_GetObjResult(interp), graphPtr->topMargin.height); - } else if ((c == 'b') && (length > 1) && + } + else if ((c == 'b') && (length > 1) && (strncmp("bottommargin", string, length) == 0)) { Tcl_SetIntObj(Tcl_GetObjResult(interp), graphPtr->bottomMargin.height); - } else { + } + else { Tcl_AppendResult(interp, "bad extent item \"", objv[2], "\": should be plotheight, plotwidth, leftmargin, rightmargin, \ topmargin, bottommargin, plotarea, or legend", (char*)NULL); -- cgit v0.12