Mercurial > cpython-lru_cache-weakref
annotate Mac/Modules/te/TEmodule.c @ 5817:48b94de85bf3 legacy-trunk
Extensive changes by AMK.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Thu, 17 Jul 1997 16:29:42 +0000 |
| parents | ff68a2ec1ff1 |
| children | 172c7febd755 |
| rev | line source |
|---|---|
| 3496 | 1 |
| 2 /* =========================== Module TE ============================ */ | |
| 3 | |
| 4 #include "Python.h" | |
| 5 | |
| 6 | |
| 7 | |
| 8 #define SystemSevenOrLater 1 | |
| 9 | |
| 10 #include "macglue.h" | |
| 11 #include <Memory.h> | |
| 12 #include <Dialogs.h> | |
| 13 #include <Menus.h> | |
| 14 #include <Controls.h> | |
| 15 | |
| 16 extern PyObject *ResObj_New(Handle); | |
| 17 extern int ResObj_Convert(PyObject *, Handle *); | |
| 18 extern PyObject *OptResObj_New(Handle); | |
| 19 extern int OptResObj_Convert(PyObject *, Handle *); | |
| 20 | |
| 21 extern PyObject *WinObj_New(WindowPtr); | |
| 22 extern int WinObj_Convert(PyObject *, WindowPtr *); | |
| 23 extern PyTypeObject Window_Type; | |
| 24 #define WinObj_Check(x) ((x)->ob_type == &Window_Type) | |
| 25 | |
| 26 extern PyObject *DlgObj_New(DialogPtr); | |
| 27 extern int DlgObj_Convert(PyObject *, DialogPtr *); | |
| 28 extern PyTypeObject Dialog_Type; | |
| 29 #define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type) | |
| 30 | |
| 31 extern PyObject *MenuObj_New(MenuHandle); | |
| 32 extern int MenuObj_Convert(PyObject *, MenuHandle *); | |
| 33 | |
| 34 extern PyObject *CtlObj_New(ControlHandle); | |
| 35 extern int CtlObj_Convert(PyObject *, ControlHandle *); | |
| 36 | |
| 37 extern PyObject *GrafObj_New(GrafPtr); | |
| 38 extern int GrafObj_Convert(PyObject *, GrafPtr *); | |
| 39 | |
| 40 extern PyObject *BMObj_New(BitMapPtr); | |
| 41 extern int BMObj_Convert(PyObject *, BitMapPtr *); | |
| 42 | |
| 43 extern PyObject *WinObj_WhichWindow(WindowPtr); | |
| 44 | |
| 45 #include <TextEdit.h> | |
| 46 | |
| 47 /* Exported by Qdmodule.c: */ | |
| 48 extern PyObject *QdRGB_New(RGBColor *); | |
| 49 extern int QdRGB_Convert(PyObject *, RGBColor *); | |
| 50 | |
| 51 /* | |
| 52 ** Parse/generate TextStyle records | |
| 53 */ | |
| 54 PyObject *TextStyle_New(itself) | |
| 55 TextStylePtr itself; | |
| 56 { | |
| 57 | |
| 58 return Py_BuildValue("lllO&", (long)itself->tsFont, (long)itself->tsFace, (long)itself->tsSize, QdRGB_New, | |
| 59 &itself->tsColor); | |
| 60 } | |
| 61 | |
| 62 TextStyle_Convert(v, p_itself) | |
| 63 PyObject *v; | |
| 64 TextStylePtr p_itself; | |
| 65 { | |
| 66 long font, face, size; | |
| 67 | |
| 68 if( !PyArg_ParseTuple(v, "lllO&", &font, &face, &size, QdRGB_Convert, &p_itself->tsColor) ) | |
| 69 return 0; | |
| 70 p_itself->tsFont = (short)font; | |
| 71 p_itself->tsFace = (Style)face; | |
| 72 p_itself->tsSize = (short)size; | |
| 73 return 1; | |
| 74 } | |
| 75 | |
| 76 static PyObject *TE_Error; | |
| 77 | |
| 78 /* ------------------------- Object type TE ------------------------- */ | |
| 79 | |
| 80 PyTypeObject TE_Type; | |
| 81 | |
| 82 #define TEObj_Check(x) ((x)->ob_type == &TE_Type) | |
| 83 | |
| 84 typedef struct TEObject { | |
| 85 PyObject_HEAD | |
| 86 TEHandle ob_itself; | |
| 87 } TEObject; | |
| 88 | |
| 89 PyObject *TEObj_New(itself) | |
| 90 TEHandle itself; | |
| 91 { | |
| 92 TEObject *it; | |
| 93 if (itself == NULL) { | |
| 94 PyErr_SetString(TE_Error,"Cannot create null TE"); | |
| 95 return NULL; | |
| 96 } | |
| 97 it = PyObject_NEW(TEObject, &TE_Type); | |
| 98 if (it == NULL) return NULL; | |
| 99 it->ob_itself = itself; | |
| 100 return (PyObject *)it; | |
| 101 } | |
| 102 TEObj_Convert(v, p_itself) | |
| 103 PyObject *v; | |
| 104 TEHandle *p_itself; | |
| 105 { | |
| 106 if (!TEObj_Check(v)) | |
| 107 { | |
| 108 PyErr_SetString(PyExc_TypeError, "TE required"); | |
| 109 return 0; | |
| 110 } | |
| 111 *p_itself = ((TEObject *)v)->ob_itself; | |
| 112 return 1; | |
| 113 } | |
| 114 | |
| 115 static void TEObj_dealloc(self) | |
| 116 TEObject *self; | |
| 117 { | |
| 118 TEDispose(self->ob_itself); | |
| 119 PyMem_DEL(self); | |
| 120 } | |
| 121 | |
| 122 static PyObject *TEObj_TESetText(_self, _args) | |
| 123 TEObject *_self; | |
| 124 PyObject *_args; | |
| 125 { | |
| 126 PyObject *_res = NULL; | |
| 127 char *text__in__; | |
| 128 long text__len__; | |
| 129 int text__in_len__; | |
| 130 if (!PyArg_ParseTuple(_args, "s#", | |
| 131 &text__in__, &text__in_len__)) | |
| 132 return NULL; | |
| 133 text__len__ = text__in_len__; | |
| 134 TESetText(text__in__, text__len__, | |
| 135 _self->ob_itself); | |
| 136 Py_INCREF(Py_None); | |
| 137 _res = Py_None; | |
| 138 text__error__: ; | |
| 139 return _res; | |
| 140 } | |
| 141 | |
| 142 static PyObject *TEObj_TEGetText(_self, _args) | |
| 143 TEObject *_self; | |
| 144 PyObject *_args; | |
| 145 { | |
| 146 PyObject *_res = NULL; | |
| 147 CharsHandle _rv; | |
| 148 if (!PyArg_ParseTuple(_args, "")) | |
| 149 return NULL; | |
| 150 _rv = TEGetText(_self->ob_itself); | |
| 151 _res = Py_BuildValue("O&", | |
| 152 ResObj_New, _rv); | |
| 153 return _res; | |
| 154 } | |
| 155 | |
| 156 static PyObject *TEObj_TEIdle(_self, _args) | |
| 157 TEObject *_self; | |
| 158 PyObject *_args; | |
| 159 { | |
| 160 PyObject *_res = NULL; | |
| 161 if (!PyArg_ParseTuple(_args, "")) | |
| 162 return NULL; | |
| 163 TEIdle(_self->ob_itself); | |
| 164 Py_INCREF(Py_None); | |
| 165 _res = Py_None; | |
| 166 return _res; | |
| 167 } | |
| 168 | |
| 169 static PyObject *TEObj_TESetSelect(_self, _args) | |
| 170 TEObject *_self; | |
| 171 PyObject *_args; | |
| 172 { | |
| 173 PyObject *_res = NULL; | |
| 174 long selStart; | |
| 175 long selEnd; | |
| 176 if (!PyArg_ParseTuple(_args, "ll", | |
| 177 &selStart, | |
| 178 &selEnd)) | |
| 179 return NULL; | |
| 180 TESetSelect(selStart, | |
| 181 selEnd, | |
| 182 _self->ob_itself); | |
| 183 Py_INCREF(Py_None); | |
| 184 _res = Py_None; | |
| 185 return _res; | |
| 186 } | |
| 187 | |
| 188 static PyObject *TEObj_TEActivate(_self, _args) | |
| 189 TEObject *_self; | |
| 190 PyObject *_args; | |
| 191 { | |
| 192 PyObject *_res = NULL; | |
| 193 if (!PyArg_ParseTuple(_args, "")) | |
| 194 return NULL; | |
| 195 TEActivate(_self->ob_itself); | |
| 196 Py_INCREF(Py_None); | |
| 197 _res = Py_None; | |
| 198 return _res; | |
| 199 } | |
| 200 | |
| 201 static PyObject *TEObj_TEDeactivate(_self, _args) | |
| 202 TEObject *_self; | |
| 203 PyObject *_args; | |
| 204 { | |
| 205 PyObject *_res = NULL; | |
| 206 if (!PyArg_ParseTuple(_args, "")) | |
| 207 return NULL; | |
| 208 TEDeactivate(_self->ob_itself); | |
| 209 Py_INCREF(Py_None); | |
| 210 _res = Py_None; | |
| 211 return _res; | |
| 212 } | |
| 213 | |
| 214 static PyObject *TEObj_TEKey(_self, _args) | |
| 215 TEObject *_self; | |
| 216 PyObject *_args; | |
| 217 { | |
| 218 PyObject *_res = NULL; | |
| 219 short key; | |
| 220 if (!PyArg_ParseTuple(_args, "h", | |
| 221 &key)) | |
| 222 return NULL; | |
| 223 TEKey(key, | |
| 224 _self->ob_itself); | |
| 225 Py_INCREF(Py_None); | |
| 226 _res = Py_None; | |
| 227 return _res; | |
| 228 } | |
| 229 | |
| 230 static PyObject *TEObj_TECut(_self, _args) | |
| 231 TEObject *_self; | |
| 232 PyObject *_args; | |
| 233 { | |
| 234 PyObject *_res = NULL; | |
| 235 if (!PyArg_ParseTuple(_args, "")) | |
| 236 return NULL; | |
| 237 TECut(_self->ob_itself); | |
| 238 Py_INCREF(Py_None); | |
| 239 _res = Py_None; | |
| 240 return _res; | |
| 241 } | |
| 242 | |
| 243 static PyObject *TEObj_TECopy(_self, _args) | |
| 244 TEObject *_self; | |
| 245 PyObject *_args; | |
| 246 { | |
| 247 PyObject *_res = NULL; | |
| 248 if (!PyArg_ParseTuple(_args, "")) | |
| 249 return NULL; | |
| 250 TECopy(_self->ob_itself); | |
| 251 Py_INCREF(Py_None); | |
| 252 _res = Py_None; | |
| 253 return _res; | |
| 254 } | |
| 255 | |
| 256 static PyObject *TEObj_TEPaste(_self, _args) | |
| 257 TEObject *_self; | |
| 258 PyObject *_args; | |
| 259 { | |
| 260 PyObject *_res = NULL; | |
| 261 if (!PyArg_ParseTuple(_args, "")) | |
| 262 return NULL; | |
| 263 TEPaste(_self->ob_itself); | |
| 264 Py_INCREF(Py_None); | |
| 265 _res = Py_None; | |
| 266 return _res; | |
| 267 } | |
| 268 | |
| 269 static PyObject *TEObj_TEDelete(_self, _args) | |
| 270 TEObject *_self; | |
| 271 PyObject *_args; | |
| 272 { | |
| 273 PyObject *_res = NULL; | |
| 274 if (!PyArg_ParseTuple(_args, "")) | |
| 275 return NULL; | |
| 276 TEDelete(_self->ob_itself); | |
| 277 Py_INCREF(Py_None); | |
| 278 _res = Py_None; | |
| 279 return _res; | |
| 280 } | |
| 281 | |
| 282 static PyObject *TEObj_TEInsert(_self, _args) | |
| 283 TEObject *_self; | |
| 284 PyObject *_args; | |
| 285 { | |
| 286 PyObject *_res = NULL; | |
| 287 char *text__in__; | |
| 288 long text__len__; | |
| 289 int text__in_len__; | |
| 290 if (!PyArg_ParseTuple(_args, "s#", | |
| 291 &text__in__, &text__in_len__)) | |
| 292 return NULL; | |
| 293 text__len__ = text__in_len__; | |
| 294 TEInsert(text__in__, text__len__, | |
| 295 _self->ob_itself); | |
| 296 Py_INCREF(Py_None); | |
| 297 _res = Py_None; | |
| 298 text__error__: ; | |
| 299 return _res; | |
| 300 } | |
| 301 | |
| 302 static PyObject *TEObj_TESetAlignment(_self, _args) | |
| 303 TEObject *_self; | |
| 304 PyObject *_args; | |
| 305 { | |
| 306 PyObject *_res = NULL; | |
| 307 short just; | |
| 308 if (!PyArg_ParseTuple(_args, "h", | |
| 309 &just)) | |
| 310 return NULL; | |
| 311 TESetAlignment(just, | |
| 312 _self->ob_itself); | |
| 313 Py_INCREF(Py_None); | |
| 314 _res = Py_None; | |
| 315 return _res; | |
| 316 } | |
| 317 | |
| 318 static PyObject *TEObj_TEUpdate(_self, _args) | |
| 319 TEObject *_self; | |
| 320 PyObject *_args; | |
| 321 { | |
| 322 PyObject *_res = NULL; | |
| 323 Rect rUpdate; | |
| 324 if (!PyArg_ParseTuple(_args, "O&", | |
| 325 PyMac_GetRect, &rUpdate)) | |
| 326 return NULL; | |
| 327 TEUpdate(&rUpdate, | |
| 328 _self->ob_itself); | |
| 329 Py_INCREF(Py_None); | |
| 330 _res = Py_None; | |
| 331 return _res; | |
| 332 } | |
| 333 | |
| 334 static PyObject *TEObj_TEScroll(_self, _args) | |
| 335 TEObject *_self; | |
| 336 PyObject *_args; | |
| 337 { | |
| 338 PyObject *_res = NULL; | |
| 339 short dh; | |
| 340 short dv; | |
| 341 if (!PyArg_ParseTuple(_args, "hh", | |
| 342 &dh, | |
| 343 &dv)) | |
| 344 return NULL; | |
| 345 TEScroll(dh, | |
| 346 dv, | |
| 347 _self->ob_itself); | |
| 348 Py_INCREF(Py_None); | |
| 349 _res = Py_None; | |
| 350 return _res; | |
| 351 } | |
| 352 | |
| 353 static PyObject *TEObj_TESelView(_self, _args) | |
| 354 TEObject *_self; | |
| 355 PyObject *_args; | |
| 356 { | |
| 357 PyObject *_res = NULL; | |
| 358 if (!PyArg_ParseTuple(_args, "")) | |
| 359 return NULL; | |
| 360 TESelView(_self->ob_itself); | |
| 361 Py_INCREF(Py_None); | |
| 362 _res = Py_None; | |
| 363 return _res; | |
| 364 } | |
| 365 | |
| 366 static PyObject *TEObj_TEPinScroll(_self, _args) | |
| 367 TEObject *_self; | |
| 368 PyObject *_args; | |
| 369 { | |
| 370 PyObject *_res = NULL; | |
| 371 short dh; | |
| 372 short dv; | |
| 373 if (!PyArg_ParseTuple(_args, "hh", | |
| 374 &dh, | |
| 375 &dv)) | |
| 376 return NULL; | |
| 377 TEPinScroll(dh, | |
| 378 dv, | |
| 379 _self->ob_itself); | |
| 380 Py_INCREF(Py_None); | |
| 381 _res = Py_None; | |
| 382 return _res; | |
| 383 } | |
| 384 | |
| 385 static PyObject *TEObj_TEAutoView(_self, _args) | |
| 386 TEObject *_self; | |
| 387 PyObject *_args; | |
| 388 { | |
| 389 PyObject *_res = NULL; | |
| 390 Boolean fAuto; | |
| 391 if (!PyArg_ParseTuple(_args, "b", | |
| 392 &fAuto)) | |
| 393 return NULL; | |
| 394 TEAutoView(fAuto, | |
| 395 _self->ob_itself); | |
| 396 Py_INCREF(Py_None); | |
| 397 _res = Py_None; | |
| 398 return _res; | |
| 399 } | |
| 400 | |
| 401 static PyObject *TEObj_TECalText(_self, _args) | |
| 402 TEObject *_self; | |
| 403 PyObject *_args; | |
| 404 { | |
| 405 PyObject *_res = NULL; | |
| 406 if (!PyArg_ParseTuple(_args, "")) | |
| 407 return NULL; | |
| 408 TECalText(_self->ob_itself); | |
| 409 Py_INCREF(Py_None); | |
| 410 _res = Py_None; | |
| 411 return _res; | |
| 412 } | |
| 413 | |
| 414 static PyObject *TEObj_TEGetOffset(_self, _args) | |
| 415 TEObject *_self; | |
| 416 PyObject *_args; | |
| 417 { | |
| 418 PyObject *_res = NULL; | |
| 419 short _rv; | |
| 420 Point pt; | |
| 421 if (!PyArg_ParseTuple(_args, "O&", | |
| 422 PyMac_GetPoint, &pt)) | |
| 423 return NULL; | |
| 424 _rv = TEGetOffset(pt, | |
| 425 _self->ob_itself); | |
| 426 _res = Py_BuildValue("h", | |
| 427 _rv); | |
| 428 return _res; | |
| 429 } | |
| 430 | |
| 431 static PyObject *TEObj_TEGetPoint(_self, _args) | |
| 432 TEObject *_self; | |
| 433 PyObject *_args; | |
| 434 { | |
| 435 PyObject *_res = NULL; | |
| 436 Point _rv; | |
| 437 short offset; | |
| 438 if (!PyArg_ParseTuple(_args, "h", | |
| 439 &offset)) | |
| 440 return NULL; | |
| 441 _rv = TEGetPoint(offset, | |
| 442 _self->ob_itself); | |
| 443 _res = Py_BuildValue("O&", | |
| 444 PyMac_BuildPoint, _rv); | |
| 445 return _res; | |
| 446 } | |
| 447 | |
| 448 static PyObject *TEObj_TEClick(_self, _args) | |
| 449 TEObject *_self; | |
| 450 PyObject *_args; | |
| 451 { | |
| 452 PyObject *_res = NULL; | |
| 453 Point pt; | |
| 454 Boolean fExtend; | |
| 455 if (!PyArg_ParseTuple(_args, "O&b", | |
| 456 PyMac_GetPoint, &pt, | |
| 457 &fExtend)) | |
| 458 return NULL; | |
| 459 TEClick(pt, | |
| 460 fExtend, | |
| 461 _self->ob_itself); | |
| 462 Py_INCREF(Py_None); | |
| 463 _res = Py_None; | |
| 464 return _res; | |
| 465 } | |
| 466 | |
| 467 static PyObject *TEObj_TESetStyleHandle(_self, _args) | |
| 468 TEObject *_self; | |
| 469 PyObject *_args; | |
| 470 { | |
| 471 PyObject *_res = NULL; | |
| 472 TEStyleHandle theHandle; | |
| 473 if (!PyArg_ParseTuple(_args, "O&", | |
| 474 ResObj_Convert, &theHandle)) | |
| 475 return NULL; | |
| 476 TESetStyleHandle(theHandle, | |
| 477 _self->ob_itself); | |
| 478 Py_INCREF(Py_None); | |
| 479 _res = Py_None; | |
| 480 return _res; | |
| 481 } | |
| 482 | |
| 483 static PyObject *TEObj_TEGetStyleHandle(_self, _args) | |
| 484 TEObject *_self; | |
| 485 PyObject *_args; | |
| 486 { | |
| 487 PyObject *_res = NULL; | |
| 488 TEStyleHandle _rv; | |
| 489 if (!PyArg_ParseTuple(_args, "")) | |
| 490 return NULL; | |
| 491 _rv = TEGetStyleHandle(_self->ob_itself); | |
| 492 _res = Py_BuildValue("O&", | |
| 493 ResObj_New, _rv); | |
| 494 return _res; | |
| 495 } | |
| 496 | |
| 497 static PyObject *TEObj_TEGetStyle(_self, _args) | |
| 498 TEObject *_self; | |
| 499 PyObject *_args; | |
| 500 { | |
| 501 PyObject *_res = NULL; | |
| 502 short offset; | |
| 503 TextStyle theStyle; | |
| 504 short lineHeight; | |
| 505 short fontAscent; | |
| 506 if (!PyArg_ParseTuple(_args, "h", | |
| 507 &offset)) | |
| 508 return NULL; | |
| 509 TEGetStyle(offset, | |
| 510 &theStyle, | |
| 511 &lineHeight, | |
| 512 &fontAscent, | |
| 513 _self->ob_itself); | |
| 514 _res = Py_BuildValue("O&hh", | |
| 515 TextStyle_New, &theStyle, | |
| 516 lineHeight, | |
| 517 fontAscent); | |
| 518 return _res; | |
| 519 } | |
| 520 | |
| 521 static PyObject *TEObj_TEStylePaste(_self, _args) | |
| 522 TEObject *_self; | |
| 523 PyObject *_args; | |
| 524 { | |
| 525 PyObject *_res = NULL; | |
| 526 if (!PyArg_ParseTuple(_args, "")) | |
| 527 return NULL; | |
| 528 TEStylePaste(_self->ob_itself); | |
| 529 Py_INCREF(Py_None); | |
| 530 _res = Py_None; | |
| 531 return _res; | |
| 532 } | |
| 533 | |
| 534 static PyObject *TEObj_TESetStyle(_self, _args) | |
| 535 TEObject *_self; | |
| 536 PyObject *_args; | |
| 537 { | |
| 538 PyObject *_res = NULL; | |
| 539 short mode; | |
| 540 TextStyle newStyle; | |
| 541 Boolean fRedraw; | |
| 542 if (!PyArg_ParseTuple(_args, "hO&b", | |
| 543 &mode, | |
| 544 TextStyle_Convert, &newStyle, | |
| 545 &fRedraw)) | |
| 546 return NULL; | |
| 547 TESetStyle(mode, | |
| 548 &newStyle, | |
| 549 fRedraw, | |
| 550 _self->ob_itself); | |
| 551 Py_INCREF(Py_None); | |
| 552 _res = Py_None; | |
| 553 return _res; | |
| 554 } | |
| 555 | |
| 556 static PyObject *TEObj_TEReplaceStyle(_self, _args) | |
| 557 TEObject *_self; | |
| 558 PyObject *_args; | |
| 559 { | |
| 560 PyObject *_res = NULL; | |
| 561 short mode; | |
| 562 TextStyle oldStyle; | |
| 563 TextStyle newStyle; | |
| 564 Boolean fRedraw; | |
| 565 if (!PyArg_ParseTuple(_args, "hO&O&b", | |
| 566 &mode, | |
| 567 TextStyle_Convert, &oldStyle, | |
| 568 TextStyle_Convert, &newStyle, | |
| 569 &fRedraw)) | |
| 570 return NULL; | |
| 571 TEReplaceStyle(mode, | |
| 572 &oldStyle, | |
| 573 &newStyle, | |
| 574 fRedraw, | |
| 575 _self->ob_itself); | |
| 576 Py_INCREF(Py_None); | |
| 577 _res = Py_None; | |
| 578 return _res; | |
| 579 } | |
| 580 | |
| 581 static PyObject *TEObj_TEGetStyleScrapHandle(_self, _args) | |
| 582 TEObject *_self; | |
| 583 PyObject *_args; | |
| 584 { | |
| 585 PyObject *_res = NULL; | |
| 586 StScrpHandle _rv; | |
| 587 if (!PyArg_ParseTuple(_args, "")) | |
| 588 return NULL; | |
| 589 _rv = TEGetStyleScrapHandle(_self->ob_itself); | |
| 590 _res = Py_BuildValue("O&", | |
| 591 ResObj_New, _rv); | |
| 592 return _res; | |
| 593 } | |
| 594 | |
| 595 static PyObject *TEObj_TEStyleInsert(_self, _args) | |
| 596 TEObject *_self; | |
| 597 PyObject *_args; | |
| 598 { | |
| 599 PyObject *_res = NULL; | |
| 600 char *text__in__; | |
| 601 long text__len__; | |
| 602 int text__in_len__; | |
| 603 StScrpHandle hST; | |
| 604 if (!PyArg_ParseTuple(_args, "s#O&", | |
| 605 &text__in__, &text__in_len__, | |
| 606 ResObj_Convert, &hST)) | |
| 607 return NULL; | |
| 608 text__len__ = text__in_len__; | |
| 609 TEStyleInsert(text__in__, text__len__, | |
| 610 hST, | |
| 611 _self->ob_itself); | |
| 612 Py_INCREF(Py_None); | |
| 613 _res = Py_None; | |
| 614 text__error__: ; | |
| 615 return _res; | |
| 616 } | |
| 617 | |
| 618 static PyObject *TEObj_TEGetHeight(_self, _args) | |
| 619 TEObject *_self; | |
| 620 PyObject *_args; | |
| 621 { | |
| 622 PyObject *_res = NULL; | |
| 623 long _rv; | |
| 624 long endLine; | |
| 625 long startLine; | |
| 626 if (!PyArg_ParseTuple(_args, "ll", | |
| 627 &endLine, | |
| 628 &startLine)) | |
| 629 return NULL; | |
| 630 _rv = TEGetHeight(endLine, | |
| 631 startLine, | |
| 632 _self->ob_itself); | |
| 633 _res = Py_BuildValue("l", | |
| 634 _rv); | |
| 635 return _res; | |
| 636 } | |
| 637 | |
| 638 static PyObject *TEObj_TEContinuousStyle(_self, _args) | |
| 639 TEObject *_self; | |
| 640 PyObject *_args; | |
| 641 { | |
| 642 PyObject *_res = NULL; | |
| 643 Boolean _rv; | |
| 644 short mode; | |
| 645 TextStyle aStyle; | |
| 646 if (!PyArg_ParseTuple(_args, "hO&", | |
| 647 &mode, | |
| 648 TextStyle_Convert, &aStyle)) | |
| 649 return NULL; | |
| 650 _rv = TEContinuousStyle(&mode, | |
| 651 &aStyle, | |
| 652 _self->ob_itself); | |
| 653 _res = Py_BuildValue("bhO&", | |
| 654 _rv, | |
| 655 mode, | |
| 656 TextStyle_New, &aStyle); | |
| 657 return _res; | |
| 658 } | |
| 659 | |
| 660 static PyObject *TEObj_TEUseStyleScrap(_self, _args) | |
| 661 TEObject *_self; | |
| 662 PyObject *_args; | |
| 663 { | |
| 664 PyObject *_res = NULL; | |
| 665 long rangeStart; | |
| 666 long rangeEnd; | |
| 667 StScrpHandle newStyles; | |
| 668 Boolean fRedraw; | |
| 669 if (!PyArg_ParseTuple(_args, "llO&b", | |
| 670 &rangeStart, | |
| 671 &rangeEnd, | |
| 672 ResObj_Convert, &newStyles, | |
| 673 &fRedraw)) | |
| 674 return NULL; | |
| 675 TEUseStyleScrap(rangeStart, | |
| 676 rangeEnd, | |
| 677 newStyles, | |
| 678 fRedraw, | |
| 679 _self->ob_itself); | |
| 680 Py_INCREF(Py_None); | |
| 681 _res = Py_None; | |
| 682 return _res; | |
| 683 } | |
| 684 | |
| 685 static PyObject *TEObj_TENumStyles(_self, _args) | |
| 686 TEObject *_self; | |
| 687 PyObject *_args; | |
| 688 { | |
| 689 PyObject *_res = NULL; | |
| 690 long _rv; | |
| 691 long rangeStart; | |
| 692 long rangeEnd; | |
| 693 if (!PyArg_ParseTuple(_args, "ll", | |
| 694 &rangeStart, | |
| 695 &rangeEnd)) | |
| 696 return NULL; | |
| 697 _rv = TENumStyles(rangeStart, | |
| 698 rangeEnd, | |
| 699 _self->ob_itself); | |
| 700 _res = Py_BuildValue("l", | |
| 701 _rv); | |
| 702 return _res; | |
| 703 } | |
| 704 | |
| 705 static PyObject *TEObj_TEFeatureFlag(_self, _args) | |
| 706 TEObject *_self; | |
| 707 PyObject *_args; | |
| 708 { | |
| 709 PyObject *_res = NULL; | |
| 710 short _rv; | |
| 711 short feature; | |
| 712 short action; | |
| 713 if (!PyArg_ParseTuple(_args, "hh", | |
| 714 &feature, | |
| 715 &action)) | |
| 716 return NULL; | |
| 717 _rv = TEFeatureFlag(feature, | |
| 718 action, | |
| 719 _self->ob_itself); | |
| 720 _res = Py_BuildValue("h", | |
| 721 _rv); | |
| 722 return _res; | |
| 723 } | |
| 724 | |
| 725 static PyMethodDef TEObj_methods[] = { | |
| 726 {"TESetText", (PyCFunction)TEObj_TESetText, 1, | |
| 727 "(Buffer text) -> None"}, | |
| 728 {"TEGetText", (PyCFunction)TEObj_TEGetText, 1, | |
| 729 "() -> (CharsHandle _rv)"}, | |
| 730 {"TEIdle", (PyCFunction)TEObj_TEIdle, 1, | |
| 731 "() -> None"}, | |
| 732 {"TESetSelect", (PyCFunction)TEObj_TESetSelect, 1, | |
| 733 "(long selStart, long selEnd) -> None"}, | |
| 734 {"TEActivate", (PyCFunction)TEObj_TEActivate, 1, | |
| 735 "() -> None"}, | |
| 736 {"TEDeactivate", (PyCFunction)TEObj_TEDeactivate, 1, | |
| 737 "() -> None"}, | |
| 738 {"TEKey", (PyCFunction)TEObj_TEKey, 1, | |
| 739 "(short key) -> None"}, | |
| 740 {"TECut", (PyCFunction)TEObj_TECut, 1, | |
| 741 "() -> None"}, | |
| 742 {"TECopy", (PyCFunction)TEObj_TECopy, 1, | |
| 743 "() -> None"}, | |
| 744 {"TEPaste", (PyCFunction)TEObj_TEPaste, 1, | |
| 745 "() -> None"}, | |
| 746 {"TEDelete", (PyCFunction)TEObj_TEDelete, 1, | |
| 747 "() -> None"}, | |
| 748 {"TEInsert", (PyCFunction)TEObj_TEInsert, 1, | |
| 749 "(Buffer text) -> None"}, | |
| 750 {"TESetAlignment", (PyCFunction)TEObj_TESetAlignment, 1, | |
| 751 "(short just) -> None"}, | |
| 752 {"TEUpdate", (PyCFunction)TEObj_TEUpdate, 1, | |
| 753 "(Rect rUpdate) -> None"}, | |
| 754 {"TEScroll", (PyCFunction)TEObj_TEScroll, 1, | |
| 755 "(short dh, short dv) -> None"}, | |
| 756 {"TESelView", (PyCFunction)TEObj_TESelView, 1, | |
| 757 "() -> None"}, | |
| 758 {"TEPinScroll", (PyCFunction)TEObj_TEPinScroll, 1, | |
| 759 "(short dh, short dv) -> None"}, | |
| 760 {"TEAutoView", (PyCFunction)TEObj_TEAutoView, 1, | |
| 761 "(Boolean fAuto) -> None"}, | |
| 762 {"TECalText", (PyCFunction)TEObj_TECalText, 1, | |
| 763 "() -> None"}, | |
| 764 {"TEGetOffset", (PyCFunction)TEObj_TEGetOffset, 1, | |
| 765 "(Point pt) -> (short _rv)"}, | |
| 766 {"TEGetPoint", (PyCFunction)TEObj_TEGetPoint, 1, | |
| 767 "(short offset) -> (Point _rv)"}, | |
| 768 {"TEClick", (PyCFunction)TEObj_TEClick, 1, | |
| 769 "(Point pt, Boolean fExtend) -> None"}, | |
| 770 {"TESetStyleHandle", (PyCFunction)TEObj_TESetStyleHandle, 1, | |
| 771 "(TEStyleHandle theHandle) -> None"}, | |
| 772 {"TEGetStyleHandle", (PyCFunction)TEObj_TEGetStyleHandle, 1, | |
| 773 "() -> (TEStyleHandle _rv)"}, | |
| 774 {"TEGetStyle", (PyCFunction)TEObj_TEGetStyle, 1, | |
| 775 "(short offset) -> (TextStyle theStyle, short lineHeight, short fontAscent)"}, | |
| 776 {"TEStylePaste", (PyCFunction)TEObj_TEStylePaste, 1, | |
| 777 "() -> None"}, | |
| 778 {"TESetStyle", (PyCFunction)TEObj_TESetStyle, 1, | |
| 779 "(short mode, TextStyle newStyle, Boolean fRedraw) -> None"}, | |
| 780 {"TEReplaceStyle", (PyCFunction)TEObj_TEReplaceStyle, 1, | |
| 781 "(short mode, TextStyle oldStyle, TextStyle newStyle, Boolean fRedraw) -> None"}, | |
| 782 {"TEGetStyleScrapHandle", (PyCFunction)TEObj_TEGetStyleScrapHandle, 1, | |
| 783 "() -> (StScrpHandle _rv)"}, | |
| 784 {"TEStyleInsert", (PyCFunction)TEObj_TEStyleInsert, 1, | |
| 785 "(Buffer text, StScrpHandle hST) -> None"}, | |
| 786 {"TEGetHeight", (PyCFunction)TEObj_TEGetHeight, 1, | |
| 787 "(long endLine, long startLine) -> (long _rv)"}, | |
| 788 {"TEContinuousStyle", (PyCFunction)TEObj_TEContinuousStyle, 1, | |
| 789 "(short mode, TextStyle aStyle) -> (Boolean _rv, short mode, TextStyle aStyle)"}, | |
| 790 {"TEUseStyleScrap", (PyCFunction)TEObj_TEUseStyleScrap, 1, | |
| 791 "(long rangeStart, long rangeEnd, StScrpHandle newStyles, Boolean fRedraw) -> None"}, | |
| 792 {"TENumStyles", (PyCFunction)TEObj_TENumStyles, 1, | |
| 793 "(long rangeStart, long rangeEnd) -> (long _rv)"}, | |
| 794 {"TEFeatureFlag", (PyCFunction)TEObj_TEFeatureFlag, 1, | |
| 795 "(short feature, short action) -> (short _rv)"}, | |
| 796 {NULL, NULL, 0} | |
| 797 }; | |
| 798 | |
| 799 PyMethodChain TEObj_chain = { TEObj_methods, NULL }; | |
| 800 | |
| 801 static PyObject *TEObj_getattr(self, name) | |
| 802 TEObject *self; | |
| 803 char *name; | |
| 804 { | |
|
3518
7f230d4f3655
bgen-generators now drop the python definition file straight in the
Jack Jansen <jack.jansen@cwi.nl>
parents:
3496
diff
changeset
|
805 |
|
7f230d4f3655
bgen-generators now drop the python definition file straight in the
Jack Jansen <jack.jansen@cwi.nl>
parents:
3496
diff
changeset
|
806 if( strcmp(name, "destRect") == 0 ) |
|
7f230d4f3655
bgen-generators now drop the python definition file straight in the
Jack Jansen <jack.jansen@cwi.nl>
parents:
3496
diff
changeset
|
807 return Py_BuildValue("O&", PyMac_BuildRect, |
|
3524
43af523a00ca
Added support for accessing a few more TERec members
Jack Jansen <jack.jansen@cwi.nl>
parents:
3518
diff
changeset
|
808 &(*self->ob_itself)->destRect); |
|
3518
7f230d4f3655
bgen-generators now drop the python definition file straight in the
Jack Jansen <jack.jansen@cwi.nl>
parents:
3496
diff
changeset
|
809 if( strcmp(name, "viewRect") == 0 ) |
|
7f230d4f3655
bgen-generators now drop the python definition file straight in the
Jack Jansen <jack.jansen@cwi.nl>
parents:
3496
diff
changeset
|
810 return Py_BuildValue("O&", PyMac_BuildRect, |
|
3524
43af523a00ca
Added support for accessing a few more TERec members
Jack Jansen <jack.jansen@cwi.nl>
parents:
3518
diff
changeset
|
811 &(*self->ob_itself)->viewRect); |
|
3518
7f230d4f3655
bgen-generators now drop the python definition file straight in the
Jack Jansen <jack.jansen@cwi.nl>
parents:
3496
diff
changeset
|
812 if( strcmp(name, "selRect") == 0 ) |
|
7f230d4f3655
bgen-generators now drop the python definition file straight in the
Jack Jansen <jack.jansen@cwi.nl>
parents:
3496
diff
changeset
|
813 return Py_BuildValue("O&", PyMac_BuildRect, |
|
3524
43af523a00ca
Added support for accessing a few more TERec members
Jack Jansen <jack.jansen@cwi.nl>
parents:
3518
diff
changeset
|
814 &(*self->ob_itself)->selRect); |
|
3518
7f230d4f3655
bgen-generators now drop the python definition file straight in the
Jack Jansen <jack.jansen@cwi.nl>
parents:
3496
diff
changeset
|
815 if( strcmp(name, "lineHeight") == 0 ) |
|
7f230d4f3655
bgen-generators now drop the python definition file straight in the
Jack Jansen <jack.jansen@cwi.nl>
parents:
3496
diff
changeset
|
816 return Py_BuildValue("h", (*self->ob_itself)->lineHeight); |
|
7f230d4f3655
bgen-generators now drop the python definition file straight in the
Jack Jansen <jack.jansen@cwi.nl>
parents:
3496
diff
changeset
|
817 if( strcmp(name, "fontAscent") == 0 ) |
|
7f230d4f3655
bgen-generators now drop the python definition file straight in the
Jack Jansen <jack.jansen@cwi.nl>
parents:
3496
diff
changeset
|
818 return Py_BuildValue("h", (*self->ob_itself)->fontAscent); |
|
7f230d4f3655
bgen-generators now drop the python definition file straight in the
Jack Jansen <jack.jansen@cwi.nl>
parents:
3496
diff
changeset
|
819 if( strcmp(name, "selPoint") == 0 ) |
|
7f230d4f3655
bgen-generators now drop the python definition file straight in the
Jack Jansen <jack.jansen@cwi.nl>
parents:
3496
diff
changeset
|
820 return Py_BuildValue("O&", PyMac_BuildPoint, |
|
3524
43af523a00ca
Added support for accessing a few more TERec members
Jack Jansen <jack.jansen@cwi.nl>
parents:
3518
diff
changeset
|
821 &(*self->ob_itself)->selPoint); |
|
3518
7f230d4f3655
bgen-generators now drop the python definition file straight in the
Jack Jansen <jack.jansen@cwi.nl>
parents:
3496
diff
changeset
|
822 if( strcmp(name, "selStart") == 0 ) |
|
7f230d4f3655
bgen-generators now drop the python definition file straight in the
Jack Jansen <jack.jansen@cwi.nl>
parents:
3496
diff
changeset
|
823 return Py_BuildValue("h", (*self->ob_itself)->selStart); |
|
7f230d4f3655
bgen-generators now drop the python definition file straight in the
Jack Jansen <jack.jansen@cwi.nl>
parents:
3496
diff
changeset
|
824 if( strcmp(name, "selEnd") == 0 ) |
|
7f230d4f3655
bgen-generators now drop the python definition file straight in the
Jack Jansen <jack.jansen@cwi.nl>
parents:
3496
diff
changeset
|
825 return Py_BuildValue("h", (*self->ob_itself)->selEnd); |
|
7f230d4f3655
bgen-generators now drop the python definition file straight in the
Jack Jansen <jack.jansen@cwi.nl>
parents:
3496
diff
changeset
|
826 if( strcmp(name, "active") == 0 ) |
|
7f230d4f3655
bgen-generators now drop the python definition file straight in the
Jack Jansen <jack.jansen@cwi.nl>
parents:
3496
diff
changeset
|
827 return Py_BuildValue("h", (*self->ob_itself)->active); |
|
3524
43af523a00ca
Added support for accessing a few more TERec members
Jack Jansen <jack.jansen@cwi.nl>
parents:
3518
diff
changeset
|
828 if( strcmp(name, "just") == 0 ) |
|
43af523a00ca
Added support for accessing a few more TERec members
Jack Jansen <jack.jansen@cwi.nl>
parents:
3518
diff
changeset
|
829 return Py_BuildValue("h", (*self->ob_itself)->just); |
|
3518
7f230d4f3655
bgen-generators now drop the python definition file straight in the
Jack Jansen <jack.jansen@cwi.nl>
parents:
3496
diff
changeset
|
830 if( strcmp(name, "teLength") == 0 ) |
|
7f230d4f3655
bgen-generators now drop the python definition file straight in the
Jack Jansen <jack.jansen@cwi.nl>
parents:
3496
diff
changeset
|
831 return Py_BuildValue("h", (*self->ob_itself)->teLength); |
|
3524
43af523a00ca
Added support for accessing a few more TERec members
Jack Jansen <jack.jansen@cwi.nl>
parents:
3518
diff
changeset
|
832 if( strcmp(name, "txFont") == 0 ) |
|
43af523a00ca
Added support for accessing a few more TERec members
Jack Jansen <jack.jansen@cwi.nl>
parents:
3518
diff
changeset
|
833 return Py_BuildValue("h", (*self->ob_itself)->txFont); |
|
43af523a00ca
Added support for accessing a few more TERec members
Jack Jansen <jack.jansen@cwi.nl>
parents:
3518
diff
changeset
|
834 if( strcmp(name, "txFace") == 0 ) |
|
43af523a00ca
Added support for accessing a few more TERec members
Jack Jansen <jack.jansen@cwi.nl>
parents:
3518
diff
changeset
|
835 return Py_BuildValue("h", (*self->ob_itself)->txFace); |
|
43af523a00ca
Added support for accessing a few more TERec members
Jack Jansen <jack.jansen@cwi.nl>
parents:
3518
diff
changeset
|
836 if( strcmp(name, "txMode") == 0 ) |
|
43af523a00ca
Added support for accessing a few more TERec members
Jack Jansen <jack.jansen@cwi.nl>
parents:
3518
diff
changeset
|
837 return Py_BuildValue("h", (*self->ob_itself)->txMode); |
|
43af523a00ca
Added support for accessing a few more TERec members
Jack Jansen <jack.jansen@cwi.nl>
parents:
3518
diff
changeset
|
838 if( strcmp(name, "txSize") == 0 ) |
|
43af523a00ca
Added support for accessing a few more TERec members
Jack Jansen <jack.jansen@cwi.nl>
parents:
3518
diff
changeset
|
839 return Py_BuildValue("h", (*self->ob_itself)->txSize); |
|
43af523a00ca
Added support for accessing a few more TERec members
Jack Jansen <jack.jansen@cwi.nl>
parents:
3518
diff
changeset
|
840 if( strcmp(name, "nLines") == 0 ) |
|
43af523a00ca
Added support for accessing a few more TERec members
Jack Jansen <jack.jansen@cwi.nl>
parents:
3518
diff
changeset
|
841 return Py_BuildValue("h", (*self->ob_itself)->nLines); |
|
3518
7f230d4f3655
bgen-generators now drop the python definition file straight in the
Jack Jansen <jack.jansen@cwi.nl>
parents:
3496
diff
changeset
|
842 |
| 3496 | 843 return Py_FindMethodInChain(&TEObj_chain, (PyObject *)self, name); |
| 844 } | |
| 845 | |
| 846 #define TEObj_setattr NULL | |
| 847 | |
| 848 PyTypeObject TE_Type = { | |
| 849 PyObject_HEAD_INIT(&PyType_Type) | |
| 850 0, /*ob_size*/ | |
| 851 "TE", /*tp_name*/ | |
| 852 sizeof(TEObject), /*tp_basicsize*/ | |
| 853 0, /*tp_itemsize*/ | |
| 854 /* methods */ | |
| 855 (destructor) TEObj_dealloc, /*tp_dealloc*/ | |
| 856 0, /*tp_print*/ | |
| 857 (getattrfunc) TEObj_getattr, /*tp_getattr*/ | |
| 858 (setattrfunc) TEObj_setattr, /*tp_setattr*/ | |
| 859 }; | |
| 860 | |
| 861 /* ----------------------- End object type TE ----------------------- */ | |
| 862 | |
| 863 | |
| 864 static PyObject *TE_TEScrapHandle(_self, _args) | |
| 865 PyObject *_self; | |
| 866 PyObject *_args; | |
| 867 { | |
| 868 PyObject *_res = NULL; | |
| 869 Handle _rv; | |
| 870 if (!PyArg_ParseTuple(_args, "")) | |
| 871 return NULL; | |
| 872 _rv = TEScrapHandle(); | |
| 873 _res = Py_BuildValue("O&", | |
| 874 ResObj_New, _rv); | |
| 875 return _res; | |
| 876 } | |
| 877 | |
| 878 static PyObject *TE_TEGetScrapLength(_self, _args) | |
| 879 PyObject *_self; | |
| 880 PyObject *_args; | |
| 881 { | |
| 882 PyObject *_res = NULL; | |
| 883 long _rv; | |
| 884 if (!PyArg_ParseTuple(_args, "")) | |
| 885 return NULL; | |
| 886 _rv = TEGetScrapLength(); | |
| 887 _res = Py_BuildValue("l", | |
| 888 _rv); | |
| 889 return _res; | |
| 890 } | |
| 891 | |
| 892 static PyObject *TE_TENew(_self, _args) | |
| 893 PyObject *_self; | |
| 894 PyObject *_args; | |
| 895 { | |
| 896 PyObject *_res = NULL; | |
| 897 TEHandle _rv; | |
| 898 Rect destRect; | |
| 899 Rect viewRect; | |
| 900 if (!PyArg_ParseTuple(_args, "O&O&", | |
| 901 PyMac_GetRect, &destRect, | |
| 902 PyMac_GetRect, &viewRect)) | |
| 903 return NULL; | |
| 904 _rv = TENew(&destRect, | |
| 905 &viewRect); | |
| 906 _res = Py_BuildValue("O&", | |
| 907 TEObj_New, _rv); | |
| 908 return _res; | |
| 909 } | |
| 910 | |
| 911 static PyObject *TE_TETextBox(_self, _args) | |
| 912 PyObject *_self; | |
| 913 PyObject *_args; | |
| 914 { | |
| 915 PyObject *_res = NULL; | |
| 916 char *text__in__; | |
| 917 long text__len__; | |
| 918 int text__in_len__; | |
| 919 Rect box; | |
| 920 short just; | |
| 921 if (!PyArg_ParseTuple(_args, "s#O&h", | |
| 922 &text__in__, &text__in_len__, | |
| 923 PyMac_GetRect, &box, | |
| 924 &just)) | |
| 925 return NULL; | |
| 926 text__len__ = text__in_len__; | |
| 927 TETextBox(text__in__, text__len__, | |
| 928 &box, | |
| 929 just); | |
| 930 Py_INCREF(Py_None); | |
| 931 _res = Py_None; | |
| 932 text__error__: ; | |
| 933 return _res; | |
| 934 } | |
| 935 | |
| 936 static PyObject *TE_TEStyleNew(_self, _args) | |
| 937 PyObject *_self; | |
| 938 PyObject *_args; | |
| 939 { | |
| 940 PyObject *_res = NULL; | |
| 941 TEHandle _rv; | |
| 942 Rect destRect; | |
| 943 Rect viewRect; | |
| 944 if (!PyArg_ParseTuple(_args, "O&O&", | |
| 945 PyMac_GetRect, &destRect, | |
| 946 PyMac_GetRect, &viewRect)) | |
| 947 return NULL; | |
| 948 _rv = TEStyleNew(&destRect, | |
| 949 &viewRect); | |
| 950 _res = Py_BuildValue("O&", | |
| 951 TEObj_New, _rv); | |
| 952 return _res; | |
| 953 } | |
| 954 | |
| 955 static PyObject *TE_TESetScrapLength(_self, _args) | |
| 956 PyObject *_self; | |
| 957 PyObject *_args; | |
| 958 { | |
| 959 PyObject *_res = NULL; | |
| 960 long length; | |
| 961 if (!PyArg_ParseTuple(_args, "l", | |
| 962 &length)) | |
| 963 return NULL; | |
| 964 TESetScrapLength(length); | |
| 965 Py_INCREF(Py_None); | |
| 966 _res = Py_None; | |
| 967 return _res; | |
| 968 } | |
| 969 | |
| 970 static PyObject *TE_TEFromScrap(_self, _args) | |
| 971 PyObject *_self; | |
| 972 PyObject *_args; | |
| 973 { | |
| 974 PyObject *_res = NULL; | |
| 975 OSErr _err; | |
| 976 if (!PyArg_ParseTuple(_args, "")) | |
| 977 return NULL; | |
| 978 _err = TEFromScrap(); | |
| 979 if (_err != noErr) return PyMac_Error(_err); | |
| 980 Py_INCREF(Py_None); | |
| 981 _res = Py_None; | |
| 982 return _res; | |
| 983 } | |
| 984 | |
| 985 static PyObject *TE_TEToScrap(_self, _args) | |
| 986 PyObject *_self; | |
| 987 PyObject *_args; | |
| 988 { | |
| 989 PyObject *_res = NULL; | |
| 990 OSErr _err; | |
| 991 if (!PyArg_ParseTuple(_args, "")) | |
| 992 return NULL; | |
| 993 _err = TEToScrap(); | |
| 994 if (_err != noErr) return PyMac_Error(_err); | |
| 995 Py_INCREF(Py_None); | |
| 996 _res = Py_None; | |
| 997 return _res; | |
| 998 } | |
| 999 | |
| 1000 static PyMethodDef TE_methods[] = { | |
| 1001 {"TEScrapHandle", (PyCFunction)TE_TEScrapHandle, 1, | |
| 1002 "() -> (Handle _rv)"}, | |
| 1003 {"TEGetScrapLength", (PyCFunction)TE_TEGetScrapLength, 1, | |
| 1004 "() -> (long _rv)"}, | |
| 1005 {"TENew", (PyCFunction)TE_TENew, 1, | |
| 1006 "(Rect destRect, Rect viewRect) -> (TEHandle _rv)"}, | |
| 1007 {"TETextBox", (PyCFunction)TE_TETextBox, 1, | |
| 1008 "(Buffer text, Rect box, short just) -> None"}, | |
| 1009 {"TEStyleNew", (PyCFunction)TE_TEStyleNew, 1, | |
| 1010 "(Rect destRect, Rect viewRect) -> (TEHandle _rv)"}, | |
| 1011 {"TESetScrapLength", (PyCFunction)TE_TESetScrapLength, 1, | |
| 1012 "(long length) -> None"}, | |
| 1013 {"TEFromScrap", (PyCFunction)TE_TEFromScrap, 1, | |
| 1014 "() -> None"}, | |
| 1015 {"TEToScrap", (PyCFunction)TE_TEToScrap, 1, | |
| 1016 "() -> None"}, | |
| 1017 {NULL, NULL, 0} | |
| 1018 }; | |
| 1019 | |
| 1020 | |
| 1021 | |
| 1022 | |
| 1023 void initTE() | |
| 1024 { | |
| 1025 PyObject *m; | |
| 1026 PyObject *d; | |
| 1027 | |
| 1028 | |
| 1029 | |
| 1030 | |
| 1031 m = Py_InitModule("TE", TE_methods); | |
| 1032 d = PyModule_GetDict(m); | |
| 1033 TE_Error = PyMac_GetOSErrException(); | |
| 1034 if (TE_Error == NULL || | |
| 1035 PyDict_SetItemString(d, "Error", TE_Error) != 0) | |
| 1036 Py_FatalError("can't initialize TE.Error"); | |
| 1037 } | |
| 1038 | |
| 1039 /* ========================= End module TE ========================== */ | |
| 1040 |
