[GRASS-SVN] r36373 - in grass/trunk/gui/wxpython: gui_modules vdigit
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Mar 14 07:47:33 EDT 2009
Author: martinl
Date: 2009-03-14 07:47:33 -0400 (Sat, 14 Mar 2009)
New Revision: 36373
Modified:
grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py
grass/trunk/gui/wxpython/vdigit/pseudodc.i
Log:
wxGUI: fix overlays for local copy of PseudoDC
(merge from devbr6, r36372)
Modified: grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py 2009-03-14 11:44:49 UTC (rev 36372)
+++ grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py 2009-03-14 11:47:33 UTC (rev 36373)
@@ -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/trunk/gui/wxpython/vdigit/pseudodc.i
===================================================================
--- grass/trunk/gui/wxpython/vdigit/pseudodc.i 2009-03-14 11:44:49 UTC (rev 36372)
+++ grass/trunk/gui/wxpython/vdigit/pseudodc.i 2009-03-14 11:47:33 UTC (rev 36373)
@@ -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