blob: aa31e30e914f93c164d873c0ce3dccc6f8308fdf [file] [log] [blame]
Jack Jansen90ecdf41996-04-16 14:29:15 +00001
2/* ========================== Module waste ========================== */
3
4#include "Python.h"
5
6
7
Jack Jansen620a7662001-12-18 15:39:38 +00008#ifdef _WIN32
9#include "pywintoolbox.h"
10#else
Jack Jansen90ecdf41996-04-16 14:29:15 +000011#include "macglue.h"
Jack Jansen9d8b96c2000-07-14 22:16:45 +000012#include "pymactoolbox.h"
Jack Jansen620a7662001-12-18 15:39:38 +000013#endif
Jack Jansen044d95e2001-09-05 15:44:37 +000014
15/* Macro to test whether a weak-loaded CFM function exists */
16#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
17 PyErr_SetString(PyExc_NotImplementedError, \
18 "Not available in this shared library/OS version"); \
19 return NULL; \
20 }} while(0)
21
Jack Jansen90ecdf41996-04-16 14:29:15 +000022
23#include <WASTE.h>
Jack Jansen8505ef81997-08-27 14:09:25 +000024#include <WEObjectHandlers.h>
Jack Jansena755e681997-09-20 17:40:22 +000025#include <WETabs.h>
Jack Jansen97257352002-11-18 15:26:43 +000026#ifndef PyDoc_STR
27#define PyDoc_STR(x) (x)
28#endif
Jack Jansen90ecdf41996-04-16 14:29:15 +000029
30/* Exported by Qdmodule.c: */
31extern PyObject *QdRGB_New(RGBColor *);
32extern int QdRGB_Convert(PyObject *, RGBColor *);
33
Jack Jansen8505ef81997-08-27 14:09:25 +000034/* Exported by AEModule.c: */
35extern PyObject *AEDesc_New(AppleEvent *);
36extern int AEDesc_Convert(PyObject *, AppleEvent *);
37
Jack Jansen90ecdf41996-04-16 14:29:15 +000038/* Forward declaration */
Jeremy Hylton938ace62002-07-17 16:30:39 +000039static PyObject *WEOObj_New(WEObjectReference);
40static PyObject *ExistingwasteObj_New(WEReference);
Jack Jansen90ecdf41996-04-16 14:29:15 +000041
42/*
43** Parse/generate TextStyle records
44*/
45static
46PyObject *TextStyle_New(itself)
47 TextStylePtr itself;
48{
49
50 return Py_BuildValue("lllO&", (long)itself->tsFont, (long)itself->tsFace, (long)itself->tsSize, QdRGB_New,
51 &itself->tsColor);
52}
53
54static
55TextStyle_Convert(v, p_itself)
56 PyObject *v;
57 TextStylePtr p_itself;
58{
59 long font, face, size;
60
61 if( !PyArg_ParseTuple(v, "lllO&", &font, &face, &size, QdRGB_Convert, &p_itself->tsColor) )
62 return 0;
63 p_itself->tsFont = (short)font;
64 p_itself->tsFace = (Style)face;
65 p_itself->tsSize = (short)size;
66 return 1;
67}
68
69/*
70** Parse/generate RunInfo records
71*/
72static
73PyObject *RunInfo_New(itself)
74 WERunInfo *itself;
75{
76
77 return Py_BuildValue("llhhO&O&", itself->runStart, itself->runEnd, itself->runHeight,
78 itself->runAscent, TextStyle_New, &itself->runStyle, WEOObj_New, itself->runObject);
79}
80
81/* Conversion of long points and rects */
82int
83LongRect_Convert(PyObject *v, LongRect *r)
84{
85 return PyArg_Parse(v, "(llll)", &r->left, &r->top, &r->right, &r->bottom);
86}
87
88PyObject *
89LongRect_New(LongRect *r)
90{
91 return Py_BuildValue("(llll)", r->left, r->top, r->right, r->bottom);
92}
93
94
95LongPt_Convert(PyObject *v, LongPt *p)
96{
97 return PyArg_Parse(v, "(ll)", &p->h, &p->v);
98}
99
100PyObject *
101LongPt_New(LongPt *p)
102{
103 return Py_BuildValue("(ll)", p->h, p->v);
104}
105
Jack Jansen756522f1996-05-07 15:24:01 +0000106/* Stuff for the callbacks: */
107static PyObject *callbackdict;
Jack Jansen25241d91996-05-20 11:30:45 +0000108WENewObjectUPP upp_new_handler;
109WEDisposeObjectUPP upp_dispose_handler;
110WEDrawObjectUPP upp_draw_handler;
111WEClickObjectUPP upp_click_handler;
Jack Jansen756522f1996-05-07 15:24:01 +0000112
113static OSErr
114any_handler(WESelector what, WEObjectReference who, PyObject *args, PyObject **rv)
115{
116 FlavorType tp;
117 PyObject *key, *func;
118
119 if ( args == NULL ) return errAECorruptData;
120
121 tp = WEGetObjectType(who);
122
123 if( (key=Py_BuildValue("O&O&", PyMac_BuildOSType, tp, PyMac_BuildOSType, what)) == NULL)
124 return errAECorruptData;
125 if( (func = PyDict_GetItem(callbackdict, key)) == NULL ) {
126 Py_DECREF(key);
127 return errAEHandlerNotFound;
128 }
129 Py_INCREF(func);
130 *rv = PyEval_CallObject(func, args);
131 Py_DECREF(func);
132 Py_DECREF(key);
133 if ( *rv == NULL ) {
Jack Jansendeff89c1998-10-12 20:53:15 +0000134 PySys_WriteStderr("--Exception in callback: ");
Jack Jansen756522f1996-05-07 15:24:01 +0000135 PyErr_Print();
136 return errAEReplyNotArrived;
137 }
138 return 0;
139}
140
141static pascal OSErr
142my_new_handler(Point *objectSize, WEObjectReference objref)
143{
144 PyObject *args=NULL, *rv=NULL;
145 OSErr err;
146
147 args=Py_BuildValue("(O&)", WEOObj_New, objref);
148 err = any_handler(weNewHandler, objref, args, &rv);
149 if (!err) {
150 if (!PyMac_GetPoint(rv, objectSize) )
151 err = errAECoercionFail;
152 }
153 if ( args ) Py_DECREF(args);
154 if ( rv ) Py_DECREF(rv);
155 return err;
156}
157
158static pascal OSErr
159my_dispose_handler(WEObjectReference objref)
160{
161 PyObject *args=NULL, *rv=NULL;
162 OSErr err;
163
164 args=Py_BuildValue("(O&)", WEOObj_New, objref);
165 err = any_handler(weDisposeHandler, objref, args, &rv);
166 if ( args ) Py_DECREF(args);
167 if ( rv ) Py_DECREF(rv);
168 return err;
169}
170
171static pascal OSErr
Jack Jansen6b9289f2001-06-20 21:21:07 +0000172my_draw_handler(const Rect *destRect, WEObjectReference objref)
Jack Jansen756522f1996-05-07 15:24:01 +0000173{
174 PyObject *args=NULL, *rv=NULL;
175 OSErr err;
176
177 args=Py_BuildValue("O&O&", PyMac_BuildRect, destRect, WEOObj_New, objref);
178 err = any_handler(weDrawHandler, objref, args, &rv);
179 if ( args ) Py_DECREF(args);
180 if ( rv ) Py_DECREF(rv);
181 return err;
182}
183
184static pascal Boolean
185my_click_handler(Point hitPt, EventModifiers modifiers,
186 unsigned long clickTime, WEObjectReference objref)
187{
188 PyObject *args=NULL, *rv=NULL;
189 int retvalue;
190 OSErr err;
191
192 args=Py_BuildValue("O&llO&", PyMac_BuildPoint, hitPt,
193 (long)modifiers, (long)clickTime, WEOObj_New, objref);
194 err = any_handler(weClickHandler, objref, args, &rv);
195 if (!err)
196 retvalue = PyInt_AsLong(rv);
197 else
198 retvalue = 0;
199 if ( args ) Py_DECREF(args);
200 if ( rv ) Py_DECREF(rv);
201 return retvalue;
202}
203
204
205
Jack Jansen90ecdf41996-04-16 14:29:15 +0000206static PyObject *waste_Error;
207
208/* ------------------------ Object type WEO ------------------------- */
209
210PyTypeObject WEO_Type;
211
212#define WEOObj_Check(x) ((x)->ob_type == &WEO_Type)
213
214typedef struct WEOObject {
215 PyObject_HEAD
216 WEObjectReference ob_itself;
217} WEOObject;
218
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000219PyObject *WEOObj_New(WEObjectReference itself)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000220{
221 WEOObject *it;
222 if (itself == NULL) {
223 Py_INCREF(Py_None);
224 return Py_None;
225 }
226 it = PyObject_NEW(WEOObject, &WEO_Type);
227 if (it == NULL) return NULL;
228 it->ob_itself = itself;
229 return (PyObject *)it;
230}
Jack Jansen044d95e2001-09-05 15:44:37 +0000231int WEOObj_Convert(PyObject *v, WEObjectReference *p_itself)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000232{
233 if (!WEOObj_Check(v))
234 {
235 PyErr_SetString(PyExc_TypeError, "WEO required");
236 return 0;
237 }
238 *p_itself = ((WEOObject *)v)->ob_itself;
239 return 1;
240}
241
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000242static void WEOObj_dealloc(WEOObject *self)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000243{
244 /* Cleanup of self->ob_itself goes here */
Jack Jansen033b79c2002-04-23 22:46:01 +0000245 PyObject_Del(self);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000246}
247
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000248static PyObject *WEOObj_WEGetObjectType(WEOObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000249{
250 PyObject *_res = NULL;
251 FlavorType _rv;
252 if (!PyArg_ParseTuple(_args, ""))
253 return NULL;
254 _rv = WEGetObjectType(_self->ob_itself);
255 _res = Py_BuildValue("O&",
256 PyMac_BuildOSType, _rv);
257 return _res;
258}
259
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000260static PyObject *WEOObj_WEGetObjectDataHandle(WEOObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000261{
262 PyObject *_res = NULL;
263 Handle _rv;
264 if (!PyArg_ParseTuple(_args, ""))
265 return NULL;
266 _rv = WEGetObjectDataHandle(_self->ob_itself);
267 _res = Py_BuildValue("O&",
268 ResObj_New, _rv);
269 return _res;
270}
271
Jack Jansenb99e5212002-01-11 12:37:15 +0000272static PyObject *WEOObj_WEGetObjectOwner(WEOObject *_self, PyObject *_args)
273{
274 PyObject *_res = NULL;
275 WEReference _rv;
276 if (!PyArg_ParseTuple(_args, ""))
277 return NULL;
278 _rv = WEGetObjectOwner(_self->ob_itself);
279 _res = Py_BuildValue("O&",
280 ExistingwasteObj_New, _rv);
281 return _res;
282}
283
284static PyObject *WEOObj_WEGetObjectOffset(WEOObject *_self, PyObject *_args)
285{
286 PyObject *_res = NULL;
287 SInt32 _rv;
288 if (!PyArg_ParseTuple(_args, ""))
289 return NULL;
290 _rv = WEGetObjectOffset(_self->ob_itself);
291 _res = Py_BuildValue("l",
292 _rv);
293 return _res;
294}
295
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000296static PyObject *WEOObj_WEGetObjectSize(WEOObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000297{
298 PyObject *_res = NULL;
299 Point _rv;
300 if (!PyArg_ParseTuple(_args, ""))
301 return NULL;
302 _rv = WEGetObjectSize(_self->ob_itself);
303 _res = Py_BuildValue("O&",
304 PyMac_BuildPoint, _rv);
305 return _res;
306}
307
Jack Jansenb99e5212002-01-11 12:37:15 +0000308static PyObject *WEOObj_WESetObjectSize(WEOObject *_self, PyObject *_args)
Jack Jansen756522f1996-05-07 15:24:01 +0000309{
310 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000311 OSErr _err;
312 Point inObjectSize;
313 if (!PyArg_ParseTuple(_args, "O&",
314 PyMac_GetPoint, &inObjectSize))
315 return NULL;
316 _err = WESetObjectSize(_self->ob_itself,
317 inObjectSize);
318 if (_err != noErr) return PyMac_Error(_err);
319 Py_INCREF(Py_None);
320 _res = Py_None;
321 return _res;
322}
323
324static PyObject *WEOObj_WEGetObjectFrame(WEOObject *_self, PyObject *_args)
325{
326 PyObject *_res = NULL;
327 OSErr _err;
328 LongRect outObjectFrame;
Jack Jansen756522f1996-05-07 15:24:01 +0000329 if (!PyArg_ParseTuple(_args, ""))
330 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000331 _err = WEGetObjectFrame(_self->ob_itself,
332 &outObjectFrame);
333 if (_err != noErr) return PyMac_Error(_err);
Jack Jansen756522f1996-05-07 15:24:01 +0000334 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +0000335 LongRect_New, &outObjectFrame);
Jack Jansen756522f1996-05-07 15:24:01 +0000336 return _res;
337}
338
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000339static PyObject *WEOObj_WEGetObjectRefCon(WEOObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000340{
341 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +0000342 SInt32 _rv;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000343 if (!PyArg_ParseTuple(_args, ""))
344 return NULL;
345 _rv = WEGetObjectRefCon(_self->ob_itself);
346 _res = Py_BuildValue("l",
347 _rv);
348 return _res;
349}
350
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000351static PyObject *WEOObj_WESetObjectRefCon(WEOObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000352{
353 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000354 SInt32 inRefCon;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000355 if (!PyArg_ParseTuple(_args, "l",
Jack Jansenb99e5212002-01-11 12:37:15 +0000356 &inRefCon))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000357 return NULL;
358 WESetObjectRefCon(_self->ob_itself,
Jack Jansenb99e5212002-01-11 12:37:15 +0000359 inRefCon);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000360 Py_INCREF(Py_None);
361 _res = Py_None;
362 return _res;
363}
364
365static PyMethodDef WEOObj_methods[] = {
366 {"WEGetObjectType", (PyCFunction)WEOObj_WEGetObjectType, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000367 PyDoc_STR("() -> (FlavorType _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +0000368 {"WEGetObjectDataHandle", (PyCFunction)WEOObj_WEGetObjectDataHandle, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000369 PyDoc_STR("() -> (Handle _rv)")},
Jack Jansen756522f1996-05-07 15:24:01 +0000370 {"WEGetObjectOwner", (PyCFunction)WEOObj_WEGetObjectOwner, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000371 PyDoc_STR("() -> (WEReference _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +0000372 {"WEGetObjectOffset", (PyCFunction)WEOObj_WEGetObjectOffset, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000373 PyDoc_STR("() -> (SInt32 _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +0000374 {"WEGetObjectSize", (PyCFunction)WEOObj_WEGetObjectSize, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000375 PyDoc_STR("() -> (Point _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +0000376 {"WESetObjectSize", (PyCFunction)WEOObj_WESetObjectSize, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000377 PyDoc_STR("(Point inObjectSize) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +0000378 {"WEGetObjectFrame", (PyCFunction)WEOObj_WEGetObjectFrame, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000379 PyDoc_STR("() -> (LongRect outObjectFrame)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +0000380 {"WEGetObjectRefCon", (PyCFunction)WEOObj_WEGetObjectRefCon, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000381 PyDoc_STR("() -> (SInt32 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +0000382 {"WESetObjectRefCon", (PyCFunction)WEOObj_WESetObjectRefCon, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000383 PyDoc_STR("(SInt32 inRefCon) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +0000384 {NULL, NULL, 0}
385};
386
Jack Jansendbd57012002-11-29 23:40:48 +0000387#define WEOObj_getsetlist NULL
Jack Jansen90ecdf41996-04-16 14:29:15 +0000388
Jack Jansen96cebde2002-12-03 23:40:22 +0000389
Jack Jansen9d8b96c2000-07-14 22:16:45 +0000390#define WEOObj_compare NULL
391
392#define WEOObj_repr NULL
393
394#define WEOObj_hash NULL
Jack Jansen96cebde2002-12-03 23:40:22 +0000395#define WEOObj_tp_init 0
396
397#define WEOObj_tp_alloc PyType_GenericAlloc
398
399static PyObject *WEOObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
400{
401 PyObject *self;
402 WEObjectReference itself;
403 char *kw[] = {"itself", 0};
404
405 if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, WEOObj_Convert, &itself)) return NULL;
406 if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
407 ((WEOObject *)self)->ob_itself = itself;
408 return self;
409}
410
411#define WEOObj_tp_free PyObject_Del
412
Jack Jansen9d8b96c2000-07-14 22:16:45 +0000413
Jack Jansen90ecdf41996-04-16 14:29:15 +0000414PyTypeObject WEO_Type = {
Jack Jansenb3be2162001-11-30 14:16:36 +0000415 PyObject_HEAD_INIT(NULL)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000416 0, /*ob_size*/
Guido van Rossum14648392001-12-08 18:02:58 +0000417 "waste.WEO", /*tp_name*/
Jack Jansen90ecdf41996-04-16 14:29:15 +0000418 sizeof(WEOObject), /*tp_basicsize*/
419 0, /*tp_itemsize*/
420 /* methods */
421 (destructor) WEOObj_dealloc, /*tp_dealloc*/
422 0, /*tp_print*/
Jack Jansendbd57012002-11-29 23:40:48 +0000423 (getattrfunc)0, /*tp_getattr*/
424 (setattrfunc)0, /*tp_setattr*/
Jack Jansen9d8b96c2000-07-14 22:16:45 +0000425 (cmpfunc) WEOObj_compare, /*tp_compare*/
426 (reprfunc) WEOObj_repr, /*tp_repr*/
427 (PyNumberMethods *)0, /* tp_as_number */
428 (PySequenceMethods *)0, /* tp_as_sequence */
429 (PyMappingMethods *)0, /* tp_as_mapping */
430 (hashfunc) WEOObj_hash, /*tp_hash*/
Jack Jansendbd57012002-11-29 23:40:48 +0000431 0, /*tp_call*/
432 0, /*tp_str*/
433 PyObject_GenericGetAttr, /*tp_getattro*/
434 PyObject_GenericSetAttr, /*tp_setattro */
Jack Jansen96cebde2002-12-03 23:40:22 +0000435 0, /*tp_as_buffer*/
436 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
437 0, /*tp_doc*/
438 0, /*tp_traverse*/
439 0, /*tp_clear*/
440 0, /*tp_richcompare*/
441 0, /*tp_weaklistoffset*/
442 0, /*tp_iter*/
443 0, /*tp_iternext*/
Jack Jansendbd57012002-11-29 23:40:48 +0000444 WEOObj_methods, /* tp_methods */
Jack Jansen96cebde2002-12-03 23:40:22 +0000445 0, /*tp_members*/
Jack Jansendbd57012002-11-29 23:40:48 +0000446 WEOObj_getsetlist, /*tp_getset*/
Jack Jansen96cebde2002-12-03 23:40:22 +0000447 0, /*tp_base*/
448 0, /*tp_dict*/
449 0, /*tp_descr_get*/
450 0, /*tp_descr_set*/
451 0, /*tp_dictoffset*/
452 WEOObj_tp_init, /* tp_init */
453 WEOObj_tp_alloc, /* tp_alloc */
454 WEOObj_tp_new, /* tp_new */
455 WEOObj_tp_free, /* tp_free */
Jack Jansen90ecdf41996-04-16 14:29:15 +0000456};
457
458/* ---------------------- End object type WEO ----------------------- */
459
460
461/* ----------------------- Object type waste ------------------------ */
462
463PyTypeObject waste_Type;
464
465#define wasteObj_Check(x) ((x)->ob_type == &waste_Type)
466
467typedef struct wasteObject {
468 PyObject_HEAD
469 WEReference ob_itself;
470} wasteObject;
471
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000472PyObject *wasteObj_New(WEReference itself)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000473{
474 wasteObject *it;
475 if (itself == NULL) {
476 PyErr_SetString(waste_Error,"Cannot create null WE");
477 return NULL;
478 }
479 it = PyObject_NEW(wasteObject, &waste_Type);
480 if (it == NULL) return NULL;
481 it->ob_itself = itself;
Jack Jansen756522f1996-05-07 15:24:01 +0000482 WESetInfo(weRefCon, (void *)&it, itself);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000483 return (PyObject *)it;
484}
Jack Jansen044d95e2001-09-05 15:44:37 +0000485int wasteObj_Convert(PyObject *v, WEReference *p_itself)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000486{
487 if (!wasteObj_Check(v))
488 {
489 PyErr_SetString(PyExc_TypeError, "waste required");
490 return 0;
491 }
492 *p_itself = ((wasteObject *)v)->ob_itself;
493 return 1;
494}
495
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000496static void wasteObj_dealloc(wasteObject *self)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000497{
498 WEDispose(self->ob_itself);
Jack Jansen033b79c2002-04-23 22:46:01 +0000499 PyObject_Del(self);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000500}
501
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000502static PyObject *wasteObj_WEGetText(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000503{
504 PyObject *_res = NULL;
505 Handle _rv;
506 if (!PyArg_ParseTuple(_args, ""))
507 return NULL;
508 _rv = WEGetText(_self->ob_itself);
509 _res = Py_BuildValue("O&",
510 ResObj_New, _rv);
511 return _res;
512}
513
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000514static PyObject *wasteObj_WEGetChar(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000515{
516 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +0000517 SInt16 _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +0000518 SInt32 inOffset;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000519 if (!PyArg_ParseTuple(_args, "l",
Jack Jansenb99e5212002-01-11 12:37:15 +0000520 &inOffset))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000521 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000522 _rv = WEGetChar(inOffset,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000523 _self->ob_itself);
524 _res = Py_BuildValue("h",
525 _rv);
526 return _res;
527}
528
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000529static PyObject *wasteObj_WEGetTextLength(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000530{
531 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +0000532 SInt32 _rv;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000533 if (!PyArg_ParseTuple(_args, ""))
534 return NULL;
535 _rv = WEGetTextLength(_self->ob_itself);
536 _res = Py_BuildValue("l",
537 _rv);
538 return _res;
539}
540
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000541static PyObject *wasteObj_WEGetSelection(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000542{
543 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000544 SInt32 outSelStart;
545 SInt32 outSelEnd;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000546 if (!PyArg_ParseTuple(_args, ""))
547 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000548 WEGetSelection(&outSelStart,
549 &outSelEnd,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000550 _self->ob_itself);
551 _res = Py_BuildValue("ll",
Jack Jansenb99e5212002-01-11 12:37:15 +0000552 outSelStart,
553 outSelEnd);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000554 return _res;
555}
556
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000557static PyObject *wasteObj_WEGetDestRect(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000558{
559 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000560 LongRect outDestRect;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000561 if (!PyArg_ParseTuple(_args, ""))
562 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000563 WEGetDestRect(&outDestRect,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000564 _self->ob_itself);
565 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +0000566 LongRect_New, &outDestRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000567 return _res;
568}
569
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000570static PyObject *wasteObj_WEGetViewRect(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000571{
572 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000573 LongRect outViewRect;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000574 if (!PyArg_ParseTuple(_args, ""))
575 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000576 WEGetViewRect(&outViewRect,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000577 _self->ob_itself);
578 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +0000579 LongRect_New, &outViewRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000580 return _res;
581}
582
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000583static PyObject *wasteObj_WEIsActive(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000584{
585 PyObject *_res = NULL;
586 Boolean _rv;
587 if (!PyArg_ParseTuple(_args, ""))
588 return NULL;
589 _rv = WEIsActive(_self->ob_itself);
590 _res = Py_BuildValue("b",
591 _rv);
592 return _res;
593}
594
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000595static PyObject *wasteObj_WEGetClickCount(wasteObject *_self, PyObject *_args)
Jack Jansen2268af51996-08-06 16:04:22 +0000596{
597 PyObject *_res = NULL;
598 UInt16 _rv;
599 if (!PyArg_ParseTuple(_args, ""))
600 return NULL;
601 _rv = WEGetClickCount(_self->ob_itself);
Jack Jansen9d8b96c2000-07-14 22:16:45 +0000602 _res = Py_BuildValue("H",
Jack Jansen2268af51996-08-06 16:04:22 +0000603 _rv);
604 return _res;
605}
606
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000607static PyObject *wasteObj_WESetSelection(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000608{
609 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000610 SInt32 inSelStart;
611 SInt32 inSelEnd;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000612 if (!PyArg_ParseTuple(_args, "ll",
Jack Jansenb99e5212002-01-11 12:37:15 +0000613 &inSelStart,
614 &inSelEnd))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000615 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000616 WESetSelection(inSelStart,
617 inSelEnd,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000618 _self->ob_itself);
619 Py_INCREF(Py_None);
620 _res = Py_None;
621 return _res;
622}
623
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000624static PyObject *wasteObj_WESetDestRect(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000625{
626 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000627 LongRect inDestRect;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000628 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +0000629 LongRect_Convert, &inDestRect))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000630 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000631 WESetDestRect(&inDestRect,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000632 _self->ob_itself);
633 Py_INCREF(Py_None);
634 _res = Py_None;
635 return _res;
636}
637
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000638static PyObject *wasteObj_WESetViewRect(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000639{
640 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000641 LongRect inViewRect;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000642 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +0000643 LongRect_Convert, &inViewRect))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000644 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000645 WESetViewRect(&inViewRect,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000646 _self->ob_itself);
647 Py_INCREF(Py_None);
648 _res = Py_None;
649 return _res;
650}
651
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000652static PyObject *wasteObj_WEContinuousStyle(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000653{
654 PyObject *_res = NULL;
655 Boolean _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +0000656 WEStyleMode ioMode;
657 TextStyle outTextStyle;
Jack Jansen9d8b96c2000-07-14 22:16:45 +0000658 if (!PyArg_ParseTuple(_args, "H",
Jack Jansenb99e5212002-01-11 12:37:15 +0000659 &ioMode))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000660 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000661 _rv = WEContinuousStyle(&ioMode,
662 &outTextStyle,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000663 _self->ob_itself);
Jack Jansen9d8b96c2000-07-14 22:16:45 +0000664 _res = Py_BuildValue("bHO&",
Jack Jansen90ecdf41996-04-16 14:29:15 +0000665 _rv,
Jack Jansenb99e5212002-01-11 12:37:15 +0000666 ioMode,
667 TextStyle_New, &outTextStyle);
668 return _res;
669}
670
671static PyObject *wasteObj_WECountRuns(wasteObject *_self, PyObject *_args)
672{
673 PyObject *_res = NULL;
674 SInt32 _rv;
675 if (!PyArg_ParseTuple(_args, ""))
676 return NULL;
677 _rv = WECountRuns(_self->ob_itself);
678 _res = Py_BuildValue("l",
679 _rv);
680 return _res;
681}
682
683static PyObject *wasteObj_WEOffsetToRun(wasteObject *_self, PyObject *_args)
684{
685 PyObject *_res = NULL;
686 SInt32 _rv;
687 SInt32 inOffset;
688 if (!PyArg_ParseTuple(_args, "l",
689 &inOffset))
690 return NULL;
691 _rv = WEOffsetToRun(inOffset,
692 _self->ob_itself);
693 _res = Py_BuildValue("l",
694 _rv);
695 return _res;
696}
697
698static PyObject *wasteObj_WEGetRunRange(wasteObject *_self, PyObject *_args)
699{
700 PyObject *_res = NULL;
701 SInt32 inStyleRunIndex;
702 SInt32 outStyleRunStart;
703 SInt32 outStyleRunEnd;
704 if (!PyArg_ParseTuple(_args, "l",
705 &inStyleRunIndex))
706 return NULL;
707 WEGetRunRange(inStyleRunIndex,
708 &outStyleRunStart,
709 &outStyleRunEnd,
710 _self->ob_itself);
711 _res = Py_BuildValue("ll",
712 outStyleRunStart,
713 outStyleRunEnd);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000714 return _res;
715}
716
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000717static PyObject *wasteObj_WEGetRunInfo(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000718{
719 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000720 SInt32 inOffset;
721 WERunInfo outStyleRunInfo;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000722 if (!PyArg_ParseTuple(_args, "l",
Jack Jansenb99e5212002-01-11 12:37:15 +0000723 &inOffset))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000724 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000725 WEGetRunInfo(inOffset,
726 &outStyleRunInfo,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000727 _self->ob_itself);
728 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +0000729 RunInfo_New, &outStyleRunInfo);
730 return _res;
731}
732
733static PyObject *wasteObj_WEGetIndRunInfo(wasteObject *_self, PyObject *_args)
734{
735 PyObject *_res = NULL;
736 SInt32 inStyleRunIndex;
737 WERunInfo outStyleRunInfo;
738 if (!PyArg_ParseTuple(_args, "l",
739 &inStyleRunIndex))
740 return NULL;
741 WEGetIndRunInfo(inStyleRunIndex,
742 &outStyleRunInfo,
743 _self->ob_itself);
744 _res = Py_BuildValue("O&",
745 RunInfo_New, &outStyleRunInfo);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000746 return _res;
747}
748
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000749static PyObject *wasteObj_WEGetRunDirection(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +0000750{
751 PyObject *_res = NULL;
752 Boolean _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +0000753 SInt32 inOffset;
Jack Jansen2369a981998-02-20 15:57:30 +0000754 if (!PyArg_ParseTuple(_args, "l",
Jack Jansenb99e5212002-01-11 12:37:15 +0000755 &inOffset))
Jack Jansen2369a981998-02-20 15:57:30 +0000756 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000757 _rv = WEGetRunDirection(inOffset,
Jack Jansen2369a981998-02-20 15:57:30 +0000758 _self->ob_itself);
759 _res = Py_BuildValue("b",
760 _rv);
761 return _res;
762}
763
Jack Jansenb99e5212002-01-11 12:37:15 +0000764static PyObject *wasteObj_WECountParaRuns(wasteObject *_self, PyObject *_args)
765{
766 PyObject *_res = NULL;
767 SInt32 _rv;
768 if (!PyArg_ParseTuple(_args, ""))
769 return NULL;
770 _rv = WECountParaRuns(_self->ob_itself);
771 _res = Py_BuildValue("l",
772 _rv);
773 return _res;
774}
775
776static PyObject *wasteObj_WEOffsetToParaRun(wasteObject *_self, PyObject *_args)
777{
778 PyObject *_res = NULL;
779 SInt32 _rv;
780 SInt32 inOffset;
781 if (!PyArg_ParseTuple(_args, "l",
782 &inOffset))
783 return NULL;
784 _rv = WEOffsetToParaRun(inOffset,
785 _self->ob_itself);
786 _res = Py_BuildValue("l",
787 _rv);
788 return _res;
789}
790
791static PyObject *wasteObj_WEGetParaRunRange(wasteObject *_self, PyObject *_args)
792{
793 PyObject *_res = NULL;
794 SInt32 inParagraphRunIndex;
795 SInt32 outParagraphRunStart;
796 SInt32 outParagraphRunEnd;
797 if (!PyArg_ParseTuple(_args, "l",
798 &inParagraphRunIndex))
799 return NULL;
800 WEGetParaRunRange(inParagraphRunIndex,
801 &outParagraphRunStart,
802 &outParagraphRunEnd,
803 _self->ob_itself);
804 _res = Py_BuildValue("ll",
805 outParagraphRunStart,
806 outParagraphRunEnd);
807 return _res;
808}
809
810static PyObject *wasteObj_WECountLines(wasteObject *_self, PyObject *_args)
811{
812 PyObject *_res = NULL;
813 SInt32 _rv;
814 if (!PyArg_ParseTuple(_args, ""))
815 return NULL;
816 _rv = WECountLines(_self->ob_itself);
817 _res = Py_BuildValue("l",
818 _rv);
819 return _res;
820}
821
822static PyObject *wasteObj_WEOffsetToLine(wasteObject *_self, PyObject *_args)
823{
824 PyObject *_res = NULL;
825 SInt32 _rv;
826 SInt32 inOffset;
827 if (!PyArg_ParseTuple(_args, "l",
828 &inOffset))
829 return NULL;
830 _rv = WEOffsetToLine(inOffset,
831 _self->ob_itself);
832 _res = Py_BuildValue("l",
833 _rv);
834 return _res;
835}
836
837static PyObject *wasteObj_WEGetLineRange(wasteObject *_self, PyObject *_args)
838{
839 PyObject *_res = NULL;
840 SInt32 inLineIndex;
841 SInt32 outLineStart;
842 SInt32 outLineEnd;
843 if (!PyArg_ParseTuple(_args, "l",
844 &inLineIndex))
845 return NULL;
846 WEGetLineRange(inLineIndex,
847 &outLineStart,
848 &outLineEnd,
849 _self->ob_itself);
850 _res = Py_BuildValue("ll",
851 outLineStart,
852 outLineEnd);
853 return _res;
854}
855
856static PyObject *wasteObj_WEGetHeight(wasteObject *_self, PyObject *_args)
857{
858 PyObject *_res = NULL;
859 SInt32 _rv;
860 SInt32 inStartLineIndex;
861 SInt32 inEndLineIndex;
862 if (!PyArg_ParseTuple(_args, "ll",
863 &inStartLineIndex,
864 &inEndLineIndex))
865 return NULL;
866 _rv = WEGetHeight(inStartLineIndex,
867 inEndLineIndex,
868 _self->ob_itself);
869 _res = Py_BuildValue("l",
870 _rv);
871 return _res;
872}
873
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000874static PyObject *wasteObj_WEGetOffset(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000875{
876 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +0000877 SInt32 _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +0000878 LongPt inPoint;
879 WEEdge outEdge;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000880 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +0000881 LongPt_Convert, &inPoint))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000882 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000883 _rv = WEGetOffset(&inPoint,
884 &outEdge,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000885 _self->ob_itself);
Jack Jansen97ed9072000-09-08 22:06:16 +0000886 _res = Py_BuildValue("lB",
Jack Jansen90ecdf41996-04-16 14:29:15 +0000887 _rv,
Jack Jansenb99e5212002-01-11 12:37:15 +0000888 outEdge);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000889 return _res;
890}
891
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000892static PyObject *wasteObj_WEGetPoint(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000893{
894 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000895 SInt32 inOffset;
896 SInt16 inDirection;
897 LongPt outPoint;
898 SInt16 outLineHeight;
Jack Jansen2268af51996-08-06 16:04:22 +0000899 if (!PyArg_ParseTuple(_args, "lh",
Jack Jansenb99e5212002-01-11 12:37:15 +0000900 &inOffset,
901 &inDirection))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000902 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000903 WEGetPoint(inOffset,
904 inDirection,
905 &outPoint,
906 &outLineHeight,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000907 _self->ob_itself);
908 _res = Py_BuildValue("O&h",
Jack Jansenb99e5212002-01-11 12:37:15 +0000909 LongPt_New, &outPoint,
910 outLineHeight);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000911 return _res;
912}
913
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000914static PyObject *wasteObj_WEFindWord(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000915{
916 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000917 SInt32 inOffset;
918 WEEdge inEdge;
919 SInt32 outWordStart;
920 SInt32 outWordEnd;
Jack Jansen97ed9072000-09-08 22:06:16 +0000921 if (!PyArg_ParseTuple(_args, "lB",
Jack Jansenb99e5212002-01-11 12:37:15 +0000922 &inOffset,
923 &inEdge))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000924 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000925 WEFindWord(inOffset,
926 inEdge,
927 &outWordStart,
928 &outWordEnd,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000929 _self->ob_itself);
930 _res = Py_BuildValue("ll",
Jack Jansenb99e5212002-01-11 12:37:15 +0000931 outWordStart,
932 outWordEnd);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000933 return _res;
934}
935
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000936static PyObject *wasteObj_WEFindLine(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000937{
938 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000939 SInt32 inOffset;
940 WEEdge inEdge;
941 SInt32 outLineStart;
942 SInt32 outLineEnd;
Jack Jansen97ed9072000-09-08 22:06:16 +0000943 if (!PyArg_ParseTuple(_args, "lB",
Jack Jansenb99e5212002-01-11 12:37:15 +0000944 &inOffset,
945 &inEdge))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000946 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000947 WEFindLine(inOffset,
948 inEdge,
949 &outLineStart,
950 &outLineEnd,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000951 _self->ob_itself);
952 _res = Py_BuildValue("ll",
Jack Jansenb99e5212002-01-11 12:37:15 +0000953 outLineStart,
954 outLineEnd);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000955 return _res;
956}
957
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000958static PyObject *wasteObj_WEFindParagraph(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +0000959{
960 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000961 SInt32 inOffset;
962 WEEdge inEdge;
963 SInt32 outParagraphStart;
964 SInt32 outParagraphEnd;
Jack Jansen97ed9072000-09-08 22:06:16 +0000965 if (!PyArg_ParseTuple(_args, "lB",
Jack Jansenb99e5212002-01-11 12:37:15 +0000966 &inOffset,
967 &inEdge))
Jack Jansen2369a981998-02-20 15:57:30 +0000968 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000969 WEFindParagraph(inOffset,
970 inEdge,
971 &outParagraphStart,
972 &outParagraphEnd,
Jack Jansen2369a981998-02-20 15:57:30 +0000973 _self->ob_itself);
974 _res = Py_BuildValue("ll",
Jack Jansenb99e5212002-01-11 12:37:15 +0000975 outParagraphStart,
976 outParagraphEnd);
977 return _res;
978}
979
980static PyObject *wasteObj_WEFind(wasteObject *_self, PyObject *_args)
981{
982 PyObject *_res = NULL;
983 OSErr _err;
984 char* inKey;
985 SInt32 inKeyLength;
986 TextEncoding inKeyEncoding;
987 OptionBits inMatchOptions;
988 SInt32 inRangeStart;
989 SInt32 inRangeEnd;
990 SInt32 outMatchStart;
991 SInt32 outMatchEnd;
992 if (!PyArg_ParseTuple(_args, "slllll",
993 &inKey,
994 &inKeyLength,
995 &inKeyEncoding,
996 &inMatchOptions,
997 &inRangeStart,
998 &inRangeEnd))
999 return NULL;
1000 _err = WEFind(inKey,
1001 inKeyLength,
1002 inKeyEncoding,
1003 inMatchOptions,
1004 inRangeStart,
1005 inRangeEnd,
1006 &outMatchStart,
1007 &outMatchEnd,
1008 _self->ob_itself);
1009 if (_err != noErr) return PyMac_Error(_err);
1010 _res = Py_BuildValue("ll",
1011 outMatchStart,
1012 outMatchEnd);
1013 return _res;
1014}
1015
1016static PyObject *wasteObj_WEStreamRange(wasteObject *_self, PyObject *_args)
1017{
1018 PyObject *_res = NULL;
1019 OSErr _err;
1020 SInt32 inRangeStart;
1021 SInt32 inRangeEnd;
1022 FlavorType inRequestedType;
1023 OptionBits inStreamOptions;
1024 Handle outData;
1025 if (!PyArg_ParseTuple(_args, "llO&lO&",
1026 &inRangeStart,
1027 &inRangeEnd,
1028 PyMac_GetOSType, &inRequestedType,
1029 &inStreamOptions,
1030 ResObj_Convert, &outData))
1031 return NULL;
1032 _err = WEStreamRange(inRangeStart,
1033 inRangeEnd,
1034 inRequestedType,
1035 inStreamOptions,
1036 outData,
1037 _self->ob_itself);
1038 if (_err != noErr) return PyMac_Error(_err);
1039 Py_INCREF(Py_None);
1040 _res = Py_None;
Jack Jansen2369a981998-02-20 15:57:30 +00001041 return _res;
1042}
1043
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001044static PyObject *wasteObj_WECopyRange(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001045{
1046 PyObject *_res = NULL;
1047 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001048 SInt32 inRangeStart;
1049 SInt32 inRangeEnd;
1050 Handle outText;
1051 StScrpHandle outStyles;
1052 WESoupHandle outSoup;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001053 if (!PyArg_ParseTuple(_args, "llO&O&O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001054 &inRangeStart,
1055 &inRangeEnd,
1056 OptResObj_Convert, &outText,
1057 OptResObj_Convert, &outStyles,
1058 OptResObj_Convert, &outSoup))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001059 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001060 _err = WECopyRange(inRangeStart,
1061 inRangeEnd,
1062 outText,
1063 outStyles,
1064 outSoup,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001065 _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 Jansenb99e5212002-01-11 12:37:15 +00001072static PyObject *wasteObj_WEGetTextRangeAsUnicode(wasteObject *_self, PyObject *_args)
1073{
1074 PyObject *_res = NULL;
1075 OSErr _err;
1076 SInt32 inRangeStart;
1077 SInt32 inRangeEnd;
1078 Handle outUnicodeText;
1079 Handle ioCharFormat;
1080 Handle ioParaFormat;
1081 TextEncodingVariant inUnicodeVariant;
1082 TextEncodingFormat inTransformationFormat;
1083 OptionBits inGetOptions;
1084 if (!PyArg_ParseTuple(_args, "llO&O&O&lll",
1085 &inRangeStart,
1086 &inRangeEnd,
1087 ResObj_Convert, &outUnicodeText,
1088 ResObj_Convert, &ioCharFormat,
1089 ResObj_Convert, &ioParaFormat,
1090 &inUnicodeVariant,
1091 &inTransformationFormat,
1092 &inGetOptions))
1093 return NULL;
1094 _err = WEGetTextRangeAsUnicode(inRangeStart,
1095 inRangeEnd,
1096 outUnicodeText,
1097 ioCharFormat,
1098 ioParaFormat,
1099 inUnicodeVariant,
1100 inTransformationFormat,
1101 inGetOptions,
1102 _self->ob_itself);
1103 if (_err != noErr) return PyMac_Error(_err);
1104 Py_INCREF(Py_None);
1105 _res = Py_None;
1106 return _res;
1107}
1108
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001109static PyObject *wasteObj_WEGetAlignment(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001110{
1111 PyObject *_res = NULL;
1112 WEAlignment _rv;
1113 if (!PyArg_ParseTuple(_args, ""))
1114 return NULL;
1115 _rv = WEGetAlignment(_self->ob_itself);
Jack Jansen97ed9072000-09-08 22:06:16 +00001116 _res = Py_BuildValue("B",
Jack Jansen90ecdf41996-04-16 14:29:15 +00001117 _rv);
1118 return _res;
1119}
1120
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001121static PyObject *wasteObj_WESetAlignment(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001122{
1123 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001124 WEAlignment inAlignment;
Jack Jansen97ed9072000-09-08 22:06:16 +00001125 if (!PyArg_ParseTuple(_args, "B",
Jack Jansenb99e5212002-01-11 12:37:15 +00001126 &inAlignment))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001127 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001128 WESetAlignment(inAlignment,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001129 _self->ob_itself);
1130 Py_INCREF(Py_None);
1131 _res = Py_None;
1132 return _res;
1133}
1134
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001135static PyObject *wasteObj_WEGetDirection(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00001136{
1137 PyObject *_res = NULL;
1138 WEDirection _rv;
1139 if (!PyArg_ParseTuple(_args, ""))
1140 return NULL;
1141 _rv = WEGetDirection(_self->ob_itself);
1142 _res = Py_BuildValue("h",
1143 _rv);
1144 return _res;
1145}
1146
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001147static PyObject *wasteObj_WESetDirection(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00001148{
1149 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001150 WEDirection inDirection;
Jack Jansen2369a981998-02-20 15:57:30 +00001151 if (!PyArg_ParseTuple(_args, "h",
Jack Jansenb99e5212002-01-11 12:37:15 +00001152 &inDirection))
Jack Jansen2369a981998-02-20 15:57:30 +00001153 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001154 WESetDirection(inDirection,
Jack Jansen2369a981998-02-20 15:57:30 +00001155 _self->ob_itself);
1156 Py_INCREF(Py_None);
1157 _res = Py_None;
1158 return _res;
1159}
1160
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001161static PyObject *wasteObj_WECalText(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001162{
1163 PyObject *_res = NULL;
1164 OSErr _err;
1165 if (!PyArg_ParseTuple(_args, ""))
1166 return NULL;
1167 _err = WECalText(_self->ob_itself);
1168 if (_err != noErr) return PyMac_Error(_err);
1169 Py_INCREF(Py_None);
1170 _res = Py_None;
1171 return _res;
1172}
1173
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001174static PyObject *wasteObj_WEUpdate(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001175{
1176 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001177 RgnHandle inUpdateRgn;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001178 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001179 ResObj_Convert, &inUpdateRgn))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001180 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001181 WEUpdate(inUpdateRgn,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001182 _self->ob_itself);
1183 Py_INCREF(Py_None);
1184 _res = Py_None;
1185 return _res;
1186}
1187
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001188static PyObject *wasteObj_WEScroll(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001189{
1190 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001191 SInt32 inHorizontalOffset;
1192 SInt32 inVerticalOffset;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001193 if (!PyArg_ParseTuple(_args, "ll",
Jack Jansenb99e5212002-01-11 12:37:15 +00001194 &inHorizontalOffset,
1195 &inVerticalOffset))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001196 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001197 WEScroll(inHorizontalOffset,
1198 inVerticalOffset,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001199 _self->ob_itself);
1200 Py_INCREF(Py_None);
1201 _res = Py_None;
1202 return _res;
1203}
1204
Jack Jansenb99e5212002-01-11 12:37:15 +00001205static PyObject *wasteObj_WEPinScroll(wasteObject *_self, PyObject *_args)
1206{
1207 PyObject *_res = NULL;
1208 SInt32 inHorizontalOffset;
1209 SInt32 inVerticalOffset;
1210 if (!PyArg_ParseTuple(_args, "ll",
1211 &inHorizontalOffset,
1212 &inVerticalOffset))
1213 return NULL;
1214 WEPinScroll(inHorizontalOffset,
1215 inVerticalOffset,
1216 _self->ob_itself);
1217 Py_INCREF(Py_None);
1218 _res = Py_None;
1219 return _res;
1220}
1221
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001222static PyObject *wasteObj_WESelView(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001223{
1224 PyObject *_res = NULL;
1225 if (!PyArg_ParseTuple(_args, ""))
1226 return NULL;
1227 WESelView(_self->ob_itself);
1228 Py_INCREF(Py_None);
1229 _res = Py_None;
1230 return _res;
1231}
1232
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001233static PyObject *wasteObj_WEActivate(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001234{
1235 PyObject *_res = NULL;
1236 if (!PyArg_ParseTuple(_args, ""))
1237 return NULL;
1238 WEActivate(_self->ob_itself);
1239 Py_INCREF(Py_None);
1240 _res = Py_None;
1241 return _res;
1242}
1243
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001244static PyObject *wasteObj_WEDeactivate(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001245{
1246 PyObject *_res = NULL;
1247 if (!PyArg_ParseTuple(_args, ""))
1248 return NULL;
1249 WEDeactivate(_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_WEKey(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001256{
1257 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001258 CharParameter inKey;
1259 EventModifiers inModifiers;
Jack Jansen9d8b96c2000-07-14 22:16:45 +00001260 if (!PyArg_ParseTuple(_args, "hH",
Jack Jansenb99e5212002-01-11 12:37:15 +00001261 &inKey,
1262 &inModifiers))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001263 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001264 WEKey(inKey,
1265 inModifiers,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001266 _self->ob_itself);
1267 Py_INCREF(Py_None);
1268 _res = Py_None;
1269 return _res;
1270}
1271
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001272static PyObject *wasteObj_WEClick(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001273{
1274 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001275 Point inHitPoint;
1276 EventModifiers inModifiers;
1277 UInt32 inClickTime;
Jack Jansen9d8b96c2000-07-14 22:16:45 +00001278 if (!PyArg_ParseTuple(_args, "O&Hl",
Jack Jansenb99e5212002-01-11 12:37:15 +00001279 PyMac_GetPoint, &inHitPoint,
1280 &inModifiers,
1281 &inClickTime))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001282 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001283 WEClick(inHitPoint,
1284 inModifiers,
1285 inClickTime,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001286 _self->ob_itself);
1287 Py_INCREF(Py_None);
1288 _res = Py_None;
1289 return _res;
1290}
1291
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001292static PyObject *wasteObj_WEAdjustCursor(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001293{
1294 PyObject *_res = NULL;
1295 Boolean _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00001296 Point inMouseLoc;
1297 RgnHandle ioMouseRgn;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001298 if (!PyArg_ParseTuple(_args, "O&O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001299 PyMac_GetPoint, &inMouseLoc,
1300 ResObj_Convert, &ioMouseRgn))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001301 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001302 _rv = WEAdjustCursor(inMouseLoc,
1303 ioMouseRgn,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001304 _self->ob_itself);
1305 _res = Py_BuildValue("b",
1306 _rv);
1307 return _res;
1308}
1309
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001310static PyObject *wasteObj_WEIdle(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001311{
1312 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001313 UInt32 outMaxSleep;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001314 if (!PyArg_ParseTuple(_args, ""))
1315 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001316 WEIdle(&outMaxSleep,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001317 _self->ob_itself);
1318 _res = Py_BuildValue("l",
Jack Jansenb99e5212002-01-11 12:37:15 +00001319 outMaxSleep);
Jack Jansen90ecdf41996-04-16 14:29:15 +00001320 return _res;
1321}
1322
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001323static PyObject *wasteObj_WEInsert(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001324{
1325 PyObject *_res = NULL;
1326 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001327 char *inTextPtr__in__;
1328 long inTextPtr__len__;
1329 int inTextPtr__in_len__;
1330 StScrpHandle inStyles;
1331 WESoupHandle inSoup;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001332 if (!PyArg_ParseTuple(_args, "s#O&O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001333 &inTextPtr__in__, &inTextPtr__in_len__,
1334 OptResObj_Convert, &inStyles,
1335 OptResObj_Convert, &inSoup))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001336 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001337 inTextPtr__len__ = inTextPtr__in_len__;
1338 _err = WEInsert(inTextPtr__in__, inTextPtr__len__,
1339 inStyles,
1340 inSoup,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001341 _self->ob_itself);
1342 if (_err != noErr) return PyMac_Error(_err);
1343 Py_INCREF(Py_None);
1344 _res = Py_None;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001345 return _res;
1346}
1347
Jack Jansenb99e5212002-01-11 12:37:15 +00001348static PyObject *wasteObj_WEInsertFormattedText(wasteObject *_self, PyObject *_args)
1349{
1350 PyObject *_res = NULL;
1351 OSErr _err;
1352 char *inTextPtr__in__;
1353 long inTextPtr__len__;
1354 int inTextPtr__in_len__;
1355 StScrpHandle inStyles;
1356 WESoupHandle inSoup;
1357 Handle inParaFormat;
1358 Handle inRulerScrap;
1359 if (!PyArg_ParseTuple(_args, "s#O&O&O&O&",
1360 &inTextPtr__in__, &inTextPtr__in_len__,
1361 OptResObj_Convert, &inStyles,
1362 OptResObj_Convert, &inSoup,
1363 ResObj_Convert, &inParaFormat,
1364 ResObj_Convert, &inRulerScrap))
1365 return NULL;
1366 inTextPtr__len__ = inTextPtr__in_len__;
1367 _err = WEInsertFormattedText(inTextPtr__in__, inTextPtr__len__,
1368 inStyles,
1369 inSoup,
1370 inParaFormat,
1371 inRulerScrap,
1372 _self->ob_itself);
1373 if (_err != noErr) return PyMac_Error(_err);
1374 Py_INCREF(Py_None);
1375 _res = Py_None;
1376 return _res;
1377}
1378
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001379static PyObject *wasteObj_WEDelete(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001380{
1381 PyObject *_res = NULL;
1382 OSErr _err;
1383 if (!PyArg_ParseTuple(_args, ""))
1384 return NULL;
1385 _err = WEDelete(_self->ob_itself);
1386 if (_err != noErr) return PyMac_Error(_err);
1387 Py_INCREF(Py_None);
1388 _res = Py_None;
1389 return _res;
1390}
1391
Jack Jansenb99e5212002-01-11 12:37:15 +00001392static PyObject *wasteObj_WEUseText(wasteObject *_self, PyObject *_args)
1393{
1394 PyObject *_res = NULL;
1395 OSErr _err;
1396 Handle inText;
1397 if (!PyArg_ParseTuple(_args, "O&",
1398 ResObj_Convert, &inText))
1399 return NULL;
1400 _err = WEUseText(inText,
1401 _self->ob_itself);
1402 if (_err != noErr) return PyMac_Error(_err);
1403 Py_INCREF(Py_None);
1404 _res = Py_None;
1405 return _res;
1406}
1407
1408static PyObject *wasteObj_WEChangeCase(wasteObject *_self, PyObject *_args)
1409{
1410 PyObject *_res = NULL;
1411 OSErr _err;
1412 SInt16 inCase;
1413 if (!PyArg_ParseTuple(_args, "h",
1414 &inCase))
1415 return NULL;
1416 _err = WEChangeCase(inCase,
1417 _self->ob_itself);
1418 if (_err != noErr) return PyMac_Error(_err);
1419 Py_INCREF(Py_None);
1420 _res = Py_None;
1421 return _res;
1422}
1423
1424static PyObject *wasteObj_WESetOneAttribute(wasteObject *_self, PyObject *_args)
1425{
1426 PyObject *_res = NULL;
1427 OSErr _err;
1428 SInt32 inRangeStart;
1429 SInt32 inRangeEnd;
1430 WESelector inAttributeSelector;
1431 char *inAttributeValue__in__;
1432 long inAttributeValue__len__;
1433 int inAttributeValue__in_len__;
1434 if (!PyArg_ParseTuple(_args, "llO&s#",
1435 &inRangeStart,
1436 &inRangeEnd,
1437 PyMac_GetOSType, &inAttributeSelector,
1438 &inAttributeValue__in__, &inAttributeValue__in_len__))
1439 return NULL;
1440 inAttributeValue__len__ = inAttributeValue__in_len__;
1441 _err = WESetOneAttribute(inRangeStart,
1442 inRangeEnd,
1443 inAttributeSelector,
1444 inAttributeValue__in__, inAttributeValue__len__,
1445 _self->ob_itself);
1446 if (_err != noErr) return PyMac_Error(_err);
1447 Py_INCREF(Py_None);
1448 _res = Py_None;
1449 return _res;
1450}
1451
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001452static PyObject *wasteObj_WESetStyle(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001453{
1454 PyObject *_res = NULL;
1455 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001456 WEStyleMode inMode;
1457 TextStyle inTextStyle;
Jack Jansen9d8b96c2000-07-14 22:16:45 +00001458 if (!PyArg_ParseTuple(_args, "HO&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001459 &inMode,
1460 TextStyle_Convert, &inTextStyle))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001461 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001462 _err = WESetStyle(inMode,
1463 &inTextStyle,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001464 _self->ob_itself);
1465 if (_err != noErr) return PyMac_Error(_err);
1466 Py_INCREF(Py_None);
1467 _res = Py_None;
1468 return _res;
1469}
1470
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001471static PyObject *wasteObj_WEUseStyleScrap(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001472{
1473 PyObject *_res = NULL;
1474 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001475 StScrpHandle inStyles;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001476 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001477 ResObj_Convert, &inStyles))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001478 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001479 _err = WEUseStyleScrap(inStyles,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001480 _self->ob_itself);
1481 if (_err != noErr) return PyMac_Error(_err);
1482 Py_INCREF(Py_None);
1483 _res = Py_None;
1484 return _res;
1485}
1486
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001487static PyObject *wasteObj_WEUndo(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001488{
1489 PyObject *_res = NULL;
1490 OSErr _err;
1491 if (!PyArg_ParseTuple(_args, ""))
1492 return NULL;
1493 _err = WEUndo(_self->ob_itself);
1494 if (_err != noErr) return PyMac_Error(_err);
1495 Py_INCREF(Py_None);
1496 _res = Py_None;
1497 return _res;
1498}
1499
Jack Jansenb99e5212002-01-11 12:37:15 +00001500static PyObject *wasteObj_WERedo(wasteObject *_self, PyObject *_args)
1501{
1502 PyObject *_res = NULL;
1503 OSErr _err;
1504 if (!PyArg_ParseTuple(_args, ""))
1505 return NULL;
1506 _err = WERedo(_self->ob_itself);
1507 if (_err != noErr) return PyMac_Error(_err);
1508 Py_INCREF(Py_None);
1509 _res = Py_None;
1510 return _res;
1511}
1512
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001513static PyObject *wasteObj_WEClearUndo(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001514{
1515 PyObject *_res = NULL;
1516 if (!PyArg_ParseTuple(_args, ""))
1517 return NULL;
1518 WEClearUndo(_self->ob_itself);
1519 Py_INCREF(Py_None);
1520 _res = Py_None;
1521 return _res;
1522}
1523
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001524static PyObject *wasteObj_WEGetUndoInfo(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001525{
1526 PyObject *_res = NULL;
1527 WEActionKind _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00001528 Boolean outRedoFlag;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001529 if (!PyArg_ParseTuple(_args, ""))
1530 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001531 _rv = WEGetUndoInfo(&outRedoFlag,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001532 _self->ob_itself);
1533 _res = Py_BuildValue("hb",
1534 _rv,
Jack Jansenb99e5212002-01-11 12:37:15 +00001535 outRedoFlag);
1536 return _res;
1537}
1538
1539static PyObject *wasteObj_WEGetIndUndoInfo(wasteObject *_self, PyObject *_args)
1540{
1541 PyObject *_res = NULL;
1542 WEActionKind _rv;
1543 SInt32 inUndoLevel;
1544 if (!PyArg_ParseTuple(_args, "l",
1545 &inUndoLevel))
1546 return NULL;
1547 _rv = WEGetIndUndoInfo(inUndoLevel,
1548 _self->ob_itself);
1549 _res = Py_BuildValue("h",
1550 _rv);
Jack Jansen90ecdf41996-04-16 14:29:15 +00001551 return _res;
1552}
1553
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001554static PyObject *wasteObj_WEIsTyping(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001555{
1556 PyObject *_res = NULL;
1557 Boolean _rv;
1558 if (!PyArg_ParseTuple(_args, ""))
1559 return NULL;
1560 _rv = WEIsTyping(_self->ob_itself);
1561 _res = Py_BuildValue("b",
1562 _rv);
1563 return _res;
1564}
1565
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001566static PyObject *wasteObj_WEBeginAction(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00001567{
1568 PyObject *_res = NULL;
1569 OSErr _err;
1570 if (!PyArg_ParseTuple(_args, ""))
1571 return NULL;
1572 _err = WEBeginAction(_self->ob_itself);
1573 if (_err != noErr) return PyMac_Error(_err);
1574 Py_INCREF(Py_None);
1575 _res = Py_None;
1576 return _res;
1577}
1578
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001579static PyObject *wasteObj_WEEndAction(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00001580{
1581 PyObject *_res = NULL;
1582 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001583 WEActionKind inActionKind;
Jack Jansen2369a981998-02-20 15:57:30 +00001584 if (!PyArg_ParseTuple(_args, "h",
Jack Jansenb99e5212002-01-11 12:37:15 +00001585 &inActionKind))
Jack Jansen2369a981998-02-20 15:57:30 +00001586 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001587 _err = WEEndAction(inActionKind,
Jack Jansen2369a981998-02-20 15:57:30 +00001588 _self->ob_itself);
1589 if (_err != noErr) return PyMac_Error(_err);
1590 Py_INCREF(Py_None);
1591 _res = Py_None;
1592 return _res;
1593}
1594
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001595static PyObject *wasteObj_WEGetModCount(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001596{
1597 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +00001598 UInt32 _rv;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001599 if (!PyArg_ParseTuple(_args, ""))
1600 return NULL;
1601 _rv = WEGetModCount(_self->ob_itself);
1602 _res = Py_BuildValue("l",
1603 _rv);
1604 return _res;
1605}
1606
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001607static PyObject *wasteObj_WEResetModCount(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001608{
1609 PyObject *_res = NULL;
1610 if (!PyArg_ParseTuple(_args, ""))
1611 return NULL;
1612 WEResetModCount(_self->ob_itself);
1613 Py_INCREF(Py_None);
1614 _res = Py_None;
1615 return _res;
1616}
1617
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001618static PyObject *wasteObj_WEInsertObject(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001619{
1620 PyObject *_res = NULL;
1621 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001622 FlavorType inObjectType;
1623 Handle inObjectDataHandle;
1624 Point inObjectSize;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001625 if (!PyArg_ParseTuple(_args, "O&O&O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001626 PyMac_GetOSType, &inObjectType,
1627 ResObj_Convert, &inObjectDataHandle,
1628 PyMac_GetPoint, &inObjectSize))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001629 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001630 _err = WEInsertObject(inObjectType,
1631 inObjectDataHandle,
1632 inObjectSize,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001633 _self->ob_itself);
1634 if (_err != noErr) return PyMac_Error(_err);
1635 Py_INCREF(Py_None);
1636 _res = Py_None;
1637 return _res;
1638}
1639
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001640static PyObject *wasteObj_WEGetSelectedObject(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001641{
1642 PyObject *_res = NULL;
1643 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001644 WEObjectReference outObject;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001645 if (!PyArg_ParseTuple(_args, ""))
1646 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001647 _err = WEGetSelectedObject(&outObject,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001648 _self->ob_itself);
1649 if (_err != noErr) return PyMac_Error(_err);
1650 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001651 WEOObj_New, outObject);
1652 return _res;
1653}
1654
1655static PyObject *wasteObj_WEGetObjectAtOffset(wasteObject *_self, PyObject *_args)
1656{
1657 PyObject *_res = NULL;
1658 OSErr _err;
1659 SInt32 inOffset;
1660 WEObjectReference outObject;
1661 if (!PyArg_ParseTuple(_args, "l",
1662 &inOffset))
1663 return NULL;
1664 _err = WEGetObjectAtOffset(inOffset,
1665 &outObject,
1666 _self->ob_itself);
1667 if (_err != noErr) return PyMac_Error(_err);
1668 _res = Py_BuildValue("O&",
1669 WEOObj_New, outObject);
Jack Jansen90ecdf41996-04-16 14:29:15 +00001670 return _res;
1671}
1672
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001673static PyObject *wasteObj_WEFindNextObject(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001674{
1675 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +00001676 SInt32 _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00001677 SInt32 inOffset;
1678 WEObjectReference outObject;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001679 if (!PyArg_ParseTuple(_args, "l",
Jack Jansenb99e5212002-01-11 12:37:15 +00001680 &inOffset))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001681 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001682 _rv = WEFindNextObject(inOffset,
1683 &outObject,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001684 _self->ob_itself);
1685 _res = Py_BuildValue("lO&",
1686 _rv,
Jack Jansenb99e5212002-01-11 12:37:15 +00001687 WEOObj_New, outObject);
Jack Jansen90ecdf41996-04-16 14:29:15 +00001688 return _res;
1689}
1690
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001691static PyObject *wasteObj_WEUseSoup(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001692{
1693 PyObject *_res = NULL;
1694 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001695 WESoupHandle inSoup;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001696 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001697 ResObj_Convert, &inSoup))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001698 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001699 _err = WEUseSoup(inSoup,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001700 _self->ob_itself);
1701 if (_err != noErr) return PyMac_Error(_err);
1702 Py_INCREF(Py_None);
1703 _res = Py_None;
1704 return _res;
1705}
1706
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001707static PyObject *wasteObj_WECut(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001708{
1709 PyObject *_res = NULL;
1710 OSErr _err;
1711 if (!PyArg_ParseTuple(_args, ""))
1712 return NULL;
1713 _err = WECut(_self->ob_itself);
1714 if (_err != noErr) return PyMac_Error(_err);
1715 Py_INCREF(Py_None);
1716 _res = Py_None;
1717 return _res;
1718}
1719
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001720static PyObject *wasteObj_WECopy(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001721{
1722 PyObject *_res = NULL;
1723 OSErr _err;
1724 if (!PyArg_ParseTuple(_args, ""))
1725 return NULL;
1726 _err = WECopy(_self->ob_itself);
1727 if (_err != noErr) return PyMac_Error(_err);
1728 Py_INCREF(Py_None);
1729 _res = Py_None;
1730 return _res;
1731}
1732
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001733static PyObject *wasteObj_WEPaste(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001734{
1735 PyObject *_res = NULL;
1736 OSErr _err;
1737 if (!PyArg_ParseTuple(_args, ""))
1738 return NULL;
1739 _err = WEPaste(_self->ob_itself);
1740 if (_err != noErr) return PyMac_Error(_err);
1741 Py_INCREF(Py_None);
1742 _res = Py_None;
1743 return _res;
1744}
1745
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001746static PyObject *wasteObj_WECanPaste(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001747{
1748 PyObject *_res = NULL;
1749 Boolean _rv;
1750 if (!PyArg_ParseTuple(_args, ""))
1751 return NULL;
1752 _rv = WECanPaste(_self->ob_itself);
1753 _res = Py_BuildValue("b",
1754 _rv);
1755 return _res;
1756}
1757
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001758static PyObject *wasteObj_WEGetHiliteRgn(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001759{
1760 PyObject *_res = NULL;
1761 RgnHandle _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00001762 SInt32 inRangeStart;
1763 SInt32 inRangeEnd;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001764 if (!PyArg_ParseTuple(_args, "ll",
Jack Jansenb99e5212002-01-11 12:37:15 +00001765 &inRangeStart,
1766 &inRangeEnd))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001767 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001768 _rv = WEGetHiliteRgn(inRangeStart,
1769 inRangeEnd,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001770 _self->ob_itself);
1771 _res = Py_BuildValue("O&",
1772 ResObj_New, _rv);
1773 return _res;
1774}
1775
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001776static PyObject *wasteObj_WECharByte(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001777{
1778 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +00001779 SInt16 _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00001780 SInt32 inOffset;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001781 if (!PyArg_ParseTuple(_args, "l",
Jack Jansenb99e5212002-01-11 12:37:15 +00001782 &inOffset))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001783 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001784 _rv = WECharByte(inOffset,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001785 _self->ob_itself);
1786 _res = Py_BuildValue("h",
1787 _rv);
1788 return _res;
1789}
1790
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001791static PyObject *wasteObj_WECharType(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001792{
1793 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +00001794 SInt16 _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00001795 SInt32 inOffset;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001796 if (!PyArg_ParseTuple(_args, "l",
Jack Jansenb99e5212002-01-11 12:37:15 +00001797 &inOffset))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001798 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001799 _rv = WECharType(inOffset,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001800 _self->ob_itself);
1801 _res = Py_BuildValue("h",
1802 _rv);
1803 return _res;
1804}
1805
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001806static PyObject *wasteObj_WEStopInlineSession(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001807{
1808 PyObject *_res = NULL;
1809 if (!PyArg_ParseTuple(_args, ""))
1810 return NULL;
1811 WEStopInlineSession(_self->ob_itself);
1812 Py_INCREF(Py_None);
1813 _res = Py_None;
1814 return _res;
1815}
1816
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001817static PyObject *wasteObj_WEFeatureFlag(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001818{
1819 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +00001820 SInt16 _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00001821 SInt16 inFeature;
1822 SInt16 inAction;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001823 if (!PyArg_ParseTuple(_args, "hh",
Jack Jansenb99e5212002-01-11 12:37:15 +00001824 &inFeature,
1825 &inAction))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001826 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001827 _rv = WEFeatureFlag(inFeature,
1828 inAction,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001829 _self->ob_itself);
1830 _res = Py_BuildValue("h",
1831 _rv);
1832 return _res;
1833}
1834
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001835static PyObject *wasteObj_WEGetUserInfo(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00001836{
1837 PyObject *_res = NULL;
1838 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001839 WESelector inUserTag;
1840 SInt32 outUserInfo;
Jack Jansen2369a981998-02-20 15:57:30 +00001841 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001842 PyMac_GetOSType, &inUserTag))
Jack Jansen2369a981998-02-20 15:57:30 +00001843 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001844 _err = WEGetUserInfo(inUserTag,
1845 &outUserInfo,
Jack Jansen2369a981998-02-20 15:57:30 +00001846 _self->ob_itself);
1847 if (_err != noErr) return PyMac_Error(_err);
1848 _res = Py_BuildValue("l",
Jack Jansenb99e5212002-01-11 12:37:15 +00001849 outUserInfo);
Jack Jansen2369a981998-02-20 15:57:30 +00001850 return _res;
1851}
1852
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001853static PyObject *wasteObj_WESetUserInfo(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00001854{
1855 PyObject *_res = NULL;
1856 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001857 WESelector inUserTag;
1858 SInt32 inUserInfo;
Jack Jansen2369a981998-02-20 15:57:30 +00001859 if (!PyArg_ParseTuple(_args, "O&l",
Jack Jansenb99e5212002-01-11 12:37:15 +00001860 PyMac_GetOSType, &inUserTag,
1861 &inUserInfo))
Jack Jansen2369a981998-02-20 15:57:30 +00001862 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001863 _err = WESetUserInfo(inUserTag,
1864 inUserInfo,
Jack Jansen2369a981998-02-20 15:57:30 +00001865 _self->ob_itself);
1866 if (_err != noErr) return PyMac_Error(_err);
1867 Py_INCREF(Py_None);
1868 _res = Py_None;
1869 return _res;
1870}
1871
Jack Jansenb99e5212002-01-11 12:37:15 +00001872static PyObject *wasteObj_WERemoveUserInfo(wasteObject *_self, PyObject *_args)
1873{
1874 PyObject *_res = NULL;
1875 OSErr _err;
1876 WESelector inUserTag;
1877 if (!PyArg_ParseTuple(_args, "O&",
1878 PyMac_GetOSType, &inUserTag))
1879 return NULL;
1880 _err = WERemoveUserInfo(inUserTag,
1881 _self->ob_itself);
1882 if (_err != noErr) return PyMac_Error(_err);
1883 Py_INCREF(Py_None);
1884 _res = Py_None;
1885 return _res;
1886}
1887
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001888static PyObject *wasteObj_WEInstallTabHooks(wasteObject *_self, PyObject *_args)
Jack Jansen176f3a91996-10-23 15:43:46 +00001889{
1890 PyObject *_res = NULL;
1891 OSErr _err;
1892 if (!PyArg_ParseTuple(_args, ""))
1893 return NULL;
1894 _err = WEInstallTabHooks(_self->ob_itself);
1895 if (_err != noErr) return PyMac_Error(_err);
1896 Py_INCREF(Py_None);
1897 _res = Py_None;
1898 return _res;
1899}
1900
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001901static PyObject *wasteObj_WERemoveTabHooks(wasteObject *_self, PyObject *_args)
Jack Jansen176f3a91996-10-23 15:43:46 +00001902{
1903 PyObject *_res = NULL;
1904 OSErr _err;
1905 if (!PyArg_ParseTuple(_args, ""))
1906 return NULL;
1907 _err = WERemoveTabHooks(_self->ob_itself);
1908 if (_err != noErr) return PyMac_Error(_err);
1909 Py_INCREF(Py_None);
1910 _res = Py_None;
1911 return _res;
1912}
1913
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001914static PyObject *wasteObj_WEIsTabHooks(wasteObject *_self, PyObject *_args)
Jack Jansen176f3a91996-10-23 15:43:46 +00001915{
1916 PyObject *_res = NULL;
1917 Boolean _rv;
1918 if (!PyArg_ParseTuple(_args, ""))
1919 return NULL;
1920 _rv = WEIsTabHooks(_self->ob_itself);
1921 _res = Py_BuildValue("b",
1922 _rv);
1923 return _res;
1924}
1925
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001926static PyObject *wasteObj_WEGetTabSize(wasteObject *_self, PyObject *_args)
Jack Jansena4f03091998-03-02 16:56:18 +00001927{
1928 PyObject *_res = NULL;
1929 SInt16 _rv;
1930 if (!PyArg_ParseTuple(_args, ""))
1931 return NULL;
1932 _rv = WEGetTabSize(_self->ob_itself);
1933 _res = Py_BuildValue("h",
1934 _rv);
1935 return _res;
1936}
1937
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001938static PyObject *wasteObj_WESetTabSize(wasteObject *_self, PyObject *_args)
Jack Jansena4f03091998-03-02 16:56:18 +00001939{
1940 PyObject *_res = NULL;
1941 OSErr _err;
1942 SInt16 tabWidth;
1943 if (!PyArg_ParseTuple(_args, "h",
1944 &tabWidth))
1945 return NULL;
1946 _err = WESetTabSize(tabWidth,
1947 _self->ob_itself);
1948 if (_err != noErr) return PyMac_Error(_err);
1949 Py_INCREF(Py_None);
1950 _res = Py_None;
1951 return _res;
1952}
1953
Jack Jansen90ecdf41996-04-16 14:29:15 +00001954static PyMethodDef wasteObj_methods[] = {
1955 {"WEGetText", (PyCFunction)wasteObj_WEGetText, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001956 PyDoc_STR("() -> (Handle _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001957 {"WEGetChar", (PyCFunction)wasteObj_WEGetChar, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001958 PyDoc_STR("(SInt32 inOffset) -> (SInt16 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001959 {"WEGetTextLength", (PyCFunction)wasteObj_WEGetTextLength, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001960 PyDoc_STR("() -> (SInt32 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001961 {"WEGetSelection", (PyCFunction)wasteObj_WEGetSelection, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001962 PyDoc_STR("() -> (SInt32 outSelStart, SInt32 outSelEnd)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001963 {"WEGetDestRect", (PyCFunction)wasteObj_WEGetDestRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001964 PyDoc_STR("() -> (LongRect outDestRect)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001965 {"WEGetViewRect", (PyCFunction)wasteObj_WEGetViewRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001966 PyDoc_STR("() -> (LongRect outViewRect)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001967 {"WEIsActive", (PyCFunction)wasteObj_WEIsActive, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001968 PyDoc_STR("() -> (Boolean _rv)")},
Jack Jansen2268af51996-08-06 16:04:22 +00001969 {"WEGetClickCount", (PyCFunction)wasteObj_WEGetClickCount, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001970 PyDoc_STR("() -> (UInt16 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001971 {"WESetSelection", (PyCFunction)wasteObj_WESetSelection, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001972 PyDoc_STR("(SInt32 inSelStart, SInt32 inSelEnd) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001973 {"WESetDestRect", (PyCFunction)wasteObj_WESetDestRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001974 PyDoc_STR("(LongRect inDestRect) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001975 {"WESetViewRect", (PyCFunction)wasteObj_WESetViewRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001976 PyDoc_STR("(LongRect inViewRect) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001977 {"WEContinuousStyle", (PyCFunction)wasteObj_WEContinuousStyle, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001978 PyDoc_STR("(WEStyleMode ioMode) -> (Boolean _rv, WEStyleMode ioMode, TextStyle outTextStyle)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001979 {"WECountRuns", (PyCFunction)wasteObj_WECountRuns, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001980 PyDoc_STR("() -> (SInt32 _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001981 {"WEOffsetToRun", (PyCFunction)wasteObj_WEOffsetToRun, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001982 PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001983 {"WEGetRunRange", (PyCFunction)wasteObj_WEGetRunRange, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001984 PyDoc_STR("(SInt32 inStyleRunIndex) -> (SInt32 outStyleRunStart, SInt32 outStyleRunEnd)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001985 {"WEGetRunInfo", (PyCFunction)wasteObj_WEGetRunInfo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001986 PyDoc_STR("(SInt32 inOffset) -> (WERunInfo outStyleRunInfo)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001987 {"WEGetIndRunInfo", (PyCFunction)wasteObj_WEGetIndRunInfo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001988 PyDoc_STR("(SInt32 inStyleRunIndex) -> (WERunInfo outStyleRunInfo)")},
Jack Jansen2369a981998-02-20 15:57:30 +00001989 {"WEGetRunDirection", (PyCFunction)wasteObj_WEGetRunDirection, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001990 PyDoc_STR("(SInt32 inOffset) -> (Boolean _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001991 {"WECountParaRuns", (PyCFunction)wasteObj_WECountParaRuns, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001992 PyDoc_STR("() -> (SInt32 _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001993 {"WEOffsetToParaRun", (PyCFunction)wasteObj_WEOffsetToParaRun, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001994 PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001995 {"WEGetParaRunRange", (PyCFunction)wasteObj_WEGetParaRunRange, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001996 PyDoc_STR("(SInt32 inParagraphRunIndex) -> (SInt32 outParagraphRunStart, SInt32 outParagraphRunEnd)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001997 {"WECountLines", (PyCFunction)wasteObj_WECountLines, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001998 PyDoc_STR("() -> (SInt32 _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001999 {"WEOffsetToLine", (PyCFunction)wasteObj_WEOffsetToLine, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002000 PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002001 {"WEGetLineRange", (PyCFunction)wasteObj_WEGetLineRange, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002002 PyDoc_STR("(SInt32 inLineIndex) -> (SInt32 outLineStart, SInt32 outLineEnd)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002003 {"WEGetHeight", (PyCFunction)wasteObj_WEGetHeight, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002004 PyDoc_STR("(SInt32 inStartLineIndex, SInt32 inEndLineIndex) -> (SInt32 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002005 {"WEGetOffset", (PyCFunction)wasteObj_WEGetOffset, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002006 PyDoc_STR("(LongPt inPoint) -> (SInt32 _rv, WEEdge outEdge)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002007 {"WEGetPoint", (PyCFunction)wasteObj_WEGetPoint, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002008 PyDoc_STR("(SInt32 inOffset, SInt16 inDirection) -> (LongPt outPoint, SInt16 outLineHeight)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002009 {"WEFindWord", (PyCFunction)wasteObj_WEFindWord, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002010 PyDoc_STR("(SInt32 inOffset, WEEdge inEdge) -> (SInt32 outWordStart, SInt32 outWordEnd)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002011 {"WEFindLine", (PyCFunction)wasteObj_WEFindLine, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002012 PyDoc_STR("(SInt32 inOffset, WEEdge inEdge) -> (SInt32 outLineStart, SInt32 outLineEnd)")},
Jack Jansen2369a981998-02-20 15:57:30 +00002013 {"WEFindParagraph", (PyCFunction)wasteObj_WEFindParagraph, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002014 PyDoc_STR("(SInt32 inOffset, WEEdge inEdge) -> (SInt32 outParagraphStart, SInt32 outParagraphEnd)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002015 {"WEFind", (PyCFunction)wasteObj_WEFind, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002016 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 +00002017 {"WEStreamRange", (PyCFunction)wasteObj_WEStreamRange, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002018 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd, FlavorType inRequestedType, OptionBits inStreamOptions, Handle outData) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002019 {"WECopyRange", (PyCFunction)wasteObj_WECopyRange, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002020 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd, Handle outText, StScrpHandle outStyles, WESoupHandle outSoup) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002021 {"WEGetTextRangeAsUnicode", (PyCFunction)wasteObj_WEGetTextRangeAsUnicode, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002022 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 +00002023 {"WEGetAlignment", (PyCFunction)wasteObj_WEGetAlignment, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002024 PyDoc_STR("() -> (WEAlignment _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002025 {"WESetAlignment", (PyCFunction)wasteObj_WESetAlignment, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002026 PyDoc_STR("(WEAlignment inAlignment) -> None")},
Jack Jansen2369a981998-02-20 15:57:30 +00002027 {"WEGetDirection", (PyCFunction)wasteObj_WEGetDirection, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002028 PyDoc_STR("() -> (WEDirection _rv)")},
Jack Jansen2369a981998-02-20 15:57:30 +00002029 {"WESetDirection", (PyCFunction)wasteObj_WESetDirection, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002030 PyDoc_STR("(WEDirection inDirection) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002031 {"WECalText", (PyCFunction)wasteObj_WECalText, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002032 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002033 {"WEUpdate", (PyCFunction)wasteObj_WEUpdate, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002034 PyDoc_STR("(RgnHandle inUpdateRgn) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002035 {"WEScroll", (PyCFunction)wasteObj_WEScroll, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002036 PyDoc_STR("(SInt32 inHorizontalOffset, SInt32 inVerticalOffset) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002037 {"WEPinScroll", (PyCFunction)wasteObj_WEPinScroll, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002038 PyDoc_STR("(SInt32 inHorizontalOffset, SInt32 inVerticalOffset) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002039 {"WESelView", (PyCFunction)wasteObj_WESelView, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002040 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002041 {"WEActivate", (PyCFunction)wasteObj_WEActivate, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002042 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002043 {"WEDeactivate", (PyCFunction)wasteObj_WEDeactivate, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002044 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002045 {"WEKey", (PyCFunction)wasteObj_WEKey, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002046 PyDoc_STR("(CharParameter inKey, EventModifiers inModifiers) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002047 {"WEClick", (PyCFunction)wasteObj_WEClick, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002048 PyDoc_STR("(Point inHitPoint, EventModifiers inModifiers, UInt32 inClickTime) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002049 {"WEAdjustCursor", (PyCFunction)wasteObj_WEAdjustCursor, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002050 PyDoc_STR("(Point inMouseLoc, RgnHandle ioMouseRgn) -> (Boolean _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002051 {"WEIdle", (PyCFunction)wasteObj_WEIdle, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002052 PyDoc_STR("() -> (UInt32 outMaxSleep)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002053 {"WEInsert", (PyCFunction)wasteObj_WEInsert, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002054 PyDoc_STR("(Buffer inTextPtr, StScrpHandle inStyles, WESoupHandle inSoup) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002055 {"WEInsertFormattedText", (PyCFunction)wasteObj_WEInsertFormattedText, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002056 PyDoc_STR("(Buffer inTextPtr, StScrpHandle inStyles, WESoupHandle inSoup, Handle inParaFormat, Handle inRulerScrap) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002057 {"WEDelete", (PyCFunction)wasteObj_WEDelete, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002058 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002059 {"WEUseText", (PyCFunction)wasteObj_WEUseText, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002060 PyDoc_STR("(Handle inText) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002061 {"WEChangeCase", (PyCFunction)wasteObj_WEChangeCase, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002062 PyDoc_STR("(SInt16 inCase) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002063 {"WESetOneAttribute", (PyCFunction)wasteObj_WESetOneAttribute, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002064 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd, WESelector inAttributeSelector, Buffer inAttributeValue) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002065 {"WESetStyle", (PyCFunction)wasteObj_WESetStyle, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002066 PyDoc_STR("(WEStyleMode inMode, TextStyle inTextStyle) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002067 {"WEUseStyleScrap", (PyCFunction)wasteObj_WEUseStyleScrap, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002068 PyDoc_STR("(StScrpHandle inStyles) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002069 {"WEUndo", (PyCFunction)wasteObj_WEUndo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002070 PyDoc_STR("() -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002071 {"WERedo", (PyCFunction)wasteObj_WERedo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002072 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002073 {"WEClearUndo", (PyCFunction)wasteObj_WEClearUndo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002074 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002075 {"WEGetUndoInfo", (PyCFunction)wasteObj_WEGetUndoInfo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002076 PyDoc_STR("() -> (WEActionKind _rv, Boolean outRedoFlag)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002077 {"WEGetIndUndoInfo", (PyCFunction)wasteObj_WEGetIndUndoInfo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002078 PyDoc_STR("(SInt32 inUndoLevel) -> (WEActionKind _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002079 {"WEIsTyping", (PyCFunction)wasteObj_WEIsTyping, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002080 PyDoc_STR("() -> (Boolean _rv)")},
Jack Jansen2369a981998-02-20 15:57:30 +00002081 {"WEBeginAction", (PyCFunction)wasteObj_WEBeginAction, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002082 PyDoc_STR("() -> None")},
Jack Jansen2369a981998-02-20 15:57:30 +00002083 {"WEEndAction", (PyCFunction)wasteObj_WEEndAction, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002084 PyDoc_STR("(WEActionKind inActionKind) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002085 {"WEGetModCount", (PyCFunction)wasteObj_WEGetModCount, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002086 PyDoc_STR("() -> (UInt32 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002087 {"WEResetModCount", (PyCFunction)wasteObj_WEResetModCount, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002088 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002089 {"WEInsertObject", (PyCFunction)wasteObj_WEInsertObject, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002090 PyDoc_STR("(FlavorType inObjectType, Handle inObjectDataHandle, Point inObjectSize) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002091 {"WEGetSelectedObject", (PyCFunction)wasteObj_WEGetSelectedObject, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002092 PyDoc_STR("() -> (WEObjectReference outObject)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002093 {"WEGetObjectAtOffset", (PyCFunction)wasteObj_WEGetObjectAtOffset, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002094 PyDoc_STR("(SInt32 inOffset) -> (WEObjectReference outObject)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002095 {"WEFindNextObject", (PyCFunction)wasteObj_WEFindNextObject, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002096 PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv, WEObjectReference outObject)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002097 {"WEUseSoup", (PyCFunction)wasteObj_WEUseSoup, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002098 PyDoc_STR("(WESoupHandle inSoup) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002099 {"WECut", (PyCFunction)wasteObj_WECut, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002100 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002101 {"WECopy", (PyCFunction)wasteObj_WECopy, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002102 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002103 {"WEPaste", (PyCFunction)wasteObj_WEPaste, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002104 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002105 {"WECanPaste", (PyCFunction)wasteObj_WECanPaste, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002106 PyDoc_STR("() -> (Boolean _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002107 {"WEGetHiliteRgn", (PyCFunction)wasteObj_WEGetHiliteRgn, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002108 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd) -> (RgnHandle _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002109 {"WECharByte", (PyCFunction)wasteObj_WECharByte, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002110 PyDoc_STR("(SInt32 inOffset) -> (SInt16 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002111 {"WECharType", (PyCFunction)wasteObj_WECharType, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002112 PyDoc_STR("(SInt32 inOffset) -> (SInt16 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002113 {"WEStopInlineSession", (PyCFunction)wasteObj_WEStopInlineSession, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002114 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002115 {"WEFeatureFlag", (PyCFunction)wasteObj_WEFeatureFlag, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002116 PyDoc_STR("(SInt16 inFeature, SInt16 inAction) -> (SInt16 _rv)")},
Jack Jansen2369a981998-02-20 15:57:30 +00002117 {"WEGetUserInfo", (PyCFunction)wasteObj_WEGetUserInfo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002118 PyDoc_STR("(WESelector inUserTag) -> (SInt32 outUserInfo)")},
Jack Jansen2369a981998-02-20 15:57:30 +00002119 {"WESetUserInfo", (PyCFunction)wasteObj_WESetUserInfo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002120 PyDoc_STR("(WESelector inUserTag, SInt32 inUserInfo) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002121 {"WERemoveUserInfo", (PyCFunction)wasteObj_WERemoveUserInfo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002122 PyDoc_STR("(WESelector inUserTag) -> None")},
Jack Jansen176f3a91996-10-23 15:43:46 +00002123 {"WEInstallTabHooks", (PyCFunction)wasteObj_WEInstallTabHooks, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002124 PyDoc_STR("() -> None")},
Jack Jansen176f3a91996-10-23 15:43:46 +00002125 {"WERemoveTabHooks", (PyCFunction)wasteObj_WERemoveTabHooks, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002126 PyDoc_STR("() -> None")},
Jack Jansen176f3a91996-10-23 15:43:46 +00002127 {"WEIsTabHooks", (PyCFunction)wasteObj_WEIsTabHooks, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002128 PyDoc_STR("() -> (Boolean _rv)")},
Jack Jansena4f03091998-03-02 16:56:18 +00002129 {"WEGetTabSize", (PyCFunction)wasteObj_WEGetTabSize, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002130 PyDoc_STR("() -> (SInt16 _rv)")},
Jack Jansena4f03091998-03-02 16:56:18 +00002131 {"WESetTabSize", (PyCFunction)wasteObj_WESetTabSize, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002132 PyDoc_STR("(SInt16 tabWidth) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002133 {NULL, NULL, 0}
2134};
2135
Jack Jansendbd57012002-11-29 23:40:48 +00002136#define wasteObj_getsetlist NULL
Jack Jansen90ecdf41996-04-16 14:29:15 +00002137
Jack Jansen96cebde2002-12-03 23:40:22 +00002138
Jack Jansen9d8b96c2000-07-14 22:16:45 +00002139#define wasteObj_compare NULL
2140
2141#define wasteObj_repr NULL
2142
2143#define wasteObj_hash NULL
Jack Jansen96cebde2002-12-03 23:40:22 +00002144#define wasteObj_tp_init 0
2145
2146#define wasteObj_tp_alloc PyType_GenericAlloc
2147
2148static PyObject *wasteObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
2149{
2150 PyObject *self;
2151 WEReference itself;
2152 char *kw[] = {"itself", 0};
2153
2154 if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, wasteObj_Convert, &itself)) return NULL;
2155 if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
2156 ((wasteObject *)self)->ob_itself = itself;
2157 return self;
2158}
2159
2160#define wasteObj_tp_free PyObject_Del
2161
Jack Jansen9d8b96c2000-07-14 22:16:45 +00002162
Jack Jansen90ecdf41996-04-16 14:29:15 +00002163PyTypeObject waste_Type = {
Jack Jansenb3be2162001-11-30 14:16:36 +00002164 PyObject_HEAD_INIT(NULL)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002165 0, /*ob_size*/
Guido van Rossum14648392001-12-08 18:02:58 +00002166 "waste.waste", /*tp_name*/
Jack Jansen90ecdf41996-04-16 14:29:15 +00002167 sizeof(wasteObject), /*tp_basicsize*/
2168 0, /*tp_itemsize*/
2169 /* methods */
2170 (destructor) wasteObj_dealloc, /*tp_dealloc*/
2171 0, /*tp_print*/
Jack Jansendbd57012002-11-29 23:40:48 +00002172 (getattrfunc)0, /*tp_getattr*/
2173 (setattrfunc)0, /*tp_setattr*/
Jack Jansen9d8b96c2000-07-14 22:16:45 +00002174 (cmpfunc) wasteObj_compare, /*tp_compare*/
2175 (reprfunc) wasteObj_repr, /*tp_repr*/
2176 (PyNumberMethods *)0, /* tp_as_number */
2177 (PySequenceMethods *)0, /* tp_as_sequence */
2178 (PyMappingMethods *)0, /* tp_as_mapping */
2179 (hashfunc) wasteObj_hash, /*tp_hash*/
Jack Jansendbd57012002-11-29 23:40:48 +00002180 0, /*tp_call*/
2181 0, /*tp_str*/
2182 PyObject_GenericGetAttr, /*tp_getattro*/
2183 PyObject_GenericSetAttr, /*tp_setattro */
Jack Jansen96cebde2002-12-03 23:40:22 +00002184 0, /*tp_as_buffer*/
2185 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
2186 0, /*tp_doc*/
2187 0, /*tp_traverse*/
2188 0, /*tp_clear*/
2189 0, /*tp_richcompare*/
2190 0, /*tp_weaklistoffset*/
2191 0, /*tp_iter*/
2192 0, /*tp_iternext*/
Jack Jansendbd57012002-11-29 23:40:48 +00002193 wasteObj_methods, /* tp_methods */
Jack Jansen96cebde2002-12-03 23:40:22 +00002194 0, /*tp_members*/
Jack Jansendbd57012002-11-29 23:40:48 +00002195 wasteObj_getsetlist, /*tp_getset*/
Jack Jansen96cebde2002-12-03 23:40:22 +00002196 0, /*tp_base*/
2197 0, /*tp_dict*/
2198 0, /*tp_descr_get*/
2199 0, /*tp_descr_set*/
2200 0, /*tp_dictoffset*/
2201 wasteObj_tp_init, /* tp_init */
2202 wasteObj_tp_alloc, /* tp_alloc */
2203 wasteObj_tp_new, /* tp_new */
2204 wasteObj_tp_free, /* tp_free */
Jack Jansen90ecdf41996-04-16 14:29:15 +00002205};
2206
2207/* --------------------- End object type waste ---------------------- */
2208
2209
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002210static PyObject *waste_WENew(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002211{
2212 PyObject *_res = NULL;
2213 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00002214 LongRect inDestRect;
2215 LongRect inViewRect;
2216 OptionBits inOptions;
2217 WEReference outWE;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002218 if (!PyArg_ParseTuple(_args, "O&O&l",
Jack Jansenb99e5212002-01-11 12:37:15 +00002219 LongRect_Convert, &inDestRect,
2220 LongRect_Convert, &inViewRect,
2221 &inOptions))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002222 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002223 _err = WENew(&inDestRect,
2224 &inViewRect,
2225 inOptions,
2226 &outWE);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002227 if (_err != noErr) return PyMac_Error(_err);
2228 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002229 wasteObj_New, outWE);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002230 return _res;
2231}
2232
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002233static PyObject *waste_WEUpdateStyleScrap(PyObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00002234{
2235 PyObject *_res = NULL;
2236 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00002237 StScrpHandle ioStyles;
2238 WEFontTableHandle inFontTable;
Jack Jansen2369a981998-02-20 15:57:30 +00002239 if (!PyArg_ParseTuple(_args, "O&O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002240 ResObj_Convert, &ioStyles,
2241 ResObj_Convert, &inFontTable))
Jack Jansen2369a981998-02-20 15:57:30 +00002242 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002243 _err = WEUpdateStyleScrap(ioStyles,
2244 inFontTable);
Jack Jansen2369a981998-02-20 15:57:30 +00002245 if (_err != noErr) return PyMac_Error(_err);
2246 Py_INCREF(Py_None);
2247 _res = Py_None;
2248 return _res;
2249}
2250
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002251static PyObject *waste_WEInstallTSMHandlers(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002252{
2253 PyObject *_res = NULL;
2254 OSErr _err;
2255 if (!PyArg_ParseTuple(_args, ""))
2256 return NULL;
2257 _err = WEInstallTSMHandlers();
2258 if (_err != noErr) return PyMac_Error(_err);
2259 Py_INCREF(Py_None);
2260 _res = Py_None;
2261 return _res;
2262}
2263
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002264static PyObject *waste_WERemoveTSMHandlers(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002265{
2266 PyObject *_res = NULL;
2267 OSErr _err;
2268 if (!PyArg_ParseTuple(_args, ""))
2269 return NULL;
2270 _err = WERemoveTSMHandlers();
2271 if (_err != noErr) return PyMac_Error(_err);
2272 Py_INCREF(Py_None);
2273 _res = Py_None;
2274 return _res;
2275}
2276
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002277static PyObject *waste_WEHandleTSMEvent(PyObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00002278{
2279 PyObject *_res = NULL;
2280 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00002281 AppleEvent inAppleEvent;
2282 AppleEvent ioReply;
Jack Jansen2369a981998-02-20 15:57:30 +00002283 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002284 AEDesc_Convert, &inAppleEvent))
Jack Jansen2369a981998-02-20 15:57:30 +00002285 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002286 _err = WEHandleTSMEvent(&inAppleEvent,
2287 &ioReply);
Jack Jansen2369a981998-02-20 15:57:30 +00002288 if (_err != noErr) return PyMac_Error(_err);
2289 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002290 AEDesc_New, &ioReply);
Jack Jansen2369a981998-02-20 15:57:30 +00002291 return _res;
2292}
2293
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002294static PyObject *waste_WELongPointToPoint(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002295{
2296 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002297 LongPt inLongPoint;
2298 Point outPoint;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002299 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002300 LongPt_Convert, &inLongPoint))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002301 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002302 WELongPointToPoint(&inLongPoint,
2303 &outPoint);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002304 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002305 PyMac_BuildPoint, outPoint);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002306 return _res;
2307}
2308
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002309static PyObject *waste_WEPointToLongPoint(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002310{
2311 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002312 Point inPoint;
2313 LongPt outLongPoint;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002314 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002315 PyMac_GetPoint, &inPoint))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002316 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002317 WEPointToLongPoint(inPoint,
2318 &outLongPoint);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002319 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002320 LongPt_New, &outLongPoint);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002321 return _res;
2322}
2323
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002324static PyObject *waste_WESetLongRect(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002325{
2326 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002327 LongRect outLongRect;
2328 SInt32 inLeft;
2329 SInt32 inTop;
2330 SInt32 inRight;
2331 SInt32 inBottom;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002332 if (!PyArg_ParseTuple(_args, "llll",
Jack Jansenb99e5212002-01-11 12:37:15 +00002333 &inLeft,
2334 &inTop,
2335 &inRight,
2336 &inBottom))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002337 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002338 WESetLongRect(&outLongRect,
2339 inLeft,
2340 inTop,
2341 inRight,
2342 inBottom);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002343 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002344 LongRect_New, &outLongRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002345 return _res;
2346}
2347
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002348static PyObject *waste_WELongRectToRect(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002349{
2350 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002351 LongRect inLongRect;
2352 Rect outRect;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002353 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002354 LongRect_Convert, &inLongRect))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002355 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002356 WELongRectToRect(&inLongRect,
2357 &outRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002358 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002359 PyMac_BuildRect, &outRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002360 return _res;
2361}
2362
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002363static PyObject *waste_WERectToLongRect(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002364{
2365 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002366 Rect inRect;
2367 LongRect outLongRect;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002368 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002369 PyMac_GetRect, &inRect))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002370 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002371 WERectToLongRect(&inRect,
2372 &outLongRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002373 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002374 LongRect_New, &outLongRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002375 return _res;
2376}
2377
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002378static PyObject *waste_WEOffsetLongRect(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002379{
2380 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002381 LongRect ioLongRect;
2382 SInt32 inHorizontalOffset;
2383 SInt32 inVerticalOffset;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002384 if (!PyArg_ParseTuple(_args, "ll",
Jack Jansenb99e5212002-01-11 12:37:15 +00002385 &inHorizontalOffset,
2386 &inVerticalOffset))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002387 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002388 WEOffsetLongRect(&ioLongRect,
2389 inHorizontalOffset,
2390 inVerticalOffset);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002391 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002392 LongRect_New, &ioLongRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002393 return _res;
2394}
2395
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002396static PyObject *waste_WELongPointInLongRect(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002397{
2398 PyObject *_res = NULL;
2399 Boolean _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00002400 LongPt inLongPoint;
2401 LongRect inLongRect;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002402 if (!PyArg_ParseTuple(_args, "O&O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002403 LongPt_Convert, &inLongPoint,
2404 LongRect_Convert, &inLongRect))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002405 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002406 _rv = WELongPointInLongRect(&inLongPoint,
2407 &inLongRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002408 _res = Py_BuildValue("b",
2409 _rv);
2410 return _res;
2411}
2412
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002413static PyObject *waste_STDObjectHandlers(PyObject *_self, PyObject *_args)
Jack Jansen756522f1996-05-07 15:24:01 +00002414{
2415 PyObject *_res = NULL;
2416
2417 OSErr err;
2418 // install the sample object handlers for pictures and sounds
2419#define kTypePicture 'PICT'
2420#define kTypeSound 'snd '
2421
2422 if ( !PyArg_ParseTuple(_args, "") ) return NULL;
2423
2424 if ((err = WEInstallObjectHandler(kTypePicture, weNewHandler,
2425 (UniversalProcPtr) NewWENewObjectProc(HandleNewPicture), NULL)) != noErr)
2426 goto cleanup;
2427
2428 if ((err = WEInstallObjectHandler(kTypePicture, weDisposeHandler,
2429 (UniversalProcPtr) NewWEDisposeObjectProc(HandleDisposePicture), NULL)) != noErr)
2430 goto cleanup;
2431
2432 if ((err = WEInstallObjectHandler(kTypePicture, weDrawHandler,
2433 (UniversalProcPtr) NewWEDrawObjectProc(HandleDrawPicture), NULL)) != noErr)
2434 goto cleanup;
2435
2436 if ((err = WEInstallObjectHandler(kTypeSound, weNewHandler,
2437 (UniversalProcPtr) NewWENewObjectProc(HandleNewSound), NULL)) != noErr)
2438 goto cleanup;
2439
2440 if ((err = WEInstallObjectHandler(kTypeSound, weDrawHandler,
2441 (UniversalProcPtr) NewWEDrawObjectProc(HandleDrawSound), NULL)) != noErr)
2442 goto cleanup;
2443
2444 if ((err = WEInstallObjectHandler(kTypeSound, weClickHandler,
2445 (UniversalProcPtr) NewWEClickObjectProc(HandleClickSound), NULL)) != noErr)
2446 goto cleanup;
2447 Py_INCREF(Py_None);
2448 return Py_None;
2449
2450 cleanup:
2451 return PyMac_Error(err);
2452
2453}
2454
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002455static PyObject *waste_WEInstallObjectHandler(PyObject *_self, PyObject *_args)
Jack Jansen756522f1996-05-07 15:24:01 +00002456{
2457 PyObject *_res = NULL;
2458
2459 OSErr err;
2460 FlavorType objectType;
2461 WESelector selector;
2462 PyObject *py_handler;
2463 UniversalProcPtr handler;
2464 WEReference we = NULL;
2465 PyObject *key;
2466
2467
2468 if ( !PyArg_ParseTuple(_args, "O&O&O|O&",
2469 PyMac_GetOSType, &objectType,
2470 PyMac_GetOSType, &selector,
2471 &py_handler,
Jack Jansen7df36061996-10-01 11:41:14 +00002472 WEOObj_Convert, &we) ) return NULL;
Jack Jansen756522f1996-05-07 15:24:01 +00002473
Jack Jansen25241d91996-05-20 11:30:45 +00002474 if ( selector == weNewHandler ) handler = (UniversalProcPtr)upp_new_handler;
2475 else if ( selector == weDisposeHandler ) handler = (UniversalProcPtr)upp_dispose_handler;
2476 else if ( selector == weDrawHandler ) handler = (UniversalProcPtr)upp_draw_handler;
2477 else if ( selector == weClickHandler ) handler = (UniversalProcPtr)upp_click_handler;
Jack Jansen756522f1996-05-07 15:24:01 +00002478 else return PyMac_Error(weUndefinedSelectorErr);
2479
2480 if ((key = Py_BuildValue("O&O&",
2481 PyMac_BuildOSType, objectType,
2482 PyMac_BuildOSType, selector)) == NULL )
2483 return NULL;
2484
2485 PyDict_SetItem(callbackdict, key, py_handler);
2486
2487 err = WEInstallObjectHandler(objectType, selector, handler, we);
2488 if ( err ) return PyMac_Error(err);
2489 Py_INCREF(Py_None);
2490 return Py_None;
2491
2492}
2493
Jack Jansen90ecdf41996-04-16 14:29:15 +00002494static PyMethodDef waste_methods[] = {
2495 {"WENew", (PyCFunction)waste_WENew, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002496 PyDoc_STR("(LongRect inDestRect, LongRect inViewRect, OptionBits inOptions) -> (WEReference outWE)")},
Jack Jansen2369a981998-02-20 15:57:30 +00002497 {"WEUpdateStyleScrap", (PyCFunction)waste_WEUpdateStyleScrap, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002498 PyDoc_STR("(StScrpHandle ioStyles, WEFontTableHandle inFontTable) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002499 {"WEInstallTSMHandlers", (PyCFunction)waste_WEInstallTSMHandlers, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002500 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002501 {"WERemoveTSMHandlers", (PyCFunction)waste_WERemoveTSMHandlers, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002502 PyDoc_STR("() -> None")},
Jack Jansen2369a981998-02-20 15:57:30 +00002503 {"WEHandleTSMEvent", (PyCFunction)waste_WEHandleTSMEvent, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002504 PyDoc_STR("(AppleEvent inAppleEvent) -> (AppleEvent ioReply)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002505 {"WELongPointToPoint", (PyCFunction)waste_WELongPointToPoint, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002506 PyDoc_STR("(LongPt inLongPoint) -> (Point outPoint)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002507 {"WEPointToLongPoint", (PyCFunction)waste_WEPointToLongPoint, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002508 PyDoc_STR("(Point inPoint) -> (LongPt outLongPoint)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002509 {"WESetLongRect", (PyCFunction)waste_WESetLongRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002510 PyDoc_STR("(SInt32 inLeft, SInt32 inTop, SInt32 inRight, SInt32 inBottom) -> (LongRect outLongRect)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002511 {"WELongRectToRect", (PyCFunction)waste_WELongRectToRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002512 PyDoc_STR("(LongRect inLongRect) -> (Rect outRect)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002513 {"WERectToLongRect", (PyCFunction)waste_WERectToLongRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002514 PyDoc_STR("(Rect inRect) -> (LongRect outLongRect)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002515 {"WEOffsetLongRect", (PyCFunction)waste_WEOffsetLongRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002516 PyDoc_STR("(SInt32 inHorizontalOffset, SInt32 inVerticalOffset) -> (LongRect ioLongRect)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002517 {"WELongPointInLongRect", (PyCFunction)waste_WELongPointInLongRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002518 PyDoc_STR("(LongPt inLongPoint, LongRect inLongRect) -> (Boolean _rv)")},
Jack Jansen756522f1996-05-07 15:24:01 +00002519 {"STDObjectHandlers", (PyCFunction)waste_STDObjectHandlers, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002520 PyDoc_STR(NULL)},
Jack Jansen756522f1996-05-07 15:24:01 +00002521 {"WEInstallObjectHandler", (PyCFunction)waste_WEInstallObjectHandler, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002522 PyDoc_STR(NULL)},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002523 {NULL, NULL, 0}
2524};
2525
2526
2527
Jack Jansen756522f1996-05-07 15:24:01 +00002528/* Return the object corresponding to the window, or NULL */
2529
2530PyObject *
2531ExistingwasteObj_New(w)
2532 WEReference w;
2533{
2534 PyObject *it = NULL;
2535
2536 if (w == NULL)
2537 it = NULL;
2538 else
2539 WEGetInfo(weRefCon, (void *)&it, w);
2540 if (it == NULL || ((wasteObject *)it)->ob_itself != w)
2541 it = Py_None;
2542 Py_INCREF(it);
2543 return it;
2544}
2545
Jack Jansen90ecdf41996-04-16 14:29:15 +00002546
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002547void initwaste(void)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002548{
2549 PyObject *m;
2550 PyObject *d;
2551
2552
2553
2554
2555 m = Py_InitModule("waste", waste_methods);
2556 d = PyModule_GetDict(m);
2557 waste_Error = PyMac_GetOSErrException();
2558 if (waste_Error == NULL ||
2559 PyDict_SetItemString(d, "Error", waste_Error) != 0)
Jack Jansen97ed9072000-09-08 22:06:16 +00002560 return;
Jack Jansena755e681997-09-20 17:40:22 +00002561 WEO_Type.ob_type = &PyType_Type;
2562 Py_INCREF(&WEO_Type);
Jack Jansen96cebde2002-12-03 23:40:22 +00002563 PyModule_AddObject(m, "WEO", (PyObject *)&WEO_Type);
2564 /* Backward-compatible name */
2565 Py_INCREF(&WEO_Type);
2566 PyModule_AddObject(m, "WEOType", (PyObject *)&WEO_Type);
Jack Jansena755e681997-09-20 17:40:22 +00002567 waste_Type.ob_type = &PyType_Type;
2568 Py_INCREF(&waste_Type);
Jack Jansen96cebde2002-12-03 23:40:22 +00002569 PyModule_AddObject(m, "waste", (PyObject *)&waste_Type);
2570 /* Backward-compatible name */
2571 Py_INCREF(&waste_Type);
2572 PyModule_AddObject(m, "wasteType", (PyObject *)&waste_Type);
Jack Jansen756522f1996-05-07 15:24:01 +00002573
2574 callbackdict = PyDict_New();
2575 if (callbackdict == NULL || PyDict_SetItemString(d, "callbacks", callbackdict) != 0)
Jack Jansen97ed9072000-09-08 22:06:16 +00002576 return;
Jack Jansen756522f1996-05-07 15:24:01 +00002577 upp_new_handler = NewWENewObjectProc(my_new_handler);
Jack Jansen25241d91996-05-20 11:30:45 +00002578 upp_dispose_handler = NewWEDisposeObjectProc(my_dispose_handler);
2579 upp_draw_handler = NewWEDrawObjectProc(my_draw_handler);
2580 upp_click_handler = NewWEClickObjectProc(my_click_handler);
Jack Jansen756522f1996-05-07 15:24:01 +00002581
2582
Jack Jansen90ecdf41996-04-16 14:29:15 +00002583}
2584
2585/* ======================== End module waste ======================== */
2586