]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/wx/lib/ogl/_lines.py
frame should call skip on child focus event to give owner a chance
[wxWidgets.git] / wxPython / wx / lib / ogl / _lines.py
index 6b6e4cf59be79d7c95e5edbb81259989f18e1d25..fdee0ed6b5f400eb6b83058272cdea0d02a95a9a 100644 (file)
@@ -14,7 +14,7 @@
 import sys
 import math
 
-from _basic import Shape, ShapeRegion, ControlPoint, RectangleShape
+from _basic import Shape, ShapeRegion, ShapeTextLine, ControlPoint, RectangleShape
 from _oglmisc import *
 
 # Line alignment flags
@@ -131,7 +131,7 @@ class LabelShape(RectangleShape):
         RectangleShape.__init__(self, w, h)
         self._lineShape = parent
         self._shapeRegion = region
-        self.SetPen(wx.ThePenList.FindOrCreatePen(wx.Colour(0, 0, 0), 1, wx.DOT))
+        self.SetPen(wx.Pen(wx.Colour(0, 0, 0), 1, wx.DOT))
 
     def OnDraw(self, dc):
         if self._lineShape and not self._lineShape.GetDrawHandles():
@@ -298,16 +298,19 @@ class LineShape(Shape):
         # the middle points to something other than (-999, -999)
         self._initialised = False
         
-    def InsertLineControlPoint(self, dc = None):
-        """Insert a control point at an arbitrary position."""
+    def InsertLineControlPoint(self, dc = None, point = None):
+        """Insert a control point at an optional given position."""
         if dc:
             self.Erase(dc)
 
-        last_point = self._lineControlPoints[-1]
-        second_last_point = self._lineControlPoints[-2]
+        if point:
+            line_x, line_y = point
+        else:
+            last_point = self._lineControlPoints[-1]
+            second_last_point = self._lineControlPoints[-2]
 
-        line_x = (last_point[0] + second_last_point[0]) / 2.0
-        line_y = (last_point[1] + second_last_point[1]) / 2.0
+            line_x = (last_point[0] + second_last_point[0]) / 2.0
+            line_y = (last_point[1] + second_last_point[1]) / 2.0
 
         point = wx.RealPoint(line_x, line_y)
         self._lineControlPoints.insert(len(self._lineControlPoints)-1, point)
@@ -1024,7 +1027,7 @@ class LineShape(Shape):
         # Problem with pen - if not a solid pen, does strange things
         # to the arrowhead. So make (get) a new pen that's solid.
         if self._pen and self._pen.GetStyle() != wx.SOLID:
-            solid_pen = wx.ThePenList.FindOrCreatePen(self._pen.GetColour(), 1, wx.SOLID)
+            solid_pen = wx.Pen(self._pen.GetColour(), 1, wx.SOLID)
             if solid_pen:
                 dc.SetPen(solid_pen)