blob: e50107452cd46c451e731281e9ba596fe6b04c69 [file] [log] [blame]
Jack Jansen90ecdf41996-04-16 14:29:15 +00001
2/* ========================== Module waste ========================== */
3
4#include "Python.h"
5
6
7
Jack Jansen620a7662001-12-18 15:39:38 +00008#ifdef _WIN32
9#include "pywintoolbox.h"
10#else
Jack Jansen90ecdf41996-04-16 14:29:15 +000011#include "macglue.h"
Jack Jansen9d8b96c2000-07-14 22:16:45 +000012#include "pymactoolbox.h"
Jack Jansen620a7662001-12-18 15:39:38 +000013#endif
Jack Jansen044d95e2001-09-05 15:44:37 +000014
15/* Macro to test whether a weak-loaded CFM function exists */
16#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
17 PyErr_SetString(PyExc_NotImplementedError, \
18 "Not available in this shared library/OS version"); \
19 return NULL; \
20 }} while(0)
21
Jack Jansen90ecdf41996-04-16 14:29:15 +000022
23#include <WASTE.h>
Jack Jansen8505ef81997-08-27 14:09:25 +000024#include <WEObjectHandlers.h>
Jack Jansena755e681997-09-20 17:40:22 +000025#include <WETabs.h>
Jack Jansen97257352002-11-18 15:26:43 +000026#ifndef PyDoc_STR
27#define PyDoc_STR(x) (x)
28#endif
Jack Jansen90ecdf41996-04-16 14:29:15 +000029
30/* Exported by Qdmodule.c: */
31extern PyObject *QdRGB_New(RGBColor *);
32extern int QdRGB_Convert(PyObject *, RGBColor *);
33
Jack Jansen8505ef81997-08-27 14:09:25 +000034/* Exported by AEModule.c: */
35extern PyObject *AEDesc_New(AppleEvent *);
36extern int AEDesc_Convert(PyObject *, AppleEvent *);
37
Jack Jansen90ecdf41996-04-16 14:29:15 +000038/* Forward declaration */
Jeremy Hylton938ace62002-07-17 16:30:39 +000039static PyObject *WEOObj_New(WEObjectReference);
40static PyObject *ExistingwasteObj_New(WEReference);
Jack Jansen90ecdf41996-04-16 14:29:15 +000041
42/*
43** Parse/generate TextStyle records
44*/
45static
46PyObject *TextStyle_New(itself)
47 TextStylePtr itself;
48{
49
50 return Py_BuildValue("lllO&", (long)itself->tsFont, (long)itself->tsFace, (long)itself->tsSize, QdRGB_New,
51 &itself->tsColor);
52}
53
54static
55TextStyle_Convert(v, p_itself)
56 PyObject *v;
57 TextStylePtr p_itself;
58{
59 long font, face, size;
60
61 if( !PyArg_ParseTuple(v, "lllO&", &font, &face, &size, QdRGB_Convert, &p_itself->tsColor) )
62 return 0;
63 p_itself->tsFont = (short)font;
64 p_itself->tsFace = (Style)face;
65 p_itself->tsSize = (short)size;
66 return 1;
67}
68
69/*
70** Parse/generate RunInfo records
71*/
72static
73PyObject *RunInfo_New(itself)
74 WERunInfo *itself;
75{
76
77 return Py_BuildValue("llhhO&O&", itself->runStart, itself->runEnd, itself->runHeight,
78 itself->runAscent, TextStyle_New, &itself->runStyle, WEOObj_New, itself->runObject);
79}
80
81/* Conversion of long points and rects */
82int
83LongRect_Convert(PyObject *v, LongRect *r)
84{
85 return PyArg_Parse(v, "(llll)", &r->left, &r->top, &r->right, &r->bottom);
86}
87
88PyObject *
89LongRect_New(LongRect *r)
90{
91 return Py_BuildValue("(llll)", r->left, r->top, r->right, r->bottom);
92}
93
94
95LongPt_Convert(PyObject *v, LongPt *p)
96{
97 return PyArg_Parse(v, "(ll)", &p->h, &p->v);
98}
99
100PyObject *
101LongPt_New(LongPt *p)
102{
103 return Py_BuildValue("(ll)", p->h, p->v);
104}
105
Jack Jansen756522f1996-05-07 15:24:01 +0000106/* Stuff for the callbacks: */
107static PyObject *callbackdict;
Jack Jansen25241d91996-05-20 11:30:45 +0000108WENewObjectUPP upp_new_handler;
109WEDisposeObjectUPP upp_dispose_handler;
110WEDrawObjectUPP upp_draw_handler;
111WEClickObjectUPP upp_click_handler;
Jack Jansen756522f1996-05-07 15:24:01 +0000112
113static OSErr
114any_handler(WESelector what, WEObjectReference who, PyObject *args, PyObject **rv)
115{
116 FlavorType tp;
117 PyObject *key, *func;
118
119 if ( args == NULL ) return errAECorruptData;
120
121 tp = WEGetObjectType(who);
122
123 if( (key=Py_BuildValue("O&O&", PyMac_BuildOSType, tp, PyMac_BuildOSType, what)) == NULL)
124 return errAECorruptData;
125 if( (func = PyDict_GetItem(callbackdict, key)) == NULL ) {
126 Py_DECREF(key);
127 return errAEHandlerNotFound;
128 }
129 Py_INCREF(func);
130 *rv = PyEval_CallObject(func, args);
131 Py_DECREF(func);
132 Py_DECREF(key);
133 if ( *rv == NULL ) {
Jack Jansendeff89c1998-10-12 20:53:15 +0000134 PySys_WriteStderr("--Exception in callback: ");
Jack Jansen756522f1996-05-07 15:24:01 +0000135 PyErr_Print();
136 return errAEReplyNotArrived;
137 }
138 return 0;
139}
140
141static pascal OSErr
142my_new_handler(Point *objectSize, WEObjectReference objref)
143{
144 PyObject *args=NULL, *rv=NULL;
145 OSErr err;
146
147 args=Py_BuildValue("(O&)", WEOObj_New, objref);
148 err = any_handler(weNewHandler, objref, args, &rv);
149 if (!err) {
150 if (!PyMac_GetPoint(rv, objectSize) )
151 err = errAECoercionFail;
152 }
153 if ( args ) Py_DECREF(args);
154 if ( rv ) Py_DECREF(rv);
155 return err;
156}
157
158static pascal OSErr
159my_dispose_handler(WEObjectReference objref)
160{
161 PyObject *args=NULL, *rv=NULL;
162 OSErr err;
163
164 args=Py_BuildValue("(O&)", WEOObj_New, objref);
165 err = any_handler(weDisposeHandler, objref, args, &rv);
166 if ( args ) Py_DECREF(args);
167 if ( rv ) Py_DECREF(rv);
168 return err;
169}
170
171static pascal OSErr
Jack Jansen6b9289f2001-06-20 21:21:07 +0000172my_draw_handler(const Rect *destRect, WEObjectReference objref)
Jack Jansen756522f1996-05-07 15:24:01 +0000173{
174 PyObject *args=NULL, *rv=NULL;
175 OSErr err;
176
177 args=Py_BuildValue("O&O&", PyMac_BuildRect, destRect, WEOObj_New, objref);
178 err = any_handler(weDrawHandler, objref, args, &rv);
179 if ( args ) Py_DECREF(args);
180 if ( rv ) Py_DECREF(rv);
181 return err;
182}
183
184static pascal Boolean
185my_click_handler(Point hitPt, EventModifiers modifiers,
186 unsigned long clickTime, WEObjectReference objref)
187{
188 PyObject *args=NULL, *rv=NULL;
189 int retvalue;
190 OSErr err;
191
192 args=Py_BuildValue("O&llO&", PyMac_BuildPoint, hitPt,
193 (long)modifiers, (long)clickTime, WEOObj_New, objref);
194 err = any_handler(weClickHandler, objref, args, &rv);
195 if (!err)
196 retvalue = PyInt_AsLong(rv);
197 else
198 retvalue = 0;
199 if ( args ) Py_DECREF(args);
200 if ( rv ) Py_DECREF(rv);
201 return retvalue;
202}
203
204
205
Jack Jansen90ecdf41996-04-16 14:29:15 +0000206static PyObject *waste_Error;
207
208/* ------------------------ Object type WEO ------------------------- */
209
210PyTypeObject WEO_Type;
211
212#define WEOObj_Check(x) ((x)->ob_type == &WEO_Type)
213
214typedef struct WEOObject {
215 PyObject_HEAD
216 WEObjectReference ob_itself;
217} WEOObject;
218
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000219PyObject *WEOObj_New(WEObjectReference itself)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000220{
221 WEOObject *it;
222 if (itself == NULL) {
223 Py_INCREF(Py_None);
224 return Py_None;
225 }
226 it = PyObject_NEW(WEOObject, &WEO_Type);
227 if (it == NULL) return NULL;
228 it->ob_itself = itself;
229 return (PyObject *)it;
230}
Jack Jansen044d95e2001-09-05 15:44:37 +0000231int WEOObj_Convert(PyObject *v, WEObjectReference *p_itself)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000232{
233 if (!WEOObj_Check(v))
234 {
235 PyErr_SetString(PyExc_TypeError, "WEO required");
236 return 0;
237 }
238 *p_itself = ((WEOObject *)v)->ob_itself;
239 return 1;
240}
241
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000242static void WEOObj_dealloc(WEOObject *self)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000243{
244 /* Cleanup of self->ob_itself goes here */
Jack Jansen033b79c2002-04-23 22:46:01 +0000245 PyObject_Del(self);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000246}
247
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000248static PyObject *WEOObj_WEGetObjectType(WEOObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000249{
250 PyObject *_res = NULL;
251 FlavorType _rv;
252 if (!PyArg_ParseTuple(_args, ""))
253 return NULL;
254 _rv = WEGetObjectType(_self->ob_itself);
255 _res = Py_BuildValue("O&",
256 PyMac_BuildOSType, _rv);
257 return _res;
258}
259
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000260static PyObject *WEOObj_WEGetObjectDataHandle(WEOObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000261{
262 PyObject *_res = NULL;
263 Handle _rv;
264 if (!PyArg_ParseTuple(_args, ""))
265 return NULL;
266 _rv = WEGetObjectDataHandle(_self->ob_itself);
267 _res = Py_BuildValue("O&",
268 ResObj_New, _rv);
269 return _res;
270}
271
Jack Jansenb99e5212002-01-11 12:37:15 +0000272static PyObject *WEOObj_WEGetObjectOwner(WEOObject *_self, PyObject *_args)
273{
274 PyObject *_res = NULL;
275 WEReference _rv;
276 if (!PyArg_ParseTuple(_args, ""))
277 return NULL;
278 _rv = WEGetObjectOwner(_self->ob_itself);
279 _res = Py_BuildValue("O&",
280 ExistingwasteObj_New, _rv);
281 return _res;
282}
283
284static PyObject *WEOObj_WEGetObjectOffset(WEOObject *_self, PyObject *_args)
285{
286 PyObject *_res = NULL;
287 SInt32 _rv;
288 if (!PyArg_ParseTuple(_args, ""))
289 return NULL;
290 _rv = WEGetObjectOffset(_self->ob_itself);
291 _res = Py_BuildValue("l",
292 _rv);
293 return _res;
294}
295
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000296static PyObject *WEOObj_WEGetObjectSize(WEOObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000297{
298 PyObject *_res = NULL;
299 Point _rv;
300 if (!PyArg_ParseTuple(_args, ""))
301 return NULL;
302 _rv = WEGetObjectSize(_self->ob_itself);
303 _res = Py_BuildValue("O&",
304 PyMac_BuildPoint, _rv);
305 return _res;
306}
307
Jack Jansenb99e5212002-01-11 12:37:15 +0000308static PyObject *WEOObj_WESetObjectSize(WEOObject *_self, PyObject *_args)
Jack Jansen756522f1996-05-07 15:24:01 +0000309{
310 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000311 OSErr _err;
312 Point inObjectSize;
313 if (!PyArg_ParseTuple(_args, "O&",
314 PyMac_GetPoint, &inObjectSize))
315 return NULL;
316 _err = WESetObjectSize(_self->ob_itself,
317 inObjectSize);
318 if (_err != noErr) return PyMac_Error(_err);
319 Py_INCREF(Py_None);
320 _res = Py_None;
321 return _res;
322}
323
324static PyObject *WEOObj_WEGetObjectFrame(WEOObject *_self, PyObject *_args)
325{
326 PyObject *_res = NULL;
327 OSErr _err;
328 LongRect outObjectFrame;
Jack Jansen756522f1996-05-07 15:24:01 +0000329 if (!PyArg_ParseTuple(_args, ""))
330 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000331 _err = WEGetObjectFrame(_self->ob_itself,
332 &outObjectFrame);
333 if (_err != noErr) return PyMac_Error(_err);
Jack Jansen756522f1996-05-07 15:24:01 +0000334 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +0000335 LongRect_New, &outObjectFrame);
Jack Jansen756522f1996-05-07 15:24:01 +0000336 return _res;
337}
338
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000339static PyObject *WEOObj_WEGetObjectRefCon(WEOObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000340{
341 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +0000342 SInt32 _rv;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000343 if (!PyArg_ParseTuple(_args, ""))
344 return NULL;
345 _rv = WEGetObjectRefCon(_self->ob_itself);
346 _res = Py_BuildValue("l",
347 _rv);
348 return _res;
349}
350
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000351static PyObject *WEOObj_WESetObjectRefCon(WEOObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000352{
353 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000354 SInt32 inRefCon;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000355 if (!PyArg_ParseTuple(_args, "l",
Jack Jansenb99e5212002-01-11 12:37:15 +0000356 &inRefCon))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000357 return NULL;
358 WESetObjectRefCon(_self->ob_itself,
Jack Jansenb99e5212002-01-11 12:37:15 +0000359 inRefCon);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000360 Py_INCREF(Py_None);
361 _res = Py_None;
362 return _res;
363}
364
365static PyMethodDef WEOObj_methods[] = {
366 {"WEGetObjectType", (PyCFunction)WEOObj_WEGetObjectType, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000367 PyDoc_STR("() -> (FlavorType _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +0000368 {"WEGetObjectDataHandle", (PyCFunction)WEOObj_WEGetObjectDataHandle, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000369 PyDoc_STR("() -> (Handle _rv)")},
Jack Jansen756522f1996-05-07 15:24:01 +0000370 {"WEGetObjectOwner", (PyCFunction)WEOObj_WEGetObjectOwner, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000371 PyDoc_STR("() -> (WEReference _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +0000372 {"WEGetObjectOffset", (PyCFunction)WEOObj_WEGetObjectOffset, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000373 PyDoc_STR("() -> (SInt32 _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +0000374 {"WEGetObjectSize", (PyCFunction)WEOObj_WEGetObjectSize, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000375 PyDoc_STR("() -> (Point _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +0000376 {"WESetObjectSize", (PyCFunction)WEOObj_WESetObjectSize, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000377 PyDoc_STR("(Point inObjectSize) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +0000378 {"WEGetObjectFrame", (PyCFunction)WEOObj_WEGetObjectFrame, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000379 PyDoc_STR("() -> (LongRect outObjectFrame)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +0000380 {"WEGetObjectRefCon", (PyCFunction)WEOObj_WEGetObjectRefCon, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000381 PyDoc_STR("() -> (SInt32 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +0000382 {"WESetObjectRefCon", (PyCFunction)WEOObj_WESetObjectRefCon, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000383 PyDoc_STR("(SInt32 inRefCon) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +0000384 {NULL, NULL, 0}
385};
386
387PyMethodChain WEOObj_chain = { WEOObj_methods, NULL };
388
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000389static PyObject *WEOObj_getattr(WEOObject *self, char *name)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000390{
391 return Py_FindMethodInChain(&WEOObj_chain, (PyObject *)self, name);
392}
393
394#define WEOObj_setattr NULL
395
Jack Jansen9d8b96c2000-07-14 22:16:45 +0000396#define WEOObj_compare NULL
397
398#define WEOObj_repr NULL
399
400#define WEOObj_hash NULL
401
Jack Jansen90ecdf41996-04-16 14:29:15 +0000402PyTypeObject WEO_Type = {
Jack Jansenb3be2162001-11-30 14:16:36 +0000403 PyObject_HEAD_INIT(NULL)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000404 0, /*ob_size*/
Guido van Rossum14648392001-12-08 18:02:58 +0000405 "waste.WEO", /*tp_name*/
Jack Jansen90ecdf41996-04-16 14:29:15 +0000406 sizeof(WEOObject), /*tp_basicsize*/
407 0, /*tp_itemsize*/
408 /* methods */
409 (destructor) WEOObj_dealloc, /*tp_dealloc*/
410 0, /*tp_print*/
411 (getattrfunc) WEOObj_getattr, /*tp_getattr*/
412 (setattrfunc) WEOObj_setattr, /*tp_setattr*/
Jack Jansen9d8b96c2000-07-14 22:16:45 +0000413 (cmpfunc) WEOObj_compare, /*tp_compare*/
414 (reprfunc) WEOObj_repr, /*tp_repr*/
415 (PyNumberMethods *)0, /* tp_as_number */
416 (PySequenceMethods *)0, /* tp_as_sequence */
417 (PyMappingMethods *)0, /* tp_as_mapping */
418 (hashfunc) WEOObj_hash, /*tp_hash*/
Jack Jansen90ecdf41996-04-16 14:29:15 +0000419};
420
421/* ---------------------- End object type WEO ----------------------- */
422
423
424/* ----------------------- Object type waste ------------------------ */
425
426PyTypeObject waste_Type;
427
428#define wasteObj_Check(x) ((x)->ob_type == &waste_Type)
429
430typedef struct wasteObject {
431 PyObject_HEAD
432 WEReference ob_itself;
433} wasteObject;
434
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000435PyObject *wasteObj_New(WEReference itself)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000436{
437 wasteObject *it;
438 if (itself == NULL) {
439 PyErr_SetString(waste_Error,"Cannot create null WE");
440 return NULL;
441 }
442 it = PyObject_NEW(wasteObject, &waste_Type);
443 if (it == NULL) return NULL;
444 it->ob_itself = itself;
Jack Jansen756522f1996-05-07 15:24:01 +0000445 WESetInfo(weRefCon, (void *)&it, itself);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000446 return (PyObject *)it;
447}
Jack Jansen044d95e2001-09-05 15:44:37 +0000448int wasteObj_Convert(PyObject *v, WEReference *p_itself)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000449{
450 if (!wasteObj_Check(v))
451 {
452 PyErr_SetString(PyExc_TypeError, "waste required");
453 return 0;
454 }
455 *p_itself = ((wasteObject *)v)->ob_itself;
456 return 1;
457}
458
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000459static void wasteObj_dealloc(wasteObject *self)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000460{
461 WEDispose(self->ob_itself);
Jack Jansen033b79c2002-04-23 22:46:01 +0000462 PyObject_Del(self);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000463}
464
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000465static PyObject *wasteObj_WEGetText(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000466{
467 PyObject *_res = NULL;
468 Handle _rv;
469 if (!PyArg_ParseTuple(_args, ""))
470 return NULL;
471 _rv = WEGetText(_self->ob_itself);
472 _res = Py_BuildValue("O&",
473 ResObj_New, _rv);
474 return _res;
475}
476
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000477static PyObject *wasteObj_WEGetChar(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000478{
479 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +0000480 SInt16 _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +0000481 SInt32 inOffset;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000482 if (!PyArg_ParseTuple(_args, "l",
Jack Jansenb99e5212002-01-11 12:37:15 +0000483 &inOffset))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000484 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000485 _rv = WEGetChar(inOffset,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000486 _self->ob_itself);
487 _res = Py_BuildValue("h",
488 _rv);
489 return _res;
490}
491
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000492static PyObject *wasteObj_WEGetTextLength(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000493{
494 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +0000495 SInt32 _rv;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000496 if (!PyArg_ParseTuple(_args, ""))
497 return NULL;
498 _rv = WEGetTextLength(_self->ob_itself);
499 _res = Py_BuildValue("l",
500 _rv);
501 return _res;
502}
503
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000504static PyObject *wasteObj_WEGetSelection(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000505{
506 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000507 SInt32 outSelStart;
508 SInt32 outSelEnd;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000509 if (!PyArg_ParseTuple(_args, ""))
510 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000511 WEGetSelection(&outSelStart,
512 &outSelEnd,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000513 _self->ob_itself);
514 _res = Py_BuildValue("ll",
Jack Jansenb99e5212002-01-11 12:37:15 +0000515 outSelStart,
516 outSelEnd);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000517 return _res;
518}
519
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000520static PyObject *wasteObj_WEGetDestRect(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000521{
522 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000523 LongRect outDestRect;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000524 if (!PyArg_ParseTuple(_args, ""))
525 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000526 WEGetDestRect(&outDestRect,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000527 _self->ob_itself);
528 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +0000529 LongRect_New, &outDestRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000530 return _res;
531}
532
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000533static PyObject *wasteObj_WEGetViewRect(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000534{
535 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000536 LongRect outViewRect;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000537 if (!PyArg_ParseTuple(_args, ""))
538 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000539 WEGetViewRect(&outViewRect,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000540 _self->ob_itself);
541 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +0000542 LongRect_New, &outViewRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000543 return _res;
544}
545
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000546static PyObject *wasteObj_WEIsActive(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000547{
548 PyObject *_res = NULL;
549 Boolean _rv;
550 if (!PyArg_ParseTuple(_args, ""))
551 return NULL;
552 _rv = WEIsActive(_self->ob_itself);
553 _res = Py_BuildValue("b",
554 _rv);
555 return _res;
556}
557
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000558static PyObject *wasteObj_WEGetClickCount(wasteObject *_self, PyObject *_args)
Jack Jansen2268af51996-08-06 16:04:22 +0000559{
560 PyObject *_res = NULL;
561 UInt16 _rv;
562 if (!PyArg_ParseTuple(_args, ""))
563 return NULL;
564 _rv = WEGetClickCount(_self->ob_itself);
Jack Jansen9d8b96c2000-07-14 22:16:45 +0000565 _res = Py_BuildValue("H",
Jack Jansen2268af51996-08-06 16:04:22 +0000566 _rv);
567 return _res;
568}
569
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000570static PyObject *wasteObj_WESetSelection(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000571{
572 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000573 SInt32 inSelStart;
574 SInt32 inSelEnd;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000575 if (!PyArg_ParseTuple(_args, "ll",
Jack Jansenb99e5212002-01-11 12:37:15 +0000576 &inSelStart,
577 &inSelEnd))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000578 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000579 WESetSelection(inSelStart,
580 inSelEnd,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000581 _self->ob_itself);
582 Py_INCREF(Py_None);
583 _res = Py_None;
584 return _res;
585}
586
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000587static PyObject *wasteObj_WESetDestRect(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000588{
589 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000590 LongRect inDestRect;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000591 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +0000592 LongRect_Convert, &inDestRect))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000593 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000594 WESetDestRect(&inDestRect,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000595 _self->ob_itself);
596 Py_INCREF(Py_None);
597 _res = Py_None;
598 return _res;
599}
600
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000601static PyObject *wasteObj_WESetViewRect(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000602{
603 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000604 LongRect inViewRect;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000605 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +0000606 LongRect_Convert, &inViewRect))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000607 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000608 WESetViewRect(&inViewRect,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000609 _self->ob_itself);
610 Py_INCREF(Py_None);
611 _res = Py_None;
612 return _res;
613}
614
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000615static PyObject *wasteObj_WEContinuousStyle(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000616{
617 PyObject *_res = NULL;
618 Boolean _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +0000619 WEStyleMode ioMode;
620 TextStyle outTextStyle;
Jack Jansen9d8b96c2000-07-14 22:16:45 +0000621 if (!PyArg_ParseTuple(_args, "H",
Jack Jansenb99e5212002-01-11 12:37:15 +0000622 &ioMode))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000623 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000624 _rv = WEContinuousStyle(&ioMode,
625 &outTextStyle,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000626 _self->ob_itself);
Jack Jansen9d8b96c2000-07-14 22:16:45 +0000627 _res = Py_BuildValue("bHO&",
Jack Jansen90ecdf41996-04-16 14:29:15 +0000628 _rv,
Jack Jansenb99e5212002-01-11 12:37:15 +0000629 ioMode,
630 TextStyle_New, &outTextStyle);
631 return _res;
632}
633
634static PyObject *wasteObj_WECountRuns(wasteObject *_self, PyObject *_args)
635{
636 PyObject *_res = NULL;
637 SInt32 _rv;
638 if (!PyArg_ParseTuple(_args, ""))
639 return NULL;
640 _rv = WECountRuns(_self->ob_itself);
641 _res = Py_BuildValue("l",
642 _rv);
643 return _res;
644}
645
646static PyObject *wasteObj_WEOffsetToRun(wasteObject *_self, PyObject *_args)
647{
648 PyObject *_res = NULL;
649 SInt32 _rv;
650 SInt32 inOffset;
651 if (!PyArg_ParseTuple(_args, "l",
652 &inOffset))
653 return NULL;
654 _rv = WEOffsetToRun(inOffset,
655 _self->ob_itself);
656 _res = Py_BuildValue("l",
657 _rv);
658 return _res;
659}
660
661static PyObject *wasteObj_WEGetRunRange(wasteObject *_self, PyObject *_args)
662{
663 PyObject *_res = NULL;
664 SInt32 inStyleRunIndex;
665 SInt32 outStyleRunStart;
666 SInt32 outStyleRunEnd;
667 if (!PyArg_ParseTuple(_args, "l",
668 &inStyleRunIndex))
669 return NULL;
670 WEGetRunRange(inStyleRunIndex,
671 &outStyleRunStart,
672 &outStyleRunEnd,
673 _self->ob_itself);
674 _res = Py_BuildValue("ll",
675 outStyleRunStart,
676 outStyleRunEnd);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000677 return _res;
678}
679
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000680static PyObject *wasteObj_WEGetRunInfo(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000681{
682 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000683 SInt32 inOffset;
684 WERunInfo outStyleRunInfo;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000685 if (!PyArg_ParseTuple(_args, "l",
Jack Jansenb99e5212002-01-11 12:37:15 +0000686 &inOffset))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000687 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000688 WEGetRunInfo(inOffset,
689 &outStyleRunInfo,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000690 _self->ob_itself);
691 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +0000692 RunInfo_New, &outStyleRunInfo);
693 return _res;
694}
695
696static PyObject *wasteObj_WEGetIndRunInfo(wasteObject *_self, PyObject *_args)
697{
698 PyObject *_res = NULL;
699 SInt32 inStyleRunIndex;
700 WERunInfo outStyleRunInfo;
701 if (!PyArg_ParseTuple(_args, "l",
702 &inStyleRunIndex))
703 return NULL;
704 WEGetIndRunInfo(inStyleRunIndex,
705 &outStyleRunInfo,
706 _self->ob_itself);
707 _res = Py_BuildValue("O&",
708 RunInfo_New, &outStyleRunInfo);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000709 return _res;
710}
711
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000712static PyObject *wasteObj_WEGetRunDirection(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +0000713{
714 PyObject *_res = NULL;
715 Boolean _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +0000716 SInt32 inOffset;
Jack Jansen2369a981998-02-20 15:57:30 +0000717 if (!PyArg_ParseTuple(_args, "l",
Jack Jansenb99e5212002-01-11 12:37:15 +0000718 &inOffset))
Jack Jansen2369a981998-02-20 15:57:30 +0000719 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000720 _rv = WEGetRunDirection(inOffset,
Jack Jansen2369a981998-02-20 15:57:30 +0000721 _self->ob_itself);
722 _res = Py_BuildValue("b",
723 _rv);
724 return _res;
725}
726
Jack Jansenb99e5212002-01-11 12:37:15 +0000727static PyObject *wasteObj_WECountParaRuns(wasteObject *_self, PyObject *_args)
728{
729 PyObject *_res = NULL;
730 SInt32 _rv;
731 if (!PyArg_ParseTuple(_args, ""))
732 return NULL;
733 _rv = WECountParaRuns(_self->ob_itself);
734 _res = Py_BuildValue("l",
735 _rv);
736 return _res;
737}
738
739static PyObject *wasteObj_WEOffsetToParaRun(wasteObject *_self, PyObject *_args)
740{
741 PyObject *_res = NULL;
742 SInt32 _rv;
743 SInt32 inOffset;
744 if (!PyArg_ParseTuple(_args, "l",
745 &inOffset))
746 return NULL;
747 _rv = WEOffsetToParaRun(inOffset,
748 _self->ob_itself);
749 _res = Py_BuildValue("l",
750 _rv);
751 return _res;
752}
753
754static PyObject *wasteObj_WEGetParaRunRange(wasteObject *_self, PyObject *_args)
755{
756 PyObject *_res = NULL;
757 SInt32 inParagraphRunIndex;
758 SInt32 outParagraphRunStart;
759 SInt32 outParagraphRunEnd;
760 if (!PyArg_ParseTuple(_args, "l",
761 &inParagraphRunIndex))
762 return NULL;
763 WEGetParaRunRange(inParagraphRunIndex,
764 &outParagraphRunStart,
765 &outParagraphRunEnd,
766 _self->ob_itself);
767 _res = Py_BuildValue("ll",
768 outParagraphRunStart,
769 outParagraphRunEnd);
770 return _res;
771}
772
773static PyObject *wasteObj_WECountLines(wasteObject *_self, PyObject *_args)
774{
775 PyObject *_res = NULL;
776 SInt32 _rv;
777 if (!PyArg_ParseTuple(_args, ""))
778 return NULL;
779 _rv = WECountLines(_self->ob_itself);
780 _res = Py_BuildValue("l",
781 _rv);
782 return _res;
783}
784
785static PyObject *wasteObj_WEOffsetToLine(wasteObject *_self, PyObject *_args)
786{
787 PyObject *_res = NULL;
788 SInt32 _rv;
789 SInt32 inOffset;
790 if (!PyArg_ParseTuple(_args, "l",
791 &inOffset))
792 return NULL;
793 _rv = WEOffsetToLine(inOffset,
794 _self->ob_itself);
795 _res = Py_BuildValue("l",
796 _rv);
797 return _res;
798}
799
800static PyObject *wasteObj_WEGetLineRange(wasteObject *_self, PyObject *_args)
801{
802 PyObject *_res = NULL;
803 SInt32 inLineIndex;
804 SInt32 outLineStart;
805 SInt32 outLineEnd;
806 if (!PyArg_ParseTuple(_args, "l",
807 &inLineIndex))
808 return NULL;
809 WEGetLineRange(inLineIndex,
810 &outLineStart,
811 &outLineEnd,
812 _self->ob_itself);
813 _res = Py_BuildValue("ll",
814 outLineStart,
815 outLineEnd);
816 return _res;
817}
818
819static PyObject *wasteObj_WEGetHeight(wasteObject *_self, PyObject *_args)
820{
821 PyObject *_res = NULL;
822 SInt32 _rv;
823 SInt32 inStartLineIndex;
824 SInt32 inEndLineIndex;
825 if (!PyArg_ParseTuple(_args, "ll",
826 &inStartLineIndex,
827 &inEndLineIndex))
828 return NULL;
829 _rv = WEGetHeight(inStartLineIndex,
830 inEndLineIndex,
831 _self->ob_itself);
832 _res = Py_BuildValue("l",
833 _rv);
834 return _res;
835}
836
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000837static PyObject *wasteObj_WEGetOffset(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000838{
839 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +0000840 SInt32 _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +0000841 LongPt inPoint;
842 WEEdge outEdge;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000843 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +0000844 LongPt_Convert, &inPoint))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000845 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000846 _rv = WEGetOffset(&inPoint,
847 &outEdge,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000848 _self->ob_itself);
Jack Jansen97ed9072000-09-08 22:06:16 +0000849 _res = Py_BuildValue("lB",
Jack Jansen90ecdf41996-04-16 14:29:15 +0000850 _rv,
Jack Jansenb99e5212002-01-11 12:37:15 +0000851 outEdge);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000852 return _res;
853}
854
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000855static PyObject *wasteObj_WEGetPoint(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000856{
857 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000858 SInt32 inOffset;
859 SInt16 inDirection;
860 LongPt outPoint;
861 SInt16 outLineHeight;
Jack Jansen2268af51996-08-06 16:04:22 +0000862 if (!PyArg_ParseTuple(_args, "lh",
Jack Jansenb99e5212002-01-11 12:37:15 +0000863 &inOffset,
864 &inDirection))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000865 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000866 WEGetPoint(inOffset,
867 inDirection,
868 &outPoint,
869 &outLineHeight,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000870 _self->ob_itself);
871 _res = Py_BuildValue("O&h",
Jack Jansenb99e5212002-01-11 12:37:15 +0000872 LongPt_New, &outPoint,
873 outLineHeight);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000874 return _res;
875}
876
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000877static PyObject *wasteObj_WEFindWord(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000878{
879 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000880 SInt32 inOffset;
881 WEEdge inEdge;
882 SInt32 outWordStart;
883 SInt32 outWordEnd;
Jack Jansen97ed9072000-09-08 22:06:16 +0000884 if (!PyArg_ParseTuple(_args, "lB",
Jack Jansenb99e5212002-01-11 12:37:15 +0000885 &inOffset,
886 &inEdge))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000887 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000888 WEFindWord(inOffset,
889 inEdge,
890 &outWordStart,
891 &outWordEnd,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000892 _self->ob_itself);
893 _res = Py_BuildValue("ll",
Jack Jansenb99e5212002-01-11 12:37:15 +0000894 outWordStart,
895 outWordEnd);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000896 return _res;
897}
898
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000899static PyObject *wasteObj_WEFindLine(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000900{
901 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000902 SInt32 inOffset;
903 WEEdge inEdge;
904 SInt32 outLineStart;
905 SInt32 outLineEnd;
Jack Jansen97ed9072000-09-08 22:06:16 +0000906 if (!PyArg_ParseTuple(_args, "lB",
Jack Jansenb99e5212002-01-11 12:37:15 +0000907 &inOffset,
908 &inEdge))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000909 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000910 WEFindLine(inOffset,
911 inEdge,
912 &outLineStart,
913 &outLineEnd,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000914 _self->ob_itself);
915 _res = Py_BuildValue("ll",
Jack Jansenb99e5212002-01-11 12:37:15 +0000916 outLineStart,
917 outLineEnd);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000918 return _res;
919}
920
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000921static PyObject *wasteObj_WEFindParagraph(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +0000922{
923 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000924 SInt32 inOffset;
925 WEEdge inEdge;
926 SInt32 outParagraphStart;
927 SInt32 outParagraphEnd;
Jack Jansen97ed9072000-09-08 22:06:16 +0000928 if (!PyArg_ParseTuple(_args, "lB",
Jack Jansenb99e5212002-01-11 12:37:15 +0000929 &inOffset,
930 &inEdge))
Jack Jansen2369a981998-02-20 15:57:30 +0000931 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000932 WEFindParagraph(inOffset,
933 inEdge,
934 &outParagraphStart,
935 &outParagraphEnd,
Jack Jansen2369a981998-02-20 15:57:30 +0000936 _self->ob_itself);
937 _res = Py_BuildValue("ll",
Jack Jansenb99e5212002-01-11 12:37:15 +0000938 outParagraphStart,
939 outParagraphEnd);
940 return _res;
941}
942
943static PyObject *wasteObj_WEFind(wasteObject *_self, PyObject *_args)
944{
945 PyObject *_res = NULL;
946 OSErr _err;
947 char* inKey;
948 SInt32 inKeyLength;
949 TextEncoding inKeyEncoding;
950 OptionBits inMatchOptions;
951 SInt32 inRangeStart;
952 SInt32 inRangeEnd;
953 SInt32 outMatchStart;
954 SInt32 outMatchEnd;
955 if (!PyArg_ParseTuple(_args, "slllll",
956 &inKey,
957 &inKeyLength,
958 &inKeyEncoding,
959 &inMatchOptions,
960 &inRangeStart,
961 &inRangeEnd))
962 return NULL;
963 _err = WEFind(inKey,
964 inKeyLength,
965 inKeyEncoding,
966 inMatchOptions,
967 inRangeStart,
968 inRangeEnd,
969 &outMatchStart,
970 &outMatchEnd,
971 _self->ob_itself);
972 if (_err != noErr) return PyMac_Error(_err);
973 _res = Py_BuildValue("ll",
974 outMatchStart,
975 outMatchEnd);
976 return _res;
977}
978
979static PyObject *wasteObj_WEStreamRange(wasteObject *_self, PyObject *_args)
980{
981 PyObject *_res = NULL;
982 OSErr _err;
983 SInt32 inRangeStart;
984 SInt32 inRangeEnd;
985 FlavorType inRequestedType;
986 OptionBits inStreamOptions;
987 Handle outData;
988 if (!PyArg_ParseTuple(_args, "llO&lO&",
989 &inRangeStart,
990 &inRangeEnd,
991 PyMac_GetOSType, &inRequestedType,
992 &inStreamOptions,
993 ResObj_Convert, &outData))
994 return NULL;
995 _err = WEStreamRange(inRangeStart,
996 inRangeEnd,
997 inRequestedType,
998 inStreamOptions,
999 outData,
1000 _self->ob_itself);
1001 if (_err != noErr) return PyMac_Error(_err);
1002 Py_INCREF(Py_None);
1003 _res = Py_None;
Jack Jansen2369a981998-02-20 15:57:30 +00001004 return _res;
1005}
1006
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001007static PyObject *wasteObj_WECopyRange(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001008{
1009 PyObject *_res = NULL;
1010 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001011 SInt32 inRangeStart;
1012 SInt32 inRangeEnd;
1013 Handle outText;
1014 StScrpHandle outStyles;
1015 WESoupHandle outSoup;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001016 if (!PyArg_ParseTuple(_args, "llO&O&O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001017 &inRangeStart,
1018 &inRangeEnd,
1019 OptResObj_Convert, &outText,
1020 OptResObj_Convert, &outStyles,
1021 OptResObj_Convert, &outSoup))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001022 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001023 _err = WECopyRange(inRangeStart,
1024 inRangeEnd,
1025 outText,
1026 outStyles,
1027 outSoup,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001028 _self->ob_itself);
1029 if (_err != noErr) return PyMac_Error(_err);
1030 Py_INCREF(Py_None);
1031 _res = Py_None;
1032 return _res;
1033}
1034
Jack Jansenb99e5212002-01-11 12:37:15 +00001035static PyObject *wasteObj_WEGetTextRangeAsUnicode(wasteObject *_self, PyObject *_args)
1036{
1037 PyObject *_res = NULL;
1038 OSErr _err;
1039 SInt32 inRangeStart;
1040 SInt32 inRangeEnd;
1041 Handle outUnicodeText;
1042 Handle ioCharFormat;
1043 Handle ioParaFormat;
1044 TextEncodingVariant inUnicodeVariant;
1045 TextEncodingFormat inTransformationFormat;
1046 OptionBits inGetOptions;
1047 if (!PyArg_ParseTuple(_args, "llO&O&O&lll",
1048 &inRangeStart,
1049 &inRangeEnd,
1050 ResObj_Convert, &outUnicodeText,
1051 ResObj_Convert, &ioCharFormat,
1052 ResObj_Convert, &ioParaFormat,
1053 &inUnicodeVariant,
1054 &inTransformationFormat,
1055 &inGetOptions))
1056 return NULL;
1057 _err = WEGetTextRangeAsUnicode(inRangeStart,
1058 inRangeEnd,
1059 outUnicodeText,
1060 ioCharFormat,
1061 ioParaFormat,
1062 inUnicodeVariant,
1063 inTransformationFormat,
1064 inGetOptions,
1065 _self->ob_itself);
1066 if (_err != noErr) return PyMac_Error(_err);
1067 Py_INCREF(Py_None);
1068 _res = Py_None;
1069 return _res;
1070}
1071
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001072static PyObject *wasteObj_WEGetAlignment(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001073{
1074 PyObject *_res = NULL;
1075 WEAlignment _rv;
1076 if (!PyArg_ParseTuple(_args, ""))
1077 return NULL;
1078 _rv = WEGetAlignment(_self->ob_itself);
Jack Jansen97ed9072000-09-08 22:06:16 +00001079 _res = Py_BuildValue("B",
Jack Jansen90ecdf41996-04-16 14:29:15 +00001080 _rv);
1081 return _res;
1082}
1083
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001084static PyObject *wasteObj_WESetAlignment(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001085{
1086 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001087 WEAlignment inAlignment;
Jack Jansen97ed9072000-09-08 22:06:16 +00001088 if (!PyArg_ParseTuple(_args, "B",
Jack Jansenb99e5212002-01-11 12:37:15 +00001089 &inAlignment))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001090 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001091 WESetAlignment(inAlignment,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001092 _self->ob_itself);
1093 Py_INCREF(Py_None);
1094 _res = Py_None;
1095 return _res;
1096}
1097
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001098static PyObject *wasteObj_WEGetDirection(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00001099{
1100 PyObject *_res = NULL;
1101 WEDirection _rv;
1102 if (!PyArg_ParseTuple(_args, ""))
1103 return NULL;
1104 _rv = WEGetDirection(_self->ob_itself);
1105 _res = Py_BuildValue("h",
1106 _rv);
1107 return _res;
1108}
1109
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001110static PyObject *wasteObj_WESetDirection(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00001111{
1112 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001113 WEDirection inDirection;
Jack Jansen2369a981998-02-20 15:57:30 +00001114 if (!PyArg_ParseTuple(_args, "h",
Jack Jansenb99e5212002-01-11 12:37:15 +00001115 &inDirection))
Jack Jansen2369a981998-02-20 15:57:30 +00001116 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001117 WESetDirection(inDirection,
Jack Jansen2369a981998-02-20 15:57:30 +00001118 _self->ob_itself);
1119 Py_INCREF(Py_None);
1120 _res = Py_None;
1121 return _res;
1122}
1123
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001124static PyObject *wasteObj_WECalText(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001125{
1126 PyObject *_res = NULL;
1127 OSErr _err;
1128 if (!PyArg_ParseTuple(_args, ""))
1129 return NULL;
1130 _err = WECalText(_self->ob_itself);
1131 if (_err != noErr) return PyMac_Error(_err);
1132 Py_INCREF(Py_None);
1133 _res = Py_None;
1134 return _res;
1135}
1136
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001137static PyObject *wasteObj_WEUpdate(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001138{
1139 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001140 RgnHandle inUpdateRgn;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001141 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001142 ResObj_Convert, &inUpdateRgn))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001143 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001144 WEUpdate(inUpdateRgn,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001145 _self->ob_itself);
1146 Py_INCREF(Py_None);
1147 _res = Py_None;
1148 return _res;
1149}
1150
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001151static PyObject *wasteObj_WEScroll(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001152{
1153 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001154 SInt32 inHorizontalOffset;
1155 SInt32 inVerticalOffset;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001156 if (!PyArg_ParseTuple(_args, "ll",
Jack Jansenb99e5212002-01-11 12:37:15 +00001157 &inHorizontalOffset,
1158 &inVerticalOffset))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001159 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001160 WEScroll(inHorizontalOffset,
1161 inVerticalOffset,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001162 _self->ob_itself);
1163 Py_INCREF(Py_None);
1164 _res = Py_None;
1165 return _res;
1166}
1167
Jack Jansenb99e5212002-01-11 12:37:15 +00001168static PyObject *wasteObj_WEPinScroll(wasteObject *_self, PyObject *_args)
1169{
1170 PyObject *_res = NULL;
1171 SInt32 inHorizontalOffset;
1172 SInt32 inVerticalOffset;
1173 if (!PyArg_ParseTuple(_args, "ll",
1174 &inHorizontalOffset,
1175 &inVerticalOffset))
1176 return NULL;
1177 WEPinScroll(inHorizontalOffset,
1178 inVerticalOffset,
1179 _self->ob_itself);
1180 Py_INCREF(Py_None);
1181 _res = Py_None;
1182 return _res;
1183}
1184
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001185static PyObject *wasteObj_WESelView(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001186{
1187 PyObject *_res = NULL;
1188 if (!PyArg_ParseTuple(_args, ""))
1189 return NULL;
1190 WESelView(_self->ob_itself);
1191 Py_INCREF(Py_None);
1192 _res = Py_None;
1193 return _res;
1194}
1195
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001196static PyObject *wasteObj_WEActivate(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001197{
1198 PyObject *_res = NULL;
1199 if (!PyArg_ParseTuple(_args, ""))
1200 return NULL;
1201 WEActivate(_self->ob_itself);
1202 Py_INCREF(Py_None);
1203 _res = Py_None;
1204 return _res;
1205}
1206
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001207static PyObject *wasteObj_WEDeactivate(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001208{
1209 PyObject *_res = NULL;
1210 if (!PyArg_ParseTuple(_args, ""))
1211 return NULL;
1212 WEDeactivate(_self->ob_itself);
1213 Py_INCREF(Py_None);
1214 _res = Py_None;
1215 return _res;
1216}
1217
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001218static PyObject *wasteObj_WEKey(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001219{
1220 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001221 CharParameter inKey;
1222 EventModifiers inModifiers;
Jack Jansen9d8b96c2000-07-14 22:16:45 +00001223 if (!PyArg_ParseTuple(_args, "hH",
Jack Jansenb99e5212002-01-11 12:37:15 +00001224 &inKey,
1225 &inModifiers))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001226 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001227 WEKey(inKey,
1228 inModifiers,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001229 _self->ob_itself);
1230 Py_INCREF(Py_None);
1231 _res = Py_None;
1232 return _res;
1233}
1234
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001235static PyObject *wasteObj_WEClick(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001236{
1237 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001238 Point inHitPoint;
1239 EventModifiers inModifiers;
1240 UInt32 inClickTime;
Jack Jansen9d8b96c2000-07-14 22:16:45 +00001241 if (!PyArg_ParseTuple(_args, "O&Hl",
Jack Jansenb99e5212002-01-11 12:37:15 +00001242 PyMac_GetPoint, &inHitPoint,
1243 &inModifiers,
1244 &inClickTime))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001245 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001246 WEClick(inHitPoint,
1247 inModifiers,
1248 inClickTime,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001249 _self->ob_itself);
1250 Py_INCREF(Py_None);
1251 _res = Py_None;
1252 return _res;
1253}
1254
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001255static PyObject *wasteObj_WEAdjustCursor(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001256{
1257 PyObject *_res = NULL;
1258 Boolean _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00001259 Point inMouseLoc;
1260 RgnHandle ioMouseRgn;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001261 if (!PyArg_ParseTuple(_args, "O&O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001262 PyMac_GetPoint, &inMouseLoc,
1263 ResObj_Convert, &ioMouseRgn))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001264 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001265 _rv = WEAdjustCursor(inMouseLoc,
1266 ioMouseRgn,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001267 _self->ob_itself);
1268 _res = Py_BuildValue("b",
1269 _rv);
1270 return _res;
1271}
1272
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001273static PyObject *wasteObj_WEIdle(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001274{
1275 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001276 UInt32 outMaxSleep;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001277 if (!PyArg_ParseTuple(_args, ""))
1278 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001279 WEIdle(&outMaxSleep,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001280 _self->ob_itself);
1281 _res = Py_BuildValue("l",
Jack Jansenb99e5212002-01-11 12:37:15 +00001282 outMaxSleep);
Jack Jansen90ecdf41996-04-16 14:29:15 +00001283 return _res;
1284}
1285
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001286static PyObject *wasteObj_WEInsert(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001287{
1288 PyObject *_res = NULL;
1289 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001290 char *inTextPtr__in__;
1291 long inTextPtr__len__;
1292 int inTextPtr__in_len__;
1293 StScrpHandle inStyles;
1294 WESoupHandle inSoup;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001295 if (!PyArg_ParseTuple(_args, "s#O&O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001296 &inTextPtr__in__, &inTextPtr__in_len__,
1297 OptResObj_Convert, &inStyles,
1298 OptResObj_Convert, &inSoup))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001299 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001300 inTextPtr__len__ = inTextPtr__in_len__;
1301 _err = WEInsert(inTextPtr__in__, inTextPtr__len__,
1302 inStyles,
1303 inSoup,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001304 _self->ob_itself);
1305 if (_err != noErr) return PyMac_Error(_err);
1306 Py_INCREF(Py_None);
1307 _res = Py_None;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001308 return _res;
1309}
1310
Jack Jansenb99e5212002-01-11 12:37:15 +00001311static PyObject *wasteObj_WEInsertFormattedText(wasteObject *_self, PyObject *_args)
1312{
1313 PyObject *_res = NULL;
1314 OSErr _err;
1315 char *inTextPtr__in__;
1316 long inTextPtr__len__;
1317 int inTextPtr__in_len__;
1318 StScrpHandle inStyles;
1319 WESoupHandle inSoup;
1320 Handle inParaFormat;
1321 Handle inRulerScrap;
1322 if (!PyArg_ParseTuple(_args, "s#O&O&O&O&",
1323 &inTextPtr__in__, &inTextPtr__in_len__,
1324 OptResObj_Convert, &inStyles,
1325 OptResObj_Convert, &inSoup,
1326 ResObj_Convert, &inParaFormat,
1327 ResObj_Convert, &inRulerScrap))
1328 return NULL;
1329 inTextPtr__len__ = inTextPtr__in_len__;
1330 _err = WEInsertFormattedText(inTextPtr__in__, inTextPtr__len__,
1331 inStyles,
1332 inSoup,
1333 inParaFormat,
1334 inRulerScrap,
1335 _self->ob_itself);
1336 if (_err != noErr) return PyMac_Error(_err);
1337 Py_INCREF(Py_None);
1338 _res = Py_None;
1339 return _res;
1340}
1341
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001342static PyObject *wasteObj_WEDelete(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001343{
1344 PyObject *_res = NULL;
1345 OSErr _err;
1346 if (!PyArg_ParseTuple(_args, ""))
1347 return NULL;
1348 _err = WEDelete(_self->ob_itself);
1349 if (_err != noErr) return PyMac_Error(_err);
1350 Py_INCREF(Py_None);
1351 _res = Py_None;
1352 return _res;
1353}
1354
Jack Jansenb99e5212002-01-11 12:37:15 +00001355static PyObject *wasteObj_WEUseText(wasteObject *_self, PyObject *_args)
1356{
1357 PyObject *_res = NULL;
1358 OSErr _err;
1359 Handle inText;
1360 if (!PyArg_ParseTuple(_args, "O&",
1361 ResObj_Convert, &inText))
1362 return NULL;
1363 _err = WEUseText(inText,
1364 _self->ob_itself);
1365 if (_err != noErr) return PyMac_Error(_err);
1366 Py_INCREF(Py_None);
1367 _res = Py_None;
1368 return _res;
1369}
1370
1371static PyObject *wasteObj_WEChangeCase(wasteObject *_self, PyObject *_args)
1372{
1373 PyObject *_res = NULL;
1374 OSErr _err;
1375 SInt16 inCase;
1376 if (!PyArg_ParseTuple(_args, "h",
1377 &inCase))
1378 return NULL;
1379 _err = WEChangeCase(inCase,
1380 _self->ob_itself);
1381 if (_err != noErr) return PyMac_Error(_err);
1382 Py_INCREF(Py_None);
1383 _res = Py_None;
1384 return _res;
1385}
1386
1387static PyObject *wasteObj_WESetOneAttribute(wasteObject *_self, PyObject *_args)
1388{
1389 PyObject *_res = NULL;
1390 OSErr _err;
1391 SInt32 inRangeStart;
1392 SInt32 inRangeEnd;
1393 WESelector inAttributeSelector;
1394 char *inAttributeValue__in__;
1395 long inAttributeValue__len__;
1396 int inAttributeValue__in_len__;
1397 if (!PyArg_ParseTuple(_args, "llO&s#",
1398 &inRangeStart,
1399 &inRangeEnd,
1400 PyMac_GetOSType, &inAttributeSelector,
1401 &inAttributeValue__in__, &inAttributeValue__in_len__))
1402 return NULL;
1403 inAttributeValue__len__ = inAttributeValue__in_len__;
1404 _err = WESetOneAttribute(inRangeStart,
1405 inRangeEnd,
1406 inAttributeSelector,
1407 inAttributeValue__in__, inAttributeValue__len__,
1408 _self->ob_itself);
1409 if (_err != noErr) return PyMac_Error(_err);
1410 Py_INCREF(Py_None);
1411 _res = Py_None;
1412 return _res;
1413}
1414
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001415static PyObject *wasteObj_WESetStyle(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001416{
1417 PyObject *_res = NULL;
1418 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001419 WEStyleMode inMode;
1420 TextStyle inTextStyle;
Jack Jansen9d8b96c2000-07-14 22:16:45 +00001421 if (!PyArg_ParseTuple(_args, "HO&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001422 &inMode,
1423 TextStyle_Convert, &inTextStyle))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001424 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001425 _err = WESetStyle(inMode,
1426 &inTextStyle,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001427 _self->ob_itself);
1428 if (_err != noErr) return PyMac_Error(_err);
1429 Py_INCREF(Py_None);
1430 _res = Py_None;
1431 return _res;
1432}
1433
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001434static PyObject *wasteObj_WEUseStyleScrap(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001435{
1436 PyObject *_res = NULL;
1437 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001438 StScrpHandle inStyles;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001439 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001440 ResObj_Convert, &inStyles))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001441 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001442 _err = WEUseStyleScrap(inStyles,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001443 _self->ob_itself);
1444 if (_err != noErr) return PyMac_Error(_err);
1445 Py_INCREF(Py_None);
1446 _res = Py_None;
1447 return _res;
1448}
1449
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001450static PyObject *wasteObj_WEUndo(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001451{
1452 PyObject *_res = NULL;
1453 OSErr _err;
1454 if (!PyArg_ParseTuple(_args, ""))
1455 return NULL;
1456 _err = WEUndo(_self->ob_itself);
1457 if (_err != noErr) return PyMac_Error(_err);
1458 Py_INCREF(Py_None);
1459 _res = Py_None;
1460 return _res;
1461}
1462
Jack Jansenb99e5212002-01-11 12:37:15 +00001463static PyObject *wasteObj_WERedo(wasteObject *_self, PyObject *_args)
1464{
1465 PyObject *_res = NULL;
1466 OSErr _err;
1467 if (!PyArg_ParseTuple(_args, ""))
1468 return NULL;
1469 _err = WERedo(_self->ob_itself);
1470 if (_err != noErr) return PyMac_Error(_err);
1471 Py_INCREF(Py_None);
1472 _res = Py_None;
1473 return _res;
1474}
1475
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001476static PyObject *wasteObj_WEClearUndo(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001477{
1478 PyObject *_res = NULL;
1479 if (!PyArg_ParseTuple(_args, ""))
1480 return NULL;
1481 WEClearUndo(_self->ob_itself);
1482 Py_INCREF(Py_None);
1483 _res = Py_None;
1484 return _res;
1485}
1486
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001487static PyObject *wasteObj_WEGetUndoInfo(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001488{
1489 PyObject *_res = NULL;
1490 WEActionKind _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00001491 Boolean outRedoFlag;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001492 if (!PyArg_ParseTuple(_args, ""))
1493 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001494 _rv = WEGetUndoInfo(&outRedoFlag,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001495 _self->ob_itself);
1496 _res = Py_BuildValue("hb",
1497 _rv,
Jack Jansenb99e5212002-01-11 12:37:15 +00001498 outRedoFlag);
1499 return _res;
1500}
1501
1502static PyObject *wasteObj_WEGetIndUndoInfo(wasteObject *_self, PyObject *_args)
1503{
1504 PyObject *_res = NULL;
1505 WEActionKind _rv;
1506 SInt32 inUndoLevel;
1507 if (!PyArg_ParseTuple(_args, "l",
1508 &inUndoLevel))
1509 return NULL;
1510 _rv = WEGetIndUndoInfo(inUndoLevel,
1511 _self->ob_itself);
1512 _res = Py_BuildValue("h",
1513 _rv);
Jack Jansen90ecdf41996-04-16 14:29:15 +00001514 return _res;
1515}
1516
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001517static PyObject *wasteObj_WEIsTyping(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001518{
1519 PyObject *_res = NULL;
1520 Boolean _rv;
1521 if (!PyArg_ParseTuple(_args, ""))
1522 return NULL;
1523 _rv = WEIsTyping(_self->ob_itself);
1524 _res = Py_BuildValue("b",
1525 _rv);
1526 return _res;
1527}
1528
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001529static PyObject *wasteObj_WEBeginAction(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00001530{
1531 PyObject *_res = NULL;
1532 OSErr _err;
1533 if (!PyArg_ParseTuple(_args, ""))
1534 return NULL;
1535 _err = WEBeginAction(_self->ob_itself);
1536 if (_err != noErr) return PyMac_Error(_err);
1537 Py_INCREF(Py_None);
1538 _res = Py_None;
1539 return _res;
1540}
1541
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001542static PyObject *wasteObj_WEEndAction(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00001543{
1544 PyObject *_res = NULL;
1545 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001546 WEActionKind inActionKind;
Jack Jansen2369a981998-02-20 15:57:30 +00001547 if (!PyArg_ParseTuple(_args, "h",
Jack Jansenb99e5212002-01-11 12:37:15 +00001548 &inActionKind))
Jack Jansen2369a981998-02-20 15:57:30 +00001549 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001550 _err = WEEndAction(inActionKind,
Jack Jansen2369a981998-02-20 15:57:30 +00001551 _self->ob_itself);
1552 if (_err != noErr) return PyMac_Error(_err);
1553 Py_INCREF(Py_None);
1554 _res = Py_None;
1555 return _res;
1556}
1557
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001558static PyObject *wasteObj_WEGetModCount(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001559{
1560 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +00001561 UInt32 _rv;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001562 if (!PyArg_ParseTuple(_args, ""))
1563 return NULL;
1564 _rv = WEGetModCount(_self->ob_itself);
1565 _res = Py_BuildValue("l",
1566 _rv);
1567 return _res;
1568}
1569
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001570static PyObject *wasteObj_WEResetModCount(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001571{
1572 PyObject *_res = NULL;
1573 if (!PyArg_ParseTuple(_args, ""))
1574 return NULL;
1575 WEResetModCount(_self->ob_itself);
1576 Py_INCREF(Py_None);
1577 _res = Py_None;
1578 return _res;
1579}
1580
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001581static PyObject *wasteObj_WEInsertObject(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001582{
1583 PyObject *_res = NULL;
1584 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001585 FlavorType inObjectType;
1586 Handle inObjectDataHandle;
1587 Point inObjectSize;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001588 if (!PyArg_ParseTuple(_args, "O&O&O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001589 PyMac_GetOSType, &inObjectType,
1590 ResObj_Convert, &inObjectDataHandle,
1591 PyMac_GetPoint, &inObjectSize))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001592 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001593 _err = WEInsertObject(inObjectType,
1594 inObjectDataHandle,
1595 inObjectSize,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001596 _self->ob_itself);
1597 if (_err != noErr) return PyMac_Error(_err);
1598 Py_INCREF(Py_None);
1599 _res = Py_None;
1600 return _res;
1601}
1602
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001603static PyObject *wasteObj_WEGetSelectedObject(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001604{
1605 PyObject *_res = NULL;
1606 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001607 WEObjectReference outObject;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001608 if (!PyArg_ParseTuple(_args, ""))
1609 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001610 _err = WEGetSelectedObject(&outObject,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001611 _self->ob_itself);
1612 if (_err != noErr) return PyMac_Error(_err);
1613 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001614 WEOObj_New, outObject);
1615 return _res;
1616}
1617
1618static PyObject *wasteObj_WEGetObjectAtOffset(wasteObject *_self, PyObject *_args)
1619{
1620 PyObject *_res = NULL;
1621 OSErr _err;
1622 SInt32 inOffset;
1623 WEObjectReference outObject;
1624 if (!PyArg_ParseTuple(_args, "l",
1625 &inOffset))
1626 return NULL;
1627 _err = WEGetObjectAtOffset(inOffset,
1628 &outObject,
1629 _self->ob_itself);
1630 if (_err != noErr) return PyMac_Error(_err);
1631 _res = Py_BuildValue("O&",
1632 WEOObj_New, outObject);
Jack Jansen90ecdf41996-04-16 14:29:15 +00001633 return _res;
1634}
1635
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001636static PyObject *wasteObj_WEFindNextObject(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001637{
1638 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +00001639 SInt32 _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00001640 SInt32 inOffset;
1641 WEObjectReference outObject;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001642 if (!PyArg_ParseTuple(_args, "l",
Jack Jansenb99e5212002-01-11 12:37:15 +00001643 &inOffset))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001644 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001645 _rv = WEFindNextObject(inOffset,
1646 &outObject,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001647 _self->ob_itself);
1648 _res = Py_BuildValue("lO&",
1649 _rv,
Jack Jansenb99e5212002-01-11 12:37:15 +00001650 WEOObj_New, outObject);
Jack Jansen90ecdf41996-04-16 14:29:15 +00001651 return _res;
1652}
1653
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001654static PyObject *wasteObj_WEUseSoup(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001655{
1656 PyObject *_res = NULL;
1657 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001658 WESoupHandle inSoup;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001659 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001660 ResObj_Convert, &inSoup))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001661 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001662 _err = WEUseSoup(inSoup,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001663 _self->ob_itself);
1664 if (_err != noErr) return PyMac_Error(_err);
1665 Py_INCREF(Py_None);
1666 _res = Py_None;
1667 return _res;
1668}
1669
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001670static PyObject *wasteObj_WECut(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001671{
1672 PyObject *_res = NULL;
1673 OSErr _err;
1674 if (!PyArg_ParseTuple(_args, ""))
1675 return NULL;
1676 _err = WECut(_self->ob_itself);
1677 if (_err != noErr) return PyMac_Error(_err);
1678 Py_INCREF(Py_None);
1679 _res = Py_None;
1680 return _res;
1681}
1682
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001683static PyObject *wasteObj_WECopy(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001684{
1685 PyObject *_res = NULL;
1686 OSErr _err;
1687 if (!PyArg_ParseTuple(_args, ""))
1688 return NULL;
1689 _err = WECopy(_self->ob_itself);
1690 if (_err != noErr) return PyMac_Error(_err);
1691 Py_INCREF(Py_None);
1692 _res = Py_None;
1693 return _res;
1694}
1695
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001696static PyObject *wasteObj_WEPaste(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001697{
1698 PyObject *_res = NULL;
1699 OSErr _err;
1700 if (!PyArg_ParseTuple(_args, ""))
1701 return NULL;
1702 _err = WEPaste(_self->ob_itself);
1703 if (_err != noErr) return PyMac_Error(_err);
1704 Py_INCREF(Py_None);
1705 _res = Py_None;
1706 return _res;
1707}
1708
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001709static PyObject *wasteObj_WECanPaste(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001710{
1711 PyObject *_res = NULL;
1712 Boolean _rv;
1713 if (!PyArg_ParseTuple(_args, ""))
1714 return NULL;
1715 _rv = WECanPaste(_self->ob_itself);
1716 _res = Py_BuildValue("b",
1717 _rv);
1718 return _res;
1719}
1720
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001721static PyObject *wasteObj_WEGetHiliteRgn(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001722{
1723 PyObject *_res = NULL;
1724 RgnHandle _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00001725 SInt32 inRangeStart;
1726 SInt32 inRangeEnd;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001727 if (!PyArg_ParseTuple(_args, "ll",
Jack Jansenb99e5212002-01-11 12:37:15 +00001728 &inRangeStart,
1729 &inRangeEnd))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001730 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001731 _rv = WEGetHiliteRgn(inRangeStart,
1732 inRangeEnd,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001733 _self->ob_itself);
1734 _res = Py_BuildValue("O&",
1735 ResObj_New, _rv);
1736 return _res;
1737}
1738
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001739static PyObject *wasteObj_WECharByte(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001740{
1741 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +00001742 SInt16 _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00001743 SInt32 inOffset;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001744 if (!PyArg_ParseTuple(_args, "l",
Jack Jansenb99e5212002-01-11 12:37:15 +00001745 &inOffset))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001746 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001747 _rv = WECharByte(inOffset,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001748 _self->ob_itself);
1749 _res = Py_BuildValue("h",
1750 _rv);
1751 return _res;
1752}
1753
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001754static PyObject *wasteObj_WECharType(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001755{
1756 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +00001757 SInt16 _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00001758 SInt32 inOffset;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001759 if (!PyArg_ParseTuple(_args, "l",
Jack Jansenb99e5212002-01-11 12:37:15 +00001760 &inOffset))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001761 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001762 _rv = WECharType(inOffset,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001763 _self->ob_itself);
1764 _res = Py_BuildValue("h",
1765 _rv);
1766 return _res;
1767}
1768
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001769static PyObject *wasteObj_WEStopInlineSession(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001770{
1771 PyObject *_res = NULL;
1772 if (!PyArg_ParseTuple(_args, ""))
1773 return NULL;
1774 WEStopInlineSession(_self->ob_itself);
1775 Py_INCREF(Py_None);
1776 _res = Py_None;
1777 return _res;
1778}
1779
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001780static PyObject *wasteObj_WEFeatureFlag(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001781{
1782 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +00001783 SInt16 _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00001784 SInt16 inFeature;
1785 SInt16 inAction;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001786 if (!PyArg_ParseTuple(_args, "hh",
Jack Jansenb99e5212002-01-11 12:37:15 +00001787 &inFeature,
1788 &inAction))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001789 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001790 _rv = WEFeatureFlag(inFeature,
1791 inAction,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001792 _self->ob_itself);
1793 _res = Py_BuildValue("h",
1794 _rv);
1795 return _res;
1796}
1797
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001798static PyObject *wasteObj_WEGetUserInfo(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00001799{
1800 PyObject *_res = NULL;
1801 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001802 WESelector inUserTag;
1803 SInt32 outUserInfo;
Jack Jansen2369a981998-02-20 15:57:30 +00001804 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001805 PyMac_GetOSType, &inUserTag))
Jack Jansen2369a981998-02-20 15:57:30 +00001806 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001807 _err = WEGetUserInfo(inUserTag,
1808 &outUserInfo,
Jack Jansen2369a981998-02-20 15:57:30 +00001809 _self->ob_itself);
1810 if (_err != noErr) return PyMac_Error(_err);
1811 _res = Py_BuildValue("l",
Jack Jansenb99e5212002-01-11 12:37:15 +00001812 outUserInfo);
Jack Jansen2369a981998-02-20 15:57:30 +00001813 return _res;
1814}
1815
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001816static PyObject *wasteObj_WESetUserInfo(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00001817{
1818 PyObject *_res = NULL;
1819 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001820 WESelector inUserTag;
1821 SInt32 inUserInfo;
Jack Jansen2369a981998-02-20 15:57:30 +00001822 if (!PyArg_ParseTuple(_args, "O&l",
Jack Jansenb99e5212002-01-11 12:37:15 +00001823 PyMac_GetOSType, &inUserTag,
1824 &inUserInfo))
Jack Jansen2369a981998-02-20 15:57:30 +00001825 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001826 _err = WESetUserInfo(inUserTag,
1827 inUserInfo,
Jack Jansen2369a981998-02-20 15:57:30 +00001828 _self->ob_itself);
1829 if (_err != noErr) return PyMac_Error(_err);
1830 Py_INCREF(Py_None);
1831 _res = Py_None;
1832 return _res;
1833}
1834
Jack Jansenb99e5212002-01-11 12:37:15 +00001835static PyObject *wasteObj_WERemoveUserInfo(wasteObject *_self, PyObject *_args)
1836{
1837 PyObject *_res = NULL;
1838 OSErr _err;
1839 WESelector inUserTag;
1840 if (!PyArg_ParseTuple(_args, "O&",
1841 PyMac_GetOSType, &inUserTag))
1842 return NULL;
1843 _err = WERemoveUserInfo(inUserTag,
1844 _self->ob_itself);
1845 if (_err != noErr) return PyMac_Error(_err);
1846 Py_INCREF(Py_None);
1847 _res = Py_None;
1848 return _res;
1849}
1850
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001851static PyObject *wasteObj_WEInstallTabHooks(wasteObject *_self, PyObject *_args)
Jack Jansen176f3a91996-10-23 15:43:46 +00001852{
1853 PyObject *_res = NULL;
1854 OSErr _err;
1855 if (!PyArg_ParseTuple(_args, ""))
1856 return NULL;
1857 _err = WEInstallTabHooks(_self->ob_itself);
1858 if (_err != noErr) return PyMac_Error(_err);
1859 Py_INCREF(Py_None);
1860 _res = Py_None;
1861 return _res;
1862}
1863
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001864static PyObject *wasteObj_WERemoveTabHooks(wasteObject *_self, PyObject *_args)
Jack Jansen176f3a91996-10-23 15:43:46 +00001865{
1866 PyObject *_res = NULL;
1867 OSErr _err;
1868 if (!PyArg_ParseTuple(_args, ""))
1869 return NULL;
1870 _err = WERemoveTabHooks(_self->ob_itself);
1871 if (_err != noErr) return PyMac_Error(_err);
1872 Py_INCREF(Py_None);
1873 _res = Py_None;
1874 return _res;
1875}
1876
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001877static PyObject *wasteObj_WEIsTabHooks(wasteObject *_self, PyObject *_args)
Jack Jansen176f3a91996-10-23 15:43:46 +00001878{
1879 PyObject *_res = NULL;
1880 Boolean _rv;
1881 if (!PyArg_ParseTuple(_args, ""))
1882 return NULL;
1883 _rv = WEIsTabHooks(_self->ob_itself);
1884 _res = Py_BuildValue("b",
1885 _rv);
1886 return _res;
1887}
1888
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001889static PyObject *wasteObj_WEGetTabSize(wasteObject *_self, PyObject *_args)
Jack Jansena4f03091998-03-02 16:56:18 +00001890{
1891 PyObject *_res = NULL;
1892 SInt16 _rv;
1893 if (!PyArg_ParseTuple(_args, ""))
1894 return NULL;
1895 _rv = WEGetTabSize(_self->ob_itself);
1896 _res = Py_BuildValue("h",
1897 _rv);
1898 return _res;
1899}
1900
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001901static PyObject *wasteObj_WESetTabSize(wasteObject *_self, PyObject *_args)
Jack Jansena4f03091998-03-02 16:56:18 +00001902{
1903 PyObject *_res = NULL;
1904 OSErr _err;
1905 SInt16 tabWidth;
1906 if (!PyArg_ParseTuple(_args, "h",
1907 &tabWidth))
1908 return NULL;
1909 _err = WESetTabSize(tabWidth,
1910 _self->ob_itself);
1911 if (_err != noErr) return PyMac_Error(_err);
1912 Py_INCREF(Py_None);
1913 _res = Py_None;
1914 return _res;
1915}
1916
Jack Jansen90ecdf41996-04-16 14:29:15 +00001917static PyMethodDef wasteObj_methods[] = {
1918 {"WEGetText", (PyCFunction)wasteObj_WEGetText, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001919 PyDoc_STR("() -> (Handle _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001920 {"WEGetChar", (PyCFunction)wasteObj_WEGetChar, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001921 PyDoc_STR("(SInt32 inOffset) -> (SInt16 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001922 {"WEGetTextLength", (PyCFunction)wasteObj_WEGetTextLength, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001923 PyDoc_STR("() -> (SInt32 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001924 {"WEGetSelection", (PyCFunction)wasteObj_WEGetSelection, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001925 PyDoc_STR("() -> (SInt32 outSelStart, SInt32 outSelEnd)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001926 {"WEGetDestRect", (PyCFunction)wasteObj_WEGetDestRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001927 PyDoc_STR("() -> (LongRect outDestRect)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001928 {"WEGetViewRect", (PyCFunction)wasteObj_WEGetViewRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001929 PyDoc_STR("() -> (LongRect outViewRect)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001930 {"WEIsActive", (PyCFunction)wasteObj_WEIsActive, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001931 PyDoc_STR("() -> (Boolean _rv)")},
Jack Jansen2268af51996-08-06 16:04:22 +00001932 {"WEGetClickCount", (PyCFunction)wasteObj_WEGetClickCount, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001933 PyDoc_STR("() -> (UInt16 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001934 {"WESetSelection", (PyCFunction)wasteObj_WESetSelection, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001935 PyDoc_STR("(SInt32 inSelStart, SInt32 inSelEnd) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001936 {"WESetDestRect", (PyCFunction)wasteObj_WESetDestRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001937 PyDoc_STR("(LongRect inDestRect) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001938 {"WESetViewRect", (PyCFunction)wasteObj_WESetViewRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001939 PyDoc_STR("(LongRect inViewRect) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001940 {"WEContinuousStyle", (PyCFunction)wasteObj_WEContinuousStyle, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001941 PyDoc_STR("(WEStyleMode ioMode) -> (Boolean _rv, WEStyleMode ioMode, TextStyle outTextStyle)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001942 {"WECountRuns", (PyCFunction)wasteObj_WECountRuns, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001943 PyDoc_STR("() -> (SInt32 _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001944 {"WEOffsetToRun", (PyCFunction)wasteObj_WEOffsetToRun, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001945 PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001946 {"WEGetRunRange", (PyCFunction)wasteObj_WEGetRunRange, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001947 PyDoc_STR("(SInt32 inStyleRunIndex) -> (SInt32 outStyleRunStart, SInt32 outStyleRunEnd)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001948 {"WEGetRunInfo", (PyCFunction)wasteObj_WEGetRunInfo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001949 PyDoc_STR("(SInt32 inOffset) -> (WERunInfo outStyleRunInfo)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001950 {"WEGetIndRunInfo", (PyCFunction)wasteObj_WEGetIndRunInfo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001951 PyDoc_STR("(SInt32 inStyleRunIndex) -> (WERunInfo outStyleRunInfo)")},
Jack Jansen2369a981998-02-20 15:57:30 +00001952 {"WEGetRunDirection", (PyCFunction)wasteObj_WEGetRunDirection, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001953 PyDoc_STR("(SInt32 inOffset) -> (Boolean _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001954 {"WECountParaRuns", (PyCFunction)wasteObj_WECountParaRuns, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001955 PyDoc_STR("() -> (SInt32 _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001956 {"WEOffsetToParaRun", (PyCFunction)wasteObj_WEOffsetToParaRun, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001957 PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001958 {"WEGetParaRunRange", (PyCFunction)wasteObj_WEGetParaRunRange, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001959 PyDoc_STR("(SInt32 inParagraphRunIndex) -> (SInt32 outParagraphRunStart, SInt32 outParagraphRunEnd)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001960 {"WECountLines", (PyCFunction)wasteObj_WECountLines, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001961 PyDoc_STR("() -> (SInt32 _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001962 {"WEOffsetToLine", (PyCFunction)wasteObj_WEOffsetToLine, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001963 PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001964 {"WEGetLineRange", (PyCFunction)wasteObj_WEGetLineRange, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001965 PyDoc_STR("(SInt32 inLineIndex) -> (SInt32 outLineStart, SInt32 outLineEnd)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001966 {"WEGetHeight", (PyCFunction)wasteObj_WEGetHeight, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001967 PyDoc_STR("(SInt32 inStartLineIndex, SInt32 inEndLineIndex) -> (SInt32 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001968 {"WEGetOffset", (PyCFunction)wasteObj_WEGetOffset, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001969 PyDoc_STR("(LongPt inPoint) -> (SInt32 _rv, WEEdge outEdge)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001970 {"WEGetPoint", (PyCFunction)wasteObj_WEGetPoint, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001971 PyDoc_STR("(SInt32 inOffset, SInt16 inDirection) -> (LongPt outPoint, SInt16 outLineHeight)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001972 {"WEFindWord", (PyCFunction)wasteObj_WEFindWord, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001973 PyDoc_STR("(SInt32 inOffset, WEEdge inEdge) -> (SInt32 outWordStart, SInt32 outWordEnd)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001974 {"WEFindLine", (PyCFunction)wasteObj_WEFindLine, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001975 PyDoc_STR("(SInt32 inOffset, WEEdge inEdge) -> (SInt32 outLineStart, SInt32 outLineEnd)")},
Jack Jansen2369a981998-02-20 15:57:30 +00001976 {"WEFindParagraph", (PyCFunction)wasteObj_WEFindParagraph, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001977 PyDoc_STR("(SInt32 inOffset, WEEdge inEdge) -> (SInt32 outParagraphStart, SInt32 outParagraphEnd)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001978 {"WEFind", (PyCFunction)wasteObj_WEFind, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001979 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 +00001980 {"WEStreamRange", (PyCFunction)wasteObj_WEStreamRange, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001981 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd, FlavorType inRequestedType, OptionBits inStreamOptions, Handle outData) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001982 {"WECopyRange", (PyCFunction)wasteObj_WECopyRange, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001983 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd, Handle outText, StScrpHandle outStyles, WESoupHandle outSoup) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001984 {"WEGetTextRangeAsUnicode", (PyCFunction)wasteObj_WEGetTextRangeAsUnicode, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001985 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 +00001986 {"WEGetAlignment", (PyCFunction)wasteObj_WEGetAlignment, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001987 PyDoc_STR("() -> (WEAlignment _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001988 {"WESetAlignment", (PyCFunction)wasteObj_WESetAlignment, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001989 PyDoc_STR("(WEAlignment inAlignment) -> None")},
Jack Jansen2369a981998-02-20 15:57:30 +00001990 {"WEGetDirection", (PyCFunction)wasteObj_WEGetDirection, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001991 PyDoc_STR("() -> (WEDirection _rv)")},
Jack Jansen2369a981998-02-20 15:57:30 +00001992 {"WESetDirection", (PyCFunction)wasteObj_WESetDirection, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001993 PyDoc_STR("(WEDirection inDirection) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001994 {"WECalText", (PyCFunction)wasteObj_WECalText, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001995 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001996 {"WEUpdate", (PyCFunction)wasteObj_WEUpdate, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001997 PyDoc_STR("(RgnHandle inUpdateRgn) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001998 {"WEScroll", (PyCFunction)wasteObj_WEScroll, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001999 PyDoc_STR("(SInt32 inHorizontalOffset, SInt32 inVerticalOffset) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002000 {"WEPinScroll", (PyCFunction)wasteObj_WEPinScroll, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002001 PyDoc_STR("(SInt32 inHorizontalOffset, SInt32 inVerticalOffset) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002002 {"WESelView", (PyCFunction)wasteObj_WESelView, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002003 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002004 {"WEActivate", (PyCFunction)wasteObj_WEActivate, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002005 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002006 {"WEDeactivate", (PyCFunction)wasteObj_WEDeactivate, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002007 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002008 {"WEKey", (PyCFunction)wasteObj_WEKey, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002009 PyDoc_STR("(CharParameter inKey, EventModifiers inModifiers) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002010 {"WEClick", (PyCFunction)wasteObj_WEClick, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002011 PyDoc_STR("(Point inHitPoint, EventModifiers inModifiers, UInt32 inClickTime) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002012 {"WEAdjustCursor", (PyCFunction)wasteObj_WEAdjustCursor, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002013 PyDoc_STR("(Point inMouseLoc, RgnHandle ioMouseRgn) -> (Boolean _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002014 {"WEIdle", (PyCFunction)wasteObj_WEIdle, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002015 PyDoc_STR("() -> (UInt32 outMaxSleep)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002016 {"WEInsert", (PyCFunction)wasteObj_WEInsert, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002017 PyDoc_STR("(Buffer inTextPtr, StScrpHandle inStyles, WESoupHandle inSoup) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002018 {"WEInsertFormattedText", (PyCFunction)wasteObj_WEInsertFormattedText, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002019 PyDoc_STR("(Buffer inTextPtr, StScrpHandle inStyles, WESoupHandle inSoup, Handle inParaFormat, Handle inRulerScrap) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002020 {"WEDelete", (PyCFunction)wasteObj_WEDelete, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002021 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002022 {"WEUseText", (PyCFunction)wasteObj_WEUseText, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002023 PyDoc_STR("(Handle inText) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002024 {"WEChangeCase", (PyCFunction)wasteObj_WEChangeCase, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002025 PyDoc_STR("(SInt16 inCase) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002026 {"WESetOneAttribute", (PyCFunction)wasteObj_WESetOneAttribute, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002027 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd, WESelector inAttributeSelector, Buffer inAttributeValue) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002028 {"WESetStyle", (PyCFunction)wasteObj_WESetStyle, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002029 PyDoc_STR("(WEStyleMode inMode, TextStyle inTextStyle) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002030 {"WEUseStyleScrap", (PyCFunction)wasteObj_WEUseStyleScrap, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002031 PyDoc_STR("(StScrpHandle inStyles) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002032 {"WEUndo", (PyCFunction)wasteObj_WEUndo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002033 PyDoc_STR("() -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002034 {"WERedo", (PyCFunction)wasteObj_WERedo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002035 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002036 {"WEClearUndo", (PyCFunction)wasteObj_WEClearUndo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002037 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002038 {"WEGetUndoInfo", (PyCFunction)wasteObj_WEGetUndoInfo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002039 PyDoc_STR("() -> (WEActionKind _rv, Boolean outRedoFlag)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002040 {"WEGetIndUndoInfo", (PyCFunction)wasteObj_WEGetIndUndoInfo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002041 PyDoc_STR("(SInt32 inUndoLevel) -> (WEActionKind _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002042 {"WEIsTyping", (PyCFunction)wasteObj_WEIsTyping, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002043 PyDoc_STR("() -> (Boolean _rv)")},
Jack Jansen2369a981998-02-20 15:57:30 +00002044 {"WEBeginAction", (PyCFunction)wasteObj_WEBeginAction, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002045 PyDoc_STR("() -> None")},
Jack Jansen2369a981998-02-20 15:57:30 +00002046 {"WEEndAction", (PyCFunction)wasteObj_WEEndAction, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002047 PyDoc_STR("(WEActionKind inActionKind) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002048 {"WEGetModCount", (PyCFunction)wasteObj_WEGetModCount, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002049 PyDoc_STR("() -> (UInt32 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002050 {"WEResetModCount", (PyCFunction)wasteObj_WEResetModCount, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002051 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002052 {"WEInsertObject", (PyCFunction)wasteObj_WEInsertObject, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002053 PyDoc_STR("(FlavorType inObjectType, Handle inObjectDataHandle, Point inObjectSize) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002054 {"WEGetSelectedObject", (PyCFunction)wasteObj_WEGetSelectedObject, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002055 PyDoc_STR("() -> (WEObjectReference outObject)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002056 {"WEGetObjectAtOffset", (PyCFunction)wasteObj_WEGetObjectAtOffset, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002057 PyDoc_STR("(SInt32 inOffset) -> (WEObjectReference outObject)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002058 {"WEFindNextObject", (PyCFunction)wasteObj_WEFindNextObject, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002059 PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv, WEObjectReference outObject)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002060 {"WEUseSoup", (PyCFunction)wasteObj_WEUseSoup, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002061 PyDoc_STR("(WESoupHandle inSoup) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002062 {"WECut", (PyCFunction)wasteObj_WECut, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002063 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002064 {"WECopy", (PyCFunction)wasteObj_WECopy, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002065 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002066 {"WEPaste", (PyCFunction)wasteObj_WEPaste, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002067 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002068 {"WECanPaste", (PyCFunction)wasteObj_WECanPaste, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002069 PyDoc_STR("() -> (Boolean _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002070 {"WEGetHiliteRgn", (PyCFunction)wasteObj_WEGetHiliteRgn, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002071 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd) -> (RgnHandle _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002072 {"WECharByte", (PyCFunction)wasteObj_WECharByte, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002073 PyDoc_STR("(SInt32 inOffset) -> (SInt16 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002074 {"WECharType", (PyCFunction)wasteObj_WECharType, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002075 PyDoc_STR("(SInt32 inOffset) -> (SInt16 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002076 {"WEStopInlineSession", (PyCFunction)wasteObj_WEStopInlineSession, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002077 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002078 {"WEFeatureFlag", (PyCFunction)wasteObj_WEFeatureFlag, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002079 PyDoc_STR("(SInt16 inFeature, SInt16 inAction) -> (SInt16 _rv)")},
Jack Jansen2369a981998-02-20 15:57:30 +00002080 {"WEGetUserInfo", (PyCFunction)wasteObj_WEGetUserInfo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002081 PyDoc_STR("(WESelector inUserTag) -> (SInt32 outUserInfo)")},
Jack Jansen2369a981998-02-20 15:57:30 +00002082 {"WESetUserInfo", (PyCFunction)wasteObj_WESetUserInfo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002083 PyDoc_STR("(WESelector inUserTag, SInt32 inUserInfo) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002084 {"WERemoveUserInfo", (PyCFunction)wasteObj_WERemoveUserInfo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002085 PyDoc_STR("(WESelector inUserTag) -> None")},
Jack Jansen176f3a91996-10-23 15:43:46 +00002086 {"WEInstallTabHooks", (PyCFunction)wasteObj_WEInstallTabHooks, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002087 PyDoc_STR("() -> None")},
Jack Jansen176f3a91996-10-23 15:43:46 +00002088 {"WERemoveTabHooks", (PyCFunction)wasteObj_WERemoveTabHooks, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002089 PyDoc_STR("() -> None")},
Jack Jansen176f3a91996-10-23 15:43:46 +00002090 {"WEIsTabHooks", (PyCFunction)wasteObj_WEIsTabHooks, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002091 PyDoc_STR("() -> (Boolean _rv)")},
Jack Jansena4f03091998-03-02 16:56:18 +00002092 {"WEGetTabSize", (PyCFunction)wasteObj_WEGetTabSize, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002093 PyDoc_STR("() -> (SInt16 _rv)")},
Jack Jansena4f03091998-03-02 16:56:18 +00002094 {"WESetTabSize", (PyCFunction)wasteObj_WESetTabSize, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002095 PyDoc_STR("(SInt16 tabWidth) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002096 {NULL, NULL, 0}
2097};
2098
2099PyMethodChain wasteObj_chain = { wasteObj_methods, NULL };
2100
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002101static PyObject *wasteObj_getattr(wasteObject *self, char *name)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002102{
2103 return Py_FindMethodInChain(&wasteObj_chain, (PyObject *)self, name);
2104}
2105
2106#define wasteObj_setattr NULL
2107
Jack Jansen9d8b96c2000-07-14 22:16:45 +00002108#define wasteObj_compare NULL
2109
2110#define wasteObj_repr NULL
2111
2112#define wasteObj_hash NULL
2113
Jack Jansen90ecdf41996-04-16 14:29:15 +00002114PyTypeObject waste_Type = {
Jack Jansenb3be2162001-11-30 14:16:36 +00002115 PyObject_HEAD_INIT(NULL)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002116 0, /*ob_size*/
Guido van Rossum14648392001-12-08 18:02:58 +00002117 "waste.waste", /*tp_name*/
Jack Jansen90ecdf41996-04-16 14:29:15 +00002118 sizeof(wasteObject), /*tp_basicsize*/
2119 0, /*tp_itemsize*/
2120 /* methods */
2121 (destructor) wasteObj_dealloc, /*tp_dealloc*/
2122 0, /*tp_print*/
2123 (getattrfunc) wasteObj_getattr, /*tp_getattr*/
2124 (setattrfunc) wasteObj_setattr, /*tp_setattr*/
Jack Jansen9d8b96c2000-07-14 22:16:45 +00002125 (cmpfunc) wasteObj_compare, /*tp_compare*/
2126 (reprfunc) wasteObj_repr, /*tp_repr*/
2127 (PyNumberMethods *)0, /* tp_as_number */
2128 (PySequenceMethods *)0, /* tp_as_sequence */
2129 (PyMappingMethods *)0, /* tp_as_mapping */
2130 (hashfunc) wasteObj_hash, /*tp_hash*/
Jack Jansen90ecdf41996-04-16 14:29:15 +00002131};
2132
2133/* --------------------- End object type waste ---------------------- */
2134
2135
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002136static PyObject *waste_WENew(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002137{
2138 PyObject *_res = NULL;
2139 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00002140 LongRect inDestRect;
2141 LongRect inViewRect;
2142 OptionBits inOptions;
2143 WEReference outWE;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002144 if (!PyArg_ParseTuple(_args, "O&O&l",
Jack Jansenb99e5212002-01-11 12:37:15 +00002145 LongRect_Convert, &inDestRect,
2146 LongRect_Convert, &inViewRect,
2147 &inOptions))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002148 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002149 _err = WENew(&inDestRect,
2150 &inViewRect,
2151 inOptions,
2152 &outWE);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002153 if (_err != noErr) return PyMac_Error(_err);
2154 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002155 wasteObj_New, outWE);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002156 return _res;
2157}
2158
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002159static PyObject *waste_WEUpdateStyleScrap(PyObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00002160{
2161 PyObject *_res = NULL;
2162 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00002163 StScrpHandle ioStyles;
2164 WEFontTableHandle inFontTable;
Jack Jansen2369a981998-02-20 15:57:30 +00002165 if (!PyArg_ParseTuple(_args, "O&O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002166 ResObj_Convert, &ioStyles,
2167 ResObj_Convert, &inFontTable))
Jack Jansen2369a981998-02-20 15:57:30 +00002168 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002169 _err = WEUpdateStyleScrap(ioStyles,
2170 inFontTable);
Jack Jansen2369a981998-02-20 15:57:30 +00002171 if (_err != noErr) return PyMac_Error(_err);
2172 Py_INCREF(Py_None);
2173 _res = Py_None;
2174 return _res;
2175}
2176
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002177static PyObject *waste_WEInstallTSMHandlers(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002178{
2179 PyObject *_res = NULL;
2180 OSErr _err;
2181 if (!PyArg_ParseTuple(_args, ""))
2182 return NULL;
2183 _err = WEInstallTSMHandlers();
2184 if (_err != noErr) return PyMac_Error(_err);
2185 Py_INCREF(Py_None);
2186 _res = Py_None;
2187 return _res;
2188}
2189
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002190static PyObject *waste_WERemoveTSMHandlers(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002191{
2192 PyObject *_res = NULL;
2193 OSErr _err;
2194 if (!PyArg_ParseTuple(_args, ""))
2195 return NULL;
2196 _err = WERemoveTSMHandlers();
2197 if (_err != noErr) return PyMac_Error(_err);
2198 Py_INCREF(Py_None);
2199 _res = Py_None;
2200 return _res;
2201}
2202
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002203static PyObject *waste_WEHandleTSMEvent(PyObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00002204{
2205 PyObject *_res = NULL;
2206 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00002207 AppleEvent inAppleEvent;
2208 AppleEvent ioReply;
Jack Jansen2369a981998-02-20 15:57:30 +00002209 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002210 AEDesc_Convert, &inAppleEvent))
Jack Jansen2369a981998-02-20 15:57:30 +00002211 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002212 _err = WEHandleTSMEvent(&inAppleEvent,
2213 &ioReply);
Jack Jansen2369a981998-02-20 15:57:30 +00002214 if (_err != noErr) return PyMac_Error(_err);
2215 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002216 AEDesc_New, &ioReply);
Jack Jansen2369a981998-02-20 15:57:30 +00002217 return _res;
2218}
2219
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002220static PyObject *waste_WELongPointToPoint(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002221{
2222 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002223 LongPt inLongPoint;
2224 Point outPoint;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002225 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002226 LongPt_Convert, &inLongPoint))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002227 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002228 WELongPointToPoint(&inLongPoint,
2229 &outPoint);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002230 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002231 PyMac_BuildPoint, outPoint);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002232 return _res;
2233}
2234
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002235static PyObject *waste_WEPointToLongPoint(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002236{
2237 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002238 Point inPoint;
2239 LongPt outLongPoint;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002240 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002241 PyMac_GetPoint, &inPoint))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002242 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002243 WEPointToLongPoint(inPoint,
2244 &outLongPoint);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002245 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002246 LongPt_New, &outLongPoint);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002247 return _res;
2248}
2249
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002250static PyObject *waste_WESetLongRect(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002251{
2252 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002253 LongRect outLongRect;
2254 SInt32 inLeft;
2255 SInt32 inTop;
2256 SInt32 inRight;
2257 SInt32 inBottom;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002258 if (!PyArg_ParseTuple(_args, "llll",
Jack Jansenb99e5212002-01-11 12:37:15 +00002259 &inLeft,
2260 &inTop,
2261 &inRight,
2262 &inBottom))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002263 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002264 WESetLongRect(&outLongRect,
2265 inLeft,
2266 inTop,
2267 inRight,
2268 inBottom);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002269 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002270 LongRect_New, &outLongRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002271 return _res;
2272}
2273
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002274static PyObject *waste_WELongRectToRect(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002275{
2276 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002277 LongRect inLongRect;
2278 Rect outRect;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002279 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002280 LongRect_Convert, &inLongRect))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002281 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002282 WELongRectToRect(&inLongRect,
2283 &outRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002284 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002285 PyMac_BuildRect, &outRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002286 return _res;
2287}
2288
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002289static PyObject *waste_WERectToLongRect(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002290{
2291 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002292 Rect inRect;
2293 LongRect outLongRect;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002294 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002295 PyMac_GetRect, &inRect))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002296 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002297 WERectToLongRect(&inRect,
2298 &outLongRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002299 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002300 LongRect_New, &outLongRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002301 return _res;
2302}
2303
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002304static PyObject *waste_WEOffsetLongRect(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002305{
2306 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002307 LongRect ioLongRect;
2308 SInt32 inHorizontalOffset;
2309 SInt32 inVerticalOffset;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002310 if (!PyArg_ParseTuple(_args, "ll",
Jack Jansenb99e5212002-01-11 12:37:15 +00002311 &inHorizontalOffset,
2312 &inVerticalOffset))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002313 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002314 WEOffsetLongRect(&ioLongRect,
2315 inHorizontalOffset,
2316 inVerticalOffset);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002317 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002318 LongRect_New, &ioLongRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002319 return _res;
2320}
2321
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002322static PyObject *waste_WELongPointInLongRect(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002323{
2324 PyObject *_res = NULL;
2325 Boolean _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00002326 LongPt inLongPoint;
2327 LongRect inLongRect;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002328 if (!PyArg_ParseTuple(_args, "O&O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002329 LongPt_Convert, &inLongPoint,
2330 LongRect_Convert, &inLongRect))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002331 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002332 _rv = WELongPointInLongRect(&inLongPoint,
2333 &inLongRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002334 _res = Py_BuildValue("b",
2335 _rv);
2336 return _res;
2337}
2338
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002339static PyObject *waste_STDObjectHandlers(PyObject *_self, PyObject *_args)
Jack Jansen756522f1996-05-07 15:24:01 +00002340{
2341 PyObject *_res = NULL;
2342
2343 OSErr err;
2344 // install the sample object handlers for pictures and sounds
2345#define kTypePicture 'PICT'
2346#define kTypeSound 'snd '
2347
2348 if ( !PyArg_ParseTuple(_args, "") ) return NULL;
2349
2350 if ((err = WEInstallObjectHandler(kTypePicture, weNewHandler,
2351 (UniversalProcPtr) NewWENewObjectProc(HandleNewPicture), NULL)) != noErr)
2352 goto cleanup;
2353
2354 if ((err = WEInstallObjectHandler(kTypePicture, weDisposeHandler,
2355 (UniversalProcPtr) NewWEDisposeObjectProc(HandleDisposePicture), NULL)) != noErr)
2356 goto cleanup;
2357
2358 if ((err = WEInstallObjectHandler(kTypePicture, weDrawHandler,
2359 (UniversalProcPtr) NewWEDrawObjectProc(HandleDrawPicture), NULL)) != noErr)
2360 goto cleanup;
2361
2362 if ((err = WEInstallObjectHandler(kTypeSound, weNewHandler,
2363 (UniversalProcPtr) NewWENewObjectProc(HandleNewSound), NULL)) != noErr)
2364 goto cleanup;
2365
2366 if ((err = WEInstallObjectHandler(kTypeSound, weDrawHandler,
2367 (UniversalProcPtr) NewWEDrawObjectProc(HandleDrawSound), NULL)) != noErr)
2368 goto cleanup;
2369
2370 if ((err = WEInstallObjectHandler(kTypeSound, weClickHandler,
2371 (UniversalProcPtr) NewWEClickObjectProc(HandleClickSound), NULL)) != noErr)
2372 goto cleanup;
2373 Py_INCREF(Py_None);
2374 return Py_None;
2375
2376 cleanup:
2377 return PyMac_Error(err);
2378
2379}
2380
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002381static PyObject *waste_WEInstallObjectHandler(PyObject *_self, PyObject *_args)
Jack Jansen756522f1996-05-07 15:24:01 +00002382{
2383 PyObject *_res = NULL;
2384
2385 OSErr err;
2386 FlavorType objectType;
2387 WESelector selector;
2388 PyObject *py_handler;
2389 UniversalProcPtr handler;
2390 WEReference we = NULL;
2391 PyObject *key;
2392
2393
2394 if ( !PyArg_ParseTuple(_args, "O&O&O|O&",
2395 PyMac_GetOSType, &objectType,
2396 PyMac_GetOSType, &selector,
2397 &py_handler,
Jack Jansen7df36061996-10-01 11:41:14 +00002398 WEOObj_Convert, &we) ) return NULL;
Jack Jansen756522f1996-05-07 15:24:01 +00002399
Jack Jansen25241d91996-05-20 11:30:45 +00002400 if ( selector == weNewHandler ) handler = (UniversalProcPtr)upp_new_handler;
2401 else if ( selector == weDisposeHandler ) handler = (UniversalProcPtr)upp_dispose_handler;
2402 else if ( selector == weDrawHandler ) handler = (UniversalProcPtr)upp_draw_handler;
2403 else if ( selector == weClickHandler ) handler = (UniversalProcPtr)upp_click_handler;
Jack Jansen756522f1996-05-07 15:24:01 +00002404 else return PyMac_Error(weUndefinedSelectorErr);
2405
2406 if ((key = Py_BuildValue("O&O&",
2407 PyMac_BuildOSType, objectType,
2408 PyMac_BuildOSType, selector)) == NULL )
2409 return NULL;
2410
2411 PyDict_SetItem(callbackdict, key, py_handler);
2412
2413 err = WEInstallObjectHandler(objectType, selector, handler, we);
2414 if ( err ) return PyMac_Error(err);
2415 Py_INCREF(Py_None);
2416 return Py_None;
2417
2418}
2419
Jack Jansen90ecdf41996-04-16 14:29:15 +00002420static PyMethodDef waste_methods[] = {
2421 {"WENew", (PyCFunction)waste_WENew, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002422 PyDoc_STR("(LongRect inDestRect, LongRect inViewRect, OptionBits inOptions) -> (WEReference outWE)")},
Jack Jansen2369a981998-02-20 15:57:30 +00002423 {"WEUpdateStyleScrap", (PyCFunction)waste_WEUpdateStyleScrap, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002424 PyDoc_STR("(StScrpHandle ioStyles, WEFontTableHandle inFontTable) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002425 {"WEInstallTSMHandlers", (PyCFunction)waste_WEInstallTSMHandlers, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002426 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002427 {"WERemoveTSMHandlers", (PyCFunction)waste_WERemoveTSMHandlers, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002428 PyDoc_STR("() -> None")},
Jack Jansen2369a981998-02-20 15:57:30 +00002429 {"WEHandleTSMEvent", (PyCFunction)waste_WEHandleTSMEvent, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002430 PyDoc_STR("(AppleEvent inAppleEvent) -> (AppleEvent ioReply)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002431 {"WELongPointToPoint", (PyCFunction)waste_WELongPointToPoint, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002432 PyDoc_STR("(LongPt inLongPoint) -> (Point outPoint)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002433 {"WEPointToLongPoint", (PyCFunction)waste_WEPointToLongPoint, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002434 PyDoc_STR("(Point inPoint) -> (LongPt outLongPoint)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002435 {"WESetLongRect", (PyCFunction)waste_WESetLongRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002436 PyDoc_STR("(SInt32 inLeft, SInt32 inTop, SInt32 inRight, SInt32 inBottom) -> (LongRect outLongRect)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002437 {"WELongRectToRect", (PyCFunction)waste_WELongRectToRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002438 PyDoc_STR("(LongRect inLongRect) -> (Rect outRect)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002439 {"WERectToLongRect", (PyCFunction)waste_WERectToLongRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002440 PyDoc_STR("(Rect inRect) -> (LongRect outLongRect)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002441 {"WEOffsetLongRect", (PyCFunction)waste_WEOffsetLongRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002442 PyDoc_STR("(SInt32 inHorizontalOffset, SInt32 inVerticalOffset) -> (LongRect ioLongRect)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002443 {"WELongPointInLongRect", (PyCFunction)waste_WELongPointInLongRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002444 PyDoc_STR("(LongPt inLongPoint, LongRect inLongRect) -> (Boolean _rv)")},
Jack Jansen756522f1996-05-07 15:24:01 +00002445 {"STDObjectHandlers", (PyCFunction)waste_STDObjectHandlers, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002446 PyDoc_STR(NULL)},
Jack Jansen756522f1996-05-07 15:24:01 +00002447 {"WEInstallObjectHandler", (PyCFunction)waste_WEInstallObjectHandler, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002448 PyDoc_STR(NULL)},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002449 {NULL, NULL, 0}
2450};
2451
2452
2453
Jack Jansen756522f1996-05-07 15:24:01 +00002454/* Return the object corresponding to the window, or NULL */
2455
2456PyObject *
2457ExistingwasteObj_New(w)
2458 WEReference w;
2459{
2460 PyObject *it = NULL;
2461
2462 if (w == NULL)
2463 it = NULL;
2464 else
2465 WEGetInfo(weRefCon, (void *)&it, w);
2466 if (it == NULL || ((wasteObject *)it)->ob_itself != w)
2467 it = Py_None;
2468 Py_INCREF(it);
2469 return it;
2470}
2471
Jack Jansen90ecdf41996-04-16 14:29:15 +00002472
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002473void initwaste(void)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002474{
2475 PyObject *m;
2476 PyObject *d;
2477
2478
2479
2480
2481 m = Py_InitModule("waste", waste_methods);
2482 d = PyModule_GetDict(m);
2483 waste_Error = PyMac_GetOSErrException();
2484 if (waste_Error == NULL ||
2485 PyDict_SetItemString(d, "Error", waste_Error) != 0)
Jack Jansen97ed9072000-09-08 22:06:16 +00002486 return;
Jack Jansena755e681997-09-20 17:40:22 +00002487 WEO_Type.ob_type = &PyType_Type;
2488 Py_INCREF(&WEO_Type);
2489 if (PyDict_SetItemString(d, "WEOType", (PyObject *)&WEO_Type) != 0)
2490 Py_FatalError("can't initialize WEOType");
2491 waste_Type.ob_type = &PyType_Type;
2492 Py_INCREF(&waste_Type);
2493 if (PyDict_SetItemString(d, "wasteType", (PyObject *)&waste_Type) != 0)
2494 Py_FatalError("can't initialize wasteType");
Jack Jansen756522f1996-05-07 15:24:01 +00002495
2496 callbackdict = PyDict_New();
2497 if (callbackdict == NULL || PyDict_SetItemString(d, "callbacks", callbackdict) != 0)
Jack Jansen97ed9072000-09-08 22:06:16 +00002498 return;
Jack Jansen756522f1996-05-07 15:24:01 +00002499 upp_new_handler = NewWENewObjectProc(my_new_handler);
Jack Jansen25241d91996-05-20 11:30:45 +00002500 upp_dispose_handler = NewWEDisposeObjectProc(my_dispose_handler);
2501 upp_draw_handler = NewWEDrawObjectProc(my_draw_handler);
2502 upp_click_handler = NewWEClickObjectProc(my_click_handler);
Jack Jansen756522f1996-05-07 15:24:01 +00002503
2504
Jack Jansen90ecdf41996-04-16 14:29:15 +00002505}
2506
2507/* ======================== End module waste ======================== */
2508