]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/wx/lib/editor/editor.py
Show status of wxMac CoreGraphics build option
[wxWidgets.git] / wxPython / wx / lib / editor / editor.py
index b3f4f1b155dc56b2d39afca0ac686ebe9d02058c..943e42dd27a06185f8e449ac343c9c8d44043f07 100644 (file)
@@ -131,9 +131,12 @@ class Editor(wx.ScrolledWindow):
 
     def NiceFontForPlatform(self):
         if wx.Platform == "__WXMSW__":
-            return wx.Font(10, wx.MODERN, wx.NORMAL, wx.NORMAL)
+            font = wx.Font(10, wx.MODERN, wx.NORMAL, wx.NORMAL)
         else:
-            return wx.Font(12, wx.MODERN, wx.NORMAL, wx.NORMAL, False)
+            font = wx.Font(12, wx.MODERN, wx.NORMAL, wx.NORMAL, False)
+        if wx.Platform == "__WXMAC__":
+            font.SetNoAntiAliasing()
+        return font
 
     def UnixKeyHack(self, key):
         #
@@ -213,7 +216,7 @@ class Editor(wx.ScrolledWindow):
         pass
 
     def DrawEditText(self, t, x, y, dc):
-        dc.DrawText(t, (x * self.fw, y * self.fh))
+        dc.DrawText(t, x * self.fw, y * self.fh)
 
     def DrawLine(self, line, dc):
         if self.IsLine(line):
@@ -261,7 +264,7 @@ class Editor(wx.ScrolledWindow):
         x = 0
         y = (len(self.lines) - self.sy) * self.fh
         hasTransparency = 1
-        dc.DrawBitmap(self.eofMarker, (x, y), hasTransparency)
+        dc.DrawBitmap(self.eofMarker, x, y, hasTransparency)
 
 ##------------------ cursor-related functions
 
@@ -290,7 +293,7 @@ class Editor(wx.ScrolledWindow):
         szy = self.fh
         x = xp * szx
         y = yp * szy
-        dc.Blit((x,y), (szx,szy), dc, (x,y), wx.SRC_INVERT)
+        dc.Blit(x,y, szx,szy, dc, x,y, wx.SRC_INVERT)
         self.sco_x = xp
         self.sco_y = yp
 
@@ -480,6 +483,7 @@ class Editor(wx.ScrolledWindow):
         self.SelectEnd = None
         self.UpdateView()
         self.CaptureMouse()
+        self.SetFocus()
 
     def OnLeftUp(self, event):
         if not self.HasCapture():
@@ -548,12 +552,13 @@ class Editor(wx.ScrolledWindow):
 
 
     def AdjustScrollbars(self):
-        for i in range(2):
-            self.SetCharDimensions()
-            self.scroller.SetScrollbars(
-                self.fw, self.fh,
-                self.CalcMaxLineLen()+3, max(self.LinesInFile()+1, self.sh),
-                self.sx, self.sy)
+        if self:
+            for i in range(2):
+                self.SetCharDimensions()
+                self.scroller.SetScrollbars(
+                    self.fw, self.fh,
+                    self.CalcMaxLineLen()+3, max(self.LinesInFile()+1, self.sh),
+                    self.sx, self.sy)
 
 #------------ backspace, delete, return
 
@@ -771,7 +776,7 @@ class Editor(wx.ScrolledWindow):
     def MoveLeft(self, event):
         if self.cx == 0:
             if self.cy == 0:
-                wxBell()
+                wx.Bell()
             else:
                 self.cVert(-1)
                 self.cx = self.CurrentLineLength()
@@ -782,7 +787,7 @@ class Editor(wx.ScrolledWindow):
         linelen = self.CurrentLineLength()
         if self.cx == linelen:
             if self.cy == len(self.lines) - 1:
-                wxBell()
+                wx.Bell()
             else:
                 self.cx = 0
                 self.cVert(1)