1 |
|
---|
2 | /* ========================== Module _Mlte ========================== */
|
---|
3 |
|
---|
4 | #include "Python.h"
|
---|
5 |
|
---|
6 | #ifndef __LP64__
|
---|
7 |
|
---|
8 |
|
---|
9 | #include "pymactoolbox.h"
|
---|
10 |
|
---|
11 | /* Macro to test whether a weak-loaded CFM function exists */
|
---|
12 | #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
|
---|
13 | PyErr_SetString(PyExc_NotImplementedError, \
|
---|
14 | "Not available in this shared library/OS version"); \
|
---|
15 | return NULL; \
|
---|
16 | }} while(0)
|
---|
17 |
|
---|
18 |
|
---|
19 | #include <Carbon/Carbon.h>
|
---|
20 |
|
---|
21 | /* For now we declare them forward here. They'll go to mactoolbox later */
|
---|
22 | static PyObject *TXNObj_New(TXNObject);
|
---|
23 | static int TXNObj_Convert(PyObject *, TXNObject *);
|
---|
24 | static PyObject *TXNFontMenuObj_New(TXNFontMenuObject);
|
---|
25 | static int TXNFontMenuObj_Convert(PyObject *, TXNFontMenuObject *);
|
---|
26 |
|
---|
27 | // ADD declarations
|
---|
28 | #ifdef NOTYET_USE_TOOLBOX_OBJECT_GLUE
|
---|
29 | //extern PyObject *_CFTypeRefObj_New(CFTypeRef);
|
---|
30 | //extern int _CFTypeRefObj_Convert(PyObject *, CFTypeRef *);
|
---|
31 |
|
---|
32 | //#define CFTypeRefObj_New _CFTypeRefObj_New
|
---|
33 | //#define CFTypeRefObj_Convert _CFTypeRefObj_Convert
|
---|
34 | #endif
|
---|
35 |
|
---|
36 | /*
|
---|
37 | ** Parse an optional fsspec
|
---|
38 | */
|
---|
39 | static int
|
---|
40 | OptFSSpecPtr_Convert(PyObject *v, FSSpec **p_itself)
|
---|
41 | {
|
---|
42 | static FSSpec fss;
|
---|
43 | if (v == Py_None)
|
---|
44 | {
|
---|
45 | *p_itself = NULL;
|
---|
46 | return 1;
|
---|
47 | }
|
---|
48 | *p_itself = &fss;
|
---|
49 | return PyMac_GetFSSpec(v, *p_itself);
|
---|
50 | }
|
---|
51 |
|
---|
52 | /*
|
---|
53 | ** Parse an optional GWorld
|
---|
54 | */
|
---|
55 | static int
|
---|
56 | OptGWorldObj_Convert(PyObject *v, GWorldPtr *p_itself)
|
---|
57 | {
|
---|
58 | if (v == Py_None)
|
---|
59 | {
|
---|
60 | *p_itself = NULL;
|
---|
61 | return 1;
|
---|
62 | }
|
---|
63 | return GWorldObj_Convert(v, p_itself);
|
---|
64 | }
|
---|
65 |
|
---|
66 |
|
---|
67 | static PyObject *Mlte_Error;
|
---|
68 |
|
---|
69 | /* --------------------- Object type TXNObject ---------------------- */
|
---|
70 |
|
---|
71 | PyTypeObject TXNObject_Type;
|
---|
72 |
|
---|
73 | #define TXNObj_Check(x) ((x)->ob_type == &TXNObject_Type || PyObject_TypeCheck((x), &TXNObject_Type))
|
---|
74 |
|
---|
75 | typedef struct TXNObjectObject {
|
---|
76 | PyObject_HEAD
|
---|
77 | TXNObject ob_itself;
|
---|
78 | } TXNObjectObject;
|
---|
79 |
|
---|
80 | PyObject *TXNObj_New(TXNObject itself)
|
---|
81 | {
|
---|
82 | TXNObjectObject *it;
|
---|
83 | if (itself == NULL) return PyMac_Error(resNotFound);
|
---|
84 | it = PyObject_NEW(TXNObjectObject, &TXNObject_Type);
|
---|
85 | if (it == NULL) return NULL;
|
---|
86 | it->ob_itself = itself;
|
---|
87 | return (PyObject *)it;
|
---|
88 | }
|
---|
89 |
|
---|
90 | int TXNObj_Convert(PyObject *v, TXNObject *p_itself)
|
---|
91 | {
|
---|
92 | if (!TXNObj_Check(v))
|
---|
93 | {
|
---|
94 | PyErr_SetString(PyExc_TypeError, "TXNObject required");
|
---|
95 | return 0;
|
---|
96 | }
|
---|
97 | *p_itself = ((TXNObjectObject *)v)->ob_itself;
|
---|
98 | return 1;
|
---|
99 | }
|
---|
100 |
|
---|
101 | static void TXNObj_dealloc(TXNObjectObject *self)
|
---|
102 | {
|
---|
103 | /* Cleanup of self->ob_itself goes here */
|
---|
104 | self->ob_type->tp_free((PyObject *)self);
|
---|
105 | }
|
---|
106 |
|
---|
107 | static PyObject *TXNObj_TXNDeleteObject(TXNObjectObject *_self, PyObject *_args)
|
---|
108 | {
|
---|
109 | PyObject *_res = NULL;
|
---|
110 | #ifndef TXNDeleteObject
|
---|
111 | PyMac_PRECHECK(TXNDeleteObject);
|
---|
112 | #endif
|
---|
113 | if (!PyArg_ParseTuple(_args, ""))
|
---|
114 | return NULL;
|
---|
115 | TXNDeleteObject(_self->ob_itself);
|
---|
116 | Py_INCREF(Py_None);
|
---|
117 | _res = Py_None;
|
---|
118 | return _res;
|
---|
119 | }
|
---|
120 |
|
---|
121 | static PyObject *TXNObj_TXNResizeFrame(TXNObjectObject *_self, PyObject *_args)
|
---|
122 | {
|
---|
123 | PyObject *_res = NULL;
|
---|
124 | UInt32 iWidth;
|
---|
125 | UInt32 iHeight;
|
---|
126 | TXNFrameID iTXNFrameID;
|
---|
127 | #ifndef TXNResizeFrame
|
---|
128 | PyMac_PRECHECK(TXNResizeFrame);
|
---|
129 | #endif
|
---|
130 | if (!PyArg_ParseTuple(_args, "lll",
|
---|
131 | &iWidth,
|
---|
132 | &iHeight,
|
---|
133 | &iTXNFrameID))
|
---|
134 | return NULL;
|
---|
135 | TXNResizeFrame(_self->ob_itself,
|
---|
136 | iWidth,
|
---|
137 | iHeight,
|
---|
138 | iTXNFrameID);
|
---|
139 | Py_INCREF(Py_None);
|
---|
140 | _res = Py_None;
|
---|
141 | return _res;
|
---|
142 | }
|
---|
143 |
|
---|
144 | static PyObject *TXNObj_TXNSetFrameBounds(TXNObjectObject *_self, PyObject *_args)
|
---|
145 | {
|
---|
146 | PyObject *_res = NULL;
|
---|
147 | SInt32 iTop;
|
---|
148 | SInt32 iLeft;
|
---|
149 | SInt32 iBottom;
|
---|
150 | SInt32 iRight;
|
---|
151 | TXNFrameID iTXNFrameID;
|
---|
152 | #ifndef TXNSetFrameBounds
|
---|
153 | PyMac_PRECHECK(TXNSetFrameBounds);
|
---|
154 | #endif
|
---|
155 | if (!PyArg_ParseTuple(_args, "lllll",
|
---|
156 | &iTop,
|
---|
157 | &iLeft,
|
---|
158 | &iBottom,
|
---|
159 | &iRight,
|
---|
160 | &iTXNFrameID))
|
---|
161 | return NULL;
|
---|
162 | TXNSetFrameBounds(_self->ob_itself,
|
---|
163 | iTop,
|
---|
164 | iLeft,
|
---|
165 | iBottom,
|
---|
166 | iRight,
|
---|
167 | iTXNFrameID);
|
---|
168 | Py_INCREF(Py_None);
|
---|
169 | _res = Py_None;
|
---|
170 | return _res;
|
---|
171 | }
|
---|
172 |
|
---|
173 | static PyObject *TXNObj_TXNKeyDown(TXNObjectObject *_self, PyObject *_args)
|
---|
174 | {
|
---|
175 | PyObject *_res = NULL;
|
---|
176 | EventRecord iEvent;
|
---|
177 | #ifndef TXNKeyDown
|
---|
178 | PyMac_PRECHECK(TXNKeyDown);
|
---|
179 | #endif
|
---|
180 | if (!PyArg_ParseTuple(_args, "O&",
|
---|
181 | PyMac_GetEventRecord, &iEvent))
|
---|
182 | return NULL;
|
---|
183 | TXNKeyDown(_self->ob_itself,
|
---|
184 | &iEvent);
|
---|
185 | Py_INCREF(Py_None);
|
---|
186 | _res = Py_None;
|
---|
187 | return _res;
|
---|
188 | }
|
---|
189 |
|
---|
190 | static PyObject *TXNObj_TXNAdjustCursor(TXNObjectObject *_self, PyObject *_args)
|
---|
191 | {
|
---|
192 | PyObject *_res = NULL;
|
---|
193 | RgnHandle ioCursorRgn;
|
---|
194 | #ifndef TXNAdjustCursor
|
---|
195 | PyMac_PRECHECK(TXNAdjustCursor);
|
---|
196 | #endif
|
---|
197 | if (!PyArg_ParseTuple(_args, "O&",
|
---|
198 | OptResObj_Convert, &ioCursorRgn))
|
---|
199 | return NULL;
|
---|
200 | TXNAdjustCursor(_self->ob_itself,
|
---|
201 | ioCursorRgn);
|
---|
202 | Py_INCREF(Py_None);
|
---|
203 | _res = Py_None;
|
---|
204 | return _res;
|
---|
205 | }
|
---|
206 |
|
---|
207 | static PyObject *TXNObj_TXNClick(TXNObjectObject *_self, PyObject *_args)
|
---|
208 | {
|
---|
209 | PyObject *_res = NULL;
|
---|
210 | EventRecord iEvent;
|
---|
211 | #ifndef TXNClick
|
---|
212 | PyMac_PRECHECK(TXNClick);
|
---|
213 | #endif
|
---|
214 | if (!PyArg_ParseTuple(_args, "O&",
|
---|
215 | PyMac_GetEventRecord, &iEvent))
|
---|
216 | return NULL;
|
---|
217 | TXNClick(_self->ob_itself,
|
---|
218 | &iEvent);
|
---|
219 | Py_INCREF(Py_None);
|
---|
220 | _res = Py_None;
|
---|
221 | return _res;
|
---|
222 | }
|
---|
223 |
|
---|
224 | static PyObject *TXNObj_TXNSelectAll(TXNObjectObject *_self, PyObject *_args)
|
---|
225 | {
|
---|
226 | PyObject *_res = NULL;
|
---|
227 | #ifndef TXNSelectAll
|
---|
228 | PyMac_PRECHECK(TXNSelectAll);
|
---|
229 | #endif
|
---|
230 | if (!PyArg_ParseTuple(_args, ""))
|
---|
231 | return NULL;
|
---|
232 | TXNSelectAll(_self->ob_itself);
|
---|
233 | Py_INCREF(Py_None);
|
---|
234 | _res = Py_None;
|
---|
235 | return _res;
|
---|
236 | }
|
---|
237 |
|
---|
238 | static PyObject *TXNObj_TXNFocus(TXNObjectObject *_self, PyObject *_args)
|
---|
239 | {
|
---|
240 | PyObject *_res = NULL;
|
---|
241 | Boolean iBecomingFocused;
|
---|
242 | #ifndef TXNFocus
|
---|
243 | PyMac_PRECHECK(TXNFocus);
|
---|
244 | #endif
|
---|
245 | if (!PyArg_ParseTuple(_args, "b",
|
---|
246 | &iBecomingFocused))
|
---|
247 | return NULL;
|
---|
248 | TXNFocus(_self->ob_itself,
|
---|
249 | iBecomingFocused);
|
---|
250 | Py_INCREF(Py_None);
|
---|
251 | _res = Py_None;
|
---|
252 | return _res;
|
---|
253 | }
|
---|
254 |
|
---|
255 | static PyObject *TXNObj_TXNUpdate(TXNObjectObject *_self, PyObject *_args)
|
---|
256 | {
|
---|
257 | PyObject *_res = NULL;
|
---|
258 | #ifndef TXNUpdate
|
---|
259 | PyMac_PRECHECK(TXNUpdate);
|
---|
260 | #endif
|
---|
261 | if (!PyArg_ParseTuple(_args, ""))
|
---|
262 | return NULL;
|
---|
263 | TXNUpdate(_self->ob_itself);
|
---|
264 | Py_INCREF(Py_None);
|
---|
265 | _res = Py_None;
|
---|
266 | return _res;
|
---|
267 | }
|
---|
268 |
|
---|
269 | static PyObject *TXNObj_TXNDraw(TXNObjectObject *_self, PyObject *_args)
|
---|
270 | {
|
---|
271 | PyObject *_res = NULL;
|
---|
272 | GWorldPtr iDrawPort;
|
---|
273 | #ifndef TXNDraw
|
---|
274 | PyMac_PRECHECK(TXNDraw);
|
---|
275 | #endif
|
---|
276 | if (!PyArg_ParseTuple(_args, "O&",
|
---|
277 | OptGWorldObj_Convert, &iDrawPort))
|
---|
278 | return NULL;
|
---|
279 | TXNDraw(_self->ob_itself,
|
---|
280 | iDrawPort);
|
---|
281 | Py_INCREF(Py_None);
|
---|
282 | _res = Py_None;
|
---|
283 | return _res;
|
---|
284 | }
|
---|
285 |
|
---|
286 | static PyObject *TXNObj_TXNForceUpdate(TXNObjectObject *_self, PyObject *_args)
|
---|
287 | {
|
---|
288 | PyObject *_res = NULL;
|
---|
289 | #ifndef TXNForceUpdate
|
---|
290 | PyMac_PRECHECK(TXNForceUpdate);
|
---|
291 | #endif
|
---|
292 | if (!PyArg_ParseTuple(_args, ""))
|
---|
293 | return NULL;
|
---|
294 | TXNForceUpdate(_self->ob_itself);
|
---|
295 | Py_INCREF(Py_None);
|
---|
296 | _res = Py_None;
|
---|
297 | return _res;
|
---|
298 | }
|
---|
299 |
|
---|
300 | static PyObject *TXNObj_TXNGetSleepTicks(TXNObjectObject *_self, PyObject *_args)
|
---|
301 | {
|
---|
302 | PyObject *_res = NULL;
|
---|
303 | UInt32 _rv;
|
---|
304 | #ifndef TXNGetSleepTicks
|
---|
305 | PyMac_PRECHECK(TXNGetSleepTicks);
|
---|
306 | #endif
|
---|
307 | if (!PyArg_ParseTuple(_args, ""))
|
---|
308 | return NULL;
|
---|
309 | _rv = TXNGetSleepTicks(_self->ob_itself);
|
---|
310 | _res = Py_BuildValue("l",
|
---|
311 | _rv);
|
---|
312 | return _res;
|
---|
313 | }
|
---|
314 |
|
---|
315 | static PyObject *TXNObj_TXNIdle(TXNObjectObject *_self, PyObject *_args)
|
---|
316 | {
|
---|
317 | PyObject *_res = NULL;
|
---|
318 | #ifndef TXNIdle
|
---|
319 | PyMac_PRECHECK(TXNIdle);
|
---|
320 | #endif
|
---|
321 | if (!PyArg_ParseTuple(_args, ""))
|
---|
322 | return NULL;
|
---|
323 | TXNIdle(_self->ob_itself);
|
---|
324 | Py_INCREF(Py_None);
|
---|
325 | _res = Py_None;
|
---|
326 | return _res;
|
---|
327 | }
|
---|
328 |
|
---|
329 | static PyObject *TXNObj_TXNGrowWindow(TXNObjectObject *_self, PyObject *_args)
|
---|
330 | {
|
---|
331 | PyObject *_res = NULL;
|
---|
332 | EventRecord iEvent;
|
---|
333 | #ifndef TXNGrowWindow
|
---|
334 | PyMac_PRECHECK(TXNGrowWindow);
|
---|
335 | #endif
|
---|
336 | if (!PyArg_ParseTuple(_args, "O&",
|
---|
337 | PyMac_GetEventRecord, &iEvent))
|
---|
338 | return NULL;
|
---|
339 | TXNGrowWindow(_self->ob_itself,
|
---|
340 | &iEvent);
|
---|
341 | Py_INCREF(Py_None);
|
---|
342 | _res = Py_None;
|
---|
343 | return _res;
|
---|
344 | }
|
---|
345 |
|
---|
346 | static PyObject *TXNObj_TXNZoomWindow(TXNObjectObject *_self, PyObject *_args)
|
---|
347 | {
|
---|
348 | PyObject *_res = NULL;
|
---|
349 | SInt16 iPart;
|
---|
350 | #ifndef TXNZoomWindow
|
---|
351 | PyMac_PRECHECK(TXNZoomWindow);
|
---|
352 | #endif
|
---|
353 | if (!PyArg_ParseTuple(_args, "h",
|
---|
354 | &iPart))
|
---|
355 | return NULL;
|
---|
356 | TXNZoomWindow(_self->ob_itself,
|
---|
357 | iPart);
|
---|
358 | Py_INCREF(Py_None);
|
---|
359 | _res = Py_None;
|
---|
360 | return _res;
|
---|
361 | }
|
---|
362 |
|
---|
363 | static PyObject *TXNObj_TXNCanUndo(TXNObjectObject *_self, PyObject *_args)
|
---|
364 | {
|
---|
365 | PyObject *_res = NULL;
|
---|
366 | Boolean _rv;
|
---|
367 | TXNActionKey oTXNActionKey;
|
---|
368 | #ifndef TXNCanUndo
|
---|
369 | PyMac_PRECHECK(TXNCanUndo);
|
---|
370 | #endif
|
---|
371 | if (!PyArg_ParseTuple(_args, ""))
|
---|
372 | return NULL;
|
---|
373 | _rv = TXNCanUndo(_self->ob_itself,
|
---|
374 | &oTXNActionKey);
|
---|
375 | _res = Py_BuildValue("bl",
|
---|
376 | _rv,
|
---|
377 | oTXNActionKey);
|
---|
378 | return _res;
|
---|
379 | }
|
---|
380 |
|
---|
381 | static PyObject *TXNObj_TXNUndo(TXNObjectObject *_self, PyObject *_args)
|
---|
382 | {
|
---|
383 | PyObject *_res = NULL;
|
---|
384 | #ifndef TXNUndo
|
---|
385 | PyMac_PRECHECK(TXNUndo);
|
---|
386 | #endif
|
---|
387 | if (!PyArg_ParseTuple(_args, ""))
|
---|
388 | return NULL;
|
---|
389 | TXNUndo(_self->ob_itself);
|
---|
390 | Py_INCREF(Py_None);
|
---|
391 | _res = Py_None;
|
---|
392 | return _res;
|
---|
393 | }
|
---|
394 |
|
---|
395 | static PyObject *TXNObj_TXNCanRedo(TXNObjectObject *_self, PyObject *_args)
|
---|
396 | {
|
---|
397 | PyObject *_res = NULL;
|
---|
398 | Boolean _rv;
|
---|
399 | TXNActionKey oTXNActionKey;
|
---|
400 | #ifndef TXNCanRedo
|
---|
401 | PyMac_PRECHECK(TXNCanRedo);
|
---|
402 | #endif
|
---|
403 | if (!PyArg_ParseTuple(_args, ""))
|
---|
404 | return NULL;
|
---|
405 | _rv = TXNCanRedo(_self->ob_itself,
|
---|
406 | &oTXNActionKey);
|
---|
407 | _res = Py_BuildValue("bl",
|
---|
408 | _rv,
|
---|
409 | oTXNActionKey);
|
---|
410 | return _res;
|
---|
411 | }
|
---|
412 |
|
---|
413 | static PyObject *TXNObj_TXNRedo(TXNObjectObject *_self, PyObject *_args)
|
---|
414 | {
|
---|
415 | PyObject *_res = NULL;
|
---|
416 | #ifndef TXNRedo
|
---|
417 | PyMac_PRECHECK(TXNRedo);
|
---|
418 | #endif
|
---|
419 | if (!PyArg_ParseTuple(_args, ""))
|
---|
420 | return NULL;
|
---|
421 | TXNRedo(_self->ob_itself);
|
---|
422 | Py_INCREF(Py_None);
|
---|
423 | _res = Py_None;
|
---|
424 | return _res;
|
---|
425 | }
|
---|
426 |
|
---|
427 | static PyObject *TXNObj_TXNCut(TXNObjectObject *_self, PyObject *_args)
|
---|
428 | {
|
---|
429 | PyObject *_res = NULL;
|
---|
430 | OSStatus _err;
|
---|
431 | #ifndef TXNCut
|
---|
432 | PyMac_PRECHECK(TXNCut);
|
---|
433 | #endif
|
---|
434 | if (!PyArg_ParseTuple(_args, ""))
|
---|
435 | return NULL;
|
---|
436 | _err = TXNCut(_self->ob_itself);
|
---|
437 | if (_err != noErr) return PyMac_Error(_err);
|
---|
438 | Py_INCREF(Py_None);
|
---|
439 | _res = Py_None;
|
---|
440 | return _res;
|
---|
441 | }
|
---|
442 |
|
---|
443 | static PyObject *TXNObj_TXNCopy(TXNObjectObject *_self, PyObject *_args)
|
---|
444 | {
|
---|
445 | PyObject *_res = NULL;
|
---|
446 | OSStatus _err;
|
---|
447 | #ifndef TXNCopy
|
---|
448 | PyMac_PRECHECK(TXNCopy);
|
---|
449 | #endif
|
---|
450 | if (!PyArg_ParseTuple(_args, ""))
|
---|
451 | return NULL;
|
---|
452 | _err = TXNCopy(_self->ob_itself);
|
---|
453 | if (_err != noErr) return PyMac_Error(_err);
|
---|
454 | Py_INCREF(Py_None);
|
---|
455 | _res = Py_None;
|
---|
456 | return _res;
|
---|
457 | }
|
---|
458 |
|
---|
459 | static PyObject *TXNObj_TXNPaste(TXNObjectObject *_self, PyObject *_args)
|
---|
460 | {
|
---|
461 | PyObject *_res = NULL;
|
---|
462 | OSStatus _err;
|
---|
463 | #ifndef TXNPaste
|
---|
464 | PyMac_PRECHECK(TXNPaste);
|
---|
465 | #endif
|
---|
466 | if (!PyArg_ParseTuple(_args, ""))
|
---|
467 | return NULL;
|
---|
468 | _err = TXNPaste(_self->ob_itself);
|
---|
469 | if (_err != noErr) return PyMac_Error(_err);
|
---|
470 | Py_INCREF(Py_None);
|
---|
471 | _res = Py_None;
|
---|
472 | return _res;
|
---|
473 | }
|
---|
474 |
|
---|
475 | static PyObject *TXNObj_TXNClear(TXNObjectObject *_self, PyObject *_args)
|
---|
476 | {
|
---|
477 | PyObject *_res = NULL;
|
---|
478 | OSStatus _err;
|
---|
479 | #ifndef TXNClear
|
---|
480 | PyMac_PRECHECK(TXNClear);
|
---|
481 | #endif
|
---|
482 | if (!PyArg_ParseTuple(_args, ""))
|
---|
483 | return NULL;
|
---|
484 | _err = TXNClear(_self->ob_itself);
|
---|
485 | if (_err != noErr) return PyMac_Error(_err);
|
---|
486 | Py_INCREF(Py_None);
|
---|
487 | _res = Py_None;
|
---|
488 | return _res;
|
---|
489 | }
|
---|
490 |
|
---|
491 | static PyObject *TXNObj_TXNGetSelection(TXNObjectObject *_self, PyObject *_args)
|
---|
492 | {
|
---|
493 | PyObject *_res = NULL;
|
---|
494 | TXNOffset oStartOffset;
|
---|
495 | TXNOffset oEndOffset;
|
---|
496 | #ifndef TXNGetSelection
|
---|
497 | PyMac_PRECHECK(TXNGetSelection);
|
---|
498 | #endif
|
---|
499 | if (!PyArg_ParseTuple(_args, ""))
|
---|
500 | return NULL;
|
---|
501 | TXNGetSelection(_self->ob_itself,
|
---|
502 | &oStartOffset,
|
---|
503 | &oEndOffset);
|
---|
504 | _res = Py_BuildValue("ll",
|
---|
505 | oStartOffset,
|
---|
506 | oEndOffset);
|
---|
507 | return _res;
|
---|
508 | }
|
---|
509 |
|
---|
510 | static PyObject *TXNObj_TXNShowSelection(TXNObjectObject *_self, PyObject *_args)
|
---|
511 | {
|
---|
512 | PyObject *_res = NULL;
|
---|
513 | Boolean iShowEnd;
|
---|
514 | #ifndef TXNShowSelection
|
---|
515 | PyMac_PRECHECK(TXNShowSelection);
|
---|
516 | #endif
|
---|
517 | if (!PyArg_ParseTuple(_args, "b",
|
---|
518 | &iShowEnd))
|
---|
519 | return NULL;
|
---|
520 | TXNShowSelection(_self->ob_itself,
|
---|
521 | iShowEnd);
|
---|
522 | Py_INCREF(Py_None);
|
---|
523 | _res = Py_None;
|
---|
524 | return _res;
|
---|
525 | }
|
---|
526 |
|
---|
527 | static PyObject *TXNObj_TXNIsSelectionEmpty(TXNObjectObject *_self, PyObject *_args)
|
---|
528 | {
|
---|
529 | PyObject *_res = NULL;
|
---|
530 | Boolean _rv;
|
---|
531 | #ifndef TXNIsSelectionEmpty
|
---|
532 | PyMac_PRECHECK(TXNIsSelectionEmpty);
|
---|
533 | #endif
|
---|
534 | if (!PyArg_ParseTuple(_args, ""))
|
---|
535 | return NULL;
|
---|
536 | _rv = TXNIsSelectionEmpty(_self->ob_itself);
|
---|
537 | _res = Py_BuildValue("b",
|
---|
538 | _rv);
|
---|
539 | return _res;
|
---|
540 | }
|
---|
541 |
|
---|
542 | static PyObject *TXNObj_TXNSetSelection(TXNObjectObject *_self, PyObject *_args)
|
---|
543 | {
|
---|
544 | PyObject *_res = NULL;
|
---|
545 | OSStatus _err;
|
---|
546 | TXNOffset iStartOffset;
|
---|
547 | TXNOffset iEndOffset;
|
---|
548 | #ifndef TXNSetSelection
|
---|
549 | PyMac_PRECHECK(TXNSetSelection);
|
---|
550 | #endif
|
---|
551 | if (!PyArg_ParseTuple(_args, "ll",
|
---|
552 | &iStartOffset,
|
---|
553 | &iEndOffset))
|
---|
554 | return NULL;
|
---|
555 | _err = TXNSetSelection(_self->ob_itself,
|
---|
556 | iStartOffset,
|
---|
557 | iEndOffset);
|
---|
558 | if (_err != noErr) return PyMac_Error(_err);
|
---|
559 | Py_INCREF(Py_None);
|
---|
560 | _res = Py_None;
|
---|
561 | return _res;
|
---|
562 | }
|
---|
563 |
|
---|
564 | static PyObject *TXNObj_TXNCountRunsInRange(TXNObjectObject *_self, PyObject *_args)
|
---|
565 | {
|
---|
566 | PyObject *_res = NULL;
|
---|
567 | OSStatus _err;
|
---|
568 | TXNOffset iStartOffset;
|
---|
569 | TXNOffset iEndOffset;
|
---|
570 | ItemCount oRunCount;
|
---|
571 | #ifndef TXNCountRunsInRange
|
---|
572 | PyMac_PRECHECK(TXNCountRunsInRange);
|
---|
573 | #endif
|
---|
574 | if (!PyArg_ParseTuple(_args, "ll",
|
---|
575 | &iStartOffset,
|
---|
576 | &iEndOffset))
|
---|
577 | return NULL;
|
---|
578 | _err = TXNCountRunsInRange(_self->ob_itself,
|
---|
579 | iStartOffset,
|
---|
580 | iEndOffset,
|
---|
581 | &oRunCount);
|
---|
582 | if (_err != noErr) return PyMac_Error(_err);
|
---|
583 | _res = Py_BuildValue("l",
|
---|
584 | oRunCount);
|
---|
585 | return _res;
|
---|
586 | }
|
---|
587 |
|
---|
588 | static PyObject *TXNObj_TXNDataSize(TXNObjectObject *_self, PyObject *_args)
|
---|
589 | {
|
---|
590 | PyObject *_res = NULL;
|
---|
591 | ByteCount _rv;
|
---|
592 | #ifndef TXNDataSize
|
---|
593 | PyMac_PRECHECK(TXNDataSize);
|
---|
594 | #endif
|
---|
595 | if (!PyArg_ParseTuple(_args, ""))
|
---|
596 | return NULL;
|
---|
597 | _rv = TXNDataSize(_self->ob_itself);
|
---|
598 | _res = Py_BuildValue("l",
|
---|
599 | _rv);
|
---|
600 | return _res;
|
---|
601 | }
|
---|
602 |
|
---|
603 | static PyObject *TXNObj_TXNGetData(TXNObjectObject *_self, PyObject *_args)
|
---|
604 | {
|
---|
605 | PyObject *_res = NULL;
|
---|
606 | OSStatus _err;
|
---|
607 | TXNOffset iStartOffset;
|
---|
608 | TXNOffset iEndOffset;
|
---|
609 | Handle oDataHandle;
|
---|
610 | #ifndef TXNGetData
|
---|
611 | PyMac_PRECHECK(TXNGetData);
|
---|
612 | #endif
|
---|
613 | if (!PyArg_ParseTuple(_args, "ll",
|
---|
614 | &iStartOffset,
|
---|
615 | &iEndOffset))
|
---|
616 | return NULL;
|
---|
617 | _err = TXNGetData(_self->ob_itself,
|
---|
618 | iStartOffset,
|
---|
619 | iEndOffset,
|
---|
620 | &oDataHandle);
|
---|
621 | if (_err != noErr) return PyMac_Error(_err);
|
---|
622 | _res = Py_BuildValue("O&",
|
---|
623 | ResObj_New, oDataHandle);
|
---|
624 | return _res;
|
---|
625 | }
|
---|
626 |
|
---|
627 | static PyObject *TXNObj_TXNGetDataEncoded(TXNObjectObject *_self, PyObject *_args)
|
---|
628 | {
|
---|
629 | PyObject *_res = NULL;
|
---|
630 | OSStatus _err;
|
---|
631 | TXNOffset iStartOffset;
|
---|
632 | TXNOffset iEndOffset;
|
---|
633 | Handle oDataHandle;
|
---|
634 | TXNDataType iEncoding;
|
---|
635 | #ifndef TXNGetDataEncoded
|
---|
636 | PyMac_PRECHECK(TXNGetDataEncoded);
|
---|
637 | #endif
|
---|
638 | if (!PyArg_ParseTuple(_args, "llO&",
|
---|
639 | &iStartOffset,
|
---|
640 | &iEndOffset,
|
---|
641 | PyMac_GetOSType, &iEncoding))
|
---|
642 | return NULL;
|
---|
643 | _err = TXNGetDataEncoded(_self->ob_itself,
|
---|
644 | iStartOffset,
|
---|
645 | iEndOffset,
|
---|
646 | &oDataHandle,
|
---|
647 | iEncoding);
|
---|
648 | if (_err != noErr) return PyMac_Error(_err);
|
---|
649 | _res = Py_BuildValue("O&",
|
---|
650 | ResObj_New, oDataHandle);
|
---|
651 | return _res;
|
---|
652 | }
|
---|
653 |
|
---|
654 | static PyObject *TXNObj_TXNSetDataFromFile(TXNObjectObject *_self, PyObject *_args)
|
---|
655 | {
|
---|
656 | PyObject *_res = NULL;
|
---|
657 | OSStatus _err;
|
---|
658 | SInt16 iFileRefNum;
|
---|
659 | OSType iFileType;
|
---|
660 | ByteCount iFileLength;
|
---|
661 | TXNOffset iStartOffset;
|
---|
662 | TXNOffset iEndOffset;
|
---|
663 | #ifndef TXNSetDataFromFile
|
---|
664 | PyMac_PRECHECK(TXNSetDataFromFile);
|
---|
665 | #endif
|
---|
666 | if (!PyArg_ParseTuple(_args, "hO&lll",
|
---|
667 | &iFileRefNum,
|
---|
668 | PyMac_GetOSType, &iFileType,
|
---|
669 | &iFileLength,
|
---|
670 | &iStartOffset,
|
---|
671 | &iEndOffset))
|
---|
672 | return NULL;
|
---|
673 | _err = TXNSetDataFromFile(_self->ob_itself,
|
---|
674 | iFileRefNum,
|
---|
675 | iFileType,
|
---|
676 | iFileLength,
|
---|
677 | iStartOffset,
|
---|
678 | iEndOffset);
|
---|
679 | if (_err != noErr) return PyMac_Error(_err);
|
---|
680 | Py_INCREF(Py_None);
|
---|
681 | _res = Py_None;
|
---|
682 | return _res;
|
---|
683 | }
|
---|
684 |
|
---|
685 | static PyObject *TXNObj_TXNGetChangeCount(TXNObjectObject *_self, PyObject *_args)
|
---|
686 | {
|
---|
687 | PyObject *_res = NULL;
|
---|
688 | ItemCount _rv;
|
---|
689 | #ifndef TXNGetChangeCount
|
---|
690 | PyMac_PRECHECK(TXNGetChangeCount);
|
---|
691 | #endif
|
---|
692 | if (!PyArg_ParseTuple(_args, ""))
|
---|
693 | return NULL;
|
---|
694 | _rv = TXNGetChangeCount(_self->ob_itself);
|
---|
695 | _res = Py_BuildValue("l",
|
---|
696 | _rv);
|
---|
697 | return _res;
|
---|
698 | }
|
---|
699 |
|
---|
700 | static PyObject *TXNObj_TXNSave(TXNObjectObject *_self, PyObject *_args)
|
---|
701 | {
|
---|
702 | PyObject *_res = NULL;
|
---|
703 | OSStatus _err;
|
---|
704 | TXNFileType iType;
|
---|
705 | OSType iResType;
|
---|
706 | TXNPermanentTextEncodingType iPermanentEncoding;
|
---|
707 | FSSpec iFileSpecification;
|
---|
708 | SInt16 iDataReference;
|
---|
709 | SInt16 iResourceReference;
|
---|
710 | #ifndef TXNSave
|
---|
711 | PyMac_PRECHECK(TXNSave);
|
---|
712 | #endif
|
---|
713 | if (!PyArg_ParseTuple(_args, "O&O&lO&hh",
|
---|
714 | PyMac_GetOSType, &iType,
|
---|
715 | PyMac_GetOSType, &iResType,
|
---|
716 | &iPermanentEncoding,
|
---|
717 | PyMac_GetFSSpec, &iFileSpecification,
|
---|
718 | &iDataReference,
|
---|
719 | &iResourceReference))
|
---|
720 | return NULL;
|
---|
721 | _err = TXNSave(_self->ob_itself,
|
---|
722 | iType,
|
---|
723 | iResType,
|
---|
724 | iPermanentEncoding,
|
---|
725 | &iFileSpecification,
|
---|
726 | iDataReference,
|
---|
727 | iResourceReference);
|
---|
728 | if (_err != noErr) return PyMac_Error(_err);
|
---|
729 | Py_INCREF(Py_None);
|
---|
730 | _res = Py_None;
|
---|
731 | return _res;
|
---|
732 | }
|
---|
733 |
|
---|
734 | static PyObject *TXNObj_TXNRevert(TXNObjectObject *_self, PyObject *_args)
|
---|
735 | {
|
---|
736 | PyObject *_res = NULL;
|
---|
737 | OSStatus _err;
|
---|
738 | #ifndef TXNRevert
|
---|
739 | PyMac_PRECHECK(TXNRevert);
|
---|
740 | #endif
|
---|
741 | if (!PyArg_ParseTuple(_args, ""))
|
---|
742 | return NULL;
|
---|
743 | _err = TXNRevert(_self->ob_itself);
|
---|
744 | if (_err != noErr) return PyMac_Error(_err);
|
---|
745 | Py_INCREF(Py_None);
|
---|
746 | _res = Py_None;
|
---|
747 | return _res;
|
---|
748 | }
|
---|
749 |
|
---|
750 | static PyObject *TXNObj_TXNPageSetup(TXNObjectObject *_self, PyObject *_args)
|
---|
751 | {
|
---|
752 | PyObject *_res = NULL;
|
---|
753 | OSStatus _err;
|
---|
754 | #ifndef TXNPageSetup
|
---|
755 | PyMac_PRECHECK(TXNPageSetup);
|
---|
756 | #endif
|
---|
757 | if (!PyArg_ParseTuple(_args, ""))
|
---|
758 | return NULL;
|
---|
759 | _err = TXNPageSetup(_self->ob_itself);
|
---|
760 | if (_err != noErr) return PyMac_Error(_err);
|
---|
761 | Py_INCREF(Py_None);
|
---|
762 | _res = Py_None;
|
---|
763 | return _res;
|
---|
764 | }
|
---|
765 |
|
---|
766 | static PyObject *TXNObj_TXNPrint(TXNObjectObject *_self, PyObject *_args)
|
---|
767 | {
|
---|
768 | PyObject *_res = NULL;
|
---|
769 | OSStatus _err;
|
---|
770 | #ifndef TXNPrint
|
---|
771 | PyMac_PRECHECK(TXNPrint);
|
---|
772 | #endif
|
---|
773 | if (!PyArg_ParseTuple(_args, ""))
|
---|
774 | return NULL;
|
---|
775 | _err = TXNPrint(_self->ob_itself);
|
---|
776 | if (_err != noErr) return PyMac_Error(_err);
|
---|
777 | Py_INCREF(Py_None);
|
---|
778 | _res = Py_None;
|
---|
779 | return _res;
|
---|
780 | }
|
---|
781 |
|
---|
782 | static PyObject *TXNObj_TXNGetViewRect(TXNObjectObject *_self, PyObject *_args)
|
---|
783 | {
|
---|
784 | PyObject *_res = NULL;
|
---|
785 | Rect oViewRect;
|
---|
786 | #ifndef TXNGetViewRect
|
---|
787 | PyMac_PRECHECK(TXNGetViewRect);
|
---|
788 | #endif
|
---|
789 | if (!PyArg_ParseTuple(_args, ""))
|
---|
790 | return NULL;
|
---|
791 | TXNGetViewRect(_self->ob_itself,
|
---|
792 | &oViewRect);
|
---|
793 | _res = Py_BuildValue("O&",
|
---|
794 | PyMac_BuildRect, &oViewRect);
|
---|
795 | return _res;
|
---|
796 | }
|
---|
797 |
|
---|
798 | static PyObject *TXNObj_TXNSetViewRect(TXNObjectObject *_self, PyObject *_args)
|
---|
799 | {
|
---|
800 | PyObject *_res = NULL;
|
---|
801 | Rect iViewRect;
|
---|
802 | #ifndef TXNSetViewRect
|
---|
803 | PyMac_PRECHECK(TXNSetViewRect);
|
---|
804 | #endif
|
---|
805 | if (!PyArg_ParseTuple(_args, "O&",
|
---|
806 | PyMac_GetRect, &iViewRect))
|
---|
807 | return NULL;
|
---|
808 | TXNSetViewRect(_self->ob_itself,
|
---|
809 | &iViewRect);
|
---|
810 | Py_INCREF(Py_None);
|
---|
811 | _res = Py_None;
|
---|
812 | return _res;
|
---|
813 | }
|
---|
814 |
|
---|
815 | static PyObject *TXNObj_TXNAttachObjectToWindow(TXNObjectObject *_self, PyObject *_args)
|
---|
816 | {
|
---|
817 | PyObject *_res = NULL;
|
---|
818 | OSStatus _err;
|
---|
819 | GWorldPtr iWindow;
|
---|
820 | Boolean iIsActualWindow;
|
---|
821 | #ifndef TXNAttachObjectToWindow
|
---|
822 | PyMac_PRECHECK(TXNAttachObjectToWindow);
|
---|
823 | #endif
|
---|
824 | if (!PyArg_ParseTuple(_args, "O&b",
|
---|
825 | GWorldObj_Convert, &iWindow,
|
---|
826 | &iIsActualWindow))
|
---|
827 | return NULL;
|
---|
828 | _err = TXNAttachObjectToWindow(_self->ob_itself,
|
---|
829 | iWindow,
|
---|
830 | iIsActualWindow);
|
---|
831 | if (_err != noErr) return PyMac_Error(_err);
|
---|
832 | Py_INCREF(Py_None);
|
---|
833 | _res = Py_None;
|
---|
834 | return _res;
|
---|
835 | }
|
---|
836 |
|
---|
837 | static PyObject *TXNObj_TXNIsObjectAttachedToWindow(TXNObjectObject *_self, PyObject *_args)
|
---|
838 | {
|
---|
839 | PyObject *_res = NULL;
|
---|
840 | Boolean _rv;
|
---|
841 | #ifndef TXNIsObjectAttachedToWindow
|
---|
842 | PyMac_PRECHECK(TXNIsObjectAttachedToWindow);
|
---|
843 | #endif
|
---|
844 | if (!PyArg_ParseTuple(_args, ""))
|
---|
845 | return NULL;
|
---|
846 | _rv = TXNIsObjectAttachedToWindow(_self->ob_itself);
|
---|
847 | _res = Py_BuildValue("b",
|
---|
848 | _rv);
|
---|
849 | return _res;
|
---|
850 | }
|
---|
851 |
|
---|
852 | static PyObject *TXNObj_TXNDragTracker(TXNObjectObject *_self, PyObject *_args)
|
---|
853 | {
|
---|
854 | PyObject *_res = NULL;
|
---|
855 | OSErr _err;
|
---|
856 | TXNFrameID iTXNFrameID;
|
---|
857 | DragTrackingMessage iMessage;
|
---|
858 | WindowPtr iWindow;
|
---|
859 | DragReference iDragReference;
|
---|
860 | Boolean iDifferentObjectSameWindow;
|
---|
861 | #ifndef TXNDragTracker
|
---|
862 | PyMac_PRECHECK(TXNDragTracker);
|
---|
863 | #endif
|
---|
864 | if (!PyArg_ParseTuple(_args, "lhO&O&b",
|
---|
865 | &iTXNFrameID,
|
---|
866 | &iMessage,
|
---|
867 | WinObj_Convert, &iWindow,
|
---|
868 | DragObj_Convert, &iDragReference,
|
---|
869 | &iDifferentObjectSameWindow))
|
---|
870 | return NULL;
|
---|
871 | _err = TXNDragTracker(_self->ob_itself,
|
---|
872 | iTXNFrameID,
|
---|
873 | iMessage,
|
---|
874 | iWindow,
|
---|
875 | iDragReference,
|
---|
876 | iDifferentObjectSameWindow);
|
---|
877 | if (_err != noErr) return PyMac_Error(_err);
|
---|
878 | Py_INCREF(Py_None);
|
---|
879 | _res = Py_None;
|
---|
880 | return _res;
|
---|
881 | }
|
---|
882 |
|
---|
883 | static PyObject *TXNObj_TXNDragReceiver(TXNObjectObject *_self, PyObject *_args)
|
---|
884 | {
|
---|
885 | PyObject *_res = NULL;
|
---|
886 | OSErr _err;
|
---|
887 | TXNFrameID iTXNFrameID;
|
---|
888 | WindowPtr iWindow;
|
---|
889 | DragReference iDragReference;
|
---|
890 | Boolean iDifferentObjectSameWindow;
|
---|
891 | #ifndef TXNDragReceiver
|
---|
892 | PyMac_PRECHECK(TXNDragReceiver);
|
---|
893 | #endif
|
---|
894 | if (!PyArg_ParseTuple(_args, "lO&O&b",
|
---|
895 | &iTXNFrameID,
|
---|
896 | WinObj_Convert, &iWindow,
|
---|
897 | DragObj_Convert, &iDragReference,
|
---|
898 | &iDifferentObjectSameWindow))
|
---|
899 | return NULL;
|
---|
900 | _err = TXNDragReceiver(_self->ob_itself,
|
---|
901 | iTXNFrameID,
|
---|
902 | iWindow,
|
---|
903 | iDragReference,
|
---|
904 | iDifferentObjectSameWindow);
|
---|
905 | if (_err != noErr) return PyMac_Error(_err);
|
---|
906 | Py_INCREF(Py_None);
|
---|
907 | _res = Py_None;
|
---|
908 | return _res;
|
---|
909 | }
|
---|
910 |
|
---|
911 | static PyObject *TXNObj_TXNActivate(TXNObjectObject *_self, PyObject *_args)
|
---|
912 | {
|
---|
913 | PyObject *_res = NULL;
|
---|
914 | OSStatus _err;
|
---|
915 | TXNFrameID iTXNFrameID;
|
---|
916 | TXNScrollBarState iActiveState;
|
---|
917 | #ifndef TXNActivate
|
---|
918 | PyMac_PRECHECK(TXNActivate);
|
---|
919 | #endif
|
---|
920 | if (!PyArg_ParseTuple(_args, "ll",
|
---|
921 | &iTXNFrameID,
|
---|
922 | &iActiveState))
|
---|
923 | return NULL;
|
---|
924 | _err = TXNActivate(_self->ob_itself,
|
---|
925 | iTXNFrameID,
|
---|
926 | iActiveState);
|
---|
927 | if (_err != noErr) return PyMac_Error(_err);
|
---|
928 | Py_INCREF(Py_None);
|
---|
929 | _res = Py_None;
|
---|
930 | return _res;
|
---|
931 | }
|
---|
932 |
|
---|
933 | static PyObject *TXNObj_TXNEchoMode(TXNObjectObject *_self, PyObject *_args)
|
---|
934 | {
|
---|
935 | PyObject *_res = NULL;
|
---|
936 | OSStatus _err;
|
---|
937 | UniChar iEchoCharacter;
|
---|
938 | TextEncoding iEncoding;
|
---|
939 | Boolean iOn;
|
---|
940 | #ifndef TXNEchoMode
|
---|
941 | PyMac_PRECHECK(TXNEchoMode);
|
---|
942 | #endif
|
---|
943 | if (!PyArg_ParseTuple(_args, "hlb",
|
---|
944 | &iEchoCharacter,
|
---|
945 | &iEncoding,
|
---|
946 | &iOn))
|
---|
947 | return NULL;
|
---|
948 | _err = TXNEchoMode(_self->ob_itself,
|
---|
949 | iEchoCharacter,
|
---|
950 | iEncoding,
|
---|
951 | iOn);
|
---|
952 | if (_err != noErr) return PyMac_Error(_err);
|
---|
953 | Py_INCREF(Py_None);
|
---|
954 | _res = Py_None;
|
---|
955 | return _res;
|
---|
956 | }
|
---|
957 |
|
---|
958 | static PyObject *TXNObj_TXNDoFontMenuSelection(TXNObjectObject *_self, PyObject *_args)
|
---|
959 | {
|
---|
960 | PyObject *_res = NULL;
|
---|
961 | OSStatus _err;
|
---|
962 | TXNFontMenuObject iTXNFontMenuObject;
|
---|
963 | SInt16 iMenuID;
|
---|
964 | SInt16 iMenuItem;
|
---|
965 | #ifndef TXNDoFontMenuSelection
|
---|
966 | PyMac_PRECHECK(TXNDoFontMenuSelection);
|
---|
967 | #endif
|
---|
968 | if (!PyArg_ParseTuple(_args, "O&hh",
|
---|
969 | TXNFontMenuObj_Convert, &iTXNFontMenuObject,
|
---|
970 | &iMenuID,
|
---|
971 | &iMenuItem))
|
---|
972 | return NULL;
|
---|
973 | _err = TXNDoFontMenuSelection(_self->ob_itself,
|
---|
974 | iTXNFontMenuObject,
|
---|
975 | iMenuID,
|
---|
976 | iMenuItem);
|
---|
977 | if (_err != noErr) return PyMac_Error(_err);
|
---|
978 | Py_INCREF(Py_None);
|
---|
979 | _res = Py_None;
|
---|
980 | return _res;
|
---|
981 | }
|
---|
982 |
|
---|
983 | static PyObject *TXNObj_TXNPrepareFontMenu(TXNObjectObject *_self, PyObject *_args)
|
---|
984 | {
|
---|
985 | PyObject *_res = NULL;
|
---|
986 | OSStatus _err;
|
---|
987 | TXNFontMenuObject iTXNFontMenuObject;
|
---|
988 | #ifndef TXNPrepareFontMenu
|
---|
989 | PyMac_PRECHECK(TXNPrepareFontMenu);
|
---|
990 | #endif
|
---|
991 | if (!PyArg_ParseTuple(_args, "O&",
|
---|
992 | TXNFontMenuObj_Convert, &iTXNFontMenuObject))
|
---|
993 | return NULL;
|
---|
994 | _err = TXNPrepareFontMenu(_self->ob_itself,
|
---|
995 | iTXNFontMenuObject);
|
---|
996 | if (_err != noErr) return PyMac_Error(_err);
|
---|
997 | Py_INCREF(Py_None);
|
---|
998 | _res = Py_None;
|
---|
999 | return _res;
|
---|
1000 | }
|
---|
1001 |
|
---|
1002 | static PyObject *TXNObj_TXNPointToOffset(TXNObjectObject *_self, PyObject *_args)
|
---|
1003 | {
|
---|
1004 | PyObject *_res = NULL;
|
---|
1005 | OSStatus _err;
|
---|
1006 | Point iPoint;
|
---|
1007 | TXNOffset oOffset;
|
---|
1008 | #ifndef TXNPointToOffset
|
---|
1009 | PyMac_PRECHECK(TXNPointToOffset);
|
---|
1010 | #endif
|
---|
1011 | if (!PyArg_ParseTuple(_args, "O&",
|
---|
1012 | PyMac_GetPoint, &iPoint))
|
---|
1013 | return NULL;
|
---|
1014 | _err = TXNPointToOffset(_self->ob_itself,
|
---|
1015 | iPoint,
|
---|
1016 | &oOffset);
|
---|
1017 | if (_err != noErr) return PyMac_Error(_err);
|
---|
1018 | _res = Py_BuildValue("l",
|
---|
1019 | oOffset);
|
---|
1020 | return _res;
|
---|
1021 | }
|
---|
1022 |
|
---|
1023 | static PyObject *TXNObj_TXNOffsetToPoint(TXNObjectObject *_self, PyObject *_args)
|
---|
1024 | {
|
---|
1025 | PyObject *_res = NULL;
|
---|
1026 | OSStatus _err;
|
---|
1027 | TXNOffset iOffset;
|
---|
1028 | Point oPoint;
|
---|
1029 | #ifndef TXNOffsetToPoint
|
---|
1030 | PyMac_PRECHECK(TXNOffsetToPoint);
|
---|
1031 | #endif
|
---|
1032 | if (!PyArg_ParseTuple(_args, "l",
|
---|
1033 | &iOffset))
|
---|
1034 | return NULL;
|
---|
1035 | _err = TXNOffsetToPoint(_self->ob_itself,
|
---|
1036 | iOffset,
|
---|
1037 | &oPoint);
|
---|
1038 | if (_err != noErr) return PyMac_Error(_err);
|
---|
1039 | _res = Py_BuildValue("O&",
|
---|
1040 | PyMac_BuildPoint, oPoint);
|
---|
1041 | return _res;
|
---|
1042 | }
|
---|
1043 |
|
---|
1044 | static PyObject *TXNObj_TXNGetLineCount(TXNObjectObject *_self, PyObject *_args)
|
---|
1045 | {
|
---|
1046 | PyObject *_res = NULL;
|
---|
1047 | OSStatus _err;
|
---|
1048 | ItemCount oLineTotal;
|
---|
1049 | #ifndef TXNGetLineCount
|
---|
1050 | PyMac_PRECHECK(TXNGetLineCount);
|
---|
1051 | #endif
|
---|
1052 | if (!PyArg_ParseTuple(_args, ""))
|
---|
1053 | return NULL;
|
---|
1054 | _err = TXNGetLineCount(_self->ob_itself,
|
---|
1055 | &oLineTotal);
|
---|
1056 | if (_err != noErr) return PyMac_Error(_err);
|
---|
1057 | _res = Py_BuildValue("l",
|
---|
1058 | oLineTotal);
|
---|
1059 | return _res;
|
---|
1060 | }
|
---|
1061 |
|
---|
1062 | static PyObject *TXNObj_TXNGetLineMetrics(TXNObjectObject *_self, PyObject *_args)
|
---|
1063 | {
|
---|
1064 | PyObject *_res = NULL;
|
---|
1065 | OSStatus _err;
|
---|
1066 | UInt32 iLineNumber;
|
---|
1067 | Fixed oLineWidth;
|
---|
1068 | Fixed oLineHeight;
|
---|
1069 | #ifndef TXNGetLineMetrics
|
---|
1070 | PyMac_PRECHECK(TXNGetLineMetrics);
|
---|
1071 | #endif
|
---|
1072 | if (!PyArg_ParseTuple(_args, "l",
|
---|
1073 | &iLineNumber))
|
---|
1074 | return NULL;
|
---|
1075 | _err = TXNGetLineMetrics(_self->ob_itself,
|
---|
1076 | iLineNumber,
|
---|
1077 | &oLineWidth,
|
---|
1078 | &oLineHeight);
|
---|
1079 | if (_err != noErr) return PyMac_Error(_err);
|
---|
1080 | _res = Py_BuildValue("O&O&",
|
---|
1081 | PyMac_BuildFixed, oLineWidth,
|
---|
1082 | PyMac_BuildFixed, oLineHeight);
|
---|
1083 | return _res;
|
---|
1084 | }
|
---|
1085 |
|
---|
1086 | static PyObject *TXNObj_TXNIsObjectAttachedToSpecificWindow(TXNObjectObject *_self, PyObject *_args)
|
---|
1087 | {
|
---|
1088 | PyObject *_res = NULL;
|
---|
1089 | OSStatus _err;
|
---|
1090 | WindowPtr iWindow;
|
---|
1091 | Boolean oAttached;
|
---|
1092 | #ifndef TXNIsObjectAttachedToSpecificWindow
|
---|
1093 | PyMac_PRECHECK(TXNIsObjectAttachedToSpecificWindow);
|
---|
1094 | #endif
|
---|
1095 | if (!PyArg_ParseTuple(_args, "O&",
|
---|
1096 | WinObj_Convert, &iWindow))
|
---|
1097 | return NULL;
|
---|
1098 | _err = TXNIsObjectAttachedToSpecificWindow(_self->ob_itself,
|
---|
1099 | iWindow,
|
---|
1100 | &oAttached);
|
---|
1101 | if (_err != noErr) return PyMac_Error(_err);
|
---|
1102 | _res = Py_BuildValue("b",
|
---|
1103 | oAttached);
|
---|
1104 | return _res;
|
---|
1105 | }
|
---|
1106 |
|
---|
1107 | static PyObject *TXNObj_TXNRecalcTextLayout(TXNObjectObject *_self, PyObject *_args)
|
---|
1108 | {
|
---|
1109 | PyObject *_res = NULL;
|
---|
1110 | #ifndef TXNRecalcTextLayout
|
---|
1111 | PyMac_PRECHECK(TXNRecalcTextLayout);
|
---|
1112 | #endif
|
---|
1113 | if (!PyArg_ParseTuple(_args, ""))
|
---|
1114 | return NULL;
|
---|
1115 | TXNRecalcTextLayout(_self->ob_itself);
|
---|
1116 | Py_INCREF(Py_None);
|
---|
1117 | _res = Py_None;
|
---|
1118 | return _res;
|
---|
1119 | }
|
---|
1120 |
|
---|
1121 | static PyMethodDef TXNObj_methods[] = {
|
---|
1122 | {"TXNDeleteObject", (PyCFunction)TXNObj_TXNDeleteObject, 1,
|
---|
1123 | PyDoc_STR("() -> None")},
|
---|
1124 | {"TXNResizeFrame", (PyCFunction)TXNObj_TXNResizeFrame, 1,
|
---|
1125 | PyDoc_STR("(UInt32 iWidth, UInt32 iHeight, TXNFrameID iTXNFrameID) -> None")},
|
---|
1126 | {"TXNSetFrameBounds", (PyCFunction)TXNObj_TXNSetFrameBounds, 1,
|
---|
1127 | PyDoc_STR("(SInt32 iTop, SInt32 iLeft, SInt32 iBottom, SInt32 iRight, TXNFrameID iTXNFrameID) -> None")},
|
---|
1128 | {"TXNKeyDown", (PyCFunction)TXNObj_TXNKeyDown, 1,
|
---|
1129 | PyDoc_STR("(EventRecord iEvent) -> None")},
|
---|
1130 | {"TXNAdjustCursor", (PyCFunction)TXNObj_TXNAdjustCursor, 1,
|
---|
1131 | PyDoc_STR("(RgnHandle ioCursorRgn) -> None")},
|
---|
1132 | {"TXNClick", (PyCFunction)TXNObj_TXNClick, 1,
|
---|
1133 | PyDoc_STR("(EventRecord iEvent) -> None")},
|
---|
1134 | {"TXNSelectAll", (PyCFunction)TXNObj_TXNSelectAll, 1,
|
---|
1135 | PyDoc_STR("() -> None")},
|
---|
1136 | {"TXNFocus", (PyCFunction)TXNObj_TXNFocus, 1,
|
---|
1137 | PyDoc_STR("(Boolean iBecomingFocused) -> None")},
|
---|
1138 | {"TXNUpdate", (PyCFunction)TXNObj_TXNUpdate, 1,
|
---|
1139 | PyDoc_STR("() -> None")},
|
---|
1140 | {"TXNDraw", (PyCFunction)TXNObj_TXNDraw, 1,
|
---|
1141 | PyDoc_STR("(GWorldPtr iDrawPort) -> None")},
|
---|
1142 | {"TXNForceUpdate", (PyCFunction)TXNObj_TXNForceUpdate, 1,
|
---|
1143 | PyDoc_STR("() -> None")},
|
---|
1144 | {"TXNGetSleepTicks", (PyCFunction)TXNObj_TXNGetSleepTicks, 1,
|
---|
1145 | PyDoc_STR("() -> (UInt32 _rv)")},
|
---|
1146 | {"TXNIdle", (PyCFunction)TXNObj_TXNIdle, 1,
|
---|
1147 | PyDoc_STR("() -> None")},
|
---|
1148 | {"TXNGrowWindow", (PyCFunction)TXNObj_TXNGrowWindow, 1,
|
---|
1149 | PyDoc_STR("(EventRecord iEvent) -> None")},
|
---|
1150 | {"TXNZoomWindow", (PyCFunction)TXNObj_TXNZoomWindow, 1,
|
---|
1151 | PyDoc_STR("(SInt16 iPart) -> None")},
|
---|
1152 | {"TXNCanUndo", (PyCFunction)TXNObj_TXNCanUndo, 1,
|
---|
1153 | PyDoc_STR("() -> (Boolean _rv, TXNActionKey oTXNActionKey)")},
|
---|
1154 | {"TXNUndo", (PyCFunction)TXNObj_TXNUndo, 1,
|
---|
1155 | PyDoc_STR("() -> None")},
|
---|
1156 | {"TXNCanRedo", (PyCFunction)TXNObj_TXNCanRedo, 1,
|
---|
1157 | PyDoc_STR("() -> (Boolean _rv, TXNActionKey oTXNActionKey)")},
|
---|
1158 | {"TXNRedo", (PyCFunction)TXNObj_TXNRedo, 1,
|
---|
1159 | PyDoc_STR("() -> None")},
|
---|
1160 | {"TXNCut", (PyCFunction)TXNObj_TXNCut, 1,
|
---|
1161 | PyDoc_STR("() -> None")},
|
---|
1162 | {"TXNCopy", (PyCFunction)TXNObj_TXNCopy, 1,
|
---|
1163 | PyDoc_STR("() -> None")},
|
---|
1164 | {"TXNPaste", (PyCFunction)TXNObj_TXNPaste, 1,
|
---|
1165 | PyDoc_STR("() -> None")},
|
---|
1166 | {"TXNClear", (PyCFunction)TXNObj_TXNClear, 1,
|
---|
1167 | PyDoc_STR("() -> None")},
|
---|
1168 | {"TXNGetSelection", (PyCFunction)TXNObj_TXNGetSelection, 1,
|
---|
1169 | PyDoc_STR("() -> (TXNOffset oStartOffset, TXNOffset oEndOffset)")},
|
---|
1170 | {"TXNShowSelection", (PyCFunction)TXNObj_TXNShowSelection, 1,
|
---|
1171 | PyDoc_STR("(Boolean iShowEnd) -> None")},
|
---|
1172 | {"TXNIsSelectionEmpty", (PyCFunction)TXNObj_TXNIsSelectionEmpty, 1,
|
---|
1173 | PyDoc_STR("() -> (Boolean _rv)")},
|
---|
1174 | {"TXNSetSelection", (PyCFunction)TXNObj_TXNSetSelection, 1,
|
---|
1175 | PyDoc_STR("(TXNOffset iStartOffset, TXNOffset iEndOffset) -> None")},
|
---|
1176 | {"TXNCountRunsInRange", (PyCFunction)TXNObj_TXNCountRunsInRange, 1,
|
---|
1177 | PyDoc_STR("(TXNOffset iStartOffset, TXNOffset iEndOffset) -> (ItemCount oRunCount)")},
|
---|
1178 | {"TXNDataSize", (PyCFunction)TXNObj_TXNDataSize, 1,
|
---|
1179 | PyDoc_STR("() -> (ByteCount _rv)")},
|
---|
1180 | {"TXNGetData", (PyCFunction)TXNObj_TXNGetData, 1,
|
---|
1181 | PyDoc_STR("(TXNOffset iStartOffset, TXNOffset iEndOffset) -> (Handle oDataHandle)")},
|
---|
1182 | {"TXNGetDataEncoded", (PyCFunction)TXNObj_TXNGetDataEncoded, 1,
|
---|
1183 | PyDoc_STR("(TXNOffset iStartOffset, TXNOffset iEndOffset, TXNDataType iEncoding) -> (Handle oDataHandle)")},
|
---|
1184 | {"TXNSetDataFromFile", (PyCFunction)TXNObj_TXNSetDataFromFile, 1,
|
---|
1185 | PyDoc_STR("(SInt16 iFileRefNum, OSType iFileType, ByteCount iFileLength, TXNOffset iStartOffset, TXNOffset iEndOffset) -> None")},
|
---|
1186 | {"TXNGetChangeCount", (PyCFunction)TXNObj_TXNGetChangeCount, 1,
|
---|
1187 | PyDoc_STR("() -> (ItemCount _rv)")},
|
---|
1188 | {"TXNSave", (PyCFunction)TXNObj_TXNSave, 1,
|
---|
1189 | PyDoc_STR("(TXNFileType iType, OSType iResType, TXNPermanentTextEncodingType iPermanentEncoding, FSSpec iFileSpecification, SInt16 iDataReference, SInt16 iResourceReference) -> None")},
|
---|
1190 | {"TXNRevert", (PyCFunction)TXNObj_TXNRevert, 1,
|
---|
1191 | PyDoc_STR("() -> None")},
|
---|
1192 | {"TXNPageSetup", (PyCFunction)TXNObj_TXNPageSetup, 1,
|
---|
1193 | PyDoc_STR("() -> None")},
|
---|
1194 | {"TXNPrint", (PyCFunction)TXNObj_TXNPrint, 1,
|
---|
1195 | PyDoc_STR("() -> None")},
|
---|
1196 | {"TXNGetViewRect", (PyCFunction)TXNObj_TXNGetViewRect, 1,
|
---|
1197 | PyDoc_STR("() -> (Rect oViewRect)")},
|
---|
1198 | {"TXNSetViewRect", (PyCFunction)TXNObj_TXNSetViewRect, 1,
|
---|
1199 | PyDoc_STR("(Rect iViewRect) -> None")},
|
---|
1200 | {"TXNAttachObjectToWindow", (PyCFunction)TXNObj_TXNAttachObjectToWindow, 1,
|
---|
1201 | PyDoc_STR("(GWorldPtr iWindow, Boolean iIsActualWindow) -> None")},
|
---|
1202 | {"TXNIsObjectAttachedToWindow", (PyCFunction)TXNObj_TXNIsObjectAttachedToWindow, 1,
|
---|
1203 | PyDoc_STR("() -> (Boolean _rv)")},
|
---|
1204 | {"TXNDragTracker", (PyCFunction)TXNObj_TXNDragTracker, 1,
|
---|
1205 | PyDoc_STR("(TXNFrameID iTXNFrameID, DragTrackingMessage iMessage, WindowPtr iWindow, DragReference iDragReference, Boolean iDifferentObjectSameWindow) -> None")},
|
---|
1206 | {"TXNDragReceiver", (PyCFunction)TXNObj_TXNDragReceiver, 1,
|
---|
1207 | PyDoc_STR("(TXNFrameID iTXNFrameID, WindowPtr iWindow, DragReference iDragReference, Boolean iDifferentObjectSameWindow) -> None")},
|
---|
1208 | {"TXNActivate", (PyCFunction)TXNObj_TXNActivate, 1,
|
---|
1209 | PyDoc_STR("(TXNFrameID iTXNFrameID, TXNScrollBarState iActiveState) -> None")},
|
---|
1210 | {"TXNEchoMode", (PyCFunction)TXNObj_TXNEchoMode, 1,
|
---|
1211 | PyDoc_STR("(UniChar iEchoCharacter, TextEncoding iEncoding, Boolean iOn) -> None")},
|
---|
1212 | {"TXNDoFontMenuSelection", (PyCFunction)TXNObj_TXNDoFontMenuSelection, 1,
|
---|
1213 | PyDoc_STR("(TXNFontMenuObject iTXNFontMenuObject, SInt16 iMenuID, SInt16 iMenuItem) -> None")},
|
---|
1214 | {"TXNPrepareFontMenu", (PyCFunction)TXNObj_TXNPrepareFontMenu, 1,
|
---|
1215 | PyDoc_STR("(TXNFontMenuObject iTXNFontMenuObject) -> None")},
|
---|
1216 | {"TXNPointToOffset", (PyCFunction)TXNObj_TXNPointToOffset, 1,
|
---|
1217 | PyDoc_STR("(Point iPoint) -> (TXNOffset oOffset)")},
|
---|
1218 | {"TXNOffsetToPoint", (PyCFunction)TXNObj_TXNOffsetToPoint, 1,
|
---|
1219 | PyDoc_STR("(TXNOffset iOffset) -> (Point oPoint)")},
|
---|
1220 | {"TXNGetLineCount", (PyCFunction)TXNObj_TXNGetLineCount, 1,
|
---|
1221 | PyDoc_STR("() -> (ItemCount oLineTotal)")},
|
---|
1222 | {"TXNGetLineMetrics", (PyCFunction)TXNObj_TXNGetLineMetrics, 1,
|
---|
1223 | PyDoc_STR("(UInt32 iLineNumber) -> (Fixed oLineWidth, Fixed oLineHeight)")},
|
---|
1224 | {"TXNIsObjectAttachedToSpecificWindow", (PyCFunction)TXNObj_TXNIsObjectAttachedToSpecificWindow, 1,
|
---|
1225 | PyDoc_STR("(WindowPtr iWindow) -> (Boolean oAttached)")},
|
---|
1226 | {"TXNRecalcTextLayout", (PyCFunction)TXNObj_TXNRecalcTextLayout, 1,
|
---|
1227 | PyDoc_STR("() -> None")},
|
---|
1228 | {NULL, NULL, 0}
|
---|
1229 | };
|
---|
1230 |
|
---|
1231 | #define TXNObj_getsetlist NULL
|
---|
1232 |
|
---|
1233 |
|
---|
1234 | #define TXNObj_compare NULL
|
---|
1235 |
|
---|
1236 | #define TXNObj_repr NULL
|
---|
1237 |
|
---|
1238 | #define TXNObj_hash NULL
|
---|
1239 | #define TXNObj_tp_init 0
|
---|
1240 |
|
---|
1241 | #define TXNObj_tp_alloc PyType_GenericAlloc
|
---|
1242 |
|
---|
1243 | static PyObject *TXNObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
|
---|
1244 | {
|
---|
1245 | PyObject *_self;
|
---|
1246 | TXNObject itself;
|
---|
1247 | char *kw[] = {"itself", 0};
|
---|
1248 |
|
---|
1249 | if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, TXNObj_Convert, &itself)) return NULL;
|
---|
1250 | if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
|
---|
1251 | ((TXNObjectObject *)_self)->ob_itself = itself;
|
---|
1252 | return _self;
|
---|
1253 | }
|
---|
1254 |
|
---|
1255 | #define TXNObj_tp_free PyObject_Del
|
---|
1256 |
|
---|
1257 |
|
---|
1258 | PyTypeObject TXNObject_Type = {
|
---|
1259 | PyObject_HEAD_INIT(NULL)
|
---|
1260 | 0, /*ob_size*/
|
---|
1261 | "_Mlte.TXNObject", /*tp_name*/
|
---|
1262 | sizeof(TXNObjectObject), /*tp_basicsize*/
|
---|
1263 | 0, /*tp_itemsize*/
|
---|
1264 | /* methods */
|
---|
1265 | (destructor) TXNObj_dealloc, /*tp_dealloc*/
|
---|
1266 | 0, /*tp_print*/
|
---|
1267 | (getattrfunc)0, /*tp_getattr*/
|
---|
1268 | (setattrfunc)0, /*tp_setattr*/
|
---|
1269 | (cmpfunc) TXNObj_compare, /*tp_compare*/
|
---|
1270 | (reprfunc) TXNObj_repr, /*tp_repr*/
|
---|
1271 | (PyNumberMethods *)0, /* tp_as_number */
|
---|
1272 | (PySequenceMethods *)0, /* tp_as_sequence */
|
---|
1273 | (PyMappingMethods *)0, /* tp_as_mapping */
|
---|
1274 | (hashfunc) TXNObj_hash, /*tp_hash*/
|
---|
1275 | 0, /*tp_call*/
|
---|
1276 | 0, /*tp_str*/
|
---|
1277 | PyObject_GenericGetAttr, /*tp_getattro*/
|
---|
1278 | PyObject_GenericSetAttr, /*tp_setattro */
|
---|
1279 | 0, /*tp_as_buffer*/
|
---|
1280 | Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
|
---|
1281 | 0, /*tp_doc*/
|
---|
1282 | 0, /*tp_traverse*/
|
---|
1283 | 0, /*tp_clear*/
|
---|
1284 | 0, /*tp_richcompare*/
|
---|
1285 | 0, /*tp_weaklistoffset*/
|
---|
1286 | 0, /*tp_iter*/
|
---|
1287 | 0, /*tp_iternext*/
|
---|
1288 | TXNObj_methods, /* tp_methods */
|
---|
1289 | 0, /*tp_members*/
|
---|
1290 | TXNObj_getsetlist, /*tp_getset*/
|
---|
1291 | 0, /*tp_base*/
|
---|
1292 | 0, /*tp_dict*/
|
---|
1293 | 0, /*tp_descr_get*/
|
---|
1294 | 0, /*tp_descr_set*/
|
---|
1295 | 0, /*tp_dictoffset*/
|
---|
1296 | TXNObj_tp_init, /* tp_init */
|
---|
1297 | TXNObj_tp_alloc, /* tp_alloc */
|
---|
1298 | TXNObj_tp_new, /* tp_new */
|
---|
1299 | TXNObj_tp_free, /* tp_free */
|
---|
1300 | };
|
---|
1301 |
|
---|
1302 | /* ------------------- End object type TXNObject -------------------- */
|
---|
1303 |
|
---|
1304 |
|
---|
1305 | /* ----------------- Object type TXNFontMenuObject ------------------ */
|
---|
1306 |
|
---|
1307 | PyTypeObject TXNFontMenuObject_Type;
|
---|
1308 |
|
---|
1309 | #define TXNFontMenuObj_Check(x) ((x)->ob_type == &TXNFontMenuObject_Type || PyObject_TypeCheck((x), &TXNFontMenuObject_Type))
|
---|
1310 |
|
---|
1311 | typedef struct TXNFontMenuObjectObject {
|
---|
1312 | PyObject_HEAD
|
---|
1313 | TXNFontMenuObject ob_itself;
|
---|
1314 | } TXNFontMenuObjectObject;
|
---|
1315 |
|
---|
1316 | PyObject *TXNFontMenuObj_New(TXNFontMenuObject itself)
|
---|
1317 | {
|
---|
1318 | TXNFontMenuObjectObject *it;
|
---|
1319 | if (itself == NULL) return PyMac_Error(resNotFound);
|
---|
1320 | it = PyObject_NEW(TXNFontMenuObjectObject, &TXNFontMenuObject_Type);
|
---|
1321 | if (it == NULL) return NULL;
|
---|
1322 | it->ob_itself = itself;
|
---|
1323 | return (PyObject *)it;
|
---|
1324 | }
|
---|
1325 |
|
---|
1326 | int TXNFontMenuObj_Convert(PyObject *v, TXNFontMenuObject *p_itself)
|
---|
1327 | {
|
---|
1328 | if (!TXNFontMenuObj_Check(v))
|
---|
1329 | {
|
---|
1330 | PyErr_SetString(PyExc_TypeError, "TXNFontMenuObject required");
|
---|
1331 | return 0;
|
---|
1332 | }
|
---|
1333 | *p_itself = ((TXNFontMenuObjectObject *)v)->ob_itself;
|
---|
1334 | return 1;
|
---|
1335 | }
|
---|
1336 |
|
---|
1337 | static void TXNFontMenuObj_dealloc(TXNFontMenuObjectObject *self)
|
---|
1338 | {
|
---|
1339 | /* Cleanup of self->ob_itself goes here */
|
---|
1340 | self->ob_type->tp_free((PyObject *)self);
|
---|
1341 | }
|
---|
1342 |
|
---|
1343 | static PyObject *TXNFontMenuObj_TXNGetFontMenuHandle(TXNFontMenuObjectObject *_self, PyObject *_args)
|
---|
1344 | {
|
---|
1345 | PyObject *_res = NULL;
|
---|
1346 | OSStatus _err;
|
---|
1347 | MenuHandle oFontMenuHandle;
|
---|
1348 | #ifndef TXNGetFontMenuHandle
|
---|
1349 | PyMac_PRECHECK(TXNGetFontMenuHandle);
|
---|
1350 | #endif
|
---|
1351 | if (!PyArg_ParseTuple(_args, ""))
|
---|
1352 | return NULL;
|
---|
1353 | _err = TXNGetFontMenuHandle(_self->ob_itself,
|
---|
1354 | &oFontMenuHandle);
|
---|
1355 | if (_err != noErr) return PyMac_Error(_err);
|
---|
1356 | _res = Py_BuildValue("O&",
|
---|
1357 | MenuObj_New, oFontMenuHandle);
|
---|
1358 | return _res;
|
---|
1359 | }
|
---|
1360 |
|
---|
1361 | static PyObject *TXNFontMenuObj_TXNDisposeFontMenuObject(TXNFontMenuObjectObject *_self, PyObject *_args)
|
---|
1362 | {
|
---|
1363 | PyObject *_res = NULL;
|
---|
1364 | OSStatus _err;
|
---|
1365 | #ifndef TXNDisposeFontMenuObject
|
---|
1366 | PyMac_PRECHECK(TXNDisposeFontMenuObject);
|
---|
1367 | #endif
|
---|
1368 | if (!PyArg_ParseTuple(_args, ""))
|
---|
1369 | return NULL;
|
---|
1370 | _err = TXNDisposeFontMenuObject(_self->ob_itself);
|
---|
1371 | if (_err != noErr) return PyMac_Error(_err);
|
---|
1372 | Py_INCREF(Py_None);
|
---|
1373 | _res = Py_None;
|
---|
1374 | return _res;
|
---|
1375 | }
|
---|
1376 |
|
---|
1377 | static PyMethodDef TXNFontMenuObj_methods[] = {
|
---|
1378 | {"TXNGetFontMenuHandle", (PyCFunction)TXNFontMenuObj_TXNGetFontMenuHandle, 1,
|
---|
1379 | PyDoc_STR("() -> (MenuHandle oFontMenuHandle)")},
|
---|
1380 | {"TXNDisposeFontMenuObject", (PyCFunction)TXNFontMenuObj_TXNDisposeFontMenuObject, 1,
|
---|
1381 | PyDoc_STR("() -> None")},
|
---|
1382 | {NULL, NULL, 0}
|
---|
1383 | };
|
---|
1384 |
|
---|
1385 | #define TXNFontMenuObj_getsetlist NULL
|
---|
1386 |
|
---|
1387 |
|
---|
1388 | #define TXNFontMenuObj_compare NULL
|
---|
1389 |
|
---|
1390 | #define TXNFontMenuObj_repr NULL
|
---|
1391 |
|
---|
1392 | #define TXNFontMenuObj_hash NULL
|
---|
1393 | #define TXNFontMenuObj_tp_init 0
|
---|
1394 |
|
---|
1395 | #define TXNFontMenuObj_tp_alloc PyType_GenericAlloc
|
---|
1396 |
|
---|
1397 | static PyObject *TXNFontMenuObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
|
---|
1398 | {
|
---|
1399 | PyObject *_self;
|
---|
1400 | TXNFontMenuObject itself;
|
---|
1401 | char *kw[] = {"itself", 0};
|
---|
1402 |
|
---|
1403 | if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, TXNFontMenuObj_Convert, &itself)) return NULL;
|
---|
1404 | if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
|
---|
1405 | ((TXNFontMenuObjectObject *)_self)->ob_itself = itself;
|
---|
1406 | return _self;
|
---|
1407 | }
|
---|
1408 |
|
---|
1409 | #define TXNFontMenuObj_tp_free PyObject_Del
|
---|
1410 |
|
---|
1411 |
|
---|
1412 | PyTypeObject TXNFontMenuObject_Type = {
|
---|
1413 | PyObject_HEAD_INIT(NULL)
|
---|
1414 | 0, /*ob_size*/
|
---|
1415 | "_Mlte.TXNFontMenuObject", /*tp_name*/
|
---|
1416 | sizeof(TXNFontMenuObjectObject), /*tp_basicsize*/
|
---|
1417 | 0, /*tp_itemsize*/
|
---|
1418 | /* methods */
|
---|
1419 | (destructor) TXNFontMenuObj_dealloc, /*tp_dealloc*/
|
---|
1420 | 0, /*tp_print*/
|
---|
1421 | (getattrfunc)0, /*tp_getattr*/
|
---|
1422 | (setattrfunc)0, /*tp_setattr*/
|
---|
1423 | (cmpfunc) TXNFontMenuObj_compare, /*tp_compare*/
|
---|
1424 | (reprfunc) TXNFontMenuObj_repr, /*tp_repr*/
|
---|
1425 | (PyNumberMethods *)0, /* tp_as_number */
|
---|
1426 | (PySequenceMethods *)0, /* tp_as_sequence */
|
---|
1427 | (PyMappingMethods *)0, /* tp_as_mapping */
|
---|
1428 | (hashfunc) TXNFontMenuObj_hash, /*tp_hash*/
|
---|
1429 | 0, /*tp_call*/
|
---|
1430 | 0, /*tp_str*/
|
---|
1431 | PyObject_GenericGetAttr, /*tp_getattro*/
|
---|
1432 | PyObject_GenericSetAttr, /*tp_setattro */
|
---|
1433 | 0, /*tp_as_buffer*/
|
---|
1434 | Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
|
---|
1435 | 0, /*tp_doc*/
|
---|
1436 | 0, /*tp_traverse*/
|
---|
1437 | 0, /*tp_clear*/
|
---|
1438 | 0, /*tp_richcompare*/
|
---|
1439 | 0, /*tp_weaklistoffset*/
|
---|
1440 | 0, /*tp_iter*/
|
---|
1441 | 0, /*tp_iternext*/
|
---|
1442 | TXNFontMenuObj_methods, /* tp_methods */
|
---|
1443 | 0, /*tp_members*/
|
---|
1444 | TXNFontMenuObj_getsetlist, /*tp_getset*/
|
---|
1445 | 0, /*tp_base*/
|
---|
1446 | 0, /*tp_dict*/
|
---|
1447 | 0, /*tp_descr_get*/
|
---|
1448 | 0, /*tp_descr_set*/
|
---|
1449 | 0, /*tp_dictoffset*/
|
---|
1450 | TXNFontMenuObj_tp_init, /* tp_init */
|
---|
1451 | TXNFontMenuObj_tp_alloc, /* tp_alloc */
|
---|
1452 | TXNFontMenuObj_tp_new, /* tp_new */
|
---|
1453 | TXNFontMenuObj_tp_free, /* tp_free */
|
---|
1454 | };
|
---|
1455 |
|
---|
1456 | /* --------------- End object type TXNFontMenuObject ---------------- */
|
---|
1457 |
|
---|
1458 |
|
---|
1459 | static PyObject *Mlte_TXNNewObject(PyObject *_self, PyObject *_args)
|
---|
1460 | {
|
---|
1461 | PyObject *_res = NULL;
|
---|
1462 | OSStatus _err;
|
---|
1463 | FSSpec * iFileSpec;
|
---|
1464 | WindowPtr iWindow;
|
---|
1465 | Rect iFrame;
|
---|
1466 | TXNFrameOptions iFrameOptions;
|
---|
1467 | TXNFrameType iFrameType;
|
---|
1468 | TXNFileType iFileType;
|
---|
1469 | TXNPermanentTextEncodingType iPermanentEncoding;
|
---|
1470 | TXNObject oTXNObject;
|
---|
1471 | TXNFrameID oTXNFrameID;
|
---|
1472 | #ifndef TXNNewObject
|
---|
1473 | PyMac_PRECHECK(TXNNewObject);
|
---|
1474 | #endif
|
---|
1475 | if (!PyArg_ParseTuple(_args, "O&O&O&llO&l",
|
---|
1476 | OptFSSpecPtr_Convert, &iFileSpec,
|
---|
1477 | WinObj_Convert, &iWindow,
|
---|
1478 | PyMac_GetRect, &iFrame,
|
---|
1479 | &iFrameOptions,
|
---|
1480 | &iFrameType,
|
---|
1481 | PyMac_GetOSType, &iFileType,
|
---|
1482 | &iPermanentEncoding))
|
---|
1483 | return NULL;
|
---|
1484 | _err = TXNNewObject(iFileSpec,
|
---|
1485 | iWindow,
|
---|
1486 | &iFrame,
|
---|
1487 | iFrameOptions,
|
---|
1488 | iFrameType,
|
---|
1489 | iFileType,
|
---|
1490 | iPermanentEncoding,
|
---|
1491 | &oTXNObject,
|
---|
1492 | &oTXNFrameID,
|
---|
1493 | (TXNObjectRefcon)0);
|
---|
1494 | if (_err != noErr) return PyMac_Error(_err);
|
---|
1495 | _res = Py_BuildValue("O&l",
|
---|
1496 | TXNObj_New, oTXNObject,
|
---|
1497 | oTXNFrameID);
|
---|
1498 | return _res;
|
---|
1499 | }
|
---|
1500 |
|
---|
1501 | static PyObject *Mlte_TXNTerminateTextension(PyObject *_self, PyObject *_args)
|
---|
1502 | {
|
---|
1503 | PyObject *_res = NULL;
|
---|
1504 | #ifndef TXNTerminateTextension
|
---|
1505 | PyMac_PRECHECK(TXNTerminateTextension);
|
---|
1506 | #endif
|
---|
1507 | if (!PyArg_ParseTuple(_args, ""))
|
---|
1508 | return NULL;
|
---|
1509 | TXNTerminateTextension();
|
---|
1510 | Py_INCREF(Py_None);
|
---|
1511 | _res = Py_None;
|
---|
1512 | return _res;
|
---|
1513 | }
|
---|
1514 |
|
---|
1515 | static PyObject *Mlte_TXNIsScrapPastable(PyObject *_self, PyObject *_args)
|
---|
1516 | {
|
---|
1517 | PyObject *_res = NULL;
|
---|
1518 | Boolean _rv;
|
---|
1519 | #ifndef TXNIsScrapPastable
|
---|
1520 | PyMac_PRECHECK(TXNIsScrapPastable);
|
---|
1521 | #endif
|
---|
1522 | if (!PyArg_ParseTuple(_args, ""))
|
---|
1523 | return NULL;
|
---|
1524 | _rv = TXNIsScrapPastable();
|
---|
1525 | _res = Py_BuildValue("b",
|
---|
1526 | _rv);
|
---|
1527 | return _res;
|
---|
1528 | }
|
---|
1529 |
|
---|
1530 | static PyObject *Mlte_TXNConvertToPublicScrap(PyObject *_self, PyObject *_args)
|
---|
1531 | {
|
---|
1532 | PyObject *_res = NULL;
|
---|
1533 | OSStatus _err;
|
---|
1534 | #ifndef TXNConvertToPublicScrap
|
---|
1535 | PyMac_PRECHECK(TXNConvertToPublicScrap);
|
---|
1536 | #endif
|
---|
1537 | if (!PyArg_ParseTuple(_args, ""))
|
---|
1538 | return NULL;
|
---|
1539 | _err = TXNConvertToPublicScrap();
|
---|
1540 | if (_err != noErr) return PyMac_Error(_err);
|
---|
1541 | Py_INCREF(Py_None);
|
---|
1542 | _res = Py_None;
|
---|
1543 | return _res;
|
---|
1544 | }
|
---|
1545 |
|
---|
1546 | static PyObject *Mlte_TXNConvertFromPublicScrap(PyObject *_self, PyObject *_args)
|
---|
1547 | {
|
---|
1548 | PyObject *_res = NULL;
|
---|
1549 | OSStatus _err;
|
---|
1550 | #ifndef TXNConvertFromPublicScrap
|
---|
1551 | PyMac_PRECHECK(TXNConvertFromPublicScrap);
|
---|
1552 | #endif
|
---|
1553 | if (!PyArg_ParseTuple(_args, ""))
|
---|
1554 | return NULL;
|
---|
1555 | _err = TXNConvertFromPublicScrap();
|
---|
1556 | if (_err != noErr) return PyMac_Error(_err);
|
---|
1557 | Py_INCREF(Py_None);
|
---|
1558 | _res = Py_None;
|
---|
1559 | return _res;
|
---|
1560 | }
|
---|
1561 |
|
---|
1562 | static PyObject *Mlte_TXNNewFontMenuObject(PyObject *_self, PyObject *_args)
|
---|
1563 | {
|
---|
1564 | PyObject *_res = NULL;
|
---|
1565 | OSStatus _err;
|
---|
1566 | MenuHandle iFontMenuHandle;
|
---|
1567 | SInt16 iMenuID;
|
---|
1568 | SInt16 iStartHierMenuID;
|
---|
1569 | TXNFontMenuObject oTXNFontMenuObject;
|
---|
1570 | #ifndef TXNNewFontMenuObject
|
---|
1571 | PyMac_PRECHECK(TXNNewFontMenuObject);
|
---|
1572 | #endif
|
---|
1573 | if (!PyArg_ParseTuple(_args, "O&hh",
|
---|
1574 | MenuObj_Convert, &iFontMenuHandle,
|
---|
1575 | &iMenuID,
|
---|
1576 | &iStartHierMenuID))
|
---|
1577 | return NULL;
|
---|
1578 | _err = TXNNewFontMenuObject(iFontMenuHandle,
|
---|
1579 | iMenuID,
|
---|
1580 | iStartHierMenuID,
|
---|
1581 | &oTXNFontMenuObject);
|
---|
1582 | if (_err != noErr) return PyMac_Error(_err);
|
---|
1583 | _res = Py_BuildValue("O&",
|
---|
1584 | TXNFontMenuObj_New, oTXNFontMenuObject);
|
---|
1585 | return _res;
|
---|
1586 | }
|
---|
1587 |
|
---|
1588 | static PyObject *Mlte_TXNVersionInformation(PyObject *_self, PyObject *_args)
|
---|
1589 | {
|
---|
1590 | PyObject *_res = NULL;
|
---|
1591 | TXNVersionValue _rv;
|
---|
1592 | TXNFeatureBits oFeatureFlags;
|
---|
1593 | #ifndef TXNVersionInformation
|
---|
1594 | PyMac_PRECHECK(TXNVersionInformation);
|
---|
1595 | #endif
|
---|
1596 | if (!PyArg_ParseTuple(_args, ""))
|
---|
1597 | return NULL;
|
---|
1598 | _rv = TXNVersionInformation(&oFeatureFlags);
|
---|
1599 | _res = Py_BuildValue("ll",
|
---|
1600 | _rv,
|
---|
1601 | oFeatureFlags);
|
---|
1602 | return _res;
|
---|
1603 | }
|
---|
1604 |
|
---|
1605 | static PyObject *Mlte_TXNInitTextension(PyObject *_self, PyObject *_args)
|
---|
1606 | {
|
---|
1607 | PyObject *_res = NULL;
|
---|
1608 |
|
---|
1609 | OSStatus _err;
|
---|
1610 | TXNMacOSPreferredFontDescription * iDefaultFonts = NULL;
|
---|
1611 | ItemCount iCountDefaultFonts = 0;
|
---|
1612 | TXNInitOptions iUsageFlags;
|
---|
1613 | PyMac_PRECHECK(TXNInitTextension);
|
---|
1614 | if (!PyArg_ParseTuple(_args, "l", &iUsageFlags))
|
---|
1615 | return NULL;
|
---|
1616 | _err = TXNInitTextension(iDefaultFonts,
|
---|
1617 | iCountDefaultFonts,
|
---|
1618 | iUsageFlags);
|
---|
1619 | if (_err != noErr) return PyMac_Error(_err);
|
---|
1620 | Py_INCREF(Py_None);
|
---|
1621 | _res = Py_None;
|
---|
1622 | return _res;
|
---|
1623 |
|
---|
1624 | }
|
---|
1625 |
|
---|
1626 | #endif /* __LP64__ */
|
---|
1627 |
|
---|
1628 | static PyMethodDef Mlte_methods[] = {
|
---|
1629 | #ifndef __LP64__
|
---|
1630 | {"TXNNewObject", (PyCFunction)Mlte_TXNNewObject, 1,
|
---|
1631 | PyDoc_STR("(FSSpec * iFileSpec, WindowPtr iWindow, Rect iFrame, TXNFrameOptions iFrameOptions, TXNFrameType iFrameType, TXNFileType iFileType, TXNPermanentTextEncodingType iPermanentEncoding) -> (TXNObject oTXNObject, TXNFrameID oTXNFrameID)")},
|
---|
1632 | {"TXNTerminateTextension", (PyCFunction)Mlte_TXNTerminateTextension, 1,
|
---|
1633 | PyDoc_STR("() -> None")},
|
---|
1634 | {"TXNIsScrapPastable", (PyCFunction)Mlte_TXNIsScrapPastable, 1,
|
---|
1635 | PyDoc_STR("() -> (Boolean _rv)")},
|
---|
1636 | {"TXNConvertToPublicScrap", (PyCFunction)Mlte_TXNConvertToPublicScrap, 1,
|
---|
1637 | PyDoc_STR("() -> None")},
|
---|
1638 | {"TXNConvertFromPublicScrap", (PyCFunction)Mlte_TXNConvertFromPublicScrap, 1,
|
---|
1639 | PyDoc_STR("() -> None")},
|
---|
1640 | {"TXNNewFontMenuObject", (PyCFunction)Mlte_TXNNewFontMenuObject, 1,
|
---|
1641 | PyDoc_STR("(MenuHandle iFontMenuHandle, SInt16 iMenuID, SInt16 iStartHierMenuID) -> (TXNFontMenuObject oTXNFontMenuObject)")},
|
---|
1642 | {"TXNVersionInformation", (PyCFunction)Mlte_TXNVersionInformation, 1,
|
---|
1643 | PyDoc_STR("() -> (TXNVersionValue _rv, TXNFeatureBits oFeatureFlags)")},
|
---|
1644 | {"TXNInitTextension", (PyCFunction)Mlte_TXNInitTextension, 1,
|
---|
1645 | PyDoc_STR("(TXNInitOptions) -> None")},
|
---|
1646 | #endif /* __LP64__ */
|
---|
1647 | {NULL, NULL, 0}
|
---|
1648 | };
|
---|
1649 |
|
---|
1650 |
|
---|
1651 |
|
---|
1652 |
|
---|
1653 | void init_Mlte(void)
|
---|
1654 | {
|
---|
1655 | PyObject *m;
|
---|
1656 | #ifndef __LP64__
|
---|
1657 | PyObject *d;
|
---|
1658 |
|
---|
1659 |
|
---|
1660 |
|
---|
1661 | // PyMac_INIT_TOOLBOX_OBJECT_NEW(xxxx);
|
---|
1662 |
|
---|
1663 | #endif /* __LP64__ */
|
---|
1664 |
|
---|
1665 | m = Py_InitModule("_Mlte", Mlte_methods);
|
---|
1666 | #ifndef __LP64__
|
---|
1667 | d = PyModule_GetDict(m);
|
---|
1668 | Mlte_Error = PyMac_GetOSErrException();
|
---|
1669 | if (Mlte_Error == NULL ||
|
---|
1670 | PyDict_SetItemString(d, "Error", Mlte_Error) != 0)
|
---|
1671 | return;
|
---|
1672 | TXNObject_Type.ob_type = &PyType_Type;
|
---|
1673 | if (PyType_Ready(&TXNObject_Type) < 0) return;
|
---|
1674 | Py_INCREF(&TXNObject_Type);
|
---|
1675 | PyModule_AddObject(m, "TXNObject", (PyObject *)&TXNObject_Type);
|
---|
1676 | /* Backward-compatible name */
|
---|
1677 | Py_INCREF(&TXNObject_Type);
|
---|
1678 | PyModule_AddObject(m, "TXNObjectType", (PyObject *)&TXNObject_Type);
|
---|
1679 | TXNFontMenuObject_Type.ob_type = &PyType_Type;
|
---|
1680 | if (PyType_Ready(&TXNFontMenuObject_Type) < 0) return;
|
---|
1681 | Py_INCREF(&TXNFontMenuObject_Type);
|
---|
1682 | PyModule_AddObject(m, "TXNFontMenuObject", (PyObject *)&TXNFontMenuObject_Type);
|
---|
1683 | /* Backward-compatible name */
|
---|
1684 | Py_INCREF(&TXNFontMenuObject_Type);
|
---|
1685 | PyModule_AddObject(m, "TXNFontMenuObjectType", (PyObject *)&TXNFontMenuObject_Type);
|
---|
1686 | #endif /* __LP64__ */
|
---|
1687 | }
|
---|
1688 |
|
---|
1689 | /* ======================== End module _Mlte ======================== */
|
---|
1690 |
|
---|