Commit 5cf23610 authored by Jack Jansen's avatar Jack Jansen

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.
parent cb441cda
......@@ -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 */
......
......@@ -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,
......
......@@ -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;
......@@ -517,6 +520,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
......
......@@ -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);
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment