| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#include "Python.h" |
| 5 |
#include "pymactoolbox.h" |
| 6 |
|
| 7 |
#if APPLE_SUPPORTS_QUICKTIME |
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ |
| 12 |
PyErr_SetString(PyExc_NotImplementedError, \ |
| 13 |
"Not available in this shared library/OS version"); \ |
| 14 |
return NULL; \ |
| 15 |
}} while(0) |
| 16 |
|
| 17 |
|
| 18 |
#include <Carbon/Carbon.h> |
| 19 |
|
| 20 |
|
| 21 |
static PyObject *TXNObj_New(TXNObject); |
| 22 |
static int TXNObj_Convert(PyObject *, TXNObject *); |
| 23 |
static PyObject *TXNFontMenuObj_New(TXNFontMenuObject); |
| 24 |
static int TXNFontMenuObj_Convert(PyObject *, TXNFontMenuObject *); |
| 25 |
|
| 26 |
|
| 27 |
#ifdef NOTYET_USE_TOOLBOX_OBJECT_GLUE |
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
#endif |
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
static int |
| 39 |
OptFSSpecPtr_Convert(PyObject *v, FSSpec **p_itself) |
| 40 |
{ |
| 41 |
static FSSpec fss; |
| 42 |
if (v == Py_None) |
| 43 |
{ |
| 44 |
*p_itself = NULL; |
| 45 |
return 1; |
| 46 |
} |
| 47 |
*p_itself = &fss; |
| 48 |
return PyMac_GetFSSpec(v, *p_itself); |
| 49 |
} |
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
static int |
| 55 |
OptGWorldObj_Convert(PyObject *v, GWorldPtr *p_itself) |
| 56 |
{ |
| 57 |
if (v == Py_None) |
| 58 |
{ |
| 59 |
*p_itself = NULL; |
| 60 |
return 1; |
| 61 |
} |
| 62 |
return GWorldObj_Convert(v, p_itself); |
| 63 |
} |
| 64 |
|
| 65 |
|
| 66 |
static PyObject *Mlte_Error; |
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
PyTypeObject TXNObject_Type; |
| 71 |
|
| 72 |
#define TXNObj_Check(x) ((x)->ob_type == &TXNObject_Type || PyObject_TypeCheck((x), &TXNObject_Type)) |
| 73 |
|
| 74 |
typedef struct TXNObjectObject { |
| 75 |
PyObject_HEAD |
| 76 |
TXNObject ob_itself; |
| 77 |
} TXNObjectObject; |
| 78 |
|
| 79 |
PyObject *TXNObj_New(TXNObject itself) |
| 80 |
{ |
| 81 |
TXNObjectObject *it; |
| 82 |
if (itself == NULL) return PyMac_Error(resNotFound); |
| 83 |
it = PyObject_NEW(TXNObjectObject, &TXNObject_Type); |
| 84 |
if (it == NULL) return NULL; |
| 85 |
it->ob_itself = itself; |
| 86 |
return (PyObject *)it; |
| 87 |
} |
| 88 |
|
| 89 |
int TXNObj_Convert(PyObject *v, TXNObject *p_itself) |
| 90 |
{ |
| 91 |
if (!TXNObj_Check(v)) |
| 92 |
{ |
| 93 |
PyErr_SetString(PyExc_TypeError, "TXNObject required"); |
| 94 |
return 0; |
| 95 |
} |
| 96 |
*p_itself = ((TXNObjectObject *)v)->ob_itself; |
| 97 |
return 1; |
| 98 |
} |
| 99 |
|
| 100 |
static void TXNObj_dealloc(TXNObjectObject *self) |
| 101 |
{ |
| 102 |
|
| 103 |
self->ob_type->tp_free((PyObject *)self); |
| 104 |
} |
| 105 |
|
| 106 |
static PyObject *TXNObj_TXNDeleteObject(TXNObjectObject *_self, PyObject *_args) |
| 107 |
{ |
| 108 |
PyObject *_res = NULL; |
| 109 |
#ifndef TXNDeleteObject |
| 110 |
PyMac_PRECHECK(TXNDeleteObject); |
| 111 |
#endif |
| 112 |
if (!PyArg_ParseTuple(_args, "")) |
| 113 |
return NULL; |
| 114 |
TXNDeleteObject(_self->ob_itself); |
| 115 |
Py_INCREF(Py_None); |
| 116 |
_res = Py_None; |
| 117 |
return _res; |
| 118 |
} |
| 119 |
|
| 120 |
static PyObject *TXNObj_TXNResizeFrame(TXNObjectObject *_self, PyObject *_args) |
| 121 |
{ |
| 122 |
PyObject *_res = NULL; |
| 123 |
UInt32 iWidth; |
| 124 |
UInt32 iHeight; |
| 125 |
TXNFrameID iTXNFrameID; |
| 126 |
#ifndef TXNResizeFrame |
| 127 |
PyMac_PRECHECK(TXNResizeFrame); |
| 128 |
#endif |
| 129 |
if (!PyArg_ParseTuple(_args, "lll", |
| 130 |
&iWidth, |
| 131 |
&iHeight, |
| 132 |
&iTXNFrameID)) |
| 133 |
return NULL; |
| 134 |
TXNResizeFrame(_self->ob_itself, |
| 135 |
iWidth, |
| 136 |
iHeight, |
| 137 |
iTXNFrameID); |
| 138 |
Py_INCREF(Py_None); |
| 139 |
_res = Py_None; |
| 140 |
return _res; |
| 141 |
} |
| 142 |
|
| 143 |
static PyObject *TXNObj_TXNSetFrameBounds(TXNObjectObject *_self, PyObject *_args) |
| 144 |
{ |
| 145 |
PyObject *_res = NULL; |
| 146 |
SInt32 iTop; |
| 147 |
SInt32 iLeft; |
| 148 |
SInt32 iBottom; |
| 149 |
SInt32 iRight; |
| 150 |
TXNFrameID iTXNFrameID; |
| 151 |
#ifndef TXNSetFrameBounds |
| 152 |
PyMac_PRECHECK(TXNSetFrameBounds); |
| 153 |
#endif |
| 154 |
if (!PyArg_ParseTuple(_args, "lllll", |
| 155 |
&iTop, |
| 156 |
&iLeft, |
| 157 |
&iBottom, |
| 158 |
&iRight, |
| 159 |
&iTXNFrameID)) |
| 160 |
return NULL; |
| 161 |
TXNSetFrameBounds(_self->ob_itself, |
| 162 |
iTop, |
| 163 |
iLeft, |
| 164 |
iBottom, |
| 165 |
iRight, |
| 166 |
iTXNFrameID); |
| 167 |
Py_INCREF(Py_None); |
| 168 |
_res = Py_None; |
| 169 |
return _res; |
| 170 |
} |
| 171 |
|
| 172 |
static PyObject *TXNObj_TXNKeyDown(TXNObjectObject *_self, PyObject *_args) |
| 173 |
{ |
| 174 |
PyObject *_res = NULL; |
| 175 |
EventRecord iEvent; |
| 176 |
#ifndef TXNKeyDown |
| 177 |
PyMac_PRECHECK(TXNKeyDown); |
| 178 |
#endif |
| 179 |
if (!PyArg_ParseTuple(_args, "O&", |
| 180 |
PyMac_GetEventRecord, &iEvent)) |
| 181 |
return NULL; |
| 182 |
TXNKeyDown(_self->ob_itself, |
| 183 |
&iEvent); |
| 184 |
Py_INCREF(Py_None); |
| 185 |
_res = Py_None; |
| 186 |
return _res; |
| 187 |
} |
| 188 |
|
| 189 |
static PyObject *TXNObj_TXNAdjustCursor(TXNObjectObject *_self, PyObject *_args) |
| 190 |
{ |
| 191 |
PyObject *_res = NULL; |
| 192 |
RgnHandle ioCursorRgn; |
| 193 |
#ifndef TXNAdjustCursor |
| 194 |
PyMac_PRECHECK(TXNAdjustCursor); |
| 195 |
#endif |
| 196 |
if (!PyArg_ParseTuple(_args, "O&", |
| 197 |
OptResObj_Convert, &ioCursorRgn)) |
| 198 |
return NULL; |
| 199 |
TXNAdjustCursor(_self->ob_itself, |
| 200 |
ioCursorRgn); |
| 201 |
Py_INCREF(Py_None); |
| 202 |
_res = Py_None; |
| 203 |
return _res; |
| 204 |
} |
| 205 |
|
| 206 |
static PyObject *TXNObj_TXNClick(TXNObjectObject *_self, PyObject *_args) |
| 207 |
{ |
| 208 |
PyObject *_res = NULL; |
| 209 |
EventRecord iEvent; |
| 210 |
#ifndef TXNClick |
| 211 |
PyMac_PRECHECK(TXNClick); |
| 212 |
#endif |
| 213 |
if (!PyArg_ParseTuple(_args, "O&", |
| 214 |
PyMac_GetEventRecord, &iEvent)) |
| 215 |
return NULL; |
| 216 |
TXNClick(_self->ob_itself, |
| 217 |
&iEvent); |
| 218 |
Py_INCREF(Py_None); |
| 219 |
_res = Py_None; |
| 220 |
return _res; |
| 221 |
} |
| 222 |
|
| 223 |
static PyObject *TXNObj_TXNSelectAll(TXNObjectObject *_self, PyObject *_args) |
| 224 |
{ |
| 225 |
PyObject *_res = NULL; |
| 226 |
#ifndef TXNSelectAll |
| 227 |
PyMac_PRECHECK(TXNSelectAll); |
| 228 |
#endif |
| 229 |
if (!PyArg_ParseTuple(_args, "")) |
| 230 |
return NULL; |
| 231 |
TXNSelectAll(_self->ob_itself); |
| 232 |
Py_INCREF(Py_None); |
| 233 |
_res = Py_None; |
| 234 |
return _res; |
| 235 |
} |
| 236 |
|
| 237 |
static PyObject *TXNObj_TXNFocus(TXNObjectObject *_self, PyObject *_args) |
| 238 |
{ |
| 239 |
PyObject *_res = NULL; |
| 240 |
Boolean iBecomingFocused; |
| 241 |
#ifndef TXNFocus |
| 242 |
PyMac_PRECHECK(TXNFocus); |
| 243 |
#endif |
| 244 |
if (!PyArg_ParseTuple(_args, "b", |
| 245 |
&iBecomingFocused)) |
| 246 |
return NULL; |
| 247 |
TXNFocus(_self->ob_itself, |
| 248 |
iBecomingFocused); |
| 249 |
Py_INCREF(Py_None); |
| 250 |
_res = Py_None; |
| 251 |
return _res; |
| 252 |
} |
| 253 |
|
| 254 |
static PyObject *TXNObj_TXNUpdate(TXNObjectObject *_self, PyObject *_args) |
| 255 |
{ |
| 256 |
PyObject *_res = NULL; |
| 257 |
#ifndef TXNUpdate |
| 258 |
PyMac_PRECHECK(TXNUpdate); |
| 259 |
#endif |
| 260 |
if (!PyArg_ParseTuple(_args, "")) |
| 261 |
return NULL; |
| 262 |
TXNUpdate(_self->ob_itself); |
| 263 |
Py_INCREF(Py_None); |
| 264 |
_res = Py_None; |
| 265 |
return _res; |
| 266 |
} |
| 267 |
|
| 268 |
static PyObject *TXNObj_TXNDraw(TXNObjectObject *_self, PyObject *_args) |
| 269 |
{ |
| 270 |
PyObject *_res = NULL; |
| 271 |
GWorldPtr iDrawPort; |
| 272 |
#ifndef TXNDraw |
| 273 |
PyMac_PRECHECK(TXNDraw); |
| 274 |
#endif |
| 275 |
if (!PyArg_ParseTuple(_args, "O&", |
| 276 |
OptGWorldObj_Convert, &iDrawPort)) |
| 277 |
return NULL; |
| 278 |
TXNDraw(_self->ob_itself, |
| 279 |
iDrawPort); |
| 280 |
Py_INCREF(Py_None); |
| 281 |
_res = Py_None; |
| 282 |
return _res; |
| 283 |
} |
| 284 |
|
| 285 |
static PyObject *TXNObj_TXNForceUpdate(TXNObjectObject *_self, PyObject *_args) |
| 286 |
{ |
| 287 |
PyObject *_res = NULL; |
| 288 |
#ifndef TXNForceUpdate |
| 289 |
PyMac_PRECHECK(TXNForceUpdate); |
| 290 |
#endif |
| 291 |
if (!PyArg_ParseTuple(_args, "")) |
| 292 |
return NULL; |
| 293 |
TXNForceUpdate(_self->ob_itself); |
| 294 |
Py_INCREF(Py_None); |
| 295 |
_res = Py_None; |
| 296 |
return _res; |
| 297 |
} |
| 298 |
|
| 299 |
static PyObject *TXNObj_TXNGetSleepTicks(TXNObjectObject *_self, PyObject *_args) |
| 300 |
{ |
| 301 |
PyObject *_res = NULL; |
| 302 |
UInt32 _rv; |
| 303 |
#ifndef TXNGetSleepTicks |
| 304 |
PyMac_PRECHECK(TXNGetSleepTicks); |
| 305 |
#endif |
| 306 |
if (!PyArg_ParseTuple(_args, "")) |
| 307 |
return NULL; |
| 308 |
_rv = TXNGetSleepTicks(_self->ob_itself); |
| 309 |
_res = Py_BuildValue("l", |
| 310 |
_rv); |
| 311 |
return _res; |
| 312 |
} |
| 313 |
|
| 314 |
static PyObject *TXNObj_TXNIdle(TXNObjectObject *_self, PyObject *_args) |
| 315 |
{ |
| 316 |
PyObject *_res = NULL; |
| 317 |
#ifndef TXNIdle |
| 318 |
PyMac_PRECHECK(TXNIdle); |
| 319 |
#endif |
| 320 |
if (!PyArg_ParseTuple(_args, "")) |
| 321 |
return NULL; |
| 322 |
TXNIdle(_self->ob_itself); |
| 323 |
Py_INCREF(Py_None); |
| 324 |
_res = Py_None; |
| 325 |
return _res; |
| 326 |
} |
| 327 |
|
| 328 |
static PyObject *TXNObj_TXNGrowWindow(TXNObjectObject *_self, PyObject *_args) |
| 329 |
{ |
| 330 |
PyObject *_res = NULL; |
| 331 |
EventRecord iEvent; |
| 332 |
#ifndef TXNGrowWindow |
| 333 |
PyMac_PRECHECK(TXNGrowWindow); |
| 334 |
#endif |
| 335 |
if (!PyArg_ParseTuple(_args, "O&", |
| 336 |
PyMac_GetEventRecord, &iEvent)) |
| 337 |
return NULL; |
| 338 |
TXNGrowWindow(_self->ob_itself, |
| 339 |
&iEvent); |
| 340 |
Py_INCREF(Py_None); |
| 341 |
_res = Py_None; |
| 342 |
return _res; |
| 343 |
} |
| 344 |
|
| 345 |
static PyObject *TXNObj_TXNZoomWindow(TXNObjectObject *_self, PyObject *_args) |
| 346 |
{ |
| 347 |
PyObject *_res = NULL; |
| 348 |
SInt16 iPart; |
| 349 |
#ifndef TXNZoomWindow |
| 350 |
PyMac_PRECHECK(TXNZoomWindow); |
| 351 |
#endif |
| 352 |
if (!PyArg_ParseTuple(_args, "h", |
| 353 |
&iPart)) |
| 354 |
return NULL; |
| 355 |
TXNZoomWindow(_self->ob_itself, |
| 356 |
iPart); |
| 357 |
Py_INCREF(Py_None); |
| 358 |
_res = Py_None; |
| 359 |
return _res; |
| 360 |
} |
| 361 |
|
| 362 |
static PyObject *TXNObj_TXNCanUndo(TXNObjectObject *_self, PyObject *_args) |
| 363 |
{ |
| 364 |
PyObject *_res = NULL; |
| 365 |
Boolean _rv; |
| 366 |
TXNActionKey oTXNActionKey; |
| 367 |
#ifndef TXNCanUndo |
| 368 |
PyMac_PRECHECK(TXNCanUndo); |
| 369 |
#endif |
| 370 |
if (!PyArg_ParseTuple(_args, "")) |
| 371 |
return NULL; |
| 372 |
_rv = TXNCanUndo(_self->ob_itself, |
| 373 |
&oTXNActionKey); |
| 374 |
_res = Py_BuildValue("bl", |
| 375 |
_rv, |
| 376 |
oTXNActionKey); |
| 377 |
return _res; |
| 378 |
} |
| 379 |
|
| 380 |
static PyObject *TXNObj_TXNUndo(TXNObjectObject *_self, PyObject *_args) |
| 381 |
{ |
| 382 |
PyObject *_res = NULL; |
| 383 |
#ifndef TXNUndo |
| 384 |
PyMac_PRECHECK(TXNUndo); |
| 385 |
#endif |
| 386 |
if (!PyArg_ParseTuple(_args, "")) |
| 387 |
return NULL; |
| 388 |
TXNUndo(_self->ob_itself); |
| 389 |
Py_INCREF(Py_None); |
| 390 |
_res = Py_None; |
| 391 |
return _res; |
| 392 |
} |
| 393 |
|
| 394 |
static PyObject *TXNObj_TXNCanRedo(TXNObjectObject *_self, PyObject *_args) |
| 395 |
{ |
| 396 |
PyObject *_res = NULL; |
| 397 |
Boolean _rv; |
| 398 |
TXNActionKey oTXNActionKey; |
| 399 |
#ifndef TXNCanRedo |
| 400 |
PyMac_PRECHECK(TXNCanRedo); |
| 401 |
#endif |
| 402 |
if (!PyArg_ParseTuple(_args, "")) |
| 403 |
return NULL; |
| 404 |
_rv = TXNCanRedo(_self->ob_itself, |
| 405 |
&oTXNActionKey); |
| 406 |
_res = Py_BuildValue("bl", |
| 407 |
_rv, |
| 408 |
oTXNActionKey); |
| 409 |
return _res; |
| 410 |
} |
| 411 |
|
| 412 |
static PyObject *TXNObj_TXNRedo(TXNObjectObject *_self, PyObject *_args) |
| 413 |
{ |
| 414 |
PyObject *_res = NULL; |
| 415 |
#ifndef TXNRedo |
| 416 |
PyMac_PRECHECK(TXNRedo); |
| 417 |
#endif |
| 418 |
if (!PyArg_ParseTuple(_args, "")) |
| 419 |
return NULL; |
| 420 |
TXNRedo(_self->ob_itself); |
| 421 |
Py_INCREF(Py_None); |
| 422 |
_res = Py_None; |
| 423 |
return _res; |
| 424 |
} |
| 425 |
|
| 426 |
static PyObject *TXNObj_TXNCut(TXNObjectObject *_self, PyObject *_args) |
| 427 |
{ |
| 428 |
PyObject *_res = NULL; |
| 429 |
OSStatus _err; |
| 430 |
#ifndef TXNCut |
| 431 |
PyMac_PRECHECK(TXNCut); |
| 432 |
#endif |
| 433 |
if (!PyArg_ParseTuple(_args, "")) |
| 434 |
return NULL; |
| 435 |
_err = TXNCut(_self->ob_itself); |
| 436 |
if (_err != noErr) return PyMac_Error(_err); |
| 437 |
Py_INCREF(Py_None); |
| 438 |
_res = Py_None; |
| 439 |
return _res; |
| 440 |
} |
| 441 |
|
| 442 |
static PyObject *TXNObj_TXNCopy(TXNObjectObject *_self, PyObject *_args) |
| 443 |
{ |
| 444 |
PyObject *_res = NULL; |
| 445 |
OSStatus _err; |
| 446 |
#ifndef TXNCopy |
| 447 |
PyMac_PRECHECK(TXNCopy); |
| 448 |
#endif |
| 449 |
if (!PyArg_ParseTuple(_args, "")) |
| 450 |
return NULL; |
| 451 |
_err = TXNCopy(_self->ob_itself); |
| 452 |
if (_err != noErr) return PyMac_Error(_err); |
| 453 |
Py_INCREF(Py_None); |
| 454 |
_res = Py_None; |
| 455 |
return _res; |
| 456 |
} |
| 457 |
|
| 458 |
static PyObject *TXNObj_TXNPaste(TXNObjectObject *_self, PyObject *_args) |
| 459 |
{ |
| 460 |
PyObject *_res = NULL; |
| 461 |
OSStatus _err; |
| 462 |
#ifndef TXNPaste |
| 463 |
PyMac_PRECHECK(TXNPaste); |
| 464 |
#endif |
| 465 |
if (!PyArg_ParseTuple(_args, "")) |
| 466 |
return NULL; |
| 467 |
_err = TXNPaste(_self->ob_itself); |
| 468 |
if (_err != noErr) return PyMac_Error(_err); |
| 469 |
Py_INCREF(Py_None); |
| 470 |
_res = Py_None; |
| 471 |
return _res; |
| 472 |
} |
| 473 |
|
| 474 |
static PyObject *TXNObj_TXNClear(TXNObjectObject *_self, PyObject *_args) |
| 475 |
{ |
| 476 |
PyObject *_res = NULL; |
| 477 |
OSStatus _err; |
| 478 |
#ifndef TXNClear |
| 479 |
PyMac_PRECHECK(TXNClear); |
| 480 |
#endif |
| 481 |
if (!PyArg_ParseTuple(_args, "")) |
| 482 |
return NULL; |
| 483 |
_err = TXNClear(_self->ob_itself); |
| 484 |
if (_err != noErr) return PyMac_Error(_err); |
| 485 |
Py_INCREF(Py_None); |
| 486 |
_res = Py_None; |
| 487 |
return _res; |
| 488 |
} |
| 489 |
|
| 490 |
static PyObject *TXNObj_TXNGetSelection(TXNObjectObject *_self, PyObject *_args) |
| 491 |
{ |
| 492 |
PyObject *_res = NULL; |
| 493 |
TXNOffset oStartOffset; |
| 494 |
TXNOffset oEndOffset; |
| 495 |
#ifndef TXNGetSelection |
| 496 |
PyMac_PRECHECK(TXNGetSelection); |
| 497 |
#endif |
| 498 |
if (!PyArg_ParseTuple(_args, "")) |
| 499 |
return NULL; |
| 500 |
TXNGetSelection(_self->ob_itself, |
| 501 |
&oStartOffset, |
| 502 |
&oEndOffset); |
| 503 |
_res = Py_BuildValue("ll", |
| 504 |
oStartOffset, |
| 505 |
oEndOffset); |
| 506 |
return _res; |
| 507 |
} |
| 508 |
|
| 509 |
static PyObject *TXNObj_TXNShowSelection(TXNObjectObject *_self, PyObject *_args) |
| 510 |
{ |
| 511 |
PyObject *_res = NULL; |
| 512 |
Boolean iShowEnd; |
| 513 |
#ifndef TXNShowSelection |
| 514 |
PyMac_PRECHECK(TXNShowSelection); |
| 515 |
#endif |
| 516 |
if (!PyArg_ParseTuple(_args, "b", |
| 517 |
&iShowEnd)) |
| 518 |
return NULL; |
| 519 |
TXNShowSelection(_self->ob_itself, |
| 520 |
iShowEnd); |
| 521 |
Py_INCREF(Py_None); |
| 522 |
_res = Py_None; |
| 523 |
return _res; |
| 524 |
} |
| 525 |
|
| 526 |
static PyObject *TXNObj_TXNIsSelectionEmpty(TXNObjectObject *_self, PyObject *_args) |
| 527 |
{ |
| 528 |
PyObject *_res = NULL; |
| 529 |
Boolean _rv; |
| 530 |
#ifndef TXNIsSelectionEmpty |
| 531 |
PyMac_PRECHECK(TXNIsSelectionEmpty); |
| 532 |
#endif |
| 533 |
if (!PyArg_ParseTuple(_args, "")) |
| 534 |
return NULL; |
| 535 |
_rv = TXNIsSelectionEmpty(_self->ob_itself); |
| 536 |
_res = Py_BuildValue("b", |
| 537 |
_rv); |
| 538 |
return _res; |
| 539 |
} |
| 540 |
|
| 541 |
static PyObject *TXNObj_TXNSetSelection(TXNObjectObject *_self, PyObject *_args) |
| 542 |
{ |
| 543 |
PyObject *_res = NULL; |
| 544 |
OSStatus _err; |
| 545 |
TXNOffset iStartOffset; |
| 546 |
TXNOffset iEndOffset; |
| 547 |
#ifndef TXNSetSelection |
| 548 |
PyMac_PRECHECK(TXNSetSelection); |
| 549 |
#endif |
| 550 |
if (!PyArg_ParseTuple(_args, "ll", |
| 551 |
&iStartOffset, |
| 552 |
&iEndOffset)) |
| 553 |
return NULL; |
| 554 |
_err = TXNSetSelection(_self->ob_itself, |
| 555 |
iStartOffset, |
| 556 |
iEndOffset); |
| 557 |
if (_err != noErr) return PyMac_Error(_err); |
| 558 |
Py_INCREF(Py_None); |
| 559 |
_res = Py_None; |
| 560 |
return _res; |
| 561 |
} |
| 562 |
|
| 563 |
static PyObject *TXNObj_TXNCountRunsInRange(TXNObjectObject *_self, PyObject *_args) |
| 564 |
{ |
| 565 |
PyObject *_res = NULL; |
| 566 |
OSStatus _err; |
| 567 |
TXNOffset iStartOffset; |
| 568 |
TXNOffset iEndOffset; |
| 569 |
ItemCount oRunCount; |
| 570 |
#ifndef TXNCountRunsInRange |
| 571 |
PyMac_PRECHECK(TXNCountRunsInRange); |
| 572 |
#endif |
| 573 |
if (!PyArg_ParseTuple(_args, "ll", |
| 574 |
&iStartOffset, |
| 575 |
&iEndOffset)) |
| 576 |
return NULL; |
| 577 |
_err = TXNCountRunsInRange(_self->ob_itself, |
| 578 |
iStartOffset, |
| 579 |
iEndOffset, |
| 580 |
&oRunCount); |
| 581 |
if (_err != noErr) return PyMac_Error(_err); |
| 582 |
_res = Py_BuildValue("l", |
| 583 |
oRunCount); |
| 584 |
return _res; |
| 585 |
} |
| 586 |
|
| 587 |
static PyObject *TXNObj_TXNDataSize(TXNObjectObject *_self, PyObject *_args) |
| 588 |
{ |
| 589 |
PyObject *_res = NULL; |
| 590 |
ByteCount _rv; |
| 591 |
#ifndef TXNDataSize |
| 592 |
PyMac_PRECHECK(TXNDataSize); |
| 593 |
#endif |
| 594 |
if (!PyArg_ParseTuple(_args, "")) |
| 595 |
return NULL; |
| 596 |
_rv = TXNDataSize(_self->ob_itself); |
| 597 |
_res = Py_BuildValue("l", |
| 598 |
_rv); |
| 599 |
return _res; |
| 600 |
} |
| 601 |
|
| 602 |
static PyObject *TXNObj_TXNGetData(TXNObjectObject *_self, PyObject *_args) |
| 603 |
{ |
| 604 |
PyObject *_res = NULL; |
| 605 |
OSStatus _err; |
| 606 |
TXNOffset iStartOffset; |
| 607 |
TXNOffset iEndOffset; |
| 608 |
Handle oDataHandle; |
| 609 |
#ifndef TXNGetData |
| 610 |
PyMac_PRECHECK(TXNGetData); |
| 611 |
#endif |
| 612 |
if (!PyArg_ParseTuple(_args, "ll", |
| 613 |
&iStartOffset, |
| 614 |
&iEndOffset)) |
| 615 |
return NULL; |
| 616 |
_err = TXNGetData(_self->ob_itself, |
| 617 |
iStartOffset, |
| 618 |
iEndOffset, |
| 619 |
&oDataHandle); |
| 620 |
if (_err != noErr) return PyMac_Error(_err); |
| 621 |
_res = Py_BuildValue("O&", |
| 622 |
ResObj_New, oDataHandle); |
| 623 |
return _res; |
| 624 |
} |
| 625 |
|
| 626 |
static PyObject *TXNObj_TXNGetDataEncoded(TXNObjectObject *_self, PyObject *_args) |
| 627 |
{ |
| 628 |
PyObject *_res = NULL; |
| 629 |
OSStatus _err; |
| 630 |
TXNOffset iStartOffset; |
| 631 |
TXNOffset iEndOffset; |
| 632 |
Handle oDataHandle; |
| 633 |
TXNDataType iEncoding; |
| 634 |
#ifndef TXNGetDataEncoded |
| 635 |
PyMac_PRECHECK(TXNGetDataEncoded); |
| 636 |
#endif |
| 637 |
if (!PyArg_ParseTuple(_args, "llO&", |
| 638 |
&iStartOffset, |
| 639 |
&iEndOffset, |
| 640 |
PyMac_GetOSType, &iEncoding)) |
| 641 |
return NULL; |
| 642 |
_err = TXNGetDataEncoded(_self->ob_itself, |
| 643 |
iStartOffset, |
| 644 |
iEndOffset, |
| 645 |
&oDataHandle, |
| 646 |
iEncoding); |
| 647 |
if (_err != noErr) return PyMac_Error(_err); |
| 648 |
_res = Py_BuildValue("O&", |
| 649 |
ResObj_New, oDataHandle); |
| 650 |
return _res; |
| 651 |
} |
| 652 |
|
| 653 |
static PyObject *TXNObj_TXNSetDataFromFile(TXNObjectObject *_self, PyObject *_args) |
| 654 |
{ |
| 655 |
PyObject *_res = NULL; |
| 656 |
OSStatus _err; |
| 657 |
SInt16 iFileRefNum; |
| 658 |
OSType iFileType; |
| 659 |
ByteCount iFileLength; |
| 660 |
TXNOffset iStartOffset; |
| 661 |
TXNOffset iEndOffset; |
| 662 |
#ifndef TXNSetDataFromFile |
| 663 |
PyMac_PRECHECK(TXNSetDataFromFile); |
| 664 |
#endif |
| 665 |
if (!PyArg_ParseTuple(_args, "hO&lll", |
| 666 |
&iFileRefNum, |
| 667 |
PyMac_GetOSType, &iFileType, |
| 668 |
&iFileLength, |
| 669 |
&iStartOffset, |
| 670 |
&iEndOffset)) |
| 671 |
return NULL; |
| 672 |
_err = TXNSetDataFromFile(_self->ob_itself, |
| 673 |
iFileRefNum, |
| 674 |
iFileType, |
| 675 |
iFileLength, |
| 676 |
iStartOffset, |
| 677 |
iEndOffset); |
| 678 |
if (_err != noErr) return PyMac_Error(_err); |
| 679 |
Py_INCREF(Py_None); |
| 680 |
_res = Py_None; |
| 681 |
return _res; |
| 682 |
} |
| 683 |
|
| 684 |
static PyObject *TXNObj_TXNGetChangeCount(TXNObjectObject *_self, PyObject *_args) |
| 685 |
{ |
| 686 |
PyObject *_res = NULL; |
| 687 |
ItemCount _rv; |
| 688 |
#ifndef TXNGetChangeCount |
| 689 |
PyMac_PRECHECK(TXNGetChangeCount); |
| 690 |
#endif |
| 691 |
if (!PyArg_ParseTuple(_args, "")) |
| 692 |
return NULL; |
| 693 |
_rv = TXNGetChangeCount(_self->ob_itself); |
| 694 |
_res = Py_BuildValue("l", |
| 695 |
_rv); |
| 696 |
return _res; |
| 697 |
} |
| 698 |
|
| 699 |
static PyObject *TXNObj_TXNSave(TXNObjectObject *_self, PyObject *_args) |
| 700 |
{ |
| 701 |
PyObject *_res = NULL; |
| 702 |
OSStatus _err; |
| 703 |
TXNFileType iType; |
| 704 |
OSType iResType; |
| 705 |
TXNPermanentTextEncodingType iPermanentEncoding; |
| 706 |
FSSpec iFileSpecification; |
| 707 |
SInt16 iDataReference; |
| 708 |
SInt16 iResourceReference; |
| 709 |
#ifndef TXNSave |
| 710 |
PyMac_PRECHECK(TXNSave); |
| 711 |
#endif |
| 712 |
if (!PyArg_ParseTuple(_args, "O&O&lO&hh", |
| 713 |
PyMac_GetOSType, &iType, |
| 714 |
PyMac_GetOSType, &iResType, |
| 715 |
&iPermanentEncoding, |
| 716 |
PyMac_GetFSSpec, &iFileSpecification, |
| 717 |
&iDataReference, |
| 718 |
&iResourceReference)) |
| 719 |
return NULL; |
| 720 |
_err = TXNSave(_self->ob_itself, |
| 721 |
iType, |
| 722 |
iResType, |
| 723 |
iPermanentEncoding, |
| 724 |
&iFileSpecification, |
| 725 |
iDataReference, |
| 726 |
iResourceReference); |
| 727 |
if (_err != noErr) return PyMac_Error(_err); |
| 728 |
Py_INCREF(Py_None); |
| 729 |
_res = Py_None; |
| 730 |
return _res; |
| 731 |
} |
| 732 |
|
| 733 |
static PyObject *TXNObj_TXNRevert(TXNObjectObject *_self, PyObject *_args) |
| 734 |
{ |
| 735 |
PyObject *_res = NULL; |
| 736 |
OSStatus _err; |
| 737 |
#ifndef TXNRevert |
| 738 |
PyMac_PRECHECK(TXNRevert); |
| 739 |
#endif |
| 740 |
if (!PyArg_ParseTuple(_args, "")) |
| 741 |
return NULL; |
| 742 |
_err = TXNRevert(_self->ob_itself); |
| 743 |
if (_err != noErr) return PyMac_Error(_err); |
| 744 |
Py_INCREF(Py_None); |
| 745 |
_res = Py_None; |
| 746 |
return _res; |
| 747 |
} |
| 748 |
|
| 749 |
static PyObject *TXNObj_TXNPageSetup(TXNObjectObject *_self, PyObject *_args) |
| 750 |
{ |
| 751 |
PyObject *_res = NULL; |
| 752 |
OSStatus _err; |
| 753 |
#ifndef TXNPageSetup |
| 754 |
PyMac_PRECHECK(TXNPageSetup); |
| 755 |
#endif |
| 756 |
if (!PyArg_ParseTuple(_args, "")) |
| 757 |
return NULL; |
| 758 |
_err = TXNPageSetup(_self->ob_itself); |
| 759 |
if (_err != noErr) return PyMac_Error(_err); |
| 760 |
Py_INCREF(Py_None); |
| 761 |
_res = Py_None; |
| 762 |
return _res; |
| 763 |
} |
| 764 |
|
| 765 |
static PyObject *TXNObj_TXNPrint(TXNObjectObject *_self, PyObject *_args) |
| 766 |
{ |
| 767 |
PyObject *_res = NULL; |
| 768 |
OSStatus _err; |
| 769 |
#ifndef TXNPrint |
| 770 |
PyMac_PRECHECK(TXNPrint); |
| 771 |
#endif |
| 772 |
if (!PyArg_ParseTuple(_args, "")) |
| 773 |
return NULL; |
| 774 |
_err = TXNPrint(_self->ob_itself); |
| 775 |
if (_err != noErr) return PyMac_Error(_err); |
| 776 |
Py_INCREF(Py_None); |
| 777 |
_res = Py_None; |
| 778 |
return _res; |
| 779 |
} |
| 780 |
|
| 781 |
static PyObject *TXNObj_TXNGetViewRect(TXNObjectObject *_self, PyObject *_args) |
| 782 |
{ |
| 783 |
PyObject *_res = NULL; |
| 784 |
Rect oViewRect; |
| 785 |
#ifndef TXNGetViewRect |
| 786 |
PyMac_PRECHECK(TXNGetViewRect); |
| 787 |
#endif |
| 788 |
if (!PyArg_ParseTuple(_args, "")) |
| 789 |
return NULL; |
| 790 |
TXNGetViewRect(_self->ob_itself, |
| 791 |
&oViewRect); |
| 792 |
_res = Py_BuildValue("O&", |
| 793 |
PyMac_BuildRect, &oViewRect); |
| 794 |
return _res; |
| 795 |
} |
| 796 |
|
| 797 |
static PyObject *TXNObj_TXNSetViewRect(TXNObjectObject *_self, PyObject *_args) |
| 798 |
{ |
| 799 |
PyObject *_res = NULL; |
| 800 |
Rect iViewRect; |
| 801 |
#ifndef TXNSetViewRect |
| 802 |
PyMac_PRECHECK(TXNSetViewRect); |
| 803 |
#endif |
| 804 |
if (!PyArg_ParseTuple(_args, "O&", |
| 805 |
PyMac_GetRect, &iViewRect)) |
| 806 |
return NULL; |
| 807 |
TXNSetViewRect(_self->ob_itself, |
| 808 |
&iViewRect); |
| 809 |
Py_INCREF(Py_None); |
| 810 |
_res = Py_None; |
| 811 |
return _res; |
| 812 |
} |
| 813 |
|
| 814 |
static PyObject *TXNObj_TXNAttachObjectToWindow(TXNObjectObject *_self, PyObject *_args) |
| 815 |
{ |
| 816 |
PyObject *_res = NULL; |
| 817 |
OSStatus _err; |
| 818 |
GWorldPtr iWindow; |
| 819 |
Boolean iIsActualWindow; |
| 820 |
#ifndef TXNAttachObjectToWindow |
| 821 |
PyMac_PRECHECK(TXNAttachObjectToWindow); |
| 822 |
#endif |
| 823 |
if (!PyArg_ParseTuple(_args, "O&b", |
| 824 |
GWorldObj_Convert, &iWindow, |
| 825 |
&iIsActualWindow)) |
| 826 |
return NULL; |
| 827 |
_err = TXNAttachObjectToWindow(_self->ob_itself, |
| 828 |
iWindow, |
| 829 |
iIsActualWindow); |
| 830 |
if (_err != noErr) return PyMac_Error(_err); |
| 831 |
Py_INCREF(Py_None); |
| 832 |
_res = Py_None; |
| 833 |
return _res; |
| 834 |
} |
| 835 |
|
| 836 |
static PyObject *TXNObj_TXNIsObjectAttachedToWindow(TXNObjectObject *_self, PyObject *_args) |
| 837 |
{ |
| 838 |
PyObject *_res = NULL; |
| 839 |
Boolean _rv; |
| 840 |
#ifndef TXNIsObjectAttachedToWindow |
| 841 |
PyMac_PRECHECK(TXNIsObjectAttachedToWindow); |
| 842 |
#endif |
| 843 |
if (!PyArg_ParseTuple(_args, "")) |
| 844 |
return NULL; |
| 845 |
_rv = TXNIsObjectAttachedToWindow(_self->ob_itself); |
| 846 |
_res = Py_BuildValue("b", |
| 847 |
_rv); |
| 848 |
return _res; |
| 849 |
} |
| 850 |
|
| 851 |
static PyObject *TXNObj_TXNDragTracker(TXNObjectObject *_self, PyObject *_args) |
| 852 |
{ |
| 853 |
PyObject *_res = NULL; |
| 854 |
OSErr _err; |
| 855 |
TXNFrameID iTXNFrameID; |
| 856 |
DragTrackingMessage iMessage; |
| 857 |
WindowPtr iWindow; |
| 858 |
DragReference iDragReference; |
| 859 |
Boolean iDifferentObjectSameWindow; |
| 860 |
#ifndef TXNDragTracker |
| 861 |
PyMac_PRECHECK(TXNDragTracker); |
| 862 |
#endif |
| 863 |
if (!PyArg_ParseTuple(_args, "lhO&O&b", |
| 864 |
&iTXNFrameID, |
| 865 |
&iMessage, |
| 866 |
WinObj_Convert, &iWindow, |
| 867 |
DragObj_Convert, &iDragReference, |
| 868 |
&iDifferentObjectSameWindow)) |
| 869 |
return NULL; |
| 870 |
_err = TXNDragTracker(_self->ob_itself, |
| 871 |
iTXNFrameID, |
| 872 |
iMessage, |
| 873 |
iWindow, |
| 874 |
iDragReference, |
| 875 |
iDifferentObjectSameWindow); |
| 876 |
if (_err != noErr) return PyMac_Error(_err); |
| 877 |
Py_INCREF(Py_None); |
| 878 |
_res = Py_None; |
| 879 |
return _res; |
| 880 |
} |
| 881 |
|
| 882 |
static PyObject *TXNObj_TXNDragReceiver(TXNObjectObject *_self, PyObject *_args) |
| 883 |
{ |
| 884 |
PyObject *_res = NULL; |
| 885 |
OSErr _err; |
| 886 |
TXNFrameID iTXNFrameID; |
| 887 |
WindowPtr iWindow; |
| 888 |
DragReference iDragReference; |
| 889 |
Boolean iDifferentObjectSameWindow; |
| 890 |
#ifndef TXNDragReceiver |
| 891 |
PyMac_PRECHECK(TXNDragReceiver); |
| 892 |
#endif |
| 893 |
if (!PyArg_ParseTuple(_args, "lO&O&b", |
| 894 |
&iTXNFrameID, |
| 895 |
WinObj_Convert, &iWindow, |
| 896 |
DragObj_Convert, &iDragReference, |
| 897 |
&iDifferentObjectSameWindow)) |
| 898 |
return NULL; |
| 899 |
_err = TXNDragReceiver(_self->ob_itself, |
| 900 |
iTXNFrameID, |
| 901 |
iWindow, |
| 902 |
iDragReference, |
| 903 |
iDifferentObjectSameWindow); |
| 904 |
if (_err != noErr) return PyMac_Error(_err); |
| 905 |
Py_INCREF(Py_None); |
| 906 |
_res = Py_None; |
| 907 |
return _res; |
| 908 |
} |
| 909 |
|
| 910 |
static PyObject *TXNObj_TXNActivate(TXNObjectObject *_self, PyObject *_args) |
| 911 |
{ |
| 912 |
PyObject *_res = NULL; |
| 913 |
OSStatus _err; |
| 914 |
TXNFrameID iTXNFrameID; |
| 915 |
TXNScrollBarState iActiveState; |
| 916 |
#ifndef TXNActivate |
| 917 |
PyMac_PRECHECK(TXNActivate); |
| 918 |
#endif |
| 919 |
if (!PyArg_ParseTuple(_args, "ll", |
| 920 |
&iTXNFrameID, |
| 921 |
&iActiveState)) |
| 922 |
return NULL; |
| 923 |
_err = TXNActivate(_self->ob_itself, |
| 924 |
iTXNFrameID, |
| 925 |
iActiveState); |
| 926 |
if (_err != noErr) return PyMac_Error(_err); |
| 927 |
Py_INCREF(Py_None); |
| 928 |
_res = Py_None; |
| 929 |
return _res; |
| 930 |
} |
| 931 |
|
| 932 |
static PyObject *TXNObj_TXNEchoMode(TXNObjectObject *_self, PyObject *_args) |
| 933 |
{ |
| 934 |
PyObject *_res = NULL; |
| 935 |
OSStatus _err; |
| 936 |
UniChar iEchoCharacter; |
| 937 |
TextEncoding iEncoding; |
| 938 |
Boolean iOn; |
| 939 |
#ifndef TXNEchoMode |
| 940 |
PyMac_PRECHECK(TXNEchoMode); |
| 941 |
#endif |
| 942 |
if (!PyArg_ParseTuple(_args, "hlb", |
| 943 |
&iEchoCharacter, |
| 944 |
&iEncoding, |
| 945 |
&iOn)) |
| 946 |
return NULL; |
| 947 |
_err = TXNEchoMode(_self->ob_itself, |
| 948 |
iEchoCharacter, |
| 949 |
iEncoding, |
| 950 |
iOn); |
| 951 |
if (_err != noErr) return PyMac_Error(_err); |
| 952 |
Py_INCREF(Py_None); |
| 953 |
_res = Py_None; |
| 954 |
return _res; |
| 955 |
} |
| 956 |
|
| 957 |
static PyObject *TXNObj_TXNDoFontMenuSelection(TXNObjectObject *_self, PyObject *_args) |
| 958 |
{ |
| 959 |
PyObject *_res = NULL; |
| 960 |
OSStatus _err; |
| 961 |
TXNFontMenuObject iTXNFontMenuObject; |
| 962 |
SInt16 iMenuID; |
| 963 |
SInt16 iMenuItem; |
| 964 |
#ifndef TXNDoFontMenuSelection |
| 965 |
PyMac_PRECHECK(TXNDoFontMenuSelection); |
| 966 |
#endif |
| 967 |
if (!PyArg_ParseTuple(_args, "O&hh", |
| 968 |
TXNFontMenuObj_Convert, &iTXNFontMenuObject, |
| 969 |
&iMenuID, |
| 970 |
&iMenuItem)) |
| 971 |
return NULL; |
| 972 |
_err = TXNDoFontMenuSelection(_self->ob_itself, |
| 973 |
iTXNFontMenuObject, |
| 974 |
iMenuID, |
| 975 |
iMenuItem); |
| 976 |
if (_err != noErr) return PyMac_Error(_err); |
| 977 |
Py_INCREF(Py_None); |
| 978 |
_res = Py_None; |
| 979 |
return _res; |
| 980 |
} |
| 981 |
|
| 982 |
static PyObject *TXNObj_TXNPrepareFontMenu(TXNObjectObject *_self, PyObject *_args) |
| 983 |
{ |
| 984 |
PyObject *_res = NULL; |
| 985 |
OSStatus _err; |
| 986 |
TXNFontMenuObject iTXNFontMenuObject; |
| 987 |
#ifndef TXNPrepareFontMenu |
| 988 |
PyMac_PRECHECK(TXNPrepareFontMenu); |
| 989 |
#endif |
| 990 |
if (!PyArg_ParseTuple(_args, "O&", |
| 991 |
TXNFontMenuObj_Convert, &iTXNFontMenuObject)) |
| 992 |
return NULL; |
| 993 |
_err = TXNPrepareFontMenu(_self->ob_itself, |
| 994 |
iTXNFontMenuObject); |
| 995 |
if (_err != noErr) return PyMac_Error(_err); |
| 996 |
Py_INCREF(Py_None); |
| 997 |
_res = Py_None; |
| 998 |
return _res; |
| 999 |
} |
| 1000 |
|
| 1001 |
static PyObject *TXNObj_TXNPointToOffset(TXNObjectObject *_self, PyObject *_args) |
| 1002 |
{ |
| 1003 |
PyObject *_res = NULL; |
| 1004 |
OSStatus _err; |
| 1005 |
Point iPoint; |
| 1006 |
TXNOffset oOffset; |
| 1007 |
#ifndef TXNPointToOffset |
| 1008 |
PyMac_PRECHECK(TXNPointToOffset); |
| 1009 |
#endif |
| 1010 |
if (!PyArg_ParseTuple(_args, "O&", |
| 1011 |
PyMac_GetPoint, &iPoint)) |
| 1012 |
return NULL; |
| 1013 |
_err = TXNPointToOffset(_self->ob_itself, |
| 1014 |
iPoint, |
| 1015 |
&oOffset); |
| 1016 |
if (_err != noErr) return PyMac_Error(_err); |
| 1017 |
_res = Py_BuildValue("l", |
| 1018 |
oOffset); |
| 1019 |
return _res; |
| 1020 |
} |
| 1021 |
|
| 1022 |
static PyObject *TXNObj_TXNOffsetToPoint(TXNObjectObject *_self, PyObject *_args) |
| 1023 |
{ |
| 1024 |
PyObject *_res = NULL; |
| 1025 |
OSStatus _err; |
| 1026 |
TXNOffset iOffset; |
| 1027 |
Point oPoint; |
| 1028 |
#ifndef TXNOffsetToPoint |
| 1029 |
PyMac_PRECHECK(TXNOffsetToPoint); |
| 1030 |
#endif |
| 1031 |
if (!PyArg_ParseTuple(_args, "l", |
| 1032 |
&iOffset)) |
| 1033 |
return NULL; |
| 1034 |
_err = TXNOffsetToPoint(_self->ob_itself, |
| 1035 |
iOffset, |
| 1036 |
&oPoint); |
| 1037 |
if (_err != noErr) return PyMac_Error(_err); |
| 1038 |
_res = Py_BuildValue("O&", |
| 1039 |
PyMac_BuildPoint, oPoint); |
| 1040 |
return _res; |
| 1041 |
} |
| 1042 |
|
| 1043 |
static PyObject *TXNObj_TXNGetLineCount(TXNObjectObject *_self, PyObject *_args) |
| 1044 |
{ |
| 1045 |
PyObject *_res = NULL; |
| 1046 |
OSStatus _err; |
| 1047 |
ItemCount oLineTotal; |
| 1048 |
#ifndef TXNGetLineCount |
| 1049 |
PyMac_PRECHECK(TXNGetLineCount); |
| 1050 |
#endif |
| 1051 |
if (!PyArg_ParseTuple(_args, "")) |
| 1052 |
return NULL; |
| 1053 |
_err = TXNGetLineCount(_self->ob_itself, |
| 1054 |
&oLineTotal); |
| 1055 |
if (_err != noErr) return PyMac_Error(_err); |
| 1056 |
_res = Py_BuildValue("l", |
| 1057 |
oLineTotal); |
| 1058 |
return _res; |
| 1059 |
} |
| 1060 |
|
| 1061 |
static PyObject *TXNObj_TXNGetLineMetrics(TXNObjectObject *_self, PyObject *_args) |
| 1062 |
{ |
| 1063 |
PyObject *_res = NULL; |
| 1064 |
OSStatus _err; |
| 1065 |
UInt32 iLineNumber; |
| 1066 |
Fixed oLineWidth; |
| 1067 |
Fixed oLineHeight; |
| 1068 |
#ifndef TXNGetLineMetrics |
| 1069 |
PyMac_PRECHECK(TXNGetLineMetrics); |
| 1070 |
#endif |
| 1071 |
if (!PyArg_ParseTuple(_args, "l", |
| 1072 |
&iLineNumber)) |
| 1073 |
return NULL; |
| 1074 |
_err = TXNGetLineMetrics(_self->ob_itself, |
| 1075 |
iLineNumber, |
| 1076 |
&oLineWidth, |
| 1077 |
&oLineHeight); |
| 1078 |
if (_err != noErr) return PyMac_Error(_err); |
| 1079 |
_res = Py_BuildValue("O&O&", |
| 1080 |
PyMac_BuildFixed, oLineWidth, |
| 1081 |
PyMac_BuildFixed, oLineHeight); |
| 1082 |
return _res; |
| 1083 |
} |
| 1084 |
|
| 1085 |
static PyObject *TXNObj_TXNIsObjectAttachedToSpecificWindow(TXNObjectObject *_self, PyObject *_args) |
| 1086 |
{ |
| 1087 |
PyObject *_res = NULL; |
| 1088 |
OSStatus _err; |
| 1089 |
WindowPtr iWindow; |
| 1090 |
Boolean oAttached; |
| 1091 |
#ifndef TXNIsObjectAttachedToSpecificWindow |
| 1092 |
PyMac_PRECHECK(TXNIsObjectAttachedToSpecificWindow); |
| 1093 |
#endif |
| 1094 |
if (!PyArg_ParseTuple(_args, "O&", |
| 1095 |
WinObj_Convert, &iWindow)) |
| 1096 |
return NULL; |
| 1097 |
_err = TXNIsObjectAttachedToSpecificWindow(_self->ob_itself, |
| 1098 |
iWindow, |
| 1099 |
&oAttached); |
| 1100 |
if (_err != noErr) return PyMac_Error(_err); |
| 1101 |
_res = Py_BuildValue("b", |
| 1102 |
oAttached); |
| 1103 |
return _res; |
| 1104 |
} |
| 1105 |
|
| 1106 |
static PyObject *TXNObj_TXNRecalcTextLayout(TXNObjectObject *_self, PyObject *_args) |
| 1107 |
{ |
| 1108 |
PyObject *_res = NULL; |
| 1109 |
#ifndef TXNRecalcTextLayout |
| 1110 |
PyMac_PRECHECK(TXNRecalcTextLayout); |
| 1111 |
#endif |
| 1112 |
if (!PyArg_ParseTuple(_args, "")) |
| 1113 |
return NULL; |
| 1114 |
TXNRecalcTextLayout(_self->ob_itself); |
| 1115 |
Py_INCREF(Py_None); |
| 1116 |
_res = Py_None; |
| 1117 |
return _res; |
| 1118 |
} |
| 1119 |
|
| 1120 |
static PyMethodDef TXNObj_methods[] = { |
| 1121 |
{"TXNDeleteObject", (PyCFunction)TXNObj_TXNDeleteObject, 1, |
| 1122 |
PyDoc_STR("() -> None")}, |
| 1123 |
{"TXNResizeFrame", (PyCFunction)TXNObj_TXNResizeFrame, 1, |
| 1124 |
PyDoc_STR("(UInt32 iWidth, UInt32 iHeight, TXNFrameID iTXNFrameID) -> None")}, |
| 1125 |
{"TXNSetFrameBounds", (PyCFunction)TXNObj_TXNSetFrameBounds, 1, |
| 1126 |
PyDoc_STR("(SInt32 iTop, SInt32 iLeft, SInt32 iBottom, SInt32 iRight, TXNFrameID iTXNFrameID) -> None")}, |
| 1127 |
{"TXNKeyDown", (PyCFunction)TXNObj_TXNKeyDown, 1, |
| 1128 |
PyDoc_STR("(EventRecord iEvent) -> None")}, |
| 1129 |
{"TXNAdjustCursor", (PyCFunction)TXNObj_TXNAdjustCursor, 1, |
| 1130 |
PyDoc_STR("(RgnHandle ioCursorRgn) -> None")}, |
| 1131 |
{"TXNClick", (PyCFunction)TXNObj_TXNClick, 1, |
| 1132 |
PyDoc_STR("(EventRecord iEvent) -> None")}, |
| 1133 |
{"TXNSelectAll", (PyCFunction)TXNObj_TXNSelectAll, 1, |
| 1134 |
PyDoc_STR("() -> None")}, |
| 1135 |
{"TXNFocus", (PyCFunction)TXNObj_TXNFocus, 1, |
| 1136 |
PyDoc_STR("(Boolean iBecomingFocused) -> None")}, |
| 1137 |
{"TXNUpdate", (PyCFunction)TXNObj_TXNUpdate, 1, |
| 1138 |
PyDoc_STR("() -> None")}, |
| 1139 |
{"TXNDraw", (PyCFunction)TXNObj_TXNDraw, 1, |
| 1140 |
PyDoc_STR("(GWorldPtr iDrawPort) -> None")}, |
| 1141 |
{"TXNForceUpdate", (PyCFunction)TXNObj_TXNForceUpdate, 1, |
| 1142 |
PyDoc_STR("() -> None")}, |
| 1143 |
{"TXNGetSleepTicks", (PyCFunction)TXNObj_TXNGetSleepTicks, 1, |
| 1144 |
PyDoc_STR("() -> (UInt32 _rv)")}, |
| 1145 |
{"TXNIdle", (PyCFunction)TXNObj_TXNIdle, 1, |
| 1146 |
PyDoc_STR("() -> None")}, |
| 1147 |
{"TXNGrowWindow", (PyCFunction)TXNObj_TXNGrowWindow, 1, |
| 1148 |
PyDoc_STR("(EventRecord iEvent) -> None")}, |
| 1149 |
{"TXNZoomWindow", (PyCFunction)TXNObj_TXNZoomWindow, 1, |
| 1150 |
PyDoc_STR("(SInt16 iPart) -> None")}, |
| 1151 |
{"TXNCanUndo", (PyCFunction)TXNObj_TXNCanUndo, 1, |
| 1152 |
PyDoc_STR("() -> (Boolean _rv, TXNActionKey oTXNActionKey)")}, |
| 1153 |
{"TXNUndo", (PyCFunction)TXNObj_TXNUndo, 1, |
| 1154 |
PyDoc_STR("() -> None")}, |
| 1155 |
{"TXNCanRedo", (PyCFunction)TXNObj_TXNCanRedo, 1, |
| 1156 |
PyDoc_STR("() -> (Boolean _rv, TXNActionKey oTXNActionKey)")}, |
| 1157 |
{"TXNRedo", (PyCFunction)TXNObj_TXNRedo, 1, |
| 1158 |
PyDoc_STR("() -> None")}, |
| 1159 |
{"TXNCut", (PyCFunction)TXNObj_TXNCut, 1, |
| 1160 |
PyDoc_STR("() -> None")}, |
| 1161 |
{"TXNCopy", (PyCFunction)TXNObj_TXNCopy, 1, |
| 1162 |
PyDoc_STR("() -> None")}, |
| 1163 |
{"TXNPaste", (PyCFunction)TXNObj_TXNPaste, 1, |
| 1164 |
PyDoc_STR("() -> None")}, |
| 1165 |
{"TXNClear", (PyCFunction)TXNObj_TXNClear, 1, |
| 1166 |
PyDoc_STR("() -> None")}, |
| 1167 |
{"TXNGetSelection", (PyCFunction)TXNObj_TXNGetSelection, 1, |
| 1168 |
PyDoc_STR("() -> (TXNOffset oStartOffset, TXNOffset oEndOffset)")}, |
| 1169 |
{"TXNShowSelection", (PyCFunction)TXNObj_TXNShowSelection, 1, |
| 1170 |
PyDoc_STR("(Boolean iShowEnd) -> None")}, |
| 1171 |
{"TXNIsSelectionEmpty", (PyCFunction)TXNObj_TXNIsSelectionEmpty, 1, |
| 1172 |
PyDoc_STR("() -> (Boolean _rv)")}, |
| 1173 |
{"TXNSetSelection", (PyCFunction)TXNObj_TXNSetSelection, 1, |
| 1174 |
PyDoc_STR("(TXNOffset iStartOffset, TXNOffset iEndOffset) -> None")}, |
| 1175 |
{"TXNCountRunsInRange", (PyCFunction)TXNObj_TXNCountRunsInRange, 1, |
| 1176 |
PyDoc_STR("(TXNOffset iStartOffset, TXNOffset iEndOffset) -> (ItemCount oRunCount)")}, |
| 1177 |
{"TXNDataSize", (PyCFunction)TXNObj_TXNDataSize, 1, |
| 1178 |
PyDoc_STR("() -> (ByteCount _rv)")}, |
| 1179 |
{"TXNGetData", (PyCFunction)TXNObj_TXNGetData, 1, |
| 1180 |
PyDoc_STR("(TXNOffset iStartOffset, TXNOffset iEndOffset) -> (Handle oDataHandle)")}, |
| 1181 |
{"TXNGetDataEncoded", (PyCFunction)TXNObj_TXNGetDataEncoded, 1, |
| 1182 |
PyDoc_STR("(TXNOffset iStartOffset, TXNOffset iEndOffset, TXNDataType iEncoding) -> (Handle oDataHandle)")}, |
| 1183 |
{"TXNSetDataFromFile", (PyCFunction)TXNObj_TXNSetDataFromFile, 1, |
| 1184 |
PyDoc_STR("(SInt16 iFileRefNum, OSType iFileType, ByteCount iFileLength, TXNOffset iStartOffset, TXNOffset iEndOffset) -> None")}, |
| 1185 |
{"TXNGetChangeCount", (PyCFunction)TXNObj_TXNGetChangeCount, 1, |
| 1186 |
PyDoc_STR("() -> (ItemCount _rv)")}, |
| 1187 |
{"TXNSave", (PyCFunction)TXNObj_TXNSave, 1, |
| 1188 |
PyDoc_STR("(TXNFileType iType, OSType iResType, TXNPermanentTextEncodingType iPermanentEncoding, FSSpec iFileSpecification, SInt16 iDataReference, SInt16 iResourceReference) -> None")}, |
| 1189 |
{"TXNRevert", (PyCFunction)TXNObj_TXNRevert, 1, |
| 1190 |
PyDoc_STR("() -> None")}, |
| 1191 |
{"TXNPageSetup", (PyCFunction)TXNObj_TXNPageSetup, 1, |
| 1192 |
PyDoc_STR("() -> None")}, |
| 1193 |
{"TXNPrint", (PyCFunction)TXNObj_TXNPrint, 1, |
| 1194 |
PyDoc_STR("() -> None")}, |
| 1195 |
{"TXNGetViewRect", (PyCFunction)TXNObj_TXNGetViewRect, 1, |
| 1196 |
PyDoc_STR("() -> (Rect oViewRect)")}, |
| 1197 |
{"TXNSetViewRect", (PyCFunction)TXNObj_TXNSetViewRect, 1, |
| 1198 |
PyDoc_STR("(Rect iViewRect) -> None")}, |
| 1199 |
{"TXNAttachObjectToWindow", (PyCFunction)TXNObj_TXNAttachObjectToWindow, 1, |
| 1200 |
PyDoc_STR("(GWorldPtr iWindow, Boolean iIsActualWindow) -> None")}, |
| 1201 |
{"TXNIsObjectAttachedToWindow", (PyCFunction)TXNObj_TXNIsObjectAttachedToWindow, 1, |
| 1202 |
PyDoc_STR("() -> (Boolean _rv)")}, |
| 1203 |
{"TXNDragTracker", (PyCFunction)TXNObj_TXNDragTracker, 1, |
| 1204 |
PyDoc_STR("(TXNFrameID iTXNFrameID, DragTrackingMessage iMessage, WindowPtr iWindow, DragReference iDragReference, Boolean iDifferentObjectSameWindow) -> None")}, |
| 1205 |
{"TXNDragReceiver", (PyCFunction)TXNObj_TXNDragReceiver, 1, |
| 1206 |
PyDoc_STR("(TXNFrameID iTXNFrameID, WindowPtr iWindow, DragReference iDragReference, Boolean iDifferentObjectSameWindow) -> None")}, |
| 1207 |
{"TXNActivate", (PyCFunction)TXNObj_TXNActivate, 1, |
| 1208 |
PyDoc_STR("(TXNFrameID iTXNFrameID, TXNScrollBarState iActiveState) -> None")}, |
| 1209 |
{"TXNEchoMode", (PyCFunction)TXNObj_TXNEchoMode, 1, |
| 1210 |
PyDoc_STR("(UniChar iEchoCharacter, TextEncoding iEncoding, Boolean iOn) -> None")}, |
| 1211 |
{"TXNDoFontMenuSelection", (PyCFunction)TXNObj_TXNDoFontMenuSelection, 1, |
| 1212 |
PyDoc_STR("(TXNFontMenuObject iTXNFontMenuObject, SInt16 iMenuID, SInt16 iMenuItem) -> None")}, |
| 1213 |
{"TXNPrepareFontMenu", (PyCFunction)TXNObj_TXNPrepareFontMenu, 1, |
| 1214 |
PyDoc_STR("(TXNFontMenuObject iTXNFontMenuObject) -> None")}, |
| 1215 |
{"TXNPointToOffset", (PyCFunction)TXNObj_TXNPointToOffset, 1, |
| 1216 |
PyDoc_STR("(Point iPoint) -> (TXNOffset oOffset)")}, |
| 1217 |
{"TXNOffsetToPoint", (PyCFunction)TXNObj_TXNOffsetToPoint, 1, |
| 1218 |
PyDoc_STR("(TXNOffset iOffset) -> (Point oPoint)")}, |
| 1219 |
{"TXNGetLineCount", (PyCFunction)TXNObj_TXNGetLineCount, 1, |
| 1220 |
PyDoc_STR("() -> (ItemCount oLineTotal)")}, |
| 1221 |
{"TXNGetLineMetrics", (PyCFunction)TXNObj_TXNGetLineMetrics, 1, |
| 1222 |
PyDoc_STR("(UInt32 iLineNumber) -> (Fixed oLineWidth, Fixed oLineHeight)")}, |
| 1223 |
{"TXNIsObjectAttachedToSpecificWindow", (PyCFunction)TXNObj_TXNIsObjectAttachedToSpecificWindow, 1, |
| 1224 |
PyDoc_STR("(WindowPtr iWindow) -> (Boolean oAttached)")}, |
| 1225 |
{"TXNRecalcTextLayout", (PyCFunction)TXNObj_TXNRecalcTextLayout, 1, |
| 1226 |
PyDoc_STR("() -> None")}, |
| 1227 |
{NULL, NULL, 0} |
| 1228 |
}; |
| 1229 |
|
| 1230 |
#define TXNObj_getsetlist NULL |
| 1231 |
|
| 1232 |
|
| 1233 |
#define TXNObj_compare NULL |
| 1234 |
|
| 1235 |
#define TXNObj_repr NULL |
| 1236 |
|
| 1237 |
#define TXNObj_hash NULL |
| 1238 |
#define TXNObj_tp_init 0 |
| 1239 |
|
| 1240 |
#define TXNObj_tp_alloc PyType_GenericAlloc |
| 1241 |
|
| 1242 |
static PyObject *TXNObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds) |
| 1243 |
{ |
| 1244 |
PyObject *_self; |
| 1245 |
TXNObject itself; |
| 1246 |
char *kw[] = {"itself", 0}; |
| 1247 |
|
| 1248 |
if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, TXNObj_Convert, &itself)) return NULL; |
| 1249 |
if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL; |
| 1250 |
((TXNObjectObject *)_self)->ob_itself = itself; |
| 1251 |
return _self; |
| 1252 |
} |
| 1253 |
|
| 1254 |
#define TXNObj_tp_free PyObject_Del |
| 1255 |
|
| 1256 |
|
| 1257 |
PyTypeObject TXNObject_Type = { |
| 1258 |
PyObject_HEAD_INIT(NULL) |
| 1259 |
0, |
| 1260 |
"_Mlte.TXNObject", |
| 1261 |
sizeof(TXNObjectObject), |
| 1262 |
0, |
| 1263 |
|
| 1264 |
(destructor) TXNObj_dealloc, |
| 1265 |
0, |
| 1266 |
(getattrfunc)0, |
| 1267 |
(setattrfunc)0, |
| 1268 |
(cmpfunc) TXNObj_compare, |
| 1269 |
(reprfunc) TXNObj_repr, |
| 1270 |
(PyNumberMethods *)0, |
| 1271 |
(PySequenceMethods *)0, |
| 1272 |
(PyMappingMethods *)0, |
| 1273 |
(hashfunc) TXNObj_hash, |
| 1274 |
0, |
| 1275 |
0, |
| 1276 |
PyObject_GenericGetAttr, |
| 1277 |
PyObject_GenericSetAttr, |
| 1278 |
0, |
| 1279 |
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, |
| 1280 |
0, |
| 1281 |
0, |
| 1282 |
0, |
| 1283 |
0, |
| 1284 |
0, |
| 1285 |
0, |
| 1286 |
0, |
| 1287 |
TXNObj_methods, |
| 1288 |
0, |
| 1289 |
TXNObj_getsetlist, |
| 1290 |
0, |
| 1291 |
0, |
| 1292 |
0, |
| 1293 |
0, |
| 1294 |
0, |
| 1295 |
TXNObj_tp_init, |
| 1296 |
TXNObj_tp_alloc, |
| 1297 |
TXNObj_tp_new, |
| 1298 |
TXNObj_tp_free, |
| 1299 |
}; |
| 1300 |
|
| 1301 |
|
| 1302 |
|
| 1303 |
|
| 1304 |
|
| 1305 |
|
| 1306 |
PyTypeObject TXNFontMenuObject_Type; |
| 1307 |
|
| 1308 |
#define TXNFontMenuObj_Check(x) ((x)->ob_type == &TXNFontMenuObject_Type || PyObject_TypeCheck((x), &TXNFontMenuObject_Type)) |
| 1309 |
|
| 1310 |
typedef struct TXNFontMenuObjectObject { |
| 1311 |
PyObject_HEAD |
| 1312 |
TXNFontMenuObject ob_itself; |
| 1313 |
} TXNFontMenuObjectObject; |
| 1314 |
|
| 1315 |
PyObject *TXNFontMenuObj_New(TXNFontMenuObject itself) |
| 1316 |
{ |
| 1317 |
TXNFontMenuObjectObject *it; |
| 1318 |
if (itself == NULL) return PyMac_Error(resNotFound); |
| 1319 |
it = PyObject_NEW(TXNFontMenuObjectObject, &TXNFontMenuObject_Type); |
| 1320 |
if (it == NULL) return NULL; |
| 1321 |
it->ob_itself = itself; |
| 1322 |
return (PyObject *)it; |
| 1323 |
} |
| 1324 |
|
| 1325 |
int TXNFontMenuObj_Convert(PyObject *v, TXNFontMenuObject *p_itself) |
| 1326 |
{ |
| 1327 |
if (!TXNFontMenuObj_Check(v)) |
| 1328 |
{ |
| 1329 |
PyErr_SetString(PyExc_TypeError, "TXNFontMenuObject required"); |
| 1330 |
return 0; |
| 1331 |
} |
| 1332 |
*p_itself = ((TXNFontMenuObjectObject *)v)->ob_itself; |
| 1333 |
return 1; |
| 1334 |
} |
| 1335 |
|
| 1336 |
static void TXNFontMenuObj_dealloc(TXNFontMenuObjectObject *self) |
| 1337 |
{ |
| 1338 |
|
| 1339 |
self->ob_type->tp_free((PyObject *)self); |
| 1340 |
} |
| 1341 |
|
| 1342 |
static PyObject *TXNFontMenuObj_TXNGetFontMenuHandle(TXNFontMenuObjectObject *_self, PyObject *_args) |
| 1343 |
{ |
| 1344 |
PyObject *_res = NULL; |
| 1345 |
OSStatus _err; |
| 1346 |
MenuHandle oFontMenuHandle; |
| 1347 |
#ifndef TXNGetFontMenuHandle |
| 1348 |
PyMac_PRECHECK(TXNGetFontMenuHandle); |
| 1349 |
#endif |
| 1350 |
if (!PyArg_ParseTuple(_args, "")) |
| 1351 |
return NULL; |
| 1352 |
_err = TXNGetFontMenuHandle(_self->ob_itself, |
| 1353 |
&oFontMenuHandle); |
| 1354 |
if (_err != noErr) return PyMac_Error(_err); |
| 1355 |
_res = Py_BuildValue("O&", |
| 1356 |
MenuObj_New, oFontMenuHandle); |
| 1357 |
return _res; |
| 1358 |
} |
| 1359 |
|
| 1360 |
static PyObject *TXNFontMenuObj_TXNDisposeFontMenuObject(TXNFontMenuObjectObject *_self, PyObject *_args) |
| 1361 |
{ |
| 1362 |
PyObject *_res = NULL; |
| 1363 |
OSStatus _err; |
| 1364 |
#ifndef TXNDisposeFontMenuObject |
| 1365 |
PyMac_PRECHECK(TXNDisposeFontMenuObject); |
| 1366 |
#endif |
| 1367 |
if (!PyArg_ParseTuple(_args, "")) |
| 1368 |
return NULL; |
| 1369 |
_err = TXNDisposeFontMenuObject(_self->ob_itself); |
| 1370 |
if (_err != noErr) return PyMac_Error(_err); |
| 1371 |
Py_INCREF(Py_None); |
| 1372 |
_res = Py_None; |
| 1373 |
return _res; |
| 1374 |
} |
| 1375 |
|
| 1376 |
static PyMethodDef TXNFontMenuObj_methods[] = { |
| 1377 |
{"TXNGetFontMenuHandle", (PyCFunction)TXNFontMenuObj_TXNGetFontMenuHandle, 1, |
| 1378 |
PyDoc_STR("() -> (MenuHandle oFontMenuHandle)")}, |
| 1379 |
{"TXNDisposeFontMenuObject", (PyCFunction)TXNFontMenuObj_TXNDisposeFontMenuObject, 1, |
| 1380 |
PyDoc_STR("() -> None")}, |
| 1381 |
{NULL, NULL, 0} |
| 1382 |
}; |
| 1383 |
|
| 1384 |
#define TXNFontMenuObj_getsetlist NULL |
| 1385 |
|
| 1386 |
|
| 1387 |
#define TXNFontMenuObj_compare NULL |
| 1388 |
|
| 1389 |
#define TXNFontMenuObj_repr NULL |
| 1390 |
|
| 1391 |
#define TXNFontMenuObj_hash NULL |
| 1392 |
#define TXNFontMenuObj_tp_init 0 |
| 1393 |
|
| 1394 |
#define TXNFontMenuObj_tp_alloc PyType_GenericAlloc |
| 1395 |
|
| 1396 |
static PyObject *TXNFontMenuObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds) |
| 1397 |
{ |
| 1398 |
PyObject *_self; |
| 1399 |
TXNFontMenuObject itself; |
| 1400 |
char *kw[] = {"itself", 0}; |
| 1401 |
|
| 1402 |
if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, TXNFontMenuObj_Convert, &itself)) return NULL; |
| 1403 |
if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL; |
| 1404 |
((TXNFontMenuObjectObject *)_self)->ob_itself = itself; |
| 1405 |
return _self; |
| 1406 |
} |
| 1407 |
|
| 1408 |
#define TXNFontMenuObj_tp_free PyObject_Del |
| 1409 |
|
| 1410 |
|
| 1411 |
PyTypeObject TXNFontMenuObject_Type = { |
| 1412 |
PyObject_HEAD_INIT(NULL) |
| 1413 |
0, |
| 1414 |
"_Mlte.TXNFontMenuObject", |
| 1415 |
sizeof(TXNFontMenuObjectObject), |
| 1416 |
0, |
| 1417 |
|
| 1418 |
(destructor) TXNFontMenuObj_dealloc, |
| 1419 |
0, |
| 1420 |
(getattrfunc)0, |
| 1421 |
(setattrfunc)0, |
| 1422 |
(cmpfunc) TXNFontMenuObj_compare, |
| 1423 |
(reprfunc) TXNFontMenuObj_repr, |
| 1424 |
(PyNumberMethods *)0, |
| 1425 |
(PySequenceMethods *)0, |
| 1426 |
(PyMappingMethods *)0, |
| 1427 |
(hashfunc) TXNFontMenuObj_hash, |
| 1428 |
0, |
| 1429 |
0, |
| 1430 |
PyObject_GenericGetAttr, |
| 1431 |
PyObject_GenericSetAttr, |
| 1432 |
0, |
| 1433 |
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, |
| 1434 |
0, |
| 1435 |
0, |
| 1436 |
0, |
| 1437 |
0, |
| 1438 |
0, |
| 1439 |
0, |
| 1440 |
0, |
| 1441 |
TXNFontMenuObj_methods, |
| 1442 |
0, |
| 1443 |
TXNFontMenuObj_getsetlist, |
| 1444 |
0, |
| 1445 |
0, |
| 1446 |
0, |
| 1447 |
0, |
| 1448 |
0, |
| 1449 |
TXNFontMenuObj_tp_init, |
| 1450 |
TXNFontMenuObj_tp_alloc, |
| 1451 |
TXNFontMenuObj_tp_new, |
| 1452 |
TXNFontMenuObj_tp_free, |
| 1453 |
}; |
| 1454 |
|
| 1455 |
|
| 1456 |
|
| 1457 |
|
| 1458 |
static PyObject *Mlte_TXNNewObject(PyObject *_self, PyObject *_args) |
| 1459 |
{ |
| 1460 |
PyObject *_res = NULL; |
| 1461 |
OSStatus _err; |
| 1462 |
FSSpec * iFileSpec; |
| 1463 |
WindowPtr iWindow; |
| 1464 |
Rect iFrame; |
| 1465 |
TXNFrameOptions iFrameOptions; |
| 1466 |
TXNFrameType iFrameType; |
| 1467 |
TXNFileType iFileType; |
| 1468 |
TXNPermanentTextEncodingType iPermanentEncoding; |
| 1469 |
TXNObject oTXNObject; |
| 1470 |
TXNFrameID oTXNFrameID; |
| 1471 |
#ifndef TXNNewObject |
| 1472 |
PyMac_PRECHECK(TXNNewObject); |
| 1473 |
#endif |
| 1474 |
if (!PyArg_ParseTuple(_args, "O&O&O&llO&l", |
| 1475 |
OptFSSpecPtr_Convert, &iFileSpec, |
| 1476 |
WinObj_Convert, &iWindow, |
| 1477 |
PyMac_GetRect, &iFrame, |
| 1478 |
&iFrameOptions, |
| 1479 |
&iFrameType, |
| 1480 |
PyMac_GetOSType, &iFileType, |
| 1481 |
&iPermanentEncoding)) |
| 1482 |
return NULL; |
| 1483 |
_err = TXNNewObject(iFileSpec, |
| 1484 |
iWindow, |
| 1485 |
&iFrame, |
| 1486 |
iFrameOptions, |
| 1487 |
iFrameType, |
| 1488 |
iFileType, |
| 1489 |
iPermanentEncoding, |
| 1490 |
&oTXNObject, |
| 1491 |
&oTXNFrameID, |
| 1492 |
(TXNObjectRefcon)0); |
| 1493 |
if (_err != noErr) return PyMac_Error(_err); |
| 1494 |
_res = Py_BuildValue("O&l", |
| 1495 |
TXNObj_New, oTXNObject, |
| 1496 |
oTXNFrameID); |
| 1497 |
return _res; |
| 1498 |
} |
| 1499 |
|
| 1500 |
static PyObject *Mlte_TXNTerminateTextension(PyObject *_self, PyObject *_args) |
| 1501 |
{ |
| 1502 |
PyObject *_res = NULL; |
| 1503 |
#ifndef TXNTerminateTextension |
| 1504 |
PyMac_PRECHECK(TXNTerminateTextension); |
| 1505 |
#endif |
| 1506 |
if (!PyArg_ParseTuple(_args, "")) |
| 1507 |
return NULL; |
| 1508 |
TXNTerminateTextension(); |
| 1509 |
Py_INCREF(Py_None); |
| 1510 |
_res = Py_None; |
| 1511 |
return _res; |
| 1512 |
} |
| 1513 |
|
| 1514 |
static PyObject *Mlte_TXNIsScrapPastable(PyObject *_self, PyObject *_args) |
| 1515 |
{ |
| 1516 |
PyObject *_res = NULL; |
| 1517 |
Boolean _rv; |
| 1518 |
#ifndef TXNIsScrapPastable |
| 1519 |
PyMac_PRECHECK(TXNIsScrapPastable); |
| 1520 |
#endif |
| 1521 |
if (!PyArg_ParseTuple(_args, "")) |
| 1522 |
return NULL; |
| 1523 |
_rv = TXNIsScrapPastable(); |
| 1524 |
_res = Py_BuildValue("b", |
| 1525 |
_rv); |
| 1526 |
return _res; |
| 1527 |
} |
| 1528 |
|
| 1529 |
static PyObject *Mlte_TXNConvertToPublicScrap(PyObject *_self, PyObject *_args) |
| 1530 |
{ |
| 1531 |
PyObject *_res = NULL; |
| 1532 |
OSStatus _err; |
| 1533 |
#ifndef TXNConvertToPublicScrap |
| 1534 |
PyMac_PRECHECK(TXNConvertToPublicScrap); |
| 1535 |
#endif |
| 1536 |
if (!PyArg_ParseTuple(_args, "")) |
| 1537 |
return NULL; |
| 1538 |
_err = TXNConvertToPublicScrap(); |
| 1539 |
if (_err != noErr) return PyMac_Error(_err); |
| 1540 |
Py_INCREF(Py_None); |
| 1541 |
_res = Py_None; |
| 1542 |
return _res; |
| 1543 |
} |
| 1544 |
|
| 1545 |
static PyObject *Mlte_TXNConvertFromPublicScrap(PyObject *_self, PyObject *_args) |
| 1546 |
{ |
| 1547 |
PyObject *_res = NULL; |
| 1548 |
OSStatus _err; |
| 1549 |
#ifndef TXNConvertFromPublicScrap |
| 1550 |
PyMac_PRECHECK(TXNConvertFromPublicScrap); |
| 1551 |
#endif |
| 1552 |
if (!PyArg_ParseTuple(_args, "")) |
| 1553 |
return NULL; |
| 1554 |
_err = TXNConvertFromPublicScrap(); |
| 1555 |
if (_err != noErr) return PyMac_Error(_err); |
| 1556 |
Py_INCREF(Py_None); |
| 1557 |
_res = Py_None; |
| 1558 |
return _res; |
| 1559 |
} |
| 1560 |
|
| 1561 |
static PyObject *Mlte_TXNNewFontMenuObject(PyObject *_self, PyObject *_args) |
| 1562 |
{ |
| 1563 |
PyObject *_res = NULL; |
| 1564 |
OSStatus _err; |
| 1565 |
MenuHandle iFontMenuHandle; |
| 1566 |
SInt16 iMenuID; |
| 1567 |
SInt16 iStartHierMenuID; |
| 1568 |
TXNFontMenuObject oTXNFontMenuObject; |
| 1569 |
#ifndef TXNNewFontMenuObject |
| 1570 |
PyMac_PRECHECK(TXNNewFontMenuObject); |
| 1571 |
#endif |
| 1572 |
if (!PyArg_ParseTuple(_args, "O&hh", |
| 1573 |
MenuObj_Convert, &iFontMenuHandle, |
| 1574 |
&iMenuID, |
| 1575 |
&iStartHierMenuID)) |
| 1576 |
return NULL; |
| 1577 |
_err = TXNNewFontMenuObject(iFontMenuHandle, |
| 1578 |
iMenuID, |
| 1579 |
iStartHierMenuID, |
| 1580 |
&oTXNFontMenuObject); |
| 1581 |
if (_err != noErr) return PyMac_Error(_err); |
| 1582 |
_res = Py_BuildValue("O&", |
| 1583 |
TXNFontMenuObj_New, oTXNFontMenuObject); |
| 1584 |
return _res; |
| 1585 |
} |
| 1586 |
|
| 1587 |
static PyObject *Mlte_TXNVersionInformation(PyObject *_self, PyObject *_args) |
| 1588 |
{ |
| 1589 |
PyObject *_res = NULL; |
| 1590 |
TXNVersionValue _rv; |
| 1591 |
TXNFeatureBits oFeatureFlags; |
| 1592 |
#ifndef TXNVersionInformation |
| 1593 |
PyMac_PRECHECK(TXNVersionInformation); |
| 1594 |
#endif |
| 1595 |
if (!PyArg_ParseTuple(_args, "")) |
| 1596 |
return NULL; |
| 1597 |
_rv = TXNVersionInformation(&oFeatureFlags); |
| 1598 |
_res = Py_BuildValue("ll", |
| 1599 |
_rv, |
| 1600 |
oFeatureFlags); |
| 1601 |
return _res; |
| 1602 |
} |
| 1603 |
|
| 1604 |
static PyObject *Mlte_TXNInitTextension(PyObject *_self, PyObject *_args) |
| 1605 |
{ |
| 1606 |
PyObject *_res = NULL; |
| 1607 |
|
| 1608 |
OSStatus _err; |
| 1609 |
TXNMacOSPreferredFontDescription * iDefaultFonts = NULL; |
| 1610 |
ItemCount iCountDefaultFonts = 0; |
| 1611 |
TXNInitOptions iUsageFlags; |
| 1612 |
PyMac_PRECHECK(TXNInitTextension); |
| 1613 |
if (!PyArg_ParseTuple(_args, "l", &iUsageFlags)) |
| 1614 |
return NULL; |
| 1615 |
_err = TXNInitTextension(iDefaultFonts, |
| 1616 |
iCountDefaultFonts, |
| 1617 |
iUsageFlags); |
| 1618 |
if (_err != noErr) return PyMac_Error(_err); |
| 1619 |
Py_INCREF(Py_None); |
| 1620 |
_res = Py_None; |
| 1621 |
return _res; |
| 1622 |
|
| 1623 |
} |
| 1624 |
|
| 1625 |
#endif |
| 1626 |
|
| 1627 |
static PyMethodDef Mlte_methods[] = { |
| 1628 |
#if APPLE_SUPPORTS_QUICKTIME |
| 1629 |
{"TXNNewObject", (PyCFunction)Mlte_TXNNewObject, 1, |
| 1630 |
PyDoc_STR("(FSSpec * iFileSpec, WindowPtr iWindow, Rect iFrame, TXNFrameOptions iFrameOptions, TXNFrameType iFrameType, TXNFileType iFileType, TXNPermanentTextEncodingType iPermanentEncoding) -> (TXNObject oTXNObject, TXNFrameID oTXNFrameID)")}, |
| 1631 |
{"TXNTerminateTextension", (PyCFunction)Mlte_TXNTerminateTextension, 1, |
| 1632 |
PyDoc_STR("() -> None")}, |
| 1633 |
{"TXNIsScrapPastable", (PyCFunction)Mlte_TXNIsScrapPastable, 1, |
| 1634 |
PyDoc_STR("() -> (Boolean _rv)")}, |
| 1635 |
{"TXNConvertToPublicScrap", (PyCFunction)Mlte_TXNConvertToPublicScrap, 1, |
| 1636 |
PyDoc_STR("() -> None")}, |
| 1637 |
{"TXNConvertFromPublicScrap", (PyCFunction)Mlte_TXNConvertFromPublicScrap, 1, |
| 1638 |
PyDoc_STR("() -> None")}, |
| 1639 |
{"TXNNewFontMenuObject", (PyCFunction)Mlte_TXNNewFontMenuObject, 1, |
| 1640 |
PyDoc_STR("(MenuHandle iFontMenuHandle, SInt16 iMenuID, SInt16 iStartHierMenuID) -> (TXNFontMenuObject oTXNFontMenuObject)")}, |
| 1641 |
{"TXNVersionInformation", (PyCFunction)Mlte_TXNVersionInformation, 1, |
| 1642 |
PyDoc_STR("() -> (TXNVersionValue _rv, TXNFeatureBits oFeatureFlags)")}, |
| 1643 |
{"TXNInitTextension", (PyCFunction)Mlte_TXNInitTextension, 1, |
| 1644 |
PyDoc_STR("(TXNInitOptions) -> None")}, |
| 1645 |
#endif |
| 1646 |
{NULL, NULL, 0} |
| 1647 |
}; |
| 1648 |
|
| 1649 |
|
| 1650 |
|
| 1651 |
|
| 1652 |
void init_Mlte(void) |
| 1653 |
{ |
| 1654 |
PyObject *m; |
| 1655 |
#if APPLE_SUPPORTS_QUICKTIME |
| 1656 |
PyObject *d; |
| 1657 |
|
| 1658 |
|
| 1659 |
|
| 1660 |
|
| 1661 |
|
| 1662 |
#endif |
| 1663 |
|
| 1664 |
m = Py_InitModule("_Mlte", Mlte_methods); |
| 1665 |
#if APPLE_SUPPORTS_QUICKTIME |
| 1666 |
d = PyModule_GetDict(m); |
| 1667 |
Mlte_Error = PyMac_GetOSErrException(); |
| 1668 |
if (Mlte_Error == NULL || |
| 1669 |
PyDict_SetItemString(d, "Error", Mlte_Error) != 0) |
| 1670 |
return; |
| 1671 |
TXNObject_Type.ob_type = &PyType_Type; |
| 1672 |
if (PyType_Ready(&TXNObject_Type) < 0) return; |
| 1673 |
Py_INCREF(&TXNObject_Type); |
| 1674 |
PyModule_AddObject(m, "TXNObject", (PyObject *)&TXNObject_Type); |
| 1675 |
|
| 1676 |
Py_INCREF(&TXNObject_Type); |
| 1677 |
PyModule_AddObject(m, "TXNObjectType", (PyObject *)&TXNObject_Type); |
| 1678 |
TXNFontMenuObject_Type.ob_type = &PyType_Type; |
| 1679 |
if (PyType_Ready(&TXNFontMenuObject_Type) < 0) return; |
| 1680 |
Py_INCREF(&TXNFontMenuObject_Type); |
| 1681 |
PyModule_AddObject(m, "TXNFontMenuObject", (PyObject *)&TXNFontMenuObject_Type); |
| 1682 |
|
| 1683 |
Py_INCREF(&TXNFontMenuObject_Type); |
| 1684 |
PyModule_AddObject(m, "TXNFontMenuObjectType", (PyObject *)&TXNFontMenuObject_Type); |
| 1685 |
#endif |
| 1686 |
} |
| 1687 |
|
| 1688 |
|
| 1689 |
|