blob: dd77cefa715e8d94935678a2ad71e514d23800df [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 Jansen90ecdf41996-04-16 14:29:15 +000026
27/* Exported by Qdmodule.c: */
28extern PyObject *QdRGB_New(RGBColor *);
29extern int QdRGB_Convert(PyObject *, RGBColor *);
30
Jack Jansen8505ef81997-08-27 14:09:25 +000031/* Exported by AEModule.c: */
32extern PyObject *AEDesc_New(AppleEvent *);
33extern int AEDesc_Convert(PyObject *, AppleEvent *);
34
Jack Jansen90ecdf41996-04-16 14:29:15 +000035/* Forward declaration */
Jeremy Hylton938ace62002-07-17 16:30:39 +000036static PyObject *WEOObj_New(WEObjectReference);
37static PyObject *ExistingwasteObj_New(WEReference);
Jack Jansen90ecdf41996-04-16 14:29:15 +000038
39/*
40** Parse/generate TextStyle records
41*/
42static
43PyObject *TextStyle_New(itself)
44 TextStylePtr itself;
45{
46
47 return Py_BuildValue("lllO&", (long)itself->tsFont, (long)itself->tsFace, (long)itself->tsSize, QdRGB_New,
48 &itself->tsColor);
49}
50
51static
52TextStyle_Convert(v, p_itself)
53 PyObject *v;
54 TextStylePtr p_itself;
55{
56 long font, face, size;
57
58 if( !PyArg_ParseTuple(v, "lllO&", &font, &face, &size, QdRGB_Convert, &p_itself->tsColor) )
59 return 0;
60 p_itself->tsFont = (short)font;
61 p_itself->tsFace = (Style)face;
62 p_itself->tsSize = (short)size;
63 return 1;
64}
65
66/*
67** Parse/generate RunInfo records
68*/
69static
70PyObject *RunInfo_New(itself)
71 WERunInfo *itself;
72{
73
74 return Py_BuildValue("llhhO&O&", itself->runStart, itself->runEnd, itself->runHeight,
75 itself->runAscent, TextStyle_New, &itself->runStyle, WEOObj_New, itself->runObject);
76}
77
78/* Conversion of long points and rects */
79int
80LongRect_Convert(PyObject *v, LongRect *r)
81{
82 return PyArg_Parse(v, "(llll)", &r->left, &r->top, &r->right, &r->bottom);
83}
84
85PyObject *
86LongRect_New(LongRect *r)
87{
88 return Py_BuildValue("(llll)", r->left, r->top, r->right, r->bottom);
89}
90
91
92LongPt_Convert(PyObject *v, LongPt *p)
93{
94 return PyArg_Parse(v, "(ll)", &p->h, &p->v);
95}
96
97PyObject *
98LongPt_New(LongPt *p)
99{
100 return Py_BuildValue("(ll)", p->h, p->v);
101}
102
Jack Jansen756522f1996-05-07 15:24:01 +0000103/* Stuff for the callbacks: */
104static PyObject *callbackdict;
Jack Jansen25241d91996-05-20 11:30:45 +0000105WENewObjectUPP upp_new_handler;
106WEDisposeObjectUPP upp_dispose_handler;
107WEDrawObjectUPP upp_draw_handler;
108WEClickObjectUPP upp_click_handler;
Jack Jansen756522f1996-05-07 15:24:01 +0000109
110static OSErr
111any_handler(WESelector what, WEObjectReference who, PyObject *args, PyObject **rv)
112{
113 FlavorType tp;
114 PyObject *key, *func;
115
116 if ( args == NULL ) return errAECorruptData;
117
118 tp = WEGetObjectType(who);
119
120 if( (key=Py_BuildValue("O&O&", PyMac_BuildOSType, tp, PyMac_BuildOSType, what)) == NULL)
121 return errAECorruptData;
122 if( (func = PyDict_GetItem(callbackdict, key)) == NULL ) {
123 Py_DECREF(key);
124 return errAEHandlerNotFound;
125 }
126 Py_INCREF(func);
127 *rv = PyEval_CallObject(func, args);
128 Py_DECREF(func);
129 Py_DECREF(key);
130 if ( *rv == NULL ) {
Jack Jansendeff89c1998-10-12 20:53:15 +0000131 PySys_WriteStderr("--Exception in callback: ");
Jack Jansen756522f1996-05-07 15:24:01 +0000132 PyErr_Print();
133 return errAEReplyNotArrived;
134 }
135 return 0;
136}
137
138static pascal OSErr
139my_new_handler(Point *objectSize, WEObjectReference objref)
140{
141 PyObject *args=NULL, *rv=NULL;
142 OSErr err;
143
144 args=Py_BuildValue("(O&)", WEOObj_New, objref);
145 err = any_handler(weNewHandler, objref, args, &rv);
146 if (!err) {
147 if (!PyMac_GetPoint(rv, objectSize) )
148 err = errAECoercionFail;
149 }
150 if ( args ) Py_DECREF(args);
151 if ( rv ) Py_DECREF(rv);
152 return err;
153}
154
155static pascal OSErr
156my_dispose_handler(WEObjectReference objref)
157{
158 PyObject *args=NULL, *rv=NULL;
159 OSErr err;
160
161 args=Py_BuildValue("(O&)", WEOObj_New, objref);
162 err = any_handler(weDisposeHandler, objref, args, &rv);
163 if ( args ) Py_DECREF(args);
164 if ( rv ) Py_DECREF(rv);
165 return err;
166}
167
168static pascal OSErr
Jack Jansen6b9289f2001-06-20 21:21:07 +0000169my_draw_handler(const Rect *destRect, WEObjectReference objref)
Jack Jansen756522f1996-05-07 15:24:01 +0000170{
171 PyObject *args=NULL, *rv=NULL;
172 OSErr err;
173
174 args=Py_BuildValue("O&O&", PyMac_BuildRect, destRect, WEOObj_New, objref);
175 err = any_handler(weDrawHandler, objref, args, &rv);
176 if ( args ) Py_DECREF(args);
177 if ( rv ) Py_DECREF(rv);
178 return err;
179}
180
181static pascal Boolean
182my_click_handler(Point hitPt, EventModifiers modifiers,
183 unsigned long clickTime, WEObjectReference objref)
184{
185 PyObject *args=NULL, *rv=NULL;
186 int retvalue;
187 OSErr err;
188
189 args=Py_BuildValue("O&llO&", PyMac_BuildPoint, hitPt,
190 (long)modifiers, (long)clickTime, WEOObj_New, objref);
191 err = any_handler(weClickHandler, objref, args, &rv);
192 if (!err)
193 retvalue = PyInt_AsLong(rv);
194 else
195 retvalue = 0;
196 if ( args ) Py_DECREF(args);
197 if ( rv ) Py_DECREF(rv);
198 return retvalue;
199}
200
201
202
Jack Jansen90ecdf41996-04-16 14:29:15 +0000203static PyObject *waste_Error;
204
205/* ------------------------ Object type WEO ------------------------- */
206
207PyTypeObject WEO_Type;
208
209#define WEOObj_Check(x) ((x)->ob_type == &WEO_Type)
210
211typedef struct WEOObject {
212 PyObject_HEAD
213 WEObjectReference ob_itself;
214} WEOObject;
215
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000216PyObject *WEOObj_New(WEObjectReference itself)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000217{
218 WEOObject *it;
219 if (itself == NULL) {
220 Py_INCREF(Py_None);
221 return Py_None;
222 }
223 it = PyObject_NEW(WEOObject, &WEO_Type);
224 if (it == NULL) return NULL;
225 it->ob_itself = itself;
226 return (PyObject *)it;
227}
Jack Jansen044d95e2001-09-05 15:44:37 +0000228int WEOObj_Convert(PyObject *v, WEObjectReference *p_itself)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000229{
230 if (!WEOObj_Check(v))
231 {
232 PyErr_SetString(PyExc_TypeError, "WEO required");
233 return 0;
234 }
235 *p_itself = ((WEOObject *)v)->ob_itself;
236 return 1;
237}
238
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000239static void WEOObj_dealloc(WEOObject *self)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000240{
241 /* Cleanup of self->ob_itself goes here */
Jack Jansen033b79c2002-04-23 22:46:01 +0000242 PyObject_Del(self);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000243}
244
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000245static PyObject *WEOObj_WEGetObjectType(WEOObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000246{
247 PyObject *_res = NULL;
248 FlavorType _rv;
249 if (!PyArg_ParseTuple(_args, ""))
250 return NULL;
251 _rv = WEGetObjectType(_self->ob_itself);
252 _res = Py_BuildValue("O&",
253 PyMac_BuildOSType, _rv);
254 return _res;
255}
256
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000257static PyObject *WEOObj_WEGetObjectDataHandle(WEOObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000258{
259 PyObject *_res = NULL;
260 Handle _rv;
261 if (!PyArg_ParseTuple(_args, ""))
262 return NULL;
263 _rv = WEGetObjectDataHandle(_self->ob_itself);
264 _res = Py_BuildValue("O&",
265 ResObj_New, _rv);
266 return _res;
267}
268
Jack Jansenb99e5212002-01-11 12:37:15 +0000269static PyObject *WEOObj_WEGetObjectOwner(WEOObject *_self, PyObject *_args)
270{
271 PyObject *_res = NULL;
272 WEReference _rv;
273 if (!PyArg_ParseTuple(_args, ""))
274 return NULL;
275 _rv = WEGetObjectOwner(_self->ob_itself);
276 _res = Py_BuildValue("O&",
277 ExistingwasteObj_New, _rv);
278 return _res;
279}
280
281static PyObject *WEOObj_WEGetObjectOffset(WEOObject *_self, PyObject *_args)
282{
283 PyObject *_res = NULL;
284 SInt32 _rv;
285 if (!PyArg_ParseTuple(_args, ""))
286 return NULL;
287 _rv = WEGetObjectOffset(_self->ob_itself);
288 _res = Py_BuildValue("l",
289 _rv);
290 return _res;
291}
292
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000293static PyObject *WEOObj_WEGetObjectSize(WEOObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000294{
295 PyObject *_res = NULL;
296 Point _rv;
297 if (!PyArg_ParseTuple(_args, ""))
298 return NULL;
299 _rv = WEGetObjectSize(_self->ob_itself);
300 _res = Py_BuildValue("O&",
301 PyMac_BuildPoint, _rv);
302 return _res;
303}
304
Jack Jansenb99e5212002-01-11 12:37:15 +0000305static PyObject *WEOObj_WESetObjectSize(WEOObject *_self, PyObject *_args)
Jack Jansen756522f1996-05-07 15:24:01 +0000306{
307 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000308 OSErr _err;
309 Point inObjectSize;
310 if (!PyArg_ParseTuple(_args, "O&",
311 PyMac_GetPoint, &inObjectSize))
312 return NULL;
313 _err = WESetObjectSize(_self->ob_itself,
314 inObjectSize);
315 if (_err != noErr) return PyMac_Error(_err);
316 Py_INCREF(Py_None);
317 _res = Py_None;
318 return _res;
319}
320
321static PyObject *WEOObj_WEGetObjectFrame(WEOObject *_self, PyObject *_args)
322{
323 PyObject *_res = NULL;
324 OSErr _err;
325 LongRect outObjectFrame;
Jack Jansen756522f1996-05-07 15:24:01 +0000326 if (!PyArg_ParseTuple(_args, ""))
327 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000328 _err = WEGetObjectFrame(_self->ob_itself,
329 &outObjectFrame);
330 if (_err != noErr) return PyMac_Error(_err);
Jack Jansen756522f1996-05-07 15:24:01 +0000331 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +0000332 LongRect_New, &outObjectFrame);
Jack Jansen756522f1996-05-07 15:24:01 +0000333 return _res;
334}
335
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000336static PyObject *WEOObj_WEGetObjectRefCon(WEOObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000337{
338 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +0000339 SInt32 _rv;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000340 if (!PyArg_ParseTuple(_args, ""))
341 return NULL;
342 _rv = WEGetObjectRefCon(_self->ob_itself);
343 _res = Py_BuildValue("l",
344 _rv);
345 return _res;
346}
347
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000348static PyObject *WEOObj_WESetObjectRefCon(WEOObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000349{
350 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000351 SInt32 inRefCon;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000352 if (!PyArg_ParseTuple(_args, "l",
Jack Jansenb99e5212002-01-11 12:37:15 +0000353 &inRefCon))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000354 return NULL;
355 WESetObjectRefCon(_self->ob_itself,
Jack Jansenb99e5212002-01-11 12:37:15 +0000356 inRefCon);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000357 Py_INCREF(Py_None);
358 _res = Py_None;
359 return _res;
360}
361
362static PyMethodDef WEOObj_methods[] = {
363 {"WEGetObjectType", (PyCFunction)WEOObj_WEGetObjectType, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000364 PyDoc_STR("() -> (FlavorType _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +0000365 {"WEGetObjectDataHandle", (PyCFunction)WEOObj_WEGetObjectDataHandle, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000366 PyDoc_STR("() -> (Handle _rv)")},
Jack Jansen756522f1996-05-07 15:24:01 +0000367 {"WEGetObjectOwner", (PyCFunction)WEOObj_WEGetObjectOwner, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000368 PyDoc_STR("() -> (WEReference _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +0000369 {"WEGetObjectOffset", (PyCFunction)WEOObj_WEGetObjectOffset, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000370 PyDoc_STR("() -> (SInt32 _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +0000371 {"WEGetObjectSize", (PyCFunction)WEOObj_WEGetObjectSize, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000372 PyDoc_STR("() -> (Point _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +0000373 {"WESetObjectSize", (PyCFunction)WEOObj_WESetObjectSize, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000374 PyDoc_STR("(Point inObjectSize) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +0000375 {"WEGetObjectFrame", (PyCFunction)WEOObj_WEGetObjectFrame, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000376 PyDoc_STR("() -> (LongRect outObjectFrame)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +0000377 {"WEGetObjectRefCon", (PyCFunction)WEOObj_WEGetObjectRefCon, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000378 PyDoc_STR("() -> (SInt32 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +0000379 {"WESetObjectRefCon", (PyCFunction)WEOObj_WESetObjectRefCon, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000380 PyDoc_STR("(SInt32 inRefCon) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +0000381 {NULL, NULL, 0}
382};
383
384PyMethodChain WEOObj_chain = { WEOObj_methods, NULL };
385
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000386static PyObject *WEOObj_getattr(WEOObject *self, char *name)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000387{
388 return Py_FindMethodInChain(&WEOObj_chain, (PyObject *)self, name);
389}
390
391#define WEOObj_setattr NULL
392
Jack Jansen9d8b96c2000-07-14 22:16:45 +0000393#define WEOObj_compare NULL
394
395#define WEOObj_repr NULL
396
397#define WEOObj_hash NULL
398
Jack Jansen90ecdf41996-04-16 14:29:15 +0000399PyTypeObject WEO_Type = {
Jack Jansenb3be2162001-11-30 14:16:36 +0000400 PyObject_HEAD_INIT(NULL)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000401 0, /*ob_size*/
Guido van Rossum14648392001-12-08 18:02:58 +0000402 "waste.WEO", /*tp_name*/
Jack Jansen90ecdf41996-04-16 14:29:15 +0000403 sizeof(WEOObject), /*tp_basicsize*/
404 0, /*tp_itemsize*/
405 /* methods */
406 (destructor) WEOObj_dealloc, /*tp_dealloc*/
407 0, /*tp_print*/
408 (getattrfunc) WEOObj_getattr, /*tp_getattr*/
409 (setattrfunc) WEOObj_setattr, /*tp_setattr*/
Jack Jansen9d8b96c2000-07-14 22:16:45 +0000410 (cmpfunc) WEOObj_compare, /*tp_compare*/
411 (reprfunc) WEOObj_repr, /*tp_repr*/
412 (PyNumberMethods *)0, /* tp_as_number */
413 (PySequenceMethods *)0, /* tp_as_sequence */
414 (PyMappingMethods *)0, /* tp_as_mapping */
415 (hashfunc) WEOObj_hash, /*tp_hash*/
Jack Jansen90ecdf41996-04-16 14:29:15 +0000416};
417
418/* ---------------------- End object type WEO ----------------------- */
419
420
421/* ----------------------- Object type waste ------------------------ */
422
423PyTypeObject waste_Type;
424
425#define wasteObj_Check(x) ((x)->ob_type == &waste_Type)
426
427typedef struct wasteObject {
428 PyObject_HEAD
429 WEReference ob_itself;
430} wasteObject;
431
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000432PyObject *wasteObj_New(WEReference itself)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000433{
434 wasteObject *it;
435 if (itself == NULL) {
436 PyErr_SetString(waste_Error,"Cannot create null WE");
437 return NULL;
438 }
439 it = PyObject_NEW(wasteObject, &waste_Type);
440 if (it == NULL) return NULL;
441 it->ob_itself = itself;
Jack Jansen756522f1996-05-07 15:24:01 +0000442 WESetInfo(weRefCon, (void *)&it, itself);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000443 return (PyObject *)it;
444}
Jack Jansen044d95e2001-09-05 15:44:37 +0000445int wasteObj_Convert(PyObject *v, WEReference *p_itself)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000446{
447 if (!wasteObj_Check(v))
448 {
449 PyErr_SetString(PyExc_TypeError, "waste required");
450 return 0;
451 }
452 *p_itself = ((wasteObject *)v)->ob_itself;
453 return 1;
454}
455
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000456static void wasteObj_dealloc(wasteObject *self)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000457{
458 WEDispose(self->ob_itself);
Jack Jansen033b79c2002-04-23 22:46:01 +0000459 PyObject_Del(self);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000460}
461
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000462static PyObject *wasteObj_WEGetText(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000463{
464 PyObject *_res = NULL;
465 Handle _rv;
466 if (!PyArg_ParseTuple(_args, ""))
467 return NULL;
468 _rv = WEGetText(_self->ob_itself);
469 _res = Py_BuildValue("O&",
470 ResObj_New, _rv);
471 return _res;
472}
473
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000474static PyObject *wasteObj_WEGetChar(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000475{
476 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +0000477 SInt16 _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +0000478 SInt32 inOffset;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000479 if (!PyArg_ParseTuple(_args, "l",
Jack Jansenb99e5212002-01-11 12:37:15 +0000480 &inOffset))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000481 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000482 _rv = WEGetChar(inOffset,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000483 _self->ob_itself);
484 _res = Py_BuildValue("h",
485 _rv);
486 return _res;
487}
488
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000489static PyObject *wasteObj_WEGetTextLength(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000490{
491 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +0000492 SInt32 _rv;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000493 if (!PyArg_ParseTuple(_args, ""))
494 return NULL;
495 _rv = WEGetTextLength(_self->ob_itself);
496 _res = Py_BuildValue("l",
497 _rv);
498 return _res;
499}
500
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000501static PyObject *wasteObj_WEGetSelection(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000502{
503 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000504 SInt32 outSelStart;
505 SInt32 outSelEnd;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000506 if (!PyArg_ParseTuple(_args, ""))
507 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000508 WEGetSelection(&outSelStart,
509 &outSelEnd,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000510 _self->ob_itself);
511 _res = Py_BuildValue("ll",
Jack Jansenb99e5212002-01-11 12:37:15 +0000512 outSelStart,
513 outSelEnd);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000514 return _res;
515}
516
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000517static PyObject *wasteObj_WEGetDestRect(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000518{
519 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000520 LongRect outDestRect;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000521 if (!PyArg_ParseTuple(_args, ""))
522 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000523 WEGetDestRect(&outDestRect,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000524 _self->ob_itself);
525 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +0000526 LongRect_New, &outDestRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000527 return _res;
528}
529
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000530static PyObject *wasteObj_WEGetViewRect(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 outViewRect;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000534 if (!PyArg_ParseTuple(_args, ""))
535 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000536 WEGetViewRect(&outViewRect,
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, &outViewRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000540 return _res;
541}
542
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000543static PyObject *wasteObj_WEIsActive(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000544{
545 PyObject *_res = NULL;
546 Boolean _rv;
547 if (!PyArg_ParseTuple(_args, ""))
548 return NULL;
549 _rv = WEIsActive(_self->ob_itself);
550 _res = Py_BuildValue("b",
551 _rv);
552 return _res;
553}
554
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000555static PyObject *wasteObj_WEGetClickCount(wasteObject *_self, PyObject *_args)
Jack Jansen2268af51996-08-06 16:04:22 +0000556{
557 PyObject *_res = NULL;
558 UInt16 _rv;
559 if (!PyArg_ParseTuple(_args, ""))
560 return NULL;
561 _rv = WEGetClickCount(_self->ob_itself);
Jack Jansen9d8b96c2000-07-14 22:16:45 +0000562 _res = Py_BuildValue("H",
Jack Jansen2268af51996-08-06 16:04:22 +0000563 _rv);
564 return _res;
565}
566
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000567static PyObject *wasteObj_WESetSelection(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000568{
569 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000570 SInt32 inSelStart;
571 SInt32 inSelEnd;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000572 if (!PyArg_ParseTuple(_args, "ll",
Jack Jansenb99e5212002-01-11 12:37:15 +0000573 &inSelStart,
574 &inSelEnd))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000575 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000576 WESetSelection(inSelStart,
577 inSelEnd,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000578 _self->ob_itself);
579 Py_INCREF(Py_None);
580 _res = Py_None;
581 return _res;
582}
583
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000584static PyObject *wasteObj_WESetDestRect(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000585{
586 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000587 LongRect inDestRect;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000588 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +0000589 LongRect_Convert, &inDestRect))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000590 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000591 WESetDestRect(&inDestRect,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000592 _self->ob_itself);
593 Py_INCREF(Py_None);
594 _res = Py_None;
595 return _res;
596}
597
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000598static PyObject *wasteObj_WESetViewRect(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000599{
600 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000601 LongRect inViewRect;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000602 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +0000603 LongRect_Convert, &inViewRect))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000604 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000605 WESetViewRect(&inViewRect,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000606 _self->ob_itself);
607 Py_INCREF(Py_None);
608 _res = Py_None;
609 return _res;
610}
611
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000612static PyObject *wasteObj_WEContinuousStyle(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000613{
614 PyObject *_res = NULL;
615 Boolean _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +0000616 WEStyleMode ioMode;
617 TextStyle outTextStyle;
Jack Jansen9d8b96c2000-07-14 22:16:45 +0000618 if (!PyArg_ParseTuple(_args, "H",
Jack Jansenb99e5212002-01-11 12:37:15 +0000619 &ioMode))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000620 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000621 _rv = WEContinuousStyle(&ioMode,
622 &outTextStyle,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000623 _self->ob_itself);
Jack Jansen9d8b96c2000-07-14 22:16:45 +0000624 _res = Py_BuildValue("bHO&",
Jack Jansen90ecdf41996-04-16 14:29:15 +0000625 _rv,
Jack Jansenb99e5212002-01-11 12:37:15 +0000626 ioMode,
627 TextStyle_New, &outTextStyle);
628 return _res;
629}
630
631static PyObject *wasteObj_WECountRuns(wasteObject *_self, PyObject *_args)
632{
633 PyObject *_res = NULL;
634 SInt32 _rv;
635 if (!PyArg_ParseTuple(_args, ""))
636 return NULL;
637 _rv = WECountRuns(_self->ob_itself);
638 _res = Py_BuildValue("l",
639 _rv);
640 return _res;
641}
642
643static PyObject *wasteObj_WEOffsetToRun(wasteObject *_self, PyObject *_args)
644{
645 PyObject *_res = NULL;
646 SInt32 _rv;
647 SInt32 inOffset;
648 if (!PyArg_ParseTuple(_args, "l",
649 &inOffset))
650 return NULL;
651 _rv = WEOffsetToRun(inOffset,
652 _self->ob_itself);
653 _res = Py_BuildValue("l",
654 _rv);
655 return _res;
656}
657
658static PyObject *wasteObj_WEGetRunRange(wasteObject *_self, PyObject *_args)
659{
660 PyObject *_res = NULL;
661 SInt32 inStyleRunIndex;
662 SInt32 outStyleRunStart;
663 SInt32 outStyleRunEnd;
664 if (!PyArg_ParseTuple(_args, "l",
665 &inStyleRunIndex))
666 return NULL;
667 WEGetRunRange(inStyleRunIndex,
668 &outStyleRunStart,
669 &outStyleRunEnd,
670 _self->ob_itself);
671 _res = Py_BuildValue("ll",
672 outStyleRunStart,
673 outStyleRunEnd);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000674 return _res;
675}
676
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000677static PyObject *wasteObj_WEGetRunInfo(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000678{
679 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000680 SInt32 inOffset;
681 WERunInfo outStyleRunInfo;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000682 if (!PyArg_ParseTuple(_args, "l",
Jack Jansenb99e5212002-01-11 12:37:15 +0000683 &inOffset))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000684 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000685 WEGetRunInfo(inOffset,
686 &outStyleRunInfo,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000687 _self->ob_itself);
688 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +0000689 RunInfo_New, &outStyleRunInfo);
690 return _res;
691}
692
693static PyObject *wasteObj_WEGetIndRunInfo(wasteObject *_self, PyObject *_args)
694{
695 PyObject *_res = NULL;
696 SInt32 inStyleRunIndex;
697 WERunInfo outStyleRunInfo;
698 if (!PyArg_ParseTuple(_args, "l",
699 &inStyleRunIndex))
700 return NULL;
701 WEGetIndRunInfo(inStyleRunIndex,
702 &outStyleRunInfo,
703 _self->ob_itself);
704 _res = Py_BuildValue("O&",
705 RunInfo_New, &outStyleRunInfo);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000706 return _res;
707}
708
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000709static PyObject *wasteObj_WEGetRunDirection(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +0000710{
711 PyObject *_res = NULL;
712 Boolean _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +0000713 SInt32 inOffset;
Jack Jansen2369a981998-02-20 15:57:30 +0000714 if (!PyArg_ParseTuple(_args, "l",
Jack Jansenb99e5212002-01-11 12:37:15 +0000715 &inOffset))
Jack Jansen2369a981998-02-20 15:57:30 +0000716 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000717 _rv = WEGetRunDirection(inOffset,
Jack Jansen2369a981998-02-20 15:57:30 +0000718 _self->ob_itself);
719 _res = Py_BuildValue("b",
720 _rv);
721 return _res;
722}
723
Jack Jansenb99e5212002-01-11 12:37:15 +0000724static PyObject *wasteObj_WECountParaRuns(wasteObject *_self, PyObject *_args)
725{
726 PyObject *_res = NULL;
727 SInt32 _rv;
728 if (!PyArg_ParseTuple(_args, ""))
729 return NULL;
730 _rv = WECountParaRuns(_self->ob_itself);
731 _res = Py_BuildValue("l",
732 _rv);
733 return _res;
734}
735
736static PyObject *wasteObj_WEOffsetToParaRun(wasteObject *_self, PyObject *_args)
737{
738 PyObject *_res = NULL;
739 SInt32 _rv;
740 SInt32 inOffset;
741 if (!PyArg_ParseTuple(_args, "l",
742 &inOffset))
743 return NULL;
744 _rv = WEOffsetToParaRun(inOffset,
745 _self->ob_itself);
746 _res = Py_BuildValue("l",
747 _rv);
748 return _res;
749}
750
751static PyObject *wasteObj_WEGetParaRunRange(wasteObject *_self, PyObject *_args)
752{
753 PyObject *_res = NULL;
754 SInt32 inParagraphRunIndex;
755 SInt32 outParagraphRunStart;
756 SInt32 outParagraphRunEnd;
757 if (!PyArg_ParseTuple(_args, "l",
758 &inParagraphRunIndex))
759 return NULL;
760 WEGetParaRunRange(inParagraphRunIndex,
761 &outParagraphRunStart,
762 &outParagraphRunEnd,
763 _self->ob_itself);
764 _res = Py_BuildValue("ll",
765 outParagraphRunStart,
766 outParagraphRunEnd);
767 return _res;
768}
769
770static PyObject *wasteObj_WECountLines(wasteObject *_self, PyObject *_args)
771{
772 PyObject *_res = NULL;
773 SInt32 _rv;
774 if (!PyArg_ParseTuple(_args, ""))
775 return NULL;
776 _rv = WECountLines(_self->ob_itself);
777 _res = Py_BuildValue("l",
778 _rv);
779 return _res;
780}
781
782static PyObject *wasteObj_WEOffsetToLine(wasteObject *_self, PyObject *_args)
783{
784 PyObject *_res = NULL;
785 SInt32 _rv;
786 SInt32 inOffset;
787 if (!PyArg_ParseTuple(_args, "l",
788 &inOffset))
789 return NULL;
790 _rv = WEOffsetToLine(inOffset,
791 _self->ob_itself);
792 _res = Py_BuildValue("l",
793 _rv);
794 return _res;
795}
796
797static PyObject *wasteObj_WEGetLineRange(wasteObject *_self, PyObject *_args)
798{
799 PyObject *_res = NULL;
800 SInt32 inLineIndex;
801 SInt32 outLineStart;
802 SInt32 outLineEnd;
803 if (!PyArg_ParseTuple(_args, "l",
804 &inLineIndex))
805 return NULL;
806 WEGetLineRange(inLineIndex,
807 &outLineStart,
808 &outLineEnd,
809 _self->ob_itself);
810 _res = Py_BuildValue("ll",
811 outLineStart,
812 outLineEnd);
813 return _res;
814}
815
816static PyObject *wasteObj_WEGetHeight(wasteObject *_self, PyObject *_args)
817{
818 PyObject *_res = NULL;
819 SInt32 _rv;
820 SInt32 inStartLineIndex;
821 SInt32 inEndLineIndex;
822 if (!PyArg_ParseTuple(_args, "ll",
823 &inStartLineIndex,
824 &inEndLineIndex))
825 return NULL;
826 _rv = WEGetHeight(inStartLineIndex,
827 inEndLineIndex,
828 _self->ob_itself);
829 _res = Py_BuildValue("l",
830 _rv);
831 return _res;
832}
833
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000834static PyObject *wasteObj_WEGetOffset(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000835{
836 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +0000837 SInt32 _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +0000838 LongPt inPoint;
839 WEEdge outEdge;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000840 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +0000841 LongPt_Convert, &inPoint))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000842 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000843 _rv = WEGetOffset(&inPoint,
844 &outEdge,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000845 _self->ob_itself);
Jack Jansen97ed9072000-09-08 22:06:16 +0000846 _res = Py_BuildValue("lB",
Jack Jansen90ecdf41996-04-16 14:29:15 +0000847 _rv,
Jack Jansenb99e5212002-01-11 12:37:15 +0000848 outEdge);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000849 return _res;
850}
851
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000852static PyObject *wasteObj_WEGetPoint(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000853{
854 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000855 SInt32 inOffset;
856 SInt16 inDirection;
857 LongPt outPoint;
858 SInt16 outLineHeight;
Jack Jansen2268af51996-08-06 16:04:22 +0000859 if (!PyArg_ParseTuple(_args, "lh",
Jack Jansenb99e5212002-01-11 12:37:15 +0000860 &inOffset,
861 &inDirection))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000862 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000863 WEGetPoint(inOffset,
864 inDirection,
865 &outPoint,
866 &outLineHeight,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000867 _self->ob_itself);
868 _res = Py_BuildValue("O&h",
Jack Jansenb99e5212002-01-11 12:37:15 +0000869 LongPt_New, &outPoint,
870 outLineHeight);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000871 return _res;
872}
873
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000874static PyObject *wasteObj_WEFindWord(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000875{
876 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000877 SInt32 inOffset;
878 WEEdge inEdge;
879 SInt32 outWordStart;
880 SInt32 outWordEnd;
Jack Jansen97ed9072000-09-08 22:06:16 +0000881 if (!PyArg_ParseTuple(_args, "lB",
Jack Jansenb99e5212002-01-11 12:37:15 +0000882 &inOffset,
883 &inEdge))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000884 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000885 WEFindWord(inOffset,
886 inEdge,
887 &outWordStart,
888 &outWordEnd,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000889 _self->ob_itself);
890 _res = Py_BuildValue("ll",
Jack Jansenb99e5212002-01-11 12:37:15 +0000891 outWordStart,
892 outWordEnd);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000893 return _res;
894}
895
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000896static PyObject *wasteObj_WEFindLine(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000897{
898 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000899 SInt32 inOffset;
900 WEEdge inEdge;
901 SInt32 outLineStart;
902 SInt32 outLineEnd;
Jack Jansen97ed9072000-09-08 22:06:16 +0000903 if (!PyArg_ParseTuple(_args, "lB",
Jack Jansenb99e5212002-01-11 12:37:15 +0000904 &inOffset,
905 &inEdge))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000906 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000907 WEFindLine(inOffset,
908 inEdge,
909 &outLineStart,
910 &outLineEnd,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000911 _self->ob_itself);
912 _res = Py_BuildValue("ll",
Jack Jansenb99e5212002-01-11 12:37:15 +0000913 outLineStart,
914 outLineEnd);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000915 return _res;
916}
917
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000918static PyObject *wasteObj_WEFindParagraph(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +0000919{
920 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000921 SInt32 inOffset;
922 WEEdge inEdge;
923 SInt32 outParagraphStart;
924 SInt32 outParagraphEnd;
Jack Jansen97ed9072000-09-08 22:06:16 +0000925 if (!PyArg_ParseTuple(_args, "lB",
Jack Jansenb99e5212002-01-11 12:37:15 +0000926 &inOffset,
927 &inEdge))
Jack Jansen2369a981998-02-20 15:57:30 +0000928 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000929 WEFindParagraph(inOffset,
930 inEdge,
931 &outParagraphStart,
932 &outParagraphEnd,
Jack Jansen2369a981998-02-20 15:57:30 +0000933 _self->ob_itself);
934 _res = Py_BuildValue("ll",
Jack Jansenb99e5212002-01-11 12:37:15 +0000935 outParagraphStart,
936 outParagraphEnd);
937 return _res;
938}
939
940static PyObject *wasteObj_WEFind(wasteObject *_self, PyObject *_args)
941{
942 PyObject *_res = NULL;
943 OSErr _err;
944 char* inKey;
945 SInt32 inKeyLength;
946 TextEncoding inKeyEncoding;
947 OptionBits inMatchOptions;
948 SInt32 inRangeStart;
949 SInt32 inRangeEnd;
950 SInt32 outMatchStart;
951 SInt32 outMatchEnd;
952 if (!PyArg_ParseTuple(_args, "slllll",
953 &inKey,
954 &inKeyLength,
955 &inKeyEncoding,
956 &inMatchOptions,
957 &inRangeStart,
958 &inRangeEnd))
959 return NULL;
960 _err = WEFind(inKey,
961 inKeyLength,
962 inKeyEncoding,
963 inMatchOptions,
964 inRangeStart,
965 inRangeEnd,
966 &outMatchStart,
967 &outMatchEnd,
968 _self->ob_itself);
969 if (_err != noErr) return PyMac_Error(_err);
970 _res = Py_BuildValue("ll",
971 outMatchStart,
972 outMatchEnd);
973 return _res;
974}
975
976static PyObject *wasteObj_WEStreamRange(wasteObject *_self, PyObject *_args)
977{
978 PyObject *_res = NULL;
979 OSErr _err;
980 SInt32 inRangeStart;
981 SInt32 inRangeEnd;
982 FlavorType inRequestedType;
983 OptionBits inStreamOptions;
984 Handle outData;
985 if (!PyArg_ParseTuple(_args, "llO&lO&",
986 &inRangeStart,
987 &inRangeEnd,
988 PyMac_GetOSType, &inRequestedType,
989 &inStreamOptions,
990 ResObj_Convert, &outData))
991 return NULL;
992 _err = WEStreamRange(inRangeStart,
993 inRangeEnd,
994 inRequestedType,
995 inStreamOptions,
996 outData,
997 _self->ob_itself);
998 if (_err != noErr) return PyMac_Error(_err);
999 Py_INCREF(Py_None);
1000 _res = Py_None;
Jack Jansen2369a981998-02-20 15:57:30 +00001001 return _res;
1002}
1003
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001004static PyObject *wasteObj_WECopyRange(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001005{
1006 PyObject *_res = NULL;
1007 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001008 SInt32 inRangeStart;
1009 SInt32 inRangeEnd;
1010 Handle outText;
1011 StScrpHandle outStyles;
1012 WESoupHandle outSoup;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001013 if (!PyArg_ParseTuple(_args, "llO&O&O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001014 &inRangeStart,
1015 &inRangeEnd,
1016 OptResObj_Convert, &outText,
1017 OptResObj_Convert, &outStyles,
1018 OptResObj_Convert, &outSoup))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001019 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001020 _err = WECopyRange(inRangeStart,
1021 inRangeEnd,
1022 outText,
1023 outStyles,
1024 outSoup,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001025 _self->ob_itself);
1026 if (_err != noErr) return PyMac_Error(_err);
1027 Py_INCREF(Py_None);
1028 _res = Py_None;
1029 return _res;
1030}
1031
Jack Jansenb99e5212002-01-11 12:37:15 +00001032static PyObject *wasteObj_WEGetTextRangeAsUnicode(wasteObject *_self, PyObject *_args)
1033{
1034 PyObject *_res = NULL;
1035 OSErr _err;
1036 SInt32 inRangeStart;
1037 SInt32 inRangeEnd;
1038 Handle outUnicodeText;
1039 Handle ioCharFormat;
1040 Handle ioParaFormat;
1041 TextEncodingVariant inUnicodeVariant;
1042 TextEncodingFormat inTransformationFormat;
1043 OptionBits inGetOptions;
1044 if (!PyArg_ParseTuple(_args, "llO&O&O&lll",
1045 &inRangeStart,
1046 &inRangeEnd,
1047 ResObj_Convert, &outUnicodeText,
1048 ResObj_Convert, &ioCharFormat,
1049 ResObj_Convert, &ioParaFormat,
1050 &inUnicodeVariant,
1051 &inTransformationFormat,
1052 &inGetOptions))
1053 return NULL;
1054 _err = WEGetTextRangeAsUnicode(inRangeStart,
1055 inRangeEnd,
1056 outUnicodeText,
1057 ioCharFormat,
1058 ioParaFormat,
1059 inUnicodeVariant,
1060 inTransformationFormat,
1061 inGetOptions,
1062 _self->ob_itself);
1063 if (_err != noErr) return PyMac_Error(_err);
1064 Py_INCREF(Py_None);
1065 _res = Py_None;
1066 return _res;
1067}
1068
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001069static PyObject *wasteObj_WEGetAlignment(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001070{
1071 PyObject *_res = NULL;
1072 WEAlignment _rv;
1073 if (!PyArg_ParseTuple(_args, ""))
1074 return NULL;
1075 _rv = WEGetAlignment(_self->ob_itself);
Jack Jansen97ed9072000-09-08 22:06:16 +00001076 _res = Py_BuildValue("B",
Jack Jansen90ecdf41996-04-16 14:29:15 +00001077 _rv);
1078 return _res;
1079}
1080
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001081static PyObject *wasteObj_WESetAlignment(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001082{
1083 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001084 WEAlignment inAlignment;
Jack Jansen97ed9072000-09-08 22:06:16 +00001085 if (!PyArg_ParseTuple(_args, "B",
Jack Jansenb99e5212002-01-11 12:37:15 +00001086 &inAlignment))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001087 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001088 WESetAlignment(inAlignment,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001089 _self->ob_itself);
1090 Py_INCREF(Py_None);
1091 _res = Py_None;
1092 return _res;
1093}
1094
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001095static PyObject *wasteObj_WEGetDirection(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00001096{
1097 PyObject *_res = NULL;
1098 WEDirection _rv;
1099 if (!PyArg_ParseTuple(_args, ""))
1100 return NULL;
1101 _rv = WEGetDirection(_self->ob_itself);
1102 _res = Py_BuildValue("h",
1103 _rv);
1104 return _res;
1105}
1106
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001107static PyObject *wasteObj_WESetDirection(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00001108{
1109 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001110 WEDirection inDirection;
Jack Jansen2369a981998-02-20 15:57:30 +00001111 if (!PyArg_ParseTuple(_args, "h",
Jack Jansenb99e5212002-01-11 12:37:15 +00001112 &inDirection))
Jack Jansen2369a981998-02-20 15:57:30 +00001113 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001114 WESetDirection(inDirection,
Jack Jansen2369a981998-02-20 15:57:30 +00001115 _self->ob_itself);
1116 Py_INCREF(Py_None);
1117 _res = Py_None;
1118 return _res;
1119}
1120
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001121static PyObject *wasteObj_WECalText(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001122{
1123 PyObject *_res = NULL;
1124 OSErr _err;
1125 if (!PyArg_ParseTuple(_args, ""))
1126 return NULL;
1127 _err = WECalText(_self->ob_itself);
1128 if (_err != noErr) return PyMac_Error(_err);
1129 Py_INCREF(Py_None);
1130 _res = Py_None;
1131 return _res;
1132}
1133
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001134static PyObject *wasteObj_WEUpdate(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001135{
1136 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001137 RgnHandle inUpdateRgn;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001138 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001139 ResObj_Convert, &inUpdateRgn))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001140 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001141 WEUpdate(inUpdateRgn,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001142 _self->ob_itself);
1143 Py_INCREF(Py_None);
1144 _res = Py_None;
1145 return _res;
1146}
1147
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001148static PyObject *wasteObj_WEScroll(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001149{
1150 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001151 SInt32 inHorizontalOffset;
1152 SInt32 inVerticalOffset;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001153 if (!PyArg_ParseTuple(_args, "ll",
Jack Jansenb99e5212002-01-11 12:37:15 +00001154 &inHorizontalOffset,
1155 &inVerticalOffset))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001156 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001157 WEScroll(inHorizontalOffset,
1158 inVerticalOffset,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001159 _self->ob_itself);
1160 Py_INCREF(Py_None);
1161 _res = Py_None;
1162 return _res;
1163}
1164
Jack Jansenb99e5212002-01-11 12:37:15 +00001165static PyObject *wasteObj_WEPinScroll(wasteObject *_self, PyObject *_args)
1166{
1167 PyObject *_res = NULL;
1168 SInt32 inHorizontalOffset;
1169 SInt32 inVerticalOffset;
1170 if (!PyArg_ParseTuple(_args, "ll",
1171 &inHorizontalOffset,
1172 &inVerticalOffset))
1173 return NULL;
1174 WEPinScroll(inHorizontalOffset,
1175 inVerticalOffset,
1176 _self->ob_itself);
1177 Py_INCREF(Py_None);
1178 _res = Py_None;
1179 return _res;
1180}
1181
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001182static PyObject *wasteObj_WESelView(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001183{
1184 PyObject *_res = NULL;
1185 if (!PyArg_ParseTuple(_args, ""))
1186 return NULL;
1187 WESelView(_self->ob_itself);
1188 Py_INCREF(Py_None);
1189 _res = Py_None;
1190 return _res;
1191}
1192
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001193static PyObject *wasteObj_WEActivate(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001194{
1195 PyObject *_res = NULL;
1196 if (!PyArg_ParseTuple(_args, ""))
1197 return NULL;
1198 WEActivate(_self->ob_itself);
1199 Py_INCREF(Py_None);
1200 _res = Py_None;
1201 return _res;
1202}
1203
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001204static PyObject *wasteObj_WEDeactivate(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001205{
1206 PyObject *_res = NULL;
1207 if (!PyArg_ParseTuple(_args, ""))
1208 return NULL;
1209 WEDeactivate(_self->ob_itself);
1210 Py_INCREF(Py_None);
1211 _res = Py_None;
1212 return _res;
1213}
1214
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001215static PyObject *wasteObj_WEKey(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001216{
1217 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001218 CharParameter inKey;
1219 EventModifiers inModifiers;
Jack Jansen9d8b96c2000-07-14 22:16:45 +00001220 if (!PyArg_ParseTuple(_args, "hH",
Jack Jansenb99e5212002-01-11 12:37:15 +00001221 &inKey,
1222 &inModifiers))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001223 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001224 WEKey(inKey,
1225 inModifiers,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001226 _self->ob_itself);
1227 Py_INCREF(Py_None);
1228 _res = Py_None;
1229 return _res;
1230}
1231
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001232static PyObject *wasteObj_WEClick(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001233{
1234 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001235 Point inHitPoint;
1236 EventModifiers inModifiers;
1237 UInt32 inClickTime;
Jack Jansen9d8b96c2000-07-14 22:16:45 +00001238 if (!PyArg_ParseTuple(_args, "O&Hl",
Jack Jansenb99e5212002-01-11 12:37:15 +00001239 PyMac_GetPoint, &inHitPoint,
1240 &inModifiers,
1241 &inClickTime))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001242 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001243 WEClick(inHitPoint,
1244 inModifiers,
1245 inClickTime,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001246 _self->ob_itself);
1247 Py_INCREF(Py_None);
1248 _res = Py_None;
1249 return _res;
1250}
1251
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001252static PyObject *wasteObj_WEAdjustCursor(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001253{
1254 PyObject *_res = NULL;
1255 Boolean _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00001256 Point inMouseLoc;
1257 RgnHandle ioMouseRgn;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001258 if (!PyArg_ParseTuple(_args, "O&O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001259 PyMac_GetPoint, &inMouseLoc,
1260 ResObj_Convert, &ioMouseRgn))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001261 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001262 _rv = WEAdjustCursor(inMouseLoc,
1263 ioMouseRgn,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001264 _self->ob_itself);
1265 _res = Py_BuildValue("b",
1266 _rv);
1267 return _res;
1268}
1269
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001270static PyObject *wasteObj_WEIdle(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001271{
1272 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001273 UInt32 outMaxSleep;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001274 if (!PyArg_ParseTuple(_args, ""))
1275 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001276 WEIdle(&outMaxSleep,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001277 _self->ob_itself);
1278 _res = Py_BuildValue("l",
Jack Jansenb99e5212002-01-11 12:37:15 +00001279 outMaxSleep);
Jack Jansen90ecdf41996-04-16 14:29:15 +00001280 return _res;
1281}
1282
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001283static PyObject *wasteObj_WEInsert(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001284{
1285 PyObject *_res = NULL;
1286 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001287 char *inTextPtr__in__;
1288 long inTextPtr__len__;
1289 int inTextPtr__in_len__;
1290 StScrpHandle inStyles;
1291 WESoupHandle inSoup;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001292 if (!PyArg_ParseTuple(_args, "s#O&O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001293 &inTextPtr__in__, &inTextPtr__in_len__,
1294 OptResObj_Convert, &inStyles,
1295 OptResObj_Convert, &inSoup))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001296 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001297 inTextPtr__len__ = inTextPtr__in_len__;
1298 _err = WEInsert(inTextPtr__in__, inTextPtr__len__,
1299 inStyles,
1300 inSoup,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001301 _self->ob_itself);
1302 if (_err != noErr) return PyMac_Error(_err);
1303 Py_INCREF(Py_None);
1304 _res = Py_None;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001305 return _res;
1306}
1307
Jack Jansenb99e5212002-01-11 12:37:15 +00001308static PyObject *wasteObj_WEInsertFormattedText(wasteObject *_self, PyObject *_args)
1309{
1310 PyObject *_res = NULL;
1311 OSErr _err;
1312 char *inTextPtr__in__;
1313 long inTextPtr__len__;
1314 int inTextPtr__in_len__;
1315 StScrpHandle inStyles;
1316 WESoupHandle inSoup;
1317 Handle inParaFormat;
1318 Handle inRulerScrap;
1319 if (!PyArg_ParseTuple(_args, "s#O&O&O&O&",
1320 &inTextPtr__in__, &inTextPtr__in_len__,
1321 OptResObj_Convert, &inStyles,
1322 OptResObj_Convert, &inSoup,
1323 ResObj_Convert, &inParaFormat,
1324 ResObj_Convert, &inRulerScrap))
1325 return NULL;
1326 inTextPtr__len__ = inTextPtr__in_len__;
1327 _err = WEInsertFormattedText(inTextPtr__in__, inTextPtr__len__,
1328 inStyles,
1329 inSoup,
1330 inParaFormat,
1331 inRulerScrap,
1332 _self->ob_itself);
1333 if (_err != noErr) return PyMac_Error(_err);
1334 Py_INCREF(Py_None);
1335 _res = Py_None;
1336 return _res;
1337}
1338
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001339static PyObject *wasteObj_WEDelete(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001340{
1341 PyObject *_res = NULL;
1342 OSErr _err;
1343 if (!PyArg_ParseTuple(_args, ""))
1344 return NULL;
1345 _err = WEDelete(_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 Jansenb99e5212002-01-11 12:37:15 +00001352static PyObject *wasteObj_WEUseText(wasteObject *_self, PyObject *_args)
1353{
1354 PyObject *_res = NULL;
1355 OSErr _err;
1356 Handle inText;
1357 if (!PyArg_ParseTuple(_args, "O&",
1358 ResObj_Convert, &inText))
1359 return NULL;
1360 _err = WEUseText(inText,
1361 _self->ob_itself);
1362 if (_err != noErr) return PyMac_Error(_err);
1363 Py_INCREF(Py_None);
1364 _res = Py_None;
1365 return _res;
1366}
1367
1368static PyObject *wasteObj_WEChangeCase(wasteObject *_self, PyObject *_args)
1369{
1370 PyObject *_res = NULL;
1371 OSErr _err;
1372 SInt16 inCase;
1373 if (!PyArg_ParseTuple(_args, "h",
1374 &inCase))
1375 return NULL;
1376 _err = WEChangeCase(inCase,
1377 _self->ob_itself);
1378 if (_err != noErr) return PyMac_Error(_err);
1379 Py_INCREF(Py_None);
1380 _res = Py_None;
1381 return _res;
1382}
1383
1384static PyObject *wasteObj_WESetOneAttribute(wasteObject *_self, PyObject *_args)
1385{
1386 PyObject *_res = NULL;
1387 OSErr _err;
1388 SInt32 inRangeStart;
1389 SInt32 inRangeEnd;
1390 WESelector inAttributeSelector;
1391 char *inAttributeValue__in__;
1392 long inAttributeValue__len__;
1393 int inAttributeValue__in_len__;
1394 if (!PyArg_ParseTuple(_args, "llO&s#",
1395 &inRangeStart,
1396 &inRangeEnd,
1397 PyMac_GetOSType, &inAttributeSelector,
1398 &inAttributeValue__in__, &inAttributeValue__in_len__))
1399 return NULL;
1400 inAttributeValue__len__ = inAttributeValue__in_len__;
1401 _err = WESetOneAttribute(inRangeStart,
1402 inRangeEnd,
1403 inAttributeSelector,
1404 inAttributeValue__in__, inAttributeValue__len__,
1405 _self->ob_itself);
1406 if (_err != noErr) return PyMac_Error(_err);
1407 Py_INCREF(Py_None);
1408 _res = Py_None;
1409 return _res;
1410}
1411
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001412static PyObject *wasteObj_WESetStyle(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001413{
1414 PyObject *_res = NULL;
1415 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001416 WEStyleMode inMode;
1417 TextStyle inTextStyle;
Jack Jansen9d8b96c2000-07-14 22:16:45 +00001418 if (!PyArg_ParseTuple(_args, "HO&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001419 &inMode,
1420 TextStyle_Convert, &inTextStyle))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001421 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001422 _err = WESetStyle(inMode,
1423 &inTextStyle,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001424 _self->ob_itself);
1425 if (_err != noErr) return PyMac_Error(_err);
1426 Py_INCREF(Py_None);
1427 _res = Py_None;
1428 return _res;
1429}
1430
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001431static PyObject *wasteObj_WEUseStyleScrap(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001432{
1433 PyObject *_res = NULL;
1434 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001435 StScrpHandle inStyles;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001436 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001437 ResObj_Convert, &inStyles))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001438 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001439 _err = WEUseStyleScrap(inStyles,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001440 _self->ob_itself);
1441 if (_err != noErr) return PyMac_Error(_err);
1442 Py_INCREF(Py_None);
1443 _res = Py_None;
1444 return _res;
1445}
1446
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001447static PyObject *wasteObj_WEUndo(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001448{
1449 PyObject *_res = NULL;
1450 OSErr _err;
1451 if (!PyArg_ParseTuple(_args, ""))
1452 return NULL;
1453 _err = WEUndo(_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 Jansenb99e5212002-01-11 12:37:15 +00001460static PyObject *wasteObj_WERedo(wasteObject *_self, PyObject *_args)
1461{
1462 PyObject *_res = NULL;
1463 OSErr _err;
1464 if (!PyArg_ParseTuple(_args, ""))
1465 return NULL;
1466 _err = WERedo(_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 Jansenfa77e1a2001-05-22 21:56:42 +00001473static PyObject *wasteObj_WEClearUndo(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001474{
1475 PyObject *_res = NULL;
1476 if (!PyArg_ParseTuple(_args, ""))
1477 return NULL;
1478 WEClearUndo(_self->ob_itself);
1479 Py_INCREF(Py_None);
1480 _res = Py_None;
1481 return _res;
1482}
1483
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001484static PyObject *wasteObj_WEGetUndoInfo(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001485{
1486 PyObject *_res = NULL;
1487 WEActionKind _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00001488 Boolean outRedoFlag;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001489 if (!PyArg_ParseTuple(_args, ""))
1490 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001491 _rv = WEGetUndoInfo(&outRedoFlag,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001492 _self->ob_itself);
1493 _res = Py_BuildValue("hb",
1494 _rv,
Jack Jansenb99e5212002-01-11 12:37:15 +00001495 outRedoFlag);
1496 return _res;
1497}
1498
1499static PyObject *wasteObj_WEGetIndUndoInfo(wasteObject *_self, PyObject *_args)
1500{
1501 PyObject *_res = NULL;
1502 WEActionKind _rv;
1503 SInt32 inUndoLevel;
1504 if (!PyArg_ParseTuple(_args, "l",
1505 &inUndoLevel))
1506 return NULL;
1507 _rv = WEGetIndUndoInfo(inUndoLevel,
1508 _self->ob_itself);
1509 _res = Py_BuildValue("h",
1510 _rv);
Jack Jansen90ecdf41996-04-16 14:29:15 +00001511 return _res;
1512}
1513
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001514static PyObject *wasteObj_WEIsTyping(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001515{
1516 PyObject *_res = NULL;
1517 Boolean _rv;
1518 if (!PyArg_ParseTuple(_args, ""))
1519 return NULL;
1520 _rv = WEIsTyping(_self->ob_itself);
1521 _res = Py_BuildValue("b",
1522 _rv);
1523 return _res;
1524}
1525
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001526static PyObject *wasteObj_WEBeginAction(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00001527{
1528 PyObject *_res = NULL;
1529 OSErr _err;
1530 if (!PyArg_ParseTuple(_args, ""))
1531 return NULL;
1532 _err = WEBeginAction(_self->ob_itself);
1533 if (_err != noErr) return PyMac_Error(_err);
1534 Py_INCREF(Py_None);
1535 _res = Py_None;
1536 return _res;
1537}
1538
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001539static PyObject *wasteObj_WEEndAction(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00001540{
1541 PyObject *_res = NULL;
1542 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001543 WEActionKind inActionKind;
Jack Jansen2369a981998-02-20 15:57:30 +00001544 if (!PyArg_ParseTuple(_args, "h",
Jack Jansenb99e5212002-01-11 12:37:15 +00001545 &inActionKind))
Jack Jansen2369a981998-02-20 15:57:30 +00001546 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001547 _err = WEEndAction(inActionKind,
Jack Jansen2369a981998-02-20 15:57:30 +00001548 _self->ob_itself);
1549 if (_err != noErr) return PyMac_Error(_err);
1550 Py_INCREF(Py_None);
1551 _res = Py_None;
1552 return _res;
1553}
1554
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001555static PyObject *wasteObj_WEGetModCount(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001556{
1557 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +00001558 UInt32 _rv;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001559 if (!PyArg_ParseTuple(_args, ""))
1560 return NULL;
1561 _rv = WEGetModCount(_self->ob_itself);
1562 _res = Py_BuildValue("l",
1563 _rv);
1564 return _res;
1565}
1566
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001567static PyObject *wasteObj_WEResetModCount(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001568{
1569 PyObject *_res = NULL;
1570 if (!PyArg_ParseTuple(_args, ""))
1571 return NULL;
1572 WEResetModCount(_self->ob_itself);
1573 Py_INCREF(Py_None);
1574 _res = Py_None;
1575 return _res;
1576}
1577
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001578static PyObject *wasteObj_WEInsertObject(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001579{
1580 PyObject *_res = NULL;
1581 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001582 FlavorType inObjectType;
1583 Handle inObjectDataHandle;
1584 Point inObjectSize;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001585 if (!PyArg_ParseTuple(_args, "O&O&O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001586 PyMac_GetOSType, &inObjectType,
1587 ResObj_Convert, &inObjectDataHandle,
1588 PyMac_GetPoint, &inObjectSize))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001589 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001590 _err = WEInsertObject(inObjectType,
1591 inObjectDataHandle,
1592 inObjectSize,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001593 _self->ob_itself);
1594 if (_err != noErr) return PyMac_Error(_err);
1595 Py_INCREF(Py_None);
1596 _res = Py_None;
1597 return _res;
1598}
1599
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001600static PyObject *wasteObj_WEGetSelectedObject(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001601{
1602 PyObject *_res = NULL;
1603 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001604 WEObjectReference outObject;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001605 if (!PyArg_ParseTuple(_args, ""))
1606 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001607 _err = WEGetSelectedObject(&outObject,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001608 _self->ob_itself);
1609 if (_err != noErr) return PyMac_Error(_err);
1610 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001611 WEOObj_New, outObject);
1612 return _res;
1613}
1614
1615static PyObject *wasteObj_WEGetObjectAtOffset(wasteObject *_self, PyObject *_args)
1616{
1617 PyObject *_res = NULL;
1618 OSErr _err;
1619 SInt32 inOffset;
1620 WEObjectReference outObject;
1621 if (!PyArg_ParseTuple(_args, "l",
1622 &inOffset))
1623 return NULL;
1624 _err = WEGetObjectAtOffset(inOffset,
1625 &outObject,
1626 _self->ob_itself);
1627 if (_err != noErr) return PyMac_Error(_err);
1628 _res = Py_BuildValue("O&",
1629 WEOObj_New, outObject);
Jack Jansen90ecdf41996-04-16 14:29:15 +00001630 return _res;
1631}
1632
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001633static PyObject *wasteObj_WEFindNextObject(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001634{
1635 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +00001636 SInt32 _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00001637 SInt32 inOffset;
1638 WEObjectReference outObject;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001639 if (!PyArg_ParseTuple(_args, "l",
Jack Jansenb99e5212002-01-11 12:37:15 +00001640 &inOffset))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001641 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001642 _rv = WEFindNextObject(inOffset,
1643 &outObject,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001644 _self->ob_itself);
1645 _res = Py_BuildValue("lO&",
1646 _rv,
Jack Jansenb99e5212002-01-11 12:37:15 +00001647 WEOObj_New, outObject);
Jack Jansen90ecdf41996-04-16 14:29:15 +00001648 return _res;
1649}
1650
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001651static PyObject *wasteObj_WEUseSoup(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001652{
1653 PyObject *_res = NULL;
1654 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001655 WESoupHandle inSoup;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001656 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001657 ResObj_Convert, &inSoup))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001658 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001659 _err = WEUseSoup(inSoup,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001660 _self->ob_itself);
1661 if (_err != noErr) return PyMac_Error(_err);
1662 Py_INCREF(Py_None);
1663 _res = Py_None;
1664 return _res;
1665}
1666
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001667static PyObject *wasteObj_WECut(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001668{
1669 PyObject *_res = NULL;
1670 OSErr _err;
1671 if (!PyArg_ParseTuple(_args, ""))
1672 return NULL;
1673 _err = WECut(_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_WECopy(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 = WECopy(_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_WEPaste(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 = WEPaste(_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_WECanPaste(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001707{
1708 PyObject *_res = NULL;
1709 Boolean _rv;
1710 if (!PyArg_ParseTuple(_args, ""))
1711 return NULL;
1712 _rv = WECanPaste(_self->ob_itself);
1713 _res = Py_BuildValue("b",
1714 _rv);
1715 return _res;
1716}
1717
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001718static PyObject *wasteObj_WEGetHiliteRgn(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001719{
1720 PyObject *_res = NULL;
1721 RgnHandle _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00001722 SInt32 inRangeStart;
1723 SInt32 inRangeEnd;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001724 if (!PyArg_ParseTuple(_args, "ll",
Jack Jansenb99e5212002-01-11 12:37:15 +00001725 &inRangeStart,
1726 &inRangeEnd))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001727 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001728 _rv = WEGetHiliteRgn(inRangeStart,
1729 inRangeEnd,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001730 _self->ob_itself);
1731 _res = Py_BuildValue("O&",
1732 ResObj_New, _rv);
1733 return _res;
1734}
1735
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001736static PyObject *wasteObj_WECharByte(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001737{
1738 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +00001739 SInt16 _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00001740 SInt32 inOffset;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001741 if (!PyArg_ParseTuple(_args, "l",
Jack Jansenb99e5212002-01-11 12:37:15 +00001742 &inOffset))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001743 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001744 _rv = WECharByte(inOffset,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001745 _self->ob_itself);
1746 _res = Py_BuildValue("h",
1747 _rv);
1748 return _res;
1749}
1750
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001751static PyObject *wasteObj_WECharType(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001752{
1753 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +00001754 SInt16 _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00001755 SInt32 inOffset;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001756 if (!PyArg_ParseTuple(_args, "l",
Jack Jansenb99e5212002-01-11 12:37:15 +00001757 &inOffset))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001758 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001759 _rv = WECharType(inOffset,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001760 _self->ob_itself);
1761 _res = Py_BuildValue("h",
1762 _rv);
1763 return _res;
1764}
1765
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001766static PyObject *wasteObj_WEStopInlineSession(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001767{
1768 PyObject *_res = NULL;
1769 if (!PyArg_ParseTuple(_args, ""))
1770 return NULL;
1771 WEStopInlineSession(_self->ob_itself);
1772 Py_INCREF(Py_None);
1773 _res = Py_None;
1774 return _res;
1775}
1776
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001777static PyObject *wasteObj_WEFeatureFlag(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001778{
1779 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +00001780 SInt16 _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00001781 SInt16 inFeature;
1782 SInt16 inAction;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001783 if (!PyArg_ParseTuple(_args, "hh",
Jack Jansenb99e5212002-01-11 12:37:15 +00001784 &inFeature,
1785 &inAction))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001786 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001787 _rv = WEFeatureFlag(inFeature,
1788 inAction,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001789 _self->ob_itself);
1790 _res = Py_BuildValue("h",
1791 _rv);
1792 return _res;
1793}
1794
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001795static PyObject *wasteObj_WEGetUserInfo(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00001796{
1797 PyObject *_res = NULL;
1798 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001799 WESelector inUserTag;
1800 SInt32 outUserInfo;
Jack Jansen2369a981998-02-20 15:57:30 +00001801 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001802 PyMac_GetOSType, &inUserTag))
Jack Jansen2369a981998-02-20 15:57:30 +00001803 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001804 _err = WEGetUserInfo(inUserTag,
1805 &outUserInfo,
Jack Jansen2369a981998-02-20 15:57:30 +00001806 _self->ob_itself);
1807 if (_err != noErr) return PyMac_Error(_err);
1808 _res = Py_BuildValue("l",
Jack Jansenb99e5212002-01-11 12:37:15 +00001809 outUserInfo);
Jack Jansen2369a981998-02-20 15:57:30 +00001810 return _res;
1811}
1812
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001813static PyObject *wasteObj_WESetUserInfo(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00001814{
1815 PyObject *_res = NULL;
1816 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001817 WESelector inUserTag;
1818 SInt32 inUserInfo;
Jack Jansen2369a981998-02-20 15:57:30 +00001819 if (!PyArg_ParseTuple(_args, "O&l",
Jack Jansenb99e5212002-01-11 12:37:15 +00001820 PyMac_GetOSType, &inUserTag,
1821 &inUserInfo))
Jack Jansen2369a981998-02-20 15:57:30 +00001822 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001823 _err = WESetUserInfo(inUserTag,
1824 inUserInfo,
Jack Jansen2369a981998-02-20 15:57:30 +00001825 _self->ob_itself);
1826 if (_err != noErr) return PyMac_Error(_err);
1827 Py_INCREF(Py_None);
1828 _res = Py_None;
1829 return _res;
1830}
1831
Jack Jansenb99e5212002-01-11 12:37:15 +00001832static PyObject *wasteObj_WERemoveUserInfo(wasteObject *_self, PyObject *_args)
1833{
1834 PyObject *_res = NULL;
1835 OSErr _err;
1836 WESelector inUserTag;
1837 if (!PyArg_ParseTuple(_args, "O&",
1838 PyMac_GetOSType, &inUserTag))
1839 return NULL;
1840 _err = WERemoveUserInfo(inUserTag,
1841 _self->ob_itself);
1842 if (_err != noErr) return PyMac_Error(_err);
1843 Py_INCREF(Py_None);
1844 _res = Py_None;
1845 return _res;
1846}
1847
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001848static PyObject *wasteObj_WEInstallTabHooks(wasteObject *_self, PyObject *_args)
Jack Jansen176f3a91996-10-23 15:43:46 +00001849{
1850 PyObject *_res = NULL;
1851 OSErr _err;
1852 if (!PyArg_ParseTuple(_args, ""))
1853 return NULL;
1854 _err = WEInstallTabHooks(_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_WERemoveTabHooks(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 = WERemoveTabHooks(_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_WEIsTabHooks(wasteObject *_self, PyObject *_args)
Jack Jansen176f3a91996-10-23 15:43:46 +00001875{
1876 PyObject *_res = NULL;
1877 Boolean _rv;
1878 if (!PyArg_ParseTuple(_args, ""))
1879 return NULL;
1880 _rv = WEIsTabHooks(_self->ob_itself);
1881 _res = Py_BuildValue("b",
1882 _rv);
1883 return _res;
1884}
1885
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001886static PyObject *wasteObj_WEGetTabSize(wasteObject *_self, PyObject *_args)
Jack Jansena4f03091998-03-02 16:56:18 +00001887{
1888 PyObject *_res = NULL;
1889 SInt16 _rv;
1890 if (!PyArg_ParseTuple(_args, ""))
1891 return NULL;
1892 _rv = WEGetTabSize(_self->ob_itself);
1893 _res = Py_BuildValue("h",
1894 _rv);
1895 return _res;
1896}
1897
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001898static PyObject *wasteObj_WESetTabSize(wasteObject *_self, PyObject *_args)
Jack Jansena4f03091998-03-02 16:56:18 +00001899{
1900 PyObject *_res = NULL;
1901 OSErr _err;
1902 SInt16 tabWidth;
1903 if (!PyArg_ParseTuple(_args, "h",
1904 &tabWidth))
1905 return NULL;
1906 _err = WESetTabSize(tabWidth,
1907 _self->ob_itself);
1908 if (_err != noErr) return PyMac_Error(_err);
1909 Py_INCREF(Py_None);
1910 _res = Py_None;
1911 return _res;
1912}
1913
Jack Jansen90ecdf41996-04-16 14:29:15 +00001914static PyMethodDef wasteObj_methods[] = {
1915 {"WEGetText", (PyCFunction)wasteObj_WEGetText, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001916 PyDoc_STR("() -> (Handle _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001917 {"WEGetChar", (PyCFunction)wasteObj_WEGetChar, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001918 PyDoc_STR("(SInt32 inOffset) -> (SInt16 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001919 {"WEGetTextLength", (PyCFunction)wasteObj_WEGetTextLength, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001920 PyDoc_STR("() -> (SInt32 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001921 {"WEGetSelection", (PyCFunction)wasteObj_WEGetSelection, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001922 PyDoc_STR("() -> (SInt32 outSelStart, SInt32 outSelEnd)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001923 {"WEGetDestRect", (PyCFunction)wasteObj_WEGetDestRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001924 PyDoc_STR("() -> (LongRect outDestRect)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001925 {"WEGetViewRect", (PyCFunction)wasteObj_WEGetViewRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001926 PyDoc_STR("() -> (LongRect outViewRect)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001927 {"WEIsActive", (PyCFunction)wasteObj_WEIsActive, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001928 PyDoc_STR("() -> (Boolean _rv)")},
Jack Jansen2268af51996-08-06 16:04:22 +00001929 {"WEGetClickCount", (PyCFunction)wasteObj_WEGetClickCount, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001930 PyDoc_STR("() -> (UInt16 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001931 {"WESetSelection", (PyCFunction)wasteObj_WESetSelection, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001932 PyDoc_STR("(SInt32 inSelStart, SInt32 inSelEnd) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001933 {"WESetDestRect", (PyCFunction)wasteObj_WESetDestRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001934 PyDoc_STR("(LongRect inDestRect) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001935 {"WESetViewRect", (PyCFunction)wasteObj_WESetViewRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001936 PyDoc_STR("(LongRect inViewRect) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001937 {"WEContinuousStyle", (PyCFunction)wasteObj_WEContinuousStyle, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001938 PyDoc_STR("(WEStyleMode ioMode) -> (Boolean _rv, WEStyleMode ioMode, TextStyle outTextStyle)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001939 {"WECountRuns", (PyCFunction)wasteObj_WECountRuns, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001940 PyDoc_STR("() -> (SInt32 _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001941 {"WEOffsetToRun", (PyCFunction)wasteObj_WEOffsetToRun, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001942 PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001943 {"WEGetRunRange", (PyCFunction)wasteObj_WEGetRunRange, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001944 PyDoc_STR("(SInt32 inStyleRunIndex) -> (SInt32 outStyleRunStart, SInt32 outStyleRunEnd)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001945 {"WEGetRunInfo", (PyCFunction)wasteObj_WEGetRunInfo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001946 PyDoc_STR("(SInt32 inOffset) -> (WERunInfo outStyleRunInfo)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001947 {"WEGetIndRunInfo", (PyCFunction)wasteObj_WEGetIndRunInfo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001948 PyDoc_STR("(SInt32 inStyleRunIndex) -> (WERunInfo outStyleRunInfo)")},
Jack Jansen2369a981998-02-20 15:57:30 +00001949 {"WEGetRunDirection", (PyCFunction)wasteObj_WEGetRunDirection, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001950 PyDoc_STR("(SInt32 inOffset) -> (Boolean _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001951 {"WECountParaRuns", (PyCFunction)wasteObj_WECountParaRuns, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001952 PyDoc_STR("() -> (SInt32 _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001953 {"WEOffsetToParaRun", (PyCFunction)wasteObj_WEOffsetToParaRun, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001954 PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001955 {"WEGetParaRunRange", (PyCFunction)wasteObj_WEGetParaRunRange, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001956 PyDoc_STR("(SInt32 inParagraphRunIndex) -> (SInt32 outParagraphRunStart, SInt32 outParagraphRunEnd)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001957 {"WECountLines", (PyCFunction)wasteObj_WECountLines, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001958 PyDoc_STR("() -> (SInt32 _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001959 {"WEOffsetToLine", (PyCFunction)wasteObj_WEOffsetToLine, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001960 PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001961 {"WEGetLineRange", (PyCFunction)wasteObj_WEGetLineRange, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001962 PyDoc_STR("(SInt32 inLineIndex) -> (SInt32 outLineStart, SInt32 outLineEnd)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001963 {"WEGetHeight", (PyCFunction)wasteObj_WEGetHeight, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001964 PyDoc_STR("(SInt32 inStartLineIndex, SInt32 inEndLineIndex) -> (SInt32 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001965 {"WEGetOffset", (PyCFunction)wasteObj_WEGetOffset, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001966 PyDoc_STR("(LongPt inPoint) -> (SInt32 _rv, WEEdge outEdge)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001967 {"WEGetPoint", (PyCFunction)wasteObj_WEGetPoint, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001968 PyDoc_STR("(SInt32 inOffset, SInt16 inDirection) -> (LongPt outPoint, SInt16 outLineHeight)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001969 {"WEFindWord", (PyCFunction)wasteObj_WEFindWord, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001970 PyDoc_STR("(SInt32 inOffset, WEEdge inEdge) -> (SInt32 outWordStart, SInt32 outWordEnd)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001971 {"WEFindLine", (PyCFunction)wasteObj_WEFindLine, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001972 PyDoc_STR("(SInt32 inOffset, WEEdge inEdge) -> (SInt32 outLineStart, SInt32 outLineEnd)")},
Jack Jansen2369a981998-02-20 15:57:30 +00001973 {"WEFindParagraph", (PyCFunction)wasteObj_WEFindParagraph, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001974 PyDoc_STR("(SInt32 inOffset, WEEdge inEdge) -> (SInt32 outParagraphStart, SInt32 outParagraphEnd)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001975 {"WEFind", (PyCFunction)wasteObj_WEFind, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001976 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 +00001977 {"WEStreamRange", (PyCFunction)wasteObj_WEStreamRange, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001978 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd, FlavorType inRequestedType, OptionBits inStreamOptions, Handle outData) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001979 {"WECopyRange", (PyCFunction)wasteObj_WECopyRange, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001980 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd, Handle outText, StScrpHandle outStyles, WESoupHandle outSoup) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001981 {"WEGetTextRangeAsUnicode", (PyCFunction)wasteObj_WEGetTextRangeAsUnicode, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001982 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 +00001983 {"WEGetAlignment", (PyCFunction)wasteObj_WEGetAlignment, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001984 PyDoc_STR("() -> (WEAlignment _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001985 {"WESetAlignment", (PyCFunction)wasteObj_WESetAlignment, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001986 PyDoc_STR("(WEAlignment inAlignment) -> None")},
Jack Jansen2369a981998-02-20 15:57:30 +00001987 {"WEGetDirection", (PyCFunction)wasteObj_WEGetDirection, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001988 PyDoc_STR("() -> (WEDirection _rv)")},
Jack Jansen2369a981998-02-20 15:57:30 +00001989 {"WESetDirection", (PyCFunction)wasteObj_WESetDirection, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001990 PyDoc_STR("(WEDirection inDirection) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001991 {"WECalText", (PyCFunction)wasteObj_WECalText, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001992 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001993 {"WEUpdate", (PyCFunction)wasteObj_WEUpdate, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001994 PyDoc_STR("(RgnHandle inUpdateRgn) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001995 {"WEScroll", (PyCFunction)wasteObj_WEScroll, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001996 PyDoc_STR("(SInt32 inHorizontalOffset, SInt32 inVerticalOffset) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001997 {"WEPinScroll", (PyCFunction)wasteObj_WEPinScroll, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001998 PyDoc_STR("(SInt32 inHorizontalOffset, SInt32 inVerticalOffset) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001999 {"WESelView", (PyCFunction)wasteObj_WESelView, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002000 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002001 {"WEActivate", (PyCFunction)wasteObj_WEActivate, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002002 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002003 {"WEDeactivate", (PyCFunction)wasteObj_WEDeactivate, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002004 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002005 {"WEKey", (PyCFunction)wasteObj_WEKey, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002006 PyDoc_STR("(CharParameter inKey, EventModifiers inModifiers) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002007 {"WEClick", (PyCFunction)wasteObj_WEClick, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002008 PyDoc_STR("(Point inHitPoint, EventModifiers inModifiers, UInt32 inClickTime) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002009 {"WEAdjustCursor", (PyCFunction)wasteObj_WEAdjustCursor, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002010 PyDoc_STR("(Point inMouseLoc, RgnHandle ioMouseRgn) -> (Boolean _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002011 {"WEIdle", (PyCFunction)wasteObj_WEIdle, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002012 PyDoc_STR("() -> (UInt32 outMaxSleep)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002013 {"WEInsert", (PyCFunction)wasteObj_WEInsert, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002014 PyDoc_STR("(Buffer inTextPtr, StScrpHandle inStyles, WESoupHandle inSoup) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002015 {"WEInsertFormattedText", (PyCFunction)wasteObj_WEInsertFormattedText, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002016 PyDoc_STR("(Buffer inTextPtr, StScrpHandle inStyles, WESoupHandle inSoup, Handle inParaFormat, Handle inRulerScrap) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002017 {"WEDelete", (PyCFunction)wasteObj_WEDelete, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002018 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002019 {"WEUseText", (PyCFunction)wasteObj_WEUseText, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002020 PyDoc_STR("(Handle inText) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002021 {"WEChangeCase", (PyCFunction)wasteObj_WEChangeCase, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002022 PyDoc_STR("(SInt16 inCase) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002023 {"WESetOneAttribute", (PyCFunction)wasteObj_WESetOneAttribute, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002024 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd, WESelector inAttributeSelector, Buffer inAttributeValue) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002025 {"WESetStyle", (PyCFunction)wasteObj_WESetStyle, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002026 PyDoc_STR("(WEStyleMode inMode, TextStyle inTextStyle) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002027 {"WEUseStyleScrap", (PyCFunction)wasteObj_WEUseStyleScrap, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002028 PyDoc_STR("(StScrpHandle inStyles) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002029 {"WEUndo", (PyCFunction)wasteObj_WEUndo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002030 PyDoc_STR("() -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002031 {"WERedo", (PyCFunction)wasteObj_WERedo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002032 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002033 {"WEClearUndo", (PyCFunction)wasteObj_WEClearUndo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002034 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002035 {"WEGetUndoInfo", (PyCFunction)wasteObj_WEGetUndoInfo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002036 PyDoc_STR("() -> (WEActionKind _rv, Boolean outRedoFlag)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002037 {"WEGetIndUndoInfo", (PyCFunction)wasteObj_WEGetIndUndoInfo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002038 PyDoc_STR("(SInt32 inUndoLevel) -> (WEActionKind _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002039 {"WEIsTyping", (PyCFunction)wasteObj_WEIsTyping, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002040 PyDoc_STR("() -> (Boolean _rv)")},
Jack Jansen2369a981998-02-20 15:57:30 +00002041 {"WEBeginAction", (PyCFunction)wasteObj_WEBeginAction, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002042 PyDoc_STR("() -> None")},
Jack Jansen2369a981998-02-20 15:57:30 +00002043 {"WEEndAction", (PyCFunction)wasteObj_WEEndAction, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002044 PyDoc_STR("(WEActionKind inActionKind) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002045 {"WEGetModCount", (PyCFunction)wasteObj_WEGetModCount, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002046 PyDoc_STR("() -> (UInt32 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002047 {"WEResetModCount", (PyCFunction)wasteObj_WEResetModCount, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002048 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002049 {"WEInsertObject", (PyCFunction)wasteObj_WEInsertObject, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002050 PyDoc_STR("(FlavorType inObjectType, Handle inObjectDataHandle, Point inObjectSize) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002051 {"WEGetSelectedObject", (PyCFunction)wasteObj_WEGetSelectedObject, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002052 PyDoc_STR("() -> (WEObjectReference outObject)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002053 {"WEGetObjectAtOffset", (PyCFunction)wasteObj_WEGetObjectAtOffset, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002054 PyDoc_STR("(SInt32 inOffset) -> (WEObjectReference outObject)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002055 {"WEFindNextObject", (PyCFunction)wasteObj_WEFindNextObject, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002056 PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv, WEObjectReference outObject)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002057 {"WEUseSoup", (PyCFunction)wasteObj_WEUseSoup, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002058 PyDoc_STR("(WESoupHandle inSoup) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002059 {"WECut", (PyCFunction)wasteObj_WECut, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002060 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002061 {"WECopy", (PyCFunction)wasteObj_WECopy, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002062 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002063 {"WEPaste", (PyCFunction)wasteObj_WEPaste, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002064 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002065 {"WECanPaste", (PyCFunction)wasteObj_WECanPaste, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002066 PyDoc_STR("() -> (Boolean _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002067 {"WEGetHiliteRgn", (PyCFunction)wasteObj_WEGetHiliteRgn, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002068 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd) -> (RgnHandle _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002069 {"WECharByte", (PyCFunction)wasteObj_WECharByte, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002070 PyDoc_STR("(SInt32 inOffset) -> (SInt16 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002071 {"WECharType", (PyCFunction)wasteObj_WECharType, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002072 PyDoc_STR("(SInt32 inOffset) -> (SInt16 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002073 {"WEStopInlineSession", (PyCFunction)wasteObj_WEStopInlineSession, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002074 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002075 {"WEFeatureFlag", (PyCFunction)wasteObj_WEFeatureFlag, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002076 PyDoc_STR("(SInt16 inFeature, SInt16 inAction) -> (SInt16 _rv)")},
Jack Jansen2369a981998-02-20 15:57:30 +00002077 {"WEGetUserInfo", (PyCFunction)wasteObj_WEGetUserInfo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002078 PyDoc_STR("(WESelector inUserTag) -> (SInt32 outUserInfo)")},
Jack Jansen2369a981998-02-20 15:57:30 +00002079 {"WESetUserInfo", (PyCFunction)wasteObj_WESetUserInfo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002080 PyDoc_STR("(WESelector inUserTag, SInt32 inUserInfo) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002081 {"WERemoveUserInfo", (PyCFunction)wasteObj_WERemoveUserInfo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002082 PyDoc_STR("(WESelector inUserTag) -> None")},
Jack Jansen176f3a91996-10-23 15:43:46 +00002083 {"WEInstallTabHooks", (PyCFunction)wasteObj_WEInstallTabHooks, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002084 PyDoc_STR("() -> None")},
Jack Jansen176f3a91996-10-23 15:43:46 +00002085 {"WERemoveTabHooks", (PyCFunction)wasteObj_WERemoveTabHooks, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002086 PyDoc_STR("() -> None")},
Jack Jansen176f3a91996-10-23 15:43:46 +00002087 {"WEIsTabHooks", (PyCFunction)wasteObj_WEIsTabHooks, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002088 PyDoc_STR("() -> (Boolean _rv)")},
Jack Jansena4f03091998-03-02 16:56:18 +00002089 {"WEGetTabSize", (PyCFunction)wasteObj_WEGetTabSize, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002090 PyDoc_STR("() -> (SInt16 _rv)")},
Jack Jansena4f03091998-03-02 16:56:18 +00002091 {"WESetTabSize", (PyCFunction)wasteObj_WESetTabSize, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002092 PyDoc_STR("(SInt16 tabWidth) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002093 {NULL, NULL, 0}
2094};
2095
2096PyMethodChain wasteObj_chain = { wasteObj_methods, NULL };
2097
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002098static PyObject *wasteObj_getattr(wasteObject *self, char *name)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002099{
2100 return Py_FindMethodInChain(&wasteObj_chain, (PyObject *)self, name);
2101}
2102
2103#define wasteObj_setattr NULL
2104
Jack Jansen9d8b96c2000-07-14 22:16:45 +00002105#define wasteObj_compare NULL
2106
2107#define wasteObj_repr NULL
2108
2109#define wasteObj_hash NULL
2110
Jack Jansen90ecdf41996-04-16 14:29:15 +00002111PyTypeObject waste_Type = {
Jack Jansenb3be2162001-11-30 14:16:36 +00002112 PyObject_HEAD_INIT(NULL)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002113 0, /*ob_size*/
Guido van Rossum14648392001-12-08 18:02:58 +00002114 "waste.waste", /*tp_name*/
Jack Jansen90ecdf41996-04-16 14:29:15 +00002115 sizeof(wasteObject), /*tp_basicsize*/
2116 0, /*tp_itemsize*/
2117 /* methods */
2118 (destructor) wasteObj_dealloc, /*tp_dealloc*/
2119 0, /*tp_print*/
2120 (getattrfunc) wasteObj_getattr, /*tp_getattr*/
2121 (setattrfunc) wasteObj_setattr, /*tp_setattr*/
Jack Jansen9d8b96c2000-07-14 22:16:45 +00002122 (cmpfunc) wasteObj_compare, /*tp_compare*/
2123 (reprfunc) wasteObj_repr, /*tp_repr*/
2124 (PyNumberMethods *)0, /* tp_as_number */
2125 (PySequenceMethods *)0, /* tp_as_sequence */
2126 (PyMappingMethods *)0, /* tp_as_mapping */
2127 (hashfunc) wasteObj_hash, /*tp_hash*/
Jack Jansen90ecdf41996-04-16 14:29:15 +00002128};
2129
2130/* --------------------- End object type waste ---------------------- */
2131
2132
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002133static PyObject *waste_WENew(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002134{
2135 PyObject *_res = NULL;
2136 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00002137 LongRect inDestRect;
2138 LongRect inViewRect;
2139 OptionBits inOptions;
2140 WEReference outWE;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002141 if (!PyArg_ParseTuple(_args, "O&O&l",
Jack Jansenb99e5212002-01-11 12:37:15 +00002142 LongRect_Convert, &inDestRect,
2143 LongRect_Convert, &inViewRect,
2144 &inOptions))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002145 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002146 _err = WENew(&inDestRect,
2147 &inViewRect,
2148 inOptions,
2149 &outWE);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002150 if (_err != noErr) return PyMac_Error(_err);
2151 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002152 wasteObj_New, outWE);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002153 return _res;
2154}
2155
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002156static PyObject *waste_WEUpdateStyleScrap(PyObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00002157{
2158 PyObject *_res = NULL;
2159 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00002160 StScrpHandle ioStyles;
2161 WEFontTableHandle inFontTable;
Jack Jansen2369a981998-02-20 15:57:30 +00002162 if (!PyArg_ParseTuple(_args, "O&O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002163 ResObj_Convert, &ioStyles,
2164 ResObj_Convert, &inFontTable))
Jack Jansen2369a981998-02-20 15:57:30 +00002165 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002166 _err = WEUpdateStyleScrap(ioStyles,
2167 inFontTable);
Jack Jansen2369a981998-02-20 15:57:30 +00002168 if (_err != noErr) return PyMac_Error(_err);
2169 Py_INCREF(Py_None);
2170 _res = Py_None;
2171 return _res;
2172}
2173
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002174static PyObject *waste_WEInstallTSMHandlers(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002175{
2176 PyObject *_res = NULL;
2177 OSErr _err;
2178 if (!PyArg_ParseTuple(_args, ""))
2179 return NULL;
2180 _err = WEInstallTSMHandlers();
2181 if (_err != noErr) return PyMac_Error(_err);
2182 Py_INCREF(Py_None);
2183 _res = Py_None;
2184 return _res;
2185}
2186
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002187static PyObject *waste_WERemoveTSMHandlers(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002188{
2189 PyObject *_res = NULL;
2190 OSErr _err;
2191 if (!PyArg_ParseTuple(_args, ""))
2192 return NULL;
2193 _err = WERemoveTSMHandlers();
2194 if (_err != noErr) return PyMac_Error(_err);
2195 Py_INCREF(Py_None);
2196 _res = Py_None;
2197 return _res;
2198}
2199
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002200static PyObject *waste_WEHandleTSMEvent(PyObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00002201{
2202 PyObject *_res = NULL;
2203 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00002204 AppleEvent inAppleEvent;
2205 AppleEvent ioReply;
Jack Jansen2369a981998-02-20 15:57:30 +00002206 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002207 AEDesc_Convert, &inAppleEvent))
Jack Jansen2369a981998-02-20 15:57:30 +00002208 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002209 _err = WEHandleTSMEvent(&inAppleEvent,
2210 &ioReply);
Jack Jansen2369a981998-02-20 15:57:30 +00002211 if (_err != noErr) return PyMac_Error(_err);
2212 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002213 AEDesc_New, &ioReply);
Jack Jansen2369a981998-02-20 15:57:30 +00002214 return _res;
2215}
2216
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002217static PyObject *waste_WELongPointToPoint(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002218{
2219 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002220 LongPt inLongPoint;
2221 Point outPoint;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002222 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002223 LongPt_Convert, &inLongPoint))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002224 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002225 WELongPointToPoint(&inLongPoint,
2226 &outPoint);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002227 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002228 PyMac_BuildPoint, outPoint);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002229 return _res;
2230}
2231
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002232static PyObject *waste_WEPointToLongPoint(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002233{
2234 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002235 Point inPoint;
2236 LongPt outLongPoint;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002237 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002238 PyMac_GetPoint, &inPoint))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002239 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002240 WEPointToLongPoint(inPoint,
2241 &outLongPoint);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002242 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002243 LongPt_New, &outLongPoint);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002244 return _res;
2245}
2246
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002247static PyObject *waste_WESetLongRect(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002248{
2249 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002250 LongRect outLongRect;
2251 SInt32 inLeft;
2252 SInt32 inTop;
2253 SInt32 inRight;
2254 SInt32 inBottom;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002255 if (!PyArg_ParseTuple(_args, "llll",
Jack Jansenb99e5212002-01-11 12:37:15 +00002256 &inLeft,
2257 &inTop,
2258 &inRight,
2259 &inBottom))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002260 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002261 WESetLongRect(&outLongRect,
2262 inLeft,
2263 inTop,
2264 inRight,
2265 inBottom);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002266 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002267 LongRect_New, &outLongRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002268 return _res;
2269}
2270
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002271static PyObject *waste_WELongRectToRect(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002272{
2273 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002274 LongRect inLongRect;
2275 Rect outRect;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002276 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002277 LongRect_Convert, &inLongRect))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002278 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002279 WELongRectToRect(&inLongRect,
2280 &outRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002281 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002282 PyMac_BuildRect, &outRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002283 return _res;
2284}
2285
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002286static PyObject *waste_WERectToLongRect(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002287{
2288 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002289 Rect inRect;
2290 LongRect outLongRect;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002291 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002292 PyMac_GetRect, &inRect))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002293 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002294 WERectToLongRect(&inRect,
2295 &outLongRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002296 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002297 LongRect_New, &outLongRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002298 return _res;
2299}
2300
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002301static PyObject *waste_WEOffsetLongRect(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002302{
2303 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002304 LongRect ioLongRect;
2305 SInt32 inHorizontalOffset;
2306 SInt32 inVerticalOffset;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002307 if (!PyArg_ParseTuple(_args, "ll",
Jack Jansenb99e5212002-01-11 12:37:15 +00002308 &inHorizontalOffset,
2309 &inVerticalOffset))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002310 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002311 WEOffsetLongRect(&ioLongRect,
2312 inHorizontalOffset,
2313 inVerticalOffset);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002314 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002315 LongRect_New, &ioLongRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002316 return _res;
2317}
2318
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002319static PyObject *waste_WELongPointInLongRect(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002320{
2321 PyObject *_res = NULL;
2322 Boolean _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00002323 LongPt inLongPoint;
2324 LongRect inLongRect;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002325 if (!PyArg_ParseTuple(_args, "O&O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002326 LongPt_Convert, &inLongPoint,
2327 LongRect_Convert, &inLongRect))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002328 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002329 _rv = WELongPointInLongRect(&inLongPoint,
2330 &inLongRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002331 _res = Py_BuildValue("b",
2332 _rv);
2333 return _res;
2334}
2335
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002336static PyObject *waste_STDObjectHandlers(PyObject *_self, PyObject *_args)
Jack Jansen756522f1996-05-07 15:24:01 +00002337{
2338 PyObject *_res = NULL;
2339
2340 OSErr err;
2341 // install the sample object handlers for pictures and sounds
2342#define kTypePicture 'PICT'
2343#define kTypeSound 'snd '
2344
2345 if ( !PyArg_ParseTuple(_args, "") ) return NULL;
2346
2347 if ((err = WEInstallObjectHandler(kTypePicture, weNewHandler,
2348 (UniversalProcPtr) NewWENewObjectProc(HandleNewPicture), NULL)) != noErr)
2349 goto cleanup;
2350
2351 if ((err = WEInstallObjectHandler(kTypePicture, weDisposeHandler,
2352 (UniversalProcPtr) NewWEDisposeObjectProc(HandleDisposePicture), NULL)) != noErr)
2353 goto cleanup;
2354
2355 if ((err = WEInstallObjectHandler(kTypePicture, weDrawHandler,
2356 (UniversalProcPtr) NewWEDrawObjectProc(HandleDrawPicture), NULL)) != noErr)
2357 goto cleanup;
2358
2359 if ((err = WEInstallObjectHandler(kTypeSound, weNewHandler,
2360 (UniversalProcPtr) NewWENewObjectProc(HandleNewSound), NULL)) != noErr)
2361 goto cleanup;
2362
2363 if ((err = WEInstallObjectHandler(kTypeSound, weDrawHandler,
2364 (UniversalProcPtr) NewWEDrawObjectProc(HandleDrawSound), NULL)) != noErr)
2365 goto cleanup;
2366
2367 if ((err = WEInstallObjectHandler(kTypeSound, weClickHandler,
2368 (UniversalProcPtr) NewWEClickObjectProc(HandleClickSound), NULL)) != noErr)
2369 goto cleanup;
2370 Py_INCREF(Py_None);
2371 return Py_None;
2372
2373 cleanup:
2374 return PyMac_Error(err);
2375
2376}
2377
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002378static PyObject *waste_WEInstallObjectHandler(PyObject *_self, PyObject *_args)
Jack Jansen756522f1996-05-07 15:24:01 +00002379{
2380 PyObject *_res = NULL;
2381
2382 OSErr err;
2383 FlavorType objectType;
2384 WESelector selector;
2385 PyObject *py_handler;
2386 UniversalProcPtr handler;
2387 WEReference we = NULL;
2388 PyObject *key;
2389
2390
2391 if ( !PyArg_ParseTuple(_args, "O&O&O|O&",
2392 PyMac_GetOSType, &objectType,
2393 PyMac_GetOSType, &selector,
2394 &py_handler,
Jack Jansen7df36061996-10-01 11:41:14 +00002395 WEOObj_Convert, &we) ) return NULL;
Jack Jansen756522f1996-05-07 15:24:01 +00002396
Jack Jansen25241d91996-05-20 11:30:45 +00002397 if ( selector == weNewHandler ) handler = (UniversalProcPtr)upp_new_handler;
2398 else if ( selector == weDisposeHandler ) handler = (UniversalProcPtr)upp_dispose_handler;
2399 else if ( selector == weDrawHandler ) handler = (UniversalProcPtr)upp_draw_handler;
2400 else if ( selector == weClickHandler ) handler = (UniversalProcPtr)upp_click_handler;
Jack Jansen756522f1996-05-07 15:24:01 +00002401 else return PyMac_Error(weUndefinedSelectorErr);
2402
2403 if ((key = Py_BuildValue("O&O&",
2404 PyMac_BuildOSType, objectType,
2405 PyMac_BuildOSType, selector)) == NULL )
2406 return NULL;
2407
2408 PyDict_SetItem(callbackdict, key, py_handler);
2409
2410 err = WEInstallObjectHandler(objectType, selector, handler, we);
2411 if ( err ) return PyMac_Error(err);
2412 Py_INCREF(Py_None);
2413 return Py_None;
2414
2415}
2416
Jack Jansen90ecdf41996-04-16 14:29:15 +00002417static PyMethodDef waste_methods[] = {
2418 {"WENew", (PyCFunction)waste_WENew, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002419 PyDoc_STR("(LongRect inDestRect, LongRect inViewRect, OptionBits inOptions) -> (WEReference outWE)")},
Jack Jansen2369a981998-02-20 15:57:30 +00002420 {"WEUpdateStyleScrap", (PyCFunction)waste_WEUpdateStyleScrap, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002421 PyDoc_STR("(StScrpHandle ioStyles, WEFontTableHandle inFontTable) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002422 {"WEInstallTSMHandlers", (PyCFunction)waste_WEInstallTSMHandlers, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002423 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002424 {"WERemoveTSMHandlers", (PyCFunction)waste_WERemoveTSMHandlers, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002425 PyDoc_STR("() -> None")},
Jack Jansen2369a981998-02-20 15:57:30 +00002426 {"WEHandleTSMEvent", (PyCFunction)waste_WEHandleTSMEvent, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002427 PyDoc_STR("(AppleEvent inAppleEvent) -> (AppleEvent ioReply)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002428 {"WELongPointToPoint", (PyCFunction)waste_WELongPointToPoint, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002429 PyDoc_STR("(LongPt inLongPoint) -> (Point outPoint)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002430 {"WEPointToLongPoint", (PyCFunction)waste_WEPointToLongPoint, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002431 PyDoc_STR("(Point inPoint) -> (LongPt outLongPoint)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002432 {"WESetLongRect", (PyCFunction)waste_WESetLongRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002433 PyDoc_STR("(SInt32 inLeft, SInt32 inTop, SInt32 inRight, SInt32 inBottom) -> (LongRect outLongRect)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002434 {"WELongRectToRect", (PyCFunction)waste_WELongRectToRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002435 PyDoc_STR("(LongRect inLongRect) -> (Rect outRect)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002436 {"WERectToLongRect", (PyCFunction)waste_WERectToLongRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002437 PyDoc_STR("(Rect inRect) -> (LongRect outLongRect)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002438 {"WEOffsetLongRect", (PyCFunction)waste_WEOffsetLongRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002439 PyDoc_STR("(SInt32 inHorizontalOffset, SInt32 inVerticalOffset) -> (LongRect ioLongRect)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002440 {"WELongPointInLongRect", (PyCFunction)waste_WELongPointInLongRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002441 PyDoc_STR("(LongPt inLongPoint, LongRect inLongRect) -> (Boolean _rv)")},
Jack Jansen756522f1996-05-07 15:24:01 +00002442 {"STDObjectHandlers", (PyCFunction)waste_STDObjectHandlers, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002443 PyDoc_STR(NULL)},
Jack Jansen756522f1996-05-07 15:24:01 +00002444 {"WEInstallObjectHandler", (PyCFunction)waste_WEInstallObjectHandler, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002445 PyDoc_STR(NULL)},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002446 {NULL, NULL, 0}
2447};
2448
2449
2450
Jack Jansen756522f1996-05-07 15:24:01 +00002451/* Return the object corresponding to the window, or NULL */
2452
2453PyObject *
2454ExistingwasteObj_New(w)
2455 WEReference w;
2456{
2457 PyObject *it = NULL;
2458
2459 if (w == NULL)
2460 it = NULL;
2461 else
2462 WEGetInfo(weRefCon, (void *)&it, w);
2463 if (it == NULL || ((wasteObject *)it)->ob_itself != w)
2464 it = Py_None;
2465 Py_INCREF(it);
2466 return it;
2467}
2468
Jack Jansen90ecdf41996-04-16 14:29:15 +00002469
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002470void initwaste(void)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002471{
2472 PyObject *m;
2473 PyObject *d;
2474
2475
2476
2477
2478 m = Py_InitModule("waste", waste_methods);
2479 d = PyModule_GetDict(m);
2480 waste_Error = PyMac_GetOSErrException();
2481 if (waste_Error == NULL ||
2482 PyDict_SetItemString(d, "Error", waste_Error) != 0)
Jack Jansen97ed9072000-09-08 22:06:16 +00002483 return;
Jack Jansena755e681997-09-20 17:40:22 +00002484 WEO_Type.ob_type = &PyType_Type;
2485 Py_INCREF(&WEO_Type);
2486 if (PyDict_SetItemString(d, "WEOType", (PyObject *)&WEO_Type) != 0)
2487 Py_FatalError("can't initialize WEOType");
2488 waste_Type.ob_type = &PyType_Type;
2489 Py_INCREF(&waste_Type);
2490 if (PyDict_SetItemString(d, "wasteType", (PyObject *)&waste_Type) != 0)
2491 Py_FatalError("can't initialize wasteType");
Jack Jansen756522f1996-05-07 15:24:01 +00002492
2493 callbackdict = PyDict_New();
2494 if (callbackdict == NULL || PyDict_SetItemString(d, "callbacks", callbackdict) != 0)
Jack Jansen97ed9072000-09-08 22:06:16 +00002495 return;
Jack Jansen756522f1996-05-07 15:24:01 +00002496 upp_new_handler = NewWENewObjectProc(my_new_handler);
Jack Jansen25241d91996-05-20 11:30:45 +00002497 upp_dispose_handler = NewWEDisposeObjectProc(my_dispose_handler);
2498 upp_draw_handler = NewWEDrawObjectProc(my_draw_handler);
2499 upp_click_handler = NewWEClickObjectProc(my_click_handler);
Jack Jansen756522f1996-05-07 15:24:01 +00002500
2501
Jack Jansen90ecdf41996-04-16 14:29:15 +00002502}
2503
2504/* ======================== End module waste ======================== */
2505