From: <md...@us...> - 2009-09-02 00:44:23
|
Revision: 7627 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7627&view=rev Author: mdehoon Date: 2009-09-02 00:44:16 +0000 (Wed, 02 Sep 2009) Log Message: ----------- Allowing mouse dragging with three-button mice. Modified Paths: -------------- trunk/matplotlib/src/_macosx.m Modified: trunk/matplotlib/src/_macosx.m =================================================================== --- trunk/matplotlib/src/_macosx.m 2009-09-01 14:44:50 UTC (rev 7626) +++ trunk/matplotlib/src/_macosx.m 2009-09-02 00:44:16 UTC (rev 7627) @@ -349,8 +349,10 @@ - (void)mouseMoved:(NSEvent*)event; - (void)rightMouseDown:(NSEvent*)event; - (void)rightMouseUp:(NSEvent*)event; +- (void)rightMouseDragged:(NSEvent*)event; - (void)otherMouseDown:(NSEvent*)event; - (void)otherMouseUp:(NSEvent*)event; +- (void)otherMouseDragged:(NSEvent*)event; - (void)setRubberband:(NSRect)rect; - (void)removeRubberband; - (const char*)convertKeyEvent:(NSEvent*)event; @@ -4744,6 +4746,23 @@ PyGILState_Release(gstate); } +- (void)rightMouseDragged:(NSEvent *)event +{ + int x, y; + NSPoint location = [event locationInWindow]; + location = [self convertPoint: location fromView: nil]; + x = location.x; + y = location.y; + PyGILState_STATE gstate = PyGILState_Ensure(); + PyObject* result = PyObject_CallMethod(canvas, "motion_notify_event", "ii", x, y); + if(result) + Py_DECREF(result); + else + PyErr_Print(); + + PyGILState_Release(gstate); +} + - (void)otherMouseDown:(NSEvent *)event { int x, y; @@ -4784,6 +4803,23 @@ PyGILState_Release(gstate); } +- (void)otherMouseDragged:(NSEvent *)event +{ + int x, y; + NSPoint location = [event locationInWindow]; + location = [self convertPoint: location fromView: nil]; + x = location.x; + y = location.y; + PyGILState_STATE gstate = PyGILState_Ensure(); + PyObject* result = PyObject_CallMethod(canvas, "motion_notify_event", "ii", x, y); + if(result) + Py_DECREF(result); + else + PyErr_Print(); + + PyGILState_Release(gstate); +} + - (void)setRubberband:(NSRect)rect { if (!NSIsEmptyRect(rubberband)) [self setNeedsDisplayInRect: rubberband]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |