diff options
Diffstat (limited to 'Mac/Modules')
-rw-r--r-- | Mac/Modules/ctl/Ctlmodule.c | 57 | ||||
-rw-r--r-- | Mac/Modules/ctl/ctlscan.py | 5 | ||||
-rw-r--r-- | Mac/Modules/ctl/ctlsupport.py | 3 | ||||
-rw-r--r-- | Mac/Modules/qd/qdscan.py | 16 | ||||
-rw-r--r-- | Mac/Modules/qd/qdsupport.py | 44 | ||||
-rw-r--r-- | Mac/Modules/qdoffs/Qdoffsmodule.c | 68 | ||||
-rw-r--r-- | Mac/Modules/qt/Qtmodule.c | 1170 | ||||
-rw-r--r-- | Mac/Modules/qt/qtscan.py | 9 | ||||
-rw-r--r-- | Mac/Modules/qt/qtsupport.py | 5 | ||||
-rw-r--r-- | Mac/Modules/res/Resmodule.c | 182 | ||||
-rw-r--r-- | Mac/Modules/res/resscan.py | 7 | ||||
-rw-r--r-- | Mac/Modules/res/ressupport.py | 2 | ||||
-rw-r--r-- | Mac/Modules/snd/Sndmodule.c | 2 | ||||
-rw-r--r-- | Mac/Modules/snd/sndscan.py | 17 | ||||
-rw-r--r-- | Mac/Modules/te/TEmodule.c | 47 | ||||
-rw-r--r-- | Mac/Modules/te/tescan.py | 12 | ||||
-rw-r--r-- | Mac/Modules/win/Winmodule.c | 851 | ||||
-rw-r--r-- | Mac/Modules/win/winedit.py | 200 | ||||
-rw-r--r-- | Mac/Modules/win/winscan.py | 21 | ||||
-rw-r--r-- | Mac/Modules/win/winsupport.py | 13 |
20 files changed, 2240 insertions, 491 deletions
diff --git a/Mac/Modules/ctl/Ctlmodule.c b/Mac/Modules/ctl/Ctlmodule.c index cd45260..c20e9b8 100644 --- a/Mac/Modules/ctl/Ctlmodule.c +++ b/Mac/Modules/ctl/Ctlmodule.c @@ -1184,6 +1184,53 @@ static PyObject *CtlObj_GetControlDataSize(_self, _args) #if TARGET_API_MAC_CARBON +static PyObject *CtlObj_HandleControlDragTracking(_self, _args) + ControlObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + DragTrackingMessage inMessage; + DragReference inDrag; + Boolean outLikesDrag; + if (!PyArg_ParseTuple(_args, "hO&", + &inMessage, + DragObj_Convert, &inDrag)) + return NULL; + _err = HandleControlDragTracking(_self->ob_itself, + inMessage, + inDrag, + &outLikesDrag); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("b", + outLikesDrag); + return _res; +} +#endif + +#if TARGET_API_MAC_CARBON + +static PyObject *CtlObj_HandleControlDragReceive(_self, _args) + ControlObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + DragReference inDrag; + if (!PyArg_ParseTuple(_args, "O&", + DragObj_Convert, &inDrag)) + return NULL; + _err = HandleControlDragReceive(_self->ob_itself, + inDrag); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} +#endif + +#if TARGET_API_MAC_CARBON + static PyObject *CtlObj_SetControlDragTrackingEnabled(_self, _args) ControlObject *_self; PyObject *_args; @@ -2065,6 +2112,16 @@ static PyMethodDef CtlObj_methods[] = { "(ControlPartCode inPart, ResType inTagName) -> (Size outMaxSize)"}, #if TARGET_API_MAC_CARBON + {"HandleControlDragTracking", (PyCFunction)CtlObj_HandleControlDragTracking, 1, + "(DragTrackingMessage inMessage, DragReference inDrag) -> (Boolean outLikesDrag)"}, +#endif + +#if TARGET_API_MAC_CARBON + {"HandleControlDragReceive", (PyCFunction)CtlObj_HandleControlDragReceive, 1, + "(DragReference inDrag) -> None"}, +#endif + +#if TARGET_API_MAC_CARBON {"SetControlDragTrackingEnabled", (PyCFunction)CtlObj_SetControlDragTrackingEnabled, 1, "(Boolean tracks) -> None"}, #endif diff --git a/Mac/Modules/ctl/ctlscan.py b/Mac/Modules/ctl/ctlscan.py index 709fa10..3af28ca 100644 --- a/Mac/Modules/ctl/ctlscan.py +++ b/Mac/Modules/ctl/ctlscan.py @@ -35,6 +35,7 @@ class MyScanner(Scanner): self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n") self.defsfile.write("from TextEdit import *\n") self.defsfile.write("from QuickDraw import *\n") + self.defsfile.write("from Dragconst import *\n") self.defsfile.write("\n") def makeblacklistnames(self): @@ -98,6 +99,8 @@ class MyScanner(Scanner): ('#if TARGET_API_MAC_CARBON', [ 'IsAutomaticControlDragTrackingEnabledForWindow', 'SetAutomaticControlDragTrackingEnabledForWindow', + 'HandleControlDragReceive', + 'HandleControlDragTracking', 'GetControlByID', 'IsControlDragTrackingEnabled', 'SetControlDragTrackingEnabled', @@ -134,8 +137,6 @@ class MyScanner(Scanner): 'ControlDefSpec', # Don't know how to do this yet 'ControlDefSpec_ptr', # ditto 'Collection', # Ditto - 'DragTrackingMessage', # Needs Drag module, must implement later - 'DragReference', # ditto ] def makerepairinstructions(self): diff --git a/Mac/Modules/ctl/ctlsupport.py b/Mac/Modules/ctl/ctlsupport.py index ab2a999..a49007c 100644 --- a/Mac/Modules/ctl/ctlsupport.py +++ b/Mac/Modules/ctl/ctlsupport.py @@ -45,6 +45,9 @@ ControlFontStyleRec_ptr = ControlFontStyleRec ControlID = OpaqueType('ControlID', 'PyControlID') ControlID_ptr = ControlID +DragTrackingMessage = Type("DragTrackingMessage", "h") +DragReference = OpaqueByValueType("DragReference", "DragObj") + includestuff = includestuff + """ #include <%s>""" % MACHEADERFILE + """ #ifndef kControlCheckBoxUncheckedValue diff --git a/Mac/Modules/qd/qdscan.py b/Mac/Modules/qd/qdscan.py index 969baf3..7d2b57b 100644 --- a/Mac/Modules/qd/qdscan.py +++ b/Mac/Modules/qd/qdscan.py @@ -100,17 +100,24 @@ extend = 0x40 'GetPortHWND', 'GetHWNDPort', 'GetPICTFromDIB', - + 'GetPortBitMapForCopyBits', # Something funny in the declaration ] + def makegreylist(self): + return [ + ('#if !TARGET_API_MAC_CARBON', [ + ]), + ('#if TARGET_API_MAC_CARBON', [ + ])] + + def makeblacklisttypes(self): return [ -## 'CCrsrHandle', 'CIconHandle', # Obsolete 'CQDProcs', + 'CQDProcsPtr', 'CSpecArray', -## 'CTabHandle', 'ColorComplementProcPtr', 'ColorComplementUPP', 'ColorSearchProcPtr', @@ -118,14 +125,13 @@ extend = 0x40 'ConstPatternParam', 'DeviceLoopDrawingProcPtr', 'DeviceLoopFlags', -## 'FontInfo', -## 'GDHandle', 'GrafVerb', 'OpenCPicParams_ptr', 'Ptr', 'QDProcs', 'ReqListRec', 'void_ptr', + 'CustomXFerProcPtr', ] def makerepairinstructions(self): diff --git a/Mac/Modules/qd/qdsupport.py b/Mac/Modules/qd/qdsupport.py index 9364a0b..abd1e3e 100644 --- a/Mac/Modules/qd/qdsupport.py +++ b/Mac/Modules/qd/qdsupport.py @@ -45,9 +45,12 @@ GDHandle = OpaqueByValueType("GDHandle", "ResObj") CGrafPtr = OpaqueByValueType("CGrafPtr", "GrafObj") GrafPtr = OpaqueByValueType("GrafPtr", "GrafObj") BitMap_ptr = OpaqueByValueType("BitMapPtr", "BMObj") +BitMap = BitMap_ptr RGBColor = OpaqueType('RGBColor', 'QdRGB') RGBColor_ptr = RGBColor FontInfo = OpaqueType('FontInfo', 'QdFI') +Component = OpaqueByValueType('Component', 'CmpObj') +ComponentInstance = OpaqueByValueType('ComponentInstance', 'CmpInstObj') Cursor_ptr = StructInputBufferType('Cursor') Pattern = StructOutputBufferType('Pattern') @@ -58,6 +61,47 @@ PenState_ptr = StructInputBufferType('PenState') includestuff = includestuff + """ #include <%s>""" % MACHEADERFILE + """ +#if !ACCESSOR_CALLS_ARE_FUNCTIONS +#define GetPortBitMapForCopyBits(port) (((GrafPort)(port))->portBits) +#define GetPortBounds(port, bounds) (*(bounds) = (port)->portRect, (bounds)) +#define GetPortForeColor(port, color) (*(color) = (port)->rgbFgColor, (color)) +#define GetPortBackColor(port, color) (*(color) = (port)->rgbBkColor, (color)) +#define GetPortOpColor(port, color) (*(color) = (*((port)->grafVars))->rgbOpColor, (color)) +#define GetPortHiliteColor(port, color) (*(color) = (*((port)->grafVars))->rgbHiliteColor, (color)) +#define GetPortTextFont(port) ((port)->txFont) +#define GetPortTextFace(port) ((port)->txFace) +#define GetPortTextMode(port) ((port)->txMode) +#define GetPortTextSize(port) ((port)->txSize) +#define GetPortChExtra(port) ((port)->chExtra) +#define GetPortFracHPenLocation(port) ((port)->pnLocHFrac) +#define GetPortSpExtra(port) ((port)->spExtra) +#define GetPortPenVisibility(port) ((port)->pnVis) +#define GetPortVisibleRegion(port, rgn) ((rgn) = (port)->visRgn, (rgn)) +#define GetPortClipRegion(port, rgn) ((rgn) = (port)->clipRgn, (rgn)) +#define GetPortBackPixPat(port, pat) ((pat) = (port)->bkPixPat, (pat)) +#define GetPortPenPixPat(port, pat) ((pat) = (port)->pnPixPat, (pat)) +#define GetPortFillPixPat(port, pat) ((pat) = (port)->fillPixPat, (pat)) +#define GetPortPenSize(port, pensize) (*(pensize) = (port)->pnSize, (pensize)) +#define GetPortPenMode(port) ((port)->pnMode) +#define GetPortPenLocation(port, location) ((*location) = (port)->pnLoc, (location)) +#define IsPortRegionBeingDefined(port) ((port)->rgnSave) +#define IsPortPictureBeingDefined(port) ((port)->picSave) +/* #define IsPortOffscreen(port) */ +/* #define IsPortColor(port) */ + +#define SetPortBounds(port, bounds) ((port)->portRect = *(bounds)) +#define SetPortOpColor(port, color) ((*((port)->grafVars))->rgbOpColor = *(color)) +#define SetPortVisibleRegion(port, rgn) ((port)->visRgn = (rgn)) +#define SetPortClipRegion(port, rgn) ((port)->clipRgn = (rgn)) +#define SetPortBackPixPat(port, pat) ((port)->bkPixPat = (pat)) +#define SetPortPenPixPat(port, pat) ((port)->pnPixPat = (pat)) +#define GetPortFillPixPat(port, pat) ((port)->fillPixPat = (pat)) +#define SetPortPenSize(port, pensize) ((port)->pnSize = (pensize)) +#define SetPortPenMode(port, mode) ((port)->pnMode = (mode)) +#define SetPortFracHPenLocation(port, frac) ((port)->pnLocHFrac = (frac)) + +#endif + /* ** Parse/generate RGB records */ diff --git a/Mac/Modules/qdoffs/Qdoffsmodule.c b/Mac/Modules/qdoffs/Qdoffsmodule.c index c0e05cd..4ffbd71 100644 --- a/Mac/Modules/qdoffs/Qdoffsmodule.c +++ b/Mac/Modules/qdoffs/Qdoffsmodule.c @@ -147,37 +147,6 @@ PyTypeObject GWorld_Type = { /* --------------------- End object type GWorld --------------------- */ -static PyObject *Qdoffs_NewGWorld(_self, _args) - PyObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - QDErr _err; - GWorldPtr offscreenGWorld; - short PixelDepth; - Rect boundsRect; - CTabHandle cTable; - GDHandle aGDevice; - GWorldFlags flags; - if (!PyArg_ParseTuple(_args, "hO&O&O&l", - &PixelDepth, - PyMac_GetRect, &boundsRect, - OptResObj_Convert, &cTable, - OptResObj_Convert, &aGDevice, - &flags)) - return NULL; - _err = NewGWorld(&offscreenGWorld, - PixelDepth, - &boundsRect, - cTable, - aGDevice, - flags); - if (_err != noErr) return PyMac_Error(_err); - _res = Py_BuildValue("O&", - GWorldObj_New, offscreenGWorld); - return _res; -} - static PyObject *Qdoffs_LockPixels(_self, _args) PyObject *_self; PyObject *_args; @@ -209,37 +178,6 @@ static PyObject *Qdoffs_UnlockPixels(_self, _args) return _res; } -static PyObject *Qdoffs_UpdateGWorld(_self, _args) - PyObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - GWorldFlags _rv; - GWorldPtr offscreenGWorld; - short pixelDepth; - Rect boundsRect; - CTabHandle cTable; - GDHandle aGDevice; - GWorldFlags flags; - if (!PyArg_ParseTuple(_args, "hO&O&O&l", - &pixelDepth, - PyMac_GetRect, &boundsRect, - OptResObj_Convert, &cTable, - OptResObj_Convert, &aGDevice, - &flags)) - return NULL; - _rv = UpdateGWorld(&offscreenGWorld, - pixelDepth, - &boundsRect, - cTable, - aGDevice, - flags); - _res = Py_BuildValue("lO&", - _rv, - GWorldObj_New, offscreenGWorld); - return _res; -} - static PyObject *Qdoffs_GetGWorld(_self, _args) PyObject *_self; PyObject *_args; @@ -563,14 +501,10 @@ static PyObject *Qdoffs_PutPixMapBytes(_self, _args) } static PyMethodDef Qdoffs_methods[] = { - {"NewGWorld", (PyCFunction)Qdoffs_NewGWorld, 1, - "(short PixelDepth, Rect boundsRect, CTabHandle cTable, GDHandle aGDevice, GWorldFlags flags) -> (GWorldPtr offscreenGWorld)"}, {"LockPixels", (PyCFunction)Qdoffs_LockPixels, 1, "(PixMapHandle pm) -> (Boolean _rv)"}, {"UnlockPixels", (PyCFunction)Qdoffs_UnlockPixels, 1, "(PixMapHandle pm) -> None"}, - {"UpdateGWorld", (PyCFunction)Qdoffs_UpdateGWorld, 1, - "(short pixelDepth, Rect boundsRect, CTabHandle cTable, GDHandle aGDevice, GWorldFlags flags) -> (GWorldFlags _rv, GWorldPtr offscreenGWorld)"}, {"GetGWorld", (PyCFunction)Qdoffs_GetGWorld, 1, "() -> (CGrafPtr port, GDHandle gdh)"}, {"SetGWorld", (PyCFunction)Qdoffs_SetGWorld, 1, @@ -628,7 +562,7 @@ void initQdoffs() Qdoffs_Error = PyMac_GetOSErrException(); if (Qdoffs_Error == NULL || PyDict_SetItemString(d, "Error", Qdoffs_Error) != 0) - Py_FatalError("can't initialize Qdoffs.Error"); + return; GWorld_Type.ob_type = &PyType_Type; Py_INCREF(&GWorld_Type); if (PyDict_SetItemString(d, "GWorldType", (PyObject *)&GWorld_Type) != 0) diff --git a/Mac/Modules/qt/Qtmodule.c b/Mac/Modules/qt/Qtmodule.c index 7084216..69347da 100644 --- a/Mac/Modules/qt/Qtmodule.c +++ b/Mac/Modules/qt/Qtmodule.c @@ -2524,6 +2524,29 @@ static PyObject *MediaObj_GetMediaDataSize(_self, _args) return _res; } +static PyObject *MediaObj_GetMediaDataSize64(_self, _args) + MediaObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + TimeValue startTime; + TimeValue duration; + wide dataSize; + if (!PyArg_ParseTuple(_args, "ll", + &startTime, + &duration)) + return NULL; + _err = GetMediaDataSize64(_self->ob_itself, + startTime, + duration, + &dataSize); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&", + PyMac_Buildwide, dataSize); + return _res; +} + static PyObject *MediaObj_GetMediaNextInterestingTime(_self, _args) MediaObject *_self; PyObject *_args; @@ -2795,6 +2818,8 @@ static PyMethodDef MediaObj_methods[] = { "(long frameDiffSampleNum) -> (long syncSampleNum)"}, {"GetMediaDataSize", (PyCFunction)MediaObj_GetMediaDataSize, 1, "(TimeValue startTime, TimeValue duration) -> (long _rv)"}, + {"GetMediaDataSize64", (PyCFunction)MediaObj_GetMediaDataSize64, 1, + "(TimeValue startTime, TimeValue duration) -> (wide dataSize)"}, {"GetMediaNextInterestingTime", (PyCFunction)MediaObj_GetMediaNextInterestingTime, 1, "(short interestingTimeFlags, TimeValue time, Fixed rate) -> (TimeValue interestingTime, TimeValue interestingDuration)"}, {"GetMediaDataRef", (PyCFunction)MediaObj_GetMediaDataRef, 1, @@ -3755,6 +3780,29 @@ static PyObject *TrackObj_GetTrackDataSize(_self, _args) return _res; } +static PyObject *TrackObj_GetTrackDataSize64(_self, _args) + TrackObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + TimeValue startTime; + TimeValue duration; + wide dataSize; + if (!PyArg_ParseTuple(_args, "ll", + &startTime, + &duration)) + return NULL; + _err = GetTrackDataSize64(_self->ob_itself, + startTime, + duration, + &dataSize); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&", + PyMac_Buildwide, dataSize); + return _res; +} + static PyObject *TrackObj_PtInTrack(_self, _args) TrackObject *_self; PyObject *_args; @@ -3981,6 +4029,8 @@ static PyMethodDef TrackObj_methods[] = { "(TimeValue atTime) -> (Fixed _rv)"}, {"GetTrackDataSize", (PyCFunction)TrackObj_GetTrackDataSize, 1, "(TimeValue startTime, TimeValue duration) -> (long _rv)"}, + {"GetTrackDataSize64", (PyCFunction)TrackObj_GetTrackDataSize64, 1, + "(TimeValue startTime, TimeValue duration) -> (wide dataSize)"}, {"PtInTrack", (PyCFunction)TrackObj_PtInTrack, 1, "(Point pt) -> (Boolean _rv)"}, {"GetTrackNextInterestingTime", (PyCFunction)TrackObj_GetTrackNextInterestingTime, 1, @@ -4116,6 +4166,22 @@ static PyObject *MovieObj_PrerollMovie(_self, _args) return _res; } +static PyObject *MovieObj_AbortPrePrerollMovie(_self, _args) + MovieObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr err; + if (!PyArg_ParseTuple(_args, "h", + &err)) + return NULL; + AbortPrePrerollMovie(_self->ob_itself, + err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + static PyObject *MovieObj_LoadMovieIntoRam(_self, _args) MovieObject *_self; PyObject *_args; @@ -4642,6 +4708,30 @@ static PyObject *MovieObj_PutMovieIntoDataFork(_self, _args) return _res; } +static PyObject *MovieObj_PutMovieIntoDataFork64(_self, _args) + MovieObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + long fRefNum; + wide offset; + unsigned long maxSize; + if (!PyArg_ParseTuple(_args, "lO&l", + &fRefNum, + PyMac_Getwide, &offset, + &maxSize)) + return NULL; + _err = PutMovieIntoDataFork64(_self->ob_itself, + fRefNum, + &offset, + maxSize); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + static PyObject *MovieObj_GetMovieCreationTime(_self, _args) MovieObject *_self; PyObject *_args; @@ -5439,6 +5529,29 @@ static PyObject *MovieObj_GetMovieDataSize(_self, _args) return _res; } +static PyObject *MovieObj_GetMovieDataSize64(_self, _args) + MovieObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + TimeValue startTime; + TimeValue duration; + wide dataSize; + if (!PyArg_ParseTuple(_args, "ll", + &startTime, + &duration)) + return NULL; + _err = GetMovieDataSize64(_self->ob_itself, + startTime, + duration, + &dataSize); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&", + PyMac_Buildwide, dataSize); + return _res; +} + static PyObject *MovieObj_PtInMovie(_self, _args) MovieObject *_self; PyObject *_args; @@ -5620,6 +5733,50 @@ static PyObject *MovieObj_GetMovieDefaultDataRef(_self, _args) return _res; } +static PyObject *MovieObj_SetMovieAnchorDataRef(_self, _args) + MovieObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + Handle dataRef; + OSType dataRefType; + if (!PyArg_ParseTuple(_args, "O&O&", + ResObj_Convert, &dataRef, + PyMac_GetOSType, &dataRefType)) + return NULL; + _err = SetMovieAnchorDataRef(_self->ob_itself, + dataRef, + dataRefType); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *MovieObj_GetMovieAnchorDataRef(_self, _args) + MovieObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + Handle dataRef; + OSType dataRefType; + long outFlags; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _err = GetMovieAnchorDataRef(_self->ob_itself, + &dataRef, + &dataRefType, + &outFlags); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&O&l", + ResObj_New, dataRef, + PyMac_BuildOSType, dataRefType, + outFlags); + return _res; +} + static PyObject *MovieObj_SetMovieColorTable(_self, _args) MovieObject *_self; PyObject *_args; @@ -5817,6 +5974,20 @@ static PyObject *MovieObj_GetMovieStatus(_self, _args) return _res; } +static PyObject *MovieObj_GetMovieLoadState(_self, _args) + MovieObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + long _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = GetMovieLoadState(_self->ob_itself); + _res = Py_BuildValue("l", + _rv); + return _res; +} + static PyObject *MovieObj_NewMovieController(_self, _args) MovieObject *_self; PyObject *_args; @@ -5936,6 +6107,8 @@ static PyMethodDef MovieObj_methods[] = { "(long maxMilliSecToUse) -> None"}, {"PrerollMovie", (PyCFunction)MovieObj_PrerollMovie, 1, "(TimeValue time, Fixed Rate) -> None"}, + {"AbortPrePrerollMovie", (PyCFunction)MovieObj_AbortPrePrerollMovie, 1, + "(OSErr err) -> None"}, {"LoadMovieIntoRam", (PyCFunction)MovieObj_LoadMovieIntoRam, 1, "(TimeValue time, TimeValue duration, long flags) -> None"}, {"SetMovieActive", (PyCFunction)MovieObj_SetMovieActive, 1, @@ -6002,6 +6175,8 @@ static PyMethodDef MovieObj_methods[] = { "(Handle publicMovie) -> None"}, {"PutMovieIntoDataFork", (PyCFunction)MovieObj_PutMovieIntoDataFork, 1, "(short fRefNum, long offset, long maxSize) -> None"}, + {"PutMovieIntoDataFork64", (PyCFunction)MovieObj_PutMovieIntoDataFork64, 1, + "(long fRefNum, wide offset, unsigned long maxSize) -> None"}, {"GetMovieCreationTime", (PyCFunction)MovieObj_GetMovieCreationTime, 1, "() -> (unsigned long _rv)"}, {"GetMovieModificationTime", (PyCFunction)MovieObj_GetMovieModificationTime, 1, @@ -6092,6 +6267,8 @@ static PyMethodDef MovieObj_methods[] = { "(Track onlyTrack, FSSpec outputFile, OSType fileType, OSType creator, ScriptCode scriptTag, long flags, ComponentInstance userComp) -> (short resID)"}, {"GetMovieDataSize", (PyCFunction)MovieObj_GetMovieDataSize, 1, "(TimeValue startTime, TimeValue duration) -> (long _rv)"}, + {"GetMovieDataSize64", (PyCFunction)MovieObj_GetMovieDataSize64, 1, + "(TimeValue startTime, TimeValue duration) -> (wide dataSize)"}, {"PtInMovie", (PyCFunction)MovieObj_PtInMovie, 1, "(Point pt) -> (Boolean _rv)"}, {"SetMovieLanguage", (PyCFunction)MovieObj_SetMovieLanguage, 1, @@ -6110,6 +6287,10 @@ static PyMethodDef MovieObj_methods[] = { "(Handle dataRef, OSType dataRefType) -> None"}, {"GetMovieDefaultDataRef", (PyCFunction)MovieObj_GetMovieDefaultDataRef, 1, "() -> (Handle dataRef, OSType dataRefType)"}, + {"SetMovieAnchorDataRef", (PyCFunction)MovieObj_SetMovieAnchorDataRef, 1, + "(Handle dataRef, OSType dataRefType) -> None"}, + {"GetMovieAnchorDataRef", (PyCFunction)MovieObj_GetMovieAnchorDataRef, 1, + "() -> (Handle dataRef, OSType dataRefType, long outFlags)"}, {"SetMovieColorTable", (PyCFunction)MovieObj_SetMovieColorTable, 1, "(CTabHandle ctab) -> None"}, {"GetMovieColorTable", (PyCFunction)MovieObj_GetMovieColorTable, 1, @@ -6128,6 +6309,8 @@ static PyMethodDef MovieObj_methods[] = { "(TimeValue time, TimeValue duration) -> (RgnHandle _rv)"}, {"GetMovieStatus", (PyCFunction)MovieObj_GetMovieStatus, 1, "() -> (ComponentResult _rv, Track firstProblemTrack)"}, + {"GetMovieLoadState", (PyCFunction)MovieObj_GetMovieLoadState, 1, + "() -> (long _rv)"}, {"NewMovieController", (PyCFunction)MovieObj_NewMovieController, 1, "(Rect movieRect, long someFlags) -> (MovieController _rv)"}, {"PutMovieOnScrap", (PyCFunction)MovieObj_PutMovieOnScrap, 1, @@ -6327,6 +6510,40 @@ static PyObject *Qt_GetDataHandler(_self, _args) return _res; } +static PyObject *Qt_OpenADataHandler(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + Handle dataRef; + OSType dataHandlerSubType; + Handle anchorDataRef; + OSType anchorDataRefType; + TimeBase tb; + long flags; + ComponentInstance dh; + if (!PyArg_ParseTuple(_args, "O&O&O&O&O&l", + ResObj_Convert, &dataRef, + PyMac_GetOSType, &dataHandlerSubType, + ResObj_Convert, &anchorDataRef, + PyMac_GetOSType, &anchorDataRefType, + TimeBaseObj_Convert, &tb, + &flags)) + return NULL; + _err = OpenADataHandler(dataRef, + dataHandlerSubType, + anchorDataRef, + anchorDataRefType, + tb, + flags, + &dh); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&", + CmpInstObj_New, dh); + return _res; +} + static PyObject *Qt_PasteHandleIntoMovie(_self, _args) PyObject *_self; PyObject *_args; @@ -6605,6 +6822,34 @@ static PyObject *Qt_NewMovieFromDataFork(_self, _args) return _res; } +static PyObject *Qt_NewMovieFromDataFork64(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + Movie theMovie; + long fRefNum; + wide fileOffset; + short newMovieFlags; + Boolean dataRefWasChanged; + if (!PyArg_ParseTuple(_args, "lO&h", + &fRefNum, + PyMac_Getwide, &fileOffset, + &newMovieFlags)) + return NULL; + _err = NewMovieFromDataFork64(&theMovie, + fRefNum, + &fileOffset, + newMovieFlags, + &dataRefWasChanged); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&b", + MovieObj_New, theMovie, + dataRefWasChanged); + return _res; +} + static PyObject *Qt_NewMovieFromDataRef(_self, _args) PyObject *_self; PyObject *_args; @@ -6653,6 +6898,38 @@ static PyObject *Qt_RemoveMovieResource(_self, _args) return _res; } +static PyObject *Qt_CreateShortcutMovieFile(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + FSSpec fileSpec; + OSType creator; + ScriptCode scriptTag; + long createMovieFileFlags; + Handle targetDataRef; + OSType targetDataRefType; + if (!PyArg_ParseTuple(_args, "O&O&hlO&O&", + PyMac_GetFSSpec, &fileSpec, + PyMac_GetOSType, &creator, + &scriptTag, + &createMovieFileFlags, + ResObj_Convert, &targetDataRef, + PyMac_GetOSType, &targetDataRefType)) + return NULL; + _err = CreateShortcutMovieFile(&fileSpec, + creator, + scriptTag, + createMovieFileFlags, + targetDataRef, + targetDataRefType); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + static PyObject *Qt_NewMovieFromScrap(_self, _args) PyObject *_self; PyObject *_args; @@ -6955,6 +7232,62 @@ static PyObject *Qt_VideoMediaGetStallCount(_self, _args) return _res; } +static PyObject *Qt_VideoMediaSetCodecParameter(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + ComponentResult _rv; + MediaHandler mh; + CodecType cType; + OSType parameterID; + long parameterChangeSeed; + void * dataPtr; + long dataSize; + if (!PyArg_ParseTuple(_args, "O&O&O&lsl", + CmpInstObj_Convert, &mh, + PyMac_GetOSType, &cType, + PyMac_GetOSType, ¶meterID, + ¶meterChangeSeed, + &dataPtr, + &dataSize)) + return NULL; + _rv = VideoMediaSetCodecParameter(mh, + cType, + parameterID, + parameterChangeSeed, + dataPtr, + dataSize); + _res = Py_BuildValue("l", + _rv); + return _res; +} + +static PyObject *Qt_VideoMediaGetCodecParameter(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + ComponentResult _rv; + MediaHandler mh; + CodecType cType; + OSType parameterID; + Handle outParameterData; + if (!PyArg_ParseTuple(_args, "O&O&O&O&", + CmpInstObj_Convert, &mh, + PyMac_GetOSType, &cType, + PyMac_GetOSType, ¶meterID, + ResObj_Convert, &outParameterData)) + return NULL; + _rv = VideoMediaGetCodecParameter(mh, + cType, + parameterID, + outParameterData); + _res = Py_BuildValue("l", + _rv); + return _res; +} + static PyObject *Qt_TextMediaAddTextSample(_self, _args) PyObject *_self; PyObject *_args; @@ -7099,6 +7432,130 @@ static PyObject *Qt_TextMediaAddHiliteSample(_self, _args) return _res; } +static PyObject *Qt_TextMediaDrawRaw(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + ComponentResult _rv; + MediaHandler mh; + GWorldPtr gw; + GDHandle gd; + void * data; + long dataSize; + TextDescriptionHandle tdh; + if (!PyArg_ParseTuple(_args, "O&O&O&slO&", + CmpInstObj_Convert, &mh, + GWorldObj_Convert, &gw, + OptResObj_Convert, &gd, + &data, + &dataSize, + ResObj_Convert, &tdh)) + return NULL; + _rv = TextMediaDrawRaw(mh, + gw, + gd, + data, + dataSize, + tdh); + _res = Py_BuildValue("l", + _rv); + return _res; +} + +static PyObject *Qt_TextMediaSetTextProperty(_self, _args) + 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 = TextMediaSetTextProperty(mh, + atMediaTime, + propertyType, + data, + dataSize); + _res = Py_BuildValue("l", + _rv); + return _res; +} + +static PyObject *Qt_TextMediaRawSetup(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + ComponentResult _rv; + MediaHandler mh; + GWorldPtr gw; + GDHandle gd; + void * data; + long dataSize; + TextDescriptionHandle tdh; + TimeValue sampleDuration; + if (!PyArg_ParseTuple(_args, "O&O&O&slO&l", + CmpInstObj_Convert, &mh, + GWorldObj_Convert, &gw, + OptResObj_Convert, &gd, + &data, + &dataSize, + ResObj_Convert, &tdh, + &sampleDuration)) + return NULL; + _rv = TextMediaRawSetup(mh, + gw, + gd, + data, + dataSize, + tdh, + sampleDuration); + _res = Py_BuildValue("l", + _rv); + return _res; +} + +static PyObject *Qt_TextMediaRawIdle(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + ComponentResult _rv; + MediaHandler mh; + GWorldPtr gw; + GDHandle gd; + TimeValue sampleTime; + long flagsIn; + long flagsOut; + if (!PyArg_ParseTuple(_args, "O&O&O&ll", + CmpInstObj_Convert, &mh, + GWorldObj_Convert, &gw, + OptResObj_Convert, &gd, + &sampleTime, + &flagsIn)) + return NULL; + _rv = TextMediaRawIdle(mh, + gw, + gd, + sampleTime, + flagsIn, + &flagsOut); + _res = Py_BuildValue("ll", + _rv, + flagsOut); + return _res; +} + static PyObject *Qt_TextMediaFindNextText(_self, _args) PyObject *_self; PyObject *_args; @@ -7603,6 +8060,643 @@ static PyObject *Qt_SpriteMediaGetIndImageProperty(_self, _args) } #endif +static PyObject *Qt_SpriteMediaDisposeSprite(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + ComponentResult _rv; + MediaHandler mh; + QTAtomID spriteID; + if (!PyArg_ParseTuple(_args, "O&l", + CmpInstObj_Convert, &mh, + &spriteID)) + return NULL; + _rv = SpriteMediaDisposeSprite(mh, + spriteID); + _res = Py_BuildValue("l", + _rv); + return _res; +} + +static PyObject *Qt_SpriteMediaSetActionVariableToString(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + ComponentResult _rv; + MediaHandler mh; + QTAtomID variableID; + Ptr theCString; + if (!PyArg_ParseTuple(_args, "O&ls", + CmpInstObj_Convert, &mh, + &variableID, + &theCString)) + return NULL; + _rv = SpriteMediaSetActionVariableToString(mh, + variableID, + theCString); + _res = Py_BuildValue("l", + _rv); + return _res; +} + +static PyObject *Qt_SpriteMediaGetActionVariableAsString(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + ComponentResult _rv; + MediaHandler mh; + QTAtomID variableID; + Handle theCString; + if (!PyArg_ParseTuple(_args, "O&l", + CmpInstObj_Convert, &mh, + &variableID)) + return NULL; + _rv = SpriteMediaGetActionVariableAsString(mh, + variableID, + &theCString); + _res = Py_BuildValue("lO&", + _rv, + ResObj_New, theCString); + return _res; +} + +static PyObject *Qt_FlashMediaSetPan(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + ComponentResult _rv; + MediaHandler mh; + short xPercent; + short yPercent; + if (!PyArg_ParseTuple(_args, "O&hh", + CmpInstObj_Convert, &mh, + &xPercent, + &yPercent)) + return NULL; + _rv = FlashMediaSetPan(mh, + xPercent, + yPercent); + _res = Py_BuildValue("l", + _rv); + return _res; +} + +static PyObject *Qt_FlashMediaSetZoom(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + ComponentResult _rv; + MediaHandler mh; + short factor; + if (!PyArg_ParseTuple(_args, "O&h", + CmpInstObj_Convert, &mh, + &factor)) + return NULL; + _rv = FlashMediaSetZoom(mh, + factor); + _res = Py_BuildValue("l", + _rv); + return _res; +} + +static PyObject *Qt_FlashMediaSetZoomRect(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + ComponentResult _rv; + MediaHandler mh; + long left; + long top; + long right; + long bottom; + if (!PyArg_ParseTuple(_args, "O&llll", + CmpInstObj_Convert, &mh, + &left, + &top, + &right, + &bottom)) + return NULL; + _rv = FlashMediaSetZoomRect(mh, + left, + top, + right, + bottom); + _res = Py_BuildValue("l", + _rv); + return _res; +} + +static PyObject *Qt_FlashMediaGetRefConBounds(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + ComponentResult _rv; + MediaHandler mh; + long refCon; + long left; + long top; + long right; + long bottom; + if (!PyArg_ParseTuple(_args, "O&l", + CmpInstObj_Convert, &mh, + &refCon)) + return NULL; + _rv = FlashMediaGetRefConBounds(mh, + refCon, + &left, + &top, + &right, + &bottom); + _res = Py_BuildValue("lllll", + _rv, + left, + top, + right, + bottom); + return _res; +} + +static PyObject *Qt_FlashMediaGetRefConID(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + ComponentResult _rv; + MediaHandler mh; + long refCon; + long refConID; + if (!PyArg_ParseTuple(_args, "O&l", + CmpInstObj_Convert, &mh, + &refCon)) + return NULL; + _rv = FlashMediaGetRefConID(mh, + refCon, + &refConID); + _res = Py_BuildValue("ll", + _rv, + refConID); + return _res; +} + +static PyObject *Qt_FlashMediaIDToRefCon(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + ComponentResult _rv; + MediaHandler mh; + long refConID; + long refCon; + if (!PyArg_ParseTuple(_args, "O&l", + CmpInstObj_Convert, &mh, + &refConID)) + return NULL; + _rv = FlashMediaIDToRefCon(mh, + refConID, + &refCon); + _res = Py_BuildValue("ll", + _rv, + refCon); + return _res; +} + +static PyObject *Qt_FlashMediaGetDisplayedFrameNumber(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + ComponentResult _rv; + MediaHandler mh; + long flashFrameNumber; + if (!PyArg_ParseTuple(_args, "O&", + CmpInstObj_Convert, &mh)) + return NULL; + _rv = FlashMediaGetDisplayedFrameNumber(mh, + &flashFrameNumber); + _res = Py_BuildValue("ll", + _rv, + flashFrameNumber); + return _res; +} + +static PyObject *Qt_FlashMediaFrameNumberToMovieTime(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + ComponentResult _rv; + MediaHandler mh; + long flashFrameNumber; + TimeValue movieTime; + if (!PyArg_ParseTuple(_args, "O&l", + CmpInstObj_Convert, &mh, + &flashFrameNumber)) + return NULL; + _rv = FlashMediaFrameNumberToMovieTime(mh, + flashFrameNumber, + &movieTime); + _res = Py_BuildValue("ll", + _rv, + movieTime); + return _res; +} + +static PyObject *Qt_FlashMediaFrameLabelToMovieTime(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + ComponentResult _rv; + MediaHandler mh; + Ptr theLabel; + TimeValue movieTime; + if (!PyArg_ParseTuple(_args, "O&s", + CmpInstObj_Convert, &mh, + &theLabel)) + return NULL; + _rv = FlashMediaFrameLabelToMovieTime(mh, + theLabel, + &movieTime); + _res = Py_BuildValue("ll", + _rv, + movieTime); + return _res; +} + +static PyObject *Qt_MovieMediaGetCurrentMovieProperty(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + ComponentResult _rv; + MediaHandler mh; + OSType whichProperty; + void * value; + if (!PyArg_ParseTuple(_args, "O&O&s", + CmpInstObj_Convert, &mh, + PyMac_GetOSType, &whichProperty, + &value)) + return NULL; + _rv = MovieMediaGetCurrentMovieProperty(mh, + whichProperty, + value); + _res = Py_BuildValue("l", + _rv); + return _res; +} + +static PyObject *Qt_MovieMediaGetCurrentTrackProperty(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + ComponentResult _rv; + MediaHandler mh; + long trackID; + OSType whichProperty; + void * value; + if (!PyArg_ParseTuple(_args, "O&lO&s", + CmpInstObj_Convert, &mh, + &trackID, + PyMac_GetOSType, &whichProperty, + &value)) + return NULL; + _rv = MovieMediaGetCurrentTrackProperty(mh, + trackID, + whichProperty, + value); + _res = Py_BuildValue("l", + _rv); + return _res; +} + +static PyObject *Qt_MovieMediaGetChildMovieDataReference(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + ComponentResult _rv; + MediaHandler mh; + QTAtomID dataRefID; + short dataRefIndex; + OSType dataRefType; + Handle dataRef; + QTAtomID dataRefIDOut; + short dataRefIndexOut; + if (!PyArg_ParseTuple(_args, "O&lh", + CmpInstObj_Convert, &mh, + &dataRefID, + &dataRefIndex)) + return NULL; + _rv = MovieMediaGetChildMovieDataReference(mh, + dataRefID, + dataRefIndex, + &dataRefType, + &dataRef, + &dataRefIDOut, + &dataRefIndexOut); + _res = Py_BuildValue("lO&O&lh", + _rv, + PyMac_BuildOSType, dataRefType, + ResObj_New, dataRef, + dataRefIDOut, + dataRefIndexOut); + return _res; +} + +static PyObject *Qt_MovieMediaSetChildMovieDataReference(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + ComponentResult _rv; + MediaHandler mh; + QTAtomID dataRefID; + OSType dataRefType; + Handle dataRef; + if (!PyArg_ParseTuple(_args, "O&lO&O&", + CmpInstObj_Convert, &mh, + &dataRefID, + PyMac_GetOSType, &dataRefType, + ResObj_Convert, &dataRef)) + return NULL; + _rv = MovieMediaSetChildMovieDataReference(mh, + dataRefID, + dataRefType, + dataRef); + _res = Py_BuildValue("l", + _rv); + return _res; +} + +static PyObject *Qt_MovieMediaLoadChildMovieFromDataReference(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + ComponentResult _rv; + MediaHandler mh; + QTAtomID dataRefID; + if (!PyArg_ParseTuple(_args, "O&l", + CmpInstObj_Convert, &mh, + &dataRefID)) + return NULL; + _rv = MovieMediaLoadChildMovieFromDataReference(mh, + dataRefID); + _res = Py_BuildValue("l", + _rv); + return _res; +} + +static PyObject *Qt_Media3DGetCurrentGroup(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + ComponentResult _rv; + MediaHandler mh; + void * group; + if (!PyArg_ParseTuple(_args, "O&s", + CmpInstObj_Convert, &mh, + &group)) + return NULL; + _rv = Media3DGetCurrentGroup(mh, + group); + _res = Py_BuildValue("l", + _rv); + return _res; +} + +static PyObject *Qt_Media3DTranslateNamedObjectTo(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + ComponentResult _rv; + MediaHandler mh; + char objectName; + Fixed x; + Fixed y; + Fixed z; + if (!PyArg_ParseTuple(_args, "O&O&O&O&", + CmpInstObj_Convert, &mh, + PyMac_GetFixed, &x, + PyMac_GetFixed, &y, + PyMac_GetFixed, &z)) + return NULL; + _rv = Media3DTranslateNamedObjectTo(mh, + &objectName, + x, + y, + z); + _res = Py_BuildValue("lc", + _rv, + objectName); + return _res; +} + +static PyObject *Qt_Media3DScaleNamedObjectTo(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + ComponentResult _rv; + MediaHandler mh; + char objectName; + Fixed xScale; + Fixed yScale; + Fixed zScale; + if (!PyArg_ParseTuple(_args, "O&O&O&O&", + CmpInstObj_Convert, &mh, + PyMac_GetFixed, &xScale, + PyMac_GetFixed, &yScale, + PyMac_GetFixed, &zScale)) + return NULL; + _rv = Media3DScaleNamedObjectTo(mh, + &objectName, + xScale, + yScale, + zScale); + _res = Py_BuildValue("lc", + _rv, + objectName); + return _res; +} + +static PyObject *Qt_Media3DRotateNamedObjectTo(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + ComponentResult _rv; + MediaHandler mh; + char objectName; + Fixed xDegrees; + Fixed yDegrees; + Fixed zDegrees; + if (!PyArg_ParseTuple(_args, "O&O&O&O&", + CmpInstObj_Convert, &mh, + PyMac_GetFixed, &xDegrees, + PyMac_GetFixed, &yDegrees, + PyMac_GetFixed, &zDegrees)) + return NULL; + _rv = Media3DRotateNamedObjectTo(mh, + &objectName, + xDegrees, + yDegrees, + zDegrees); + _res = Py_BuildValue("lc", + _rv, + objectName); + return _res; +} + +static PyObject *Qt_Media3DSetCameraData(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + ComponentResult _rv; + MediaHandler mh; + void * cameraData; + if (!PyArg_ParseTuple(_args, "O&s", + CmpInstObj_Convert, &mh, + &cameraData)) + return NULL; + _rv = Media3DSetCameraData(mh, + cameraData); + _res = Py_BuildValue("l", + _rv); + return _res; +} + +static PyObject *Qt_Media3DGetCameraData(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + ComponentResult _rv; + MediaHandler mh; + void * cameraData; + if (!PyArg_ParseTuple(_args, "O&s", + CmpInstObj_Convert, &mh, + &cameraData)) + return NULL; + _rv = Media3DGetCameraData(mh, + cameraData); + _res = Py_BuildValue("l", + _rv); + return _res; +} + +static PyObject *Qt_Media3DSetCameraAngleAspect(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + ComponentResult _rv; + MediaHandler mh; + QTFloatSingle fov; + QTFloatSingle aspectRatioXToY; + if (!PyArg_ParseTuple(_args, "O&ff", + CmpInstObj_Convert, &mh, + &fov, + &aspectRatioXToY)) + return NULL; + _rv = Media3DSetCameraAngleAspect(mh, + fov, + aspectRatioXToY); + _res = Py_BuildValue("l", + _rv); + return _res; +} + +static PyObject *Qt_Media3DGetCameraAngleAspect(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + ComponentResult _rv; + MediaHandler mh; + QTFloatSingle fov; + QTFloatSingle aspectRatioXToY; + if (!PyArg_ParseTuple(_args, "O&", + CmpInstObj_Convert, &mh)) + return NULL; + _rv = Media3DGetCameraAngleAspect(mh, + &fov, + &aspectRatioXToY); + _res = Py_BuildValue("lff", + _rv, + fov, + aspectRatioXToY); + return _res; +} + +static PyObject *Qt_Media3DSetCameraRange(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + ComponentResult _rv; + MediaHandler mh; + void * tQ3CameraRange; + if (!PyArg_ParseTuple(_args, "O&s", + CmpInstObj_Convert, &mh, + &tQ3CameraRange)) + return NULL; + _rv = Media3DSetCameraRange(mh, + tQ3CameraRange); + _res = Py_BuildValue("l", + _rv); + return _res; +} + +static PyObject *Qt_Media3DGetCameraRange(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + ComponentResult _rv; + MediaHandler mh; + void * tQ3CameraRange; + if (!PyArg_ParseTuple(_args, "O&s", + CmpInstObj_Convert, &mh, + &tQ3CameraRange)) + return NULL; + _rv = Media3DGetCameraRange(mh, + tQ3CameraRange); + _res = Py_BuildValue("l", + _rv); + return _res; +} + +static PyObject *Qt_Media3DGetViewObject(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + ComponentResult _rv; + MediaHandler mh; + void * tq3viewObject; + if (!PyArg_ParseTuple(_args, "O&s", + CmpInstObj_Convert, &mh, + &tq3viewObject)) + return NULL; + _rv = Media3DGetViewObject(mh, + tq3viewObject); + _res = Py_BuildValue("l", + _rv); + return _res; +} + static PyObject *Qt_NewTimeBase(_self, _args) PyObject *_self; PyObject *_args; @@ -7792,6 +8886,8 @@ static PyMethodDef Qt_methods[] = { "(long flags) -> (Movie _rv)"}, {"GetDataHandler", (PyCFunction)Qt_GetDataHandler, 1, "(Handle dataRef, OSType dataHandlerSubType, long flags) -> (Component _rv)"}, + {"OpenADataHandler", (PyCFunction)Qt_OpenADataHandler, 1, + "(Handle dataRef, OSType dataHandlerSubType, Handle anchorDataRef, OSType anchorDataRefType, TimeBase tb, long flags) -> (ComponentInstance dh)"}, {"PasteHandleIntoMovie", (PyCFunction)Qt_PasteHandleIntoMovie, 1, "(Handle h, OSType handleType, Movie theMovie, long flags, ComponentInstance userComp) -> None"}, {"GetMovieImporterForDataRef", (PyCFunction)Qt_GetMovieImporterForDataRef, 1, @@ -7816,10 +8912,14 @@ static PyMethodDef Qt_methods[] = { "(Handle h, short newMovieFlags) -> (Movie theMovie, Boolean dataRefWasChanged)"}, {"NewMovieFromDataFork", (PyCFunction)Qt_NewMovieFromDataFork, 1, "(short fRefNum, long fileOffset, short newMovieFlags) -> (Movie theMovie, Boolean dataRefWasChanged)"}, + {"NewMovieFromDataFork64", (PyCFunction)Qt_NewMovieFromDataFork64, 1, + "(long fRefNum, wide fileOffset, short newMovieFlags) -> (Movie theMovie, Boolean dataRefWasChanged)"}, {"NewMovieFromDataRef", (PyCFunction)Qt_NewMovieFromDataRef, 1, "(short flags, Handle dataRef, OSType dataRefType) -> (Movie m, short id)"}, {"RemoveMovieResource", (PyCFunction)Qt_RemoveMovieResource, 1, "(short resRefNum, short resId) -> None"}, + {"CreateShortcutMovieFile", (PyCFunction)Qt_CreateShortcutMovieFile, 1, + "(FSSpec fileSpec, OSType creator, ScriptCode scriptTag, long createMovieFileFlags, Handle targetDataRef, OSType targetDataRefType) -> None"}, {"NewMovieFromScrap", (PyCFunction)Qt_NewMovieFromScrap, 1, "(long newMovieFlags) -> (Movie _rv)"}, {"QTNewAlias", (PyCFunction)Qt_QTNewAlias, 1, @@ -7850,12 +8950,24 @@ static PyMethodDef Qt_methods[] = { "(MediaHandler mh) -> (ComponentResult _rv)"}, {"VideoMediaGetStallCount", (PyCFunction)Qt_VideoMediaGetStallCount, 1, "(MediaHandler mh) -> (ComponentResult _rv, unsigned long stalls)"}, + {"VideoMediaSetCodecParameter", (PyCFunction)Qt_VideoMediaSetCodecParameter, 1, + "(MediaHandler mh, CodecType cType, OSType parameterID, long parameterChangeSeed, void * dataPtr, long dataSize) -> (ComponentResult _rv)"}, + {"VideoMediaGetCodecParameter", (PyCFunction)Qt_VideoMediaGetCodecParameter, 1, + "(MediaHandler mh, CodecType cType, OSType parameterID, Handle outParameterData) -> (ComponentResult _rv)"}, {"TextMediaAddTextSample", (PyCFunction)Qt_TextMediaAddTextSample, 1, "(MediaHandler mh, Ptr text, unsigned long size, short fontNumber, short fontSize, Style textFace, short textJustification, long displayFlags, TimeValue scrollDelay, short hiliteStart, short hiliteEnd, TimeValue duration) -> (ComponentResult _rv, RGBColor textColor, RGBColor backColor, Rect textBox, RGBColor rgbHiliteColor, TimeValue sampleTime)"}, {"TextMediaAddTESample", (PyCFunction)Qt_TextMediaAddTESample, 1, "(MediaHandler mh, TEHandle hTE, short textJustification, long displayFlags, TimeValue scrollDelay, short hiliteStart, short hiliteEnd, TimeValue duration) -> (ComponentResult _rv, RGBColor backColor, Rect textBox, RGBColor rgbHiliteColor, TimeValue sampleTime)"}, {"TextMediaAddHiliteSample", (PyCFunction)Qt_TextMediaAddHiliteSample, 1, "(MediaHandler mh, short hiliteStart, short hiliteEnd, TimeValue duration) -> (ComponentResult _rv, RGBColor rgbHiliteColor, TimeValue sampleTime)"}, + {"TextMediaDrawRaw", (PyCFunction)Qt_TextMediaDrawRaw, 1, + "(MediaHandler mh, GWorldPtr gw, GDHandle gd, void * data, long dataSize, TextDescriptionHandle tdh) -> (ComponentResult _rv)"}, + {"TextMediaSetTextProperty", (PyCFunction)Qt_TextMediaSetTextProperty, 1, + "(MediaHandler mh, TimeValue atMediaTime, long propertyType, void * data, long dataSize) -> (ComponentResult _rv)"}, + {"TextMediaRawSetup", (PyCFunction)Qt_TextMediaRawSetup, 1, + "(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)"}, {"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, @@ -7901,6 +9013,62 @@ static PyMethodDef Qt_methods[] = { {"SpriteMediaGetIndImageProperty", (PyCFunction)Qt_SpriteMediaGetIndImageProperty, 1, "(MediaHandler mh, short imageIndex, long imagePropertyType, void * imagePropertyValue) -> (ComponentResult _rv)"}, #endif + {"SpriteMediaDisposeSprite", (PyCFunction)Qt_SpriteMediaDisposeSprite, 1, + "(MediaHandler mh, QTAtomID spriteID) -> (ComponentResult _rv)"}, + {"SpriteMediaSetActionVariableToString", (PyCFunction)Qt_SpriteMediaSetActionVariableToString, 1, + "(MediaHandler mh, QTAtomID variableID, Ptr theCString) -> (ComponentResult _rv)"}, + {"SpriteMediaGetActionVariableAsString", (PyCFunction)Qt_SpriteMediaGetActionVariableAsString, 1, + "(MediaHandler mh, QTAtomID variableID) -> (ComponentResult _rv, Handle theCString)"}, + {"FlashMediaSetPan", (PyCFunction)Qt_FlashMediaSetPan, 1, + "(MediaHandler mh, short xPercent, short yPercent) -> (ComponentResult _rv)"}, + {"FlashMediaSetZoom", (PyCFunction)Qt_FlashMediaSetZoom, 1, + "(MediaHandler mh, short factor) -> (ComponentResult _rv)"}, + {"FlashMediaSetZoomRect", (PyCFunction)Qt_FlashMediaSetZoomRect, 1, + "(MediaHandler mh, long left, long top, long right, long bottom) -> (ComponentResult _rv)"}, + {"FlashMediaGetRefConBounds", (PyCFunction)Qt_FlashMediaGetRefConBounds, 1, + "(MediaHandler mh, long refCon) -> (ComponentResult _rv, long left, long top, long right, long bottom)"}, + {"FlashMediaGetRefConID", (PyCFunction)Qt_FlashMediaGetRefConID, 1, + "(MediaHandler mh, long refCon) -> (ComponentResult _rv, long refConID)"}, + {"FlashMediaIDToRefCon", (PyCFunction)Qt_FlashMediaIDToRefCon, 1, + "(MediaHandler mh, long refConID) -> (ComponentResult _rv, long refCon)"}, + {"FlashMediaGetDisplayedFrameNumber", (PyCFunction)Qt_FlashMediaGetDisplayedFrameNumber, 1, + "(MediaHandler mh) -> (ComponentResult _rv, long flashFrameNumber)"}, + {"FlashMediaFrameNumberToMovieTime", (PyCFunction)Qt_FlashMediaFrameNumberToMovieTime, 1, + "(MediaHandler mh, long flashFrameNumber) -> (ComponentResult _rv, TimeValue movieTime)"}, + {"FlashMediaFrameLabelToMovieTime", (PyCFunction)Qt_FlashMediaFrameLabelToMovieTime, 1, + "(MediaHandler mh, Ptr theLabel) -> (ComponentResult _rv, TimeValue movieTime)"}, + {"MovieMediaGetCurrentMovieProperty", (PyCFunction)Qt_MovieMediaGetCurrentMovieProperty, 1, + "(MediaHandler mh, OSType whichProperty, void * value) -> (ComponentResult _rv)"}, + {"MovieMediaGetCurrentTrackProperty", (PyCFunction)Qt_MovieMediaGetCurrentTrackProperty, 1, + "(MediaHandler mh, long trackID, OSType whichProperty, void * value) -> (ComponentResult _rv)"}, + {"MovieMediaGetChildMovieDataReference", (PyCFunction)Qt_MovieMediaGetChildMovieDataReference, 1, + "(MediaHandler mh, QTAtomID dataRefID, short dataRefIndex) -> (ComponentResult _rv, OSType dataRefType, Handle dataRef, QTAtomID dataRefIDOut, short dataRefIndexOut)"}, + {"MovieMediaSetChildMovieDataReference", (PyCFunction)Qt_MovieMediaSetChildMovieDataReference, 1, + "(MediaHandler mh, QTAtomID dataRefID, OSType dataRefType, Handle dataRef) -> (ComponentResult _rv)"}, + {"MovieMediaLoadChildMovieFromDataReference", (PyCFunction)Qt_MovieMediaLoadChildMovieFromDataReference, 1, + "(MediaHandler mh, QTAtomID dataRefID) -> (ComponentResult _rv)"}, + {"Media3DGetCurrentGroup", (PyCFunction)Qt_Media3DGetCurrentGroup, 1, + "(MediaHandler mh, void * group) -> (ComponentResult _rv)"}, + {"Media3DTranslateNamedObjectTo", (PyCFunction)Qt_Media3DTranslateNamedObjectTo, 1, + "(MediaHandler mh, Fixed x, Fixed y, Fixed z) -> (ComponentResult _rv, char objectName)"}, + {"Media3DScaleNamedObjectTo", (PyCFunction)Qt_Media3DScaleNamedObjectTo, 1, + "(MediaHandler mh, Fixed xScale, Fixed yScale, Fixed zScale) -> (ComponentResult _rv, char objectName)"}, + {"Media3DRotateNamedObjectTo", (PyCFunction)Qt_Media3DRotateNamedObjectTo, 1, + "(MediaHandler mh, Fixed xDegrees, Fixed yDegrees, Fixed zDegrees) -> (ComponentResult _rv, char objectName)"}, + {"Media3DSetCameraData", (PyCFunction)Qt_Media3DSetCameraData, 1, + "(MediaHandler mh, void * cameraData) -> (ComponentResult _rv)"}, + {"Media3DGetCameraData", (PyCFunction)Qt_Media3DGetCameraData, 1, + "(MediaHandler mh, void * cameraData) -> (ComponentResult _rv)"}, + {"Media3DSetCameraAngleAspect", (PyCFunction)Qt_Media3DSetCameraAngleAspect, 1, + "(MediaHandler mh, QTFloatSingle fov, QTFloatSingle aspectRatioXToY) -> (ComponentResult _rv)"}, + {"Media3DGetCameraAngleAspect", (PyCFunction)Qt_Media3DGetCameraAngleAspect, 1, + "(MediaHandler mh) -> (ComponentResult _rv, QTFloatSingle fov, QTFloatSingle aspectRatioXToY)"}, + {"Media3DSetCameraRange", (PyCFunction)Qt_Media3DSetCameraRange, 1, + "(MediaHandler mh, void * tQ3CameraRange) -> (ComponentResult _rv)"}, + {"Media3DGetCameraRange", (PyCFunction)Qt_Media3DGetCameraRange, 1, + "(MediaHandler mh, void * tQ3CameraRange) -> (ComponentResult _rv)"}, + {"Media3DGetViewObject", (PyCFunction)Qt_Media3DGetViewObject, 1, + "(MediaHandler mh, void * tq3viewObject) -> (ComponentResult _rv)"}, {"NewTimeBase", (PyCFunction)Qt_NewTimeBase, 1, "() -> (TimeBase _rv)"}, {"ConvertTime", (PyCFunction)Qt_ConvertTime, 1, @@ -7938,7 +9106,7 @@ void initQt() Qt_Error = PyMac_GetOSErrException(); if (Qt_Error == NULL || PyDict_SetItemString(d, "Error", Qt_Error) != 0) - Py_FatalError("can't initialize Qt.Error"); + return; MovieController_Type.ob_type = &PyType_Type; Py_INCREF(&MovieController_Type); if (PyDict_SetItemString(d, "MovieControllerType", (PyObject *)&MovieController_Type) != 0) diff --git a/Mac/Modules/qt/qtscan.py b/Mac/Modules/qt/qtscan.py index 27d76be..9dd120b 100644 --- a/Mac/Modules/qt/qtscan.py +++ b/Mac/Modules/qt/qtscan.py @@ -97,6 +97,15 @@ class MyScanner(Scanner): "GetMovieUPP", "ModalFilterUPP", "TrackTransferUPP", + "MoviePrePrerollCompleteUPP", + "MovieExecuteWiredActionsUPP", + "QTBandwidthNotificationUPP", + "DoMCActionUPP", + + "SampleReference64Ptr", # Don't know what this does, yet + "QTRuntimeSpriteDescPtr", + "QTBandwidthReference", + "QTScheduledBandwidthReference", "QTAtomContainer", "SpriteWorld", "Sprite", diff --git a/Mac/Modules/qt/qtsupport.py b/Mac/Modules/qt/qtsupport.py index fd2169d..3d26673 100644 --- a/Mac/Modules/qt/qtsupport.py +++ b/Mac/Modules/qt/qtsupport.py @@ -91,6 +91,7 @@ CTabHandle = OpaqueByValueType("CTabHandle", "ResObj") PixMapHandle = OpaqueByValueType("PixMapHandle", "ResObj") SampleDescriptionHandle = OpaqueByValueType("SampleDescriptionHandle", "ResObj") ImageDescriptionHandle = OpaqueByValueType("ImageDescriptionHandle", "ResObj") +TextDescriptionHandle = OpaqueByValueType("TextDescriptionHandle", "ResObj") TEHandle = OpaqueByValueType("TEHandle", "ResObj") CGrafPtr = OpaqueByValueType("CGrafPtr", "GrafObj") GDHandle = OpaqueByValueType("GDHandle", "OptResObj") @@ -127,6 +128,10 @@ mcactionparams = InputOnlyType("void *", "s") QTParameterDialog = Type("QTParameterDialog", "l") QTAtomID = Type("QTAtomID", "l") MCInterfaceElement = Type("MCInterfaceElement", "l") +CodecType = OSTypeType("CodecType") +GWorldPtr = OpaqueByValueType("GWorldPtr", "GWorldObj") +QTFloatSingle = Type("QTFloatSingle", "f") + # Could-not-be-bothered-types (NewMovieFromFile) dummyshortptr = FakeType('(short *)0') dummyStringPtr = FakeType('(StringPtr)0') diff --git a/Mac/Modules/res/Resmodule.c b/Mac/Modules/res/Resmodule.c index 56534d6..42c8800 100644 --- a/Mac/Modules/res/Resmodule.c +++ b/Mac/Modules/res/Resmodule.c @@ -1304,6 +1304,159 @@ static PyObject *Res_FSpCreateResFile(_self, _args) return _res; } +#if TARGET_API_MAC_CARBON + +static PyObject *Res_InsertResourceFile(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _rv; + SInt16 refNum; + RsrcChainLocation where; + if (!PyArg_ParseTuple(_args, "hh", + &refNum, + &where)) + return NULL; + _rv = InsertResourceFile(refNum, + where); + { + OSErr _err = ResError(); + if (_err != noErr) return PyMac_Error(_err); + } + _res = Py_BuildValue("h", + _rv); + return _res; +} +#endif + +#if TARGET_API_MAC_CARBON + +static PyObject *Res_DetachResourceFile(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _rv; + SInt16 refNum; + if (!PyArg_ParseTuple(_args, "h", + &refNum)) + return NULL; + _rv = DetachResourceFile(refNum); + { + OSErr _err = ResError(); + if (_err != noErr) return PyMac_Error(_err); + } + _res = Py_BuildValue("h", + _rv); + return _res; +} +#endif + +static PyObject *Res_FSpResourceFileAlreadyOpen(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + Boolean _rv; + FSSpec resourceFile; + Boolean inChain; + SInt16 refNum; + if (!PyArg_ParseTuple(_args, "O&", + PyMac_GetFSSpec, &resourceFile)) + return NULL; + _rv = FSpResourceFileAlreadyOpen(&resourceFile, + &inChain, + &refNum); + { + OSErr _err = ResError(); + if (_err != noErr) return PyMac_Error(_err); + } + _res = Py_BuildValue("bbh", + _rv, + inChain, + refNum); + return _res; +} + +#if TARGET_API_MAC_CARBON + +static PyObject *Res_FSpOpenOrphanResFile(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _rv; + FSSpec spec; + SignedByte permission; + SInt16 refNum; + if (!PyArg_ParseTuple(_args, "O&b", + PyMac_GetFSSpec, &spec, + &permission)) + return NULL; + _rv = FSpOpenOrphanResFile(&spec, + permission, + &refNum); + { + OSErr _err = ResError(); + if (_err != noErr) return PyMac_Error(_err); + } + _res = Py_BuildValue("hh", + _rv, + refNum); + return _res; +} +#endif + +#if TARGET_API_MAC_CARBON + +static PyObject *Res_GetTopResourceFile(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _rv; + SInt16 refNum; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = GetTopResourceFile(&refNum); + { + OSErr _err = ResError(); + if (_err != noErr) return PyMac_Error(_err); + } + _res = Py_BuildValue("hh", + _rv, + refNum); + return _res; +} +#endif + +#if TARGET_API_MAC_CARBON + +static PyObject *Res_GetNextResourceFile(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _rv; + SInt16 curRefNum; + SInt16 nextRefNum; + if (!PyArg_ParseTuple(_args, "h", + &curRefNum)) + return NULL; + _rv = GetNextResourceFile(curRefNum, + &nextRefNum); + { + OSErr _err = ResError(); + if (_err != noErr) return PyMac_Error(_err); + } + _res = Py_BuildValue("hh", + _rv, + nextRefNum); + return _res; +} +#endif + static PyObject *Res_Resource(_self, _args) PyObject *_self; PyObject *_args; @@ -1437,6 +1590,33 @@ static PyMethodDef Res_methods[] = { "(FSSpec spec, SignedByte permission) -> (short _rv)"}, {"FSpCreateResFile", (PyCFunction)Res_FSpCreateResFile, 1, "(FSSpec spec, OSType creator, OSType fileType, ScriptCode scriptTag) -> None"}, + +#if TARGET_API_MAC_CARBON + {"InsertResourceFile", (PyCFunction)Res_InsertResourceFile, 1, + "(SInt16 refNum, RsrcChainLocation where) -> (OSErr _rv)"}, +#endif + +#if TARGET_API_MAC_CARBON + {"DetachResourceFile", (PyCFunction)Res_DetachResourceFile, 1, + "(SInt16 refNum) -> (OSErr _rv)"}, +#endif + {"FSpResourceFileAlreadyOpen", (PyCFunction)Res_FSpResourceFileAlreadyOpen, 1, + "(FSSpec resourceFile) -> (Boolean _rv, Boolean inChain, SInt16 refNum)"}, + +#if TARGET_API_MAC_CARBON + {"FSpOpenOrphanResFile", (PyCFunction)Res_FSpOpenOrphanResFile, 1, + "(FSSpec spec, SignedByte permission) -> (OSErr _rv, SInt16 refNum)"}, +#endif + +#if TARGET_API_MAC_CARBON + {"GetTopResourceFile", (PyCFunction)Res_GetTopResourceFile, 1, + "() -> (OSErr _rv, SInt16 refNum)"}, +#endif + +#if TARGET_API_MAC_CARBON + {"GetNextResourceFile", (PyCFunction)Res_GetNextResourceFile, 1, + "(SInt16 curRefNum) -> (OSErr _rv, SInt16 nextRefNum)"}, +#endif {"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, @@ -1499,7 +1679,7 @@ void initRes() Res_Error = PyMac_GetOSErrException(); if (Res_Error == NULL || PyDict_SetItemString(d, "Error", Res_Error) != 0) - Py_FatalError("can't initialize Res.Error"); + return; Resource_Type.ob_type = &PyType_Type; Py_INCREF(&Resource_Type); if (PyDict_SetItemString(d, "ResourceType", (PyObject *)&Resource_Type) != 0) diff --git a/Mac/Modules/res/resscan.py b/Mac/Modules/res/resscan.py index b417cd7..d97f972 100644 --- a/Mac/Modules/res/resscan.py +++ b/Mac/Modules/res/resscan.py @@ -57,6 +57,13 @@ class ResourcesScanner(Scanner): 'RsrcZoneInit', 'InitResources', 'RsrcMapEntry', + ]), + ('#if TARGET_API_MAC_CARBON', [ + 'GetNextResourceFile', + 'GetTopResourceFile', + 'FSpOpenOrphanResFile', + 'DetachResourceFile', + 'InsertResourceFile', ])] def makerepairinstructions(self): diff --git a/Mac/Modules/res/ressupport.py b/Mac/Modules/res/ressupport.py index b19c10d..fcee62e 100644 --- a/Mac/Modules/res/ressupport.py +++ b/Mac/Modules/res/ressupport.py @@ -18,6 +18,8 @@ class ResMixIn: class ResFunction(ResMixIn, FunctionGenerator): pass class ResMethod(ResMixIn, MethodGenerator): pass +RsrcChainLocation = Type("RsrcChainLocation", "h") + # includestuff etc. are imported from macsupport includestuff = includestuff + """ diff --git a/Mac/Modules/snd/Sndmodule.c b/Mac/Modules/snd/Sndmodule.c index daa0090..e0a80c3 100644 --- a/Mac/Modules/snd/Sndmodule.c +++ b/Mac/Modules/snd/Sndmodule.c @@ -1541,7 +1541,7 @@ void initSnd() Snd_Error = PyMac_GetOSErrException(); if (Snd_Error == NULL || PyDict_SetItemString(d, "Error", Snd_Error) != 0) - Py_FatalError("can't initialize Snd.Error"); + return; SndChannel_Type.ob_type = &PyType_Type; Py_INCREF(&SndChannel_Type); if (PyDict_SetItemString(d, "SndChannelType", (PyObject *)&SndChannel_Type) != 0) diff --git a/Mac/Modules/snd/sndscan.py b/Mac/Modules/snd/sndscan.py index 9c1ff10..1873c19 100644 --- a/Mac/Modules/snd/sndscan.py +++ b/Mac/Modules/snd/sndscan.py @@ -41,20 +41,9 @@ class SoundScanner(Scanner): 'SndDisposeChannel', # automatic on deallocation 'SndAddModifier', # for internal use only 'SndPlayDoubleBuffer', # very low level routine - # Obsolete: - 'StartSound', - 'StopSound', - 'SoundDone', - # These do not work for cfm68k: -## 'SndGetInfo', -## 'SndSetInfo', -## 'GetCompressionInfo', -## 'GetCompressionName', -## 'GetSoundPreference', -## 'SetSoundPreference', - # And old calls that are no longer supported - 'SetSoundVol', - 'GetSoundVol', + # Missing from libraries (UH332) + 'SoundManagerSetInfo', + 'SoundManagerGetInfo', # Constants with funny definitions 'rate48khz', 'rate44khz', diff --git a/Mac/Modules/te/TEmodule.c b/Mac/Modules/te/TEmodule.c index 789b157..2bb447b 100644 --- a/Mac/Modules/te/TEmodule.c +++ b/Mac/Modules/te/TEmodule.c @@ -1012,6 +1012,41 @@ static PyObject *TE_TEToScrap(_self, _args) return _res; } +#if TARGET_API_MAC_CARBON + +static PyObject *TE_TEGetScrapHandle(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + Handle _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = TEGetScrapHandle(); + _res = Py_BuildValue("O&", + ResObj_New, _rv); + return _res; +} +#endif + +#if TARGET_API_MAC_CARBON + +static PyObject *TE_TESetScrapHandle(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + Handle value; + if (!PyArg_ParseTuple(_args, "O&", + ResObj_Convert, &value)) + return NULL; + TESetScrapHandle(value); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} +#endif + static PyObject *TE_as_TE(_self, _args) PyObject *_self; PyObject *_args; @@ -1045,6 +1080,16 @@ static PyMethodDef TE_methods[] = { "() -> None"}, {"TEToScrap", (PyCFunction)TE_TEToScrap, 1, "() -> None"}, + +#if TARGET_API_MAC_CARBON + {"TEGetScrapHandle", (PyCFunction)TE_TEGetScrapHandle, 1, + "() -> (Handle _rv)"}, +#endif + +#if TARGET_API_MAC_CARBON + {"TESetScrapHandle", (PyCFunction)TE_TESetScrapHandle, 1, + "(Handle value) -> None"}, +#endif {"as_TE", (PyCFunction)TE_as_TE, 1, "(Handle h) -> (TEHandle _rv)"}, {NULL, NULL, 0} @@ -1066,7 +1111,7 @@ void initTE() TE_Error = PyMac_GetOSErrException(); if (TE_Error == NULL || PyDict_SetItemString(d, "Error", TE_Error) != 0) - Py_FatalError("can't initialize TE.Error"); + return; TE_Type.ob_type = &PyType_Type; Py_INCREF(&TE_Type); if (PyDict_SetItemString(d, "TEType", (PyObject *)&TE_Type) != 0) diff --git a/Mac/Modules/te/tescan.py b/Mac/Modules/te/tescan.py index 87a25da..c9cff60 100644 --- a/Mac/Modules/te/tescan.py +++ b/Mac/Modules/te/tescan.py @@ -42,11 +42,21 @@ class MyScanner(Scanner): ## "TEGetHiliteRgn", ] + def makegreylist(self): + return [ + ('#if TARGET_API_MAC_CARBON', [ + 'TEGetScrapHandle', + 'TESetScrapHandle', + ])] + def makeblacklisttypes(self): return [ "TEClickLoopUPP", "UniversalProcPtr", - "WordBreakUPP" + "WordBreakUPP", + "TEDoTextUPP", + "TERecalcUPP", + "TEFindWordUPP", ] def makerepairinstructions(self): diff --git a/Mac/Modules/win/Winmodule.c b/Mac/Modules/win/Winmodule.c index c95e06b..02f0efe 100644 --- a/Mac/Modules/win/Winmodule.c +++ b/Mac/Modules/win/Winmodule.c @@ -9,6 +9,13 @@ #include "pymactoolbox.h" #include <Windows.h> + +#if !ACCESSOR_CALLS_ARE_FUNCTIONS +#define GetWindowSpareFlag(win) (((CWindowPeek)(win))->spareFlag) +#define GetWindowFromPort(port) ((WindowRef)(port)) +#define GetWindowPortBounds(win, rectp) (*(rectp) = ((CWindowPeek)(win))->port.portRect) +#endif + /* Function to dispose a window, with a "normal" calling sequence */ static void PyMac_AutoDisposeWindow(WindowPtr w) @@ -46,12 +53,10 @@ WinObj_Convert(v, p_itself) PyObject *v; WindowPtr *p_itself; { -#if !TARGET_API_MAC_CARBON if (DlgObj_Check(v)) { - *p_itself = ((WindowObject *)v)->ob_itself; + *p_itself = DlgObj_ConvertToWindow(v); return 1; } -#endif if (v == Py_None) { *p_itself = NULL; return 1; } if (PyInt_Check(v)) { *p_itself = (WindowPtr)PyInt_AsLong(v); return 1; } @@ -109,6 +114,24 @@ static PyObject *WinObj_CloneWindow(_self, _args) return _res; } +#if TARGET_API_MAC_CARBON + +static PyObject *WinObj_ReshapeCustomWindow(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _err = ReshapeCustomWindow(_self->ob_itself); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} +#endif + static PyObject *WinObj_GetWindowClass(_self, _args) WindowObject *_self; PyObject *_args; @@ -143,6 +166,30 @@ static PyObject *WinObj_GetWindowAttributes(_self, _args) return _res; } +#if TARGET_API_MAC_CARBON + +static PyObject *WinObj_ChangeWindowAttributes(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + WindowAttributes setTheseAttributes; + WindowAttributes clearTheseAttributes; + if (!PyArg_ParseTuple(_args, "ll", + &setTheseAttributes, + &clearTheseAttributes)) + return NULL; + _err = ChangeWindowAttributes(_self->ob_itself, + setTheseAttributes, + clearTheseAttributes); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} +#endif + #if !TARGET_API_MAC_CARBON static PyObject *WinObj_SetWinColor(_self, _args) @@ -169,13 +216,14 @@ static PyObject *WinObj_SetWindowContentColor(_self, _args) PyObject *_res = NULL; OSStatus _err; RGBColor color; - if (!PyArg_ParseTuple(_args, "")) + if (!PyArg_ParseTuple(_args, "O&", + QdRGB_Convert, &color)) return NULL; _err = SetWindowContentColor(_self->ob_itself, &color); if (_err != noErr) return PyMac_Error(_err); - _res = Py_BuildValue("O&", - QdRGB_New, &color); + Py_INCREF(Py_None); + _res = Py_None; return _res; } @@ -232,6 +280,72 @@ static PyObject *WinObj_SetWindowContentPattern(_self, _args) return _res; } +#if TARGET_API_MAC_CARBON + +static PyObject *WinObj_ScrollWindowRect(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + Rect inScrollRect; + SInt16 inHPixels; + SInt16 inVPixels; + ScrollWindowOptions inOptions; + RgnHandle outExposedRgn; + if (!PyArg_ParseTuple(_args, "O&hhlO&", + PyMac_GetRect, &inScrollRect, + &inHPixels, + &inVPixels, + &inOptions, + ResObj_Convert, &outExposedRgn)) + return NULL; + _err = ScrollWindowRect(_self->ob_itself, + &inScrollRect, + inHPixels, + inVPixels, + inOptions, + outExposedRgn); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} +#endif + +#if TARGET_API_MAC_CARBON + +static PyObject *WinObj_ScrollWindowRegion(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + RgnHandle inScrollRgn; + SInt16 inHPixels; + SInt16 inVPixels; + ScrollWindowOptions inOptions; + RgnHandle outExposedRgn; + if (!PyArg_ParseTuple(_args, "O&hhlO&", + ResObj_Convert, &inScrollRgn, + &inHPixels, + &inVPixels, + &inOptions, + ResObj_Convert, &outExposedRgn)) + return NULL; + _err = ScrollWindowRegion(_self->ob_itself, + inScrollRgn, + inHPixels, + inVPixels, + inOptions, + outExposedRgn); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} +#endif + static PyObject *WinObj_ClipAbove(_self, _args) WindowObject *_self; PyObject *_args; @@ -280,108 +394,100 @@ static PyObject *WinObj_DrawNew(_self, _args) } #endif -static PyObject *WinObj_PaintOne(_self, _args) - WindowObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - RgnHandle clobberedRgn; - if (!PyArg_ParseTuple(_args, "O&", - ResObj_Convert, &clobberedRgn)) - return NULL; - PaintOne(_self->ob_itself, - clobberedRgn); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - -static PyObject *WinObj_PaintBehind(_self, _args) +static PyObject *WinObj_CalcVis(_self, _args) WindowObject *_self; PyObject *_args; { PyObject *_res = NULL; - RgnHandle clobberedRgn; - if (!PyArg_ParseTuple(_args, "O&", - ResObj_Convert, &clobberedRgn)) + if (!PyArg_ParseTuple(_args, "")) return NULL; - PaintBehind(_self->ob_itself, - clobberedRgn); + CalcVis(_self->ob_itself); Py_INCREF(Py_None); _res = Py_None; return _res; } -static PyObject *WinObj_CalcVis(_self, _args) +static PyObject *WinObj_BringToFront(_self, _args) WindowObject *_self; PyObject *_args; { PyObject *_res = NULL; if (!PyArg_ParseTuple(_args, "")) return NULL; - CalcVis(_self->ob_itself); + BringToFront(_self->ob_itself); Py_INCREF(Py_None); _res = Py_None; return _res; } -static PyObject *WinObj_CalcVisBehind(_self, _args) +static PyObject *WinObj_SendBehind(_self, _args) WindowObject *_self; PyObject *_args; { PyObject *_res = NULL; - RgnHandle clobberedRgn; + WindowPtr behindWindow; if (!PyArg_ParseTuple(_args, "O&", - ResObj_Convert, &clobberedRgn)) + WinObj_Convert, &behindWindow)) return NULL; - CalcVisBehind(_self->ob_itself, - clobberedRgn); + SendBehind(_self->ob_itself, + behindWindow); Py_INCREF(Py_None); _res = Py_None; return _res; } -static PyObject *WinObj_BringToFront(_self, _args) +static PyObject *WinObj_SelectWindow(_self, _args) WindowObject *_self; PyObject *_args; { PyObject *_res = NULL; if (!PyArg_ParseTuple(_args, "")) return NULL; - BringToFront(_self->ob_itself); + SelectWindow(_self->ob_itself); Py_INCREF(Py_None); _res = Py_None; return _res; } -static PyObject *WinObj_SendBehind(_self, _args) +#if TARGET_API_MAC_CARBON + +static PyObject *WinObj_GetNextWindowOfClass(_self, _args) WindowObject *_self; PyObject *_args; { PyObject *_res = NULL; - WindowPtr behindWindow; - if (!PyArg_ParseTuple(_args, "O&", - WinObj_Convert, &behindWindow)) - return NULL; - SendBehind(_self->ob_itself, - behindWindow); - Py_INCREF(Py_None); - _res = Py_None; + WindowPtr _rv; + WindowClass inWindowClass; + Boolean mustBeVisible; + if (!PyArg_ParseTuple(_args, "lb", + &inWindowClass, + &mustBeVisible)) + return NULL; + _rv = GetNextWindowOfClass(_self->ob_itself, + inWindowClass, + mustBeVisible); + _res = Py_BuildValue("O&", + WinObj_New, _rv); return _res; } +#endif -static PyObject *WinObj_SelectWindow(_self, _args) +#if !TARGET_API_MAC_CARBON + +static PyObject *WinObj_IsValidWindowPtr(_self, _args) WindowObject *_self; PyObject *_args; { PyObject *_res = NULL; + Boolean _rv; if (!PyArg_ParseTuple(_args, "")) return NULL; - SelectWindow(_self->ob_itself); - Py_INCREF(Py_None); - _res = Py_None; + _rv = IsValidWindowPtr(_self->ob_itself); + _res = Py_BuildValue("b", + _rv); return _res; } +#endif static PyObject *WinObj_HiliteWindow(_self, _args) WindowObject *_self; @@ -797,6 +903,68 @@ static PyObject *WinObj_RemoveWindowProxy(_self, _args) return _res; } +static PyObject *WinObj_BeginWindowProxyDrag(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + DragReference outNewDrag; + RgnHandle outDragOutlineRgn; + if (!PyArg_ParseTuple(_args, "O&", + ResObj_Convert, &outDragOutlineRgn)) + return NULL; + _err = BeginWindowProxyDrag(_self->ob_itself, + &outNewDrag, + outDragOutlineRgn); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&", + DragObj_New, outNewDrag); + return _res; +} + +static PyObject *WinObj_EndWindowProxyDrag(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + DragReference theDrag; + if (!PyArg_ParseTuple(_args, "O&", + DragObj_Convert, &theDrag)) + return NULL; + _err = EndWindowProxyDrag(_self->ob_itself, + theDrag); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *WinObj_TrackWindowProxyFromExistingDrag(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + Point startPt; + DragReference drag; + RgnHandle inDragOutlineRgn; + if (!PyArg_ParseTuple(_args, "O&O&O&", + PyMac_GetPoint, &startPt, + DragObj_Convert, &drag, + ResObj_Convert, &inDragOutlineRgn)) + return NULL; + _err = TrackWindowProxyFromExistingDrag(_self->ob_itself, + startPt, + drag, + inDragOutlineRgn); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + static PyObject *WinObj_TrackWindowProxyDrag(_self, _args) WindowObject *_self; PyObject *_args; @@ -854,13 +1022,13 @@ static PyObject *WinObj_IsWindowPathSelectClick(_self, _args) PyObject *_res = NULL; Boolean _rv; EventRecord event; - if (!PyArg_ParseTuple(_args, "")) + if (!PyArg_ParseTuple(_args, "O&", + PyMac_GetEventRecord, &event)) return NULL; _rv = IsWindowPathSelectClick(_self->ob_itself, &event); - _res = Py_BuildValue("bO&", - _rv, - PyMac_BuildEventRecord, &event); + _res = Py_BuildValue("b", + _rv); return _res; } @@ -994,7 +1162,7 @@ static PyObject *WinObj_ZoomWindow(_self, _args) PyObject *_args; { PyObject *_res = NULL; - short partCode; + WindowPartCode partCode; Boolean front; if (!PyArg_ParseTuple(_args, "hb", &partCode, @@ -1054,24 +1222,23 @@ static PyObject *WinObj_CollapseWindow(_self, _args) return _res; } -static PyObject *WinObj_RepositionWindow(_self, _args) +static PyObject *WinObj_GetWindowBounds(_self, _args) WindowObject *_self; PyObject *_args; { PyObject *_res = NULL; OSStatus _err; - WindowPtr parentWindow; - WindowPositionMethod method; - if (!PyArg_ParseTuple(_args, "O&l", - WinObj_Convert, &parentWindow, - &method)) + WindowRegionCode regionCode; + Rect globalBounds; + if (!PyArg_ParseTuple(_args, "H", + ®ionCode)) return NULL; - _err = RepositionWindow(_self->ob_itself, - parentWindow, - method); + _err = GetWindowBounds(_self->ob_itself, + regionCode, + &globalBounds); if (_err != noErr) return PyMac_Error(_err); - Py_INCREF(Py_None); - _res = Py_None; + _res = Py_BuildValue("O&", + PyMac_BuildRect, &globalBounds); return _res; } @@ -1096,23 +1263,24 @@ static PyObject *WinObj_SetWindowBounds(_self, _args) return _res; } -static PyObject *WinObj_GetWindowBounds(_self, _args) +static PyObject *WinObj_RepositionWindow(_self, _args) WindowObject *_self; PyObject *_args; { PyObject *_res = NULL; OSStatus _err; - WindowRegionCode regionCode; - Rect globalBounds; - if (!PyArg_ParseTuple(_args, "H", - ®ionCode)) + WindowPtr parentWindow; + WindowPositionMethod method; + if (!PyArg_ParseTuple(_args, "O&l", + WinObj_Convert, &parentWindow, + &method)) return NULL; - _err = GetWindowBounds(_self->ob_itself, - regionCode, - &globalBounds); + _err = RepositionWindow(_self->ob_itself, + parentWindow, + method); if (_err != noErr) return PyMac_Error(_err); - _res = Py_BuildValue("O&", - PyMac_BuildRect, &globalBounds); + Py_INCREF(Py_None); + _res = Py_None; return _res; } @@ -1163,7 +1331,7 @@ static PyObject *WinObj_ZoomWindowIdeal(_self, _args) { PyObject *_res = NULL; OSStatus _err; - SInt16 partCode; + WindowPartCode partCode; Point ioIdealSize; if (!PyArg_ParseTuple(_args, "h", &partCode)) @@ -1253,6 +1421,62 @@ static PyObject *WinObj_ShowHide(_self, _args) return _res; } +#if TARGET_API_MAC_CARBON + +static PyObject *WinObj_GetWindowPropertyAttributes(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + OSType propertyCreator; + OSType propertyTag; + UInt32 attributes; + if (!PyArg_ParseTuple(_args, "O&O&", + PyMac_GetOSType, &propertyCreator, + PyMac_GetOSType, &propertyTag)) + return NULL; + _err = GetWindowPropertyAttributes(_self->ob_itself, + propertyCreator, + propertyTag, + &attributes); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("l", + attributes); + return _res; +} +#endif + +#if TARGET_API_MAC_CARBON + +static PyObject *WinObj_ChangeWindowPropertyAttributes(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + OSType propertyCreator; + OSType propertyTag; + UInt32 attributesToSet; + UInt32 attributesToClear; + if (!PyArg_ParseTuple(_args, "O&O&ll", + PyMac_GetOSType, &propertyCreator, + PyMac_GetOSType, &propertyTag, + &attributesToSet, + &attributesToClear)) + return NULL; + _err = ChangeWindowPropertyAttributes(_self->ob_itself, + propertyCreator, + propertyTag, + attributesToSet, + attributesToClear); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} +#endif + static PyObject *WinObj_TrackBox(_self, _args) WindowObject *_self; PyObject *_args; @@ -1260,7 +1484,7 @@ static PyObject *WinObj_TrackBox(_self, _args) PyObject *_res = NULL; Boolean _rv; Point thePt; - short partCode; + WindowPartCode partCode; if (!PyArg_ParseTuple(_args, "O&h", PyMac_GetPoint, &thePt, &partCode)) @@ -1310,64 +1534,63 @@ static PyObject *WinObj_GetAuxWin(_self, _args) } #endif -static PyObject *WinObj_GetWindowPort(_self, _args) +static PyObject *WinObj_GetWindowGoAwayFlag(_self, _args) WindowObject *_self; PyObject *_args; { PyObject *_res = NULL; - CGrafPtr _rv; + Boolean _rv; if (!PyArg_ParseTuple(_args, "")) return NULL; - _rv = GetWindowPort(_self->ob_itself); - _res = Py_BuildValue("O&", - GrafObj_New, _rv); + _rv = GetWindowGoAwayFlag(_self->ob_itself); + _res = Py_BuildValue("b", + _rv); return _res; } -static PyObject *WinObj_SetPortWindowPort(_self, _args) +static PyObject *WinObj_GetWindowSpareFlag(_self, _args) WindowObject *_self; PyObject *_args; { PyObject *_res = NULL; + Boolean _rv; if (!PyArg_ParseTuple(_args, "")) return NULL; - SetPortWindowPort(_self->ob_itself); - Py_INCREF(Py_None); - _res = Py_None; + _rv = GetWindowSpareFlag(_self->ob_itself); + _res = Py_BuildValue("b", + _rv); return _res; } -static PyObject *WinObj_GetWindowKind(_self, _args) +static PyObject *WinObj_GetWindowPort(_self, _args) WindowObject *_self; PyObject *_args; { PyObject *_res = NULL; - short _rv; + CGrafPtr _rv; if (!PyArg_ParseTuple(_args, "")) return NULL; - _rv = GetWindowKind(_self->ob_itself); - _res = Py_BuildValue("h", - _rv); + _rv = GetWindowPort(_self->ob_itself); + _res = Py_BuildValue("O&", + GrafObj_New, _rv); return _res; } -static PyObject *WinObj_SetWindowKind(_self, _args) +static PyObject *WinObj_GetWindowKind(_self, _args) WindowObject *_self; PyObject *_args; { PyObject *_res = NULL; - short wKind; - if (!PyArg_ParseTuple(_args, "h", - &wKind)) + short _rv; + if (!PyArg_ParseTuple(_args, "")) return NULL; - SetWindowKind(_self->ob_itself, - wKind); - Py_INCREF(Py_None); - _res = Py_None; + _rv = GetWindowKind(_self->ob_itself); + _res = Py_BuildValue("h", + _rv); return _res; } -static PyObject *WinObj_IsWindowVisible(_self, _args) +static PyObject *WinObj_MacIsWindowVisible(_self, _args) WindowObject *_self; PyObject *_args; { @@ -1375,7 +1598,7 @@ static PyObject *WinObj_IsWindowVisible(_self, _args) Boolean _rv; if (!PyArg_ParseTuple(_args, "")) return NULL; - _rv = IsWindowVisible(_self->ob_itself); + _rv = MacIsWindowVisible(_self->ob_itself); _res = Py_BuildValue("b", _rv); return _res; @@ -1395,7 +1618,9 @@ static PyObject *WinObj_IsWindowHilited(_self, _args) return _res; } -static PyObject *WinObj_GetWindowGoAwayFlag(_self, _args) +#if TARGET_API_MAC_CARBON + +static PyObject *WinObj_IsWindowUpdatePending(_self, _args) WindowObject *_self; PyObject *_args; { @@ -1403,176 +1628,130 @@ static PyObject *WinObj_GetWindowGoAwayFlag(_self, _args) Boolean _rv; if (!PyArg_ParseTuple(_args, "")) return NULL; - _rv = GetWindowGoAwayFlag(_self->ob_itself); + _rv = IsWindowUpdatePending(_self->ob_itself); _res = Py_BuildValue("b", _rv); return _res; } +#endif -#if !TARGET_API_MAC_CARBON - -static PyObject *WinObj_GetWindowZoomFlag(_self, _args) +static PyObject *WinObj_MacGetNextWindow(_self, _args) WindowObject *_self; PyObject *_args; { PyObject *_res = NULL; - Boolean _rv; + WindowPtr _rv; if (!PyArg_ParseTuple(_args, "")) return NULL; - _rv = GetWindowZoomFlag(_self->ob_itself); - _res = Py_BuildValue("b", - _rv); + _rv = MacGetNextWindow(_self->ob_itself); + _res = Py_BuildValue("O&", + WinObj_New, _rv); return _res; } -#endif - -#if !TARGET_API_MAC_CARBON -static PyObject *WinObj_GetWindowStructureRgn(_self, _args) +static PyObject *WinObj_GetWindowStandardState(_self, _args) WindowObject *_self; PyObject *_args; { PyObject *_res = NULL; - RgnHandle r; - if (!PyArg_ParseTuple(_args, "O&", - ResObj_Convert, &r)) + Rect rect; + if (!PyArg_ParseTuple(_args, "")) return NULL; - GetWindowStructureRgn(_self->ob_itself, - r); - Py_INCREF(Py_None); - _res = Py_None; + GetWindowStandardState(_self->ob_itself, + &rect); + _res = Py_BuildValue("O&", + PyMac_BuildRect, &rect); return _res; } -#endif -#if !TARGET_API_MAC_CARBON - -static PyObject *WinObj_GetWindowContentRgn(_self, _args) +static PyObject *WinObj_GetWindowUserState(_self, _args) WindowObject *_self; PyObject *_args; { PyObject *_res = NULL; - RgnHandle r; - if (!PyArg_ParseTuple(_args, "O&", - ResObj_Convert, &r)) + Rect rect; + if (!PyArg_ParseTuple(_args, "")) return NULL; - GetWindowContentRgn(_self->ob_itself, - r); - Py_INCREF(Py_None); - _res = Py_None; + GetWindowUserState(_self->ob_itself, + &rect); + _res = Py_BuildValue("O&", + PyMac_BuildRect, &rect); return _res; } -#endif - -#if !TARGET_API_MAC_CARBON -static PyObject *WinObj_GetWindowUpdateRgn(_self, _args) +static PyObject *WinObj_SetWindowKind(_self, _args) WindowObject *_self; PyObject *_args; { PyObject *_res = NULL; - RgnHandle r; - if (!PyArg_ParseTuple(_args, "O&", - ResObj_Convert, &r)) + short kind; + if (!PyArg_ParseTuple(_args, "h", + &kind)) return NULL; - GetWindowUpdateRgn(_self->ob_itself, - r); + SetWindowKind(_self->ob_itself, + kind); Py_INCREF(Py_None); _res = Py_None; return _res; } -#endif - -#if !TARGET_API_MAC_CARBON - -static PyObject *WinObj_GetWindowTitleWidth(_self, _args) - WindowObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - short _rv; - if (!PyArg_ParseTuple(_args, "")) - return NULL; - _rv = GetWindowTitleWidth(_self->ob_itself); - _res = Py_BuildValue("h", - _rv); - return _res; -} -#endif -static PyObject *WinObj_GetNextWindow(_self, _args) +static PyObject *WinObj_SetWindowStandardState(_self, _args) WindowObject *_self; PyObject *_args; { PyObject *_res = NULL; - WindowPtr _rv; - if (!PyArg_ParseTuple(_args, "")) + Rect rect; + if (!PyArg_ParseTuple(_args, "O&", + PyMac_GetRect, &rect)) return NULL; - _rv = GetNextWindow(_self->ob_itself); - _res = Py_BuildValue("O&", - WinObj_WhichWindow, _rv); + SetWindowStandardState(_self->ob_itself, + &rect); + Py_INCREF(Py_None); + _res = Py_None; return _res; } -static PyObject *WinObj_GetWindowStandardState(_self, _args) +static PyObject *WinObj_SetWindowUserState(_self, _args) WindowObject *_self; PyObject *_args; { PyObject *_res = NULL; - Rect r; - if (!PyArg_ParseTuple(_args, "")) + Rect rect; + if (!PyArg_ParseTuple(_args, "O&", + PyMac_GetRect, &rect)) return NULL; - GetWindowStandardState(_self->ob_itself, - &r); - _res = Py_BuildValue("O&", - PyMac_BuildRect, &r); + SetWindowUserState(_self->ob_itself, + &rect); + Py_INCREF(Py_None); + _res = Py_None; return _res; } -static PyObject *WinObj_GetWindowUserState(_self, _args) +static PyObject *WinObj_SetPortWindowPort(_self, _args) WindowObject *_self; PyObject *_args; { PyObject *_res = NULL; - Rect r; if (!PyArg_ParseTuple(_args, "")) return NULL; - GetWindowUserState(_self->ob_itself, - &r); - _res = Py_BuildValue("O&", - PyMac_BuildRect, &r); - return _res; -} - -static PyObject *WinObj_SetWindowStandardState(_self, _args) - WindowObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - Rect r; - if (!PyArg_ParseTuple(_args, "O&", - PyMac_GetRect, &r)) - return NULL; - SetWindowStandardState(_self->ob_itself, - &r); + SetPortWindowPort(_self->ob_itself); Py_INCREF(Py_None); _res = Py_None; return _res; } -static PyObject *WinObj_SetWindowUserState(_self, _args) +static PyObject *WinObj_GetWindowPortBounds(_self, _args) WindowObject *_self; PyObject *_args; { PyObject *_res = NULL; - Rect r; - if (!PyArg_ParseTuple(_args, "O&", - PyMac_GetRect, &r)) + Rect bounds; + if (!PyArg_ParseTuple(_args, "")) return NULL; - SetWindowUserState(_self->ob_itself, - &r); - Py_INCREF(Py_None); - _res = Py_None; + GetWindowPortBounds(_self->ob_itself, + &bounds); + _res = Py_BuildValue("O&", + PyMac_BuildRect, &bounds); return _res; } @@ -1632,23 +1811,43 @@ static PyMethodDef WinObj_methods[] = { "() -> (UInt32 outCount)"}, {"CloneWindow", (PyCFunction)WinObj_CloneWindow, 1, "() -> None"}, + +#if TARGET_API_MAC_CARBON + {"ReshapeCustomWindow", (PyCFunction)WinObj_ReshapeCustomWindow, 1, + "() -> None"}, +#endif {"GetWindowClass", (PyCFunction)WinObj_GetWindowClass, 1, "() -> (WindowClass outClass)"}, {"GetWindowAttributes", (PyCFunction)WinObj_GetWindowAttributes, 1, "() -> (WindowAttributes outAttributes)"}, +#if TARGET_API_MAC_CARBON + {"ChangeWindowAttributes", (PyCFunction)WinObj_ChangeWindowAttributes, 1, + "(WindowAttributes setTheseAttributes, WindowAttributes clearTheseAttributes) -> None"}, +#endif + #if !TARGET_API_MAC_CARBON {"SetWinColor", (PyCFunction)WinObj_SetWinColor, 1, "(WCTabHandle newColorTable) -> None"}, #endif {"SetWindowContentColor", (PyCFunction)WinObj_SetWindowContentColor, 1, - "() -> (RGBColor color)"}, + "(RGBColor color) -> None"}, {"GetWindowContentColor", (PyCFunction)WinObj_GetWindowContentColor, 1, "() -> (RGBColor color)"}, {"GetWindowContentPattern", (PyCFunction)WinObj_GetWindowContentPattern, 1, "(PixPatHandle outPixPat) -> None"}, {"SetWindowContentPattern", (PyCFunction)WinObj_SetWindowContentPattern, 1, "(PixPatHandle pixPat) -> None"}, + +#if TARGET_API_MAC_CARBON + {"ScrollWindowRect", (PyCFunction)WinObj_ScrollWindowRect, 1, + "(Rect inScrollRect, SInt16 inHPixels, SInt16 inVPixels, ScrollWindowOptions inOptions, RgnHandle outExposedRgn) -> None"}, +#endif + +#if TARGET_API_MAC_CARBON + {"ScrollWindowRegion", (PyCFunction)WinObj_ScrollWindowRegion, 1, + "(RgnHandle inScrollRgn, SInt16 inHPixels, SInt16 inVPixels, ScrollWindowOptions inOptions, RgnHandle outExposedRgn) -> None"}, +#endif {"ClipAbove", (PyCFunction)WinObj_ClipAbove, 1, "() -> None"}, @@ -1661,20 +1860,24 @@ static PyMethodDef WinObj_methods[] = { {"DrawNew", (PyCFunction)WinObj_DrawNew, 1, "(Boolean update) -> None"}, #endif - {"PaintOne", (PyCFunction)WinObj_PaintOne, 1, - "(RgnHandle clobberedRgn) -> None"}, - {"PaintBehind", (PyCFunction)WinObj_PaintBehind, 1, - "(RgnHandle clobberedRgn) -> None"}, {"CalcVis", (PyCFunction)WinObj_CalcVis, 1, "() -> None"}, - {"CalcVisBehind", (PyCFunction)WinObj_CalcVisBehind, 1, - "(RgnHandle clobberedRgn) -> None"}, {"BringToFront", (PyCFunction)WinObj_BringToFront, 1, "() -> None"}, {"SendBehind", (PyCFunction)WinObj_SendBehind, 1, "(WindowPtr behindWindow) -> None"}, {"SelectWindow", (PyCFunction)WinObj_SelectWindow, 1, "() -> None"}, + +#if TARGET_API_MAC_CARBON + {"GetNextWindowOfClass", (PyCFunction)WinObj_GetNextWindowOfClass, 1, + "(WindowClass inWindowClass, Boolean mustBeVisible) -> (WindowPtr _rv)"}, +#endif + +#if !TARGET_API_MAC_CARBON + {"IsValidWindowPtr", (PyCFunction)WinObj_IsValidWindowPtr, 1, + "() -> (Boolean _rv)"}, +#endif {"HiliteWindow", (PyCFunction)WinObj_HiliteWindow, 1, "(Boolean fHilite) -> None"}, {"SetWRefCon", (PyCFunction)WinObj_SetWRefCon, 1, @@ -1725,6 +1928,12 @@ static PyMethodDef WinObj_methods[] = { "(IconRef icon) -> None"}, {"RemoveWindowProxy", (PyCFunction)WinObj_RemoveWindowProxy, 1, "() -> None"}, + {"BeginWindowProxyDrag", (PyCFunction)WinObj_BeginWindowProxyDrag, 1, + "(RgnHandle outDragOutlineRgn) -> (DragReference outNewDrag)"}, + {"EndWindowProxyDrag", (PyCFunction)WinObj_EndWindowProxyDrag, 1, + "(DragReference theDrag) -> None"}, + {"TrackWindowProxyFromExistingDrag", (PyCFunction)WinObj_TrackWindowProxyFromExistingDrag, 1, + "(Point startPt, DragReference drag, RgnHandle inDragOutlineRgn) -> None"}, {"TrackWindowProxyDrag", (PyCFunction)WinObj_TrackWindowProxyDrag, 1, "(Point startPt) -> None"}, {"IsWindowModified", (PyCFunction)WinObj_IsWindowModified, 1, @@ -1732,7 +1941,7 @@ static PyMethodDef WinObj_methods[] = { {"SetWindowModified", (PyCFunction)WinObj_SetWindowModified, 1, "(Boolean modified) -> None"}, {"IsWindowPathSelectClick", (PyCFunction)WinObj_IsWindowPathSelectClick, 1, - "() -> (Boolean _rv, EventRecord event)"}, + "(EventRecord event) -> (Boolean _rv)"}, {"HiliteWindowFrameForDrag", (PyCFunction)WinObj_HiliteWindowFrameForDrag, 1, "(Boolean hilited) -> None"}, {"TransitionWindow", (PyCFunction)WinObj_TransitionWindow, 1, @@ -1746,25 +1955,25 @@ static PyMethodDef WinObj_methods[] = { {"DragWindow", (PyCFunction)WinObj_DragWindow, 1, "(Point startPt, Rect boundsRect) -> None"}, {"ZoomWindow", (PyCFunction)WinObj_ZoomWindow, 1, - "(short partCode, Boolean front) -> None"}, + "(WindowPartCode partCode, Boolean front) -> None"}, {"IsWindowCollapsable", (PyCFunction)WinObj_IsWindowCollapsable, 1, "() -> (Boolean _rv)"}, {"IsWindowCollapsed", (PyCFunction)WinObj_IsWindowCollapsed, 1, "() -> (Boolean _rv)"}, {"CollapseWindow", (PyCFunction)WinObj_CollapseWindow, 1, "(Boolean collapse) -> None"}, - {"RepositionWindow", (PyCFunction)WinObj_RepositionWindow, 1, - "(WindowPtr parentWindow, WindowPositionMethod method) -> None"}, - {"SetWindowBounds", (PyCFunction)WinObj_SetWindowBounds, 1, - "(WindowRegionCode regionCode, Rect globalBounds) -> None"}, {"GetWindowBounds", (PyCFunction)WinObj_GetWindowBounds, 1, "(WindowRegionCode regionCode) -> (Rect globalBounds)"}, + {"SetWindowBounds", (PyCFunction)WinObj_SetWindowBounds, 1, + "(WindowRegionCode regionCode, Rect globalBounds) -> None"}, + {"RepositionWindow", (PyCFunction)WinObj_RepositionWindow, 1, + "(WindowPtr parentWindow, WindowPositionMethod method) -> None"}, {"MoveWindowStructure", (PyCFunction)WinObj_MoveWindowStructure, 1, "(short hGlobal, short vGlobal) -> None"}, {"IsWindowInStandardState", (PyCFunction)WinObj_IsWindowInStandardState, 1, "() -> (Boolean _rv, Point idealSize, Rect idealStandardState)"}, {"ZoomWindowIdeal", (PyCFunction)WinObj_ZoomWindowIdeal, 1, - "(SInt16 partCode) -> (Point ioIdealSize)"}, + "(WindowPartCode partCode) -> (Point ioIdealSize)"}, {"GetWindowIdealUserState", (PyCFunction)WinObj_GetWindowIdealUserState, 1, "() -> (Rect userState)"}, {"SetWindowIdealUserState", (PyCFunction)WinObj_SetWindowIdealUserState, 1, @@ -1775,8 +1984,18 @@ static PyMethodDef WinObj_methods[] = { "() -> None"}, {"ShowHide", (PyCFunction)WinObj_ShowHide, 1, "(Boolean showFlag) -> None"}, + +#if TARGET_API_MAC_CARBON + {"GetWindowPropertyAttributes", (PyCFunction)WinObj_GetWindowPropertyAttributes, 1, + "(OSType propertyCreator, OSType propertyTag) -> (UInt32 attributes)"}, +#endif + +#if TARGET_API_MAC_CARBON + {"ChangeWindowPropertyAttributes", (PyCFunction)WinObj_ChangeWindowPropertyAttributes, 1, + "(OSType propertyCreator, OSType propertyTag, UInt32 attributesToSet, UInt32 attributesToClear) -> None"}, +#endif {"TrackBox", (PyCFunction)WinObj_TrackBox, 1, - "(Point thePt, short partCode) -> (Boolean _rv)"}, + "(Point thePt, WindowPartCode partCode) -> (Boolean _rv)"}, {"TrackGoAway", (PyCFunction)WinObj_TrackGoAway, 1, "(Point thePt) -> (Boolean _rv)"}, @@ -1784,55 +2003,39 @@ static PyMethodDef WinObj_methods[] = { {"GetAuxWin", (PyCFunction)WinObj_GetAuxWin, 1, "() -> (Boolean _rv, AuxWinHandle awHndl)"}, #endif + {"GetWindowGoAwayFlag", (PyCFunction)WinObj_GetWindowGoAwayFlag, 1, + "() -> (Boolean _rv)"}, + {"GetWindowSpareFlag", (PyCFunction)WinObj_GetWindowSpareFlag, 1, + "() -> (Boolean _rv)"}, {"GetWindowPort", (PyCFunction)WinObj_GetWindowPort, 1, "() -> (CGrafPtr _rv)"}, - {"SetPortWindowPort", (PyCFunction)WinObj_SetPortWindowPort, 1, - "() -> None"}, {"GetWindowKind", (PyCFunction)WinObj_GetWindowKind, 1, "() -> (short _rv)"}, - {"SetWindowKind", (PyCFunction)WinObj_SetWindowKind, 1, - "(short wKind) -> None"}, - {"IsWindowVisible", (PyCFunction)WinObj_IsWindowVisible, 1, + {"MacIsWindowVisible", (PyCFunction)WinObj_MacIsWindowVisible, 1, "() -> (Boolean _rv)"}, {"IsWindowHilited", (PyCFunction)WinObj_IsWindowHilited, 1, "() -> (Boolean _rv)"}, - {"GetWindowGoAwayFlag", (PyCFunction)WinObj_GetWindowGoAwayFlag, 1, - "() -> (Boolean _rv)"}, -#if !TARGET_API_MAC_CARBON - {"GetWindowZoomFlag", (PyCFunction)WinObj_GetWindowZoomFlag, 1, +#if TARGET_API_MAC_CARBON + {"IsWindowUpdatePending", (PyCFunction)WinObj_IsWindowUpdatePending, 1, "() -> (Boolean _rv)"}, #endif - -#if !TARGET_API_MAC_CARBON - {"GetWindowStructureRgn", (PyCFunction)WinObj_GetWindowStructureRgn, 1, - "(RgnHandle r) -> None"}, -#endif - -#if !TARGET_API_MAC_CARBON - {"GetWindowContentRgn", (PyCFunction)WinObj_GetWindowContentRgn, 1, - "(RgnHandle r) -> None"}, -#endif - -#if !TARGET_API_MAC_CARBON - {"GetWindowUpdateRgn", (PyCFunction)WinObj_GetWindowUpdateRgn, 1, - "(RgnHandle r) -> None"}, -#endif - -#if !TARGET_API_MAC_CARBON - {"GetWindowTitleWidth", (PyCFunction)WinObj_GetWindowTitleWidth, 1, - "() -> (short _rv)"}, -#endif - {"GetNextWindow", (PyCFunction)WinObj_GetNextWindow, 1, + {"MacGetNextWindow", (PyCFunction)WinObj_MacGetNextWindow, 1, "() -> (WindowPtr _rv)"}, {"GetWindowStandardState", (PyCFunction)WinObj_GetWindowStandardState, 1, - "() -> (Rect r)"}, + "() -> (Rect rect)"}, {"GetWindowUserState", (PyCFunction)WinObj_GetWindowUserState, 1, - "() -> (Rect r)"}, + "() -> (Rect rect)"}, + {"SetWindowKind", (PyCFunction)WinObj_SetWindowKind, 1, + "(short kind) -> None"}, {"SetWindowStandardState", (PyCFunction)WinObj_SetWindowStandardState, 1, - "(Rect r) -> None"}, + "(Rect rect) -> None"}, {"SetWindowUserState", (PyCFunction)WinObj_SetWindowUserState, 1, - "(Rect r) -> None"}, + "(Rect rect) -> None"}, + {"SetPortWindowPort", (PyCFunction)WinObj_SetPortWindowPort, 1, + "() -> None"}, + {"GetWindowPortBounds", (PyCFunction)WinObj_GetWindowPortBounds, 1, + "() -> (Rect bounds)"}, #if !TARGET_API_MAC_CARBON {"CloseWindow", (PyCFunction)WinObj_CloseWindow, 1, @@ -2002,16 +2205,16 @@ static PyObject *Win_CreateNewWindow(_self, _args) OSStatus _err; WindowClass windowClass; WindowAttributes attributes; - Rect bounds; + Rect contentBounds; WindowPtr outWindow; if (!PyArg_ParseTuple(_args, "llO&", &windowClass, &attributes, - PyMac_GetRect, &bounds)) + PyMac_GetRect, &contentBounds)) return NULL; _err = CreateNewWindow(windowClass, attributes, - &bounds, + &contentBounds, &outWindow); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&", @@ -2082,20 +2285,6 @@ static PyObject *Win_AreFloatingWindowsVisible(_self, _args) return _res; } -static PyObject *Win_FrontNonFloatingWindow(_self, _args) - PyObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - WindowPtr _rv; - if (!PyArg_ParseTuple(_args, "")) - return NULL; - _rv = FrontNonFloatingWindow(); - _res = Py_BuildValue("O&", - WinObj_WhichWindow, _rv); - return _res; -} - #if !TARGET_API_MAC_CARBON static PyObject *Win_SetDeskCPat(_self, _args) @@ -2135,7 +2324,7 @@ static PyObject *Win_MacFindWindow(_self, _args) PyObject *_args; { PyObject *_res = NULL; - short _rv; + WindowPartCode _rv; Point thePoint; WindowPtr window; if (!PyArg_ParseTuple(_args, "O&", @@ -2163,6 +2352,70 @@ static PyObject *Win_FrontWindow(_self, _args) return _res; } +static PyObject *Win_FrontNonFloatingWindow(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + WindowPtr _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = FrontNonFloatingWindow(); + _res = Py_BuildValue("O&", + WinObj_WhichWindow, _rv); + return _res; +} + +#if TARGET_API_MAC_CARBON + +static PyObject *Win_GetFrontWindowOfClass(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + WindowPtr _rv; + WindowClass inWindowClass; + Boolean mustBeVisible; + if (!PyArg_ParseTuple(_args, "lb", + &inWindowClass, + &mustBeVisible)) + return NULL; + _rv = GetFrontWindowOfClass(inWindowClass, + mustBeVisible); + _res = Py_BuildValue("O&", + WinObj_New, _rv); + return _res; +} +#endif + +#if TARGET_API_MAC_CARBON + +static PyObject *Win_FindWindowOfClass(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + Point where; + WindowClass inWindowClass; + WindowPtr outWindow; + WindowPartCode outWindowPart; + if (!PyArg_ParseTuple(_args, "O&l", + PyMac_GetPoint, &where, + &inWindowClass)) + return NULL; + _err = FindWindowOfClass(&where, + inWindowClass, + &outWindow, + &outWindowPart); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&h", + WinObj_WhichWindow, outWindow, + outWindowPart); + return _res; +} +#endif + #if !TARGET_API_MAC_CARBON static PyObject *Win_InitWindows(_self, _args) @@ -2215,25 +2468,6 @@ static PyObject *Win_GetCWMgrPort(_self, _args) #if !TARGET_API_MAC_CARBON -static PyObject *Win_IsValidWindowPtr(_self, _args) - PyObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - Boolean _rv; - GrafPtr grafPort; - if (!PyArg_ParseTuple(_args, "O&", - GrafObj_Convert, &grafPort)) - return NULL; - _rv = IsValidWindowPtr(grafPort); - _res = Py_BuildValue("b", - _rv); - return _res; -} -#endif - -#if !TARGET_API_MAC_CARBON - static PyObject *Win_InitFloatingWindows(_self, _args) PyObject *_self; PyObject *_args; @@ -2372,6 +2606,22 @@ static PyObject *Win_GetGrayRgn(_self, _args) return _res; } +static PyObject *Win_GetWindowFromPort(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + WindowPtr _rv; + CGrafPtr port; + if (!PyArg_ParseTuple(_args, "O&", + GrafObj_Convert, &port)) + return NULL; + _rv = GetWindowFromPort(port); + _res = Py_BuildValue("O&", + WinObj_New, _rv); + return _res; +} + static PyObject *Win_WhichWindow(_self, _args) PyObject *_self; PyObject *_args; @@ -2415,7 +2665,7 @@ static PyMethodDef Win_methods[] = { {"NewCWindow", (PyCFunction)Win_NewCWindow, 1, "(Rect boundsRect, Str255 title, Boolean visible, short procID, WindowPtr behind, Boolean goAwayFlag, long refCon) -> (WindowPtr _rv)"}, {"CreateNewWindow", (PyCFunction)Win_CreateNewWindow, 1, - "(WindowClass windowClass, WindowAttributes attributes, Rect bounds) -> (WindowPtr outWindow)"}, + "(WindowClass windowClass, WindowAttributes attributes, Rect contentBounds) -> (WindowPtr outWindow)"}, {"CreateWindowFromResource", (PyCFunction)Win_CreateWindowFromResource, 1, "(SInt16 resID) -> (WindowPtr outWindow)"}, {"ShowFloatingWindows", (PyCFunction)Win_ShowFloatingWindows, 1, @@ -2424,8 +2674,6 @@ static PyMethodDef Win_methods[] = { "() -> None"}, {"AreFloatingWindowsVisible", (PyCFunction)Win_AreFloatingWindowsVisible, 1, "() -> (Boolean _rv)"}, - {"FrontNonFloatingWindow", (PyCFunction)Win_FrontNonFloatingWindow, 1, - "() -> (WindowPtr _rv)"}, #if !TARGET_API_MAC_CARBON {"SetDeskCPat", (PyCFunction)Win_SetDeskCPat, 1, @@ -2434,9 +2682,21 @@ static PyMethodDef Win_methods[] = { {"CheckUpdate", (PyCFunction)Win_CheckUpdate, 1, "() -> (Boolean _rv, EventRecord theEvent)"}, {"MacFindWindow", (PyCFunction)Win_MacFindWindow, 1, - "(Point thePoint) -> (short _rv, WindowPtr window)"}, + "(Point thePoint) -> (WindowPartCode _rv, WindowPtr window)"}, {"FrontWindow", (PyCFunction)Win_FrontWindow, 1, "() -> (WindowPtr _rv)"}, + {"FrontNonFloatingWindow", (PyCFunction)Win_FrontNonFloatingWindow, 1, + "() -> (WindowPtr _rv)"}, + +#if TARGET_API_MAC_CARBON + {"GetFrontWindowOfClass", (PyCFunction)Win_GetFrontWindowOfClass, 1, + "(WindowClass inWindowClass, Boolean mustBeVisible) -> (WindowPtr _rv)"}, +#endif + +#if TARGET_API_MAC_CARBON + {"FindWindowOfClass", (PyCFunction)Win_FindWindowOfClass, 1, + "(Point where, WindowClass inWindowClass) -> (WindowPtr outWindow, WindowPartCode outWindowPart)"}, +#endif #if !TARGET_API_MAC_CARBON {"InitWindows", (PyCFunction)Win_InitWindows, 1, @@ -2454,11 +2714,6 @@ static PyMethodDef Win_methods[] = { #endif #if !TARGET_API_MAC_CARBON - {"IsValidWindowPtr", (PyCFunction)Win_IsValidWindowPtr, 1, - "(GrafPtr grafPort) -> (Boolean _rv)"}, -#endif - -#if !TARGET_API_MAC_CARBON {"InitFloatingWindows", (PyCFunction)Win_InitFloatingWindows, 1, "() -> None"}, #endif @@ -2488,6 +2743,8 @@ static PyMethodDef Win_methods[] = { "(Rect theRect, Point thePt) -> (long _rv)"}, {"GetGrayRgn", (PyCFunction)Win_GetGrayRgn, 1, "() -> (RgnHandle _rv)"}, + {"GetWindowFromPort", (PyCFunction)Win_GetWindowFromPort, 1, + "(CGrafPtr port) -> (WindowPtr _rv)"}, {"WhichWindow", (PyCFunction)Win_WhichWindow, 1, "Resolve an integer WindowPtr address to a Window object"}, {"FindWindow", (PyCFunction)Win_FindWindow, 1, @@ -2534,7 +2791,7 @@ void initWin() Win_Error = PyMac_GetOSErrException(); if (Win_Error == NULL || PyDict_SetItemString(d, "Error", Win_Error) != 0) - Py_FatalError("can't initialize Win.Error"); + return; Window_Type.ob_type = &PyType_Type; Py_INCREF(&Window_Type); if (PyDict_SetItemString(d, "WindowType", (PyObject *)&Window_Type) != 0) diff --git a/Mac/Modules/win/winedit.py b/Mac/Modules/win/winedit.py index 89955ea..42fbcf8 100644 --- a/Mac/Modules/win/winedit.py +++ b/Mac/Modules/win/winedit.py @@ -1,105 +1,105 @@ # These are inline-routines/defines, so we do them "by hand" # - -f = Method(CGrafPtr, 'GetWindowPort', - (WindowRef, 'theWindow', InMode), -) -methods.append(f) - -f = Method(void, 'SetPortWindowPort', - (WindowRef, 'theWindow', InMode), -) -methods.append(f) - -f = Method(short, 'GetWindowKind', - (WindowRef, 'theWindow', InMode), -) -methods.append(f) - -f = Method(void, 'SetWindowKind', - (WindowRef, 'theWindow', InMode), - (short, 'wKind', InMode), -) -methods.append(f) - - -f = Method(Boolean, 'IsWindowVisible', - (WindowRef, 'theWindow', InMode), -) -methods.append(f) - -f = Method(Boolean, 'IsWindowHilited', - (WindowRef, 'theWindow', InMode), -) -methods.append(f) - -f = Method(Boolean, 'GetWindowGoAwayFlag', - (WindowRef, 'theWindow', InMode), -) -methods.append(f) - -f = Method(Boolean, 'GetWindowZoomFlag', - (WindowRef, 'theWindow', InMode), - condition='#if !TARGET_API_MAC_CARBON' -) -methods.append(f) - -f = Method(void, 'GetWindowStructureRgn', - (WindowRef, 'theWindow', InMode), - (RgnHandle, 'r', InMode), - condition='#if !TARGET_API_MAC_CARBON' -) -methods.append(f) - -f = Method(void, 'GetWindowContentRgn', - (WindowRef, 'theWindow', InMode), - (RgnHandle, 'r', InMode), - condition='#if !TARGET_API_MAC_CARBON' -) -methods.append(f) - -f = Method(void, 'GetWindowUpdateRgn', - (WindowRef, 'theWindow', InMode), - (RgnHandle, 'r', InMode), - condition='#if !TARGET_API_MAC_CARBON' -) -methods.append(f) - -f = Method(short, 'GetWindowTitleWidth', - (WindowRef, 'theWindow', InMode), - condition='#if !TARGET_API_MAC_CARBON' -) -methods.append(f) - -f = Method(ExistingWindowPtr, 'GetNextWindow', - (WindowRef, 'theWindow', InMode), -) -methods.append(f) - -f = Method(void, 'GetWindowStandardState', - (WindowRef, 'theWindow', InMode), - (Rect, 'r', OutMode), -) -methods.append(f) - -f = Method(void, 'GetWindowUserState', - (WindowRef, 'theWindow', InMode), - (Rect, 'r', OutMode), -) -methods.append(f) - - -f = Method(void, 'SetWindowStandardState', - (WindowRef, 'theWindow', InMode), - (Rect, 'r', InMode), -) -methods.append(f) - -f = Method(void, 'SetWindowUserState', - (WindowRef, 'theWindow', InMode), - (Rect, 'r', InMode), -) -methods.append(f) +if 0: + f = Method(CGrafPtr, 'GetWindowPort', + (WindowRef, 'theWindow', InMode), + ) + methods.append(f) + + f = Method(void, 'SetPortWindowPort', + (WindowRef, 'theWindow', InMode), + ) + methods.append(f) + + f = Method(short, 'GetWindowKind', + (WindowRef, 'theWindow', InMode), + ) + methods.append(f) + + f = Method(void, 'SetWindowKind', + (WindowRef, 'theWindow', InMode), + (short, 'wKind', InMode), + ) + methods.append(f) + + + f = Method(Boolean, 'IsWindowVisible', + (WindowRef, 'theWindow', InMode), + ) + methods.append(f) + + f = Method(Boolean, 'IsWindowHilited', + (WindowRef, 'theWindow', InMode), + ) + methods.append(f) + + f = Method(Boolean, 'GetWindowGoAwayFlag', + (WindowRef, 'theWindow', InMode), + ) + methods.append(f) + + f = Method(Boolean, 'GetWindowZoomFlag', + (WindowRef, 'theWindow', InMode), + condition='#if !TARGET_API_MAC_CARBON' + ) + methods.append(f) + + f = Method(void, 'GetWindowStructureRgn', + (WindowRef, 'theWindow', InMode), + (RgnHandle, 'r', InMode), + condition='#if !TARGET_API_MAC_CARBON' + ) + methods.append(f) + + f = Method(void, 'GetWindowContentRgn', + (WindowRef, 'theWindow', InMode), + (RgnHandle, 'r', InMode), + condition='#if !TARGET_API_MAC_CARBON' + ) + methods.append(f) + + f = Method(void, 'GetWindowUpdateRgn', + (WindowRef, 'theWindow', InMode), + (RgnHandle, 'r', InMode), + condition='#if !TARGET_API_MAC_CARBON' + ) + methods.append(f) + + f = Method(short, 'GetWindowTitleWidth', + (WindowRef, 'theWindow', InMode), + condition='#if !TARGET_API_MAC_CARBON' + ) + methods.append(f) + + f = Method(ExistingWindowPtr, 'GetNextWindow', + (WindowRef, 'theWindow', InMode), + ) + methods.append(f) + + f = Method(void, 'GetWindowStandardState', + (WindowRef, 'theWindow', InMode), + (Rect, 'r', OutMode), + ) + methods.append(f) + + f = Method(void, 'GetWindowUserState', + (WindowRef, 'theWindow', InMode), + (Rect, 'r', OutMode), + ) + methods.append(f) + + + f = Method(void, 'SetWindowStandardState', + (WindowRef, 'theWindow', InMode), + (Rect, 'r', InMode), + ) + methods.append(f) + + f = Method(void, 'SetWindowUserState', + (WindowRef, 'theWindow', InMode), + (Rect, 'r', InMode), + ) + methods.append(f) # These have Mac prefixed to their name in the 3.1 universal headers, # so we add the old/real names by hand. diff --git a/Mac/Modules/win/winscan.py b/Mac/Modules/win/winscan.py index 3c37d33..316a812 100644 --- a/Mac/Modules/win/winscan.py +++ b/Mac/Modules/win/winscan.py @@ -42,8 +42,10 @@ class MyScanner(Scanner): 'GetWindowPropertySize', 'RemoveWindowProperty', 'MacCloseWindow', + 'GetWindowList', # Don't know whether this is safe... # Constants with funny definitions 'kMouseUpOutOfSlop', + 'kAllWindowClasses', ] def makegreylist(self): @@ -64,14 +66,28 @@ class MyScanner(Scanner): 'InvalRgn', 'InvalRect', 'IsValidWindowPtr', # I think this is useless for Python, but not sure... + ]), + ('#if TARGET_API_MAC_CARBON', [ + 'IsWindowUpdatePending', + 'FindWindowOfClass', + 'GetFrontWindowOfClass', + 'ChangeWindowPropertyAttributes', + 'GetWindowPropertyAttributes', + 'GetNextWindowOfClass', + 'ScrollWindowRegion', + 'ScrollWindowRect', + 'ChangeWindowAttributes', + 'ReshapeCustomWindow', ])] def makeblacklisttypes(self): return [ 'ProcPtr', 'DragGrayRgnUPP', + 'WindowPaintUPP', 'Collection', # For now, to be done later - 'DragReference', # Ditto, dragmodule doesn't export it yet. + 'WindowDefSpec', # Too difficult for now + 'WindowDefSpec_ptr', ] def makerepairinstructions(self): @@ -104,6 +120,9 @@ class MyScanner(Scanner): [("ExistingWindowPtr", "*", "*")]), ([("WindowRef", "FrontNonFloatingWindow", "ReturnMode")], # Ditto [("ExistingWindowPtr", "*", "*")]), + + ([("Rect_ptr", "*", "ReturnMode")], # GetWindowXXXState accessors + [("void", "*", "ReturnMode")]), ] if __name__ == "__main__": diff --git a/Mac/Modules/win/winsupport.py b/Mac/Modules/win/winsupport.py index 65d70d0..2b96555 100644 --- a/Mac/Modules/win/winsupport.py +++ b/Mac/Modules/win/winsupport.py @@ -29,6 +29,8 @@ WindowPeek.passInput = lambda name: "(WindowPeek)(%s)" % name CGrafPtr = OpaqueByValueType("CGrafPtr", "GrafObj") GrafPtr = OpaqueByValueType("GrafPtr", "GrafObj") +DragReference = OpaqueByValueType("DragReference", "DragObj") + RgnHandle = OpaqueByValueType("RgnHandle", "ResObj") PicHandle = OpaqueByValueType("PicHandle", "ResObj") WCTabHandle = OpaqueByValueType("WCTabHandle", "ResObj") @@ -44,11 +46,22 @@ WindowPositionMethod = Type("WindowPositionMethod", "l") WindowTransitionEffect = Type("WindowTransitionEffect", "l") WindowTransitionAction = Type("WindowTransitionAction", "l") RGBColor = OpaqueType("RGBColor", "QdRGB") +RGBColor_ptr = RGBColor +ScrollWindowOptions = Type("ScrollWindowOptions", "l") +WindowPartCode = Type("WindowPartCode", "h") + PropertyCreator = OSTypeType("PropertyCreator") PropertyTag = OSTypeType("PropertyTag") includestuff = includestuff + """ #include <%s>""" % MACHEADERFILE + """ + +#if !ACCESSOR_CALLS_ARE_FUNCTIONS +#define GetWindowSpareFlag(win) (((CWindowPeek)(win))->spareFlag) +#define GetWindowFromPort(port) ((WindowRef)(port)) +#define GetWindowPortBounds(win, rectp) (*(rectp) = ((CWindowPeek)(win))->port.portRect) +#endif + /* Function to dispose a window, with a "normal" calling sequence */ static void PyMac_AutoDisposeWindow(WindowPtr w) |