summaryrefslogtreecommitdiffstats
path: root/mac/tkMacDialog.c
diff options
context:
space:
mode:
authorjingham <jingham@noemail.net>2000-04-23 03:47:13 (GMT)
committerjingham <jingham@noemail.net>2000-04-23 03:47:13 (GMT)
commit1eb4b976d7c7ef79102c479065996250f673c7f0 (patch)
tree80482fd73a69139e652624000f1c33ca6f129f2a /mac/tkMacDialog.c
parentf4d129867943c4f9ebd0fe7b7719cf08fa2e75a7 (diff)
downloadtk-1eb4b976d7c7ef79102c479065996250f673c7f0.zip
tk-1eb4b976d7c7ef79102c479065996250f673c7f0.tar.gz
tk-1eb4b976d7c7ef79102c479065996250f673c7f0.tar.bz2
2000-04-22 Jim Ingham <jingham@cygnus.com> * mac/tkMacDialog.c (Tk_MacGetOpenFile): Add empty bodies for the "-initialfile" and "-defaultextension" options. * mac/tkMacDialog.c (NavServicesGetFile): Only cons the result up into a list if multiple is true. * mac/tkMacMenus.c (SourceDialog): Use the "tk_getOpenFile" instead of hand-coding the dialog with StandardGetFile. This way we get the Navigation dialogs for free. * doc/getOpenFile.n: Document the -multiple and -message flags which are only implemented on the Mac. Also note that the -title works on the Mac with Nav Services installed.
FossilOrigin-Name: 94894720f3e5ba4140104523b125afa23b691842
Diffstat (limited to 'mac/tkMacDialog.c')
-rw-r--r--mac/tkMacDialog.c38
1 files changed, 31 insertions, 7 deletions
diff --git a/mac/tkMacDialog.c b/mac/tkMacDialog.c
index 51c250c..629860c 100644
--- a/mac/tkMacDialog.c
+++ b/mac/tkMacDialog.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacDialog.c,v 1.5 2000/04/17 02:16:50 jingham Exp $
+ * RCS: @(#) $Id: tkMacDialog.c,v 1.6 2000/04/23 03:47:24 jingham Exp $
*/
#include <Gestalt.h>
@@ -305,11 +305,15 @@ Tk_GetOpenFileObjCmd(
AEDesc initialDesc = {typeNull, NULL};
FSSpec dirSpec;
static char *openOptionStrings[] = {
- "-filetypes", "-initialdir", "-message", "-multiple",
+ "-defaultextension", "-filetypes",
+ "-initialdir", "-initialfile",
+ "-message", "-multiple",
"-parent", "-title", NULL
};
enum openOptions {
- OPEN_TYPES, OPEN_INITDIR, OPEN_MESSAGE, OPEN_MULTIPLE,
+ OPEN_DEFAULT, OPEN_TYPES,
+ OPEN_INITDIR, OPEN_INITFILE,
+ OPEN_MESSAGE, OPEN_MULTIPLE,
OPEN_PARENT, OPEN_TITLE
};
@@ -349,6 +353,8 @@ Tk_GetOpenFileObjCmd(
}
switch (index) {
+ case OPEN_DEFAULT:
+ break;
case OPEN_TYPES:
choice = Tcl_GetStringFromObj(objv[i + 1], NULL);
if (TkGetFileFilters(interp, &ofd.fl, choice, 0)
@@ -365,6 +371,8 @@ Tk_GetOpenFileObjCmd(
goto end;
}
break;
+ case OPEN_INITFILE:
+ break;
case OPEN_MESSAGE:
choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
Tcl_UtfToExternal(NULL, NULL, choice, choiceLen,
@@ -898,7 +906,17 @@ NavServicesGetFile(
openFileEventUPP, NULL, NULL);
}
- theResult = Tcl_NewListObj(0, NULL);
+
+ /*
+ * Most commands assume that the file dialogs return a single
+ * item, not a list. So only build a list if multiple is true...
+ */
+
+ if (multiple) {
+ theResult = Tcl_NewListObj(0, NULL);
+ } else {
+ theResult = Tcl_NewObj();
+ }
if ( theReply.validRecord && err == noErr ) {
AEDesc resultDesc;
@@ -921,9 +939,15 @@ NavServicesGetFile(
&length, &pathHandle);
HLock(pathHandle);
Tcl_ExternalToUtfDString(NULL, (char *) *pathHandle, -1, &fileName);
- Tcl_ListObjAppendElement(interp, theResult,
- Tcl_NewStringObj(Tcl_DStringValue(&fileName),
- Tcl_DStringLength(&fileName)));
+ if (multiple) {
+ Tcl_ListObjAppendElement(interp, theResult,
+ Tcl_NewStringObj(Tcl_DStringValue(&fileName),
+ Tcl_DStringLength(&fileName)));
+ } else {
+ Tcl_SetStringObj(theResult, Tcl_DStringValue(&fileName),
+ Tcl_DStringLength(&fileName));
+ }
+
Tcl_DStringFree(&fileName);
HUnlock(pathHandle);
DisposeHandle(pathHandle);