]> granicus.if.org Git - python/commitdiff
First bits and pieces of appearance support: an init routine, a global flag PyMac_App...
authorJack Jansen <jack.jansen@cwi.nl>
Tue, 7 Dec 1999 23:08:10 +0000 (23:08 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Tue, 7 Dec 1999 23:08:10 +0000 (23:08 +0000)
is off the code is disabled (but the variables are still there, set to 0).

Mac/Include/macglue.h
Mac/Include/pythonresources.h
Mac/Modules/macosmodule.c
Mac/Python/macglue.c
Mac/Python/macmain.c
Mac/mwerks/mwerks_small_config.h

index b40d18aeb391b7427c1be25609424122c6289785..5e390448c0adc910a2eb08fcd7385d5e0a9865f0 100644 (file)
@@ -72,6 +72,7 @@ extern char PyMac_ApplicationPath[];          /* Application location (from macargv.c) *
 extern OSErr PyMac_init_application_location Py_PROTO((void)); /* Init the above */
 extern OSErr PyMac_GetFullPath Py_PROTO((FSSpec *, char *)); /* convert fsspec->path (macargv.c) */
 extern int PyMac_GetArgv Py_PROTO((char ***, int));    /* Get argc, argv (from macargv.c) */
+extern int PyMac_AppearanceCompliant;  /* True if in appearance support mode */
 
 extern PyObject *PyMac_OSErrException;         /* Exception for OSErr */
 PyObject *PyMac_GetOSErrException(void);       /* Initialize & return it */
index 8f6c227efd593a829d992e2f49e18d4c9587fd4f..a696b866be03a267dc6cd75acd4f209a62b4dc23 100644 (file)
@@ -41,24 +41,26 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 ** shared ppc python, in the core dynamic library)
 */
 
+#define BASE_ID 228
+
 /* The alert for "No Python directory, where is it?" (OBSOLETE) */
-#define NOPYTHON_ALERT 228
+#define NOPYTHON_ALERT BASE_ID+0
 #define YES_ITEM               1
 #define NO_ITEM                        2
 #define CURWD_ITEM             3
 
 /* The alert for "this is an applet template" */
-#define NOPYC_ALERT            229
+#define NOPYC_ALERT            BASE_ID+1
 
 /* The dialog for our GetDirectory and PromptGetFile call */
-#define GETDIR_ID              230             /* Resource ID for our "get directory" */
-#define GETFILEPROMPT_ID 232   /* Resource id for prompted get file */
-#define PROMPT_ITEM            10              /* The prompt, at the top */
-#define SELECTCUR_ITEM 11      /* "Select current directory" button */
+#define GETDIR_ID              BASE_ID+2               /* Resource ID for our "get directory" */
+#define GETFILEPROMPT_ID BASE_ID+4             /* Resource id for prompted get file */
+#define PROMPT_ITEM            10                              /* The prompt, at the top */
+#define SELECTCUR_ITEM 11                              /* "Select current directory" button */
 
 
 /* The dialog for interactive options */
-#define OPT_DIALOG             231             /* Resource ID for dialog */
+#define OPT_DIALOG             BASE_ID+3               /* Resource ID for dialog */
 #define OPT_OK                 1
 #define OPT_CANCEL             2
 #define OPT_INSPECT            3
@@ -74,21 +76,21 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #define OPT_HELP       16
 
 /* Dialog for 'No preferences directory' */
-#define NOPREFDIR_ID   233
+#define NOPREFDIR_ID   BASE_ID+5
 
 /* Dialog for 'Bad or outdated preferences' */
-#define BADPREFERENCES_ID      234
+#define BADPREFERENCES_ID      BASE_ID+6
 #define BADPREF_DELETE         1
 #define BADPREF_CONTINUE       2
 #define BADPREF_QUIT           3
 /* Dialog for 'Bad preference file' */
-#define BADPREFFILE_ID 235
+#define BADPREFFILE_ID BASE_ID+7
 
 /* About box */
