summaryrefslogtreecommitdiffstats
path: root/Mac/Modules/qt/qtsupport.py
diff options
context:
space:
mode:
Diffstat (limited to 'Mac/Modules/qt/qtsupport.py')
-rw-r--r--Mac/Modules/qt/qtsupport.py177
1 files changed, 88 insertions, 89 deletions
diff --git a/Mac/Modules/qt/qtsupport.py b/Mac/Modules/qt/qtsupport.py
index 20304c9..132c2b4 100644
--- a/Mac/Modules/qt/qtsupport.py
+++ b/Mac/Modules/qt/qtsupport.py
@@ -8,16 +8,16 @@
import string
# Declarations that change for each manager
-MACHEADERFILE = 'Movies.h' # The Apple header file
-MODNAME = '_Qt' # The name of the module
-OBJECTNAME = 'Movie' # The basic name of the objects used here
+MACHEADERFILE = 'Movies.h' # The Apple header file
+MODNAME = '_Qt' # The name of the module
+OBJECTNAME = 'Movie' # The basic name of the objects used here
# The following is *usually* unchanged but may still require tuning
-MODPREFIX = 'Qt' # The prefix for module-wide routines
-OBJECTTYPE = "Movie" # The C type used to represent them
-OBJECTPREFIX = MODPREFIX + 'Obj' # The prefix for object methods
+MODPREFIX = 'Qt' # The prefix for module-wide routines
+OBJECTTYPE = "Movie" # The C type used to represent them
+OBJECTPREFIX = MODPREFIX + 'Obj' # The prefix for object methods
INPUTFILE = string.lower(MODPREFIX) + 'gen.py' # The file generated by the scanner
-OUTPUTFILE = MODNAME + "module.c" # The file generated by this program
+OUTPUTFILE = MODNAME + "module.c" # The file generated by this program
from macsupport import *
@@ -57,45 +57,45 @@ extern int _MediaObj_Convert(PyObject *, Media *);
/* Macro to allow us to GetNextInterestingTime without duration */
#define GetMediaNextInterestingTimeOnly(media, flags, time, rate, rv) \
- GetMediaNextInterestingTime(media, flags, time, rate, rv, NULL)
-
+ GetMediaNextInterestingTime(media, flags, time, rate, rv, NULL)
+
/*
** Parse/generate time records
*/
static PyObject *
QtTimeRecord_New(TimeRecord *itself)
{
- if (itself->base)
- return Py_BuildValue("O&lO&", PyMac_Buildwide, &itself->value, itself->scale,
- TimeBaseObj_New, itself->base);
- else
- return Py_BuildValue("O&lO", PyMac_Buildwide, &itself->value, itself->scale,
- Py_None);
+ if (itself->base)
+ return Py_BuildValue("O&lO&", PyMac_Buildwide, &itself->value, itself->scale,
+ TimeBaseObj_New, itself->base);
+ else
+ return Py_BuildValue("O&lO", PyMac_Buildwide, &itself->value, itself->scale,
+ Py_None);
}
static int
QtTimeRecord_Convert(PyObject *v, TimeRecord *p_itself)
{
- PyObject *base = NULL;
- if( !PyArg_ParseTuple(v, "O&l|O", PyMac_Getwide, &p_itself->value, &p_itself->scale,
- &base) )
- return 0;
- if ( base == NULL || base == Py_None )
- p_itself->base = NULL;
- else
- if ( !TimeBaseObj_Convert(base, &p_itself->base) )
- return 0;
- return 1;
+ PyObject *base = NULL;
+ if( !PyArg_ParseTuple(v, "O&l|O", PyMac_Getwide, &p_itself->value, &p_itself->scale,
+ &base) )
+ return 0;
+ if ( base == NULL || base == Py_None )
+ p_itself->base = NULL;
+ else
+ if ( !TimeBaseObj_Convert(base, &p_itself->base) )
+ return 0;
+ return 1;
}
static int
QtMusicMIDIPacket_Convert(PyObject *v, MusicMIDIPacket *p_itself)
{
- int dummy;
-
- if( !PyArg_ParseTuple(v, "hls#", &p_itself->length, &p_itself->reserved, p_itself->data, dummy) )
- return 0;
- return 1;
+ int dummy;
+
+ if( !PyArg_ParseTuple(v, "hls#", &p_itself->length, &p_itself->reserved, p_itself->data, dummy) )
+ return 0;
+ return 1;
}
@@ -103,18 +103,18 @@ QtMusicMIDIPacket_Convert(PyObject *v, MusicMIDIPacket *p_itself)
"""
initstuff = initstuff + """
- PyMac_INIT_TOOLBOX_OBJECT_NEW(Track, TrackObj_New);
- PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Track, TrackObj_Convert);
- PyMac_INIT_TOOLBOX_OBJECT_NEW(Movie, MovieObj_New);
- PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Movie, MovieObj_Convert);
- PyMac_INIT_TOOLBOX_OBJECT_NEW(MovieController, MovieCtlObj_New);
- PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MovieController, MovieCtlObj_Convert);
- PyMac_INIT_TOOLBOX_OBJECT_NEW(TimeBase, TimeBaseObj_New);
- PyMac_INIT_TOOLBOX_OBJECT_CONVERT(TimeBase, TimeBaseObj_Convert);
- PyMac_INIT_TOOLBOX_OBJECT_NEW(UserData, UserDataObj_New);
- PyMac_INIT_TOOLBOX_OBJECT_CONVERT(UserData, UserDataObj_Convert);
- PyMac_INIT_TOOLBOX_OBJECT_NEW(Media, MediaObj_New);
- PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Media, MediaObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(Track, TrackObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Track, TrackObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(Movie, MovieObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Movie, MovieObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(MovieController, MovieCtlObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MovieController, MovieCtlObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(TimeBase, TimeBaseObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(TimeBase, TimeBaseObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(UserData, UserDataObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(UserData, UserDataObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(Media, MediaObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Media, MediaObj_Convert);
"""
# Our (opaque) objects
@@ -232,56 +232,56 @@ AtomicInstrumentPtr = InputOnlyType("AtomicInstrumentPtr", "s")
# XXXX Need to override output_tp_newBody() to allow for None initializer.
class QtGlobalObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
- def outputCheckNewArg(self):
- # We don't allow NULL pointers to be returned by QuickTime API calls,
- # in stead we raise an exception
- Output("""if (itself == NULL) {
- PyErr_SetString(Qt_Error,"Cannot create %s from NULL pointer");
- return NULL;
- }""", self.name)
-
- def outputCheckConvertArg(self):
- # But what we do allow is passing None whereever a quicktime object is
- # expected, and pass this as NULL to the API routines. Note you can
- # call methods too by creating an object with None as the initializer.
- Output("if (v == Py_None)")
- OutLbrace()
- Output("*p_itself = NULL;")
- Output("return 1;")
- OutRbrace()
-
+ def outputCheckNewArg(self):
+ # We don't allow NULL pointers to be returned by QuickTime API calls,
+ # in stead we raise an exception
+ Output("""if (itself == NULL) {
+ PyErr_SetString(Qt_Error,"Cannot create %s from NULL pointer");
+ return NULL;
+ }""", self.name)
+
+ def outputCheckConvertArg(self):
+ # But what we do allow is passing None whereever a quicktime object is
+ # expected, and pass this as NULL to the API routines. Note you can
+ # call methods too by creating an object with None as the initializer.
+ Output("if (v == Py_None)")
+ OutLbrace()
+ Output("*p_itself = NULL;")
+ Output("return 1;")
+ OutRbrace()
+
class MovieObjectDefinition(QtGlobalObjectDefinition):
- def outputFreeIt(self, itselfname):
- Output("if (%s) DisposeMovie(%s);", itselfname, itselfname)
+ def outputFreeIt(self, itselfname):
+ Output("if (%s) DisposeMovie(%s);", itselfname, itselfname)
class TrackObjectDefinition(QtGlobalObjectDefinition):
- def outputFreeIt(self, itselfname):
- Output("if (%s) DisposeMovieTrack(%s);", itselfname, itselfname)
+ def outputFreeIt(self, itselfname):
+ Output("if (%s) DisposeMovieTrack(%s);", itselfname, itselfname)
class MediaObjectDefinition(QtGlobalObjectDefinition):
- def outputFreeIt(self, itselfname):
- Output("if (%s) DisposeTrackMedia(%s);", itselfname, itselfname)
+ def outputFreeIt(self, itselfname):
+ Output("if (%s) DisposeTrackMedia(%s);", itselfname, itselfname)
class UserDataObjectDefinition(QtGlobalObjectDefinition):
- def outputFreeIt(self, itselfname):
- Output("if (%s) DisposeUserData(%s);", itselfname, itselfname)
+ def outputFreeIt(self, itselfname):
+ Output("if (%s) DisposeUserData(%s);", itselfname, itselfname)
class TimeBaseObjectDefinition(QtGlobalObjectDefinition):
- pass
-
+ pass
+
class MovieCtlObjectDefinition(QtGlobalObjectDefinition):
- def outputFreeIt(self, itselfname):
- Output("if (%s) DisposeMovieController(%s);", itselfname, itselfname)
+ def outputFreeIt(self, itselfname):
+ Output("if (%s) DisposeMovieController(%s);", itselfname, itselfname)
class IdleManagerObjectDefinition(QtGlobalObjectDefinition):
- pass
-
+ pass
+
class SGOutputObjectDefinition(QtGlobalObjectDefinition):
- # XXXX I'm not sure I fully understand how SGOutput works. It seems it's always tied
- # to a specific SeqGrabComponent, but I'm not 100% sure. Also, I'm not sure all the
- # routines that return an SGOutput actually return a *new* SGOutput. Need to read up on
- # this.
- pass
+ # XXXX I'm not sure I fully understand how SGOutput works. It seems it's always tied
+ # to a specific SeqGrabComponent, but I'm not 100% sure. Also, I'm not sure all the
+ # routines that return an SGOutput actually return a *new* SGOutput. Need to read up on
+ # this.
+ pass
# From here on it's basically all boiler plate...
@@ -331,19 +331,19 @@ ICMAlignmentProcRecordPtr = FakeType('(ICMAlignmentProcRecordPtr)0')
dummyRect = FakeType('(Rect *)0')
f = Function(void, 'AlignWindow',
- (WindowPtr, 'wp', InMode),
- (Boolean, 'front', InMode),
- (dummyRect, 'alignmentRect', InMode),
- (ICMAlignmentProcRecordPtr, 'alignmentProc', InMode),
+ (WindowPtr, 'wp', InMode),
+ (Boolean, 'front', InMode),
+ (dummyRect, 'alignmentRect', InMode),
+ (ICMAlignmentProcRecordPtr, 'alignmentProc', InMode),
)
functions.append(f)
f = Function(void, 'DragAlignedWindow',
- (WindowPtr, 'wp', InMode),
- (Point, 'startPt', InMode),
- (Rect_ptr, 'boundsRect', InMode),
- (dummyRect, 'alignmentRect', InMode),
- (ICMAlignmentProcRecordPtr, 'alignmentProc', InMode),
+ (WindowPtr, 'wp', InMode),
+ (Point, 'startPt', InMode),
+ (Rect_ptr, 'boundsRect', InMode),
+ (dummyRect, 'alignmentRect', InMode),
+ (ICMAlignmentProcRecordPtr, 'alignmentProc', InMode),
)
functions.append(f)
@@ -377,4 +377,3 @@ for f in Movie_methods: Movie_object.add(f)
# generate output (open the output file as late as possible)
SetOutputFileName(OUTPUTFILE)
module.generate()
-