diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 2000-06-02 21:35:07 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 2000-06-02 21:35:07 (GMT) |
commit | e79dc76f53dfa18fb08c35f71b049259642c0142 (patch) | |
tree | 2d9cc6228cc713336a01d9ff09571eacff3a2ba0 /Mac/Modules/dlg | |
parent | 33d1ad28cba273b94c70ffc22deb6c53b0c1b068 (diff) | |
download | cpython-e79dc76f53dfa18fb08c35f71b049259642c0142.zip cpython-e79dc76f53dfa18fb08c35f71b049259642c0142.tar.gz cpython-e79dc76f53dfa18fb08c35f71b049259642c0142.tar.bz2 |
Made the core toolbox modules carbon-compatible using the new greylist feature of bgen: non-carbon methods are still included in non-carbon MacPython. The issue of backward compatibility of Python code is still open.
Macmodule and macosmodule have also been carbonified. Some functionality is still missing there.
Diffstat (limited to 'Mac/Modules/dlg')
-rw-r--r-- | Mac/Modules/dlg/Dlgmodule.c | 14 | ||||
-rw-r--r-- | Mac/Modules/dlg/dlgscan.py | 6 | ||||
-rw-r--r-- | Mac/Modules/dlg/dlgsupport.py | 7 |
3 files changed, 20 insertions, 7 deletions
diff --git a/Mac/Modules/dlg/Dlgmodule.c b/Mac/Modules/dlg/Dlgmodule.c index fbbadd8..15f61f5 100644 --- a/Mac/Modules/dlg/Dlgmodule.c +++ b/Mac/Modules/dlg/Dlgmodule.c @@ -154,7 +154,7 @@ PyObject *DlgObj_New(itself) it = PyObject_NEW(DialogObject, &Dialog_Type); if (it == NULL) return NULL; it->ob_itself = itself; - SetWRefCon(itself, (long)it); + SetWRefCon(GetDialogWindow(itself), (long)it); return (PyObject *)it; } DlgObj_Convert(v, p_itself) @@ -692,12 +692,12 @@ static PyObject *DlgObj_GetDialogWindow(_self, _args) PyObject *_args; { PyObject *_res = NULL; - DialogPtr _rv; + WindowPtr _rv; if (!PyArg_ParseTuple(_args, "")) return NULL; _rv = GetDialogWindow(_self->ob_itself); _res = Py_BuildValue("O&", - WinObj_WhichWindow, _rv); + WinObj_New, _rv); return _res; } @@ -743,6 +743,8 @@ static PyObject *DlgObj_GetDialogKeyboardFocusItem(_self, _args) return _res; } +#ifndef TARGET_API_MAC_CARBON + static PyObject *DlgObj_SetGrafPortOfDialog(_self, _args) DialogObject *_self; PyObject *_args; @@ -755,6 +757,7 @@ static PyObject *DlgObj_SetGrafPortOfDialog(_self, _args) _res = Py_None; return _res; } +#endif static PyMethodDef DlgObj_methods[] = { {"DrawDialog", (PyCFunction)DlgObj_DrawDialog, 1, @@ -814,15 +817,18 @@ static PyMethodDef DlgObj_methods[] = { {"GetModalDialogEventMask", (PyCFunction)DlgObj_GetModalDialogEventMask, 1, "() -> (EventMask outMask)"}, {"GetDialogWindow", (PyCFunction)DlgObj_GetDialogWindow, 1, - "() -> (DialogPtr _rv)"}, + "() -> (WindowPtr _rv)"}, {"GetDialogDefaultItem", (PyCFunction)DlgObj_GetDialogDefaultItem, 1, "() -> (SInt16 _rv)"}, {"GetDialogCancelItem", (PyCFunction)DlgObj_GetDialogCancelItem, 1, "() -> (SInt16 _rv)"}, {"GetDialogKeyboardFocusItem", (PyCFunction)DlgObj_GetDialogKeyboardFocusItem, 1, "() -> (SInt16 _rv)"}, + +#ifndef TARGET_API_MAC_CARBON {"SetGrafPortOfDialog", (PyCFunction)DlgObj_SetGrafPortOfDialog, 1, "() -> None"}, +#endif {NULL, NULL, 0} }; diff --git a/Mac/Modules/dlg/dlgscan.py b/Mac/Modules/dlg/dlgscan.py index eb5bbfe..a9d6fc4 100644 --- a/Mac/Modules/dlg/dlgscan.py +++ b/Mac/Modules/dlg/dlgscan.py @@ -55,6 +55,12 @@ class MyScanner(Scanner): 'GetDialogControlNotificationProc', ] + def makegreylist(self): + return [ + ('#ifndef TARGET_API_MAC_CARBON', [ + 'SetGrafPortOfDialog', + ])] + def makeblacklisttypes(self): return [ "AlertStdAlertParamPtr", # Too much work, for now diff --git a/Mac/Modules/dlg/dlgsupport.py b/Mac/Modules/dlg/dlgsupport.py index 4c44722..78b6be2 100644 --- a/Mac/Modules/dlg/dlgsupport.py +++ b/Mac/Modules/dlg/dlgsupport.py @@ -129,7 +129,7 @@ class MyObjectDefinition(GlobalObjectDefinition): self.basechain = "&WinObj_chain" def outputInitStructMembers(self): GlobalObjectDefinition.outputInitStructMembers(self) - Output("SetWRefCon(itself, (long)it);") + Output("SetWRefCon(GetDialogWindow(itself), (long)it);") def outputCheckNewArg(self): Output("if (itself == NULL) return Py_None;") def outputCheckConvertArg(self): @@ -160,7 +160,7 @@ for f in methods: object.add(f) # Some methods that are currently macro's in C, but will be real routines # in MacOS 8. -f = Method(ExistingDialogPtr, 'GetDialogWindow', (DialogRef, 'dialog', InMode)) +f = Method(WindowPtr, 'GetDialogWindow', (DialogRef, 'dialog', InMode)) object.add(f) f = Method(SInt16, 'GetDialogDefaultItem', (DialogRef, 'dialog', InMode)) object.add(f) @@ -168,7 +168,8 @@ f = Method(SInt16, 'GetDialogCancelItem', (DialogRef, 'dialog', InMode)) object.add(f) f = Method(SInt16, 'GetDialogKeyboardFocusItem', (DialogRef, 'dialog', InMode)) object.add(f) -f = Method(void, 'SetGrafPortOfDialog', (DialogRef, 'dialog', InMode)) +f = Method(void, 'SetGrafPortOfDialog', (DialogRef, 'dialog', InMode), + condition='#ifndef TARGET_API_MAC_CARBON') object.add(f) setuseritembody = """ |