blob: 85159e5c487bb2f986b6830d4a6c096e28058e77 [file] [log] [blame]
Jack Jansen90ecdf41996-04-16 14:29:15 +00001
2/* ========================== Module waste ========================== */
3
4#include "Python.h"
5
6
7
Jack Jansen620a7662001-12-18 15:39:38 +00008#ifdef _WIN32
9#include "pywintoolbox.h"
10#else
Jack Jansen90ecdf41996-04-16 14:29:15 +000011#include "macglue.h"
Jack Jansen9d8b96c2000-07-14 22:16:45 +000012#include "pymactoolbox.h"
Jack Jansen620a7662001-12-18 15:39:38 +000013#endif
Jack Jansen044d95e2001-09-05 15:44:37 +000014
15/* Macro to test whether a weak-loaded CFM function exists */
16#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
17 PyErr_SetString(PyExc_NotImplementedError, \
18 "Not available in this shared library/OS version"); \
19 return NULL; \
20 }} while(0)
21
Jack Jansen90ecdf41996-04-16 14:29:15 +000022
23#include <WASTE.h>
Jack Jansen8505ef81997-08-27 14:09:25 +000024#include <WEObjectHandlers.h>
Jack Jansena755e681997-09-20 17:40:22 +000025#include <WETabs.h>
Jack Jansen97257352002-11-18 15:26:43 +000026#ifndef PyDoc_STR
27#define PyDoc_STR(x) (x)
28#endif
Jack Jansen90ecdf41996-04-16 14:29:15 +000029
30/* Exported by Qdmodule.c: */
31extern PyObject *QdRGB_New(RGBColor *);
32extern int QdRGB_Convert(PyObject *, RGBColor *);
33
Jack Jansen8505ef81997-08-27 14:09:25 +000034/* Exported by AEModule.c: */
35extern PyObject *AEDesc_New(AppleEvent *);
36extern int AEDesc_Convert(PyObject *, AppleEvent *);
37
Jack Jansen90ecdf41996-04-16 14:29:15 +000038/* Forward declaration */
Jeremy Hylton938ace62002-07-17 16:30:39 +000039static PyObject *WEOObj_New(WEObjectReference);
40static PyObject *ExistingwasteObj_New(WEReference);
Jack Jansen90ecdf41996-04-16 14:29:15 +000041
42/*
43** Parse/generate TextStyle records
44*/
45static
Jack Jansen65cbf932002-12-13 15:02:02 +000046PyObject *TextStyle_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
53static
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*/
69static
Jack Jansen65cbf932002-12-13 15:02:02 +000070PyObject *RunInfo_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
90
91LongPt_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 }
149 if ( args ) Py_DECREF(args);
150 if ( rv ) Py_DECREF(rv);
151 return err;
152}
153
154static pascal OSErr
155my_dispose_handler(WEObjectReference objref)
156{
157 PyObject *args=NULL, *rv=NULL;
158 OSErr err;
159
160 args=Py_BuildValue("(O&)", WEOObj_New, objref);
161 err = any_handler(weDisposeHandler, objref, args, &rv);
162 if ( args ) Py_DECREF(args);
163 if ( rv ) Py_DECREF(rv);
164 return err;
165}
166
167static pascal OSErr
Jack Jansen6b9289f2001-06-20 21:21:07 +0000168my_draw_handler(const Rect *destRect, WEObjectReference objref)
Jack Jansen756522f1996-05-07 15:24:01 +0000169{
170 PyObject *args=NULL, *rv=NULL;
171 OSErr err;
172
173 args=Py_BuildValue("O&O&", PyMac_BuildRect, destRect, WEOObj_New, objref);
174 err = any_handler(weDrawHandler, objref, args, &rv);
175 if ( args ) Py_DECREF(args);
176 if ( rv ) Py_DECREF(rv);
177 return err;
178}
179
180static pascal Boolean
181my_click_handler(Point hitPt, EventModifiers modifiers,
182 unsigned long clickTime, WEObjectReference objref)
183{
184 PyObject *args=NULL, *rv=NULL;
185 int retvalue;
186 OSErr err;
187
188 args=Py_BuildValue("O&llO&", PyMac_BuildPoint, hitPt,
189 (long)modifiers, (long)clickTime, WEOObj_New, objref);
190 err = any_handler(weClickHandler, objref, args, &rv);
191 if (!err)
192 retvalue = PyInt_AsLong(rv);
193 else
194 retvalue = 0;
195 if ( args ) Py_DECREF(args);
196 if ( rv ) Py_DECREF(rv);
197 return retvalue;
198}
199
200
201
Jack Jansen90ecdf41996-04-16 14:29:15 +0000202static PyObject *waste_Error;
203
204/* ------------------------ Object type WEO ------------------------- */
205
206PyTypeObject WEO_Type;
207
Jack Jansenf9557842002-12-19 21:24:35 +0000208#define WEOObj_Check(x) ((x)->ob_type == &WEO_Type || PyObject_TypeCheck((x), &WEO_Type))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000209
210typedef struct WEOObject {
211 PyObject_HEAD
212 WEObjectReference ob_itself;
213} WEOObject;
214
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000215PyObject *WEOObj_New(WEObjectReference itself)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000216{
217 WEOObject *it;
218 if (itself == NULL) {
219 Py_INCREF(Py_None);
220 return Py_None;
221 }
222 it = PyObject_NEW(WEOObject, &WEO_Type);
223 if (it == NULL) return NULL;
224 it->ob_itself = itself;
225 return (PyObject *)it;
226}
Jack Jansen044d95e2001-09-05 15:44:37 +0000227int WEOObj_Convert(PyObject *v, WEObjectReference *p_itself)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000228{
229 if (!WEOObj_Check(v))
230 {
231 PyErr_SetString(PyExc_TypeError, "WEO required");
232 return 0;
233 }
234 *p_itself = ((WEOObject *)v)->ob_itself;
235 return 1;
236}
237
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000238static void WEOObj_dealloc(WEOObject *self)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000239{
240 /* Cleanup of self->ob_itself goes here */
Jack Jansen033b79c2002-04-23 22:46:01 +0000241 PyObject_Del(self);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000242}
243
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000244static PyObject *WEOObj_WEGetObjectType(WEOObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000245{
246 PyObject *_res = NULL;
247 FlavorType _rv;
248 if (!PyArg_ParseTuple(_args, ""))
249 return NULL;
250 _rv = WEGetObjectType(_self->ob_itself);
251 _res = Py_BuildValue("O&",
252 PyMac_BuildOSType, _rv);
253 return _res;
254}
255
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000256static PyObject *WEOObj_WEGetObjectDataHandle(WEOObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000257{
258 PyObject *_res = NULL;
259 Handle _rv;
260 if (!PyArg_ParseTuple(_args, ""))
261 return NULL;
262 _rv = WEGetObjectDataHandle(_self->ob_itself);
263 _res = Py_BuildValue("O&",
264 ResObj_New, _rv);
265 return _res;
266}
267
Jack Jansenb99e5212002-01-11 12:37:15 +0000268static PyObject *WEOObj_WEGetObjectOwner(WEOObject *_self, PyObject *_args)
269{
270 PyObject *_res = NULL;
271 WEReference _rv;
272 if (!PyArg_ParseTuple(_args, ""))
273 return NULL;
274 _rv = WEGetObjectOwner(_self->ob_itself);
275 _res = Py_BuildValue("O&",
276 ExistingwasteObj_New, _rv);
277 return _res;
278}
279
280static PyObject *WEOObj_WEGetObjectOffset(WEOObject *_self, PyObject *_args)
281{
282 PyObject *_res = NULL;
283 SInt32 _rv;
284 if (!PyArg_ParseTuple(_args, ""))
285 return NULL;
286 _rv = WEGetObjectOffset(_self->ob_itself);
287 _res = Py_BuildValue("l",
288 _rv);
289 return _res;
290}
291
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000292static PyObject *WEOObj_WEGetObjectSize(WEOObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000293{
294 PyObject *_res = NULL;
295 Point _rv;
296 if (!PyArg_ParseTuple(_args, ""))
297 return NULL;
298 _rv = WEGetObjectSize(_self->ob_itself);
299 _res = Py_BuildValue("O&",
300 PyMac_BuildPoint, _rv);
301 return _res;
302}
303
Jack Jansenb99e5212002-01-11 12:37:15 +0000304static PyObject *WEOObj_WESetObjectSize(WEOObject *_self, PyObject *_args)
Jack Jansen756522f1996-05-07 15:24:01 +0000305{
306 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000307 OSErr _err;
308 Point inObjectSize;
309 if (!PyArg_ParseTuple(_args, "O&",
310 PyMac_GetPoint, &inObjectSize))
311 return NULL;
312 _err = WESetObjectSize(_self->ob_itself,
313 inObjectSize);
314 if (_err != noErr) return PyMac_Error(_err);
315 Py_INCREF(Py_None);
316 _res = Py_None;
317 return _res;
318}
319
320static PyObject *WEOObj_WEGetObjectFrame(WEOObject *_self, PyObject *_args)
321{
322 PyObject *_res = NULL;
323 OSErr _err;
324 LongRect outObjectFrame;
Jack Jansen756522f1996-05-07 15:24:01 +0000325 if (!PyArg_ParseTuple(_args, ""))
326 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000327 _err = WEGetObjectFrame(_self->ob_itself,
328 &outObjectFrame);
329 if (_err != noErr) return PyMac_Error(_err);
Jack Jansen756522f1996-05-07 15:24:01 +0000330 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +0000331 LongRect_New, &outObjectFrame);
Jack Jansen756522f1996-05-07 15:24:01 +0000332 return _res;
333}
334
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000335static PyObject *WEOObj_WEGetObjectRefCon(WEOObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000336{
337 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +0000338 SInt32 _rv;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000339 if (!PyArg_ParseTuple(_args, ""))
340 return NULL;
341 _rv = WEGetObjectRefCon(_self->ob_itself);
342 _res = Py_BuildValue("l",
343 _rv);
344 return _res;
345}
346
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000347static PyObject *WEOObj_WESetObjectRefCon(WEOObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000348{
349 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000350 SInt32 inRefCon;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000351 if (!PyArg_ParseTuple(_args, "l",
Jack Jansenb99e5212002-01-11 12:37:15 +0000352 &inRefCon))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000353 return NULL;
354 WESetObjectRefCon(_self->ob_itself,
Jack Jansenb99e5212002-01-11 12:37:15 +0000355 inRefCon);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000356 Py_INCREF(Py_None);
357 _res = Py_None;
358 return _res;
359}
360
361static PyMethodDef WEOObj_methods[] = {
362 {"WEGetObjectType", (PyCFunction)WEOObj_WEGetObjectType, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000363 PyDoc_STR("() -> (FlavorType _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +0000364 {"WEGetObjectDataHandle", (PyCFunction)WEOObj_WEGetObjectDataHandle, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000365 PyDoc_STR("() -> (Handle _rv)")},
Jack Jansen756522f1996-05-07 15:24:01 +0000366 {"WEGetObjectOwner", (PyCFunction)WEOObj_WEGetObjectOwner, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000367 PyDoc_STR("() -> (WEReference _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +0000368 {"WEGetObjectOffset", (PyCFunction)WEOObj_WEGetObjectOffset, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000369 PyDoc_STR("() -> (SInt32 _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +0000370 {"WEGetObjectSize", (PyCFunction)WEOObj_WEGetObjectSize, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000371 PyDoc_STR("() -> (Point _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +0000372 {"WESetObjectSize", (PyCFunction)WEOObj_WESetObjectSize, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000373 PyDoc_STR("(Point inObjectSize) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +0000374 {"WEGetObjectFrame", (PyCFunction)WEOObj_WEGetObjectFrame, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000375 PyDoc_STR("() -> (LongRect outObjectFrame)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +0000376 {"WEGetObjectRefCon", (PyCFunction)WEOObj_WEGetObjectRefCon, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000377 PyDoc_STR("() -> (SInt32 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +0000378 {"WESetObjectRefCon", (PyCFunction)WEOObj_WESetObjectRefCon, 1,
Jack Jansen286e8382002-08-22 23:29:45 +0000379 PyDoc_STR("(SInt32 inRefCon) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +0000380 {NULL, NULL, 0}
381};
382
Jack Jansendbd57012002-11-29 23:40:48 +0000383#define WEOObj_getsetlist NULL
Jack Jansen90ecdf41996-04-16 14:29:15 +0000384
Jack Jansen96cebde2002-12-03 23:40:22 +0000385
Jack Jansen9d8b96c2000-07-14 22:16:45 +0000386#define WEOObj_compare NULL
387
388#define WEOObj_repr NULL
389
390#define WEOObj_hash NULL
Jack Jansen96cebde2002-12-03 23:40:22 +0000391#define WEOObj_tp_init 0
392
393#define WEOObj_tp_alloc PyType_GenericAlloc
394
395static PyObject *WEOObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
396{
397 PyObject *self;
398 WEObjectReference itself;
399 char *kw[] = {"itself", 0};
400
401 if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, WEOObj_Convert, &itself)) return NULL;
402 if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
403 ((WEOObject *)self)->ob_itself = itself;
404 return self;
405}
406
407#define WEOObj_tp_free PyObject_Del
408
Jack Jansen9d8b96c2000-07-14 22:16:45 +0000409
Jack Jansen90ecdf41996-04-16 14:29:15 +0000410PyTypeObject WEO_Type = {
Jack Jansenb3be2162001-11-30 14:16:36 +0000411 PyObject_HEAD_INIT(NULL)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000412 0, /*ob_size*/
Guido van Rossum14648392001-12-08 18:02:58 +0000413 "waste.WEO", /*tp_name*/
Jack Jansen90ecdf41996-04-16 14:29:15 +0000414 sizeof(WEOObject), /*tp_basicsize*/
415 0, /*tp_itemsize*/
416 /* methods */
417 (destructor) WEOObj_dealloc, /*tp_dealloc*/
418 0, /*tp_print*/
Jack Jansendbd57012002-11-29 23:40:48 +0000419 (getattrfunc)0, /*tp_getattr*/
420 (setattrfunc)0, /*tp_setattr*/
Jack Jansen9d8b96c2000-07-14 22:16:45 +0000421 (cmpfunc) WEOObj_compare, /*tp_compare*/
422 (reprfunc) WEOObj_repr, /*tp_repr*/
423 (PyNumberMethods *)0, /* tp_as_number */
424 (PySequenceMethods *)0, /* tp_as_sequence */
425 (PyMappingMethods *)0, /* tp_as_mapping */
426 (hashfunc) WEOObj_hash, /*tp_hash*/
Jack Jansendbd57012002-11-29 23:40:48 +0000427 0, /*tp_call*/
428 0, /*tp_str*/
429 PyObject_GenericGetAttr, /*tp_getattro*/
430 PyObject_GenericSetAttr, /*tp_setattro */
Jack Jansen96cebde2002-12-03 23:40:22 +0000431 0, /*tp_as_buffer*/
432 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
433 0, /*tp_doc*/
434 0, /*tp_traverse*/
435 0, /*tp_clear*/
436 0, /*tp_richcompare*/
437 0, /*tp_weaklistoffset*/
438 0, /*tp_iter*/
439 0, /*tp_iternext*/
Jack Jansendbd57012002-11-29 23:40:48 +0000440 WEOObj_methods, /* tp_methods */
Jack Jansen96cebde2002-12-03 23:40:22 +0000441 0, /*tp_members*/
Jack Jansendbd57012002-11-29 23:40:48 +0000442 WEOObj_getsetlist, /*tp_getset*/
Jack Jansen96cebde2002-12-03 23:40:22 +0000443 0, /*tp_base*/
444 0, /*tp_dict*/
445 0, /*tp_descr_get*/
446 0, /*tp_descr_set*/
447 0, /*tp_dictoffset*/
448 WEOObj_tp_init, /* tp_init */
449 WEOObj_tp_alloc, /* tp_alloc */
450 WEOObj_tp_new, /* tp_new */
451 WEOObj_tp_free, /* tp_free */
Jack Jansen90ecdf41996-04-16 14:29:15 +0000452};
453
454/* ---------------------- End object type WEO ----------------------- */
455
456
457/* ----------------------- Object type waste ------------------------ */
458
459PyTypeObject waste_Type;
460
Jack Jansenf9557842002-12-19 21:24:35 +0000461#define wasteObj_Check(x) ((x)->ob_type == &waste_Type || PyObject_TypeCheck((x), &waste_Type))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000462
463typedef struct wasteObject {
464 PyObject_HEAD
465 WEReference ob_itself;
466} wasteObject;
467
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000468PyObject *wasteObj_New(WEReference itself)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000469{
470 wasteObject *it;
471 if (itself == NULL) {
472 PyErr_SetString(waste_Error,"Cannot create null WE");
473 return NULL;
474 }
475 it = PyObject_NEW(wasteObject, &waste_Type);
476 if (it == NULL) return NULL;
477 it->ob_itself = itself;
Jack Jansen756522f1996-05-07 15:24:01 +0000478 WESetInfo(weRefCon, (void *)&it, itself);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000479 return (PyObject *)it;
480}
Jack Jansen044d95e2001-09-05 15:44:37 +0000481int wasteObj_Convert(PyObject *v, WEReference *p_itself)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000482{
483 if (!wasteObj_Check(v))
484 {
485 PyErr_SetString(PyExc_TypeError, "waste required");
486 return 0;
487 }
488 *p_itself = ((wasteObject *)v)->ob_itself;
489 return 1;
490}
491
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000492static void wasteObj_dealloc(wasteObject *self)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000493{
494 WEDispose(self->ob_itself);
Jack Jansen033b79c2002-04-23 22:46:01 +0000495 PyObject_Del(self);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000496}
497
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000498static PyObject *wasteObj_WEGetText(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000499{
500 PyObject *_res = NULL;
501 Handle _rv;
502 if (!PyArg_ParseTuple(_args, ""))
503 return NULL;
504 _rv = WEGetText(_self->ob_itself);
505 _res = Py_BuildValue("O&",
506 ResObj_New, _rv);
507 return _res;
508}
509
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000510static PyObject *wasteObj_WEGetChar(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000511{
512 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +0000513 SInt16 _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +0000514 SInt32 inOffset;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000515 if (!PyArg_ParseTuple(_args, "l",
Jack Jansenb99e5212002-01-11 12:37:15 +0000516 &inOffset))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000517 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000518 _rv = WEGetChar(inOffset,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000519 _self->ob_itself);
520 _res = Py_BuildValue("h",
521 _rv);
522 return _res;
523}
524
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000525static PyObject *wasteObj_WEGetTextLength(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000526{
527 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +0000528 SInt32 _rv;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000529 if (!PyArg_ParseTuple(_args, ""))
530 return NULL;
531 _rv = WEGetTextLength(_self->ob_itself);
532 _res = Py_BuildValue("l",
533 _rv);
534 return _res;
535}
536
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000537static PyObject *wasteObj_WEGetSelection(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000538{
539 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000540 SInt32 outSelStart;
541 SInt32 outSelEnd;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000542 if (!PyArg_ParseTuple(_args, ""))
543 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000544 WEGetSelection(&outSelStart,
545 &outSelEnd,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000546 _self->ob_itself);
547 _res = Py_BuildValue("ll",
Jack Jansenb99e5212002-01-11 12:37:15 +0000548 outSelStart,
549 outSelEnd);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000550 return _res;
551}
552
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000553static PyObject *wasteObj_WEGetDestRect(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000554{
555 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000556 LongRect outDestRect;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000557 if (!PyArg_ParseTuple(_args, ""))
558 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000559 WEGetDestRect(&outDestRect,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000560 _self->ob_itself);
561 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +0000562 LongRect_New, &outDestRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000563 return _res;
564}
565
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000566static PyObject *wasteObj_WEGetViewRect(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000567{
568 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000569 LongRect outViewRect;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000570 if (!PyArg_ParseTuple(_args, ""))
571 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000572 WEGetViewRect(&outViewRect,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000573 _self->ob_itself);
574 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +0000575 LongRect_New, &outViewRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000576 return _res;
577}
578
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000579static PyObject *wasteObj_WEIsActive(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000580{
581 PyObject *_res = NULL;
582 Boolean _rv;
583 if (!PyArg_ParseTuple(_args, ""))
584 return NULL;
585 _rv = WEIsActive(_self->ob_itself);
586 _res = Py_BuildValue("b",
587 _rv);
588 return _res;
589}
590
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000591static PyObject *wasteObj_WEGetClickCount(wasteObject *_self, PyObject *_args)
Jack Jansen2268af51996-08-06 16:04:22 +0000592{
593 PyObject *_res = NULL;
594 UInt16 _rv;
595 if (!PyArg_ParseTuple(_args, ""))
596 return NULL;
597 _rv = WEGetClickCount(_self->ob_itself);
Jack Jansen9d8b96c2000-07-14 22:16:45 +0000598 _res = Py_BuildValue("H",
Jack Jansen2268af51996-08-06 16:04:22 +0000599 _rv);
600 return _res;
601}
602
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000603static PyObject *wasteObj_WESetSelection(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000604{
605 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000606 SInt32 inSelStart;
607 SInt32 inSelEnd;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000608 if (!PyArg_ParseTuple(_args, "ll",
Jack Jansenb99e5212002-01-11 12:37:15 +0000609 &inSelStart,
610 &inSelEnd))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000611 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000612 WESetSelection(inSelStart,
613 inSelEnd,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000614 _self->ob_itself);
615 Py_INCREF(Py_None);
616 _res = Py_None;
617 return _res;
618}
619
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000620static PyObject *wasteObj_WESetDestRect(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000621{
622 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000623 LongRect inDestRect;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000624 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +0000625 LongRect_Convert, &inDestRect))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000626 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000627 WESetDestRect(&inDestRect,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000628 _self->ob_itself);
629 Py_INCREF(Py_None);
630 _res = Py_None;
631 return _res;
632}
633
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000634static PyObject *wasteObj_WESetViewRect(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000635{
636 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000637 LongRect inViewRect;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000638 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +0000639 LongRect_Convert, &inViewRect))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000640 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000641 WESetViewRect(&inViewRect,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000642 _self->ob_itself);
643 Py_INCREF(Py_None);
644 _res = Py_None;
645 return _res;
646}
647
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000648static PyObject *wasteObj_WEContinuousStyle(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000649{
650 PyObject *_res = NULL;
651 Boolean _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +0000652 WEStyleMode ioMode;
653 TextStyle outTextStyle;
Jack Jansen9d8b96c2000-07-14 22:16:45 +0000654 if (!PyArg_ParseTuple(_args, "H",
Jack Jansenb99e5212002-01-11 12:37:15 +0000655 &ioMode))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000656 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000657 _rv = WEContinuousStyle(&ioMode,
658 &outTextStyle,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000659 _self->ob_itself);
Jack Jansen9d8b96c2000-07-14 22:16:45 +0000660 _res = Py_BuildValue("bHO&",
Jack Jansen90ecdf41996-04-16 14:29:15 +0000661 _rv,
Jack Jansenb99e5212002-01-11 12:37:15 +0000662 ioMode,
663 TextStyle_New, &outTextStyle);
664 return _res;
665}
666
667static PyObject *wasteObj_WECountRuns(wasteObject *_self, PyObject *_args)
668{
669 PyObject *_res = NULL;
670 SInt32 _rv;
671 if (!PyArg_ParseTuple(_args, ""))
672 return NULL;
673 _rv = WECountRuns(_self->ob_itself);
674 _res = Py_BuildValue("l",
675 _rv);
676 return _res;
677}
678
679static PyObject *wasteObj_WEOffsetToRun(wasteObject *_self, PyObject *_args)
680{
681 PyObject *_res = NULL;
682 SInt32 _rv;
683 SInt32 inOffset;
684 if (!PyArg_ParseTuple(_args, "l",
685 &inOffset))
686 return NULL;
687 _rv = WEOffsetToRun(inOffset,
688 _self->ob_itself);
689 _res = Py_BuildValue("l",
690 _rv);
691 return _res;
692}
693
694static PyObject *wasteObj_WEGetRunRange(wasteObject *_self, PyObject *_args)
695{
696 PyObject *_res = NULL;
697 SInt32 inStyleRunIndex;
698 SInt32 outStyleRunStart;
699 SInt32 outStyleRunEnd;
700 if (!PyArg_ParseTuple(_args, "l",
701 &inStyleRunIndex))
702 return NULL;
703 WEGetRunRange(inStyleRunIndex,
704 &outStyleRunStart,
705 &outStyleRunEnd,
706 _self->ob_itself);
707 _res = Py_BuildValue("ll",
708 outStyleRunStart,
709 outStyleRunEnd);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000710 return _res;
711}
712
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000713static PyObject *wasteObj_WEGetRunInfo(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000714{
715 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000716 SInt32 inOffset;
717 WERunInfo outStyleRunInfo;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000718 if (!PyArg_ParseTuple(_args, "l",
Jack Jansenb99e5212002-01-11 12:37:15 +0000719 &inOffset))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000720 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000721 WEGetRunInfo(inOffset,
722 &outStyleRunInfo,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000723 _self->ob_itself);
724 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +0000725 RunInfo_New, &outStyleRunInfo);
726 return _res;
727}
728
729static PyObject *wasteObj_WEGetIndRunInfo(wasteObject *_self, PyObject *_args)
730{
731 PyObject *_res = NULL;
732 SInt32 inStyleRunIndex;
733 WERunInfo outStyleRunInfo;
734 if (!PyArg_ParseTuple(_args, "l",
735 &inStyleRunIndex))
736 return NULL;
737 WEGetIndRunInfo(inStyleRunIndex,
738 &outStyleRunInfo,
739 _self->ob_itself);
740 _res = Py_BuildValue("O&",
741 RunInfo_New, &outStyleRunInfo);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000742 return _res;
743}
744
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000745static PyObject *wasteObj_WEGetRunDirection(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +0000746{
747 PyObject *_res = NULL;
748 Boolean _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +0000749 SInt32 inOffset;
Jack Jansen2369a981998-02-20 15:57:30 +0000750 if (!PyArg_ParseTuple(_args, "l",
Jack Jansenb99e5212002-01-11 12:37:15 +0000751 &inOffset))
Jack Jansen2369a981998-02-20 15:57:30 +0000752 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000753 _rv = WEGetRunDirection(inOffset,
Jack Jansen2369a981998-02-20 15:57:30 +0000754 _self->ob_itself);
755 _res = Py_BuildValue("b",
756 _rv);
757 return _res;
758}
759
Jack Jansenb99e5212002-01-11 12:37:15 +0000760static PyObject *wasteObj_WECountParaRuns(wasteObject *_self, PyObject *_args)
761{
762 PyObject *_res = NULL;
763 SInt32 _rv;
764 if (!PyArg_ParseTuple(_args, ""))
765 return NULL;
766 _rv = WECountParaRuns(_self->ob_itself);
767 _res = Py_BuildValue("l",
768 _rv);
769 return _res;
770}
771
772static PyObject *wasteObj_WEOffsetToParaRun(wasteObject *_self, PyObject *_args)
773{
774 PyObject *_res = NULL;
775 SInt32 _rv;
776 SInt32 inOffset;
777 if (!PyArg_ParseTuple(_args, "l",
778 &inOffset))
779 return NULL;
780 _rv = WEOffsetToParaRun(inOffset,
781 _self->ob_itself);
782 _res = Py_BuildValue("l",
783 _rv);
784 return _res;
785}
786
787static PyObject *wasteObj_WEGetParaRunRange(wasteObject *_self, PyObject *_args)
788{
789 PyObject *_res = NULL;
790 SInt32 inParagraphRunIndex;
791 SInt32 outParagraphRunStart;
792 SInt32 outParagraphRunEnd;
793 if (!PyArg_ParseTuple(_args, "l",
794 &inParagraphRunIndex))
795 return NULL;
796 WEGetParaRunRange(inParagraphRunIndex,
797 &outParagraphRunStart,
798 &outParagraphRunEnd,
799 _self->ob_itself);
800 _res = Py_BuildValue("ll",
801 outParagraphRunStart,
802 outParagraphRunEnd);
803 return _res;
804}
805
806static PyObject *wasteObj_WECountLines(wasteObject *_self, PyObject *_args)
807{
808 PyObject *_res = NULL;
809 SInt32 _rv;
810 if (!PyArg_ParseTuple(_args, ""))
811 return NULL;
812 _rv = WECountLines(_self->ob_itself);
813 _res = Py_BuildValue("l",
814 _rv);
815 return _res;
816}
817
818static PyObject *wasteObj_WEOffsetToLine(wasteObject *_self, PyObject *_args)
819{
820 PyObject *_res = NULL;
821 SInt32 _rv;
822 SInt32 inOffset;
823 if (!PyArg_ParseTuple(_args, "l",
824 &inOffset))
825 return NULL;
826 _rv = WEOffsetToLine(inOffset,
827 _self->ob_itself);
828 _res = Py_BuildValue("l",
829 _rv);
830 return _res;
831}
832
833static PyObject *wasteObj_WEGetLineRange(wasteObject *_self, PyObject *_args)
834{
835 PyObject *_res = NULL;
836 SInt32 inLineIndex;
837 SInt32 outLineStart;
838 SInt32 outLineEnd;
839 if (!PyArg_ParseTuple(_args, "l",
840 &inLineIndex))
841 return NULL;
842 WEGetLineRange(inLineIndex,
843 &outLineStart,
844 &outLineEnd,
845 _self->ob_itself);
846 _res = Py_BuildValue("ll",
847 outLineStart,
848 outLineEnd);
849 return _res;
850}
851
852static PyObject *wasteObj_WEGetHeight(wasteObject *_self, PyObject *_args)
853{
854 PyObject *_res = NULL;
855 SInt32 _rv;
856 SInt32 inStartLineIndex;
857 SInt32 inEndLineIndex;
858 if (!PyArg_ParseTuple(_args, "ll",
859 &inStartLineIndex,
860 &inEndLineIndex))
861 return NULL;
862 _rv = WEGetHeight(inStartLineIndex,
863 inEndLineIndex,
864 _self->ob_itself);
865 _res = Py_BuildValue("l",
866 _rv);
867 return _res;
868}
869
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000870static PyObject *wasteObj_WEGetOffset(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000871{
872 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +0000873 SInt32 _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +0000874 LongPt inPoint;
875 WEEdge outEdge;
Jack Jansen90ecdf41996-04-16 14:29:15 +0000876 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +0000877 LongPt_Convert, &inPoint))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000878 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000879 _rv = WEGetOffset(&inPoint,
880 &outEdge,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000881 _self->ob_itself);
Jack Jansen97ed9072000-09-08 22:06:16 +0000882 _res = Py_BuildValue("lB",
Jack Jansen90ecdf41996-04-16 14:29:15 +0000883 _rv,
Jack Jansenb99e5212002-01-11 12:37:15 +0000884 outEdge);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000885 return _res;
886}
887
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000888static PyObject *wasteObj_WEGetPoint(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000889{
890 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000891 SInt32 inOffset;
892 SInt16 inDirection;
893 LongPt outPoint;
894 SInt16 outLineHeight;
Jack Jansen2268af51996-08-06 16:04:22 +0000895 if (!PyArg_ParseTuple(_args, "lh",
Jack Jansenb99e5212002-01-11 12:37:15 +0000896 &inOffset,
897 &inDirection))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000898 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000899 WEGetPoint(inOffset,
900 inDirection,
901 &outPoint,
902 &outLineHeight,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000903 _self->ob_itself);
904 _res = Py_BuildValue("O&h",
Jack Jansenb99e5212002-01-11 12:37:15 +0000905 LongPt_New, &outPoint,
906 outLineHeight);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000907 return _res;
908}
909
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000910static PyObject *wasteObj_WEFindWord(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000911{
912 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000913 SInt32 inOffset;
914 WEEdge inEdge;
915 SInt32 outWordStart;
916 SInt32 outWordEnd;
Jack Jansen97ed9072000-09-08 22:06:16 +0000917 if (!PyArg_ParseTuple(_args, "lB",
Jack Jansenb99e5212002-01-11 12:37:15 +0000918 &inOffset,
919 &inEdge))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000920 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000921 WEFindWord(inOffset,
922 inEdge,
923 &outWordStart,
924 &outWordEnd,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000925 _self->ob_itself);
926 _res = Py_BuildValue("ll",
Jack Jansenb99e5212002-01-11 12:37:15 +0000927 outWordStart,
928 outWordEnd);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000929 return _res;
930}
931
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000932static PyObject *wasteObj_WEFindLine(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +0000933{
934 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000935 SInt32 inOffset;
936 WEEdge inEdge;
937 SInt32 outLineStart;
938 SInt32 outLineEnd;
Jack Jansen97ed9072000-09-08 22:06:16 +0000939 if (!PyArg_ParseTuple(_args, "lB",
Jack Jansenb99e5212002-01-11 12:37:15 +0000940 &inOffset,
941 &inEdge))
Jack Jansen90ecdf41996-04-16 14:29:15 +0000942 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000943 WEFindLine(inOffset,
944 inEdge,
945 &outLineStart,
946 &outLineEnd,
Jack Jansen90ecdf41996-04-16 14:29:15 +0000947 _self->ob_itself);
948 _res = Py_BuildValue("ll",
Jack Jansenb99e5212002-01-11 12:37:15 +0000949 outLineStart,
950 outLineEnd);
Jack Jansen90ecdf41996-04-16 14:29:15 +0000951 return _res;
952}
953
Jack Jansenfa77e1a2001-05-22 21:56:42 +0000954static PyObject *wasteObj_WEFindParagraph(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +0000955{
956 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000957 SInt32 inOffset;
958 WEEdge inEdge;
959 SInt32 outParagraphStart;
960 SInt32 outParagraphEnd;
Jack Jansen97ed9072000-09-08 22:06:16 +0000961 if (!PyArg_ParseTuple(_args, "lB",
Jack Jansenb99e5212002-01-11 12:37:15 +0000962 &inOffset,
963 &inEdge))
Jack Jansen2369a981998-02-20 15:57:30 +0000964 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +0000965 WEFindParagraph(inOffset,
966 inEdge,
967 &outParagraphStart,
968 &outParagraphEnd,
Jack Jansen2369a981998-02-20 15:57:30 +0000969 _self->ob_itself);
970 _res = Py_BuildValue("ll",
Jack Jansenb99e5212002-01-11 12:37:15 +0000971 outParagraphStart,
972 outParagraphEnd);
973 return _res;
974}
975
976static PyObject *wasteObj_WEFind(wasteObject *_self, PyObject *_args)
977{
978 PyObject *_res = NULL;
979 OSErr _err;
980 char* inKey;
981 SInt32 inKeyLength;
982 TextEncoding inKeyEncoding;
983 OptionBits inMatchOptions;
984 SInt32 inRangeStart;
985 SInt32 inRangeEnd;
986 SInt32 outMatchStart;
987 SInt32 outMatchEnd;
988 if (!PyArg_ParseTuple(_args, "slllll",
989 &inKey,
990 &inKeyLength,
991 &inKeyEncoding,
992 &inMatchOptions,
993 &inRangeStart,
994 &inRangeEnd))
995 return NULL;
996 _err = WEFind(inKey,
997 inKeyLength,
998 inKeyEncoding,
999 inMatchOptions,
1000 inRangeStart,
1001 inRangeEnd,
1002 &outMatchStart,
1003 &outMatchEnd,
1004 _self->ob_itself);
1005 if (_err != noErr) return PyMac_Error(_err);
1006 _res = Py_BuildValue("ll",
1007 outMatchStart,
1008 outMatchEnd);
1009 return _res;
1010}
1011
1012static PyObject *wasteObj_WEStreamRange(wasteObject *_self, PyObject *_args)
1013{
1014 PyObject *_res = NULL;
1015 OSErr _err;
1016 SInt32 inRangeStart;
1017 SInt32 inRangeEnd;
1018 FlavorType inRequestedType;
1019 OptionBits inStreamOptions;
1020 Handle outData;
1021 if (!PyArg_ParseTuple(_args, "llO&lO&",
1022 &inRangeStart,
1023 &inRangeEnd,
1024 PyMac_GetOSType, &inRequestedType,
1025 &inStreamOptions,
1026 ResObj_Convert, &outData))
1027 return NULL;
1028 _err = WEStreamRange(inRangeStart,
1029 inRangeEnd,
1030 inRequestedType,
1031 inStreamOptions,
1032 outData,
1033 _self->ob_itself);
1034 if (_err != noErr) return PyMac_Error(_err);
1035 Py_INCREF(Py_None);
1036 _res = Py_None;
Jack Jansen2369a981998-02-20 15:57:30 +00001037 return _res;
1038}
1039
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001040static PyObject *wasteObj_WECopyRange(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001041{
1042 PyObject *_res = NULL;
1043 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001044 SInt32 inRangeStart;
1045 SInt32 inRangeEnd;
1046 Handle outText;
1047 StScrpHandle outStyles;
1048 WESoupHandle outSoup;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001049 if (!PyArg_ParseTuple(_args, "llO&O&O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001050 &inRangeStart,
1051 &inRangeEnd,
1052 OptResObj_Convert, &outText,
1053 OptResObj_Convert, &outStyles,
1054 OptResObj_Convert, &outSoup))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001055 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001056 _err = WECopyRange(inRangeStart,
1057 inRangeEnd,
1058 outText,
1059 outStyles,
1060 outSoup,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001061 _self->ob_itself);
1062 if (_err != noErr) return PyMac_Error(_err);
1063 Py_INCREF(Py_None);
1064 _res = Py_None;
1065 return _res;
1066}
1067
Jack Jansenb99e5212002-01-11 12:37:15 +00001068static PyObject *wasteObj_WEGetTextRangeAsUnicode(wasteObject *_self, PyObject *_args)
1069{
1070 PyObject *_res = NULL;
1071 OSErr _err;
1072 SInt32 inRangeStart;
1073 SInt32 inRangeEnd;
1074 Handle outUnicodeText;
1075 Handle ioCharFormat;
1076 Handle ioParaFormat;
1077 TextEncodingVariant inUnicodeVariant;
1078 TextEncodingFormat inTransformationFormat;
1079 OptionBits inGetOptions;
1080 if (!PyArg_ParseTuple(_args, "llO&O&O&lll",
1081 &inRangeStart,
1082 &inRangeEnd,
1083 ResObj_Convert, &outUnicodeText,
1084 ResObj_Convert, &ioCharFormat,
1085 ResObj_Convert, &ioParaFormat,
1086 &inUnicodeVariant,
1087 &inTransformationFormat,
1088 &inGetOptions))
1089 return NULL;
1090 _err = WEGetTextRangeAsUnicode(inRangeStart,
1091 inRangeEnd,
1092 outUnicodeText,
1093 ioCharFormat,
1094 ioParaFormat,
1095 inUnicodeVariant,
1096 inTransformationFormat,
1097 inGetOptions,
1098 _self->ob_itself);
1099 if (_err != noErr) return PyMac_Error(_err);
1100 Py_INCREF(Py_None);
1101 _res = Py_None;
1102 return _res;
1103}
1104
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001105static PyObject *wasteObj_WEGetAlignment(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001106{
1107 PyObject *_res = NULL;
1108 WEAlignment _rv;
1109 if (!PyArg_ParseTuple(_args, ""))
1110 return NULL;
1111 _rv = WEGetAlignment(_self->ob_itself);
Jack Jansen97ed9072000-09-08 22:06:16 +00001112 _res = Py_BuildValue("B",
Jack Jansen90ecdf41996-04-16 14:29:15 +00001113 _rv);
1114 return _res;
1115}
1116
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001117static PyObject *wasteObj_WESetAlignment(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001118{
1119 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001120 WEAlignment inAlignment;
Jack Jansen97ed9072000-09-08 22:06:16 +00001121 if (!PyArg_ParseTuple(_args, "B",
Jack Jansenb99e5212002-01-11 12:37:15 +00001122 &inAlignment))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001123 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001124 WESetAlignment(inAlignment,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001125 _self->ob_itself);
1126 Py_INCREF(Py_None);
1127 _res = Py_None;
1128 return _res;
1129}
1130
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001131static PyObject *wasteObj_WEGetDirection(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00001132{
1133 PyObject *_res = NULL;
1134 WEDirection _rv;
1135 if (!PyArg_ParseTuple(_args, ""))
1136 return NULL;
1137 _rv = WEGetDirection(_self->ob_itself);
1138 _res = Py_BuildValue("h",
1139 _rv);
1140 return _res;
1141}
1142
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001143static PyObject *wasteObj_WESetDirection(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00001144{
1145 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001146 WEDirection inDirection;
Jack Jansen2369a981998-02-20 15:57:30 +00001147 if (!PyArg_ParseTuple(_args, "h",
Jack Jansenb99e5212002-01-11 12:37:15 +00001148 &inDirection))
Jack Jansen2369a981998-02-20 15:57:30 +00001149 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001150 WESetDirection(inDirection,
Jack Jansen2369a981998-02-20 15:57:30 +00001151 _self->ob_itself);
1152 Py_INCREF(Py_None);
1153 _res = Py_None;
1154 return _res;
1155}
1156
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001157static PyObject *wasteObj_WECalText(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001158{
1159 PyObject *_res = NULL;
1160 OSErr _err;
1161 if (!PyArg_ParseTuple(_args, ""))
1162 return NULL;
1163 _err = WECalText(_self->ob_itself);
1164 if (_err != noErr) return PyMac_Error(_err);
1165 Py_INCREF(Py_None);
1166 _res = Py_None;
1167 return _res;
1168}
1169
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001170static PyObject *wasteObj_WEUpdate(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001171{
1172 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001173 RgnHandle inUpdateRgn;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001174 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001175 ResObj_Convert, &inUpdateRgn))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001176 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001177 WEUpdate(inUpdateRgn,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001178 _self->ob_itself);
1179 Py_INCREF(Py_None);
1180 _res = Py_None;
1181 return _res;
1182}
1183
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001184static PyObject *wasteObj_WEScroll(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001185{
1186 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001187 SInt32 inHorizontalOffset;
1188 SInt32 inVerticalOffset;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001189 if (!PyArg_ParseTuple(_args, "ll",
Jack Jansenb99e5212002-01-11 12:37:15 +00001190 &inHorizontalOffset,
1191 &inVerticalOffset))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001192 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001193 WEScroll(inHorizontalOffset,
1194 inVerticalOffset,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001195 _self->ob_itself);
1196 Py_INCREF(Py_None);
1197 _res = Py_None;
1198 return _res;
1199}
1200
Jack Jansenb99e5212002-01-11 12:37:15 +00001201static PyObject *wasteObj_WEPinScroll(wasteObject *_self, PyObject *_args)
1202{
1203 PyObject *_res = NULL;
1204 SInt32 inHorizontalOffset;
1205 SInt32 inVerticalOffset;
1206 if (!PyArg_ParseTuple(_args, "ll",
1207 &inHorizontalOffset,
1208 &inVerticalOffset))
1209 return NULL;
1210 WEPinScroll(inHorizontalOffset,
1211 inVerticalOffset,
1212 _self->ob_itself);
1213 Py_INCREF(Py_None);
1214 _res = Py_None;
1215 return _res;
1216}
1217
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001218static PyObject *wasteObj_WESelView(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001219{
1220 PyObject *_res = NULL;
1221 if (!PyArg_ParseTuple(_args, ""))
1222 return NULL;
1223 WESelView(_self->ob_itself);
1224 Py_INCREF(Py_None);
1225 _res = Py_None;
1226 return _res;
1227}
1228
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001229static PyObject *wasteObj_WEActivate(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001230{
1231 PyObject *_res = NULL;
1232 if (!PyArg_ParseTuple(_args, ""))
1233 return NULL;
1234 WEActivate(_self->ob_itself);
1235 Py_INCREF(Py_None);
1236 _res = Py_None;
1237 return _res;
1238}
1239
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001240static PyObject *wasteObj_WEDeactivate(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001241{
1242 PyObject *_res = NULL;
1243 if (!PyArg_ParseTuple(_args, ""))
1244 return NULL;
1245 WEDeactivate(_self->ob_itself);
1246 Py_INCREF(Py_None);
1247 _res = Py_None;
1248 return _res;
1249}
1250
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001251static PyObject *wasteObj_WEKey(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001252{
1253 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001254 CharParameter inKey;
1255 EventModifiers inModifiers;
Jack Jansen9d8b96c2000-07-14 22:16:45 +00001256 if (!PyArg_ParseTuple(_args, "hH",
Jack Jansenb99e5212002-01-11 12:37:15 +00001257 &inKey,
1258 &inModifiers))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001259 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001260 WEKey(inKey,
1261 inModifiers,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001262 _self->ob_itself);
1263 Py_INCREF(Py_None);
1264 _res = Py_None;
1265 return _res;
1266}
1267
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001268static PyObject *wasteObj_WEClick(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001269{
1270 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001271 Point inHitPoint;
1272 EventModifiers inModifiers;
1273 UInt32 inClickTime;
Jack Jansen9d8b96c2000-07-14 22:16:45 +00001274 if (!PyArg_ParseTuple(_args, "O&Hl",
Jack Jansenb99e5212002-01-11 12:37:15 +00001275 PyMac_GetPoint, &inHitPoint,
1276 &inModifiers,
1277 &inClickTime))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001278 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001279 WEClick(inHitPoint,
1280 inModifiers,
1281 inClickTime,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001282 _self->ob_itself);
1283 Py_INCREF(Py_None);
1284 _res = Py_None;
1285 return _res;
1286}
1287
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001288static PyObject *wasteObj_WEAdjustCursor(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001289{
1290 PyObject *_res = NULL;
1291 Boolean _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00001292 Point inMouseLoc;
1293 RgnHandle ioMouseRgn;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001294 if (!PyArg_ParseTuple(_args, "O&O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001295 PyMac_GetPoint, &inMouseLoc,
1296 ResObj_Convert, &ioMouseRgn))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001297 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001298 _rv = WEAdjustCursor(inMouseLoc,
1299 ioMouseRgn,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001300 _self->ob_itself);
1301 _res = Py_BuildValue("b",
1302 _rv);
1303 return _res;
1304}
1305
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001306static PyObject *wasteObj_WEIdle(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001307{
1308 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001309 UInt32 outMaxSleep;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001310 if (!PyArg_ParseTuple(_args, ""))
1311 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001312 WEIdle(&outMaxSleep,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001313 _self->ob_itself);
1314 _res = Py_BuildValue("l",
Jack Jansenb99e5212002-01-11 12:37:15 +00001315 outMaxSleep);
Jack Jansen90ecdf41996-04-16 14:29:15 +00001316 return _res;
1317}
1318
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001319static PyObject *wasteObj_WEInsert(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001320{
1321 PyObject *_res = NULL;
1322 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001323 char *inTextPtr__in__;
1324 long inTextPtr__len__;
1325 int inTextPtr__in_len__;
1326 StScrpHandle inStyles;
1327 WESoupHandle inSoup;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001328 if (!PyArg_ParseTuple(_args, "s#O&O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001329 &inTextPtr__in__, &inTextPtr__in_len__,
1330 OptResObj_Convert, &inStyles,
1331 OptResObj_Convert, &inSoup))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001332 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001333 inTextPtr__len__ = inTextPtr__in_len__;
1334 _err = WEInsert(inTextPtr__in__, inTextPtr__len__,
1335 inStyles,
1336 inSoup,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001337 _self->ob_itself);
1338 if (_err != noErr) return PyMac_Error(_err);
1339 Py_INCREF(Py_None);
1340 _res = Py_None;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001341 return _res;
1342}
1343
Jack Jansenb99e5212002-01-11 12:37:15 +00001344static PyObject *wasteObj_WEInsertFormattedText(wasteObject *_self, PyObject *_args)
1345{
1346 PyObject *_res = NULL;
1347 OSErr _err;
1348 char *inTextPtr__in__;
1349 long inTextPtr__len__;
1350 int inTextPtr__in_len__;
1351 StScrpHandle inStyles;
1352 WESoupHandle inSoup;
1353 Handle inParaFormat;
1354 Handle inRulerScrap;
1355 if (!PyArg_ParseTuple(_args, "s#O&O&O&O&",
1356 &inTextPtr__in__, &inTextPtr__in_len__,
1357 OptResObj_Convert, &inStyles,
1358 OptResObj_Convert, &inSoup,
1359 ResObj_Convert, &inParaFormat,
1360 ResObj_Convert, &inRulerScrap))
1361 return NULL;
1362 inTextPtr__len__ = inTextPtr__in_len__;
1363 _err = WEInsertFormattedText(inTextPtr__in__, inTextPtr__len__,
1364 inStyles,
1365 inSoup,
1366 inParaFormat,
1367 inRulerScrap,
1368 _self->ob_itself);
1369 if (_err != noErr) return PyMac_Error(_err);
1370 Py_INCREF(Py_None);
1371 _res = Py_None;
1372 return _res;
1373}
1374
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001375static PyObject *wasteObj_WEDelete(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001376{
1377 PyObject *_res = NULL;
1378 OSErr _err;
1379 if (!PyArg_ParseTuple(_args, ""))
1380 return NULL;
1381 _err = WEDelete(_self->ob_itself);
1382 if (_err != noErr) return PyMac_Error(_err);
1383 Py_INCREF(Py_None);
1384 _res = Py_None;
1385 return _res;
1386}
1387
Jack Jansenb99e5212002-01-11 12:37:15 +00001388static PyObject *wasteObj_WEUseText(wasteObject *_self, PyObject *_args)
1389{
1390 PyObject *_res = NULL;
1391 OSErr _err;
1392 Handle inText;
1393 if (!PyArg_ParseTuple(_args, "O&",
1394 ResObj_Convert, &inText))
1395 return NULL;
1396 _err = WEUseText(inText,
1397 _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
1404static PyObject *wasteObj_WEChangeCase(wasteObject *_self, PyObject *_args)
1405{
1406 PyObject *_res = NULL;
1407 OSErr _err;
1408 SInt16 inCase;
1409 if (!PyArg_ParseTuple(_args, "h",
1410 &inCase))
1411 return NULL;
1412 _err = WEChangeCase(inCase,
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_WESetOneAttribute(wasteObject *_self, PyObject *_args)
1421{
1422 PyObject *_res = NULL;
1423 OSErr _err;
1424 SInt32 inRangeStart;
1425 SInt32 inRangeEnd;
1426 WESelector inAttributeSelector;
1427 char *inAttributeValue__in__;
1428 long inAttributeValue__len__;
1429 int inAttributeValue__in_len__;
1430 if (!PyArg_ParseTuple(_args, "llO&s#",
1431 &inRangeStart,
1432 &inRangeEnd,
1433 PyMac_GetOSType, &inAttributeSelector,
1434 &inAttributeValue__in__, &inAttributeValue__in_len__))
1435 return NULL;
1436 inAttributeValue__len__ = inAttributeValue__in_len__;
1437 _err = WESetOneAttribute(inRangeStart,
1438 inRangeEnd,
1439 inAttributeSelector,
1440 inAttributeValue__in__, inAttributeValue__len__,
1441 _self->ob_itself);
1442 if (_err != noErr) return PyMac_Error(_err);
1443 Py_INCREF(Py_None);
1444 _res = Py_None;
1445 return _res;
1446}
1447
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001448static PyObject *wasteObj_WESetStyle(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001449{
1450 PyObject *_res = NULL;
1451 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001452 WEStyleMode inMode;
1453 TextStyle inTextStyle;
Jack Jansen9d8b96c2000-07-14 22:16:45 +00001454 if (!PyArg_ParseTuple(_args, "HO&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001455 &inMode,
1456 TextStyle_Convert, &inTextStyle))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001457 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001458 _err = WESetStyle(inMode,
1459 &inTextStyle,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001460 _self->ob_itself);
1461 if (_err != noErr) return PyMac_Error(_err);
1462 Py_INCREF(Py_None);
1463 _res = Py_None;
1464 return _res;
1465}
1466
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001467static PyObject *wasteObj_WEUseStyleScrap(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001468{
1469 PyObject *_res = NULL;
1470 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001471 StScrpHandle inStyles;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001472 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001473 ResObj_Convert, &inStyles))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001474 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001475 _err = WEUseStyleScrap(inStyles,
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_WEUndo(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001484{
1485 PyObject *_res = NULL;
1486 OSErr _err;
1487 if (!PyArg_ParseTuple(_args, ""))
1488 return NULL;
1489 _err = WEUndo(_self->ob_itself);
1490 if (_err != noErr) return PyMac_Error(_err);
1491 Py_INCREF(Py_None);
1492 _res = Py_None;
1493 return _res;
1494}
1495
Jack Jansenb99e5212002-01-11 12:37:15 +00001496static PyObject *wasteObj_WERedo(wasteObject *_self, PyObject *_args)
1497{
1498 PyObject *_res = NULL;
1499 OSErr _err;
1500 if (!PyArg_ParseTuple(_args, ""))
1501 return NULL;
1502 _err = WERedo(_self->ob_itself);
1503 if (_err != noErr) return PyMac_Error(_err);
1504 Py_INCREF(Py_None);
1505 _res = Py_None;
1506 return _res;
1507}
1508
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001509static PyObject *wasteObj_WEClearUndo(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001510{
1511 PyObject *_res = NULL;
1512 if (!PyArg_ParseTuple(_args, ""))
1513 return NULL;
1514 WEClearUndo(_self->ob_itself);
1515 Py_INCREF(Py_None);
1516 _res = Py_None;
1517 return _res;
1518}
1519
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001520static PyObject *wasteObj_WEGetUndoInfo(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001521{
1522 PyObject *_res = NULL;
1523 WEActionKind _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00001524 Boolean outRedoFlag;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001525 if (!PyArg_ParseTuple(_args, ""))
1526 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001527 _rv = WEGetUndoInfo(&outRedoFlag,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001528 _self->ob_itself);
1529 _res = Py_BuildValue("hb",
1530 _rv,
Jack Jansenb99e5212002-01-11 12:37:15 +00001531 outRedoFlag);
1532 return _res;
1533}
1534
1535static PyObject *wasteObj_WEGetIndUndoInfo(wasteObject *_self, PyObject *_args)
1536{
1537 PyObject *_res = NULL;
1538 WEActionKind _rv;
1539 SInt32 inUndoLevel;
1540 if (!PyArg_ParseTuple(_args, "l",
1541 &inUndoLevel))
1542 return NULL;
1543 _rv = WEGetIndUndoInfo(inUndoLevel,
1544 _self->ob_itself);
1545 _res = Py_BuildValue("h",
1546 _rv);
Jack Jansen90ecdf41996-04-16 14:29:15 +00001547 return _res;
1548}
1549
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001550static PyObject *wasteObj_WEIsTyping(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001551{
1552 PyObject *_res = NULL;
1553 Boolean _rv;
1554 if (!PyArg_ParseTuple(_args, ""))
1555 return NULL;
1556 _rv = WEIsTyping(_self->ob_itself);
1557 _res = Py_BuildValue("b",
1558 _rv);
1559 return _res;
1560}
1561
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001562static PyObject *wasteObj_WEBeginAction(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00001563{
1564 PyObject *_res = NULL;
1565 OSErr _err;
1566 if (!PyArg_ParseTuple(_args, ""))
1567 return NULL;
1568 _err = WEBeginAction(_self->ob_itself);
1569 if (_err != noErr) return PyMac_Error(_err);
1570 Py_INCREF(Py_None);
1571 _res = Py_None;
1572 return _res;
1573}
1574
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001575static PyObject *wasteObj_WEEndAction(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00001576{
1577 PyObject *_res = NULL;
1578 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001579 WEActionKind inActionKind;
Jack Jansen2369a981998-02-20 15:57:30 +00001580 if (!PyArg_ParseTuple(_args, "h",
Jack Jansenb99e5212002-01-11 12:37:15 +00001581 &inActionKind))
Jack Jansen2369a981998-02-20 15:57:30 +00001582 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001583 _err = WEEndAction(inActionKind,
Jack Jansen2369a981998-02-20 15:57:30 +00001584 _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_WEGetModCount(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001592{
1593 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +00001594 UInt32 _rv;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001595 if (!PyArg_ParseTuple(_args, ""))
1596 return NULL;
1597 _rv = WEGetModCount(_self->ob_itself);
1598 _res = Py_BuildValue("l",
1599 _rv);
1600 return _res;
1601}
1602
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001603static PyObject *wasteObj_WEResetModCount(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001604{
1605 PyObject *_res = NULL;
1606 if (!PyArg_ParseTuple(_args, ""))
1607 return NULL;
1608 WEResetModCount(_self->ob_itself);
1609 Py_INCREF(Py_None);
1610 _res = Py_None;
1611 return _res;
1612}
1613
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001614static PyObject *wasteObj_WEInsertObject(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001615{
1616 PyObject *_res = NULL;
1617 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001618 FlavorType inObjectType;
1619 Handle inObjectDataHandle;
1620 Point inObjectSize;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001621 if (!PyArg_ParseTuple(_args, "O&O&O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001622 PyMac_GetOSType, &inObjectType,
1623 ResObj_Convert, &inObjectDataHandle,
1624 PyMac_GetPoint, &inObjectSize))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001625 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001626 _err = WEInsertObject(inObjectType,
1627 inObjectDataHandle,
1628 inObjectSize,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001629 _self->ob_itself);
1630 if (_err != noErr) return PyMac_Error(_err);
1631 Py_INCREF(Py_None);
1632 _res = Py_None;
1633 return _res;
1634}
1635
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001636static PyObject *wasteObj_WEGetSelectedObject(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001637{
1638 PyObject *_res = NULL;
1639 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001640 WEObjectReference outObject;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001641 if (!PyArg_ParseTuple(_args, ""))
1642 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001643 _err = WEGetSelectedObject(&outObject,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001644 _self->ob_itself);
1645 if (_err != noErr) return PyMac_Error(_err);
1646 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001647 WEOObj_New, outObject);
1648 return _res;
1649}
1650
1651static PyObject *wasteObj_WEGetObjectAtOffset(wasteObject *_self, PyObject *_args)
1652{
1653 PyObject *_res = NULL;
1654 OSErr _err;
1655 SInt32 inOffset;
1656 WEObjectReference outObject;
1657 if (!PyArg_ParseTuple(_args, "l",
1658 &inOffset))
1659 return NULL;
1660 _err = WEGetObjectAtOffset(inOffset,
1661 &outObject,
1662 _self->ob_itself);
1663 if (_err != noErr) return PyMac_Error(_err);
1664 _res = Py_BuildValue("O&",
1665 WEOObj_New, outObject);
Jack Jansen90ecdf41996-04-16 14:29:15 +00001666 return _res;
1667}
1668
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001669static PyObject *wasteObj_WEFindNextObject(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001670{
1671 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +00001672 SInt32 _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00001673 SInt32 inOffset;
1674 WEObjectReference outObject;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001675 if (!PyArg_ParseTuple(_args, "l",
Jack Jansenb99e5212002-01-11 12:37:15 +00001676 &inOffset))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001677 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001678 _rv = WEFindNextObject(inOffset,
1679 &outObject,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001680 _self->ob_itself);
1681 _res = Py_BuildValue("lO&",
1682 _rv,
Jack Jansenb99e5212002-01-11 12:37:15 +00001683 WEOObj_New, outObject);
Jack Jansen90ecdf41996-04-16 14:29:15 +00001684 return _res;
1685}
1686
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001687static PyObject *wasteObj_WEUseSoup(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001688{
1689 PyObject *_res = NULL;
1690 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001691 WESoupHandle inSoup;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001692 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001693 ResObj_Convert, &inSoup))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001694 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001695 _err = WEUseSoup(inSoup,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001696 _self->ob_itself);
1697 if (_err != noErr) return PyMac_Error(_err);
1698 Py_INCREF(Py_None);
1699 _res = Py_None;
1700 return _res;
1701}
1702
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001703static PyObject *wasteObj_WECut(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001704{
1705 PyObject *_res = NULL;
1706 OSErr _err;
1707 if (!PyArg_ParseTuple(_args, ""))
1708 return NULL;
1709 _err = WECut(_self->ob_itself);
1710 if (_err != noErr) return PyMac_Error(_err);
1711 Py_INCREF(Py_None);
1712 _res = Py_None;
1713 return _res;
1714}
1715
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001716static PyObject *wasteObj_WECopy(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001717{
1718 PyObject *_res = NULL;
1719 OSErr _err;
1720 if (!PyArg_ParseTuple(_args, ""))
1721 return NULL;
1722 _err = WECopy(_self->ob_itself);
1723 if (_err != noErr) return PyMac_Error(_err);
1724 Py_INCREF(Py_None);
1725 _res = Py_None;
1726 return _res;
1727}
1728
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001729static PyObject *wasteObj_WEPaste(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001730{
1731 PyObject *_res = NULL;
1732 OSErr _err;
1733 if (!PyArg_ParseTuple(_args, ""))
1734 return NULL;
1735 _err = WEPaste(_self->ob_itself);
1736 if (_err != noErr) return PyMac_Error(_err);
1737 Py_INCREF(Py_None);
1738 _res = Py_None;
1739 return _res;
1740}
1741
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001742static PyObject *wasteObj_WECanPaste(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001743{
1744 PyObject *_res = NULL;
1745 Boolean _rv;
1746 if (!PyArg_ParseTuple(_args, ""))
1747 return NULL;
1748 _rv = WECanPaste(_self->ob_itself);
1749 _res = Py_BuildValue("b",
1750 _rv);
1751 return _res;
1752}
1753
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001754static PyObject *wasteObj_WEGetHiliteRgn(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001755{
1756 PyObject *_res = NULL;
1757 RgnHandle _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00001758 SInt32 inRangeStart;
1759 SInt32 inRangeEnd;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001760 if (!PyArg_ParseTuple(_args, "ll",
Jack Jansenb99e5212002-01-11 12:37:15 +00001761 &inRangeStart,
1762 &inRangeEnd))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001763 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001764 _rv = WEGetHiliteRgn(inRangeStart,
1765 inRangeEnd,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001766 _self->ob_itself);
1767 _res = Py_BuildValue("O&",
1768 ResObj_New, _rv);
1769 return _res;
1770}
1771
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001772static PyObject *wasteObj_WECharByte(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001773{
1774 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +00001775 SInt16 _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00001776 SInt32 inOffset;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001777 if (!PyArg_ParseTuple(_args, "l",
Jack Jansenb99e5212002-01-11 12:37:15 +00001778 &inOffset))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001779 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001780 _rv = WECharByte(inOffset,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001781 _self->ob_itself);
1782 _res = Py_BuildValue("h",
1783 _rv);
1784 return _res;
1785}
1786
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001787static PyObject *wasteObj_WECharType(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001788{
1789 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +00001790 SInt16 _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00001791 SInt32 inOffset;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001792 if (!PyArg_ParseTuple(_args, "l",
Jack Jansenb99e5212002-01-11 12:37:15 +00001793 &inOffset))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001794 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001795 _rv = WECharType(inOffset,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001796 _self->ob_itself);
1797 _res = Py_BuildValue("h",
1798 _rv);
1799 return _res;
1800}
1801
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001802static PyObject *wasteObj_WEStopInlineSession(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001803{
1804 PyObject *_res = NULL;
1805 if (!PyArg_ParseTuple(_args, ""))
1806 return NULL;
1807 WEStopInlineSession(_self->ob_itself);
1808 Py_INCREF(Py_None);
1809 _res = Py_None;
1810 return _res;
1811}
1812
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001813static PyObject *wasteObj_WEFeatureFlag(wasteObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00001814{
1815 PyObject *_res = NULL;
Jack Jansen2268af51996-08-06 16:04:22 +00001816 SInt16 _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00001817 SInt16 inFeature;
1818 SInt16 inAction;
Jack Jansen90ecdf41996-04-16 14:29:15 +00001819 if (!PyArg_ParseTuple(_args, "hh",
Jack Jansenb99e5212002-01-11 12:37:15 +00001820 &inFeature,
1821 &inAction))
Jack Jansen90ecdf41996-04-16 14:29:15 +00001822 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001823 _rv = WEFeatureFlag(inFeature,
1824 inAction,
Jack Jansen90ecdf41996-04-16 14:29:15 +00001825 _self->ob_itself);
1826 _res = Py_BuildValue("h",
1827 _rv);
1828 return _res;
1829}
1830
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001831static PyObject *wasteObj_WEGetUserInfo(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00001832{
1833 PyObject *_res = NULL;
1834 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001835 WESelector inUserTag;
1836 SInt32 outUserInfo;
Jack Jansen2369a981998-02-20 15:57:30 +00001837 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00001838 PyMac_GetOSType, &inUserTag))
Jack Jansen2369a981998-02-20 15:57:30 +00001839 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001840 _err = WEGetUserInfo(inUserTag,
1841 &outUserInfo,
Jack Jansen2369a981998-02-20 15:57:30 +00001842 _self->ob_itself);
1843 if (_err != noErr) return PyMac_Error(_err);
1844 _res = Py_BuildValue("l",
Jack Jansenb99e5212002-01-11 12:37:15 +00001845 outUserInfo);
Jack Jansen2369a981998-02-20 15:57:30 +00001846 return _res;
1847}
1848
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001849static PyObject *wasteObj_WESetUserInfo(wasteObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00001850{
1851 PyObject *_res = NULL;
1852 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00001853 WESelector inUserTag;
1854 SInt32 inUserInfo;
Jack Jansen2369a981998-02-20 15:57:30 +00001855 if (!PyArg_ParseTuple(_args, "O&l",
Jack Jansenb99e5212002-01-11 12:37:15 +00001856 PyMac_GetOSType, &inUserTag,
1857 &inUserInfo))
Jack Jansen2369a981998-02-20 15:57:30 +00001858 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00001859 _err = WESetUserInfo(inUserTag,
1860 inUserInfo,
Jack Jansen2369a981998-02-20 15:57:30 +00001861 _self->ob_itself);
1862 if (_err != noErr) return PyMac_Error(_err);
1863 Py_INCREF(Py_None);
1864 _res = Py_None;
1865 return _res;
1866}
1867
Jack Jansenb99e5212002-01-11 12:37:15 +00001868static PyObject *wasteObj_WERemoveUserInfo(wasteObject *_self, PyObject *_args)
1869{
1870 PyObject *_res = NULL;
1871 OSErr _err;
1872 WESelector inUserTag;
1873 if (!PyArg_ParseTuple(_args, "O&",
1874 PyMac_GetOSType, &inUserTag))
1875 return NULL;
1876 _err = WERemoveUserInfo(inUserTag,
1877 _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 Jansenfa77e1a2001-05-22 21:56:42 +00001884static PyObject *wasteObj_WEInstallTabHooks(wasteObject *_self, PyObject *_args)
Jack Jansen176f3a91996-10-23 15:43:46 +00001885{
1886 PyObject *_res = NULL;
1887 OSErr _err;
1888 if (!PyArg_ParseTuple(_args, ""))
1889 return NULL;
1890 _err = WEInstallTabHooks(_self->ob_itself);
1891 if (_err != noErr) return PyMac_Error(_err);
1892 Py_INCREF(Py_None);
1893 _res = Py_None;
1894 return _res;
1895}
1896
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001897static PyObject *wasteObj_WERemoveTabHooks(wasteObject *_self, PyObject *_args)
Jack Jansen176f3a91996-10-23 15:43:46 +00001898{
1899 PyObject *_res = NULL;
1900 OSErr _err;
1901 if (!PyArg_ParseTuple(_args, ""))
1902 return NULL;
1903 _err = WERemoveTabHooks(_self->ob_itself);
1904 if (_err != noErr) return PyMac_Error(_err);
1905 Py_INCREF(Py_None);
1906 _res = Py_None;
1907 return _res;
1908}
1909
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001910static PyObject *wasteObj_WEIsTabHooks(wasteObject *_self, PyObject *_args)
Jack Jansen176f3a91996-10-23 15:43:46 +00001911{
1912 PyObject *_res = NULL;
1913 Boolean _rv;
1914 if (!PyArg_ParseTuple(_args, ""))
1915 return NULL;
1916 _rv = WEIsTabHooks(_self->ob_itself);
1917 _res = Py_BuildValue("b",
1918 _rv);
1919 return _res;
1920}
1921
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001922static PyObject *wasteObj_WEGetTabSize(wasteObject *_self, PyObject *_args)
Jack Jansena4f03091998-03-02 16:56:18 +00001923{
1924 PyObject *_res = NULL;
1925 SInt16 _rv;
1926 if (!PyArg_ParseTuple(_args, ""))
1927 return NULL;
1928 _rv = WEGetTabSize(_self->ob_itself);
1929 _res = Py_BuildValue("h",
1930 _rv);
1931 return _res;
1932}
1933
Jack Jansenfa77e1a2001-05-22 21:56:42 +00001934static PyObject *wasteObj_WESetTabSize(wasteObject *_self, PyObject *_args)
Jack Jansena4f03091998-03-02 16:56:18 +00001935{
1936 PyObject *_res = NULL;
1937 OSErr _err;
1938 SInt16 tabWidth;
1939 if (!PyArg_ParseTuple(_args, "h",
1940 &tabWidth))
1941 return NULL;
1942 _err = WESetTabSize(tabWidth,
1943 _self->ob_itself);
1944 if (_err != noErr) return PyMac_Error(_err);
1945 Py_INCREF(Py_None);
1946 _res = Py_None;
1947 return _res;
1948}
1949
Jack Jansen90ecdf41996-04-16 14:29:15 +00001950static PyMethodDef wasteObj_methods[] = {
1951 {"WEGetText", (PyCFunction)wasteObj_WEGetText, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001952 PyDoc_STR("() -> (Handle _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001953 {"WEGetChar", (PyCFunction)wasteObj_WEGetChar, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001954 PyDoc_STR("(SInt32 inOffset) -> (SInt16 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001955 {"WEGetTextLength", (PyCFunction)wasteObj_WEGetTextLength, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001956 PyDoc_STR("() -> (SInt32 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001957 {"WEGetSelection", (PyCFunction)wasteObj_WEGetSelection, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001958 PyDoc_STR("() -> (SInt32 outSelStart, SInt32 outSelEnd)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001959 {"WEGetDestRect", (PyCFunction)wasteObj_WEGetDestRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001960 PyDoc_STR("() -> (LongRect outDestRect)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001961 {"WEGetViewRect", (PyCFunction)wasteObj_WEGetViewRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001962 PyDoc_STR("() -> (LongRect outViewRect)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001963 {"WEIsActive", (PyCFunction)wasteObj_WEIsActive, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001964 PyDoc_STR("() -> (Boolean _rv)")},
Jack Jansen2268af51996-08-06 16:04:22 +00001965 {"WEGetClickCount", (PyCFunction)wasteObj_WEGetClickCount, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001966 PyDoc_STR("() -> (UInt16 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001967 {"WESetSelection", (PyCFunction)wasteObj_WESetSelection, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001968 PyDoc_STR("(SInt32 inSelStart, SInt32 inSelEnd) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001969 {"WESetDestRect", (PyCFunction)wasteObj_WESetDestRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001970 PyDoc_STR("(LongRect inDestRect) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001971 {"WESetViewRect", (PyCFunction)wasteObj_WESetViewRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001972 PyDoc_STR("(LongRect inViewRect) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001973 {"WEContinuousStyle", (PyCFunction)wasteObj_WEContinuousStyle, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001974 PyDoc_STR("(WEStyleMode ioMode) -> (Boolean _rv, WEStyleMode ioMode, TextStyle outTextStyle)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001975 {"WECountRuns", (PyCFunction)wasteObj_WECountRuns, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001976 PyDoc_STR("() -> (SInt32 _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001977 {"WEOffsetToRun", (PyCFunction)wasteObj_WEOffsetToRun, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001978 PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001979 {"WEGetRunRange", (PyCFunction)wasteObj_WEGetRunRange, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001980 PyDoc_STR("(SInt32 inStyleRunIndex) -> (SInt32 outStyleRunStart, SInt32 outStyleRunEnd)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00001981 {"WEGetRunInfo", (PyCFunction)wasteObj_WEGetRunInfo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001982 PyDoc_STR("(SInt32 inOffset) -> (WERunInfo outStyleRunInfo)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001983 {"WEGetIndRunInfo", (PyCFunction)wasteObj_WEGetIndRunInfo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001984 PyDoc_STR("(SInt32 inStyleRunIndex) -> (WERunInfo outStyleRunInfo)")},
Jack Jansen2369a981998-02-20 15:57:30 +00001985 {"WEGetRunDirection", (PyCFunction)wasteObj_WEGetRunDirection, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001986 PyDoc_STR("(SInt32 inOffset) -> (Boolean _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001987 {"WECountParaRuns", (PyCFunction)wasteObj_WECountParaRuns, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001988 PyDoc_STR("() -> (SInt32 _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001989 {"WEOffsetToParaRun", (PyCFunction)wasteObj_WEOffsetToParaRun, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001990 PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001991 {"WEGetParaRunRange", (PyCFunction)wasteObj_WEGetParaRunRange, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001992 PyDoc_STR("(SInt32 inParagraphRunIndex) -> (SInt32 outParagraphRunStart, SInt32 outParagraphRunEnd)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001993 {"WECountLines", (PyCFunction)wasteObj_WECountLines, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001994 PyDoc_STR("() -> (SInt32 _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001995 {"WEOffsetToLine", (PyCFunction)wasteObj_WEOffsetToLine, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001996 PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001997 {"WEGetLineRange", (PyCFunction)wasteObj_WEGetLineRange, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00001998 PyDoc_STR("(SInt32 inLineIndex) -> (SInt32 outLineStart, SInt32 outLineEnd)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00001999 {"WEGetHeight", (PyCFunction)wasteObj_WEGetHeight, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002000 PyDoc_STR("(SInt32 inStartLineIndex, SInt32 inEndLineIndex) -> (SInt32 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002001 {"WEGetOffset", (PyCFunction)wasteObj_WEGetOffset, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002002 PyDoc_STR("(LongPt inPoint) -> (SInt32 _rv, WEEdge outEdge)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002003 {"WEGetPoint", (PyCFunction)wasteObj_WEGetPoint, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002004 PyDoc_STR("(SInt32 inOffset, SInt16 inDirection) -> (LongPt outPoint, SInt16 outLineHeight)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002005 {"WEFindWord", (PyCFunction)wasteObj_WEFindWord, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002006 PyDoc_STR("(SInt32 inOffset, WEEdge inEdge) -> (SInt32 outWordStart, SInt32 outWordEnd)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002007 {"WEFindLine", (PyCFunction)wasteObj_WEFindLine, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002008 PyDoc_STR("(SInt32 inOffset, WEEdge inEdge) -> (SInt32 outLineStart, SInt32 outLineEnd)")},
Jack Jansen2369a981998-02-20 15:57:30 +00002009 {"WEFindParagraph", (PyCFunction)wasteObj_WEFindParagraph, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002010 PyDoc_STR("(SInt32 inOffset, WEEdge inEdge) -> (SInt32 outParagraphStart, SInt32 outParagraphEnd)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002011 {"WEFind", (PyCFunction)wasteObj_WEFind, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002012 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 +00002013 {"WEStreamRange", (PyCFunction)wasteObj_WEStreamRange, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002014 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd, FlavorType inRequestedType, OptionBits inStreamOptions, Handle outData) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002015 {"WECopyRange", (PyCFunction)wasteObj_WECopyRange, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002016 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd, Handle outText, StScrpHandle outStyles, WESoupHandle outSoup) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002017 {"WEGetTextRangeAsUnicode", (PyCFunction)wasteObj_WEGetTextRangeAsUnicode, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002018 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 +00002019 {"WEGetAlignment", (PyCFunction)wasteObj_WEGetAlignment, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002020 PyDoc_STR("() -> (WEAlignment _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002021 {"WESetAlignment", (PyCFunction)wasteObj_WESetAlignment, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002022 PyDoc_STR("(WEAlignment inAlignment) -> None")},
Jack Jansen2369a981998-02-20 15:57:30 +00002023 {"WEGetDirection", (PyCFunction)wasteObj_WEGetDirection, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002024 PyDoc_STR("() -> (WEDirection _rv)")},
Jack Jansen2369a981998-02-20 15:57:30 +00002025 {"WESetDirection", (PyCFunction)wasteObj_WESetDirection, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002026 PyDoc_STR("(WEDirection inDirection) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002027 {"WECalText", (PyCFunction)wasteObj_WECalText, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002028 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002029 {"WEUpdate", (PyCFunction)wasteObj_WEUpdate, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002030 PyDoc_STR("(RgnHandle inUpdateRgn) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002031 {"WEScroll", (PyCFunction)wasteObj_WEScroll, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002032 PyDoc_STR("(SInt32 inHorizontalOffset, SInt32 inVerticalOffset) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002033 {"WEPinScroll", (PyCFunction)wasteObj_WEPinScroll, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002034 PyDoc_STR("(SInt32 inHorizontalOffset, SInt32 inVerticalOffset) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002035 {"WESelView", (PyCFunction)wasteObj_WESelView, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002036 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002037 {"WEActivate", (PyCFunction)wasteObj_WEActivate, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002038 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002039 {"WEDeactivate", (PyCFunction)wasteObj_WEDeactivate, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002040 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002041 {"WEKey", (PyCFunction)wasteObj_WEKey, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002042 PyDoc_STR("(CharParameter inKey, EventModifiers inModifiers) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002043 {"WEClick", (PyCFunction)wasteObj_WEClick, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002044 PyDoc_STR("(Point inHitPoint, EventModifiers inModifiers, UInt32 inClickTime) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002045 {"WEAdjustCursor", (PyCFunction)wasteObj_WEAdjustCursor, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002046 PyDoc_STR("(Point inMouseLoc, RgnHandle ioMouseRgn) -> (Boolean _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002047 {"WEIdle", (PyCFunction)wasteObj_WEIdle, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002048 PyDoc_STR("() -> (UInt32 outMaxSleep)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002049 {"WEInsert", (PyCFunction)wasteObj_WEInsert, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002050 PyDoc_STR("(Buffer inTextPtr, StScrpHandle inStyles, WESoupHandle inSoup) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002051 {"WEInsertFormattedText", (PyCFunction)wasteObj_WEInsertFormattedText, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002052 PyDoc_STR("(Buffer inTextPtr, StScrpHandle inStyles, WESoupHandle inSoup, Handle inParaFormat, Handle inRulerScrap) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002053 {"WEDelete", (PyCFunction)wasteObj_WEDelete, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002054 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002055 {"WEUseText", (PyCFunction)wasteObj_WEUseText, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002056 PyDoc_STR("(Handle inText) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002057 {"WEChangeCase", (PyCFunction)wasteObj_WEChangeCase, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002058 PyDoc_STR("(SInt16 inCase) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002059 {"WESetOneAttribute", (PyCFunction)wasteObj_WESetOneAttribute, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002060 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd, WESelector inAttributeSelector, Buffer inAttributeValue) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002061 {"WESetStyle", (PyCFunction)wasteObj_WESetStyle, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002062 PyDoc_STR("(WEStyleMode inMode, TextStyle inTextStyle) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002063 {"WEUseStyleScrap", (PyCFunction)wasteObj_WEUseStyleScrap, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002064 PyDoc_STR("(StScrpHandle inStyles) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002065 {"WEUndo", (PyCFunction)wasteObj_WEUndo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002066 PyDoc_STR("() -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002067 {"WERedo", (PyCFunction)wasteObj_WERedo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002068 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002069 {"WEClearUndo", (PyCFunction)wasteObj_WEClearUndo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002070 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002071 {"WEGetUndoInfo", (PyCFunction)wasteObj_WEGetUndoInfo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002072 PyDoc_STR("() -> (WEActionKind _rv, Boolean outRedoFlag)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002073 {"WEGetIndUndoInfo", (PyCFunction)wasteObj_WEGetIndUndoInfo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002074 PyDoc_STR("(SInt32 inUndoLevel) -> (WEActionKind _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002075 {"WEIsTyping", (PyCFunction)wasteObj_WEIsTyping, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002076 PyDoc_STR("() -> (Boolean _rv)")},
Jack Jansen2369a981998-02-20 15:57:30 +00002077 {"WEBeginAction", (PyCFunction)wasteObj_WEBeginAction, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002078 PyDoc_STR("() -> None")},
Jack Jansen2369a981998-02-20 15:57:30 +00002079 {"WEEndAction", (PyCFunction)wasteObj_WEEndAction, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002080 PyDoc_STR("(WEActionKind inActionKind) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002081 {"WEGetModCount", (PyCFunction)wasteObj_WEGetModCount, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002082 PyDoc_STR("() -> (UInt32 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002083 {"WEResetModCount", (PyCFunction)wasteObj_WEResetModCount, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002084 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002085 {"WEInsertObject", (PyCFunction)wasteObj_WEInsertObject, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002086 PyDoc_STR("(FlavorType inObjectType, Handle inObjectDataHandle, Point inObjectSize) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002087 {"WEGetSelectedObject", (PyCFunction)wasteObj_WEGetSelectedObject, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002088 PyDoc_STR("() -> (WEObjectReference outObject)")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002089 {"WEGetObjectAtOffset", (PyCFunction)wasteObj_WEGetObjectAtOffset, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002090 PyDoc_STR("(SInt32 inOffset) -> (WEObjectReference outObject)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002091 {"WEFindNextObject", (PyCFunction)wasteObj_WEFindNextObject, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002092 PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv, WEObjectReference outObject)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002093 {"WEUseSoup", (PyCFunction)wasteObj_WEUseSoup, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002094 PyDoc_STR("(WESoupHandle inSoup) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002095 {"WECut", (PyCFunction)wasteObj_WECut, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002096 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002097 {"WECopy", (PyCFunction)wasteObj_WECopy, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002098 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002099 {"WEPaste", (PyCFunction)wasteObj_WEPaste, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002100 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002101 {"WECanPaste", (PyCFunction)wasteObj_WECanPaste, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002102 PyDoc_STR("() -> (Boolean _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002103 {"WEGetHiliteRgn", (PyCFunction)wasteObj_WEGetHiliteRgn, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002104 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd) -> (RgnHandle _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002105 {"WECharByte", (PyCFunction)wasteObj_WECharByte, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002106 PyDoc_STR("(SInt32 inOffset) -> (SInt16 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002107 {"WECharType", (PyCFunction)wasteObj_WECharType, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002108 PyDoc_STR("(SInt32 inOffset) -> (SInt16 _rv)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002109 {"WEStopInlineSession", (PyCFunction)wasteObj_WEStopInlineSession, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002110 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002111 {"WEFeatureFlag", (PyCFunction)wasteObj_WEFeatureFlag, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002112 PyDoc_STR("(SInt16 inFeature, SInt16 inAction) -> (SInt16 _rv)")},
Jack Jansen2369a981998-02-20 15:57:30 +00002113 {"WEGetUserInfo", (PyCFunction)wasteObj_WEGetUserInfo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002114 PyDoc_STR("(WESelector inUserTag) -> (SInt32 outUserInfo)")},
Jack Jansen2369a981998-02-20 15:57:30 +00002115 {"WESetUserInfo", (PyCFunction)wasteObj_WESetUserInfo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002116 PyDoc_STR("(WESelector inUserTag, SInt32 inUserInfo) -> None")},
Jack Jansenb99e5212002-01-11 12:37:15 +00002117 {"WERemoveUserInfo", (PyCFunction)wasteObj_WERemoveUserInfo, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002118 PyDoc_STR("(WESelector inUserTag) -> None")},
Jack Jansen176f3a91996-10-23 15:43:46 +00002119 {"WEInstallTabHooks", (PyCFunction)wasteObj_WEInstallTabHooks, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002120 PyDoc_STR("() -> None")},
Jack Jansen176f3a91996-10-23 15:43:46 +00002121 {"WERemoveTabHooks", (PyCFunction)wasteObj_WERemoveTabHooks, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002122 PyDoc_STR("() -> None")},
Jack Jansen176f3a91996-10-23 15:43:46 +00002123 {"WEIsTabHooks", (PyCFunction)wasteObj_WEIsTabHooks, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002124 PyDoc_STR("() -> (Boolean _rv)")},
Jack Jansena4f03091998-03-02 16:56:18 +00002125 {"WEGetTabSize", (PyCFunction)wasteObj_WEGetTabSize, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002126 PyDoc_STR("() -> (SInt16 _rv)")},
Jack Jansena4f03091998-03-02 16:56:18 +00002127 {"WESetTabSize", (PyCFunction)wasteObj_WESetTabSize, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002128 PyDoc_STR("(SInt16 tabWidth) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002129 {NULL, NULL, 0}
2130};
2131
Jack Jansendbd57012002-11-29 23:40:48 +00002132#define wasteObj_getsetlist NULL
Jack Jansen90ecdf41996-04-16 14:29:15 +00002133
Jack Jansen96cebde2002-12-03 23:40:22 +00002134
Jack Jansen9d8b96c2000-07-14 22:16:45 +00002135#define wasteObj_compare NULL
2136
2137#define wasteObj_repr NULL
2138
2139#define wasteObj_hash NULL
Jack Jansen96cebde2002-12-03 23:40:22 +00002140#define wasteObj_tp_init 0
2141
2142#define wasteObj_tp_alloc PyType_GenericAlloc
2143
2144static PyObject *wasteObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
2145{
2146 PyObject *self;
2147 WEReference itself;
2148 char *kw[] = {"itself", 0};
2149
2150 if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, wasteObj_Convert, &itself)) return NULL;
2151 if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
2152 ((wasteObject *)self)->ob_itself = itself;
2153 return self;
2154}
2155
2156#define wasteObj_tp_free PyObject_Del
2157
Jack Jansen9d8b96c2000-07-14 22:16:45 +00002158
Jack Jansen90ecdf41996-04-16 14:29:15 +00002159PyTypeObject waste_Type = {
Jack Jansenb3be2162001-11-30 14:16:36 +00002160 PyObject_HEAD_INIT(NULL)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002161 0, /*ob_size*/
Guido van Rossum14648392001-12-08 18:02:58 +00002162 "waste.waste", /*tp_name*/
Jack Jansen90ecdf41996-04-16 14:29:15 +00002163 sizeof(wasteObject), /*tp_basicsize*/
2164 0, /*tp_itemsize*/
2165 /* methods */
2166 (destructor) wasteObj_dealloc, /*tp_dealloc*/
2167 0, /*tp_print*/
Jack Jansendbd57012002-11-29 23:40:48 +00002168 (getattrfunc)0, /*tp_getattr*/
2169 (setattrfunc)0, /*tp_setattr*/
Jack Jansen9d8b96c2000-07-14 22:16:45 +00002170 (cmpfunc) wasteObj_compare, /*tp_compare*/
2171 (reprfunc) wasteObj_repr, /*tp_repr*/
2172 (PyNumberMethods *)0, /* tp_as_number */
2173 (PySequenceMethods *)0, /* tp_as_sequence */
2174 (PyMappingMethods *)0, /* tp_as_mapping */
2175 (hashfunc) wasteObj_hash, /*tp_hash*/
Jack Jansendbd57012002-11-29 23:40:48 +00002176 0, /*tp_call*/
2177 0, /*tp_str*/
2178 PyObject_GenericGetAttr, /*tp_getattro*/
2179 PyObject_GenericSetAttr, /*tp_setattro */
Jack Jansen96cebde2002-12-03 23:40:22 +00002180 0, /*tp_as_buffer*/
2181 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
2182 0, /*tp_doc*/
2183 0, /*tp_traverse*/
2184 0, /*tp_clear*/
2185 0, /*tp_richcompare*/
2186 0, /*tp_weaklistoffset*/
2187 0, /*tp_iter*/
2188 0, /*tp_iternext*/
Jack Jansendbd57012002-11-29 23:40:48 +00002189 wasteObj_methods, /* tp_methods */
Jack Jansen96cebde2002-12-03 23:40:22 +00002190 0, /*tp_members*/
Jack Jansendbd57012002-11-29 23:40:48 +00002191 wasteObj_getsetlist, /*tp_getset*/
Jack Jansen96cebde2002-12-03 23:40:22 +00002192 0, /*tp_base*/
2193 0, /*tp_dict*/
2194 0, /*tp_descr_get*/
2195 0, /*tp_descr_set*/
2196 0, /*tp_dictoffset*/
2197 wasteObj_tp_init, /* tp_init */
2198 wasteObj_tp_alloc, /* tp_alloc */
2199 wasteObj_tp_new, /* tp_new */
2200 wasteObj_tp_free, /* tp_free */
Jack Jansen90ecdf41996-04-16 14:29:15 +00002201};
2202
2203/* --------------------- End object type waste ---------------------- */
2204
2205
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002206static PyObject *waste_WENew(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002207{
2208 PyObject *_res = NULL;
2209 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00002210 LongRect inDestRect;
2211 LongRect inViewRect;
2212 OptionBits inOptions;
2213 WEReference outWE;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002214 if (!PyArg_ParseTuple(_args, "O&O&l",
Jack Jansenb99e5212002-01-11 12:37:15 +00002215 LongRect_Convert, &inDestRect,
2216 LongRect_Convert, &inViewRect,
2217 &inOptions))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002218 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002219 _err = WENew(&inDestRect,
2220 &inViewRect,
2221 inOptions,
2222 &outWE);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002223 if (_err != noErr) return PyMac_Error(_err);
2224 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002225 wasteObj_New, outWE);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002226 return _res;
2227}
2228
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002229static PyObject *waste_WEUpdateStyleScrap(PyObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00002230{
2231 PyObject *_res = NULL;
2232 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00002233 StScrpHandle ioStyles;
2234 WEFontTableHandle inFontTable;
Jack Jansen2369a981998-02-20 15:57:30 +00002235 if (!PyArg_ParseTuple(_args, "O&O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002236 ResObj_Convert, &ioStyles,
2237 ResObj_Convert, &inFontTable))
Jack Jansen2369a981998-02-20 15:57:30 +00002238 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002239 _err = WEUpdateStyleScrap(ioStyles,
2240 inFontTable);
Jack Jansen2369a981998-02-20 15:57:30 +00002241 if (_err != noErr) return PyMac_Error(_err);
2242 Py_INCREF(Py_None);
2243 _res = Py_None;
2244 return _res;
2245}
2246
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002247static PyObject *waste_WEInstallTSMHandlers(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002248{
2249 PyObject *_res = NULL;
2250 OSErr _err;
2251 if (!PyArg_ParseTuple(_args, ""))
2252 return NULL;
2253 _err = WEInstallTSMHandlers();
2254 if (_err != noErr) return PyMac_Error(_err);
2255 Py_INCREF(Py_None);
2256 _res = Py_None;
2257 return _res;
2258}
2259
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002260static PyObject *waste_WERemoveTSMHandlers(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002261{
2262 PyObject *_res = NULL;
2263 OSErr _err;
2264 if (!PyArg_ParseTuple(_args, ""))
2265 return NULL;
2266 _err = WERemoveTSMHandlers();
2267 if (_err != noErr) return PyMac_Error(_err);
2268 Py_INCREF(Py_None);
2269 _res = Py_None;
2270 return _res;
2271}
2272
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002273static PyObject *waste_WEHandleTSMEvent(PyObject *_self, PyObject *_args)
Jack Jansen2369a981998-02-20 15:57:30 +00002274{
2275 PyObject *_res = NULL;
2276 OSErr _err;
Jack Jansenb99e5212002-01-11 12:37:15 +00002277 AppleEvent inAppleEvent;
2278 AppleEvent ioReply;
Jack Jansen2369a981998-02-20 15:57:30 +00002279 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002280 AEDesc_Convert, &inAppleEvent))
Jack Jansen2369a981998-02-20 15:57:30 +00002281 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002282 _err = WEHandleTSMEvent(&inAppleEvent,
2283 &ioReply);
Jack Jansen2369a981998-02-20 15:57:30 +00002284 if (_err != noErr) return PyMac_Error(_err);
2285 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002286 AEDesc_New, &ioReply);
Jack Jansen2369a981998-02-20 15:57:30 +00002287 return _res;
2288}
2289
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002290static PyObject *waste_WELongPointToPoint(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002291{
2292 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002293 LongPt inLongPoint;
2294 Point outPoint;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002295 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002296 LongPt_Convert, &inLongPoint))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002297 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002298 WELongPointToPoint(&inLongPoint,
2299 &outPoint);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002300 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002301 PyMac_BuildPoint, outPoint);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002302 return _res;
2303}
2304
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002305static PyObject *waste_WEPointToLongPoint(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002306{
2307 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002308 Point inPoint;
2309 LongPt outLongPoint;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002310 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002311 PyMac_GetPoint, &inPoint))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002312 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002313 WEPointToLongPoint(inPoint,
2314 &outLongPoint);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002315 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002316 LongPt_New, &outLongPoint);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002317 return _res;
2318}
2319
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002320static PyObject *waste_WESetLongRect(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002321{
2322 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002323 LongRect outLongRect;
2324 SInt32 inLeft;
2325 SInt32 inTop;
2326 SInt32 inRight;
2327 SInt32 inBottom;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002328 if (!PyArg_ParseTuple(_args, "llll",
Jack Jansenb99e5212002-01-11 12:37:15 +00002329 &inLeft,
2330 &inTop,
2331 &inRight,
2332 &inBottom))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002333 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002334 WESetLongRect(&outLongRect,
2335 inLeft,
2336 inTop,
2337 inRight,
2338 inBottom);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002339 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002340 LongRect_New, &outLongRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002341 return _res;
2342}
2343
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002344static PyObject *waste_WELongRectToRect(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002345{
2346 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002347 LongRect inLongRect;
2348 Rect outRect;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002349 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002350 LongRect_Convert, &inLongRect))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002351 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002352 WELongRectToRect(&inLongRect,
2353 &outRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002354 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002355 PyMac_BuildRect, &outRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002356 return _res;
2357}
2358
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002359static PyObject *waste_WERectToLongRect(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002360{
2361 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002362 Rect inRect;
2363 LongRect outLongRect;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002364 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002365 PyMac_GetRect, &inRect))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002366 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002367 WERectToLongRect(&inRect,
2368 &outLongRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002369 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002370 LongRect_New, &outLongRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002371 return _res;
2372}
2373
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002374static PyObject *waste_WEOffsetLongRect(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002375{
2376 PyObject *_res = NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002377 LongRect ioLongRect;
2378 SInt32 inHorizontalOffset;
2379 SInt32 inVerticalOffset;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002380 if (!PyArg_ParseTuple(_args, "ll",
Jack Jansenb99e5212002-01-11 12:37:15 +00002381 &inHorizontalOffset,
2382 &inVerticalOffset))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002383 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002384 WEOffsetLongRect(&ioLongRect,
2385 inHorizontalOffset,
2386 inVerticalOffset);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002387 _res = Py_BuildValue("O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002388 LongRect_New, &ioLongRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002389 return _res;
2390}
2391
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002392static PyObject *waste_WELongPointInLongRect(PyObject *_self, PyObject *_args)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002393{
2394 PyObject *_res = NULL;
2395 Boolean _rv;
Jack Jansenb99e5212002-01-11 12:37:15 +00002396 LongPt inLongPoint;
2397 LongRect inLongRect;
Jack Jansen90ecdf41996-04-16 14:29:15 +00002398 if (!PyArg_ParseTuple(_args, "O&O&",
Jack Jansenb99e5212002-01-11 12:37:15 +00002399 LongPt_Convert, &inLongPoint,
2400 LongRect_Convert, &inLongRect))
Jack Jansen90ecdf41996-04-16 14:29:15 +00002401 return NULL;
Jack Jansenb99e5212002-01-11 12:37:15 +00002402 _rv = WELongPointInLongRect(&inLongPoint,
2403 &inLongRect);
Jack Jansen90ecdf41996-04-16 14:29:15 +00002404 _res = Py_BuildValue("b",
2405 _rv);
2406 return _res;
2407}
2408
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002409static PyObject *waste_STDObjectHandlers(PyObject *_self, PyObject *_args)
Jack Jansen756522f1996-05-07 15:24:01 +00002410{
2411 PyObject *_res = NULL;
2412
2413 OSErr err;
2414 // install the sample object handlers for pictures and sounds
2415#define kTypePicture 'PICT'
2416#define kTypeSound 'snd '
2417
2418 if ( !PyArg_ParseTuple(_args, "") ) return NULL;
2419
2420 if ((err = WEInstallObjectHandler(kTypePicture, weNewHandler,
2421 (UniversalProcPtr) NewWENewObjectProc(HandleNewPicture), NULL)) != noErr)
2422 goto cleanup;
2423
2424 if ((err = WEInstallObjectHandler(kTypePicture, weDisposeHandler,
2425 (UniversalProcPtr) NewWEDisposeObjectProc(HandleDisposePicture), NULL)) != noErr)
2426 goto cleanup;
2427
2428 if ((err = WEInstallObjectHandler(kTypePicture, weDrawHandler,
2429 (UniversalProcPtr) NewWEDrawObjectProc(HandleDrawPicture), NULL)) != noErr)
2430 goto cleanup;
2431
2432 if ((err = WEInstallObjectHandler(kTypeSound, weNewHandler,
2433 (UniversalProcPtr) NewWENewObjectProc(HandleNewSound), NULL)) != noErr)
2434 goto cleanup;
2435
2436 if ((err = WEInstallObjectHandler(kTypeSound, weDrawHandler,
2437 (UniversalProcPtr) NewWEDrawObjectProc(HandleDrawSound), NULL)) != noErr)
2438 goto cleanup;
2439
2440 if ((err = WEInstallObjectHandler(kTypeSound, weClickHandler,
2441 (UniversalProcPtr) NewWEClickObjectProc(HandleClickSound), NULL)) != noErr)
2442 goto cleanup;
2443 Py_INCREF(Py_None);
2444 return Py_None;
2445
2446 cleanup:
2447 return PyMac_Error(err);
2448
2449}
2450
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002451static PyObject *waste_WEInstallObjectHandler(PyObject *_self, PyObject *_args)
Jack Jansen756522f1996-05-07 15:24:01 +00002452{
2453 PyObject *_res = NULL;
2454
2455 OSErr err;
2456 FlavorType objectType;
2457 WESelector selector;
2458 PyObject *py_handler;
2459 UniversalProcPtr handler;
2460 WEReference we = NULL;
2461 PyObject *key;
2462
2463
2464 if ( !PyArg_ParseTuple(_args, "O&O&O|O&",
2465 PyMac_GetOSType, &objectType,
2466 PyMac_GetOSType, &selector,
2467 &py_handler,
Jack Jansen7df36061996-10-01 11:41:14 +00002468 WEOObj_Convert, &we) ) return NULL;
Jack Jansen756522f1996-05-07 15:24:01 +00002469
Jack Jansen25241d91996-05-20 11:30:45 +00002470 if ( selector == weNewHandler ) handler = (UniversalProcPtr)upp_new_handler;
2471 else if ( selector == weDisposeHandler ) handler = (UniversalProcPtr)upp_dispose_handler;
2472 else if ( selector == weDrawHandler ) handler = (UniversalProcPtr)upp_draw_handler;
2473 else if ( selector == weClickHandler ) handler = (UniversalProcPtr)upp_click_handler;
Jack Jansen756522f1996-05-07 15:24:01 +00002474 else return PyMac_Error(weUndefinedSelectorErr);
2475
2476 if ((key = Py_BuildValue("O&O&",
2477 PyMac_BuildOSType, objectType,
2478 PyMac_BuildOSType, selector)) == NULL )
2479 return NULL;
2480
2481 PyDict_SetItem(callbackdict, key, py_handler);
2482
2483 err = WEInstallObjectHandler(objectType, selector, handler, we);
2484 if ( err ) return PyMac_Error(err);
2485 Py_INCREF(Py_None);
2486 return Py_None;
2487
2488}
2489
Jack Jansen90ecdf41996-04-16 14:29:15 +00002490static PyMethodDef waste_methods[] = {
2491 {"WENew", (PyCFunction)waste_WENew, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002492 PyDoc_STR("(LongRect inDestRect, LongRect inViewRect, OptionBits inOptions) -> (WEReference outWE)")},
Jack Jansen2369a981998-02-20 15:57:30 +00002493 {"WEUpdateStyleScrap", (PyCFunction)waste_WEUpdateStyleScrap, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002494 PyDoc_STR("(StScrpHandle ioStyles, WEFontTableHandle inFontTable) -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002495 {"WEInstallTSMHandlers", (PyCFunction)waste_WEInstallTSMHandlers, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002496 PyDoc_STR("() -> None")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002497 {"WERemoveTSMHandlers", (PyCFunction)waste_WERemoveTSMHandlers, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002498 PyDoc_STR("() -> None")},
Jack Jansen2369a981998-02-20 15:57:30 +00002499 {"WEHandleTSMEvent", (PyCFunction)waste_WEHandleTSMEvent, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002500 PyDoc_STR("(AppleEvent inAppleEvent) -> (AppleEvent ioReply)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002501 {"WELongPointToPoint", (PyCFunction)waste_WELongPointToPoint, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002502 PyDoc_STR("(LongPt inLongPoint) -> (Point outPoint)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002503 {"WEPointToLongPoint", (PyCFunction)waste_WEPointToLongPoint, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002504 PyDoc_STR("(Point inPoint) -> (LongPt outLongPoint)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002505 {"WESetLongRect", (PyCFunction)waste_WESetLongRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002506 PyDoc_STR("(SInt32 inLeft, SInt32 inTop, SInt32 inRight, SInt32 inBottom) -> (LongRect outLongRect)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002507 {"WELongRectToRect", (PyCFunction)waste_WELongRectToRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002508 PyDoc_STR("(LongRect inLongRect) -> (Rect outRect)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002509 {"WERectToLongRect", (PyCFunction)waste_WERectToLongRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002510 PyDoc_STR("(Rect inRect) -> (LongRect outLongRect)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002511 {"WEOffsetLongRect", (PyCFunction)waste_WEOffsetLongRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002512 PyDoc_STR("(SInt32 inHorizontalOffset, SInt32 inVerticalOffset) -> (LongRect ioLongRect)")},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002513 {"WELongPointInLongRect", (PyCFunction)waste_WELongPointInLongRect, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002514 PyDoc_STR("(LongPt inLongPoint, LongRect inLongRect) -> (Boolean _rv)")},
Jack Jansen756522f1996-05-07 15:24:01 +00002515 {"STDObjectHandlers", (PyCFunction)waste_STDObjectHandlers, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002516 PyDoc_STR(NULL)},
Jack Jansen756522f1996-05-07 15:24:01 +00002517 {"WEInstallObjectHandler", (PyCFunction)waste_WEInstallObjectHandler, 1,
Jack Jansen286e8382002-08-22 23:29:45 +00002518 PyDoc_STR(NULL)},
Jack Jansen90ecdf41996-04-16 14:29:15 +00002519 {NULL, NULL, 0}
2520};
2521
2522
2523
Jack Jansen756522f1996-05-07 15:24:01 +00002524/* Return the object corresponding to the window, or NULL */
2525
2526PyObject *
2527ExistingwasteObj_New(w)
2528 WEReference w;
2529{
2530 PyObject *it = NULL;
2531
2532 if (w == NULL)
2533 it = NULL;
2534 else
2535 WEGetInfo(weRefCon, (void *)&it, w);
2536 if (it == NULL || ((wasteObject *)it)->ob_itself != w)
2537 it = Py_None;
2538 Py_INCREF(it);
2539 return it;
2540}
2541
Jack Jansen90ecdf41996-04-16 14:29:15 +00002542
Jack Jansenfa77e1a2001-05-22 21:56:42 +00002543void initwaste(void)
Jack Jansen90ecdf41996-04-16 14:29:15 +00002544{
2545 PyObject *m;
2546 PyObject *d;
2547
2548
2549
2550
2551 m = Py_InitModule("waste", waste_methods);
2552 d = PyModule_GetDict(m);
2553 waste_Error = PyMac_GetOSErrException();
2554 if (waste_Error == NULL ||
2555 PyDict_SetItemString(d, "Error", waste_Error) != 0)
Jack Jansen97ed9072000-09-08 22:06:16 +00002556 return;
Jack Jansena755e681997-09-20 17:40:22 +00002557 WEO_Type.ob_type = &PyType_Type;
2558 Py_INCREF(&WEO_Type);
Jack Jansen96cebde2002-12-03 23:40:22 +00002559 PyModule_AddObject(m, "WEO", (PyObject *)&WEO_Type);
2560 /* Backward-compatible name */
2561 Py_INCREF(&WEO_Type);
2562 PyModule_AddObject(m, "WEOType", (PyObject *)&WEO_Type);
Jack Jansena755e681997-09-20 17:40:22 +00002563 waste_Type.ob_type = &PyType_Type;
2564 Py_INCREF(&waste_Type);
Jack Jansen96cebde2002-12-03 23:40:22 +00002565 PyModule_AddObject(m, "waste", (PyObject *)&waste_Type);
2566 /* Backward-compatible name */
2567 Py_INCREF(&waste_Type);
2568 PyModule_AddObject(m, "wasteType", (PyObject *)&waste_Type);
Jack Jansen756522f1996-05-07 15:24:01 +00002569
2570 callbackdict = PyDict_New();
2571 if (callbackdict == NULL || PyDict_SetItemString(d, "callbacks", callbackdict) != 0)
Jack Jansen97ed9072000-09-08 22:06:16 +00002572 return;
Jack Jansen756522f1996-05-07 15:24:01 +00002573 upp_new_handler = NewWENewObjectProc(my_new_handler);
Jack Jansen25241d91996-05-20 11:30:45 +00002574 upp_dispose_handler = NewWEDisposeObjectProc(my_dispose_handler);
2575 upp_draw_handler = NewWEDrawObjectProc(my_draw_handler);
2576 upp_click_handler = NewWEClickObjectProc(my_click_handler);
Jack Jansen756522f1996-05-07 15:24:01 +00002577
2578
Jack Jansen90ecdf41996-04-16 14:29:15 +00002579}
2580
2581/* ======================== End module waste ======================== */
2582