summaryrefslogtreecommitdiffstats
path: root/Mac
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>1995-07-29 13:52:37 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>1995-07-29 13:52:37 (GMT)
commit292b0f96f3f87d47766b0fa3ac5123ff24ef829d (patch)
tree64a1b3044a50e322fe315e4cc964b1c503741a9d /Mac
parentcc456fbe82cf55fcec71d4237b86cea2bc1c1cef (diff)
downloadcpython-292b0f96f3f87d47766b0fa3ac5123ff24ef829d.zip
cpython-292b0f96f3f87d47766b0fa3ac5123ff24ef829d.tar.gz
cpython-292b0f96f3f87d47766b0fa3ac5123ff24ef829d.tar.bz2
Added code so you canset "command line options" if you
option-click/drag python. Needs a new dialog resource.
Diffstat (limited to 'Mac')
-rw-r--r--Mac/Python/macglue.c62
1 files changed, 61 insertions, 1 deletions
diff --git a/Mac/Python/macglue.c b/Mac/Python/macglue.c
index 24667e6..7e4f0a0 100644
--- a/Mac/Python/macglue.c
+++ b/Mac/Python/macglue.c
@@ -73,6 +73,16 @@ typedef FileFilterYDProcPtr FileFilterYDUPP;
#define GETDIR_ID 130 /* Resource ID for our "get directory" */
#define SELECTCUR_ITEM 10 /* "Select current directory" button */
+/* The dialog for interactive options */
+#define OPT_DIALOG 131 /* Resource ID for dialog */
+#define OPT_OK 1
+#define OPT_CANCEL 2
+#define OPT_INSPECT 3
+#define OPT_VERBOSE 4
+#define OPT_SUPPRESS 5
+#define OPT_UNBUFFERED 6
+#define OPT_DEBUGGING 7
+
/* The STR# resource for sys.path initialization */
#define PYTHONPATH_ID 128
@@ -954,7 +964,7 @@ PyMac_InitApplet()
if (!err)
SIOUXSettings.autocloseonquit = 1;
else
- SIOUXSettings.showstatusline = 1;
+ printf("\n[Terminated]\n");
#endif
/* XXX Should we bother to Py_Exit(sts)? */
}
@@ -991,3 +1001,53 @@ PyMac_InitApplication()
}
Py_Main(argc, argv);
}
+
+/*
+** PyMac_InteractiveOptions - Allow user to set options if option key is pressed
+*/
+void
+PyMac_InteractiveOptions(int *inspect, int *verbose, int *suppress_print,
+ int *unbuffered, int *debugging)
+{
+ KeyMap rmap;
+ unsigned char *map;
+ short item, type;
+ ControlHandle handle;
+ DialogPtr dialog;
+ Rect rect;
+
+ GetKeys(rmap);
+ map = (unsigned char *)rmap;
+ if ( ( map[0x3a>>3] & (1<<(0x3a&7)) ) == 0 ) /* option key is 3a */
+ return;
+
+ dialog = GetNewDialog(OPT_DIALOG, NULL, (WindowPtr)-1);
+ if ( dialog == NULL )
+ return;
+ while (1) {
+ handle = NULL;
+ ModalDialog(NULL, &item);
+ if ( item == OPT_OK )
+ break;
+ if ( item == OPT_CANCEL ) {
+ DisposDialog(dialog);
+ exit(0);
+ }
+#define OPT_ITEM(num, var) \
+ if ( item == (num) ) { \
+ *(var) = !*(var); \
+ GetDialogItem(dialog, (num), &type, (Handle *)&handle, &rect); \
+ SetCtlValue(handle, (short)*(var)); \
+ }
+
+ OPT_ITEM(OPT_INSPECT, inspect);
+ OPT_ITEM(OPT_VERBOSE, verbose);
+ OPT_ITEM(OPT_SUPPRESS, suppress_print);
+ OPT_ITEM(OPT_UNBUFFERED, unbuffered);
+ OPT_ITEM(OPT_DEBUGGING, debugging);
+
+#undef OPT_ITEM
+ }
+ DisposDialog(dialog);
+ /*DBG*/printf("options: %d %d %d %d %d %d\n", *inspect, *verbose, *suppress_print, *unbuffered, *debugging);
+}