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