Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 54c8f7e

Browse files
committed
- Fixed handling of InsetRect, OffsetRect, MapRect
- Added support for PatHandle, CursHandle - Regenerated from new universal headers.
1 parent cdaa3d9 commit 54c8f7e

5 files changed

Lines changed: 190 additions & 13 deletions

File tree

Mac/Lib/toolbox/QuickDraw.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Generated from 'Sap:CodeWarrior6:Metrowerks C/C++:Headers:Universal Headers 2.0.1f:QuickDraw.h'
1+
# Generated from 'Sap:CodeWarrior7:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:QuickDraw.h'
22

33
invalColReq = -1
44
srcCopy = 0
@@ -58,6 +58,7 @@
5858
fixedType = 1
5959
directType = 2
6060
gdDevType = 0
61+
interlacedDevice = 2
6162
roundedDevice = 5
6263
hasAuxMenuBar = 6
6364
burstDevice = 7
@@ -73,6 +74,11 @@
7374
defQDColors = 127
7475
RGBDirect = 16
7576
baseAddr32 = 4
77+
sysPatListID = 0
78+
iBeamCursor = 1
79+
crossCursor = 2
80+
plusCursor = 3
81+
watchCursor = 4
7682
singleDevicesBit = 0
7783
dontMatchSeedsBit = 1
7884
allDevicesBit = 2
@@ -82,7 +88,9 @@
8288
kNoConstraint = 0
8389
kVerticalConstraint = 1
8490
kHorizontalConstraint = 2
85-
# Generated from 'Sap:CodeWarrior6:Metrowerks C/C++:Headers:Universal Headers 2.0.1f:QuickDrawText.h'
91+
kCursorImageMajorVersion = 0x0001
92+
kCursorImageMinorVersion = 0x0000
93+
# Generated from 'Sap:CodeWarrior7:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:QuickDrawText.h'
8694

8795
leftCaret = 0
8896
rightCaret = -1

Mac/Modules/qd/Qdmodule.c

