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

Skip to content

Commit e85e4e4

Browse files
committed
The TNXDraw gworld argument is optional.
1 parent e160fe1 commit e85e4e4

3 files changed

Lines changed: 35 additions & 2 deletions

File tree

Mac/Modules/mlte/Mltemodule.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,20 @@ OptRectPtr_Convert(PyObject *v, Rect **p_itself)
7070
return PyMac_GetRect(v, *p_itself);
7171
}
7272

73+
/*
74+
** Parse an optional GWorld
75+
*/
76+
static int
77+
OptGWorldObj_Convert(PyObject *v, GWorldPtr *p_itself)
78+
{
79+
if (v == Py_None)
80+
{
81+
*p_itself = NULL;
82+
return 1;
83+
}
84+
return GWorldObj_Convert(v, p_itself);
85+
}
86+
7387

7488
static PyObject *Mlte_Error;
7589

@@ -276,7 +290,7 @@ static PyObject *TXNObj_TXNDraw(TXNObjectObject *_self, PyObject *_args)
276290
GWorldPtr iDrawPort;
277291
PyMac_PRECHECK(TXNDraw);
278292
if (!PyArg_ParseTuple(_args, "O&",
279-
GWorldObj_Convert, &iDrawPort))
293+
OptGWorldObj_Convert, &iDrawPort))
280294
return NULL;
281295
TXNDraw(_self->ob_itself,
282296
iDrawPort);

Mac/Modules/mlte/mltescan.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,11 @@ def makerepairinstructions(self):
116116

117117
# The AdjustCursor region handle is optional
118118
([("RgnHandle", "ioCursorRgn", "InMode")],
119-
[("OptRgnHandle", "*", "*")])
119+
[("OptRgnHandle", "*", "*")]),
120+
121+
# The GWorld for TXNDraw is optional
122+
([('GWorldPtr', 'iDrawPort', 'InMode')],
123+
[('OptGWorldPtr', '*', '*')]),
120124
]
121125

122126
if __name__ == "__main__":

Mac/Modules/mlte/mltesupport.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,20 @@
7474
return PyMac_GetRect(v, *p_itself);
7575
}
7676
77+
/*
78+
** Parse an optional GWorld
79+
*/
80+
static int
81+
OptGWorldObj_Convert(PyObject *v, GWorldPtr *p_itself)
82+
{
83+
if (v == Py_None)
84+
{
85+
*p_itself = NULL;
86+
return 1;
87+
}
88+
return GWorldObj_Convert(v, p_itself);
89+
}
90+
7791
"""
7892

7993
initstuff = initstuff + """
@@ -109,6 +123,7 @@
109123
RgnHandle = OpaqueByValueType("RgnHandle", "ResObj")
110124
OptRgnHandle = OpaqueByValueType("RgnHandle", "OptResObj")
111125
GWorldPtr = OpaqueByValueType("GWorldPtr", "GWorldObj")
126+
OptGWorldPtr = OpaqueByValueType("GWorldPtr", "OptGWorldObj")
112127
MlteInBuffer = VarInputBufferType('void *', 'ByteCount', 'l')
113128

114129
OptFSSpecPtr = OpaqueByValueType("FSSpec *", "OptFSSpecPtr")

0 commit comments

Comments
 (0)