Middle button pans

Russell Nelson nelson at crynwr.com
Tue Dec 14 17:30:40 CET 2004


This patch causes the middle button to pan.  Press middle, and the
tool switches to Pan from whatever it was.  Release middle, and the
tool switches back.  *Extremely useful*.

The next thing that I want is for the scroll wheel (button4 and button
5) to zoom in and out.

After that, I want the line/polygon underneath the cursor to be
automagically identified.

After that, I want a table click to cause an automatic re-pan and zoom
so the entire feature is visible.

I have Plans.


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	14 Dec 2004 16:04:00 -0000
@@ -24,6 +24,7 @@
      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, \
      wxOVERWRITE_PROMPT, wxID_OK
 
 # Export related stuff
@@ -128,6 +129,8 @@
         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_MOTION(self, self.OnMotion)
         EVT_LEAVE_WINDOW(self, self.OnLeaveWindow)
         wx.EVT_SIZE(self, self.OnSize)
@@ -352,6 +355,15 @@
 
     def GetPortSizeTuple(self):
         return self.GetSizeTuple()
+
+    def OnMiddleDown(self, event):
+        self.remembertool = self.tool
+        self.PanTool()
+        self.OnLeftDown(event)
+
+    def OnMiddleUp(self, event):
+        self.OnLeftUp(event)
+        self.SelectTool(self.remembertool)
 
     def OnLeftDown(self, event):
         self.MouseLeftDown(event)




More information about the Thuban-devel mailing list

This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)