Lines changed: 123 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,8 @@ static PyObject *Qd_OffsetRect(_self, _args)
518518
Rect r;
519519
short dh;
520520
short dv;
521-
if (!PyArg_ParseTuple(_args, "hh",
521+
if (!PyArg_ParseTuple(_args, "O&hh",
522+
PyMac_GetRect, &r,
522523
&dh,
523524
&dv))
524525
return NULL;
@@ -538,7 +539,8 @@ static PyObject *Qd_InsetRect(_self, _args)
538539
Rect r;
539540
short dh;
540541
short dv;
541-
if (!PyArg_ParseTuple(_args, "hh",
542+
if (!PyArg_ParseTuple(_args, "O&hh",
543+
PyMac_GetRect, &r,
542544
&dh,
543545
&dv))
544546
return NULL;
@@ -1654,7 +1656,8 @@ static PyObject *Qd_MapRect(_self, _args)
16541656
Rect r;
16551657
Rect srcRect;
16561658
Rect dstRect;
1657-
if (!PyArg_ParseTuple(_args, "O&O&",
1659+
if (!PyArg_ParseTuple(_args, "O&O&O&",
1660+
PyMac_GetRect, &r,
16581661
PyMac_GetRect, &srcRect,
16591662
PyMac_GetRect, &dstRect))
16601663
return NULL;
@@ -2208,6 +2211,108 @@ static PyObject *Qd_QDError(_self, _args)
22082211
return _res;
22092212
}
22102213

2214+
static PyObject *Qd_GetPattern(_self, _args)
2215+
PyObject *_self;
2216+
PyObject *_args;
2217+
{
2218+
PyObject *_res = NULL;
2219+
PatHandle _rv;
2220+
short patternID;
2221+
if (!PyArg_ParseTuple(_args, "h",
2222+
&patternID))
2223+
return NULL;
2224+
_rv = GetPattern(patternID);
2225+
_res = Py_BuildValue("O&",
2226+
ResObj_New, _rv);
2227+
return _res;
2228+
}
2229+
2230+
static PyObject *Qd_GetCursor(_self, _args)
2231+
PyObject *_self;
2232+
PyObject *_args;
2233+
{
2234+
PyObject *_res = NULL;
2235+
CursHandle _rv;
2236+
short cursorID;
2237+
if (!PyArg_ParseTuple(_args, "h",
2238+
&cursorID))
2239+
return NULL;
2240+
_rv = GetCursor(cursorID);
2241+
_res = Py_BuildValue("O&",
2242+
ResObj_New, _rv);
2243+
return _res;
2244+
}
2245+
2246+
static PyObject *Qd_GetPicture(_self, _args)
2247+
PyObject *_self;
2248+
PyObject *_args;
2249+
{
2250+
PyObject *_res = NULL;
2251+
PicHandle _rv;
2252+
short pictureID;
2253+
if (!PyArg_ParseTuple(_args, "h",
2254+
&pictureID))
2255+
return NULL;
2256+
_rv = GetPicture(pictureID);
2257+
_res = Py_BuildValue("O&",
2258+
ResObj_New, _rv);
2259+
return _res;
2260+
}
2261+
2262+
static PyObject *Qd_DeltaPoint(_self, _args)
2263+
PyObject *_self;
2264+
PyObject *_args;
2265+
{
2266+
PyObject *_res = NULL;
2267+
long _rv;
2268+
Point ptA;
2269+
Point ptB;
2270+
if (!PyArg_ParseTuple(_args, "O&O&",
2271+
PyMac_GetPoint, &ptA,
2272+
PyMac_GetPoint, &ptB))
2273+
return NULL;
2274+
_rv = DeltaPoint(ptA,
2275+
ptB);
2276+
_res = Py_BuildValue("l",
2277+
_rv);
2278+
return _res;
2279+
}
2280+
2281+
static PyObject *Qd_ShieldCursor(_self, _args)
2282+
PyObject *_self;
2283+
PyObject *_args;
2284+
{
2285+
PyObject *_res = NULL;
2286+
Rect shieldRect;
2287+
Point offsetPt;
2288+
if (!PyArg_ParseTuple(_args, "O&O&",
2289+
PyMac_GetRect, &shieldRect,
2290+
PyMac_GetPoint, &offsetPt))
2291+
return NULL;
2292+
ShieldCursor(&shieldRect,
2293+
offsetPt);
2294+
Py_INCREF(Py_None);
2295+
_res = Py_None;
2296+
return _res;
2297+
}
2298+
2299+
static PyObject *Qd_ScreenRes(_self, _args)
2300+
PyObject *_self;
2301+
PyObject *_args;
2302+
{
2303+
PyObject *_res = NULL;
2304+
short scrnHRes;
2305+
short scrnVRes;
2306+
if (!PyArg_ParseTuple(_args, ""))
2307+
return NULL;
2308+
ScreenRes(&scrnHRes,
2309+
&scrnVRes);
2310+
_res = Py_BuildValue("hh",
2311+
scrnHRes,
2312+
scrnVRes);
2313+
return _res;
2314+
}
2315+
22112316
static PyObject *Qd_TextFont(_self, _args)
22122317
PyObject *_self;
22132318
PyObject *_args;
@@ -2471,9 +2576,9 @@ static PyMethodDef Qd_methods[] = {
24712576
{"SetRect", (PyCFunction)Qd_SetRect, 1,
24722577
"(short left, short top, short right, short bottom) -> (Rect r)"},
24732578
{"OffsetRect", (PyCFunction)Qd_OffsetRect, 1,
2474-
"(short dh, short dv) -> (Rect r)"},
2579+
"(Rect r, short dh, short dv) -> (Rect r)"},
24752580
{"InsetRect", (PyCFunction)Qd_InsetRect, 1,
2476-
"(short dh, short dv) -> (Rect r)"},
2581+
"(Rect r, short dh, short dv) -> (Rect r)"},
24772582
{"SectRect", (PyCFunction)Qd_SectRect, 1,
24782583
"(Rect src1, Rect src2) -> (Boolean _rv, Rect dstRect)"},
24792584
{"UnionRect", (PyCFunction)Qd_UnionRect, 1,
@@ -2599,7 +2704,7 @@ static PyMethodDef Qd_methods[] = {
25992704
{"MapPt", (PyCFunction)Qd_MapPt, 1,
26002705
"(Point pt, Rect srcRect, Rect dstRect) -> (Point pt)"},
26012706
{"MapRect", (PyCFunction)Qd_MapRect, 1,
2602-
"(Rect srcRect, Rect dstRect) -> (Rect r)"},
2707+
"(Rect r, Rect srcRect, Rect dstRect) -> (Rect r)"},
26032708
{"MapRgn", (PyCFunction)Qd_MapRgn, 1,
26042709
"(RgnHandle rgn, Rect srcRect, Rect dstRect) -> None"},
26052710
{"MapPoly", (PyCFunction)Qd_MapPoly, 1,
@@ -2662,6 +2767,18 @@ static PyMethodDef Qd_methods[] = {
26622767
"(short index, Boolean reserve) -> None"},
26632768
{"QDError", (PyCFunction)Qd_QDError, 1,
26642769
"() -> (short _rv)"},
2770+
{"GetPattern", (PyCFunction)Qd_GetPattern, 1,
2771+
"(short patternID) -> (PatHandle _rv)"},
2772+
{"GetCursor", (PyCFunction)Qd_GetCursor, 1,
2773+
"(short cursorID) -> (CursHandle _rv)"},
2774+
{"GetPicture", (PyCFunction)Qd_GetPicture, 1,
2775+
"(short pictureID) -> (PicHandle _rv)"},
2776+
{"DeltaPoint", (PyCFunction)Qd_DeltaPoint, 1,
2777+
"(Point ptA, Point ptB) -> (long _rv)"},
2778+
{"ShieldCursor", (PyCFunction)Qd_ShieldCursor, 1,
2779+
"(Rect shieldRect, Point offsetPt) -> None"},
2780+
{"ScreenRes", (PyCFunction)Qd_ScreenRes, 1,
2781+
"() -> (short scrnHRes, short scrnVRes)"},
26652782
{"TextFont", (PyCFunction)Qd_TextFont, 1,
26662783
"(short font) -> None"},
26672784
{"TextFace", (PyCFunction)Qd_TextFace, 1,

Mac/Modules/qd/qdgen.py

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Generated from 'Sap:CodeWarrior6:Metrowerks C/C++:Headers:Universal Headers 2.0.1f:QuickDraw.h'
1+
# Generated from 'Sap:CodeWarrior7:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:QuickDraw.h'
22

33
f = Function(void, 'OpenPort',
44
(GrafPtr, 'port', InMode),
@@ -156,14 +156,14 @@
156156
functions.append(f)
157157

158158
f = Function(void, 'OffsetRect',
159-
(Rect, 'r', OutMode),
159+
(Rect, 'r', InOutMode),
160160
(short, 'dh', InMode),
161161
(short, 'dv', InMode),
162162
)
163163
functions.append(f)
164164

165165
f = Function(void, 'InsetRect',
166-
(Rect, 'r', OutMode),
166+
(Rect, 'r', InOutMode),
167167
(short, 'dh', InMode),
168168
(short, 'dv', InMode),
169169
)
@@ -530,7 +530,7 @@
530530
functions.append(f)
531531

532532
f = Function(void, 'MapRect',
533-
(Rect, 'r', OutMode),
533+
(Rect, 'r', InOutMode),
534534
(Rect_ptr, 'srcRect', InMode),
535535
(Rect_ptr, 'dstRect', InMode),
536536
)
@@ -713,7 +713,40 @@
713713
)
714714
functions.append(f)
715715

716-
# Generated from 'Sap:CodeWarrior6:Metrowerks C/C++:Headers:Universal Headers 2.0.1f:QuickDrawText.h'
716+
f = Function(PatHandle, 'GetPattern',
717+
(short, 'patternID', InMode),
718+
)
719+
functions.append(f)
720+
721+
f = Function(CursHandle, 'GetCursor',
722+
(short, 'cursorID', InMode),
723+
)
724+
functions.append(f)
725+
726+
f = Function(PicHandle, 'GetPicture',
727+
(short, 'pictureID', InMode),
728+
)
729+
functions.append(f)
730+
731+
f = Function(long, 'DeltaPoint',
732+
(Point, 'ptA', InMode),
733+
(Point, 'ptB', InMode),
734+
)
735+
functions.append(f)
736+
737+
f = Function(void, 'ShieldCursor',
738+
(Rect_ptr, 'shieldRect', InMode),
739+
(Point, 'offsetPt', InMode),
740+
)
741+
functions.append(f)
742+
743+
f = Function(void, 'ScreenRes',
744+
(short, 'scrnHRes', OutMode),
745+
(short, 'scrnVRes', OutMode),
746+
)
747+
functions.append(f)
748+
749+
# Generated from 'Sap:CodeWarrior7:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:QuickDrawText.h'
717750

718751
f = Function(void, 'TextFont',
719752
(short, 'font', InMode),

Mac/Modules/qd/qdscan.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ def makeblacklisttypes(self):
7979
'ColorSearchUPP',
8080
'ConstPatternParam',
8181
'Pattern_ptr',
82+
'Pattern',
8283
'Cursor_ptr',
8384
'DeviceLoopDrawingProcPtr',
8485
'DeviceLoopFlags',
@@ -105,6 +106,22 @@ def makerepairinstructions(self):
105106

106107
([('Point', '*', 'OutMode')],
107108
[('*', '*', 'InOutMode')]),
109+
110+
# InsetRect, OffsetRect
111+
([('Rect', 'r', 'OutMode'),
112+
('short', 'dh', 'InMode'),
113+
('short', 'dv', 'InMode')],
114+
[('Rect', 'r', 'InOutMode'),
115+
('short', 'dh', 'InMode'),
116+
('short', 'dv', 'InMode')]),
117+
118+
# MapRect
119+
([('Rect', 'r', 'OutMode'),
120+
('Rect_ptr', 'srcRect', 'InMode'),
121+
('Rect_ptr', 'dstRect', 'InMode')],
122+
[('Rect', 'r', 'InOutMode'),
123+
('Rect_ptr', 'srcRect', 'InMode'),
124+
('Rect_ptr', 'dstRect', 'InMode')]),
108125

109126
]
110127

Mac/Modules/qd/qdsupport.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ def getargsCheck(self, name):
4040
PolyHandle = OpaqueByValueType("PolyHandle", "ResObj")
4141
PixMapHandle = OpaqueByValueType("PixMapHandle", "ResObj")
4242
PixPatHandle = OpaqueByValueType("PixPatHandle", "ResObj")
43+
PatHandle = OpaqueByValueType("PatHandle", "ResObj")
44+
CursHandle = OpaqueByValueType("CursHandle", "ResObj")
4345

4446
includestuff = includestuff + """
4547
#include <%s>""" % MACHEADERFILE + """

0 commit comments

Comments
 (0)