emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r110284: Support file name dialog on


From: Jan D.
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r110284: Support file name dialog on NS.
Date: Sun, 30 Sep 2012 15:43:47 +0200
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 110284
committer: Jan D. <address@hidden>
branch nick: trunk
timestamp: Sun 2012-09-30 15:43:47 +0200
message:
  Support file name dialog on NS.
  
  * 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.
modified:
  etc/ChangeLog
  etc/NEWS
  lisp/ChangeLog
  lisp/term/ns-win.el
  src/ChangeLog
  src/fileio.c
  src/nsfns.m
  src/w32fns.c
  src/xfns.c
=== modified file 'etc/ChangeLog'
--- a/etc/ChangeLog     2012-09-30 12:50:09 +0000
+++ b/etc/ChangeLog     2012-09-30 13:43:47 +0000
@@ -1,6 +1,7 @@
 2012-09-30  Jan Djärv  <address@hidden>
 
        * NEWS: The NS port supports fullscreen.
+       Mention that the file dialog is used on NS.
 
 2012-09-17  Glenn Morris  <address@hidden>
 

=== modified file 'etc/NEWS'
--- a/etc/NEWS  2012-09-30 12:50:09 +0000
+++ b/etc/NEWS  2012-09-30 13:43:47 +0000
@@ -187,8 +187,11 @@
 ---
 *** 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.
 
 * Editing Changes in Emacs 24.3
 

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-09-30 12:28:50 +0000
+++ b/lisp/ChangeLog    2012-09-30 13:43:47 +0000
@@ -1,3 +1,7 @@
+2012-09-30  Jan Djärv  <address@hidden>
+
+       * term/ns-win.el (x-file-dialog): New function.
+
 2012-09-30  Juanma Barranquero  <address@hidden>
 
        * ido.el (ido-max-directory-size): Default to nil; the current

=== modified file 'lisp/term/ns-win.el'
--- a/lisp/term/ns-win.el       2012-07-11 23:13:41 +0000
+++ b/lisp/term/ns-win.el       2012-09-30 13:43:47 +0000
@@ -452,6 +452,17 @@
 
 ;;;; 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)

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-09-30 12:50:09 +0000
+++ b/src/ChangeLog     2012-09-30 13:43:47 +0000
@@ -1,5 +1,14 @@
 2012-09-30  Jan Djärv  <address@hidden>
 
+       * 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.

=== modified file 'src/fileio.c'
--- a/src/fileio.c      2012-09-23 08:44:20 +0000
+++ b/src/fileio.c      2012-09-30 13:43:47 +0000
@@ -5520,7 +5520,8 @@
 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

=== modified file 'src/nsfns.m'
--- a/src/nsfns.m       2012-09-30 12:50:09 +0000
+++ b/src/nsfns.m       2012-09-30 13:43:47 +0000
@@ -1467,13 +1467,15 @@
 }
 
 
-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;
@@ -1498,21 +1500,36 @@
   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];
     }
@@ -1521,6 +1538,7 @@
       [panel setCanChooseDirectories: YES];
       ret = [panel runModalForDirectory: dirS file: initS types: nil];
     }
+#endif
 
   ret = (ret == NSOKButton) || panelOK;
 

=== modified file 'src/w32fns.c'
--- a/src/w32fns.c      2012-09-23 08:44:20 +0000
+++ b/src/w32fns.c      2012-09-30 13:43:47 +0000
@@ -5945,7 +5945,7 @@
 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)

=== modified file 'src/xfns.c'
--- a/src/xfns.c        2012-09-24 21:38:23 +0000
+++ b/src/xfns.c        2012-09-30 13:43:47 +0000
@@ -5344,7 +5344,7 @@
 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)
@@ -5517,7 +5517,7 @@
 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)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]