Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1 | |
| 2 | /* ========================== Module waste ========================== */ |
| 3 | |
| 4 | #include "Python.h" |
| 5 | |
| 6 | |
| 7 | |
Jack Jansen | 620a766 | 2001-12-18 15:39:38 +0000 | [diff] [blame] | 8 | #ifdef _WIN32 |
| 9 | #include "pywintoolbox.h" |
| 10 | #else |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 11 | #include "macglue.h" |
Jack Jansen | 9d8b96c | 2000-07-14 22:16:45 +0000 | [diff] [blame] | 12 | #include "pymactoolbox.h" |
Jack Jansen | 620a766 | 2001-12-18 15:39:38 +0000 | [diff] [blame] | 13 | #endif |
Jack Jansen | 044d95e | 2001-09-05 15:44:37 +0000 | [diff] [blame] | 14 | |
| 15 | /* Macro to test whether a weak-loaded CFM function exists */ |
| 16 | #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ |
| 17 | PyErr_SetString(PyExc_NotImplementedError, \ |
| 18 | "Not available in this shared library/OS version"); \ |
| 19 | return NULL; \ |
| 20 | }} while(0) |
| 21 | |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 22 | |
| 23 | #include <WASTE.h> |
Jack Jansen | 8505ef8 | 1997-08-27 14:09:25 +0000 | [diff] [blame] | 24 | #include <WEObjectHandlers.h> |
Jack Jansen | a755e68 | 1997-09-20 17:40:22 +0000 | [diff] [blame] | 25 | #include <WETabs.h> |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 26 | |
| 27 | /* Exported by Qdmodule.c: */ |
| 28 | extern PyObject *QdRGB_New(RGBColor *); |
| 29 | extern int QdRGB_Convert(PyObject *, RGBColor *); |
| 30 | |
Jack Jansen | 8505ef8 | 1997-08-27 14:09:25 +0000 | [diff] [blame] | 31 | /* Exported by AEModule.c: */ |
| 32 | extern PyObject *AEDesc_New(AppleEvent *); |
| 33 | extern int AEDesc_Convert(PyObject *, AppleEvent *); |
| 34 | |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 35 | /* Forward declaration */ |
| 36 | staticforward PyObject *WEOObj_New(WEObjectReference); |
Jack Jansen | 756522f | 1996-05-07 15:24:01 +0000 | [diff] [blame] | 37 | staticforward PyObject *ExistingwasteObj_New(WEReference); |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 38 | |
| 39 | /* |
| 40 | ** Parse/generate TextStyle records |
| 41 | */ |
| 42 | static |
| 43 | PyObject *TextStyle_New(itself) |
| 44 | TextStylePtr itself; |
| 45 | { |
| 46 | |
| 47 | return Py_BuildValue("lllO&", (long)itself->tsFont, (long)itself->tsFace, (long)itself->tsSize, QdRGB_New, |
| 48 | &itself->tsColor); |
| 49 | } |
| 50 | |
| 51 | static |
| 52 | TextStyle_Convert(v, p_itself) |
| 53 | PyObject *v; |
| 54 | TextStylePtr p_itself; |
| 55 | { |
| 56 | long font, face, size; |
| 57 | |
| 58 | if( !PyArg_ParseTuple(v, "lllO&", &font, &face, &size, QdRGB_Convert, &p_itself->tsColor) ) |
| 59 | return 0; |
| 60 | p_itself->tsFont = (short)font; |
| 61 | p_itself->tsFace = (Style)face; |
| 62 | p_itself->tsSize = (short)size; |
| 63 | return 1; |
| 64 | } |
| 65 | |
| 66 | /* |
| 67 | ** Parse/generate RunInfo records |
| 68 | */ |
| 69 | static |
| 70 | PyObject *RunInfo_New(itself) |
| 71 | WERunInfo *itself; |
| 72 | { |
| 73 | |
| 74 | return Py_BuildValue("llhhO&O&", itself->runStart, itself->runEnd, itself->runHeight, |
| 75 | itself->runAscent, TextStyle_New, &itself->runStyle, WEOObj_New, itself->runObject); |
| 76 | } |
| 77 | |
| 78 | /* Conversion of long points and rects */ |
| 79 | int |
| 80 | LongRect_Convert(PyObject *v, LongRect *r) |
| 81 | { |
| 82 | return PyArg_Parse(v, "(llll)", &r->left, &r->top, &r->right, &r->bottom); |
| 83 | } |
| 84 | |
| 85 | PyObject * |
| 86 | LongRect_New(LongRect *r) |
| 87 | { |
| 88 | return Py_BuildValue("(llll)", r->left, r->top, r->right, r->bottom); |
| 89 | } |
| 90 | |
| 91 | |
| 92 | LongPt_Convert(PyObject *v, LongPt *p) |
| 93 | { |
| 94 | return PyArg_Parse(v, "(ll)", &p->h, &p->v); |
| 95 | } |
| 96 | |
| 97 | PyObject * |
| 98 | LongPt_New(LongPt *p) |
| 99 | { |
| 100 | return Py_BuildValue("(ll)", p->h, p->v); |
| 101 | } |
| 102 | |
Jack Jansen | 756522f | 1996-05-07 15:24:01 +0000 | [diff] [blame] | 103 | /* Stuff for the callbacks: */ |
| 104 | static PyObject *callbackdict; |
Jack Jansen | 25241d9 | 1996-05-20 11:30:45 +0000 | [diff] [blame] | 105 | WENewObjectUPP upp_new_handler; |
| 106 | WEDisposeObjectUPP upp_dispose_handler; |
| 107 | WEDrawObjectUPP upp_draw_handler; |
| 108 | WEClickObjectUPP upp_click_handler; |
Jack Jansen | 756522f | 1996-05-07 15:24:01 +0000 | [diff] [blame] | 109 | |
| 110 | static OSErr |
| 111 | any_handler(WESelector what, WEObjectReference who, PyObject *args, PyObject **rv) |
| 112 | { |
| 113 | FlavorType tp; |
| 114 | PyObject *key, *func; |
| 115 | |
| 116 | if ( args == NULL ) return errAECorruptData; |
| 117 | |
| 118 | tp = WEGetObjectType(who); |
| 119 | |
| 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; |
| 125 | } |
| 126 | Py_INCREF(func); |
| 127 | *rv = PyEval_CallObject(func, args); |
| 128 | Py_DECREF(func); |
| 129 | Py_DECREF(key); |
| 130 | if ( *rv == NULL ) { |
Jack Jansen | deff89c | 1998-10-12 20:53:15 +0000 | [diff] [blame] | 131 | PySys_WriteStderr("--Exception in callback: "); |
Jack Jansen | 756522f | 1996-05-07 15:24:01 +0000 | [diff] [blame] | 132 | PyErr_Print(); |
| 133 | return errAEReplyNotArrived; |
| 134 | } |
| 135 | return 0; |
| 136 | } |
| 137 | |
| 138 | static pascal OSErr |
| 139 | my_new_handler(Point *objectSize, WEObjectReference objref) |
| 140 | { |
| 141 | PyObject *args=NULL, *rv=NULL; |
| 142 | OSErr err; |
| 143 | |
| 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; |
| 149 | } |
| 150 | if ( args ) Py_DECREF(args); |
| 151 | if ( rv ) Py_DECREF(rv); |
| 152 | return err; |
| 153 | } |
| 154 | |
| 155 | static pascal OSErr |
| 156 | my_dispose_handler(WEObjectReference objref) |
| 157 | { |
| 158 | PyObject *args=NULL, *rv=NULL; |
| 159 | OSErr err; |
| 160 | |
| 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; |
| 166 | } |
| 167 | |
| 168 | static pascal OSErr |
Jack Jansen | 6b9289f | 2001-06-20 21:21:07 +0000 | [diff] [blame] | 169 | my_draw_handler(const Rect *destRect, WEObjectReference objref) |
Jack Jansen | 756522f | 1996-05-07 15:24:01 +0000 | [diff] [blame] | 170 | { |
| 171 | PyObject *args=NULL, *rv=NULL; |
| 172 | OSErr err; |
| 173 | |
| 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; |
| 179 | } |
| 180 | |
| 181 | static pascal Boolean |
| 182 | my_click_handler(Point hitPt, EventModifiers modifiers, |
| 183 | unsigned long clickTime, WEObjectReference objref) |
| 184 | { |
| 185 | PyObject *args=NULL, *rv=NULL; |
| 186 | int retvalue; |
| 187 | OSErr err; |
| 188 | |
| 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; |
| 199 | } |
| 200 | |
| 201 | |
| 202 | |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 203 | static PyObject *waste_Error; |
| 204 | |
| 205 | /* ------------------------ Object type WEO ------------------------- */ |
| 206 | |
| 207 | PyTypeObject WEO_Type; |
| 208 | |
| 209 | #define WEOObj_Check(x) ((x)->ob_type == &WEO_Type) |
| 210 | |
| 211 | typedef struct WEOObject { |
| 212 | PyObject_HEAD |
| 213 | WEObjectReference ob_itself; |
| 214 | } WEOObject; |
| 215 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 216 | PyObject *WEOObj_New(WEObjectReference itself) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 217 | { |
| 218 | WEOObject *it; |
| 219 | if (itself == NULL) { |
| 220 | Py_INCREF(Py_None); |
| 221 | return Py_None; |
| 222 | } |
| 223 | it = PyObject_NEW(WEOObject, &WEO_Type); |
| 224 | if (it == NULL) return NULL; |
| 225 | it->ob_itself = itself; |
| 226 | return (PyObject *)it; |
| 227 | } |
Jack Jansen | 044d95e | 2001-09-05 15:44:37 +0000 | [diff] [blame] | 228 | int WEOObj_Convert(PyObject *v, WEObjectReference *p_itself) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 229 | { |
| 230 | if (!WEOObj_Check(v)) |
| 231 | { |
| 232 | PyErr_SetString(PyExc_TypeError, "WEO required"); |
| 233 | return 0; |
| 234 | } |
| 235 | *p_itself = ((WEOObject *)v)->ob_itself; |
| 236 | return 1; |
| 237 | } |
| 238 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 239 | static void WEOObj_dealloc(WEOObject *self) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 240 | { |
| 241 | /* Cleanup of self->ob_itself goes here */ |
Jack Jansen | 033b79c | 2002-04-23 22:46:01 +0000 | [diff] [blame] | 242 | PyObject_Del(self); |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 243 | } |
| 244 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 245 | static PyObject *WEOObj_WEGetObjectType(WEOObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 246 | { |
| 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; |
| 255 | } |
| 256 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 257 | static PyObject *WEOObj_WEGetObjectDataHandle(WEOObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 258 | { |
| 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; |
| 267 | } |
| 268 | |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 269 | static PyObject *WEOObj_WEGetObjectOwner(WEOObject *_self, PyObject *_args) |
| 270 | { |
| 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; |
| 279 | } |
| 280 | |
| 281 | static PyObject *WEOObj_WEGetObjectOffset(WEOObject *_self, PyObject *_args) |
| 282 | { |
| 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; |
| 291 | } |
| 292 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 293 | static PyObject *WEOObj_WEGetObjectSize(WEOObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 294 | { |
| 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; |
| 303 | } |
| 304 | |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 305 | static PyObject *WEOObj_WESetObjectSize(WEOObject *_self, PyObject *_args) |
Jack Jansen | 756522f | 1996-05-07 15:24:01 +0000 | [diff] [blame] | 306 | { |
| 307 | PyObject *_res = NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 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; |
| 319 | } |
| 320 | |
| 321 | static PyObject *WEOObj_WEGetObjectFrame(WEOObject *_self, PyObject *_args) |
| 322 | { |
| 323 | PyObject *_res = NULL; |
| 324 | OSErr _err; |
| 325 | LongRect outObjectFrame; |
Jack Jansen | 756522f | 1996-05-07 15:24:01 +0000 | [diff] [blame] | 326 | if (!PyArg_ParseTuple(_args, "")) |
| 327 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 328 | _err = WEGetObjectFrame(_self->ob_itself, |
| 329 | &outObjectFrame); |
| 330 | if (_err != noErr) return PyMac_Error(_err); |
Jack Jansen | 756522f | 1996-05-07 15:24:01 +0000 | [diff] [blame] | 331 | _res = Py_BuildValue("O&", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 332 | LongRect_New, &outObjectFrame); |
Jack Jansen | 756522f | 1996-05-07 15:24:01 +0000 | [diff] [blame] | 333 | return _res; |
| 334 | } |
| 335 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 336 | static PyObject *WEOObj_WEGetObjectRefCon(WEOObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 337 | { |
| 338 | PyObject *_res = NULL; |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 339 | SInt32 _rv; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 340 | if (!PyArg_ParseTuple(_args, "")) |
| 341 | return NULL; |
| 342 | _rv = WEGetObjectRefCon(_self->ob_itself); |
| 343 | _res = Py_BuildValue("l", |
| 344 | _rv); |
| 345 | return _res; |
| 346 | } |
| 347 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 348 | static PyObject *WEOObj_WESetObjectRefCon(WEOObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 349 | { |
| 350 | PyObject *_res = NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 351 | SInt32 inRefCon; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 352 | if (!PyArg_ParseTuple(_args, "l", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 353 | &inRefCon)) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 354 | return NULL; |
| 355 | WESetObjectRefCon(_self->ob_itself, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 356 | inRefCon); |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 357 | Py_INCREF(Py_None); |
| 358 | _res = Py_None; |
| 359 | return _res; |
| 360 | } |
| 361 | |
| 362 | static PyMethodDef WEOObj_methods[] = { |
| 363 | {"WEGetObjectType", (PyCFunction)WEOObj_WEGetObjectType, 1, |
| 364 | "() -> (FlavorType _rv)"}, |
| 365 | {"WEGetObjectDataHandle", (PyCFunction)WEOObj_WEGetObjectDataHandle, 1, |
| 366 | "() -> (Handle _rv)"}, |
Jack Jansen | 756522f | 1996-05-07 15:24:01 +0000 | [diff] [blame] | 367 | {"WEGetObjectOwner", (PyCFunction)WEOObj_WEGetObjectOwner, 1, |
| 368 | "() -> (WEReference _rv)"}, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 369 | {"WEGetObjectOffset", (PyCFunction)WEOObj_WEGetObjectOffset, 1, |
| 370 | "() -> (SInt32 _rv)"}, |
| 371 | {"WEGetObjectSize", (PyCFunction)WEOObj_WEGetObjectSize, 1, |
| 372 | "() -> (Point _rv)"}, |
| 373 | {"WESetObjectSize", (PyCFunction)WEOObj_WESetObjectSize, 1, |
| 374 | "(Point inObjectSize) -> None"}, |
| 375 | {"WEGetObjectFrame", (PyCFunction)WEOObj_WEGetObjectFrame, 1, |
| 376 | "() -> (LongRect outObjectFrame)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 377 | {"WEGetObjectRefCon", (PyCFunction)WEOObj_WEGetObjectRefCon, 1, |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 378 | "() -> (SInt32 _rv)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 379 | {"WESetObjectRefCon", (PyCFunction)WEOObj_WESetObjectRefCon, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 380 | "(SInt32 inRefCon) -> None"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 381 | {NULL, NULL, 0} |
| 382 | }; |
| 383 | |
| 384 | PyMethodChain WEOObj_chain = { WEOObj_methods, NULL }; |
| 385 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 386 | static PyObject *WEOObj_getattr(WEOObject *self, char *name) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 387 | { |
| 388 | return Py_FindMethodInChain(&WEOObj_chain, (PyObject *)self, name); |
| 389 | } |
| 390 | |
| 391 | #define WEOObj_setattr NULL |
| 392 | |
Jack Jansen | 9d8b96c | 2000-07-14 22:16:45 +0000 | [diff] [blame] | 393 | #define WEOObj_compare NULL |
| 394 | |
| 395 | #define WEOObj_repr NULL |
| 396 | |
| 397 | #define WEOObj_hash NULL |
| 398 | |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 399 | PyTypeObject WEO_Type = { |
Jack Jansen | b3be216 | 2001-11-30 14:16:36 +0000 | [diff] [blame] | 400 | PyObject_HEAD_INIT(NULL) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 401 | 0, /*ob_size*/ |
Guido van Rossum | 1464839 | 2001-12-08 18:02:58 +0000 | [diff] [blame] | 402 | "waste.WEO", /*tp_name*/ |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 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*/ |
Jack Jansen | 9d8b96c | 2000-07-14 22:16:45 +0000 | [diff] [blame] | 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*/ |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 416 | }; |
| 417 | |
| 418 | /* ---------------------- End object type WEO ----------------------- */ |
| 419 | |
| 420 | |
| 421 | /* ----------------------- Object type waste ------------------------ */ |
| 422 | |
| 423 | PyTypeObject waste_Type; |
| 424 | |
| 425 | #define wasteObj_Check(x) ((x)->ob_type == &waste_Type) |
| 426 | |
| 427 | typedef struct wasteObject { |
| 428 | PyObject_HEAD |
| 429 | WEReference ob_itself; |
| 430 | } wasteObject; |
| 431 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 432 | PyObject *wasteObj_New(WEReference itself) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 433 | { |
| 434 | wasteObject *it; |
| 435 | if (itself == NULL) { |
| 436 | PyErr_SetString(waste_Error,"Cannot create null WE"); |
| 437 | return NULL; |
| 438 | } |
| 439 | it = PyObject_NEW(wasteObject, &waste_Type); |
| 440 | if (it == NULL) return NULL; |
| 441 | it->ob_itself = itself; |
Jack Jansen | 756522f | 1996-05-07 15:24:01 +0000 | [diff] [blame] | 442 | WESetInfo(weRefCon, (void *)&it, itself); |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 443 | return (PyObject *)it; |
| 444 | } |
Jack Jansen | 044d95e | 2001-09-05 15:44:37 +0000 | [diff] [blame] | 445 | int wasteObj_Convert(PyObject *v, WEReference *p_itself) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 446 | { |
| 447 | if (!wasteObj_Check(v)) |
| 448 | { |
| 449 | PyErr_SetString(PyExc_TypeError, "waste required"); |
| 450 | return 0; |
| 451 | } |
| 452 | *p_itself = ((wasteObject *)v)->ob_itself; |
| 453 | return 1; |
| 454 | } |
| 455 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 456 | static void wasteObj_dealloc(wasteObject *self) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 457 | { |
| 458 | WEDispose(self->ob_itself); |
Jack Jansen | 033b79c | 2002-04-23 22:46:01 +0000 | [diff] [blame] | 459 | PyObject_Del(self); |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 460 | } |
| 461 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 462 | static PyObject *wasteObj_WEGetText(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 463 | { |
| 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; |
| 472 | } |
| 473 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 474 | static PyObject *wasteObj_WEGetChar(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 475 | { |
| 476 | PyObject *_res = NULL; |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 477 | SInt16 _rv; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 478 | SInt32 inOffset; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 479 | if (!PyArg_ParseTuple(_args, "l", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 480 | &inOffset)) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 481 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 482 | _rv = WEGetChar(inOffset, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 483 | _self->ob_itself); |
| 484 | _res = Py_BuildValue("h", |
| 485 | _rv); |
| 486 | return _res; |
| 487 | } |
| 488 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 489 | static PyObject *wasteObj_WEGetTextLength(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 490 | { |
| 491 | PyObject *_res = NULL; |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 492 | SInt32 _rv; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 493 | if (!PyArg_ParseTuple(_args, "")) |
| 494 | return NULL; |
| 495 | _rv = WEGetTextLength(_self->ob_itself); |
| 496 | _res = Py_BuildValue("l", |
| 497 | _rv); |
| 498 | return _res; |
| 499 | } |
| 500 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 501 | static PyObject *wasteObj_WEGetSelection(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 502 | { |
| 503 | PyObject *_res = NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 504 | SInt32 outSelStart; |
| 505 | SInt32 outSelEnd; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 506 | if (!PyArg_ParseTuple(_args, "")) |
| 507 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 508 | WEGetSelection(&outSelStart, |
| 509 | &outSelEnd, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 510 | _self->ob_itself); |
| 511 | _res = Py_BuildValue("ll", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 512 | outSelStart, |
| 513 | outSelEnd); |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 514 | return _res; |
| 515 | } |
| 516 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 517 | static PyObject *wasteObj_WEGetDestRect(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 518 | { |
| 519 | PyObject *_res = NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 520 | LongRect outDestRect; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 521 | if (!PyArg_ParseTuple(_args, "")) |
| 522 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 523 | WEGetDestRect(&outDestRect, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 524 | _self->ob_itself); |
| 525 | _res = Py_BuildValue("O&", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 526 | LongRect_New, &outDestRect); |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 527 | return _res; |
| 528 | } |
| 529 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 530 | static PyObject *wasteObj_WEGetViewRect(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 531 | { |
| 532 | PyObject *_res = NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 533 | LongRect outViewRect; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 534 | if (!PyArg_ParseTuple(_args, "")) |
| 535 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 536 | WEGetViewRect(&outViewRect, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 537 | _self->ob_itself); |
| 538 | _res = Py_BuildValue("O&", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 539 | LongRect_New, &outViewRect); |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 540 | return _res; |
| 541 | } |
| 542 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 543 | static PyObject *wasteObj_WEIsActive(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 544 | { |
| 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; |
| 553 | } |
| 554 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 555 | static PyObject *wasteObj_WEGetClickCount(wasteObject *_self, PyObject *_args) |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 556 | { |
| 557 | PyObject *_res = NULL; |
| 558 | UInt16 _rv; |
| 559 | if (!PyArg_ParseTuple(_args, "")) |
| 560 | return NULL; |
| 561 | _rv = WEGetClickCount(_self->ob_itself); |
Jack Jansen | 9d8b96c | 2000-07-14 22:16:45 +0000 | [diff] [blame] | 562 | _res = Py_BuildValue("H", |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 563 | _rv); |
| 564 | return _res; |
| 565 | } |
| 566 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 567 | static PyObject *wasteObj_WESetSelection(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 568 | { |
| 569 | PyObject *_res = NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 570 | SInt32 inSelStart; |
| 571 | SInt32 inSelEnd; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 572 | if (!PyArg_ParseTuple(_args, "ll", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 573 | &inSelStart, |
| 574 | &inSelEnd)) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 575 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 576 | WESetSelection(inSelStart, |
| 577 | inSelEnd, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 578 | _self->ob_itself); |
| 579 | Py_INCREF(Py_None); |
| 580 | _res = Py_None; |
| 581 | return _res; |
| 582 | } |
| 583 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 584 | static PyObject *wasteObj_WESetDestRect(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 585 | { |
| 586 | PyObject *_res = NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 587 | LongRect inDestRect; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 588 | if (!PyArg_ParseTuple(_args, "O&", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 589 | LongRect_Convert, &inDestRect)) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 590 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 591 | WESetDestRect(&inDestRect, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 592 | _self->ob_itself); |
| 593 | Py_INCREF(Py_None); |
| 594 | _res = Py_None; |
| 595 | return _res; |
| 596 | } |
| 597 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 598 | static PyObject *wasteObj_WESetViewRect(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 599 | { |
| 600 | PyObject *_res = NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 601 | LongRect inViewRect; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 602 | if (!PyArg_ParseTuple(_args, "O&", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 603 | LongRect_Convert, &inViewRect)) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 604 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 605 | WESetViewRect(&inViewRect, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 606 | _self->ob_itself); |
| 607 | Py_INCREF(Py_None); |
| 608 | _res = Py_None; |
| 609 | return _res; |
| 610 | } |
| 611 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 612 | static PyObject *wasteObj_WEContinuousStyle(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 613 | { |
| 614 | PyObject *_res = NULL; |
| 615 | Boolean _rv; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 616 | WEStyleMode ioMode; |
| 617 | TextStyle outTextStyle; |
Jack Jansen | 9d8b96c | 2000-07-14 22:16:45 +0000 | [diff] [blame] | 618 | if (!PyArg_ParseTuple(_args, "H", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 619 | &ioMode)) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 620 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 621 | _rv = WEContinuousStyle(&ioMode, |
| 622 | &outTextStyle, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 623 | _self->ob_itself); |
Jack Jansen | 9d8b96c | 2000-07-14 22:16:45 +0000 | [diff] [blame] | 624 | _res = Py_BuildValue("bHO&", |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 625 | _rv, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 626 | ioMode, |
| 627 | TextStyle_New, &outTextStyle); |
| 628 | return _res; |
| 629 | } |
| 630 | |
| 631 | static PyObject *wasteObj_WECountRuns(wasteObject *_self, PyObject *_args) |
| 632 | { |
| 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; |
| 641 | } |
| 642 | |
| 643 | static PyObject *wasteObj_WEOffsetToRun(wasteObject *_self, PyObject *_args) |
| 644 | { |
| 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; |
| 656 | } |
| 657 | |
| 658 | static PyObject *wasteObj_WEGetRunRange(wasteObject *_self, PyObject *_args) |
| 659 | { |
| 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); |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 674 | return _res; |
| 675 | } |
| 676 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 677 | static PyObject *wasteObj_WEGetRunInfo(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 678 | { |
| 679 | PyObject *_res = NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 680 | SInt32 inOffset; |
| 681 | WERunInfo outStyleRunInfo; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 682 | if (!PyArg_ParseTuple(_args, "l", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 683 | &inOffset)) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 684 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 685 | WEGetRunInfo(inOffset, |
| 686 | &outStyleRunInfo, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 687 | _self->ob_itself); |
| 688 | _res = Py_BuildValue("O&", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 689 | RunInfo_New, &outStyleRunInfo); |
| 690 | return _res; |
| 691 | } |
| 692 | |
| 693 | static PyObject *wasteObj_WEGetIndRunInfo(wasteObject *_self, PyObject *_args) |
| 694 | { |
| 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); |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 706 | return _res; |
| 707 | } |
| 708 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 709 | static PyObject *wasteObj_WEGetRunDirection(wasteObject *_self, PyObject *_args) |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 710 | { |
| 711 | PyObject *_res = NULL; |
| 712 | Boolean _rv; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 713 | SInt32 inOffset; |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 714 | if (!PyArg_ParseTuple(_args, "l", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 715 | &inOffset)) |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 716 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 717 | _rv = WEGetRunDirection(inOffset, |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 718 | _self->ob_itself); |
| 719 | _res = Py_BuildValue("b", |
| 720 | _rv); |
| 721 | return _res; |
| 722 | } |
| 723 | |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 724 | static PyObject *wasteObj_WECountParaRuns(wasteObject *_self, PyObject *_args) |
| 725 | { |
| 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; |
| 734 | } |
| 735 | |
| 736 | static PyObject *wasteObj_WEOffsetToParaRun(wasteObject *_self, PyObject *_args) |
| 737 | { |
| 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; |
| 749 | } |
| 750 | |
| 751 | static PyObject *wasteObj_WEGetParaRunRange(wasteObject *_self, PyObject *_args) |
| 752 | { |
| 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; |
| 768 | } |
| 769 | |
| 770 | static PyObject *wasteObj_WECountLines(wasteObject *_self, PyObject *_args) |
| 771 | { |
| 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; |
| 780 | } |
| 781 | |
| 782 | static PyObject *wasteObj_WEOffsetToLine(wasteObject *_self, PyObject *_args) |
| 783 | { |
| 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; |
| 795 | } |
| 796 | |
| 797 | static PyObject *wasteObj_WEGetLineRange(wasteObject *_self, PyObject *_args) |
| 798 | { |
| 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; |
| 814 | } |
| 815 | |
| 816 | static PyObject *wasteObj_WEGetHeight(wasteObject *_self, PyObject *_args) |
| 817 | { |
| 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; |
| 832 | } |
| 833 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 834 | static PyObject *wasteObj_WEGetOffset(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 835 | { |
| 836 | PyObject *_res = NULL; |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 837 | SInt32 _rv; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 838 | LongPt inPoint; |
| 839 | WEEdge outEdge; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 840 | if (!PyArg_ParseTuple(_args, "O&", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 841 | LongPt_Convert, &inPoint)) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 842 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 843 | _rv = WEGetOffset(&inPoint, |
| 844 | &outEdge, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 845 | _self->ob_itself); |
Jack Jansen | 97ed907 | 2000-09-08 22:06:16 +0000 | [diff] [blame] | 846 | _res = Py_BuildValue("lB", |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 847 | _rv, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 848 | outEdge); |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 849 | return _res; |
| 850 | } |
| 851 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 852 | static PyObject *wasteObj_WEGetPoint(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 853 | { |
| 854 | PyObject *_res = NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 855 | SInt32 inOffset; |
| 856 | SInt16 inDirection; |
| 857 | LongPt outPoint; |
| 858 | SInt16 outLineHeight; |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 859 | if (!PyArg_ParseTuple(_args, "lh", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 860 | &inOffset, |
| 861 | &inDirection)) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 862 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 863 | WEGetPoint(inOffset, |
| 864 | inDirection, |
| 865 | &outPoint, |
| 866 | &outLineHeight, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 867 | _self->ob_itself); |
| 868 | _res = Py_BuildValue("O&h", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 869 | LongPt_New, &outPoint, |
| 870 | outLineHeight); |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 871 | return _res; |
| 872 | } |
| 873 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 874 | static PyObject *wasteObj_WEFindWord(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 875 | { |
| 876 | PyObject *_res = NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 877 | SInt32 inOffset; |
| 878 | WEEdge inEdge; |
| 879 | SInt32 outWordStart; |
| 880 | SInt32 outWordEnd; |
Jack Jansen | 97ed907 | 2000-09-08 22:06:16 +0000 | [diff] [blame] | 881 | if (!PyArg_ParseTuple(_args, "lB", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 882 | &inOffset, |
| 883 | &inEdge)) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 884 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 885 | WEFindWord(inOffset, |
| 886 | inEdge, |
| 887 | &outWordStart, |
| 888 | &outWordEnd, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 889 | _self->ob_itself); |
| 890 | _res = Py_BuildValue("ll", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 891 | outWordStart, |
| 892 | outWordEnd); |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 893 | return _res; |
| 894 | } |
| 895 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 896 | static PyObject *wasteObj_WEFindLine(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 897 | { |
| 898 | PyObject *_res = NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 899 | SInt32 inOffset; |
| 900 | WEEdge inEdge; |
| 901 | SInt32 outLineStart; |
| 902 | SInt32 outLineEnd; |
Jack Jansen | 97ed907 | 2000-09-08 22:06:16 +0000 | [diff] [blame] | 903 | if (!PyArg_ParseTuple(_args, "lB", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 904 | &inOffset, |
| 905 | &inEdge)) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 906 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 907 | WEFindLine(inOffset, |
| 908 | inEdge, |
| 909 | &outLineStart, |
| 910 | &outLineEnd, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 911 | _self->ob_itself); |
| 912 | _res = Py_BuildValue("ll", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 913 | outLineStart, |
| 914 | outLineEnd); |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 915 | return _res; |
| 916 | } |
| 917 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 918 | static PyObject *wasteObj_WEFindParagraph(wasteObject *_self, PyObject *_args) |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 919 | { |
| 920 | PyObject *_res = NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 921 | SInt32 inOffset; |
| 922 | WEEdge inEdge; |
| 923 | SInt32 outParagraphStart; |
| 924 | SInt32 outParagraphEnd; |
Jack Jansen | 97ed907 | 2000-09-08 22:06:16 +0000 | [diff] [blame] | 925 | if (!PyArg_ParseTuple(_args, "lB", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 926 | &inOffset, |
| 927 | &inEdge)) |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 928 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 929 | WEFindParagraph(inOffset, |
| 930 | inEdge, |
| 931 | &outParagraphStart, |
| 932 | &outParagraphEnd, |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 933 | _self->ob_itself); |
| 934 | _res = Py_BuildValue("ll", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 935 | outParagraphStart, |
| 936 | outParagraphEnd); |
| 937 | return _res; |
| 938 | } |
| 939 | |
| 940 | static PyObject *wasteObj_WEFind(wasteObject *_self, PyObject *_args) |
| 941 | { |
| 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; |
| 974 | } |
| 975 | |
| 976 | static PyObject *wasteObj_WEStreamRange(wasteObject *_self, PyObject *_args) |
| 977 | { |
| 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; |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 1001 | return _res; |
| 1002 | } |
| 1003 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1004 | static PyObject *wasteObj_WECopyRange(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1005 | { |
| 1006 | PyObject *_res = NULL; |
| 1007 | OSErr _err; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1008 | SInt32 inRangeStart; |
| 1009 | SInt32 inRangeEnd; |
| 1010 | Handle outText; |
| 1011 | StScrpHandle outStyles; |
| 1012 | WESoupHandle outSoup; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1013 | if (!PyArg_ParseTuple(_args, "llO&O&O&", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1014 | &inRangeStart, |
| 1015 | &inRangeEnd, |
| 1016 | OptResObj_Convert, &outText, |
| 1017 | OptResObj_Convert, &outStyles, |
| 1018 | OptResObj_Convert, &outSoup)) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1019 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1020 | _err = WECopyRange(inRangeStart, |
| 1021 | inRangeEnd, |
| 1022 | outText, |
| 1023 | outStyles, |
| 1024 | outSoup, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1025 | _self->ob_itself); |
| 1026 | if (_err != noErr) return PyMac_Error(_err); |
| 1027 | Py_INCREF(Py_None); |
| 1028 | _res = Py_None; |
| 1029 | return _res; |
| 1030 | } |
| 1031 | |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1032 | static PyObject *wasteObj_WEGetTextRangeAsUnicode(wasteObject *_self, PyObject *_args) |
| 1033 | { |
| 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; |
| 1067 | } |
| 1068 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1069 | static PyObject *wasteObj_WEGetAlignment(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1070 | { |
| 1071 | PyObject *_res = NULL; |
| 1072 | WEAlignment _rv; |
| 1073 | if (!PyArg_ParseTuple(_args, "")) |
| 1074 | return NULL; |
| 1075 | _rv = WEGetAlignment(_self->ob_itself); |
Jack Jansen | 97ed907 | 2000-09-08 22:06:16 +0000 | [diff] [blame] | 1076 | _res = Py_BuildValue("B", |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1077 | _rv); |
| 1078 | return _res; |
| 1079 | } |
| 1080 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1081 | static PyObject *wasteObj_WESetAlignment(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1082 | { |
| 1083 | PyObject *_res = NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1084 | WEAlignment inAlignment; |
Jack Jansen | 97ed907 | 2000-09-08 22:06:16 +0000 | [diff] [blame] | 1085 | if (!PyArg_ParseTuple(_args, "B", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1086 | &inAlignment)) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1087 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1088 | WESetAlignment(inAlignment, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1089 | _self->ob_itself); |
| 1090 | Py_INCREF(Py_None); |
| 1091 | _res = Py_None; |
| 1092 | return _res; |
| 1093 | } |
| 1094 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1095 | static PyObject *wasteObj_WEGetDirection(wasteObject *_self, PyObject *_args) |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 1096 | { |
| 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; |
| 1105 | } |
| 1106 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1107 | static PyObject *wasteObj_WESetDirection(wasteObject *_self, PyObject *_args) |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 1108 | { |
| 1109 | PyObject *_res = NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1110 | WEDirection inDirection; |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 1111 | if (!PyArg_ParseTuple(_args, "h", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1112 | &inDirection)) |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 1113 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1114 | WESetDirection(inDirection, |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 1115 | _self->ob_itself); |
| 1116 | Py_INCREF(Py_None); |
| 1117 | _res = Py_None; |
| 1118 | return _res; |
| 1119 | } |
| 1120 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1121 | static PyObject *wasteObj_WECalText(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1122 | { |
| 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; |
| 1132 | } |
| 1133 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1134 | static PyObject *wasteObj_WEUpdate(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1135 | { |
| 1136 | PyObject *_res = NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1137 | RgnHandle inUpdateRgn; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1138 | if (!PyArg_ParseTuple(_args, "O&", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1139 | ResObj_Convert, &inUpdateRgn)) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1140 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1141 | WEUpdate(inUpdateRgn, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1142 | _self->ob_itself); |
| 1143 | Py_INCREF(Py_None); |
| 1144 | _res = Py_None; |
| 1145 | return _res; |
| 1146 | } |
| 1147 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1148 | static PyObject *wasteObj_WEScroll(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1149 | { |
| 1150 | PyObject *_res = NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1151 | SInt32 inHorizontalOffset; |
| 1152 | SInt32 inVerticalOffset; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1153 | if (!PyArg_ParseTuple(_args, "ll", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1154 | &inHorizontalOffset, |
| 1155 | &inVerticalOffset)) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1156 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1157 | WEScroll(inHorizontalOffset, |
| 1158 | inVerticalOffset, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1159 | _self->ob_itself); |
| 1160 | Py_INCREF(Py_None); |
| 1161 | _res = Py_None; |
| 1162 | return _res; |
| 1163 | } |
| 1164 | |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1165 | static PyObject *wasteObj_WEPinScroll(wasteObject *_self, PyObject *_args) |
| 1166 | { |
| 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; |
| 1180 | } |
| 1181 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1182 | static PyObject *wasteObj_WESelView(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1183 | { |
| 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; |
| 1191 | } |
| 1192 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1193 | static PyObject *wasteObj_WEActivate(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1194 | { |
| 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; |
| 1202 | } |
| 1203 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1204 | static PyObject *wasteObj_WEDeactivate(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1205 | { |
| 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; |
| 1213 | } |
| 1214 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1215 | static PyObject *wasteObj_WEKey(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1216 | { |
| 1217 | PyObject *_res = NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1218 | CharParameter inKey; |
| 1219 | EventModifiers inModifiers; |
Jack Jansen | 9d8b96c | 2000-07-14 22:16:45 +0000 | [diff] [blame] | 1220 | if (!PyArg_ParseTuple(_args, "hH", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1221 | &inKey, |
| 1222 | &inModifiers)) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1223 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1224 | WEKey(inKey, |
| 1225 | inModifiers, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1226 | _self->ob_itself); |
| 1227 | Py_INCREF(Py_None); |
| 1228 | _res = Py_None; |
| 1229 | return _res; |
| 1230 | } |
| 1231 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1232 | static PyObject *wasteObj_WEClick(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1233 | { |
| 1234 | PyObject *_res = NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1235 | Point inHitPoint; |
| 1236 | EventModifiers inModifiers; |
| 1237 | UInt32 inClickTime; |
Jack Jansen | 9d8b96c | 2000-07-14 22:16:45 +0000 | [diff] [blame] | 1238 | if (!PyArg_ParseTuple(_args, "O&Hl", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1239 | PyMac_GetPoint, &inHitPoint, |
| 1240 | &inModifiers, |
| 1241 | &inClickTime)) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1242 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1243 | WEClick(inHitPoint, |
| 1244 | inModifiers, |
| 1245 | inClickTime, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1246 | _self->ob_itself); |
| 1247 | Py_INCREF(Py_None); |
| 1248 | _res = Py_None; |
| 1249 | return _res; |
| 1250 | } |
| 1251 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1252 | static PyObject *wasteObj_WEAdjustCursor(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1253 | { |
| 1254 | PyObject *_res = NULL; |
| 1255 | Boolean _rv; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1256 | Point inMouseLoc; |
| 1257 | RgnHandle ioMouseRgn; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1258 | if (!PyArg_ParseTuple(_args, "O&O&", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1259 | PyMac_GetPoint, &inMouseLoc, |
| 1260 | ResObj_Convert, &ioMouseRgn)) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1261 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1262 | _rv = WEAdjustCursor(inMouseLoc, |
| 1263 | ioMouseRgn, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1264 | _self->ob_itself); |
| 1265 | _res = Py_BuildValue("b", |
| 1266 | _rv); |
| 1267 | return _res; |
| 1268 | } |
| 1269 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1270 | static PyObject *wasteObj_WEIdle(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1271 | { |
| 1272 | PyObject *_res = NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1273 | UInt32 outMaxSleep; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1274 | if (!PyArg_ParseTuple(_args, "")) |
| 1275 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1276 | WEIdle(&outMaxSleep, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1277 | _self->ob_itself); |
| 1278 | _res = Py_BuildValue("l", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1279 | outMaxSleep); |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1280 | return _res; |
| 1281 | } |
| 1282 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1283 | static PyObject *wasteObj_WEInsert(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1284 | { |
| 1285 | PyObject *_res = NULL; |
| 1286 | OSErr _err; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1287 | char *inTextPtr__in__; |
| 1288 | long inTextPtr__len__; |
| 1289 | int inTextPtr__in_len__; |
| 1290 | StScrpHandle inStyles; |
| 1291 | WESoupHandle inSoup; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1292 | if (!PyArg_ParseTuple(_args, "s#O&O&", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1293 | &inTextPtr__in__, &inTextPtr__in_len__, |
| 1294 | OptResObj_Convert, &inStyles, |
| 1295 | OptResObj_Convert, &inSoup)) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1296 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1297 | inTextPtr__len__ = inTextPtr__in_len__; |
| 1298 | _err = WEInsert(inTextPtr__in__, inTextPtr__len__, |
| 1299 | inStyles, |
| 1300 | inSoup, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1301 | _self->ob_itself); |
| 1302 | if (_err != noErr) return PyMac_Error(_err); |
| 1303 | Py_INCREF(Py_None); |
| 1304 | _res = Py_None; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1305 | return _res; |
| 1306 | } |
| 1307 | |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1308 | static PyObject *wasteObj_WEInsertFormattedText(wasteObject *_self, PyObject *_args) |
| 1309 | { |
| 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; |
| 1337 | } |
| 1338 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1339 | static PyObject *wasteObj_WEDelete(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1340 | { |
| 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; |
| 1350 | } |
| 1351 | |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1352 | static PyObject *wasteObj_WEUseText(wasteObject *_self, PyObject *_args) |
| 1353 | { |
| 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; |
| 1366 | } |
| 1367 | |
| 1368 | static PyObject *wasteObj_WEChangeCase(wasteObject *_self, PyObject *_args) |
| 1369 | { |
| 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; |
| 1382 | } |
| 1383 | |
| 1384 | static PyObject *wasteObj_WESetOneAttribute(wasteObject *_self, PyObject *_args) |
| 1385 | { |
| 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; |
| 1410 | } |
| 1411 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1412 | static PyObject *wasteObj_WESetStyle(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1413 | { |
| 1414 | PyObject *_res = NULL; |
| 1415 | OSErr _err; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1416 | WEStyleMode inMode; |
| 1417 | TextStyle inTextStyle; |
Jack Jansen | 9d8b96c | 2000-07-14 22:16:45 +0000 | [diff] [blame] | 1418 | if (!PyArg_ParseTuple(_args, "HO&", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1419 | &inMode, |
| 1420 | TextStyle_Convert, &inTextStyle)) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1421 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1422 | _err = WESetStyle(inMode, |
| 1423 | &inTextStyle, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1424 | _self->ob_itself); |
| 1425 | if (_err != noErr) return PyMac_Error(_err); |
| 1426 | Py_INCREF(Py_None); |
| 1427 | _res = Py_None; |
| 1428 | return _res; |
| 1429 | } |
| 1430 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1431 | static PyObject *wasteObj_WEUseStyleScrap(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1432 | { |
| 1433 | PyObject *_res = NULL; |
| 1434 | OSErr _err; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1435 | StScrpHandle inStyles; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1436 | if (!PyArg_ParseTuple(_args, "O&", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1437 | ResObj_Convert, &inStyles)) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1438 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1439 | _err = WEUseStyleScrap(inStyles, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1440 | _self->ob_itself); |
| 1441 | if (_err != noErr) return PyMac_Error(_err); |
| 1442 | Py_INCREF(Py_None); |
| 1443 | _res = Py_None; |
| 1444 | return _res; |
| 1445 | } |
| 1446 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1447 | static PyObject *wasteObj_WEUndo(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1448 | { |
| 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; |
| 1458 | } |
| 1459 | |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1460 | static PyObject *wasteObj_WERedo(wasteObject *_self, PyObject *_args) |
| 1461 | { |
| 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; |
| 1471 | } |
| 1472 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1473 | static PyObject *wasteObj_WEClearUndo(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1474 | { |
| 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; |
| 1482 | } |
| 1483 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1484 | static PyObject *wasteObj_WEGetUndoInfo(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1485 | { |
| 1486 | PyObject *_res = NULL; |
| 1487 | WEActionKind _rv; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1488 | Boolean outRedoFlag; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1489 | if (!PyArg_ParseTuple(_args, "")) |
| 1490 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1491 | _rv = WEGetUndoInfo(&outRedoFlag, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1492 | _self->ob_itself); |
| 1493 | _res = Py_BuildValue("hb", |
| 1494 | _rv, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1495 | outRedoFlag); |
| 1496 | return _res; |
| 1497 | } |
| 1498 | |
| 1499 | static PyObject *wasteObj_WEGetIndUndoInfo(wasteObject *_self, PyObject *_args) |
| 1500 | { |
| 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); |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1511 | return _res; |
| 1512 | } |
| 1513 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1514 | static PyObject *wasteObj_WEIsTyping(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1515 | { |
| 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; |
| 1524 | } |
| 1525 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1526 | static PyObject *wasteObj_WEBeginAction(wasteObject *_self, PyObject *_args) |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 1527 | { |
| 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; |
| 1537 | } |
| 1538 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1539 | static PyObject *wasteObj_WEEndAction(wasteObject *_self, PyObject *_args) |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 1540 | { |
| 1541 | PyObject *_res = NULL; |
| 1542 | OSErr _err; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1543 | WEActionKind inActionKind; |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 1544 | if (!PyArg_ParseTuple(_args, "h", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1545 | &inActionKind)) |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 1546 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1547 | _err = WEEndAction(inActionKind, |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 1548 | _self->ob_itself); |
| 1549 | if (_err != noErr) return PyMac_Error(_err); |
| 1550 | Py_INCREF(Py_None); |
| 1551 | _res = Py_None; |
| 1552 | return _res; |
| 1553 | } |
| 1554 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1555 | static PyObject *wasteObj_WEGetModCount(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1556 | { |
| 1557 | PyObject *_res = NULL; |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 1558 | UInt32 _rv; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1559 | if (!PyArg_ParseTuple(_args, "")) |
| 1560 | return NULL; |
| 1561 | _rv = WEGetModCount(_self->ob_itself); |
| 1562 | _res = Py_BuildValue("l", |
| 1563 | _rv); |
| 1564 | return _res; |
| 1565 | } |
| 1566 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1567 | static PyObject *wasteObj_WEResetModCount(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1568 | { |
| 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; |
| 1576 | } |
| 1577 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1578 | static PyObject *wasteObj_WEInsertObject(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1579 | { |
| 1580 | PyObject *_res = NULL; |
| 1581 | OSErr _err; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1582 | FlavorType inObjectType; |
| 1583 | Handle inObjectDataHandle; |
| 1584 | Point inObjectSize; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1585 | if (!PyArg_ParseTuple(_args, "O&O&O&", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1586 | PyMac_GetOSType, &inObjectType, |
| 1587 | ResObj_Convert, &inObjectDataHandle, |
| 1588 | PyMac_GetPoint, &inObjectSize)) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1589 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1590 | _err = WEInsertObject(inObjectType, |
| 1591 | inObjectDataHandle, |
| 1592 | inObjectSize, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1593 | _self->ob_itself); |
| 1594 | if (_err != noErr) return PyMac_Error(_err); |
| 1595 | Py_INCREF(Py_None); |
| 1596 | _res = Py_None; |
| 1597 | return _res; |
| 1598 | } |
| 1599 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1600 | static PyObject *wasteObj_WEGetSelectedObject(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1601 | { |
| 1602 | PyObject *_res = NULL; |
| 1603 | OSErr _err; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1604 | WEObjectReference outObject; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1605 | if (!PyArg_ParseTuple(_args, "")) |
| 1606 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1607 | _err = WEGetSelectedObject(&outObject, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1608 | _self->ob_itself); |
| 1609 | if (_err != noErr) return PyMac_Error(_err); |
| 1610 | _res = Py_BuildValue("O&", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1611 | WEOObj_New, outObject); |
| 1612 | return _res; |
| 1613 | } |
| 1614 | |
| 1615 | static PyObject *wasteObj_WEGetObjectAtOffset(wasteObject *_self, PyObject *_args) |
| 1616 | { |
| 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); |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1630 | return _res; |
| 1631 | } |
| 1632 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1633 | static PyObject *wasteObj_WEFindNextObject(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1634 | { |
| 1635 | PyObject *_res = NULL; |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 1636 | SInt32 _rv; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1637 | SInt32 inOffset; |
| 1638 | WEObjectReference outObject; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1639 | if (!PyArg_ParseTuple(_args, "l", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1640 | &inOffset)) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1641 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1642 | _rv = WEFindNextObject(inOffset, |
| 1643 | &outObject, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1644 | _self->ob_itself); |
| 1645 | _res = Py_BuildValue("lO&", |
| 1646 | _rv, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1647 | WEOObj_New, outObject); |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1648 | return _res; |
| 1649 | } |
| 1650 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1651 | static PyObject *wasteObj_WEUseSoup(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1652 | { |
| 1653 | PyObject *_res = NULL; |
| 1654 | OSErr _err; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1655 | WESoupHandle inSoup; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1656 | if (!PyArg_ParseTuple(_args, "O&", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1657 | ResObj_Convert, &inSoup)) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1658 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1659 | _err = WEUseSoup(inSoup, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1660 | _self->ob_itself); |
| 1661 | if (_err != noErr) return PyMac_Error(_err); |
| 1662 | Py_INCREF(Py_None); |
| 1663 | _res = Py_None; |
| 1664 | return _res; |
| 1665 | } |
| 1666 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1667 | static PyObject *wasteObj_WECut(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1668 | { |
| 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; |
| 1678 | } |
| 1679 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1680 | static PyObject *wasteObj_WECopy(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1681 | { |
| 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; |
| 1691 | } |
| 1692 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1693 | static PyObject *wasteObj_WEPaste(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1694 | { |
| 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; |
| 1704 | } |
| 1705 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1706 | static PyObject *wasteObj_WECanPaste(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1707 | { |
| 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; |
| 1716 | } |
| 1717 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1718 | static PyObject *wasteObj_WEGetHiliteRgn(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1719 | { |
| 1720 | PyObject *_res = NULL; |
| 1721 | RgnHandle _rv; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1722 | SInt32 inRangeStart; |
| 1723 | SInt32 inRangeEnd; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1724 | if (!PyArg_ParseTuple(_args, "ll", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1725 | &inRangeStart, |
| 1726 | &inRangeEnd)) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1727 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1728 | _rv = WEGetHiliteRgn(inRangeStart, |
| 1729 | inRangeEnd, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1730 | _self->ob_itself); |
| 1731 | _res = Py_BuildValue("O&", |
| 1732 | ResObj_New, _rv); |
| 1733 | return _res; |
| 1734 | } |
| 1735 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1736 | static PyObject *wasteObj_WECharByte(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1737 | { |
| 1738 | PyObject *_res = NULL; |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 1739 | SInt16 _rv; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1740 | SInt32 inOffset; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1741 | if (!PyArg_ParseTuple(_args, "l", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1742 | &inOffset)) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1743 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1744 | _rv = WECharByte(inOffset, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1745 | _self->ob_itself); |
| 1746 | _res = Py_BuildValue("h", |
| 1747 | _rv); |
| 1748 | return _res; |
| 1749 | } |
| 1750 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1751 | static PyObject *wasteObj_WECharType(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1752 | { |
| 1753 | PyObject *_res = NULL; |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 1754 | SInt16 _rv; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1755 | SInt32 inOffset; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1756 | if (!PyArg_ParseTuple(_args, "l", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1757 | &inOffset)) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1758 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1759 | _rv = WECharType(inOffset, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1760 | _self->ob_itself); |
| 1761 | _res = Py_BuildValue("h", |
| 1762 | _rv); |
| 1763 | return _res; |
| 1764 | } |
| 1765 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1766 | static PyObject *wasteObj_WEStopInlineSession(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1767 | { |
| 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; |
| 1775 | } |
| 1776 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1777 | static PyObject *wasteObj_WEFeatureFlag(wasteObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1778 | { |
| 1779 | PyObject *_res = NULL; |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 1780 | SInt16 _rv; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1781 | SInt16 inFeature; |
| 1782 | SInt16 inAction; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1783 | if (!PyArg_ParseTuple(_args, "hh", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1784 | &inFeature, |
| 1785 | &inAction)) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1786 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1787 | _rv = WEFeatureFlag(inFeature, |
| 1788 | inAction, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1789 | _self->ob_itself); |
| 1790 | _res = Py_BuildValue("h", |
| 1791 | _rv); |
| 1792 | return _res; |
| 1793 | } |
| 1794 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1795 | static PyObject *wasteObj_WEGetUserInfo(wasteObject *_self, PyObject *_args) |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 1796 | { |
| 1797 | PyObject *_res = NULL; |
| 1798 | OSErr _err; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1799 | WESelector inUserTag; |
| 1800 | SInt32 outUserInfo; |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 1801 | if (!PyArg_ParseTuple(_args, "O&", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1802 | PyMac_GetOSType, &inUserTag)) |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 1803 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1804 | _err = WEGetUserInfo(inUserTag, |
| 1805 | &outUserInfo, |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 1806 | _self->ob_itself); |
| 1807 | if (_err != noErr) return PyMac_Error(_err); |
| 1808 | _res = Py_BuildValue("l", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1809 | outUserInfo); |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 1810 | return _res; |
| 1811 | } |
| 1812 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1813 | static PyObject *wasteObj_WESetUserInfo(wasteObject *_self, PyObject *_args) |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 1814 | { |
| 1815 | PyObject *_res = NULL; |
| 1816 | OSErr _err; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1817 | WESelector inUserTag; |
| 1818 | SInt32 inUserInfo; |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 1819 | if (!PyArg_ParseTuple(_args, "O&l", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1820 | PyMac_GetOSType, &inUserTag, |
| 1821 | &inUserInfo)) |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 1822 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1823 | _err = WESetUserInfo(inUserTag, |
| 1824 | inUserInfo, |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 1825 | _self->ob_itself); |
| 1826 | if (_err != noErr) return PyMac_Error(_err); |
| 1827 | Py_INCREF(Py_None); |
| 1828 | _res = Py_None; |
| 1829 | return _res; |
| 1830 | } |
| 1831 | |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1832 | static PyObject *wasteObj_WERemoveUserInfo(wasteObject *_self, PyObject *_args) |
| 1833 | { |
| 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; |
| 1846 | } |
| 1847 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1848 | static PyObject *wasteObj_WEInstallTabHooks(wasteObject *_self, PyObject *_args) |
Jack Jansen | 176f3a9 | 1996-10-23 15:43:46 +0000 | [diff] [blame] | 1849 | { |
| 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; |
| 1859 | } |
| 1860 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1861 | static PyObject *wasteObj_WERemoveTabHooks(wasteObject *_self, PyObject *_args) |
Jack Jansen | 176f3a9 | 1996-10-23 15:43:46 +0000 | [diff] [blame] | 1862 | { |
| 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; |
| 1872 | } |
| 1873 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1874 | static PyObject *wasteObj_WEIsTabHooks(wasteObject *_self, PyObject *_args) |
Jack Jansen | 176f3a9 | 1996-10-23 15:43:46 +0000 | [diff] [blame] | 1875 | { |
| 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; |
| 1884 | } |
| 1885 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1886 | static PyObject *wasteObj_WEGetTabSize(wasteObject *_self, PyObject *_args) |
Jack Jansen | a4f0309 | 1998-03-02 16:56:18 +0000 | [diff] [blame] | 1887 | { |
| 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; |
| 1896 | } |
| 1897 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 1898 | static PyObject *wasteObj_WESetTabSize(wasteObject *_self, PyObject *_args) |
Jack Jansen | a4f0309 | 1998-03-02 16:56:18 +0000 | [diff] [blame] | 1899 | { |
| 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; |
| 1912 | } |
| 1913 | |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1914 | static PyMethodDef wasteObj_methods[] = { |
| 1915 | {"WEGetText", (PyCFunction)wasteObj_WEGetText, 1, |
| 1916 | "() -> (Handle _rv)"}, |
| 1917 | {"WEGetChar", (PyCFunction)wasteObj_WEGetChar, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1918 | "(SInt32 inOffset) -> (SInt16 _rv)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1919 | {"WEGetTextLength", (PyCFunction)wasteObj_WEGetTextLength, 1, |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 1920 | "() -> (SInt32 _rv)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1921 | {"WEGetSelection", (PyCFunction)wasteObj_WEGetSelection, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1922 | "() -> (SInt32 outSelStart, SInt32 outSelEnd)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1923 | {"WEGetDestRect", (PyCFunction)wasteObj_WEGetDestRect, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1924 | "() -> (LongRect outDestRect)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1925 | {"WEGetViewRect", (PyCFunction)wasteObj_WEGetViewRect, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1926 | "() -> (LongRect outViewRect)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1927 | {"WEIsActive", (PyCFunction)wasteObj_WEIsActive, 1, |
| 1928 | "() -> (Boolean _rv)"}, |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 1929 | {"WEGetClickCount", (PyCFunction)wasteObj_WEGetClickCount, 1, |
| 1930 | "() -> (UInt16 _rv)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1931 | {"WESetSelection", (PyCFunction)wasteObj_WESetSelection, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1932 | "(SInt32 inSelStart, SInt32 inSelEnd) -> None"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1933 | {"WESetDestRect", (PyCFunction)wasteObj_WESetDestRect, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1934 | "(LongRect inDestRect) -> None"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1935 | {"WESetViewRect", (PyCFunction)wasteObj_WESetViewRect, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1936 | "(LongRect inViewRect) -> None"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1937 | {"WEContinuousStyle", (PyCFunction)wasteObj_WEContinuousStyle, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1938 | "(WEStyleMode ioMode) -> (Boolean _rv, WEStyleMode ioMode, TextStyle outTextStyle)"}, |
| 1939 | {"WECountRuns", (PyCFunction)wasteObj_WECountRuns, 1, |
| 1940 | "() -> (SInt32 _rv)"}, |
| 1941 | {"WEOffsetToRun", (PyCFunction)wasteObj_WEOffsetToRun, 1, |
| 1942 | "(SInt32 inOffset) -> (SInt32 _rv)"}, |
| 1943 | {"WEGetRunRange", (PyCFunction)wasteObj_WEGetRunRange, 1, |
| 1944 | "(SInt32 inStyleRunIndex) -> (SInt32 outStyleRunStart, SInt32 outStyleRunEnd)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1945 | {"WEGetRunInfo", (PyCFunction)wasteObj_WEGetRunInfo, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1946 | "(SInt32 inOffset) -> (WERunInfo outStyleRunInfo)"}, |
| 1947 | {"WEGetIndRunInfo", (PyCFunction)wasteObj_WEGetIndRunInfo, 1, |
| 1948 | "(SInt32 inStyleRunIndex) -> (WERunInfo outStyleRunInfo)"}, |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 1949 | {"WEGetRunDirection", (PyCFunction)wasteObj_WEGetRunDirection, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1950 | "(SInt32 inOffset) -> (Boolean _rv)"}, |
| 1951 | {"WECountParaRuns", (PyCFunction)wasteObj_WECountParaRuns, 1, |
| 1952 | "() -> (SInt32 _rv)"}, |
| 1953 | {"WEOffsetToParaRun", (PyCFunction)wasteObj_WEOffsetToParaRun, 1, |
| 1954 | "(SInt32 inOffset) -> (SInt32 _rv)"}, |
| 1955 | {"WEGetParaRunRange", (PyCFunction)wasteObj_WEGetParaRunRange, 1, |
| 1956 | "(SInt32 inParagraphRunIndex) -> (SInt32 outParagraphRunStart, SInt32 outParagraphRunEnd)"}, |
| 1957 | {"WECountLines", (PyCFunction)wasteObj_WECountLines, 1, |
| 1958 | "() -> (SInt32 _rv)"}, |
| 1959 | {"WEOffsetToLine", (PyCFunction)wasteObj_WEOffsetToLine, 1, |
| 1960 | "(SInt32 inOffset) -> (SInt32 _rv)"}, |
| 1961 | {"WEGetLineRange", (PyCFunction)wasteObj_WEGetLineRange, 1, |
| 1962 | "(SInt32 inLineIndex) -> (SInt32 outLineStart, SInt32 outLineEnd)"}, |
| 1963 | {"WEGetHeight", (PyCFunction)wasteObj_WEGetHeight, 1, |
| 1964 | "(SInt32 inStartLineIndex, SInt32 inEndLineIndex) -> (SInt32 _rv)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1965 | {"WEGetOffset", (PyCFunction)wasteObj_WEGetOffset, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1966 | "(LongPt inPoint) -> (SInt32 _rv, WEEdge outEdge)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1967 | {"WEGetPoint", (PyCFunction)wasteObj_WEGetPoint, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1968 | "(SInt32 inOffset, SInt16 inDirection) -> (LongPt outPoint, SInt16 outLineHeight)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1969 | {"WEFindWord", (PyCFunction)wasteObj_WEFindWord, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1970 | "(SInt32 inOffset, WEEdge inEdge) -> (SInt32 outWordStart, SInt32 outWordEnd)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1971 | {"WEFindLine", (PyCFunction)wasteObj_WEFindLine, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1972 | "(SInt32 inOffset, WEEdge inEdge) -> (SInt32 outLineStart, SInt32 outLineEnd)"}, |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 1973 | {"WEFindParagraph", (PyCFunction)wasteObj_WEFindParagraph, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1974 | "(SInt32 inOffset, WEEdge inEdge) -> (SInt32 outParagraphStart, SInt32 outParagraphEnd)"}, |
| 1975 | {"WEFind", (PyCFunction)wasteObj_WEFind, 1, |
| 1976 | "(char* inKey, SInt32 inKeyLength, TextEncoding inKeyEncoding, OptionBits inMatchOptions, SInt32 inRangeStart, SInt32 inRangeEnd) -> (SInt32 outMatchStart, SInt32 outMatchEnd)"}, |
| 1977 | {"WEStreamRange", (PyCFunction)wasteObj_WEStreamRange, 1, |
| 1978 | "(SInt32 inRangeStart, SInt32 inRangeEnd, FlavorType inRequestedType, OptionBits inStreamOptions, Handle outData) -> None"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1979 | {"WECopyRange", (PyCFunction)wasteObj_WECopyRange, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1980 | "(SInt32 inRangeStart, SInt32 inRangeEnd, Handle outText, StScrpHandle outStyles, WESoupHandle outSoup) -> None"}, |
| 1981 | {"WEGetTextRangeAsUnicode", (PyCFunction)wasteObj_WEGetTextRangeAsUnicode, 1, |
| 1982 | "(SInt32 inRangeStart, SInt32 inRangeEnd, Handle outUnicodeText, Handle ioCharFormat, Handle ioParaFormat, TextEncodingVariant inUnicodeVariant, TextEncodingFormat inTransformationFormat, OptionBits inGetOptions) -> None"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1983 | {"WEGetAlignment", (PyCFunction)wasteObj_WEGetAlignment, 1, |
| 1984 | "() -> (WEAlignment _rv)"}, |
| 1985 | {"WESetAlignment", (PyCFunction)wasteObj_WESetAlignment, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1986 | "(WEAlignment inAlignment) -> None"}, |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 1987 | {"WEGetDirection", (PyCFunction)wasteObj_WEGetDirection, 1, |
| 1988 | "() -> (WEDirection _rv)"}, |
| 1989 | {"WESetDirection", (PyCFunction)wasteObj_WESetDirection, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1990 | "(WEDirection inDirection) -> None"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1991 | {"WECalText", (PyCFunction)wasteObj_WECalText, 1, |
| 1992 | "() -> None"}, |
| 1993 | {"WEUpdate", (PyCFunction)wasteObj_WEUpdate, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1994 | "(RgnHandle inUpdateRgn) -> None"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1995 | {"WEScroll", (PyCFunction)wasteObj_WEScroll, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 1996 | "(SInt32 inHorizontalOffset, SInt32 inVerticalOffset) -> None"}, |
| 1997 | {"WEPinScroll", (PyCFunction)wasteObj_WEPinScroll, 1, |
| 1998 | "(SInt32 inHorizontalOffset, SInt32 inVerticalOffset) -> None"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1999 | {"WESelView", (PyCFunction)wasteObj_WESelView, 1, |
| 2000 | "() -> None"}, |
| 2001 | {"WEActivate", (PyCFunction)wasteObj_WEActivate, 1, |
| 2002 | "() -> None"}, |
| 2003 | {"WEDeactivate", (PyCFunction)wasteObj_WEDeactivate, 1, |
| 2004 | "() -> None"}, |
| 2005 | {"WEKey", (PyCFunction)wasteObj_WEKey, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2006 | "(CharParameter inKey, EventModifiers inModifiers) -> None"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2007 | {"WEClick", (PyCFunction)wasteObj_WEClick, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2008 | "(Point inHitPoint, EventModifiers inModifiers, UInt32 inClickTime) -> None"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2009 | {"WEAdjustCursor", (PyCFunction)wasteObj_WEAdjustCursor, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2010 | "(Point inMouseLoc, RgnHandle ioMouseRgn) -> (Boolean _rv)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2011 | {"WEIdle", (PyCFunction)wasteObj_WEIdle, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2012 | "() -> (UInt32 outMaxSleep)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2013 | {"WEInsert", (PyCFunction)wasteObj_WEInsert, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2014 | "(Buffer inTextPtr, StScrpHandle inStyles, WESoupHandle inSoup) -> None"}, |
| 2015 | {"WEInsertFormattedText", (PyCFunction)wasteObj_WEInsertFormattedText, 1, |
| 2016 | "(Buffer inTextPtr, StScrpHandle inStyles, WESoupHandle inSoup, Handle inParaFormat, Handle inRulerScrap) -> None"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2017 | {"WEDelete", (PyCFunction)wasteObj_WEDelete, 1, |
| 2018 | "() -> None"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2019 | {"WEUseText", (PyCFunction)wasteObj_WEUseText, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2020 | "(Handle inText) -> None"}, |
| 2021 | {"WEChangeCase", (PyCFunction)wasteObj_WEChangeCase, 1, |
| 2022 | "(SInt16 inCase) -> None"}, |
| 2023 | {"WESetOneAttribute", (PyCFunction)wasteObj_WESetOneAttribute, 1, |
| 2024 | "(SInt32 inRangeStart, SInt32 inRangeEnd, WESelector inAttributeSelector, Buffer inAttributeValue) -> None"}, |
| 2025 | {"WESetStyle", (PyCFunction)wasteObj_WESetStyle, 1, |
| 2026 | "(WEStyleMode inMode, TextStyle inTextStyle) -> None"}, |
| 2027 | {"WEUseStyleScrap", (PyCFunction)wasteObj_WEUseStyleScrap, 1, |
| 2028 | "(StScrpHandle inStyles) -> None"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2029 | {"WEUndo", (PyCFunction)wasteObj_WEUndo, 1, |
| 2030 | "() -> None"}, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2031 | {"WERedo", (PyCFunction)wasteObj_WERedo, 1, |
| 2032 | "() -> None"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2033 | {"WEClearUndo", (PyCFunction)wasteObj_WEClearUndo, 1, |
| 2034 | "() -> None"}, |
| 2035 | {"WEGetUndoInfo", (PyCFunction)wasteObj_WEGetUndoInfo, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2036 | "() -> (WEActionKind _rv, Boolean outRedoFlag)"}, |
| 2037 | {"WEGetIndUndoInfo", (PyCFunction)wasteObj_WEGetIndUndoInfo, 1, |
| 2038 | "(SInt32 inUndoLevel) -> (WEActionKind _rv)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2039 | {"WEIsTyping", (PyCFunction)wasteObj_WEIsTyping, 1, |
| 2040 | "() -> (Boolean _rv)"}, |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 2041 | {"WEBeginAction", (PyCFunction)wasteObj_WEBeginAction, 1, |
| 2042 | "() -> None"}, |
| 2043 | {"WEEndAction", (PyCFunction)wasteObj_WEEndAction, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2044 | "(WEActionKind inActionKind) -> None"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2045 | {"WEGetModCount", (PyCFunction)wasteObj_WEGetModCount, 1, |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 2046 | "() -> (UInt32 _rv)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2047 | {"WEResetModCount", (PyCFunction)wasteObj_WEResetModCount, 1, |
| 2048 | "() -> None"}, |
| 2049 | {"WEInsertObject", (PyCFunction)wasteObj_WEInsertObject, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2050 | "(FlavorType inObjectType, Handle inObjectDataHandle, Point inObjectSize) -> None"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2051 | {"WEGetSelectedObject", (PyCFunction)wasteObj_WEGetSelectedObject, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2052 | "() -> (WEObjectReference outObject)"}, |
| 2053 | {"WEGetObjectAtOffset", (PyCFunction)wasteObj_WEGetObjectAtOffset, 1, |
| 2054 | "(SInt32 inOffset) -> (WEObjectReference outObject)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2055 | {"WEFindNextObject", (PyCFunction)wasteObj_WEFindNextObject, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2056 | "(SInt32 inOffset) -> (SInt32 _rv, WEObjectReference outObject)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2057 | {"WEUseSoup", (PyCFunction)wasteObj_WEUseSoup, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2058 | "(WESoupHandle inSoup) -> None"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2059 | {"WECut", (PyCFunction)wasteObj_WECut, 1, |
| 2060 | "() -> None"}, |
| 2061 | {"WECopy", (PyCFunction)wasteObj_WECopy, 1, |
| 2062 | "() -> None"}, |
| 2063 | {"WEPaste", (PyCFunction)wasteObj_WEPaste, 1, |
| 2064 | "() -> None"}, |
| 2065 | {"WECanPaste", (PyCFunction)wasteObj_WECanPaste, 1, |
| 2066 | "() -> (Boolean _rv)"}, |
| 2067 | {"WEGetHiliteRgn", (PyCFunction)wasteObj_WEGetHiliteRgn, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2068 | "(SInt32 inRangeStart, SInt32 inRangeEnd) -> (RgnHandle _rv)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2069 | {"WECharByte", (PyCFunction)wasteObj_WECharByte, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2070 | "(SInt32 inOffset) -> (SInt16 _rv)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2071 | {"WECharType", (PyCFunction)wasteObj_WECharType, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2072 | "(SInt32 inOffset) -> (SInt16 _rv)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2073 | {"WEStopInlineSession", (PyCFunction)wasteObj_WEStopInlineSession, 1, |
| 2074 | "() -> None"}, |
| 2075 | {"WEFeatureFlag", (PyCFunction)wasteObj_WEFeatureFlag, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2076 | "(SInt16 inFeature, SInt16 inAction) -> (SInt16 _rv)"}, |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 2077 | {"WEGetUserInfo", (PyCFunction)wasteObj_WEGetUserInfo, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2078 | "(WESelector inUserTag) -> (SInt32 outUserInfo)"}, |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 2079 | {"WESetUserInfo", (PyCFunction)wasteObj_WESetUserInfo, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2080 | "(WESelector inUserTag, SInt32 inUserInfo) -> None"}, |
| 2081 | {"WERemoveUserInfo", (PyCFunction)wasteObj_WERemoveUserInfo, 1, |
| 2082 | "(WESelector inUserTag) -> None"}, |
Jack Jansen | 176f3a9 | 1996-10-23 15:43:46 +0000 | [diff] [blame] | 2083 | {"WEInstallTabHooks", (PyCFunction)wasteObj_WEInstallTabHooks, 1, |
| 2084 | "() -> None"}, |
| 2085 | {"WERemoveTabHooks", (PyCFunction)wasteObj_WERemoveTabHooks, 1, |
| 2086 | "() -> None"}, |
| 2087 | {"WEIsTabHooks", (PyCFunction)wasteObj_WEIsTabHooks, 1, |
| 2088 | "() -> (Boolean _rv)"}, |
Jack Jansen | a4f0309 | 1998-03-02 16:56:18 +0000 | [diff] [blame] | 2089 | {"WEGetTabSize", (PyCFunction)wasteObj_WEGetTabSize, 1, |
| 2090 | "() -> (SInt16 _rv)"}, |
| 2091 | {"WESetTabSize", (PyCFunction)wasteObj_WESetTabSize, 1, |
| 2092 | "(SInt16 tabWidth) -> None"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2093 | {NULL, NULL, 0} |
| 2094 | }; |
| 2095 | |
| 2096 | PyMethodChain wasteObj_chain = { wasteObj_methods, NULL }; |
| 2097 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 2098 | static PyObject *wasteObj_getattr(wasteObject *self, char *name) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2099 | { |
| 2100 | return Py_FindMethodInChain(&wasteObj_chain, (PyObject *)self, name); |
| 2101 | } |
| 2102 | |
| 2103 | #define wasteObj_setattr NULL |
| 2104 | |
Jack Jansen | 9d8b96c | 2000-07-14 22:16:45 +0000 | [diff] [blame] | 2105 | #define wasteObj_compare NULL |
| 2106 | |
| 2107 | #define wasteObj_repr NULL |
| 2108 | |
| 2109 | #define wasteObj_hash NULL |
| 2110 | |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2111 | PyTypeObject waste_Type = { |
Jack Jansen | b3be216 | 2001-11-30 14:16:36 +0000 | [diff] [blame] | 2112 | PyObject_HEAD_INIT(NULL) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2113 | 0, /*ob_size*/ |
Guido van Rossum | 1464839 | 2001-12-08 18:02:58 +0000 | [diff] [blame] | 2114 | "waste.waste", /*tp_name*/ |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 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*/ |
Jack Jansen | 9d8b96c | 2000-07-14 22:16:45 +0000 | [diff] [blame] | 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*/ |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2128 | }; |
| 2129 | |
| 2130 | /* --------------------- End object type waste ---------------------- */ |
| 2131 | |
| 2132 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 2133 | static PyObject *waste_WENew(PyObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2134 | { |
| 2135 | PyObject *_res = NULL; |
| 2136 | OSErr _err; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2137 | LongRect inDestRect; |
| 2138 | LongRect inViewRect; |
| 2139 | OptionBits inOptions; |
| 2140 | WEReference outWE; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2141 | if (!PyArg_ParseTuple(_args, "O&O&l", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2142 | LongRect_Convert, &inDestRect, |
| 2143 | LongRect_Convert, &inViewRect, |
| 2144 | &inOptions)) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2145 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2146 | _err = WENew(&inDestRect, |
| 2147 | &inViewRect, |
| 2148 | inOptions, |
| 2149 | &outWE); |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2150 | if (_err != noErr) return PyMac_Error(_err); |
| 2151 | _res = Py_BuildValue("O&", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2152 | wasteObj_New, outWE); |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2153 | return _res; |
| 2154 | } |
| 2155 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 2156 | static PyObject *waste_WEUpdateStyleScrap(PyObject *_self, PyObject *_args) |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 2157 | { |
| 2158 | PyObject *_res = NULL; |
| 2159 | OSErr _err; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2160 | StScrpHandle ioStyles; |
| 2161 | WEFontTableHandle inFontTable; |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 2162 | if (!PyArg_ParseTuple(_args, "O&O&", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2163 | ResObj_Convert, &ioStyles, |
| 2164 | ResObj_Convert, &inFontTable)) |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 2165 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2166 | _err = WEUpdateStyleScrap(ioStyles, |
| 2167 | inFontTable); |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 2168 | if (_err != noErr) return PyMac_Error(_err); |
| 2169 | Py_INCREF(Py_None); |
| 2170 | _res = Py_None; |
| 2171 | return _res; |
| 2172 | } |
| 2173 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 2174 | static PyObject *waste_WEInstallTSMHandlers(PyObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2175 | { |
| 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; |
| 2185 | } |
| 2186 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 2187 | static PyObject *waste_WERemoveTSMHandlers(PyObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2188 | { |
| 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; |
| 2198 | } |
| 2199 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 2200 | static PyObject *waste_WEHandleTSMEvent(PyObject *_self, PyObject *_args) |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 2201 | { |
| 2202 | PyObject *_res = NULL; |
| 2203 | OSErr _err; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2204 | AppleEvent inAppleEvent; |
| 2205 | AppleEvent ioReply; |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 2206 | if (!PyArg_ParseTuple(_args, "O&", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2207 | AEDesc_Convert, &inAppleEvent)) |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 2208 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2209 | _err = WEHandleTSMEvent(&inAppleEvent, |
| 2210 | &ioReply); |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 2211 | if (_err != noErr) return PyMac_Error(_err); |
| 2212 | _res = Py_BuildValue("O&", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2213 | AEDesc_New, &ioReply); |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 2214 | return _res; |
| 2215 | } |
| 2216 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 2217 | static PyObject *waste_WELongPointToPoint(PyObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2218 | { |
| 2219 | PyObject *_res = NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2220 | LongPt inLongPoint; |
| 2221 | Point outPoint; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2222 | if (!PyArg_ParseTuple(_args, "O&", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2223 | LongPt_Convert, &inLongPoint)) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2224 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2225 | WELongPointToPoint(&inLongPoint, |
| 2226 | &outPoint); |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2227 | _res = Py_BuildValue("O&", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2228 | PyMac_BuildPoint, outPoint); |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2229 | return _res; |
| 2230 | } |
| 2231 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 2232 | static PyObject *waste_WEPointToLongPoint(PyObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2233 | { |
| 2234 | PyObject *_res = NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2235 | Point inPoint; |
| 2236 | LongPt outLongPoint; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2237 | if (!PyArg_ParseTuple(_args, "O&", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2238 | PyMac_GetPoint, &inPoint)) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2239 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2240 | WEPointToLongPoint(inPoint, |
| 2241 | &outLongPoint); |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2242 | _res = Py_BuildValue("O&", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2243 | LongPt_New, &outLongPoint); |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2244 | return _res; |
| 2245 | } |
| 2246 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 2247 | static PyObject *waste_WESetLongRect(PyObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2248 | { |
| 2249 | PyObject *_res = NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2250 | LongRect outLongRect; |
| 2251 | SInt32 inLeft; |
| 2252 | SInt32 inTop; |
| 2253 | SInt32 inRight; |
| 2254 | SInt32 inBottom; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2255 | if (!PyArg_ParseTuple(_args, "llll", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2256 | &inLeft, |
| 2257 | &inTop, |
| 2258 | &inRight, |
| 2259 | &inBottom)) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2260 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2261 | WESetLongRect(&outLongRect, |
| 2262 | inLeft, |
| 2263 | inTop, |
| 2264 | inRight, |
| 2265 | inBottom); |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2266 | _res = Py_BuildValue("O&", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2267 | LongRect_New, &outLongRect); |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2268 | return _res; |
| 2269 | } |
| 2270 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 2271 | static PyObject *waste_WELongRectToRect(PyObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2272 | { |
| 2273 | PyObject *_res = NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2274 | LongRect inLongRect; |
| 2275 | Rect outRect; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2276 | if (!PyArg_ParseTuple(_args, "O&", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2277 | LongRect_Convert, &inLongRect)) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2278 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2279 | WELongRectToRect(&inLongRect, |
| 2280 | &outRect); |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2281 | _res = Py_BuildValue("O&", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2282 | PyMac_BuildRect, &outRect); |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2283 | return _res; |
| 2284 | } |
| 2285 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 2286 | static PyObject *waste_WERectToLongRect(PyObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2287 | { |
| 2288 | PyObject *_res = NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2289 | Rect inRect; |
| 2290 | LongRect outLongRect; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2291 | if (!PyArg_ParseTuple(_args, "O&", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2292 | PyMac_GetRect, &inRect)) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2293 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2294 | WERectToLongRect(&inRect, |
| 2295 | &outLongRect); |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2296 | _res = Py_BuildValue("O&", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2297 | LongRect_New, &outLongRect); |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2298 | return _res; |
| 2299 | } |
| 2300 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 2301 | static PyObject *waste_WEOffsetLongRect(PyObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2302 | { |
| 2303 | PyObject *_res = NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2304 | LongRect ioLongRect; |
| 2305 | SInt32 inHorizontalOffset; |
| 2306 | SInt32 inVerticalOffset; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2307 | if (!PyArg_ParseTuple(_args, "ll", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2308 | &inHorizontalOffset, |
| 2309 | &inVerticalOffset)) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2310 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2311 | WEOffsetLongRect(&ioLongRect, |
| 2312 | inHorizontalOffset, |
| 2313 | inVerticalOffset); |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2314 | _res = Py_BuildValue("O&", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2315 | LongRect_New, &ioLongRect); |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2316 | return _res; |
| 2317 | } |
| 2318 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 2319 | static PyObject *waste_WELongPointInLongRect(PyObject *_self, PyObject *_args) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2320 | { |
| 2321 | PyObject *_res = NULL; |
| 2322 | Boolean _rv; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2323 | LongPt inLongPoint; |
| 2324 | LongRect inLongRect; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2325 | if (!PyArg_ParseTuple(_args, "O&O&", |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2326 | LongPt_Convert, &inLongPoint, |
| 2327 | LongRect_Convert, &inLongRect)) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2328 | return NULL; |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2329 | _rv = WELongPointInLongRect(&inLongPoint, |
| 2330 | &inLongRect); |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2331 | _res = Py_BuildValue("b", |
| 2332 | _rv); |
| 2333 | return _res; |
| 2334 | } |
| 2335 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 2336 | static PyObject *waste_STDObjectHandlers(PyObject *_self, PyObject *_args) |
Jack Jansen | 756522f | 1996-05-07 15:24:01 +0000 | [diff] [blame] | 2337 | { |
| 2338 | PyObject *_res = NULL; |
| 2339 | |
| 2340 | OSErr err; |
| 2341 | // install the sample object handlers for pictures and sounds |
| 2342 | #define kTypePicture 'PICT' |
| 2343 | #define kTypeSound 'snd ' |
| 2344 | |
| 2345 | if ( !PyArg_ParseTuple(_args, "") ) return NULL; |
| 2346 | |
| 2347 | if ((err = WEInstallObjectHandler(kTypePicture, weNewHandler, |
| 2348 | (UniversalProcPtr) NewWENewObjectProc(HandleNewPicture), NULL)) != noErr) |
| 2349 | goto cleanup; |
| 2350 | |
| 2351 | if ((err = WEInstallObjectHandler(kTypePicture, weDisposeHandler, |
| 2352 | (UniversalProcPtr) NewWEDisposeObjectProc(HandleDisposePicture), NULL)) != noErr) |
| 2353 | goto cleanup; |
| 2354 | |
| 2355 | if ((err = WEInstallObjectHandler(kTypePicture, weDrawHandler, |
| 2356 | (UniversalProcPtr) NewWEDrawObjectProc(HandleDrawPicture), NULL)) != noErr) |
| 2357 | goto cleanup; |
| 2358 | |
| 2359 | if ((err = WEInstallObjectHandler(kTypeSound, weNewHandler, |
| 2360 | (UniversalProcPtr) NewWENewObjectProc(HandleNewSound), NULL)) != noErr) |
| 2361 | goto cleanup; |
| 2362 | |
| 2363 | if ((err = WEInstallObjectHandler(kTypeSound, weDrawHandler, |
| 2364 | (UniversalProcPtr) NewWEDrawObjectProc(HandleDrawSound), NULL)) != noErr) |
| 2365 | goto cleanup; |
| 2366 | |
| 2367 | if ((err = WEInstallObjectHandler(kTypeSound, weClickHandler, |
| 2368 | (UniversalProcPtr) NewWEClickObjectProc(HandleClickSound), NULL)) != noErr) |
| 2369 | goto cleanup; |
| 2370 | Py_INCREF(Py_None); |
| 2371 | return Py_None; |
| 2372 | |
| 2373 | cleanup: |
| 2374 | return PyMac_Error(err); |
| 2375 | |
| 2376 | } |
| 2377 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 2378 | static PyObject *waste_WEInstallObjectHandler(PyObject *_self, PyObject *_args) |
Jack Jansen | 756522f | 1996-05-07 15:24:01 +0000 | [diff] [blame] | 2379 | { |
| 2380 | PyObject *_res = NULL; |
| 2381 | |
| 2382 | OSErr err; |
| 2383 | FlavorType objectType; |
| 2384 | WESelector selector; |
| 2385 | PyObject *py_handler; |
| 2386 | UniversalProcPtr handler; |
| 2387 | WEReference we = NULL; |
| 2388 | PyObject *key; |
| 2389 | |
| 2390 | |
| 2391 | if ( !PyArg_ParseTuple(_args, "O&O&O|O&", |
| 2392 | PyMac_GetOSType, &objectType, |
| 2393 | PyMac_GetOSType, &selector, |
| 2394 | &py_handler, |
Jack Jansen | 7df3606 | 1996-10-01 11:41:14 +0000 | [diff] [blame] | 2395 | WEOObj_Convert, &we) ) return NULL; |
Jack Jansen | 756522f | 1996-05-07 15:24:01 +0000 | [diff] [blame] | 2396 | |
Jack Jansen | 25241d9 | 1996-05-20 11:30:45 +0000 | [diff] [blame] | 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; |
Jack Jansen | 756522f | 1996-05-07 15:24:01 +0000 | [diff] [blame] | 2401 | else return PyMac_Error(weUndefinedSelectorErr); |
| 2402 | |
| 2403 | if ((key = Py_BuildValue("O&O&", |
| 2404 | PyMac_BuildOSType, objectType, |
| 2405 | PyMac_BuildOSType, selector)) == NULL ) |
| 2406 | return NULL; |
| 2407 | |
| 2408 | PyDict_SetItem(callbackdict, key, py_handler); |
| 2409 | |
| 2410 | err = WEInstallObjectHandler(objectType, selector, handler, we); |
| 2411 | if ( err ) return PyMac_Error(err); |
| 2412 | Py_INCREF(Py_None); |
| 2413 | return Py_None; |
| 2414 | |
| 2415 | } |
| 2416 | |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2417 | static PyMethodDef waste_methods[] = { |
| 2418 | {"WENew", (PyCFunction)waste_WENew, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2419 | "(LongRect inDestRect, LongRect inViewRect, OptionBits inOptions) -> (WEReference outWE)"}, |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 2420 | {"WEUpdateStyleScrap", (PyCFunction)waste_WEUpdateStyleScrap, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2421 | "(StScrpHandle ioStyles, WEFontTableHandle inFontTable) -> None"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2422 | {"WEInstallTSMHandlers", (PyCFunction)waste_WEInstallTSMHandlers, 1, |
| 2423 | "() -> None"}, |
| 2424 | {"WERemoveTSMHandlers", (PyCFunction)waste_WERemoveTSMHandlers, 1, |
| 2425 | "() -> None"}, |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 2426 | {"WEHandleTSMEvent", (PyCFunction)waste_WEHandleTSMEvent, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2427 | "(AppleEvent inAppleEvent) -> (AppleEvent ioReply)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2428 | {"WELongPointToPoint", (PyCFunction)waste_WELongPointToPoint, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2429 | "(LongPt inLongPoint) -> (Point outPoint)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2430 | {"WEPointToLongPoint", (PyCFunction)waste_WEPointToLongPoint, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2431 | "(Point inPoint) -> (LongPt outLongPoint)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2432 | {"WESetLongRect", (PyCFunction)waste_WESetLongRect, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2433 | "(SInt32 inLeft, SInt32 inTop, SInt32 inRight, SInt32 inBottom) -> (LongRect outLongRect)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2434 | {"WELongRectToRect", (PyCFunction)waste_WELongRectToRect, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2435 | "(LongRect inLongRect) -> (Rect outRect)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2436 | {"WERectToLongRect", (PyCFunction)waste_WERectToLongRect, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2437 | "(Rect inRect) -> (LongRect outLongRect)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2438 | {"WEOffsetLongRect", (PyCFunction)waste_WEOffsetLongRect, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2439 | "(SInt32 inHorizontalOffset, SInt32 inVerticalOffset) -> (LongRect ioLongRect)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2440 | {"WELongPointInLongRect", (PyCFunction)waste_WELongPointInLongRect, 1, |
Jack Jansen | b99e521 | 2002-01-11 12:37:15 +0000 | [diff] [blame] | 2441 | "(LongPt inLongPoint, LongRect inLongRect) -> (Boolean _rv)"}, |
Jack Jansen | 756522f | 1996-05-07 15:24:01 +0000 | [diff] [blame] | 2442 | {"STDObjectHandlers", (PyCFunction)waste_STDObjectHandlers, 1, |
| 2443 | NULL}, |
| 2444 | {"WEInstallObjectHandler", (PyCFunction)waste_WEInstallObjectHandler, 1, |
| 2445 | NULL}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2446 | {NULL, NULL, 0} |
| 2447 | }; |
| 2448 | |
| 2449 | |
| 2450 | |
Jack Jansen | 756522f | 1996-05-07 15:24:01 +0000 | [diff] [blame] | 2451 | /* Return the object corresponding to the window, or NULL */ |
| 2452 | |
| 2453 | PyObject * |
| 2454 | ExistingwasteObj_New(w) |
| 2455 | WEReference w; |
| 2456 | { |
| 2457 | PyObject *it = NULL; |
| 2458 | |
| 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; |
| 2467 | } |
| 2468 | |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2469 | |
Jack Jansen | fa77e1a | 2001-05-22 21:56:42 +0000 | [diff] [blame] | 2470 | void initwaste(void) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2471 | { |
| 2472 | PyObject *m; |
| 2473 | PyObject *d; |
| 2474 | |
| 2475 | |
| 2476 | |
| 2477 | |
| 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) |
Jack Jansen | 97ed907 | 2000-09-08 22:06:16 +0000 | [diff] [blame] | 2483 | return; |
Jack Jansen | a755e68 | 1997-09-20 17:40:22 +0000 | [diff] [blame] | 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"); |
Jack Jansen | 756522f | 1996-05-07 15:24:01 +0000 | [diff] [blame] | 2492 | |
| 2493 | callbackdict = PyDict_New(); |
| 2494 | if (callbackdict == NULL || PyDict_SetItemString(d, "callbacks", callbackdict) != 0) |
Jack Jansen | 97ed907 | 2000-09-08 22:06:16 +0000 | [diff] [blame] | 2495 | return; |
Jack Jansen | 756522f | 1996-05-07 15:24:01 +0000 | [diff] [blame] | 2496 | upp_new_handler = NewWENewObjectProc(my_new_handler); |
Jack Jansen | 25241d9 | 1996-05-20 11:30:45 +0000 | [diff] [blame] | 2497 | upp_dispose_handler = NewWEDisposeObjectProc(my_dispose_handler); |
| 2498 | upp_draw_handler = NewWEDrawObjectProc(my_draw_handler); |
| 2499 | upp_click_handler = NewWEClickObjectProc(my_click_handler); |
Jack Jansen | 756522f | 1996-05-07 15:24:01 +0000 | [diff] [blame] | 2500 | |
| 2501 | |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2502 | } |
| 2503 | |
| 2504 | /* ======================== End module waste ======================== */ |
| 2505 | |