diff options
author | joye <joye> | 2014-05-29 18:56:43 (GMT) |
---|---|---|
committer | joye <joye> | 2014-05-29 18:56:43 (GMT) |
commit | 5a540b87131f192071240d23845b12e5ea03b1a8 (patch) | |
tree | fdcc40fd41a5f49165ed0b51833bb656646ccf2d /src | |
parent | b837f5354ce5d26c666434780df8e6cb52276090 (diff) | |
download | blt-5a540b87131f192071240d23845b12e5ea03b1a8.zip blt-5a540b87131f192071240d23845b12e5ea03b1a8.tar.gz blt-5a540b87131f192071240d23845b12e5ea03b1a8.tar.bz2 |
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r-- | src/bltGrAxis.C | 1 | ||||
-rw-r--r-- | src/bltGrBind.C | 16 | ||||
-rw-r--r-- | src/bltGrBind.h | 5 | ||||
-rw-r--r-- | src/bltGrElem.C | 1 | ||||
-rw-r--r-- | src/bltGrLegd.C | 4 | ||||
-rw-r--r-- | src/bltGrMarker.C | 1 | ||||
-rw-r--r-- | src/bltGrXAxisOp.C | 1 | ||||
-rw-r--r-- | src/bltGraph.C | 26 | ||||
-rw-r--r-- | src/bltGraph.h | 4 |
9 files changed, 31 insertions, 28 deletions
diff --git a/src/bltGrAxis.C b/src/bltGrAxis.C index a0b9574..108c4ce 100644 --- a/src/bltGrAxis.C +++ b/src/bltGrAxis.C @@ -33,6 +33,7 @@ #include <string.h> #include "bltGraph.h" +#include "bltGrBind.h" #include "bltGrAxis.h" #include "bltGrAxisOption.h" #include "bltGrMisc.h" diff --git a/src/bltGrBind.C b/src/bltGrBind.C index 362bfe9..eb8af54 100644 --- a/src/bltGrBind.C +++ b/src/bltGrBind.C @@ -35,13 +35,14 @@ using namespace std; #include "bltGrBind.h" +#include "bltGraph.h" static Tk_EventProc BindProc; -BindTable::BindTable(Tcl_Interp* interp, Tk_Window tkwinn, - ClientData clientDataa, +BindTable::BindTable(Graph* graphPtr, Tcl_Interp* interp, Tk_Window tkwinn, Blt_BindPickProc* pickProcc) { + graphPtr_ = graphPtr; flags =0; bindingTable = Tk_CreateBindingTable(interp); currentItem =NULL; @@ -52,7 +53,6 @@ BindTable::BindTable(Tcl_Interp* interp, Tk_Window tkwinn, focusContext =NULL; // pickEvent =NULL; state =0; - clientData = clientDataa; tkwin = tkwinn; pickProc = pickProcc; unsigned int mask = (KeyPressMask | KeyReleaseMask | ButtonPressMask | @@ -143,8 +143,6 @@ void BindTable::deleteBindings(ClientData object) #define REPICK_IN_PROGRESS (1<<0) #define LEFT_GRABBED_ITEM (1<<1) -const char** BltGraphTags(BindTable* table, ClientData object, ClientData context, int* num); - static void BltDoEvent(BindTable* bindPtr, XEvent* eventPtr, ClientData item, ClientData context) { @@ -159,7 +157,7 @@ static void BltDoEvent(BindTable* bindPtr, XEvent* eventPtr, return; int nTags; - const char** tagArray = BltGraphTags(bindPtr, item, context, &nTags); + const char** tagArray = bindPtr->graphPtr_->getTags(item, context, &nTags); Tk_BindEvent(bindPtr->bindingTable, eventPtr, bindPtr->tkwin, nTags, (void**)tagArray); @@ -225,7 +223,7 @@ static void PickCurrentItem(BindTable* bindPtr, XEvent* eventPtr) if (bindPtr->pickEvent.type != LeaveNotify) { int x = bindPtr->pickEvent.xcrossing.x; int y = bindPtr->pickEvent.xcrossing.y; - newItem = (*bindPtr->pickProc)(bindPtr->clientData, x, y, &newContext); + newItem = (*bindPtr->pickProc)(bindPtr->graphPtr_, x, y, &newContext); } // Nothing to do: the current item hasn't changed. @@ -315,7 +313,7 @@ static void BindProc(ClientData clientData, XEvent* eventPtr) BindTable* bindPtr = (BindTable*)clientData; - Tcl_Preserve(bindPtr->clientData); + Tcl_Preserve(bindPtr->graphPtr_); switch (eventPtr->type) { case ButtonPress: @@ -394,6 +392,6 @@ static void BindProc(ClientData clientData, XEvent* eventPtr) break; } - Tcl_Release(bindPtr->clientData); + Tcl_Release(bindPtr->graphPtr_); } diff --git a/src/bltGrBind.h b/src/bltGrBind.h index e1f83e5..6496106 100644 --- a/src/bltGrBind.h +++ b/src/bltGrBind.h @@ -33,11 +33,13 @@ #include <tk.h> class BindTable; +class Graph; typedef ClientData (Blt_BindPickProc)(ClientData clientData, int x, int y, ClientData *contextPtr); class BindTable { public: + Graph* graphPtr_; unsigned int flags; Tk_BindingTable bindingTable; ClientData currentItem; @@ -48,12 +50,11 @@ class BindTable { ClientData focusContext; XEvent pickEvent; int state; - ClientData clientData; Tk_Window tkwin; Blt_BindPickProc* pickProc; public: - BindTable(Tcl_Interp* interp, Tk_Window tkwin, ClientData clientData, + BindTable(Graph*, Tcl_Interp* interp, Tk_Window tkwin, Blt_BindPickProc* pickProc); virtual ~BindTable(); diff --git a/src/bltGrElem.C b/src/bltGrElem.C index 39cd5e2..43fdfac 100644 --- a/src/bltGrElem.C +++ b/src/bltGrElem.C @@ -31,6 +31,7 @@ #include <stdlib.h> #include "bltGraph.h" +#include "bltGrBind.h" #include "bltGrElem.h" #include "bltGrPen.h" diff --git a/src/bltGrLegd.C b/src/bltGrLegd.C index 5a73838..2cd3162 100644 --- a/src/bltGrLegd.C +++ b/src/bltGrLegd.C @@ -194,8 +194,8 @@ Legend::Legend(Graph* graphPtr) ops->titleStyle.angle =0; ops->titleStyle.justify =TK_JUSTIFY_LEFT; - bindTable_ = new BindTable(graphPtr->interp_, graphPtr->tkwin_, - graphPtr, LegendPickEntry); + bindTable_ = new BindTable(graphPtr, graphPtr->interp_, graphPtr->tkwin_, + LegendPickEntry); Tcl_InitHashTable(&selectTable_, TCL_ONE_WORD_KEYS); diff --git a/src/bltGrMarker.C b/src/bltGrMarker.C index c5b0620..1c82b3d 100644 --- a/src/bltGrMarker.C +++ b/src/bltGrMarker.C @@ -32,6 +32,7 @@ #include <float.h> #include "bltGraph.h" +#include "bltGrBind.h" #include "bltGrMarker.h" #include "bltGrAxis.h" #include "bltGrMisc.h" diff --git a/src/bltGrXAxisOp.C b/src/bltGrXAxisOp.C index 4e6cc2c..235c9b3 100644 --- a/src/bltGrXAxisOp.C +++ b/src/bltGrXAxisOp.C @@ -30,6 +30,7 @@ #include <string.h> #include "bltGraph.h" +#include "bltGrBind.h" #include "bltGrXAxisOp.h" #include "bltGrAxis.h" #include "bltGrAxisOp.h" diff --git a/src/bltGraph.C b/src/bltGraph.C index e5b1620..d438bb9 100644 --- a/src/bltGraph.C +++ b/src/bltGraph.C @@ -32,6 +32,7 @@ #include "bltGraph.h" #include "bltGraphOp.h" +#include "bltGrBind.h" #include "bltGrAxis.h" #include "bltGrAxisOp.h" #include "bltGrXAxisOp.h" @@ -119,7 +120,7 @@ Graph::Graph(ClientData clientData, Tcl_Interp* interp, axes_.displayList = Blt_Chain_Create(); elements_.displayList = Blt_Chain_Create(); markers_.displayList = Blt_Chain_Create(); - bindTable_ = new BindTable(interp_, tkwin_, this, GraphPickEntry); + bindTable_ = new BindTable(this, interp_, tkwin_, GraphPickEntry); if (createAxes() != TCL_OK) { valid_ =0; @@ -1260,12 +1261,9 @@ Axis* Graph::nearestAxis(int x, int y) return NULL; } -const char** BltGraphTags(BindTable* table, ClientData object, - ClientData context, int* num) +const char** Graph::getTags(ClientData object, ClientData context, int* num) { - Graph* graphPtr = (Graph*)table->clientData; ClassId classId = (ClassId)(long(context)); - const char** tags =NULL; switch (classId) { @@ -1280,11 +1278,11 @@ const char** BltGraphTags(BindTable* table, ClientData object, cnt +=2; tags = new const char*[cnt]; - tags[0] = (const char*)graphPtr->elementTag(ptr->name_); - tags[1] = (const char*)graphPtr->elementTag(ptr->className()); + tags[0] = (const char*)elementTag(ptr->name_); + tags[1] = (const char*)elementTag(ptr->className()); int ii=2; for (const char** pp = ops->tags; *pp; pp++, ii++) - tags[ii] = (const char*)graphPtr->elementTag(*pp); + tags[ii] = (const char*)elementTag(*pp); *num = cnt; return tags; @@ -1301,11 +1299,11 @@ const char** BltGraphTags(BindTable* table, ClientData object, cnt +=2; tags = new const char*[cnt]; - tags[0] = (const char*)graphPtr->axisTag(ptr->name_); - tags[1] = (const char*)graphPtr->axisTag(ptr->className()); + tags[0] = (const char*)axisTag(ptr->name_); + tags[1] = (const char*)axisTag(ptr->className()); int ii=2; for (const char** pp = ops->tags; *pp; pp++, ii++) - tags[ii] = (const char*)graphPtr->axisTag(*pp); + tags[ii] = (const char*)axisTag(*pp); *num = cnt; return tags; @@ -1324,11 +1322,11 @@ const char** BltGraphTags(BindTable* table, ClientData object, cnt +=2; tags = new const char*[cnt]; - tags[0] = (const char*)graphPtr->markerTag(ptr->name_); - tags[1] = (const char*)graphPtr->markerTag(ptr->className()); + tags[0] = (const char*)markerTag(ptr->name_); + tags[1] = (const char*)markerTag(ptr->className()); int ii=2; for (const char** pp = ops->tags; *pp; pp++, ii++) - tags[ii] = (const char*)graphPtr->markerTag(*pp); + tags[ii] = (const char*)markerTag(*pp); *num = cnt; return tags; diff --git a/src/bltGraph.h b/src/bltGraph.h index a79e0b1..667fc7a 100644 --- a/src/bltGraph.h +++ b/src/bltGraph.h @@ -36,13 +36,13 @@ extern "C" { #include "bltChain.h" }; -#include "bltGrBind.h" #include "bltGrMisc.h" #include "bltGrText.h" typedef struct _Blt_Ps *Blt_Ps; class Graph; +class BindTable; class Crosshairs; class Axis; class Element; @@ -245,6 +245,8 @@ class Graph { void getTextExtents(Tk_Font, const char*, int, int*, int*); void getBoundingBox(int, int, float, double*, double*, Point2d*); Point2d anchorPoint(double, double, double, double, Tk_Anchor); + + const char** getTags(ClientData item, ClientData context, int*); }; #endif |