[GRASS-SVN] r36372 - in grass/branches/develbranch_6/gui/wxpython: gui_modules vdigit

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Mar 14 07:44:49 EDT 2009


Author: martinl
Date: 2009-03-14 07:44:49 -0400 (Sat, 14 Mar 2009)
New Revision: 36372

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_window.py
   grass/branches/develbranch_6/gui/wxpython/vdigit/pseudodc.i
Log:
wxGUI: fix overlays for local copy of PseudoDC


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_window.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_window.py	2009-03-13 21:36:45 UTC (rev 36371)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_window.py	2009-03-14 11:44:49 UTC (rev 36372)
@@ -841,6 +841,9 @@
         dy = event.GetY() - y
         self.pdc.SetBackground(wx.Brush(self.GetBackgroundColour()))
         r = self.pdc.GetIdBounds(id)
+        ### FIXME in vdigit/pseudodc.i
+        if type(r) is list:
+            r = wx.Rect(r[0], r[1], r[2], r[3])
         if id > 100: # text dragging
             rtop = (r[0],r[1]-r[3],r[2],r[3])
             r = r.Union(rtop)
@@ -849,6 +852,8 @@
         self.pdc.TranslateId(id, dx, dy)
 
         r2 = self.pdc.GetIdBounds(id)
+        if type(r2) is list:
+            r2 = wx.Rect(r[0], r[1], r[2], r[3])
         if id > 100: # text
             self.textdict[id]['coords'] = r2
         r = r.Union(r2)
@@ -882,7 +887,8 @@
             mousecoords = [begin[0], begin[1],
                            end[0], end[1]]
             r = pdc.GetIdBounds(boxid)
-            r = wx.Rect(r[0], r[1], r[2], r[3])
+            if type(r) is list:
+                r = wx.Rect(r[0], r[1], r[2], r[3])
             r.Inflate(4, 4)
             pdc.ClearId(boxid)
             self.RefreshRect(r, False)

Modified: grass/branches/develbranch_6/gui/wxpython/vdigit/pseudodc.i
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/vdigit/pseudodc.i	2009-03-13 21:36:45 UTC (rev 36371)
+++ grass/branches/develbranch_6/gui/wxpython/vdigit/pseudodc.i	2009-03-14 11:44:49 UTC (rev 36372)
@@ -10,10 +10,41 @@
 
 %rename(PseudoDC) gwxPseudoDC;
 
+%typemap(in) wxString& (bool temp=false) {
+    $1 = wxString_in_helper($input);
+    if ($1 == NULL) SWIG_fail;
+    temp = true;
+}
+%typemap(freearg) wxString& {
+    if (temp$argnum)
+        delete $1;
+}
+
+%apply wxString& { wxString* };
+
+
+%typemap(in) wxRect& (wxRect temp) {
+    $1 = &temp;
+    if ( ! wxRect_helper($input, &$1)) SWIG_fail;
+}
+%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER) wxRect& {
+    $1 = wxPySimple_typecheck($input, wxT("wxRect"), 4);
+}
+
+%apply wxRect& { wxRect* };
+
 %typemap(out) wxRect {
-	$result = Py_BuildValue("iiii", $1.x, $1.y, $1.width, $1.height);
+    $result = Py_BuildValue("[iiii]", $1.x, $1.y, $1.width, $1.height);
 }
 
+%typemap(out) wxArrayInt& {
+    $result = wxArrayInt2PyList_helper(*$1);
+}
+
+%typemap(out) wxArrayInt {
+    $result = wxArrayInt2PyList_helper($1);
+}
+
 class gwxPseudoDC
 {
 public:
@@ -33,6 +64,8 @@
         void SetPen(const wxPen&);
 	void SetIdBounds(int, wxRect&);
 	void DrawLine(const wxPoint&, const wxPoint&);
+	void SetFont(const wxFont&);
+	void SetTextForeground(const wxColour&);
 	%extend {
 		void DrawToDC(void *dc) {
 			self->DrawToDC((wxDC *) dc);
@@ -55,5 +88,11 @@
 		void DrawRectangleRect(const wxRect& rect) {
 		        return self->DrawRectangle(rect);
                 }
+		void DrawText(const wxString& text, int x, int y) {
+		        return self->DrawText(text, (wxCoord) x, (wxCoord) y);
+		}
+		void DrawRotatedText(const wxString& text, int x, int y, double angle) {
+		        return self->DrawRotatedText(text, (wxCoord) x, (wxCoord) y, angle);
+		}
 	}
 };



More information about the grass-commit mailing list