[Thuban-devel] Middle button pans
Russell Nelson
nelson at crynwr.com
Thu Dec 16 15:40:05 CET 2004
Frank Koormann writes:
> I like this feature also very much. However, it chrashes Thuban, if you
> click the middle mouse button over a view without a session loaded.
Hahahaha! Indeed it does. Patch against CVS HEAD, including
EVT_SCROLLWHEEL similar to yours. Could you try scrolling with the
mouse wheel? I'm not getting anything printed out.
Index: Thuban/UI/view.py
===================================================================
RCS file: /home/thuban/jail/thubanrepository/thuban/Thuban/UI/view.py,v
retrieving revision 1.63
diff -u -r1.63 view.py
--- Thuban/UI/view.py 13 Dec 2004 18:26:11 -0000 1.63
+++ Thuban/UI/view.py 16 Dec 2004 14:35:50 -0000
@@ -24,6 +24,8 @@
wxPaintDC, wxColour, wxClientDC, wxINVERT, wxTRANSPARENT_BRUSH, wxFont,\
EVT_PAINT, EVT_LEFT_DOWN, EVT_LEFT_UP, EVT_MOTION, EVT_LEAVE_WINDOW, \
wxPlatform, wxBeginBusyCursor, wxEndBusyCursor, wxFileDialog, wxSAVE, \
+ EVT_MIDDLE_DOWN, EVT_MIDDLE_UP, \
+ EVT_MOUSEWHEEL, \
wxOVERWRITE_PROMPT, wxID_OK
# Export related stuff
@@ -128,6 +130,9 @@
EVT_PAINT(self, self.OnPaint)
EVT_LEFT_DOWN(self, self.OnLeftDown)
EVT_LEFT_UP(self, self.OnLeftUp)
+ EVT_MIDDLE_DOWN(self, self.OnMiddleDown)
+ EVT_MIDDLE_UP(self, self.OnMiddleUp)
+ EVT_MOUSEWHEEL(self, self.OnMouseWheel)
EVT_MOTION(self, self.OnMotion)
EVT_LEAVE_WINDOW(self, self.OnLeaveWindow)
wx.EVT_SIZE(self, self.OnSize)
@@ -352,6 +357,20 @@
def GetPortSizeTuple(self):
return self.GetSizeTuple()
+
+ def OnMouseWheel(self, event):
+ print "wheeled", event
+
+ def OnMiddleDown(self, event):
+ self.remembertool = self.tool
+ if self.tool:
+ self.PanTool()
+ self.OnLeftDown(event)
+
+ def OnMiddleUp(self, event):
+ if self.remembertool:
+ self.OnLeftUp(event)
+ self.SelectTool(self.remembertool)
def OnLeftDown(self, event):
self.MouseLeftDown(event)
--
--My blog is at angry-economist.russnelson.com | Freedom means allowing
Crynwr sells support for free software | PGPok | people to do things the
521 Pleasant Valley Rd. | +1 315-323-1241 cell | majority thinks are
Potsdam, NY 13676-3213 | +1 212-202-2318 VOIP | stupid, e.g. take drugs.
More information about the Thuban-devel
mailing list
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)