2 /* ========================== Module waste ========================== */
9 #include "pywintoolbox.h"
12 #include "pymactoolbox.h"
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"); \
24 #include <WEObjectHandlers.h>
27 #define PyDoc_STR(x) (x)
30 /* Exported by Qdmodule.c: */
31 extern PyObject
*QdRGB_New(RGBColor
*);
32 extern int QdRGB_Convert(PyObject
*, RGBColor
*);
34 /* Exported by AEModule.c: */
35 extern PyObject
*AEDesc_New(AppleEvent
*);
36 extern int AEDesc_Convert(PyObject
*, AppleEvent
*);
38 /* Forward declaration */
39 static PyObject
*WEOObj_New(WEObjectReference
);
40 static PyObject
*ExistingwasteObj_New(WEReference
);
43 ** Parse/generate TextStyle records
46 TextStyle_New(TextStylePtr itself
)
49 return Py_BuildValue("lllO&", (long)itself
->tsFont
, (long)itself
->tsFace
, (long)itself
->tsSize
, QdRGB_New
,
54 TextStyle_Convert(PyObject
*v
, TextStylePtr p_itself
)
56 long font
, face
, size
;
58 if( !PyArg_ParseTuple(v
, "lllO&", &font
, &face
, &size
, QdRGB_Convert
, &p_itself
->tsColor
) )
60 p_itself
->tsFont
= (short)font
;
61 p_itself
->tsFace
= (Style
)face
;
62 p_itself
->tsSize
= (short)size
;
67 ** Parse/generate RunInfo records
70 RunInfo_New(WERunInfo
*itself
)
73 return Py_BuildValue("llhhO&O&", itself
->runStart
, itself
->runEnd
, itself
->runHeight
,
74 itself
->runAscent
, TextStyle_New
, &itself
->runStyle
, WEOObj_New
, itself
->runObject
);
77 /* Conversion of long points and rects */
79 LongRect_Convert(PyObject
*v
, LongRect
*r
)
81 return PyArg_Parse(v
, "(llll)", &r
->left
, &r
->top
, &r
->right
, &r
->bottom
);
85 LongRect_New(LongRect
*r
)
87 return Py_BuildValue("(llll)", r
->left
, r
->top
, r
->right
, r
->bottom
);
91 LongPt_Convert(PyObject
*v
, LongPt
*p
)
93 return PyArg_Parse(v
, "(ll)", &p
->h
, &p
->v
);
99 return Py_BuildValue("(ll)", p
->h
, p
->v
);
102 /* Stuff for the callbacks: */
103 static PyObject
*callbackdict
;
104 WENewObjectUPP upp_new_handler
;
105 WEDisposeObjectUPP upp_dispose_handler
;
106 WEDrawObjectUPP upp_draw_handler
;
107 WEClickObjectUPP upp_click_handler
;
110 any_handler(WESelector what
, WEObjectReference who
, PyObject
*args
, PyObject
**rv
)
113 PyObject
*key
, *func
;
115 if ( args
== NULL
) return errAECorruptData
;
117 tp
= WEGetObjectType(who
);
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
) {
123 return errAEHandlerNotFound
;
126 *rv
= PyEval_CallObject(func
, args
);
130 PySys_WriteStderr("--Exception in callback: ");
132 return errAEReplyNotArrived
;
138 my_new_handler(Point
*objectSize
, WEObjectReference objref
)
140 PyObject
*args
=NULL
, *rv
=NULL
;
143 args
=Py_BuildValue("(O&)", WEOObj_New
, objref
);
144 err
= any_handler(weNewHandler
, objref
, args
, &rv
);
146 if (!PyMac_GetPoint(rv
, objectSize
) )
147 err
= errAECoercionFail
;
159 my_dispose_handler(WEObjectReference objref
)
161 PyObject
*args
=NULL
, *rv
=NULL
;
164 args
=Py_BuildValue("(O&)", WEOObj_New
, objref
);
165 err
= any_handler(weDisposeHandler
, objref
, args
, &rv
);
176 my_draw_handler(const Rect
*destRect
, WEObjectReference objref
)
178 PyObject
*args
=NULL
, *rv
=NULL
;
181 args
=Py_BuildValue("O&O&", PyMac_BuildRect
, destRect
, WEOObj_New
, objref
);
182 err
= any_handler(weDrawHandler
, objref
, args
, &rv
);
192 static pascal Boolean
193 my_click_handler(Point hitPt
, EventModifiers modifiers
,
194 unsigned long clickTime
, WEObjectReference objref
)
196 PyObject
*args
=NULL
, *rv
=NULL
;
200 args
=Py_BuildValue("O&llO&", PyMac_BuildPoint
, hitPt
,
201 (long)modifiers
, (long)clickTime
, WEOObj_New
, objref
);
202 err
= any_handler(weClickHandler
, objref
, args
, &rv
);
204 retvalue
= PyInt_AsLong(rv
);
218 static PyObject
*waste_Error
;
220 /* ------------------------ Object type WEO ------------------------- */
222 PyTypeObject WEO_Type
;
224 #define WEOObj_Check(x) ((x)->ob_type == &WEO_Type || PyObject_TypeCheck((x), &WEO_Type))
226 typedef struct WEOObject
{
228 WEObjectReference ob_itself
;
231 PyObject
*WEOObj_New(WEObjectReference itself
)
234 if (itself
== NULL
) {
238 it
= PyObject_NEW(WEOObject
, &WEO_Type
);
239 if (it
== NULL
) return NULL
;
240 it
->ob_itself
= itself
;
241 return (PyObject
*)it
;
243 int WEOObj_Convert(PyObject
*v
, WEObjectReference
*p_itself
)
245 if (!WEOObj_Check(v
))
247 PyErr_SetString(PyExc_TypeError
, "WEO required");
250 *p_itself
= ((WEOObject
*)v
)->ob_itself
;
254 static void WEOObj_dealloc(WEOObject
*self
)
256 /* Cleanup of self->ob_itself goes here */
257 self
->ob_type
->tp_free((PyObject
*)self
);
260 static PyObject
*WEOObj_WEGetObjectType(WEOObject
*_self
, PyObject
*_args
)
262 PyObject
*_res
= NULL
;
264 if (!PyArg_ParseTuple(_args
, ""))
266 _rv
= WEGetObjectType(_self
->ob_itself
);
267 _res
= Py_BuildValue("O&",
268 PyMac_BuildOSType
, _rv
);
272 static PyObject
*WEOObj_WEGetObjectDataHandle(WEOObject
*_self
, PyObject
*_args
)
274 PyObject
*_res
= NULL
;
276 if (!PyArg_ParseTuple(_args
, ""))
278 _rv
= WEGetObjectDataHandle(_self
->ob_itself
);
279 _res
= Py_BuildValue("O&",
284 static PyObject
*WEOObj_WEGetObjectOwner(WEOObject
*_self
, PyObject
*_args
)
286 PyObject
*_res
= NULL
;
288 if (!PyArg_ParseTuple(_args
, ""))
290 _rv
= WEGetObjectOwner(_self
->ob_itself
);
291 _res
= Py_BuildValue("O&",
292 ExistingwasteObj_New
, _rv
);
296 static PyObject
*WEOObj_WEGetObjectOffset(WEOObject
*_self
, PyObject
*_args
)
298 PyObject
*_res
= NULL
;
300 if (!PyArg_ParseTuple(_args
, ""))
302 _rv
= WEGetObjectOffset(_self
->ob_itself
);
303 _res
= Py_BuildValue("l",
308 static PyObject
*WEOObj_WEGetObjectSize(WEOObject
*_self
, PyObject
*_args
)
310 PyObject
*_res
= NULL
;
312 if (!PyArg_ParseTuple(_args
, ""))
314 _rv
= WEGetObjectSize(_self
->ob_itself
);
315 _res
= Py_BuildValue("O&",
316 PyMac_BuildPoint
, _rv
);
320 static PyObject
*WEOObj_WESetObjectSize(WEOObject
*_self
, PyObject
*_args
)
322 PyObject
*_res
= NULL
;
325 if (!PyArg_ParseTuple(_args
, "O&",
326 PyMac_GetPoint
, &inObjectSize
))
328 _err
= WESetObjectSize(_self
->ob_itself
,
330 if (_err
!= noErr
) return PyMac_Error(_err
);
336 static PyObject
*WEOObj_WEGetObjectFrame(WEOObject
*_self
, PyObject
*_args
)
338 PyObject
*_res
= NULL
;
340 LongRect outObjectFrame
;
341 if (!PyArg_ParseTuple(_args
, ""))
343 _err
= WEGetObjectFrame(_self
->ob_itself
,
345 if (_err
!= noErr
) return PyMac_Error(_err
);
346 _res
= Py_BuildValue("O&",
347 LongRect_New
, &outObjectFrame
);
351 static PyObject
*WEOObj_WEGetObjectRefCon(WEOObject
*_self
, PyObject
*_args
)
353 PyObject
*_res
= NULL
;
355 if (!PyArg_ParseTuple(_args
, ""))
357 _rv
= WEGetObjectRefCon(_self
->ob_itself
);
358 _res
= Py_BuildValue("l",
363 static PyObject
*WEOObj_WESetObjectRefCon(WEOObject
*_self
, PyObject
*_args
)
365 PyObject
*_res
= NULL
;
367 if (!PyArg_ParseTuple(_args
, "l",
370 WESetObjectRefCon(_self
->ob_itself
,
377 static PyMethodDef WEOObj_methods
[] = {
378 {"WEGetObjectType", (PyCFunction
)WEOObj_WEGetObjectType
, 1,
379 PyDoc_STR("() -> (FlavorType _rv)")},
380 {"WEGetObjectDataHandle", (PyCFunction
)WEOObj_WEGetObjectDataHandle
, 1,
381 PyDoc_STR("() -> (Handle _rv)")},
382 {"WEGetObjectOwner", (PyCFunction
)WEOObj_WEGetObjectOwner
, 1,
383 PyDoc_STR("() -> (WEReference _rv)")},
384 {"WEGetObjectOffset", (PyCFunction
)WEOObj_WEGetObjectOffset
, 1,
385 PyDoc_STR("() -> (SInt32 _rv)")},
386 {"WEGetObjectSize", (PyCFunction
)WEOObj_WEGetObjectSize
, 1,
387 PyDoc_STR("() -> (Point _rv)")},
388 {"WESetObjectSize", (PyCFunction
)WEOObj_WESetObjectSize
, 1,
389 PyDoc_STR("(Point inObjectSize) -> None")},
390 {"WEGetObjectFrame", (PyCFunction
)WEOObj_WEGetObjectFrame
, 1,
391 PyDoc_STR("() -> (LongRect outObjectFrame)")},
392 {"WEGetObjectRefCon", (PyCFunction
)WEOObj_WEGetObjectRefCon
, 1,
393 PyDoc_STR("() -> (SInt32 _rv)")},
394 {"WESetObjectRefCon", (PyCFunction
)WEOObj_WESetObjectRefCon
, 1,
395 PyDoc_STR("(SInt32 inRefCon) -> None")},
399 #define WEOObj_getsetlist NULL
402 #define WEOObj_compare NULL
404 #define WEOObj_repr NULL
406 #define WEOObj_hash NULL
407 #define WEOObj_tp_init 0
409 #define WEOObj_tp_alloc PyType_GenericAlloc
411 static PyObject
*WEOObj_tp_new(PyTypeObject
*type
, PyObject
*args
, PyObject
*kwds
)
414 WEObjectReference itself
;
415 char *kw
[] = {"itself", 0};
417 if (!PyArg_ParseTupleAndKeywords(args
, kwds
, "O&", kw
, WEOObj_Convert
, &itself
)) return NULL
;
418 if ((self
= type
->tp_alloc(type
, 0)) == NULL
) return NULL
;
419 ((WEOObject
*)self
)->ob_itself
= itself
;
423 #define WEOObj_tp_free PyObject_Del
426 PyTypeObject WEO_Type
= {
427 PyObject_HEAD_INIT(NULL
)
429 "waste.WEO", /*tp_name*/
430 sizeof(WEOObject
), /*tp_basicsize*/
433 (destructor
) WEOObj_dealloc
, /*tp_dealloc*/
435 (getattrfunc
)0, /*tp_getattr*/
436 (setattrfunc
)0, /*tp_setattr*/
437 (cmpfunc
) WEOObj_compare
, /*tp_compare*/
438 (reprfunc
) WEOObj_repr
, /*tp_repr*/
439 (PyNumberMethods
*)0, /* tp_as_number */
440 (PySequenceMethods
*)0, /* tp_as_sequence */
441 (PyMappingMethods
*)0, /* tp_as_mapping */
442 (hashfunc
) WEOObj_hash
, /*tp_hash*/
445 PyObject_GenericGetAttr
, /*tp_getattro*/
446 PyObject_GenericSetAttr
, /*tp_setattro */
448 Py_TPFLAGS_DEFAULT
|Py_TPFLAGS_BASETYPE
, /* tp_flags */
452 0, /*tp_richcompare*/
453 0, /*tp_weaklistoffset*/
456 WEOObj_methods
, /* tp_methods */
458 WEOObj_getsetlist
, /*tp_getset*/
464 WEOObj_tp_init
, /* tp_init */
465 WEOObj_tp_alloc
, /* tp_alloc */
466 WEOObj_tp_new
, /* tp_new */
467 WEOObj_tp_free
, /* tp_free */
470 /* ---------------------- End object type WEO ----------------------- */
473 /* ----------------------- Object type waste ------------------------ */
475 PyTypeObject waste_Type
;
477 #define wasteObj_Check(x) ((x)->ob_type == &waste_Type || PyObject_TypeCheck((x), &waste_Type))
479 typedef struct wasteObject
{
481 WEReference ob_itself
;
484 PyObject
*wasteObj_New(WEReference itself
)
487 if (itself
== NULL
) {
488 PyErr_SetString(waste_Error
,"Cannot create null WE");
491 it
= PyObject_NEW(wasteObject
, &waste_Type
);
492 if (it
== NULL
) return NULL
;
493 it
->ob_itself
= itself
;
494 WESetInfo(weRefCon
, (void *)&it
, itself
);
495 return (PyObject
*)it
;
497 int wasteObj_Convert(PyObject
*v
, WEReference
*p_itself
)
499 if (!wasteObj_Check(v
))
501 PyErr_SetString(PyExc_TypeError
, "waste required");
504 *p_itself
= ((wasteObject
*)v
)->ob_itself
;
508 static void wasteObj_dealloc(wasteObject
*self
)
510 WEDispose(self
->ob_itself
);
511 self
->ob_type
->tp_free((PyObject
*)self
);
514 static PyObject
*wasteObj_WEGetText(wasteObject
*_self
, PyObject
*_args
)
516 PyObject
*_res
= NULL
;
518 if (!PyArg_ParseTuple(_args
, ""))
520 _rv
= WEGetText(_self
->ob_itself
);
521 _res
= Py_BuildValue("O&",
526 static PyObject
*wasteObj_WEGetChar(wasteObject
*_self
, PyObject
*_args
)
528 PyObject
*_res
= NULL
;
531 if (!PyArg_ParseTuple(_args
, "l",
534 _rv
= WEGetChar(inOffset
,
536 _res
= Py_BuildValue("h",
541 static PyObject
*wasteObj_WEGetTextLength(wasteObject
*_self
, PyObject
*_args
)
543 PyObject
*_res
= NULL
;
545 if (!PyArg_ParseTuple(_args
, ""))
547 _rv
= WEGetTextLength(_self
->ob_itself
);
548 _res
= Py_BuildValue("l",
553 static PyObject
*wasteObj_WEGetSelection(wasteObject
*_self
, PyObject
*_args
)
555 PyObject
*_res
= NULL
;
558 if (!PyArg_ParseTuple(_args
, ""))
560 WEGetSelection(&outSelStart
,
563 _res
= Py_BuildValue("ll",
569 static PyObject
*wasteObj_WEGetDestRect(wasteObject
*_self
, PyObject
*_args
)
571 PyObject
*_res
= NULL
;
572 LongRect outDestRect
;
573 if (!PyArg_ParseTuple(_args
, ""))
575 WEGetDestRect(&outDestRect
,
577 _res
= Py_BuildValue("O&",
578 LongRect_New
, &outDestRect
);
582 static PyObject
*wasteObj_WEGetViewRect(wasteObject
*_self
, PyObject
*_args
)
584 PyObject
*_res
= NULL
;
585 LongRect outViewRect
;
586 if (!PyArg_ParseTuple(_args
, ""))
588 WEGetViewRect(&outViewRect
,
590 _res
= Py_BuildValue("O&",
591 LongRect_New
, &outViewRect
);
595 static PyObject
*wasteObj_WEIsActive(wasteObject
*_self
, PyObject
*_args
)
597 PyObject
*_res
= NULL
;
599 if (!PyArg_ParseTuple(_args
, ""))
601 _rv
= WEIsActive(_self
->ob_itself
);
602 _res
= Py_BuildValue("b",
607 static PyObject
*wasteObj_WEGetClickCount(wasteObject
*_self
, PyObject
*_args
)
609 PyObject
*_res
= NULL
;
611 if (!PyArg_ParseTuple(_args
, ""))
613 _rv
= WEGetClickCount(_self
->ob_itself
);
614 _res
= Py_BuildValue("H",
619 static PyObject
*wasteObj_WESetSelection(wasteObject
*_self
, PyObject
*_args
)
621 PyObject
*_res
= NULL
;
624 if (!PyArg_ParseTuple(_args
, "ll",
628 WESetSelection(inSelStart
,
636 static PyObject
*wasteObj_WESetDestRect(wasteObject
*_self
, PyObject
*_args
)
638 PyObject
*_res
= NULL
;
640 if (!PyArg_ParseTuple(_args
, "O&",
641 LongRect_Convert
, &inDestRect
))
643 WESetDestRect(&inDestRect
,
650 static PyObject
*wasteObj_WESetViewRect(wasteObject
*_self
, PyObject
*_args
)
652 PyObject
*_res
= NULL
;
654 if (!PyArg_ParseTuple(_args
, "O&",
655 LongRect_Convert
, &inViewRect
))
657 WESetViewRect(&inViewRect
,
664 static PyObject
*wasteObj_WEContinuousStyle(wasteObject
*_self
, PyObject
*_args
)
666 PyObject
*_res
= NULL
;
669 TextStyle outTextStyle
;
670 if (!PyArg_ParseTuple(_args
, "H",
673 _rv
= WEContinuousStyle(&ioMode
,
676 _res
= Py_BuildValue("bHO&",
679 TextStyle_New
, &outTextStyle
);
683 static PyObject
*wasteObj_WECountRuns(wasteObject
*_self
, PyObject
*_args
)
685 PyObject
*_res
= NULL
;
687 if (!PyArg_ParseTuple(_args
, ""))
689 _rv
= WECountRuns(_self
->ob_itself
);
690 _res
= Py_BuildValue("l",
695 static PyObject
*wasteObj_WEOffsetToRun(wasteObject
*_self
, PyObject
*_args
)
697 PyObject
*_res
= NULL
;
700 if (!PyArg_ParseTuple(_args
, "l",
703 _rv
= WEOffsetToRun(inOffset
,
705 _res
= Py_BuildValue("l",
710 static PyObject
*wasteObj_WEGetRunRange(wasteObject
*_self
, PyObject
*_args
)
712 PyObject
*_res
= NULL
;
713 SInt32 inStyleRunIndex
;
714 SInt32 outStyleRunStart
;
715 SInt32 outStyleRunEnd
;
716 if (!PyArg_ParseTuple(_args
, "l",
719 WEGetRunRange(inStyleRunIndex
,
723 _res
= Py_BuildValue("ll",
729 static PyObject
*wasteObj_WEGetRunInfo(wasteObject
*_self
, PyObject
*_args
)
731 PyObject
*_res
= NULL
;
733 WERunInfo outStyleRunInfo
;
734 if (!PyArg_ParseTuple(_args
, "l",
737 WEGetRunInfo(inOffset
,
740 _res
= Py_BuildValue("O&",
741 RunInfo_New
, &outStyleRunInfo
);
745 static PyObject
*wasteObj_WEGetIndRunInfo(wasteObject
*_self
, PyObject
*_args
)
747 PyObject
*_res
= NULL
;
748 SInt32 inStyleRunIndex
;
749 WERunInfo outStyleRunInfo
;
750 if (!PyArg_ParseTuple(_args
, "l",
753 WEGetIndRunInfo(inStyleRunIndex
,
756 _res
= Py_BuildValue("O&",
757 RunInfo_New
, &outStyleRunInfo
);
761 static PyObject
*wasteObj_WEGetRunDirection(wasteObject
*_self
, PyObject
*_args
)
763 PyObject
*_res
= NULL
;
766 if (!PyArg_ParseTuple(_args
, "l",
769 _rv
= WEGetRunDirection(inOffset
,
771 _res
= Py_BuildValue("b",
776 static PyObject
*wasteObj_WECountParaRuns(wasteObject
*_self
, PyObject
*_args
)
778 PyObject
*_res
= NULL
;
780 if (!PyArg_ParseTuple(_args
, ""))
782 _rv
= WECountParaRuns(_self
->ob_itself
);
783 _res
= Py_BuildValue("l",
788 static PyObject
*wasteObj_WEOffsetToParaRun(wasteObject
*_self
, PyObject
*_args
)
790 PyObject
*_res
= NULL
;
793 if (!PyArg_ParseTuple(_args
, "l",
796 _rv
= WEOffsetToParaRun(inOffset
,
798 _res
= Py_BuildValue("l",
803 static PyObject
*wasteObj_WEGetParaRunRange(wasteObject
*_self
, PyObject
*_args
)
805 PyObject
*_res
= NULL
;
806 SInt32 inParagraphRunIndex
;
807 SInt32 outParagraphRunStart
;
808 SInt32 outParagraphRunEnd
;
809 if (!PyArg_ParseTuple(_args
, "l",
810 &inParagraphRunIndex
))
812 WEGetParaRunRange(inParagraphRunIndex
,
813 &outParagraphRunStart
,
816 _res
= Py_BuildValue("ll",
817 outParagraphRunStart
,
822 static PyObject
*wasteObj_WECountLines(wasteObject
*_self
, PyObject
*_args
)
824 PyObject
*_res
= NULL
;
826 if (!PyArg_ParseTuple(_args
, ""))
828 _rv
= WECountLines(_self
->ob_itself
);
829 _res
= Py_BuildValue("l",
834 static PyObject
*wasteObj_WEOffsetToLine(wasteObject
*_self
, PyObject
*_args
)
836 PyObject
*_res
= NULL
;
839 if (!PyArg_ParseTuple(_args
, "l",
842 _rv
= WEOffsetToLine(inOffset
,
844 _res
= Py_BuildValue("l",
849 static PyObject
*wasteObj_WEGetLineRange(wasteObject
*_self
, PyObject
*_args
)
851 PyObject
*_res
= NULL
;
855 if (!PyArg_ParseTuple(_args
, "l",
858 WEGetLineRange(inLineIndex
,
862 _res
= Py_BuildValue("ll",
868 static PyObject
*wasteObj_WEGetHeight(wasteObject
*_self
, PyObject
*_args
)
870 PyObject
*_res
= NULL
;
872 SInt32 inStartLineIndex
;
873 SInt32 inEndLineIndex
;
874 if (!PyArg_ParseTuple(_args
, "ll",
878 _rv
= WEGetHeight(inStartLineIndex
,
881 _res
= Py_BuildValue("l",
886 static PyObject
*wasteObj_WEGetOffset(wasteObject
*_self
, PyObject
*_args
)
888 PyObject
*_res
= NULL
;
892 if (!PyArg_ParseTuple(_args
, "O&",
893 LongPt_Convert
, &inPoint
))
895 _rv
= WEGetOffset(&inPoint
,
898 _res
= Py_BuildValue("lB",
904 static PyObject
*wasteObj_WEGetPoint(wasteObject
*_self
, PyObject
*_args
)
906 PyObject
*_res
= NULL
;
910 SInt16 outLineHeight
;
911 if (!PyArg_ParseTuple(_args
, "lh",
920 _res
= Py_BuildValue("O&h",
921 LongPt_New
, &outPoint
,
926 static PyObject
*wasteObj_WEFindWord(wasteObject
*_self
, PyObject
*_args
)
928 PyObject
*_res
= NULL
;
933 if (!PyArg_ParseTuple(_args
, "lB",
942 _res
= Py_BuildValue("ll",
948 static PyObject
*wasteObj_WEFindLine(wasteObject
*_self
, PyObject
*_args
)
950 PyObject
*_res
= NULL
;
955 if (!PyArg_ParseTuple(_args
, "lB",
964 _res
= Py_BuildValue("ll",
970 static PyObject
*wasteObj_WEFindParagraph(wasteObject
*_self
, PyObject
*_args
)
972 PyObject
*_res
= NULL
;
975 SInt32 outParagraphStart
;
976 SInt32 outParagraphEnd
;
977 if (!PyArg_ParseTuple(_args
, "lB",
981 WEFindParagraph(inOffset
,
986 _res
= Py_BuildValue("ll",
992 static PyObject
*wasteObj_WEFind(wasteObject
*_self
, PyObject
*_args
)
994 PyObject
*_res
= NULL
;
998 TextEncoding inKeyEncoding
;
999 OptionBits inMatchOptions
;
1000 SInt32 inRangeStart
;
1002 SInt32 outMatchStart
;
1004 if (!PyArg_ParseTuple(_args
, "slllll",
1012 _err
= WEFind(inKey
,
1021 if (_err
!= noErr
) return PyMac_Error(_err
);
1022 _res
= Py_BuildValue("ll",
1028 static PyObject
*wasteObj_WEStreamRange(wasteObject
*_self
, PyObject
*_args
)
1030 PyObject
*_res
= NULL
;
1032 SInt32 inRangeStart
;
1034 FlavorType inRequestedType
;
1035 OptionBits inStreamOptions
;
1037 if (!PyArg_ParseTuple(_args
, "llO&lO&",
1040 PyMac_GetOSType
, &inRequestedType
,
1042 ResObj_Convert
, &outData
))
1044 _err
= WEStreamRange(inRangeStart
,
1050 if (_err
!= noErr
) return PyMac_Error(_err
);
1056 static PyObject
*wasteObj_WECopyRange(wasteObject
*_self
, PyObject
*_args
)
1058 PyObject
*_res
= NULL
;
1060 SInt32 inRangeStart
;
1063 StScrpHandle outStyles
;
1064 WESoupHandle outSoup
;
1065 if (!PyArg_ParseTuple(_args
, "llO&O&O&",
1068 OptResObj_Convert
, &outText
,
1069 OptResObj_Convert
, &outStyles
,
1070 OptResObj_Convert
, &outSoup
))
1072 _err
= WECopyRange(inRangeStart
,
1078 if (_err
!= noErr
) return PyMac_Error(_err
);
1084 static PyObject
*wasteObj_WEGetTextRangeAsUnicode(wasteObject
*_self
, PyObject
*_args
)
1086 PyObject
*_res
= NULL
;
1088 SInt32 inRangeStart
;
1090 Handle outUnicodeText
;
1091 Handle ioCharFormat
;
1092 Handle ioParaFormat
;
1093 TextEncodingVariant inUnicodeVariant
;
1094 TextEncodingFormat inTransformationFormat
;
1095 OptionBits inGetOptions
;
1096 if (!PyArg_ParseTuple(_args
, "llO&O&O&lll",
1099 ResObj_Convert
, &outUnicodeText
,
1100 ResObj_Convert
, &ioCharFormat
,
1101 ResObj_Convert
, &ioParaFormat
,
1103 &inTransformationFormat
,
1106 _err
= WEGetTextRangeAsUnicode(inRangeStart
,
1112 inTransformationFormat
,
1115 if (_err
!= noErr
) return PyMac_Error(_err
);
1121 static PyObject
*wasteObj_WEGetAlignment(wasteObject
*_self
, PyObject
*_args
)
1123 PyObject
*_res
= NULL
;
1125 if (!PyArg_ParseTuple(_args
, ""))
1127 _rv
= WEGetAlignment(_self
->ob_itself
);
1128 _res
= Py_BuildValue("B",
1133 static PyObject
*wasteObj_WESetAlignment(wasteObject
*_self
, PyObject
*_args
)
1135 PyObject
*_res
= NULL
;
1136 WEAlignment inAlignment
;
1137 if (!PyArg_ParseTuple(_args
, "B",
1140 WESetAlignment(inAlignment
,
1147 static PyObject
*wasteObj_WEGetDirection(wasteObject
*_self
, PyObject
*_args
)
1149 PyObject
*_res
= NULL
;
1151 if (!PyArg_ParseTuple(_args
, ""))
1153 _rv
= WEGetDirection(_self
->ob_itself
);
1154 _res
= Py_BuildValue("h",
1159 static PyObject
*wasteObj_WESetDirection(wasteObject
*_self
, PyObject
*_args
)
1161 PyObject
*_res
= NULL
;
1162 WEDirection inDirection
;
1163 if (!PyArg_ParseTuple(_args
, "h",
1166 WESetDirection(inDirection
,
1173 static PyObject
*wasteObj_WECalText(wasteObject
*_self
, PyObject
*_args
)
1175 PyObject
*_res
= NULL
;
1177 if (!PyArg_ParseTuple(_args
, ""))
1179 _err
= WECalText(_self
->ob_itself
);
1180 if (_err
!= noErr
) return PyMac_Error(_err
);
1186 static PyObject
*wasteObj_WEUpdate(wasteObject
*_self
, PyObject
*_args
)
1188 PyObject
*_res
= NULL
;
1189 RgnHandle inUpdateRgn
;
1190 if (!PyArg_ParseTuple(_args
, "O&",
1191 ResObj_Convert
, &inUpdateRgn
))
1193 WEUpdate(inUpdateRgn
,
1200 static PyObject
*wasteObj_WEScroll(wasteObject
*_self
, PyObject
*_args
)
1202 PyObject
*_res
= NULL
;
1203 SInt32 inHorizontalOffset
;
1204 SInt32 inVerticalOffset
;
1205 if (!PyArg_ParseTuple(_args
, "ll",
1206 &inHorizontalOffset
,
1209 WEScroll(inHorizontalOffset
,
1217 static PyObject
*wasteObj_WEPinScroll(wasteObject
*_self
, PyObject
*_args
)
1219 PyObject
*_res
= NULL
;
1220 SInt32 inHorizontalOffset
;
1221 SInt32 inVerticalOffset
;
1222 if (!PyArg_ParseTuple(_args
, "ll",
1223 &inHorizontalOffset
,
1226 WEPinScroll(inHorizontalOffset
,
1234 static PyObject
*wasteObj_WESelView(wasteObject
*_self
, PyObject
*_args
)
1236 PyObject
*_res
= NULL
;
1237 if (!PyArg_ParseTuple(_args
, ""))
1239 WESelView(_self
->ob_itself
);
1245 static PyObject
*wasteObj_WEActivate(wasteObject
*_self
, PyObject
*_args
)
1247 PyObject
*_res
= NULL
;
1248 if (!PyArg_ParseTuple(_args
, ""))
1250 WEActivate(_self
->ob_itself
);
1256 static PyObject
*wasteObj_WEDeactivate(wasteObject
*_self
, PyObject
*_args
)
1258 PyObject
*_res
= NULL
;
1259 if (!PyArg_ParseTuple(_args
, ""))
1261 WEDeactivate(_self
->ob_itself
);
1267 static PyObject
*wasteObj_WEKey(wasteObject
*_self
, PyObject
*_args
)
1269 PyObject
*_res
= NULL
;
1270 CharParameter inKey
;
1271 EventModifiers inModifiers
;
1272 if (!PyArg_ParseTuple(_args
, "hH",
1284 static PyObject
*wasteObj_WEClick(wasteObject
*_self
, PyObject
*_args
)
1286 PyObject
*_res
= NULL
;
1288 EventModifiers inModifiers
;
1290 if (!PyArg_ParseTuple(_args
, "O&Hl",
1291 PyMac_GetPoint
, &inHitPoint
,
1304 static PyObject
*wasteObj_WEAdjustCursor(wasteObject
*_self
, PyObject
*_args
)
1306 PyObject
*_res
= NULL
;
1309 RgnHandle ioMouseRgn
;
1310 if (!PyArg_ParseTuple(_args
, "O&O&",
1311 PyMac_GetPoint
, &inMouseLoc
,
1312 ResObj_Convert
, &ioMouseRgn
))
1314 _rv
= WEAdjustCursor(inMouseLoc
,
1317 _res
= Py_BuildValue("b",
1322 static PyObject
*wasteObj_WEIdle(wasteObject
*_self
, PyObject
*_args
)
1324 PyObject
*_res
= NULL
;
1326 if (!PyArg_ParseTuple(_args
, ""))
1328 WEIdle(&outMaxSleep
,
1330 _res
= Py_BuildValue("l",
1335 static PyObject
*wasteObj_WEInsert(wasteObject
*_self
, PyObject
*_args
)
1337 PyObject
*_res
= NULL
;
1339 char *inTextPtr__in__
;
1340 long inTextPtr__len__
;
1341 int inTextPtr__in_len__
;
1342 StScrpHandle inStyles
;
1343 WESoupHandle inSoup
;
1344 if (!PyArg_ParseTuple(_args
, "s#O&O&",
1345 &inTextPtr__in__
, &inTextPtr__in_len__
,
1346 OptResObj_Convert
, &inStyles
,
1347 OptResObj_Convert
, &inSoup
))
1349 inTextPtr__len__
= inTextPtr__in_len__
;
1350 _err
= WEInsert(inTextPtr__in__
, inTextPtr__len__
,
1354 if (_err
!= noErr
) return PyMac_Error(_err
);
1360 static PyObject
*wasteObj_WEInsertFormattedText(wasteObject
*_self
, PyObject
*_args
)
1362 PyObject
*_res
= NULL
;
1364 char *inTextPtr__in__
;
1365 long inTextPtr__len__
;
1366 int inTextPtr__in_len__
;
1367 StScrpHandle inStyles
;
1368 WESoupHandle inSoup
;
1369 Handle inParaFormat
;
1370 Handle inRulerScrap
;
1371 if (!PyArg_ParseTuple(_args
, "s#O&O&O&O&",
1372 &inTextPtr__in__
, &inTextPtr__in_len__
,
1373 OptResObj_Convert
, &inStyles
,
1374 OptResObj_Convert
, &inSoup
,
1375 ResObj_Convert
, &inParaFormat
,
1376 ResObj_Convert
, &inRulerScrap
))
1378 inTextPtr__len__
= inTextPtr__in_len__
;
1379 _err
= WEInsertFormattedText(inTextPtr__in__
, inTextPtr__len__
,
1385 if (_err
!= noErr
) return PyMac_Error(_err
);
1391 static PyObject
*wasteObj_WEDelete(wasteObject
*_self
, PyObject
*_args
)
1393 PyObject
*_res
= NULL
;
1395 if (!PyArg_ParseTuple(_args
, ""))
1397 _err
= WEDelete(_self
->ob_itself
);
1398 if (_err
!= noErr
) return PyMac_Error(_err
);
1404 static PyObject
*wasteObj_WEUseText(wasteObject
*_self
, PyObject
*_args
)
1406 PyObject
*_res
= NULL
;
1409 if (!PyArg_ParseTuple(_args
, "O&",
1410 ResObj_Convert
, &inText
))
1412 _err
= WEUseText(inText
,
1414 if (_err
!= noErr
) return PyMac_Error(_err
);
1420 static PyObject
*wasteObj_WEChangeCase(wasteObject
*_self
, PyObject
*_args
)
1422 PyObject
*_res
= NULL
;
1425 if (!PyArg_ParseTuple(_args
, "h",
1428 _err
= WEChangeCase(inCase
,
1430 if (_err
!= noErr
) return PyMac_Error(_err
);
1436 static PyObject
*wasteObj_WESetOneAttribute(wasteObject
*_self
, PyObject
*_args
)
1438 PyObject
*_res
= NULL
;
1440 SInt32 inRangeStart
;
1442 WESelector inAttributeSelector
;
1443 char *inAttributeValue__in__
;
1444 long inAttributeValue__len__
;
1445 int inAttributeValue__in_len__
;
1446 if (!PyArg_ParseTuple(_args
, "llO&s#",
1449 PyMac_GetOSType
, &inAttributeSelector
,
1450 &inAttributeValue__in__
, &inAttributeValue__in_len__
))
1452 inAttributeValue__len__
= inAttributeValue__in_len__
;
1453 _err
= WESetOneAttribute(inRangeStart
,
1455 inAttributeSelector
,
1456 inAttributeValue__in__
, inAttributeValue__len__
,
1458 if (_err
!= noErr
) return PyMac_Error(_err
);
1464 static PyObject
*wasteObj_WESetStyle(wasteObject
*_self
, PyObject
*_args
)
1466 PyObject
*_res
= NULL
;
1469 TextStyle inTextStyle
;
1470 if (!PyArg_ParseTuple(_args
, "HO&",
1472 TextStyle_Convert
, &inTextStyle
))
1474 _err
= WESetStyle(inMode
,
1477 if (_err
!= noErr
) return PyMac_Error(_err
);
1483 static PyObject
*wasteObj_WEUseStyleScrap(wasteObject
*_self
, PyObject
*_args
)
1485 PyObject
*_res
= NULL
;
1487 StScrpHandle inStyles
;
1488 if (!PyArg_ParseTuple(_args
, "O&",
1489 ResObj_Convert
, &inStyles
))
1491 _err
= WEUseStyleScrap(inStyles
,
1493 if (_err
!= noErr
) return PyMac_Error(_err
);
1499 static PyObject
*wasteObj_WEUndo(wasteObject
*_self
, PyObject
*_args
)
1501 PyObject
*_res
= NULL
;
1503 if (!PyArg_ParseTuple(_args
, ""))
1505 _err
= WEUndo(_self
->ob_itself
);
1506 if (_err
!= noErr
) return PyMac_Error(_err
);
1512 static PyObject
*wasteObj_WERedo(wasteObject
*_self
, PyObject
*_args
)
1514 PyObject
*_res
= NULL
;
1516 if (!PyArg_ParseTuple(_args
, ""))
1518 _err
= WERedo(_self
->ob_itself
);
1519 if (_err
!= noErr
) return PyMac_Error(_err
);
1525 static PyObject
*wasteObj_WEClearUndo(wasteObject
*_self
, PyObject
*_args
)
1527 PyObject
*_res
= NULL
;
1528 if (!PyArg_ParseTuple(_args
, ""))
1530 WEClearUndo(_self
->ob_itself
);
1536 static PyObject
*wasteObj_WEGetUndoInfo(wasteObject
*_self
, PyObject
*_args
)
1538 PyObject
*_res
= NULL
;
1540 Boolean outRedoFlag
;
1541 if (!PyArg_ParseTuple(_args
, ""))
1543 _rv
= WEGetUndoInfo(&outRedoFlag
,
1545 _res
= Py_BuildValue("hb",
1551 static PyObject
*wasteObj_WEGetIndUndoInfo(wasteObject
*_self
, PyObject
*_args
)
1553 PyObject
*_res
= NULL
;
1556 if (!PyArg_ParseTuple(_args
, "l",
1559 _rv
= WEGetIndUndoInfo(inUndoLevel
,
1561 _res
= Py_BuildValue("h",
1566 static PyObject
*wasteObj_WEIsTyping(wasteObject
*_self
, PyObject
*_args
)
1568 PyObject
*_res
= NULL
;
1570 if (!PyArg_ParseTuple(_args
, ""))
1572 _rv
= WEIsTyping(_self
->ob_itself
);
1573 _res
= Py_BuildValue("b",
1578 static PyObject
*wasteObj_WEBeginAction(wasteObject
*_self
, PyObject
*_args
)
1580 PyObject
*_res
= NULL
;
1582 if (!PyArg_ParseTuple(_args
, ""))
1584 _err
= WEBeginAction(_self
->ob_itself
);
1585 if (_err
!= noErr
) return PyMac_Error(_err
);
1591 static PyObject
*wasteObj_WEEndAction(wasteObject
*_self
, PyObject
*_args
)
1593 PyObject
*_res
= NULL
;
1595 WEActionKind inActionKind
;
1596 if (!PyArg_ParseTuple(_args
, "h",
1599 _err
= WEEndAction(inActionKind
,
1601 if (_err
!= noErr
) return PyMac_Error(_err
);
1607 static PyObject
*wasteObj_WEGetModCount(wasteObject
*_self
, PyObject
*_args
)
1609 PyObject
*_res
= NULL
;
1611 if (!PyArg_ParseTuple(_args
, ""))
1613 _rv
= WEGetModCount(_self
->ob_itself
);
1614 _res
= Py_BuildValue("l",
1619 static PyObject
*wasteObj_WEResetModCount(wasteObject
*_self
, PyObject
*_args
)
1621 PyObject
*_res
= NULL
;
1622 if (!PyArg_ParseTuple(_args
, ""))
1624 WEResetModCount(_self
->ob_itself
);
1630 static PyObject
*wasteObj_WEInsertObject(wasteObject
*_self
, PyObject
*_args
)
1632 PyObject
*_res
= NULL
;
1634 FlavorType inObjectType
;
1635 Handle inObjectDataHandle
;
1637 if (!PyArg_ParseTuple(_args
, "O&O&O&",
1638 PyMac_GetOSType
, &inObjectType
,
1639 ResObj_Convert
, &inObjectDataHandle
,
1640 PyMac_GetPoint
, &inObjectSize
))
1642 _err
= WEInsertObject(inObjectType
,
1646 if (_err
!= noErr
) return PyMac_Error(_err
);
1652 static PyObject
*wasteObj_WEGetSelectedObject(wasteObject
*_self
, PyObject
*_args
)
1654 PyObject
*_res
= NULL
;
1656 WEObjectReference outObject
;
1657 if (!PyArg_ParseTuple(_args
, ""))
1659 _err
= WEGetSelectedObject(&outObject
,
1661 if (_err
!= noErr
) return PyMac_Error(_err
);
1662 _res
= Py_BuildValue("O&",
1663 WEOObj_New
, outObject
);
1667 static PyObject
*wasteObj_WEGetObjectAtOffset(wasteObject
*_self
, PyObject
*_args
)
1669 PyObject
*_res
= NULL
;
1672 WEObjectReference outObject
;
1673 if (!PyArg_ParseTuple(_args
, "l",
1676 _err
= WEGetObjectAtOffset(inOffset
,
1679 if (_err
!= noErr
) return PyMac_Error(_err
);
1680 _res
= Py_BuildValue("O&",
1681 WEOObj_New
, outObject
);
1685 static PyObject
*wasteObj_WEFindNextObject(wasteObject
*_self
, PyObject
*_args
)
1687 PyObject
*_res
= NULL
;
1690 WEObjectReference outObject
;
1691 if (!PyArg_ParseTuple(_args
, "l",
1694 _rv
= WEFindNextObject(inOffset
,
1697 _res
= Py_BuildValue("lO&",
1699 WEOObj_New
, outObject
);
1703 static PyObject
*wasteObj_WEUseSoup(wasteObject
*_self
, PyObject
*_args
)
1705 PyObject
*_res
= NULL
;
1707 WESoupHandle inSoup
;
1708 if (!PyArg_ParseTuple(_args
, "O&",
1709 ResObj_Convert
, &inSoup
))
1711 _err
= WEUseSoup(inSoup
,
1713 if (_err
!= noErr
) return PyMac_Error(_err
);
1719 static PyObject
*wasteObj_WECut(wasteObject
*_self
, PyObject
*_args
)
1721 PyObject
*_res
= NULL
;
1723 if (!PyArg_ParseTuple(_args
, ""))
1725 _err
= WECut(_self
->ob_itself
);
1726 if (_err
!= noErr
) return PyMac_Error(_err
);
1732 static PyObject
*wasteObj_WECopy(wasteObject
*_self
, PyObject
*_args
)
1734 PyObject
*_res
= NULL
;
1736 if (!PyArg_ParseTuple(_args
, ""))
1738 _err
= WECopy(_self
->ob_itself
);
1739 if (_err
!= noErr
) return PyMac_Error(_err
);
1745 static PyObject
*wasteObj_WEPaste(wasteObject
*_self
, PyObject
*_args
)
1747 PyObject
*_res
= NULL
;
1749 if (!PyArg_ParseTuple(_args
, ""))
1751 _err
= WEPaste(_self
->ob_itself
);
1752 if (_err
!= noErr
) return PyMac_Error(_err
);
1758 static PyObject
*wasteObj_WECanPaste(wasteObject
*_self
, PyObject
*_args
)
1760 PyObject
*_res
= NULL
;
1762 if (!PyArg_ParseTuple(_args
, ""))
1764 _rv
= WECanPaste(_self
->ob_itself
);
1765 _res
= Py_BuildValue("b",
1770 static PyObject
*wasteObj_WEGetHiliteRgn(wasteObject
*_self
, PyObject
*_args
)
1772 PyObject
*_res
= NULL
;
1774 SInt32 inRangeStart
;
1776 if (!PyArg_ParseTuple(_args
, "ll",
1780 _rv
= WEGetHiliteRgn(inRangeStart
,
1783 _res
= Py_BuildValue("O&",
1788 static PyObject
*wasteObj_WECharByte(wasteObject
*_self
, PyObject
*_args
)
1790 PyObject
*_res
= NULL
;
1793 if (!PyArg_ParseTuple(_args
, "l",
1796 _rv
= WECharByte(inOffset
,
1798 _res
= Py_BuildValue("h",
1803 static PyObject
*wasteObj_WECharType(wasteObject
*_self
, PyObject
*_args
)
1805 PyObject
*_res
= NULL
;
1808 if (!PyArg_ParseTuple(_args
, "l",
1811 _rv
= WECharType(inOffset
,
1813 _res
= Py_BuildValue("h",
1818 static PyObject
*wasteObj_WEStopInlineSession(wasteObject
*_self
, PyObject
*_args
)
1820 PyObject
*_res
= NULL
;
1821 if (!PyArg_ParseTuple(_args
, ""))
1823 WEStopInlineSession(_self
->ob_itself
);
1829 static PyObject
*wasteObj_WEFeatureFlag(wasteObject
*_self
, PyObject
*_args
)
1831 PyObject
*_res
= NULL
;
1835 if (!PyArg_ParseTuple(_args
, "hh",
1839 _rv
= WEFeatureFlag(inFeature
,
1842 _res
= Py_BuildValue("h",
1847 static PyObject
*wasteObj_WEGetUserInfo(wasteObject
*_self
, PyObject
*_args
)
1849 PyObject
*_res
= NULL
;
1851 WESelector inUserTag
;
1853 if (!PyArg_ParseTuple(_args
, "O&",
1854 PyMac_GetOSType
, &inUserTag
))
1856 _err
= WEGetUserInfo(inUserTag
,
1859 if (_err
!= noErr
) return PyMac_Error(_err
);
1860 _res
= Py_BuildValue("l",
1865 static PyObject
*wasteObj_WESetUserInfo(wasteObject
*_self
, PyObject
*_args
)
1867 PyObject
*_res
= NULL
;
1869 WESelector inUserTag
;
1871 if (!PyArg_ParseTuple(_args
, "O&l",
1872 PyMac_GetOSType
, &inUserTag
,
1875 _err
= WESetUserInfo(inUserTag
,
1878 if (_err
!= noErr
) return PyMac_Error(_err
);
1884 static PyObject
*wasteObj_WERemoveUserInfo(wasteObject
*_self
, PyObject
*_args
)
1886 PyObject
*_res
= NULL
;
1888 WESelector inUserTag
;
1889 if (!PyArg_ParseTuple(_args
, "O&",
1890 PyMac_GetOSType
, &inUserTag
))
1892 _err
= WERemoveUserInfo(inUserTag
,
1894 if (_err
!= noErr
) return PyMac_Error(_err
);
1900 static PyObject
*wasteObj_WEInstallTabHooks(wasteObject
*_self
, PyObject
*_args
)
1902 PyObject
*_res
= NULL
;
1904 if (!PyArg_ParseTuple(_args
, ""))
1906 _err
= WEInstallTabHooks(_self
->ob_itself
);
1907 if (_err
!= noErr
) return PyMac_Error(_err
);
1913 static PyObject
*wasteObj_WERemoveTabHooks(wasteObject
*_self
, PyObject
*_args
)
1915 PyObject
*_res
= NULL
;
1917 if (!PyArg_ParseTuple(_args
, ""))
1919 _err
= WERemoveTabHooks(_self
->ob_itself
);
1920 if (_err
!= noErr
) return PyMac_Error(_err
);
1926 static PyObject
*wasteObj_WEIsTabHooks(wasteObject
*_self
, PyObject
*_args
)
1928 PyObject
*_res
= NULL
;
1930 if (!PyArg_ParseTuple(_args
, ""))
1932 _rv
= WEIsTabHooks(_self
->ob_itself
);
1933 _res
= Py_BuildValue("b",
1938 static PyObject
*wasteObj_WEGetTabSize(wasteObject
*_self
, PyObject
*_args
)
1940 PyObject
*_res
= NULL
;
1942 if (!PyArg_ParseTuple(_args
, ""))
1944 _rv
= WEGetTabSize(_self
->ob_itself
);
1945 _res
= Py_BuildValue("h",
1950 static PyObject
*wasteObj_WESetTabSize(wasteObject
*_self
, PyObject
*_args
)
1952 PyObject
*_res
= NULL
;
1955 if (!PyArg_ParseTuple(_args
, "h",
1958 _err
= WESetTabSize(tabWidth
,
1960 if (_err
!= noErr
) return PyMac_Error(_err
);
1966 static PyMethodDef wasteObj_methods
[] = {
1967 {"WEGetText", (PyCFunction
)wasteObj_WEGetText
, 1,
1968 PyDoc_STR("() -> (Handle _rv)")},
1969 {"WEGetChar", (PyCFunction
)wasteObj_WEGetChar
, 1,
1970 PyDoc_STR("(SInt32 inOffset) -> (SInt16 _rv)")},
1971 {"WEGetTextLength", (PyCFunction
)wasteObj_WEGetTextLength
, 1,
1972 PyDoc_STR("() -> (SInt32 _rv)")},
1973 {"WEGetSelection", (PyCFunction
)wasteObj_WEGetSelection
, 1,
1974 PyDoc_STR("() -> (SInt32 outSelStart, SInt32 outSelEnd)")},
1975 {"WEGetDestRect", (PyCFunction
)wasteObj_WEGetDestRect
, 1,
1976 PyDoc_STR("() -> (LongRect outDestRect)")},
1977 {"WEGetViewRect", (PyCFunction
)wasteObj_WEGetViewRect
, 1,
1978 PyDoc_STR("() -> (LongRect outViewRect)")},
1979 {"WEIsActive", (PyCFunction
)wasteObj_WEIsActive
, 1,
1980 PyDoc_STR("() -> (Boolean _rv)")},
1981 {"WEGetClickCount", (PyCFunction
)wasteObj_WEGetClickCount
, 1,
1982 PyDoc_STR("() -> (UInt16 _rv)")},
1983 {"WESetSelection", (PyCFunction
)wasteObj_WESetSelection
, 1,
1984 PyDoc_STR("(SInt32 inSelStart, SInt32 inSelEnd) -> None")},
1985 {"WESetDestRect", (PyCFunction
)wasteObj_WESetDestRect
, 1,
1986 PyDoc_STR("(LongRect inDestRect) -> None")},
1987 {"WESetViewRect", (PyCFunction
)wasteObj_WESetViewRect
, 1,
1988 PyDoc_STR("(LongRect inViewRect) -> None")},
1989 {"WEContinuousStyle", (PyCFunction
)wasteObj_WEContinuousStyle
, 1,
1990 PyDoc_STR("(WEStyleMode ioMode) -> (Boolean _rv, WEStyleMode ioMode, TextStyle outTextStyle)")},
1991 {"WECountRuns", (PyCFunction
)wasteObj_WECountRuns
, 1,
1992 PyDoc_STR("() -> (SInt32 _rv)")},
1993 {"WEOffsetToRun", (PyCFunction
)wasteObj_WEOffsetToRun
, 1,
1994 PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv)")},
1995 {"WEGetRunRange", (PyCFunction
)wasteObj_WEGetRunRange
, 1,
1996 PyDoc_STR("(SInt32 inStyleRunIndex) -> (SInt32 outStyleRunStart, SInt32 outStyleRunEnd)")},
1997 {"WEGetRunInfo", (PyCFunction
)wasteObj_WEGetRunInfo
, 1,
1998 PyDoc_STR("(SInt32 inOffset) -> (WERunInfo outStyleRunInfo)")},
1999 {"WEGetIndRunInfo", (PyCFunction
)wasteObj_WEGetIndRunInfo
, 1,
2000 PyDoc_STR("(SInt32 inStyleRunIndex) -> (WERunInfo outStyleRunInfo)")},
2001 {"WEGetRunDirection", (PyCFunction
)wasteObj_WEGetRunDirection
, 1,
2002 PyDoc_STR("(SInt32 inOffset) -> (Boolean _rv)")},
2003 {"WECountParaRuns", (PyCFunction
)wasteObj_WECountParaRuns
, 1,
2004 PyDoc_STR("() -> (SInt32 _rv)")},
2005 {"WEOffsetToParaRun", (PyCFunction
)wasteObj_WEOffsetToParaRun
, 1,
2006 PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv)")},
2007 {"WEGetParaRunRange", (PyCFunction
)wasteObj_WEGetParaRunRange
, 1,
2008 PyDoc_STR("(SInt32 inParagraphRunIndex) -> (SInt32 outParagraphRunStart, SInt32 outParagraphRunEnd)")},
2009 {"WECountLines", (PyCFunction
)wasteObj_WECountLines
, 1,
2010 PyDoc_STR("() -> (SInt32 _rv)")},
2011 {"WEOffsetToLine", (PyCFunction
)wasteObj_WEOffsetToLine
, 1,
2012 PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv)")},
2013 {"WEGetLineRange", (PyCFunction
)wasteObj_WEGetLineRange
, 1,
2014 PyDoc_STR("(SInt32 inLineIndex) -> (SInt32 outLineStart, SInt32 outLineEnd)")},
2015 {"WEGetHeight", (PyCFunction
)wasteObj_WEGetHeight
, 1,
2016 PyDoc_STR("(SInt32 inStartLineIndex, SInt32 inEndLineIndex) -> (SInt32 _rv)")},
2017 {"WEGetOffset", (PyCFunction
)wasteObj_WEGetOffset
, 1,
2018 PyDoc_STR("(LongPt inPoint) -> (SInt32 _rv, WEEdge outEdge)")},
2019 {"WEGetPoint", (PyCFunction
)wasteObj_WEGetPoint
, 1,
2020 PyDoc_STR("(SInt32 inOffset, SInt16 inDirection) -> (LongPt outPoint, SInt16 outLineHeight)")},
2021 {"WEFindWord", (PyCFunction
)wasteObj_WEFindWord
, 1,
2022 PyDoc_STR("(SInt32 inOffset, WEEdge inEdge) -> (SInt32 outWordStart, SInt32 outWordEnd)")},
2023 {"WEFindLine", (PyCFunction
)wasteObj_WEFindLine
, 1,
2024 PyDoc_STR("(SInt32 inOffset, WEEdge inEdge) -> (SInt32 outLineStart, SInt32 outLineEnd)")},
2025 {"WEFindParagraph", (PyCFunction
)wasteObj_WEFindParagraph
, 1,
2026 PyDoc_STR("(SInt32 inOffset, WEEdge inEdge) -> (SInt32 outParagraphStart, SInt32 outParagraphEnd)")},
2027 {"WEFind", (PyCFunction
)wasteObj_WEFind
, 1,
2028 PyDoc_STR("(char* inKey, SInt32 inKeyLength, TextEncoding inKeyEncoding, OptionBits inMatchOptions, SInt32 inRangeStart, SInt32 inRangeEnd) -> (SInt32 outMatchStart, SInt32 outMatchEnd)")},
2029 {"WEStreamRange", (PyCFunction
)wasteObj_WEStreamRange
, 1,
2030 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd, FlavorType inRequestedType, OptionBits inStreamOptions, Handle outData) -> None")},
2031 {"WECopyRange", (PyCFunction
)wasteObj_WECopyRange
, 1,
2032 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd, Handle outText, StScrpHandle outStyles, WESoupHandle outSoup) -> None")},
2033 {"WEGetTextRangeAsUnicode", (PyCFunction
)wasteObj_WEGetTextRangeAsUnicode
, 1,
2034 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd, Handle outUnicodeText, Handle ioCharFormat, Handle ioParaFormat, TextEncodingVariant inUnicodeVariant, TextEncodingFormat inTransformationFormat, OptionBits inGetOptions) -> None")},
2035 {"WEGetAlignment", (PyCFunction
)wasteObj_WEGetAlignment
, 1,
2036 PyDoc_STR("() -> (WEAlignment _rv)")},
2037 {"WESetAlignment", (PyCFunction
)wasteObj_WESetAlignment
, 1,
2038 PyDoc_STR("(WEAlignment inAlignment) -> None")},
2039 {"WEGetDirection", (PyCFunction
)wasteObj_WEGetDirection
, 1,
2040 PyDoc_STR("() -> (WEDirection _rv)")},
2041 {"WESetDirection", (PyCFunction
)wasteObj_WESetDirection
, 1,
2042 PyDoc_STR("(WEDirection inDirection) -> None")},
2043 {"WECalText", (PyCFunction
)wasteObj_WECalText
, 1,
2044 PyDoc_STR("() -> None")},
2045 {"WEUpdate", (PyCFunction
)wasteObj_WEUpdate
, 1,
2046 PyDoc_STR("(RgnHandle inUpdateRgn) -> None")},
2047 {"WEScroll", (PyCFunction
)wasteObj_WEScroll
, 1,
2048 PyDoc_STR("(SInt32 inHorizontalOffset, SInt32 inVerticalOffset) -> None")},
2049 {"WEPinScroll", (PyCFunction
)wasteObj_WEPinScroll
, 1,
2050 PyDoc_STR("(SInt32 inHorizontalOffset, SInt32 inVerticalOffset) -> None")},
2051 {"WESelView", (PyCFunction
)wasteObj_WESelView
, 1,
2052 PyDoc_STR("() -> None")},
2053 {"WEActivate", (PyCFunction
)wasteObj_WEActivate
, 1,
2054 PyDoc_STR("() -> None")},
2055 {"WEDeactivate", (PyCFunction
)wasteObj_WEDeactivate
, 1,
2056 PyDoc_STR("() -> None")},
2057 {"WEKey", (PyCFunction
)wasteObj_WEKey
, 1,
2058 PyDoc_STR("(CharParameter inKey, EventModifiers inModifiers) -> None")},
2059 {"WEClick", (PyCFunction
)wasteObj_WEClick
, 1,
2060 PyDoc_STR("(Point inHitPoint, EventModifiers inModifiers, UInt32 inClickTime) -> None")},
2061 {"WEAdjustCursor", (PyCFunction
)wasteObj_WEAdjustCursor
, 1,
2062 PyDoc_STR("(Point inMouseLoc, RgnHandle ioMouseRgn) -> (Boolean _rv)")},
2063 {"WEIdle", (PyCFunction
)wasteObj_WEIdle
, 1,
2064 PyDoc_STR("() -> (UInt32 outMaxSleep)")},
2065 {"WEInsert", (PyCFunction
)wasteObj_WEInsert
, 1,
2066 PyDoc_STR("(Buffer inTextPtr, StScrpHandle inStyles, WESoupHandle inSoup) -> None")},
2067 {"WEInsertFormattedText", (PyCFunction
)wasteObj_WEInsertFormattedText
, 1,
2068 PyDoc_STR("(Buffer inTextPtr, StScrpHandle inStyles, WESoupHandle inSoup, Handle inParaFormat, Handle inRulerScrap) -> None")},
2069 {"WEDelete", (PyCFunction
)wasteObj_WEDelete
, 1,
2070 PyDoc_STR("() -> None")},
2071 {"WEUseText", (PyCFunction
)wasteObj_WEUseText
, 1,
2072 PyDoc_STR("(Handle inText) -> None")},
2073 {"WEChangeCase", (PyCFunction
)wasteObj_WEChangeCase
, 1,
2074 PyDoc_STR("(SInt16 inCase) -> None")},
2075 {"WESetOneAttribute", (PyCFunction
)wasteObj_WESetOneAttribute
, 1,
2076 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd, WESelector inAttributeSelector, Buffer inAttributeValue) -> None")},
2077 {"WESetStyle", (PyCFunction
)wasteObj_WESetStyle
, 1,
2078 PyDoc_STR("(WEStyleMode inMode, TextStyle inTextStyle) -> None")},
2079 {"WEUseStyleScrap", (PyCFunction
)wasteObj_WEUseStyleScrap
, 1,
2080 PyDoc_STR("(StScrpHandle inStyles) -> None")},
2081 {"WEUndo", (PyCFunction
)wasteObj_WEUndo
, 1,
2082 PyDoc_STR("() -> None")},
2083 {"WERedo", (PyCFunction
)wasteObj_WERedo
, 1,
2084 PyDoc_STR("() -> None")},
2085 {"WEClearUndo", (PyCFunction
)wasteObj_WEClearUndo
, 1,
2086 PyDoc_STR("() -> None")},
2087 {"WEGetUndoInfo", (PyCFunction
)wasteObj_WEGetUndoInfo
, 1,
2088 PyDoc_STR("() -> (WEActionKind _rv, Boolean outRedoFlag)")},
2089 {"WEGetIndUndoInfo", (PyCFunction
)wasteObj_WEGetIndUndoInfo
, 1,
2090 PyDoc_STR("(SInt32 inUndoLevel) -> (WEActionKind _rv)")},
2091 {"WEIsTyping", (PyCFunction
)wasteObj_WEIsTyping
, 1,
2092 PyDoc_STR("() -> (Boolean _rv)")},
2093 {"WEBeginAction", (PyCFunction
)wasteObj_WEBeginAction
, 1,
2094 PyDoc_STR("() -> None")},
2095 {"WEEndAction", (PyCFunction
)wasteObj_WEEndAction
, 1,
2096 PyDoc_STR("(WEActionKind inActionKind) -> None")},
2097 {"WEGetModCount", (PyCFunction
)wasteObj_WEGetModCount
, 1,
2098 PyDoc_STR("() -> (UInt32 _rv)")},
2099 {"WEResetModCount", (PyCFunction
)wasteObj_WEResetModCount
, 1,
2100 PyDoc_STR("() -> None")},
2101 {"WEInsertObject", (PyCFunction
)wasteObj_WEInsertObject
, 1,
2102 PyDoc_STR("(FlavorType inObjectType, Handle inObjectDataHandle, Point inObjectSize) -> None")},
2103 {"WEGetSelectedObject", (PyCFunction
)wasteObj_WEGetSelectedObject
, 1,
2104 PyDoc_STR("() -> (WEObjectReference outObject)")},
2105 {"WEGetObjectAtOffset", (PyCFunction
)wasteObj_WEGetObjectAtOffset
, 1,
2106 PyDoc_STR("(SInt32 inOffset) -> (WEObjectReference outObject)")},
2107 {"WEFindNextObject", (PyCFunction
)wasteObj_WEFindNextObject
, 1,
2108 PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv, WEObjectReference outObject)")},
2109 {"WEUseSoup", (PyCFunction
)wasteObj_WEUseSoup
, 1,
2110 PyDoc_STR("(WESoupHandle inSoup) -> None")},
2111 {"WECut", (PyCFunction
)wasteObj_WECut
, 1,
2112 PyDoc_STR("() -> None")},
2113 {"WECopy", (PyCFunction
)wasteObj_WECopy
, 1,
2114 PyDoc_STR("() -> None")},
2115 {"WEPaste", (PyCFunction
)wasteObj_WEPaste
, 1,
2116 PyDoc_STR("() -> None")},
2117 {"WECanPaste", (PyCFunction
)wasteObj_WECanPaste
, 1,
2118 PyDoc_STR("() -> (Boolean _rv)")},
2119 {"WEGetHiliteRgn", (PyCFunction
)wasteObj_WEGetHiliteRgn
, 1,
2120 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd) -> (RgnHandle _rv)")},
2121 {"WECharByte", (PyCFunction
)wasteObj_WECharByte
, 1,
2122 PyDoc_STR("(SInt32 inOffset) -> (SInt16 _rv)")},
2123 {"WECharType", (PyCFunction
)wasteObj_WECharType
, 1,
2124 PyDoc_STR("(SInt32 inOffset) -> (SInt16 _rv)")},
2125 {"WEStopInlineSession", (PyCFunction
)wasteObj_WEStopInlineSession
, 1,
2126 PyDoc_STR("() -> None")},
2127 {"WEFeatureFlag", (PyCFunction
)wasteObj_WEFeatureFlag
, 1,
2128 PyDoc_STR("(SInt16 inFeature, SInt16 inAction) -> (SInt16 _rv)")},
2129 {"WEGetUserInfo", (PyCFunction
)wasteObj_WEGetUserInfo
, 1,
2130 PyDoc_STR("(WESelector inUserTag) -> (SInt32 outUserInfo)")},
2131 {"WESetUserInfo", (PyCFunction
)wasteObj_WESetUserInfo
, 1,
2132 PyDoc_STR("(WESelector inUserTag, SInt32 inUserInfo) -> None")},
2133 {"WERemoveUserInfo", (PyCFunction
)wasteObj_WERemoveUserInfo
, 1,
2134 PyDoc_STR("(WESelector inUserTag) -> None")},
2135 {"WEInstallTabHooks", (PyCFunction
)wasteObj_WEInstallTabHooks
, 1,
2136 PyDoc_STR("() -> None")},
2137 {"WERemoveTabHooks", (PyCFunction
)wasteObj_WERemoveTabHooks
, 1,
2138 PyDoc_STR("() -> None")},
2139 {"WEIsTabHooks", (PyCFunction
)wasteObj_WEIsTabHooks
, 1,
2140 PyDoc_STR("() -> (Boolean _rv)")},
2141 {"WEGetTabSize", (PyCFunction
)wasteObj_WEGetTabSize
, 1,
2142 PyDoc_STR("() -> (SInt16 _rv)")},
2143 {"WESetTabSize", (PyCFunction
)wasteObj_WESetTabSize
, 1,
2144 PyDoc_STR("(SInt16 tabWidth) -> None")},
2148 #define wasteObj_getsetlist NULL
2151 #define wasteObj_compare NULL
2153 #define wasteObj_repr NULL
2155 #define wasteObj_hash NULL
2156 #define wasteObj_tp_init 0
2158 #define wasteObj_tp_alloc PyType_GenericAlloc
2160 static PyObject
*wasteObj_tp_new(PyTypeObject
*type
, PyObject
*args
, PyObject
*kwds
)
2164 char *kw
[] = {"itself", 0};
2166 if (!PyArg_ParseTupleAndKeywords(args
, kwds
, "O&", kw
, wasteObj_Convert
, &itself
)) return NULL
;
2167 if ((self
= type
->tp_alloc(type
, 0)) == NULL
) return NULL
;
2168 ((wasteObject
*)self
)->ob_itself
= itself
;
2172 #define wasteObj_tp_free PyObject_Del
2175 PyTypeObject waste_Type
= {
2176 PyObject_HEAD_INIT(NULL
)
2178 "waste.waste", /*tp_name*/
2179 sizeof(wasteObject
), /*tp_basicsize*/
2182 (destructor
) wasteObj_dealloc
, /*tp_dealloc*/
2184 (getattrfunc
)0, /*tp_getattr*/
2185 (setattrfunc
)0, /*tp_setattr*/
2186 (cmpfunc
) wasteObj_compare
, /*tp_compare*/
2187 (reprfunc
) wasteObj_repr
, /*tp_repr*/
2188 (PyNumberMethods
*)0, /* tp_as_number */
2189 (PySequenceMethods
*)0, /* tp_as_sequence */
2190 (PyMappingMethods
*)0, /* tp_as_mapping */
2191 (hashfunc
) wasteObj_hash
, /*tp_hash*/
2194 PyObject_GenericGetAttr
, /*tp_getattro*/
2195 PyObject_GenericSetAttr
, /*tp_setattro */
2197 Py_TPFLAGS_DEFAULT
|Py_TPFLAGS_BASETYPE
, /* tp_flags */
2201 0, /*tp_richcompare*/
2202 0, /*tp_weaklistoffset*/
2205 wasteObj_methods
, /* tp_methods */
2207 wasteObj_getsetlist
, /*tp_getset*/
2212 0, /*tp_dictoffset*/
2213 wasteObj_tp_init
, /* tp_init */
2214 wasteObj_tp_alloc
, /* tp_alloc */
2215 wasteObj_tp_new
, /* tp_new */
2216 wasteObj_tp_free
, /* tp_free */
2219 /* --------------------- End object type waste ---------------------- */
2222 static PyObject
*waste_WENew(PyObject
*_self
, PyObject
*_args
)
2224 PyObject
*_res
= NULL
;
2226 LongRect inDestRect
;
2227 LongRect inViewRect
;
2228 OptionBits inOptions
;
2230 if (!PyArg_ParseTuple(_args
, "O&O&l",
2231 LongRect_Convert
, &inDestRect
,
2232 LongRect_Convert
, &inViewRect
,
2235 _err
= WENew(&inDestRect
,
2239 if (_err
!= noErr
) return PyMac_Error(_err
);
2240 _res
= Py_BuildValue("O&",
2241 wasteObj_New
, outWE
);
2245 static PyObject
*waste_WEUpdateStyleScrap(PyObject
*_self
, PyObject
*_args
)
2247 PyObject
*_res
= NULL
;
2249 StScrpHandle ioStyles
;
2250 WEFontTableHandle inFontTable
;
2251 if (!PyArg_ParseTuple(_args
, "O&O&",
2252 ResObj_Convert
, &ioStyles
,
2253 ResObj_Convert
, &inFontTable
))
2255 _err
= WEUpdateStyleScrap(ioStyles
,
2257 if (_err
!= noErr
) return PyMac_Error(_err
);
2263 static PyObject
*waste_WEInstallTSMHandlers(PyObject
*_self
, PyObject
*_args
)
2265 PyObject
*_res
= NULL
;
2267 if (!PyArg_ParseTuple(_args
, ""))
2269 _err
= WEInstallTSMHandlers();
2270 if (_err
!= noErr
) return PyMac_Error(_err
);
2276 static PyObject
*waste_WERemoveTSMHandlers(PyObject
*_self
, PyObject
*_args
)
2278 PyObject
*_res
= NULL
;
2280 if (!PyArg_ParseTuple(_args
, ""))
2282 _err
= WERemoveTSMHandlers();
2283 if (_err
!= noErr
) return PyMac_Error(_err
);
2289 static PyObject
*waste_WEHandleTSMEvent(PyObject
*_self
, PyObject
*_args
)
2291 PyObject
*_res
= NULL
;
2293 AppleEvent inAppleEvent
;
2295 if (!PyArg_ParseTuple(_args
, "O&",
2296 AEDesc_Convert
, &inAppleEvent
))
2298 _err
= WEHandleTSMEvent(&inAppleEvent
,
2300 if (_err
!= noErr
) return PyMac_Error(_err
);
2301 _res
= Py_BuildValue("O&",
2302 AEDesc_New
, &ioReply
);
2306 static PyObject
*waste_WELongPointToPoint(PyObject
*_self
, PyObject
*_args
)
2308 PyObject
*_res
= NULL
;
2311 if (!PyArg_ParseTuple(_args
, "O&",
2312 LongPt_Convert
, &inLongPoint
))
2314 WELongPointToPoint(&inLongPoint
,
2316 _res
= Py_BuildValue("O&",
2317 PyMac_BuildPoint
, outPoint
);
2321 static PyObject
*waste_WEPointToLongPoint(PyObject
*_self
, PyObject
*_args
)
2323 PyObject
*_res
= NULL
;
2325 LongPt outLongPoint
;
2326 if (!PyArg_ParseTuple(_args
, "O&",
2327 PyMac_GetPoint
, &inPoint
))
2329 WEPointToLongPoint(inPoint
,
2331 _res
= Py_BuildValue("O&",
2332 LongPt_New
, &outLongPoint
);
2336 static PyObject
*waste_WESetLongRect(PyObject
*_self
, PyObject
*_args
)
2338 PyObject
*_res
= NULL
;
2339 LongRect outLongRect
;
2344 if (!PyArg_ParseTuple(_args
, "llll",
2350 WESetLongRect(&outLongRect
,
2355 _res
= Py_BuildValue("O&",
2356 LongRect_New
, &outLongRect
);
2360 static PyObject
*waste_WELongRectToRect(PyObject
*_self
, PyObject
*_args
)
2362 PyObject
*_res
= NULL
;
2363 LongRect inLongRect
;
2365 if (!PyArg_ParseTuple(_args
, "O&",
2366 LongRect_Convert
, &inLongRect
))
2368 WELongRectToRect(&inLongRect
,
2370 _res
= Py_BuildValue("O&",
2371 PyMac_BuildRect
, &outRect
);
2375 static PyObject
*waste_WERectToLongRect(PyObject
*_self
, PyObject
*_args
)
2377 PyObject
*_res
= NULL
;
2379 LongRect outLongRect
;
2380 if (!PyArg_ParseTuple(_args
, "O&",
2381 PyMac_GetRect
, &inRect
))
2383 WERectToLongRect(&inRect
,
2385 _res
= Py_BuildValue("O&",
2386 LongRect_New
, &outLongRect
);
2390 static PyObject
*waste_WEOffsetLongRect(PyObject
*_self
, PyObject
*_args
)
2392 PyObject
*_res
= NULL
;
2393 LongRect ioLongRect
;
2394 SInt32 inHorizontalOffset
;
2395 SInt32 inVerticalOffset
;
2396 if (!PyArg_ParseTuple(_args
, "ll",
2397 &inHorizontalOffset
,
2400 WEOffsetLongRect(&ioLongRect
,
2403 _res
= Py_BuildValue("O&",
2404 LongRect_New
, &ioLongRect
);
2408 static PyObject
*waste_WELongPointInLongRect(PyObject
*_self
, PyObject
*_args
)
2410 PyObject
*_res
= NULL
;
2413 LongRect inLongRect
;
2414 if (!PyArg_ParseTuple(_args
, "O&O&",
2415 LongPt_Convert
, &inLongPoint
,
2416 LongRect_Convert
, &inLongRect
))
2418 _rv
= WELongPointInLongRect(&inLongPoint
,
2420 _res
= Py_BuildValue("b",
2425 static PyObject
*waste_STDObjectHandlers(PyObject
*_self
, PyObject
*_args
)
2427 PyObject
*_res
= NULL
;
2430 // install the sample object handlers for pictures and sounds
2431 #define kTypePicture 'PICT'
2432 #define kTypeSound 'snd '
2434 if ( !PyArg_ParseTuple(_args
, "") ) return NULL
;
2436 if ((err
= WEInstallObjectHandler(kTypePicture
, weNewHandler
,
2437 (UniversalProcPtr
) NewWENewObjectProc(HandleNewPicture
), NULL
)) != noErr
)
2440 if ((err
= WEInstallObjectHandler(kTypePicture
, weDisposeHandler
,
2441 (UniversalProcPtr
) NewWEDisposeObjectProc(HandleDisposePicture
), NULL
)) != noErr
)
2444 if ((err
= WEInstallObjectHandler(kTypePicture
, weDrawHandler
,
2445 (UniversalProcPtr
) NewWEDrawObjectProc(HandleDrawPicture
), NULL
)) != noErr
)
2448 if ((err
= WEInstallObjectHandler(kTypeSound
, weNewHandler
,
2449 (UniversalProcPtr
) NewWENewObjectProc(HandleNewSound
), NULL
)) != noErr
)
2452 if ((err
= WEInstallObjectHandler(kTypeSound
, weDrawHandler
,
2453 (UniversalProcPtr
) NewWEDrawObjectProc(HandleDrawSound
), NULL
)) != noErr
)
2456 if ((err
= WEInstallObjectHandler(kTypeSound
, weClickHandler
,
2457 (UniversalProcPtr
) NewWEClickObjectProc(HandleClickSound
), NULL
)) != noErr
)
2464 return PyMac_Error(err
);
2468 static PyObject
*waste_WEInstallObjectHandler(PyObject
*_self
, PyObject
*_args
)
2470 PyObject
*_res
= NULL
;
2473 FlavorType objectType
;
2474 WESelector selector
;
2475 PyObject
*py_handler
;
2476 UniversalProcPtr handler
;
2477 WEReference we
= NULL
;
2481 if ( !PyArg_ParseTuple(_args
, "O&O&O|O&",
2482 PyMac_GetOSType
, &objectType
,
2483 PyMac_GetOSType
, &selector
,
2485 WEOObj_Convert
, &we
) ) return NULL
;
2487 if ( selector
== weNewHandler
) handler
= (UniversalProcPtr
)upp_new_handler
;
2488 else if ( selector
== weDisposeHandler
) handler
= (UniversalProcPtr
)upp_dispose_handler
;
2489 else if ( selector
== weDrawHandler
) handler
= (UniversalProcPtr
)upp_draw_handler
;
2490 else if ( selector
== weClickHandler
) handler
= (UniversalProcPtr
)upp_click_handler
;
2491 else return PyMac_Error(weUndefinedSelectorErr
);
2493 if ((key
= Py_BuildValue("O&O&",
2494 PyMac_BuildOSType
, objectType
,
2495 PyMac_BuildOSType
, selector
)) == NULL
)
2498 PyDict_SetItem(callbackdict
, key
, py_handler
);
2500 err
= WEInstallObjectHandler(objectType
, selector
, handler
, we
);
2501 if ( err
) return PyMac_Error(err
);
2508 static PyMethodDef waste_methods
[] = {
2509 {"WENew", (PyCFunction
)waste_WENew
, 1,
2510 PyDoc_STR("(LongRect inDestRect, LongRect inViewRect, OptionBits inOptions) -> (WEReference outWE)")},
2511 {"WEUpdateStyleScrap", (PyCFunction
)waste_WEUpdateStyleScrap
, 1,
2512 PyDoc_STR("(StScrpHandle ioStyles, WEFontTableHandle inFontTable) -> None")},
2513 {"WEInstallTSMHandlers", (PyCFunction
)waste_WEInstallTSMHandlers
, 1,
2514 PyDoc_STR("() -> None")},
2515 {"WERemoveTSMHandlers", (PyCFunction
)waste_WERemoveTSMHandlers
, 1,
2516 PyDoc_STR("() -> None")},
2517 {"WEHandleTSMEvent", (PyCFunction
)waste_WEHandleTSMEvent
, 1,
2518 PyDoc_STR("(AppleEvent inAppleEvent) -> (AppleEvent ioReply)")},
2519 {"WELongPointToPoint", (PyCFunction
)waste_WELongPointToPoint
, 1,
2520 PyDoc_STR("(LongPt inLongPoint) -> (Point outPoint)")},
2521 {"WEPointToLongPoint", (PyCFunction
)waste_WEPointToLongPoint
, 1,
2522 PyDoc_STR("(Point inPoint) -> (LongPt outLongPoint)")},
2523 {"WESetLongRect", (PyCFunction
)waste_WESetLongRect
, 1,
2524 PyDoc_STR("(SInt32 inLeft, SInt32 inTop, SInt32 inRight, SInt32 inBottom) -> (LongRect outLongRect)")},
2525 {"WELongRectToRect", (PyCFunction
)waste_WELongRectToRect
, 1,
2526 PyDoc_STR("(LongRect inLongRect) -> (Rect outRect)")},
2527 {"WERectToLongRect", (PyCFunction
)waste_WERectToLongRect
, 1,
2528 PyDoc_STR("(Rect inRect) -> (LongRect outLongRect)")},
2529 {"WEOffsetLongRect", (PyCFunction
)waste_WEOffsetLongRect
, 1,
2530 PyDoc_STR("(SInt32 inHorizontalOffset, SInt32 inVerticalOffset) -> (LongRect ioLongRect)")},
2531 {"WELongPointInLongRect", (PyCFunction
)waste_WELongPointInLongRect
, 1,
2532 PyDoc_STR("(LongPt inLongPoint, LongRect inLongRect) -> (Boolean _rv)")},
2533 {"STDObjectHandlers", (PyCFunction
)waste_STDObjectHandlers
, 1,
2535 {"WEInstallObjectHandler", (PyCFunction
)waste_WEInstallObjectHandler
, 1,
2542 /* Return the object corresponding to the window, or NULL */
2545 ExistingwasteObj_New(w
)
2548 PyObject
*it
= NULL
;
2553 WEGetInfo(weRefCon
, (void *)&it
, w
);
2554 if (it
== NULL
|| ((wasteObject
*)it
)->ob_itself
!= w
)
2561 void initwaste(void)
2569 m
= Py_InitModule("waste", waste_methods
);
2570 d
= PyModule_GetDict(m
);
2571 waste_Error
= PyMac_GetOSErrException();
2572 if (waste_Error
== NULL
||
2573 PyDict_SetItemString(d
, "Error", waste_Error
) != 0)
2575 WEO_Type
.ob_type
= &PyType_Type
;
2576 if (PyType_Ready(&WEO_Type
) < 0) return;
2577 Py_INCREF(&WEO_Type
);
2578 PyModule_AddObject(m
, "WEO", (PyObject
*)&WEO_Type
);
2579 /* Backward-compatible name */
2580 Py_INCREF(&WEO_Type
);
2581 PyModule_AddObject(m
, "WEOType", (PyObject
*)&WEO_Type
);
2582 waste_Type
.ob_type
= &PyType_Type
;
2583 if (PyType_Ready(&waste_Type
) < 0) return;
2584 Py_INCREF(&waste_Type
);
2585 PyModule_AddObject(m
, "waste", (PyObject
*)&waste_Type
);
2586 /* Backward-compatible name */
2587 Py_INCREF(&waste_Type
);
2588 PyModule_AddObject(m
, "wasteType", (PyObject
*)&waste_Type
);
2590 callbackdict
= PyDict_New();
2591 if (callbackdict
== NULL
|| PyDict_SetItemString(d
, "callbacks", callbackdict
) != 0)
2593 upp_new_handler
= NewWENewObjectProc(my_new_handler
);
2594 upp_dispose_handler
= NewWEDisposeObjectProc(my_dispose_handler
);
2595 upp_draw_handler
= NewWEDrawObjectProc(my_draw_handler
);
2596 upp_click_handler
= NewWEClickObjectProc(my_click_handler
);
2601 /* ======================== End module waste ======================== */