Resources/Gorgon-gdb.py

Tue, 06 Jul 2021 10:22:49 +0300

author
cemkalyoncu
date
Tue, 06 Jul 2021 10:22:49 +0300
branch
4.x-dev
changeset 1701
b168349a931d
parent 1390
d2cad48445cd
child 1751
c11e4d2ab93b
permissions
-rw-r--r--

* Image/Bitmap rotate

1236
1816e647b817 * Polyfill problem is fixed for AA>1 cases
cemkalyoncu
parents:
diff changeset
1 import gdb
1816e647b817 * Polyfill problem is fixed for AA>1 cases
cemkalyoncu
parents:
diff changeset
2 import gdb.printing
1390
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
3 from pprint import pprint
1236
1816e647b817 * Polyfill problem is fixed for AA>1 cases
cemkalyoncu
parents:
diff changeset
4
1816e647b817 * Polyfill problem is fixed for AA>1 cases
cemkalyoncu
parents:
diff changeset
5 class geometry_point:
1816e647b817 * Polyfill problem is fixed for AA>1 cases
cemkalyoncu
parents:
diff changeset
6 def __init__(self, val):
1816e647b817 * Polyfill problem is fixed for AA>1 cases
cemkalyoncu
parents:
diff changeset
7 self.val=val
1816e647b817 * Polyfill problem is fixed for AA>1 cases
cemkalyoncu
parents:
diff changeset
8
1816e647b817 * Polyfill problem is fixed for AA>1 cases
cemkalyoncu
parents:
diff changeset
9 def to_string(self):
1816e647b817 * Polyfill problem is fixed for AA>1 cases
cemkalyoncu
parents:
diff changeset
10 return '(' + str(self.val['X']) + ', ' + str(self.val['Y']) + ')'
1390
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
11
1236
1816e647b817 * Polyfill problem is fixed for AA>1 cases
cemkalyoncu
parents:
diff changeset
12 class geometry_size:
1816e647b817 * Polyfill problem is fixed for AA>1 cases
cemkalyoncu
parents:
diff changeset
13 def __init__(self, val):
1816e647b817 * Polyfill problem is fixed for AA>1 cases
cemkalyoncu
parents:
diff changeset
14 self.val=val
1816e647b817 * Polyfill problem is fixed for AA>1 cases
cemkalyoncu
parents:
diff changeset
15
1816e647b817 * Polyfill problem is fixed for AA>1 cases
cemkalyoncu
parents:
diff changeset
16 def to_string(self):
1390
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
17 return '(' + str(self.val['Width']) + ' x ' + str(self.val['Height']) + ')'
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
18
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
19
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
20 class geometry_bounds:
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
21 def __init__(self, val):
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
22 self.val=val
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
23
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
24 def to_string(self):
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
25 return '<(' + str(self.val['Left']) + ', ' + str(self.val['Top']) + ') - (' + str(self.val['Right']) + ', ' + str(self.val['Bottom']) + ')]'
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
26
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
27
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
28 class geometry_margin:
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
29 def __init__(self, val):
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
30 self.val=val
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
31
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
32 def to_string(self):
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
33 return '(' + str(self.val['Left']) + ', ' + str(self.val['Top']) + ', ' + str(self.val['Right']) + ', ' + str(self.val['Bottom']) + ')'
1236
1816e647b817 * Polyfill problem is fixed for AA>1 cases
cemkalyoncu
parents:
diff changeset
34
1816e647b817 * Polyfill problem is fixed for AA>1 cases
cemkalyoncu
parents:
diff changeset
35
1390
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
36 class geometry_rect:
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
37 def __init__(self, val):
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
38 self.val=val
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
39
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
40 def to_string(self):
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
41 return '<(' + str(self.val['Left']) + ', ' + str(self.val['Top']) + '), ' + str(self.val['Width']) + ' x ' + str(self.val['Height']) + '>'
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
42
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
43 class ui_dim:
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
44 def __init__(self, val):
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
45 self.val=val
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
46
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
47 def to_string(self):
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
48 s = str(self.val['value'])
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
49
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
50 print(str(s)+'!')
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
51
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
52 if(self.val['unit'] == 0):
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
53 s = str(s) + 'px'
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
54 elif(self.val['unit'] == 1):
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
55 s = str(s) + '%'
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
56 elif(self.val['unit'] == 2):
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
57 s = str(s) + 'mpx'
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
58 elif(self.val['unit'] == 3):
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
59 s = str(s) + 'bp'
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
60 elif(self.val['unit'] == 4):
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
61 s = str(s) + 'em'
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
62 else:
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
63 s = str(s) + str(self.val['unit'])
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
64
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
65 return s
1236
1816e647b817 * Polyfill problem is fixed for AA>1 cases
cemkalyoncu
parents:
diff changeset
66
1816e647b817 * Polyfill problem is fixed for AA>1 cases
cemkalyoncu
parents:
diff changeset
67 def build_pretty_printer():
1816e647b817 * Polyfill problem is fixed for AA>1 cases
cemkalyoncu
parents:
diff changeset
68 pp = gdb.printing.RegexpCollectionPrettyPrinter("prettygorgon")
1816e647b817 * Polyfill problem is fixed for AA>1 cases
cemkalyoncu
parents:
diff changeset
69 pp.add_printer('geometry-point', '^Gorgon::Geometry::basic_Point<.*>$', geometry_point)
1816e647b817 * Polyfill problem is fixed for AA>1 cases
cemkalyoncu
parents:
diff changeset
70 pp.add_printer('geometry-size', '^Gorgon::Geometry::basic_Size<.*>$', geometry_size)
1390
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
71 pp.add_printer('geometry-bounds', '^Gorgon::Geometry::basic_Bounds<.*>$', geometry_bounds)
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
72 pp.add_printer('geometry-margin', '^Gorgon::Geometry::basic_Margin<.*>$', geometry_margin)
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
73 pp.add_printer('geometry-rect', '^Gorgon::Geometry::basic_Rectangle<.*>$', geometry_rect)
d2cad48445cd #140: AbsoluteSliding mode is fixed
cemkalyoncu
parents: 1236
diff changeset
74 pp.add_printer('ui-dimension', '^Gorgon::UI::Dimension$', ui_dim)
1236
1816e647b817 * Polyfill problem is fixed for AA>1 cases
cemkalyoncu
parents:
diff changeset
75 return pp;
1816e647b817 * Polyfill problem is fixed for AA>1 cases
cemkalyoncu
parents:
diff changeset
76
1816e647b817 * Polyfill problem is fixed for AA>1 cases
cemkalyoncu
parents:
diff changeset
77
1816e647b817 * Polyfill problem is fixed for AA>1 cases
cemkalyoncu
parents:
diff changeset
78
1816e647b817 * Polyfill problem is fixed for AA>1 cases
cemkalyoncu
parents:
diff changeset
79 gdb.printing.register_pretty_printer(
1816e647b817 * Polyfill problem is fixed for AA>1 cases
cemkalyoncu
parents:
diff changeset
80 gdb.current_objfile(),
1816e647b817 * Polyfill problem is fixed for AA>1 cases
cemkalyoncu
parents:
diff changeset
81 build_pretty_printer())

mercurial