--- a/graphics/LD_Objects.py Wed Jan 30 09:52:57 2008 +0100
+++ b/graphics/LD_Objects.py Wed Jan 30 18:48:05 2008 +0100
@@ -109,7 +109,6 @@
# Refresh the power rail bounding box
def RefreshBoundingBox(self):
- dc = wx.ClientDC(self.Parent)
self.BoundingBox = wx.Rect(self.Pos.x, self.Pos.y, self.Size[0] + 1, self.Size[1] + 1)
# Refresh the power rail size
@@ -313,7 +312,7 @@
self.Parent.PopupDefaultMenu()
# Refreshes the powerrail state according to move defined and handle selected
- def ProcessDragging(self, movex, movey, scaling):
+ def ProcessDragging(self, movex, movey, centered, scaling):
handle_type, handle = self.Handle
# A connector has been handled
if handle_type == HANDLE_CONNECTOR:
@@ -324,7 +323,7 @@
self.MoveConnector(handle, movey)
return 0, movey
else:
- return Graphic_Element.ProcessDragging(self, movex, movey, scaling)
+ return Graphic_Element.ProcessDragging(self, movex, movey, centered, scaling)
# Refreshes the power rail model
def RefreshModel(self, move=True):
@@ -416,15 +415,13 @@
# Refresh the size of text for name
def RefreshNameSize(self):
- dc = wx.ClientDC(self.Parent)
if self.Name != "":
- self.NameSize = dc.GetTextExtent(self.Name)
+ self.NameSize = self.Parent.GetTextExtent(self.Name)
else:
self.NameSize = 0, 0
# Refresh the size of text for type
def RefreshTypeSize(self):
- dc = wx.ClientDC(self.Parent)
typetext = ""
if self.Type == CONTACT_REVERSE:
typetext = "/"
@@ -433,15 +430,14 @@
elif self.Type == CONTACT_FALLING:
typetext = "N"
if typetext != "":
- self.TypeSize = dc.GetTextExtent(typetext)
+ self.TypeSize = self.Parent.GetTextExtent(typetext)
else:
self.TypeSize = 0, 0
# Refresh the contact bounding box
def RefreshBoundingBox(self):
- dc = wx.ClientDC(self.Parent)
# Calculate the size of the name outside the contact
- text_width, text_height = dc.GetTextExtent(self.Name)
+ text_width, text_height = self.Parent.GetTextExtent(self.Name)
# Calculate the bounding box size
if self.Name != "":
bbx_x = self.Pos.x - max(0, (text_width - self.Size[0]) / 2)
@@ -646,15 +642,13 @@
# Refresh the size of text for name
def RefreshNameSize(self):
- dc = wx.ClientDC(self.Parent)
if self.Name != "":
- self.NameSize = dc.GetTextExtent(self.Name)
+ self.NameSize = self.Parent.GetTextExtent(self.Name)
else:
self.NameSize = 0, 0
# Refresh the size of text for type
def RefreshTypeSize(self):
- dc = wx.ClientDC(self.Parent)
typetext = ""
if self.Type == COIL_REVERSE:
typetext = "/"
@@ -663,15 +657,14 @@
elif self.Type == COIL_RESET:
typetext = "R"
if typetext != "":
- self.TypeSize = dc.GetTextExtent(typetext)
+ self.TypeSize = self.Parent.GetTextExtent(typetext)
else:
self.TypeSize = 0, 0
# Refresh the coil bounding box
def RefreshBoundingBox(self):
- dc = wx.ClientDC(self.Parent)
# Calculate the size of the name outside the coil
- text_width, text_height = dc.GetTextExtent(self.Name)
+ text_width, text_height = self.Parent.GetTextExtent(self.Name)
# Calculate the bounding box size
if self.Name != "":
bbx_x = self.Pos.x - max(0, (text_width - self.Size[0]) / 2)