bug fixes

This commit is contained in:
Kelvin Sherlock 2024-01-04 13:37:46 -05:00
parent 62c070fb1a
commit 8b39e26dc7
2 changed files with 44 additions and 9 deletions

View File

@ -617,12 +617,12 @@ class rRectangleControl(rControlTemplate):
return rv
fSquishText = 0x0010 # 6.0.1
fTextCanDim = 0x0008
fBlastText = 0x0004
fSubstituteText = 0x0002
fSubTextIsPascal = 0x0001
fSubTextIsC = 0x0000
# fSquishText = 0x0010 # 6.0.1
# fTextCanDim = 0x0008
# fBlastText = 0x0004
# fSubstituteText = 0x0002
# fSubTextIsPascal = 0x0001
# fSubTextIsC = 0x0000
# leftJustify = 0
# centerJustify = 1
@ -665,7 +665,7 @@ class rStatTextControl(rControlTemplate):
if fBlastText: flags |= 0x0004
if fSubstituteText: flags |= 0x0002
if fSubTextIsPascal: flags |= 0x0001| 0x0002
if fSubTextIsC != None: flags |= 0x0002
if fSubTextIsC: flags |= 0x0002
if leftJust: just = 0
elif centerJust: just = 1

View File

@ -280,8 +280,8 @@ class rect_class:
return rect_class(
x = self.x + horizontal,
y = self.y + vertical,
width = self.width - horizontal,
height = self.height - vertical
width = self.width - horizontal * 2,
height = self.height - vertical * 2
)
def offset_to(self, x, y):
@ -313,6 +313,27 @@ class rect_class:
def bottom_right(self):
return point_class(x = self.x + self.width, y = self.y + self.height)
def split_horizontal(self, where):
if where < 0: where = self.width + where
where = max(0, min(self.width, where))
l = rect_class(x = self.x, y = self.y, height = self.height, width = where)
r = rect_class(x = where, y = self.y, height = self.height, width = self.width - where)
return l, r
def split_vertical(self, where):
if where < 0: where = self.height + where
where = max(0, min(self.height, where))
l = rect_class(x = self.x, y = self.y, height = where, width = self.width)
r = rect_class(x = self.x, y = where, height = self.height - where, width = self.width)
return l, r
def __str__(self):
return "{{ {:d}, {:d}, {:d}, {:d} }}".format(self.y, self.x, self.y + self.height, self.x + self.width)
@ -354,6 +375,20 @@ class rect_class:
return rect_class(v1 = y1, h1 = x1, v2 = y2, h2 = x2)
def __add__(self, other):
if type(other) == size_class:
return rect_class(x = self.x, y = self.y, height = self.height + other.height, width = self.width + other.width)
raise ValueError("bad parameter")
def __sub__(self, other):
if type(other) == size_class:
return rect_class(x = self.x, y = self.y, height = self.height - other.height, width = self.width - other.width)
raise ValueError("bad parameter")
point = point_class
rect = rect_class
size = size_class