blob: f05e467b0b19fc0b72436d160f4c7a2b7dbcc71a [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*/
Jack Jansenb7348692002-12-23 23:16:25 +000045static PyObject *
46TextStyle_New(TextStylePtr itself)
Jack Jansen90ecdf41996-04-16 14:29:15 +000047{
48
49 return Py_BuildValue("lllO&", (long)itself->tsFont, (long)itself->tsFace, (long)itself->tsSize, QdRGB_New,
50 &itself->tsColor);
51}
52
Jack Jansenb7348692002-12-23 23:16:25 +000053static int
Jack Jansen65cbf932002-12-13 15:02:02 +000054TextStyle_Convert(PyObject *v, TextStylePtr p_itself)
Jack Jansen90ecdf41996-04-16 14:29:15 +000055{
56 long font, face, size;
57
58 if( !PyArg_ParseTuple(v, "lllO&", &font, &face, &size, QdRGB_Convert, &p_itself->tsColor) )
59 return 0;
60 p_itself->tsFont = (short)font;
61 p_itself->tsFace = (Style)face;
62 p_itself->tsSize = (short)size;
63 return 1;
64}
65
66/*
67** Parse/generate RunInfo records
68*/
Jack Jansenb7348692002-12-23 23:16:25 +000069static PyObject *
70RunInfo_New(WERunInfo *itself)
Jack Jansen90ecdf41996-04-16 14:29:15 +000071{
72
73 return Py_BuildValue("llhhO&O&", itself->runStart, itself->runEnd, itself->runHeight,
74 itself->runAscent, TextStyle_New, &itself->runStyle, WEOObj_New, itself->runObject);
75}
76
77/* Conversion of long points and rects */
78int
79LongRect_Convert(PyObject *v, LongRect *r)
80{
81 return PyArg_Parse(v, "(llll)", &r->left, &r->top, &r->right, &r->bottom);
82}
83
84PyObject *
85LongRect_New(LongRect *r)
86{
87 return Py_BuildValue("(llll)", r->left, r->top, r->right, r->bottom);
88}
89
Jack Jansenb7348692002-12-23 23:16:25 +000090int
Jack Jansen90ecdf41996-04-16 14:29:15 +000091LongPt_Convert(PyObject *v, LongPt *p)
92{
93 return PyArg_Parse(v, "(ll)", &p->h, &p->v);
94}
95
96PyObject *
97LongPt_New(LongPt *p)
98{
99 return Py_BuildValue("(ll)", p->h, p->v);
100}
101
Jack Jansen756522f1996-05-07 15:24:01 +0000102/* Stuff for the callbacks: */
103static PyObject *callbackdict;
Jack Jansen25241d91996-05-20 11:30:45 +0000104WENewObjectUPP upp_new_handler;
105WEDisposeObjectUPP upp_dispose_handler;
106WEDrawObjectUPP upp_draw_handler;
107WEClickObjectUPP upp_click_handler;
Jack Jansen756522f1996-05-07 15:24:01 +0000108
109static OSErr
110any_handler(WESelector what, WEObjectReference who, PyObject *args, PyObject **rv)
111{
112 FlavorType tp;
113 PyObject *key, *func;
114
115 if ( args == NULL ) return errAECorruptData;
116
117 tp = WEGetObjectType(who);
118
119 if( (key=Py_BuildValue("O&O&", PyMac_BuildOSType, tp, PyMac_BuildOSType, what)) == NULL)
120 return errAECorruptData;
121 if( (func = PyDict_GetItem(callbackdict, key)) == NULL ) {
122 Py_DECREF(key);
123 return errAEHandlerNotFound;
124 }
125 Py_INCREF(func);
126 *rv = PyEval_CallObject(func, args);
127 Py_DECREF(func);
128 Py_DECREF(key);
129 if ( *rv == NULL ) {
Jack Jansendeff89c1998-10-12 20:53:15 +0000130 PySys_WriteStderr("--Exception in callback: ");
Jack Jansen756522f1996-05-07 15:24:01 +0000131 PyErr_Print();
132 return errAEReplyNotArrived;
133 }
134 return 0;
135}
136
137static pascal OSErr
138my_new_handler(Point *objectSize, WEObjectReference objref)
139{
140 PyObject *args=NULL, *rv=NULL;
141 OSErr err;
142
143 args=Py_BuildValue("(O&)", WEOObj_New, objref);
144 err = any_handler(weNewHandler, objref, args, &rv);
145 if (!err) {
146 if (!PyMac_GetPoint(rv, objectSize) )
147 err = errAECoercionFail;
148 }
Jack Jansenb7348692002-12-23 23:16:25 +0000149 if ( args ) {
150 Py_DECREF(args);
151 }
152 if ( rv ) {
153 Py_DECREF(rv);
154 }
Jack Jansen756522f1996-05-07 15:24:01 +0000155 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);
Jack Jansenb7348692002-12-23 23:16:25 +0000166 if ( args ) {
167 Py_DECREF(args);
168 }
169 if ( rv ) {
170 Py_DECREF(rv);
171 }
Jack Jansen756522f1996-05-07 15:24:01 +0000172 return err;
173}
174
175static pascal OSErr
Jack Jansen6b9289f2001-06-20 21:21:07 +0000176my_draw_handler(const Rect *destRect, WEObjectReference objref)
Jack Jansen756522f1996-05-07 15:24:01 +0000177{
178 PyObject *args=NULL, *rv=NULL;
179 OSErr err;
180
181 args=Py_BuildValue("O&O&", PyMac_BuildRect, destRect, WEOObj_New, objref);
182 err = any_handler(weDrawHandler, objref, args, &rv);
Jack Jansenb7348692002-12-23 23:16:25 +0000183 if ( args ) {
184 Py_DECREF(args);
185 }
186 if ( rv ) {
187 Py_DECREF(rv);
188 }
Jack Jansen756522f1996-05-07 15:24:01 +0000189 return err;
190}
191
192static pascal Boolean
193my_click_handler(Point hitPt, EventModifiers modifiers,
194 unsigned long clickTime, WEObjectReference objref)
195{
196 PyObject *args=NULL, *rv=NULL;
197 int retvalue;
198 OSErr err;
199
200 args=Py_BuildValue("O&llO&", PyMac_BuildPoint, hitPt,
201 (long)modifiers, (long)clickTime, WEOObj_New, objref);
202 err = any_handler(weClickHandler, objref, args, &rv);
203 if (!err)
204 retvalue = PyInt_AsLong(rv);
205 else
206 retvalue = 0;
Jack Jansenb7348692002-12-23 23:16:25 +0000207 if ( args ) {
208 Py_DECREF(args);
209 }
210 if ( rv ) {
211 Py_DECREF(rv);
212 }
Jack Jansen756522f1996-05-07 15:24:01 +0000213 return retvalue;
214}
215
216
217
Jack Jansen90ecdf41996-04-16 14:29:15 +0000218static PyObject *waste_Error;
219
220/* ------------------------ Object type WEO ------------------------- */
221
222PyTypeObject WEO_Type;
223
Jack Jansenf9557842002-12-19 21:24:35 +0000224#define WEOObj_Check(x) ((x)->ob_type == &WEO_Type || PyObject_TypeCheck((x), &WEO_Type))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000225
226typedef struct WEOObject {
227 PyObject_HEAD
228 WEObjectReference ob_itself;
229} WEOObject;
230
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000231PyObject *WEOObj_New(WEObjectReference itself)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000232{
233 WEOObject *it;
234 if (itself == NULL) {
235 Py_INCREF(Py_None);
236 return Py_None;
237 }
238 it = PyObject_NEW(WEOObject, &WEO_Type);
239 if (it == NULL) return NULL;
240 it->ob_itself = itself;
241 return (PyObject *)it;
242}
Jack Jansen044d95e2001-09-05 15:44:37 +0000243int WEOObj_Convert(PyObject *v, WEObjectReference *p_itself)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000244{
245 if (!WEOObj_Check(v))
246 {
247 PyErr_SetString(PyExc_TypeError, "WEO required");
248 return 0;
249 }
250 *p_itself = ((WEOObject *)v)->ob_itself;
251 return 1;
252}
253
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000254static void WEOObj_dealloc(WEOObject *self)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000255{
256 /* Cleanup of self->ob_itself goes here */
Jack Jansenb7348692002-12-23 23:16:25 +0000257 self->ob_type->tp_free((PyObject *)self);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000258}
259
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000260static PyObject *WEOObj_WEGetObjectType(WEOObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000261{
262 PyObject *_res = NULL;
263 FlavorType _rv;
264 if (!PyArg_ParseTuple(_args, ""))
265 return NULL;
266 _rv = WEGetObjectType(_self->ob_itself);
267 _res = Py_BuildValue("O&",
268 PyMac_BuildOSType, _rv);
269 return _res;
270}
271
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000272static PyObject *WEOObj_WEGetObjectDataHandle(WEOObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000273{
274 PyObject *_res = NULL;
275 Handle _rv;
276 if (!PyArg_ParseTuple(_args, ""))
277 return NULL;
278 _rv = WEGetObjectDataHandle(_self->ob_itself);
279 _res = Py_BuildValue("O&",
280 ResObj_New, _rv);
281 return _res;
282}
283
Jack Jansenb99e5212002-01-11 12:37:15 +0000284static PyObject *WEOObj_WEGetObjectOwner(WEOObject *_self, PyObject *_args)
285{
286 PyObject *_res = NULL;
287 WEReference _rv;
288 if (!PyArg_ParseTuple(_args, ""))
289 return NULL;
290 _rv = WEGetObjectOwner(_self->ob_itself);
291 _res = Py_BuildValue("O&",
292 ExistingwasteObj_New, _rv);
293 return _res;
294}
295
296static PyObject *WEOObj_WEGetObjectOffset(WEOObject *_self, PyObject *_args)
297{
298 PyObject *_res = NULL;
299 SInt32 _rv;
300 if (!PyArg_ParseTuple(_args, ""))
301 return NULL;
302 _rv = WEGetObjectOffset(_self->ob_itself);
303 _res = Py_BuildValue("l",
304 _rv);
305 return _res;
306}
307
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000308static PyObject *WEOObj_WEGetObjectSize(WEOObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000309{
310 PyObject *_res = NULL;
311 Point _rv;
312 if (!PyArg_ParseTuple(_args, ""))
313 return NULL;
314 _rv = WEGetObjectSize(_self->ob_itself);
315 _res = Py_BuildValue("O&",
316 PyMac_BuildPoint, _rv);
317 return _res;
318}
319
Jack Jansenb99e5212002-01-11 12:37:15 +0000320static PyObject *WEOObj_WESetObjectSize(WEOObject *_self, PyObject *_args)
Jack Jansen756522f1996-05-07 15:24:01 +0000321{
322 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000323 OSErr _err;
324 Point inObjectSize;
325 if (!PyArg_ParseTuple(_args, "O&",
326 PyMac_GetPoint, &inObjectSize))
327 return NULL;
328 _err = WESetObjectSize(_self->ob_itself,
329 inObjectSize);
330 if (_err != noErr) return PyMac_Error(_err);
331 Py_INCREF(Py_None);
332 _res = Py_None;
333 return _res;
334}
335
336static PyObject *WEOObj_WEGetObjectFrame(WEOObject *_self, PyObject *_args)
337{
338 PyObject *_res = NULL;
339 OSErr _err;
340 LongRect outObjectFrame;
Jack Jansen756522f1996-05-07 15:24:01 +0000341 if (!PyArg_ParseTuple(_args, ""))
342 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000343 _err = WEGetObjectFrame(_self->ob_itself,
344 &outObjectFrame);
345 if (_err != noErr) return PyMac_Error(_err);
Jack Jansen756522f1996-05-07 15:24:01 +0000346 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +0000347 LongRect_New, &outObjectFrame);
Jack Jansen756522f1996-05-07 15:24:01 +0000348 return _res;
349}
350
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000351static PyObject *WEOObj_WEGetObjectRefCon(WEOObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000352{
353 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +0000354 SInt32 _rv;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000355 if (!PyArg_ParseTuple(_args, ""))
356 return NULL;
357 _rv = WEGetObjectRefCon(_self->ob_itself);
358 _res = Py_BuildValue("l",
359 _rv);
360 return _res;
361}
362
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000363static PyObject *WEOObj_WESetObjectRefCon(WEOObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000364{
365 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000366 SInt32 inRefCon;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000367 if (!PyArg_ParseTuple(_args, "l",
Jack Jansenb99e5212002-01-11 12:37:15 +0000368 &inRefCon))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000369 return NULL;
370 WESetObjectRefCon(_self->ob_itself,
Jack Jansenb99e5212002-01-11 12:37:15 +0000371 inRefCon);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000372 Py_INCREF(Py_None);
373 _res = Py_None;
374 return _res;
375}
376
377static PyMethodDef WEOObj_methods[] = {
378 {"WEGetObjectType", (PyCFunction)WEOObj_WEGetObjectType, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000379 PyDoc_STR("() -> (FlavorType _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +0000380 {"WEGetObjectDataHandle", (PyCFunction)WEOObj_WEGetObjectDataHandle, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000381 PyDoc_STR("() -> (Handle _rv)")},
Jack Jansen756522f1996-05-07 15:24:01 +0000382 {"WEGetObjectOwner", (PyCFunction)WEOObj_WEGetObjectOwner, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000383 PyDoc_STR("() -> (WEReference _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +0000384 {"WEGetObjectOffset", (PyCFunction)WEOObj_WEGetObjectOffset, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000385 PyDoc_STR("() -> (SInt32 _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +0000386 {"WEGetObjectSize", (PyCFunction)WEOObj_WEGetObjectSize, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000387 PyDoc_STR("() -> (Point _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +0000388 {"WESetObjectSize", (PyCFunction)WEOObj_WESetObjectSize, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000389 PyDoc_STR("(Point inObjectSize) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +0000390 {"WEGetObjectFrame", (PyCFunction)WEOObj_WEGetObjectFrame, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000391 PyDoc_STR("() -> (LongRect outObjectFrame)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +0000392 {"WEGetObjectRefCon", (PyCFunction)WEOObj_WEGetObjectRefCon, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000393 PyDoc_STR("() -> (SInt32 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +0000394 {"WESetObjectRefCon", (PyCFunction)WEOObj_WESetObjectRefCon, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000395 PyDoc_STR("(SInt32 inRefCon) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +0000396 {NULL, NULL, 0}
397};
398
Jack Jansendbd57012002-11-29 23:40:48 +0000399#define WEOObj_getsetlist NULL
Jack Jansen90ecdf41996-04-16 14:29:15 +0000400
Jack Jansen96cebde2002-12-03 23:40:22 +0000401
Jack Jansen9d8b96c2000-07-14 22:16:45 +0000402#define WEOObj_compare NULL
403
404#define WEOObj_repr NULL
405
406#define WEOObj_hash NULL
Jack Jansen96cebde2002-12-03 23:40:22 +0000407#define WEOObj_tp_init 0
408
409#define WEOObj_tp_alloc PyType_GenericAlloc
410
411static PyObject *WEOObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
412{
413 PyObject *self;
414 WEObjectReference itself;
415 char *kw[] = {"itself", 0};
416
417 if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, WEOObj_Convert, &itself)) return NULL;
418 if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
419 ((WEOObject *)self)->ob_itself = itself;
420 return self;
421}
422
423#define WEOObj_tp_free PyObject_Del
424
Jack Jansen9d8b96c2000-07-14 22:16:45 +0000425
Jack Jansen90ecdf41996-04-16 14:29:15 +0000426PyTypeObject WEO_Type = {
Jack Jansenb3be2162001-11-30 14:16:36 +0000427 PyObject_HEAD_INIT(NULL)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000428 0, /*ob_size*/
Guido van Rossum14648392001-12-08 18:02:58 +0000429 "waste.WEO", /*tp_name*/
Jack Jansen90ecdf41996-04-16 14:29:15 +0000430 sizeof(WEOObject), /*tp_basicsize*/
431 0, /*tp_itemsize*/
432 /* methods */
433 (destructor) WEOObj_dealloc, /*tp_dealloc*/
434 0, /*tp_print*/
Jack Jansendbd57012002-11-29 23:40:48 +0000435 (getattrfunc)0, /*tp_getattr*/
436 (setattrfunc)0, /*tp_setattr*/
Jack Jansen9d8b96c2000-07-14 22:16:45 +0000437 (cmpfunc) WEOObj_compare, /*tp_compare*/
438 (reprfunc) WEOObj_repr, /*tp_repr*/
439 (PyNumberMethods *)0, /* tp_as_number */
440 (PySequenceMethods *)0, /* tp_as_sequence */
441 (PyMappingMethods *)0, /* tp_as_mapping */
442 (hashfunc) WEOObj_hash, /*tp_hash*/
Jack Jansendbd57012002-11-29 23:40:48 +0000443 0, /*tp_call*/
444 0, /*tp_str*/
445 PyObject_GenericGetAttr, /*tp_getattro*/
446 PyObject_GenericSetAttr, /*tp_setattro */
Jack Jansen96cebde2002-12-03 23:40:22 +0000447 0, /*tp_as_buffer*/
448 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
449 0, /*tp_doc*/
450 0, /*tp_traverse*/
451 0, /*tp_clear*/
452 0, /*tp_richcompare*/
453 0, /*tp_weaklistoffset*/
454 0, /*tp_iter*/
455 0, /*tp_iternext*/
Jack Jansendbd57012002-11-29 23:40:48 +0000456 WEOObj_methods, /* tp_methods */
Jack Jansen96cebde2002-12-03 23:40:22 +0000457 0, /*tp_members*/
Jack Jansendbd57012002-11-29 23:40:48 +0000458 WEOObj_getsetlist, /*tp_getset*/
Jack Jansen96cebde2002-12-03 23:40:22 +0000459 0, /*tp_base*/
460 0, /*tp_dict*/
461 0, /*tp_descr_get*/
462 0, /*tp_descr_set*/
463 0, /*tp_dictoffset*/
464 WEOObj_tp_init, /* tp_init */
465 WEOObj_tp_alloc, /* tp_alloc */
466 WEOObj_tp_new, /* tp_new */
467 WEOObj_tp_free, /* tp_free */
Jack Jansen90ecdf41996-04-16 14:29:15 +0000468};
469
470/* ---------------------- End object type WEO ----------------------- */
471
472
473/* ----------------------- Object type waste ------------------------ */
474
475PyTypeObject waste_Type;
476
Jack Jansenf9557842002-12-19 21:24:35 +0000477#define wasteObj_Check(x) ((x)->ob_type == &waste_Type || PyObject_TypeCheck((x), &waste_Type))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000478
479typedef struct wasteObject {
480 PyObject_HEAD
481 WEReference ob_itself;
482} wasteObject;
483
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000484PyObject *wasteObj_New(WEReference itself)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000485{
486 wasteObject *it;
487 if (itself == NULL) {
488 PyErr_SetString(waste_Error,"Cannot create null WE");
489 return NULL;
490 }
491 it = PyObject_NEW(wasteObject, &waste_Type);
492 if (it == NULL) return NULL;
493 it->ob_itself = itself;
Jack Jansen756522f1996-05-07 15:24:01 +0000494 WESetInfo(weRefCon, (void *)&it, itself);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000495 return (PyObject *)it;
496}
Jack Jansen044d95e2001-09-05 15:44:37 +0000497int wasteObj_Convert(PyObject *v, WEReference *p_itself)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000498{
499 if (!wasteObj_Check(v))
500 {
501 PyErr_SetString(PyExc_TypeError, "waste required");
502 return 0;
503 }
504 *p_itself = ((wasteObject *)v)->ob_itself;
505 return 1;
506}
507
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000508static void wasteObj_dealloc(wasteObject *self)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000509{
510 WEDispose(self->ob_itself);
Jack Jansenb7348692002-12-23 23:16:25 +0000511 self->ob_type->tp_free((PyObject *)self);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000512}
513
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000514static PyObject *wasteObj_WEGetText(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000515{
516 PyObject *_res = NULL;
517 Handle _rv;
518 if (!PyArg_ParseTuple(_args, ""))
519 return NULL;
520 _rv = WEGetText(_self->ob_itself);
521 _res = Py_BuildValue("O&",
522 ResObj_New, _rv);
523 return _res;
524}
525
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000526static PyObject *wasteObj_WEGetChar(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000527{
528 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +0000529 SInt16 _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +0000530 SInt32 inOffset;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000531 if (!PyArg_ParseTuple(_args, "l",
Jack Jansenb99e5212002-01-11 12:37:15 +0000532 &inOffset))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000533 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000534 _rv = WEGetChar(inOffset,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000535 _self->ob_itself);
536 _res = Py_BuildValue("h",
537 _rv);
538 return _res;
539}
540
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000541static PyObject *wasteObj_WEGetTextLength(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000542{
543 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +0000544 SInt32 _rv;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000545 if (!PyArg_ParseTuple(_args, ""))
546 return NULL;
547 _rv = WEGetTextLength(_self->ob_itself);
548 _res = Py_BuildValue("l",
549 _rv);
550 return _res;
551}
552
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000553static PyObject *wasteObj_WEGetSelection(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000554{
555 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000556 SInt32 outSelStart;
557 SInt32 outSelEnd;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000558 if (!PyArg_ParseTuple(_args, ""))
559 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000560 WEGetSelection(&outSelStart,
561 &outSelEnd,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000562 _self->ob_itself);
563 _res = Py_BuildValue("ll",
Jack Jansenb99e5212002-01-11 12:37:15 +0000564 outSelStart,
565 outSelEnd);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000566 return _res;
567}
568
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000569static PyObject *wasteObj_WEGetDestRect(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000570{
571 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000572 LongRect outDestRect;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000573 if (!PyArg_ParseTuple(_args, ""))
574 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000575 WEGetDestRect(&outDestRect,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000576 _self->ob_itself);
577 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +0000578 LongRect_New, &outDestRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000579 return _res;
580}
581
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000582static PyObject *wasteObj_WEGetViewRect(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000583{
584 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000585 LongRect outViewRect;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000586 if (!PyArg_ParseTuple(_args, ""))
587 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000588 WEGetViewRect(&outViewRect,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000589 _self->ob_itself);
590 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +0000591 LongRect_New, &outViewRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000592 return _res;
593}
594
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000595static PyObject *wasteObj_WEIsActive(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000596{
597 PyObject *_res = NULL;
598 Boolean _rv;
599 if (!PyArg_ParseTuple(_args, ""))
600 return NULL;
601 _rv = WEIsActive(_self->ob_itself);
602 _res = Py_BuildValue("b",
603 _rv);
604 return _res;
605}
606
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000607static PyObject *wasteObj_WEGetClickCount(wasteObject *_self, PyObject *_args)
Jack Jansen2268af51996-08-06 16:04:22 +0000608{
609 PyObject *_res = NULL;
610 UInt16 _rv;
611 if (!PyArg_ParseTuple(_args, ""))
612 return NULL;
613 _rv = WEGetClickCount(_self->ob_itself);
Jack Jansen9d8b96c2000-07-14 22:16:45 +0000614 _res = Py_BuildValue("H",
Jack Jansen2268af51996-08-06 16:04:22 +0000615 _rv);
616 return _res;
617}
618
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000619static PyObject *wasteObj_WESetSelection(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000620{
621 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000622 SInt32 inSelStart;
623 SInt32 inSelEnd;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000624 if (!PyArg_ParseTuple(_args, "ll",
Jack Jansenb99e5212002-01-11 12:37:15 +0000625 &inSelStart,
626 &inSelEnd))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000627 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000628 WESetSelection(inSelStart,
629 inSelEnd,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000630 _self->ob_itself);
631 Py_INCREF(Py_None);
632 _res = Py_None;
633 return _res;
634}
635
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000636static PyObject *wasteObj_WESetDestRect(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000637{
638 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000639 LongRect inDestRect;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000640 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +0000641 LongRect_Convert, &inDestRect))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000642 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000643 WESetDestRect(&inDestRect,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000644 _self->ob_itself);
645 Py_INCREF(Py_None);
646 _res = Py_None;
647 return _res;
648}
649
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000650static PyObject *wasteObj_WESetViewRect(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000651{
652 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000653 LongRect inViewRect;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000654 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +0000655 LongRect_Convert, &inViewRect))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000656 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000657 WESetViewRect(&inViewRect,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000658 _self->ob_itself);
659 Py_INCREF(Py_None);
660 _res = Py_None;
661 return _res;
662}
663
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000664static PyObject *wasteObj_WEContinuousStyle(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000665{
666 PyObject *_res = NULL;
667 Boolean _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +0000668 WEStyleMode ioMode;
669 TextStyle outTextStyle;
Jack Jansen9d8b96c2000-07-14 22:16:45 +0000670 if (!PyArg_ParseTuple(_args, "H",
Jack Jansenb99e5212002-01-11 12:37:15 +0000671 &ioMode))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000672 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000673 _rv = WEContinuousStyle(&ioMode,
674 &outTextStyle,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000675 _self->ob_itself);
Jack Jansen9d8b96c2000-07-14 22:16:45 +0000676 _res = Py_BuildValue("bHO&",
Jack Jansen90ecdf41996-04-16 14:29:15 +0000677 _rv,
Jack Jansenb99e5212002-01-11 12:37:15 +0000678 ioMode,
679 TextStyle_New, &outTextStyle);
680 return _res;
681}
682
683static PyObject *wasteObj_WECountRuns(wasteObject *_self, PyObject *_args)
684{
685 PyObject *_res = NULL;
686 SInt32 _rv;
687 if (!PyArg_ParseTuple(_args, ""))
688 return NULL;
689 _rv = WECountRuns(_self->ob_itself);
690 _res = Py_BuildValue("l",
691 _rv);
692 return _res;
693}
694
695static PyObject *wasteObj_WEOffsetToRun(wasteObject *_self, PyObject *_args)
696{
697 PyObject *_res = NULL;
698 SInt32 _rv;
699 SInt32 inOffset;
700 if (!PyArg_ParseTuple(_args, "l",
701 &inOffset))
702 return NULL;
703 _rv = WEOffsetToRun(inOffset,
704 _self->ob_itself);
705 _res = Py_BuildValue("l",
706 _rv);
707 return _res;
708}
709
710static PyObject *wasteObj_WEGetRunRange(wasteObject *_self, PyObject *_args)
711{
712 PyObject *_res = NULL;
713 SInt32 inStyleRunIndex;
714 SInt32 outStyleRunStart;
715 SInt32 outStyleRunEnd;
716 if (!PyArg_ParseTuple(_args, "l",
717 &inStyleRunIndex))
718 return NULL;
719 WEGetRunRange(inStyleRunIndex,
720 &outStyleRunStart,
721 &outStyleRunEnd,
722 _self->ob_itself);
723 _res = Py_BuildValue("ll",
724 outStyleRunStart,
725 outStyleRunEnd);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000726 return _res;
727}
728
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000729static PyObject *wasteObj_WEGetRunInfo(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000730{
731 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000732 SInt32 inOffset;
733 WERunInfo outStyleRunInfo;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000734 if (!PyArg_ParseTuple(_args, "l",
Jack Jansenb99e5212002-01-11 12:37:15 +0000735 &inOffset))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000736 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000737 WEGetRunInfo(inOffset,
738 &outStyleRunInfo,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000739 _self->ob_itself);
740 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +0000741 RunInfo_New, &outStyleRunInfo);
742 return _res;
743}
744
745static PyObject *wasteObj_WEGetIndRunInfo(wasteObject *_self, PyObject *_args)
746{
747 PyObject *_res = NULL;
748 SInt32 inStyleRunIndex;
749 WERunInfo outStyleRunInfo;
750 if (!PyArg_ParseTuple(_args, "l",
751 &inStyleRunIndex))
752 return NULL;
753 WEGetIndRunInfo(inStyleRunIndex,
754 &outStyleRunInfo,
755 _self->ob_itself);
756 _res = Py_BuildValue("O&",
757 RunInfo_New, &outStyleRunInfo);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000758 return _res;
759}
760
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000761static PyObject *wasteObj_WEGetRunDirection(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +0000762{
763 PyObject *_res = NULL;
764 Boolean _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +0000765 SInt32 inOffset;
Jack Jansen2369a981998-02-20 15:57:30 +0000766 if (!PyArg_ParseTuple(_args, "l",
Jack Jansenb99e5212002-01-11 12:37:15 +0000767 &inOffset))
Jack Jansen2369a981998-02-20 15:57:30 +0000768 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000769 _rv = WEGetRunDirection(inOffset,
Jack Jansen2369a981998-02-20 15:57:30 +0000770 _self->ob_itself);
771 _res = Py_BuildValue("b",
772 _rv);
773 return _res;
774}
775
Jack Jansenb99e5212002-01-11 12:37:15 +0000776static PyObject *wasteObj_WECountParaRuns(wasteObject *_self, PyObject *_args)
777{
778 PyObject *_res = NULL;
779 SInt32 _rv;
780 if (!PyArg_ParseTuple(_args, ""))
781 return NULL;
782 _rv = WECountParaRuns(_self->ob_itself);
783 _res = Py_BuildValue("l",
784 _rv);
785 return _res;
786}
787
788static PyObject *wasteObj_WEOffsetToParaRun(wasteObject *_self, PyObject *_args)
789{
790 PyObject *_res = NULL;
791 SInt32 _rv;
792 SInt32 inOffset;
793 if (!PyArg_ParseTuple(_args, "l",
794 &inOffset))
795 return NULL;
796 _rv = WEOffsetToParaRun(inOffset,
797 _self->ob_itself);
798 _res = Py_BuildValue("l",
799 _rv);
800 return _res;
801}
802
803static PyObject *wasteObj_WEGetParaRunRange(wasteObject *_self, PyObject *_args)
804{
805 PyObject *_res = NULL;
806 SInt32 inParagraphRunIndex;
807 SInt32 outParagraphRunStart;
808 SInt32 outParagraphRunEnd;
809 if (!PyArg_ParseTuple(_args, "l",
810 &inParagraphRunIndex))
811 return NULL;
812 WEGetParaRunRange(inParagraphRunIndex,
813 &outParagraphRunStart,
814 &outParagraphRunEnd,
815 _self->ob_itself);
816 _res = Py_BuildValue("ll",
817 outParagraphRunStart,
818 outParagraphRunEnd);
819 return _res;
820}
821
822static PyObject *wasteObj_WECountLines(wasteObject *_self, PyObject *_args)
823{
824 PyObject *_res = NULL;
825 SInt32 _rv;
826 if (!PyArg_ParseTuple(_args, ""))
827 return NULL;
828 _rv = WECountLines(_self->ob_itself);
829 _res = Py_BuildValue("l",
830 _rv);
831 return _res;
832}
833
834static PyObject *wasteObj_WEOffsetToLine(wasteObject *_self, PyObject *_args)
835{
836 PyObject *_res = NULL;
837 SInt32 _rv;
838 SInt32 inOffset;
839 if (!PyArg_ParseTuple(_args, "l",
840 &inOffset))
841 return NULL;
842 _rv = WEOffsetToLine(inOffset,
843 _self->ob_itself);
844 _res = Py_BuildValue("l",
845 _rv);
846 return _res;
847}
848
849static PyObject *wasteObj_WEGetLineRange(wasteObject *_self, PyObject *_args)
850{
851 PyObject *_res = NULL;
852 SInt32 inLineIndex;
853 SInt32 outLineStart;
854 SInt32 outLineEnd;
855 if (!PyArg_ParseTuple(_args, "l",
856 &inLineIndex))
857 return NULL;
858 WEGetLineRange(inLineIndex,
859 &outLineStart,
860 &outLineEnd,
861 _self->ob_itself);
862 _res = Py_BuildValue("ll",
863 outLineStart,
864 outLineEnd);
865 return _res;
866}
867
868static PyObject *wasteObj_WEGetHeight(wasteObject *_self, PyObject *_args)
869{
870 PyObject *_res = NULL;
871 SInt32 _rv;
872 SInt32 inStartLineIndex;
873 SInt32 inEndLineIndex;
874 if (!PyArg_ParseTuple(_args, "ll",
875 &inStartLineIndex,
876 &inEndLineIndex))
877 return NULL;
878 _rv = WEGetHeight(inStartLineIndex,
879 inEndLineIndex,
880 _self->ob_itself);
881 _res = Py_BuildValue("l",
882 _rv);
883 return _res;
884}
885
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000886static PyObject *wasteObj_WEGetOffset(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000887{
888 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +0000889 SInt32 _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +0000890 LongPt inPoint;
891 WEEdge outEdge;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000892 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +0000893 LongPt_Convert, &inPoint))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000894 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000895 _rv = WEGetOffset(&inPoint,
896 &outEdge,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000897 _self->ob_itself);
Jack Jansen97ed9072000-09-08 22:06:16 +0000898 _res = Py_BuildValue("lB",
Jack Jansen90ecdf41996-04-16 14:29:15 +0000899 _rv,
Jack Jansenb99e5212002-01-11 12:37:15 +0000900 outEdge);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000901 return _res;
902}
903
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000904static PyObject *wasteObj_WEGetPoint(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000905{
906 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000907 SInt32 inOffset;
908 SInt16 inDirection;
909 LongPt outPoint;
910 SInt16 outLineHeight;
Jack Jansen2268af51996-08-06 16:04:22 +0000911 if (!PyArg_ParseTuple(_args, "lh",
Jack Jansenb99e5212002-01-11 12:37:15 +0000912 &inOffset,
913 &inDirection))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000914 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000915 WEGetPoint(inOffset,
916 inDirection,
917 &outPoint,
918 &outLineHeight,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000919 _self->ob_itself);
920 _res = Py_BuildValue("O&h",
Jack Jansenb99e5212002-01-11 12:37:15 +0000921 LongPt_New, &outPoint,
922 outLineHeight);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000923 return _res;
924}
925
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000926static PyObject *wasteObj_WEFindWord(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000927{
928 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000929 SInt32 inOffset;
930 WEEdge inEdge;
931 SInt32 outWordStart;
932 SInt32 outWordEnd;
Jack Jansen97ed9072000-09-08 22:06:16 +0000933 if (!PyArg_ParseTuple(_args, "lB",
Jack Jansenb99e5212002-01-11 12:37:15 +0000934 &inOffset,
935 &inEdge))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000936 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000937 WEFindWord(inOffset,
938 inEdge,
939 &outWordStart,
940 &outWordEnd,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000941 _self->ob_itself);
942 _res = Py_BuildValue("ll",
Jack Jansenb99e5212002-01-11 12:37:15 +0000943 outWordStart,
944 outWordEnd);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000945 return _res;
946}
947
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000948static PyObject *wasteObj_WEFindLine(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000949{
950 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000951 SInt32 inOffset;
952 WEEdge inEdge;
953 SInt32 outLineStart;
954 SInt32 outLineEnd;
Jack Jansen97ed9072000-09-08 22:06:16 +0000955 if (!PyArg_ParseTuple(_args, "lB",
Jack Jansenb99e5212002-01-11 12:37:15 +0000956 &inOffset,
957 &inEdge))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000958 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000959 WEFindLine(inOffset,
960 inEdge,
961 &outLineStart,
962 &outLineEnd,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000963 _self->ob_itself);
964 _res = Py_BuildValue("ll",
Jack Jansenb99e5212002-01-11 12:37:15 +0000965 outLineStart,
966 outLineEnd);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000967 return _res;
968}
969
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000970static PyObject *wasteObj_WEFindParagraph(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +0000971{
972 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000973 SInt32 inOffset;
974 WEEdge inEdge;
975 SInt32 outParagraphStart;
976 SInt32 outParagraphEnd;
Jack Jansen97ed9072000-09-08 22:06:16 +0000977 if (!PyArg_ParseTuple(_args, "lB",
Jack Jansenb99e5212002-01-11 12:37:15 +0000978 &inOffset,
979 &inEdge))
Jack Jansen2369a981998-02-20 15:57:30 +0000980 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000981 WEFindParagraph(inOffset,
982 inEdge,
983 &outParagraphStart,
984 &outParagraphEnd,
Jack Jansen2369a981998-02-20 15:57:30 +0000985 _self->ob_itself);
986 _res = Py_BuildValue("ll",
Jack Jansenb99e5212002-01-11 12:37:15 +0000987 outParagraphStart,
988 outParagraphEnd);
989 return _res;
990}
991
992static PyObject *wasteObj_WEFind(wasteObject *_self, PyObject *_args)
993{
994 PyObject *_res = NULL;
995 OSErr _err;
996 char* inKey;
997 SInt32 inKeyLength;
998 TextEncoding inKeyEncoding;
999 OptionBits inMatchOptions;
1000 SInt32 inRangeStart;
1001 SInt32 inRangeEnd;
1002 SInt32 outMatchStart;
1003 SInt32 outMatchEnd;
1004 if (!PyArg_ParseTuple(_args, "slllll",
1005 &inKey,
1006 &inKeyLength,
1007 &inKeyEncoding,
1008 &inMatchOptions,
1009 &inRangeStart,
1010 &inRangeEnd))
1011 return NULL;
1012 _err = WEFind(inKey,
1013 inKeyLength,
1014 inKeyEncoding,
1015 inMatchOptions,
1016 inRangeStart,
1017 inRangeEnd,
1018 &outMatchStart,
1019 &outMatchEnd,
1020 _self->ob_itself);
1021 if (_err != noErr) return PyMac_Error(_err);
1022 _res = Py_BuildValue("ll",
1023 outMatchStart,
1024 outMatchEnd);
1025 return _res;
1026}
1027
1028static PyObject *wasteObj_WEStreamRange(wasteObject *_self, PyObject *_args)
1029{
1030 PyObject *_res = NULL;
1031 OSErr _err;
1032 SInt32 inRangeStart;
1033 SInt32 inRangeEnd;
1034 FlavorType inRequestedType;
1035 OptionBits inStreamOptions;
1036 Handle outData;
1037 if (!PyArg_ParseTuple(_args, "llO&lO&",
1038 &inRangeStart,
1039 &inRangeEnd,
1040 PyMac_GetOSType, &inRequestedType,
1041 &inStreamOptions,
1042 ResObj_Convert, &outData))
1043 return NULL;
1044 _err = WEStreamRange(inRangeStart,
1045 inRangeEnd,
1046 inRequestedType,
1047 inStreamOptions,
1048 outData,
1049 _self->ob_itself);
1050 if (_err != noErr) return PyMac_Error(_err);
1051 Py_INCREF(Py_None);
1052 _res = Py_None;
Jack Jansen2369a981998-02-20 15:57:30 +00001053 return _res;
1054}
1055
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001056static PyObject *wasteObj_WECopyRange(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001057{
1058 PyObject *_res = NULL;
1059 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001060 SInt32 inRangeStart;
1061 SInt32 inRangeEnd;
1062 Handle outText;
1063 StScrpHandle outStyles;
1064 WESoupHandle outSoup;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001065 if (!PyArg_ParseTuple(_args, "llO&O&O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001066 &inRangeStart,
1067 &inRangeEnd,
1068 OptResObj_Convert, &outText,
1069 OptResObj_Convert, &outStyles,
1070 OptResObj_Convert, &outSoup))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001071 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001072 _err = WECopyRange(inRangeStart,
1073 inRangeEnd,
1074 outText,
1075 outStyles,
1076 outSoup,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001077 _self->ob_itself);
1078 if (_err != noErr) return PyMac_Error(_err);
1079 Py_INCREF(Py_None);
1080 _res = Py_None;
1081 return _res;
1082}
1083
Jack Jansenb99e5212002-01-11 12:37:15 +00001084static PyObject *wasteObj_WEGetTextRangeAsUnicode(wasteObject *_self, PyObject *_args)
1085{
1086 PyObject *_res = NULL;
1087 OSErr _err;
1088 SInt32 inRangeStart;
1089 SInt32 inRangeEnd;
1090 Handle outUnicodeText;
1091 Handle ioCharFormat;
1092 Handle ioParaFormat;
1093 TextEncodingVariant inUnicodeVariant;
1094 TextEncodingFormat inTransformationFormat;
1095 OptionBits inGetOptions;
1096 if (!PyArg_ParseTuple(_args, "llO&O&O&lll",
1097 &inRangeStart,
1098 &inRangeEnd,
1099 ResObj_Convert, &outUnicodeText,
1100 ResObj_Convert, &ioCharFormat,
1101 ResObj_Convert, &ioParaFormat,
1102 &inUnicodeVariant,
1103 &inTransformationFormat,
1104 &inGetOptions))
1105 return NULL;
1106 _err = WEGetTextRangeAsUnicode(inRangeStart,
1107 inRangeEnd,
1108 outUnicodeText,
1109 ioCharFormat,
1110 ioParaFormat,
1111 inUnicodeVariant,
1112 inTransformationFormat,
1113 inGetOptions,
1114 _self->ob_itself);
1115 if (_err != noErr) return PyMac_Error(_err);
1116 Py_INCREF(Py_None);
1117 _res = Py_None;
1118 return _res;
1119}
1120
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001121static PyObject *wasteObj_WEGetAlignment(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001122{
1123 PyObject *_res = NULL;
1124 WEAlignment _rv;
1125 if (!PyArg_ParseTuple(_args, ""))
1126 return NULL;
1127 _rv = WEGetAlignment(_self->ob_itself);
Jack Jansen97ed9072000-09-08 22:06:16 +00001128 _res = Py_BuildValue("B",
Jack Jansen90ecdf41996-04-16 14:29:15 +00001129 _rv);
1130 return _res;
1131}
1132
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001133static PyObject *wasteObj_WESetAlignment(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001134{
1135 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001136 WEAlignment inAlignment;
Jack Jansen97ed9072000-09-08 22:06:16 +00001137 if (!PyArg_ParseTuple(_args, "B",
Jack Jansenb99e5212002-01-11 12:37:15 +00001138 &inAlignment))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001139 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001140 WESetAlignment(inAlignment,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001141 _self->ob_itself);
1142 Py_INCREF(Py_None);
1143 _res = Py_None;
1144 return _res;
1145}
1146
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001147static PyObject *wasteObj_WEGetDirection(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00001148{
1149 PyObject *_res = NULL;
1150 WEDirection _rv;
1151 if (!PyArg_ParseTuple(_args, ""))
1152 return NULL;
1153 _rv = WEGetDirection(_self->ob_itself);
1154 _res = Py_BuildValue("h",
1155 _rv);
1156 return _res;
1157}
1158
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001159static PyObject *wasteObj_WESetDirection(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00001160{
1161 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001162 WEDirection inDirection;
Jack Jansen2369a981998-02-20 15:57:30 +00001163 if (!PyArg_ParseTuple(_args, "h",
Jack Jansenb99e5212002-01-11 12:37:15 +00001164 &inDirection))
Jack Jansen2369a981998-02-20 15:57:30 +00001165 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001166 WESetDirection(inDirection,
Jack Jansen2369a981998-02-20 15:57:30 +00001167 _self->ob_itself);
1168 Py_INCREF(Py_None);
1169 _res = Py_None;
1170 return _res;
1171}
1172
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001173static PyObject *wasteObj_WECalText(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001174{
1175 PyObject *_res = NULL;
1176 OSErr _err;
1177 if (!PyArg_ParseTuple(_args, ""))
1178 return NULL;
1179 _err = WECalText(_self->ob_itself);
1180 if (_err != noErr) return PyMac_Error(_err);
1181 Py_INCREF(Py_None);
1182 _res = Py_None;
1183 return _res;
1184}
1185
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001186static PyObject *wasteObj_WEUpdate(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001187{
1188 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001189 RgnHandle inUpdateRgn;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001190 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001191 ResObj_Convert, &inUpdateRgn))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001192 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001193 WEUpdate(inUpdateRgn,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001194 _self->ob_itself);
1195 Py_INCREF(Py_None);
1196 _res = Py_None;
1197 return _res;
1198}
1199
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001200static PyObject *wasteObj_WEScroll(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001201{
1202 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001203 SInt32 inHorizontalOffset;
1204 SInt32 inVerticalOffset;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001205 if (!PyArg_ParseTuple(_args, "ll",
Jack Jansenb99e5212002-01-11 12:37:15 +00001206 &inHorizontalOffset,
1207 &inVerticalOffset))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001208 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001209 WEScroll(inHorizontalOffset,
1210 inVerticalOffset,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001211 _self->ob_itself);
1212 Py_INCREF(Py_None);
1213 _res = Py_None;
1214 return _res;
1215}
1216
Jack Jansenb99e5212002-01-11 12:37:15 +00001217static PyObject *wasteObj_WEPinScroll(wasteObject *_self, PyObject *_args)
1218{
1219 PyObject *_res = NULL;
1220 SInt32 inHorizontalOffset;
1221 SInt32 inVerticalOffset;
1222 if (!PyArg_ParseTuple(_args, "ll",
1223 &inHorizontalOffset,
1224 &inVerticalOffset))
1225 return NULL;
1226 WEPinScroll(inHorizontalOffset,
1227 inVerticalOffset,
1228 _self->ob_itself);
1229 Py_INCREF(Py_None);
1230 _res = Py_None;
1231 return _res;
1232}
1233
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001234static PyObject *wasteObj_WESelView(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001235{
1236 PyObject *_res = NULL;
1237 if (!PyArg_ParseTuple(_args, ""))
1238 return NULL;
1239 WESelView(_self->ob_itself);
1240 Py_INCREF(Py_None);
1241 _res = Py_None;
1242 return _res;
1243}
1244
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001245static PyObject *wasteObj_WEActivate(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001246{
1247 PyObject *_res = NULL;
1248 if (!PyArg_ParseTuple(_args, ""))
1249 return NULL;
1250 WEActivate(_self->ob_itself);
1251 Py_INCREF(Py_None);
1252 _res = Py_None;
1253 return _res;
1254}
1255
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001256static PyObject *wasteObj_WEDeactivate(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001257{
1258 PyObject *_res = NULL;
1259 if (!PyArg_ParseTuple(_args, ""))
1260 return NULL;
1261 WEDeactivate(_self->ob_itself);
1262 Py_INCREF(Py_None);
1263 _res = Py_None;
1264 return _res;
1265}
1266
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001267static PyObject *wasteObj_WEKey(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001268{
1269 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001270 CharParameter inKey;
1271 EventModifiers inModifiers;
Jack Jansen9d8b96c2000-07-14 22:16:45 +00001272 if (!PyArg_ParseTuple(_args, "hH",
Jack Jansenb99e5212002-01-11 12:37:15 +00001273 &inKey,
1274 &inModifiers))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001275 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001276 WEKey(inKey,
1277 inModifiers,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001278 _self->ob_itself);
1279 Py_INCREF(Py_None);
1280 _res = Py_None;
1281 return _res;
1282}
1283
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001284static PyObject *wasteObj_WEClick(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001285{
1286 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001287 Point inHitPoint;
1288 EventModifiers inModifiers;
1289 UInt32 inClickTime;
Jack Jansen9d8b96c2000-07-14 22:16:45 +00001290 if (!PyArg_ParseTuple(_args, "O&Hl",
Jack Jansenb99e5212002-01-11 12:37:15 +00001291 PyMac_GetPoint, &inHitPoint,
1292 &inModifiers,
1293 &inClickTime))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001294 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001295 WEClick(inHitPoint,
1296 inModifiers,
1297 inClickTime,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001298 _self->ob_itself);
1299 Py_INCREF(Py_None);
1300 _res = Py_None;
1301 return _res;
1302}
1303
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001304static PyObject *wasteObj_WEAdjustCursor(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001305{
1306 PyObject *_res = NULL;
1307 Boolean _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00001308 Point inMouseLoc;
1309 RgnHandle ioMouseRgn;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001310 if (!PyArg_ParseTuple(_args, "O&O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001311 PyMac_GetPoint, &inMouseLoc,
1312 ResObj_Convert, &ioMouseRgn))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001313 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001314 _rv = WEAdjustCursor(inMouseLoc,
1315 ioMouseRgn,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001316 _self->ob_itself);
1317 _res = Py_BuildValue("b",
1318 _rv);
1319 return _res;
1320}
1321
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001322static PyObject *wasteObj_WEIdle(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001323{
1324 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001325 UInt32 outMaxSleep;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001326 if (!PyArg_ParseTuple(_args, ""))
1327 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001328 WEIdle(&outMaxSleep,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001329 _self->ob_itself);
1330 _res = Py_BuildValue("l",
Jack Jansenb99e5212002-01-11 12:37:15 +00001331 outMaxSleep);
Jack Jansen90ecdf41996-04-16 14:29:15 +00001332 return _res;
1333}
1334
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001335static PyObject *wasteObj_WEInsert(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001336{
1337 PyObject *_res = NULL;
1338 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001339 char *inTextPtr__in__;
1340 long inTextPtr__len__;
1341 int inTextPtr__in_len__;
1342 StScrpHandle inStyles;
1343 WESoupHandle inSoup;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001344 if (!PyArg_ParseTuple(_args, "s#O&O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001345 &inTextPtr__in__, &inTextPtr__in_len__,
1346 OptResObj_Convert, &inStyles,
1347 OptResObj_Convert, &inSoup))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001348 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001349 inTextPtr__len__ = inTextPtr__in_len__;
1350 _err = WEInsert(inTextPtr__in__, inTextPtr__len__,
1351 inStyles,
1352 inSoup,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001353 _self->ob_itself);
1354 if (_err != noErr) return PyMac_Error(_err);
1355 Py_INCREF(Py_None);
1356 _res = Py_None;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001357 return _res;
1358}
1359
Jack Jansenb99e5212002-01-11 12:37:15 +00001360static PyObject *wasteObj_WEInsertFormattedText(wasteObject *_self, PyObject *_args)
1361{
1362 PyObject *_res = NULL;
1363 OSErr _err;
1364 char *inTextPtr__in__;
1365 long inTextPtr__len__;
1366 int inTextPtr__in_len__;
1367 StScrpHandle inStyles;
1368 WESoupHandle inSoup;
1369 Handle inParaFormat;
1370 Handle inRulerScrap;
1371 if (!PyArg_ParseTuple(_args, "s#O&O&O&O&",
1372 &inTextPtr__in__, &inTextPtr__in_len__,
1373 OptResObj_Convert, &inStyles,
1374 OptResObj_Convert, &inSoup,
1375 ResObj_Convert, &inParaFormat,
1376 ResObj_Convert, &inRulerScrap))
1377 return NULL;
1378 inTextPtr__len__ = inTextPtr__in_len__;
1379 _err = WEInsertFormattedText(inTextPtr__in__, inTextPtr__len__,
1380 inStyles,
1381 inSoup,
1382 inParaFormat,
1383 inRulerScrap,
1384 _self->ob_itself);
1385 if (_err != noErr) return PyMac_Error(_err);
1386 Py_INCREF(Py_None);
1387 _res = Py_None;
1388 return _res;
1389}
1390
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001391static PyObject *wasteObj_WEDelete(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001392{
1393 PyObject *_res = NULL;
1394 OSErr _err;
1395 if (!PyArg_ParseTuple(_args, ""))
1396 return NULL;
1397 _err = WEDelete(_self->ob_itself);
1398 if (_err != noErr) return PyMac_Error(_err);
1399 Py_INCREF(Py_None);
1400 _res = Py_None;
1401 return _res;
1402}
1403
Jack Jansenb99e5212002-01-11 12:37:15 +00001404static PyObject *wasteObj_WEUseText(wasteObject *_self, PyObject *_args)
1405{
1406 PyObject *_res = NULL;
1407 OSErr _err;
1408 Handle inText;
1409 if (!PyArg_ParseTuple(_args, "O&",
1410 ResObj_Convert, &inText))
1411 return NULL;
1412 _err = WEUseText(inText,
1413 _self->ob_itself);
1414 if (_err != noErr) return PyMac_Error(_err);
1415 Py_INCREF(Py_None);
1416 _res = Py_None;
1417 return _res;
1418}
1419
1420static PyObject *wasteObj_WEChangeCase(wasteObject *_self, PyObject *_args)
1421{
1422 PyObject *_res = NULL;
1423 OSErr _err;
1424 SInt16 inCase;
1425 if (!PyArg_ParseTuple(_args, "h",
1426 &inCase))
1427 return NULL;
1428 _err = WEChangeCase(inCase,
1429 _self->ob_itself);
1430 if (_err != noErr) return PyMac_Error(_err);
1431 Py_INCREF(Py_None);
1432 _res = Py_None;
1433 return _res;
1434}
1435
1436static PyObject *wasteObj_WESetOneAttribute(wasteObject *_self, PyObject *_args)
1437{
1438 PyObject *_res = NULL;
1439 OSErr _err;
1440 SInt32 inRangeStart;
1441 SInt32 inRangeEnd;
1442 WESelector inAttributeSelector;
1443 char *inAttributeValue__in__;
1444 long inAttributeValue__len__;
1445 int inAttributeValue__in_len__;
1446 if (!PyArg_ParseTuple(_args, "llO&s#",
1447 &inRangeStart,
1448 &inRangeEnd,
1449 PyMac_GetOSType, &inAttributeSelector,
1450 &inAttributeValue__in__, &inAttributeValue__in_len__))
1451 return NULL;
1452 inAttributeValue__len__ = inAttributeValue__in_len__;
1453 _err = WESetOneAttribute(inRangeStart,
1454 inRangeEnd,
1455 inAttributeSelector,
1456 inAttributeValue__in__, inAttributeValue__len__,
1457 _self->ob_itself);
1458 if (_err != noErr) return PyMac_Error(_err);
1459 Py_INCREF(Py_None);
1460 _res = Py_None;
1461 return _res;
1462}
1463
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001464static PyObject *wasteObj_WESetStyle(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001465{
1466 PyObject *_res = NULL;
1467 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001468 WEStyleMode inMode;
1469 TextStyle inTextStyle;
Jack Jansen9d8b96c2000-07-14 22:16:45 +00001470 if (!PyArg_ParseTuple(_args, "HO&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001471 &inMode,
1472 TextStyle_Convert, &inTextStyle))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001473 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001474 _err = WESetStyle(inMode,
1475 &inTextStyle,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001476 _self->ob_itself);
1477 if (_err != noErr) return PyMac_Error(_err);
1478 Py_INCREF(Py_None);
1479 _res = Py_None;
1480 return _res;
1481}
1482
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001483static PyObject *wasteObj_WEUseStyleScrap(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001484{
1485 PyObject *_res = NULL;
1486 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001487 StScrpHandle inStyles;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001488 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001489 ResObj_Convert, &inStyles))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001490 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001491 _err = WEUseStyleScrap(inStyles,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001492 _self->ob_itself);
1493 if (_err != noErr) return PyMac_Error(_err);
1494 Py_INCREF(Py_None);
1495 _res = Py_None;
1496 return _res;
1497}
1498
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001499static PyObject *wasteObj_WEUndo(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001500{
1501 PyObject *_res = NULL;
1502 OSErr _err;
1503 if (!PyArg_ParseTuple(_args, ""))
1504 return NULL;
1505 _err = WEUndo(_self->ob_itself);
1506 if (_err != noErr) return PyMac_Error(_err);
1507 Py_INCREF(Py_None);
1508 _res = Py_None;
1509 return _res;
1510}
1511
Jack Jansenb99e5212002-01-11 12:37:15 +00001512static PyObject *wasteObj_WERedo(wasteObject *_self, PyObject *_args)
1513{
1514 PyObject *_res = NULL;
1515 OSErr _err;
1516 if (!PyArg_ParseTuple(_args, ""))
1517 return NULL;
1518 _err = WERedo(_self->ob_itself);
1519 if (_err != noErr) return PyMac_Error(_err);
1520 Py_INCREF(Py_None);
1521 _res = Py_None;
1522 return _res;
1523}
1524
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001525static PyObject *wasteObj_WEClearUndo(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001526{
1527 PyObject *_res = NULL;
1528 if (!PyArg_ParseTuple(_args, ""))
1529 return NULL;
1530 WEClearUndo(_self->ob_itself);
1531 Py_INCREF(Py_None);
1532 _res = Py_None;
1533 return _res;
1534}
1535
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001536static PyObject *wasteObj_WEGetUndoInfo(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001537{
1538 PyObject *_res = NULL;
1539 WEActionKind _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00001540 Boolean outRedoFlag;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001541 if (!PyArg_ParseTuple(_args, ""))
1542 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001543 _rv = WEGetUndoInfo(&outRedoFlag,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001544 _self->ob_itself);
1545 _res = Py_BuildValue("hb",
1546 _rv,
Jack Jansenb99e5212002-01-11 12:37:15 +00001547 outRedoFlag);
1548 return _res;
1549}
1550
1551static PyObject *wasteObj_WEGetIndUndoInfo(wasteObject *_self, PyObject *_args)
1552{
1553 PyObject *_res = NULL;
1554 WEActionKind _rv;
1555 SInt32 inUndoLevel;
1556 if (!PyArg_ParseTuple(_args, "l",
1557 &inUndoLevel))
1558 return NULL;
1559 _rv = WEGetIndUndoInfo(inUndoLevel,
1560 _self->ob_itself);
1561 _res = Py_BuildValue("h",
1562 _rv);
Jack Jansen90ecdf41996-04-16 14:29:15 +00001563 return _res;
1564}
1565
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001566static PyObject *wasteObj_WEIsTyping(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001567{
1568 PyObject *_res = NULL;
1569 Boolean _rv;
1570 if (!PyArg_ParseTuple(_args, ""))
1571 return NULL;
1572 _rv = WEIsTyping(_self->ob_itself);
1573 _res = Py_BuildValue("b",
1574 _rv);
1575 return _res;
1576}
1577
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001578static PyObject *wasteObj_WEBeginAction(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00001579{
1580 PyObject *_res = NULL;
1581 OSErr _err;
1582 if (!PyArg_ParseTuple(_args, ""))
1583 return NULL;
1584 _err = WEBeginAction(_self->ob_itself);
1585 if (_err != noErr) return PyMac_Error(_err);
1586 Py_INCREF(Py_None);
1587 _res = Py_None;
1588 return _res;
1589}
1590
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001591static PyObject *wasteObj_WEEndAction(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00001592{
1593 PyObject *_res = NULL;
1594 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001595 WEActionKind inActionKind;
Jack Jansen2369a981998-02-20 15:57:30 +00001596 if (!PyArg_ParseTuple(_args, "h",
Jack Jansenb99e5212002-01-11 12:37:15 +00001597 &inActionKind))
Jack Jansen2369a981998-02-20 15:57:30 +00001598 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001599 _err = WEEndAction(inActionKind,
Jack Jansen2369a981998-02-20 15:57:30 +00001600 _self->ob_itself);
1601 if (_err != noErr) return PyMac_Error(_err);
1602 Py_INCREF(Py_None);
1603 _res = Py_None;
1604 return _res;
1605}
1606
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001607static PyObject *wasteObj_WEGetModCount(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001608{
1609 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +00001610 UInt32 _rv;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001611 if (!PyArg_ParseTuple(_args, ""))
1612 return NULL;
1613 _rv = WEGetModCount(_self->ob_itself);
1614 _res = Py_BuildValue("l",
1615 _rv);
1616 return _res;
1617}
1618
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001619static PyObject *wasteObj_WEResetModCount(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001620{
1621 PyObject *_res = NULL;
1622 if (!PyArg_ParseTuple(_args, ""))
1623 return NULL;
1624 WEResetModCount(_self->ob_itself);
1625 Py_INCREF(Py_None);
1626 _res = Py_None;
1627 return _res;
1628}
1629
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001630static PyObject *wasteObj_WEInsertObject(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001631{
1632 PyObject *_res = NULL;
1633 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001634 FlavorType inObjectType;
1635 Handle inObjectDataHandle;
1636 Point inObjectSize;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001637 if (!PyArg_ParseTuple(_args, "O&O&O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001638 PyMac_GetOSType, &inObjectType,
1639 ResObj_Convert, &inObjectDataHandle,
1640 PyMac_GetPoint, &inObjectSize))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001641 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001642 _err = WEInsertObject(inObjectType,
1643 inObjectDataHandle,
1644 inObjectSize,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001645 _self->ob_itself);
1646 if (_err != noErr) return PyMac_Error(_err);
1647 Py_INCREF(Py_None);
1648 _res = Py_None;
1649 return _res;
1650}
1651
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001652static PyObject *wasteObj_WEGetSelectedObject(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001653{
1654 PyObject *_res = NULL;
1655 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001656 WEObjectReference outObject;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001657 if (!PyArg_ParseTuple(_args, ""))
1658 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001659 _err = WEGetSelectedObject(&outObject,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001660 _self->ob_itself);
1661 if (_err != noErr) return PyMac_Error(_err);
1662 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001663 WEOObj_New, outObject);
1664 return _res;
1665}
1666
1667static PyObject *wasteObj_WEGetObjectAtOffset(wasteObject *_self, PyObject *_args)
1668{
1669 PyObject *_res = NULL;
1670 OSErr _err;
1671 SInt32 inOffset;
1672 WEObjectReference outObject;
1673 if (!PyArg_ParseTuple(_args, "l",
1674 &inOffset))
1675 return NULL;
1676 _err = WEGetObjectAtOffset(inOffset,
1677 &outObject,
1678 _self->ob_itself);
1679 if (_err != noErr) return PyMac_Error(_err);
1680 _res = Py_BuildValue("O&",
1681 WEOObj_New, outObject);
Jack Jansen90ecdf41996-04-16 14:29:15 +00001682 return _res;
1683}
1684
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001685static PyObject *wasteObj_WEFindNextObject(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001686{
1687 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +00001688 SInt32 _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00001689 SInt32 inOffset;
1690 WEObjectReference outObject;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001691 if (!PyArg_ParseTuple(_args, "l",
Jack Jansenb99e5212002-01-11 12:37:15 +00001692 &inOffset))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001693 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001694 _rv = WEFindNextObject(inOffset,
1695 &outObject,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001696 _self->ob_itself);
1697 _res = Py_BuildValue("lO&",
1698 _rv,
Jack Jansenb99e5212002-01-11 12:37:15 +00001699 WEOObj_New, outObject);
Jack Jansen90ecdf41996-04-16 14:29:15 +00001700 return _res;
1701}
1702
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001703static PyObject *wasteObj_WEUseSoup(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001704{
1705 PyObject *_res = NULL;
1706 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001707 WESoupHandle inSoup;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001708 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001709 ResObj_Convert, &inSoup))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001710 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001711 _err = WEUseSoup(inSoup,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001712 _self->ob_itself);
1713 if (_err != noErr) return PyMac_Error(_err);
1714 Py_INCREF(Py_None);
1715 _res = Py_None;
1716 return _res;
1717}
1718
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001719static PyObject *wasteObj_WECut(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001720{
1721 PyObject *_res = NULL;
1722 OSErr _err;
1723 if (!PyArg_ParseTuple(_args, ""))
1724 return NULL;
1725 _err = WECut(_self->ob_itself);
1726 if (_err != noErr) return PyMac_Error(_err);
1727 Py_INCREF(Py_None);
1728 _res = Py_None;
1729 return _res;
1730}
1731
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001732static PyObject *wasteObj_WECopy(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001733{
1734 PyObject *_res = NULL;
1735 OSErr _err;
1736 if (!PyArg_ParseTuple(_args, ""))
1737 return NULL;
1738 _err = WECopy(_self->ob_itself);
1739 if (_err != noErr) return PyMac_Error(_err);
1740 Py_INCREF(Py_None);
1741 _res = Py_None;
1742 return _res;
1743}
1744
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001745static PyObject *wasteObj_WEPaste(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001746{
1747 PyObject *_res = NULL;
1748 OSErr _err;
1749 if (!PyArg_ParseTuple(_args, ""))
1750 return NULL;
1751 _err = WEPaste(_self->ob_itself);
1752 if (_err != noErr) return PyMac_Error(_err);
1753 Py_INCREF(Py_None);
1754 _res = Py_None;
1755 return _res;
1756}
1757
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001758static PyObject *wasteObj_WECanPaste(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001759{
1760 PyObject *_res = NULL;
1761 Boolean _rv;
1762 if (!PyArg_ParseTuple(_args, ""))
1763 return NULL;
1764 _rv = WECanPaste(_self->ob_itself);
1765 _res = Py_BuildValue("b",
1766 _rv);
1767 return _res;
1768}
1769
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001770static PyObject *wasteObj_WEGetHiliteRgn(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001771{
1772 PyObject *_res = NULL;
1773 RgnHandle _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00001774 SInt32 inRangeStart;
1775 SInt32 inRangeEnd;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001776 if (!PyArg_ParseTuple(_args, "ll",
Jack Jansenb99e5212002-01-11 12:37:15 +00001777 &inRangeStart,
1778 &inRangeEnd))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001779 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001780 _rv = WEGetHiliteRgn(inRangeStart,
1781 inRangeEnd,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001782 _self->ob_itself);
1783 _res = Py_BuildValue("O&",
1784 ResObj_New, _rv);
1785 return _res;
1786}
1787
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001788static PyObject *wasteObj_WECharByte(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001789{
1790 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +00001791 SInt16 _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00001792 SInt32 inOffset;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001793 if (!PyArg_ParseTuple(_args, "l",
Jack Jansenb99e5212002-01-11 12:37:15 +00001794 &inOffset))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001795 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001796 _rv = WECharByte(inOffset,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001797 _self->ob_itself);
1798 _res = Py_BuildValue("h",
1799 _rv);
1800 return _res;
1801}
1802
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001803static PyObject *wasteObj_WECharType(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001804{
1805 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +00001806 SInt16 _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00001807 SInt32 inOffset;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001808 if (!PyArg_ParseTuple(_args, "l",
Jack Jansenb99e5212002-01-11 12:37:15 +00001809 &inOffset))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001810 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001811 _rv = WECharType(inOffset,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001812 _self->ob_itself);
1813 _res = Py_BuildValue("h",
1814 _rv);
1815 return _res;
1816}
1817
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001818static PyObject *wasteObj_WEStopInlineSession(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001819{
1820 PyObject *_res = NULL;
1821 if (!PyArg_ParseTuple(_args, ""))
1822 return NULL;
1823 WEStopInlineSession(_self->ob_itself);
1824 Py_INCREF(Py_None);
1825 _res = Py_None;
1826 return _res;
1827}
1828
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001829static PyObject *wasteObj_WEFeatureFlag(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001830{
1831 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +00001832 SInt16 _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00001833 SInt16 inFeature;
1834 SInt16 inAction;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001835 if (!PyArg_ParseTuple(_args, "hh",
Jack Jansenb99e5212002-01-11 12:37:15 +00001836 &inFeature,
1837 &inAction))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001838 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001839 _rv = WEFeatureFlag(inFeature,
1840 inAction,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001841 _self->ob_itself);
1842 _res = Py_BuildValue("h",
1843 _rv);
1844 return _res;
1845}
1846
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001847static PyObject *wasteObj_WEGetUserInfo(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00001848{
1849 PyObject *_res = NULL;
1850 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001851 WESelector inUserTag;
1852 SInt32 outUserInfo;
Jack Jansen2369a981998-02-20 15:57:30 +00001853 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001854 PyMac_GetOSType, &inUserTag))
Jack Jansen2369a981998-02-20 15:57:30 +00001855 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001856 _err = WEGetUserInfo(inUserTag,
1857 &outUserInfo,
Jack Jansen2369a981998-02-20 15:57:30 +00001858 _self->ob_itself);
1859 if (_err != noErr) return PyMac_Error(_err);
1860 _res = Py_BuildValue("l",
Jack Jansenb99e5212002-01-11 12:37:15 +00001861 outUserInfo);
Jack Jansen2369a981998-02-20 15:57:30 +00001862 return _res;
1863}
1864
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001865static PyObject *wasteObj_WESetUserInfo(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00001866{
1867 PyObject *_res = NULL;
1868 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001869 WESelector inUserTag;
1870 SInt32 inUserInfo;
Jack Jansen2369a981998-02-20 15:57:30 +00001871 if (!PyArg_ParseTuple(_args, "O&l",
Jack Jansenb99e5212002-01-11 12:37:15 +00001872 PyMac_GetOSType, &inUserTag,
1873 &inUserInfo))
Jack Jansen2369a981998-02-20 15:57:30 +00001874 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001875 _err = WESetUserInfo(inUserTag,
1876 inUserInfo,
Jack Jansen2369a981998-02-20 15:57:30 +00001877 _self->ob_itself);
1878 if (_err != noErr) return PyMac_Error(_err);
1879 Py_INCREF(Py_None);
1880 _res = Py_None;
1881 return _res;
1882}
1883
Jack Jansenb99e5212002-01-11 12:37:15 +00001884static PyObject *wasteObj_WERemoveUserInfo(wasteObject *_self, PyObject *_args)
1885{
1886 PyObject *_res = NULL;
1887 OSErr _err;
1888 WESelector inUserTag;
1889 if (!PyArg_ParseTuple(_args, "O&",
1890 PyMac_GetOSType, &inUserTag))
1891 return NULL;
1892 _err = WERemoveUserInfo(inUserTag,
1893 _self->ob_itself);
1894 if (_err != noErr) return PyMac_Error(_err);
1895 Py_INCREF(Py_None);
1896 _res = Py_None;
1897 return _res;
1898}
1899
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001900static PyObject *wasteObj_WEInstallTabHooks(wasteObject *_self, PyObject *_args)
Jack Jansen176f3a91996-10-23 15:43:46 +00001901{
1902 PyObject *_res = NULL;
1903 OSErr _err;
1904 if (!PyArg_ParseTuple(_args, ""))
1905 return NULL;
1906 _err = WEInstallTabHooks(_self->ob_itself);
1907 if (_err != noErr) return PyMac_Error(_err);
1908 Py_INCREF(Py_None);
1909 _res = Py_None;
1910 return _res;
1911}
1912
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001913static PyObject *wasteObj_WERemoveTabHooks(wasteObject *_self, PyObject *_args)
Jack Jansen176f3a91996-10-23 15:43:46 +00001914{
1915 PyObject *_res = NULL;
1916 OSErr _err;
1917 if (!PyArg_ParseTuple(_args, ""))
1918 return NULL;
1919 _err = WERemoveTabHooks(_self->ob_itself);
1920 if (_err != noErr) return PyMac_Error(_err);
1921 Py_INCREF(Py_None);
1922 _res = Py_None;
1923 return _res;
1924}
1925
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001926static PyObject *wasteObj_WEIsTabHooks(wasteObject *_self, PyObject *_args)
Jack Jansen176f3a91996-10-23 15:43:46 +00001927{
1928 PyObject *_res = NULL;
1929 Boolean _rv;
1930 if (!PyArg_ParseTuple(_args, ""))
1931 return NULL;
1932 _rv = WEIsTabHooks(_self->ob_itself);
1933 _res = Py_BuildValue("b",
1934 _rv);
1935 return _res;
1936}
1937
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001938static PyObject *wasteObj_WEGetTabSize(wasteObject *_self, PyObject *_args)
Jack Jansena4f03091998-03-02 16:56:18 +00001939{
1940 PyObject *_res = NULL;
1941 SInt16 _rv;
1942 if (!PyArg_ParseTuple(_args, ""))
1943 return NULL;
1944 _rv = WEGetTabSize(_self->ob_itself);
1945 _res = Py_BuildValue("h",
1946 _rv);
1947 return _res;
1948}
1949
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001950static PyObject *wasteObj_WESetTabSize(wasteObject *_self, PyObject *_args)
Jack Jansena4f03091998-03-02 16:56:18 +00001951{
1952 PyObject *_res = NULL;
1953 OSErr _err;
1954 SInt16 tabWidth;
1955 if (!PyArg_ParseTuple(_args, "h",
1956 &tabWidth))
1957 return NULL;
1958 _err = WESetTabSize(tabWidth,
1959 _self->ob_itself);
1960 if (_err != noErr) return PyMac_Error(_err);
1961 Py_INCREF(Py_None);
1962 _res = Py_None;
1963 return _res;
1964}
1965
Jack Jansen90ecdf41996-04-16 14:29:15 +00001966static PyMethodDef wasteObj_methods[] = {
1967 {"WEGetText", (PyCFunction)wasteObj_WEGetText, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001968 PyDoc_STR("() -> (Handle _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001969 {"WEGetChar", (PyCFunction)wasteObj_WEGetChar, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001970 PyDoc_STR("(SInt32 inOffset) -> (SInt16 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001971 {"WEGetTextLength", (PyCFunction)wasteObj_WEGetTextLength, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001972 PyDoc_STR("() -> (SInt32 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001973 {"WEGetSelection", (PyCFunction)wasteObj_WEGetSelection, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001974 PyDoc_STR("() -> (SInt32 outSelStart, SInt32 outSelEnd)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001975 {"WEGetDestRect", (PyCFunction)wasteObj_WEGetDestRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001976 PyDoc_STR("() -> (LongRect outDestRect)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001977 {"WEGetViewRect", (PyCFunction)wasteObj_WEGetViewRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001978 PyDoc_STR("() -> (LongRect outViewRect)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001979 {"WEIsActive", (PyCFunction)wasteObj_WEIsActive, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001980 PyDoc_STR("() -> (Boolean _rv)")},
Jack Jansen2268af51996-08-06 16:04:22 +00001981 {"WEGetClickCount", (PyCFunction)wasteObj_WEGetClickCount, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001982 PyDoc_STR("() -> (UInt16 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001983 {"WESetSelection", (PyCFunction)wasteObj_WESetSelection, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001984 PyDoc_STR("(SInt32 inSelStart, SInt32 inSelEnd) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001985 {"WESetDestRect", (PyCFunction)wasteObj_WESetDestRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001986 PyDoc_STR("(LongRect inDestRect) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001987 {"WESetViewRect", (PyCFunction)wasteObj_WESetViewRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001988 PyDoc_STR("(LongRect inViewRect) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001989 {"WEContinuousStyle", (PyCFunction)wasteObj_WEContinuousStyle, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001990 PyDoc_STR("(WEStyleMode ioMode) -> (Boolean _rv, WEStyleMode ioMode, TextStyle outTextStyle)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001991 {"WECountRuns", (PyCFunction)wasteObj_WECountRuns, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001992 PyDoc_STR("() -> (SInt32 _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001993 {"WEOffsetToRun", (PyCFunction)wasteObj_WEOffsetToRun, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001994 PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001995 {"WEGetRunRange", (PyCFunction)wasteObj_WEGetRunRange, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001996 PyDoc_STR("(SInt32 inStyleRunIndex) -> (SInt32 outStyleRunStart, SInt32 outStyleRunEnd)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001997 {"WEGetRunInfo", (PyCFunction)wasteObj_WEGetRunInfo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001998 PyDoc_STR("(SInt32 inOffset) -> (WERunInfo outStyleRunInfo)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001999 {"WEGetIndRunInfo", (PyCFunction)wasteObj_WEGetIndRunInfo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002000 PyDoc_STR("(SInt32 inStyleRunIndex) -> (WERunInfo outStyleRunInfo)")},
Jack Jansen2369a981998-02-20 15:57:30 +00002001 {"WEGetRunDirection", (PyCFunction)wasteObj_WEGetRunDirection, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002002 PyDoc_STR("(SInt32 inOffset) -> (Boolean _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002003 {"WECountParaRuns", (PyCFunction)wasteObj_WECountParaRuns, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002004 PyDoc_STR("() -> (SInt32 _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002005 {"WEOffsetToParaRun", (PyCFunction)wasteObj_WEOffsetToParaRun, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002006 PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002007 {"WEGetParaRunRange", (PyCFunction)wasteObj_WEGetParaRunRange, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002008 PyDoc_STR("(SInt32 inParagraphRunIndex) -> (SInt32 outParagraphRunStart, SInt32 outParagraphRunEnd)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002009 {"WECountLines", (PyCFunction)wasteObj_WECountLines, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002010 PyDoc_STR("() -> (SInt32 _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002011 {"WEOffsetToLine", (PyCFunction)wasteObj_WEOffsetToLine, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002012 PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002013 {"WEGetLineRange", (PyCFunction)wasteObj_WEGetLineRange, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002014 PyDoc_STR("(SInt32 inLineIndex) -> (SInt32 outLineStart, SInt32 outLineEnd)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002015 {"WEGetHeight", (PyCFunction)wasteObj_WEGetHeight, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002016 PyDoc_STR("(SInt32 inStartLineIndex, SInt32 inEndLineIndex) -> (SInt32 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002017 {"WEGetOffset", (PyCFunction)wasteObj_WEGetOffset, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002018 PyDoc_STR("(LongPt inPoint) -> (SInt32 _rv, WEEdge outEdge)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002019 {"WEGetPoint", (PyCFunction)wasteObj_WEGetPoint, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002020 PyDoc_STR("(SInt32 inOffset, SInt16 inDirection) -> (LongPt outPoint, SInt16 outLineHeight)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002021 {"WEFindWord", (PyCFunction)wasteObj_WEFindWord, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002022 PyDoc_STR("(SInt32 inOffset, WEEdge inEdge) -> (SInt32 outWordStart, SInt32 outWordEnd)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002023 {"WEFindLine", (PyCFunction)wasteObj_WEFindLine, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002024 PyDoc_STR("(SInt32 inOffset, WEEdge inEdge) -> (SInt32 outLineStart, SInt32 outLineEnd)")},
Jack Jansen2369a981998-02-20 15:57:30 +00002025 {"WEFindParagraph", (PyCFunction)wasteObj_WEFindParagraph, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002026 PyDoc_STR("(SInt32 inOffset, WEEdge inEdge) -> (SInt32 outParagraphStart, SInt32 outParagraphEnd)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002027 {"WEFind", (PyCFunction)wasteObj_WEFind, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002028 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 +00002029 {"WEStreamRange", (PyCFunction)wasteObj_WEStreamRange, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002030 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd, FlavorType inRequestedType, OptionBits inStreamOptions, Handle outData) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002031 {"WECopyRange", (PyCFunction)wasteObj_WECopyRange, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002032 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd, Handle outText, StScrpHandle outStyles, WESoupHandle outSoup) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002033 {"WEGetTextRangeAsUnicode", (PyCFunction)wasteObj_WEGetTextRangeAsUnicode, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002034 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 +00002035 {"WEGetAlignment", (PyCFunction)wasteObj_WEGetAlignment, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002036 PyDoc_STR("() -> (WEAlignment _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002037 {"WESetAlignment", (PyCFunction)wasteObj_WESetAlignment, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002038 PyDoc_STR("(WEAlignment inAlignment) -> None")},
Jack Jansen2369a981998-02-20 15:57:30 +00002039 {"WEGetDirection", (PyCFunction)wasteObj_WEGetDirection, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002040 PyDoc_STR("() -> (WEDirection _rv)")},
Jack Jansen2369a981998-02-20 15:57:30 +00002041 {"WESetDirection", (PyCFunction)wasteObj_WESetDirection, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002042 PyDoc_STR("(WEDirection inDirection) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002043 {"WECalText", (PyCFunction)wasteObj_WECalText, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002044 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002045 {"WEUpdate", (PyCFunction)wasteObj_WEUpdate, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002046 PyDoc_STR("(RgnHandle inUpdateRgn) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002047 {"WEScroll", (PyCFunction)wasteObj_WEScroll, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002048 PyDoc_STR("(SInt32 inHorizontalOffset, SInt32 inVerticalOffset) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002049 {"WEPinScroll", (PyCFunction)wasteObj_WEPinScroll, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002050 PyDoc_STR("(SInt32 inHorizontalOffset, SInt32 inVerticalOffset) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002051 {"WESelView", (PyCFunction)wasteObj_WESelView, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002052 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002053 {"WEActivate", (PyCFunction)wasteObj_WEActivate, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002054 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002055 {"WEDeactivate", (PyCFunction)wasteObj_WEDeactivate, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002056 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002057 {"WEKey", (PyCFunction)wasteObj_WEKey, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002058 PyDoc_STR("(CharParameter inKey, EventModifiers inModifiers) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002059 {"WEClick", (PyCFunction)wasteObj_WEClick, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002060 PyDoc_STR("(Point inHitPoint, EventModifiers inModifiers, UInt32 inClickTime) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002061 {"WEAdjustCursor", (PyCFunction)wasteObj_WEAdjustCursor, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002062 PyDoc_STR("(Point inMouseLoc, RgnHandle ioMouseRgn) -> (Boolean _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002063 {"WEIdle", (PyCFunction)wasteObj_WEIdle, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002064 PyDoc_STR("() -> (UInt32 outMaxSleep)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002065 {"WEInsert", (PyCFunction)wasteObj_WEInsert, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002066 PyDoc_STR("(Buffer inTextPtr, StScrpHandle inStyles, WESoupHandle inSoup) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002067 {"WEInsertFormattedText", (PyCFunction)wasteObj_WEInsertFormattedText, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002068 PyDoc_STR("(Buffer inTextPtr, StScrpHandle inStyles, WESoupHandle inSoup, Handle inParaFormat, Handle inRulerScrap) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002069 {"WEDelete", (PyCFunction)wasteObj_WEDelete, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002070 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002071 {"WEUseText", (PyCFunction)wasteObj_WEUseText, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002072 PyDoc_STR("(Handle inText) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002073 {"WEChangeCase", (PyCFunction)wasteObj_WEChangeCase, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002074 PyDoc_STR("(SInt16 inCase) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002075 {"WESetOneAttribute", (PyCFunction)wasteObj_WESetOneAttribute, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002076 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd, WESelector inAttributeSelector, Buffer inAttributeValue) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002077 {"WESetStyle", (PyCFunction)wasteObj_WESetStyle, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002078 PyDoc_STR("(WEStyleMode inMode, TextStyle inTextStyle) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002079 {"WEUseStyleScrap", (PyCFunction)wasteObj_WEUseStyleScrap, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002080 PyDoc_STR("(StScrpHandle inStyles) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002081 {"WEUndo", (PyCFunction)wasteObj_WEUndo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002082 PyDoc_STR("() -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002083 {"WERedo", (PyCFunction)wasteObj_WERedo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002084 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002085 {"WEClearUndo", (PyCFunction)wasteObj_WEClearUndo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002086 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002087 {"WEGetUndoInfo", (PyCFunction)wasteObj_WEGetUndoInfo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002088 PyDoc_STR("() -> (WEActionKind _rv, Boolean outRedoFlag)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002089 {"WEGetIndUndoInfo", (PyCFunction)wasteObj_WEGetIndUndoInfo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002090 PyDoc_STR("(SInt32 inUndoLevel) -> (WEActionKind _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002091 {"WEIsTyping", (PyCFunction)wasteObj_WEIsTyping, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002092 PyDoc_STR("() -> (Boolean _rv)")},
Jack Jansen2369a981998-02-20 15:57:30 +00002093 {"WEBeginAction", (PyCFunction)wasteObj_WEBeginAction, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002094 PyDoc_STR("() -> None")},
Jack Jansen2369a981998-02-20 15:57:30 +00002095 {"WEEndAction", (PyCFunction)wasteObj_WEEndAction, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002096 PyDoc_STR("(WEActionKind inActionKind) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002097 {"WEGetModCount", (PyCFunction)wasteObj_WEGetModCount, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002098 PyDoc_STR("() -> (UInt32 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002099 {"WEResetModCount", (PyCFunction)wasteObj_WEResetModCount, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002100 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002101 {"WEInsertObject", (PyCFunction)wasteObj_WEInsertObject, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002102 PyDoc_STR("(FlavorType inObjectType, Handle inObjectDataHandle, Point inObjectSize) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002103 {"WEGetSelectedObject", (PyCFunction)wasteObj_WEGetSelectedObject, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002104 PyDoc_STR("() -> (WEObjectReference outObject)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002105 {"WEGetObjectAtOffset", (PyCFunction)wasteObj_WEGetObjectAtOffset, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002106 PyDoc_STR("(SInt32 inOffset) -> (WEObjectReference outObject)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002107 {"WEFindNextObject", (PyCFunction)wasteObj_WEFindNextObject, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002108 PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv, WEObjectReference outObject)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002109 {"WEUseSoup", (PyCFunction)wasteObj_WEUseSoup, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002110 PyDoc_STR("(WESoupHandle inSoup) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002111 {"WECut", (PyCFunction)wasteObj_WECut, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002112 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002113 {"WECopy", (PyCFunction)wasteObj_WECopy, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002114 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002115 {"WEPaste", (PyCFunction)wasteObj_WEPaste, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002116 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002117 {"WECanPaste", (PyCFunction)wasteObj_WECanPaste, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002118 PyDoc_STR("() -> (Boolean _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002119 {"WEGetHiliteRgn", (PyCFunction)wasteObj_WEGetHiliteRgn, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002120 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd) -> (RgnHandle _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002121 {"WECharByte", (PyCFunction)wasteObj_WECharByte, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002122 PyDoc_STR("(SInt32 inOffset) -> (SInt16 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002123 {"WECharType", (PyCFunction)wasteObj_WECharType, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002124 PyDoc_STR("(SInt32 inOffset) -> (SInt16 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002125 {"WEStopInlineSession", (PyCFunction)wasteObj_WEStopInlineSession, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002126 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002127 {"WEFeatureFlag", (PyCFunction)wasteObj_WEFeatureFlag, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002128 PyDoc_STR("(SInt16 inFeature, SInt16 inAction) -> (SInt16 _rv)")},
Jack Jansen2369a981998-02-20 15:57:30 +00002129 {"WEGetUserInfo", (PyCFunction)wasteObj_WEGetUserInfo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002130 PyDoc_STR("(WESelector inUserTag) -> (SInt32 outUserInfo)")},
Jack Jansen2369a981998-02-20 15:57:30 +00002131 {"WESetUserInfo", (PyCFunction)wasteObj_WESetUserInfo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002132 PyDoc_STR("(WESelector inUserTag, SInt32 inUserInfo) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002133 {"WERemoveUserInfo", (PyCFunction)wasteObj_WERemoveUserInfo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002134 PyDoc_STR("(WESelector inUserTag) -> None")},
Jack Jansen176f3a91996-10-23 15:43:46 +00002135 {"WEInstallTabHooks", (PyCFunction)wasteObj_WEInstallTabHooks, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002136 PyDoc_STR("() -> None")},
Jack Jansen176f3a91996-10-23 15:43:46 +00002137 {"WERemoveTabHooks", (PyCFunction)wasteObj_WERemoveTabHooks, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002138 PyDoc_STR("() -> None")},
Jack Jansen176f3a91996-10-23 15:43:46 +00002139 {"WEIsTabHooks", (PyCFunction)wasteObj_WEIsTabHooks, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002140 PyDoc_STR("() -> (Boolean _rv)")},
Jack Jansena4f03091998-03-02 16:56:18 +00002141 {"WEGetTabSize", (PyCFunction)wasteObj_WEGetTabSize, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002142 PyDoc_STR("() -> (SInt16 _rv)")},
Jack Jansena4f03091998-03-02 16:56:18 +00002143 {"WESetTabSize", (PyCFunction)wasteObj_WESetTabSize, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002144 PyDoc_STR("(SInt16 tabWidth) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002145 {NULL, NULL, 0}
2146};
2147
Jack Jansendbd57012002-11-29 23:40:48 +00002148#define wasteObj_getsetlist NULL
Jack Jansen90ecdf41996-04-16 14:29:15 +00002149
Jack Jansen96cebde2002-12-03 23:40:22 +00002150
Jack Jansen9d8b96c2000-07-14 22:16:45 +00002151#define wasteObj_compare NULL
2152
2153#define wasteObj_repr NULL
2154
2155#define wasteObj_hash NULL
Jack Jansen96cebde2002-12-03 23:40:22 +00002156#define wasteObj_tp_init 0
2157
2158#define wasteObj_tp_alloc PyType_GenericAlloc
2159
2160static PyObject *wasteObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
2161{
2162 PyObject *self;
2163 WEReference itself;
2164 char *kw[] = {"itself", 0};
2165
2166 if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, wasteObj_Convert, &itself)) return NULL;
2167 if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
2168 ((wasteObject *)self)->ob_itself = itself;
2169 return self;
2170}
2171
2172#define wasteObj_tp_free PyObject_Del
2173
Jack Jansen9d8b96c2000-07-14 22:16:45 +00002174
Jack Jansen90ecdf41996-04-16 14:29:15 +00002175PyTypeObject waste_Type = {
Jack Jansenb3be2162001-11-30 14:16:36 +00002176 PyObject_HEAD_INIT(NULL)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002177 0, /*ob_size*/
Guido van Rossum14648392001-12-08 18:02:58 +00002178 "waste.waste", /*tp_name*/
Jack Jansen90ecdf41996-04-16 14:29:15 +00002179 sizeof(wasteObject), /*tp_basicsize*/
2180 0, /*tp_itemsize*/
2181 /* methods */
2182 (destructor) wasteObj_dealloc, /*tp_dealloc*/
2183 0, /*tp_print*/
Jack Jansendbd57012002-11-29 23:40:48 +00002184 (getattrfunc)0, /*tp_getattr*/
2185 (setattrfunc)0, /*tp_setattr*/
Jack Jansen9d8b96c2000-07-14 22:16:45 +00002186 (cmpfunc) wasteObj_compare, /*tp_compare*/
2187 (reprfunc) wasteObj_repr, /*tp_repr*/
2188 (PyNumberMethods *)0, /* tp_as_number */
2189 (PySequenceMethods *)0, /* tp_as_sequence */
2190 (PyMappingMethods *)0, /* tp_as_mapping */
2191 (hashfunc) wasteObj_hash, /*tp_hash*/
Jack Jansendbd57012002-11-29 23:40:48 +00002192 0, /*tp_call*/
2193 0, /*tp_str*/
2194 PyObject_GenericGetAttr, /*tp_getattro*/
2195 PyObject_GenericSetAttr, /*tp_setattro */
Jack Jansen96cebde2002-12-03 23:40:22 +00002196 0, /*tp_as_buffer*/
2197 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
2198 0, /*tp_doc*/
2199 0, /*tp_traverse*/
2200 0, /*tp_clear*/
2201 0, /*tp_richcompare*/
2202 0, /*tp_weaklistoffset*/
2203 0, /*tp_iter*/
2204 0, /*tp_iternext*/
Jack Jansendbd57012002-11-29 23:40:48 +00002205 wasteObj_methods, /* tp_methods */
Jack Jansen96cebde2002-12-03 23:40:22 +00002206 0, /*tp_members*/
Jack Jansendbd57012002-11-29 23:40:48 +00002207 wasteObj_getsetlist, /*tp_getset*/
Jack Jansen96cebde2002-12-03 23:40:22 +00002208 0, /*tp_base*/
2209 0, /*tp_dict*/
2210 0, /*tp_descr_get*/
2211 0, /*tp_descr_set*/
2212 0, /*tp_dictoffset*/
2213 wasteObj_tp_init, /* tp_init */
2214 wasteObj_tp_alloc, /* tp_alloc */
2215 wasteObj_tp_new, /* tp_new */
2216 wasteObj_tp_free, /* tp_free */
Jack Jansen90ecdf41996-04-16 14:29:15 +00002217};
2218
2219/* --------------------- End object type waste ---------------------- */
2220
2221
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002222static PyObject *waste_WENew(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002223{
2224 PyObject *_res = NULL;
2225 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00002226 LongRect inDestRect;
2227 LongRect inViewRect;
2228 OptionBits inOptions;
2229 WEReference outWE;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002230 if (!PyArg_ParseTuple(_args, "O&O&l",
Jack Jansenb99e5212002-01-11 12:37:15 +00002231 LongRect_Convert, &inDestRect,
2232 LongRect_Convert, &inViewRect,
2233 &inOptions))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002234 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002235 _err = WENew(&inDestRect,
2236 &inViewRect,
2237 inOptions,
2238 &outWE);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002239 if (_err != noErr) return PyMac_Error(_err);
2240 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002241 wasteObj_New, outWE);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002242 return _res;
2243}
2244
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002245static PyObject *waste_WEUpdateStyleScrap(PyObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00002246{
2247 PyObject *_res = NULL;
2248 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00002249 StScrpHandle ioStyles;
2250 WEFontTableHandle inFontTable;
Jack Jansen2369a981998-02-20 15:57:30 +00002251 if (!PyArg_ParseTuple(_args, "O&O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002252 ResObj_Convert, &ioStyles,
2253 ResObj_Convert, &inFontTable))
Jack Jansen2369a981998-02-20 15:57:30 +00002254 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002255 _err = WEUpdateStyleScrap(ioStyles,
2256 inFontTable);
Jack Jansen2369a981998-02-20 15:57:30 +00002257 if (_err != noErr) return PyMac_Error(_err);
2258 Py_INCREF(Py_None);
2259 _res = Py_None;
2260 return _res;
2261}
2262
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002263static PyObject *waste_WEInstallTSMHandlers(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002264{
2265 PyObject *_res = NULL;
2266 OSErr _err;
2267 if (!PyArg_ParseTuple(_args, ""))
2268 return NULL;
2269 _err = WEInstallTSMHandlers();
2270 if (_err != noErr) return PyMac_Error(_err);
2271 Py_INCREF(Py_None);
2272 _res = Py_None;
2273 return _res;
2274}
2275
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002276static PyObject *waste_WERemoveTSMHandlers(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002277{
2278 PyObject *_res = NULL;
2279 OSErr _err;
2280 if (!PyArg_ParseTuple(_args, ""))
2281 return NULL;
2282 _err = WERemoveTSMHandlers();
2283 if (_err != noErr) return PyMac_Error(_err);
2284 Py_INCREF(Py_None);
2285 _res = Py_None;
2286 return _res;
2287}
2288
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002289static PyObject *waste_WEHandleTSMEvent(PyObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00002290{
2291 PyObject *_res = NULL;
2292 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00002293 AppleEvent inAppleEvent;
2294 AppleEvent ioReply;
Jack Jansen2369a981998-02-20 15:57:30 +00002295 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002296 AEDesc_Convert, &inAppleEvent))
Jack Jansen2369a981998-02-20 15:57:30 +00002297 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002298 _err = WEHandleTSMEvent(&inAppleEvent,
2299 &ioReply);
Jack Jansen2369a981998-02-20 15:57:30 +00002300 if (_err != noErr) return PyMac_Error(_err);
2301 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002302 AEDesc_New, &ioReply);
Jack Jansen2369a981998-02-20 15:57:30 +00002303 return _res;
2304}
2305
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002306static PyObject *waste_WELongPointToPoint(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002307{
2308 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002309 LongPt inLongPoint;
2310 Point outPoint;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002311 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002312 LongPt_Convert, &inLongPoint))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002313 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002314 WELongPointToPoint(&inLongPoint,
2315 &outPoint);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002316 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002317 PyMac_BuildPoint, outPoint);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002318 return _res;
2319}
2320
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002321static PyObject *waste_WEPointToLongPoint(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002322{
2323 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002324 Point inPoint;
2325 LongPt outLongPoint;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002326 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002327 PyMac_GetPoint, &inPoint))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002328 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002329 WEPointToLongPoint(inPoint,
2330 &outLongPoint);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002331 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002332 LongPt_New, &outLongPoint);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002333 return _res;
2334}
2335
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002336static PyObject *waste_WESetLongRect(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002337{
2338 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002339 LongRect outLongRect;
2340 SInt32 inLeft;
2341 SInt32 inTop;
2342 SInt32 inRight;
2343 SInt32 inBottom;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002344 if (!PyArg_ParseTuple(_args, "llll",
Jack Jansenb99e5212002-01-11 12:37:15 +00002345 &inLeft,
2346 &inTop,
2347 &inRight,
2348 &inBottom))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002349 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002350 WESetLongRect(&outLongRect,
2351 inLeft,
2352 inTop,
2353 inRight,
2354 inBottom);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002355 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002356 LongRect_New, &outLongRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002357 return _res;
2358}
2359
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002360static PyObject *waste_WELongRectToRect(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002361{
2362 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002363 LongRect inLongRect;
2364 Rect outRect;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002365 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002366 LongRect_Convert, &inLongRect))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002367 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002368 WELongRectToRect(&inLongRect,
2369 &outRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002370 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002371 PyMac_BuildRect, &outRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002372 return _res;
2373}
2374
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002375static PyObject *waste_WERectToLongRect(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002376{
2377 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002378 Rect inRect;
2379 LongRect outLongRect;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002380 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002381 PyMac_GetRect, &inRect))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002382 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002383 WERectToLongRect(&inRect,
2384 &outLongRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002385 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002386 LongRect_New, &outLongRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002387 return _res;
2388}
2389
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002390static PyObject *waste_WEOffsetLongRect(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002391{
2392 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002393 LongRect ioLongRect;
2394 SInt32 inHorizontalOffset;
2395 SInt32 inVerticalOffset;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002396 if (!PyArg_ParseTuple(_args, "ll",
Jack Jansenb99e5212002-01-11 12:37:15 +00002397 &inHorizontalOffset,
2398 &inVerticalOffset))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002399 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002400 WEOffsetLongRect(&ioLongRect,
2401 inHorizontalOffset,
2402 inVerticalOffset);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002403 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002404 LongRect_New, &ioLongRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002405 return _res;
2406}
2407
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002408static PyObject *waste_WELongPointInLongRect(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002409{
2410 PyObject *_res = NULL;
2411 Boolean _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00002412 LongPt inLongPoint;
2413 LongRect inLongRect;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002414 if (!PyArg_ParseTuple(_args, "O&O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002415 LongPt_Convert, &inLongPoint,
2416 LongRect_Convert, &inLongRect))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002417 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002418 _rv = WELongPointInLongRect(&inLongPoint,
2419 &inLongRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002420 _res = Py_BuildValue("b",
2421 _rv);
2422 return _res;
2423}
2424
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002425static PyObject *waste_STDObjectHandlers(PyObject *_self, PyObject *_args)
Jack Jansen756522f1996-05-07 15:24:01 +00002426{
2427 PyObject *_res = NULL;
2428
2429 OSErr err;
2430 // install the sample object handlers for pictures and sounds
2431#define kTypePicture 'PICT'
2432#define kTypeSound 'snd '
2433
2434 if ( !PyArg_ParseTuple(_args, "") ) return NULL;
2435
2436 if ((err = WEInstallObjectHandler(kTypePicture, weNewHandler,
2437 (UniversalProcPtr) NewWENewObjectProc(HandleNewPicture), NULL)) != noErr)
2438 goto cleanup;
2439
2440 if ((err = WEInstallObjectHandler(kTypePicture, weDisposeHandler,
2441 (UniversalProcPtr) NewWEDisposeObjectProc(HandleDisposePicture), NULL)) != noErr)
2442 goto cleanup;
2443
2444 if ((err = WEInstallObjectHandler(kTypePicture, weDrawHandler,
2445 (UniversalProcPtr) NewWEDrawObjectProc(HandleDrawPicture), NULL)) != noErr)
2446 goto cleanup;
2447
2448 if ((err = WEInstallObjectHandler(kTypeSound, weNewHandler,
2449 (UniversalProcPtr) NewWENewObjectProc(HandleNewSound), NULL)) != noErr)
2450 goto cleanup;
2451
2452 if ((err = WEInstallObjectHandler(kTypeSound, weDrawHandler,
2453 (UniversalProcPtr) NewWEDrawObjectProc(HandleDrawSound), NULL)) != noErr)
2454 goto cleanup;
2455
2456 if ((err = WEInstallObjectHandler(kTypeSound, weClickHandler,
2457 (UniversalProcPtr) NewWEClickObjectProc(HandleClickSound), NULL)) != noErr)
2458 goto cleanup;
2459 Py_INCREF(Py_None);
Jack Jansenb7348692002-12-23 23:16:25 +00002460 _res = Py_None;
2461 return _res;
Jack Jansen756522f1996-05-07 15:24:01 +00002462
2463 cleanup:
2464 return PyMac_Error(err);
2465
2466}
2467
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002468static PyObject *waste_WEInstallObjectHandler(PyObject *_self, PyObject *_args)
Jack Jansen756522f1996-05-07 15:24:01 +00002469{
2470 PyObject *_res = NULL;
2471
2472 OSErr err;
2473 FlavorType objectType;
2474 WESelector selector;
2475 PyObject *py_handler;
2476 UniversalProcPtr handler;
2477 WEReference we = NULL;
2478 PyObject *key;
2479
2480
2481 if ( !PyArg_ParseTuple(_args, "O&O&O|O&",
2482 PyMac_GetOSType, &objectType,
2483 PyMac_GetOSType, &selector,
2484 &py_handler,
Jack Jansen7df36061996-10-01 11:41:14 +00002485 WEOObj_Convert, &we) ) return NULL;
Jack Jansen756522f1996-05-07 15:24:01 +00002486
Jack Jansen25241d91996-05-20 11:30:45 +00002487 if ( selector == weNewHandler ) handler = (UniversalProcPtr)upp_new_handler;
2488 else if ( selector == weDisposeHandler ) handler = (UniversalProcPtr)upp_dispose_handler;
2489 else if ( selector == weDrawHandler ) handler = (UniversalProcPtr)upp_draw_handler;
2490 else if ( selector == weClickHandler ) handler = (UniversalProcPtr)upp_click_handler;
Jack Jansen756522f1996-05-07 15:24:01 +00002491 else return PyMac_Error(weUndefinedSelectorErr);
2492
2493 if ((key = Py_BuildValue("O&O&",
2494 PyMac_BuildOSType, objectType,
2495 PyMac_BuildOSType, selector)) == NULL )
2496 return NULL;
2497
2498 PyDict_SetItem(callbackdict, key, py_handler);
2499
2500 err = WEInstallObjectHandler(objectType, selector, handler, we);
2501 if ( err ) return PyMac_Error(err);
2502 Py_INCREF(Py_None);
Jack Jansenb7348692002-12-23 23:16:25 +00002503 _res = Py_None;
2504 return _res;
Jack Jansen756522f1996-05-07 15:24:01 +00002505
2506}
2507
Jack Jansen90ecdf41996-04-16 14:29:15 +00002508static PyMethodDef waste_methods[] = {
2509 {"WENew", (PyCFunction)waste_WENew, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002510 PyDoc_STR("(LongRect inDestRect, LongRect inViewRect, OptionBits inOptions) -> (WEReference outWE)")},
Jack Jansen2369a981998-02-20 15:57:30 +00002511 {"WEUpdateStyleScrap", (PyCFunction)waste_WEUpdateStyleScrap, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002512 PyDoc_STR("(StScrpHandle ioStyles, WEFontTableHandle inFontTable) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002513 {"WEInstallTSMHandlers", (PyCFunction)waste_WEInstallTSMHandlers, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002514 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002515 {"WERemoveTSMHandlers", (PyCFunction)waste_WERemoveTSMHandlers, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002516 PyDoc_STR("() -> None")},
Jack Jansen2369a981998-02-20 15:57:30 +00002517 {"WEHandleTSMEvent", (PyCFunction)waste_WEHandleTSMEvent, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002518 PyDoc_STR("(AppleEvent inAppleEvent) -> (AppleEvent ioReply)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002519 {"WELongPointToPoint", (PyCFunction)waste_WELongPointToPoint, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002520 PyDoc_STR("(LongPt inLongPoint) -> (Point outPoint)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002521 {"WEPointToLongPoint", (PyCFunction)waste_WEPointToLongPoint, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002522 PyDoc_STR("(Point inPoint) -> (LongPt outLongPoint)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002523 {"WESetLongRect", (PyCFunction)waste_WESetLongRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002524 PyDoc_STR("(SInt32 inLeft, SInt32 inTop, SInt32 inRight, SInt32 inBottom) -> (LongRect outLongRect)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002525 {"WELongRectToRect", (PyCFunction)waste_WELongRectToRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002526 PyDoc_STR("(LongRect inLongRect) -> (Rect outRect)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002527 {"WERectToLongRect", (PyCFunction)waste_WERectToLongRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002528 PyDoc_STR("(Rect inRect) -> (LongRect outLongRect)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002529 {"WEOffsetLongRect", (PyCFunction)waste_WEOffsetLongRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002530 PyDoc_STR("(SInt32 inHorizontalOffset, SInt32 inVerticalOffset) -> (LongRect ioLongRect)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002531 {"WELongPointInLongRect", (PyCFunction)waste_WELongPointInLongRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002532 PyDoc_STR("(LongPt inLongPoint, LongRect inLongRect) -> (Boolean _rv)")},
Jack Jansen756522f1996-05-07 15:24:01 +00002533 {"STDObjectHandlers", (PyCFunction)waste_STDObjectHandlers, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002534 PyDoc_STR(NULL)},
Jack Jansen756522f1996-05-07 15:24:01 +00002535 {"WEInstallObjectHandler", (PyCFunction)waste_WEInstallObjectHandler, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002536 PyDoc_STR(NULL)},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002537 {NULL, NULL, 0}
2538};
2539
2540
2541
Jack Jansen756522f1996-05-07 15:24:01 +00002542/* Return the object corresponding to the window, or NULL */
2543
2544PyObject *
2545ExistingwasteObj_New(w)
2546 WEReference w;
2547{
2548 PyObject *it = NULL;
2549
2550 if (w == NULL)
2551 it = NULL;
2552 else
2553 WEGetInfo(weRefCon, (void *)&it, w);
2554 if (it == NULL || ((wasteObject *)it)->ob_itself != w)
2555 it = Py_None;
2556 Py_INCREF(it);
2557 return it;
2558}
2559
Jack Jansen90ecdf41996-04-16 14:29:15 +00002560
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002561void initwaste(void)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002562{
2563 PyObject *m;
2564 PyObject *d;
2565
2566
2567
2568
2569 m = Py_InitModule("waste", waste_methods);
2570 d = PyModule_GetDict(m);
2571 waste_Error = PyMac_GetOSErrException();
2572 if (waste_Error == NULL ||
2573 PyDict_SetItemString(d, "Error", waste_Error) != 0)
Jack Jansen97ed9072000-09-08 22:06:16 +00002574 return;
Jack Jansena755e681997-09-20 17:40:22 +00002575 WEO_Type.ob_type = &PyType_Type;
Jack Jansenb7348692002-12-23 23:16:25 +00002576 if (PyType_Ready(&WEO_Type) < 0) return;
Jack Jansena755e681997-09-20 17:40:22 +00002577 Py_INCREF(&WEO_Type);
Jack Jansen96cebde2002-12-03 23:40:22 +00002578 PyModule_AddObject(m, "WEO", (PyObject *)&WEO_Type);
2579 /* Backward-compatible name */
2580 Py_INCREF(&WEO_Type);
2581 PyModule_AddObject(m, "WEOType", (PyObject *)&WEO_Type);
Jack Jansena755e681997-09-20 17:40:22 +00002582 waste_Type.ob_type = &PyType_Type;
Jack Jansenb7348692002-12-23 23:16:25 +00002583 if (PyType_Ready(&waste_Type) < 0) return;
Jack Jansena755e681997-09-20 17:40:22 +00002584 Py_INCREF(&waste_Type);
Jack Jansen96cebde2002-12-03 23:40:22 +00002585 PyModule_AddObject(m, "waste", (PyObject *)&waste_Type);
2586 /* Backward-compatible name */
2587 Py_INCREF(&waste_Type);
2588 PyModule_AddObject(m, "wasteType", (PyObject *)&waste_Type);
Jack Jansen756522f1996-05-07 15:24:01 +00002589
2590 callbackdict = PyDict_New();
2591 if (callbackdict == NULL || PyDict_SetItemString(d, "callbacks", callbackdict) != 0)
Jack Jansen97ed9072000-09-08 22:06:16 +00002592 return;
Jack Jansen756522f1996-05-07 15:24:01 +00002593 upp_new_handler = NewWENewObjectProc(my_new_handler);
Jack Jansen25241d91996-05-20 11:30:45 +00002594 upp_dispose_handler = NewWEDisposeObjectProc(my_dispose_handler);
2595 upp_draw_handler = NewWEDrawObjectProc(my_draw_handler);
2596 upp_click_handler = NewWEClickObjectProc(my_click_handler);
Jack Jansen756522f1996-05-07 15:24:01 +00002597
2598
Jack Jansen90ecdf41996-04-16 14:29:15 +00002599}
2600
2601/* ======================== End module waste ======================== */
2602