From 620a7667ebb2ebd31a22349c20e66bad3a8980f9 Mon Sep 17 00:00:00 2001 From: Jack Jansen Date: Tue, 18 Dec 2001 15:39:38 +0000 Subject: Updated to Universal Headers 3.4 --- Mac/Modules/app/_Appmodule.c | 4 + Mac/Modules/cf/_CFmodule.c | 4 + Mac/Modules/cg/_CGmodule.c | 4 + Mac/Modules/cm/_Cmmodule.c | 4 + Mac/Modules/ctl/_Ctlmodule.c | 4 + Mac/Modules/dlg/_Dlgmodule.c | 4 + Mac/Modules/drag/_Dragmodule.c | 4 + Mac/Modules/evt/evtedit.py | 4 + Mac/Modules/fm/_Fmmodule.c | 4 + Mac/Modules/help/_Helpmodule.c | 4 + Mac/Modules/icn/_Icnmodule.c | 4 + Mac/Modules/list/_Listmodule.c | 4 + Mac/Modules/menu/_Menumodule.c | 4 + Mac/Modules/mlte/_Mltemodule.c | 166 ++++++++- Mac/Modules/mlte/mltescan.py | 9 +- Mac/Modules/mlte/mltesupport.py | 1 + Mac/Modules/qd/_Qdmodule.c | 570 +++++++++++++++++++++++++++++++ Mac/Modules/qd/qdscan.py | 5 + Mac/Modules/qd/qdsupport.py | 1 + Mac/Modules/qdoffs/_Qdoffsmodule.c | 4 + Mac/Modules/qt/_Qtmodule.c | 317 ++++++++++++++++- Mac/Modules/qt/qtscan.py | 5 + Mac/Modules/res/_Resmodule.c | 53 +++ Mac/Modules/res/resscan.py | 5 + Mac/Modules/res/ressupport.py | 1 + Mac/Modules/snd/_Sndmodule.c | 4 + Mac/Modules/te/_TEmodule.c | 4 + Mac/Modules/waste/wastemodule.c | 4 + Mac/Modules/win/_Winmodule.c | 672 ++++++++++++++++++++++++++++++++++--- Mac/Modules/win/winscan.py | 25 +- Mac/Modules/win/winsupport.py | 5 + 31 files changed, 1835 insertions(+), 68 deletions(-) diff --git a/Mac/Modules/app/_Appmodule.c b/Mac/Modules/app/_Appmodule.c index 4e9adc2..ab330a5 100644 --- a/Mac/Modules/app/_Appmodule.c +++ b/Mac/Modules/app/_Appmodule.c @@ -5,8 +5,12 @@ +#ifdef _WIN32 +#include "pywintoolbox.h" +#else #include "macglue.h" #include "pymactoolbox.h" +#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ diff --git a/Mac/Modules/cf/_CFmodule.c b/Mac/Modules/cf/_CFmodule.c index bb2b0b3..a748813 100644 --- a/Mac/Modules/cf/_CFmodule.c +++ b/Mac/Modules/cf/_CFmodule.c @@ -5,8 +5,12 @@ +#ifdef _WIN32 +#include "pywintoolbox.h" +#else #include "macglue.h" #include "pymactoolbox.h" +#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ diff --git a/Mac/Modules/cg/_CGmodule.c b/Mac/Modules/cg/_CGmodule.c index 729162b..3bcb260 100755 --- a/Mac/Modules/cg/_CGmodule.c +++ b/Mac/Modules/cg/_CGmodule.c @@ -5,8 +5,12 @@ +#ifdef _WIN32 +#include "pywintoolbox.h" +#else #include "macglue.h" #include "pymactoolbox.h" +#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ diff --git a/Mac/Modules/cm/_Cmmodule.c b/Mac/Modules/cm/_Cmmodule.c index 6fb0832..a2da9c2 100644 --- a/Mac/Modules/cm/_Cmmodule.c +++ b/Mac/Modules/cm/_Cmmodule.c @@ -5,8 +5,12 @@ +#ifdef _WIN32 +#include "pywintoolbox.h" +#else #include "macglue.h" #include "pymactoolbox.h" +#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ diff --git a/Mac/Modules/ctl/_Ctlmodule.c b/Mac/Modules/ctl/_Ctlmodule.c index 7571c3f..b2ba986 100644 --- a/Mac/Modules/ctl/_Ctlmodule.c +++ b/Mac/Modules/ctl/_Ctlmodule.c @@ -5,8 +5,12 @@ +#ifdef _WIN32 +#include "pywintoolbox.h" +#else #include "macglue.h" #include "pymactoolbox.h" +#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ diff --git a/Mac/Modules/dlg/_Dlgmodule.c b/Mac/Modules/dlg/_Dlgmodule.c index afa50cc..d118e11 100644 --- a/Mac/Modules/dlg/_Dlgmodule.c +++ b/Mac/Modules/dlg/_Dlgmodule.c @@ -5,8 +5,12 @@ +#ifdef _WIN32 +#include "pywintoolbox.h" +#else #include "macglue.h" #include "pymactoolbox.h" +#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ diff --git a/Mac/Modules/drag/_Dragmodule.c b/Mac/Modules/drag/_Dragmodule.c index 6e35e03..5312023 100644 --- a/Mac/Modules/drag/_Dragmodule.c +++ b/Mac/Modules/drag/_Dragmodule.c @@ -5,8 +5,12 @@ +#ifdef _WIN32 +#include "pywintoolbox.h" +#else #include "macglue.h" #include "pymactoolbox.h" +#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ diff --git a/Mac/Modules/evt/evtedit.py b/Mac/Modules/evt/evtedit.py index 50b4b1a..3426b70 100644 --- a/Mac/Modules/evt/evtedit.py +++ b/Mac/Modules/evt/evtedit.py @@ -4,3 +4,7 @@ f = Function(void, 'SystemClick', ) functions.append(f) +f = Function(UInt32, 'TickCount', +) +functions.append(f) + diff --git a/Mac/Modules/fm/_Fmmodule.c b/Mac/Modules/fm/_Fmmodule.c index 9cafebc..c5ab18a 100644 --- a/Mac/Modules/fm/_Fmmodule.c +++ b/Mac/Modules/fm/_Fmmodule.c @@ -5,8 +5,12 @@ +#ifdef _WIN32 +#include "pywintoolbox.h" +#else #include "macglue.h" #include "pymactoolbox.h" +#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ diff --git a/Mac/Modules/help/_Helpmodule.c b/Mac/Modules/help/_Helpmodule.c index 0b42fc4..46f1a35 100644 --- a/Mac/Modules/help/_Helpmodule.c +++ b/Mac/Modules/help/_Helpmodule.c @@ -5,8 +5,12 @@ +#ifdef _WIN32 +#include "pywintoolbox.h" +#else #include "macglue.h" #include "pymactoolbox.h" +#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ diff --git a/Mac/Modules/icn/_Icnmodule.c b/Mac/Modules/icn/_Icnmodule.c index a9af768..bc27732 100644 --- a/Mac/Modules/icn/_Icnmodule.c +++ b/Mac/Modules/icn/_Icnmodule.c @@ -5,8 +5,12 @@ +#ifdef _WIN32 +#include "pywintoolbox.h" +#else #include "macglue.h" #include "pymactoolbox.h" +#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ diff --git a/Mac/Modules/list/_Listmodule.c b/Mac/Modules/list/_Listmodule.c index af23548..94e3bcf 100644 --- a/Mac/Modules/list/_Listmodule.c +++ b/Mac/Modules/list/_Listmodule.c @@ -5,8 +5,12 @@ +#ifdef _WIN32 +#include "pywintoolbox.h" +#else #include "macglue.h" #include "pymactoolbox.h" +#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ diff --git a/Mac/Modules/menu/_Menumodule.c b/Mac/Modules/menu/_Menumodule.c index 91063cf..398f6fa 100644 --- a/Mac/Modules/menu/_Menumodule.c +++ b/Mac/Modules/menu/_Menumodule.c @@ -5,8 +5,12 @@ +#ifdef _WIN32 +#include "pywintoolbox.h" +#else #include "macglue.h" #include "pymactoolbox.h" +#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ diff --git a/Mac/Modules/mlte/_Mltemodule.c b/Mac/Modules/mlte/_Mltemodule.c index a72ea0e..4acc4b5 100644 --- a/Mac/Modules/mlte/_Mltemodule.c +++ b/Mac/Modules/mlte/_Mltemodule.c @@ -5,8 +5,12 @@ +#ifdef _WIN32 +#include "pywintoolbox.h" +#else #include "macglue.h" #include "pymactoolbox.h" +#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ @@ -241,23 +245,23 @@ static PyObject *TXNObj_TXNClick(TXNObjectObject *_self, PyObject *_args) return _res; } -#if 0 +#if TARGET_API_MAC_OS8 static PyObject *TXNObj_TXNTSMCheck(TXNObjectObject *_self, PyObject *_args) { PyObject *_res = NULL; Boolean _rv; - EventRecord iEvent; + EventRecord ioEvent; #ifndef TXNTSMCheck PyMac_PRECHECK(TXNTSMCheck); #endif - if (!PyArg_ParseTuple(_args, "O&", - PyMac_GetEventRecord, &iEvent)) + if (!PyArg_ParseTuple(_args, "")) return NULL; _rv = TXNTSMCheck(_self->ob_itself, - &iEvent); - _res = Py_BuildValue("b", - _rv); + &ioEvent); + _res = Py_BuildValue("bO&", + _rv, + PyMac_BuildEventRecord, &ioEvent); return _res; } #endif @@ -606,8 +610,8 @@ static PyObject *TXNObj_TXNCountRunsInRange(TXNObjectObject *_self, PyObject *_a { PyObject *_res = NULL; OSStatus _err; - UInt32 iStartOffset; - UInt32 iEndOffset; + TXNOffset iStartOffset; + TXNOffset iEndOffset; ItemCount oRunCount; #ifndef TXNCountRunsInRange PyMac_PRECHECK(TXNCountRunsInRange); @@ -773,7 +777,7 @@ static PyObject *TXNObj_TXNSave(TXNObjectObject *_self, PyObject *_args) { PyObject *_res = NULL; OSStatus _err; - OSType iType; + TXNFileType iType; OSType iResType; TXNPermanentTextEncodingType iPermanentEncoding; FSSpec iFileSpecification; @@ -867,6 +871,23 @@ static PyObject *TXNObj_TXNGetViewRect(TXNObjectObject *_self, PyObject *_args) return _res; } +static PyObject *TXNObj_TXNSetViewRect(TXNObjectObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + Rect iViewRect; +#ifndef TXNSetViewRect + PyMac_PRECHECK(TXNSetViewRect); +#endif + if (!PyArg_ParseTuple(_args, "O&", + PyMac_GetRect, &iViewRect)) + return NULL; + TXNSetViewRect(_self->ob_itself, + &iViewRect); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + static PyObject *TXNObj_TXNAttachObjectToWindow(TXNObjectObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -1029,6 +1050,111 @@ static PyObject *TXNObj_TXNPrepareFontMenu(TXNObjectObject *_self, PyObject *_ar return _res; } +static PyObject *TXNObj_TXNPointToOffset(TXNObjectObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + OSStatus _err; + Point iPoint; + TXNOffset oOffset; +#ifndef TXNPointToOffset + PyMac_PRECHECK(TXNPointToOffset); +#endif + if (!PyArg_ParseTuple(_args, "O&", + PyMac_GetPoint, &iPoint)) + return NULL; + _err = TXNPointToOffset(_self->ob_itself, + iPoint, + &oOffset); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("l", + oOffset); + return _res; +} + +static PyObject *TXNObj_TXNOffsetToPoint(TXNObjectObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + OSStatus _err; + TXNOffset iOffset; + Point oPoint; +#ifndef TXNOffsetToPoint + PyMac_PRECHECK(TXNOffsetToPoint); +#endif + if (!PyArg_ParseTuple(_args, "l", + &iOffset)) + return NULL; + _err = TXNOffsetToPoint(_self->ob_itself, + iOffset, + &oPoint); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&", + PyMac_BuildPoint, oPoint); + return _res; +} + +static PyObject *TXNObj_TXNGetLineCount(TXNObjectObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + OSStatus _err; + ItemCount oLineTotal; +#ifndef TXNGetLineCount + PyMac_PRECHECK(TXNGetLineCount); +#endif + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _err = TXNGetLineCount(_self->ob_itself, + &oLineTotal); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("l", + oLineTotal); + return _res; +} + +static PyObject *TXNObj_TXNGetLineMetrics(TXNObjectObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + OSStatus _err; + UInt32 iLineNumber; + Fixed oLineWidth; + Fixed oLineHeight; +#ifndef TXNGetLineMetrics + PyMac_PRECHECK(TXNGetLineMetrics); +#endif + if (!PyArg_ParseTuple(_args, "l", + &iLineNumber)) + return NULL; + _err = TXNGetLineMetrics(_self->ob_itself, + iLineNumber, + &oLineWidth, + &oLineHeight); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&O&", + PyMac_BuildFixed, oLineWidth, + PyMac_BuildFixed, oLineHeight); + return _res; +} + +static PyObject *TXNObj_TXNIsObjectAttachedToSpecificWindow(TXNObjectObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + OSStatus _err; + WindowPtr iWindow; + Boolean oAttached; +#ifndef TXNIsObjectAttachedToSpecificWindow + PyMac_PRECHECK(TXNIsObjectAttachedToSpecificWindow); +#endif + if (!PyArg_ParseTuple(_args, "O&", + WinObj_Convert, &iWindow)) + return NULL; + _err = TXNIsObjectAttachedToSpecificWindow(_self->ob_itself, + iWindow, + &oAttached); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("b", + oAttached); + return _res; +} + static PyMethodDef TXNObj_methods[] = { {"TXNDeleteObject", (PyCFunction)TXNObj_TXNDeleteObject, 1, "() -> None"}, @@ -1043,9 +1169,9 @@ static PyMethodDef TXNObj_methods[] = { {"TXNClick", (PyCFunction)TXNObj_TXNClick, 1, "(EventRecord iEvent) -> None"}, -#if 0 +#if TARGET_API_MAC_OS8 {"TXNTSMCheck", (PyCFunction)TXNObj_TXNTSMCheck, 1, - "(EventRecord iEvent) -> (Boolean _rv)"}, + "() -> (Boolean _rv, EventRecord ioEvent)"}, #endif {"TXNSelectAll", (PyCFunction)TXNObj_TXNSelectAll, 1, "() -> None"}, @@ -1090,7 +1216,7 @@ static PyMethodDef TXNObj_methods[] = { {"TXNSetSelection", (PyCFunction)TXNObj_TXNSetSelection, 1, "(TXNOffset iStartOffset, TXNOffset iEndOffset) -> None"}, {"TXNCountRunsInRange", (PyCFunction)TXNObj_TXNCountRunsInRange, 1, - "(UInt32 iStartOffset, UInt32 iEndOffset) -> (ItemCount oRunCount)"}, + "(TXNOffset iStartOffset, TXNOffset iEndOffset) -> (ItemCount oRunCount)"}, {"TXNDataSize", (PyCFunction)TXNObj_TXNDataSize, 1, "() -> (ByteCount _rv)"}, {"TXNGetData", (PyCFunction)TXNObj_TXNGetData, 1, @@ -1104,7 +1230,7 @@ static PyMethodDef TXNObj_methods[] = { {"TXNGetChangeCount", (PyCFunction)TXNObj_TXNGetChangeCount, 1, "() -> (ItemCount _rv)"}, {"TXNSave", (PyCFunction)TXNObj_TXNSave, 1, - "(OSType iType, OSType iResType, TXNPermanentTextEncodingType iPermanentEncoding, FSSpec iFileSpecification, SInt16 iDataReference, SInt16 iResourceReference) -> None"}, + "(TXNFileType iType, OSType iResType, TXNPermanentTextEncodingType iPermanentEncoding, FSSpec iFileSpecification, SInt16 iDataReference, SInt16 iResourceReference) -> None"}, {"TXNRevert", (PyCFunction)TXNObj_TXNRevert, 1, "() -> None"}, {"TXNPageSetup", (PyCFunction)TXNObj_TXNPageSetup, 1, @@ -1113,6 +1239,8 @@ static PyMethodDef TXNObj_methods[] = { "() -> None"}, {"TXNGetViewRect", (PyCFunction)TXNObj_TXNGetViewRect, 1, "() -> (Rect oViewRect)"}, + {"TXNSetViewRect", (PyCFunction)TXNObj_TXNSetViewRect, 1, + "(Rect iViewRect) -> None"}, {"TXNAttachObjectToWindow", (PyCFunction)TXNObj_TXNAttachObjectToWindow, 1, "(GWorldPtr iWindow, Boolean iIsActualWindow) -> None"}, {"TXNIsObjectAttachedToWindow", (PyCFunction)TXNObj_TXNIsObjectAttachedToWindow, 1, @@ -1127,6 +1255,16 @@ static PyMethodDef TXNObj_methods[] = { "(TXNFontMenuObject iTXNFontMenuObject, SInt16 iMenuID, SInt16 iMenuItem) -> None"}, {"TXNPrepareFontMenu", (PyCFunction)TXNObj_TXNPrepareFontMenu, 1, "(TXNFontMenuObject iTXNFontMenuObject) -> None"}, + {"TXNPointToOffset", (PyCFunction)TXNObj_TXNPointToOffset, 1, + "(Point iPoint) -> (TXNOffset oOffset)"}, + {"TXNOffsetToPoint", (PyCFunction)TXNObj_TXNOffsetToPoint, 1, + "(TXNOffset iOffset) -> (Point oPoint)"}, + {"TXNGetLineCount", (PyCFunction)TXNObj_TXNGetLineCount, 1, + "() -> (ItemCount oLineTotal)"}, + {"TXNGetLineMetrics", (PyCFunction)TXNObj_TXNGetLineMetrics, 1, + "(UInt32 iLineNumber) -> (Fixed oLineWidth, Fixed oLineHeight)"}, + {"TXNIsObjectAttachedToSpecificWindow", (PyCFunction)TXNObj_TXNIsObjectAttachedToSpecificWindow, 1, + "(WindowPtr iWindow) -> (Boolean oAttached)"}, {NULL, NULL, 0} }; diff --git a/Mac/Modules/mlte/mltescan.py b/Mac/Modules/mlte/mltescan.py index ae45f79..c4b3d47 100644 --- a/Mac/Modules/mlte/mltescan.py +++ b/Mac/Modules/mlte/mltescan.py @@ -77,7 +77,7 @@ MovieFileType = FOUR_CHAR_CODE('moov') def makegreylist(self): return [ - ('#if !TARGET_API_MAC_OSX', [ + ('#if TARGET_API_MAC_OS8', [ 'TXNTSMCheck', ])] @@ -94,7 +94,14 @@ MovieFileType = FOUR_CHAR_CODE('moov') "TXNMatchTextRecord", #TBD "TXNBackground", #TBD "UniChar", #TBD + "UniCharCount", #TBD + "UniChar_ptr", #TBD "TXNFindUPP", + "ATSUStyle", #TBD + "TXNActionKeyMapperProcPtr", + "TXNActionKeyMapperUPP", + "TXNTextBoxOptionsData", + "TXNCountOptions", ] def makerepairinstructions(self): diff --git a/Mac/Modules/mlte/mltesupport.py b/Mac/Modules/mlte/mltesupport.py index 3a11e88..3ce2463 100644 --- a/Mac/Modules/mlte/mltesupport.py +++ b/Mac/Modules/mlte/mltesupport.py @@ -125,6 +125,7 @@ OptRgnHandle = OpaqueByValueType("RgnHandle", "OptResObj") GWorldPtr = OpaqueByValueType("GWorldPtr", "GWorldObj") OptGWorldPtr = OpaqueByValueType("GWorldPtr", "OptGWorldObj") MlteInBuffer = VarInputBufferType('void *', 'ByteCount', 'l') +CFStringRef = OpaqueByValueType("CFStringRef", "CFStringRefObj") OptFSSpecPtr = OpaqueByValueType("FSSpec *", "OptFSSpecPtr") OptRectPtr = OpaqueByValueType("Rect *", "OptRectPtr") diff --git a/Mac/Modules/qd/_Qdmodule.c b/Mac/Modules/qd/_Qdmodule.c index 7c176d8..81fe2cd 100644 --- a/Mac/Modules/qd/_Qdmodule.c +++ b/Mac/Modules/qd/_Qdmodule.c @@ -5,8 +5,12 @@ +#ifdef _WIN32 +#include "pywintoolbox.h" +#else #include "macglue.h" #include "pymactoolbox.h" +#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ @@ -1645,6 +1649,25 @@ static PyObject *Qd_BitMapToRegion(PyObject *_self, PyObject *_args) return _res; } +#if TARGET_API_MAC_CARBON + +static PyObject *Qd_RgnToHandle(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + RgnHandle region; + Handle flattenedRgnDataHdl; + if (!PyArg_ParseTuple(_args, "O&O&", + ResObj_Convert, ®ion, + ResObj_Convert, &flattenedRgnDataHdl)) + return NULL; + RgnToHandle(region, + flattenedRgnDataHdl); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} +#endif + static PyObject *Qd_DisposeRgn(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -3502,6 +3525,23 @@ static PyObject *Qd_AngleFromSlope(PyObject *_self, PyObject *_args) return _res; } +#if TARGET_API_MAC_CARBON + +static PyObject *Qd_IsValidPort(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + Boolean _rv; + CGrafPtr port; + if (!PyArg_ParseTuple(_args, "O&", + GrafObj_Convert, &port)) + return NULL; + _rv = IsValidPort(port); + _res = Py_BuildValue("b", + _rv); + return _res; +} +#endif + static PyObject *Qd_GetPortPixMap(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -3878,6 +3918,23 @@ static PyObject *Qd_IsPortPictureBeingDefined(PyObject *_self, PyObject *_args) #if TARGET_API_MAC_CARBON +static PyObject *Qd_IsPortPolyBeingDefined(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + Boolean _rv; + CGrafPtr port; + if (!PyArg_ParseTuple(_args, "O&", + GrafObj_Convert, &port)) + return NULL; + _rv = IsPortPolyBeingDefined(port); + _res = Py_BuildValue("b", + _rv); + return _res; +} +#endif + +#if TARGET_API_MAC_CARBON + static PyObject *Qd_IsPortOffscreen(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -3990,6 +4047,22 @@ static PyObject *Qd_SetPortPenPixPat(PyObject *_self, PyObject *_args) return _res; } +static PyObject *Qd_SetPortFillPixPat(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + CGrafPtr port; + PixPatHandle penPattern; + if (!PyArg_ParseTuple(_args, "O&O&", + GrafObj_Convert, &port, + ResObj_Convert, &penPattern)) + return NULL; + SetPortFillPixPat(port, + penPattern); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + static PyObject *Qd_SetPortBackPixPat(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -4347,6 +4420,398 @@ static PyObject *Qd_QDFlushPortBuffer(PyObject *_self, PyObject *_args) return _res; } +#if TARGET_API_MAC_CARBON + +static PyObject *Qd_QDGetDirtyRegion(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + OSStatus _err; + CGrafPtr port; + RgnHandle rgn; + if (!PyArg_ParseTuple(_args, "O&O&", + GrafObj_Convert, &port, + ResObj_Convert, &rgn)) + return NULL; + _err = QDGetDirtyRegion(port, + rgn); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} +#endif + +#if TARGET_API_MAC_CARBON + +static PyObject *Qd_QDSetDirtyRegion(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + OSStatus _err; + CGrafPtr port; + RgnHandle rgn; + if (!PyArg_ParseTuple(_args, "O&O&", + GrafObj_Convert, &port, + ResObj_Convert, &rgn)) + return NULL; + _err = QDSetDirtyRegion(port, + rgn); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} +#endif + +static PyObject *Qd_LMGetScrVRes(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + SInt16 _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = LMGetScrVRes(); + _res = Py_BuildValue("h", + _rv); + return _res; +} + +static PyObject *Qd_LMSetScrVRes(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + SInt16 value; + if (!PyArg_ParseTuple(_args, "h", + &value)) + return NULL; + LMSetScrVRes(value); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Qd_LMGetScrHRes(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + SInt16 _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = LMGetScrHRes(); + _res = Py_BuildValue("h", + _rv); + return _res; +} + +static PyObject *Qd_LMSetScrHRes(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + SInt16 value; + if (!PyArg_ParseTuple(_args, "h", + &value)) + return NULL; + LMSetScrHRes(value); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Qd_LMGetMainDevice(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + GDHandle _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = LMGetMainDevice(); + _res = Py_BuildValue("O&", + ResObj_New, _rv); + return _res; +} + +static PyObject *Qd_LMSetMainDevice(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + GDHandle value; + if (!PyArg_ParseTuple(_args, "O&", + ResObj_Convert, &value)) + return NULL; + LMSetMainDevice(value); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Qd_LMGetDeviceList(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + GDHandle _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = LMGetDeviceList(); + _res = Py_BuildValue("O&", + ResObj_New, _rv); + return _res; +} + +static PyObject *Qd_LMSetDeviceList(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + GDHandle value; + if (!PyArg_ParseTuple(_args, "O&", + ResObj_Convert, &value)) + return NULL; + LMSetDeviceList(value); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Qd_LMGetQDColors(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + Handle _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = LMGetQDColors(); + _res = Py_BuildValue("O&", + ResObj_New, _rv); + return _res; +} + +static PyObject *Qd_LMSetQDColors(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + Handle value; + if (!PyArg_ParseTuple(_args, "O&", + ResObj_Convert, &value)) + return NULL; + LMSetQDColors(value); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Qd_LMGetWidthListHand(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + Handle _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = LMGetWidthListHand(); + _res = Py_BuildValue("O&", + ResObj_New, _rv); + return _res; +} + +static PyObject *Qd_LMSetWidthListHand(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + Handle value; + if (!PyArg_ParseTuple(_args, "O&", + ResObj_Convert, &value)) + return NULL; + LMSetWidthListHand(value); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Qd_LMGetHiliteMode(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + UInt8 _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = LMGetHiliteMode(); + _res = Py_BuildValue("b", + _rv); + return _res; +} + +static PyObject *Qd_LMSetHiliteMode(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + UInt8 value; + if (!PyArg_ParseTuple(_args, "b", + &value)) + return NULL; + LMSetHiliteMode(value); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Qd_LMGetWidthTabHandle(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + Handle _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = LMGetWidthTabHandle(); + _res = Py_BuildValue("O&", + ResObj_New, _rv); + return _res; +} + +static PyObject *Qd_LMSetWidthTabHandle(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + Handle value; + if (!PyArg_ParseTuple(_args, "O&", + ResObj_Convert, &value)) + return NULL; + LMSetWidthTabHandle(value); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Qd_LMGetLastSPExtra(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + SInt32 _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = LMGetLastSPExtra(); + _res = Py_BuildValue("l", + _rv); + return _res; +} + +static PyObject *Qd_LMSetLastSPExtra(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + SInt32 value; + if (!PyArg_ParseTuple(_args, "l", + &value)) + return NULL; + LMSetLastSPExtra(value); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Qd_LMGetLastFOND(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + Handle _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = LMGetLastFOND(); + _res = Py_BuildValue("O&", + ResObj_New, _rv); + return _res; +} + +static PyObject *Qd_LMSetLastFOND(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + Handle value; + if (!PyArg_ParseTuple(_args, "O&", + ResObj_Convert, &value)) + return NULL; + LMSetLastFOND(value); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Qd_LMGetFractEnable(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + UInt8 _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = LMGetFractEnable(); + _res = Py_BuildValue("b", + _rv); + return _res; +} + +static PyObject *Qd_LMSetFractEnable(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + UInt8 value; + if (!PyArg_ParseTuple(_args, "b", + &value)) + return NULL; + LMSetFractEnable(value); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Qd_LMGetTheGDevice(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + GDHandle _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = LMGetTheGDevice(); + _res = Py_BuildValue("O&", + ResObj_New, _rv); + return _res; +} + +static PyObject *Qd_LMSetTheGDevice(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + GDHandle value; + if (!PyArg_ParseTuple(_args, "O&", + ResObj_Convert, &value)) + return NULL; + LMSetTheGDevice(value); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Qd_LMGetHiliteRGB(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + RGBColor hiliteRGBValue; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + LMGetHiliteRGB(&hiliteRGBValue); + _res = Py_BuildValue("O&", + QdRGB_New, &hiliteRGBValue); + return _res; +} + +static PyObject *Qd_LMSetHiliteRGB(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + RGBColor hiliteRGBValue; + if (!PyArg_ParseTuple(_args, "O&", + QdRGB_Convert, &hiliteRGBValue)) + return NULL; + LMSetHiliteRGB(&hiliteRGBValue); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Qd_LMGetCursorNew(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + Boolean _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = LMGetCursorNew(); + _res = Py_BuildValue("b", + _rv); + return _res; +} + +static PyObject *Qd_LMSetCursorNew(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + Boolean value; + if (!PyArg_ParseTuple(_args, "b", + &value)) + return NULL; + LMSetCursorNew(value); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + static PyObject *Qd_TextFont(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -4536,6 +5001,26 @@ static PyObject *Qd_CharExtra(PyObject *_self, PyObject *_args) return _res; } +static PyObject *Qd_TruncString(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + short _rv; + short width; + Str255 theString; + TruncCode truncWhere; + if (!PyArg_ParseTuple(_args, "hO&h", + &width, + PyMac_GetStr255, theString, + &truncWhere)) + return NULL; + _rv = TruncString(width, + theString, + truncWhere); + _res = Py_BuildValue("h", + _rv); + return _res; +} + static PyObject *Qd_SetPort(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -5169,6 +5654,11 @@ static PyMethodDef Qd_methods[] = { "(RgnHandle dstRgn) -> None"}, {"BitMapToRegion", (PyCFunction)Qd_BitMapToRegion, 1, "(RgnHandle region, BitMapPtr bMap) -> None"}, + +#if TARGET_API_MAC_CARBON + {"RgnToHandle", (PyCFunction)Qd_RgnToHandle, 1, + "(RgnHandle region, Handle flattenedRgnDataHdl) -> None"}, +#endif {"DisposeRgn", (PyCFunction)Qd_DisposeRgn, 1, "(RgnHandle rgn) -> None"}, {"MacCopyRgn", (PyCFunction)Qd_MacCopyRgn, 1, @@ -5403,6 +5893,11 @@ static PyMethodDef Qd_methods[] = { "(short angle) -> (Fixed _rv)"}, {"AngleFromSlope", (PyCFunction)Qd_AngleFromSlope, 1, "(Fixed slope) -> (short _rv)"}, + +#if TARGET_API_MAC_CARBON + {"IsValidPort", (PyCFunction)Qd_IsValidPort, 1, + "(CGrafPtr port) -> (Boolean _rv)"}, +#endif {"GetPortPixMap", (PyCFunction)Qd_GetPortPixMap, 1, "(CGrafPtr port) -> (PixMapHandle _rv)"}, {"GetPortBitMapForCopyBits", (PyCFunction)Qd_GetPortBitMapForCopyBits, 1, @@ -5455,6 +5950,11 @@ static PyMethodDef Qd_methods[] = { "(CGrafPtr port) -> (Boolean _rv)"}, #if TARGET_API_MAC_CARBON + {"IsPortPolyBeingDefined", (PyCFunction)Qd_IsPortPolyBeingDefined, 1, + "(CGrafPtr port) -> (Boolean _rv)"}, +#endif + +#if TARGET_API_MAC_CARBON {"IsPortOffscreen", (PyCFunction)Qd_IsPortOffscreen, 1, "(CGrafPtr port) -> (Boolean _rv)"}, #endif @@ -5473,6 +5973,8 @@ static PyMethodDef Qd_methods[] = { "(CGrafPtr port, RgnHandle clipRgn) -> None"}, {"SetPortPenPixPat", (PyCFunction)Qd_SetPortPenPixPat, 1, "(CGrafPtr port, PixPatHandle penPattern) -> None"}, + {"SetPortFillPixPat", (PyCFunction)Qd_SetPortFillPixPat, 1, + "(CGrafPtr port, PixPatHandle penPattern) -> None"}, {"SetPortBackPixPat", (PyCFunction)Qd_SetPortBackPixPat, 1, "(CGrafPtr port, PixPatHandle backPattern) -> None"}, {"SetPortPenSize", (PyCFunction)Qd_SetPortPenSize, 1, @@ -5535,6 +6037,72 @@ static PyMethodDef Qd_methods[] = { "(CGrafPtr port) -> (Boolean _rv)"}, {"QDFlushPortBuffer", (PyCFunction)Qd_QDFlushPortBuffer, 1, "(CGrafPtr port, RgnHandle region) -> None"}, + +#if TARGET_API_MAC_CARBON + {"QDGetDirtyRegion", (PyCFunction)Qd_QDGetDirtyRegion, 1, + "(CGrafPtr port, RgnHandle rgn) -> None"}, +#endif + +#if TARGET_API_MAC_CARBON + {"QDSetDirtyRegion", (PyCFunction)Qd_QDSetDirtyRegion, 1, + "(CGrafPtr port, RgnHandle rgn) -> None"}, +#endif + {"LMGetScrVRes", (PyCFunction)Qd_LMGetScrVRes, 1, + "() -> (SInt16 _rv)"}, + {"LMSetScrVRes", (PyCFunction)Qd_LMSetScrVRes, 1, + "(SInt16 value) -> None"}, + {"LMGetScrHRes", (PyCFunction)Qd_LMGetScrHRes, 1, + "() -> (SInt16 _rv)"}, + {"LMSetScrHRes", (PyCFunction)Qd_LMSetScrHRes, 1, + "(SInt16 value) -> None"}, + {"LMGetMainDevice", (PyCFunction)Qd_LMGetMainDevice, 1, + "() -> (GDHandle _rv)"}, + {"LMSetMainDevice", (PyCFunction)Qd_LMSetMainDevice, 1, + "(GDHandle value) -> None"}, + {"LMGetDeviceList", (PyCFunction)Qd_LMGetDeviceList, 1, + "() -> (GDHandle _rv)"}, + {"LMSetDeviceList", (PyCFunction)Qd_LMSetDeviceList, 1, + "(GDHandle value) -> None"}, + {"LMGetQDColors", (PyCFunction)Qd_LMGetQDColors, 1, + "() -> (Handle _rv)"}, + {"LMSetQDColors", (PyCFunction)Qd_LMSetQDColors, 1, + "(Handle value) -> None"}, + {"LMGetWidthListHand", (PyCFunction)Qd_LMGetWidthListHand, 1, + "() -> (Handle _rv)"}, + {"LMSetWidthListHand", (PyCFunction)Qd_LMSetWidthListHand, 1, + "(Handle value) -> None"}, + {"LMGetHiliteMode", (PyCFunction)Qd_LMGetHiliteMode, 1, + "() -> (UInt8 _rv)"}, + {"LMSetHiliteMode", (PyCFunction)Qd_LMSetHiliteMode, 1, + "(UInt8 value) -> None"}, + {"LMGetWidthTabHandle", (PyCFunction)Qd_LMGetWidthTabHandle, 1, + "() -> (Handle _rv)"}, + {"LMSetWidthTabHandle", (PyCFunction)Qd_LMSetWidthTabHandle, 1, + "(Handle value) -> None"}, + {"LMGetLastSPExtra", (PyCFunction)Qd_LMGetLastSPExtra, 1, + "() -> (SInt32 _rv)"}, + {"LMSetLastSPExtra", (PyCFunction)Qd_LMSetLastSPExtra, 1, + "(SInt32 value) -> None"}, + {"LMGetLastFOND", (PyCFunction)Qd_LMGetLastFOND, 1, + "() -> (Handle _rv)"}, + {"LMSetLastFOND", (PyCFunction)Qd_LMSetLastFOND, 1, + "(Handle value) -> None"}, + {"LMGetFractEnable", (PyCFunction)Qd_LMGetFractEnable, 1, + "() -> (UInt8 _rv)"}, + {"LMSetFractEnable", (PyCFunction)Qd_LMSetFractEnable, 1, + "(UInt8 value) -> None"}, + {"LMGetTheGDevice", (PyCFunction)Qd_LMGetTheGDevice, 1, + "() -> (GDHandle _rv)"}, + {"LMSetTheGDevice", (PyCFunction)Qd_LMSetTheGDevice, 1, + "(GDHandle value) -> None"}, + {"LMGetHiliteRGB", (PyCFunction)Qd_LMGetHiliteRGB, 1, + "() -> (RGBColor hiliteRGBValue)"}, + {"LMSetHiliteRGB", (PyCFunction)Qd_LMSetHiliteRGB, 1, + "(RGBColor hiliteRGBValue) -> None"}, + {"LMGetCursorNew", (PyCFunction)Qd_LMGetCursorNew, 1, + "() -> (Boolean _rv)"}, + {"LMSetCursorNew", (PyCFunction)Qd_LMSetCursorNew, 1, + "(Boolean value) -> None"}, {"TextFont", (PyCFunction)Qd_TextFont, 1, "(short font) -> None"}, {"TextFace", (PyCFunction)Qd_TextFace, 1, @@ -5561,6 +6129,8 @@ static PyMethodDef Qd_methods[] = { "() -> (FontInfo info)"}, {"CharExtra", (PyCFunction)Qd_CharExtra, 1, "(Fixed extra) -> None"}, + {"TruncString", (PyCFunction)Qd_TruncString, 1, + "(short width, Str255 theString, TruncCode truncWhere) -> (short _rv)"}, {"SetPort", (PyCFunction)Qd_SetPort, 1, "(GrafPtr thePort) -> None"}, {"GetCursor", (PyCFunction)Qd_GetCursor, 1, diff --git a/Mac/Modules/qd/qdscan.py b/Mac/Modules/qd/qdscan.py index d47b46a..7562915 100644 --- a/Mac/Modules/qd/qdscan.py +++ b/Mac/Modules/qd/qdscan.py @@ -122,6 +122,11 @@ extend = 0x40 'CreateNewPort', 'DisposePort', 'SetQDError', + 'IsPortPolyBeingDefined', + 'QDSetDirtyRegion', + 'QDGetDirtyRegion', + 'IsValidPort', + 'RgnToHandle', ])] diff --git a/Mac/Modules/qd/qdsupport.py b/Mac/Modules/qd/qdsupport.py index 0c969d7..561aefd 100644 --- a/Mac/Modules/qd/qdsupport.py +++ b/Mac/Modules/qd/qdsupport.py @@ -63,6 +63,7 @@ Pattern = StructOutputBufferType('Pattern') Pattern_ptr = StructInputBufferType('Pattern') PenState = StructOutputBufferType('PenState') PenState_ptr = StructInputBufferType('PenState') +TruncCode = Type("TruncCode", "h") includestuff = includestuff + """ #ifdef WITHOUT_FRAMEWORKS diff --git a/Mac/Modules/qdoffs/_Qdoffsmodule.c b/Mac/Modules/qdoffs/_Qdoffsmodule.c index 5af63ef..c2edf17 100644 --- a/Mac/Modules/qdoffs/_Qdoffsmodule.c +++ b/Mac/Modules/qdoffs/_Qdoffsmodule.c @@ -5,8 +5,12 @@ +#ifdef _WIN32 +#include "pywintoolbox.h" +#else #include "macglue.h" #include "pymactoolbox.h" +#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ diff --git a/Mac/Modules/qt/_Qtmodule.c b/Mac/Modules/qt/_Qtmodule.c index 962ee2a..594d156 100644 --- a/Mac/Modules/qt/_Qtmodule.c +++ b/Mac/Modules/qt/_Qtmodule.c @@ -5,8 +5,12 @@ +#ifdef _WIN32 +#include "pywintoolbox.h" +#else #include "macglue.h" #include "pymactoolbox.h" +#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ @@ -822,6 +826,36 @@ static PyObject *MovieCtlObj_MCGetInterfaceElement(MovieControllerObject *_self, return _res; } +static PyObject *MovieCtlObj_MCAddMovieSegment(MovieControllerObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + ComponentResult _rv; + Movie srcMovie; + Boolean scaled; + if (!PyArg_ParseTuple(_args, "O&b", + MovieObj_Convert, &srcMovie, + &scaled)) + return NULL; + _rv = MCAddMovieSegment(_self->ob_itself, + srcMovie, + scaled); + _res = Py_BuildValue("l", + _rv); + return _res; +} + +static PyObject *MovieCtlObj_MCTrimMovieSegment(MovieControllerObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + ComponentResult _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = MCTrimMovieSegment(_self->ob_itself); + _res = Py_BuildValue("l", + _rv); + return _res; +} + static PyMethodDef MovieCtlObj_methods[] = { {"MCSetMovie", (PyCFunction)MovieCtlObj_MCSetMovie, 1, "(Movie theMovie, WindowPtr movieWindow, Point where) -> (ComponentResult _rv)"}, @@ -911,6 +945,10 @@ static PyMethodDef MovieCtlObj_methods[] = { "(WindowPtr w, Point where, long modifiers) -> (ComponentResult _rv)"}, {"MCGetInterfaceElement", (PyCFunction)MovieCtlObj_MCGetInterfaceElement, 1, "(MCInterfaceElement whichElement, void * element) -> (ComponentResult _rv)"}, + {"MCAddMovieSegment", (PyCFunction)MovieCtlObj_MCAddMovieSegment, 1, + "(Movie srcMovie, Boolean scaled) -> (ComponentResult _rv)"}, + {"MCTrimMovieSegment", (PyCFunction)MovieCtlObj_MCTrimMovieSegment, 1, + "() -> (ComponentResult _rv)"}, {NULL, NULL, 0} }; @@ -3311,6 +3349,27 @@ static PyObject *TrackObj_AddEmptyTrackToMovie(TrackObject *_self, PyObject *_ar return _res; } +static PyObject *TrackObj_AddClonedTrackToMovie(TrackObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + OSErr _err; + Movie dstMovie; + long flags; + Track dstTrack; + if (!PyArg_ParseTuple(_args, "O&l", + MovieObj_Convert, &dstMovie, + &flags)) + return NULL; + _err = AddClonedTrackToMovie(_self->ob_itself, + dstMovie, + flags, + &dstTrack); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&", + TrackObj_New, dstTrack); + return _res; +} + static PyObject *TrackObj_AddTrackReference(TrackObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -3673,6 +3732,8 @@ static PyMethodDef TrackObj_methods[] = { "(Track dstTrack) -> None"}, {"AddEmptyTrackToMovie", (PyCFunction)TrackObj_AddEmptyTrackToMovie, 1, "(Movie dstMovie, Handle dataRef, OSType dataRefType) -> (Track dstTrack)"}, + {"AddClonedTrackToMovie", (PyCFunction)TrackObj_AddClonedTrackToMovie, 1, + "(Movie dstMovie, long flags) -> (Track dstTrack)"}, {"AddTrackReference", (PyCFunction)TrackObj_AddTrackReference, 1, "(Track refTrack, OSType refType) -> (long addedIndex)"}, {"DeleteTrackReference", (PyCFunction)TrackObj_DeleteTrackReference, 1, @@ -4252,6 +4313,20 @@ static PyObject *MovieObj_GetMovieBoundsRgn(MovieObject *_self, PyObject *_args) return _res; } +static PyObject *MovieObj_SetMovieVideoOutput(MovieObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + ComponentInstance vout; + if (!PyArg_ParseTuple(_args, "O&", + CmpInstObj_Convert, &vout)) + return NULL; + SetMovieVideoOutput(_self->ob_itself, + vout); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + static PyObject *MovieObj_PutMovieIntoHandle(MovieObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -5614,6 +5689,8 @@ static PyMethodDef MovieObj_methods[] = { "() -> (RgnHandle _rv)"}, {"GetMovieBoundsRgn", (PyCFunction)MovieObj_GetMovieBoundsRgn, 1, "() -> (RgnHandle _rv)"}, + {"SetMovieVideoOutput", (PyCFunction)MovieObj_SetMovieVideoOutput, 1, + "(ComponentInstance vout) -> None"}, {"PutMovieIntoHandle", (PyCFunction)MovieObj_PutMovieIntoHandle, 1, "(Handle publicMovie) -> None"}, {"PutMovieIntoDataFork", (PyCFunction)MovieObj_PutMovieIntoDataFork, 1, @@ -6027,6 +6104,32 @@ static PyObject *Qt_GetMovieImporterForDataRef(PyObject *_self, PyObject *_args) return _res; } +static PyObject *Qt_QTGetMIMETypeInfo(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + OSErr _err; + char* mimeStringStart; + short mimeStringLength; + OSType infoSelector; + void * infoDataPtr; + long infoDataSize; + if (!PyArg_ParseTuple(_args, "shO&s", + &mimeStringStart, + &mimeStringLength, + PyMac_GetOSType, &infoSelector, + &infoDataPtr)) + return NULL; + _err = QTGetMIMETypeInfo(mimeStringStart, + mimeStringLength, + infoSelector, + infoDataPtr, + &infoDataSize); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("l", + infoDataSize); + return _res; +} + static PyObject *Qt_TrackTimeToMediaTime(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -6331,6 +6434,67 @@ static PyObject *Qt_CreateShortcutMovieFile(PyObject *_self, PyObject *_args) return _res; } +static PyObject *Qt_CanQuickTimeOpenFile(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + OSErr _err; + FSSpec fileSpec; + OSType fileType; + OSType fileNameExtension; + Boolean outCanOpenWithGraphicsImporter; + Boolean outCanOpenAsMovie; + Boolean outPreferGraphicsImporter; + UInt32 inFlags; + if (!PyArg_ParseTuple(_args, "O&O&O&l", + PyMac_GetFSSpec, &fileSpec, + PyMac_GetOSType, &fileType, + PyMac_GetOSType, &fileNameExtension, + &inFlags)) + return NULL; + _err = CanQuickTimeOpenFile(&fileSpec, + fileType, + fileNameExtension, + &outCanOpenWithGraphicsImporter, + &outCanOpenAsMovie, + &outPreferGraphicsImporter, + inFlags); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("bbb", + outCanOpenWithGraphicsImporter, + outCanOpenAsMovie, + outPreferGraphicsImporter); + return _res; +} + +static PyObject *Qt_CanQuickTimeOpenDataRef(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + OSErr _err; + Handle dataRef; + OSType dataRefType; + Boolean outCanOpenWithGraphicsImporter; + Boolean outCanOpenAsMovie; + Boolean outPreferGraphicsImporter; + UInt32 inFlags; + if (!PyArg_ParseTuple(_args, "O&O&l", + ResObj_Convert, &dataRef, + PyMac_GetOSType, &dataRefType, + &inFlags)) + return NULL; + _err = CanQuickTimeOpenDataRef(dataRef, + dataRefType, + &outCanOpenWithGraphicsImporter, + &outCanOpenAsMovie, + &outPreferGraphicsImporter, + inFlags); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("bbb", + outCanOpenWithGraphicsImporter, + outCanOpenAsMovie, + outPreferGraphicsImporter); + return _res; +} + static PyObject *Qt_NewMovieFromScrap(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -6909,6 +7073,32 @@ static PyObject *Qt_TextMediaRawIdle(PyObject *_self, PyObject *_args) return _res; } +static PyObject *Qt_TextMediaGetTextProperty(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + ComponentResult _rv; + MediaHandler mh; + TimeValue atMediaTime; + long propertyType; + void * data; + long dataSize; + if (!PyArg_ParseTuple(_args, "O&llsl", + CmpInstObj_Convert, &mh, + &atMediaTime, + &propertyType, + &data, + &dataSize)) + return NULL; + _rv = TextMediaGetTextProperty(mh, + atMediaTime, + propertyType, + data, + dataSize); + _res = Py_BuildValue("l", + _rv); + return _res; +} + static PyObject *Qt_TextMediaFindNextText(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -7617,6 +7807,95 @@ static PyObject *Qt_FlashMediaFrameLabelToMovieTime(PyObject *_self, PyObject *_ return _res; } +static PyObject *Qt_FlashMediaGetFlashVariable(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + ComponentResult _rv; + MediaHandler mh; + char path; + char name; + Handle theVariableCStringOut; + if (!PyArg_ParseTuple(_args, "O&", + CmpInstObj_Convert, &mh)) + return NULL; + _rv = FlashMediaGetFlashVariable(mh, + &path, + &name, + &theVariableCStringOut); + _res = Py_BuildValue("lccO&", + _rv, + path, + name, + ResObj_New, theVariableCStringOut); + return _res; +} + +static PyObject *Qt_FlashMediaSetFlashVariable(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + ComponentResult _rv; + MediaHandler mh; + char path; + char name; + char value; + Boolean updateFocus; + if (!PyArg_ParseTuple(_args, "O&b", + CmpInstObj_Convert, &mh, + &updateFocus)) + return NULL; + _rv = FlashMediaSetFlashVariable(mh, + &path, + &name, + &value, + updateFocus); + _res = Py_BuildValue("lccc", + _rv, + path, + name, + value); + return _res; +} + +static PyObject *Qt_FlashMediaDoButtonActions(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + ComponentResult _rv; + MediaHandler mh; + char path; + long buttonID; + long transition; + if (!PyArg_ParseTuple(_args, "O&ll", + CmpInstObj_Convert, &mh, + &buttonID, + &transition)) + return NULL; + _rv = FlashMediaDoButtonActions(mh, + &path, + buttonID, + transition); + _res = Py_BuildValue("lc", + _rv, + path); + return _res; +} + +static PyObject *Qt_FlashMediaGetSupportedSwfVersion(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + ComponentResult _rv; + MediaHandler mh; + UInt8 swfVersion; + if (!PyArg_ParseTuple(_args, "O&", + CmpInstObj_Convert, &mh)) + return NULL; + _rv = FlashMediaGetSupportedSwfVersion(mh, + &swfVersion); + _res = Py_BuildValue("lb", + _rv, + swfVersion); + return _res; +} + #if !TARGET_API_MAC_CARBON static PyObject *Qt_MovieMediaGetCurrentMovieProperty(PyObject *_self, PyObject *_args) @@ -7985,32 +8264,30 @@ static PyObject *Qt_NewTimeBase(PyObject *_self, PyObject *_args) static PyObject *Qt_ConvertTime(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; - TimeRecord inout; + TimeRecord theTime; TimeBase newBase; - if (!PyArg_ParseTuple(_args, "O&O&", - QtTimeRecord_Convert, &inout, + if (!PyArg_ParseTuple(_args, "O&", TimeBaseObj_Convert, &newBase)) return NULL; - ConvertTime(&inout, + ConvertTime(&theTime, newBase); _res = Py_BuildValue("O&", - QtTimeRecord_New, &inout); + QtTimeRecord_New, &theTime); return _res; } static PyObject *Qt_ConvertTimeScale(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; - TimeRecord inout; + TimeRecord theTime; TimeScale newScale; - if (!PyArg_ParseTuple(_args, "O&l", - QtTimeRecord_Convert, &inout, + if (!PyArg_ParseTuple(_args, "l", &newScale)) return NULL; - ConvertTimeScale(&inout, + ConvertTimeScale(&theTime, newScale); _res = Py_BuildValue("O&", - QtTimeRecord_New, &inout); + QtTimeRecord_New, &theTime); return _res; } @@ -8150,6 +8427,8 @@ static PyMethodDef Qt_methods[] = { "(Handle h, OSType handleType, Movie theMovie, long flags, ComponentInstance userComp) -> None"}, {"GetMovieImporterForDataRef", (PyCFunction)Qt_GetMovieImporterForDataRef, 1, "(OSType dataRefType, Handle dataRef, long flags) -> (Component importer)"}, + {"QTGetMIMETypeInfo", (PyCFunction)Qt_QTGetMIMETypeInfo, 1, + "(char* mimeStringStart, short mimeStringLength, OSType infoSelector, void * infoDataPtr) -> (long infoDataSize)"}, {"TrackTimeToMediaTime", (PyCFunction)Qt_TrackTimeToMediaTime, 1, "(TimeValue value, Track theTrack) -> (TimeValue _rv)"}, {"NewUserData", (PyCFunction)Qt_NewUserData, 1, @@ -8178,6 +8457,10 @@ static PyMethodDef Qt_methods[] = { "(short resRefNum, short resId) -> None"}, {"CreateShortcutMovieFile", (PyCFunction)Qt_CreateShortcutMovieFile, 1, "(FSSpec fileSpec, OSType creator, ScriptCode scriptTag, long createMovieFileFlags, Handle targetDataRef, OSType targetDataRefType) -> None"}, + {"CanQuickTimeOpenFile", (PyCFunction)Qt_CanQuickTimeOpenFile, 1, + "(FSSpec fileSpec, OSType fileType, OSType fileNameExtension, UInt32 inFlags) -> (Boolean outCanOpenWithGraphicsImporter, Boolean outCanOpenAsMovie, Boolean outPreferGraphicsImporter)"}, + {"CanQuickTimeOpenDataRef", (PyCFunction)Qt_CanQuickTimeOpenDataRef, 1, + "(Handle dataRef, OSType dataRefType, UInt32 inFlags) -> (Boolean outCanOpenWithGraphicsImporter, Boolean outCanOpenAsMovie, Boolean outPreferGraphicsImporter)"}, {"NewMovieFromScrap", (PyCFunction)Qt_NewMovieFromScrap, 1, "(long newMovieFlags) -> (Movie _rv)"}, {"QTNewAlias", (PyCFunction)Qt_QTNewAlias, 1, @@ -8226,6 +8509,8 @@ static PyMethodDef Qt_methods[] = { "(MediaHandler mh, GWorldPtr gw, GDHandle gd, void * data, long dataSize, TextDescriptionHandle tdh, TimeValue sampleDuration) -> (ComponentResult _rv)"}, {"TextMediaRawIdle", (PyCFunction)Qt_TextMediaRawIdle, 1, "(MediaHandler mh, GWorldPtr gw, GDHandle gd, TimeValue sampleTime, long flagsIn) -> (ComponentResult _rv, long flagsOut)"}, + {"TextMediaGetTextProperty", (PyCFunction)Qt_TextMediaGetTextProperty, 1, + "(MediaHandler mh, TimeValue atMediaTime, long propertyType, void * data, long dataSize) -> (ComponentResult _rv)"}, {"TextMediaFindNextText", (PyCFunction)Qt_TextMediaFindNextText, 1, "(MediaHandler mh, Ptr text, long size, short findFlags, TimeValue startTime) -> (ComponentResult _rv, TimeValue foundTime, TimeValue foundDuration, long offset)"}, {"TextMediaHiliteTextSample", (PyCFunction)Qt_TextMediaHiliteTextSample, 1, @@ -8295,6 +8580,14 @@ static PyMethodDef Qt_methods[] = { "(MediaHandler mh, long flashFrameNumber) -> (ComponentResult _rv, TimeValue movieTime)"}, {"FlashMediaFrameLabelToMovieTime", (PyCFunction)Qt_FlashMediaFrameLabelToMovieTime, 1, "(MediaHandler mh, Ptr theLabel) -> (ComponentResult _rv, TimeValue movieTime)"}, + {"FlashMediaGetFlashVariable", (PyCFunction)Qt_FlashMediaGetFlashVariable, 1, + "(MediaHandler mh) -> (ComponentResult _rv, char path, char name, Handle theVariableCStringOut)"}, + {"FlashMediaSetFlashVariable", (PyCFunction)Qt_FlashMediaSetFlashVariable, 1, + "(MediaHandler mh, Boolean updateFocus) -> (ComponentResult _rv, char path, char name, char value)"}, + {"FlashMediaDoButtonActions", (PyCFunction)Qt_FlashMediaDoButtonActions, 1, + "(MediaHandler mh, long buttonID, long transition) -> (ComponentResult _rv, char path)"}, + {"FlashMediaGetSupportedSwfVersion", (PyCFunction)Qt_FlashMediaGetSupportedSwfVersion, 1, + "(MediaHandler mh) -> (ComponentResult _rv, UInt8 swfVersion)"}, #if !TARGET_API_MAC_CARBON {"MovieMediaGetCurrentMovieProperty", (PyCFunction)Qt_MovieMediaGetCurrentMovieProperty, 1, @@ -8348,9 +8641,9 @@ static PyMethodDef Qt_methods[] = { {"NewTimeBase", (PyCFunction)Qt_NewTimeBase, 1, "() -> (TimeBase _rv)"}, {"ConvertTime", (PyCFunction)Qt_ConvertTime, 1, - "(TimeRecord inout, TimeBase newBase) -> (TimeRecord inout)"}, + "(TimeBase newBase) -> (TimeRecord theTime)"}, {"ConvertTimeScale", (PyCFunction)Qt_ConvertTimeScale, 1, - "(TimeRecord inout, TimeScale newScale) -> (TimeRecord inout)"}, + "(TimeScale newScale) -> (TimeRecord theTime)"}, {"AddTime", (PyCFunction)Qt_AddTime, 1, "(TimeRecord dst, TimeRecord src) -> (TimeRecord dst)"}, {"SubtractTime", (PyCFunction)Qt_SubtractTime, 1, diff --git a/Mac/Modules/qt/qtscan.py b/Mac/Modules/qt/qtscan.py index 45ef428..f0e3d1e 100644 --- a/Mac/Modules/qt/qtscan.py +++ b/Mac/Modules/qt/qtscan.py @@ -144,6 +144,11 @@ class MyScanner(Scanner): # AddTime and SubtractTime ([('TimeRecord', 'dst', 'OutMode')], [('TimeRecord', 'dst', 'InOutMode')]), + + # Funny definitions + ([('char_ptr', '*', 'InMode')], [('stringptr', '*', 'InMode')]), + ([('FSSpecPtr', '*', 'InMode')], [('FSSpec_ptr', '*', 'InMode')]), + ([('unsigned_char', 'swfVersion', 'OutMode')], [('UInt8', 'swfVersion', 'OutMode')]), ] if __name__ == "__main__": diff --git a/Mac/Modules/res/_Resmodule.c b/Mac/Modules/res/_Resmodule.c index b29e852..0c4576b 100644 --- a/Mac/Modules/res/_Resmodule.c +++ b/Mac/Modules/res/_Resmodule.c @@ -5,8 +5,12 @@ +#ifdef _WIN32 +#include "pywintoolbox.h" +#else #include "macglue.h" #include "pymactoolbox.h" +#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ @@ -1357,6 +1361,51 @@ static PyObject *Res_GetNextResourceFile(PyObject *_self, PyObject *_args) } #endif +static PyObject *Res_FSOpenResFile(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + short _rv; + FSRef ref; + SignedByte permission; + if (!PyArg_ParseTuple(_args, "O&b", + PyMac_GetFSRef, &ref, + &permission)) + return NULL; + _rv = FSOpenResFile(&ref, + permission); + { + OSErr _err = ResError(); + if (_err != noErr) return PyMac_Error(_err); + } + _res = Py_BuildValue("h", + _rv); + return _res; +} + +static PyObject *Res_FSResourceFileAlreadyOpen(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + Boolean _rv; + FSRef resourceFileRef; + Boolean inChain; + SInt16 refNum; + if (!PyArg_ParseTuple(_args, "O&", + PyMac_GetFSRef, &resourceFileRef)) + return NULL; + _rv = FSResourceFileAlreadyOpen(&resourceFileRef, + &inChain, + &refNum); + { + OSErr _err = ResError(); + if (_err != noErr) return PyMac_Error(_err); + } + _res = Py_BuildValue("bbh", + _rv, + inChain, + refNum); + return _res; +} + static PyObject *Res_Resource(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -1518,6 +1567,10 @@ static PyMethodDef Res_methods[] = { {"GetNextResourceFile", (PyCFunction)Res_GetNextResourceFile, 1, "(SInt16 curRefNum) -> (OSErr _rv, SInt16 nextRefNum)"}, #endif + {"FSOpenResFile", (PyCFunction)Res_FSOpenResFile, 1, + "(FSRef ref, SignedByte permission) -> (short _rv)"}, + {"FSResourceFileAlreadyOpen", (PyCFunction)Res_FSResourceFileAlreadyOpen, 1, + "(FSRef resourceFileRef) -> (Boolean _rv, Boolean inChain, SInt16 refNum)"}, {"Resource", (PyCFunction)Res_Resource, 1, "Convert a string to a resource object.\n\nThe created resource object is actually just a handle,\napply AddResource() to write it to a resource file.\nSee also the Handle() docstring.\n"}, {"Handle", (PyCFunction)Res_Handle, 1, diff --git a/Mac/Modules/res/resscan.py b/Mac/Modules/res/resscan.py index d748adb..ecdd86b 100644 --- a/Mac/Modules/res/resscan.py +++ b/Mac/Modules/res/resscan.py @@ -46,6 +46,11 @@ class ResourcesScanner(Scanner): ## "MaxSizeRsrc", # GetMaxResourceSize ] + def makeblacklisttypes(self): + return [ + "UniCharCount", #TBD + ] + def makegreylist(self): return [ ('#if TARGET_API_MAC_OS8', [ diff --git a/Mac/Modules/res/ressupport.py b/Mac/Modules/res/ressupport.py index f7a1f45..056e214 100644 --- a/Mac/Modules/res/ressupport.py +++ b/Mac/Modules/res/ressupport.py @@ -5,6 +5,7 @@ from macsupport import * +FSRef_ptr = OpaqueType("FSRef", "PyMac_BuildFSRef", "PyMac_GetFSRef") class ResMixIn: diff --git a/Mac/Modules/snd/_Sndmodule.c b/Mac/Modules/snd/_Sndmodule.c index 3812507..dc2f5da 100644 --- a/Mac/Modules/snd/_Sndmodule.c +++ b/Mac/Modules/snd/_Sndmodule.c @@ -5,8 +5,12 @@ +#ifdef _WIN32 +#include "pywintoolbox.h" +#else #include "macglue.h" #include "pymactoolbox.h" +#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ diff --git a/Mac/Modules/te/_TEmodule.c b/Mac/Modules/te/_TEmodule.c index c545c8b..f57b7e6 100644 --- a/Mac/Modules/te/_TEmodule.c +++ b/Mac/Modules/te/_TEmodule.c @@ -5,8 +5,12 @@ +#ifdef _WIN32 +#include "pywintoolbox.h" +#else #include "macglue.h" #include "pymactoolbox.h" +#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ diff --git a/Mac/Modules/waste/wastemodule.c b/Mac/Modules/waste/wastemodule.c index 734a2e7..f459c11 100644 --- a/Mac/Modules/waste/wastemodule.c +++ b/Mac/Modules/waste/wastemodule.c @@ -5,8 +5,12 @@ +#ifdef _WIN32 +#include "pywintoolbox.h" +#else #include "macglue.h" #include "pymactoolbox.h" +#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ diff --git a/Mac/Modules/win/_Winmodule.c b/Mac/Modules/win/_Winmodule.c index fa0cfeb..6db74a9 100644 --- a/Mac/Modules/win/_Winmodule.c +++ b/Mac/Modules/win/_Winmodule.c @@ -5,8 +5,12 @@ +#ifdef _WIN32 +#include "pywintoolbox.h" +#else #include "macglue.h" #include "pymactoolbox.h" +#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ @@ -153,7 +157,63 @@ static PyObject *WinObj_CloneWindow(WindowObject *_self, PyObject *_args) return _res; } -#if TARGET_API_MAC_CARBON +#if !TARGET_API_MAC_OS8 + +static PyObject *WinObj_GetWindowRetainCount(WindowObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + ItemCount _rv; +#ifndef GetWindowRetainCount + PyMac_PRECHECK(GetWindowRetainCount); +#endif + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = GetWindowRetainCount(_self->ob_itself); + _res = Py_BuildValue("l", + _rv); + return _res; +} +#endif + +#if !TARGET_API_MAC_OS8 + +static PyObject *WinObj_RetainWindow(WindowObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + OSStatus _err; +#ifndef RetainWindow + PyMac_PRECHECK(RetainWindow); +#endif + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _err = RetainWindow(_self->ob_itself); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} +#endif + +#if !TARGET_API_MAC_OS8 + +static PyObject *WinObj_ReleaseWindow(WindowObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + OSStatus _err; +#ifndef ReleaseWindow + PyMac_PRECHECK(ReleaseWindow); +#endif + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _err = ReleaseWindow(_self->ob_itself); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} +#endif + +#if !TARGET_API_MAC_OS8 static PyObject *WinObj_ReshapeCustomWindow(WindowObject *_self, PyObject *_args) { @@ -172,6 +232,24 @@ static PyObject *WinObj_ReshapeCustomWindow(WindowObject *_self, PyObject *_args } #endif +static PyObject *WinObj_GetWindowWidgetHilite(WindowObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + OSStatus _err; + WindowDefPartCode outHilite; +#ifndef GetWindowWidgetHilite + PyMac_PRECHECK(GetWindowWidgetHilite); +#endif + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _err = GetWindowWidgetHilite(_self->ob_itself, + &outHilite); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("h", + outHilite); + return _res; +} + static PyObject *WinObj_GetWindowClass(WindowObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -208,7 +286,7 @@ static PyObject *WinObj_GetWindowAttributes(WindowObject *_self, PyObject *_args return _res; } -#if TARGET_API_MAC_CARBON +#if !TARGET_API_MAC_OS8 static PyObject *WinObj_ChangeWindowAttributes(WindowObject *_self, PyObject *_args) { @@ -233,6 +311,77 @@ static PyObject *WinObj_ChangeWindowAttributes(WindowObject *_self, PyObject *_a } #endif +#if !TARGET_API_MAC_OS8 + +static PyObject *WinObj_SetWindowClass(WindowObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + OSStatus _err; + WindowClass inWindowClass; +#ifndef SetWindowClass + PyMac_PRECHECK(SetWindowClass); +#endif + if (!PyArg_ParseTuple(_args, "l", + &inWindowClass)) + return NULL; + _err = SetWindowClass(_self->ob_itself, + inWindowClass); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} +#endif + +#if !TARGET_API_MAC_OS8 + +static PyObject *WinObj_SetWindowModality(WindowObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + OSStatus _err; + WindowModality inModalKind; + WindowPtr inUnavailableWindow; +#ifndef SetWindowModality + PyMac_PRECHECK(SetWindowModality); +#endif + if (!PyArg_ParseTuple(_args, "lO&", + &inModalKind, + WinObj_Convert, &inUnavailableWindow)) + return NULL; + _err = SetWindowModality(_self->ob_itself, + inModalKind, + inUnavailableWindow); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} +#endif + +#if !TARGET_API_MAC_OS8 + +static PyObject *WinObj_GetWindowModality(WindowObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + OSStatus _err; + WindowModality outModalKind; + WindowPtr outUnavailableWindow; +#ifndef GetWindowModality + PyMac_PRECHECK(GetWindowModality); +#endif + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _err = GetWindowModality(_self->ob_itself, + &outModalKind, + &outUnavailableWindow); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("lO&", + outModalKind, + WinObj_WhichWindow, outUnavailableWindow); + return _res; +} +#endif + #if !TARGET_API_MAC_CARBON static PyObject *WinObj_SetWinColor(WindowObject *_self, PyObject *_args) @@ -328,7 +477,7 @@ static PyObject *WinObj_SetWindowContentPattern(WindowObject *_self, PyObject *_ return _res; } -#if TARGET_API_MAC_CARBON +#if !TARGET_API_MAC_OS8 static PyObject *WinObj_ScrollWindowRect(WindowObject *_self, PyObject *_args) { @@ -362,7 +511,7 @@ static PyObject *WinObj_ScrollWindowRect(WindowObject *_self, PyObject *_args) } #endif -#if TARGET_API_MAC_CARBON +#if !TARGET_API_MAC_OS8 static PyObject *WinObj_ScrollWindowRegion(WindowObject *_self, PyObject *_args) { @@ -557,7 +706,7 @@ static PyObject *WinObj_SelectWindow(WindowObject *_self, PyObject *_args) return _res; } -#if TARGET_API_MAC_CARBON +#if !TARGET_API_MAC_OS8 static PyObject *WinObj_GetNextWindowOfClass(WindowObject *_self, PyObject *_args) { @@ -581,6 +730,49 @@ static PyObject *WinObj_GetNextWindowOfClass(WindowObject *_self, PyObject *_arg } #endif +#if !TARGET_API_MAC_OS8 + +static PyObject *WinObj_SetWindowAlternateTitle(WindowObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + OSStatus _err; + CFStringRef inTitle; +#ifndef SetWindowAlternateTitle + PyMac_PRECHECK(SetWindowAlternateTitle); +#endif + if (!PyArg_ParseTuple(_args, "O&", + CFStringRefObj_Convert, &inTitle)) + return NULL; + _err = SetWindowAlternateTitle(_self->ob_itself, + inTitle); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} +#endif + +#if !TARGET_API_MAC_OS8 + +static PyObject *WinObj_CopyWindowAlternateTitle(WindowObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + OSStatus _err; + CFStringRef outTitle; +#ifndef CopyWindowAlternateTitle + PyMac_PRECHECK(CopyWindowAlternateTitle); +#endif + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _err = CopyWindowAlternateTitle(_self->ob_itself, + &outTitle); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&", + CFStringRefObj_New, outTitle); + return _res; +} +#endif + #if !TARGET_API_MAC_CARBON static PyObject *WinObj_IsValidWindowPtr(WindowObject *_self, PyObject *_args) @@ -735,6 +927,24 @@ static PyObject *WinObj_GetWindowRegion(WindowObject *_self, PyObject *_args) return _res; } +static PyObject *WinObj_GetWindowStructureWidths(WindowObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + OSStatus _err; + Rect outRect; +#ifndef GetWindowStructureWidths + PyMac_PRECHECK(GetWindowStructureWidths); +#endif + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _err = GetWindowStructureWidths(_self->ob_itself, + &outRect); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&", + PyMac_BuildRect, &outRect); + return _res; +} + static PyObject *WinObj_BeginUpdate(WindowObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -886,6 +1096,49 @@ static PyObject *WinObj_GetWTitle(WindowObject *_self, PyObject *_args) return _res; } +#if !TARGET_API_MAC_OS8 + +static PyObject *WinObj_SetWindowTitleWithCFString(WindowObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + OSStatus _err; + CFStringRef inString; +#ifndef SetWindowTitleWithCFString + PyMac_PRECHECK(SetWindowTitleWithCFString); +#endif + if (!PyArg_ParseTuple(_args, "O&", + CFStringRefObj_Convert, &inString)) + return NULL; + _err = SetWindowTitleWithCFString(_self->ob_itself, + inString); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} +#endif + +#if !TARGET_API_MAC_OS8 + +static PyObject *WinObj_CopyWindowTitleAsCFString(WindowObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + OSStatus _err; + CFStringRef outString; +#ifndef CopyWindowTitleAsCFString + PyMac_PRECHECK(CopyWindowTitleAsCFString); +#endif + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _err = CopyWindowTitleAsCFString(_self->ob_itself, + &outString); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&", + CFStringRefObj_New, outString); + return _res; +} +#endif + static PyObject *WinObj_SetWindowProxyFSSpec(WindowObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -1239,6 +1492,37 @@ static PyObject *WinObj_TransitionWindow(WindowObject *_self, PyObject *_args) return _res; } +#if TARGET_API_MAC_OSX + +static PyObject *WinObj_TransitionWindowAndParent(WindowObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + OSStatus _err; + WindowPtr parentWindow; + WindowTransitionEffect effect; + WindowTransitionAction action; + Rect rect; +#ifndef TransitionWindowAndParent + PyMac_PRECHECK(TransitionWindowAndParent); +#endif + if (!PyArg_ParseTuple(_args, "O&llO&", + WinObj_Convert, &parentWindow, + &effect, + &action, + PyMac_GetRect, &rect)) + return NULL; + _err = TransitionWindowAndParent(_self->ob_itself, + parentWindow, + effect, + action, + &rect); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} +#endif + static PyObject *WinObj_MacMoveWindow(WindowObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -1574,15 +1858,73 @@ static PyObject *WinObj_SetWindowIdealUserState(WindowObject *_self, PyObject *_ #ifndef SetWindowIdealUserState PyMac_PRECHECK(SetWindowIdealUserState); #endif - if (!PyArg_ParseTuple(_args, "")) + if (!PyArg_ParseTuple(_args, "O&", + PyMac_GetRect, &userState)) return NULL; _err = SetWindowIdealUserState(_self->ob_itself, &userState); if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +#if !TARGET_API_MAC_OS8 + +static PyObject *WinObj_GetWindowGreatestAreaDevice(WindowObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + OSStatus _err; + WindowRegionCode inRegion; + GDHandle outGreatestDevice; + Rect outGreatestDeviceRect; +#ifndef GetWindowGreatestAreaDevice + PyMac_PRECHECK(GetWindowGreatestAreaDevice); +#endif + if (!PyArg_ParseTuple(_args, "H", + &inRegion)) + return NULL; + _err = GetWindowGreatestAreaDevice(_self->ob_itself, + inRegion, + &outGreatestDevice, + &outGreatestDeviceRect); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&O&", + ResObj_New, outGreatestDevice, + PyMac_BuildRect, &outGreatestDeviceRect); + return _res; +} +#endif + +#if !TARGET_API_MAC_OS8 + +static PyObject *WinObj_ConstrainWindowToScreen(WindowObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + OSStatus _err; + WindowRegionCode inRegionCode; + WindowConstrainOptions inOptions; + Rect inScreenRect; + Rect outStructure; +#ifndef ConstrainWindowToScreen + PyMac_PRECHECK(ConstrainWindowToScreen); +#endif + if (!PyArg_ParseTuple(_args, "HlO&", + &inRegionCode, + &inOptions, + PyMac_GetRect, &inScreenRect)) + return NULL; + _err = ConstrainWindowToScreen(_self->ob_itself, + inRegionCode, + inOptions, + &inScreenRect, + &outStructure); + if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&", - PyMac_BuildRect, &userState); + PyMac_BuildRect, &outStructure); return _res; } +#endif static PyObject *WinObj_HideWindow(WindowObject *_self, PyObject *_args) { @@ -1629,7 +1971,84 @@ static PyObject *WinObj_ShowHide(WindowObject *_self, PyObject *_args) return _res; } -#if TARGET_API_MAC_CARBON +static PyObject *WinObj_MacIsWindowVisible(WindowObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + Boolean _rv; +#ifndef MacIsWindowVisible + PyMac_PRECHECK(MacIsWindowVisible); +#endif + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = MacIsWindowVisible(_self->ob_itself); + _res = Py_BuildValue("b", + _rv); + return _res; +} + +#if !TARGET_API_MAC_OS8 + +static PyObject *WinObj_ShowSheetWindow(WindowObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + OSStatus _err; + WindowPtr inParentWindow; +#ifndef ShowSheetWindow + PyMac_PRECHECK(ShowSheetWindow); +#endif + if (!PyArg_ParseTuple(_args, "O&", + WinObj_Convert, &inParentWindow)) + return NULL; + _err = ShowSheetWindow(_self->ob_itself, + inParentWindow); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} +#endif + +#if !TARGET_API_MAC_OS8 + +static PyObject *WinObj_HideSheetWindow(WindowObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + OSStatus _err; +#ifndef HideSheetWindow + PyMac_PRECHECK(HideSheetWindow); +#endif + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _err = HideSheetWindow(_self->ob_itself); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} +#endif + +#if !TARGET_API_MAC_OS8 + +static PyObject *WinObj_GetSheetWindowParent(WindowObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + OSStatus _err; + WindowPtr outParentWindow; +#ifndef GetSheetWindowParent + PyMac_PRECHECK(GetSheetWindowParent); +#endif + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _err = GetSheetWindowParent(_self->ob_itself, + &outParentWindow); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&", + WinObj_WhichWindow, outParentWindow); + return _res; +} +#endif + +#if !TARGET_API_MAC_OS8 static PyObject *WinObj_GetWindowPropertyAttributes(WindowObject *_self, PyObject *_args) { @@ -1656,7 +2075,7 @@ static PyObject *WinObj_GetWindowPropertyAttributes(WindowObject *_self, PyObjec } #endif -#if TARGET_API_MAC_CARBON +#if !TARGET_API_MAC_OS8 static PyObject *WinObj_ChangeWindowPropertyAttributes(WindowObject *_self, PyObject *_args) { @@ -1813,21 +2232,6 @@ static PyObject *WinObj_GetWindowKind(WindowObject *_self, PyObject *_args) return _res; } -static PyObject *WinObj_MacIsWindowVisible(WindowObject *_self, PyObject *_args) -{ - PyObject *_res = NULL; - Boolean _rv; -#ifndef MacIsWindowVisible - PyMac_PRECHECK(MacIsWindowVisible); -#endif - if (!PyArg_ParseTuple(_args, "")) - return NULL; - _rv = MacIsWindowVisible(_self->ob_itself); - _res = Py_BuildValue("b", - _rv); - return _res; -} - static PyObject *WinObj_IsWindowHilited(WindowObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -1843,7 +2247,7 @@ static PyObject *WinObj_IsWindowHilited(WindowObject *_self, PyObject *_args) return _res; } -#if TARGET_API_MAC_CARBON +#if !TARGET_API_MAC_OS8 static PyObject *WinObj_IsWindowUpdatePending(WindowObject *_self, PyObject *_args) { @@ -2166,20 +2570,52 @@ static PyMethodDef WinObj_methods[] = { {"CloneWindow", (PyCFunction)WinObj_CloneWindow, 1, "() -> None"}, -#if TARGET_API_MAC_CARBON +#if !TARGET_API_MAC_OS8 + {"GetWindowRetainCount", (PyCFunction)WinObj_GetWindowRetainCount, 1, + "() -> (ItemCount _rv)"}, +#endif + +#if !TARGET_API_MAC_OS8 + {"RetainWindow", (PyCFunction)WinObj_RetainWindow, 1, + "() -> None"}, +#endif + +#if !TARGET_API_MAC_OS8 + {"ReleaseWindow", (PyCFunction)WinObj_ReleaseWindow, 1, + "() -> None"}, +#endif + +#if !TARGET_API_MAC_OS8 {"ReshapeCustomWindow", (PyCFunction)WinObj_ReshapeCustomWindow, 1, "() -> None"}, #endif + {"GetWindowWidgetHilite", (PyCFunction)WinObj_GetWindowWidgetHilite, 1, + "() -> (WindowDefPartCode outHilite)"}, {"GetWindowClass", (PyCFunction)WinObj_GetWindowClass, 1, "() -> (WindowClass outClass)"}, {"GetWindowAttributes", (PyCFunction)WinObj_GetWindowAttributes, 1, "() -> (WindowAttributes outAttributes)"}, -#if TARGET_API_MAC_CARBON +#if !TARGET_API_MAC_OS8 {"ChangeWindowAttributes", (PyCFunction)WinObj_ChangeWindowAttributes, 1, "(WindowAttributes setTheseAttributes, WindowAttributes clearTheseAttributes) -> None"}, #endif +#if !TARGET_API_MAC_OS8 + {"SetWindowClass", (PyCFunction)WinObj_SetWindowClass, 1, + "(WindowClass inWindowClass) -> None"}, +#endif + +#if !TARGET_API_MAC_OS8 + {"SetWindowModality", (PyCFunction)WinObj_SetWindowModality, 1, + "(WindowModality inModalKind, WindowPtr inUnavailableWindow) -> None"}, +#endif + +#if !TARGET_API_MAC_OS8 + {"GetWindowModality", (PyCFunction)WinObj_GetWindowModality, 1, + "() -> (WindowModality outModalKind, WindowPtr outUnavailableWindow)"}, +#endif + #if !TARGET_API_MAC_CARBON {"SetWinColor", (PyCFunction)WinObj_SetWinColor, 1, "(WCTabHandle newColorTable) -> None"}, @@ -2193,12 +2629,12 @@ static PyMethodDef WinObj_methods[] = { {"SetWindowContentPattern", (PyCFunction)WinObj_SetWindowContentPattern, 1, "(PixPatHandle pixPat) -> None"}, -#if TARGET_API_MAC_CARBON +#if !TARGET_API_MAC_OS8 {"ScrollWindowRect", (PyCFunction)WinObj_ScrollWindowRect, 1, "(Rect inScrollRect, SInt16 inHPixels, SInt16 inVPixels, ScrollWindowOptions inOptions, RgnHandle outExposedRgn) -> None"}, #endif -#if TARGET_API_MAC_CARBON +#if !TARGET_API_MAC_OS8 {"ScrollWindowRegion", (PyCFunction)WinObj_ScrollWindowRegion, 1, "(RgnHandle inScrollRgn, SInt16 inHPixels, SInt16 inVPixels, ScrollWindowOptions inOptions, RgnHandle outExposedRgn) -> None"}, #endif @@ -2229,11 +2665,21 @@ static PyMethodDef WinObj_methods[] = { {"SelectWindow", (PyCFunction)WinObj_SelectWindow, 1, "() -> None"}, -#if TARGET_API_MAC_CARBON +#if !TARGET_API_MAC_OS8 {"GetNextWindowOfClass", (PyCFunction)WinObj_GetNextWindowOfClass, 1, "(WindowClass inWindowClass, Boolean mustBeVisible) -> (WindowPtr _rv)"}, #endif +#if !TARGET_API_MAC_OS8 + {"SetWindowAlternateTitle", (PyCFunction)WinObj_SetWindowAlternateTitle, 1, + "(CFStringRef inTitle) -> None"}, +#endif + +#if !TARGET_API_MAC_OS8 + {"CopyWindowAlternateTitle", (PyCFunction)WinObj_CopyWindowAlternateTitle, 1, + "() -> (CFStringRef outTitle)"}, +#endif + #if !TARGET_API_MAC_CARBON {"IsValidWindowPtr", (PyCFunction)WinObj_IsValidWindowPtr, 1, "() -> (Boolean _rv)"}, @@ -2254,6 +2700,8 @@ static PyMethodDef WinObj_methods[] = { "() -> (UInt32 outFeatures)"}, {"GetWindowRegion", (PyCFunction)WinObj_GetWindowRegion, 1, "(WindowRegionCode inRegionCode, RgnHandle ioWinRgn) -> None"}, + {"GetWindowStructureWidths", (PyCFunction)WinObj_GetWindowStructureWidths, 1, + "() -> (Rect outRect)"}, {"BeginUpdate", (PyCFunction)WinObj_BeginUpdate, 1, "() -> None"}, {"EndUpdate", (PyCFunction)WinObj_EndUpdate, 1, @@ -2272,6 +2720,16 @@ static PyMethodDef WinObj_methods[] = { "(Str255 title) -> None"}, {"GetWTitle", (PyCFunction)WinObj_GetWTitle, 1, "() -> (Str255 title)"}, + +#if !TARGET_API_MAC_OS8 + {"SetWindowTitleWithCFString", (PyCFunction)WinObj_SetWindowTitleWithCFString, 1, + "(CFStringRef inString) -> None"}, +#endif + +#if !TARGET_API_MAC_OS8 + {"CopyWindowTitleAsCFString", (PyCFunction)WinObj_CopyWindowTitleAsCFString, 1, + "() -> (CFStringRef outString)"}, +#endif {"SetWindowProxyFSSpec", (PyCFunction)WinObj_SetWindowProxyFSSpec, 1, "(FSSpec inFile) -> None"}, {"GetWindowProxyFSSpec", (PyCFunction)WinObj_GetWindowProxyFSSpec, 1, @@ -2308,6 +2766,11 @@ static PyMethodDef WinObj_methods[] = { "(Boolean hilited) -> None"}, {"TransitionWindow", (PyCFunction)WinObj_TransitionWindow, 1, "(WindowTransitionEffect effect, WindowTransitionAction action, Rect rect) -> None"}, + +#if TARGET_API_MAC_OSX + {"TransitionWindowAndParent", (PyCFunction)WinObj_TransitionWindowAndParent, 1, + "(WindowPtr parentWindow, WindowTransitionEffect effect, WindowTransitionAction action, Rect rect) -> None"}, +#endif {"MacMoveWindow", (PyCFunction)WinObj_MacMoveWindow, 1, "(short hGlobal, short vGlobal, Boolean front) -> None"}, {"SizeWindow", (PyCFunction)WinObj_SizeWindow, 1, @@ -2341,20 +2804,47 @@ static PyMethodDef WinObj_methods[] = { {"GetWindowIdealUserState", (PyCFunction)WinObj_GetWindowIdealUserState, 1, "() -> (Rect userState)"}, {"SetWindowIdealUserState", (PyCFunction)WinObj_SetWindowIdealUserState, 1, - "() -> (Rect userState)"}, + "(Rect userState) -> None"}, + +#if !TARGET_API_MAC_OS8 + {"GetWindowGreatestAreaDevice", (PyCFunction)WinObj_GetWindowGreatestAreaDevice, 1, + "(WindowRegionCode inRegion) -> (GDHandle outGreatestDevice, Rect outGreatestDeviceRect)"}, +#endif + +#if !TARGET_API_MAC_OS8 + {"ConstrainWindowToScreen", (PyCFunction)WinObj_ConstrainWindowToScreen, 1, + "(WindowRegionCode inRegionCode, WindowConstrainOptions inOptions, Rect inScreenRect) -> (Rect outStructure)"}, +#endif {"HideWindow", (PyCFunction)WinObj_HideWindow, 1, "() -> None"}, {"MacShowWindow", (PyCFunction)WinObj_MacShowWindow, 1, "() -> None"}, {"ShowHide", (PyCFunction)WinObj_ShowHide, 1, "(Boolean showFlag) -> None"}, + {"MacIsWindowVisible", (PyCFunction)WinObj_MacIsWindowVisible, 1, + "() -> (Boolean _rv)"}, + +#if !TARGET_API_MAC_OS8 + {"ShowSheetWindow", (PyCFunction)WinObj_ShowSheetWindow, 1, + "(WindowPtr inParentWindow) -> None"}, +#endif + +#if !TARGET_API_MAC_OS8 + {"HideSheetWindow", (PyCFunction)WinObj_HideSheetWindow, 1, + "() -> None"}, +#endif + +#if !TARGET_API_MAC_OS8 + {"GetSheetWindowParent", (PyCFunction)WinObj_GetSheetWindowParent, 1, + "() -> (WindowPtr outParentWindow)"}, +#endif -#if TARGET_API_MAC_CARBON +#if !TARGET_API_MAC_OS8 {"GetWindowPropertyAttributes", (PyCFunction)WinObj_GetWindowPropertyAttributes, 1, "(OSType propertyCreator, OSType propertyTag) -> (UInt32 attributes)"}, #endif -#if TARGET_API_MAC_CARBON +#if !TARGET_API_MAC_OS8 {"ChangeWindowPropertyAttributes", (PyCFunction)WinObj_ChangeWindowPropertyAttributes, 1, "(OSType propertyCreator, OSType propertyTag, UInt32 attributesToSet, UInt32 attributesToClear) -> None"}, #endif @@ -2381,12 +2871,10 @@ static PyMethodDef WinObj_methods[] = { "() -> (CGrafPtr _rv)"}, {"GetWindowKind", (PyCFunction)WinObj_GetWindowKind, 1, "() -> (short _rv)"}, - {"MacIsWindowVisible", (PyCFunction)WinObj_MacIsWindowVisible, 1, - "() -> (Boolean _rv)"}, {"IsWindowHilited", (PyCFunction)WinObj_IsWindowHilited, 1, "() -> (Boolean _rv)"}, -#if TARGET_API_MAC_CARBON +#if !TARGET_API_MAC_OS8 {"IsWindowUpdatePending", (PyCFunction)WinObj_IsWindowUpdatePending, 1, "() -> (Boolean _rv)"}, #endif @@ -2781,7 +3269,7 @@ static PyObject *Win_FrontNonFloatingWindow(PyObject *_self, PyObject *_args) return _res; } -#if TARGET_API_MAC_CARBON +#if !TARGET_API_MAC_OS8 static PyObject *Win_GetFrontWindowOfClass(PyObject *_self, PyObject *_args) { @@ -2804,7 +3292,7 @@ static PyObject *Win_GetFrontWindowOfClass(PyObject *_self, PyObject *_args) } #endif -#if TARGET_API_MAC_CARBON +#if !TARGET_API_MAC_OS8 static PyObject *Win_FindWindowOfClass(PyObject *_self, PyObject *_args) { @@ -2833,6 +3321,29 @@ static PyObject *Win_FindWindowOfClass(PyObject *_self, PyObject *_args) } #endif +#if !TARGET_API_MAC_OS8 + +static PyObject *Win_CreateStandardWindowMenu(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + OSStatus _err; + OptionBits inOptions; + MenuHandle outMenu; +#ifndef CreateStandardWindowMenu + PyMac_PRECHECK(CreateStandardWindowMenu); +#endif + if (!PyArg_ParseTuple(_args, "l", + &inOptions)) + return NULL; + _err = CreateStandardWindowMenu(inOptions, + &outMenu); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&", + MenuObj_New, outMenu); + return _res; +} +#endif + #if !TARGET_API_MAC_CARBON static PyObject *Win_InitWindows(PyObject *_self, PyObject *_args) @@ -2999,6 +3510,67 @@ static PyObject *Win_CollapseAllWindows(PyObject *_self, PyObject *_args) return _res; } +#if !TARGET_API_MAC_OS8 + +static PyObject *Win_GetAvailableWindowPositioningBounds(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + OSStatus _err; + GDHandle inDevice; + Rect availableRect; +#ifndef GetAvailableWindowPositioningBounds + PyMac_PRECHECK(GetAvailableWindowPositioningBounds); +#endif + if (!PyArg_ParseTuple(_args, "O&", + ResObj_Convert, &inDevice)) + return NULL; + _err = GetAvailableWindowPositioningBounds(inDevice, + &availableRect); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&", + PyMac_BuildRect, &availableRect); + return _res; +} +#endif + +#if !TARGET_API_MAC_OS8 + +static PyObject *Win_DisableScreenUpdates(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + OSStatus _err; +#ifndef DisableScreenUpdates + PyMac_PRECHECK(DisableScreenUpdates); +#endif + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _err = DisableScreenUpdates(); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} +#endif + +#if !TARGET_API_MAC_OS8 + +static PyObject *Win_EnableScreenUpdates(PyObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + OSStatus _err; +#ifndef EnableScreenUpdates + PyMac_PRECHECK(EnableScreenUpdates); +#endif + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _err = EnableScreenUpdates(); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} +#endif + static PyObject *Win_PinRect(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -3117,16 +3689,21 @@ static PyMethodDef Win_methods[] = { {"FrontNonFloatingWindow", (PyCFunction)Win_FrontNonFloatingWindow, 1, "() -> (WindowPtr _rv)"}, -#if TARGET_API_MAC_CARBON +#if !TARGET_API_MAC_OS8 {"GetFrontWindowOfClass", (PyCFunction)Win_GetFrontWindowOfClass, 1, "(WindowClass inWindowClass, Boolean mustBeVisible) -> (WindowPtr _rv)"}, #endif -#if TARGET_API_MAC_CARBON +#if !TARGET_API_MAC_OS8 {"FindWindowOfClass", (PyCFunction)Win_FindWindowOfClass, 1, "(Point where, WindowClass inWindowClass) -> (WindowPtr outWindow, WindowPartCode outWindowPart)"}, #endif +#if !TARGET_API_MAC_OS8 + {"CreateStandardWindowMenu", (PyCFunction)Win_CreateStandardWindowMenu, 1, + "(OptionBits inOptions) -> (MenuHandle outMenu)"}, +#endif + #if !TARGET_API_MAC_CARBON {"InitWindows", (PyCFunction)Win_InitWindows, 1, "() -> None"}, @@ -3168,6 +3745,21 @@ static PyMethodDef Win_methods[] = { #endif {"CollapseAllWindows", (PyCFunction)Win_CollapseAllWindows, 1, "(Boolean collapse) -> None"}, + +#if !TARGET_API_MAC_OS8 + {"GetAvailableWindowPositioningBounds", (PyCFunction)Win_GetAvailableWindowPositioningBounds, 1, + "(GDHandle inDevice) -> (Rect availableRect)"}, +#endif + +#if !TARGET_API_MAC_OS8 + {"DisableScreenUpdates", (PyCFunction)Win_DisableScreenUpdates, 1, + "() -> None"}, +#endif + +#if !TARGET_API_MAC_OS8 + {"EnableScreenUpdates", (PyCFunction)Win_EnableScreenUpdates, 1, + "() -> None"}, +#endif {"PinRect", (PyCFunction)Win_PinRect, 1, "(Rect theRect, Point thePt) -> (long _rv)"}, {"GetGrayRgn", (PyCFunction)Win_GetGrayRgn, 1, diff --git a/Mac/Modules/win/winscan.py b/Mac/Modules/win/winscan.py index dcb62c3..82f4441 100644 --- a/Mac/Modules/win/winscan.py +++ b/Mac/Modules/win/winscan.py @@ -71,7 +71,7 @@ class MyScanner(Scanner): 'GetWindowGoAwayFlag', 'GetWindowSpareFlag', ]), - ('#if TARGET_API_MAC_CARBON', [ + ('#if !TARGET_API_MAC_OS8', [ 'IsWindowUpdatePending', 'FindWindowOfClass', 'GetFrontWindowOfClass', @@ -82,6 +82,28 @@ class MyScanner(Scanner): 'ScrollWindowRect', 'ChangeWindowAttributes', 'ReshapeCustomWindow', + 'EnableScreenUpdates', + 'DisableScreenUpdates', + 'GetAvailableWindowPositioningBounds', + 'CreateStandardWindowMenu', + 'GetSheetWindowParent', + 'HideSheetWindow', + 'ShowSheetWindow', + 'ConstrainWindowToScreen', + 'GetWindowGreatestAreaDevice', + 'CopyWindowTitleAsCFString', + 'SetWindowTitleWithCFString', + 'CopyWindowAlternateTitle', + 'SetWindowAlternateTitle', + 'GetWindowModality', + 'SetWindowModality', + 'SetWindowClass', + 'ReleaseWindow', + 'RetainWindow', + 'GetWindowRetainCount', + ]), + ('#if TARGET_API_MAC_OSX', [ + 'TransitionWindowAndParent', ])] def makeblacklisttypes(self): @@ -92,6 +114,7 @@ class MyScanner(Scanner): 'Collection', # For now, to be done later 'WindowDefSpec', # Too difficult for now 'WindowDefSpec_ptr', + 'EventRef', #TBD ] def makerepairinstructions(self): diff --git a/Mac/Modules/win/winsupport.py b/Mac/Modules/win/winsupport.py index 81e6b53..022cf94 100644 --- a/Mac/Modules/win/winsupport.py +++ b/Mac/Modules/win/winsupport.py @@ -49,6 +49,11 @@ RGBColor = OpaqueType("RGBColor", "QdRGB") RGBColor_ptr = RGBColor ScrollWindowOptions = Type("ScrollWindowOptions", "l") WindowPartCode = Type("WindowPartCode", "h") +WindowDefPartCode = Type("WindowDefPartCode", "h") +WindowModality = Type("WindowModality", "l") +CFStringRef = OpaqueByValueType("CFStringRef", "CFStringRefObj") +GDHandle = OpaqueByValueType("GDHandle", "ResObj") +WindowConstrainOptions = Type("WindowConstrainOptions", "l") PropertyCreator = OSTypeType("PropertyCreator") PropertyTag = OSTypeType("PropertyTag") -- cgit v0.12