Changeset 391 for python/trunk/Mac/Modules/te
- Timestamp:
- Mar 19, 2014, 11:31:01 PM (11 years ago)
- Location:
- python/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
python/trunk
-
Property svn:mergeinfo
set to
/python/vendor/Python-2.7.6 merged eligible /python/vendor/current merged eligible
-
Property svn:mergeinfo
set to
-
python/trunk/Mac/Modules/te/_TEmodule.c
r2 r391 11 11 /* Macro to test whether a weak-loaded CFM function exists */ 12 12 #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ 13 14 15 13 PyErr_SetString(PyExc_NotImplementedError, \ 14 "Not available in this shared library/OS version"); \ 15 return NULL; \ 16 16 }} while(0) 17 17 … … 37 37 { 38 38 39 40 39 return Py_BuildValue("lllO&", (long)itself->tsFont, (long)itself->tsFace, (long)itself->tsSize, QdRGB_New, 40 &itself->tsColor); 41 41 } 42 42 … … 44 44 TextStyle_Convert(PyObject *v, TextStylePtr p_itself) 45 45 { 46 47 48 49 50 51 52 53 46 long font, face, size; 47 48 if( !PyArg_ParseTuple(v, "lllO&", &font, &face, &size, QdRGB_Convert, &p_itself->tsColor) ) 49 return 0; 50 p_itself->tsFont = (short)font; 51 p_itself->tsFace = (Style)face; 52 p_itself->tsSize = (short)size; 53 return 1; 54 54 } 55 55 … … 63 63 64 64 typedef struct TEObject { 65 66 65 PyObject_HEAD 66 TEHandle ob_itself; 67 67 } TEObject; 68 68 69 69 PyObject *TEObj_New(TEHandle itself) 70 70 { 71 72 73 74 75 76 77 78 79 71 TEObject *it; 72 if (itself == NULL) { 73 PyErr_SetString(TE_Error,"Cannot create null TE"); 74 return NULL; 75 } 76 it = PyObject_NEW(TEObject, &TE_Type); 77 if (it == NULL) return NULL; 78 it->ob_itself = itself; 79 return (PyObject *)it; 80 80 } 81 81 82 82 int TEObj_Convert(PyObject *v, TEHandle *p_itself) 83 83 { 84 85 86 87 88 89 90 84 if (!TEObj_Check(v)) 85 { 86 PyErr_SetString(PyExc_TypeError, "TE required"); 87 return 0; 88 } 89 *p_itself = ((TEObject *)v)->ob_itself; 90 return 1; 91 91 } 92 92 93 93 static void TEObj_dealloc(TEObject *self) 94 94 { 95 96 95 TEDispose(self->ob_itself); 96 self->ob_type->tp_free((PyObject *)self); 97 97 } 98 98 99 99 static PyObject *TEObj_TESetText(TEObject *_self, PyObject *_args) 100 100 { 101 102 103 104 101 PyObject *_res = NULL; 102 char *text__in__; 103 long text__len__; 104 int text__in_len__; 105 105 #ifndef TESetText 106 107 #endif 108 109 110 111 112 113 114 115 116 106 PyMac_PRECHECK(TESetText); 107 #endif 108 if (!PyArg_ParseTuple(_args, "s#", 109 &text__in__, &text__in_len__)) 110 return NULL; 111 text__len__ = text__in_len__; 112 TESetText(text__in__, text__len__, 113 _self->ob_itself); 114 Py_INCREF(Py_None); 115 _res = Py_None; 116 return _res; 117 117 } 118 118 119 119 static PyObject *TEObj_TEGetText(TEObject *_self, PyObject *_args) 120 120 { 121 122 121 PyObject *_res = NULL; 122 CharsHandle _rv; 123 123 #ifndef TEGetText 124 125 #endif 126 127 128 129 130 131 124 PyMac_PRECHECK(TEGetText); 125 #endif 126 if (!PyArg_ParseTuple(_args, "")) 127 return NULL; 128 _rv = TEGetText(_self->ob_itself); 129 _res = Py_BuildValue("O&", 130 ResObj_New, _rv); 131 return _res; 132 132 } 133 133 134 134 static PyObject *TEObj_TEIdle(TEObject *_self, PyObject *_args) 135 135 { 136 136 PyObject *_res = NULL; 137 137 #ifndef TEIdle 138 139 #endif 140 141 142 143 144 145 138 PyMac_PRECHECK(TEIdle); 139 #endif 140 if (!PyArg_ParseTuple(_args, "")) 141 return NULL; 142 TEIdle(_self->ob_itself); 143 Py_INCREF(Py_None); 144 _res = Py_None; 145 return _res; 146 146 } 147 147 148 148 static PyObject *TEObj_TESetSelect(TEObject *_self, PyObject *_args) 149 149 { 150 151 152 150 PyObject *_res = NULL; 151 long selStart; 152 long selEnd; 153 153 #ifndef TESetSelect 154 155 #endif 156 157 158 159 160 161 162 163 164 165 154 PyMac_PRECHECK(TESetSelect); 155 #endif 156 if (!PyArg_ParseTuple(_args, "ll", 157 &selStart, 158 &selEnd)) 159 return NULL; 160 TESetSelect(selStart, 161 selEnd, 162 _self->ob_itself); 163 Py_INCREF(Py_None); 164 _res = Py_None; 165 return _res; 166 166 } 167 167 168 168 static PyObject *TEObj_TEActivate(TEObject *_self, PyObject *_args) 169 169 { 170 170 PyObject *_res = NULL; 171 171 #ifndef TEActivate 172 173 #endif 174 175 176 177 178 179 172 PyMac_PRECHECK(TEActivate); 173 #endif 174 if (!PyArg_ParseTuple(_args, "")) 175 return NULL; 176 TEActivate(_self->ob_itself); 177 Py_INCREF(Py_None); 178 _res = Py_None; 179 return _res; 180 180 } 181 181 182 182 static PyObject *TEObj_TEDeactivate(TEObject *_self, PyObject *_args) 183 183 { 184 184 PyObject *_res = NULL; 185 185 #ifndef TEDeactivate 186 187 #endif 188 189 190 191 192 193 186 PyMac_PRECHECK(TEDeactivate); 187 #endif 188 if (!PyArg_ParseTuple(_args, "")) 189 return NULL; 190 TEDeactivate(_self->ob_itself); 191 Py_INCREF(Py_None); 192 _res = Py_None; 193 return _res; 194 194 } 195 195 196 196 static PyObject *TEObj_TEKey(TEObject *_self, PyObject *_args) 197 197 { 198 199 198 PyObject *_res = NULL; 199 CharParameter key; 200 200 #ifndef TEKey 201 202 #endif 203 204 205 206 207 208 209 210 201 PyMac_PRECHECK(TEKey); 202 #endif 203 if (!PyArg_ParseTuple(_args, "h", 204 &key)) 205 return NULL; 206 TEKey(key, 207 _self->ob_itself); 208 Py_INCREF(Py_None); 209 _res = Py_None; 210 return _res; 211 211 } 212 212 213 213 static PyObject *TEObj_TECut(TEObject *_self, PyObject *_args) 214 214 { 215 215 PyObject *_res = NULL; 216 216 #ifndef TECut 217 218 #endif 219 220 221 222 223 224 217 PyMac_PRECHECK(TECut); 218 #endif 219 if (!PyArg_ParseTuple(_args, "")) 220 return NULL; 221 TECut(_self->ob_itself); 222 Py_INCREF(Py_None); 223 _res = Py_None; 224 return _res; 225 225 } 226 226 227 227 static PyObject *TEObj_TECopy(TEObject *_self, PyObject *_args) 228 228 { 229 229 PyObject *_res = NULL; 230 230 #ifndef TECopy 231 232 #endif 233 234 235 236 237 238 231 PyMac_PRECHECK(TECopy); 232 #endif 233 if (!PyArg_ParseTuple(_args, "")) 234 return NULL; 235 TECopy(_self->ob_itself); 236 Py_INCREF(Py_None); 237 _res = Py_None; 238 return _res; 239 239 } 240 240 241 241 static PyObject *TEObj_TEPaste(TEObject *_self, PyObject *_args) 242 242 { 243 243 PyObject *_res = NULL; 244 244 #ifndef TEPaste 245 246 #endif 247 248 249 250 251 252 245 PyMac_PRECHECK(TEPaste); 246 #endif 247 if (!PyArg_ParseTuple(_args, "")) 248 return NULL; 249 TEPaste(_self->ob_itself); 250 Py_INCREF(Py_None); 251 _res = Py_None; 252 return _res; 253 253 } 254 254 255 255 static PyObject *TEObj_TEDelete(TEObject *_self, PyObject *_args) 256 256 { 257 257 PyObject *_res = NULL; 258 258 #ifndef TEDelete 259 260 #endif 261 262 263 264 265 266 259 PyMac_PRECHECK(TEDelete); 260 #endif 261 if (!PyArg_ParseTuple(_args, "")) 262 return NULL; 263 TEDelete(_self->ob_itself); 264 Py_INCREF(Py_None); 265 _res = Py_None; 266 return _res; 267 267 } 268 268 269 269 static PyObject *TEObj_TEInsert(TEObject *_self, PyObject *_args) 270 270 { 271 272 273 274 271 PyObject *_res = NULL; 272 char *text__in__; 273 long text__len__; 274 int text__in_len__; 275 275 #ifndef TEInsert 276 277 #endif 278 279 280 281 282 283 284 285 286 276 PyMac_PRECHECK(TEInsert); 277 #endif 278 if (!PyArg_ParseTuple(_args, "s#", 279 &text__in__, &text__in_len__)) 280 return NULL; 281 text__len__ = text__in_len__; 282 TEInsert(text__in__, text__len__, 283 _self->ob_itself); 284 Py_INCREF(Py_None); 285 _res = Py_None; 286 return _res; 287 287 } 288 288 289 289 static PyObject *TEObj_TESetAlignment(TEObject *_self, PyObject *_args) 290 290 { 291 292 291 PyObject *_res = NULL; 292 short just; 293 293 #ifndef TESetAlignment 294 295 #endif 296 297 298 299 300 301 302 303 294 PyMac_PRECHECK(TESetAlignment); 295 #endif 296 if (!PyArg_ParseTuple(_args, "h", 297 &just)) 298 return NULL; 299 TESetAlignment(just, 300 _self->ob_itself); 301 Py_INCREF(Py_None); 302 _res = Py_None; 303 return _res; 304 304 } 305 305 306 306 static PyObject *TEObj_TEUpdate(TEObject *_self, PyObject *_args) 307 307 { 308 309 308 PyObject *_res = NULL; 309 Rect rUpdate; 310 310 #ifndef TEUpdate 311 312 #endif 313 314 315 316 317 318 319 320 311 PyMac_PRECHECK(TEUpdate); 312 #endif 313 if (!PyArg_ParseTuple(_args, "O&", 314 PyMac_GetRect, &rUpdate)) 315 return NULL; 316 TEUpdate(&rUpdate, 317 _self->ob_itself); 318 Py_INCREF(Py_None); 319 _res = Py_None; 320 return _res; 321 321 } 322 322 323 323 static PyObject *TEObj_TEScroll(TEObject *_self, PyObject *_args) 324 324 { 325 326 327 325 PyObject *_res = NULL; 326 short dh; 327 short dv; 328 328 #ifndef TEScroll 329 330 #endif 331 332 333 334 335 336 337 338 339 340 329 PyMac_PRECHECK(TEScroll); 330 #endif 331 if (!PyArg_ParseTuple(_args, "hh", 332 &dh, 333 &dv)) 334 return NULL; 335 TEScroll(dh, 336 dv, 337 _self->ob_itself); 338 Py_INCREF(Py_None); 339 _res = Py_None; 340 return _res; 341 341 } 342 342 343 343 static PyObject *TEObj_TESelView(TEObject *_self, PyObject *_args) 344 344 { 345 345 PyObject *_res = NULL; 346 346 #ifndef TESelView 347 348 #endif 349 350 351 352 353 354 347 PyMac_PRECHECK(TESelView); 348 #endif 349 if (!PyArg_ParseTuple(_args, "")) 350 return NULL; 351 TESelView(_self->ob_itself); 352 Py_INCREF(Py_None); 353 _res = Py_None; 354 return _res; 355 355 } 356 356 357 357 static PyObject *TEObj_TEPinScroll(TEObject *_self, PyObject *_args) 358 358 { 359 360 361 359 PyObject *_res = NULL; 360 short dh; 361 short dv; 362 362 #ifndef TEPinScroll 363 364 #endif 365 366 367 368 369 370 371 372 373 374 363 PyMac_PRECHECK(TEPinScroll); 364 #endif 365 if (!PyArg_ParseTuple(_args, "hh", 366 &dh, 367 &dv)) 368 return NULL; 369 TEPinScroll(dh, 370 dv, 371 _self->ob_itself); 372 Py_INCREF(Py_None); 373 _res = Py_None; 374 return _res; 375 375 } 376 376 377 377 static PyObject *TEObj_TEAutoView(TEObject *_self, PyObject *_args) 378 378 { 379 380 379 PyObject *_res = NULL; 380 Boolean fAuto; 381 381 #ifndef TEAutoView 382 383 #endif 384 385 386 387 388 389 390 391 382 PyMac_PRECHECK(TEAutoView); 383 #endif 384 if (!PyArg_ParseTuple(_args, "b", 385 &fAuto)) 386 return NULL; 387 TEAutoView(fAuto, 388 _self->ob_itself); 389 Py_INCREF(Py_None); 390 _res = Py_None; 391 return _res; 392 392 } 393 393 394 394 static PyObject *TEObj_TECalText(TEObject *_self, PyObject *_args) 395 395 { 396 396 PyObject *_res = NULL; 397 397 #ifndef TECalText 398 399 #endif 400 401 402 403 404 405 398 PyMac_PRECHECK(TECalText); 399 #endif 400 if (!PyArg_ParseTuple(_args, "")) 401 return NULL; 402 TECalText(_self->ob_itself); 403 Py_INCREF(Py_None); 404 _res = Py_None; 405 return _res; 406 406 } 407 407 408 408 static PyObject *TEObj_TEGetOffset(TEObject *_self, PyObject *_args) 409 409 { 410 411 412 410 PyObject *_res = NULL; 411 short _rv; 412 Point pt; 413 413 #ifndef TEGetOffset 414 415 #endif 416 417 418 419 420 421 422 423 414 PyMac_PRECHECK(TEGetOffset); 415 #endif 416 if (!PyArg_ParseTuple(_args, "O&", 417 PyMac_GetPoint, &pt)) 418 return NULL; 419 _rv = TEGetOffset(pt, 420 _self->ob_itself); 421 _res = Py_BuildValue("h", 422 _rv); 423 return _res; 424 424 } 425 425 426 426 static PyObject *TEObj_TEGetPoint(TEObject *_self, PyObject *_args) 427 427 { 428 429 430 428 PyObject *_res = NULL; 429 Point _rv; 430 short offset; 431 431 #ifndef TEGetPoint 432 433 #endif 434 435 436 437 438 439 440 441 432 PyMac_PRECHECK(TEGetPoint); 433 #endif 434 if (!PyArg_ParseTuple(_args, "h", 435 &offset)) 436 return NULL; 437 _rv = TEGetPoint(offset, 438 _self->ob_itself); 439 _res = Py_BuildValue("O&", 440 PyMac_BuildPoint, _rv); 441 return _res; 442 442 } 443 443 444 444 static PyObject *TEObj_TEClick(TEObject *_self, PyObject *_args) 445 445 { 446 447 448 446 PyObject *_res = NULL; 447 Point pt; 448 Boolean fExtend; 449 449 #ifndef TEClick 450 451 #endif 452 453 454 455 456 457 458 459 460 461 450 PyMac_PRECHECK(TEClick); 451 #endif 452 if (!PyArg_ParseTuple(_args, "O&b", 453 PyMac_GetPoint, &pt, 454 &fExtend)) 455 return NULL; 456 TEClick(pt, 457 fExtend, 458 _self->ob_itself); 459 Py_INCREF(Py_None); 460 _res = Py_None; 461 return _res; 462 462 } 463 463 464 464 static PyObject *TEObj_TESetStyleHandle(TEObject *_self, PyObject *_args) 465 465 { 466 467 466 PyObject *_res = NULL; 467 TEStyleHandle theHandle; 468 468 #ifndef TESetStyleHandle 469 470 #endif 471 472 473 474 475 476 477 478 469 PyMac_PRECHECK(TESetStyleHandle); 470 #endif 471 if (!PyArg_ParseTuple(_args, "O&", 472 ResObj_Convert, &theHandle)) 473 return NULL; 474 TESetStyleHandle(theHandle, 475 _self->ob_itself); 476 Py_INCREF(Py_None); 477 _res = Py_None; 478 return _res; 479 479 } 480 480 481 481 static PyObject *TEObj_TEGetStyleHandle(TEObject *_self, PyObject *_args) 482 482 { 483 484 483 PyObject *_res = NULL; 484 TEStyleHandle _rv; 485 485 #ifndef TEGetStyleHandle 486 487 #endif 488 489 490 491 492 493 486 PyMac_PRECHECK(TEGetStyleHandle); 487 #endif 488 if (!PyArg_ParseTuple(_args, "")) 489 return NULL; 490 _rv = TEGetStyleHandle(_self->ob_itself); 491 _res = Py_BuildValue("O&", 492 ResObj_New, _rv); 493 return _res; 494 494 } 495 495 496 496 static PyObject *TEObj_TEGetStyle(TEObject *_self, PyObject *_args) 497 497 { 498 499 500 501 502 498 PyObject *_res = NULL; 499 short offset; 500 TextStyle theStyle; 501 short lineHeight; 502 short fontAscent; 503 503 #ifndef TEGetStyle 504 505 #endif 506 507 508 509 510 511 512 513 514 515 516 517 518 504 PyMac_PRECHECK(TEGetStyle); 505 #endif 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 519 } 520 520 521 521 static PyObject *TEObj_TEStylePaste(TEObject *_self, PyObject *_args) 522 522 { 523 523 PyObject *_res = NULL; 524 524 #ifndef TEStylePaste 525 526 #endif 527 528 529 530 531 532 525 PyMac_PRECHECK(TEStylePaste); 526 #endif 527 if (!PyArg_ParseTuple(_args, "")) 528 return NULL; 529 TEStylePaste(_self->ob_itself); 530 Py_INCREF(Py_None); 531 _res = Py_None; 532 return _res; 533 533 } 534 534 535 535 static PyObject *TEObj_TESetStyle(TEObject *_self, PyObject *_args) 536 536 { 537 538 539 540 537 PyObject *_res = NULL; 538 short mode; 539 TextStyle newStyle; 540 Boolean fRedraw; 541 541 #ifndef TESetStyle 542 543 #endif 544 545 546 547 548 549 550 551 552 553 554 555 542 PyMac_PRECHECK(TESetStyle); 543 #endif 544 if (!PyArg_ParseTuple(_args, "hO&b", 545 &mode, 546 TextStyle_Convert, &newStyle, 547 &fRedraw)) 548 return NULL; 549 TESetStyle(mode, 550 &newStyle, 551 fRedraw, 552 _self->ob_itself); 553 Py_INCREF(Py_None); 554 _res = Py_None; 555 return _res; 556 556 } 557 557 558 558 static PyObject *TEObj_TEReplaceStyle(TEObject *_self, PyObject *_args) 559 559 { 560 561 562 563 564 560 PyObject *_res = NULL; 561 short mode; 562 TextStyle oldStyle; 563 TextStyle newStyle; 564 Boolean fRedraw; 565 565 #ifndef TEReplaceStyle 566 567 #endif 568 569 570 571 572 573 574 575 576 577 578 579 580 581 566 PyMac_PRECHECK(TEReplaceStyle); 567 #endif 568 if (!PyArg_ParseTuple(_args, "hO&O&b", 569 &mode, 570 TextStyle_Convert, &oldStyle, 571 TextStyle_Convert, &newStyle, 572 &fRedraw)) 573 return NULL; 574 TEReplaceStyle(mode, 575 &oldStyle, 576 &newStyle, 577 fRedraw, 578 _self->ob_itself); 579 Py_INCREF(Py_None); 580 _res = Py_None; 581 return _res; 582 582 } 583 583 584 584 static PyObject *TEObj_TEGetStyleScrapHandle(TEObject *_self, PyObject *_args) 585 585 { 586 587 586 PyObject *_res = NULL; 587 StScrpHandle _rv; 588 588 #ifndef TEGetStyleScrapHandle 589 590 #endif 591 592 593 594 595 596 589 PyMac_PRECHECK(TEGetStyleScrapHandle); 590 #endif 591 if (!PyArg_ParseTuple(_args, "")) 592 return NULL; 593 _rv = TEGetStyleScrapHandle(_self->ob_itself); 594 _res = Py_BuildValue("O&", 595 ResObj_New, _rv); 596 return _res; 597 597 } 598 598 599 599 static PyObject *TEObj_TEStyleInsert(TEObject *_self, PyObject *_args) 600 600 { 601 602 603 604 605 601 PyObject *_res = NULL; 602 char *text__in__; 603 long text__len__; 604 int text__in_len__; 605 StScrpHandle hST; 606 606 #ifndef TEStyleInsert 607 608 #endif 609 610 611 612 613 614 615 616 617 618 619 607 PyMac_PRECHECK(TEStyleInsert); 608 #endif 609 if (!PyArg_ParseTuple(_args, "s#O&", 610 &text__in__, &text__in_len__, 611 ResObj_Convert, &hST)) 612 return NULL; 613 text__len__ = text__in_len__; 614 TEStyleInsert(text__in__, text__len__, 615 hST, 616 _self->ob_itself); 617 Py_INCREF(Py_None); 618 _res = Py_None; 619 return _res; 620 620 } 621 621 622 622 static PyObject *TEObj_TEGetHeight(TEObject *_self, PyObject *_args) 623 623 { 624 625 626 627 624 PyObject *_res = NULL; 625 long _rv; 626 long endLine; 627 long startLine; 628 628 #ifndef TEGetHeight 629 630 #endif 631 632 633 634 635 636 637 638 639 640 629 PyMac_PRECHECK(TEGetHeight); 630 #endif 631 if (!PyArg_ParseTuple(_args, "ll", 632 &endLine, 633 &startLine)) 634 return NULL; 635 _rv = TEGetHeight(endLine, 636 startLine, 637 _self->ob_itself); 638 _res = Py_BuildValue("l", 639 _rv); 640 return _res; 641 641 } 642 642 643 643 static PyObject *TEObj_TEContinuousStyle(TEObject *_self, PyObject *_args) 644 644 { 645 646 647 648 645 PyObject *_res = NULL; 646 Boolean _rv; 647 short mode; 648 TextStyle aStyle; 649 649 #ifndef TEContinuousStyle 650 651 #endif 652 653 654 655 656 657 658 659 660 661 662 663 650 PyMac_PRECHECK(TEContinuousStyle); 651 #endif 652 if (!PyArg_ParseTuple(_args, "hO&", 653 &mode, 654 TextStyle_Convert, &aStyle)) 655 return NULL; 656 _rv = TEContinuousStyle(&mode, 657 &aStyle, 658 _self->ob_itself); 659 _res = Py_BuildValue("bhO&", 660 _rv, 661 mode, 662 TextStyle_New, &aStyle); 663 return _res; 664 664 } 665 665 666 666 static PyObject *TEObj_TEUseStyleScrap(TEObject *_self, PyObject *_args) 667 667 { 668 669 670 671 672 668 PyObject *_res = NULL; 669 long rangeStart; 670 long rangeEnd; 671 StScrpHandle newStyles; 672 Boolean fRedraw; 673 673 #ifndef TEUseStyleScrap 674 675 #endif 676 677 678 679 680 681 682 683 684 685 686 687 688 689 674 PyMac_PRECHECK(TEUseStyleScrap); 675 #endif 676 if (!PyArg_ParseTuple(_args, "llO&b", 677 &rangeStart, 678 &rangeEnd, 679 ResObj_Convert, &newStyles, 680 &fRedraw)) 681 return NULL; 682 TEUseStyleScrap(rangeStart, 683 rangeEnd, 684 newStyles, 685 fRedraw, 686 _self->ob_itself); 687 Py_INCREF(Py_None); 688 _res = Py_None; 689 return _res; 690 690 } 691 691 692 692 static PyObject *TEObj_TENumStyles(TEObject *_self, PyObject *_args) 693 693 { 694 695 696 697 694 PyObject *_res = NULL; 695 long _rv; 696 long rangeStart; 697 long rangeEnd; 698 698 #ifndef TENumStyles 699 700 #endif 701 702 703 704 705 706 707 708 709 710 699 PyMac_PRECHECK(TENumStyles); 700 #endif 701 if (!PyArg_ParseTuple(_args, "ll", 702 &rangeStart, 703 &rangeEnd)) 704 return NULL; 705 _rv = TENumStyles(rangeStart, 706 rangeEnd, 707 _self->ob_itself); 708 _res = Py_BuildValue("l", 709 _rv); 710 return _res; 711 711 } 712 712 713 713 static PyObject *TEObj_TEFeatureFlag(TEObject *_self, PyObject *_args) 714 714 { 715 716 717 718 715 PyObject *_res = NULL; 716 short _rv; 717 short feature; 718 short action; 719 719 #ifndef TEFeatureFlag 720 721 #endif 722 723 724 725 726 727 728 729 730 731 720 PyMac_PRECHECK(TEFeatureFlag); 721 #endif 722 if (!PyArg_ParseTuple(_args, "hh", 723 &feature, 724 &action)) 725 return NULL; 726 _rv = TEFeatureFlag(feature, 727 action, 728 _self->ob_itself); 729 _res = Py_BuildValue("h", 730 _rv); 731 return _res; 732 732 } 733 733 734 734 static PyObject *TEObj_TEGetHiliteRgn(TEObject *_self, PyObject *_args) 735 735 { 736 737 738 736 PyObject *_res = NULL; 737 OSErr _err; 738 RgnHandle region; 739 739 #ifndef TEGetHiliteRgn 740 741 #endif 742 743 744 745 746 747 748 749 750 740 PyMac_PRECHECK(TEGetHiliteRgn); 741 #endif 742 if (!PyArg_ParseTuple(_args, "O&", 743 ResObj_Convert, ®ion)) 744 return NULL; 745 _err = TEGetHiliteRgn(region, 746 _self->ob_itself); 747 if (_err != noErr) return PyMac_Error(_err); 748 Py_INCREF(Py_None); 749 _res = Py_None; 750 return _res; 751 751 } 752 752 753 753 static PyObject *TEObj_as_Resource(TEObject *_self, PyObject *_args) 754 754 { 755 756 755 PyObject *_res = NULL; 756 Handle _rv; 757 757 #ifndef as_Resource 758 759 #endif 760 761 762 763 764 765 758 PyMac_PRECHECK(as_Resource); 759 #endif 760 if (!PyArg_ParseTuple(_args, "")) 761 return NULL; 762 _rv = as_Resource(_self->ob_itself); 763 _res = Py_BuildValue("O&", 764 ResObj_New, _rv); 765 return _res; 766 766 } 767 767 768 768 static PyMethodDef TEObj_methods[] = { 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 769 {"TESetText", (PyCFunction)TEObj_TESetText, 1, 770 PyDoc_STR("(Buffer text) -> None")}, 771 {"TEGetText", (PyCFunction)TEObj_TEGetText, 1, 772 PyDoc_STR("() -> (CharsHandle _rv)")}, 773 {"TEIdle", (PyCFunction)TEObj_TEIdle, 1, 774 PyDoc_STR("() -> None")}, 775 {"TESetSelect", (PyCFunction)TEObj_TESetSelect, 1, 776 PyDoc_STR("(long selStart, long selEnd) -> None")}, 777 {"TEActivate", (PyCFunction)TEObj_TEActivate, 1, 778 PyDoc_STR("() -> None")}, 779 {"TEDeactivate", (PyCFunction)TEObj_TEDeactivate, 1, 780 PyDoc_STR("() -> None")}, 781 {"TEKey", (PyCFunction)TEObj_TEKey, 1, 782 PyDoc_STR("(CharParameter key) -> None")}, 783 {"TECut", (PyCFunction)TEObj_TECut, 1, 784 PyDoc_STR("() -> None")}, 785 {"TECopy", (PyCFunction)TEObj_TECopy, 1, 786 PyDoc_STR("() -> None")}, 787 {"TEPaste", (PyCFunction)TEObj_TEPaste, 1, 788 PyDoc_STR("() -> None")}, 789 {"TEDelete", (PyCFunction)TEObj_TEDelete, 1, 790 PyDoc_STR("() -> None")}, 791 {"TEInsert", (PyCFunction)TEObj_TEInsert, 1, 792 PyDoc_STR("(Buffer text) -> None")}, 793 {"TESetAlignment", (PyCFunction)TEObj_TESetAlignment, 1, 794 PyDoc_STR("(short just) -> None")}, 795 {"TEUpdate", (PyCFunction)TEObj_TEUpdate, 1, 796 PyDoc_STR("(Rect rUpdate) -> None")}, 797 {"TEScroll", (PyCFunction)TEObj_TEScroll, 1, 798 PyDoc_STR("(short dh, short dv) -> None")}, 799 {"TESelView", (PyCFunction)TEObj_TESelView, 1, 800 PyDoc_STR("() -> None")}, 801 {"TEPinScroll", (PyCFunction)TEObj_TEPinScroll, 1, 802 PyDoc_STR("(short dh, short dv) -> None")}, 803 {"TEAutoView", (PyCFunction)TEObj_TEAutoView, 1, 804 PyDoc_STR("(Boolean fAuto) -> None")}, 805 {"TECalText", (PyCFunction)TEObj_TECalText, 1, 806 PyDoc_STR("() -> None")}, 807 {"TEGetOffset", (PyCFunction)TEObj_TEGetOffset, 1, 808 PyDoc_STR("(Point pt) -> (short _rv)")}, 809 {"TEGetPoint", (PyCFunction)TEObj_TEGetPoint, 1, 810 PyDoc_STR("(short offset) -> (Point _rv)")}, 811 {"TEClick", (PyCFunction)TEObj_TEClick, 1, 812 PyDoc_STR("(Point pt, Boolean fExtend) -> None")}, 813 {"TESetStyleHandle", (PyCFunction)TEObj_TESetStyleHandle, 1, 814 PyDoc_STR("(TEStyleHandle theHandle) -> None")}, 815 {"TEGetStyleHandle", (PyCFunction)TEObj_TEGetStyleHandle, 1, 816 PyDoc_STR("() -> (TEStyleHandle _rv)")}, 817 {"TEGetStyle", (PyCFunction)TEObj_TEGetStyle, 1, 818 PyDoc_STR("(short offset) -> (TextStyle theStyle, short lineHeight, short fontAscent)")}, 819 {"TEStylePaste", (PyCFunction)TEObj_TEStylePaste, 1, 820 PyDoc_STR("() -> None")}, 821 {"TESetStyle", (PyCFunction)TEObj_TESetStyle, 1, 822 PyDoc_STR("(short mode, TextStyle newStyle, Boolean fRedraw) -> None")}, 823 {"TEReplaceStyle", (PyCFunction)TEObj_TEReplaceStyle, 1, 824 PyDoc_STR("(short mode, TextStyle oldStyle, TextStyle newStyle, Boolean fRedraw) -> None")}, 825 {"TEGetStyleScrapHandle", (PyCFunction)TEObj_TEGetStyleScrapHandle, 1, 826 PyDoc_STR("() -> (StScrpHandle _rv)")}, 827 {"TEStyleInsert", (PyCFunction)TEObj_TEStyleInsert, 1, 828 PyDoc_STR("(Buffer text, StScrpHandle hST) -> None")}, 829 {"TEGetHeight", (PyCFunction)TEObj_TEGetHeight, 1, 830 PyDoc_STR("(long endLine, long startLine) -> (long _rv)")}, 831 {"TEContinuousStyle", (PyCFunction)TEObj_TEContinuousStyle, 1, 832 PyDoc_STR("(short mode, TextStyle aStyle) -> (Boolean _rv, short mode, TextStyle aStyle)")}, 833 {"TEUseStyleScrap", (PyCFunction)TEObj_TEUseStyleScrap, 1, 834 PyDoc_STR("(long rangeStart, long rangeEnd, StScrpHandle newStyles, Boolean fRedraw) -> None")}, 835 {"TENumStyles", (PyCFunction)TEObj_TENumStyles, 1, 836 PyDoc_STR("(long rangeStart, long rangeEnd) -> (long _rv)")}, 837 {"TEFeatureFlag", (PyCFunction)TEObj_TEFeatureFlag, 1, 838 PyDoc_STR("(short feature, short action) -> (short _rv)")}, 839 {"TEGetHiliteRgn", (PyCFunction)TEObj_TEGetHiliteRgn, 1, 840 PyDoc_STR("(RgnHandle region) -> None")}, 841 {"as_Resource", (PyCFunction)TEObj_as_Resource, 1, 842 PyDoc_STR("() -> (Handle _rv)")}, 843 {NULL, NULL, 0} 844 844 }; 845 845 846 846 static PyObject *TEObj_get_destRect(TEObject *self, void *closure) 847 847 { 848 848 return Py_BuildValue("O&", PyMac_BuildRect, &(*self->ob_itself)->destRect); 849 849 } 850 850 … … 853 853 static PyObject *TEObj_get_viewRect(TEObject *self, void *closure) 854 854 { 855 855 return Py_BuildValue("O&", PyMac_BuildRect, &(*self->ob_itself)->viewRect); 856 856 } 857 857 … … 860 860 static PyObject *TEObj_get_selRect(TEObject *self, void *closure) 861 861 { 862 862 return Py_BuildValue("O&", PyMac_BuildRect, &(*self->ob_itself)->selRect); 863 863 } 864 864 … … 867 867 static PyObject *TEObj_get_lineHeight(TEObject *self, void *closure) 868 868 { 869 869 return Py_BuildValue("h", (*self->ob_itself)->lineHeight); 870 870 } 871 871 … … 874 874 static PyObject *TEObj_get_fontAscent(TEObject *self, void *closure) 875 875 { 876 876 return Py_BuildValue("h", (*self->ob_itself)->fontAscent); 877 877 } 878 878 … … 881 881 static PyObject *TEObj_get_selPoint(TEObject *self, void *closure) 882 882 { 883 883 return Py_BuildValue("O&", PyMac_BuildPoint, (*self->ob_itself)->selPoint); 884 884 } 885 885 … … 888 888 static PyObject *TEObj_get_selStart(TEObject *self, void *closure) 889 889 { 890 890 return Py_BuildValue("h", (*self->ob_itself)->selStart); 891 891 } 892 892 … … 895 895 static PyObject *TEObj_get_selEnd(TEObject *self, void *closure) 896 896 { 897 897 return Py_BuildValue("h", (*self->ob_itself)->selEnd); 898 898 } 899 899 … … 902 902 static PyObject *TEObj_get_active(TEObject *self, void *closure) 903 903 { 904 904 return Py_BuildValue("h", (*self->ob_itself)->active); 905 905 } 906 906 … … 909 909 static PyObject *TEObj_get_just(TEObject *self, void *closure) 910 910 { 911 911 return Py_BuildValue("h", (*self->ob_itself)->just); 912 912 } 913 913 … … 916 916 static PyObject *TEObj_get_teLength(TEObject *self, void *closure) 917 917 { 918 918 return Py_BuildValue("h", (*self->ob_itself)->teLength); 919 919 } 920 920 … … 923 923 static PyObject *TEObj_get_txFont(TEObject *self, void *closure) 924 924 { 925 925 return Py_BuildValue("h", (*self->ob_itself)->txFont); 926 926 } 927 927 … … 930 930 static PyObject *TEObj_get_txFace(TEObject *self, void *closure) 931 931 { 932 932 return Py_BuildValue("h", (*self->ob_itself)->txFace); 933 933 } 934 934 … … 937 937 static PyObject *TEObj_get_txMode(TEObject *self, void *closure) 938 938 { 939 939 return Py_BuildValue("h", (*self->ob_itself)->txMode); 940 940 } 941 941 … … 944 944 static PyObject *TEObj_get_txSize(TEObject *self, void *closure) 945 945 { 946 946 return Py_BuildValue("h", (*self->ob_itself)->txSize); 947 947 } 948 948 … … 951 951 static PyObject *TEObj_get_nLines(TEObject *self, void *closure) 952 952 { 953 953 return Py_BuildValue("h", (*self->ob_itself)->nLines); 954 954 } 955 955 … … 957 957 958 958 static PyGetSetDef TEObj_getsetlist[] = { 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 959 {"destRect", (getter)TEObj_get_destRect, (setter)TEObj_set_destRect, "Destination rectangle"}, 960 {"viewRect", (getter)TEObj_get_viewRect, (setter)TEObj_set_viewRect, "Viewing rectangle"}, 961 {"selRect", (getter)TEObj_get_selRect, (setter)TEObj_set_selRect, "Selection rectangle"}, 962 {"lineHeight", (getter)TEObj_get_lineHeight, (setter)TEObj_set_lineHeight, "Height of a line"}, 963 {"fontAscent", (getter)TEObj_get_fontAscent, (setter)TEObj_set_fontAscent, "Ascent of a line"}, 964 {"selPoint", (getter)TEObj_get_selPoint, (setter)TEObj_set_selPoint, "Selection Point"}, 965 {"selStart", (getter)TEObj_get_selStart, (setter)TEObj_set_selStart, "Start of selection"}, 966 {"selEnd", (getter)TEObj_get_selEnd, (setter)TEObj_set_selEnd, "End of selection"}, 967 {"active", (getter)TEObj_get_active, (setter)TEObj_set_active, "TBD"}, 968 {"just", (getter)TEObj_get_just, (setter)TEObj_set_just, "Justification"}, 969 {"teLength", (getter)TEObj_get_teLength, (setter)TEObj_set_teLength, "TBD"}, 970 {"txFont", (getter)TEObj_get_txFont, (setter)TEObj_set_txFont, "Current font"}, 971 {"txFace", (getter)TEObj_get_txFace, (setter)TEObj_set_txFace, "Current font variant"}, 972 {"txMode", (getter)TEObj_get_txMode, (setter)TEObj_set_txMode, "Current text-drawing mode"}, 973 {"txSize", (getter)TEObj_get_txSize, (setter)TEObj_set_txSize, "Current font size"}, 974 {"nLines", (getter)TEObj_get_nLines, (setter)TEObj_set_nLines, "TBD"}, 975 {NULL, NULL, NULL, NULL}, 976 976 }; 977 977 … … 988 988 static PyObject *TEObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds) 989 989 { 990 991 992 993 994 995 996 997 990 PyObject *_self; 991 TEHandle itself; 992 char *kw[] = {"itself", 0}; 993 994 if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, TEObj_Convert, &itself)) return NULL; 995 if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL; 996 ((TEObject *)_self)->ob_itself = itself; 997 return _self; 998 998 } 999 999 … … 1002 1002 1003 1003 PyTypeObject TE_Type = { 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1004 PyObject_HEAD_INIT(NULL) 1005 0, /*ob_size*/ 1006 "_TE.TE", /*tp_name*/ 1007 sizeof(TEObject), /*tp_basicsize*/ 1008 0, /*tp_itemsize*/ 1009 /* methods */ 1010 (destructor) TEObj_dealloc, /*tp_dealloc*/ 1011 0, /*tp_print*/ 1012 (getattrfunc)0, /*tp_getattr*/ 1013 (setattrfunc)0, /*tp_setattr*/ 1014 (cmpfunc) TEObj_compare, /*tp_compare*/ 1015 (reprfunc) TEObj_repr, /*tp_repr*/ 1016 (PyNumberMethods *)0, /* tp_as_number */ 1017 (PySequenceMethods *)0, /* tp_as_sequence */ 1018 (PyMappingMethods *)0, /* tp_as_mapping */ 1019 (hashfunc) TEObj_hash, /*tp_hash*/ 1020 0, /*tp_call*/ 1021 0, /*tp_str*/ 1022 PyObject_GenericGetAttr, /*tp_getattro*/ 1023 PyObject_GenericSetAttr, /*tp_setattro */ 1024 0, /*tp_as_buffer*/ 1025 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ 1026 0, /*tp_doc*/ 1027 0, /*tp_traverse*/ 1028 0, /*tp_clear*/ 1029 0, /*tp_richcompare*/ 1030 0, /*tp_weaklistoffset*/ 1031 0, /*tp_iter*/ 1032 0, /*tp_iternext*/ 1033 TEObj_methods, /* tp_methods */ 1034 0, /*tp_members*/ 1035 TEObj_getsetlist, /*tp_getset*/ 1036 0, /*tp_base*/ 1037 0, /*tp_dict*/ 1038 0, /*tp_descr_get*/ 1039 0, /*tp_descr_set*/ 1040 0, /*tp_dictoffset*/ 1041 TEObj_tp_init, /* tp_init */ 1042 TEObj_tp_alloc, /* tp_alloc */ 1043 TEObj_tp_new, /* tp_new */ 1044 TEObj_tp_free, /* tp_free */ 1045 1045 }; 1046 1046 … … 1050 1050 static PyObject *TE_TEScrapHandle(PyObject *_self, PyObject *_args) 1051 1051 { 1052 1053 1052 PyObject *_res = NULL; 1053 Handle _rv; 1054 1054 #ifndef TEScrapHandle 1055 1056 #endif 1057 1058 1059 1060 1061 1062 1055 PyMac_PRECHECK(TEScrapHandle); 1056 #endif 1057 if (!PyArg_ParseTuple(_args, "")) 1058 return NULL; 1059 _rv = TEScrapHandle(); 1060 _res = Py_BuildValue("O&", 1061 ResObj_New, _rv); 1062 return _res; 1063 1063 } 1064 1064 1065 1065 static PyObject *TE_TEGetScrapLength(PyObject *_self, PyObject *_args) 1066 1066 { 1067 1068 1067 PyObject *_res = NULL; 1068 long _rv; 1069 1069 #ifndef TEGetScrapLength 1070 1071 #endif 1072 1073 1074 1075 1076 1077 1070 PyMac_PRECHECK(TEGetScrapLength); 1071 #endif 1072 if (!PyArg_ParseTuple(_args, "")) 1073 return NULL; 1074 _rv = TEGetScrapLength(); 1075 _res = Py_BuildValue("l", 1076 _rv); 1077 return _res; 1078 1078 } 1079 1079 1080 1080 static PyObject *TE_TENew(PyObject *_self, PyObject *_args) 1081 1081 { 1082 1083 1084 1085 1082 PyObject *_res = NULL; 1083 TEHandle _rv; 1084 Rect destRect; 1085 Rect viewRect; 1086 1086 #ifndef TENew 1087 1088 #endif 1089 1090 1091 1092 1093 1094 1095 1096 1097 1087 PyMac_PRECHECK(TENew); 1088 #endif 1089 if (!PyArg_ParseTuple(_args, "O&O&", 1090 PyMac_GetRect, &destRect, 1091 PyMac_GetRect, &viewRect)) 1092 return NULL; 1093 _rv = TENew(&destRect, 1094 &viewRect); 1095 _res = Py_BuildValue("O&", 1096 TEObj_New, _rv); 1097 return _res; 1098 1098 } 1099 1099 1100 1100 static PyObject *TE_TETextBox(PyObject *_self, PyObject *_args) 1101 1101 { 1102 1103 1104 1105 1106 1107 1102 PyObject *_res = NULL; 1103 char *text__in__; 1104 long text__len__; 1105 int text__in_len__; 1106 Rect box; 1107 short just; 1108 1108 #ifndef TETextBox 1109 1110 #endif 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1109 PyMac_PRECHECK(TETextBox); 1110 #endif 1111 if (!PyArg_ParseTuple(_args, "s#O&h", 1112 &text__in__, &text__in_len__, 1113 PyMac_GetRect, &box, 1114 &just)) 1115 return NULL; 1116 text__len__ = text__in_len__; 1117 TETextBox(text__in__, text__len__, 1118 &box, 1119 just); 1120 Py_INCREF(Py_None); 1121 _res = Py_None; 1122 return _res; 1123 1123 } 1124 1124 1125 1125 static PyObject *TE_TEStyleNew(PyObject *_self, PyObject *_args) 1126 1126 { 1127 1128 1129 1130 1127 PyObject *_res = NULL; 1128 TEHandle _rv; 1129 Rect destRect; 1130 Rect viewRect; 1131 1131 #ifndef TEStyleNew 1132 1133 #endif 1134 1135 1136 1137 1138 1139 1140 1141 1142 1132 PyMac_PRECHECK(TEStyleNew); 1133 #endif 1134 if (!PyArg_ParseTuple(_args, "O&O&", 1135 PyMac_GetRect, &destRect, 1136 PyMac_GetRect, &viewRect)) 1137 return NULL; 1138 _rv = TEStyleNew(&destRect, 1139 &viewRect); 1140 _res = Py_BuildValue("O&", 1141 TEObj_New, _rv); 1142 return _res; 1143 1143 } 1144 1144 1145 1145 static PyObject *TE_TESetScrapLength(PyObject *_self, PyObject *_args) 1146 1146 { 1147 1148 1147 PyObject *_res = NULL; 1148 long length; 1149 1149 #ifndef TESetScrapLength 1150 1151 #endif 1152 1153 1154 1155 1156 1157 1158 1150 PyMac_PRECHECK(TESetScrapLength); 1151 #endif 1152 if (!PyArg_ParseTuple(_args, "l", 1153 &length)) 1154 return NULL; 1155 TESetScrapLength(length); 1156 Py_INCREF(Py_None); 1157 _res = Py_None; 1158 return _res; 1159 1159 } 1160 1160 1161 1161 static PyObject *TE_TEFromScrap(PyObject *_self, PyObject *_args) 1162 1162 { 1163 1164 1163 PyObject *_res = NULL; 1164 OSErr _err; 1165 1165 #ifndef TEFromScrap 1166 1167 #endif 1168 1169 1170 1171 1172 1173 1174 1166 PyMac_PRECHECK(TEFromScrap); 1167 #endif 1168 if (!PyArg_ParseTuple(_args, "")) 1169 return NULL; 1170 _err = TEFromScrap(); 1171 if (_err != noErr) return PyMac_Error(_err); 1172 Py_INCREF(Py_None); 1173 _res = Py_None; 1174 return _res; 1175 1175 } 1176 1176 1177 1177 static PyObject *TE_TEToScrap(PyObject *_self, PyObject *_args) 1178 1178 { 1179 1180 1179 PyObject *_res = NULL; 1180 OSErr _err; 1181 1181 #ifndef TEToScrap 1182 1183 #endif 1184 1185 1186 1187 1188 1189 1190 1182 PyMac_PRECHECK(TEToScrap); 1183 #endif 1184 if (!PyArg_ParseTuple(_args, "")) 1185 return NULL; 1186 _err = TEToScrap(); 1187 if (_err != noErr) return PyMac_Error(_err); 1188 Py_INCREF(Py_None); 1189 _res = Py_None; 1190 return _res; 1191 1191 } 1192 1192 1193 1193 static PyObject *TE_TEGetScrapHandle(PyObject *_self, PyObject *_args) 1194 1194 { 1195 1196 1195 PyObject *_res = NULL; 1196 Handle _rv; 1197 1197 #ifndef TEGetScrapHandle 1198 1199 #endif 1200 1201 1202 1203 1204 1205 1198 PyMac_PRECHECK(TEGetScrapHandle); 1199 #endif 1200 if (!PyArg_ParseTuple(_args, "")) 1201 return NULL; 1202 _rv = TEGetScrapHandle(); 1203 _res = Py_BuildValue("O&", 1204 ResObj_New, _rv); 1205 return _res; 1206 1206 } 1207 1207 1208 1208 static PyObject *TE_TESetScrapHandle(PyObject *_self, PyObject *_args) 1209 1209 { 1210 1211 1210 PyObject *_res = NULL; 1211 Handle value; 1212 1212 #ifndef TESetScrapHandle 1213 1214 #endif 1215 1216 1217 1218 1219 1220 1221 1213 PyMac_PRECHECK(TESetScrapHandle); 1214 #endif 1215 if (!PyArg_ParseTuple(_args, "O&", 1216 ResObj_Convert, &value)) 1217 return NULL; 1218 TESetScrapHandle(value); 1219 Py_INCREF(Py_None); 1220 _res = Py_None; 1221 return _res; 1222 1222 } 1223 1223 1224 1224 static PyObject *TE_LMGetWordRedraw(PyObject *_self, PyObject *_args) 1225 1225 { 1226 1227 1226 PyObject *_res = NULL; 1227 UInt8 _rv; 1228 1228 #ifndef LMGetWordRedraw 1229 1230 #endif 1231 1232 1233 1234 1235 1236 1229 PyMac_PRECHECK(LMGetWordRedraw); 1230 #endif 1231 if (!PyArg_ParseTuple(_args, "")) 1232 return NULL; 1233 _rv = LMGetWordRedraw(); 1234 _res = Py_BuildValue("b", 1235 _rv); 1236 return _res; 1237 1237 } 1238 1238 1239 1239 static PyObject *TE_LMSetWordRedraw(PyObject *_self, PyObject *_args) 1240 1240 { 1241 1242 1241 PyObject *_res = NULL; 1242 UInt8 value; 1243 1243 #ifndef LMSetWordRedraw 1244 1245 #endif 1246 1247 1248 1249 1250 1251 1252 1244 PyMac_PRECHECK(LMSetWordRedraw); 1245 #endif 1246 if (!PyArg_ParseTuple(_args, "b", 1247 &value)) 1248 return NULL; 1249 LMSetWordRedraw(value); 1250 Py_INCREF(Py_None); 1251 _res = Py_None; 1252 return _res; 1253 1253 } 1254 1254 1255 1255 static PyObject *TE_as_TE(PyObject *_self, PyObject *_args) 1256 1256 { 1257 1258 1259 1257 PyObject *_res = NULL; 1258 TEHandle _rv; 1259 Handle h; 1260 1260 #ifndef as_TE 1261 1262 #endif 1263 1264 1265 1266 1267 1268 1269 1261 PyMac_PRECHECK(as_TE); 1262 #endif 1263 if (!PyArg_ParseTuple(_args, "O&", 1264 ResObj_Convert, &h)) 1265 return NULL; 1266 _rv = as_TE(h); 1267 _res = Py_BuildValue("O&", 1268 TEObj_New, _rv); 1269 return _res; 1270 1270 } 1271 1271 #endif /* __LP64__ */ … … 1273 1273 static PyMethodDef TE_methods[] = { 1274 1274 #ifndef __LP64__ 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1275 {"TEScrapHandle", (PyCFunction)TE_TEScrapHandle, 1, 1276 PyDoc_STR("() -> (Handle _rv)")}, 1277 {"TEGetScrapLength", (PyCFunction)TE_TEGetScrapLength, 1, 1278 PyDoc_STR("() -> (long _rv)")}, 1279 {"TENew", (PyCFunction)TE_TENew, 1, 1280 PyDoc_STR("(Rect destRect, Rect viewRect) -> (TEHandle _rv)")}, 1281 {"TETextBox", (PyCFunction)TE_TETextBox, 1, 1282 PyDoc_STR("(Buffer text, Rect box, short just) -> None")}, 1283 {"TEStyleNew", (PyCFunction)TE_TEStyleNew, 1, 1284 PyDoc_STR("(Rect destRect, Rect viewRect) -> (TEHandle _rv)")}, 1285 {"TESetScrapLength", (PyCFunction)TE_TESetScrapLength, 1, 1286 PyDoc_STR("(long length) -> None")}, 1287 {"TEFromScrap", (PyCFunction)TE_TEFromScrap, 1, 1288 PyDoc_STR("() -> None")}, 1289 {"TEToScrap", (PyCFunction)TE_TEToScrap, 1, 1290 PyDoc_STR("() -> None")}, 1291 {"TEGetScrapHandle", (PyCFunction)TE_TEGetScrapHandle, 1, 1292 PyDoc_STR("() -> (Handle _rv)")}, 1293 {"TESetScrapHandle", (PyCFunction)TE_TESetScrapHandle, 1, 1294 PyDoc_STR("(Handle value) -> None")}, 1295 {"LMGetWordRedraw", (PyCFunction)TE_LMGetWordRedraw, 1, 1296 PyDoc_STR("() -> (UInt8 _rv)")}, 1297 {"LMSetWordRedraw", (PyCFunction)TE_LMSetWordRedraw, 1, 1298 PyDoc_STR("(UInt8 value) -> None")}, 1299 {"as_TE", (PyCFunction)TE_as_TE, 1, 1300 PyDoc_STR("(Handle h) -> (TEHandle _rv)")}, 1301 1301 #endif /* __LP64__ */ 1302 1302 {NULL, NULL, 0} 1303 1303 }; 1304 1304 … … 1308 1308 void init_TE(void) 1309 1309 { 1310 1310 PyObject *m; 1311 1311 #ifndef __LP64__ 1312 1313 1314 1315 1316 1317 1312 PyObject *d; 1313 1314 1315 1316 PyMac_INIT_TOOLBOX_OBJECT_NEW(TEHandle, TEObj_New); 1317 PyMac_INIT_TOOLBOX_OBJECT_CONVERT(TEHandle, TEObj_Convert); 1318 1318 1319 1319 #endif /* __LP64__ */ 1320 1320 1321 1321 m = Py_InitModule("_TE", TE_methods); 1322 1322 #ifndef __LP64__ 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1323 d = PyModule_GetDict(m); 1324 TE_Error = PyMac_GetOSErrException(); 1325 if (TE_Error == NULL || 1326 PyDict_SetItemString(d, "Error", TE_Error) != 0) 1327 return; 1328 TE_Type.ob_type = &PyType_Type; 1329 if (PyType_Ready(&TE_Type) < 0) return; 1330 Py_INCREF(&TE_Type); 1331 PyModule_AddObject(m, "TE", (PyObject *)&TE_Type); 1332 /* Backward-compatible name */ 1333 Py_INCREF(&TE_Type); 1334 PyModule_AddObject(m, "TEType", (PyObject *)&TE_Type); 1335 1335 #endif /* __LP64__ */ 1336 1336 }
Note:
See TracChangeset
for help on using the changeset viewer.