Improved graphics of LogViewer scrollbar to be anti-aliased
authorLaurent Bessard
Fri, 15 Mar 2013 12:07:39 +0100
changeset 987 7ca88194ae89
parent 986 b663f099da8a
child 988 30e7571c10d0
Improved graphics of LogViewer scrollbar to be anti-aliased
controls/LogViewer.py
--- a/controls/LogViewer.py	Fri Mar 15 11:33:50 2013 +0100
+++ b/controls/LogViewer.py	Fri Mar 15 12:07:39 2013 +0100
@@ -69,7 +69,7 @@
         thumb_center_position = (thumb_size + (self.ThumbPosition + 1) * thumb_range) / 2.
         thumb_start = int(thumb_center_position - thumb_size / 2.)
         thumb_end = int(thumb_center_position + thumb_size / 2.)
-        return wx.Rect(1, range_rect.y + thumb_start, width - 1, thumb_end - thumb_start)
+        return wx.Rect(0, range_rect.y + thumb_start, width, thumb_end - thumb_start)
     
     def RefreshThumbPosition(self, thumb_position=None):
         if thumb_position is None:
@@ -129,16 +129,18 @@
         dc.Clear()
         dc.BeginDrawing()
         
+        gc = wx.GCDC(dc)
+        
         width, height = self.GetClientSize()
         
-        dc.SetPen(wx.Pen(wx.NamedColour("GREY"), 2))
-        dc.SetBrush(wx.GREY_BRUSH)
-        
-        dc.DrawLines(ArrowPoints(wx.TOP, width, width * 0.75, 2 * width))
-        dc.DrawLines(ArrowPoints(wx.TOP, width, width * 0.75, 2 * width + 6))
-        
-        dc.DrawLines(ArrowPoints(wx.BOTTOM, width, width * 0.75, height - 2 * width))
-        dc.DrawLines(ArrowPoints(wx.BOTTOM, width, width * 0.75, height - 2 * width - 6))
+        gc.SetPen(wx.Pen(wx.NamedColour("GREY"), 2))
+        gc.SetBrush(wx.GREY_BRUSH)
+        
+        gc.DrawLines(ArrowPoints(wx.TOP, width, width * 0.75, 2 * width))
+        gc.DrawLines(ArrowPoints(wx.TOP, width, width * 0.75, 2 * width + 6))
+        
+        gc.DrawLines(ArrowPoints(wx.BOTTOM, width, width * 0.75, height - 2 * width))
+        gc.DrawLines(ArrowPoints(wx.BOTTOM, width, width * 0.75, height - 2 * width - 6))
         
         thumb_rect = self.GetThumbRect()
         exclusion_rect = wx.Rect(thumb_rect.x, thumb_rect.y,
@@ -149,20 +151,20 @@
             exclusion_rect.height = height - width - exclusion_rect.y
         if exclusion_rect != thumb_rect:
             colour = wx.NamedColour("LIGHT GREY")
-            dc.SetPen(wx.Pen(colour))
-            dc.SetBrush(wx.Brush(colour))
-        
-            dc.DrawRectangle(exclusion_rect.x, exclusion_rect.y, 
+            gc.SetPen(wx.Pen(colour))
+            gc.SetBrush(wx.Brush(colour))
+        
+            gc.DrawRectangle(exclusion_rect.x, exclusion_rect.y, 
                              exclusion_rect.width, exclusion_rect.height)
         
-        dc.SetPen(wx.GREY_PEN)
-        dc.SetBrush(wx.GREY_BRUSH)
-        
-        dc.DrawPolygon(ArrowPoints(wx.TOP, width, width, 0))
-        
-        dc.DrawPolygon(ArrowPoints(wx.BOTTOM, width, width, height))
+        gc.SetPen(wx.GREY_PEN)
+        gc.SetBrush(wx.GREY_BRUSH)
+        
+        gc.DrawPolygon(ArrowPoints(wx.TOP, width, width, 0))
+        
+        gc.DrawPolygon(ArrowPoints(wx.BOTTOM, width, width, height))
             
-        dc.DrawRectangle(thumb_rect.x, thumb_rect.y, 
+        gc.DrawRectangle(thumb_rect.x, thumb_rect.y, 
                          thumb_rect.width, thumb_rect.height)
         
         dc.EndDrawing()