summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorjoye <joye>2014-04-09 18:06:49 (GMT)
committerjoye <joye>2014-04-09 18:06:49 (GMT)
commit4013a25fbbd042d11b8933e50c30c8db5491e8b0 (patch)
tree48ae1029ec2ded82d0a778e94f9088755891279e /src
parentdd2b1a1cdee24d6d0f61f1c6afa992b98b43c9f7 (diff)
downloadblt-4013a25fbbd042d11b8933e50c30c8db5491e8b0.zip
blt-4013a25fbbd042d11b8933e50c30c8db5491e8b0.tar.gz
blt-4013a25fbbd042d11b8933e50c30c8db5491e8b0.tar.bz2
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r--src/bltGrLegd.C356
-rw-r--r--src/bltGrLegd.h10
-rw-r--r--src/bltGrLegdOp.C22
3 files changed, 189 insertions, 199 deletions
diff --git a/src/bltGrLegd.C b/src/bltGrLegd.C
index 24d5aa1..8ad4ee2 100644
--- a/src/bltGrLegd.C
+++ b/src/bltGrLegd.C
@@ -869,120 +869,68 @@ int Legend::entryIsSelected(Element* elemPtr)
return (hPtr != NULL);
}
-// Tk Procs
-
-static void DisplayProc(ClientData clientData)
-{
- Legend* legendPtr = (Legend*)clientData;
-
- legendPtr->flags &= ~REDRAW_PENDING;
- if (Tk_IsMapped(legendPtr->graphPtr_->tkwin))
- legendPtr->draw(Tk_WindowId(legendPtr->graphPtr_->tkwin));
-}
-
-static int SelectionProc(ClientData clientData, int offset, char *buffer,
- int maxBytes)
+int Legend::getElementFromObj(Tcl_Obj* objPtr, Element** elemPtrPtr)
{
- Legend* legendPtr = (Legend*)clientData;
- Graph* graphPtr = legendPtr->graphPtr_;
- LegendOptions* ops = (LegendOptions*)legendPtr->ops_;
-
- if ((ops->exportSelection) == 0)
- return -1;
+ const char *string = Tcl_GetString(objPtr);
+ Element* elemPtr = NULL;
- // Retrieve the names of the selected entries
- Tcl_DString dString;
- Tcl_DStringInit(&dString);
- if (legendPtr->flags & SELECT_SORTED) {
- Blt_ChainLink link;
+ if (!strcmp(string, "anchor"))
+ elemPtr = selAnchorPtr_;
+ else if (!strcmp(string, "current"))
+ elemPtr = (Element*)Blt_GetCurrentItem(bindTable_);
+ else if (!strcmp(string, "first"))
+ elemPtr = getFirstElement();
+ else if (!strcmp(string, "focus"))
+ elemPtr = focusPtr_;
+ else if (!strcmp(string, "last"))
+ elemPtr = getLastElement();
+ else if (!strcmp(string, "end"))
+ elemPtr = getLastElement();
+ else if (!strcmp(string, "next.row"))
+ elemPtr = getNextRow(focusPtr_);
+ else if (!strcmp(string, "next.column"))
+ elemPtr = getNextColumn(focusPtr_);
+ else if (!strcmp(string, "previous.row"))
+ elemPtr = getPreviousRow(focusPtr_);
+ else if (!strcmp(string, "previous.column"))
+ elemPtr = getPreviousColumn(focusPtr_);
+ else if (!strcmp(string, "sel.first"))
+ elemPtr = selFirstPtr_;
+ else if (!strcmp(string, "sel.last"))
+ elemPtr = selLastPtr_;
+ else if (string[0] == '@') {
+ int x, y;
+ if (Blt_GetXY(graphPtr_->interp, graphPtr_->tkwin, string, &x, &y) !=TCL_OK)
+ return TCL_ERROR;
- for (link = Blt_Chain_FirstLink(legendPtr->selected_);
- link != NULL; link = Blt_Chain_NextLink(link)) {
- Element* elemPtr = (Element*)Blt_Chain_GetValue(link);
- Tcl_DStringAppend(&dString, elemPtr->name(), -1);
- Tcl_DStringAppend(&dString, "\n", -1);
- }
+ elemPtr = (Element*)PickEntryProc(graphPtr_, x, y, NULL);
}
else {
- for (Blt_ChainLink link = Blt_Chain_FirstLink(graphPtr->elements.displayList); link != NULL; link = Blt_Chain_NextLink(link)) {
- Element* elemPtr = (Element*)Blt_Chain_GetValue(link);
- if (legendPtr->entryIsSelected(elemPtr)) {
- Tcl_DStringAppend(&dString, elemPtr->name(), -1);
- Tcl_DStringAppend(&dString, "\n", -1);
- }
- }
- }
-
- int nBytes = Tcl_DStringLength(&dString) - offset;
- strncpy(buffer, Tcl_DStringValue(&dString) + offset, maxBytes);
- Tcl_DStringFree(&dString);
- buffer[maxBytes] = '\0';
- return MIN(nBytes, maxBytes);
-}
-
-static ClientData PickEntryProc(ClientData clientData, int x, int y,
- ClientData *contextPtr)
-{
- Graph* graphPtr = (Graph*)clientData;
- Legend* legendPtr = graphPtr->legend;
- LegendOptions* ops = (LegendOptions*)legendPtr->ops_;
-
- int w = legendPtr->width_;
- int h = legendPtr->height_;
-
- if (legendPtr->titleHeight_ > 0)
- y -= legendPtr->titleHeight_ + ops->yPad;
-
- x -= legendPtr->x_ + ops->borderWidth;
- y -= legendPtr->y_ + ops->borderWidth;
- w -= 2 * ops->borderWidth + 2*ops->xPad;
- h -= 2 * ops->borderWidth + 2*ops->yPad;
-
- if ((x >= 0) && (x < w) && (y >= 0) && (y < h)) {
- int row, column;
- int n;
-
- /*
- * It's in the bounding box, so compute the index.
- */
- row = y / legendPtr->entryHeight_;
- column = x / legendPtr->entryWidth_;
- n = (column * legendPtr->nRows_) + row;
- if (n < legendPtr->nEntries_) {
- Blt_ChainLink link;
- int count;
+ if (Blt_GetElement(graphPtr_->interp, graphPtr_, objPtr, &elemPtr) !=TCL_OK)
+ return TCL_ERROR;
- /* Legend entries are stored in bottom-to-top. */
- count = 0;
- for (link = Blt_Chain_FirstLink(graphPtr->elements.displayList);
- link != NULL; link = Blt_Chain_NextLink(link)) {
- Element* elemPtr = (Element*)Blt_Chain_GetValue(link);
- ElementOptions* elemOps = (ElementOptions*)elemPtr->ops();
- if (elemOps->label) {
- if (count == n)
- return elemPtr;
- count++;
- }
- }
- if (link)
- return Blt_Chain_GetValue(link);
+ if (elemPtr->link == NULL) {
+ Tcl_AppendResult(graphPtr_->interp, "bad legend index \"", string, "\"",
+ (char *)NULL);
+ return TCL_ERROR;
}
+ ElementOptions* elemOps = (ElementOptions*)elemPtr->ops();
+ if (elemOps->label == NULL)
+ elemPtr = NULL;
}
- return NULL;
-}
-// Support
+ *elemPtrPtr = elemPtr;
+ return TCL_OK;
+}
-static Element *GetNextRow(Graph* graphPtr, Element *focusPtr)
+Element* Legend::getNextRow(Element* focusPtr)
{
- Blt_ChainLink link;
- int row, col;
-
- col = focusPtr->col_;
- row = focusPtr->row_ + 1;
- for (link = focusPtr->link; link != NULL; link = Blt_Chain_NextLink(link)) {
+ int col = focusPtr->col_;
+ int row = focusPtr->row_ + 1;
+ for (Blt_ChainLink link=focusPtr->link; link; link=Blt_Chain_NextLink(link)) {
Element* elemPtr = (Element*)Blt_Chain_GetValue(link);
ElementOptions* elemOps = (ElementOptions*)elemPtr->ops();
+
if (elemOps->label == NULL)
continue;
@@ -992,16 +940,14 @@ static Element *GetNextRow(Graph* graphPtr, Element *focusPtr)
return NULL;
}
-static Element *GetNextColumn(Graph* graphPtr, Element *focusPtr)
+Element* Legend::getNextColumn(Element* focusPtr)
{
- Blt_ChainLink link;
- int row, col;
-
- col = focusPtr->col_ + 1;
- row = focusPtr->row_;
- for (link = focusPtr->link; link != NULL; link = Blt_Chain_NextLink(link)) {
+ int col = focusPtr->col_ + 1;
+ int row = focusPtr->row_;
+ for (Blt_ChainLink link=focusPtr->link; link; link=Blt_Chain_NextLink(link)) {
Element* elemPtr = (Element*)Blt_Chain_GetValue(link);
ElementOptions* elemOps = (ElementOptions*)elemPtr->ops();
+
if (elemOps->label == NULL)
continue;
@@ -1011,14 +957,14 @@ static Element *GetNextColumn(Graph* graphPtr, Element *focusPtr)
return NULL;
}
-static Element *GetPreviousRow(Graph* graphPtr, Element *focusPtr)
+Element* Legend::getPreviousRow(Element* focusPtr)
{
int col = focusPtr->col_;
int row = focusPtr->row_ - 1;
- for (Blt_ChainLink link = focusPtr->link; link != NULL;
- link = Blt_Chain_PrevLink(link)) {
+ for (Blt_ChainLink link=focusPtr->link; link; link=Blt_Chain_PrevLink(link)) {
Element* elemPtr = (Element*)Blt_Chain_GetValue(link);
ElementOptions* elemOps = (ElementOptions*)elemPtr->ops();
+
if (elemOps->label == NULL)
continue;
@@ -1028,14 +974,14 @@ static Element *GetPreviousRow(Graph* graphPtr, Element *focusPtr)
return NULL;
}
-static Element *GetPreviousColumn(Graph* graphPtr, Element *focusPtr)
+Element* Legend::getPreviousColumn(Element* focusPtr)
{
int col = focusPtr->col_ - 1;
int row = focusPtr->row_;
- for (Blt_ChainLink link = focusPtr->link; link != NULL;
- link = Blt_Chain_PrevLink(link)) {
+ for (Blt_ChainLink link=focusPtr->link; link; link=Blt_Chain_PrevLink(link)) {
Element* elemPtr = (Element*)Blt_Chain_GetValue(link);
ElementOptions* elemOps = (ElementOptions*)elemPtr->ops();
+
if (elemOps->label == NULL)
continue;
@@ -1045,9 +991,9 @@ static Element *GetPreviousColumn(Graph* graphPtr, Element *focusPtr)
return NULL;
}
-static Element *GetFirstElement(Graph* graphPtr)
+Element* Legend::getFirstElement()
{
- for (Blt_ChainLink link = Blt_Chain_FirstLink(graphPtr->elements.displayList);link != NULL; link = Blt_Chain_NextLink(link)) {
+ for (Blt_ChainLink link=Blt_Chain_FirstLink(graphPtr_->elements.displayList);link; link=Blt_Chain_NextLink(link)) {
Element* elemPtr = (Element*)Blt_Chain_GetValue(link);
ElementOptions* elemOps = (ElementOptions*)elemPtr->ops();
if (elemOps->label)
@@ -1056,10 +1002,10 @@ static Element *GetFirstElement(Graph* graphPtr)
return NULL;
}
-static Element *GetLastElement(Graph* graphPtr)
+Element* Legend::getLastElement()
{
- for (Blt_ChainLink link = Blt_Chain_LastLink(graphPtr->elements.displayList);
- link != NULL; link = Blt_Chain_PrevLink(link)) {
+ for (Blt_ChainLink link=Blt_Chain_LastLink(graphPtr_->elements.displayList);
+ link; link=Blt_Chain_PrevLink(link)) {
Element* elemPtr = (Element*)Blt_Chain_GetValue(link);
ElementOptions* elemOps = (ElementOptions*)elemPtr->ops();
if (elemOps->label)
@@ -1068,86 +1014,126 @@ static Element *GetLastElement(Graph* graphPtr)
return NULL;
}
-int GetElementFromObj(Graph* graphPtr, Tcl_Obj *objPtr, Element **elemPtrPtr)
+int Legend::selectRange(Element *fromPtr, Element *toPtr)
{
- Legend* legendPtr = graphPtr->legend;
- Tcl_Interp* interp = graphPtr->interp;
- const char *string = Tcl_GetString(objPtr);
- char c = string[0];
- Element* elemPtr = NULL;
-
- // int last = Blt_Chain_GetLength(graphPtr->elements.displayList) - 1;
- if ((c == 'a') && (strcmp(string, "anchor") == 0))
- elemPtr = legendPtr->selAnchorPtr_;
- else if ((c == 'c') && (strcmp(string, "current") == 0))
- elemPtr = (Element *)Blt_GetCurrentItem(legendPtr->bindTable_);
- else if ((c == 'f') && (strcmp(string, "first") == 0))
- elemPtr = GetFirstElement(graphPtr);
- else if ((c == 'f') && (strcmp(string, "focus") == 0))
- elemPtr = legendPtr->focusPtr_;
- else if ((c == 'l') && (strcmp(string, "last") == 0))
- elemPtr = GetLastElement(graphPtr);
- else if ((c == 'e') && (strcmp(string, "end") == 0))
- elemPtr = GetLastElement(graphPtr);
- else if ((c == 'n') && (strcmp(string, "next.row") == 0))
- elemPtr = GetNextRow(graphPtr, legendPtr->focusPtr_);
- else if ((c == 'n') && (strcmp(string, "next.column") == 0))
- elemPtr = GetNextColumn(graphPtr, legendPtr->focusPtr_);
- else if ((c == 'p') && (strcmp(string, "previous.row") == 0))
- elemPtr = GetPreviousRow(graphPtr, legendPtr->focusPtr_);
- else if ((c == 'p') && (strcmp(string, "previous.column") == 0))
- elemPtr = GetPreviousColumn(graphPtr, legendPtr->focusPtr_);
- else if ((c == 's') && (strcmp(string, "sel.first") == 0))
- elemPtr = legendPtr->selFirstPtr_;
- else if ((c == 's') && (strcmp(string, "sel.last") == 0))
- elemPtr = legendPtr->selLastPtr_;
- else if (c == '@') {
- int x, y;
-
- if (Blt_GetXY(interp, graphPtr->tkwin, string, &x, &y) != TCL_OK)
- return TCL_ERROR;
-
- elemPtr = (Element *)PickEntryProc(graphPtr, x, y, NULL);
- }
+ if (Blt_Chain_IsBefore(fromPtr->link, toPtr->link)) {
+ for (Blt_ChainLink link=fromPtr->link; link;
+ link=Blt_Chain_NextLink(link)) {
+ Element* elemPtr = (Element*)Blt_Chain_GetValue(link);
+ selectEntry(elemPtr);
+ if (link == toPtr->link)
+ break;
+ }
+ }
else {
- if (Blt_GetElement(interp, graphPtr, objPtr, &elemPtr) != TCL_OK)
- return TCL_ERROR;
-
- if (elemPtr->link == NULL) {
- Tcl_AppendResult(interp, "bad legend index \"", string, "\"",
- (char *)NULL);
- return TCL_ERROR;
+ for (Blt_ChainLink link=fromPtr->link; link;
+ link=Blt_Chain_PrevLink(link)) {
+ Element* elemPtr = (Element*)Blt_Chain_GetValue(link);
+ selectEntry(elemPtr);
+ if (link == toPtr->link)
+ break;
}
- ElementOptions* elemOps = (ElementOptions*)elemPtr->ops();
- if (elemOps->label == NULL)
- elemPtr = NULL;
}
- *elemPtrPtr = elemPtr;
+
return TCL_OK;
}
-int SelectRange(Legend* legendPtr, Element *fromPtr, Element *toPtr)
+// Support
+
+static void DisplayProc(ClientData clientData)
{
- if (Blt_Chain_IsBefore(fromPtr->link, toPtr->link)) {
- for (Blt_ChainLink link = fromPtr->link; link != NULL;
- link = Blt_Chain_NextLink(link)) {
+ Legend* legendPtr = (Legend*)clientData;
+
+ legendPtr->flags &= ~REDRAW_PENDING;
+ if (Tk_IsMapped(legendPtr->graphPtr_->tkwin))
+ legendPtr->draw(Tk_WindowId(legendPtr->graphPtr_->tkwin));
+}
+
+static int SelectionProc(ClientData clientData, int offset, char *buffer,
+ int maxBytes)
+{
+ Legend* legendPtr = (Legend*)clientData;
+ Graph* graphPtr = legendPtr->graphPtr_;
+ LegendOptions* ops = (LegendOptions*)legendPtr->ops_;
+
+ if ((ops->exportSelection) == 0)
+ return -1;
+
+ // Retrieve the names of the selected entries
+ Tcl_DString dString;
+ Tcl_DStringInit(&dString);
+ if (legendPtr->flags & SELECT_SORTED) {
+ Blt_ChainLink link;
+
+ for (link = Blt_Chain_FirstLink(legendPtr->selected_);
+ link != NULL; link = Blt_Chain_NextLink(link)) {
Element* elemPtr = (Element*)Blt_Chain_GetValue(link);
- legendPtr->selectEntry(elemPtr);
- if (link == toPtr->link) {
- break;
- }
+ Tcl_DStringAppend(&dString, elemPtr->name(), -1);
+ Tcl_DStringAppend(&dString, "\n", -1);
}
- }
+ }
else {
- for (Blt_ChainLink link = fromPtr->link; link != NULL;
- link = Blt_Chain_PrevLink(link)) {
+ for (Blt_ChainLink link = Blt_Chain_FirstLink(graphPtr->elements.displayList); link != NULL; link = Blt_Chain_NextLink(link)) {
Element* elemPtr = (Element*)Blt_Chain_GetValue(link);
- legendPtr->selectEntry(elemPtr);
- if (link == toPtr->link) {
- break;
+ if (legendPtr->entryIsSelected(elemPtr)) {
+ Tcl_DStringAppend(&dString, elemPtr->name(), -1);
+ Tcl_DStringAppend(&dString, "\n", -1);
}
}
}
- return TCL_OK;
+
+ int nBytes = Tcl_DStringLength(&dString) - offset;
+ strncpy(buffer, Tcl_DStringValue(&dString) + offset, maxBytes);
+ Tcl_DStringFree(&dString);
+ buffer[maxBytes] = '\0';
+ return MIN(nBytes, maxBytes);
+}
+
+static ClientData PickEntryProc(ClientData clientData, int x, int y,
+ ClientData *contextPtr)
+{
+ Graph* graphPtr = (Graph*)clientData;
+ Legend* legendPtr = graphPtr->legend;
+ LegendOptions* ops = (LegendOptions*)legendPtr->ops_;
+
+ int w = legendPtr->width_;
+ int h = legendPtr->height_;
+
+ if (legendPtr->titleHeight_ > 0)
+ y -= legendPtr->titleHeight_ + ops->yPad;
+
+ x -= legendPtr->x_ + ops->borderWidth;
+ y -= legendPtr->y_ + ops->borderWidth;
+ w -= 2 * ops->borderWidth + 2*ops->xPad;
+ h -= 2 * ops->borderWidth + 2*ops->yPad;
+
+ if ((x >= 0) && (x < w) && (y >= 0) && (y < h)) {
+
+ // It's in the bounding box, so compute the index.
+ int row = y / legendPtr->entryHeight_;
+ int column = x / legendPtr->entryWidth_;
+ int n = (column * legendPtr->nRows_) + row;
+
+ if (n < legendPtr->nEntries_) {
+ // Legend entries are stored in bottom-to-top
+ int count = 0;
+ Blt_ChainLink link;
+ for (link = Blt_Chain_FirstLink(graphPtr->elements.displayList); link != NULL; link = Blt_Chain_NextLink(link)) {
+ Element* elemPtr = (Element*)Blt_Chain_GetValue(link);
+ ElementOptions* elemOps = (ElementOptions*)elemPtr->ops();
+ if (elemOps->label) {
+ if (count == n)
+ return elemPtr;
+ count++;
+ }
+ }
+ if (link)
+ return Blt_Chain_GetValue(link);
+ }
+ }
+
+ return NULL;
}
+
+
diff --git a/src/bltGrLegd.h b/src/bltGrLegd.h
index cdcc20b..11f9d0f 100644
--- a/src/bltGrLegd.h
+++ b/src/bltGrLegd.h
@@ -151,6 +151,12 @@ class Legend {
protected:
void setOrigin();
+ Element* getNextRow(Element*);
+ Element* getNextColumn(Element*);
+ Element* getPreviousRow(Element*);
+ Element* getPreviousColumn(Element*);
+ Element* getFirstElement();
+ Element* getLastElement();
public:
Legend(Graph*);
@@ -160,9 +166,10 @@ class Legend {
void map(int, int);
void draw(Drawable drawable);
void print(Blt_Ps ps);
+ void eventuallyRedraw();
void removeElement(Element*);
- void eventuallyRedraw();
+ int getElementFromObj(Tcl_Obj*, Element**);
int width() {return width_;}
int height() {return height_;}
@@ -171,6 +178,7 @@ class Legend {
int y() {return y_;}
void selectEntry(Element*);
+ int selectRange(Element*, Element*);
void selectElement(Element*);
void deselectElement(Element*);
int entryIsSelected(Element*);
diff --git a/src/bltGrLegdOp.C b/src/bltGrLegdOp.C
index 54b01ed..8a6d97e 100644
--- a/src/bltGrLegdOp.C
+++ b/src/bltGrLegdOp.C
@@ -35,10 +35,6 @@ extern "C" {
#include "bltGrLegd.h"
#include "bltGrElem.h"
-extern int GetElementFromObj(Graph* graphPtr, Tcl_Obj *objPtr,
- Element **elemPtrPtr);
-extern int SelectRange(Legend* legendPtr, Element *fromPtr, Element *toPtr);
-
static void SelectCmdProc(ClientData clientData);
static void EventuallyInvokeSelectCmd(Legend* legendPtr);
static int SelectionOp(Graph* graphPtr, Tcl_Interp* interp,
@@ -270,7 +266,7 @@ static int FocusOp(Graph* graphPtr, Tcl_Interp* interp,
if (objc == 4) {
Element* elemPtr;
- if (GetElementFromObj(graphPtr, objv[3], &elemPtr) != TCL_OK)
+ if (legendPtr->getElementFromObj(objv[3], &elemPtr) != TCL_OK)
return TCL_ERROR;
if ((elemPtr != NULL) && (elemPtr != legendPtr->focusPtr_)) {
@@ -298,7 +294,7 @@ static int GetOp(Graph* graphPtr, Tcl_Interp* interp,
if (((ops->hide) == 0) && (legendPtr->nEntries_ > 0)) {
Element* elemPtr;
- if (GetElementFromObj(graphPtr, objv[3], &elemPtr) != TCL_OK)
+ if (legendPtr->getElementFromObj(objv[3], &elemPtr) != TCL_OK)
return TCL_ERROR;
if (elemPtr)
@@ -339,7 +335,7 @@ static int SelectionAnchorOp(Graph* graphPtr, Tcl_Interp* interp,
Legend* legendPtr = graphPtr->legend;
Element* elemPtr;
- if (GetElementFromObj(graphPtr, objv[4], &elemPtr) != TCL_OK)
+ if (legendPtr->getElementFromObj(objv[4], &elemPtr) != TCL_OK)
return TCL_ERROR;
// Set both the anchor and the mark. Indicates that a single entry
@@ -368,7 +364,7 @@ static int SelectionIncludesOp(Graph* graphPtr, Tcl_Interp* interp,
{
Legend* legendPtr = graphPtr->legend;
Element* elemPtr;
- if (GetElementFromObj(graphPtr, objv[4], &elemPtr) != TCL_OK)
+ if (legendPtr->getElementFromObj(objv[4], &elemPtr) != TCL_OK)
return TCL_ERROR;
int boo = legendPtr->entryIsSelected(elemPtr);
@@ -383,7 +379,7 @@ static int SelectionMarkOp(Graph* graphPtr, Tcl_Interp* interp,
LegendOptions* ops = (LegendOptions*)legendPtr->ops_;
Element* elemPtr;
- if (GetElementFromObj(graphPtr, objv[4], &elemPtr) != TCL_OK)
+ if (legendPtr->getElementFromObj(objv[4], &elemPtr) != TCL_OK)
return TCL_ERROR;
if (legendPtr->selAnchorPtr_ == NULL) {
@@ -406,7 +402,7 @@ static int SelectionMarkOp(Graph* graphPtr, Tcl_Interp* interp,
legendPtr->flags &= ~SELECT_TOGGLE;
legendPtr->flags |= SELECT_SET;
- SelectRange(legendPtr, legendPtr->selAnchorPtr_, elemPtr);
+ legendPtr->selectRange(legendPtr->selAnchorPtr_, elemPtr);
Tcl_SetStringObj(Tcl_GetObjResult(interp), elemPtr->name(), -1);
legendPtr->selMarkPtr_ = elemPtr;
@@ -448,7 +444,7 @@ static int SelectionSetOp(Graph* graphPtr, Tcl_Interp* interp,
}
Element *firstPtr;
- if (GetElementFromObj(graphPtr, objv[4], &firstPtr) != TCL_OK)
+ if (legendPtr->getElementFromObj(objv[4], &firstPtr) != TCL_OK)
return TCL_ERROR;
if ((firstPtr->hide()) && ((legendPtr->flags & SELECT_CLEAR)==0)) {
@@ -459,7 +455,7 @@ static int SelectionSetOp(Graph* graphPtr, Tcl_Interp* interp,
Element* lastPtr = firstPtr;
if (objc > 5) {
- if (GetElementFromObj(graphPtr, objv[5], &lastPtr) != TCL_OK)
+ if (legendPtr->getElementFromObj(objv[5], &lastPtr) != TCL_OK)
return TCL_ERROR;
if (lastPtr->hide() && ((legendPtr->flags & SELECT_CLEAR) == 0)) {
@@ -472,7 +468,7 @@ static int SelectionSetOp(Graph* graphPtr, Tcl_Interp* interp,
if (firstPtr == lastPtr)
legendPtr->selectEntry(firstPtr);
else
- SelectRange(legendPtr, firstPtr, lastPtr);
+ legendPtr->selectRange(firstPtr, lastPtr);
// Set both the anchor and the mark. Indicates that a single entry is
// selected