Bump to 2.3.1 to pick up the missing file.
[python/dscho.git] / Mac / Modules / waste / wastemodule.c
blobdd77cefa715e8d94935678a2ad71e514d23800df
2 /* ========================== Module waste ========================== */
4 #include "Python.h"
8 #ifdef _WIN32
9 #include "pywintoolbox.h"
10 #else
11 #include "macglue.h"
12 #include "pymactoolbox.h"
13 #endif
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)
23 #include <WASTE.h>
24 #include <WEObjectHandlers.h>
25 #include <WETabs.h>
27 /* Exported by Qdmodule.c: */
28 extern PyObject *QdRGB_New(RGBColor *);
29 extern int QdRGB_Convert(PyObject *, RGBColor *);
31 /* Exported by AEModule.c: */
32 extern PyObject *AEDesc_New(AppleEvent *);
33 extern int AEDesc_Convert(PyObject *, AppleEvent *);
35 /* Forward declaration */
36 static PyObject *WEOObj_New(WEObjectReference);
37 static PyObject *ExistingwasteObj_New(WEReference);
40 ** Parse/generate TextStyle records
42 static
43 PyObject *TextStyle_New(itself)
44 TextStylePtr itself;
47 return Py_BuildValue("lllO&", (long)itself->tsFont, (long)itself->tsFace, (long)itself->tsSize, QdRGB_New,
48 &itself->tsColor);
51 static
52 TextStyle_Convert(v, p_itself)
53 PyObject *v;
54 TextStylePtr p_itself;
56 long font, face, size;
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;
67 ** Parse/generate RunInfo records
69 static
70 PyObject *RunInfo_New(itself)
71 WERunInfo *itself;
74 return Py_BuildValue("llhhO&O&", itself->runStart, itself->runEnd, itself->runHeight,
75 itself->runAscent, TextStyle_New, &itself->runStyle, WEOObj_New, itself->runObject);
78 /* Conversion of long points and rects */
79 int
80 LongRect_Convert(PyObject *v, LongRect *r)
82 return PyArg_Parse(v, "(llll)", &r->left, &r->top, &r->right, &r->bottom);
85 PyObject *
86 LongRect_New(LongRect *r)
88 return Py_BuildValue("(llll)", r->left, r->top, r->right, r->bottom);
92 LongPt_Convert(PyObject *v, LongPt *p)
94 return PyArg_Parse(v, "(ll)", &p->h, &p->v);
97 PyObject *
98 LongPt_New(LongPt *p)
100 return Py_BuildValue("(ll)", p->h, p->v);
103 /* Stuff for the callbacks: */
104 static PyObject *callbackdict;
105 WENewObjectUPP upp_new_handler;
106 WEDisposeObjectUPP upp_dispose_handler;
107 WEDrawObjectUPP upp_draw_handler;
108 WEClickObjectUPP upp_click_handler;
110 static OSErr
111 any_handler(WESelector what, WEObjectReference who, PyObject *args, PyObject **rv)
113 FlavorType tp;
114 PyObject *key, *func;
116 if ( args == NULL ) return errAECorruptData;
118 tp = WEGetObjectType(who);
120 if( (key=Py_BuildValue("O&O&", PyMac_BuildOSType, tp, PyMac_BuildOSType, what)) == NULL)
121 return errAECorruptData;
122 if( (func = PyDict_GetItem(callbackdict, key)) == NULL ) {
123 Py_DECREF(key);
124 return errAEHandlerNotFound;
126 Py_INCREF(func);
127 *rv = PyEval_CallObject(func, args);
128 Py_DECREF(func);
129 Py_DECREF(key);
130 if ( *rv == NULL ) {
131 PySys_WriteStderr("--Exception in callback: ");
132 PyErr_Print();
133 return errAEReplyNotArrived;
135 return 0;
138 static pascal OSErr
139 my_new_handler(Point *objectSize, WEObjectReference objref)
141 PyObject *args=NULL, *rv=NULL;
142 OSErr err;
144 args=Py_BuildValue("(O&)", WEOObj_New, objref);
145 err = any_handler(weNewHandler, objref, args, &rv);
146 if (!err) {
147 if (!PyMac_GetPoint(rv, objectSize) )
148 err = errAECoercionFail;
150 if ( args ) Py_DECREF(args);
151 if ( rv ) Py_DECREF(rv);
152 return err;
155 static pascal OSErr
156 my_dispose_handler(WEObjectReference objref)
158 PyObject *args=NULL, *rv=NULL;
159 OSErr err;
161 args=Py_BuildValue("(O&)", WEOObj_New, objref);
162 err = any_handler(weDisposeHandler, objref, args, &rv);
163 if ( args ) Py_DECREF(args);
164 if ( rv ) Py_DECREF(rv);
165 return err;
168 static pascal OSErr
169 my_draw_handler(const Rect *destRect, WEObjectReference objref)
171 PyObject *args=NULL, *rv=NULL;
172 OSErr err;
174 args=Py_BuildValue("O&O&", PyMac_BuildRect, destRect, WEOObj_New, objref);
175 err = any_handler(weDrawHandler, objref, args, &rv);
176 if ( args ) Py_DECREF(args);
177 if ( rv ) Py_DECREF(rv);
178 return err;
181 static pascal Boolean
182 my_click_handler(Point hitPt, EventModifiers modifiers,
183 unsigned long clickTime, WEObjectReference objref)
185 PyObject *args=NULL, *rv=NULL;
186 int retvalue;
187 OSErr err;
189 args=Py_BuildValue("O&llO&", PyMac_BuildPoint, hitPt,
190 (long)modifiers, (long)clickTime, WEOObj_New, objref);
191 err = any_handler(weClickHandler, objref, args, &rv);
192 if (!err)
193 retvalue = PyInt_AsLong(rv);
194 else
195 retvalue = 0;
196 if ( args ) Py_DECREF(args);
197 if ( rv ) Py_DECREF(rv);
198 return retvalue;
203 static PyObject *waste_Error;
205 /* ------------------------ Object type WEO ------------------------- */
207 PyTypeObject WEO_Type;
209 #define WEOObj_Check(x) ((x)->ob_type == &WEO_Type)
211 typedef struct WEOObject {
212 PyObject_HEAD
213 WEObjectReference ob_itself;
214 } WEOObject;
216 PyObject *WEOObj_New(WEObjectReference itself)
218 WEOObject *it;
219 if (itself == NULL) {
220 Py_INCREF(Py_None);
221 return Py_None;
223 it = PyObject_NEW(WEOObject, &WEO_Type);
224 if (it == NULL) return NULL;
225 it->ob_itself = itself;
226 return (PyObject *)it;
228 int WEOObj_Convert(PyObject *v, WEObjectReference *p_itself)
230 if (!WEOObj_Check(v))
232 PyErr_SetString(PyExc_TypeError, "WEO required");
233 return 0;
235 *p_itself = ((WEOObject *)v)->ob_itself;
236 return 1;
239 static void WEOObj_dealloc(WEOObject *self)
241 /* Cleanup of self->ob_itself goes here */
242 PyObject_Del(self);
245 static PyObject *WEOObj_WEGetObjectType(WEOObject *_self, PyObject *_args)
247 PyObject *_res = NULL;
248 FlavorType _rv;
249 if (!PyArg_ParseTuple(_args, ""))
250 return NULL;
251 _rv = WEGetObjectType(_self->ob_itself);
252 _res = Py_BuildValue("O&",
253 PyMac_BuildOSType, _rv);
254 return _res;
257 static PyObject *WEOObj_WEGetObjectDataHandle(WEOObject *_self, PyObject *_args)
259 PyObject *_res = NULL;
260 Handle _rv;
261 if (!PyArg_ParseTuple(_args, ""))
262 return NULL;
263 _rv = WEGetObjectDataHandle(_self->ob_itself);
264 _res = Py_BuildValue("O&",
265 ResObj_New, _rv);
266 return _res;
269 static PyObject *WEOObj_WEGetObjectOwner(WEOObject *_self, PyObject *_args)
271 PyObject *_res = NULL;
272 WEReference _rv;
273 if (!PyArg_ParseTuple(_args, ""))
274 return NULL;
275 _rv = WEGetObjectOwner(_self->ob_itself);
276 _res = Py_BuildValue("O&",
277 ExistingwasteObj_New, _rv);
278 return _res;
281 static PyObject *WEOObj_WEGetObjectOffset(WEOObject *_self, PyObject *_args)
283 PyObject *_res = NULL;
284 SInt32 _rv;
285 if (!PyArg_ParseTuple(_args, ""))
286 return NULL;
287 _rv = WEGetObjectOffset(_self->ob_itself);
288 _res = Py_BuildValue("l",
289 _rv);
290 return _res;
293 static PyObject *WEOObj_WEGetObjectSize(WEOObject *_self, PyObject *_args)
295 PyObject *_res = NULL;
296 Point _rv;
297 if (!PyArg_ParseTuple(_args, ""))
298 return NULL;
299 _rv = WEGetObjectSize(_self->ob_itself);
300 _res = Py_BuildValue("O&",
301 PyMac_BuildPoint, _rv);
302 return _res;
305 static PyObject *WEOObj_WESetObjectSize(WEOObject *_self, PyObject *_args)
307 PyObject *_res = NULL;
308 OSErr _err;
309 Point inObjectSize;
310 if (!PyArg_ParseTuple(_args, "O&",
311 PyMac_GetPoint, &inObjectSize))
312 return NULL;
313 _err = WESetObjectSize(_self->ob_itself,
314 inObjectSize);
315 if (_err != noErr) return PyMac_Error(_err);
316 Py_INCREF(Py_None);
317 _res = Py_None;
318 return _res;
321 static PyObject *WEOObj_WEGetObjectFrame(WEOObject *_self, PyObject *_args)
323 PyObject *_res = NULL;
324 OSErr _err;
325 LongRect outObjectFrame;
326 if (!PyArg_ParseTuple(_args, ""))
327 return NULL;
328 _err = WEGetObjectFrame(_self->ob_itself,
329 &outObjectFrame);
330 if (_err != noErr) return PyMac_Error(_err);
331 _res = Py_BuildValue("O&",
332 LongRect_New, &outObjectFrame);
333 return _res;
336 static PyObject *WEOObj_WEGetObjectRefCon(WEOObject *_self, PyObject *_args)
338 PyObject *_res = NULL;
339 SInt32 _rv;
340 if (!PyArg_ParseTuple(_args, ""))
341 return NULL;
342 _rv = WEGetObjectRefCon(_self->ob_itself);
343 _res = Py_BuildValue("l",
344 _rv);
345 return _res;
348 static PyObject *WEOObj_WESetObjectRefCon(WEOObject *_self, PyObject *_args)
350 PyObject *_res = NULL;
351 SInt32 inRefCon;
352 if (!PyArg_ParseTuple(_args, "l",
353 &inRefCon))
354 return NULL;
355 WESetObjectRefCon(_self->ob_itself,
356 inRefCon);
357 Py_INCREF(Py_None);
358 _res = Py_None;
359 return _res;
362 static PyMethodDef WEOObj_methods[] = {
363 {"WEGetObjectType", (PyCFunction)WEOObj_WEGetObjectType, 1,
364 PyDoc_STR("() -> (FlavorType _rv)")},
365 {"WEGetObjectDataHandle", (PyCFunction)WEOObj_WEGetObjectDataHandle, 1,
366 PyDoc_STR("() -> (Handle _rv)")},
367 {"WEGetObjectOwner", (PyCFunction)WEOObj_WEGetObjectOwner, 1,
368 PyDoc_STR("() -> (WEReference _rv)")},
369 {"WEGetObjectOffset", (PyCFunction)WEOObj_WEGetObjectOffset, 1,
370 PyDoc_STR("() -> (SInt32 _rv)")},
371 {"WEGetObjectSize", (PyCFunction)WEOObj_WEGetObjectSize, 1,
372 PyDoc_STR("() -> (Point _rv)")},
373 {"WESetObjectSize", (PyCFunction)WEOObj_WESetObjectSize, 1,
374 PyDoc_STR("(Point inObjectSize) -> None")},
375 {"WEGetObjectFrame", (PyCFunction)WEOObj_WEGetObjectFrame, 1,
376 PyDoc_STR("() -> (LongRect outObjectFrame)")},
377 {"WEGetObjectRefCon", (PyCFunction)WEOObj_WEGetObjectRefCon, 1,
378 PyDoc_STR("() -> (SInt32 _rv)")},
379 {"WESetObjectRefCon", (PyCFunction)WEOObj_WESetObjectRefCon, 1,
380 PyDoc_STR("(SInt32 inRefCon) -> None")},
381 {NULL, NULL, 0}
384 PyMethodChain WEOObj_chain = { WEOObj_methods, NULL };
386 static PyObject *WEOObj_getattr(WEOObject *self, char *name)
388 return Py_FindMethodInChain(&WEOObj_chain, (PyObject *)self, name);
391 #define WEOObj_setattr NULL
393 #define WEOObj_compare NULL
395 #define WEOObj_repr NULL
397 #define WEOObj_hash NULL
399 PyTypeObject WEO_Type = {
400 PyObject_HEAD_INIT(NULL)
401 0, /*ob_size*/
402 "waste.WEO", /*tp_name*/
403 sizeof(WEOObject), /*tp_basicsize*/
404 0, /*tp_itemsize*/
405 /* methods */
406 (destructor) WEOObj_dealloc, /*tp_dealloc*/
407 0, /*tp_print*/
408 (getattrfunc) WEOObj_getattr, /*tp_getattr*/
409 (setattrfunc) WEOObj_setattr, /*tp_setattr*/
410 (cmpfunc) WEOObj_compare, /*tp_compare*/
411 (reprfunc) WEOObj_repr, /*tp_repr*/
412 (PyNumberMethods *)0, /* tp_as_number */
413 (PySequenceMethods *)0, /* tp_as_sequence */
414 (PyMappingMethods *)0, /* tp_as_mapping */
415 (hashfunc) WEOObj_hash, /*tp_hash*/
418 /* ---------------------- End object type WEO ----------------------- */
421 /* ----------------------- Object type waste ------------------------ */
423 PyTypeObject waste_Type;
425 #define wasteObj_Check(x) ((x)->ob_type == &waste_Type)
427 typedef struct wasteObject {
428 PyObject_HEAD
429 WEReference ob_itself;
430 } wasteObject;
432 PyObject *wasteObj_New(WEReference itself)
434 wasteObject *it;
435 if (itself == NULL) {
436 PyErr_SetString(waste_Error,"Cannot create null WE");
437 return NULL;
439 it = PyObject_NEW(wasteObject, &waste_Type);
440 if (it == NULL) return NULL;
441 it->ob_itself = itself;
442 WESetInfo(weRefCon, (void *)&it, itself);
443 return (PyObject *)it;
445 int wasteObj_Convert(PyObject *v, WEReference *p_itself)
447 if (!wasteObj_Check(v))
449 PyErr_SetString(PyExc_TypeError, "waste required");
450 return 0;
452 *p_itself = ((wasteObject *)v)->ob_itself;
453 return 1;
456 static void wasteObj_dealloc(wasteObject *self)
458 WEDispose(self->ob_itself);
459 PyObject_Del(self);
462 static PyObject *wasteObj_WEGetText(wasteObject *_self, PyObject *_args)
464 PyObject *_res = NULL;
465 Handle _rv;
466 if (!PyArg_ParseTuple(_args, ""))
467 return NULL;
468 _rv = WEGetText(_self->ob_itself);
469 _res = Py_BuildValue("O&",
470 ResObj_New, _rv);
471 return _res;
474 static PyObject *wasteObj_WEGetChar(wasteObject *_self, PyObject *_args)
476 PyObject *_res = NULL;
477 SInt16 _rv;
478 SInt32 inOffset;
479 if (!PyArg_ParseTuple(_args, "l",
480 &inOffset))
481 return NULL;
482 _rv = WEGetChar(inOffset,
483 _self->ob_itself);
484 _res = Py_BuildValue("h",
485 _rv);
486 return _res;
489 static PyObject *wasteObj_WEGetTextLength(wasteObject *_self, PyObject *_args)
491 PyObject *_res = NULL;
492 SInt32 _rv;
493 if (!PyArg_ParseTuple(_args, ""))
494 return NULL;
495 _rv = WEGetTextLength(_self->ob_itself);
496 _res = Py_BuildValue("l",
497 _rv);
498 return _res;
501 static PyObject *wasteObj_WEGetSelection(wasteObject *_self, PyObject *_args)
503 PyObject *_res = NULL;
504 SInt32 outSelStart;
505 SInt32 outSelEnd;
506 if (!PyArg_ParseTuple(_args, ""))
507 return NULL;
508 WEGetSelection(&outSelStart,
509 &outSelEnd,
510 _self->ob_itself);
511 _res = Py_BuildValue("ll",
512 outSelStart,
513 outSelEnd);
514 return _res;
517 static PyObject *wasteObj_WEGetDestRect(wasteObject *_self, PyObject *_args)
519 PyObject *_res = NULL;
520 LongRect outDestRect;
521 if (!PyArg_ParseTuple(_args, ""))
522 return NULL;
523 WEGetDestRect(&outDestRect,
524 _self->ob_itself);
525 _res = Py_BuildValue("O&",
526 LongRect_New, &outDestRect);
527 return _res;
530 static PyObject *wasteObj_WEGetViewRect(wasteObject *_self, PyObject *_args)
532 PyObject *_res = NULL;
533 LongRect outViewRect;
534 if (!PyArg_ParseTuple(_args, ""))
535 return NULL;
536 WEGetViewRect(&outViewRect,
537 _self->ob_itself);
538 _res = Py_BuildValue("O&",
539 LongRect_New, &outViewRect);
540 return _res;
543 static PyObject *wasteObj_WEIsActive(wasteObject *_self, PyObject *_args)
545 PyObject *_res = NULL;
546 Boolean _rv;
547 if (!PyArg_ParseTuple(_args, ""))
548 return NULL;
549 _rv = WEIsActive(_self->ob_itself);
550 _res = Py_BuildValue("b",
551 _rv);
552 return _res;
555 static PyObject *wasteObj_WEGetClickCount(wasteObject *_self, PyObject *_args)
557 PyObject *_res = NULL;
558 UInt16 _rv;
559 if (!PyArg_ParseTuple(_args, ""))
560 return NULL;
561 _rv = WEGetClickCount(_self->ob_itself);
562 _res = Py_BuildValue("H",
563 _rv);
564 return _res;
567 static PyObject *wasteObj_WESetSelection(wasteObject *_self, PyObject *_args)
569 PyObject *_res = NULL;
570 SInt32 inSelStart;
571 SInt32 inSelEnd;
572 if (!PyArg_ParseTuple(_args, "ll",
573 &inSelStart,
574 &inSelEnd))
575 return NULL;
576 WESetSelection(inSelStart,
577 inSelEnd,
578 _self->ob_itself);
579 Py_INCREF(Py_None);
580 _res = Py_None;
581 return _res;
584 static PyObject *wasteObj_WESetDestRect(wasteObject *_self, PyObject *_args)
586 PyObject *_res = NULL;
587 LongRect inDestRect;
588 if (!PyArg_ParseTuple(_args, "O&",
589 LongRect_Convert, &inDestRect))
590 return NULL;
591 WESetDestRect(&inDestRect,
592 _self->ob_itself);
593 Py_INCREF(Py_None);
594 _res = Py_None;
595 return _res;
598 static PyObject *wasteObj_WESetViewRect(wasteObject *_self, PyObject *_args)
600 PyObject *_res = NULL;
601 LongRect inViewRect;
602 if (!PyArg_ParseTuple(_args, "O&",
603 LongRect_Convert, &inViewRect))
604 return NULL;
605 WESetViewRect(&inViewRect,
606 _self->ob_itself);
607 Py_INCREF(Py_None);
608 _res = Py_None;
609 return _res;
612 static PyObject *wasteObj_WEContinuousStyle(wasteObject *_self, PyObject *_args)
614 PyObject *_res = NULL;
615 Boolean _rv;
616 WEStyleMode ioMode;
617 TextStyle outTextStyle;
618 if (!PyArg_ParseTuple(_args, "H",
619 &ioMode))
620 return NULL;
621 _rv = WEContinuousStyle(&ioMode,
622 &outTextStyle,
623 _self->ob_itself);
624 _res = Py_BuildValue("bHO&",
625 _rv,
626 ioMode,
627 TextStyle_New, &outTextStyle);
628 return _res;
631 static PyObject *wasteObj_WECountRuns(wasteObject *_self, PyObject *_args)
633 PyObject *_res = NULL;
634 SInt32 _rv;
635 if (!PyArg_ParseTuple(_args, ""))
636 return NULL;
637 _rv = WECountRuns(_self->ob_itself);
638 _res = Py_BuildValue("l",
639 _rv);
640 return _res;
643 static PyObject *wasteObj_WEOffsetToRun(wasteObject *_self, PyObject *_args)
645 PyObject *_res = NULL;
646 SInt32 _rv;
647 SInt32 inOffset;
648 if (!PyArg_ParseTuple(_args, "l",
649 &inOffset))
650 return NULL;
651 _rv = WEOffsetToRun(inOffset,
652 _self->ob_itself);
653 _res = Py_BuildValue("l",
654 _rv);
655 return _res;
658 static PyObject *wasteObj_WEGetRunRange(wasteObject *_self, PyObject *_args)
660 PyObject *_res = NULL;
661 SInt32 inStyleRunIndex;
662 SInt32 outStyleRunStart;
663 SInt32 outStyleRunEnd;
664 if (!PyArg_ParseTuple(_args, "l",
665 &inStyleRunIndex))
666 return NULL;
667 WEGetRunRange(inStyleRunIndex,
668 &outStyleRunStart,
669 &outStyleRunEnd,
670 _self->ob_itself);
671 _res = Py_BuildValue("ll",
672 outStyleRunStart,
673 outStyleRunEnd);
674 return _res;
677 static PyObject *wasteObj_WEGetRunInfo(wasteObject *_self, PyObject *_args)
679 PyObject *_res = NULL;
680 SInt32 inOffset;
681 WERunInfo outStyleRunInfo;
682 if (!PyArg_ParseTuple(_args, "l",
683 &inOffset))
684 return NULL;
685 WEGetRunInfo(inOffset,
686 &outStyleRunInfo,
687 _self->ob_itself);
688 _res = Py_BuildValue("O&",
689 RunInfo_New, &outStyleRunInfo);
690 return _res;
693 static PyObject *wasteObj_WEGetIndRunInfo(wasteObject *_self, PyObject *_args)
695 PyObject *_res = NULL;
696 SInt32 inStyleRunIndex;
697 WERunInfo outStyleRunInfo;
698 if (!PyArg_ParseTuple(_args, "l",
699 &inStyleRunIndex))
700 return NULL;
701 WEGetIndRunInfo(inStyleRunIndex,
702 &outStyleRunInfo,
703 _self->ob_itself);
704 _res = Py_BuildValue("O&",
705 RunInfo_New, &outStyleRunInfo);
706 return _res;
709 static PyObject *wasteObj_WEGetRunDirection(wasteObject *_self, PyObject *_args)
711 PyObject *_res = NULL;
712 Boolean _rv;
713 SInt32 inOffset;
714 if (!PyArg_ParseTuple(_args, "l",
715 &inOffset))
716 return NULL;
717 _rv = WEGetRunDirection(inOffset,
718 _self->ob_itself);
719 _res = Py_BuildValue("b",
720 _rv);
721 return _res;
724 static PyObject *wasteObj_WECountParaRuns(wasteObject *_self, PyObject *_args)
726 PyObject *_res = NULL;
727 SInt32 _rv;
728 if (!PyArg_ParseTuple(_args, ""))
729 return NULL;
730 _rv = WECountParaRuns(_self->ob_itself);
731 _res = Py_BuildValue("l",
732 _rv);
733 return _res;
736 static PyObject *wasteObj_WEOffsetToParaRun(wasteObject *_self, PyObject *_args)
738 PyObject *_res = NULL;
739 SInt32 _rv;
740 SInt32 inOffset;
741 if (!PyArg_ParseTuple(_args, "l",
742 &inOffset))
743 return NULL;
744 _rv = WEOffsetToParaRun(inOffset,
745 _self->ob_itself);
746 _res = Py_BuildValue("l",
747 _rv);
748 return _res;
751 static PyObject *wasteObj_WEGetParaRunRange(wasteObject *_self, PyObject *_args)
753 PyObject *_res = NULL;
754 SInt32 inParagraphRunIndex;
755 SInt32 outParagraphRunStart;
756 SInt32 outParagraphRunEnd;
757 if (!PyArg_ParseTuple(_args, "l",
758 &inParagraphRunIndex))
759 return NULL;
760 WEGetParaRunRange(inParagraphRunIndex,
761 &outParagraphRunStart,
762 &outParagraphRunEnd,
763 _self->ob_itself);
764 _res = Py_BuildValue("ll",
765 outParagraphRunStart,
766 outParagraphRunEnd);
767 return _res;
770 static PyObject *wasteObj_WECountLines(wasteObject *_self, PyObject *_args)
772 PyObject *_res = NULL;
773 SInt32 _rv;
774 if (!PyArg_ParseTuple(_args, ""))
775 return NULL;
776 _rv = WECountLines(_self->ob_itself);
777 _res = Py_BuildValue("l",
778 _rv);
779 return _res;
782 static PyObject *wasteObj_WEOffsetToLine(wasteObject *_self, PyObject *_args)
784 PyObject *_res = NULL;
785 SInt32 _rv;
786 SInt32 inOffset;
787 if (!PyArg_ParseTuple(_args, "l",
788 &inOffset))
789 return NULL;
790 _rv = WEOffsetToLine(inOffset,
791 _self->ob_itself);
792 _res = Py_BuildValue("l",
793 _rv);
794 return _res;
797 static PyObject *wasteObj_WEGetLineRange(wasteObject *_self, PyObject *_args)
799 PyObject *_res = NULL;
800 SInt32 inLineIndex;
801 SInt32 outLineStart;
802 SInt32 outLineEnd;
803 if (!PyArg_ParseTuple(_args, "l",
804 &inLineIndex))
805 return NULL;
806 WEGetLineRange(inLineIndex,
807 &outLineStart,
808 &outLineEnd,
809 _self->ob_itself);
810 _res = Py_BuildValue("ll",
811 outLineStart,
812 outLineEnd);
813 return _res;
816 static PyObject *wasteObj_WEGetHeight(wasteObject *_self, PyObject *_args)
818 PyObject *_res = NULL;
819 SInt32 _rv;
820 SInt32 inStartLineIndex;
821 SInt32 inEndLineIndex;
822 if (!PyArg_ParseTuple(_args, "ll",
823 &inStartLineIndex,
824 &inEndLineIndex))
825 return NULL;
826 _rv = WEGetHeight(inStartLineIndex,
827 inEndLineIndex,
828 _self->ob_itself);
829 _res = Py_BuildValue("l",
830 _rv);
831 return _res;
834 static PyObject *wasteObj_WEGetOffset(wasteObject *_self, PyObject *_args)
836 PyObject *_res = NULL;
837 SInt32 _rv;
838 LongPt inPoint;
839 WEEdge outEdge;
840 if (!PyArg_ParseTuple(_args, "O&",
841 LongPt_Convert, &inPoint))
842 return NULL;
843 _rv = WEGetOffset(&inPoint,
844 &outEdge,
845 _self->ob_itself);
846 _res = Py_BuildValue("lB",
847 _rv,
848 outEdge);
849 return _res;
852 static PyObject *wasteObj_WEGetPoint(wasteObject *_self, PyObject *_args)
854 PyObject *_res = NULL;
855 SInt32 inOffset;
856 SInt16 inDirection;
857 LongPt outPoint;
858 SInt16 outLineHeight;
859 if (!PyArg_ParseTuple(_args, "lh",
860 &inOffset,
861 &inDirection))
862 return NULL;
863 WEGetPoint(inOffset,
864 inDirection,
865 &outPoint,
866 &outLineHeight,
867 _self->ob_itself);
868 _res = Py_BuildValue("O&h",
869 LongPt_New, &outPoint,
870 outLineHeight);
871 return _res;
874 static PyObject *wasteObj_WEFindWord(wasteObject *_self, PyObject *_args)
876 PyObject *_res = NULL;
877 SInt32 inOffset;
878 WEEdge inEdge;
879 SInt32 outWordStart;
880 SInt32 outWordEnd;
881 if (!PyArg_ParseTuple(_args, "lB",
882 &inOffset,
883 &inEdge))
884 return NULL;
885 WEFindWord(inOffset,
886 inEdge,
887 &outWordStart,
888 &outWordEnd,
889 _self->ob_itself);
890 _res = Py_BuildValue("ll",
891 outWordStart,
892 outWordEnd);
893 return _res;
896 static PyObject *wasteObj_WEFindLine(wasteObject *_self, PyObject *_args)
898 PyObject *_res = NULL;
899 SInt32 inOffset;
900 WEEdge inEdge;
901 SInt32 outLineStart;
902 SInt32 outLineEnd;
903 if (!PyArg_ParseTuple(_args, "lB",
904 &inOffset,
905 &inEdge))
906 return NULL;
907 WEFindLine(inOffset,
908 inEdge,
909 &outLineStart,
910 &outLineEnd,
911 _self->ob_itself);
912 _res = Py_BuildValue("ll",
913 outLineStart,
914 outLineEnd);
915 return _res;
918 static PyObject *wasteObj_WEFindParagraph(wasteObject *_self, PyObject *_args)
920 PyObject *_res = NULL;
921 SInt32 inOffset;
922 WEEdge inEdge;
923 SInt32 outParagraphStart;
924 SInt32 outParagraphEnd;
925 if (!PyArg_ParseTuple(_args, "lB",
926 &inOffset,
927 &inEdge))
928 return NULL;
929 WEFindParagraph(inOffset,
930 inEdge,
931 &outParagraphStart,
932 &outParagraphEnd,
933 _self->ob_itself);
934 _res = Py_BuildValue("ll",
935 outParagraphStart,
936 outParagraphEnd);
937 return _res;
940 static PyObject *wasteObj_WEFind(wasteObject *_self, PyObject *_args)
942 PyObject *_res = NULL;
943 OSErr _err;
944 char* inKey;
945 SInt32 inKeyLength;
946 TextEncoding inKeyEncoding;
947 OptionBits inMatchOptions;
948 SInt32 inRangeStart;
949 SInt32 inRangeEnd;
950 SInt32 outMatchStart;
951 SInt32 outMatchEnd;
952 if (!PyArg_ParseTuple(_args, "slllll",
953 &inKey,
954 &inKeyLength,
955 &inKeyEncoding,
956 &inMatchOptions,
957 &inRangeStart,
958 &inRangeEnd))
959 return NULL;
960 _err = WEFind(inKey,
961 inKeyLength,
962 inKeyEncoding,
963 inMatchOptions,
964 inRangeStart,
965 inRangeEnd,
966 &outMatchStart,
967 &outMatchEnd,
968 _self->ob_itself);
969 if (_err != noErr) return PyMac_Error(_err);
970 _res = Py_BuildValue("ll",
971 outMatchStart,
972 outMatchEnd);
973 return _res;
976 static PyObject *wasteObj_WEStreamRange(wasteObject *_self, PyObject *_args)
978 PyObject *_res = NULL;
979 OSErr _err;
980 SInt32 inRangeStart;
981 SInt32 inRangeEnd;
982 FlavorType inRequestedType;
983 OptionBits inStreamOptions;
984 Handle outData;
985 if (!PyArg_ParseTuple(_args, "llO&lO&",
986 &inRangeStart,
987 &inRangeEnd,
988 PyMac_GetOSType, &inRequestedType,
989 &inStreamOptions,
990 ResObj_Convert, &outData))
991 return NULL;
992 _err = WEStreamRange(inRangeStart,
993 inRangeEnd,
994 inRequestedType,
995 inStreamOptions,
996 outData,
997 _self->ob_itself);
998 if (_err != noErr) return PyMac_Error(_err);
999 Py_INCREF(Py_None);
1000 _res = Py_None;
1001 return _res;
1004 static PyObject *wasteObj_WECopyRange(wasteObject *_self, PyObject *_args)
1006 PyObject *_res = NULL;
1007 OSErr _err;
1008 SInt32 inRangeStart;
1009 SInt32 inRangeEnd;
1010 Handle outText;
1011 StScrpHandle outStyles;
1012 WESoupHandle outSoup;
1013 if (!PyArg_ParseTuple(_args, "llO&O&O&",
1014 &inRangeStart,
1015 &inRangeEnd,
1016 OptResObj_Convert, &outText,
1017 OptResObj_Convert, &outStyles,
1018 OptResObj_Convert, &outSoup))
1019 return NULL;
1020 _err = WECopyRange(inRangeStart,
1021 inRangeEnd,
1022 outText,
1023 outStyles,
1024 outSoup,
1025 _self->ob_itself);
1026 if (_err != noErr) return PyMac_Error(_err);
1027 Py_INCREF(Py_None);
1028 _res = Py_None;
1029 return _res;
1032 static PyObject *wasteObj_WEGetTextRangeAsUnicode(wasteObject *_self, PyObject *_args)
1034 PyObject *_res = NULL;
1035 OSErr _err;
1036 SInt32 inRangeStart;
1037 SInt32 inRangeEnd;
1038 Handle outUnicodeText;
1039 Handle ioCharFormat;
1040 Handle ioParaFormat;
1041 TextEncodingVariant inUnicodeVariant;
1042 TextEncodingFormat inTransformationFormat;
1043 OptionBits inGetOptions;
1044 if (!PyArg_ParseTuple(_args, "llO&O&O&lll",
1045 &inRangeStart,
1046 &inRangeEnd,
1047 ResObj_Convert, &outUnicodeText,
1048 ResObj_Convert, &ioCharFormat,
1049 ResObj_Convert, &ioParaFormat,
1050 &inUnicodeVariant,
1051 &inTransformationFormat,
1052 &inGetOptions))
1053 return NULL;
1054 _err = WEGetTextRangeAsUnicode(inRangeStart,
1055 inRangeEnd,
1056 outUnicodeText,
1057 ioCharFormat,
1058 ioParaFormat,
1059 inUnicodeVariant,
1060 inTransformationFormat,
1061 inGetOptions,
1062 _self->ob_itself);
1063 if (_err != noErr) return PyMac_Error(_err);
1064 Py_INCREF(Py_None);
1065 _res = Py_None;
1066 return _res;
1069 static PyObject *wasteObj_WEGetAlignment(wasteObject *_self, PyObject *_args)
1071 PyObject *_res = NULL;
1072 WEAlignment _rv;
1073 if (!PyArg_ParseTuple(_args, ""))
1074 return NULL;
1075 _rv = WEGetAlignment(_self->ob_itself);
1076 _res = Py_BuildValue("B",
1077 _rv);
1078 return _res;
1081 static PyObject *wasteObj_WESetAlignment(wasteObject *_self, PyObject *_args)
1083 PyObject *_res = NULL;
1084 WEAlignment inAlignment;
1085 if (!PyArg_ParseTuple(_args, "B",
1086 &inAlignment))
1087 return NULL;
1088 WESetAlignment(inAlignment,
1089 _self->ob_itself);
1090 Py_INCREF(Py_None);
1091 _res = Py_None;
1092 return _res;
1095 static PyObject *wasteObj_WEGetDirection(wasteObject *_self, PyObject *_args)
1097 PyObject *_res = NULL;
1098 WEDirection _rv;
1099 if (!PyArg_ParseTuple(_args, ""))
1100 return NULL;
1101 _rv = WEGetDirection(_self->ob_itself);
1102 _res = Py_BuildValue("h",
1103 _rv);
1104 return _res;
1107 static PyObject *wasteObj_WESetDirection(wasteObject *_self, PyObject *_args)
1109 PyObject *_res = NULL;
1110 WEDirection inDirection;
1111 if (!PyArg_ParseTuple(_args, "h",
1112 &inDirection))
1113 return NULL;
1114 WESetDirection(inDirection,
1115 _self->ob_itself);
1116 Py_INCREF(Py_None);
1117 _res = Py_None;
1118 return _res;
1121 static PyObject *wasteObj_WECalText(wasteObject *_self, PyObject *_args)
1123 PyObject *_res = NULL;
1124 OSErr _err;
1125 if (!PyArg_ParseTuple(_args, ""))
1126 return NULL;
1127 _err = WECalText(_self->ob_itself);
1128 if (_err != noErr) return PyMac_Error(_err);
1129 Py_INCREF(Py_None);
1130 _res = Py_None;
1131 return _res;
1134 static PyObject *wasteObj_WEUpdate(wasteObject *_self, PyObject *_args)
1136 PyObject *_res = NULL;
1137 RgnHandle inUpdateRgn;
1138 if (!PyArg_ParseTuple(_args, "O&",
1139 ResObj_Convert, &inUpdateRgn))
1140 return NULL;
1141 WEUpdate(inUpdateRgn,
1142 _self->ob_itself);
1143 Py_INCREF(Py_None);
1144 _res = Py_None;
1145 return _res;
1148 static PyObject *wasteObj_WEScroll(wasteObject *_self, PyObject *_args)
1150 PyObject *_res = NULL;
1151 SInt32 inHorizontalOffset;
1152 SInt32 inVerticalOffset;
1153 if (!PyArg_ParseTuple(_args, "ll",
1154 &inHorizontalOffset,
1155 &inVerticalOffset))
1156 return NULL;
1157 WEScroll(inHorizontalOffset,
1158 inVerticalOffset,
1159 _self->ob_itself);
1160 Py_INCREF(Py_None);
1161 _res = Py_None;
1162 return _res;
1165 static PyObject *wasteObj_WEPinScroll(wasteObject *_self, PyObject *_args)
1167 PyObject *_res = NULL;
1168 SInt32 inHorizontalOffset;
1169 SInt32 inVerticalOffset;
1170 if (!PyArg_ParseTuple(_args, "ll",
1171 &inHorizontalOffset,
1172 &inVerticalOffset))
1173 return NULL;
1174 WEPinScroll(inHorizontalOffset,
1175 inVerticalOffset,
1176 _self->ob_itself);
1177 Py_INCREF(Py_None);
1178 _res = Py_None;
1179 return _res;
1182 static PyObject *wasteObj_WESelView(wasteObject *_self, PyObject *_args)
1184 PyObject *_res = NULL;
1185 if (!PyArg_ParseTuple(_args, ""))
1186 return NULL;
1187 WESelView(_self->ob_itself);
1188 Py_INCREF(Py_None);
1189 _res = Py_None;
1190 return _res;
1193 static PyObject *wasteObj_WEActivate(wasteObject *_self, PyObject *_args)
1195 PyObject *_res = NULL;
1196 if (!PyArg_ParseTuple(_args, ""))
1197 return NULL;
1198 WEActivate(_self->ob_itself);
1199 Py_INCREF(Py_None);
1200 _res = Py_None;
1201 return _res;
1204 static PyObject *wasteObj_WEDeactivate(wasteObject *_self, PyObject *_args)
1206 PyObject *_res = NULL;
1207 if (!PyArg_ParseTuple(_args, ""))
1208 return NULL;
1209 WEDeactivate(_self->ob_itself);
1210 Py_INCREF(Py_None);
1211 _res = Py_None;
1212 return _res;
1215 static PyObject *wasteObj_WEKey(wasteObject *_self, PyObject *_args)
1217 PyObject *_res = NULL;
1218 CharParameter inKey;
1219 EventModifiers inModifiers;
1220 if (!PyArg_ParseTuple(_args, "hH",
1221 &inKey,
1222 &inModifiers))
1223 return NULL;
1224 WEKey(inKey,
1225 inModifiers,
1226 _self->ob_itself);
1227 Py_INCREF(Py_None);
1228 _res = Py_None;
1229 return _res;
1232 static PyObject *wasteObj_WEClick(wasteObject *_self, PyObject *_args)
1234 PyObject *_res = NULL;
1235 Point inHitPoint;
1236 EventModifiers inModifiers;
1237 UInt32 inClickTime;
1238 if (!PyArg_ParseTuple(_args, "O&Hl",
1239 PyMac_GetPoint, &inHitPoint,
1240 &inModifiers,
1241 &inClickTime))
1242 return NULL;
1243 WEClick(inHitPoint,
1244 inModifiers,
1245 inClickTime,
1246 _self->ob_itself);
1247 Py_INCREF(Py_None);
1248 _res = Py_None;
1249 return _res;
1252 static PyObject *wasteObj_WEAdjustCursor(wasteObject *_self, PyObject *_args)
1254 PyObject *_res = NULL;
1255 Boolean _rv;
1256 Point inMouseLoc;
1257 RgnHandle ioMouseRgn;
1258 if (!PyArg_ParseTuple(_args, "O&O&",
1259 PyMac_GetPoint, &inMouseLoc,
1260 ResObj_Convert, &ioMouseRgn))
1261 return NULL;
1262 _rv = WEAdjustCursor(inMouseLoc,
1263 ioMouseRgn,
1264 _self->ob_itself);
1265 _res = Py_BuildValue("b",
1266 _rv);
1267 return _res;
1270 static PyObject *wasteObj_WEIdle(wasteObject *_self, PyObject *_args)
1272 PyObject *_res = NULL;
1273 UInt32 outMaxSleep;
1274 if (!PyArg_ParseTuple(_args, ""))
1275 return NULL;
1276 WEIdle(&outMaxSleep,
1277 _self->ob_itself);
1278 _res = Py_BuildValue("l",
1279 outMaxSleep);
1280 return _res;
1283 static PyObject *wasteObj_WEInsert(wasteObject *_self, PyObject *_args)
1285 PyObject *_res = NULL;
1286 OSErr _err;
1287 char *inTextPtr__in__;
1288 long inTextPtr__len__;
1289 int inTextPtr__in_len__;
1290 StScrpHandle inStyles;
1291 WESoupHandle inSoup;
1292 if (!PyArg_ParseTuple(_args, "s#O&O&",
1293 &inTextPtr__in__, &inTextPtr__in_len__,
1294 OptResObj_Convert, &inStyles,
1295 OptResObj_Convert, &inSoup))
1296 return NULL;
1297 inTextPtr__len__ = inTextPtr__in_len__;
1298 _err = WEInsert(inTextPtr__in__, inTextPtr__len__,
1299 inStyles,
1300 inSoup,
1301 _self->ob_itself);
1302 if (_err != noErr) return PyMac_Error(_err);
1303 Py_INCREF(Py_None);
1304 _res = Py_None;
1305 return _res;
1308 static PyObject *wasteObj_WEInsertFormattedText(wasteObject *_self, PyObject *_args)
1310 PyObject *_res = NULL;
1311 OSErr _err;
1312 char *inTextPtr__in__;
1313 long inTextPtr__len__;
1314 int inTextPtr__in_len__;
1315 StScrpHandle inStyles;
1316 WESoupHandle inSoup;
1317 Handle inParaFormat;
1318 Handle inRulerScrap;
1319 if (!PyArg_ParseTuple(_args, "s#O&O&O&O&",
1320 &inTextPtr__in__, &inTextPtr__in_len__,
1321 OptResObj_Convert, &inStyles,
1322 OptResObj_Convert, &inSoup,
1323 ResObj_Convert, &inParaFormat,
1324 ResObj_Convert, &inRulerScrap))
1325 return NULL;
1326 inTextPtr__len__ = inTextPtr__in_len__;
1327 _err = WEInsertFormattedText(inTextPtr__in__, inTextPtr__len__,
1328 inStyles,
1329 inSoup,
1330 inParaFormat,
1331 inRulerScrap,
1332 _self->ob_itself);
1333 if (_err != noErr) return PyMac_Error(_err);
1334 Py_INCREF(Py_None);
1335 _res = Py_None;
1336 return _res;
1339 static PyObject *wasteObj_WEDelete(wasteObject *_self, PyObject *_args)
1341 PyObject *_res = NULL;
1342 OSErr _err;
1343 if (!PyArg_ParseTuple(_args, ""))
1344 return NULL;
1345 _err = WEDelete(_self->ob_itself);
1346 if (_err != noErr) return PyMac_Error(_err);
1347 Py_INCREF(Py_None);
1348 _res = Py_None;
1349 return _res;
1352 static PyObject *wasteObj_WEUseText(wasteObject *_self, PyObject *_args)
1354 PyObject *_res = NULL;
1355 OSErr _err;
1356 Handle inText;
1357 if (!PyArg_ParseTuple(_args, "O&",
1358 ResObj_Convert, &inText))
1359 return NULL;
1360 _err = WEUseText(inText,
1361 _self->ob_itself);
1362 if (_err != noErr) return PyMac_Error(_err);
1363 Py_INCREF(Py_None);
1364 _res = Py_None;
1365 return _res;
1368 static PyObject *wasteObj_WEChangeCase(wasteObject *_self, PyObject *_args)
1370 PyObject *_res = NULL;
1371 OSErr _err;
1372 SInt16 inCase;
1373 if (!PyArg_ParseTuple(_args, "h",
1374 &inCase))
1375 return NULL;
1376 _err = WEChangeCase(inCase,
1377 _self->ob_itself);
1378 if (_err != noErr) return PyMac_Error(_err);
1379 Py_INCREF(Py_None);
1380 _res = Py_None;
1381 return _res;
1384 static PyObject *wasteObj_WESetOneAttribute(wasteObject *_self, PyObject *_args)
1386 PyObject *_res = NULL;
1387 OSErr _err;
1388 SInt32 inRangeStart;
1389 SInt32 inRangeEnd;
1390 WESelector inAttributeSelector;
1391 char *inAttributeValue__in__;
1392 long inAttributeValue__len__;
1393 int inAttributeValue__in_len__;
1394 if (!PyArg_ParseTuple(_args, "llO&s#",
1395 &inRangeStart,
1396 &inRangeEnd,
1397 PyMac_GetOSType, &inAttributeSelector,
1398 &inAttributeValue__in__, &inAttributeValue__in_len__))
1399 return NULL;
1400 inAttributeValue__len__ = inAttributeValue__in_len__;
1401 _err = WESetOneAttribute(inRangeStart,
1402 inRangeEnd,
1403 inAttributeSelector,
1404 inAttributeValue__in__, inAttributeValue__len__,
1405 _self->ob_itself);
1406 if (_err != noErr) return PyMac_Error(_err);
1407 Py_INCREF(Py_None);
1408 _res = Py_None;
1409 return _res;
1412 static PyObject *wasteObj_WESetStyle(wasteObject *_self, PyObject *_args)
1414 PyObject *_res = NULL;
1415 OSErr _err;
1416 WEStyleMode inMode;
1417 TextStyle inTextStyle;
1418 if (!PyArg_ParseTuple(_args, "HO&",
1419 &inMode,
1420 TextStyle_Convert, &inTextStyle))
1421 return NULL;
1422 _err = WESetStyle(inMode,
1423 &inTextStyle,
1424 _self->ob_itself);
1425 if (_err != noErr) return PyMac_Error(_err);
1426 Py_INCREF(Py_None);
1427 _res = Py_None;
1428 return _res;
1431 static PyObject *wasteObj_WEUseStyleScrap(wasteObject *_self, PyObject *_args)
1433 PyObject *_res = NULL;
1434 OSErr _err;
1435 StScrpHandle inStyles;
1436 if (!PyArg_ParseTuple(_args, "O&",
1437 ResObj_Convert, &inStyles))
1438 return NULL;
1439 _err = WEUseStyleScrap(inStyles,
1440 _self->ob_itself);
1441 if (_err != noErr) return PyMac_Error(_err);
1442 Py_INCREF(Py_None);
1443 _res = Py_None;
1444 return _res;
1447 static PyObject *wasteObj_WEUndo(wasteObject *_self, PyObject *_args)
1449 PyObject *_res = NULL;
1450 OSErr _err;
1451 if (!PyArg_ParseTuple(_args, ""))
1452 return NULL;
1453 _err = WEUndo(_self->ob_itself);
1454 if (_err != noErr) return PyMac_Error(_err);
1455 Py_INCREF(Py_None);
1456 _res = Py_None;
1457 return _res;
1460 static PyObject *wasteObj_WERedo(wasteObject *_self, PyObject *_args)
1462 PyObject *_res = NULL;
1463 OSErr _err;
1464 if (!PyArg_ParseTuple(_args, ""))
1465 return NULL;
1466 _err = WERedo(_self->ob_itself);
1467 if (_err != noErr) return PyMac_Error(_err);
1468 Py_INCREF(Py_None);
1469 _res = Py_None;
1470 return _res;
1473 static PyObject *wasteObj_WEClearUndo(wasteObject *_self, PyObject *_args)
1475 PyObject *_res = NULL;
1476 if (!PyArg_ParseTuple(_args, ""))
1477 return NULL;
1478 WEClearUndo(_self->ob_itself);
1479 Py_INCREF(Py_None);
1480 _res = Py_None;
1481 return _res;
1484 static PyObject *wasteObj_WEGetUndoInfo(wasteObject *_self, PyObject *_args)
1486 PyObject *_res = NULL;
1487 WEActionKind _rv;
1488 Boolean outRedoFlag;
1489 if (!PyArg_ParseTuple(_args, ""))
1490 return NULL;
1491 _rv = WEGetUndoInfo(&outRedoFlag,
1492 _self->ob_itself);
1493 _res = Py_BuildValue("hb",
1494 _rv,
1495 outRedoFlag);
1496 return _res;
1499 static PyObject *wasteObj_WEGetIndUndoInfo(wasteObject *_self, PyObject *_args)
1501 PyObject *_res = NULL;
1502 WEActionKind _rv;
1503 SInt32 inUndoLevel;
1504 if (!PyArg_ParseTuple(_args, "l",
1505 &inUndoLevel))
1506 return NULL;
1507 _rv = WEGetIndUndoInfo(inUndoLevel,
1508 _self->ob_itself);
1509 _res = Py_BuildValue("h",
1510 _rv);
1511 return _res;
1514 static PyObject *wasteObj_WEIsTyping(wasteObject *_self, PyObject *_args)
1516 PyObject *_res = NULL;
1517 Boolean _rv;
1518 if (!PyArg_ParseTuple(_args, ""))
1519 return NULL;
1520 _rv = WEIsTyping(_self->ob_itself);
1521 _res = Py_BuildValue("b",
1522 _rv);
1523 return _res;
1526 static PyObject *wasteObj_WEBeginAction(wasteObject *_self, PyObject *_args)
1528 PyObject *_res = NULL;
1529 OSErr _err;
1530 if (!PyArg_ParseTuple(_args, ""))
1531 return NULL;
1532 _err = WEBeginAction(_self->ob_itself);
1533 if (_err != noErr) return PyMac_Error(_err);
1534 Py_INCREF(Py_None);
1535 _res = Py_None;
1536 return _res;
1539 static PyObject *wasteObj_WEEndAction(wasteObject *_self, PyObject *_args)
1541 PyObject *_res = NULL;
1542 OSErr _err;
1543 WEActionKind inActionKind;
1544 if (!PyArg_ParseTuple(_args, "h",
1545 &inActionKind))
1546 return NULL;
1547 _err = WEEndAction(inActionKind,
1548 _self->ob_itself);
1549 if (_err != noErr) return PyMac_Error(_err);
1550 Py_INCREF(Py_None);
1551 _res = Py_None;
1552 return _res;
1555 static PyObject *wasteObj_WEGetModCount(wasteObject *_self, PyObject *_args)
1557 PyObject *_res = NULL;
1558 UInt32 _rv;
1559 if (!PyArg_ParseTuple(_args, ""))
1560 return NULL;
1561 _rv = WEGetModCount(_self->ob_itself);
1562 _res = Py_BuildValue("l",
1563 _rv);
1564 return _res;
1567 static PyObject *wasteObj_WEResetModCount(wasteObject *_self, PyObject *_args)
1569 PyObject *_res = NULL;
1570 if (!PyArg_ParseTuple(_args, ""))
1571 return NULL;
1572 WEResetModCount(_self->ob_itself);
1573 Py_INCREF(Py_None);
1574 _res = Py_None;
1575 return _res;
1578 static PyObject *wasteObj_WEInsertObject(wasteObject *_self, PyObject *_args)
1580 PyObject *_res = NULL;
1581 OSErr _err;
1582 FlavorType inObjectType;
1583 Handle inObjectDataHandle;
1584 Point inObjectSize;
1585 if (!PyArg_ParseTuple(_args, "O&O&O&",
1586 PyMac_GetOSType, &inObjectType,
1587 ResObj_Convert, &inObjectDataHandle,
1588 PyMac_GetPoint, &inObjectSize))
1589 return NULL;
1590 _err = WEInsertObject(inObjectType,
1591 inObjectDataHandle,
1592 inObjectSize,
1593 _self->ob_itself);
1594 if (_err != noErr) return PyMac_Error(_err);
1595 Py_INCREF(Py_None);
1596 _res = Py_None;
1597 return _res;
1600 static PyObject *wasteObj_WEGetSelectedObject(wasteObject *_self, PyObject *_args)
1602 PyObject *_res = NULL;
1603 OSErr _err;
1604 WEObjectReference outObject;
1605 if (!PyArg_ParseTuple(_args, ""))
1606 return NULL;
1607 _err = WEGetSelectedObject(&outObject,
1608 _self->ob_itself);
1609 if (_err != noErr) return PyMac_Error(_err);
1610 _res = Py_BuildValue("O&",
1611 WEOObj_New, outObject);
1612 return _res;
1615 static PyObject *wasteObj_WEGetObjectAtOffset(wasteObject *_self, PyObject *_args)
1617 PyObject *_res = NULL;
1618 OSErr _err;
1619 SInt32 inOffset;
1620 WEObjectReference outObject;
1621 if (!PyArg_ParseTuple(_args, "l",
1622 &inOffset))
1623 return NULL;
1624 _err = WEGetObjectAtOffset(inOffset,
1625 &outObject,
1626 _self->ob_itself);
1627 if (_err != noErr) return PyMac_Error(_err);
1628 _res = Py_BuildValue("O&",
1629 WEOObj_New, outObject);
1630 return _res;
1633 static PyObject *wasteObj_WEFindNextObject(wasteObject *_self, PyObject *_args)
1635 PyObject *_res = NULL;
1636 SInt32 _rv;
1637 SInt32 inOffset;
1638 WEObjectReference outObject;
1639 if (!PyArg_ParseTuple(_args, "l",
1640 &inOffset))
1641 return NULL;
1642 _rv = WEFindNextObject(inOffset,
1643 &outObject,
1644 _self->ob_itself);
1645 _res = Py_BuildValue("lO&",
1646 _rv,
1647 WEOObj_New, outObject);
1648 return _res;
1651 static PyObject *wasteObj_WEUseSoup(wasteObject *_self, PyObject *_args)
1653 PyObject *_res = NULL;
1654 OSErr _err;
1655 WESoupHandle inSoup;
1656 if (!PyArg_ParseTuple(_args, "O&",
1657 ResObj_Convert, &inSoup))
1658 return NULL;
1659 _err = WEUseSoup(inSoup,
1660 _self->ob_itself);
1661 if (_err != noErr) return PyMac_Error(_err);
1662 Py_INCREF(Py_None);
1663 _res = Py_None;
1664 return _res;
1667 static PyObject *wasteObj_WECut(wasteObject *_self, PyObject *_args)
1669 PyObject *_res = NULL;
1670 OSErr _err;
1671 if (!PyArg_ParseTuple(_args, ""))
1672 return NULL;
1673 _err = WECut(_self->ob_itself);
1674 if (_err != noErr) return PyMac_Error(_err);
1675 Py_INCREF(Py_None);
1676 _res = Py_None;
1677 return _res;
1680 static PyObject *wasteObj_WECopy(wasteObject *_self, PyObject *_args)
1682 PyObject *_res = NULL;
1683 OSErr _err;
1684 if (!PyArg_ParseTuple(_args, ""))
1685 return NULL;
1686 _err = WECopy(_self->ob_itself);
1687 if (_err != noErr) return PyMac_Error(_err);
1688 Py_INCREF(Py_None);
1689 _res = Py_None;
1690 return _res;
1693 static PyObject *wasteObj_WEPaste(wasteObject *_self, PyObject *_args)
1695 PyObject *_res = NULL;
1696 OSErr _err;
1697 if (!PyArg_ParseTuple(_args, ""))
1698 return NULL;
1699 _err = WEPaste(_self->ob_itself);
1700 if (_err != noErr) return PyMac_Error(_err);
1701 Py_INCREF(Py_None);
1702 _res = Py_None;
1703 return _res;
1706 static PyObject *wasteObj_WECanPaste(wasteObject *_self, PyObject *_args)
1708 PyObject *_res = NULL;
1709 Boolean _rv;
1710 if (!PyArg_ParseTuple(_args, ""))
1711 return NULL;
1712 _rv = WECanPaste(_self->ob_itself);
1713 _res = Py_BuildValue("b",
1714 _rv);
1715 return _res;
1718 static PyObject *wasteObj_WEGetHiliteRgn(wasteObject *_self, PyObject *_args)
1720 PyObject *_res = NULL;
1721 RgnHandle _rv;
1722 SInt32 inRangeStart;
1723 SInt32 inRangeEnd;
1724 if (!PyArg_ParseTuple(_args, "ll",
1725 &inRangeStart,
1726 &inRangeEnd))
1727 return NULL;
1728 _rv = WEGetHiliteRgn(inRangeStart,
1729 inRangeEnd,
1730 _self->ob_itself);
1731 _res = Py_BuildValue("O&",
1732 ResObj_New, _rv);
1733 return _res;
1736 static PyObject *wasteObj_WECharByte(wasteObject *_self, PyObject *_args)
1738 PyObject *_res = NULL;
1739 SInt16 _rv;
1740 SInt32 inOffset;
1741 if (!PyArg_ParseTuple(_args, "l",
1742 &inOffset))
1743 return NULL;
1744 _rv = WECharByte(inOffset,
1745 _self->ob_itself);
1746 _res = Py_BuildValue("h",
1747 _rv);
1748 return _res;
1751 static PyObject *wasteObj_WECharType(wasteObject *_self, PyObject *_args)
1753 PyObject *_res = NULL;
1754 SInt16 _rv;
1755 SInt32 inOffset;
1756 if (!PyArg_ParseTuple(_args, "l",
1757 &inOffset))
1758 return NULL;
1759 _rv = WECharType(inOffset,
1760 _self->ob_itself);
1761 _res = Py_BuildValue("h",
1762 _rv);
1763 return _res;
1766 static PyObject *wasteObj_WEStopInlineSession(wasteObject *_self, PyObject *_args)
1768 PyObject *_res = NULL;
1769 if (!PyArg_ParseTuple(_args, ""))
1770 return NULL;
1771 WEStopInlineSession(_self->ob_itself);
1772 Py_INCREF(Py_None);
1773 _res = Py_None;
1774 return _res;
1777 static PyObject *wasteObj_WEFeatureFlag(wasteObject *_self, PyObject *_args)
1779 PyObject *_res = NULL;
1780 SInt16 _rv;
1781 SInt16 inFeature;
1782 SInt16 inAction;
1783 if (!PyArg_ParseTuple(_args, "hh",
1784 &inFeature,
1785 &inAction))
1786 return NULL;
1787 _rv = WEFeatureFlag(inFeature,
1788 inAction,
1789 _self->ob_itself);
1790 _res = Py_BuildValue("h",
1791 _rv);
1792 return _res;
1795 static PyObject *wasteObj_WEGetUserInfo(wasteObject *_self, PyObject *_args)
1797 PyObject *_res = NULL;
1798 OSErr _err;
1799 WESelector inUserTag;
1800 SInt32 outUserInfo;
1801 if (!PyArg_ParseTuple(_args, "O&",
1802 PyMac_GetOSType, &inUserTag))
1803 return NULL;
1804 _err = WEGetUserInfo(inUserTag,
1805 &outUserInfo,
1806 _self->ob_itself);
1807 if (_err != noErr) return PyMac_Error(_err);
1808 _res = Py_BuildValue("l",
1809 outUserInfo);
1810 return _res;
1813 static PyObject *wasteObj_WESetUserInfo(wasteObject *_self, PyObject *_args)
1815 PyObject *_res = NULL;
1816 OSErr _err;
1817 WESelector inUserTag;
1818 SInt32 inUserInfo;
1819 if (!PyArg_ParseTuple(_args, "O&l",
1820 PyMac_GetOSType, &inUserTag,
1821 &inUserInfo))
1822 return NULL;
1823 _err = WESetUserInfo(inUserTag,
1824 inUserInfo,
1825 _self->ob_itself);
1826 if (_err != noErr) return PyMac_Error(_err);
1827 Py_INCREF(Py_None);
1828 _res = Py_None;
1829 return _res;
1832 static PyObject *wasteObj_WERemoveUserInfo(wasteObject *_self, PyObject *_args)
1834 PyObject *_res = NULL;
1835 OSErr _err;
1836 WESelector inUserTag;
1837 if (!PyArg_ParseTuple(_args, "O&",
1838 PyMac_GetOSType, &inUserTag))
1839 return NULL;
1840 _err = WERemoveUserInfo(inUserTag,
1841 _self->ob_itself);
1842 if (_err != noErr) return PyMac_Error(_err);
1843 Py_INCREF(Py_None);
1844 _res = Py_None;
1845 return _res;
1848 static PyObject *wasteObj_WEInstallTabHooks(wasteObject *_self, PyObject *_args)
1850 PyObject *_res = NULL;
1851 OSErr _err;
1852 if (!PyArg_ParseTuple(_args, ""))
1853 return NULL;
1854 _err = WEInstallTabHooks(_self->ob_itself);
1855 if (_err != noErr) return PyMac_Error(_err);
1856 Py_INCREF(Py_None);
1857 _res = Py_None;
1858 return _res;
1861 static PyObject *wasteObj_WERemoveTabHooks(wasteObject *_self, PyObject *_args)
1863 PyObject *_res = NULL;
1864 OSErr _err;
1865 if (!PyArg_ParseTuple(_args, ""))
1866 return NULL;
1867 _err = WERemoveTabHooks(_self->ob_itself);
1868 if (_err != noErr) return PyMac_Error(_err);
1869 Py_INCREF(Py_None);
1870 _res = Py_None;
1871 return _res;
1874 static PyObject *wasteObj_WEIsTabHooks(wasteObject *_self, PyObject *_args)
1876 PyObject *_res = NULL;
1877 Boolean _rv;
1878 if (!PyArg_ParseTuple(_args, ""))
1879 return NULL;
1880 _rv = WEIsTabHooks(_self->ob_itself);
1881 _res = Py_BuildValue("b",
1882 _rv);
1883 return _res;
1886 static PyObject *wasteObj_WEGetTabSize(wasteObject *_self, PyObject *_args)
1888 PyObject *_res = NULL;
1889 SInt16 _rv;
1890 if (!PyArg_ParseTuple(_args, ""))
1891 return NULL;
1892 _rv = WEGetTabSize(_self->ob_itself);
1893 _res = Py_BuildValue("h",
1894 _rv);
1895 return _res;
1898 static PyObject *wasteObj_WESetTabSize(wasteObject *_self, PyObject *_args)
1900 PyObject *_res = NULL;
1901 OSErr _err;
1902 SInt16 tabWidth;
1903 if (!PyArg_ParseTuple(_args, "h",
1904 &tabWidth))
1905 return NULL;
1906 _err = WESetTabSize(tabWidth,
1907 _self->ob_itself);
1908 if (_err != noErr) return PyMac_Error(_err);
1909 Py_INCREF(Py_None);
1910 _res = Py_None;
1911 return _res;
1914 static PyMethodDef wasteObj_methods[] = {
1915 {"WEGetText", (PyCFunction)wasteObj_WEGetText, 1,
1916 PyDoc_STR("() -> (Handle _rv)")},
1917 {"WEGetChar", (PyCFunction)wasteObj_WEGetChar, 1,
1918 PyDoc_STR("(SInt32 inOffset) -> (SInt16 _rv)")},
1919 {"WEGetTextLength", (PyCFunction)wasteObj_WEGetTextLength, 1,
1920 PyDoc_STR("() -> (SInt32 _rv)")},
1921 {"WEGetSelection", (PyCFunction)wasteObj_WEGetSelection, 1,
1922 PyDoc_STR("() -> (SInt32 outSelStart, SInt32 outSelEnd)")},
1923 {"WEGetDestRect", (PyCFunction)wasteObj_WEGetDestRect, 1,
1924 PyDoc_STR("() -> (LongRect outDestRect)")},
1925 {"WEGetViewRect", (PyCFunction)wasteObj_WEGetViewRect, 1,
1926 PyDoc_STR("() -> (LongRect outViewRect)")},
1927 {"WEIsActive", (PyCFunction)wasteObj_WEIsActive, 1,
1928 PyDoc_STR("() -> (Boolean _rv)")},
1929 {"WEGetClickCount", (PyCFunction)wasteObj_WEGetClickCount, 1,
1930 PyDoc_STR("() -> (UInt16 _rv)")},
1931 {"WESetSelection", (PyCFunction)wasteObj_WESetSelection, 1,
1932 PyDoc_STR("(SInt32 inSelStart, SInt32 inSelEnd) -> None")},
1933 {"WESetDestRect", (PyCFunction)wasteObj_WESetDestRect, 1,
1934 PyDoc_STR("(LongRect inDestRect) -> None")},
1935 {"WESetViewRect", (PyCFunction)wasteObj_WESetViewRect, 1,
1936 PyDoc_STR("(LongRect inViewRect) -> None")},
1937 {"WEContinuousStyle", (PyCFunction)wasteObj_WEContinuousStyle, 1,
1938 PyDoc_STR("(WEStyleMode ioMode) -> (Boolean _rv, WEStyleMode ioMode, TextStyle outTextStyle)")},
1939 {"WECountRuns", (PyCFunction)wasteObj_WECountRuns, 1,
1940 PyDoc_STR("() -> (SInt32 _rv)")},
1941 {"WEOffsetToRun", (PyCFunction)wasteObj_WEOffsetToRun, 1,
1942 PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv)")},
1943 {"WEGetRunRange", (PyCFunction)wasteObj_WEGetRunRange, 1,
1944 PyDoc_STR("(SInt32 inStyleRunIndex) -> (SInt32 outStyleRunStart, SInt32 outStyleRunEnd)")},
1945 {"WEGetRunInfo", (PyCFunction)wasteObj_WEGetRunInfo, 1,
1946 PyDoc_STR("(SInt32 inOffset) -> (WERunInfo outStyleRunInfo)")},
1947 {"WEGetIndRunInfo", (PyCFunction)wasteObj_WEGetIndRunInfo, 1,
1948 PyDoc_STR("(SInt32 inStyleRunIndex) -> (WERunInfo outStyleRunInfo)")},
1949 {"WEGetRunDirection", (PyCFunction)wasteObj_WEGetRunDirection, 1,
1950 PyDoc_STR("(SInt32 inOffset) -> (Boolean _rv)")},
1951 {"WECountParaRuns", (PyCFunction)wasteObj_WECountParaRuns, 1,
1952 PyDoc_STR("() -> (SInt32 _rv)")},
1953 {"WEOffsetToParaRun", (PyCFunction)wasteObj_WEOffsetToParaRun, 1,
1954 PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv)")},
1955 {"WEGetParaRunRange", (PyCFunction)wasteObj_WEGetParaRunRange, 1,
1956 PyDoc_STR("(SInt32 inParagraphRunIndex) -> (SInt32 outParagraphRunStart, SInt32 outParagraphRunEnd)")},
1957 {"WECountLines", (PyCFunction)wasteObj_WECountLines, 1,
1958 PyDoc_STR("() -> (SInt32 _rv)")},
1959 {"WEOffsetToLine", (PyCFunction)wasteObj_WEOffsetToLine, 1,
1960 PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv)")},
1961 {"WEGetLineRange", (PyCFunction)wasteObj_WEGetLineRange, 1,
1962 PyDoc_STR("(SInt32 inLineIndex) -> (SInt32 outLineStart, SInt32 outLineEnd)")},
1963 {"WEGetHeight", (PyCFunction)wasteObj_WEGetHeight, 1,
1964 PyDoc_STR("(SInt32 inStartLineIndex, SInt32 inEndLineIndex) -> (SInt32 _rv)")},
1965 {"WEGetOffset", (PyCFunction)wasteObj_WEGetOffset, 1,
1966 PyDoc_STR("(LongPt inPoint) -> (SInt32 _rv, WEEdge outEdge)")},
1967 {"WEGetPoint", (PyCFunction)wasteObj_WEGetPoint, 1,
1968 PyDoc_STR("(SInt32 inOffset, SInt16 inDirection) -> (LongPt outPoint, SInt16 outLineHeight)")},
1969 {"WEFindWord", (PyCFunction)wasteObj_WEFindWord, 1,
1970 PyDoc_STR("(SInt32 inOffset, WEEdge inEdge) -> (SInt32 outWordStart, SInt32 outWordEnd)")},
1971 {"WEFindLine", (PyCFunction)wasteObj_WEFindLine, 1,
1972 PyDoc_STR("(SInt32 inOffset, WEEdge inEdge) -> (SInt32 outLineStart, SInt32 outLineEnd)")},
1973 {"WEFindParagraph", (PyCFunction)wasteObj_WEFindParagraph, 1,
1974 PyDoc_STR("(SInt32 inOffset, WEEdge inEdge) -> (SInt32 outParagraphStart, SInt32 outParagraphEnd)")},
1975 {"WEFind", (PyCFunction)wasteObj_WEFind, 1,
1976 PyDoc_STR("(char* inKey, SInt32 inKeyLength, TextEncoding inKeyEncoding, OptionBits inMatchOptions, SInt32 inRangeStart, SInt32 inRangeEnd) -> (SInt32 outMatchStart, SInt32 outMatchEnd)")},
1977 {"WEStreamRange", (PyCFunction)wasteObj_WEStreamRange, 1,
1978 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd, FlavorType inRequestedType, OptionBits inStreamOptions, Handle outData) -> None")},
1979 {"WECopyRange", (PyCFunction)wasteObj_WECopyRange, 1,
1980 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd, Handle outText, StScrpHandle outStyles, WESoupHandle outSoup) -> None")},
1981 {"WEGetTextRangeAsUnicode", (PyCFunction)wasteObj_WEGetTextRangeAsUnicode, 1,
1982 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd, Handle outUnicodeText, Handle ioCharFormat, Handle ioParaFormat, TextEncodingVariant inUnicodeVariant, TextEncodingFormat inTransformationFormat, OptionBits inGetOptions) -> None")},
1983 {"WEGetAlignment", (PyCFunction)wasteObj_WEGetAlignment, 1,
1984 PyDoc_STR("() -> (WEAlignment _rv)")},
1985 {"WESetAlignment", (PyCFunction)wasteObj_WESetAlignment, 1,
1986 PyDoc_STR("(WEAlignment inAlignment) -> None")},
1987 {"WEGetDirection", (PyCFunction)wasteObj_WEGetDirection, 1,
1988 PyDoc_STR("() -> (WEDirection _rv)")},
1989 {"WESetDirection", (PyCFunction)wasteObj_WESetDirection, 1,
1990 PyDoc_STR("(WEDirection inDirection) -> None")},
1991 {"WECalText", (PyCFunction)wasteObj_WECalText, 1,
1992 PyDoc_STR("() -> None")},
1993 {"WEUpdate", (PyCFunction)wasteObj_WEUpdate, 1,
1994 PyDoc_STR("(RgnHandle inUpdateRgn) -> None")},
1995 {"WEScroll", (PyCFunction)wasteObj_WEScroll, 1,
1996 PyDoc_STR("(SInt32 inHorizontalOffset, SInt32 inVerticalOffset) -> None")},
1997 {"WEPinScroll", (PyCFunction)wasteObj_WEPinScroll, 1,
1998 PyDoc_STR("(SInt32 inHorizontalOffset, SInt32 inVerticalOffset) -> None")},
1999 {"WESelView", (PyCFunction)wasteObj_WESelView, 1,
2000 PyDoc_STR("() -> None")},
2001 {"WEActivate", (PyCFunction)wasteObj_WEActivate, 1,
2002 PyDoc_STR("() -> None")},
2003 {"WEDeactivate", (PyCFunction)wasteObj_WEDeactivate, 1,
2004 PyDoc_STR("() -> None")},
2005 {"WEKey", (PyCFunction)wasteObj_WEKey, 1,
2006 PyDoc_STR("(CharParameter inKey, EventModifiers inModifiers) -> None")},
2007 {"WEClick", (PyCFunction)wasteObj_WEClick, 1,
2008 PyDoc_STR("(Point inHitPoint, EventModifiers inModifiers, UInt32 inClickTime) -> None")},
2009 {"WEAdjustCursor", (PyCFunction)wasteObj_WEAdjustCursor, 1,
2010 PyDoc_STR("(Point inMouseLoc, RgnHandle ioMouseRgn) -> (Boolean _rv)")},
2011 {"WEIdle", (PyCFunction)wasteObj_WEIdle, 1,
2012 PyDoc_STR("() -> (UInt32 outMaxSleep)")},
2013 {"WEInsert", (PyCFunction)wasteObj_WEInsert, 1,
2014 PyDoc_STR("(Buffer inTextPtr, StScrpHandle inStyles, WESoupHandle inSoup) -> None")},
2015 {"WEInsertFormattedText", (PyCFunction)wasteObj_WEInsertFormattedText, 1,
2016 PyDoc_STR("(Buffer inTextPtr, StScrpHandle inStyles, WESoupHandle inSoup, Handle inParaFormat, Handle inRulerScrap) -> None")},
2017 {"WEDelete", (PyCFunction)wasteObj_WEDelete, 1,
2018 PyDoc_STR("() -> None")},
2019 {"WEUseText", (PyCFunction)wasteObj_WEUseText, 1,
2020 PyDoc_STR("(Handle inText) -> None")},
2021 {"WEChangeCase", (PyCFunction)wasteObj_WEChangeCase, 1,
2022 PyDoc_STR("(SInt16 inCase) -> None")},
2023 {"WESetOneAttribute", (PyCFunction)wasteObj_WESetOneAttribute, 1,
2024 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd, WESelector inAttributeSelector, Buffer inAttributeValue) -> None")},
2025 {"WESetStyle", (PyCFunction)wasteObj_WESetStyle, 1,
2026 PyDoc_STR("(WEStyleMode inMode, TextStyle inTextStyle) -> None")},
2027 {"WEUseStyleScrap", (PyCFunction)wasteObj_WEUseStyleScrap, 1,
2028 PyDoc_STR("(StScrpHandle inStyles) -> None")},
2029 {"WEUndo", (PyCFunction)wasteObj_WEUndo, 1,
2030 PyDoc_STR("() -> None")},
2031 {"WERedo", (PyCFunction)wasteObj_WERedo, 1,
2032 PyDoc_STR("() -> None")},
2033 {"WEClearUndo", (PyCFunction)wasteObj_WEClearUndo, 1,
2034 PyDoc_STR("() -> None")},
2035 {"WEGetUndoInfo", (PyCFunction)wasteObj_WEGetUndoInfo, 1,
2036 PyDoc_STR("() -> (WEActionKind _rv, Boolean outRedoFlag)")},
2037 {"WEGetIndUndoInfo", (PyCFunction)wasteObj_WEGetIndUndoInfo, 1,
2038 PyDoc_STR("(SInt32 inUndoLevel) -> (WEActionKind _rv)")},
2039 {"WEIsTyping", (PyCFunction)wasteObj_WEIsTyping, 1,
2040 PyDoc_STR("() -> (Boolean _rv)")},
2041 {"WEBeginAction", (PyCFunction)wasteObj_WEBeginAction, 1,
2042 PyDoc_STR("() -> None")},
2043 {"WEEndAction", (PyCFunction)wasteObj_WEEndAction, 1,
2044 PyDoc_STR("(WEActionKind inActionKind) -> None")},
2045 {"WEGetModCount", (PyCFunction)wasteObj_WEGetModCount, 1,
2046 PyDoc_STR("() -> (UInt32 _rv)")},
2047 {"WEResetModCount", (PyCFunction)wasteObj_WEResetModCount, 1,
2048 PyDoc_STR("() -> None")},
2049 {"WEInsertObject", (PyCFunction)wasteObj_WEInsertObject, 1,
2050 PyDoc_STR("(FlavorType inObjectType, Handle inObjectDataHandle, Point inObjectSize) -> None")},
2051 {"WEGetSelectedObject", (PyCFunction)wasteObj_WEGetSelectedObject, 1,
2052 PyDoc_STR("() -> (WEObjectReference outObject)")},
2053 {"WEGetObjectAtOffset", (PyCFunction)wasteObj_WEGetObjectAtOffset, 1,
2054 PyDoc_STR("(SInt32 inOffset) -> (WEObjectReference outObject)")},
2055 {"WEFindNextObject", (PyCFunction)wasteObj_WEFindNextObject, 1,
2056 PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv, WEObjectReference outObject)")},
2057 {"WEUseSoup", (PyCFunction)wasteObj_WEUseSoup, 1,
2058 PyDoc_STR("(WESoupHandle inSoup) -> None")},
2059 {"WECut", (PyCFunction)wasteObj_WECut, 1,
2060 PyDoc_STR("() -> None")},
2061 {"WECopy", (PyCFunction)wasteObj_WECopy, 1,
2062 PyDoc_STR("() -> None")},
2063 {"WEPaste", (PyCFunction)wasteObj_WEPaste, 1,
2064 PyDoc_STR("() -> None")},
2065 {"WECanPaste", (PyCFunction)wasteObj_WECanPaste, 1,
2066 PyDoc_STR("() -> (Boolean _rv)")},
2067 {"WEGetHiliteRgn", (PyCFunction)wasteObj_WEGetHiliteRgn, 1,
2068 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd) -> (RgnHandle _rv)")},
2069 {"WECharByte", (PyCFunction)wasteObj_WECharByte, 1,
2070 PyDoc_STR("(SInt32 inOffset) -> (SInt16 _rv)")},
2071 {"WECharType", (PyCFunction)wasteObj_WECharType, 1,
2072 PyDoc_STR("(SInt32 inOffset) -> (SInt16 _rv)")},
2073 {"WEStopInlineSession", (PyCFunction)wasteObj_WEStopInlineSession, 1,
2074 PyDoc_STR("() -> None")},
2075 {"WEFeatureFlag", (PyCFunction)wasteObj_WEFeatureFlag, 1,
2076 PyDoc_STR("(SInt16 inFeature, SInt16 inAction) -> (SInt16 _rv)")},
2077 {"WEGetUserInfo", (PyCFunction)wasteObj_WEGetUserInfo, 1,
2078 PyDoc_STR("(WESelector inUserTag) -> (SInt32 outUserInfo)")},
2079 {"WESetUserInfo", (PyCFunction)wasteObj_WESetUserInfo, 1,
2080 PyDoc_STR("(WESelector inUserTag, SInt32 inUserInfo) -> None")},
2081 {"WERemoveUserInfo", (PyCFunction)wasteObj_WERemoveUserInfo, 1,
2082 PyDoc_STR("(WESelector inUserTag) -> None")},
2083 {"WEInstallTabHooks", (PyCFunction)wasteObj_WEInstallTabHooks, 1,
2084 PyDoc_STR("() -> None")},
2085 {"WERemoveTabHooks", (PyCFunction)wasteObj_WERemoveTabHooks, 1,
2086 PyDoc_STR("() -> None")},
2087 {"WEIsTabHooks", (PyCFunction)wasteObj_WEIsTabHooks, 1,
2088 PyDoc_STR("() -> (Boolean _rv)")},
2089 {"WEGetTabSize", (PyCFunction)wasteObj_WEGetTabSize, 1,
2090 PyDoc_STR("() -> (SInt16 _rv)")},
2091 {"WESetTabSize", (PyCFunction)wasteObj_WESetTabSize, 1,
2092 PyDoc_STR("(SInt16 tabWidth) -> None")},
2093 {NULL, NULL, 0}
2096 PyMethodChain wasteObj_chain = { wasteObj_methods, NULL };
2098 static PyObject *wasteObj_getattr(wasteObject *self, char *name)
2100 return Py_FindMethodInChain(&wasteObj_chain, (PyObject *)self, name);
2103 #define wasteObj_setattr NULL
2105 #define wasteObj_compare NULL
2107 #define wasteObj_repr NULL
2109 #define wasteObj_hash NULL
2111 PyTypeObject waste_Type = {
2112 PyObject_HEAD_INIT(NULL)
2113 0, /*ob_size*/
2114 "waste.waste", /*tp_name*/
2115 sizeof(wasteObject), /*tp_basicsize*/
2116 0, /*tp_itemsize*/
2117 /* methods */
2118 (destructor) wasteObj_dealloc, /*tp_dealloc*/
2119 0, /*tp_print*/
2120 (getattrfunc) wasteObj_getattr, /*tp_getattr*/
2121 (setattrfunc) wasteObj_setattr, /*tp_setattr*/
2122 (cmpfunc) wasteObj_compare, /*tp_compare*/
2123 (reprfunc) wasteObj_repr, /*tp_repr*/
2124 (PyNumberMethods *)0, /* tp_as_number */
2125 (PySequenceMethods *)0, /* tp_as_sequence */
2126 (PyMappingMethods *)0, /* tp_as_mapping */
2127 (hashfunc) wasteObj_hash, /*tp_hash*/
2130 /* --------------------- End object type waste ---------------------- */
2133 static PyObject *waste_WENew(PyObject *_self, PyObject *_args)
2135 PyObject *_res = NULL;
2136 OSErr _err;
2137 LongRect inDestRect;
2138 LongRect inViewRect;
2139 OptionBits inOptions;
2140 WEReference outWE;
2141 if (!PyArg_ParseTuple(_args, "O&O&l",
2142 LongRect_Convert, &inDestRect,
2143 LongRect_Convert, &inViewRect,
2144 &inOptions))
2145 return NULL;
2146 _err = WENew(&inDestRect,
2147 &inViewRect,
2148 inOptions,
2149 &outWE);
2150 if (_err != noErr) return PyMac_Error(_err);
2151 _res = Py_BuildValue("O&",
2152 wasteObj_New, outWE);
2153 return _res;
2156 static PyObject *waste_WEUpdateStyleScrap(PyObject *_self, PyObject *_args)
2158 PyObject *_res = NULL;
2159 OSErr _err;
2160 StScrpHandle ioStyles;
2161 WEFontTableHandle inFontTable;
2162 if (!PyArg_ParseTuple(_args, "O&O&",
2163 ResObj_Convert, &ioStyles,
2164 ResObj_Convert, &inFontTable))
2165 return NULL;
2166 _err = WEUpdateStyleScrap(ioStyles,
2167 inFontTable);
2168 if (_err != noErr) return PyMac_Error(_err);
2169 Py_INCREF(Py_None);
2170 _res = Py_None;
2171 return _res;
2174 static PyObject *waste_WEInstallTSMHandlers(PyObject *_self, PyObject *_args)
2176 PyObject *_res = NULL;
2177 OSErr _err;
2178 if (!PyArg_ParseTuple(_args, ""))
2179 return NULL;
2180 _err = WEInstallTSMHandlers();
2181 if (_err != noErr) return PyMac_Error(_err);
2182 Py_INCREF(Py_None);
2183 _res = Py_None;
2184 return _res;
2187 static PyObject *waste_WERemoveTSMHandlers(PyObject *_self, PyObject *_args)
2189 PyObject *_res = NULL;
2190 OSErr _err;
2191 if (!PyArg_ParseTuple(_args, ""))
2192 return NULL;
2193 _err = WERemoveTSMHandlers();
2194 if (_err != noErr) return PyMac_Error(_err);
2195 Py_INCREF(Py_None);
2196 _res = Py_None;
2197 return _res;
2200 static PyObject *waste_WEHandleTSMEvent(PyObject *_self, PyObject *_args)
2202 PyObject *_res = NULL;
2203 OSErr _err;
2204 AppleEvent inAppleEvent;
2205 AppleEvent ioReply;
2206 if (!PyArg_ParseTuple(_args, "O&",
2207 AEDesc_Convert, &inAppleEvent))
2208 return NULL;
2209 _err = WEHandleTSMEvent(&inAppleEvent,
2210 &ioReply);
2211 if (_err != noErr) return PyMac_Error(_err);
2212 _res = Py_BuildValue("O&",
2213 AEDesc_New, &ioReply);
2214 return _res;
2217 static PyObject *waste_WELongPointToPoint(PyObject *_self, PyObject *_args)
2219 PyObject *_res = NULL;
2220 LongPt inLongPoint;
2221 Point outPoint;
2222 if (!PyArg_ParseTuple(_args, "O&",
2223 LongPt_Convert, &inLongPoint))
2224 return NULL;
2225 WELongPointToPoint(&inLongPoint,
2226 &outPoint);
2227 _res = Py_BuildValue("O&",
2228 PyMac_BuildPoint, outPoint);
2229 return _res;
2232 static PyObject *waste_WEPointToLongPoint(PyObject *_self, PyObject *_args)
2234 PyObject *_res = NULL;
2235 Point inPoint;
2236 LongPt outLongPoint;
2237 if (!PyArg_ParseTuple(_args, "O&",
2238 PyMac_GetPoint, &inPoint))
2239 return NULL;
2240 WEPointToLongPoint(inPoint,
2241 &outLongPoint);
2242 _res = Py_BuildValue("O&",
2243 LongPt_New, &outLongPoint);
2244 return _res;
2247 static PyObject *waste_WESetLongRect(PyObject *_self, PyObject *_args)
2249 PyObject *_res = NULL;
2250 LongRect outLongRect;
2251 SInt32 inLeft;
2252 SInt32 inTop;
2253 SInt32 inRight;
2254 SInt32 inBottom;
2255 if (!PyArg_ParseTuple(_args, "llll",
2256 &inLeft,
2257 &inTop,
2258 &inRight,
2259 &inBottom))
2260 return NULL;
2261 WESetLongRect(&outLongRect,
2262 inLeft,
2263 inTop,
2264 inRight,
2265 inBottom);
2266 _res = Py_BuildValue("O&",
2267 LongRect_New, &outLongRect);
2268 return _res;
2271 static PyObject *waste_WELongRectToRect(PyObject *_self, PyObject *_args)
2273 PyObject *_res = NULL;
2274 LongRect inLongRect;
2275 Rect outRect;
2276 if (!PyArg_ParseTuple(_args, "O&",
2277 LongRect_Convert, &inLongRect))
2278 return NULL;
2279 WELongRectToRect(&inLongRect,
2280 &outRect);
2281 _res = Py_BuildValue("O&",
2282 PyMac_BuildRect, &outRect);
2283 return _res;
2286 static PyObject *waste_WERectToLongRect(PyObject *_self, PyObject *_args)
2288 PyObject *_res = NULL;
2289 Rect inRect;
2290 LongRect outLongRect;
2291 if (!PyArg_ParseTuple(_args, "O&",
2292 PyMac_GetRect, &inRect))
2293 return NULL;
2294 WERectToLongRect(&inRect,
2295 &outLongRect);
2296 _res = Py_BuildValue("O&",
2297 LongRect_New, &outLongRect);
2298 return _res;
2301 static PyObject *waste_WEOffsetLongRect(PyObject *_self, PyObject *_args)
2303 PyObject *_res = NULL;
2304 LongRect ioLongRect;
2305 SInt32 inHorizontalOffset;
2306 SInt32 inVerticalOffset;
2307 if (!PyArg_ParseTuple(_args, "ll",
2308 &inHorizontalOffset,
2309 &inVerticalOffset))
2310 return NULL;
2311 WEOffsetLongRect(&ioLongRect,
2312 inHorizontalOffset,
2313 inVerticalOffset);
2314 _res = Py_BuildValue("O&",
2315 LongRect_New, &ioLongRect);
2316 return _res;
2319 static PyObject *waste_WELongPointInLongRect(PyObject *_self, PyObject *_args)
2321 PyObject *_res = NULL;
2322 Boolean _rv;
2323 LongPt inLongPoint;
2324 LongRect inLongRect;
2325 if (!PyArg_ParseTuple(_args, "O&O&",
2326 LongPt_Convert, &inLongPoint,
2327 LongRect_Convert, &inLongRect))
2328 return NULL;
2329 _rv = WELongPointInLongRect(&inLongPoint,
2330 &inLongRect);
2331 _res = Py_BuildValue("b",
2332 _rv);
2333 return _res;
2336 static PyObject *waste_STDObjectHandlers(PyObject *_self, PyObject *_args)
2338 PyObject *_res = NULL;
2340 OSErr err;
2341 // install the sample object handlers for pictures and sounds
2342 #define kTypePicture 'PICT'
2343 #define kTypeSound 'snd '
2345 if ( !PyArg_ParseTuple(_args, "") ) return NULL;
2347 if ((err = WEInstallObjectHandler(kTypePicture, weNewHandler,
2348 (UniversalProcPtr) NewWENewObjectProc(HandleNewPicture), NULL)) != noErr)
2349 goto cleanup;
2351 if ((err = WEInstallObjectHandler(kTypePicture, weDisposeHandler,
2352 (UniversalProcPtr) NewWEDisposeObjectProc(HandleDisposePicture), NULL)) != noErr)
2353 goto cleanup;
2355 if ((err = WEInstallObjectHandler(kTypePicture, weDrawHandler,
2356 (UniversalProcPtr) NewWEDrawObjectProc(HandleDrawPicture), NULL)) != noErr)
2357 goto cleanup;
2359 if ((err = WEInstallObjectHandler(kTypeSound, weNewHandler,
2360 (UniversalProcPtr) NewWENewObjectProc(HandleNewSound), NULL)) != noErr)
2361 goto cleanup;
2363 if ((err = WEInstallObjectHandler(kTypeSound, weDrawHandler,
2364 (UniversalProcPtr) NewWEDrawObjectProc(HandleDrawSound), NULL)) != noErr)
2365 goto cleanup;
2367 if ((err = WEInstallObjectHandler(kTypeSound, weClickHandler,
2368 (UniversalProcPtr) NewWEClickObjectProc(HandleClickSound), NULL)) != noErr)
2369 goto cleanup;
2370 Py_INCREF(Py_None);
2371 return Py_None;
2373 cleanup:
2374 return PyMac_Error(err);
2378 static PyObject *waste_WEInstallObjectHandler(PyObject *_self, PyObject *_args)
2380 PyObject *_res = NULL;
2382 OSErr err;
2383 FlavorType objectType;
2384 WESelector selector;
2385 PyObject *py_handler;
2386 UniversalProcPtr handler;
2387 WEReference we = NULL;
2388 PyObject *key;
2391 if ( !PyArg_ParseTuple(_args, "O&O&O|O&",
2392 PyMac_GetOSType, &objectType,
2393 PyMac_GetOSType, &selector,
2394 &py_handler,
2395 WEOObj_Convert, &we) ) return NULL;
2397 if ( selector == weNewHandler ) handler = (UniversalProcPtr)upp_new_handler;
2398 else if ( selector == weDisposeHandler ) handler = (UniversalProcPtr)upp_dispose_handler;
2399 else if ( selector == weDrawHandler ) handler = (UniversalProcPtr)upp_draw_handler;
2400 else if ( selector == weClickHandler ) handler = (UniversalProcPtr)upp_click_handler;
2401 else return PyMac_Error(weUndefinedSelectorErr);
2403 if ((key = Py_BuildValue("O&O&",
2404 PyMac_BuildOSType, objectType,
2405 PyMac_BuildOSType, selector)) == NULL )
2406 return NULL;
2408 PyDict_SetItem(callbackdict, key, py_handler);
2410 err = WEInstallObjectHandler(objectType, selector, handler, we);
2411 if ( err ) return PyMac_Error(err);
2412 Py_INCREF(Py_None);
2413 return Py_None;
2417 static PyMethodDef waste_methods[] = {
2418 {"WENew", (PyCFunction)waste_WENew, 1,
2419 PyDoc_STR("(LongRect inDestRect, LongRect inViewRect, OptionBits inOptions) -> (WEReference outWE)")},
2420 {"WEUpdateStyleScrap", (PyCFunction)waste_WEUpdateStyleScrap, 1,
2421 PyDoc_STR("(StScrpHandle ioStyles, WEFontTableHandle inFontTable) -> None")},
2422 {"WEInstallTSMHandlers", (PyCFunction)waste_WEInstallTSMHandlers, 1,
2423 PyDoc_STR("() -> None")},
2424 {"WERemoveTSMHandlers", (PyCFunction)waste_WERemoveTSMHandlers, 1,
2425 PyDoc_STR("() -> None")},
2426 {"WEHandleTSMEvent", (PyCFunction)waste_WEHandleTSMEvent, 1,
2427 PyDoc_STR("(AppleEvent inAppleEvent) -> (AppleEvent ioReply)")},
2428 {"WELongPointToPoint", (PyCFunction)waste_WELongPointToPoint, 1,
2429 PyDoc_STR("(LongPt inLongPoint) -> (Point outPoint)")},
2430 {"WEPointToLongPoint", (PyCFunction)waste_WEPointToLongPoint, 1,
2431 PyDoc_STR("(Point inPoint) -> (LongPt outLongPoint)")},
2432 {"WESetLongRect", (PyCFunction)waste_WESetLongRect, 1,
2433 PyDoc_STR("(SInt32 inLeft, SInt32 inTop, SInt32 inRight, SInt32 inBottom) -> (LongRect outLongRect)")},
2434 {"WELongRectToRect", (PyCFunction)waste_WELongRectToRect, 1,
2435 PyDoc_STR("(LongRect inLongRect) -> (Rect outRect)")},
2436 {"WERectToLongRect", (PyCFunction)waste_WERectToLongRect, 1,
2437 PyDoc_STR("(Rect inRect) -> (LongRect outLongRect)")},
2438 {"WEOffsetLongRect", (PyCFunction)waste_WEOffsetLongRect, 1,
2439 PyDoc_STR("(SInt32 inHorizontalOffset, SInt32 inVerticalOffset) -> (LongRect ioLongRect)")},
2440 {"WELongPointInLongRect", (PyCFunction)waste_WELongPointInLongRect, 1,
2441 PyDoc_STR("(LongPt inLongPoint, LongRect inLongRect) -> (Boolean _rv)")},
2442 {"STDObjectHandlers", (PyCFunction)waste_STDObjectHandlers, 1,
2443 PyDoc_STR(NULL)},
2444 {"WEInstallObjectHandler", (PyCFunction)waste_WEInstallObjectHandler, 1,
2445 PyDoc_STR(NULL)},
2446 {NULL, NULL, 0}
2451 /* Return the object corresponding to the window, or NULL */
2453 PyObject *
2454 ExistingwasteObj_New(w)
2455 WEReference w;
2457 PyObject *it = NULL;
2459 if (w == NULL)
2460 it = NULL;
2461 else
2462 WEGetInfo(weRefCon, (void *)&it, w);
2463 if (it == NULL || ((wasteObject *)it)->ob_itself != w)
2464 it = Py_None;
2465 Py_INCREF(it);
2466 return it;
2470 void initwaste(void)
2472 PyObject *m;
2473 PyObject *d;
2478 m = Py_InitModule("waste", waste_methods);
2479 d = PyModule_GetDict(m);
2480 waste_Error = PyMac_GetOSErrException();
2481 if (waste_Error == NULL ||
2482 PyDict_SetItemString(d, "Error", waste_Error) != 0)
2483 return;
2484 WEO_Type.ob_type = &PyType_Type;
2485 Py_INCREF(&WEO_Type);
2486 if (PyDict_SetItemString(d, "WEOType", (PyObject *)&WEO_Type) != 0)
2487 Py_FatalError("can't initialize WEOType");
2488 waste_Type.ob_type = &PyType_Type;
2489 Py_INCREF(&waste_Type);
2490 if (PyDict_SetItemString(d, "wasteType", (PyObject *)&waste_Type) != 0)
2491 Py_FatalError("can't initialize wasteType");
2493 callbackdict = PyDict_New();
2494 if (callbackdict == NULL || PyDict_SetItemString(d, "callbacks", callbackdict) != 0)
2495 return;
2496 upp_new_handler = NewWENewObjectProc(my_new_handler);
2497 upp_dispose_handler = NewWEDisposeObjectProc(my_dispose_handler);
2498 upp_draw_handler = NewWEDrawObjectProc(my_draw_handler);
2499 upp_click_handler = NewWEClickObjectProc(my_click_handler);
2504 /* ======================== End module waste ======================== */