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 | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 8 | #include "macglue.h" |
Jack Jansen | 9d8b96c | 2000-07-14 22:16:45 +0000 | [diff] [blame] | 9 | #include "pymactoolbox.h" |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 10 | |
| 11 | #include <WASTE.h> |
Jack Jansen | 8505ef8 | 1997-08-27 14:09:25 +0000 | [diff] [blame] | 12 | #include <WEObjectHandlers.h> |
Jack Jansen | a755e68 | 1997-09-20 17:40:22 +0000 | [diff] [blame] | 13 | #include <WETabs.h> |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 14 | |
| 15 | /* Exported by Qdmodule.c: */ |
| 16 | extern PyObject *QdRGB_New(RGBColor *); |
| 17 | extern int QdRGB_Convert(PyObject *, RGBColor *); |
| 18 | |
Jack Jansen | 8505ef8 | 1997-08-27 14:09:25 +0000 | [diff] [blame] | 19 | /* Exported by AEModule.c: */ |
| 20 | extern PyObject *AEDesc_New(AppleEvent *); |
| 21 | extern int AEDesc_Convert(PyObject *, AppleEvent *); |
| 22 | |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 23 | /* Forward declaration */ |
| 24 | staticforward PyObject *WEOObj_New(WEObjectReference); |
Jack Jansen | 756522f | 1996-05-07 15:24:01 +0000 | [diff] [blame] | 25 | staticforward PyObject *ExistingwasteObj_New(WEReference); |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 26 | |
| 27 | /* |
| 28 | ** Parse/generate TextStyle records |
| 29 | */ |
| 30 | static |
| 31 | PyObject *TextStyle_New(itself) |
| 32 | TextStylePtr itself; |
| 33 | { |
| 34 | |
| 35 | return Py_BuildValue("lllO&", (long)itself->tsFont, (long)itself->tsFace, (long)itself->tsSize, QdRGB_New, |
| 36 | &itself->tsColor); |
| 37 | } |
| 38 | |
| 39 | static |
| 40 | TextStyle_Convert(v, p_itself) |
| 41 | PyObject *v; |
| 42 | TextStylePtr p_itself; |
| 43 | { |
| 44 | long font, face, size; |
| 45 | |
| 46 | if( !PyArg_ParseTuple(v, "lllO&", &font, &face, &size, QdRGB_Convert, &p_itself->tsColor) ) |
| 47 | return 0; |
| 48 | p_itself->tsFont = (short)font; |
| 49 | p_itself->tsFace = (Style)face; |
| 50 | p_itself->tsSize = (short)size; |
| 51 | return 1; |
| 52 | } |
| 53 | |
| 54 | /* |
| 55 | ** Parse/generate RunInfo records |
| 56 | */ |
| 57 | static |
| 58 | PyObject *RunInfo_New(itself) |
| 59 | WERunInfo *itself; |
| 60 | { |
| 61 | |
| 62 | return Py_BuildValue("llhhO&O&", itself->runStart, itself->runEnd, itself->runHeight, |
| 63 | itself->runAscent, TextStyle_New, &itself->runStyle, WEOObj_New, itself->runObject); |
| 64 | } |
| 65 | |
| 66 | /* Conversion of long points and rects */ |
| 67 | int |
| 68 | LongRect_Convert(PyObject *v, LongRect *r) |
| 69 | { |
| 70 | return PyArg_Parse(v, "(llll)", &r->left, &r->top, &r->right, &r->bottom); |
| 71 | } |
| 72 | |
| 73 | PyObject * |
| 74 | LongRect_New(LongRect *r) |
| 75 | { |
| 76 | return Py_BuildValue("(llll)", r->left, r->top, r->right, r->bottom); |
| 77 | } |
| 78 | |
| 79 | |
| 80 | LongPt_Convert(PyObject *v, LongPt *p) |
| 81 | { |
| 82 | return PyArg_Parse(v, "(ll)", &p->h, &p->v); |
| 83 | } |
| 84 | |
| 85 | PyObject * |
| 86 | LongPt_New(LongPt *p) |
| 87 | { |
| 88 | return Py_BuildValue("(ll)", p->h, p->v); |
| 89 | } |
| 90 | |
Jack Jansen | 756522f | 1996-05-07 15:24:01 +0000 | [diff] [blame] | 91 | /* Stuff for the callbacks: */ |
| 92 | static PyObject *callbackdict; |
Jack Jansen | 25241d9 | 1996-05-20 11:30:45 +0000 | [diff] [blame] | 93 | WENewObjectUPP upp_new_handler; |
| 94 | WEDisposeObjectUPP upp_dispose_handler; |
| 95 | WEDrawObjectUPP upp_draw_handler; |
| 96 | WEClickObjectUPP upp_click_handler; |
Jack Jansen | 756522f | 1996-05-07 15:24:01 +0000 | [diff] [blame] | 97 | |
| 98 | static OSErr |
| 99 | any_handler(WESelector what, WEObjectReference who, PyObject *args, PyObject **rv) |
| 100 | { |
| 101 | FlavorType tp; |
| 102 | PyObject *key, *func; |
| 103 | |
| 104 | if ( args == NULL ) return errAECorruptData; |
| 105 | |
| 106 | tp = WEGetObjectType(who); |
| 107 | |
| 108 | if( (key=Py_BuildValue("O&O&", PyMac_BuildOSType, tp, PyMac_BuildOSType, what)) == NULL) |
| 109 | return errAECorruptData; |
| 110 | if( (func = PyDict_GetItem(callbackdict, key)) == NULL ) { |
| 111 | Py_DECREF(key); |
| 112 | return errAEHandlerNotFound; |
| 113 | } |
| 114 | Py_INCREF(func); |
| 115 | *rv = PyEval_CallObject(func, args); |
| 116 | Py_DECREF(func); |
| 117 | Py_DECREF(key); |
| 118 | if ( *rv == NULL ) { |
Jack Jansen | deff89c | 1998-10-12 20:53:15 +0000 | [diff] [blame] | 119 | PySys_WriteStderr("--Exception in callback: "); |
Jack Jansen | 756522f | 1996-05-07 15:24:01 +0000 | [diff] [blame] | 120 | PyErr_Print(); |
| 121 | return errAEReplyNotArrived; |
| 122 | } |
| 123 | return 0; |
| 124 | } |
| 125 | |
| 126 | static pascal OSErr |
| 127 | my_new_handler(Point *objectSize, WEObjectReference objref) |
| 128 | { |
| 129 | PyObject *args=NULL, *rv=NULL; |
| 130 | OSErr err; |
| 131 | |
| 132 | args=Py_BuildValue("(O&)", WEOObj_New, objref); |
| 133 | err = any_handler(weNewHandler, objref, args, &rv); |
| 134 | if (!err) { |
| 135 | if (!PyMac_GetPoint(rv, objectSize) ) |
| 136 | err = errAECoercionFail; |
| 137 | } |
| 138 | if ( args ) Py_DECREF(args); |
| 139 | if ( rv ) Py_DECREF(rv); |
| 140 | return err; |
| 141 | } |
| 142 | |
| 143 | static pascal OSErr |
| 144 | my_dispose_handler(WEObjectReference objref) |
| 145 | { |
| 146 | PyObject *args=NULL, *rv=NULL; |
| 147 | OSErr err; |
| 148 | |
| 149 | args=Py_BuildValue("(O&)", WEOObj_New, objref); |
| 150 | err = any_handler(weDisposeHandler, objref, args, &rv); |
| 151 | if ( args ) Py_DECREF(args); |
| 152 | if ( rv ) Py_DECREF(rv); |
| 153 | return err; |
| 154 | } |
| 155 | |
| 156 | static pascal OSErr |
| 157 | my_draw_handler(Rect *destRect, WEObjectReference objref) |
| 158 | { |
| 159 | PyObject *args=NULL, *rv=NULL; |
| 160 | OSErr err; |
| 161 | |
| 162 | args=Py_BuildValue("O&O&", PyMac_BuildRect, destRect, WEOObj_New, objref); |
| 163 | err = any_handler(weDrawHandler, objref, args, &rv); |
| 164 | if ( args ) Py_DECREF(args); |
| 165 | if ( rv ) Py_DECREF(rv); |
| 166 | return err; |
| 167 | } |
| 168 | |
| 169 | static pascal Boolean |
| 170 | my_click_handler(Point hitPt, EventModifiers modifiers, |
| 171 | unsigned long clickTime, WEObjectReference objref) |
| 172 | { |
| 173 | PyObject *args=NULL, *rv=NULL; |
| 174 | int retvalue; |
| 175 | OSErr err; |
| 176 | |
| 177 | args=Py_BuildValue("O&llO&", PyMac_BuildPoint, hitPt, |
| 178 | (long)modifiers, (long)clickTime, WEOObj_New, objref); |
| 179 | err = any_handler(weClickHandler, objref, args, &rv); |
| 180 | if (!err) |
| 181 | retvalue = PyInt_AsLong(rv); |
| 182 | else |
| 183 | retvalue = 0; |
| 184 | if ( args ) Py_DECREF(args); |
| 185 | if ( rv ) Py_DECREF(rv); |
| 186 | return retvalue; |
| 187 | } |
| 188 | |
| 189 | |
| 190 | |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 191 | static PyObject *waste_Error; |
| 192 | |
| 193 | /* ------------------------ Object type WEO ------------------------- */ |
| 194 | |
| 195 | PyTypeObject WEO_Type; |
| 196 | |
| 197 | #define WEOObj_Check(x) ((x)->ob_type == &WEO_Type) |
| 198 | |
| 199 | typedef struct WEOObject { |
| 200 | PyObject_HEAD |
| 201 | WEObjectReference ob_itself; |
| 202 | } WEOObject; |
| 203 | |
| 204 | PyObject *WEOObj_New(itself) |
| 205 | WEObjectReference itself; |
| 206 | { |
| 207 | WEOObject *it; |
| 208 | if (itself == NULL) { |
| 209 | Py_INCREF(Py_None); |
| 210 | return Py_None; |
| 211 | } |
| 212 | it = PyObject_NEW(WEOObject, &WEO_Type); |
| 213 | if (it == NULL) return NULL; |
| 214 | it->ob_itself = itself; |
| 215 | return (PyObject *)it; |
| 216 | } |
| 217 | WEOObj_Convert(v, p_itself) |
| 218 | PyObject *v; |
| 219 | WEObjectReference *p_itself; |
| 220 | { |
| 221 | if (!WEOObj_Check(v)) |
| 222 | { |
| 223 | PyErr_SetString(PyExc_TypeError, "WEO required"); |
| 224 | return 0; |
| 225 | } |
| 226 | *p_itself = ((WEOObject *)v)->ob_itself; |
| 227 | return 1; |
| 228 | } |
| 229 | |
| 230 | static void WEOObj_dealloc(self) |
| 231 | WEOObject *self; |
| 232 | { |
| 233 | /* Cleanup of self->ob_itself goes here */ |
| 234 | PyMem_DEL(self); |
| 235 | } |
| 236 | |
| 237 | static PyObject *WEOObj_WEGetObjectType(_self, _args) |
| 238 | WEOObject *_self; |
| 239 | PyObject *_args; |
| 240 | { |
| 241 | PyObject *_res = NULL; |
| 242 | FlavorType _rv; |
| 243 | if (!PyArg_ParseTuple(_args, "")) |
| 244 | return NULL; |
| 245 | _rv = WEGetObjectType(_self->ob_itself); |
| 246 | _res = Py_BuildValue("O&", |
| 247 | PyMac_BuildOSType, _rv); |
| 248 | return _res; |
| 249 | } |
| 250 | |
| 251 | static PyObject *WEOObj_WEGetObjectDataHandle(_self, _args) |
| 252 | WEOObject *_self; |
| 253 | PyObject *_args; |
| 254 | { |
| 255 | PyObject *_res = NULL; |
| 256 | Handle _rv; |
| 257 | if (!PyArg_ParseTuple(_args, "")) |
| 258 | return NULL; |
| 259 | _rv = WEGetObjectDataHandle(_self->ob_itself); |
| 260 | _res = Py_BuildValue("O&", |
| 261 | ResObj_New, _rv); |
| 262 | return _res; |
| 263 | } |
| 264 | |
| 265 | static PyObject *WEOObj_WEGetObjectSize(_self, _args) |
| 266 | WEOObject *_self; |
| 267 | PyObject *_args; |
| 268 | { |
| 269 | PyObject *_res = NULL; |
| 270 | Point _rv; |
| 271 | if (!PyArg_ParseTuple(_args, "")) |
| 272 | return NULL; |
| 273 | _rv = WEGetObjectSize(_self->ob_itself); |
| 274 | _res = Py_BuildValue("O&", |
| 275 | PyMac_BuildPoint, _rv); |
| 276 | return _res; |
| 277 | } |
| 278 | |
Jack Jansen | 756522f | 1996-05-07 15:24:01 +0000 | [diff] [blame] | 279 | static PyObject *WEOObj_WEGetObjectOwner(_self, _args) |
| 280 | WEOObject *_self; |
| 281 | PyObject *_args; |
| 282 | { |
| 283 | PyObject *_res = NULL; |
| 284 | WEReference _rv; |
| 285 | if (!PyArg_ParseTuple(_args, "")) |
| 286 | return NULL; |
| 287 | _rv = WEGetObjectOwner(_self->ob_itself); |
| 288 | _res = Py_BuildValue("O&", |
| 289 | ExistingwasteObj_New, _rv); |
| 290 | return _res; |
| 291 | } |
| 292 | |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 293 | static PyObject *WEOObj_WEGetObjectRefCon(_self, _args) |
| 294 | WEOObject *_self; |
| 295 | PyObject *_args; |
| 296 | { |
| 297 | PyObject *_res = NULL; |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 298 | SInt32 _rv; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 299 | if (!PyArg_ParseTuple(_args, "")) |
| 300 | return NULL; |
| 301 | _rv = WEGetObjectRefCon(_self->ob_itself); |
| 302 | _res = Py_BuildValue("l", |
| 303 | _rv); |
| 304 | return _res; |
| 305 | } |
| 306 | |
| 307 | static PyObject *WEOObj_WESetObjectRefCon(_self, _args) |
| 308 | WEOObject *_self; |
| 309 | PyObject *_args; |
| 310 | { |
| 311 | PyObject *_res = NULL; |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 312 | SInt32 refCon; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 313 | if (!PyArg_ParseTuple(_args, "l", |
| 314 | &refCon)) |
| 315 | return NULL; |
| 316 | WESetObjectRefCon(_self->ob_itself, |
| 317 | refCon); |
| 318 | Py_INCREF(Py_None); |
| 319 | _res = Py_None; |
| 320 | return _res; |
| 321 | } |
| 322 | |
| 323 | static PyMethodDef WEOObj_methods[] = { |
| 324 | {"WEGetObjectType", (PyCFunction)WEOObj_WEGetObjectType, 1, |
| 325 | "() -> (FlavorType _rv)"}, |
| 326 | {"WEGetObjectDataHandle", (PyCFunction)WEOObj_WEGetObjectDataHandle, 1, |
| 327 | "() -> (Handle _rv)"}, |
| 328 | {"WEGetObjectSize", (PyCFunction)WEOObj_WEGetObjectSize, 1, |
| 329 | "() -> (Point _rv)"}, |
Jack Jansen | 756522f | 1996-05-07 15:24:01 +0000 | [diff] [blame] | 330 | {"WEGetObjectOwner", (PyCFunction)WEOObj_WEGetObjectOwner, 1, |
| 331 | "() -> (WEReference _rv)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 332 | {"WEGetObjectRefCon", (PyCFunction)WEOObj_WEGetObjectRefCon, 1, |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 333 | "() -> (SInt32 _rv)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 334 | {"WESetObjectRefCon", (PyCFunction)WEOObj_WESetObjectRefCon, 1, |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 335 | "(SInt32 refCon) -> None"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 336 | {NULL, NULL, 0} |
| 337 | }; |
| 338 | |
| 339 | PyMethodChain WEOObj_chain = { WEOObj_methods, NULL }; |
| 340 | |
| 341 | static PyObject *WEOObj_getattr(self, name) |
| 342 | WEOObject *self; |
| 343 | char *name; |
| 344 | { |
| 345 | return Py_FindMethodInChain(&WEOObj_chain, (PyObject *)self, name); |
| 346 | } |
| 347 | |
| 348 | #define WEOObj_setattr NULL |
| 349 | |
Jack Jansen | 9d8b96c | 2000-07-14 22:16:45 +0000 | [diff] [blame] | 350 | #define WEOObj_compare NULL |
| 351 | |
| 352 | #define WEOObj_repr NULL |
| 353 | |
| 354 | #define WEOObj_hash NULL |
| 355 | |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 356 | PyTypeObject WEO_Type = { |
| 357 | PyObject_HEAD_INIT(&PyType_Type) |
| 358 | 0, /*ob_size*/ |
| 359 | "WEO", /*tp_name*/ |
| 360 | sizeof(WEOObject), /*tp_basicsize*/ |
| 361 | 0, /*tp_itemsize*/ |
| 362 | /* methods */ |
| 363 | (destructor) WEOObj_dealloc, /*tp_dealloc*/ |
| 364 | 0, /*tp_print*/ |
| 365 | (getattrfunc) WEOObj_getattr, /*tp_getattr*/ |
| 366 | (setattrfunc) WEOObj_setattr, /*tp_setattr*/ |
Jack Jansen | 9d8b96c | 2000-07-14 22:16:45 +0000 | [diff] [blame] | 367 | (cmpfunc) WEOObj_compare, /*tp_compare*/ |
| 368 | (reprfunc) WEOObj_repr, /*tp_repr*/ |
| 369 | (PyNumberMethods *)0, /* tp_as_number */ |
| 370 | (PySequenceMethods *)0, /* tp_as_sequence */ |
| 371 | (PyMappingMethods *)0, /* tp_as_mapping */ |
| 372 | (hashfunc) WEOObj_hash, /*tp_hash*/ |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 373 | }; |
| 374 | |
| 375 | /* ---------------------- End object type WEO ----------------------- */ |
| 376 | |
| 377 | |
| 378 | /* ----------------------- Object type waste ------------------------ */ |
| 379 | |
| 380 | PyTypeObject waste_Type; |
| 381 | |
| 382 | #define wasteObj_Check(x) ((x)->ob_type == &waste_Type) |
| 383 | |
| 384 | typedef struct wasteObject { |
| 385 | PyObject_HEAD |
| 386 | WEReference ob_itself; |
| 387 | } wasteObject; |
| 388 | |
| 389 | PyObject *wasteObj_New(itself) |
| 390 | WEReference itself; |
| 391 | { |
| 392 | wasteObject *it; |
| 393 | if (itself == NULL) { |
| 394 | PyErr_SetString(waste_Error,"Cannot create null WE"); |
| 395 | return NULL; |
| 396 | } |
| 397 | it = PyObject_NEW(wasteObject, &waste_Type); |
| 398 | if (it == NULL) return NULL; |
| 399 | it->ob_itself = itself; |
Jack Jansen | 756522f | 1996-05-07 15:24:01 +0000 | [diff] [blame] | 400 | WESetInfo(weRefCon, (void *)&it, itself); |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 401 | return (PyObject *)it; |
| 402 | } |
| 403 | wasteObj_Convert(v, p_itself) |
| 404 | PyObject *v; |
| 405 | WEReference *p_itself; |
| 406 | { |
| 407 | if (!wasteObj_Check(v)) |
| 408 | { |
| 409 | PyErr_SetString(PyExc_TypeError, "waste required"); |
| 410 | return 0; |
| 411 | } |
| 412 | *p_itself = ((wasteObject *)v)->ob_itself; |
| 413 | return 1; |
| 414 | } |
| 415 | |
| 416 | static void wasteObj_dealloc(self) |
| 417 | wasteObject *self; |
| 418 | { |
| 419 | WEDispose(self->ob_itself); |
| 420 | PyMem_DEL(self); |
| 421 | } |
| 422 | |
| 423 | static PyObject *wasteObj_WEGetText(_self, _args) |
| 424 | wasteObject *_self; |
| 425 | PyObject *_args; |
| 426 | { |
| 427 | PyObject *_res = NULL; |
| 428 | Handle _rv; |
| 429 | if (!PyArg_ParseTuple(_args, "")) |
| 430 | return NULL; |
| 431 | _rv = WEGetText(_self->ob_itself); |
| 432 | _res = Py_BuildValue("O&", |
| 433 | ResObj_New, _rv); |
| 434 | return _res; |
| 435 | } |
| 436 | |
| 437 | static PyObject *wasteObj_WEGetChar(_self, _args) |
| 438 | wasteObject *_self; |
| 439 | PyObject *_args; |
| 440 | { |
| 441 | PyObject *_res = NULL; |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 442 | SInt16 _rv; |
| 443 | SInt32 offset; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 444 | if (!PyArg_ParseTuple(_args, "l", |
| 445 | &offset)) |
| 446 | return NULL; |
| 447 | _rv = WEGetChar(offset, |
| 448 | _self->ob_itself); |
| 449 | _res = Py_BuildValue("h", |
| 450 | _rv); |
| 451 | return _res; |
| 452 | } |
| 453 | |
| 454 | static PyObject *wasteObj_WEGetTextLength(_self, _args) |
| 455 | wasteObject *_self; |
| 456 | PyObject *_args; |
| 457 | { |
| 458 | PyObject *_res = NULL; |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 459 | SInt32 _rv; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 460 | if (!PyArg_ParseTuple(_args, "")) |
| 461 | return NULL; |
| 462 | _rv = WEGetTextLength(_self->ob_itself); |
| 463 | _res = Py_BuildValue("l", |
| 464 | _rv); |
| 465 | return _res; |
| 466 | } |
| 467 | |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 468 | static PyObject *wasteObj_WEGetHeight(_self, _args) |
| 469 | wasteObject *_self; |
| 470 | PyObject *_args; |
| 471 | { |
| 472 | PyObject *_res = NULL; |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 473 | SInt32 _rv; |
| 474 | SInt32 startLine; |
| 475 | SInt32 endLine; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 476 | if (!PyArg_ParseTuple(_args, "ll", |
| 477 | &startLine, |
| 478 | &endLine)) |
| 479 | return NULL; |
| 480 | _rv = WEGetHeight(startLine, |
| 481 | endLine, |
| 482 | _self->ob_itself); |
| 483 | _res = Py_BuildValue("l", |
| 484 | _rv); |
| 485 | return _res; |
| 486 | } |
| 487 | |
| 488 | static PyObject *wasteObj_WEGetSelection(_self, _args) |
| 489 | wasteObject *_self; |
| 490 | PyObject *_args; |
| 491 | { |
| 492 | PyObject *_res = NULL; |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 493 | SInt32 selStart; |
| 494 | SInt32 selEnd; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 495 | if (!PyArg_ParseTuple(_args, "")) |
| 496 | return NULL; |
| 497 | WEGetSelection(&selStart, |
| 498 | &selEnd, |
| 499 | _self->ob_itself); |
| 500 | _res = Py_BuildValue("ll", |
| 501 | selStart, |
| 502 | selEnd); |
| 503 | return _res; |
| 504 | } |
| 505 | |
| 506 | static PyObject *wasteObj_WEGetDestRect(_self, _args) |
| 507 | wasteObject *_self; |
| 508 | PyObject *_args; |
| 509 | { |
| 510 | PyObject *_res = NULL; |
| 511 | LongRect destRect; |
| 512 | if (!PyArg_ParseTuple(_args, "")) |
| 513 | return NULL; |
| 514 | WEGetDestRect(&destRect, |
| 515 | _self->ob_itself); |
| 516 | _res = Py_BuildValue("O&", |
| 517 | LongRect_New, &destRect); |
| 518 | return _res; |
| 519 | } |
| 520 | |
| 521 | static PyObject *wasteObj_WEGetViewRect(_self, _args) |
| 522 | wasteObject *_self; |
| 523 | PyObject *_args; |
| 524 | { |
| 525 | PyObject *_res = NULL; |
| 526 | LongRect viewRect; |
| 527 | if (!PyArg_ParseTuple(_args, "")) |
| 528 | return NULL; |
| 529 | WEGetViewRect(&viewRect, |
| 530 | _self->ob_itself); |
| 531 | _res = Py_BuildValue("O&", |
| 532 | LongRect_New, &viewRect); |
| 533 | return _res; |
| 534 | } |
| 535 | |
| 536 | static PyObject *wasteObj_WEIsActive(_self, _args) |
| 537 | wasteObject *_self; |
| 538 | PyObject *_args; |
| 539 | { |
| 540 | PyObject *_res = NULL; |
| 541 | Boolean _rv; |
| 542 | if (!PyArg_ParseTuple(_args, "")) |
| 543 | return NULL; |
| 544 | _rv = WEIsActive(_self->ob_itself); |
| 545 | _res = Py_BuildValue("b", |
| 546 | _rv); |
| 547 | return _res; |
| 548 | } |
| 549 | |
| 550 | static PyObject *wasteObj_WEOffsetToLine(_self, _args) |
| 551 | wasteObject *_self; |
| 552 | PyObject *_args; |
| 553 | { |
| 554 | PyObject *_res = NULL; |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 555 | SInt32 _rv; |
| 556 | SInt32 offset; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 557 | if (!PyArg_ParseTuple(_args, "l", |
| 558 | &offset)) |
| 559 | return NULL; |
| 560 | _rv = WEOffsetToLine(offset, |
| 561 | _self->ob_itself); |
| 562 | _res = Py_BuildValue("l", |
| 563 | _rv); |
| 564 | return _res; |
| 565 | } |
| 566 | |
| 567 | static PyObject *wasteObj_WEGetLineRange(_self, _args) |
| 568 | wasteObject *_self; |
| 569 | PyObject *_args; |
| 570 | { |
| 571 | PyObject *_res = NULL; |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 572 | SInt32 lineIndex; |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 573 | SInt32 lineStart; |
| 574 | SInt32 lineEnd; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 575 | if (!PyArg_ParseTuple(_args, "l", |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 576 | &lineIndex)) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 577 | return NULL; |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 578 | WEGetLineRange(lineIndex, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 579 | &lineStart, |
| 580 | &lineEnd, |
| 581 | _self->ob_itself); |
| 582 | _res = Py_BuildValue("ll", |
| 583 | lineStart, |
| 584 | lineEnd); |
| 585 | return _res; |
| 586 | } |
| 587 | |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 588 | static PyObject *wasteObj_WECountLines(_self, _args) |
| 589 | wasteObject *_self; |
| 590 | PyObject *_args; |
| 591 | { |
| 592 | PyObject *_res = NULL; |
| 593 | SInt32 _rv; |
| 594 | if (!PyArg_ParseTuple(_args, "")) |
| 595 | return NULL; |
| 596 | _rv = WECountLines(_self->ob_itself); |
| 597 | _res = Py_BuildValue("l", |
| 598 | _rv); |
| 599 | return _res; |
| 600 | } |
| 601 | |
| 602 | static PyObject *wasteObj_WEOffsetToRun(_self, _args) |
| 603 | wasteObject *_self; |
| 604 | PyObject *_args; |
| 605 | { |
| 606 | PyObject *_res = NULL; |
| 607 | SInt32 _rv; |
| 608 | SInt32 offset; |
| 609 | if (!PyArg_ParseTuple(_args, "l", |
| 610 | &offset)) |
| 611 | return NULL; |
| 612 | _rv = WEOffsetToRun(offset, |
| 613 | _self->ob_itself); |
| 614 | _res = Py_BuildValue("l", |
| 615 | _rv); |
| 616 | return _res; |
| 617 | } |
| 618 | |
| 619 | static PyObject *wasteObj_WEGetRunRange(_self, _args) |
| 620 | wasteObject *_self; |
| 621 | PyObject *_args; |
| 622 | { |
| 623 | PyObject *_res = NULL; |
| 624 | SInt32 runIndex; |
| 625 | SInt32 runStart; |
| 626 | SInt32 runEnd; |
| 627 | if (!PyArg_ParseTuple(_args, "l", |
| 628 | &runIndex)) |
| 629 | return NULL; |
| 630 | WEGetRunRange(runIndex, |
| 631 | &runStart, |
| 632 | &runEnd, |
| 633 | _self->ob_itself); |
| 634 | _res = Py_BuildValue("ll", |
| 635 | runStart, |
| 636 | runEnd); |
| 637 | return _res; |
| 638 | } |
| 639 | |
| 640 | static PyObject *wasteObj_WECountRuns(_self, _args) |
| 641 | wasteObject *_self; |
| 642 | PyObject *_args; |
| 643 | { |
| 644 | PyObject *_res = NULL; |
| 645 | SInt32 _rv; |
| 646 | if (!PyArg_ParseTuple(_args, "")) |
| 647 | return NULL; |
| 648 | _rv = WECountRuns(_self->ob_itself); |
| 649 | _res = Py_BuildValue("l", |
| 650 | _rv); |
| 651 | return _res; |
| 652 | } |
| 653 | |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 654 | static PyObject *wasteObj_WEGetClickCount(_self, _args) |
| 655 | wasteObject *_self; |
| 656 | PyObject *_args; |
| 657 | { |
| 658 | PyObject *_res = NULL; |
| 659 | UInt16 _rv; |
| 660 | if (!PyArg_ParseTuple(_args, "")) |
| 661 | return NULL; |
| 662 | _rv = WEGetClickCount(_self->ob_itself); |
Jack Jansen | 9d8b96c | 2000-07-14 22:16:45 +0000 | [diff] [blame] | 663 | _res = Py_BuildValue("H", |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 664 | _rv); |
| 665 | return _res; |
| 666 | } |
| 667 | |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 668 | static PyObject *wasteObj_WESetSelection(_self, _args) |
| 669 | wasteObject *_self; |
| 670 | PyObject *_args; |
| 671 | { |
| 672 | PyObject *_res = NULL; |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 673 | SInt32 selStart; |
| 674 | SInt32 selEnd; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 675 | if (!PyArg_ParseTuple(_args, "ll", |
| 676 | &selStart, |
| 677 | &selEnd)) |
| 678 | return NULL; |
| 679 | WESetSelection(selStart, |
| 680 | selEnd, |
| 681 | _self->ob_itself); |
| 682 | Py_INCREF(Py_None); |
| 683 | _res = Py_None; |
| 684 | return _res; |
| 685 | } |
| 686 | |
| 687 | static PyObject *wasteObj_WESetDestRect(_self, _args) |
| 688 | wasteObject *_self; |
| 689 | PyObject *_args; |
| 690 | { |
| 691 | PyObject *_res = NULL; |
| 692 | LongRect destRect; |
| 693 | if (!PyArg_ParseTuple(_args, "O&", |
| 694 | LongRect_Convert, &destRect)) |
| 695 | return NULL; |
| 696 | WESetDestRect(&destRect, |
| 697 | _self->ob_itself); |
| 698 | Py_INCREF(Py_None); |
| 699 | _res = Py_None; |
| 700 | return _res; |
| 701 | } |
| 702 | |
| 703 | static PyObject *wasteObj_WESetViewRect(_self, _args) |
| 704 | wasteObject *_self; |
| 705 | PyObject *_args; |
| 706 | { |
| 707 | PyObject *_res = NULL; |
| 708 | LongRect viewRect; |
| 709 | if (!PyArg_ParseTuple(_args, "O&", |
| 710 | LongRect_Convert, &viewRect)) |
| 711 | return NULL; |
| 712 | WESetViewRect(&viewRect, |
| 713 | _self->ob_itself); |
| 714 | Py_INCREF(Py_None); |
| 715 | _res = Py_None; |
| 716 | return _res; |
| 717 | } |
| 718 | |
| 719 | static PyObject *wasteObj_WEContinuousStyle(_self, _args) |
| 720 | wasteObject *_self; |
| 721 | PyObject *_args; |
| 722 | { |
| 723 | PyObject *_res = NULL; |
| 724 | Boolean _rv; |
| 725 | WEStyleMode mode; |
| 726 | TextStyle ts; |
Jack Jansen | 9d8b96c | 2000-07-14 22:16:45 +0000 | [diff] [blame] | 727 | if (!PyArg_ParseTuple(_args, "H", |
Jack Jansen | 8ae8e4f | 1996-04-23 16:17:08 +0000 | [diff] [blame] | 728 | &mode)) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 729 | return NULL; |
| 730 | _rv = WEContinuousStyle(&mode, |
| 731 | &ts, |
| 732 | _self->ob_itself); |
Jack Jansen | 9d8b96c | 2000-07-14 22:16:45 +0000 | [diff] [blame] | 733 | _res = Py_BuildValue("bHO&", |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 734 | _rv, |
| 735 | mode, |
| 736 | TextStyle_New, &ts); |
| 737 | return _res; |
| 738 | } |
| 739 | |
| 740 | static PyObject *wasteObj_WEGetRunInfo(_self, _args) |
| 741 | wasteObject *_self; |
| 742 | PyObject *_args; |
| 743 | { |
| 744 | PyObject *_res = NULL; |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 745 | SInt32 offset; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 746 | WERunInfo runInfo; |
| 747 | if (!PyArg_ParseTuple(_args, "l", |
| 748 | &offset)) |
| 749 | return NULL; |
| 750 | WEGetRunInfo(offset, |
| 751 | &runInfo, |
| 752 | _self->ob_itself); |
| 753 | _res = Py_BuildValue("O&", |
| 754 | RunInfo_New, &runInfo); |
| 755 | return _res; |
| 756 | } |
| 757 | |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 758 | static PyObject *wasteObj_WEGetRunDirection(_self, _args) |
| 759 | wasteObject *_self; |
| 760 | PyObject *_args; |
| 761 | { |
| 762 | PyObject *_res = NULL; |
| 763 | Boolean _rv; |
| 764 | SInt32 offset; |
| 765 | if (!PyArg_ParseTuple(_args, "l", |
| 766 | &offset)) |
| 767 | return NULL; |
| 768 | _rv = WEGetRunDirection(offset, |
| 769 | _self->ob_itself); |
| 770 | _res = Py_BuildValue("b", |
| 771 | _rv); |
| 772 | return _res; |
| 773 | } |
| 774 | |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 775 | static PyObject *wasteObj_WEGetOffset(_self, _args) |
| 776 | wasteObject *_self; |
| 777 | PyObject *_args; |
| 778 | { |
| 779 | PyObject *_res = NULL; |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 780 | SInt32 _rv; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 781 | LongPt thePoint; |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 782 | WEEdge edge; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 783 | if (!PyArg_ParseTuple(_args, "O&", |
| 784 | LongPt_Convert, &thePoint)) |
| 785 | return NULL; |
| 786 | _rv = WEGetOffset(&thePoint, |
| 787 | &edge, |
| 788 | _self->ob_itself); |
Jack Jansen | 97ed907 | 2000-09-08 22:06:16 +0000 | [diff] [blame] | 789 | _res = Py_BuildValue("lB", |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 790 | _rv, |
| 791 | edge); |
| 792 | return _res; |
| 793 | } |
| 794 | |
| 795 | static PyObject *wasteObj_WEGetPoint(_self, _args) |
| 796 | wasteObject *_self; |
| 797 | PyObject *_args; |
| 798 | { |
| 799 | PyObject *_res = NULL; |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 800 | SInt32 offset; |
| 801 | SInt16 direction; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 802 | LongPt thePoint; |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 803 | SInt16 lineHeight; |
| 804 | if (!PyArg_ParseTuple(_args, "lh", |
| 805 | &offset, |
| 806 | &direction)) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 807 | return NULL; |
| 808 | WEGetPoint(offset, |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 809 | direction, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 810 | &thePoint, |
| 811 | &lineHeight, |
| 812 | _self->ob_itself); |
| 813 | _res = Py_BuildValue("O&h", |
| 814 | LongPt_New, &thePoint, |
| 815 | lineHeight); |
| 816 | return _res; |
| 817 | } |
| 818 | |
| 819 | static PyObject *wasteObj_WEFindWord(_self, _args) |
| 820 | wasteObject *_self; |
| 821 | PyObject *_args; |
| 822 | { |
| 823 | PyObject *_res = NULL; |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 824 | SInt32 offset; |
| 825 | WEEdge edge; |
| 826 | SInt32 wordStart; |
| 827 | SInt32 wordEnd; |
Jack Jansen | 97ed907 | 2000-09-08 22:06:16 +0000 | [diff] [blame] | 828 | if (!PyArg_ParseTuple(_args, "lB", |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 829 | &offset, |
| 830 | &edge)) |
| 831 | return NULL; |
| 832 | WEFindWord(offset, |
| 833 | edge, |
| 834 | &wordStart, |
| 835 | &wordEnd, |
| 836 | _self->ob_itself); |
| 837 | _res = Py_BuildValue("ll", |
| 838 | wordStart, |
| 839 | wordEnd); |
| 840 | return _res; |
| 841 | } |
| 842 | |
| 843 | static PyObject *wasteObj_WEFindLine(_self, _args) |
| 844 | wasteObject *_self; |
| 845 | PyObject *_args; |
| 846 | { |
| 847 | PyObject *_res = NULL; |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 848 | SInt32 offset; |
| 849 | WEEdge edge; |
| 850 | SInt32 lineStart; |
| 851 | SInt32 lineEnd; |
Jack Jansen | 97ed907 | 2000-09-08 22:06:16 +0000 | [diff] [blame] | 852 | if (!PyArg_ParseTuple(_args, "lB", |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 853 | &offset, |
| 854 | &edge)) |
| 855 | return NULL; |
| 856 | WEFindLine(offset, |
| 857 | edge, |
| 858 | &lineStart, |
| 859 | &lineEnd, |
| 860 | _self->ob_itself); |
| 861 | _res = Py_BuildValue("ll", |
| 862 | lineStart, |
| 863 | lineEnd); |
| 864 | return _res; |
| 865 | } |
| 866 | |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 867 | static PyObject *wasteObj_WEFindParagraph(_self, _args) |
| 868 | wasteObject *_self; |
| 869 | PyObject *_args; |
| 870 | { |
| 871 | PyObject *_res = NULL; |
| 872 | SInt32 offset; |
| 873 | WEEdge edge; |
| 874 | SInt32 paragraphStart; |
| 875 | SInt32 paragraphEnd; |
Jack Jansen | 97ed907 | 2000-09-08 22:06:16 +0000 | [diff] [blame] | 876 | if (!PyArg_ParseTuple(_args, "lB", |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 877 | &offset, |
| 878 | &edge)) |
| 879 | return NULL; |
| 880 | WEFindParagraph(offset, |
| 881 | edge, |
| 882 | ¶graphStart, |
| 883 | ¶graphEnd, |
| 884 | _self->ob_itself); |
| 885 | _res = Py_BuildValue("ll", |
| 886 | paragraphStart, |
| 887 | paragraphEnd); |
| 888 | return _res; |
| 889 | } |
| 890 | |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 891 | static PyObject *wasteObj_WECopyRange(_self, _args) |
| 892 | wasteObject *_self; |
| 893 | PyObject *_args; |
| 894 | { |
| 895 | PyObject *_res = NULL; |
| 896 | OSErr _err; |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 897 | SInt32 rangeStart; |
| 898 | SInt32 rangeEnd; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 899 | Handle hText; |
| 900 | StScrpHandle hStyles; |
| 901 | WESoupHandle hSoup; |
| 902 | if (!PyArg_ParseTuple(_args, "llO&O&O&", |
| 903 | &rangeStart, |
| 904 | &rangeEnd, |
Jack Jansen | 8ae8e4f | 1996-04-23 16:17:08 +0000 | [diff] [blame] | 905 | OptResObj_Convert, &hText, |
| 906 | OptResObj_Convert, &hStyles, |
| 907 | OptResObj_Convert, &hSoup)) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 908 | return NULL; |
| 909 | _err = WECopyRange(rangeStart, |
| 910 | rangeEnd, |
| 911 | hText, |
| 912 | hStyles, |
| 913 | hSoup, |
| 914 | _self->ob_itself); |
| 915 | if (_err != noErr) return PyMac_Error(_err); |
| 916 | Py_INCREF(Py_None); |
| 917 | _res = Py_None; |
| 918 | return _res; |
| 919 | } |
| 920 | |
| 921 | static PyObject *wasteObj_WEGetAlignment(_self, _args) |
| 922 | wasteObject *_self; |
| 923 | PyObject *_args; |
| 924 | { |
| 925 | PyObject *_res = NULL; |
| 926 | WEAlignment _rv; |
| 927 | if (!PyArg_ParseTuple(_args, "")) |
| 928 | return NULL; |
| 929 | _rv = WEGetAlignment(_self->ob_itself); |
Jack Jansen | 97ed907 | 2000-09-08 22:06:16 +0000 | [diff] [blame] | 930 | _res = Py_BuildValue("B", |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 931 | _rv); |
| 932 | return _res; |
| 933 | } |
| 934 | |
| 935 | static PyObject *wasteObj_WESetAlignment(_self, _args) |
| 936 | wasteObject *_self; |
| 937 | PyObject *_args; |
| 938 | { |
| 939 | PyObject *_res = NULL; |
| 940 | WEAlignment alignment; |
Jack Jansen | 97ed907 | 2000-09-08 22:06:16 +0000 | [diff] [blame] | 941 | if (!PyArg_ParseTuple(_args, "B", |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 942 | &alignment)) |
| 943 | return NULL; |
| 944 | WESetAlignment(alignment, |
| 945 | _self->ob_itself); |
| 946 | Py_INCREF(Py_None); |
| 947 | _res = Py_None; |
| 948 | return _res; |
| 949 | } |
| 950 | |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 951 | static PyObject *wasteObj_WEGetDirection(_self, _args) |
| 952 | wasteObject *_self; |
| 953 | PyObject *_args; |
| 954 | { |
| 955 | PyObject *_res = NULL; |
| 956 | WEDirection _rv; |
| 957 | if (!PyArg_ParseTuple(_args, "")) |
| 958 | return NULL; |
| 959 | _rv = WEGetDirection(_self->ob_itself); |
| 960 | _res = Py_BuildValue("h", |
| 961 | _rv); |
| 962 | return _res; |
| 963 | } |
| 964 | |
| 965 | static PyObject *wasteObj_WESetDirection(_self, _args) |
| 966 | wasteObject *_self; |
| 967 | PyObject *_args; |
| 968 | { |
| 969 | PyObject *_res = NULL; |
| 970 | WEDirection direction; |
| 971 | if (!PyArg_ParseTuple(_args, "h", |
| 972 | &direction)) |
| 973 | return NULL; |
| 974 | WESetDirection(direction, |
| 975 | _self->ob_itself); |
| 976 | Py_INCREF(Py_None); |
| 977 | _res = Py_None; |
| 978 | return _res; |
| 979 | } |
| 980 | |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 981 | static PyObject *wasteObj_WECalText(_self, _args) |
| 982 | wasteObject *_self; |
| 983 | PyObject *_args; |
| 984 | { |
| 985 | PyObject *_res = NULL; |
| 986 | OSErr _err; |
| 987 | if (!PyArg_ParseTuple(_args, "")) |
| 988 | return NULL; |
| 989 | _err = WECalText(_self->ob_itself); |
| 990 | if (_err != noErr) return PyMac_Error(_err); |
| 991 | Py_INCREF(Py_None); |
| 992 | _res = Py_None; |
| 993 | return _res; |
| 994 | } |
| 995 | |
| 996 | static PyObject *wasteObj_WEUpdate(_self, _args) |
| 997 | wasteObject *_self; |
| 998 | PyObject *_args; |
| 999 | { |
| 1000 | PyObject *_res = NULL; |
| 1001 | RgnHandle updateRgn; |
| 1002 | if (!PyArg_ParseTuple(_args, "O&", |
| 1003 | ResObj_Convert, &updateRgn)) |
| 1004 | return NULL; |
| 1005 | WEUpdate(updateRgn, |
| 1006 | _self->ob_itself); |
| 1007 | Py_INCREF(Py_None); |
| 1008 | _res = Py_None; |
| 1009 | return _res; |
| 1010 | } |
| 1011 | |
| 1012 | static PyObject *wasteObj_WEScroll(_self, _args) |
| 1013 | wasteObject *_self; |
| 1014 | PyObject *_args; |
| 1015 | { |
| 1016 | PyObject *_res = NULL; |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 1017 | SInt32 hOffset; |
| 1018 | SInt32 vOffset; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1019 | if (!PyArg_ParseTuple(_args, "ll", |
| 1020 | &hOffset, |
| 1021 | &vOffset)) |
| 1022 | return NULL; |
| 1023 | WEScroll(hOffset, |
| 1024 | vOffset, |
| 1025 | _self->ob_itself); |
| 1026 | Py_INCREF(Py_None); |
| 1027 | _res = Py_None; |
| 1028 | return _res; |
| 1029 | } |
| 1030 | |
| 1031 | static PyObject *wasteObj_WESelView(_self, _args) |
| 1032 | wasteObject *_self; |
| 1033 | PyObject *_args; |
| 1034 | { |
| 1035 | PyObject *_res = NULL; |
| 1036 | if (!PyArg_ParseTuple(_args, "")) |
| 1037 | return NULL; |
| 1038 | WESelView(_self->ob_itself); |
| 1039 | Py_INCREF(Py_None); |
| 1040 | _res = Py_None; |
| 1041 | return _res; |
| 1042 | } |
| 1043 | |
| 1044 | static PyObject *wasteObj_WEActivate(_self, _args) |
| 1045 | wasteObject *_self; |
| 1046 | PyObject *_args; |
| 1047 | { |
| 1048 | PyObject *_res = NULL; |
| 1049 | if (!PyArg_ParseTuple(_args, "")) |
| 1050 | return NULL; |
| 1051 | WEActivate(_self->ob_itself); |
| 1052 | Py_INCREF(Py_None); |
| 1053 | _res = Py_None; |
| 1054 | return _res; |
| 1055 | } |
| 1056 | |
| 1057 | static PyObject *wasteObj_WEDeactivate(_self, _args) |
| 1058 | wasteObject *_self; |
| 1059 | PyObject *_args; |
| 1060 | { |
| 1061 | PyObject *_res = NULL; |
| 1062 | if (!PyArg_ParseTuple(_args, "")) |
| 1063 | return NULL; |
| 1064 | WEDeactivate(_self->ob_itself); |
| 1065 | Py_INCREF(Py_None); |
| 1066 | _res = Py_None; |
| 1067 | return _res; |
| 1068 | } |
| 1069 | |
| 1070 | static PyObject *wasteObj_WEKey(_self, _args) |
| 1071 | wasteObject *_self; |
| 1072 | PyObject *_args; |
| 1073 | { |
| 1074 | PyObject *_res = NULL; |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 1075 | SInt16 key; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1076 | EventModifiers modifiers; |
Jack Jansen | 9d8b96c | 2000-07-14 22:16:45 +0000 | [diff] [blame] | 1077 | if (!PyArg_ParseTuple(_args, "hH", |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1078 | &key, |
| 1079 | &modifiers)) |
| 1080 | return NULL; |
| 1081 | WEKey(key, |
| 1082 | modifiers, |
| 1083 | _self->ob_itself); |
| 1084 | Py_INCREF(Py_None); |
| 1085 | _res = Py_None; |
| 1086 | return _res; |
| 1087 | } |
| 1088 | |
| 1089 | static PyObject *wasteObj_WEClick(_self, _args) |
| 1090 | wasteObject *_self; |
| 1091 | PyObject *_args; |
| 1092 | { |
| 1093 | PyObject *_res = NULL; |
| 1094 | Point hitPt; |
| 1095 | EventModifiers modifiers; |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 1096 | UInt32 clickTime; |
Jack Jansen | 9d8b96c | 2000-07-14 22:16:45 +0000 | [diff] [blame] | 1097 | if (!PyArg_ParseTuple(_args, "O&Hl", |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1098 | PyMac_GetPoint, &hitPt, |
| 1099 | &modifiers, |
| 1100 | &clickTime)) |
| 1101 | return NULL; |
| 1102 | WEClick(hitPt, |
| 1103 | modifiers, |
| 1104 | clickTime, |
| 1105 | _self->ob_itself); |
| 1106 | Py_INCREF(Py_None); |
| 1107 | _res = Py_None; |
| 1108 | return _res; |
| 1109 | } |
| 1110 | |
| 1111 | static PyObject *wasteObj_WEAdjustCursor(_self, _args) |
| 1112 | wasteObject *_self; |
| 1113 | PyObject *_args; |
| 1114 | { |
| 1115 | PyObject *_res = NULL; |
| 1116 | Boolean _rv; |
| 1117 | Point mouseLoc; |
| 1118 | RgnHandle mouseRgn; |
| 1119 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 1120 | PyMac_GetPoint, &mouseLoc, |
| 1121 | ResObj_Convert, &mouseRgn)) |
| 1122 | return NULL; |
| 1123 | _rv = WEAdjustCursor(mouseLoc, |
| 1124 | mouseRgn, |
| 1125 | _self->ob_itself); |
| 1126 | _res = Py_BuildValue("b", |
| 1127 | _rv); |
| 1128 | return _res; |
| 1129 | } |
| 1130 | |
| 1131 | static PyObject *wasteObj_WEIdle(_self, _args) |
| 1132 | wasteObject *_self; |
| 1133 | PyObject *_args; |
| 1134 | { |
| 1135 | PyObject *_res = NULL; |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 1136 | UInt32 maxSleep; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1137 | if (!PyArg_ParseTuple(_args, "")) |
| 1138 | return NULL; |
| 1139 | WEIdle(&maxSleep, |
| 1140 | _self->ob_itself); |
| 1141 | _res = Py_BuildValue("l", |
| 1142 | maxSleep); |
| 1143 | return _res; |
| 1144 | } |
| 1145 | |
| 1146 | static PyObject *wasteObj_WEInsert(_self, _args) |
| 1147 | wasteObject *_self; |
| 1148 | PyObject *_args; |
| 1149 | { |
| 1150 | PyObject *_res = NULL; |
| 1151 | OSErr _err; |
| 1152 | char *pText__in__; |
| 1153 | long pText__len__; |
| 1154 | int pText__in_len__; |
| 1155 | StScrpHandle hStyles; |
| 1156 | WESoupHandle hSoup; |
| 1157 | if (!PyArg_ParseTuple(_args, "s#O&O&", |
| 1158 | &pText__in__, &pText__in_len__, |
Jack Jansen | 8ae8e4f | 1996-04-23 16:17:08 +0000 | [diff] [blame] | 1159 | OptResObj_Convert, &hStyles, |
| 1160 | OptResObj_Convert, &hSoup)) |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1161 | return NULL; |
| 1162 | pText__len__ = pText__in_len__; |
| 1163 | _err = WEInsert(pText__in__, pText__len__, |
| 1164 | hStyles, |
| 1165 | hSoup, |
| 1166 | _self->ob_itself); |
| 1167 | if (_err != noErr) return PyMac_Error(_err); |
| 1168 | Py_INCREF(Py_None); |
| 1169 | _res = Py_None; |
| 1170 | pText__error__: ; |
| 1171 | return _res; |
| 1172 | } |
| 1173 | |
| 1174 | static PyObject *wasteObj_WEDelete(_self, _args) |
| 1175 | wasteObject *_self; |
| 1176 | PyObject *_args; |
| 1177 | { |
| 1178 | PyObject *_res = NULL; |
| 1179 | OSErr _err; |
| 1180 | if (!PyArg_ParseTuple(_args, "")) |
| 1181 | return NULL; |
| 1182 | _err = WEDelete(_self->ob_itself); |
| 1183 | if (_err != noErr) return PyMac_Error(_err); |
| 1184 | Py_INCREF(Py_None); |
| 1185 | _res = Py_None; |
| 1186 | return _res; |
| 1187 | } |
| 1188 | |
| 1189 | static PyObject *wasteObj_WESetStyle(_self, _args) |
| 1190 | wasteObject *_self; |
| 1191 | PyObject *_args; |
| 1192 | { |
| 1193 | PyObject *_res = NULL; |
| 1194 | OSErr _err; |
| 1195 | WEStyleMode mode; |
| 1196 | TextStyle ts; |
Jack Jansen | 9d8b96c | 2000-07-14 22:16:45 +0000 | [diff] [blame] | 1197 | if (!PyArg_ParseTuple(_args, "HO&", |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1198 | &mode, |
| 1199 | TextStyle_Convert, &ts)) |
| 1200 | return NULL; |
| 1201 | _err = WESetStyle(mode, |
| 1202 | &ts, |
| 1203 | _self->ob_itself); |
| 1204 | if (_err != noErr) return PyMac_Error(_err); |
| 1205 | Py_INCREF(Py_None); |
| 1206 | _res = Py_None; |
| 1207 | return _res; |
| 1208 | } |
| 1209 | |
| 1210 | static PyObject *wasteObj_WEUseStyleScrap(_self, _args) |
| 1211 | wasteObject *_self; |
| 1212 | PyObject *_args; |
| 1213 | { |
| 1214 | PyObject *_res = NULL; |
| 1215 | OSErr _err; |
| 1216 | StScrpHandle hStyles; |
| 1217 | if (!PyArg_ParseTuple(_args, "O&", |
| 1218 | ResObj_Convert, &hStyles)) |
| 1219 | return NULL; |
| 1220 | _err = WEUseStyleScrap(hStyles, |
| 1221 | _self->ob_itself); |
| 1222 | if (_err != noErr) return PyMac_Error(_err); |
| 1223 | Py_INCREF(Py_None); |
| 1224 | _res = Py_None; |
| 1225 | return _res; |
| 1226 | } |
| 1227 | |
| 1228 | static PyObject *wasteObj_WEUseText(_self, _args) |
| 1229 | wasteObject *_self; |
| 1230 | PyObject *_args; |
| 1231 | { |
| 1232 | PyObject *_res = NULL; |
| 1233 | OSErr _err; |
| 1234 | Handle hText; |
| 1235 | if (!PyArg_ParseTuple(_args, "O&", |
| 1236 | ResObj_Convert, &hText)) |
| 1237 | return NULL; |
| 1238 | _err = WEUseText(hText, |
| 1239 | _self->ob_itself); |
| 1240 | if (_err != noErr) return PyMac_Error(_err); |
| 1241 | Py_INCREF(Py_None); |
| 1242 | _res = Py_None; |
| 1243 | return _res; |
| 1244 | } |
| 1245 | |
| 1246 | static PyObject *wasteObj_WEUndo(_self, _args) |
| 1247 | wasteObject *_self; |
| 1248 | PyObject *_args; |
| 1249 | { |
| 1250 | PyObject *_res = NULL; |
| 1251 | OSErr _err; |
| 1252 | if (!PyArg_ParseTuple(_args, "")) |
| 1253 | return NULL; |
| 1254 | _err = WEUndo(_self->ob_itself); |
| 1255 | if (_err != noErr) return PyMac_Error(_err); |
| 1256 | Py_INCREF(Py_None); |
| 1257 | _res = Py_None; |
| 1258 | return _res; |
| 1259 | } |
| 1260 | |
| 1261 | static PyObject *wasteObj_WEClearUndo(_self, _args) |
| 1262 | wasteObject *_self; |
| 1263 | PyObject *_args; |
| 1264 | { |
| 1265 | PyObject *_res = NULL; |
| 1266 | if (!PyArg_ParseTuple(_args, "")) |
| 1267 | return NULL; |
| 1268 | WEClearUndo(_self->ob_itself); |
| 1269 | Py_INCREF(Py_None); |
| 1270 | _res = Py_None; |
| 1271 | return _res; |
| 1272 | } |
| 1273 | |
| 1274 | static PyObject *wasteObj_WEGetUndoInfo(_self, _args) |
| 1275 | wasteObject *_self; |
| 1276 | PyObject *_args; |
| 1277 | { |
| 1278 | PyObject *_res = NULL; |
| 1279 | WEActionKind _rv; |
| 1280 | Boolean redoFlag; |
| 1281 | if (!PyArg_ParseTuple(_args, "")) |
| 1282 | return NULL; |
| 1283 | _rv = WEGetUndoInfo(&redoFlag, |
| 1284 | _self->ob_itself); |
| 1285 | _res = Py_BuildValue("hb", |
| 1286 | _rv, |
| 1287 | redoFlag); |
| 1288 | return _res; |
| 1289 | } |
| 1290 | |
| 1291 | static PyObject *wasteObj_WEIsTyping(_self, _args) |
| 1292 | wasteObject *_self; |
| 1293 | PyObject *_args; |
| 1294 | { |
| 1295 | PyObject *_res = NULL; |
| 1296 | Boolean _rv; |
| 1297 | if (!PyArg_ParseTuple(_args, "")) |
| 1298 | return NULL; |
| 1299 | _rv = WEIsTyping(_self->ob_itself); |
| 1300 | _res = Py_BuildValue("b", |
| 1301 | _rv); |
| 1302 | return _res; |
| 1303 | } |
| 1304 | |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 1305 | static PyObject *wasteObj_WEBeginAction(_self, _args) |
| 1306 | wasteObject *_self; |
| 1307 | PyObject *_args; |
| 1308 | { |
| 1309 | PyObject *_res = NULL; |
| 1310 | OSErr _err; |
| 1311 | if (!PyArg_ParseTuple(_args, "")) |
| 1312 | return NULL; |
| 1313 | _err = WEBeginAction(_self->ob_itself); |
| 1314 | if (_err != noErr) return PyMac_Error(_err); |
| 1315 | Py_INCREF(Py_None); |
| 1316 | _res = Py_None; |
| 1317 | return _res; |
| 1318 | } |
| 1319 | |
| 1320 | static PyObject *wasteObj_WEEndAction(_self, _args) |
| 1321 | wasteObject *_self; |
| 1322 | PyObject *_args; |
| 1323 | { |
| 1324 | PyObject *_res = NULL; |
| 1325 | OSErr _err; |
| 1326 | WEActionKind actionKind; |
| 1327 | if (!PyArg_ParseTuple(_args, "h", |
| 1328 | &actionKind)) |
| 1329 | return NULL; |
| 1330 | _err = WEEndAction(actionKind, |
| 1331 | _self->ob_itself); |
| 1332 | if (_err != noErr) return PyMac_Error(_err); |
| 1333 | Py_INCREF(Py_None); |
| 1334 | _res = Py_None; |
| 1335 | return _res; |
| 1336 | } |
| 1337 | |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1338 | static PyObject *wasteObj_WEGetModCount(_self, _args) |
| 1339 | wasteObject *_self; |
| 1340 | PyObject *_args; |
| 1341 | { |
| 1342 | PyObject *_res = NULL; |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 1343 | UInt32 _rv; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1344 | if (!PyArg_ParseTuple(_args, "")) |
| 1345 | return NULL; |
| 1346 | _rv = WEGetModCount(_self->ob_itself); |
| 1347 | _res = Py_BuildValue("l", |
| 1348 | _rv); |
| 1349 | return _res; |
| 1350 | } |
| 1351 | |
| 1352 | static PyObject *wasteObj_WEResetModCount(_self, _args) |
| 1353 | wasteObject *_self; |
| 1354 | PyObject *_args; |
| 1355 | { |
| 1356 | PyObject *_res = NULL; |
| 1357 | if (!PyArg_ParseTuple(_args, "")) |
| 1358 | return NULL; |
| 1359 | WEResetModCount(_self->ob_itself); |
| 1360 | Py_INCREF(Py_None); |
| 1361 | _res = Py_None; |
| 1362 | return _res; |
| 1363 | } |
| 1364 | |
| 1365 | static PyObject *wasteObj_WEInsertObject(_self, _args) |
| 1366 | wasteObject *_self; |
| 1367 | PyObject *_args; |
| 1368 | { |
| 1369 | PyObject *_res = NULL; |
| 1370 | OSErr _err; |
| 1371 | FlavorType objectType; |
| 1372 | Handle objectDataHandle; |
| 1373 | Point objectSize; |
| 1374 | if (!PyArg_ParseTuple(_args, "O&O&O&", |
| 1375 | PyMac_GetOSType, &objectType, |
| 1376 | ResObj_Convert, &objectDataHandle, |
| 1377 | PyMac_GetPoint, &objectSize)) |
| 1378 | return NULL; |
| 1379 | _err = WEInsertObject(objectType, |
| 1380 | objectDataHandle, |
| 1381 | objectSize, |
| 1382 | _self->ob_itself); |
| 1383 | if (_err != noErr) return PyMac_Error(_err); |
| 1384 | Py_INCREF(Py_None); |
| 1385 | _res = Py_None; |
| 1386 | return _res; |
| 1387 | } |
| 1388 | |
| 1389 | static PyObject *wasteObj_WEGetSelectedObject(_self, _args) |
| 1390 | wasteObject *_self; |
| 1391 | PyObject *_args; |
| 1392 | { |
| 1393 | PyObject *_res = NULL; |
| 1394 | OSErr _err; |
| 1395 | WEObjectReference obj; |
| 1396 | if (!PyArg_ParseTuple(_args, "")) |
| 1397 | return NULL; |
| 1398 | _err = WEGetSelectedObject(&obj, |
| 1399 | _self->ob_itself); |
| 1400 | if (_err != noErr) return PyMac_Error(_err); |
| 1401 | _res = Py_BuildValue("O&", |
| 1402 | WEOObj_New, obj); |
| 1403 | return _res; |
| 1404 | } |
| 1405 | |
| 1406 | static PyObject *wasteObj_WEFindNextObject(_self, _args) |
| 1407 | wasteObject *_self; |
| 1408 | PyObject *_args; |
| 1409 | { |
| 1410 | PyObject *_res = NULL; |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 1411 | SInt32 _rv; |
| 1412 | SInt32 offset; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1413 | WEObjectReference obj; |
| 1414 | if (!PyArg_ParseTuple(_args, "l", |
| 1415 | &offset)) |
| 1416 | return NULL; |
| 1417 | _rv = WEFindNextObject(offset, |
| 1418 | &obj, |
| 1419 | _self->ob_itself); |
| 1420 | _res = Py_BuildValue("lO&", |
| 1421 | _rv, |
| 1422 | WEOObj_New, obj); |
| 1423 | return _res; |
| 1424 | } |
| 1425 | |
| 1426 | static PyObject *wasteObj_WEUseSoup(_self, _args) |
| 1427 | wasteObject *_self; |
| 1428 | PyObject *_args; |
| 1429 | { |
| 1430 | PyObject *_res = NULL; |
| 1431 | OSErr _err; |
| 1432 | WESoupHandle hSoup; |
| 1433 | if (!PyArg_ParseTuple(_args, "O&", |
| 1434 | ResObj_Convert, &hSoup)) |
| 1435 | return NULL; |
| 1436 | _err = WEUseSoup(hSoup, |
| 1437 | _self->ob_itself); |
| 1438 | if (_err != noErr) return PyMac_Error(_err); |
| 1439 | Py_INCREF(Py_None); |
| 1440 | _res = Py_None; |
| 1441 | return _res; |
| 1442 | } |
| 1443 | |
| 1444 | static PyObject *wasteObj_WECut(_self, _args) |
| 1445 | wasteObject *_self; |
| 1446 | PyObject *_args; |
| 1447 | { |
| 1448 | PyObject *_res = NULL; |
| 1449 | OSErr _err; |
| 1450 | if (!PyArg_ParseTuple(_args, "")) |
| 1451 | return NULL; |
| 1452 | _err = WECut(_self->ob_itself); |
| 1453 | if (_err != noErr) return PyMac_Error(_err); |
| 1454 | Py_INCREF(Py_None); |
| 1455 | _res = Py_None; |
| 1456 | return _res; |
| 1457 | } |
| 1458 | |
| 1459 | static PyObject *wasteObj_WECopy(_self, _args) |
| 1460 | wasteObject *_self; |
| 1461 | PyObject *_args; |
| 1462 | { |
| 1463 | PyObject *_res = NULL; |
| 1464 | OSErr _err; |
| 1465 | if (!PyArg_ParseTuple(_args, "")) |
| 1466 | return NULL; |
| 1467 | _err = WECopy(_self->ob_itself); |
| 1468 | if (_err != noErr) return PyMac_Error(_err); |
| 1469 | Py_INCREF(Py_None); |
| 1470 | _res = Py_None; |
| 1471 | return _res; |
| 1472 | } |
| 1473 | |
| 1474 | static PyObject *wasteObj_WEPaste(_self, _args) |
| 1475 | wasteObject *_self; |
| 1476 | PyObject *_args; |
| 1477 | { |
| 1478 | PyObject *_res = NULL; |
| 1479 | OSErr _err; |
| 1480 | if (!PyArg_ParseTuple(_args, "")) |
| 1481 | return NULL; |
| 1482 | _err = WEPaste(_self->ob_itself); |
| 1483 | if (_err != noErr) return PyMac_Error(_err); |
| 1484 | Py_INCREF(Py_None); |
| 1485 | _res = Py_None; |
| 1486 | return _res; |
| 1487 | } |
| 1488 | |
| 1489 | static PyObject *wasteObj_WECanPaste(_self, _args) |
| 1490 | wasteObject *_self; |
| 1491 | PyObject *_args; |
| 1492 | { |
| 1493 | PyObject *_res = NULL; |
| 1494 | Boolean _rv; |
| 1495 | if (!PyArg_ParseTuple(_args, "")) |
| 1496 | return NULL; |
| 1497 | _rv = WECanPaste(_self->ob_itself); |
| 1498 | _res = Py_BuildValue("b", |
| 1499 | _rv); |
| 1500 | return _res; |
| 1501 | } |
| 1502 | |
| 1503 | static PyObject *wasteObj_WEGetHiliteRgn(_self, _args) |
| 1504 | wasteObject *_self; |
| 1505 | PyObject *_args; |
| 1506 | { |
| 1507 | PyObject *_res = NULL; |
| 1508 | RgnHandle _rv; |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 1509 | SInt32 rangeStart; |
| 1510 | SInt32 rangeEnd; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1511 | if (!PyArg_ParseTuple(_args, "ll", |
| 1512 | &rangeStart, |
| 1513 | &rangeEnd)) |
| 1514 | return NULL; |
| 1515 | _rv = WEGetHiliteRgn(rangeStart, |
| 1516 | rangeEnd, |
| 1517 | _self->ob_itself); |
| 1518 | _res = Py_BuildValue("O&", |
| 1519 | ResObj_New, _rv); |
| 1520 | return _res; |
| 1521 | } |
| 1522 | |
| 1523 | static PyObject *wasteObj_WECharByte(_self, _args) |
| 1524 | wasteObject *_self; |
| 1525 | PyObject *_args; |
| 1526 | { |
| 1527 | PyObject *_res = NULL; |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 1528 | SInt16 _rv; |
| 1529 | SInt32 offset; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1530 | if (!PyArg_ParseTuple(_args, "l", |
| 1531 | &offset)) |
| 1532 | return NULL; |
| 1533 | _rv = WECharByte(offset, |
| 1534 | _self->ob_itself); |
| 1535 | _res = Py_BuildValue("h", |
| 1536 | _rv); |
| 1537 | return _res; |
| 1538 | } |
| 1539 | |
| 1540 | static PyObject *wasteObj_WECharType(_self, _args) |
| 1541 | wasteObject *_self; |
| 1542 | PyObject *_args; |
| 1543 | { |
| 1544 | PyObject *_res = NULL; |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 1545 | SInt16 _rv; |
| 1546 | SInt32 offset; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1547 | if (!PyArg_ParseTuple(_args, "l", |
| 1548 | &offset)) |
| 1549 | return NULL; |
| 1550 | _rv = WECharType(offset, |
| 1551 | _self->ob_itself); |
| 1552 | _res = Py_BuildValue("h", |
| 1553 | _rv); |
| 1554 | return _res; |
| 1555 | } |
| 1556 | |
| 1557 | static PyObject *wasteObj_WEStopInlineSession(_self, _args) |
| 1558 | wasteObject *_self; |
| 1559 | PyObject *_args; |
| 1560 | { |
| 1561 | PyObject *_res = NULL; |
| 1562 | if (!PyArg_ParseTuple(_args, "")) |
| 1563 | return NULL; |
| 1564 | WEStopInlineSession(_self->ob_itself); |
| 1565 | Py_INCREF(Py_None); |
| 1566 | _res = Py_None; |
| 1567 | return _res; |
| 1568 | } |
| 1569 | |
| 1570 | static PyObject *wasteObj_WEFeatureFlag(_self, _args) |
| 1571 | wasteObject *_self; |
| 1572 | PyObject *_args; |
| 1573 | { |
| 1574 | PyObject *_res = NULL; |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 1575 | SInt16 _rv; |
| 1576 | SInt16 feature; |
| 1577 | SInt16 action; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1578 | if (!PyArg_ParseTuple(_args, "hh", |
| 1579 | &feature, |
| 1580 | &action)) |
| 1581 | return NULL; |
| 1582 | _rv = WEFeatureFlag(feature, |
| 1583 | action, |
| 1584 | _self->ob_itself); |
| 1585 | _res = Py_BuildValue("h", |
| 1586 | _rv); |
| 1587 | return _res; |
| 1588 | } |
| 1589 | |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 1590 | static PyObject *wasteObj_WEGetUserInfo(_self, _args) |
| 1591 | wasteObject *_self; |
| 1592 | PyObject *_args; |
| 1593 | { |
| 1594 | PyObject *_res = NULL; |
| 1595 | OSErr _err; |
| 1596 | WESelector tag; |
| 1597 | SInt32 userInfo; |
| 1598 | if (!PyArg_ParseTuple(_args, "O&", |
| 1599 | PyMac_GetOSType, &tag)) |
| 1600 | return NULL; |
| 1601 | _err = WEGetUserInfo(tag, |
| 1602 | &userInfo, |
| 1603 | _self->ob_itself); |
| 1604 | if (_err != noErr) return PyMac_Error(_err); |
| 1605 | _res = Py_BuildValue("l", |
| 1606 | userInfo); |
| 1607 | return _res; |
| 1608 | } |
| 1609 | |
| 1610 | static PyObject *wasteObj_WESetUserInfo(_self, _args) |
| 1611 | wasteObject *_self; |
| 1612 | PyObject *_args; |
| 1613 | { |
| 1614 | PyObject *_res = NULL; |
| 1615 | OSErr _err; |
| 1616 | WESelector tag; |
| 1617 | SInt32 userInfo; |
| 1618 | if (!PyArg_ParseTuple(_args, "O&l", |
| 1619 | PyMac_GetOSType, &tag, |
| 1620 | &userInfo)) |
| 1621 | return NULL; |
| 1622 | _err = WESetUserInfo(tag, |
| 1623 | userInfo, |
| 1624 | _self->ob_itself); |
| 1625 | if (_err != noErr) return PyMac_Error(_err); |
| 1626 | Py_INCREF(Py_None); |
| 1627 | _res = Py_None; |
| 1628 | return _res; |
| 1629 | } |
| 1630 | |
Jack Jansen | 176f3a9 | 1996-10-23 15:43:46 +0000 | [diff] [blame] | 1631 | static PyObject *wasteObj_WEInstallTabHooks(_self, _args) |
| 1632 | wasteObject *_self; |
| 1633 | PyObject *_args; |
| 1634 | { |
| 1635 | PyObject *_res = NULL; |
| 1636 | OSErr _err; |
| 1637 | if (!PyArg_ParseTuple(_args, "")) |
| 1638 | return NULL; |
| 1639 | _err = WEInstallTabHooks(_self->ob_itself); |
| 1640 | if (_err != noErr) return PyMac_Error(_err); |
| 1641 | Py_INCREF(Py_None); |
| 1642 | _res = Py_None; |
| 1643 | return _res; |
| 1644 | } |
| 1645 | |
| 1646 | static PyObject *wasteObj_WERemoveTabHooks(_self, _args) |
| 1647 | wasteObject *_self; |
| 1648 | PyObject *_args; |
| 1649 | { |
| 1650 | PyObject *_res = NULL; |
| 1651 | OSErr _err; |
| 1652 | if (!PyArg_ParseTuple(_args, "")) |
| 1653 | return NULL; |
| 1654 | _err = WERemoveTabHooks(_self->ob_itself); |
| 1655 | if (_err != noErr) return PyMac_Error(_err); |
| 1656 | Py_INCREF(Py_None); |
| 1657 | _res = Py_None; |
| 1658 | return _res; |
| 1659 | } |
| 1660 | |
| 1661 | static PyObject *wasteObj_WEIsTabHooks(_self, _args) |
| 1662 | wasteObject *_self; |
| 1663 | PyObject *_args; |
| 1664 | { |
| 1665 | PyObject *_res = NULL; |
| 1666 | Boolean _rv; |
| 1667 | if (!PyArg_ParseTuple(_args, "")) |
| 1668 | return NULL; |
| 1669 | _rv = WEIsTabHooks(_self->ob_itself); |
| 1670 | _res = Py_BuildValue("b", |
| 1671 | _rv); |
| 1672 | return _res; |
| 1673 | } |
| 1674 | |
Jack Jansen | a4f0309 | 1998-03-02 16:56:18 +0000 | [diff] [blame] | 1675 | static PyObject *wasteObj_WEGetTabSize(_self, _args) |
| 1676 | wasteObject *_self; |
| 1677 | PyObject *_args; |
| 1678 | { |
| 1679 | PyObject *_res = NULL; |
| 1680 | SInt16 _rv; |
| 1681 | if (!PyArg_ParseTuple(_args, "")) |
| 1682 | return NULL; |
| 1683 | _rv = WEGetTabSize(_self->ob_itself); |
| 1684 | _res = Py_BuildValue("h", |
| 1685 | _rv); |
| 1686 | return _res; |
| 1687 | } |
| 1688 | |
| 1689 | static PyObject *wasteObj_WESetTabSize(_self, _args) |
| 1690 | wasteObject *_self; |
| 1691 | PyObject *_args; |
| 1692 | { |
| 1693 | PyObject *_res = NULL; |
| 1694 | OSErr _err; |
| 1695 | SInt16 tabWidth; |
| 1696 | if (!PyArg_ParseTuple(_args, "h", |
| 1697 | &tabWidth)) |
| 1698 | return NULL; |
| 1699 | _err = WESetTabSize(tabWidth, |
| 1700 | _self->ob_itself); |
| 1701 | if (_err != noErr) return PyMac_Error(_err); |
| 1702 | Py_INCREF(Py_None); |
| 1703 | _res = Py_None; |
| 1704 | return _res; |
| 1705 | } |
| 1706 | |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1707 | static PyMethodDef wasteObj_methods[] = { |
| 1708 | {"WEGetText", (PyCFunction)wasteObj_WEGetText, 1, |
| 1709 | "() -> (Handle _rv)"}, |
| 1710 | {"WEGetChar", (PyCFunction)wasteObj_WEGetChar, 1, |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 1711 | "(SInt32 offset) -> (SInt16 _rv)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1712 | {"WEGetTextLength", (PyCFunction)wasteObj_WEGetTextLength, 1, |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 1713 | "() -> (SInt32 _rv)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1714 | {"WEGetHeight", (PyCFunction)wasteObj_WEGetHeight, 1, |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 1715 | "(SInt32 startLine, SInt32 endLine) -> (SInt32 _rv)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1716 | {"WEGetSelection", (PyCFunction)wasteObj_WEGetSelection, 1, |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 1717 | "() -> (SInt32 selStart, SInt32 selEnd)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1718 | {"WEGetDestRect", (PyCFunction)wasteObj_WEGetDestRect, 1, |
| 1719 | "() -> (LongRect destRect)"}, |
| 1720 | {"WEGetViewRect", (PyCFunction)wasteObj_WEGetViewRect, 1, |
| 1721 | "() -> (LongRect viewRect)"}, |
| 1722 | {"WEIsActive", (PyCFunction)wasteObj_WEIsActive, 1, |
| 1723 | "() -> (Boolean _rv)"}, |
| 1724 | {"WEOffsetToLine", (PyCFunction)wasteObj_WEOffsetToLine, 1, |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 1725 | "(SInt32 offset) -> (SInt32 _rv)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1726 | {"WEGetLineRange", (PyCFunction)wasteObj_WEGetLineRange, 1, |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 1727 | "(SInt32 lineIndex) -> (SInt32 lineStart, SInt32 lineEnd)"}, |
| 1728 | {"WECountLines", (PyCFunction)wasteObj_WECountLines, 1, |
| 1729 | "() -> (SInt32 _rv)"}, |
| 1730 | {"WEOffsetToRun", (PyCFunction)wasteObj_WEOffsetToRun, 1, |
| 1731 | "(SInt32 offset) -> (SInt32 _rv)"}, |
| 1732 | {"WEGetRunRange", (PyCFunction)wasteObj_WEGetRunRange, 1, |
| 1733 | "(SInt32 runIndex) -> (SInt32 runStart, SInt32 runEnd)"}, |
| 1734 | {"WECountRuns", (PyCFunction)wasteObj_WECountRuns, 1, |
| 1735 | "() -> (SInt32 _rv)"}, |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 1736 | {"WEGetClickCount", (PyCFunction)wasteObj_WEGetClickCount, 1, |
| 1737 | "() -> (UInt16 _rv)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1738 | {"WESetSelection", (PyCFunction)wasteObj_WESetSelection, 1, |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 1739 | "(SInt32 selStart, SInt32 selEnd) -> None"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1740 | {"WESetDestRect", (PyCFunction)wasteObj_WESetDestRect, 1, |
| 1741 | "(LongRect destRect) -> None"}, |
| 1742 | {"WESetViewRect", (PyCFunction)wasteObj_WESetViewRect, 1, |
| 1743 | "(LongRect viewRect) -> None"}, |
| 1744 | {"WEContinuousStyle", (PyCFunction)wasteObj_WEContinuousStyle, 1, |
Jack Jansen | 8ae8e4f | 1996-04-23 16:17:08 +0000 | [diff] [blame] | 1745 | "(WEStyleMode mode) -> (Boolean _rv, WEStyleMode mode, TextStyle ts)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1746 | {"WEGetRunInfo", (PyCFunction)wasteObj_WEGetRunInfo, 1, |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 1747 | "(SInt32 offset) -> (WERunInfo runInfo)"}, |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 1748 | {"WEGetRunDirection", (PyCFunction)wasteObj_WEGetRunDirection, 1, |
| 1749 | "(SInt32 offset) -> (Boolean _rv)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1750 | {"WEGetOffset", (PyCFunction)wasteObj_WEGetOffset, 1, |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 1751 | "(LongPt thePoint) -> (SInt32 _rv, WEEdge edge)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1752 | {"WEGetPoint", (PyCFunction)wasteObj_WEGetPoint, 1, |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 1753 | "(SInt32 offset, SInt16 direction) -> (LongPt thePoint, SInt16 lineHeight)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1754 | {"WEFindWord", (PyCFunction)wasteObj_WEFindWord, 1, |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 1755 | "(SInt32 offset, WEEdge edge) -> (SInt32 wordStart, SInt32 wordEnd)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1756 | {"WEFindLine", (PyCFunction)wasteObj_WEFindLine, 1, |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 1757 | "(SInt32 offset, WEEdge edge) -> (SInt32 lineStart, SInt32 lineEnd)"}, |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 1758 | {"WEFindParagraph", (PyCFunction)wasteObj_WEFindParagraph, 1, |
| 1759 | "(SInt32 offset, WEEdge edge) -> (SInt32 paragraphStart, SInt32 paragraphEnd)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1760 | {"WECopyRange", (PyCFunction)wasteObj_WECopyRange, 1, |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 1761 | "(SInt32 rangeStart, SInt32 rangeEnd, Handle hText, StScrpHandle hStyles, WESoupHandle hSoup) -> None"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1762 | {"WEGetAlignment", (PyCFunction)wasteObj_WEGetAlignment, 1, |
| 1763 | "() -> (WEAlignment _rv)"}, |
| 1764 | {"WESetAlignment", (PyCFunction)wasteObj_WESetAlignment, 1, |
| 1765 | "(WEAlignment alignment) -> None"}, |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 1766 | {"WEGetDirection", (PyCFunction)wasteObj_WEGetDirection, 1, |
| 1767 | "() -> (WEDirection _rv)"}, |
| 1768 | {"WESetDirection", (PyCFunction)wasteObj_WESetDirection, 1, |
| 1769 | "(WEDirection direction) -> None"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1770 | {"WECalText", (PyCFunction)wasteObj_WECalText, 1, |
| 1771 | "() -> None"}, |
| 1772 | {"WEUpdate", (PyCFunction)wasteObj_WEUpdate, 1, |
| 1773 | "(RgnHandle updateRgn) -> None"}, |
| 1774 | {"WEScroll", (PyCFunction)wasteObj_WEScroll, 1, |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 1775 | "(SInt32 hOffset, SInt32 vOffset) -> None"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1776 | {"WESelView", (PyCFunction)wasteObj_WESelView, 1, |
| 1777 | "() -> None"}, |
| 1778 | {"WEActivate", (PyCFunction)wasteObj_WEActivate, 1, |
| 1779 | "() -> None"}, |
| 1780 | {"WEDeactivate", (PyCFunction)wasteObj_WEDeactivate, 1, |
| 1781 | "() -> None"}, |
| 1782 | {"WEKey", (PyCFunction)wasteObj_WEKey, 1, |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 1783 | "(SInt16 key, EventModifiers modifiers) -> None"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1784 | {"WEClick", (PyCFunction)wasteObj_WEClick, 1, |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 1785 | "(Point hitPt, EventModifiers modifiers, UInt32 clickTime) -> None"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1786 | {"WEAdjustCursor", (PyCFunction)wasteObj_WEAdjustCursor, 1, |
| 1787 | "(Point mouseLoc, RgnHandle mouseRgn) -> (Boolean _rv)"}, |
| 1788 | {"WEIdle", (PyCFunction)wasteObj_WEIdle, 1, |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 1789 | "() -> (UInt32 maxSleep)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1790 | {"WEInsert", (PyCFunction)wasteObj_WEInsert, 1, |
| 1791 | "(Buffer pText, StScrpHandle hStyles, WESoupHandle hSoup) -> None"}, |
| 1792 | {"WEDelete", (PyCFunction)wasteObj_WEDelete, 1, |
| 1793 | "() -> None"}, |
| 1794 | {"WESetStyle", (PyCFunction)wasteObj_WESetStyle, 1, |
| 1795 | "(WEStyleMode mode, TextStyle ts) -> None"}, |
| 1796 | {"WEUseStyleScrap", (PyCFunction)wasteObj_WEUseStyleScrap, 1, |
| 1797 | "(StScrpHandle hStyles) -> None"}, |
| 1798 | {"WEUseText", (PyCFunction)wasteObj_WEUseText, 1, |
| 1799 | "(Handle hText) -> None"}, |
| 1800 | {"WEUndo", (PyCFunction)wasteObj_WEUndo, 1, |
| 1801 | "() -> None"}, |
| 1802 | {"WEClearUndo", (PyCFunction)wasteObj_WEClearUndo, 1, |
| 1803 | "() -> None"}, |
| 1804 | {"WEGetUndoInfo", (PyCFunction)wasteObj_WEGetUndoInfo, 1, |
| 1805 | "() -> (WEActionKind _rv, Boolean redoFlag)"}, |
| 1806 | {"WEIsTyping", (PyCFunction)wasteObj_WEIsTyping, 1, |
| 1807 | "() -> (Boolean _rv)"}, |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 1808 | {"WEBeginAction", (PyCFunction)wasteObj_WEBeginAction, 1, |
| 1809 | "() -> None"}, |
| 1810 | {"WEEndAction", (PyCFunction)wasteObj_WEEndAction, 1, |
| 1811 | "(WEActionKind actionKind) -> None"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1812 | {"WEGetModCount", (PyCFunction)wasteObj_WEGetModCount, 1, |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 1813 | "() -> (UInt32 _rv)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1814 | {"WEResetModCount", (PyCFunction)wasteObj_WEResetModCount, 1, |
| 1815 | "() -> None"}, |
| 1816 | {"WEInsertObject", (PyCFunction)wasteObj_WEInsertObject, 1, |
| 1817 | "(FlavorType objectType, Handle objectDataHandle, Point objectSize) -> None"}, |
| 1818 | {"WEGetSelectedObject", (PyCFunction)wasteObj_WEGetSelectedObject, 1, |
| 1819 | "() -> (WEObjectReference obj)"}, |
| 1820 | {"WEFindNextObject", (PyCFunction)wasteObj_WEFindNextObject, 1, |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 1821 | "(SInt32 offset) -> (SInt32 _rv, WEObjectReference obj)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1822 | {"WEUseSoup", (PyCFunction)wasteObj_WEUseSoup, 1, |
| 1823 | "(WESoupHandle hSoup) -> None"}, |
| 1824 | {"WECut", (PyCFunction)wasteObj_WECut, 1, |
| 1825 | "() -> None"}, |
| 1826 | {"WECopy", (PyCFunction)wasteObj_WECopy, 1, |
| 1827 | "() -> None"}, |
| 1828 | {"WEPaste", (PyCFunction)wasteObj_WEPaste, 1, |
| 1829 | "() -> None"}, |
| 1830 | {"WECanPaste", (PyCFunction)wasteObj_WECanPaste, 1, |
| 1831 | "() -> (Boolean _rv)"}, |
| 1832 | {"WEGetHiliteRgn", (PyCFunction)wasteObj_WEGetHiliteRgn, 1, |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 1833 | "(SInt32 rangeStart, SInt32 rangeEnd) -> (RgnHandle _rv)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1834 | {"WECharByte", (PyCFunction)wasteObj_WECharByte, 1, |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 1835 | "(SInt32 offset) -> (SInt16 _rv)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1836 | {"WECharType", (PyCFunction)wasteObj_WECharType, 1, |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 1837 | "(SInt32 offset) -> (SInt16 _rv)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1838 | {"WEStopInlineSession", (PyCFunction)wasteObj_WEStopInlineSession, 1, |
| 1839 | "() -> None"}, |
| 1840 | {"WEFeatureFlag", (PyCFunction)wasteObj_WEFeatureFlag, 1, |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 1841 | "(SInt16 feature, SInt16 action) -> (SInt16 _rv)"}, |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 1842 | {"WEGetUserInfo", (PyCFunction)wasteObj_WEGetUserInfo, 1, |
| 1843 | "(WESelector tag) -> (SInt32 userInfo)"}, |
| 1844 | {"WESetUserInfo", (PyCFunction)wasteObj_WESetUserInfo, 1, |
| 1845 | "(WESelector tag, SInt32 userInfo) -> None"}, |
Jack Jansen | 176f3a9 | 1996-10-23 15:43:46 +0000 | [diff] [blame] | 1846 | {"WEInstallTabHooks", (PyCFunction)wasteObj_WEInstallTabHooks, 1, |
| 1847 | "() -> None"}, |
| 1848 | {"WERemoveTabHooks", (PyCFunction)wasteObj_WERemoveTabHooks, 1, |
| 1849 | "() -> None"}, |
| 1850 | {"WEIsTabHooks", (PyCFunction)wasteObj_WEIsTabHooks, 1, |
| 1851 | "() -> (Boolean _rv)"}, |
Jack Jansen | a4f0309 | 1998-03-02 16:56:18 +0000 | [diff] [blame] | 1852 | {"WEGetTabSize", (PyCFunction)wasteObj_WEGetTabSize, 1, |
| 1853 | "() -> (SInt16 _rv)"}, |
| 1854 | {"WESetTabSize", (PyCFunction)wasteObj_WESetTabSize, 1, |
| 1855 | "(SInt16 tabWidth) -> None"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1856 | {NULL, NULL, 0} |
| 1857 | }; |
| 1858 | |
| 1859 | PyMethodChain wasteObj_chain = { wasteObj_methods, NULL }; |
| 1860 | |
| 1861 | static PyObject *wasteObj_getattr(self, name) |
| 1862 | wasteObject *self; |
| 1863 | char *name; |
| 1864 | { |
| 1865 | return Py_FindMethodInChain(&wasteObj_chain, (PyObject *)self, name); |
| 1866 | } |
| 1867 | |
| 1868 | #define wasteObj_setattr NULL |
| 1869 | |
Jack Jansen | 9d8b96c | 2000-07-14 22:16:45 +0000 | [diff] [blame] | 1870 | #define wasteObj_compare NULL |
| 1871 | |
| 1872 | #define wasteObj_repr NULL |
| 1873 | |
| 1874 | #define wasteObj_hash NULL |
| 1875 | |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1876 | PyTypeObject waste_Type = { |
| 1877 | PyObject_HEAD_INIT(&PyType_Type) |
| 1878 | 0, /*ob_size*/ |
| 1879 | "waste", /*tp_name*/ |
| 1880 | sizeof(wasteObject), /*tp_basicsize*/ |
| 1881 | 0, /*tp_itemsize*/ |
| 1882 | /* methods */ |
| 1883 | (destructor) wasteObj_dealloc, /*tp_dealloc*/ |
| 1884 | 0, /*tp_print*/ |
| 1885 | (getattrfunc) wasteObj_getattr, /*tp_getattr*/ |
| 1886 | (setattrfunc) wasteObj_setattr, /*tp_setattr*/ |
Jack Jansen | 9d8b96c | 2000-07-14 22:16:45 +0000 | [diff] [blame] | 1887 | (cmpfunc) wasteObj_compare, /*tp_compare*/ |
| 1888 | (reprfunc) wasteObj_repr, /*tp_repr*/ |
| 1889 | (PyNumberMethods *)0, /* tp_as_number */ |
| 1890 | (PySequenceMethods *)0, /* tp_as_sequence */ |
| 1891 | (PyMappingMethods *)0, /* tp_as_mapping */ |
| 1892 | (hashfunc) wasteObj_hash, /*tp_hash*/ |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1893 | }; |
| 1894 | |
| 1895 | /* --------------------- End object type waste ---------------------- */ |
| 1896 | |
| 1897 | |
| 1898 | static PyObject *waste_WENew(_self, _args) |
| 1899 | PyObject *_self; |
| 1900 | PyObject *_args; |
| 1901 | { |
| 1902 | PyObject *_res = NULL; |
| 1903 | OSErr _err; |
| 1904 | LongRect destRect; |
| 1905 | LongRect viewRect; |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 1906 | UInt32 flags; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1907 | WEReference we; |
| 1908 | if (!PyArg_ParseTuple(_args, "O&O&l", |
| 1909 | LongRect_Convert, &destRect, |
| 1910 | LongRect_Convert, &viewRect, |
| 1911 | &flags)) |
| 1912 | return NULL; |
| 1913 | _err = WENew(&destRect, |
| 1914 | &viewRect, |
| 1915 | flags, |
| 1916 | &we); |
| 1917 | if (_err != noErr) return PyMac_Error(_err); |
| 1918 | _res = Py_BuildValue("O&", |
| 1919 | wasteObj_New, we); |
| 1920 | return _res; |
| 1921 | } |
| 1922 | |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 1923 | static PyObject *waste_WEUpdateStyleScrap(_self, _args) |
| 1924 | PyObject *_self; |
| 1925 | PyObject *_args; |
| 1926 | { |
| 1927 | PyObject *_res = NULL; |
| 1928 | OSErr _err; |
| 1929 | StScrpHandle hStyles; |
| 1930 | WEFontTableHandle hFontTable; |
| 1931 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 1932 | ResObj_Convert, &hStyles, |
| 1933 | ResObj_Convert, &hFontTable)) |
| 1934 | return NULL; |
| 1935 | _err = WEUpdateStyleScrap(hStyles, |
| 1936 | hFontTable); |
| 1937 | if (_err != noErr) return PyMac_Error(_err); |
| 1938 | Py_INCREF(Py_None); |
| 1939 | _res = Py_None; |
| 1940 | return _res; |
| 1941 | } |
| 1942 | |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1943 | static PyObject *waste_WEInstallTSMHandlers(_self, _args) |
| 1944 | PyObject *_self; |
| 1945 | PyObject *_args; |
| 1946 | { |
| 1947 | PyObject *_res = NULL; |
| 1948 | OSErr _err; |
| 1949 | if (!PyArg_ParseTuple(_args, "")) |
| 1950 | return NULL; |
| 1951 | _err = WEInstallTSMHandlers(); |
| 1952 | if (_err != noErr) return PyMac_Error(_err); |
| 1953 | Py_INCREF(Py_None); |
| 1954 | _res = Py_None; |
| 1955 | return _res; |
| 1956 | } |
| 1957 | |
| 1958 | static PyObject *waste_WERemoveTSMHandlers(_self, _args) |
| 1959 | PyObject *_self; |
| 1960 | PyObject *_args; |
| 1961 | { |
| 1962 | PyObject *_res = NULL; |
| 1963 | OSErr _err; |
| 1964 | if (!PyArg_ParseTuple(_args, "")) |
| 1965 | return NULL; |
| 1966 | _err = WERemoveTSMHandlers(); |
| 1967 | if (_err != noErr) return PyMac_Error(_err); |
| 1968 | Py_INCREF(Py_None); |
| 1969 | _res = Py_None; |
| 1970 | return _res; |
| 1971 | } |
| 1972 | |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 1973 | static PyObject *waste_WEHandleTSMEvent(_self, _args) |
| 1974 | PyObject *_self; |
| 1975 | PyObject *_args; |
| 1976 | { |
| 1977 | PyObject *_res = NULL; |
| 1978 | OSErr _err; |
| 1979 | AppleEvent ae; |
| 1980 | AppleEvent reply; |
| 1981 | if (!PyArg_ParseTuple(_args, "O&", |
| 1982 | AEDesc_Convert, &ae)) |
| 1983 | return NULL; |
| 1984 | _err = WEHandleTSMEvent(&ae, |
| 1985 | &reply); |
| 1986 | if (_err != noErr) return PyMac_Error(_err); |
| 1987 | _res = Py_BuildValue("O&", |
| 1988 | AEDesc_New, &reply); |
| 1989 | return _res; |
| 1990 | } |
| 1991 | |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 1992 | static PyObject *waste_WELongPointToPoint(_self, _args) |
| 1993 | PyObject *_self; |
| 1994 | PyObject *_args; |
| 1995 | { |
| 1996 | PyObject *_res = NULL; |
| 1997 | LongPt lp; |
| 1998 | Point p; |
| 1999 | if (!PyArg_ParseTuple(_args, "O&", |
| 2000 | LongPt_Convert, &lp)) |
| 2001 | return NULL; |
| 2002 | WELongPointToPoint(&lp, |
| 2003 | &p); |
| 2004 | _res = Py_BuildValue("O&", |
| 2005 | PyMac_BuildPoint, p); |
| 2006 | return _res; |
| 2007 | } |
| 2008 | |
| 2009 | static PyObject *waste_WEPointToLongPoint(_self, _args) |
| 2010 | PyObject *_self; |
| 2011 | PyObject *_args; |
| 2012 | { |
| 2013 | PyObject *_res = NULL; |
| 2014 | Point p; |
| 2015 | LongPt lp; |
| 2016 | if (!PyArg_ParseTuple(_args, "O&", |
| 2017 | PyMac_GetPoint, &p)) |
| 2018 | return NULL; |
| 2019 | WEPointToLongPoint(p, |
| 2020 | &lp); |
| 2021 | _res = Py_BuildValue("O&", |
| 2022 | LongPt_New, &lp); |
| 2023 | return _res; |
| 2024 | } |
| 2025 | |
| 2026 | static PyObject *waste_WESetLongRect(_self, _args) |
| 2027 | PyObject *_self; |
| 2028 | PyObject *_args; |
| 2029 | { |
| 2030 | PyObject *_res = NULL; |
| 2031 | LongRect lr; |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 2032 | SInt32 left; |
| 2033 | SInt32 top; |
| 2034 | SInt32 right; |
| 2035 | SInt32 bottom; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2036 | if (!PyArg_ParseTuple(_args, "llll", |
| 2037 | &left, |
| 2038 | &top, |
| 2039 | &right, |
| 2040 | &bottom)) |
| 2041 | return NULL; |
| 2042 | WESetLongRect(&lr, |
| 2043 | left, |
| 2044 | top, |
| 2045 | right, |
| 2046 | bottom); |
| 2047 | _res = Py_BuildValue("O&", |
| 2048 | LongRect_New, &lr); |
| 2049 | return _res; |
| 2050 | } |
| 2051 | |
| 2052 | static PyObject *waste_WELongRectToRect(_self, _args) |
| 2053 | PyObject *_self; |
| 2054 | PyObject *_args; |
| 2055 | { |
| 2056 | PyObject *_res = NULL; |
| 2057 | LongRect lr; |
| 2058 | Rect r; |
| 2059 | if (!PyArg_ParseTuple(_args, "O&", |
| 2060 | LongRect_Convert, &lr)) |
| 2061 | return NULL; |
| 2062 | WELongRectToRect(&lr, |
| 2063 | &r); |
| 2064 | _res = Py_BuildValue("O&", |
| 2065 | PyMac_BuildRect, &r); |
| 2066 | return _res; |
| 2067 | } |
| 2068 | |
| 2069 | static PyObject *waste_WERectToLongRect(_self, _args) |
| 2070 | PyObject *_self; |
| 2071 | PyObject *_args; |
| 2072 | { |
| 2073 | PyObject *_res = NULL; |
| 2074 | Rect r; |
| 2075 | LongRect lr; |
| 2076 | if (!PyArg_ParseTuple(_args, "O&", |
| 2077 | PyMac_GetRect, &r)) |
| 2078 | return NULL; |
| 2079 | WERectToLongRect(&r, |
| 2080 | &lr); |
| 2081 | _res = Py_BuildValue("O&", |
| 2082 | LongRect_New, &lr); |
| 2083 | return _res; |
| 2084 | } |
| 2085 | |
| 2086 | static PyObject *waste_WEOffsetLongRect(_self, _args) |
| 2087 | PyObject *_self; |
| 2088 | PyObject *_args; |
| 2089 | { |
| 2090 | PyObject *_res = NULL; |
| 2091 | LongRect lr; |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 2092 | SInt32 hOffset; |
| 2093 | SInt32 vOffset; |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2094 | if (!PyArg_ParseTuple(_args, "ll", |
| 2095 | &hOffset, |
| 2096 | &vOffset)) |
| 2097 | return NULL; |
| 2098 | WEOffsetLongRect(&lr, |
| 2099 | hOffset, |
| 2100 | vOffset); |
| 2101 | _res = Py_BuildValue("O&", |
| 2102 | LongRect_New, &lr); |
| 2103 | return _res; |
| 2104 | } |
| 2105 | |
| 2106 | static PyObject *waste_WELongPointInLongRect(_self, _args) |
| 2107 | PyObject *_self; |
| 2108 | PyObject *_args; |
| 2109 | { |
| 2110 | PyObject *_res = NULL; |
| 2111 | Boolean _rv; |
| 2112 | LongPt lp; |
| 2113 | LongRect lr; |
| 2114 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 2115 | LongPt_Convert, &lp, |
| 2116 | LongRect_Convert, &lr)) |
| 2117 | return NULL; |
| 2118 | _rv = WELongPointInLongRect(&lp, |
| 2119 | &lr); |
| 2120 | _res = Py_BuildValue("b", |
| 2121 | _rv); |
| 2122 | return _res; |
| 2123 | } |
| 2124 | |
Jack Jansen | 756522f | 1996-05-07 15:24:01 +0000 | [diff] [blame] | 2125 | static PyObject *waste_STDObjectHandlers(_self, _args) |
| 2126 | PyObject *_self; |
| 2127 | PyObject *_args; |
| 2128 | { |
| 2129 | PyObject *_res = NULL; |
| 2130 | |
| 2131 | OSErr err; |
| 2132 | // install the sample object handlers for pictures and sounds |
| 2133 | #define kTypePicture 'PICT' |
| 2134 | #define kTypeSound 'snd ' |
| 2135 | |
| 2136 | if ( !PyArg_ParseTuple(_args, "") ) return NULL; |
| 2137 | |
| 2138 | if ((err = WEInstallObjectHandler(kTypePicture, weNewHandler, |
| 2139 | (UniversalProcPtr) NewWENewObjectProc(HandleNewPicture), NULL)) != noErr) |
| 2140 | goto cleanup; |
| 2141 | |
| 2142 | if ((err = WEInstallObjectHandler(kTypePicture, weDisposeHandler, |
| 2143 | (UniversalProcPtr) NewWEDisposeObjectProc(HandleDisposePicture), NULL)) != noErr) |
| 2144 | goto cleanup; |
| 2145 | |
| 2146 | if ((err = WEInstallObjectHandler(kTypePicture, weDrawHandler, |
| 2147 | (UniversalProcPtr) NewWEDrawObjectProc(HandleDrawPicture), NULL)) != noErr) |
| 2148 | goto cleanup; |
| 2149 | |
| 2150 | if ((err = WEInstallObjectHandler(kTypeSound, weNewHandler, |
| 2151 | (UniversalProcPtr) NewWENewObjectProc(HandleNewSound), NULL)) != noErr) |
| 2152 | goto cleanup; |
| 2153 | |
| 2154 | if ((err = WEInstallObjectHandler(kTypeSound, weDrawHandler, |
| 2155 | (UniversalProcPtr) NewWEDrawObjectProc(HandleDrawSound), NULL)) != noErr) |
| 2156 | goto cleanup; |
| 2157 | |
| 2158 | if ((err = WEInstallObjectHandler(kTypeSound, weClickHandler, |
| 2159 | (UniversalProcPtr) NewWEClickObjectProc(HandleClickSound), NULL)) != noErr) |
| 2160 | goto cleanup; |
| 2161 | Py_INCREF(Py_None); |
| 2162 | return Py_None; |
| 2163 | |
| 2164 | cleanup: |
| 2165 | return PyMac_Error(err); |
| 2166 | |
| 2167 | } |
| 2168 | |
| 2169 | static PyObject *waste_WEInstallObjectHandler(_self, _args) |
| 2170 | PyObject *_self; |
| 2171 | PyObject *_args; |
| 2172 | { |
| 2173 | PyObject *_res = NULL; |
| 2174 | |
| 2175 | OSErr err; |
| 2176 | FlavorType objectType; |
| 2177 | WESelector selector; |
| 2178 | PyObject *py_handler; |
| 2179 | UniversalProcPtr handler; |
| 2180 | WEReference we = NULL; |
| 2181 | PyObject *key; |
| 2182 | |
| 2183 | |
| 2184 | if ( !PyArg_ParseTuple(_args, "O&O&O|O&", |
| 2185 | PyMac_GetOSType, &objectType, |
| 2186 | PyMac_GetOSType, &selector, |
| 2187 | &py_handler, |
Jack Jansen | 7df3606 | 1996-10-01 11:41:14 +0000 | [diff] [blame] | 2188 | WEOObj_Convert, &we) ) return NULL; |
Jack Jansen | 756522f | 1996-05-07 15:24:01 +0000 | [diff] [blame] | 2189 | |
Jack Jansen | 25241d9 | 1996-05-20 11:30:45 +0000 | [diff] [blame] | 2190 | if ( selector == weNewHandler ) handler = (UniversalProcPtr)upp_new_handler; |
| 2191 | else if ( selector == weDisposeHandler ) handler = (UniversalProcPtr)upp_dispose_handler; |
| 2192 | else if ( selector == weDrawHandler ) handler = (UniversalProcPtr)upp_draw_handler; |
| 2193 | else if ( selector == weClickHandler ) handler = (UniversalProcPtr)upp_click_handler; |
Jack Jansen | 756522f | 1996-05-07 15:24:01 +0000 | [diff] [blame] | 2194 | else return PyMac_Error(weUndefinedSelectorErr); |
| 2195 | |
| 2196 | if ((key = Py_BuildValue("O&O&", |
| 2197 | PyMac_BuildOSType, objectType, |
| 2198 | PyMac_BuildOSType, selector)) == NULL ) |
| 2199 | return NULL; |
| 2200 | |
| 2201 | PyDict_SetItem(callbackdict, key, py_handler); |
| 2202 | |
| 2203 | err = WEInstallObjectHandler(objectType, selector, handler, we); |
| 2204 | if ( err ) return PyMac_Error(err); |
| 2205 | Py_INCREF(Py_None); |
| 2206 | return Py_None; |
| 2207 | |
| 2208 | } |
| 2209 | |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2210 | static PyMethodDef waste_methods[] = { |
| 2211 | {"WENew", (PyCFunction)waste_WENew, 1, |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 2212 | "(LongRect destRect, LongRect viewRect, UInt32 flags) -> (WEReference we)"}, |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 2213 | {"WEUpdateStyleScrap", (PyCFunction)waste_WEUpdateStyleScrap, 1, |
| 2214 | "(StScrpHandle hStyles, WEFontTableHandle hFontTable) -> None"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2215 | {"WEInstallTSMHandlers", (PyCFunction)waste_WEInstallTSMHandlers, 1, |
| 2216 | "() -> None"}, |
| 2217 | {"WERemoveTSMHandlers", (PyCFunction)waste_WERemoveTSMHandlers, 1, |
| 2218 | "() -> None"}, |
Jack Jansen | 2369a98 | 1998-02-20 15:57:30 +0000 | [diff] [blame] | 2219 | {"WEHandleTSMEvent", (PyCFunction)waste_WEHandleTSMEvent, 1, |
| 2220 | "(AppleEvent ae) -> (AppleEvent reply)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2221 | {"WELongPointToPoint", (PyCFunction)waste_WELongPointToPoint, 1, |
| 2222 | "(LongPt lp) -> (Point p)"}, |
| 2223 | {"WEPointToLongPoint", (PyCFunction)waste_WEPointToLongPoint, 1, |
| 2224 | "(Point p) -> (LongPt lp)"}, |
| 2225 | {"WESetLongRect", (PyCFunction)waste_WESetLongRect, 1, |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 2226 | "(SInt32 left, SInt32 top, SInt32 right, SInt32 bottom) -> (LongRect lr)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2227 | {"WELongRectToRect", (PyCFunction)waste_WELongRectToRect, 1, |
| 2228 | "(LongRect lr) -> (Rect r)"}, |
| 2229 | {"WERectToLongRect", (PyCFunction)waste_WERectToLongRect, 1, |
| 2230 | "(Rect r) -> (LongRect lr)"}, |
| 2231 | {"WEOffsetLongRect", (PyCFunction)waste_WEOffsetLongRect, 1, |
Jack Jansen | 2268af5 | 1996-08-06 16:04:22 +0000 | [diff] [blame] | 2232 | "(SInt32 hOffset, SInt32 vOffset) -> (LongRect lr)"}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2233 | {"WELongPointInLongRect", (PyCFunction)waste_WELongPointInLongRect, 1, |
| 2234 | "(LongPt lp, LongRect lr) -> (Boolean _rv)"}, |
Jack Jansen | 756522f | 1996-05-07 15:24:01 +0000 | [diff] [blame] | 2235 | {"STDObjectHandlers", (PyCFunction)waste_STDObjectHandlers, 1, |
| 2236 | NULL}, |
| 2237 | {"WEInstallObjectHandler", (PyCFunction)waste_WEInstallObjectHandler, 1, |
| 2238 | NULL}, |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2239 | {NULL, NULL, 0} |
| 2240 | }; |
| 2241 | |
| 2242 | |
| 2243 | |
Jack Jansen | 756522f | 1996-05-07 15:24:01 +0000 | [diff] [blame] | 2244 | /* Return the object corresponding to the window, or NULL */ |
| 2245 | |
| 2246 | PyObject * |
| 2247 | ExistingwasteObj_New(w) |
| 2248 | WEReference w; |
| 2249 | { |
| 2250 | PyObject *it = NULL; |
| 2251 | |
| 2252 | if (w == NULL) |
| 2253 | it = NULL; |
| 2254 | else |
| 2255 | WEGetInfo(weRefCon, (void *)&it, w); |
| 2256 | if (it == NULL || ((wasteObject *)it)->ob_itself != w) |
| 2257 | it = Py_None; |
| 2258 | Py_INCREF(it); |
| 2259 | return it; |
| 2260 | } |
| 2261 | |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2262 | |
| 2263 | void initwaste() |
| 2264 | { |
| 2265 | PyObject *m; |
| 2266 | PyObject *d; |
| 2267 | |
| 2268 | |
| 2269 | |
| 2270 | |
| 2271 | m = Py_InitModule("waste", waste_methods); |
| 2272 | d = PyModule_GetDict(m); |
| 2273 | waste_Error = PyMac_GetOSErrException(); |
| 2274 | if (waste_Error == NULL || |
| 2275 | PyDict_SetItemString(d, "Error", waste_Error) != 0) |
Jack Jansen | 97ed907 | 2000-09-08 22:06:16 +0000 | [diff] [blame] | 2276 | return; |
Jack Jansen | a755e68 | 1997-09-20 17:40:22 +0000 | [diff] [blame] | 2277 | WEO_Type.ob_type = &PyType_Type; |
| 2278 | Py_INCREF(&WEO_Type); |
| 2279 | if (PyDict_SetItemString(d, "WEOType", (PyObject *)&WEO_Type) != 0) |
| 2280 | Py_FatalError("can't initialize WEOType"); |
| 2281 | waste_Type.ob_type = &PyType_Type; |
| 2282 | Py_INCREF(&waste_Type); |
| 2283 | if (PyDict_SetItemString(d, "wasteType", (PyObject *)&waste_Type) != 0) |
| 2284 | Py_FatalError("can't initialize wasteType"); |
Jack Jansen | 756522f | 1996-05-07 15:24:01 +0000 | [diff] [blame] | 2285 | |
| 2286 | callbackdict = PyDict_New(); |
| 2287 | if (callbackdict == NULL || PyDict_SetItemString(d, "callbacks", callbackdict) != 0) |
Jack Jansen | 97ed907 | 2000-09-08 22:06:16 +0000 | [diff] [blame] | 2288 | return; |
Jack Jansen | 756522f | 1996-05-07 15:24:01 +0000 | [diff] [blame] | 2289 | upp_new_handler = NewWENewObjectProc(my_new_handler); |
Jack Jansen | 25241d9 | 1996-05-20 11:30:45 +0000 | [diff] [blame] | 2290 | upp_dispose_handler = NewWEDisposeObjectProc(my_dispose_handler); |
| 2291 | upp_draw_handler = NewWEDrawObjectProc(my_draw_handler); |
| 2292 | upp_click_handler = NewWEClickObjectProc(my_click_handler); |
Jack Jansen | 756522f | 1996-05-07 15:24:01 +0000 | [diff] [blame] | 2293 | |
| 2294 | |
Jack Jansen | 90ecdf4 | 1996-04-16 14:29:15 +0000 | [diff] [blame] | 2295 | } |
| 2296 | |
| 2297 | /* ======================== End module waste ======================== */ |
| 2298 | |