summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorjoye <joye>2014-05-29 19:04:44 (GMT)
committerjoye <joye>2014-05-29 19:04:44 (GMT)
commitcc905526f6b089b9b4936535510da782bebeea92 (patch)
tree9db10abb1db533378b7d6fdf70a7511d19610889 /src
parent5a540b87131f192071240d23845b12e5ea03b1a8 (diff)
downloadblt-cc905526f6b089b9b4936535510da782bebeea92.zip
blt-cc905526f6b089b9b4936535510da782bebeea92.tar.gz
blt-cc905526f6b089b9b4936535510da782bebeea92.tar.bz2
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r--src/bltGrBind.C42
-rw-r--r--src/bltGrBind.h4
-rw-r--r--src/bltGraph.C3
-rw-r--r--src/bltGraph.h2
4 files changed, 22 insertions, 29 deletions
diff --git a/src/bltGrBind.C b/src/bltGrBind.C
index eb8af54..8d77add 100644
--- a/src/bltGrBind.C
+++ b/src/bltGrBind.C
@@ -140,31 +140,29 @@ void BindTable::deleteBindings(ClientData object)
}
}
-#define REPICK_IN_PROGRESS (1<<0)
-#define LEFT_GRABBED_ITEM (1<<1)
-
-static void BltDoEvent(BindTable* bindPtr, XEvent* eventPtr,
- ClientData item, ClientData context)
+void BindTable::doEvent(XEvent* eventPtr, ClientData item, ClientData context)
{
- if (!bindPtr->tkwin || !bindPtr->bindingTable)
+ if (!tkwin || !bindingTable)
return;
if ((eventPtr->type == KeyPress) || (eventPtr->type == KeyRelease)) {
- item = bindPtr->focusItem;
- context = bindPtr->focusContext;
+ item = focusItem;
+ context = focusContext;
}
if (!item)
return;
int nTags;
- const char** tagArray = bindPtr->graphPtr_->getTags(item, context, &nTags);
- Tk_BindEvent(bindPtr->bindingTable, eventPtr, bindPtr->tkwin, nTags,
- (void**)tagArray);
-
+ ClassId classId = (ClassId)(long(context));
+ const char** tagArray = graphPtr_->getTags(item, classId, &nTags);
+ Tk_BindEvent(bindingTable, eventPtr, tkwin, nTags, (void**)tagArray);
if (tagArray)
delete [] tagArray;
}
+#define REPICK_IN_PROGRESS (1<<0)
+#define LEFT_GRABBED_ITEM (1<<1)
+
static void PickCurrentItem(BindTable* bindPtr, XEvent* eventPtr)
{
// Check whether or not a button is down. If so, we'll log entry and exit
@@ -247,7 +245,7 @@ static void PickCurrentItem(BindTable* bindPtr, XEvent* eventPtr)
event.xcrossing.detail = NotifyAncestor;
bindPtr->flags |= REPICK_IN_PROGRESS;
- BltDoEvent(bindPtr, &event, bindPtr->currentItem, bindPtr->currentContext);
+ bindPtr->doEvent(&event, bindPtr->currentItem, bindPtr->currentContext);
bindPtr->flags &= ~REPICK_IN_PROGRESS;
// Note: during DoEvent above, it's possible that bindPtr->newItem got
@@ -270,7 +268,7 @@ static void PickCurrentItem(BindTable* bindPtr, XEvent* eventPtr)
event.type = LeaveNotify;
event.xcrossing.detail = NotifyVirtual; // Ancestor
bindPtr->currentItem = bindPtr->newItem;
- BltDoEvent(bindPtr, &event, bindPtr->newItem, bindPtr->newContext);
+ bindPtr->doEvent(&event, bindPtr->newItem, bindPtr->newContext);
}
bindPtr->newItem = newItem;
@@ -279,7 +277,7 @@ static void PickCurrentItem(BindTable* bindPtr, XEvent* eventPtr)
event.type = EnterNotify;
event.xcrossing.detail = NotifyVirtual; // Ancestor
bindPtr->currentItem = newItem;
- BltDoEvent(bindPtr, &event, newItem, newContext);
+ bindPtr->doEvent(&event, newItem, newContext);
}
bindPtr->currentItem = savedItem;
@@ -297,7 +295,7 @@ static void PickCurrentItem(BindTable* bindPtr, XEvent* eventPtr)
XEvent event = bindPtr->pickEvent;
event.type = EnterNotify;
event.xcrossing.detail = NotifyAncestor;
- BltDoEvent(bindPtr, &event, newItem, newContext);
+ bindPtr->doEvent(&event, newItem, newContext);
}
done:
@@ -352,16 +350,14 @@ static void BindProc(ClientData clientData, XEvent* eventPtr)
bindPtr->state = eventPtr->xbutton.state;
PickCurrentItem(bindPtr, eventPtr);
bindPtr->state ^= mask;
- BltDoEvent(bindPtr, eventPtr, bindPtr->currentItem,
- bindPtr->currentContext);
+ bindPtr->doEvent(eventPtr, bindPtr->currentItem, bindPtr->currentContext);
}
else {
// Button release: first process the event, with the button still
// considered to be down. Then repick the current item under the
// assumption that the button is no longer down.
bindPtr->state = eventPtr->xbutton.state;
- BltDoEvent(bindPtr, eventPtr, bindPtr->currentItem,
- bindPtr->currentContext);
+ bindPtr->doEvent(eventPtr, bindPtr->currentItem, bindPtr->currentContext);
eventPtr->xbutton.state ^= mask;
bindPtr->state = eventPtr->xbutton.state;
PickCurrentItem(bindPtr, eventPtr);
@@ -379,16 +375,14 @@ static void BindProc(ClientData clientData, XEvent* eventPtr)
case MotionNotify:
bindPtr->state = eventPtr->xmotion.state;
PickCurrentItem(bindPtr, eventPtr);
- BltDoEvent(bindPtr, eventPtr, bindPtr->currentItem,
- bindPtr->currentContext);
+ bindPtr->doEvent(eventPtr, bindPtr->currentItem, bindPtr->currentContext);
break;
case KeyPress:
case KeyRelease:
bindPtr->state = eventPtr->xkey.state;
PickCurrentItem(bindPtr, eventPtr);
- BltDoEvent(bindPtr, eventPtr, bindPtr->currentItem,
- bindPtr->currentContext);
+ bindPtr->doEvent(eventPtr, bindPtr->currentItem, bindPtr->currentContext);
break;
}
diff --git a/src/bltGrBind.h b/src/bltGrBind.h
index 6496106..9a4f79e 100644
--- a/src/bltGrBind.h
+++ b/src/bltGrBind.h
@@ -58,9 +58,9 @@ class BindTable {
Blt_BindPickProc* pickProc);
virtual ~BindTable();
- int configure(Tcl_Interp* interp, ClientData item, int objc,
- Tcl_Obj *const *objv);
+ int configure(Tcl_Interp*, ClientData, int, Tcl_Obj *const []);
void deleteBindings(ClientData object);
+ void doEvent(XEvent*, ClientData, ClientData);
};
diff --git a/src/bltGraph.C b/src/bltGraph.C
index d438bb9..103346a 100644
--- a/src/bltGraph.C
+++ b/src/bltGraph.C
@@ -1261,9 +1261,8 @@ Axis* Graph::nearestAxis(int x, int y)
return NULL;
}
-const char** Graph::getTags(ClientData object, ClientData context, int* num)
+const char** Graph::getTags(ClientData object, ClassId classId, int* num)
{
- ClassId classId = (ClassId)(long(context));
const char** tags =NULL;
switch (classId) {
diff --git a/src/bltGraph.h b/src/bltGraph.h
index 667fc7a..45640c7 100644
--- a/src/bltGraph.h
+++ b/src/bltGraph.h
@@ -246,7 +246,7 @@ class Graph {
void getBoundingBox(int, int, float, double*, double*, Point2d*);
Point2d anchorPoint(double, double, double, double, Tk_Anchor);
- const char** getTags(ClientData item, ClientData context, int*);
+ const char** getTags(ClientData, ClassId, int*);
};
#endif