-#define ABOUT_ID               236
+#define ABOUT_ID               BASE_ID+8
 
 /* No preferences file name resource */
-#define NOPREFNAME_ID  237
+#define NOPREFNAME_ID  BASE_ID+9
 
 /* EditPythonPrefs range. Needed here to forestall conflicts with applets */
 #define EDITPYTHONPREFS_MIN    508
@@ -168,4 +170,4 @@ typedef struct PyMac_PrefRecord {
 /* From macgetpath.c: */
 void PyMac_PreferenceOptions Py_PROTO((PyMac_PrefRecord *));
 char * PyMac_GetPythonDir Py_PROTO((void));
-#endif
\ No newline at end of file
+#endif
index 14f807c81c53609424d9f7b4de7ee54d2ed7cfbd..586d6750ede5e6cf5ad57b7cdc4cd205346862fc 100644 (file)
@@ -734,5 +734,8 @@ initMacOS()
                if( PyDict_SetItemString(d, "string_id_to_buffer", Py_BuildValue("i", off)) != 0)
                        Py_FatalError("Can't define MacOS.string_id_to_buffer");
        }
+       if (PyDict_SetItemString(d, "AppearanceCompliant", 
+                               Py_BuildValue("i", PyMac_AppearanceCompliant)) != 0)
+               Py_FatalError("can't define MacOS.AppearanceCompliant");
 }
 
index fa27c79c4ff8b25ef04ad3d67d05b181333ca91c..4b4c021695c274377268cc18e98c12dd1183280a 100644 (file)
@@ -155,6 +155,11 @@ static int upp_inited = 0;
 */
 static PyObject *python_event_handler;
 
+/*
+** Set to true if we're appearance-compliant
+*/
+int PyMac_AppearanceCompliant;
+
 #ifdef USE_GUSI
 /*
 ** GUSI (1.6.0 and earlier, at the least) do not set the MacOS idea of
index 0fdcb511f2f776bd9b5d06224eeacee244eabd6d..db39e18d1a7342943b8174103ae68933ded8d13b 100644 (file)
@@ -37,6 +37,10 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #include <Windows.h>
 #include <Fonts.h>
 #include <Balloons.h>
+#ifdef USE_APPEARANCE
+#include <Gestalt.h>
+#include <Appearance.h>
+#endif /* USE_APPEARANCE */
 #ifdef __MWERKS__
 #include <SIOUX.h>
 #define USE_SIOUX
@@ -64,6 +68,21 @@ PyMac_PrefRecord options;
 static void Py_Main Py_PROTO((int, char **)); /* Forward */
 void PyMac_Exit Py_PROTO((int)); /* Forward */
 
+static void init_appearance()
+{
+#ifdef USE_APPEARANCE
+       OSErr err;
+       SInt32 response;
+
+       err = Gestalt(gestaltAppearanceAttr,&response);
+       if ( err ) goto no_appearance;
+       if ( !(response&(1<<gestaltAppearanceExists)) ) goto no_appearance;
+       /* XXXX Should we check the version? Compat-mode? */
+       PyMac_AppearanceCompliant = 1;
+no_appearance:
+       return;
+#endif /* USE_APPEARANCE */
+}
 /* Initialize the Mac toolbox world */
 
 static void
@@ -80,6 +99,7 @@ init_mac_world()
        InitDialogs((long)0);
        InitMenus();
        InitCursor();
+       init_appearance();
 #endif
 }
 
index d3ba30750a1074f4a783e81698281ffb28dc2fef..cee8d068f9965340e166b9460eaa11573df6c379 100644 (file)
@@ -23,6 +23,7 @@
 #define USE_MALLOC_DEBUG                       /* Enable range checking and other malloc debugging */
 /* #define USE_GDBM            /* Include the gdbm module */
 /* #define USE_ZLIB            /* Include the zlib module */
+#define USE_APPEARANCE /* Enable Appearance support */
 #ifdef __powerc
 #define USE_CACHE_ALIGNED 8            /* Align on 32-byte boundaries for 604 */
 #endif