* etc/NEWS: Mention that the file dialog is used on NS.
* lisp/term/ns-win.el (x-file-dialog): New function.
* src/fileio.c (Fnext_read_file_uses_dialog_p): Add HAVE_NS.
* src/nsfns.m (ns_frame_parm_handlers): Add x_set_fullscreen.
* src/nsfns.m (Fns_read_file_name): Add argument DIR_ONLY_P.
Initialize panel name field if OSX >= 10.6.
* src/w32fns.c (Fx_file_dialog): Update comment.
* src/xfns.c (Fx_file_dialog): Update comment.
2012-09-30 Jan Djärv <jan.h.d@swipnet.se>
* NEWS: The NS port supports fullscreen.
+ Mention that the file dialog is used on NS.
2012-09-17 Glenn Morris <rgm@gnu.org>
---
*** New input method `vietnamese-vni'.
-** The NS port supports fullscreen.
-
+** NextStep/OSX port changes.
+---
+*** Fullscreen and frame parameter fullscreen is supported.
+---
+*** A file dialog is used when open/saved is done from the menu/toolbar.
\f
* Editing Changes in Emacs 24.3
+2012-09-30 Jan Djärv <jan.h.d@swipnet.se>
+
+ * term/ns-win.el (x-file-dialog): New function.
+
2012-09-30 Juanma Barranquero <lekktu@gmail.com>
* ido.el (ido-max-directory-size): Default to nil; the current
;;;; File handling.
+(defun x-file-dialog (prompt dir default_filename mustmatch only_dir_p)
+"Read file name, prompting with PROMPT in directory DIR.
+Use a file selection dialog. Select DEFAULT-FILENAME in the dialog's file
+selection box, if specified. If MUSTMATCH is non-nil, the returned file
+or directory must exist.
+
+This function is only defined on NS, MS Windows, and X Windows with the
+Motif or Gtk toolkits. With the Motif toolkit, ONLY-DIR-P is ignored.
+Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories."
+ (ns-read-file-name prompt dir mustmatch default_filename only_dir_p))
+
(defun ns-open-file-using-panel ()
"Pop up open-file panel, and load the result in a buffer."
(interactive)
2012-09-30 Jan Djärv <jan.h.d@swipnet.se>
+ * xfns.c (Fx_file_dialog): Update comment.
+
+ * w32fns.c (Fx_file_dialog): Update comment.
+
+ * nsfns.m (Fns_read_file_name): Add argument DIR_ONLY_P.
+ Initialize panel name field if OSX >= 10.6.
+
+ * fileio.c (Fnext_read_file_uses_dialog_p): Add HAVE_NS.
+
* nsfns.m (ns_frame_parm_handlers): Add x_set_fullscreen.
* nsterm.m (NEW_STYLE_FS): New define.
before any other event (mouse or keypress) is handled. */)
(void)
{
-#if defined (USE_MOTIF) || defined (HAVE_NTGUI) || defined (USE_GTK)
+#if defined (USE_MOTIF) || defined (HAVE_NTGUI) || defined (USE_GTK) \
+ || defined (HAVE_NS)
if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event))
&& use_dialog_box
&& use_file_dialog
}
-DEFUN ("ns-read-file-name", Fns_read_file_name, Sns_read_file_name, 1, 4, 0,
+DEFUN ("ns-read-file-name", Fns_read_file_name, Sns_read_file_name, 1, 5, 0,
doc: /* Use a graphical panel to read a file name, using prompt PROMPT.
Optional arg DIR, if non-nil, supplies a default directory.
Optional arg MUSTMATCH, if non-nil, means the returned file or
directory must exist.
-Optional arg INIT, if non-nil, provides a default file name to use. */)
- (Lisp_Object prompt, Lisp_Object dir, Lisp_Object mustmatch, Lisp_Object init)
+Optional arg INIT, if non-nil, provides a default file name to use.
+Optional arg DIR_ONLY_P, if non-nil, means choose only directories. */)
+ (Lisp_Object prompt, Lisp_Object dir, Lisp_Object mustmatch,
+ Lisp_Object init, Lisp_Object dir_only_p)
{
static id fileDelegate = nil;
int ret;
if ([dirS characterAtIndex: 0] == '~')
dirS = [dirS stringByExpandingTildeInPath];
- panel = NILP (mustmatch) ?
+ panel = NILP (mustmatch) && NILP (dir_only_p) ?
(id)[EmacsSavePanel savePanel] : (id)[EmacsOpenPanel openPanel];
[panel setTitle: promptS];
- /* Puma (10.1) does not have */
- if ([panel respondsToSelector: @selector (setAllowsOtherFileTypes:)])
- [panel setAllowsOtherFileTypes: YES];
-
+ [panel setAllowsOtherFileTypes: YES];
[panel setTreatsFilePackagesAsDirectories: YES];
[panel setDelegate: fileDelegate];
panelOK = 0;
+ if (! NILP (dir_only_p))
+ {
+ [panel setCanChooseDirectories: YES];
+ [panel setCanChooseFiles: NO];
+ }
+
block_input ();
- if (NILP (mustmatch))
+#if defined (NS_IMPL_COCOA) && \
+ MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
+ if (! NILP (mustmatch) || ! NILP (dir_only_p))
+ [panel setAllowedFileTypes: nil];
+ if (dirS) [panel setDirectoryURL: [NSURL fileURLWithPath: dirS]];
+ if (initS && NILP (Ffile_directory_p (init)))
+ [panel setNameFieldStringValue: [initS lastPathComponent]];
+ else
+ [panel setNameFieldStringValue: @""];
+
+ ret = [panel runModal];
+#else
+ if (NILP (mustmatch) && NILP (dir_only_p))
{
ret = [panel runModalForDirectory: dirS file: initS];
}
[panel setCanChooseDirectories: YES];
ret = [panel runModalForDirectory: dirS file: initS types: nil];
}
+#endif
ret = (ret == NSOKButton) || panelOK;
selection box, if specified. If MUSTMATCH is non-nil, the returned file
or directory must exist.
-This function is only defined on MS Windows, and X Windows with the
+This function is only defined on NS, MS Windows, and X Windows with the
Motif or Gtk toolkits. With the Motif toolkit, ONLY-DIR-P is ignored.
Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */)
(Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object only_dir_p)
selection box, if specified. If MUSTMATCH is non-nil, the returned file
or directory must exist.
-This function is only defined on MS Windows, and X Windows with the
+This function is only defined on NS, MS Windows, and X Windows with the
Motif or Gtk toolkits. With the Motif toolkit, ONLY-DIR-P is ignored.
Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */)
(Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object only_dir_p)
selection box, if specified. If MUSTMATCH is non-nil, the returned file
or directory must exist.
-This function is only defined on MS Windows, and X Windows with the
+This function is only defined on NS, MS Windows, and X Windows with the
Motif or Gtk toolkits. With the Motif toolkit, ONLY-DIR-P is ignored.
Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */)
(Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object only_dir_p)