X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/31c07ca5a3699fbd6051fd9b8e481cd6ea5bd9c3..aea9f6d5d3eb8513065583fa8e26d7687c39cc4b:/wxPython/wx/lib/editor/editor.py diff --git a/wxPython/wx/lib/editor/editor.py b/wxPython/wx/lib/editor/editor.py index 3be1a8ce71..2a3f3af6ba 100644 --- a/wxPython/wx/lib/editor/editor.py +++ b/wxPython/wx/lib/editor/editor.py @@ -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): @@ -238,9 +241,8 @@ class Editor(wx.ScrolledWindow): if not odc: odc = wx.ClientDC(self) - bmp = wx.EmptyBitmap(max(1,self.bw), max(1,self.bh)) - dc = wx.BufferedDC(odc, bmp) - if dc.Ok(): + dc = wx.BufferedDC(odc) + if dc.IsOk(): dc.SetFont(self.font) dc.SetBackgroundMode(wx.SOLID) dc.SetTextBackground(self.bgColor) @@ -261,7 +263,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 +292,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 +482,7 @@ class Editor(wx.ScrolledWindow): self.SelectEnd = None self.UpdateView() self.CaptureMouse() + self.SetFocus() def OnLeftUp(self, event): if not self.HasCapture(): @@ -548,12 +551,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 @@ -937,7 +941,7 @@ class Editor(wx.ScrolledWindow): self.AdjustScrollbars() def OnChar(self, event): - key = event.KeyCode() + key = event.GetKeyCode() filters = [self.AltKey, self.MoveSpecialControlKey, self.ControlKey,