blob: 93f8aa5ed2030ed3e1f148b62c827acbff4ea7ea [file] [log] [blame]
Jack Jansen90ecdf41996-04-16 14:29:15 +00001
2/* ========================== Module waste ========================== */
3
4#include "Python.h"
5
6
7
Jack Jansen620a7662001-12-18 15:39:38 +00008#ifdef _WIN32
9#include "pywintoolbox.h"
10#else
Jack Jansen90ecdf41996-04-16 14:29:15 +000011#include "macglue.h"
Jack Jansen9d8b96c2000-07-14 22:16:45 +000012#include "pymactoolbox.h"
Jack Jansen620a7662001-12-18 15:39:38 +000013#endif
Jack Jansen044d95e2001-09-05 15:44:37 +000014
15/* Macro to test whether a weak-loaded CFM function exists */
16#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
17 PyErr_SetString(PyExc_NotImplementedError, \
18 "Not available in this shared library/OS version"); \
19 return NULL; \
20 }} while(0)
21
Jack Jansen90ecdf41996-04-16 14:29:15 +000022
23#include <WASTE.h>
Jack Jansen8505ef81997-08-27 14:09:25 +000024#include <WEObjectHandlers.h>
Jack Jansena755e681997-09-20 17:40:22 +000025#include <WETabs.h>
Jack Jansen97257352002-11-18 15:26:43 +000026#ifndef PyDoc_STR
27#define PyDoc_STR(x) (x)
28#endif
Jack Jansen90ecdf41996-04-16 14:29:15 +000029
30/* Exported by Qdmodule.c: */
31extern PyObject *QdRGB_New(RGBColor *);
32extern int QdRGB_Convert(PyObject *, RGBColor *);
33
Jack Jansen8505ef81997-08-27 14:09:25 +000034/* Exported by AEModule.c: */
35extern PyObject *AEDesc_New(AppleEvent *);
36extern int AEDesc_Convert(PyObject *, AppleEvent *);
37
Jack Jansen90ecdf41996-04-16 14:29:15 +000038/* Forward declaration */
Jeremy Hylton938ace62002-07-17 16:30:39 +000039static PyObject *WEOObj_New(WEObjectReference);
40static PyObject *ExistingwasteObj_New(WEReference);
Jack Jansen90ecdf41996-04-16 14:29:15 +000041
42/*
43** Parse/generate TextStyle records
44*/
45static
46PyObject *TextStyle_New(itself)
47 TextStylePtr itself;
48{
49
50 return Py_BuildValue("lllO&", (long)itself->tsFont, (long)itself->tsFace, (long)itself->tsSize, QdRGB_New,
51 &itself->tsColor);
52}
53
54static
55TextStyle_Convert(v, p_itself)
56 PyObject *v;
57 TextStylePtr p_itself;
58{
59 long font, face, size;
60
61 if( !PyArg_ParseTuple(v, "lllO&", &font, &face, &size, QdRGB_Convert, &p_itself->tsColor) )
62 return 0;
63 p_itself->tsFont = (short)font;
64 p_itself->tsFace = (Style)face;
65 p_itself->tsSize = (short)size;
66 return 1;
67}
68
69/*
70** Parse/generate RunInfo records
71*/
72static
73PyObject *RunInfo_New(itself)
74 WERunInfo *itself;
75{
76
77 return Py_BuildValue("llhhO&O&", itself->runStart, itself->runEnd, itself->runHeight,
78 itself->runAscent, TextStyle_New, &itself->runStyle, WEOObj_New, itself->runObject);
79}
80
81/* Conversion of long points and rects */
82int
83LongRect_Convert(PyObject *v, LongRect *r)
84{
85 return PyArg_Parse(v, "(llll)", &r->left, &r->top, &r->right, &r->bottom);
86}
87
88PyObject *
89LongRect_New(LongRect *r)
90{
91 return Py_BuildValue("(llll)", r->left, r->top, r->right, r->bottom);
92}
93
94
95LongPt_Convert(PyObject *v, LongPt *p)
96{
97 return PyArg_Parse(v, "(ll)", &p->h, &p->v);
98}
99
100PyObject *
101LongPt_New(LongPt *p)
102{
103 return Py_BuildValue("(ll)", p->h, p->v);
104}
105
Jack Jansen756522f1996-05-07 15:24:01 +0000106/* Stuff for the callbacks: */
107static PyObject *callbackdict;
Jack Jansen25241d91996-05-20 11:30:45 +0000108WENewObjectUPP upp_new_handler;
109WEDisposeObjectUPP upp_dispose_handler;
110WEDrawObjectUPP upp_draw_handler;
111WEClickObjectUPP upp_click_handler;
Jack Jansen756522f1996-05-07 15:24:01 +0000112
113static OSErr
114any_handler(WESelector what, WEObjectReference who, PyObject *args, PyObject **rv)
115{
116 FlavorType tp;
117 PyObject *key, *func;
118
119 if ( args == NULL ) return errAECorruptData;
120
121 tp = WEGetObjectType(who);
122
123 if( (key=Py_BuildValue("O&O&", PyMac_BuildOSType, tp, PyMac_BuildOSType, what)) == NULL)
124 return errAECorruptData;
125 if( (func = PyDict_GetItem(callbackdict, key)) == NULL ) {
126 Py_DECREF(key);
127 return errAEHandlerNotFound;
128 }
129 Py_INCREF(func);
130 *rv = PyEval_CallObject(func, args);
131 Py_DECREF(func);
132 Py_DECREF(key);
133 if ( *rv == NULL ) {
Jack Jansendeff89c1998-10-12 20:53:15 +0000134 PySys_WriteStderr("--Exception in callback: ");
Jack Jansen756522f1996-05-07 15:24:01 +0000135 PyErr_Print();
136 return errAEReplyNotArrived;
137 }
138 return 0;
139}
140
141static pascal OSErr
142my_new_handler(Point *objectSize, WEObjectReference objref)
143{
144 PyObject *args=NULL, *rv=NULL;
145 OSErr err;
146
147 args=Py_BuildValue("(O&)", WEOObj_New, objref);
148 err = any_handler(weNewHandler, objref, args, &rv);
149 if (!err) {
150 if (!PyMac_GetPoint(rv, objectSize) )
151 err = errAECoercionFail;
152 }
153 if ( args ) Py_DECREF(args);
154 if ( rv ) Py_DECREF(rv);
155 return err;
156}
157
158static pascal OSErr
159my_dispose_handler(WEObjectReference objref)
160{
161 PyObject *args=NULL, *rv=NULL;
162 OSErr err;
163
164 args=Py_BuildValue("(O&)", WEOObj_New, objref);
165 err = any_handler(weDisposeHandler, objref, args, &rv);
166 if ( args ) Py_DECREF(args);
167 if ( rv ) Py_DECREF(rv);
168 return err;
169}
170
171static pascal OSErr
Jack Jansen6b9289f2001-06-20 21:21:07 +0000172my_draw_handler(const Rect *destRect, WEObjectReference objref)
Jack Jansen756522f1996-05-07 15:24:01 +0000173{
174 PyObject *args=NULL, *rv=NULL;
175 OSErr err;
176
177 args=Py_BuildValue("O&O&", PyMac_BuildRect, destRect, WEOObj_New, objref);
178 err = any_handler(weDrawHandler, objref, args, &rv);
179 if ( args ) Py_DECREF(args);
180 if ( rv ) Py_DECREF(rv);
181 return err;
182}
183
184static pascal Boolean
185my_click_handler(Point hitPt, EventModifiers modifiers,
186 unsigned long clickTime, WEObjectReference objref)
187{
188 PyObject *args=NULL, *rv=NULL;
189 int retvalue;
190 OSErr err;
191
192 args=Py_BuildValue("O&llO&", PyMac_BuildPoint, hitPt,
193 (long)modifiers, (long)clickTime, WEOObj_New, objref);
194 err = any_handler(weClickHandler, objref, args, &rv);
195 if (!err)
196 retvalue = PyInt_AsLong(rv);
197 else
198 retvalue = 0;
199 if ( args ) Py_DECREF(args);
200 if ( rv ) Py_DECREF(rv);
201 return retvalue;
202}
203
204
205
Jack Jansen90ecdf41996-04-16 14:29:15 +0000206static PyObject *waste_Error;
207
208/* ------------------------ Object type WEO ------------------------- */
209
210PyTypeObject WEO_Type;
211
212#define WEOObj_Check(x) ((x)->ob_type == &WEO_Type)
213
214typedef struct WEOObject {
215 PyObject_HEAD
216 WEObjectReference ob_itself;
217} WEOObject;
218
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000219PyObject *WEOObj_New(WEObjectReference itself)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000220{
221 WEOObject *it;
222 if (itself == NULL) {
223 Py_INCREF(Py_None);
224 return Py_None;
225 }
226 it = PyObject_NEW(WEOObject, &WEO_Type);
227 if (it == NULL) return NULL;
228 it->ob_itself = itself;
229 return (PyObject *)it;
230}
Jack Jansen044d95e2001-09-05 15:44:37 +0000231int WEOObj_Convert(PyObject *v, WEObjectReference *p_itself)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000232{
233 if (!WEOObj_Check(v))
234 {
235 PyErr_SetString(PyExc_TypeError, "WEO required");
236 return 0;
237 }
238 *p_itself = ((WEOObject *)v)->ob_itself;
239 return 1;
240}
241
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000242static void WEOObj_dealloc(WEOObject *self)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000243{
244 /* Cleanup of self->ob_itself goes here */
Jack Jansen033b79c2002-04-23 22:46:01 +0000245 PyObject_Del(self);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000246}
247
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000248static PyObject *WEOObj_WEGetObjectType(WEOObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000249{
250 PyObject *_res = NULL;
251 FlavorType _rv;
252 if (!PyArg_ParseTuple(_args, ""))
253 return NULL;
254 _rv = WEGetObjectType(_self->ob_itself);
255 _res = Py_BuildValue("O&",
256 PyMac_BuildOSType, _rv);
257 return _res;
258}
259
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000260static PyObject *WEOObj_WEGetObjectDataHandle(WEOObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000261{
262 PyObject *_res = NULL;
263 Handle _rv;
264 if (!PyArg_ParseTuple(_args, ""))
265 return NULL;
266 _rv = WEGetObjectDataHandle(_self->ob_itself);
267 _res = Py_BuildValue("O&",
268 ResObj_New, _rv);
269 return _res;
270}
271
Jack Jansenb99e5212002-01-11 12:37:15 +0000272static PyObject *WEOObj_WEGetObjectOwner(WEOObject *_self, PyObject *_args)
273{
274 PyObject *_res = NULL;
275 WEReference _rv;
276 if (!PyArg_ParseTuple(_args, ""))
277 return NULL;
278 _rv = WEGetObjectOwner(_self->ob_itself);
279 _res = Py_BuildValue("O&",
280 ExistingwasteObj_New, _rv);
281 return _res;
282}
283
284static PyObject *WEOObj_WEGetObjectOffset(WEOObject *_self, PyObject *_args)
285{
286 PyObject *_res = NULL;
287 SInt32 _rv;
288 if (!PyArg_ParseTuple(_args, ""))
289 return NULL;
290 _rv = WEGetObjectOffset(_self->ob_itself);
291 _res = Py_BuildValue("l",
292 _rv);
293 return _res;
294}
295
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000296static PyObject *WEOObj_WEGetObjectSize(WEOObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000297{
298 PyObject *_res = NULL;
299 Point _rv;
300 if (!PyArg_ParseTuple(_args, ""))
301 return NULL;
302 _rv = WEGetObjectSize(_self->ob_itself);
303 _res = Py_BuildValue("O&",
304 PyMac_BuildPoint, _rv);
305 return _res;
306}
307
Jack Jansenb99e5212002-01-11 12:37:15 +0000308static PyObject *WEOObj_WESetObjectSize(WEOObject *_self, PyObject *_args)
Jack Jansen756522f1996-05-07 15:24:01 +0000309{
310 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000311 OSErr _err;
312 Point inObjectSize;
313 if (!PyArg_ParseTuple(_args, "O&",
314 PyMac_GetPoint, &inObjectSize))
315 return NULL;
316 _err = WESetObjectSize(_self->ob_itself,
317 inObjectSize);
318 if (_err != noErr) return PyMac_Error(_err);
319 Py_INCREF(Py_None);
320 _res = Py_None;
321 return _res;
322}
323
324static PyObject *WEOObj_WEGetObjectFrame(WEOObject *_self, PyObject *_args)
325{
326 PyObject *_res = NULL;
327 OSErr _err;
328 LongRect outObjectFrame;
Jack Jansen756522f1996-05-07 15:24:01 +0000329 if (!PyArg_ParseTuple(_args, ""))
330 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000331 _err = WEGetObjectFrame(_self->ob_itself,
332 &outObjectFrame);
333 if (_err != noErr) return PyMac_Error(_err);
Jack Jansen756522f1996-05-07 15:24:01 +0000334 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +0000335 LongRect_New, &outObjectFrame);
Jack Jansen756522f1996-05-07 15:24:01 +0000336 return _res;
337}
338
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000339static PyObject *WEOObj_WEGetObjectRefCon(WEOObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000340{
341 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +0000342 SInt32 _rv;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000343 if (!PyArg_ParseTuple(_args, ""))
344 return NULL;
345 _rv = WEGetObjectRefCon(_self->ob_itself);
346 _res = Py_BuildValue("l",
347 _rv);
348 return _res;
349}
350
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000351static PyObject *WEOObj_WESetObjectRefCon(WEOObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000352{
353 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000354 SInt32 inRefCon;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000355 if (!PyArg_ParseTuple(_args, "l",
Jack Jansenb99e5212002-01-11 12:37:15 +0000356 &inRefCon))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000357 return NULL;
358 WESetObjectRefCon(_self->ob_itself,
Jack Jansenb99e5212002-01-11 12:37:15 +0000359 inRefCon);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000360 Py_INCREF(Py_None);
361 _res = Py_None;
362 return _res;
363}
364
365static PyMethodDef WEOObj_methods[] = {
366 {"WEGetObjectType", (PyCFunction)WEOObj_WEGetObjectType, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000367 PyDoc_STR("() -> (FlavorType _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +0000368 {"WEGetObjectDataHandle", (PyCFunction)WEOObj_WEGetObjectDataHandle, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000369 PyDoc_STR("() -> (Handle _rv)")},
Jack Jansen756522f1996-05-07 15:24:01 +0000370 {"WEGetObjectOwner", (PyCFunction)WEOObj_WEGetObjectOwner, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000371 PyDoc_STR("() -> (WEReference _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +0000372 {"WEGetObjectOffset", (PyCFunction)WEOObj_WEGetObjectOffset, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000373 PyDoc_STR("() -> (SInt32 _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +0000374 {"WEGetObjectSize", (PyCFunction)WEOObj_WEGetObjectSize, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000375 PyDoc_STR("() -> (Point _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +0000376 {"WESetObjectSize", (PyCFunction)WEOObj_WESetObjectSize, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000377 PyDoc_STR("(Point inObjectSize) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +0000378 {"WEGetObjectFrame", (PyCFunction)WEOObj_WEGetObjectFrame, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000379 PyDoc_STR("() -> (LongRect outObjectFrame)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +0000380 {"WEGetObjectRefCon", (PyCFunction)WEOObj_WEGetObjectRefCon, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000381 PyDoc_STR("() -> (SInt32 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +0000382 {"WESetObjectRefCon", (PyCFunction)WEOObj_WESetObjectRefCon, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000383 PyDoc_STR("(SInt32 inRefCon) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +0000384 {NULL, NULL, 0}
385};
386
Jack Jansendbd57012002-11-29 23:40:48 +0000387#define WEOObj_getsetlist NULL
Jack Jansen90ecdf41996-04-16 14:29:15 +0000388
Jack Jansen9d8b96c2000-07-14 22:16:45 +0000389#define WEOObj_compare NULL
390
391#define WEOObj_repr NULL
392
393#define WEOObj_hash NULL
394
Jack Jansen90ecdf41996-04-16 14:29:15 +0000395PyTypeObject WEO_Type = {
Jack Jansenb3be2162001-11-30 14:16:36 +0000396 PyObject_HEAD_INIT(NULL)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000397 0, /*ob_size*/
Guido van Rossum14648392001-12-08 18:02:58 +0000398 "waste.WEO", /*tp_name*/
Jack Jansen90ecdf41996-04-16 14:29:15 +0000399 sizeof(WEOObject), /*tp_basicsize*/
400 0, /*tp_itemsize*/
401 /* methods */
402 (destructor) WEOObj_dealloc, /*tp_dealloc*/
403 0, /*tp_print*/
Jack Jansendbd57012002-11-29 23:40:48 +0000404 (getattrfunc)0, /*tp_getattr*/
405 (setattrfunc)0, /*tp_setattr*/
Jack Jansen9d8b96c2000-07-14 22:16:45 +0000406 (cmpfunc) WEOObj_compare, /*tp_compare*/
407 (reprfunc) WEOObj_repr, /*tp_repr*/
408 (PyNumberMethods *)0, /* tp_as_number */
409 (PySequenceMethods *)0, /* tp_as_sequence */
410 (PyMappingMethods *)0, /* tp_as_mapping */
411 (hashfunc) WEOObj_hash, /*tp_hash*/
Jack Jansendbd57012002-11-29 23:40:48 +0000412 0, /*tp_call*/
413 0, /*tp_str*/
414 PyObject_GenericGetAttr, /*tp_getattro*/
415 PyObject_GenericSetAttr, /*tp_setattro */
416 0, /*outputHook_tp_as_buffer*/
417 0, /*outputHook_tp_flags*/
418 0, /*outputHook_tp_doc*/
419 0, /*outputHook_tp_traverse*/
420 0, /*outputHook_tp_clear*/
421 0, /*outputHook_tp_richcompare*/
422 0, /*outputHook_tp_weaklistoffset*/
423 0, /*outputHook_tp_iter*/
424 0, /*outputHook_tp_iternext*/
425 WEOObj_methods, /* tp_methods */
426 0, /*outputHook_tp_members*/
427 WEOObj_getsetlist, /*tp_getset*/
428 0, /*outputHook_tp_base*/
Jack Jansen90ecdf41996-04-16 14:29:15 +0000429};
430
431/* ---------------------- End object type WEO ----------------------- */
432
433
434/* ----------------------- Object type waste ------------------------ */
435
436PyTypeObject waste_Type;
437
438#define wasteObj_Check(x) ((x)->ob_type == &waste_Type)
439
440typedef struct wasteObject {
441 PyObject_HEAD
442 WEReference ob_itself;
443} wasteObject;
444
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000445PyObject *wasteObj_New(WEReference itself)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000446{
447 wasteObject *it;
448 if (itself == NULL) {
449 PyErr_SetString(waste_Error,"Cannot create null WE");
450 return NULL;
451 }
452 it = PyObject_NEW(wasteObject, &waste_Type);
453 if (it == NULL) return NULL;
454 it->ob_itself = itself;
Jack Jansen756522f1996-05-07 15:24:01 +0000455 WESetInfo(weRefCon, (void *)&it, itself);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000456 return (PyObject *)it;
457}
Jack Jansen044d95e2001-09-05 15:44:37 +0000458int wasteObj_Convert(PyObject *v, WEReference *p_itself)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000459{
460 if (!wasteObj_Check(v))
461 {
462 PyErr_SetString(PyExc_TypeError, "waste required");
463 return 0;
464 }
465 *p_itself = ((wasteObject *)v)->ob_itself;
466 return 1;
467}
468
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000469static void wasteObj_dealloc(wasteObject *self)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000470{
471 WEDispose(self->ob_itself);
Jack Jansen033b79c2002-04-23 22:46:01 +0000472 PyObject_Del(self);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000473}
474
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000475static PyObject *wasteObj_WEGetText(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000476{
477 PyObject *_res = NULL;
478 Handle _rv;
479 if (!PyArg_ParseTuple(_args, ""))
480 return NULL;
481 _rv = WEGetText(_self->ob_itself);
482 _res = Py_BuildValue("O&",
483 ResObj_New, _rv);
484 return _res;
485}
486
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000487static PyObject *wasteObj_WEGetChar(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000488{
489 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +0000490 SInt16 _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +0000491 SInt32 inOffset;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000492 if (!PyArg_ParseTuple(_args, "l",
Jack Jansenb99e5212002-01-11 12:37:15 +0000493 &inOffset))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000494 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000495 _rv = WEGetChar(inOffset,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000496 _self->ob_itself);
497 _res = Py_BuildValue("h",
498 _rv);
499 return _res;
500}
501
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000502static PyObject *wasteObj_WEGetTextLength(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000503{
504 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +0000505 SInt32 _rv;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000506 if (!PyArg_ParseTuple(_args, ""))
507 return NULL;
508 _rv = WEGetTextLength(_self->ob_itself);
509 _res = Py_BuildValue("l",
510 _rv);
511 return _res;
512}
513
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000514static PyObject *wasteObj_WEGetSelection(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000515{
516 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000517 SInt32 outSelStart;
518 SInt32 outSelEnd;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000519 if (!PyArg_ParseTuple(_args, ""))
520 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000521 WEGetSelection(&outSelStart,
522 &outSelEnd,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000523 _self->ob_itself);
524 _res = Py_BuildValue("ll",
Jack Jansenb99e5212002-01-11 12:37:15 +0000525 outSelStart,
526 outSelEnd);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000527 return _res;
528}
529
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000530static PyObject *wasteObj_WEGetDestRect(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000531{
532 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000533 LongRect outDestRect;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000534 if (!PyArg_ParseTuple(_args, ""))
535 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000536 WEGetDestRect(&outDestRect,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000537 _self->ob_itself);
538 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +0000539 LongRect_New, &outDestRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000540 return _res;
541}
542
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000543static PyObject *wasteObj_WEGetViewRect(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000544{
545 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000546 LongRect outViewRect;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000547 if (!PyArg_ParseTuple(_args, ""))
548 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000549 WEGetViewRect(&outViewRect,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000550 _self->ob_itself);
551 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +0000552 LongRect_New, &outViewRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000553 return _res;
554}
555
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000556static PyObject *wasteObj_WEIsActive(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000557{
558 PyObject *_res = NULL;
559 Boolean _rv;
560 if (!PyArg_ParseTuple(_args, ""))
561 return NULL;
562 _rv = WEIsActive(_self->ob_itself);
563 _res = Py_BuildValue("b",
564 _rv);
565 return _res;
566}
567
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000568static PyObject *wasteObj_WEGetClickCount(wasteObject *_self, PyObject *_args)
Jack Jansen2268af51996-08-06 16:04:22 +0000569{
570 PyObject *_res = NULL;
571 UInt16 _rv;
572 if (!PyArg_ParseTuple(_args, ""))
573 return NULL;
574 _rv = WEGetClickCount(_self->ob_itself);
Jack Jansen9d8b96c2000-07-14 22:16:45 +0000575 _res = Py_BuildValue("H",
Jack Jansen2268af51996-08-06 16:04:22 +0000576 _rv);
577 return _res;
578}
579
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000580static PyObject *wasteObj_WESetSelection(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000581{
582 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000583 SInt32 inSelStart;
584 SInt32 inSelEnd;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000585 if (!PyArg_ParseTuple(_args, "ll",
Jack Jansenb99e5212002-01-11 12:37:15 +0000586 &inSelStart,
587 &inSelEnd))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000588 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000589 WESetSelection(inSelStart,
590 inSelEnd,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000591 _self->ob_itself);
592 Py_INCREF(Py_None);
593 _res = Py_None;
594 return _res;
595}
596
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000597static PyObject *wasteObj_WESetDestRect(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000598{
599 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000600 LongRect inDestRect;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000601 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +0000602 LongRect_Convert, &inDestRect))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000603 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000604 WESetDestRect(&inDestRect,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000605 _self->ob_itself);
606 Py_INCREF(Py_None);
607 _res = Py_None;
608 return _res;
609}
610
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000611static PyObject *wasteObj_WESetViewRect(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000612{
613 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000614 LongRect inViewRect;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000615 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +0000616 LongRect_Convert, &inViewRect))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000617 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000618 WESetViewRect(&inViewRect,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000619 _self->ob_itself);
620 Py_INCREF(Py_None);
621 _res = Py_None;
622 return _res;
623}
624
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000625static PyObject *wasteObj_WEContinuousStyle(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000626{
627 PyObject *_res = NULL;
628 Boolean _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +0000629 WEStyleMode ioMode;
630 TextStyle outTextStyle;
Jack Jansen9d8b96c2000-07-14 22:16:45 +0000631 if (!PyArg_ParseTuple(_args, "H",
Jack Jansenb99e5212002-01-11 12:37:15 +0000632 &ioMode))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000633 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000634 _rv = WEContinuousStyle(&ioMode,
635 &outTextStyle,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000636 _self->ob_itself);
Jack Jansen9d8b96c2000-07-14 22:16:45 +0000637 _res = Py_BuildValue("bHO&",
Jack Jansen90ecdf41996-04-16 14:29:15 +0000638 _rv,
Jack Jansenb99e5212002-01-11 12:37:15 +0000639 ioMode,
640 TextStyle_New, &outTextStyle);
641 return _res;
642}
643
644static PyObject *wasteObj_WECountRuns(wasteObject *_self, PyObject *_args)
645{
646 PyObject *_res = NULL;
647 SInt32 _rv;
648 if (!PyArg_ParseTuple(_args, ""))
649 return NULL;
650 _rv = WECountRuns(_self->ob_itself);
651 _res = Py_BuildValue("l",
652 _rv);
653 return _res;
654}
655
656static PyObject *wasteObj_WEOffsetToRun(wasteObject *_self, PyObject *_args)
657{
658 PyObject *_res = NULL;
659 SInt32 _rv;
660 SInt32 inOffset;
661 if (!PyArg_ParseTuple(_args, "l",
662 &inOffset))
663 return NULL;
664 _rv = WEOffsetToRun(inOffset,
665 _self->ob_itself);
666 _res = Py_BuildValue("l",
667 _rv);
668 return _res;
669}
670
671static PyObject *wasteObj_WEGetRunRange(wasteObject *_self, PyObject *_args)
672{
673 PyObject *_res = NULL;
674 SInt32 inStyleRunIndex;
675 SInt32 outStyleRunStart;
676 SInt32 outStyleRunEnd;
677 if (!PyArg_ParseTuple(_args, "l",
678 &inStyleRunIndex))
679 return NULL;
680 WEGetRunRange(inStyleRunIndex,
681 &outStyleRunStart,
682 &outStyleRunEnd,
683 _self->ob_itself);
684 _res = Py_BuildValue("ll",
685 outStyleRunStart,
686 outStyleRunEnd);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000687 return _res;
688}
689
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000690static PyObject *wasteObj_WEGetRunInfo(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000691{
692 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000693 SInt32 inOffset;
694 WERunInfo outStyleRunInfo;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000695 if (!PyArg_ParseTuple(_args, "l",
Jack Jansenb99e5212002-01-11 12:37:15 +0000696 &inOffset))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000697 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000698 WEGetRunInfo(inOffset,
699 &outStyleRunInfo,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000700 _self->ob_itself);
701 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +0000702 RunInfo_New, &outStyleRunInfo);
703 return _res;
704}
705
706static PyObject *wasteObj_WEGetIndRunInfo(wasteObject *_self, PyObject *_args)
707{
708 PyObject *_res = NULL;
709 SInt32 inStyleRunIndex;
710 WERunInfo outStyleRunInfo;
711 if (!PyArg_ParseTuple(_args, "l",
712 &inStyleRunIndex))
713 return NULL;
714 WEGetIndRunInfo(inStyleRunIndex,
715 &outStyleRunInfo,
716 _self->ob_itself);
717 _res = Py_BuildValue("O&",
718 RunInfo_New, &outStyleRunInfo);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000719 return _res;
720}
721
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000722static PyObject *wasteObj_WEGetRunDirection(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +0000723{
724 PyObject *_res = NULL;
725 Boolean _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +0000726 SInt32 inOffset;
Jack Jansen2369a981998-02-20 15:57:30 +0000727 if (!PyArg_ParseTuple(_args, "l",
Jack Jansenb99e5212002-01-11 12:37:15 +0000728 &inOffset))
Jack Jansen2369a981998-02-20 15:57:30 +0000729 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000730 _rv = WEGetRunDirection(inOffset,
Jack Jansen2369a981998-02-20 15:57:30 +0000731 _self->ob_itself);
732 _res = Py_BuildValue("b",
733 _rv);
734 return _res;
735}
736
Jack Jansenb99e5212002-01-11 12:37:15 +0000737static PyObject *wasteObj_WECountParaRuns(wasteObject *_self, PyObject *_args)
738{
739 PyObject *_res = NULL;
740 SInt32 _rv;
741 if (!PyArg_ParseTuple(_args, ""))
742 return NULL;
743 _rv = WECountParaRuns(_self->ob_itself);
744 _res = Py_BuildValue("l",
745 _rv);
746 return _res;
747}
748
749static PyObject *wasteObj_WEOffsetToParaRun(wasteObject *_self, PyObject *_args)
750{
751 PyObject *_res = NULL;
752 SInt32 _rv;
753 SInt32 inOffset;
754 if (!PyArg_ParseTuple(_args, "l",
755 &inOffset))
756 return NULL;
757 _rv = WEOffsetToParaRun(inOffset,
758 _self->ob_itself);
759 _res = Py_BuildValue("l",
760 _rv);
761 return _res;
762}
763
764static PyObject *wasteObj_WEGetParaRunRange(wasteObject *_self, PyObject *_args)
765{
766 PyObject *_res = NULL;
767 SInt32 inParagraphRunIndex;
768 SInt32 outParagraphRunStart;
769 SInt32 outParagraphRunEnd;
770 if (!PyArg_ParseTuple(_args, "l",
771 &inParagraphRunIndex))
772 return NULL;
773 WEGetParaRunRange(inParagraphRunIndex,
774 &outParagraphRunStart,
775 &outParagraphRunEnd,
776 _self->ob_itself);
777 _res = Py_BuildValue("ll",
778 outParagraphRunStart,
779 outParagraphRunEnd);
780 return _res;
781}
782
783static PyObject *wasteObj_WECountLines(wasteObject *_self, PyObject *_args)
784{
785 PyObject *_res = NULL;
786 SInt32 _rv;
787 if (!PyArg_ParseTuple(_args, ""))
788 return NULL;
789 _rv = WECountLines(_self->ob_itself);
790 _res = Py_BuildValue("l",
791 _rv);
792 return _res;
793}
794
795static PyObject *wasteObj_WEOffsetToLine(wasteObject *_self, PyObject *_args)
796{
797 PyObject *_res = NULL;
798 SInt32 _rv;
799 SInt32 inOffset;
800 if (!PyArg_ParseTuple(_args, "l",
801 &inOffset))
802 return NULL;
803 _rv = WEOffsetToLine(inOffset,
804 _self->ob_itself);
805 _res = Py_BuildValue("l",
806 _rv);
807 return _res;
808}
809
810static PyObject *wasteObj_WEGetLineRange(wasteObject *_self, PyObject *_args)
811{
812 PyObject *_res = NULL;
813 SInt32 inLineIndex;
814 SInt32 outLineStart;
815 SInt32 outLineEnd;
816 if (!PyArg_ParseTuple(_args, "l",
817 &inLineIndex))
818 return NULL;
819 WEGetLineRange(inLineIndex,
820 &outLineStart,
821 &outLineEnd,
822 _self->ob_itself);
823 _res = Py_BuildValue("ll",
824 outLineStart,
825 outLineEnd);
826 return _res;
827}
828
829static PyObject *wasteObj_WEGetHeight(wasteObject *_self, PyObject *_args)
830{
831 PyObject *_res = NULL;
832 SInt32 _rv;
833 SInt32 inStartLineIndex;
834 SInt32 inEndLineIndex;
835 if (!PyArg_ParseTuple(_args, "ll",
836 &inStartLineIndex,
837 &inEndLineIndex))
838 return NULL;
839 _rv = WEGetHeight(inStartLineIndex,
840 inEndLineIndex,
841 _self->ob_itself);
842 _res = Py_BuildValue("l",
843 _rv);
844 return _res;
845}
846
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000847static PyObject *wasteObj_WEGetOffset(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000848{
849 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +0000850 SInt32 _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +0000851 LongPt inPoint;
852 WEEdge outEdge;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000853 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +0000854 LongPt_Convert, &inPoint))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000855 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000856 _rv = WEGetOffset(&inPoint,
857 &outEdge,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000858 _self->ob_itself);
Jack Jansen97ed9072000-09-08 22:06:16 +0000859 _res = Py_BuildValue("lB",
Jack Jansen90ecdf41996-04-16 14:29:15 +0000860 _rv,
Jack Jansenb99e5212002-01-11 12:37:15 +0000861 outEdge);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000862 return _res;
863}
864
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000865static PyObject *wasteObj_WEGetPoint(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000866{
867 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000868 SInt32 inOffset;
869 SInt16 inDirection;
870 LongPt outPoint;
871 SInt16 outLineHeight;
Jack Jansen2268af51996-08-06 16:04:22 +0000872 if (!PyArg_ParseTuple(_args, "lh",
Jack Jansenb99e5212002-01-11 12:37:15 +0000873 &inOffset,
874 &inDirection))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000875 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000876 WEGetPoint(inOffset,
877 inDirection,
878 &outPoint,
879 &outLineHeight,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000880 _self->ob_itself);
881 _res = Py_BuildValue("O&h",
Jack Jansenb99e5212002-01-11 12:37:15 +0000882 LongPt_New, &outPoint,
883 outLineHeight);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000884 return _res;
885}
886
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000887static PyObject *wasteObj_WEFindWord(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000888{
889 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000890 SInt32 inOffset;
891 WEEdge inEdge;
892 SInt32 outWordStart;
893 SInt32 outWordEnd;
Jack Jansen97ed9072000-09-08 22:06:16 +0000894 if (!PyArg_ParseTuple(_args, "lB",
Jack Jansenb99e5212002-01-11 12:37:15 +0000895 &inOffset,
896 &inEdge))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000897 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000898 WEFindWord(inOffset,
899 inEdge,
900 &outWordStart,
901 &outWordEnd,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000902 _self->ob_itself);
903 _res = Py_BuildValue("ll",
Jack Jansenb99e5212002-01-11 12:37:15 +0000904 outWordStart,
905 outWordEnd);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000906 return _res;
907}
908
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000909static PyObject *wasteObj_WEFindLine(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000910{
911 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000912 SInt32 inOffset;
913 WEEdge inEdge;
914 SInt32 outLineStart;
915 SInt32 outLineEnd;
Jack Jansen97ed9072000-09-08 22:06:16 +0000916 if (!PyArg_ParseTuple(_args, "lB",
Jack Jansenb99e5212002-01-11 12:37:15 +0000917 &inOffset,
918 &inEdge))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000919 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000920 WEFindLine(inOffset,
921 inEdge,
922 &outLineStart,
923 &outLineEnd,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000924 _self->ob_itself);
925 _res = Py_BuildValue("ll",
Jack Jansenb99e5212002-01-11 12:37:15 +0000926 outLineStart,
927 outLineEnd);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000928 return _res;
929}
930
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000931static PyObject *wasteObj_WEFindParagraph(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +0000932{
933 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000934 SInt32 inOffset;
935 WEEdge inEdge;
936 SInt32 outParagraphStart;
937 SInt32 outParagraphEnd;
Jack Jansen97ed9072000-09-08 22:06:16 +0000938 if (!PyArg_ParseTuple(_args, "lB",
Jack Jansenb99e5212002-01-11 12:37:15 +0000939 &inOffset,
940 &inEdge))
Jack Jansen2369a981998-02-20 15:57:30 +0000941 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000942 WEFindParagraph(inOffset,
943 inEdge,
944 &outParagraphStart,
945 &outParagraphEnd,
Jack Jansen2369a981998-02-20 15:57:30 +0000946 _self->ob_itself);
947 _res = Py_BuildValue("ll",
Jack Jansenb99e5212002-01-11 12:37:15 +0000948 outParagraphStart,
949 outParagraphEnd);
950 return _res;
951}
952
953static PyObject *wasteObj_WEFind(wasteObject *_self, PyObject *_args)
954{
955 PyObject *_res = NULL;
956 OSErr _err;
957 char* inKey;
958 SInt32 inKeyLength;
959 TextEncoding inKeyEncoding;
960 OptionBits inMatchOptions;
961 SInt32 inRangeStart;
962 SInt32 inRangeEnd;
963 SInt32 outMatchStart;
964 SInt32 outMatchEnd;
965 if (!PyArg_ParseTuple(_args, "slllll",
966 &inKey,
967 &inKeyLength,
968 &inKeyEncoding,
969 &inMatchOptions,
970 &inRangeStart,
971 &inRangeEnd))
972 return NULL;
973 _err = WEFind(inKey,
974 inKeyLength,
975 inKeyEncoding,
976 inMatchOptions,
977 inRangeStart,
978 inRangeEnd,
979 &outMatchStart,
980 &outMatchEnd,
981 _self->ob_itself);
982 if (_err != noErr) return PyMac_Error(_err);
983 _res = Py_BuildValue("ll",
984 outMatchStart,
985 outMatchEnd);
986 return _res;
987}
988
989static PyObject *wasteObj_WEStreamRange(wasteObject *_self, PyObject *_args)
990{
991 PyObject *_res = NULL;
992 OSErr _err;
993 SInt32 inRangeStart;
994 SInt32 inRangeEnd;
995 FlavorType inRequestedType;
996 OptionBits inStreamOptions;
997 Handle outData;
998 if (!PyArg_ParseTuple(_args, "llO&lO&",
999 &inRangeStart,
1000 &inRangeEnd,
1001 PyMac_GetOSType, &inRequestedType,
1002 &inStreamOptions,
1003 ResObj_Convert, &outData))
1004 return NULL;
1005 _err = WEStreamRange(inRangeStart,
1006 inRangeEnd,
1007 inRequestedType,
1008 inStreamOptions,
1009 outData,
1010 _self->ob_itself);
1011 if (_err != noErr) return PyMac_Error(_err);
1012 Py_INCREF(Py_None);
1013 _res = Py_None;
Jack Jansen2369a981998-02-20 15:57:30 +00001014 return _res;
1015}
1016
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001017static PyObject *wasteObj_WECopyRange(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001018{
1019 PyObject *_res = NULL;
1020 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001021 SInt32 inRangeStart;
1022 SInt32 inRangeEnd;
1023 Handle outText;
1024 StScrpHandle outStyles;
1025 WESoupHandle outSoup;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001026 if (!PyArg_ParseTuple(_args, "llO&O&O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001027 &inRangeStart,
1028 &inRangeEnd,
1029 OptResObj_Convert, &outText,
1030 OptResObj_Convert, &outStyles,
1031 OptResObj_Convert, &outSoup))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001032 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001033 _err = WECopyRange(inRangeStart,
1034 inRangeEnd,
1035 outText,
1036 outStyles,
1037 outSoup,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001038 _self->ob_itself);
1039 if (_err != noErr) return PyMac_Error(_err);
1040 Py_INCREF(Py_None);
1041 _res = Py_None;
1042 return _res;
1043}
1044
Jack Jansenb99e5212002-01-11 12:37:15 +00001045static PyObject *wasteObj_WEGetTextRangeAsUnicode(wasteObject *_self, PyObject *_args)
1046{
1047 PyObject *_res = NULL;
1048 OSErr _err;
1049 SInt32 inRangeStart;
1050 SInt32 inRangeEnd;
1051 Handle outUnicodeText;
1052 Handle ioCharFormat;
1053 Handle ioParaFormat;
1054 TextEncodingVariant inUnicodeVariant;
1055 TextEncodingFormat inTransformationFormat;
1056 OptionBits inGetOptions;
1057 if (!PyArg_ParseTuple(_args, "llO&O&O&lll",
1058 &inRangeStart,
1059 &inRangeEnd,
1060 ResObj_Convert, &outUnicodeText,
1061 ResObj_Convert, &ioCharFormat,
1062 ResObj_Convert, &ioParaFormat,
1063 &inUnicodeVariant,
1064 &inTransformationFormat,
1065 &inGetOptions))
1066 return NULL;
1067 _err = WEGetTextRangeAsUnicode(inRangeStart,
1068 inRangeEnd,
1069 outUnicodeText,
1070 ioCharFormat,
1071 ioParaFormat,
1072 inUnicodeVariant,
1073 inTransformationFormat,
1074 inGetOptions,
1075 _self->ob_itself);
1076 if (_err != noErr) return PyMac_Error(_err);
1077 Py_INCREF(Py_None);
1078 _res = Py_None;
1079 return _res;
1080}
1081
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001082static PyObject *wasteObj_WEGetAlignment(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001083{
1084 PyObject *_res = NULL;
1085 WEAlignment _rv;
1086 if (!PyArg_ParseTuple(_args, ""))
1087 return NULL;
1088 _rv = WEGetAlignment(_self->ob_itself);
Jack Jansen97ed9072000-09-08 22:06:16 +00001089 _res = Py_BuildValue("B",
Jack Jansen90ecdf41996-04-16 14:29:15 +00001090 _rv);
1091 return _res;
1092}
1093
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001094static PyObject *wasteObj_WESetAlignment(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001095{
1096 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001097 WEAlignment inAlignment;
Jack Jansen97ed9072000-09-08 22:06:16 +00001098 if (!PyArg_ParseTuple(_args, "B",
Jack Jansenb99e5212002-01-11 12:37:15 +00001099 &inAlignment))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001100 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001101 WESetAlignment(inAlignment,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001102 _self->ob_itself);
1103 Py_INCREF(Py_None);
1104 _res = Py_None;
1105 return _res;
1106}
1107
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001108static PyObject *wasteObj_WEGetDirection(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00001109{
1110 PyObject *_res = NULL;
1111 WEDirection _rv;
1112 if (!PyArg_ParseTuple(_args, ""))
1113 return NULL;
1114 _rv = WEGetDirection(_self->ob_itself);
1115 _res = Py_BuildValue("h",
1116 _rv);
1117 return _res;
1118}
1119
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001120static PyObject *wasteObj_WESetDirection(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00001121{
1122 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001123 WEDirection inDirection;
Jack Jansen2369a981998-02-20 15:57:30 +00001124 if (!PyArg_ParseTuple(_args, "h",
Jack Jansenb99e5212002-01-11 12:37:15 +00001125 &inDirection))
Jack Jansen2369a981998-02-20 15:57:30 +00001126 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001127 WESetDirection(inDirection,
Jack Jansen2369a981998-02-20 15:57:30 +00001128 _self->ob_itself);
1129 Py_INCREF(Py_None);
1130 _res = Py_None;
1131 return _res;
1132}
1133
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001134static PyObject *wasteObj_WECalText(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001135{
1136 PyObject *_res = NULL;
1137 OSErr _err;
1138 if (!PyArg_ParseTuple(_args, ""))
1139 return NULL;
1140 _err = WECalText(_self->ob_itself);
1141 if (_err != noErr) return PyMac_Error(_err);
1142 Py_INCREF(Py_None);
1143 _res = Py_None;
1144 return _res;
1145}
1146
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001147static PyObject *wasteObj_WEUpdate(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001148{
1149 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001150 RgnHandle inUpdateRgn;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001151 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001152 ResObj_Convert, &inUpdateRgn))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001153 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001154 WEUpdate(inUpdateRgn,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001155 _self->ob_itself);
1156 Py_INCREF(Py_None);
1157 _res = Py_None;
1158 return _res;
1159}
1160
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001161static PyObject *wasteObj_WEScroll(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001162{
1163 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001164 SInt32 inHorizontalOffset;
1165 SInt32 inVerticalOffset;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001166 if (!PyArg_ParseTuple(_args, "ll",
Jack Jansenb99e5212002-01-11 12:37:15 +00001167 &inHorizontalOffset,
1168 &inVerticalOffset))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001169 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001170 WEScroll(inHorizontalOffset,
1171 inVerticalOffset,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001172 _self->ob_itself);
1173 Py_INCREF(Py_None);
1174 _res = Py_None;
1175 return _res;
1176}
1177
Jack Jansenb99e5212002-01-11 12:37:15 +00001178static PyObject *wasteObj_WEPinScroll(wasteObject *_self, PyObject *_args)
1179{
1180 PyObject *_res = NULL;
1181 SInt32 inHorizontalOffset;
1182 SInt32 inVerticalOffset;
1183 if (!PyArg_ParseTuple(_args, "ll",
1184 &inHorizontalOffset,
1185 &inVerticalOffset))
1186 return NULL;
1187 WEPinScroll(inHorizontalOffset,
1188 inVerticalOffset,
1189 _self->ob_itself);
1190 Py_INCREF(Py_None);
1191 _res = Py_None;
1192 return _res;
1193}
1194
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001195static PyObject *wasteObj_WESelView(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001196{
1197 PyObject *_res = NULL;
1198 if (!PyArg_ParseTuple(_args, ""))
1199 return NULL;
1200 WESelView(_self->ob_itself);
1201 Py_INCREF(Py_None);
1202 _res = Py_None;
1203 return _res;
1204}
1205
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001206static PyObject *wasteObj_WEActivate(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001207{
1208 PyObject *_res = NULL;
1209 if (!PyArg_ParseTuple(_args, ""))
1210 return NULL;
1211 WEActivate(_self->ob_itself);
1212 Py_INCREF(Py_None);
1213 _res = Py_None;
1214 return _res;
1215}
1216
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001217static PyObject *wasteObj_WEDeactivate(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001218{
1219 PyObject *_res = NULL;
1220 if (!PyArg_ParseTuple(_args, ""))
1221 return NULL;
1222 WEDeactivate(_self->ob_itself);
1223 Py_INCREF(Py_None);
1224 _res = Py_None;
1225 return _res;
1226}
1227
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001228static PyObject *wasteObj_WEKey(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001229{
1230 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001231 CharParameter inKey;
1232 EventModifiers inModifiers;
Jack Jansen9d8b96c2000-07-14 22:16:45 +00001233 if (!PyArg_ParseTuple(_args, "hH",
Jack Jansenb99e5212002-01-11 12:37:15 +00001234 &inKey,
1235 &inModifiers))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001236 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001237 WEKey(inKey,
1238 inModifiers,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001239 _self->ob_itself);
1240 Py_INCREF(Py_None);
1241 _res = Py_None;
1242 return _res;
1243}
1244
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001245static PyObject *wasteObj_WEClick(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001246{
1247 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001248 Point inHitPoint;
1249 EventModifiers inModifiers;
1250 UInt32 inClickTime;
Jack Jansen9d8b96c2000-07-14 22:16:45 +00001251 if (!PyArg_ParseTuple(_args, "O&Hl",
Jack Jansenb99e5212002-01-11 12:37:15 +00001252 PyMac_GetPoint, &inHitPoint,
1253 &inModifiers,
1254 &inClickTime))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001255 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001256 WEClick(inHitPoint,
1257 inModifiers,
1258 inClickTime,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001259 _self->ob_itself);
1260 Py_INCREF(Py_None);
1261 _res = Py_None;
1262 return _res;
1263}
1264
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001265static PyObject *wasteObj_WEAdjustCursor(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001266{
1267 PyObject *_res = NULL;
1268 Boolean _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00001269 Point inMouseLoc;
1270 RgnHandle ioMouseRgn;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001271 if (!PyArg_ParseTuple(_args, "O&O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001272 PyMac_GetPoint, &inMouseLoc,
1273 ResObj_Convert, &ioMouseRgn))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001274 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001275 _rv = WEAdjustCursor(inMouseLoc,
1276 ioMouseRgn,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001277 _self->ob_itself);
1278 _res = Py_BuildValue("b",
1279 _rv);
1280 return _res;
1281}
1282
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001283static PyObject *wasteObj_WEIdle(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001284{
1285 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001286 UInt32 outMaxSleep;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001287 if (!PyArg_ParseTuple(_args, ""))
1288 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001289 WEIdle(&outMaxSleep,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001290 _self->ob_itself);
1291 _res = Py_BuildValue("l",
Jack Jansenb99e5212002-01-11 12:37:15 +00001292 outMaxSleep);
Jack Jansen90ecdf41996-04-16 14:29:15 +00001293 return _res;
1294}
1295
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001296static PyObject *wasteObj_WEInsert(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001297{
1298 PyObject *_res = NULL;
1299 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001300 char *inTextPtr__in__;
1301 long inTextPtr__len__;
1302 int inTextPtr__in_len__;
1303 StScrpHandle inStyles;
1304 WESoupHandle inSoup;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001305 if (!PyArg_ParseTuple(_args, "s#O&O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001306 &inTextPtr__in__, &inTextPtr__in_len__,
1307 OptResObj_Convert, &inStyles,
1308 OptResObj_Convert, &inSoup))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001309 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001310 inTextPtr__len__ = inTextPtr__in_len__;
1311 _err = WEInsert(inTextPtr__in__, inTextPtr__len__,
1312 inStyles,
1313 inSoup,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001314 _self->ob_itself);
1315 if (_err != noErr) return PyMac_Error(_err);
1316 Py_INCREF(Py_None);
1317 _res = Py_None;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001318 return _res;
1319}
1320
Jack Jansenb99e5212002-01-11 12:37:15 +00001321static PyObject *wasteObj_WEInsertFormattedText(wasteObject *_self, PyObject *_args)
1322{
1323 PyObject *_res = NULL;
1324 OSErr _err;
1325 char *inTextPtr__in__;
1326 long inTextPtr__len__;
1327 int inTextPtr__in_len__;
1328 StScrpHandle inStyles;
1329 WESoupHandle inSoup;
1330 Handle inParaFormat;
1331 Handle inRulerScrap;
1332 if (!PyArg_ParseTuple(_args, "s#O&O&O&O&",
1333 &inTextPtr__in__, &inTextPtr__in_len__,
1334 OptResObj_Convert, &inStyles,
1335 OptResObj_Convert, &inSoup,
1336 ResObj_Convert, &inParaFormat,
1337 ResObj_Convert, &inRulerScrap))
1338 return NULL;
1339 inTextPtr__len__ = inTextPtr__in_len__;
1340 _err = WEInsertFormattedText(inTextPtr__in__, inTextPtr__len__,
1341 inStyles,
1342 inSoup,
1343 inParaFormat,
1344 inRulerScrap,
1345 _self->ob_itself);
1346 if (_err != noErr) return PyMac_Error(_err);
1347 Py_INCREF(Py_None);
1348 _res = Py_None;
1349 return _res;
1350}
1351
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001352static PyObject *wasteObj_WEDelete(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001353{
1354 PyObject *_res = NULL;
1355 OSErr _err;
1356 if (!PyArg_ParseTuple(_args, ""))
1357 return NULL;
1358 _err = WEDelete(_self->ob_itself);
1359 if (_err != noErr) return PyMac_Error(_err);
1360 Py_INCREF(Py_None);
1361 _res = Py_None;
1362 return _res;
1363}
1364
Jack Jansenb99e5212002-01-11 12:37:15 +00001365static PyObject *wasteObj_WEUseText(wasteObject *_self, PyObject *_args)
1366{
1367 PyObject *_res = NULL;
1368 OSErr _err;
1369 Handle inText;
1370 if (!PyArg_ParseTuple(_args, "O&",
1371 ResObj_Convert, &inText))
1372 return NULL;
1373 _err = WEUseText(inText,
1374 _self->ob_itself);
1375 if (_err != noErr) return PyMac_Error(_err);
1376 Py_INCREF(Py_None);
1377 _res = Py_None;
1378 return _res;
1379}
1380
1381static PyObject *wasteObj_WEChangeCase(wasteObject *_self, PyObject *_args)
1382{
1383 PyObject *_res = NULL;
1384 OSErr _err;
1385 SInt16 inCase;
1386 if (!PyArg_ParseTuple(_args, "h",
1387 &inCase))
1388 return NULL;
1389 _err = WEChangeCase(inCase,
1390 _self->ob_itself);
1391 if (_err != noErr) return PyMac_Error(_err);
1392 Py_INCREF(Py_None);
1393 _res = Py_None;
1394 return _res;
1395}
1396
1397static PyObject *wasteObj_WESetOneAttribute(wasteObject *_self, PyObject *_args)
1398{
1399 PyObject *_res = NULL;
1400 OSErr _err;
1401 SInt32 inRangeStart;
1402 SInt32 inRangeEnd;
1403 WESelector inAttributeSelector;
1404 char *inAttributeValue__in__;
1405 long inAttributeValue__len__;
1406 int inAttributeValue__in_len__;
1407 if (!PyArg_ParseTuple(_args, "llO&s#",
1408 &inRangeStart,
1409 &inRangeEnd,
1410 PyMac_GetOSType, &inAttributeSelector,
1411 &inAttributeValue__in__, &inAttributeValue__in_len__))
1412 return NULL;
1413 inAttributeValue__len__ = inAttributeValue__in_len__;
1414 _err = WESetOneAttribute(inRangeStart,
1415 inRangeEnd,
1416 inAttributeSelector,
1417 inAttributeValue__in__, inAttributeValue__len__,
1418 _self->ob_itself);
1419 if (_err != noErr) return PyMac_Error(_err);
1420 Py_INCREF(Py_None);
1421 _res = Py_None;
1422 return _res;
1423}
1424
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001425static PyObject *wasteObj_WESetStyle(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001426{
1427 PyObject *_res = NULL;
1428 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001429 WEStyleMode inMode;
1430 TextStyle inTextStyle;
Jack Jansen9d8b96c2000-07-14 22:16:45 +00001431 if (!PyArg_ParseTuple(_args, "HO&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001432 &inMode,
1433 TextStyle_Convert, &inTextStyle))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001434 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001435 _err = WESetStyle(inMode,
1436 &inTextStyle,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001437 _self->ob_itself);
1438 if (_err != noErr) return PyMac_Error(_err);
1439 Py_INCREF(Py_None);
1440 _res = Py_None;
1441 return _res;
1442}
1443
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001444static PyObject *wasteObj_WEUseStyleScrap(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001445{
1446 PyObject *_res = NULL;
1447 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001448 StScrpHandle inStyles;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001449 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001450 ResObj_Convert, &inStyles))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001451 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001452 _err = WEUseStyleScrap(inStyles,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001453 _self->ob_itself);
1454 if (_err != noErr) return PyMac_Error(_err);
1455 Py_INCREF(Py_None);
1456 _res = Py_None;
1457 return _res;
1458}
1459
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001460static PyObject *wasteObj_WEUndo(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001461{
1462 PyObject *_res = NULL;
1463 OSErr _err;
1464 if (!PyArg_ParseTuple(_args, ""))
1465 return NULL;
1466 _err = WEUndo(_self->ob_itself);
1467 if (_err != noErr) return PyMac_Error(_err);
1468 Py_INCREF(Py_None);
1469 _res = Py_None;
1470 return _res;
1471}
1472
Jack Jansenb99e5212002-01-11 12:37:15 +00001473static PyObject *wasteObj_WERedo(wasteObject *_self, PyObject *_args)
1474{
1475 PyObject *_res = NULL;
1476 OSErr _err;
1477 if (!PyArg_ParseTuple(_args, ""))
1478 return NULL;
1479 _err = WERedo(_self->ob_itself);
1480 if (_err != noErr) return PyMac_Error(_err);
1481 Py_INCREF(Py_None);
1482 _res = Py_None;
1483 return _res;
1484}
1485
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001486static PyObject *wasteObj_WEClearUndo(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001487{
1488 PyObject *_res = NULL;
1489 if (!PyArg_ParseTuple(_args, ""))
1490 return NULL;
1491 WEClearUndo(_self->ob_itself);
1492 Py_INCREF(Py_None);
1493 _res = Py_None;
1494 return _res;
1495}
1496
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001497static PyObject *wasteObj_WEGetUndoInfo(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001498{
1499 PyObject *_res = NULL;
1500 WEActionKind _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00001501 Boolean outRedoFlag;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001502 if (!PyArg_ParseTuple(_args, ""))
1503 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001504 _rv = WEGetUndoInfo(&outRedoFlag,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001505 _self->ob_itself);
1506 _res = Py_BuildValue("hb",
1507 _rv,
Jack Jansenb99e5212002-01-11 12:37:15 +00001508 outRedoFlag);
1509 return _res;
1510}
1511
1512static PyObject *wasteObj_WEGetIndUndoInfo(wasteObject *_self, PyObject *_args)
1513{
1514 PyObject *_res = NULL;
1515 WEActionKind _rv;
1516 SInt32 inUndoLevel;
1517 if (!PyArg_ParseTuple(_args, "l",
1518 &inUndoLevel))
1519 return NULL;
1520 _rv = WEGetIndUndoInfo(inUndoLevel,
1521 _self->ob_itself);
1522 _res = Py_BuildValue("h",
1523 _rv);
Jack Jansen90ecdf41996-04-16 14:29:15 +00001524 return _res;
1525}
1526
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001527static PyObject *wasteObj_WEIsTyping(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001528{
1529 PyObject *_res = NULL;
1530 Boolean _rv;
1531 if (!PyArg_ParseTuple(_args, ""))
1532 return NULL;
1533 _rv = WEIsTyping(_self->ob_itself);
1534 _res = Py_BuildValue("b",
1535 _rv);
1536 return _res;
1537}
1538
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001539static PyObject *wasteObj_WEBeginAction(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00001540{
1541 PyObject *_res = NULL;
1542 OSErr _err;
1543 if (!PyArg_ParseTuple(_args, ""))
1544 return NULL;
1545 _err = WEBeginAction(_self->ob_itself);
1546 if (_err != noErr) return PyMac_Error(_err);
1547 Py_INCREF(Py_None);
1548 _res = Py_None;
1549 return _res;
1550}
1551
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001552static PyObject *wasteObj_WEEndAction(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00001553{
1554 PyObject *_res = NULL;
1555 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001556 WEActionKind inActionKind;
Jack Jansen2369a981998-02-20 15:57:30 +00001557 if (!PyArg_ParseTuple(_args, "h",
Jack Jansenb99e5212002-01-11 12:37:15 +00001558 &inActionKind))
Jack Jansen2369a981998-02-20 15:57:30 +00001559 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001560 _err = WEEndAction(inActionKind,
Jack Jansen2369a981998-02-20 15:57:30 +00001561 _self->ob_itself);
1562 if (_err != noErr) return PyMac_Error(_err);
1563 Py_INCREF(Py_None);
1564 _res = Py_None;
1565 return _res;
1566}
1567
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001568static PyObject *wasteObj_WEGetModCount(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001569{
1570 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +00001571 UInt32 _rv;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001572 if (!PyArg_ParseTuple(_args, ""))
1573 return NULL;
1574 _rv = WEGetModCount(_self->ob_itself);
1575 _res = Py_BuildValue("l",
1576 _rv);
1577 return _res;
1578}
1579
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001580static PyObject *wasteObj_WEResetModCount(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001581{
1582 PyObject *_res = NULL;
1583 if (!PyArg_ParseTuple(_args, ""))
1584 return NULL;
1585 WEResetModCount(_self->ob_itself);
1586 Py_INCREF(Py_None);
1587 _res = Py_None;
1588 return _res;
1589}
1590
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001591static PyObject *wasteObj_WEInsertObject(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001592{
1593 PyObject *_res = NULL;
1594 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001595 FlavorType inObjectType;
1596 Handle inObjectDataHandle;
1597 Point inObjectSize;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001598 if (!PyArg_ParseTuple(_args, "O&O&O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001599 PyMac_GetOSType, &inObjectType,
1600 ResObj_Convert, &inObjectDataHandle,
1601 PyMac_GetPoint, &inObjectSize))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001602 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001603 _err = WEInsertObject(inObjectType,
1604 inObjectDataHandle,
1605 inObjectSize,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001606 _self->ob_itself);
1607 if (_err != noErr) return PyMac_Error(_err);
1608 Py_INCREF(Py_None);
1609 _res = Py_None;
1610 return _res;
1611}
1612
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001613static PyObject *wasteObj_WEGetSelectedObject(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001614{
1615 PyObject *_res = NULL;
1616 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001617 WEObjectReference outObject;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001618 if (!PyArg_ParseTuple(_args, ""))
1619 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001620 _err = WEGetSelectedObject(&outObject,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001621 _self->ob_itself);
1622 if (_err != noErr) return PyMac_Error(_err);
1623 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001624 WEOObj_New, outObject);
1625 return _res;
1626}
1627
1628static PyObject *wasteObj_WEGetObjectAtOffset(wasteObject *_self, PyObject *_args)
1629{
1630 PyObject *_res = NULL;
1631 OSErr _err;
1632 SInt32 inOffset;
1633 WEObjectReference outObject;
1634 if (!PyArg_ParseTuple(_args, "l",
1635 &inOffset))
1636 return NULL;
1637 _err = WEGetObjectAtOffset(inOffset,
1638 &outObject,
1639 _self->ob_itself);
1640 if (_err != noErr) return PyMac_Error(_err);
1641 _res = Py_BuildValue("O&",
1642 WEOObj_New, outObject);
Jack Jansen90ecdf41996-04-16 14:29:15 +00001643 return _res;
1644}
1645
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001646static PyObject *wasteObj_WEFindNextObject(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001647{
1648 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +00001649 SInt32 _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00001650 SInt32 inOffset;
1651 WEObjectReference outObject;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001652 if (!PyArg_ParseTuple(_args, "l",
Jack Jansenb99e5212002-01-11 12:37:15 +00001653 &inOffset))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001654 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001655 _rv = WEFindNextObject(inOffset,
1656 &outObject,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001657 _self->ob_itself);
1658 _res = Py_BuildValue("lO&",
1659 _rv,
Jack Jansenb99e5212002-01-11 12:37:15 +00001660 WEOObj_New, outObject);
Jack Jansen90ecdf41996-04-16 14:29:15 +00001661 return _res;
1662}
1663
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001664static PyObject *wasteObj_WEUseSoup(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001665{
1666 PyObject *_res = NULL;
1667 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001668 WESoupHandle inSoup;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001669 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001670 ResObj_Convert, &inSoup))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001671 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001672 _err = WEUseSoup(inSoup,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001673 _self->ob_itself);
1674 if (_err != noErr) return PyMac_Error(_err);
1675 Py_INCREF(Py_None);
1676 _res = Py_None;
1677 return _res;
1678}
1679
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001680static PyObject *wasteObj_WECut(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001681{
1682 PyObject *_res = NULL;
1683 OSErr _err;
1684 if (!PyArg_ParseTuple(_args, ""))
1685 return NULL;
1686 _err = WECut(_self->ob_itself);
1687 if (_err != noErr) return PyMac_Error(_err);
1688 Py_INCREF(Py_None);
1689 _res = Py_None;
1690 return _res;
1691}
1692
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001693static PyObject *wasteObj_WECopy(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001694{
1695 PyObject *_res = NULL;
1696 OSErr _err;
1697 if (!PyArg_ParseTuple(_args, ""))
1698 return NULL;
1699 _err = WECopy(_self->ob_itself);
1700 if (_err != noErr) return PyMac_Error(_err);
1701 Py_INCREF(Py_None);
1702 _res = Py_None;
1703 return _res;
1704}
1705
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001706static PyObject *wasteObj_WEPaste(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001707{
1708 PyObject *_res = NULL;
1709 OSErr _err;
1710 if (!PyArg_ParseTuple(_args, ""))
1711 return NULL;
1712 _err = WEPaste(_self->ob_itself);
1713 if (_err != noErr) return PyMac_Error(_err);
1714 Py_INCREF(Py_None);
1715 _res = Py_None;
1716 return _res;
1717}
1718
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001719static PyObject *wasteObj_WECanPaste(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001720{
1721 PyObject *_res = NULL;
1722 Boolean _rv;
1723 if (!PyArg_ParseTuple(_args, ""))
1724 return NULL;
1725 _rv = WECanPaste(_self->ob_itself);
1726 _res = Py_BuildValue("b",
1727 _rv);
1728 return _res;
1729}
1730
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001731static PyObject *wasteObj_WEGetHiliteRgn(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001732{
1733 PyObject *_res = NULL;
1734 RgnHandle _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00001735 SInt32 inRangeStart;
1736 SInt32 inRangeEnd;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001737 if (!PyArg_ParseTuple(_args, "ll",
Jack Jansenb99e5212002-01-11 12:37:15 +00001738 &inRangeStart,
1739 &inRangeEnd))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001740 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001741 _rv = WEGetHiliteRgn(inRangeStart,
1742 inRangeEnd,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001743 _self->ob_itself);
1744 _res = Py_BuildValue("O&",
1745 ResObj_New, _rv);
1746 return _res;
1747}
1748
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001749static PyObject *wasteObj_WECharByte(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001750{
1751 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +00001752 SInt16 _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00001753 SInt32 inOffset;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001754 if (!PyArg_ParseTuple(_args, "l",
Jack Jansenb99e5212002-01-11 12:37:15 +00001755 &inOffset))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001756 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001757 _rv = WECharByte(inOffset,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001758 _self->ob_itself);
1759 _res = Py_BuildValue("h",
1760 _rv);
1761 return _res;
1762}
1763
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001764static PyObject *wasteObj_WECharType(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001765{
1766 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +00001767 SInt16 _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00001768 SInt32 inOffset;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001769 if (!PyArg_ParseTuple(_args, "l",
Jack Jansenb99e5212002-01-11 12:37:15 +00001770 &inOffset))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001771 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001772 _rv = WECharType(inOffset,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001773 _self->ob_itself);
1774 _res = Py_BuildValue("h",
1775 _rv);
1776 return _res;
1777}
1778
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001779static PyObject *wasteObj_WEStopInlineSession(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001780{
1781 PyObject *_res = NULL;
1782 if (!PyArg_ParseTuple(_args, ""))
1783 return NULL;
1784 WEStopInlineSession(_self->ob_itself);
1785 Py_INCREF(Py_None);
1786 _res = Py_None;
1787 return _res;
1788}
1789
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001790static PyObject *wasteObj_WEFeatureFlag(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001791{
1792 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +00001793 SInt16 _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00001794 SInt16 inFeature;
1795 SInt16 inAction;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001796 if (!PyArg_ParseTuple(_args, "hh",
Jack Jansenb99e5212002-01-11 12:37:15 +00001797 &inFeature,
1798 &inAction))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001799 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001800 _rv = WEFeatureFlag(inFeature,
1801 inAction,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001802 _self->ob_itself);
1803 _res = Py_BuildValue("h",
1804 _rv);
1805 return _res;
1806}
1807
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001808static PyObject *wasteObj_WEGetUserInfo(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00001809{
1810 PyObject *_res = NULL;
1811 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001812 WESelector inUserTag;
1813 SInt32 outUserInfo;
Jack Jansen2369a981998-02-20 15:57:30 +00001814 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001815 PyMac_GetOSType, &inUserTag))
Jack Jansen2369a981998-02-20 15:57:30 +00001816 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001817 _err = WEGetUserInfo(inUserTag,
1818 &outUserInfo,
Jack Jansen2369a981998-02-20 15:57:30 +00001819 _self->ob_itself);
1820 if (_err != noErr) return PyMac_Error(_err);
1821 _res = Py_BuildValue("l",
Jack Jansenb99e5212002-01-11 12:37:15 +00001822 outUserInfo);
Jack Jansen2369a981998-02-20 15:57:30 +00001823 return _res;
1824}
1825
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001826static PyObject *wasteObj_WESetUserInfo(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00001827{
1828 PyObject *_res = NULL;
1829 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001830 WESelector inUserTag;
1831 SInt32 inUserInfo;
Jack Jansen2369a981998-02-20 15:57:30 +00001832 if (!PyArg_ParseTuple(_args, "O&l",
Jack Jansenb99e5212002-01-11 12:37:15 +00001833 PyMac_GetOSType, &inUserTag,
1834 &inUserInfo))
Jack Jansen2369a981998-02-20 15:57:30 +00001835 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001836 _err = WESetUserInfo(inUserTag,
1837 inUserInfo,
Jack Jansen2369a981998-02-20 15:57:30 +00001838 _self->ob_itself);
1839 if (_err != noErr) return PyMac_Error(_err);
1840 Py_INCREF(Py_None);
1841 _res = Py_None;
1842 return _res;
1843}
1844
Jack Jansenb99e5212002-01-11 12:37:15 +00001845static PyObject *wasteObj_WERemoveUserInfo(wasteObject *_self, PyObject *_args)
1846{
1847 PyObject *_res = NULL;
1848 OSErr _err;
1849 WESelector inUserTag;
1850 if (!PyArg_ParseTuple(_args, "O&",
1851 PyMac_GetOSType, &inUserTag))
1852 return NULL;
1853 _err = WERemoveUserInfo(inUserTag,
1854 _self->ob_itself);
1855 if (_err != noErr) return PyMac_Error(_err);
1856 Py_INCREF(Py_None);
1857 _res = Py_None;
1858 return _res;
1859}
1860
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001861static PyObject *wasteObj_WEInstallTabHooks(wasteObject *_self, PyObject *_args)
Jack Jansen176f3a91996-10-23 15:43:46 +00001862{
1863 PyObject *_res = NULL;
1864 OSErr _err;
1865 if (!PyArg_ParseTuple(_args, ""))
1866 return NULL;
1867 _err = WEInstallTabHooks(_self->ob_itself);
1868 if (_err != noErr) return PyMac_Error(_err);
1869 Py_INCREF(Py_None);
1870 _res = Py_None;
1871 return _res;
1872}
1873
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001874static PyObject *wasteObj_WERemoveTabHooks(wasteObject *_self, PyObject *_args)
Jack Jansen176f3a91996-10-23 15:43:46 +00001875{
1876 PyObject *_res = NULL;
1877 OSErr _err;
1878 if (!PyArg_ParseTuple(_args, ""))
1879 return NULL;
1880 _err = WERemoveTabHooks(_self->ob_itself);
1881 if (_err != noErr) return PyMac_Error(_err);
1882 Py_INCREF(Py_None);
1883 _res = Py_None;
1884 return _res;
1885}
1886
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001887static PyObject *wasteObj_WEIsTabHooks(wasteObject *_self, PyObject *_args)
Jack Jansen176f3a91996-10-23 15:43:46 +00001888{
1889 PyObject *_res = NULL;
1890 Boolean _rv;
1891 if (!PyArg_ParseTuple(_args, ""))
1892 return NULL;
1893 _rv = WEIsTabHooks(_self->ob_itself);
1894 _res = Py_BuildValue("b",
1895 _rv);
1896 return _res;
1897}
1898
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001899static PyObject *wasteObj_WEGetTabSize(wasteObject *_self, PyObject *_args)
Jack Jansena4f03091998-03-02 16:56:18 +00001900{
1901 PyObject *_res = NULL;
1902 SInt16 _rv;
1903 if (!PyArg_ParseTuple(_args, ""))
1904 return NULL;
1905 _rv = WEGetTabSize(_self->ob_itself);
1906 _res = Py_BuildValue("h",
1907 _rv);
1908 return _res;
1909}
1910
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001911static PyObject *wasteObj_WESetTabSize(wasteObject *_self, PyObject *_args)
Jack Jansena4f03091998-03-02 16:56:18 +00001912{
1913 PyObject *_res = NULL;
1914 OSErr _err;
1915 SInt16 tabWidth;
1916 if (!PyArg_ParseTuple(_args, "h",
1917 &tabWidth))
1918 return NULL;
1919 _err = WESetTabSize(tabWidth,
1920 _self->ob_itself);
1921 if (_err != noErr) return PyMac_Error(_err);
1922 Py_INCREF(Py_None);
1923 _res = Py_None;
1924 return _res;
1925}
1926
Jack Jansen90ecdf41996-04-16 14:29:15 +00001927static PyMethodDef wasteObj_methods[] = {
1928 {"WEGetText", (PyCFunction)wasteObj_WEGetText, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001929 PyDoc_STR("() -> (Handle _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001930 {"WEGetChar", (PyCFunction)wasteObj_WEGetChar, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001931 PyDoc_STR("(SInt32 inOffset) -> (SInt16 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001932 {"WEGetTextLength", (PyCFunction)wasteObj_WEGetTextLength, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001933 PyDoc_STR("() -> (SInt32 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001934 {"WEGetSelection", (PyCFunction)wasteObj_WEGetSelection, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001935 PyDoc_STR("() -> (SInt32 outSelStart, SInt32 outSelEnd)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001936 {"WEGetDestRect", (PyCFunction)wasteObj_WEGetDestRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001937 PyDoc_STR("() -> (LongRect outDestRect)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001938 {"WEGetViewRect", (PyCFunction)wasteObj_WEGetViewRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001939 PyDoc_STR("() -> (LongRect outViewRect)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001940 {"WEIsActive", (PyCFunction)wasteObj_WEIsActive, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001941 PyDoc_STR("() -> (Boolean _rv)")},
Jack Jansen2268af51996-08-06 16:04:22 +00001942 {"WEGetClickCount", (PyCFunction)wasteObj_WEGetClickCount, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001943 PyDoc_STR("() -> (UInt16 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001944 {"WESetSelection", (PyCFunction)wasteObj_WESetSelection, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001945 PyDoc_STR("(SInt32 inSelStart, SInt32 inSelEnd) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001946 {"WESetDestRect", (PyCFunction)wasteObj_WESetDestRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001947 PyDoc_STR("(LongRect inDestRect) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001948 {"WESetViewRect", (PyCFunction)wasteObj_WESetViewRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001949 PyDoc_STR("(LongRect inViewRect) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001950 {"WEContinuousStyle", (PyCFunction)wasteObj_WEContinuousStyle, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001951 PyDoc_STR("(WEStyleMode ioMode) -> (Boolean _rv, WEStyleMode ioMode, TextStyle outTextStyle)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001952 {"WECountRuns", (PyCFunction)wasteObj_WECountRuns, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001953 PyDoc_STR("() -> (SInt32 _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001954 {"WEOffsetToRun", (PyCFunction)wasteObj_WEOffsetToRun, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001955 PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001956 {"WEGetRunRange", (PyCFunction)wasteObj_WEGetRunRange, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001957 PyDoc_STR("(SInt32 inStyleRunIndex) -> (SInt32 outStyleRunStart, SInt32 outStyleRunEnd)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001958 {"WEGetRunInfo", (PyCFunction)wasteObj_WEGetRunInfo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001959 PyDoc_STR("(SInt32 inOffset) -> (WERunInfo outStyleRunInfo)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001960 {"WEGetIndRunInfo", (PyCFunction)wasteObj_WEGetIndRunInfo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001961 PyDoc_STR("(SInt32 inStyleRunIndex) -> (WERunInfo outStyleRunInfo)")},
Jack Jansen2369a981998-02-20 15:57:30 +00001962 {"WEGetRunDirection", (PyCFunction)wasteObj_WEGetRunDirection, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001963 PyDoc_STR("(SInt32 inOffset) -> (Boolean _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001964 {"WECountParaRuns", (PyCFunction)wasteObj_WECountParaRuns, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001965 PyDoc_STR("() -> (SInt32 _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001966 {"WEOffsetToParaRun", (PyCFunction)wasteObj_WEOffsetToParaRun, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001967 PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001968 {"WEGetParaRunRange", (PyCFunction)wasteObj_WEGetParaRunRange, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001969 PyDoc_STR("(SInt32 inParagraphRunIndex) -> (SInt32 outParagraphRunStart, SInt32 outParagraphRunEnd)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001970 {"WECountLines", (PyCFunction)wasteObj_WECountLines, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001971 PyDoc_STR("() -> (SInt32 _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001972 {"WEOffsetToLine", (PyCFunction)wasteObj_WEOffsetToLine, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001973 PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001974 {"WEGetLineRange", (PyCFunction)wasteObj_WEGetLineRange, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001975 PyDoc_STR("(SInt32 inLineIndex) -> (SInt32 outLineStart, SInt32 outLineEnd)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001976 {"WEGetHeight", (PyCFunction)wasteObj_WEGetHeight, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001977 PyDoc_STR("(SInt32 inStartLineIndex, SInt32 inEndLineIndex) -> (SInt32 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001978 {"WEGetOffset", (PyCFunction)wasteObj_WEGetOffset, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001979 PyDoc_STR("(LongPt inPoint) -> (SInt32 _rv, WEEdge outEdge)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001980 {"WEGetPoint", (PyCFunction)wasteObj_WEGetPoint, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001981 PyDoc_STR("(SInt32 inOffset, SInt16 inDirection) -> (LongPt outPoint, SInt16 outLineHeight)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001982 {"WEFindWord", (PyCFunction)wasteObj_WEFindWord, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001983 PyDoc_STR("(SInt32 inOffset, WEEdge inEdge) -> (SInt32 outWordStart, SInt32 outWordEnd)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001984 {"WEFindLine", (PyCFunction)wasteObj_WEFindLine, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001985 PyDoc_STR("(SInt32 inOffset, WEEdge inEdge) -> (SInt32 outLineStart, SInt32 outLineEnd)")},
Jack Jansen2369a981998-02-20 15:57:30 +00001986 {"WEFindParagraph", (PyCFunction)wasteObj_WEFindParagraph, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001987 PyDoc_STR("(SInt32 inOffset, WEEdge inEdge) -> (SInt32 outParagraphStart, SInt32 outParagraphEnd)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001988 {"WEFind", (PyCFunction)wasteObj_WEFind, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001989 PyDoc_STR("(char* inKey, SInt32 inKeyLength, TextEncoding inKeyEncoding, OptionBits inMatchOptions, SInt32 inRangeStart, SInt32 inRangeEnd) -> (SInt32 outMatchStart, SInt32 outMatchEnd)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001990 {"WEStreamRange", (PyCFunction)wasteObj_WEStreamRange, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001991 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd, FlavorType inRequestedType, OptionBits inStreamOptions, Handle outData) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001992 {"WECopyRange", (PyCFunction)wasteObj_WECopyRange, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001993 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd, Handle outText, StScrpHandle outStyles, WESoupHandle outSoup) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001994 {"WEGetTextRangeAsUnicode", (PyCFunction)wasteObj_WEGetTextRangeAsUnicode, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001995 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd, Handle outUnicodeText, Handle ioCharFormat, Handle ioParaFormat, TextEncodingVariant inUnicodeVariant, TextEncodingFormat inTransformationFormat, OptionBits inGetOptions) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001996 {"WEGetAlignment", (PyCFunction)wasteObj_WEGetAlignment, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001997 PyDoc_STR("() -> (WEAlignment _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001998 {"WESetAlignment", (PyCFunction)wasteObj_WESetAlignment, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001999 PyDoc_STR("(WEAlignment inAlignment) -> None")},
Jack Jansen2369a981998-02-20 15:57:30 +00002000 {"WEGetDirection", (PyCFunction)wasteObj_WEGetDirection, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002001 PyDoc_STR("() -> (WEDirection _rv)")},
Jack Jansen2369a981998-02-20 15:57:30 +00002002 {"WESetDirection", (PyCFunction)wasteObj_WESetDirection, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002003 PyDoc_STR("(WEDirection inDirection) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002004 {"WECalText", (PyCFunction)wasteObj_WECalText, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002005 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002006 {"WEUpdate", (PyCFunction)wasteObj_WEUpdate, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002007 PyDoc_STR("(RgnHandle inUpdateRgn) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002008 {"WEScroll", (PyCFunction)wasteObj_WEScroll, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002009 PyDoc_STR("(SInt32 inHorizontalOffset, SInt32 inVerticalOffset) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002010 {"WEPinScroll", (PyCFunction)wasteObj_WEPinScroll, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002011 PyDoc_STR("(SInt32 inHorizontalOffset, SInt32 inVerticalOffset) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002012 {"WESelView", (PyCFunction)wasteObj_WESelView, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002013 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002014 {"WEActivate", (PyCFunction)wasteObj_WEActivate, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002015 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002016 {"WEDeactivate", (PyCFunction)wasteObj_WEDeactivate, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002017 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002018 {"WEKey", (PyCFunction)wasteObj_WEKey, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002019 PyDoc_STR("(CharParameter inKey, EventModifiers inModifiers) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002020 {"WEClick", (PyCFunction)wasteObj_WEClick, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002021 PyDoc_STR("(Point inHitPoint, EventModifiers inModifiers, UInt32 inClickTime) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002022 {"WEAdjustCursor", (PyCFunction)wasteObj_WEAdjustCursor, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002023 PyDoc_STR("(Point inMouseLoc, RgnHandle ioMouseRgn) -> (Boolean _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002024 {"WEIdle", (PyCFunction)wasteObj_WEIdle, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002025 PyDoc_STR("() -> (UInt32 outMaxSleep)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002026 {"WEInsert", (PyCFunction)wasteObj_WEInsert, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002027 PyDoc_STR("(Buffer inTextPtr, StScrpHandle inStyles, WESoupHandle inSoup) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002028 {"WEInsertFormattedText", (PyCFunction)wasteObj_WEInsertFormattedText, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002029 PyDoc_STR("(Buffer inTextPtr, StScrpHandle inStyles, WESoupHandle inSoup, Handle inParaFormat, Handle inRulerScrap) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002030 {"WEDelete", (PyCFunction)wasteObj_WEDelete, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002031 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002032 {"WEUseText", (PyCFunction)wasteObj_WEUseText, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002033 PyDoc_STR("(Handle inText) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002034 {"WEChangeCase", (PyCFunction)wasteObj_WEChangeCase, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002035 PyDoc_STR("(SInt16 inCase) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002036 {"WESetOneAttribute", (PyCFunction)wasteObj_WESetOneAttribute, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002037 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd, WESelector inAttributeSelector, Buffer inAttributeValue) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002038 {"WESetStyle", (PyCFunction)wasteObj_WESetStyle, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002039 PyDoc_STR("(WEStyleMode inMode, TextStyle inTextStyle) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002040 {"WEUseStyleScrap", (PyCFunction)wasteObj_WEUseStyleScrap, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002041 PyDoc_STR("(StScrpHandle inStyles) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002042 {"WEUndo", (PyCFunction)wasteObj_WEUndo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002043 PyDoc_STR("() -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002044 {"WERedo", (PyCFunction)wasteObj_WERedo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002045 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002046 {"WEClearUndo", (PyCFunction)wasteObj_WEClearUndo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002047 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002048 {"WEGetUndoInfo", (PyCFunction)wasteObj_WEGetUndoInfo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002049 PyDoc_STR("() -> (WEActionKind _rv, Boolean outRedoFlag)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002050 {"WEGetIndUndoInfo", (PyCFunction)wasteObj_WEGetIndUndoInfo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002051 PyDoc_STR("(SInt32 inUndoLevel) -> (WEActionKind _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002052 {"WEIsTyping", (PyCFunction)wasteObj_WEIsTyping, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002053 PyDoc_STR("() -> (Boolean _rv)")},
Jack Jansen2369a981998-02-20 15:57:30 +00002054 {"WEBeginAction", (PyCFunction)wasteObj_WEBeginAction, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002055 PyDoc_STR("() -> None")},
Jack Jansen2369a981998-02-20 15:57:30 +00002056 {"WEEndAction", (PyCFunction)wasteObj_WEEndAction, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002057 PyDoc_STR("(WEActionKind inActionKind) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002058 {"WEGetModCount", (PyCFunction)wasteObj_WEGetModCount, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002059 PyDoc_STR("() -> (UInt32 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002060 {"WEResetModCount", (PyCFunction)wasteObj_WEResetModCount, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002061 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002062 {"WEInsertObject", (PyCFunction)wasteObj_WEInsertObject, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002063 PyDoc_STR("(FlavorType inObjectType, Handle inObjectDataHandle, Point inObjectSize) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002064 {"WEGetSelectedObject", (PyCFunction)wasteObj_WEGetSelectedObject, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002065 PyDoc_STR("() -> (WEObjectReference outObject)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002066 {"WEGetObjectAtOffset", (PyCFunction)wasteObj_WEGetObjectAtOffset, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002067 PyDoc_STR("(SInt32 inOffset) -> (WEObjectReference outObject)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002068 {"WEFindNextObject", (PyCFunction)wasteObj_WEFindNextObject, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002069 PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv, WEObjectReference outObject)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002070 {"WEUseSoup", (PyCFunction)wasteObj_WEUseSoup, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002071 PyDoc_STR("(WESoupHandle inSoup) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002072 {"WECut", (PyCFunction)wasteObj_WECut, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002073 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002074 {"WECopy", (PyCFunction)wasteObj_WECopy, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002075 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002076 {"WEPaste", (PyCFunction)wasteObj_WEPaste, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002077 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002078 {"WECanPaste", (PyCFunction)wasteObj_WECanPaste, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002079 PyDoc_STR("() -> (Boolean _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002080 {"WEGetHiliteRgn", (PyCFunction)wasteObj_WEGetHiliteRgn, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002081 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd) -> (RgnHandle _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002082 {"WECharByte", (PyCFunction)wasteObj_WECharByte, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002083 PyDoc_STR("(SInt32 inOffset) -> (SInt16 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002084 {"WECharType", (PyCFunction)wasteObj_WECharType, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002085 PyDoc_STR("(SInt32 inOffset) -> (SInt16 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002086 {"WEStopInlineSession", (PyCFunction)wasteObj_WEStopInlineSession, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002087 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002088 {"WEFeatureFlag", (PyCFunction)wasteObj_WEFeatureFlag, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002089 PyDoc_STR("(SInt16 inFeature, SInt16 inAction) -> (SInt16 _rv)")},
Jack Jansen2369a981998-02-20 15:57:30 +00002090 {"WEGetUserInfo", (PyCFunction)wasteObj_WEGetUserInfo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002091 PyDoc_STR("(WESelector inUserTag) -> (SInt32 outUserInfo)")},
Jack Jansen2369a981998-02-20 15:57:30 +00002092 {"WESetUserInfo", (PyCFunction)wasteObj_WESetUserInfo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002093 PyDoc_STR("(WESelector inUserTag, SInt32 inUserInfo) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002094 {"WERemoveUserInfo", (PyCFunction)wasteObj_WERemoveUserInfo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002095 PyDoc_STR("(WESelector inUserTag) -> None")},
Jack Jansen176f3a91996-10-23 15:43:46 +00002096 {"WEInstallTabHooks", (PyCFunction)wasteObj_WEInstallTabHooks, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002097 PyDoc_STR("() -> None")},
Jack Jansen176f3a91996-10-23 15:43:46 +00002098 {"WERemoveTabHooks", (PyCFunction)wasteObj_WERemoveTabHooks, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002099 PyDoc_STR("() -> None")},
Jack Jansen176f3a91996-10-23 15:43:46 +00002100 {"WEIsTabHooks", (PyCFunction)wasteObj_WEIsTabHooks, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002101 PyDoc_STR("() -> (Boolean _rv)")},
Jack Jansena4f03091998-03-02 16:56:18 +00002102 {"WEGetTabSize", (PyCFunction)wasteObj_WEGetTabSize, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002103 PyDoc_STR("() -> (SInt16 _rv)")},
Jack Jansena4f03091998-03-02 16:56:18 +00002104 {"WESetTabSize", (PyCFunction)wasteObj_WESetTabSize, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002105 PyDoc_STR("(SInt16 tabWidth) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002106 {NULL, NULL, 0}
2107};
2108
Jack Jansendbd57012002-11-29 23:40:48 +00002109#define wasteObj_getsetlist NULL
Jack Jansen90ecdf41996-04-16 14:29:15 +00002110
Jack Jansen9d8b96c2000-07-14 22:16:45 +00002111#define wasteObj_compare NULL
2112
2113#define wasteObj_repr NULL
2114
2115#define wasteObj_hash NULL
2116
Jack Jansen90ecdf41996-04-16 14:29:15 +00002117PyTypeObject waste_Type = {
Jack Jansenb3be2162001-11-30 14:16:36 +00002118 PyObject_HEAD_INIT(NULL)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002119 0, /*ob_size*/
Guido van Rossum14648392001-12-08 18:02:58 +00002120 "waste.waste", /*tp_name*/
Jack Jansen90ecdf41996-04-16 14:29:15 +00002121 sizeof(wasteObject), /*tp_basicsize*/
2122 0, /*tp_itemsize*/
2123 /* methods */
2124 (destructor) wasteObj_dealloc, /*tp_dealloc*/
2125 0, /*tp_print*/
Jack Jansendbd57012002-11-29 23:40:48 +00002126 (getattrfunc)0, /*tp_getattr*/
2127 (setattrfunc)0, /*tp_setattr*/
Jack Jansen9d8b96c2000-07-14 22:16:45 +00002128 (cmpfunc) wasteObj_compare, /*tp_compare*/
2129 (reprfunc) wasteObj_repr, /*tp_repr*/
2130 (PyNumberMethods *)0, /* tp_as_number */
2131 (PySequenceMethods *)0, /* tp_as_sequence */
2132 (PyMappingMethods *)0, /* tp_as_mapping */
2133 (hashfunc) wasteObj_hash, /*tp_hash*/
Jack Jansendbd57012002-11-29 23:40:48 +00002134 0, /*tp_call*/
2135 0, /*tp_str*/
2136 PyObject_GenericGetAttr, /*tp_getattro*/
2137 PyObject_GenericSetAttr, /*tp_setattro */
2138 0, /*outputHook_tp_as_buffer*/
2139 0, /*outputHook_tp_flags*/
2140 0, /*outputHook_tp_doc*/
2141 0, /*outputHook_tp_traverse*/
2142 0, /*outputHook_tp_clear*/
2143 0, /*outputHook_tp_richcompare*/
2144 0, /*outputHook_tp_weaklistoffset*/
2145 0, /*outputHook_tp_iter*/
2146 0, /*outputHook_tp_iternext*/
2147 wasteObj_methods, /* tp_methods */
2148 0, /*outputHook_tp_members*/
2149 wasteObj_getsetlist, /*tp_getset*/
2150 0, /*outputHook_tp_base*/
Jack Jansen90ecdf41996-04-16 14:29:15 +00002151};
2152
2153/* --------------------- End object type waste ---------------------- */
2154
2155
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002156static PyObject *waste_WENew(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002157{
2158 PyObject *_res = NULL;
2159 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00002160 LongRect inDestRect;
2161 LongRect inViewRect;
2162 OptionBits inOptions;
2163 WEReference outWE;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002164 if (!PyArg_ParseTuple(_args, "O&O&l",
Jack Jansenb99e5212002-01-11 12:37:15 +00002165 LongRect_Convert, &inDestRect,
2166 LongRect_Convert, &inViewRect,
2167 &inOptions))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002168 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002169 _err = WENew(&inDestRect,
2170 &inViewRect,
2171 inOptions,
2172 &outWE);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002173 if (_err != noErr) return PyMac_Error(_err);
2174 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002175 wasteObj_New, outWE);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002176 return _res;
2177}
2178
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002179static PyObject *waste_WEUpdateStyleScrap(PyObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00002180{
2181 PyObject *_res = NULL;
2182 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00002183 StScrpHandle ioStyles;
2184 WEFontTableHandle inFontTable;
Jack Jansen2369a981998-02-20 15:57:30 +00002185 if (!PyArg_ParseTuple(_args, "O&O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002186 ResObj_Convert, &ioStyles,
2187 ResObj_Convert, &inFontTable))
Jack Jansen2369a981998-02-20 15:57:30 +00002188 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002189 _err = WEUpdateStyleScrap(ioStyles,
2190 inFontTable);
Jack Jansen2369a981998-02-20 15:57:30 +00002191 if (_err != noErr) return PyMac_Error(_err);
2192 Py_INCREF(Py_None);
2193 _res = Py_None;
2194 return _res;
2195}
2196
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002197static PyObject *waste_WEInstallTSMHandlers(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002198{
2199 PyObject *_res = NULL;
2200 OSErr _err;
2201 if (!PyArg_ParseTuple(_args, ""))
2202 return NULL;
2203 _err = WEInstallTSMHandlers();
2204 if (_err != noErr) return PyMac_Error(_err);
2205 Py_INCREF(Py_None);
2206 _res = Py_None;
2207 return _res;
2208}
2209
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002210static PyObject *waste_WERemoveTSMHandlers(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002211{
2212 PyObject *_res = NULL;
2213 OSErr _err;
2214 if (!PyArg_ParseTuple(_args, ""))
2215 return NULL;
2216 _err = WERemoveTSMHandlers();
2217 if (_err != noErr) return PyMac_Error(_err);
2218 Py_INCREF(Py_None);
2219 _res = Py_None;
2220 return _res;
2221}
2222
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002223static PyObject *waste_WEHandleTSMEvent(PyObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00002224{
2225 PyObject *_res = NULL;
2226 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00002227 AppleEvent inAppleEvent;
2228 AppleEvent ioReply;
Jack Jansen2369a981998-02-20 15:57:30 +00002229 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002230 AEDesc_Convert, &inAppleEvent))
Jack Jansen2369a981998-02-20 15:57:30 +00002231 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002232 _err = WEHandleTSMEvent(&inAppleEvent,
2233 &ioReply);
Jack Jansen2369a981998-02-20 15:57:30 +00002234 if (_err != noErr) return PyMac_Error(_err);
2235 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002236 AEDesc_New, &ioReply);
Jack Jansen2369a981998-02-20 15:57:30 +00002237 return _res;
2238}
2239
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002240static PyObject *waste_WELongPointToPoint(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002241{
2242 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002243 LongPt inLongPoint;
2244 Point outPoint;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002245 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002246 LongPt_Convert, &inLongPoint))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002247 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002248 WELongPointToPoint(&inLongPoint,
2249 &outPoint);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002250 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002251 PyMac_BuildPoint, outPoint);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002252 return _res;
2253}
2254
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002255static PyObject *waste_WEPointToLongPoint(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002256{
2257 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002258 Point inPoint;
2259 LongPt outLongPoint;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002260 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002261 PyMac_GetPoint, &inPoint))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002262 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002263 WEPointToLongPoint(inPoint,
2264 &outLongPoint);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002265 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002266 LongPt_New, &outLongPoint);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002267 return _res;
2268}
2269
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002270static PyObject *waste_WESetLongRect(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002271{
2272 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002273 LongRect outLongRect;
2274 SInt32 inLeft;
2275 SInt32 inTop;
2276 SInt32 inRight;
2277 SInt32 inBottom;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002278 if (!PyArg_ParseTuple(_args, "llll",
Jack Jansenb99e5212002-01-11 12:37:15 +00002279 &inLeft,
2280 &inTop,
2281 &inRight,
2282 &inBottom))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002283 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002284 WESetLongRect(&outLongRect,
2285 inLeft,
2286 inTop,
2287 inRight,
2288 inBottom);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002289 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002290 LongRect_New, &outLongRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002291 return _res;
2292}
2293
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002294static PyObject *waste_WELongRectToRect(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002295{
2296 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002297 LongRect inLongRect;
2298 Rect outRect;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002299 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002300 LongRect_Convert, &inLongRect))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002301 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002302 WELongRectToRect(&inLongRect,
2303 &outRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002304 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002305 PyMac_BuildRect, &outRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002306 return _res;
2307}
2308
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002309static PyObject *waste_WERectToLongRect(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002310{
2311 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002312 Rect inRect;
2313 LongRect outLongRect;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002314 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002315 PyMac_GetRect, &inRect))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002316 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002317 WERectToLongRect(&inRect,
2318 &outLongRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002319 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002320 LongRect_New, &outLongRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002321 return _res;
2322}
2323
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002324static PyObject *waste_WEOffsetLongRect(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002325{
2326 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002327 LongRect ioLongRect;
2328 SInt32 inHorizontalOffset;
2329 SInt32 inVerticalOffset;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002330 if (!PyArg_ParseTuple(_args, "ll",
Jack Jansenb99e5212002-01-11 12:37:15 +00002331 &inHorizontalOffset,
2332 &inVerticalOffset))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002333 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002334 WEOffsetLongRect(&ioLongRect,
2335 inHorizontalOffset,
2336 inVerticalOffset);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002337 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002338 LongRect_New, &ioLongRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002339 return _res;
2340}
2341
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002342static PyObject *waste_WELongPointInLongRect(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002343{
2344 PyObject *_res = NULL;
2345 Boolean _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00002346 LongPt inLongPoint;
2347 LongRect inLongRect;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002348 if (!PyArg_ParseTuple(_args, "O&O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002349 LongPt_Convert, &inLongPoint,
2350 LongRect_Convert, &inLongRect))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002351 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002352 _rv = WELongPointInLongRect(&inLongPoint,
2353 &inLongRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002354 _res = Py_BuildValue("b",
2355 _rv);
2356 return _res;
2357}
2358
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002359static PyObject *waste_STDObjectHandlers(PyObject *_self, PyObject *_args)
Jack Jansen756522f1996-05-07 15:24:01 +00002360{
2361 PyObject *_res = NULL;
2362
2363 OSErr err;
2364 // install the sample object handlers for pictures and sounds
2365#define kTypePicture 'PICT'
2366#define kTypeSound 'snd '
2367
2368 if ( !PyArg_ParseTuple(_args, "") ) return NULL;
2369
2370 if ((err = WEInstallObjectHandler(kTypePicture, weNewHandler,
2371 (UniversalProcPtr) NewWENewObjectProc(HandleNewPicture), NULL)) != noErr)
2372 goto cleanup;
2373
2374 if ((err = WEInstallObjectHandler(kTypePicture, weDisposeHandler,
2375 (UniversalProcPtr) NewWEDisposeObjectProc(HandleDisposePicture), NULL)) != noErr)
2376 goto cleanup;
2377
2378 if ((err = WEInstallObjectHandler(kTypePicture, weDrawHandler,
2379 (UniversalProcPtr) NewWEDrawObjectProc(HandleDrawPicture), NULL)) != noErr)
2380 goto cleanup;
2381
2382 if ((err = WEInstallObjectHandler(kTypeSound, weNewHandler,
2383 (UniversalProcPtr) NewWENewObjectProc(HandleNewSound), NULL)) != noErr)
2384 goto cleanup;
2385
2386 if ((err = WEInstallObjectHandler(kTypeSound, weDrawHandler,
2387 (UniversalProcPtr) NewWEDrawObjectProc(HandleDrawSound), NULL)) != noErr)
2388 goto cleanup;
2389
2390 if ((err = WEInstallObjectHandler(kTypeSound, weClickHandler,
2391 (UniversalProcPtr) NewWEClickObjectProc(HandleClickSound), NULL)) != noErr)
2392 goto cleanup;
2393 Py_INCREF(Py_None);
2394 return Py_None;
2395
2396 cleanup:
2397 return PyMac_Error(err);
2398
2399}
2400
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002401static PyObject *waste_WEInstallObjectHandler(PyObject *_self, PyObject *_args)
Jack Jansen756522f1996-05-07 15:24:01 +00002402{
2403 PyObject *_res = NULL;
2404
2405 OSErr err;
2406 FlavorType objectType;
2407 WESelector selector;
2408 PyObject *py_handler;
2409 UniversalProcPtr handler;
2410 WEReference we = NULL;
2411 PyObject *key;
2412
2413
2414 if ( !PyArg_ParseTuple(_args, "O&O&O|O&",
2415 PyMac_GetOSType, &objectType,
2416 PyMac_GetOSType, &selector,
2417 &py_handler,
Jack Jansen7df36061996-10-01 11:41:14 +00002418 WEOObj_Convert, &we) ) return NULL;
Jack Jansen756522f1996-05-07 15:24:01 +00002419
Jack Jansen25241d91996-05-20 11:30:45 +00002420 if ( selector == weNewHandler ) handler = (UniversalProcPtr)upp_new_handler;
2421 else if ( selector == weDisposeHandler ) handler = (UniversalProcPtr)upp_dispose_handler;
2422 else if ( selector == weDrawHandler ) handler = (UniversalProcPtr)upp_draw_handler;
2423 else if ( selector == weClickHandler ) handler = (UniversalProcPtr)upp_click_handler;
Jack Jansen756522f1996-05-07 15:24:01 +00002424 else return PyMac_Error(weUndefinedSelectorErr);
2425
2426 if ((key = Py_BuildValue("O&O&",
2427 PyMac_BuildOSType, objectType,
2428 PyMac_BuildOSType, selector)) == NULL )
2429 return NULL;
2430
2431 PyDict_SetItem(callbackdict, key, py_handler);
2432
2433 err = WEInstallObjectHandler(objectType, selector, handler, we);
2434 if ( err ) return PyMac_Error(err);
2435 Py_INCREF(Py_None);
2436 return Py_None;
2437
2438}
2439
Jack Jansen90ecdf41996-04-16 14:29:15 +00002440static PyMethodDef waste_methods[] = {
2441 {"WENew", (PyCFunction)waste_WENew, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002442 PyDoc_STR("(LongRect inDestRect, LongRect inViewRect, OptionBits inOptions) -> (WEReference outWE)")},
Jack Jansen2369a981998-02-20 15:57:30 +00002443 {"WEUpdateStyleScrap", (PyCFunction)waste_WEUpdateStyleScrap, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002444 PyDoc_STR("(StScrpHandle ioStyles, WEFontTableHandle inFontTable) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002445 {"WEInstallTSMHandlers", (PyCFunction)waste_WEInstallTSMHandlers, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002446 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002447 {"WERemoveTSMHandlers", (PyCFunction)waste_WERemoveTSMHandlers, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002448 PyDoc_STR("() -> None")},
Jack Jansen2369a981998-02-20 15:57:30 +00002449 {"WEHandleTSMEvent", (PyCFunction)waste_WEHandleTSMEvent, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002450 PyDoc_STR("(AppleEvent inAppleEvent) -> (AppleEvent ioReply)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002451 {"WELongPointToPoint", (PyCFunction)waste_WELongPointToPoint, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002452 PyDoc_STR("(LongPt inLongPoint) -> (Point outPoint)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002453 {"WEPointToLongPoint", (PyCFunction)waste_WEPointToLongPoint, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002454 PyDoc_STR("(Point inPoint) -> (LongPt outLongPoint)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002455 {"WESetLongRect", (PyCFunction)waste_WESetLongRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002456 PyDoc_STR("(SInt32 inLeft, SInt32 inTop, SInt32 inRight, SInt32 inBottom) -> (LongRect outLongRect)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002457 {"WELongRectToRect", (PyCFunction)waste_WELongRectToRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002458 PyDoc_STR("(LongRect inLongRect) -> (Rect outRect)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002459 {"WERectToLongRect", (PyCFunction)waste_WERectToLongRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002460 PyDoc_STR("(Rect inRect) -> (LongRect outLongRect)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002461 {"WEOffsetLongRect", (PyCFunction)waste_WEOffsetLongRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002462 PyDoc_STR("(SInt32 inHorizontalOffset, SInt32 inVerticalOffset) -> (LongRect ioLongRect)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002463 {"WELongPointInLongRect", (PyCFunction)waste_WELongPointInLongRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002464 PyDoc_STR("(LongPt inLongPoint, LongRect inLongRect) -> (Boolean _rv)")},
Jack Jansen756522f1996-05-07 15:24:01 +00002465 {"STDObjectHandlers", (PyCFunction)waste_STDObjectHandlers, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002466 PyDoc_STR(NULL)},
Jack Jansen756522f1996-05-07 15:24:01 +00002467 {"WEInstallObjectHandler", (PyCFunction)waste_WEInstallObjectHandler, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002468 PyDoc_STR(NULL)},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002469 {NULL, NULL, 0}
2470};
2471
2472
2473
Jack Jansen756522f1996-05-07 15:24:01 +00002474/* Return the object corresponding to the window, or NULL */
2475
2476PyObject *
2477ExistingwasteObj_New(w)
2478 WEReference w;
2479{
2480 PyObject *it = NULL;
2481
2482 if (w == NULL)
2483 it = NULL;
2484 else
2485 WEGetInfo(weRefCon, (void *)&it, w);
2486 if (it == NULL || ((wasteObject *)it)->ob_itself != w)
2487 it = Py_None;
2488 Py_INCREF(it);
2489 return it;
2490}
2491
Jack Jansen90ecdf41996-04-16 14:29:15 +00002492
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002493void initwaste(void)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002494{
2495 PyObject *m;
2496 PyObject *d;
2497
2498
2499
2500
2501 m = Py_InitModule("waste", waste_methods);
2502 d = PyModule_GetDict(m);
2503 waste_Error = PyMac_GetOSErrException();
2504 if (waste_Error == NULL ||
2505 PyDict_SetItemString(d, "Error", waste_Error) != 0)
Jack Jansen97ed9072000-09-08 22:06:16 +00002506 return;
Jack Jansena755e681997-09-20 17:40:22 +00002507 WEO_Type.ob_type = &PyType_Type;
2508 Py_INCREF(&WEO_Type);
2509 if (PyDict_SetItemString(d, "WEOType", (PyObject *)&WEO_Type) != 0)
2510 Py_FatalError("can't initialize WEOType");
2511 waste_Type.ob_type = &PyType_Type;
2512 Py_INCREF(&waste_Type);
2513 if (PyDict_SetItemString(d, "wasteType", (PyObject *)&waste_Type) != 0)
2514 Py_FatalError("can't initialize wasteType");
Jack Jansen756522f1996-05-07 15:24:01 +00002515
2516 callbackdict = PyDict_New();
2517 if (callbackdict == NULL || PyDict_SetItemString(d, "callbacks", callbackdict) != 0)
Jack Jansen97ed9072000-09-08 22:06:16 +00002518 return;
Jack Jansen756522f1996-05-07 15:24:01 +00002519 upp_new_handler = NewWENewObjectProc(my_new_handler);
Jack Jansen25241d91996-05-20 11:30:45 +00002520 upp_dispose_handler = NewWEDisposeObjectProc(my_dispose_handler);
2521 upp_draw_handler = NewWEDrawObjectProc(my_draw_handler);
2522 upp_click_handler = NewWEClickObjectProc(my_click_handler);
Jack Jansen756522f1996-05-07 15:24:01 +00002523
2524
Jack Jansen90ecdf41996-04-16 14:29:15 +00002525}
2526
2527/* ======================== End module waste ======================== */
2528