diff options
| author | Jack Jansen <jack.jansen@cwi.nl> | 1996-09-06 00:30:45 +0000 |
|---|---|---|
| committer | Jack Jansen <jack.jansen@cwi.nl> | 1996-09-06 00:30:45 +0000 |
| commit | 3469e997b4cab1927737d45132b416efc17916bb (patch) | |
| tree | fd6637a5dc712aba556c446e019159e2c8c70f28 /Mac | |
| parent | c204c70c1a8a581ea0458657e81a6716404863f5 (diff) | |
| download | cpython-git-3469e997b4cab1927737d45132b416efc17916bb.tar.gz | |
Python about box implemented. Slightly convoluted, since (a) we have
to override an internal sioux routine and (b) we have to override the
"about sioux" menuitem after sioux has created its menus.
Diffstat (limited to 'Mac')
| -rw-r--r-- | Mac/Include/macglue.h | 2 | ||||
| -rw-r--r-- | Mac/Include/pythonresources.h | 6 | ||||
| -rw-r--r-- | Mac/Python/macglue.c | 32 | ||||
| -rw-r--r-- | Mac/Python/macmain.c | 6 | ||||
| -rw-r--r-- | Mac/Resources/dialogs.rsrc.hqx | 475 |
5 files changed, 463 insertions, 58 deletions
diff --git a/Mac/Include/macglue.h b/Mac/Include/macglue.h index 929e9cabd0..035b51fb6f 100644 --- a/Mac/Include/macglue.h +++ b/Mac/Include/macglue.h @@ -63,6 +63,8 @@ PyObject *PyErr_Mac(PyObject *, int); /* Exception with a mac error */ PyObject *PyMac_Error(OSErr); /* Uses PyMac_GetOSErrException */ void PyMac_HandleEvent Py_PROTO((EventRecord *)); /* Handle one event, if possible */ +void PyMac_InitMenuBar(void); /* Setup menu bar as we want it */ + int PyMac_FindResourceModule(char *, char *); /* Test for 'PYC ' resource in a file */ PyObject * PyMac_LoadResourceModule(char *, char *); /* Load 'PYC ' resource from file */ diff --git a/Mac/Include/pythonresources.h b/Mac/Include/pythonresources.h index 93e046be6d..dd847ff70e 100644 --- a/Mac/Include/pythonresources.h +++ b/Mac/Include/pythonresources.h @@ -56,6 +56,9 @@ /* Dialog for 'Bad preference file' */ #define BADPREFFILE_ID 135 +/* About box */ +#define ABOUT_ID 136 + /* ** The following are valid both in the binary (or shared library) ** and in the Preferences file. @@ -83,6 +86,9 @@ #define POPT_KEEPNORM 5 #define POPT_KEEPERR 6 +/* Our menu bar */ +#define MENUBAR_ID 128 + /* From macgetpath.c: */ void PyMac_PreferenceOptions Py_PROTO((int *inspect, int *verbose, int *suppress_print, int *unbuffered, int *debugging, int *keep_normal, diff --git a/Mac/Python/macglue.c b/Mac/Python/macglue.c index 00d6d2c5ae..17bbff00ed 100644 --- a/Mac/Python/macglue.c +++ b/Mac/Python/macglue.c @@ -68,6 +68,9 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <GUSI.h> #endif +/* The ID of the Sioux apple menu */ +#define SIOUX_APPLEID 32000 + #ifndef HAVE_UNIVERSAL_HEADERS #define GetResourceSizeOnDisk(x) SizeResource(x) typedef DlgHookYDProcPtr DlgHookYDUPP; @@ -518,6 +521,35 @@ PyMac_Idle() #endif /* +** Install our menu bar. +*/ +void +PyMac_InitMenuBar() +{ + Handle bar; + MenuHandle applemenu; + + if ( (bar=GetMenuBar()) == NULL ) return; + if ( (applemenu=GetMHandle(SIOUX_APPLEID)) == NULL ) return; + SetMenuItemText(applemenu, 1, "\pAbout Python..."); +} + +/* +** Our replacement about box +*/ +void +SIOUXDoAboutBox(void) +{ + DialogPtr theDialog; + short item; + + if( (theDialog = GetNewDialog(ABOUT_ID, NULL, (WindowPtr)-1)) == NULL ) + return; + ModalDialog(NULL, &item); + DisposeDialog(theDialog); +} + +/* ** Returns true if the argument has a resource fork, and it contains ** a 'PYC ' resource of the correct name */ diff --git a/Mac/Python/macmain.c b/Mac/Python/macmain.c index 019e0bec0f..a85f88f9fc 100644 --- a/Mac/Python/macmain.c +++ b/Mac/Python/macmain.c @@ -351,6 +351,12 @@ Py_Main(argc, argv) } } + /* + ** For reasons I don't fully understand we cannot insert our + ** menu earlier. Leave it here, we hope to be rid of Sioux soon anyway. + */ + PyMac_InitMenuBar(); + Py_Initialize(); PySys_SetArgv(argc-1, argv+1); diff --git a/Mac/Resources/dialogs.rsrc.hqx b/Mac/Resources/dialogs.rsrc.hqx index 1c9c1d9772..95604eaf08 100644 --- a/Mac/Resources/dialogs.rsrc.hqx +++ b/Mac/Resources/dialogs.rsrc.hqx @@ -1,60 +1,419 @@ (This file must be converted with BinHex 4.0) -:$'4TB@a[Ch-ZFR0bB`"bFh*M8P0&4!%!N!F,GLmj!*!%!3!!!!N,!!!)#`!!!QX -f&#"8)'J!&#"3I4'`D"%!1J&R*K)[$%kk!J`-1J"DH3aND@&XEfGc,R*cFQ0c!J! -!!(*cFQ058d9%!3$rN!3!!(*cFQ058d9%!3$rN!3!N"+YR5,r!*!'#hEr%F#SD3% -G3"(rma0`!"!Zrr1pdK&Q%&%f[P9V!3,fK[P9V!3%`86)"Caj%&3`!!"aP%R! -!%#j$&3`!!"pL"R!"B!!"!3)X@P3Y,N5p!3!E2!&Q-#G92KT+J#"6!LJ