summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Mac/Modules/ae/AEmodule.c10
-rw-r--r--Mac/Modules/ae/aesupport.py10
-rw-r--r--Mac/Modules/cm/Cmmodule.c16
-rw-r--r--Mac/Modules/cm/cmsupport.py18
-rw-r--r--Mac/Modules/ctl/Ctlmodule.c10
-rw-r--r--Mac/Modules/ctl/ctlsupport.py10
-rw-r--r--Mac/Modules/dlg/Dlgmodule.c16
-rw-r--r--Mac/Modules/dlg/dlgsupport.py18
-rw-r--r--Mac/Modules/drag/Dragmodule.c11
-rw-r--r--Mac/Modules/drag/dragsupport.py13
-rw-r--r--Mac/Modules/list/Listmodule.c12
-rw-r--r--Mac/Modules/list/listsupport.py14
-rw-r--r--Mac/Modules/menu/Menumodule.c12
-rw-r--r--Mac/Modules/menu/menusupport.py14
-rw-r--r--Mac/Modules/qd/Qdmodule.c34
-rw-r--r--Mac/Modules/qd/qdsupport.py36
-rw-r--r--Mac/Modules/qdoffs/Qdoffsmodule.c11
-rw-r--r--Mac/Modules/qdoffs/qdoffssupport.py12
-rw-r--r--Mac/Modules/qt/Qtmodule.c40
-rw-r--r--Mac/Modules/qt/qtsupport.py42
-rw-r--r--Mac/Modules/res/Resmodule.c15
-rw-r--r--Mac/Modules/res/ressupport.py15
-rw-r--r--Mac/Modules/te/TEmodule.c11
-rw-r--r--Mac/Modules/te/tesupport.py13
-rw-r--r--Mac/Modules/win/Winmodule.c25
-rw-r--r--Mac/Modules/win/winsupport.py27
26 files changed, 463 insertions, 2 deletions
diff --git a/Mac/Modules/ae/AEmodule.c b/Mac/Modules/ae/AEmodule.c
index e0ce470..d4aab79 100644
--- a/Mac/Modules/ae/AEmodule.c
+++ b/Mac/Modules/ae/AEmodule.c
@@ -11,6 +11,14 @@
#include <AppleEvents.h>
#include <AEObjects.h>
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_AEDesc_New(AEDesc *);
+extern int _AEDesc_Convert(PyObject *, AEDesc *);
+
+#define AEDesc_New _AEDesc_New
+#define AEDesc_Convert _AEDesc_Convert
+#endif
+
static pascal OSErr GenericEventHandler(); /* Forward */
AEEventHandlerUPP upp_GenericEventHandler;
@@ -1331,6 +1339,8 @@ void initAE()
upp_AEIdleProc = NewAEIdleProc(AEIdleProc);
upp_GenericEventHandler = NewAEEventHandlerProc(GenericEventHandler);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(AEDesc_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(AEDesc_Convert);
m = Py_InitModule("AE", AE_methods);
diff --git a/Mac/Modules/ae/aesupport.py b/Mac/Modules/ae/aesupport.py
index 86f2094..094a309 100644
--- a/Mac/Modules/ae/aesupport.py
+++ b/Mac/Modules/ae/aesupport.py
@@ -85,6 +85,14 @@ includestuff = includestuff + """
#include <AppleEvents.h>
#include <AEObjects.h>
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_AEDesc_New(AEDesc *);
+extern int _AEDesc_Convert(PyObject *, AEDesc *);
+
+#define AEDesc_New _AEDesc_New
+#define AEDesc_Convert _AEDesc_Convert
+#endif
+
static pascal OSErr GenericEventHandler(); /* Forward */
AEEventHandlerUPP upp_GenericEventHandler;
@@ -138,6 +146,8 @@ GenericEventHandler(const AppleEvent *request, AppleEvent *reply, unsigned long
initstuff = initstuff + """
upp_AEIdleProc = NewAEIdleProc(AEIdleProc);
upp_GenericEventHandler = NewAEEventHandlerProc(GenericEventHandler);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(AEDesc_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(AEDesc_Convert);
"""
module = MacModule('AE', 'AE', includestuff, finalstuff, initstuff)
diff --git a/Mac/Modules/cm/Cmmodule.c b/Mac/Modules/cm/Cmmodule.c
index 93a3e09..5e8a17c 100644
--- a/Mac/Modules/cm/Cmmodule.c
+++ b/Mac/Modules/cm/Cmmodule.c
@@ -9,6 +9,17 @@
#include "pymactoolbox.h"
#include <Components.h>
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_CmpObj_New(Component);
+extern int _CmpObj_Convert(PyObject *, Component *);
+extern PyObject *_CmpInstObj_New(ComponentInstance);
+extern int _CmpInstObj_Convert(PyObject *, ComponentInstance *);
+
+#define CmpObj_New _CmpObj_New
+#define CmpObj_Convert _CmpObj_Convert
+#define CmpInstObj_New _CmpInstObj_New
+#define CmpInstObj_Convert _CmpInstObj_Convert
+#endif
/*
** Parse/generate ComponentDescriptor records
@@ -825,6 +836,11 @@ void initCm()
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(CmpObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CmpObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(CmpInstObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CmpInstObj_Convert);
+
m = Py_InitModule("Cm", Cm_methods);
d = PyModule_GetDict(m);
diff --git a/Mac/Modules/cm/cmsupport.py b/Mac/Modules/cm/cmsupport.py
index 598b51d..5681c81 100644
--- a/Mac/Modules/cm/cmsupport.py
+++ b/Mac/Modules/cm/cmsupport.py
@@ -22,6 +22,17 @@ from macsupport import *
includestuff = includestuff + """
#include <%s>""" % MACHEADERFILE + """
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_CmpObj_New(Component);
+extern int _CmpObj_Convert(PyObject *, Component *);
+extern PyObject *_CmpInstObj_New(ComponentInstance);
+extern int _CmpInstObj_Convert(PyObject *, ComponentInstance *);
+
+#define CmpObj_New _CmpObj_New
+#define CmpObj_Convert _CmpObj_Convert
+#define CmpInstObj_New _CmpInstObj_New
+#define CmpInstObj_Convert _CmpInstObj_Convert
+#endif
/*
** Parse/generate ComponentDescriptor records
@@ -52,6 +63,13 @@ CmpDesc_Convert(v, p_itself)
"""
+initstuff = initstuff + """
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(CmpObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CmpObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(CmpInstObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CmpInstObj_Convert);
+"""
+
ComponentDescription = OpaqueType('ComponentDescription', 'CmpDesc')
Component = OpaqueByValueType('Component', C_OBJECTPREFIX)
ComponentInstance = OpaqueByValueType('ComponentInstance', CI_OBJECTPREFIX)
diff --git a/Mac/Modules/ctl/Ctlmodule.c b/Mac/Modules/ctl/Ctlmodule.c
index 91df945..083929d 100644
--- a/Mac/Modules/ctl/Ctlmodule.c
+++ b/Mac/Modules/ctl/Ctlmodule.c
@@ -13,6 +13,14 @@
#include <ControlDefinitions.h>
#endif
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_CtlObj_New(ControlHandle);
+extern int _CtlObj_Convert(PyObject *, ControlHandle *);
+
+#define CtlObj_New _CtlObj_New
+#define CtlObj_Convert _CtlObj_Convert
+#endif
+
staticforward PyObject *CtlObj_WhichControl(ControlHandle);
#define as_Control(h) ((ControlHandle)h)
@@ -2925,6 +2933,8 @@ void initCtl()
myidleproc_upp = NewControlUserPaneIdleProc(myidleproc);
myhittestproc_upp = NewControlUserPaneHitTestProc(myhittestproc);
mytrackingproc_upp = NewControlUserPaneTrackingProc(mytrackingproc);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(CtlObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CtlObj_Convert);
m = Py_InitModule("Ctl", Ctl_methods);
diff --git a/Mac/Modules/ctl/ctlsupport.py b/Mac/Modules/ctl/ctlsupport.py
index 557ff48..da28d04 100644
--- a/Mac/Modules/ctl/ctlsupport.py
+++ b/Mac/Modules/ctl/ctlsupport.py
@@ -54,6 +54,14 @@ includestuff = includestuff + """
#include <ControlDefinitions.h>
#endif
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_CtlObj_New(ControlHandle);
+extern int _CtlObj_Convert(PyObject *, ControlHandle *);
+
+#define CtlObj_New _CtlObj_New
+#define CtlObj_Convert _CtlObj_Convert
+#endif
+
staticforward PyObject *CtlObj_WhichControl(ControlHandle);
#define as_Control(h) ((ControlHandle)h)
@@ -316,6 +324,8 @@ mydrawproc_upp = NewControlUserPaneDrawProc(mydrawproc);
myidleproc_upp = NewControlUserPaneIdleProc(myidleproc);
myhittestproc_upp = NewControlUserPaneHitTestProc(myhittestproc);
mytrackingproc_upp = NewControlUserPaneTrackingProc(mytrackingproc);
+PyMac_INIT_TOOLBOX_OBJECT_NEW(CtlObj_New);
+PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CtlObj_Convert);
"""
class MyObjectDefinition(ObjectIdentityMixin, GlobalObjectDefinition):
diff --git a/Mac/Modules/dlg/Dlgmodule.c b/Mac/Modules/dlg/Dlgmodule.c
index 2262b54..be68b75 100644
--- a/Mac/Modules/dlg/Dlgmodule.c
+++ b/Mac/Modules/dlg/Dlgmodule.c
@@ -9,6 +9,15 @@
#include "pymactoolbox.h"
#include <Dialogs.h>
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_DlgObj_New(DialogRef);
+extern PyObject *_DlgObj_WhichDialog(DialogRef);
+extern int _DlgObj_Convert(PyObject *, DialogRef *);
+
+#define DlgObj_New _DlgObj_New
+#define DlgObj_WhichDialog _DlgObj_WhichDialog
+#define DlgObj_Convert _DlgObj_Convert
+#endif
#if !ACCESSOR_CALLS_ARE_FUNCTIONS
#define GetDialogTextEditHandle(dlg) (((DialogPeek)(dlg))->textH)
@@ -1468,7 +1477,7 @@ static PyMethodDef Dlg_methods[] = {
/* Return the WindowPtr corresponding to a DialogObject */
-
+#if 0
WindowPtr
DlgObj_ConvertToWindow(self)
PyObject *self;
@@ -1477,6 +1486,7 @@ DlgObj_ConvertToWindow(self)
return GetDialogWindow(((DialogObject *)self)->ob_itself);
return NULL;
}
+#endif
/* Return the object corresponding to the dialog, or None */
PyObject *
@@ -1516,6 +1526,10 @@ void initDlg()
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(DlgObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(DlgObj_WhichDialog);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(DlgObj_Convert);
+
m = Py_InitModule("Dlg", Dlg_methods);
d = PyModule_GetDict(m);
diff --git a/Mac/Modules/dlg/dlgsupport.py b/Mac/Modules/dlg/dlgsupport.py
index 594b7a8..460d3b9 100644
--- a/Mac/Modules/dlg/dlgsupport.py
+++ b/Mac/Modules/dlg/dlgsupport.py
@@ -32,6 +32,15 @@ EventMask = Type("EventMask", "H")
includestuff = includestuff + """
#include <Dialogs.h>
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_DlgObj_New(DialogRef);
+extern PyObject *_DlgObj_WhichDialog(DialogRef);
+extern int _DlgObj_Convert(PyObject *, DialogRef *);
+
+#define DlgObj_New _DlgObj_New
+#define DlgObj_WhichDialog _DlgObj_WhichDialog
+#define DlgObj_Convert _DlgObj_Convert
+#endif
#if !ACCESSOR_CALLS_ARE_FUNCTIONS
#define GetDialogTextEditHandle(dlg) (((DialogPeek)(dlg))->textH)
@@ -139,7 +148,7 @@ extern PyMethodChain WinObj_chain;
finalstuff = finalstuff + """
/* Return the WindowPtr corresponding to a DialogObject */
-
+#if 0
WindowPtr
DlgObj_ConvertToWindow(self)
PyObject *self;
@@ -148,6 +157,7 @@ DlgObj_ConvertToWindow(self)
return GetDialogWindow(((DialogObject *)self)->ob_itself);
return NULL;
}
+#endif
/* Return the object corresponding to the dialog, or None */
PyObject *
@@ -180,6 +190,12 @@ DlgObj_WhichDialog(d)
}
"""
+initstuff = initstuff + """
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(DlgObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(DlgObj_WhichDialog);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(DlgObj_Convert);
+"""
+
# Define a class which specializes our object definition
class MyObjectDefinition(GlobalObjectDefinition):
diff --git a/Mac/Modules/drag/Dragmodule.c b/Mac/Modules/drag/Dragmodule.c
index fa6c2d9..3ce19b7 100644
--- a/Mac/Modules/drag/Dragmodule.c
+++ b/Mac/Modules/drag/Dragmodule.c
@@ -19,6 +19,14 @@ DragInputUPP dragglue_InputUPP;
DragDrawingUPP dragglue_DrawingUPP;
#endif
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_DragObj_New(DragRef);
+extern int _DragObj_Convert(PyObject *, DragRef *);
+
+#define DragObj_New _DragObj_New
+#define DragObj_Convert _DragObj_Convert
+#endif
+
static PyObject *Drag_Error;
/* ---------------------- Object type DragObj ----------------------- */
@@ -1040,6 +1048,9 @@ void initDrag()
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(DragObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(DragObj_Convert);
+
m = Py_InitModule("Drag", Drag_methods);
d = PyModule_GetDict(m);
diff --git a/Mac/Modules/drag/dragsupport.py b/Mac/Modules/drag/dragsupport.py
index d90acc9..79bf00c 100644
--- a/Mac/Modules/drag/dragsupport.py
+++ b/Mac/Modules/drag/dragsupport.py
@@ -54,6 +54,14 @@ DragSendDataUPP dragglue_SendDataUPP;
DragInputUPP dragglue_InputUPP;
DragDrawingUPP dragglue_DrawingUPP;
#endif
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_DragObj_New(DragRef);
+extern int _DragObj_Convert(PyObject *, DragRef *);
+
+#define DragObj_New _DragObj_New
+#define DragObj_Convert _DragObj_Convert
+#endif
"""
finalstuff = finalstuff + """
@@ -153,6 +161,11 @@ dragglue_Drawing(xxxx
"""
+initstuff = initstuff + """
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(DragObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(DragObj_Convert);
+"""
+
variablestuff = """
dragglue_TrackingHandlerUPP = NewDragTrackingHandlerProc(dragglue_TrackingHandler);
dragglue_ReceiveHandlerUPP = NewDragReceiveHandlerProc(dragglue_ReceiveHandler);
diff --git a/Mac/Modules/list/Listmodule.c b/Mac/Modules/list/Listmodule.c
index 0509812..53d070f 100644
--- a/Mac/Modules/list/Listmodule.c
+++ b/Mac/Modules/list/Listmodule.c
@@ -10,6 +10,15 @@
#include <Lists.h>
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_ListObj_New(ListHandle);
+extern int _ListObj_Convert(PyObject *, ListHandle *);
+
+#define ListObj_New _ListObj_New
+#define ListObj_Convert _ListObj_Convert
+#endif
+
#if !ACCESSOR_CALLS_ARE_FUNCTIONS
#define GetListPort(list) ((CGrafPtr)(*(list))->port)
#define GetListVerticalScrollBar(list) ((*(list))->vScroll)
@@ -1066,6 +1075,9 @@ void initList()
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(ListObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ListObj_Convert);
+
m = Py_InitModule("List", List_methods);
d = PyModule_GetDict(m);
diff --git a/Mac/Modules/list/listsupport.py b/Mac/Modules/list/listsupport.py
index ecf8392..751f16b 100644
--- a/Mac/Modules/list/listsupport.py
+++ b/Mac/Modules/list/listsupport.py
@@ -37,6 +37,15 @@ CGrafPtr = OpaqueByValueType("CGrafPtr", "GrafObj")
includestuff = includestuff + """
#include <%s>""" % MACHEADERFILE + """
+
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_ListObj_New(ListHandle);
+extern int _ListObj_Convert(PyObject *, ListHandle *);
+
+#define ListObj_New _ListObj_New
+#define ListObj_Convert _ListObj_Convert
+#endif
+
#if !ACCESSOR_CALLS_ARE_FUNCTIONS
#define GetListPort(list) ((CGrafPtr)(*(list))->port)
#define GetListVerticalScrollBar(list) ((*(list))->vScroll)
@@ -66,6 +75,11 @@ includestuff = includestuff + """
#define as_Resource(lh) ((Handle)lh)
"""
+initstuff = initstuff + """
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(ListObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ListObj_Convert);
+"""
+
class ListMethodGenerator(MethodGenerator):
"""Similar to MethodGenerator, but has self as last argument"""
diff --git a/Mac/Modules/menu/Menumodule.c b/Mac/Modules/menu/Menumodule.c
index 782b270..f965586 100644
--- a/Mac/Modules/menu/Menumodule.c
+++ b/Mac/Modules/menu/Menumodule.c
@@ -11,6 +11,15 @@
#include <Devices.h> /* Defines OpenDeskAcc in universal headers */
#include <Menus.h>
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+
+extern PyObject *_MenuObj_New(MenuHandle);
+extern int _MenuObj_Convert(PyObject *, MenuHandle *);
+
+#define MenuObj_New _MenuObj_New
+#define MenuObj_Convert _MenuObj_Convert
+#endif
+
#if !ACCESSOR_CALLS_ARE_FUNCTIONS
#define GetMenuID(menu) ((*(menu))->menuID)
#define GetMenuWidth(menu) ((*(menu))->menuWidth)
@@ -2780,6 +2789,9 @@ void initMenu()
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(MenuObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MenuObj_Convert);
+
m = Py_InitModule("Menu", Menu_methods);
d = PyModule_GetDict(m);
diff --git a/Mac/Modules/menu/menusupport.py b/Mac/Modules/menu/menusupport.py
index 20b4f36..4de26a2 100644
--- a/Mac/Modules/menu/menusupport.py
+++ b/Mac/Modules/menu/menusupport.py
@@ -39,6 +39,15 @@ includestuff = includestuff + """
#include <Devices.h> /* Defines OpenDeskAcc in universal headers */
#include <%s>""" % MACHEADERFILE + """
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+
+extern PyObject *_MenuObj_New(MenuHandle);
+extern int _MenuObj_Convert(PyObject *, MenuHandle *);
+
+#define MenuObj_New _MenuObj_New
+#define MenuObj_Convert _MenuObj_Convert
+#endif
+
#if !ACCESSOR_CALLS_ARE_FUNCTIONS
#define GetMenuID(menu) ((*(menu))->menuID)
#define GetMenuWidth(menu) ((*(menu))->menuWidth)
@@ -53,6 +62,11 @@ includestuff = includestuff + """
#define as_Resource(h) ((Handle)h)
"""
+initstuff = initstuff + """
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(MenuObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MenuObj_Convert);
+"""
+
class MyObjectDefinition(GlobalObjectDefinition):
pass
diff --git a/Mac/Modules/qd/Qdmodule.c b/Mac/Modules/qd/Qdmodule.c
index 12f44f4..9c3280e 100644
--- a/Mac/Modules/qd/Qdmodule.c
+++ b/Mac/Modules/qd/Qdmodule.c
@@ -10,6 +10,22 @@
#include <QuickDraw.h>
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_GrafObj_New(GrafPtr);
+extern int _GrafObj_Convert(PyObject *, GrafPtr *);
+extern PyObject *_BMObj_New(BitMapPtr);
+extern int _BMObj_Convert(PyObject *, BitMapPtr *);
+extern PyObject *_QdRGB_New(RGBColorPtr);
+extern int _QdRGB_Convert(PyObject *, RGBColorPtr *);
+
+#define GrafObj_New _GrafObj_New
+#define GrafObj_Convert _GrafObj_Convert
+#define BMObj_New _BMObj_New
+#define BMObj_Convert _BMObj_Convert
+#define QdRGB_New _QdRGB_New
+#define QdRGB_Convert _QdRGB_Convert
+#endif
+
#if !ACCESSOR_CALLS_ARE_FUNCTIONS
#define GetPortBitMapForCopyBits(port) ((const struct BitMap *)&((GrafPort *)(port))->portBits)
#define GetPortPixMap(port) (((CGrafPtr)(port))->portPixMap)
@@ -144,6 +160,16 @@ GrafObj_Convert(v, p_itself)
PyObject *v;
GrafPtr *p_itself;
{
+#if 1
+ {
+ WindowRef win;
+ if (WinObj_Convert(v, &win) && v) {
+ *p_itself = (GrafPtr)GetWindowPort(win);
+ return 1;
+ }
+ PyErr_Clear();
+ }
+#else
if (DlgObj_Check(v)) {
DialogRef dlg = (DialogRef)((GrafPortObject *)v)->ob_itself;
*p_itself = (GrafPtr)GetWindowPort(GetDialogWindow(dlg));
@@ -154,6 +180,7 @@ GrafObj_Convert(v, p_itself)
*p_itself = (GrafPtr)GetWindowPort(win);
return 1;
}
+#endif
if (!GrafObj_Check(v))
{
PyErr_SetString(PyExc_TypeError, "GrafPort required");
@@ -6194,6 +6221,13 @@ void initQd()
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(BMObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(BMObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(GrafObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(GrafObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(QdRGB_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(QdRGB_Convert);
+
m = Py_InitModule("Qd", Qd_methods);
d = PyModule_GetDict(m);
diff --git a/Mac/Modules/qd/qdsupport.py b/Mac/Modules/qd/qdsupport.py
index fe606f5..705cc4e 100644
--- a/Mac/Modules/qd/qdsupport.py
+++ b/Mac/Modules/qd/qdsupport.py
@@ -63,6 +63,22 @@ PenState_ptr = StructInputBufferType('PenState')
includestuff = includestuff + """
#include <%s>""" % MACHEADERFILE + """
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_GrafObj_New(GrafPtr);
+extern int _GrafObj_Convert(PyObject *, GrafPtr *);
+extern PyObject *_BMObj_New(BitMapPtr);
+extern int _BMObj_Convert(PyObject *, BitMapPtr *);
+extern PyObject *_QdRGB_New(RGBColorPtr);
+extern int _QdRGB_Convert(PyObject *, RGBColorPtr *);
+
+#define GrafObj_New _GrafObj_New
+#define GrafObj_Convert _GrafObj_Convert
+#define BMObj_New _BMObj_New
+#define BMObj_Convert _BMObj_Convert
+#define QdRGB_New _QdRGB_New
+#define QdRGB_Convert _QdRGB_Convert
+#endif
+
#if !ACCESSOR_CALLS_ARE_FUNCTIONS
#define GetPortBitMapForCopyBits(port) ((const struct BitMap *)&((GrafPort *)(port))->portBits)
#define GetPortPixMap(port) (((CGrafPtr)(port))->portPixMap)
@@ -201,6 +217,15 @@ variablestuff = """
}
"""
+initstuff = initstuff + """
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(BMObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(BMObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(GrafObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(GrafObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(QdRGB_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(QdRGB_Convert);
+"""
+
## not yet...
##
##class Region_ObjectDefinition(GlobalObjectDefinition):
@@ -219,6 +244,16 @@ class MyGRObjectDefinition(GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("if (itself == NULL) return PyMac_Error(resNotFound);")
def outputCheckConvertArg(self):
+ Output("#if 1")
+ OutLbrace()
+ Output("WindowRef win;")
+ OutLbrace("if (WinObj_Convert(v, &win) && v)")
+ Output("*p_itself = (GrafPtr)GetWindowPort(win);")
+ Output("return 1;")
+ OutRbrace()
+ Output("PyErr_Clear();")
+ OutRbrace()
+ Output("#else")
OutLbrace("if (DlgObj_Check(v))")
Output("DialogRef dlg = (DialogRef)((GrafPortObject *)v)->ob_itself;")
Output("*p_itself = (GrafPtr)GetWindowPort(GetDialogWindow(dlg));")
@@ -229,6 +264,7 @@ class MyGRObjectDefinition(GlobalObjectDefinition):
Output("*p_itself = (GrafPtr)GetWindowPort(win);")
Output("return 1;")
OutRbrace()
+ Output("#endif")
def outputGetattrHook(self):
Output("#if !ACCESSOR_CALLS_ARE_FUNCTIONS")
Output("""
diff --git a/Mac/Modules/qdoffs/Qdoffsmodule.c b/Mac/Modules/qdoffs/Qdoffsmodule.c
index 2caf6f3..caa997e 100644
--- a/Mac/Modules/qdoffs/Qdoffsmodule.c
+++ b/Mac/Modules/qdoffs/Qdoffsmodule.c
@@ -10,6 +10,14 @@
#include <QDOffscreen.h>
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_GWorldObj_New(GWorldPtr);
+extern int _GWorldObj_Convert(PyObject *, GWorldPtr *);
+
+#define GWorldObj_New _GWorldObj_New
+#define GWorldObj_Convert _GWorldObj_Convert
+#endif
+
#define as_GrafPtr(gworld) ((GrafPtr)(gworld))
@@ -622,6 +630,9 @@ void initQdoffs()
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(GWorldObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(GWorldObj_Convert);
+
m = Py_InitModule("Qdoffs", Qdoffs_methods);
d = PyModule_GetDict(m);
diff --git a/Mac/Modules/qdoffs/qdoffssupport.py b/Mac/Modules/qdoffs/qdoffssupport.py
index 7f4a043..3d96ca4 100644
--- a/Mac/Modules/qdoffs/qdoffssupport.py
+++ b/Mac/Modules/qdoffs/qdoffssupport.py
@@ -36,10 +36,22 @@ QDErr = OSErrType("QDErr", 'h')
includestuff = includestuff + """
#include <%s>""" % MACHEADERFILE + """
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_GWorldObj_New(GWorldPtr);
+extern int _GWorldObj_Convert(PyObject *, GWorldPtr *);
+
+#define GWorldObj_New _GWorldObj_New
+#define GWorldObj_Convert _GWorldObj_Convert
+#endif
+
#define as_GrafPtr(gworld) ((GrafPtr)(gworld))
"""
+initstuff = initstuff + """
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(GWorldObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(GWorldObj_Convert);
+"""
class MyObjectDefinition(GlobalObjectDefinition):
def outputCheckNewArg(self):
diff --git a/Mac/Modules/qt/Qtmodule.c b/Mac/Modules/qt/Qtmodule.c
index 20f10cc..20ba370 100644
--- a/Mac/Modules/qt/Qtmodule.c
+++ b/Mac/Modules/qt/Qtmodule.c
@@ -10,6 +10,33 @@
#include <Movies.h>
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_TrackObj_New(Track);
+extern int _TrackObj_Convert(PyObject *, Track *);
+extern PyObject *_MovieObj_New(Movie);
+extern int _MovieObj_Convert(PyObject *, Movie *);
+extern PyObject *_MovieCtlObj_New(MovieController);
+extern int _MovieCtlObj_Convert(PyObject *, MovieController *);
+extern PyObject *_TimeBaseObj_New(TimeBase);
+extern int _TimeBaseObj_Convert(PyObject *, TimeBase *);
+extern PyObject *_UserDataObj_New(UserData);
+extern int _UserDataObj_Convert(PyObject *, UserData *);
+extern PyObject *_MediaObj_New(Media);
+extern int _MediaObj_Convert(PyObject *, Media *);
+
+#define TrackObj_New _TrackObj_New
+#define TrackObj_Convert _TrackObj_Convert
+#define MovieObj_New _MovieObj_New
+#define MovieObj_Convert _MovieObj_Convert
+#define MovieCtlObj_New _MovieCtlObj_New
+#define MovieCtlObj_Convert _MovieCtlObj_Convert
+#define TimeBaseObj_New _TimeBaseObj_New
+#define TimeBaseObj_Convert _TimeBaseObj_Convert
+#define UserDataObj_New _UserDataObj_New
+#define UserDataObj_Convert _UserDataObj_Convert
+#define MediaObj_New _MediaObj_New
+#define MediaObj_Convert _MediaObj_Convert
+#endif
/* Macro to allow us to GetNextInterestingTime without duration */
#define GetMediaNextInterestingTimeOnly(media, flags, time, rate, rv) GetMediaNextInterestingTime(media, flags, time, rate, rv, NULL)
@@ -9160,6 +9187,19 @@ void initQt()
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(TrackObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(TrackObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(MovieObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MovieObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(MovieCtlObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MovieCtlObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(TimeBaseObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(TimeBaseObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(UserDataObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(UserDataObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(MediaObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MediaObj_Convert);
+
m = Py_InitModule("Qt", Qt_methods);
d = PyModule_GetDict(m);
diff --git a/Mac/Modules/qt/qtsupport.py b/Mac/Modules/qt/qtsupport.py
index 3d26673..02ce57e 100644
--- a/Mac/Modules/qt/qtsupport.py
+++ b/Mac/Modules/qt/qtsupport.py
@@ -26,6 +26,33 @@ from macsupport import *
includestuff = includestuff + """
#include <%s>""" % MACHEADERFILE + """
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_TrackObj_New(Track);
+extern int _TrackObj_Convert(PyObject *, Track *);
+extern PyObject *_MovieObj_New(Movie);
+extern int _MovieObj_Convert(PyObject *, Movie *);
+extern PyObject *_MovieCtlObj_New(MovieController);
+extern int _MovieCtlObj_Convert(PyObject *, MovieController *);
+extern PyObject *_TimeBaseObj_New(TimeBase);
+extern int _TimeBaseObj_Convert(PyObject *, TimeBase *);
+extern PyObject *_UserDataObj_New(UserData);
+extern int _UserDataObj_Convert(PyObject *, UserData *);
+extern PyObject *_MediaObj_New(Media);
+extern int _MediaObj_Convert(PyObject *, Media *);
+
+#define TrackObj_New _TrackObj_New
+#define TrackObj_Convert _TrackObj_Convert
+#define MovieObj_New _MovieObj_New
+#define MovieObj_Convert _MovieObj_Convert
+#define MovieCtlObj_New _MovieCtlObj_New
+#define MovieCtlObj_Convert _MovieCtlObj_Convert
+#define TimeBaseObj_New _TimeBaseObj_New
+#define TimeBaseObj_Convert _TimeBaseObj_Convert
+#define UserDataObj_New _UserDataObj_New
+#define UserDataObj_Convert _UserDataObj_Convert
+#define MediaObj_New _MediaObj_New
+#define MediaObj_Convert _MediaObj_Convert
+#endif
/* Macro to allow us to GetNextInterestingTime without duration */
#define GetMediaNextInterestingTimeOnly(media, flags, time, rate, rv) \
@@ -67,6 +94,21 @@ QtTimeRecord_Convert(v, p_itself)
"""
+initstuff = initstuff + """
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(TrackObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(TrackObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(MovieObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MovieObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(MovieCtlObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MovieCtlObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(TimeBaseObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(TimeBaseObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(UserDataObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(UserDataObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(MediaObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MediaObj_Convert);
+"""
+
# Our (opaque) objects
Movie = OpaqueByValueType('Movie', 'MovieObj')
NullMovie = FakeType("(Movie)0")
diff --git a/Mac/Modules/res/Resmodule.c b/Mac/Modules/res/Resmodule.c
index bd6a42d..26007b4 100644
--- a/Mac/Modules/res/Resmodule.c
+++ b/Mac/Modules/res/Resmodule.c
@@ -11,6 +11,17 @@
#include <Resources.h>
#include <string.h>
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_ResObj_New(Handle);
+extern int _ResObj_Convert(PyObject *, Handle *);
+extern PyObject *_OptResObj_New(Handle);
+extern int _OptResObj_Convert(PyObject *, Handle *);
+#define ResObj_New _ResObj_New
+#define ResObj_Convert _ResObj_Convert
+#define OptResObj_New _OptResObj_New
+#define OptResObj_Convert _OptResObj_Convert
+#endif
+
/* Function to dispose a resource, with a "normal" calling sequence */
static void
PyMac_AutoDisposeHandle(Handle h)
@@ -1678,6 +1689,10 @@ void initRes()
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(ResObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ResObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(OptResObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(OptResObj_Convert);
m = Py_InitModule("Res", Res_methods);
diff --git a/Mac/Modules/res/ressupport.py b/Mac/Modules/res/ressupport.py
index fcee62e..cdbb778 100644
--- a/Mac/Modules/res/ressupport.py
+++ b/Mac/Modules/res/ressupport.py
@@ -26,6 +26,17 @@ includestuff = includestuff + """
#include <Resources.h>
#include <string.h>
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_ResObj_New(Handle);
+extern int _ResObj_Convert(PyObject *, Handle *);
+extern PyObject *_OptResObj_New(Handle);
+extern int _OptResObj_Convert(PyObject *, Handle *);
+#define ResObj_New _ResObj_New
+#define ResObj_Convert _ResObj_Convert
+#define OptResObj_New _OptResObj_New
+#define OptResObj_Convert _OptResObj_Convert
+#endif
+
/* Function to dispose a resource, with a "normal" calling sequence */
static void
PyMac_AutoDisposeHandle(Handle h)
@@ -75,6 +86,10 @@ OptResObj_Convert(v, p_itself)
"""
initstuff = initstuff + """
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(ResObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ResObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(OptResObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(OptResObj_Convert);
"""
module = MacModule('Res', 'Res', includestuff, finalstuff, initstuff)
diff --git a/Mac/Modules/te/TEmodule.c b/Mac/Modules/te/TEmodule.c
index 2bb447b..05b9b0c 100644
--- a/Mac/Modules/te/TEmodule.c
+++ b/Mac/Modules/te/TEmodule.c
@@ -10,6 +10,14 @@
#include <TextEdit.h>
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_TEObj_New(TEHandle);
+extern int _TEObj_Convert(PyObject *, TEHandle *);
+
+#define TEObj_New _TEObj_New
+#define TEObj_Convert _TEObj_Convert
+#endif
+
#define as_TE(h) ((TEHandle)h)
#define as_Resource(teh) ((Handle)teh)
@@ -1105,6 +1113,9 @@ void initTE()
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(TEObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(TEObj_Convert);
+
m = Py_InitModule("TE", TE_methods);
d = PyModule_GetDict(m);
diff --git a/Mac/Modules/te/tesupport.py b/Mac/Modules/te/tesupport.py
index 337ac2b..5512be0 100644
--- a/Mac/Modules/te/tesupport.py
+++ b/Mac/Modules/te/tesupport.py
@@ -34,6 +34,14 @@ TextStyle_ptr = TextStyle
includestuff = includestuff + """
#include <%s>""" % MACHEADERFILE + """
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_TEObj_New(TEHandle);
+extern int _TEObj_Convert(PyObject *, TEHandle *);
+
+#define TEObj_New _TEObj_New
+#define TEObj_Convert _TEObj_Convert
+#endif
+
#define as_TE(h) ((TEHandle)h)
#define as_Resource(teh) ((Handle)teh)
@@ -65,6 +73,11 @@ TextStyle_Convert(v, p_itself)
}
"""
+initstuff = initstuff + """
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(TEObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(TEObj_Convert);
+"""
+
class TEMethodGenerator(OSErrMethodGenerator):
"""Similar to MethodGenerator, but has self as last argument"""
diff --git a/Mac/Modules/win/Winmodule.c b/Mac/Modules/win/Winmodule.c
index d267248..6a9ded3 100644
--- a/Mac/Modules/win/Winmodule.c
+++ b/Mac/Modules/win/Winmodule.c
@@ -10,6 +10,16 @@
#include <Windows.h>
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_WinObj_New(WindowRef);
+extern PyObject *_WinObj_WhichWindow(WindowRef);
+extern int _WinObj_Convert(PyObject *, WindowRef *);
+
+#define WinObj_New _WinObj_New
+#define WinObj_WhichWindow _WinObj_WhichWindow
+#define WinObj_Convert _WinObj_Convert
+#endif
+
#if !ACCESSOR_CALLS_ARE_FUNCTIONS
/* Carbon calls that we emulate in classic mode */
#define GetWindowSpareFlag(win) (((CWindowPeek)(win))->spareFlag)
@@ -65,10 +75,21 @@ WinObj_Convert(v, p_itself)
PyObject *v;
WindowPtr *p_itself;
{
+#if 1
+ {
+ DialogRef dlg;
+ if (DlgObj_Convert(v, &dlg) && dlg) {
+ *p_itself = GetDialogWindow(dlg);
+ return 1;
+ }
+ PyErr_Clear();
+ }
+#else
if (DlgObj_Check(v)) {
*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; }
@@ -3057,6 +3078,10 @@ void initWin()
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(WinObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(WinObj_WhichWindow);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(WinObj_Convert);
+
m = Py_InitModule("Win", Win_methods);
d = PyModule_GetDict(m);
diff --git a/Mac/Modules/win/winsupport.py b/Mac/Modules/win/winsupport.py
index 0359a91..e55d273 100644
--- a/Mac/Modules/win/winsupport.py
+++ b/Mac/Modules/win/winsupport.py
@@ -56,6 +56,16 @@ PropertyTag = OSTypeType("PropertyTag")
includestuff = includestuff + """
#include <%s>""" % MACHEADERFILE + """
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_WinObj_New(WindowRef);
+extern PyObject *_WinObj_WhichWindow(WindowRef);
+extern int _WinObj_Convert(PyObject *, WindowRef *);
+
+#define WinObj_New _WinObj_New
+#define WinObj_WhichWindow _WinObj_WhichWindow
+#define WinObj_Convert _WinObj_Convert
+#endif
+
#if !ACCESSOR_CALLS_ARE_FUNCTIONS
/* Carbon calls that we emulate in classic mode */
#define GetWindowSpareFlag(win) (((CWindowPeek)(win))->spareFlag)
@@ -103,6 +113,12 @@ WinObj_WhichWindow(w)
}
"""
+initstuff = initstuff + """
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(WinObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(WinObj_WhichWindow);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(WinObj_Convert);
+"""
+
class MyObjectDefinition(GlobalObjectDefinition):
def outputCheckNewArg(self):
Output("if (itself == NULL) return PyMac_Error(resNotFound);")
@@ -118,10 +134,21 @@ class MyObjectDefinition(GlobalObjectDefinition):
Output("it->ob_freeit = PyMac_AutoDisposeWindow;")
OutRbrace()
def outputCheckConvertArg(self):
+ Output("#if 1")
+ OutLbrace()
+ Output("DialogRef dlg;")
+ OutLbrace("if (DlgObj_Convert(v, &dlg) && dlg)")
+ Output("*p_itself = GetDialogWindow(dlg);")
+ Output("return 1;")
+ OutRbrace()
+ Output("PyErr_Clear();")
+ OutRbrace()
+ Output("#else")
OutLbrace("if (DlgObj_Check(v))")
Output("*p_itself = DlgObj_ConvertToWindow(v);")
Output("return 1;")
OutRbrace()
+ Output("#endif")
Out("""
if (v == Py_None) { *p_itself = NULL; return 1; }
if (PyInt_Check(v)) { *p_itself = (WindowPtr)PyInt_AsLong(v); return 1; }