From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: David PONCE Newsgroups: gmane.emacs.devel Subject: (W32) Select a directory using the file selection dialog Date: Tue, 8 Apr 2003 11:08:49 +0200 (CEST) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <16097356.1049792929727.JavaMail.www@wwinf9802> Reply-To: david.ponce@wanadoo.fr NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1049793435 29018 80.91.224.249 (8 Apr 2003 09:17:15 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 8 Apr 2003 09:17:15 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Tue Apr 08 11:17:12 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 192pE8-0007Xj-00 for ; Tue, 08 Apr 2003 11:17:12 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 192pI3-0003Qj-00 for ; Tue, 08 Apr 2003 11:21:15 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 192pAz-0002tY-04 for emacs-devel@quimby.gnus.org; Tue, 08 Apr 2003 05:13:57 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 192pA9-0002im-00 for emacs-devel@gnu.org; Tue, 08 Apr 2003 05:13:05 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 192p9O-0001RE-00 for emacs-devel@gnu.org; Tue, 08 Apr 2003 05:12:21 -0400 Original-Received: from smtp4.wanadoo.fr ([193.252.22.28] helo=mwinf0304.wanadoo.fr) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 192p65-00081C-00 for emacs-devel@gnu.org; Tue, 08 Apr 2003 05:08:53 -0400 Original-Received: from wwinf9802 (wwinf9802 [172.22.150.29]) by mwinf0304.wanadoo.fr (SMTP Server) with ESMTP id B44B7A802669 for ; Tue, 8 Apr 2003 11:08:49 +0200 (CEST) Original-To: emacs-devel X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:13020 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:13020 Hi All, For now, it is impossible to select a directory using the file selection dialog. A consequence is that, for example, it is impossible to use the menu "Tools"/"PCL-CVS"/"Examine Directory", when it displays the file selection dialog to select a directory. I submit you the following patch to w32fns.c to allow directory selection through the file selection dialog. Tested: In GNU Emacs 21.3.50.1 (i386-mingw-nt4.0.1381) of 2003-04-08 configured using `configure --with-gcc (3.2)' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: ENU locale-coding-system: iso-latin-1 default-enable-multibyte-characters: t Hope it will help. Sincerely, David 2003-04-08 David Ponce * w32fns.c (TYPE_FILTERS_COMBO_FIELD): New define. (Qfile_directory_p, Vread_file_name_predicate): Declare extern. (file_dialog_callback): Allow directory selection. Index: src/w32fns.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/w32fns.c,v retrieving revision 1.215 diff -c -r1.215 w32fns.c *** src/w32fns.c 31 Mar 2003 21:16:55 -0000 1.215 --- src/w32fns.c 8 Apr 2003 08:33:44 -0000 *************** *** 54,59 **** --- 54,60 ---- #include #define FILE_NAME_TEXT_FIELD edt1 + #define TYPE_FILTERS_COMBO_FIELD cmb1 void syms_of_w32fns (); void globals_of_w32fns (); *************** *** 13278,13283 **** --- 13279,13286 ---- File selection dialog ***********************************************************************/ extern Lisp_Object Qfile_name_history; + extern Lisp_Object Qfile_directory_p; + extern Lisp_Object Vread_file_name_predicate; /* Callback for altering the behaviour of the Open File dialog. Makes the Filename text field contain "Current Directory" and be *************** *** 13294,13308 **** if (msg == WM_NOTIFY) { OFNOTIFY * notify = (OFNOTIFY *)lParam; /* Detect when the Filter dropdown is changed. */ ! if (notify->hdr.code == CDN_TYPECHANGE) { ! HWND dialog = GetParent (hwnd); ! HWND edit_control = GetDlgItem (dialog, FILE_NAME_TEXT_FIELD); /* Directories is in index 2. */ if (notify->lpOFN->nFilterIndex == 2) { CommDlg_OpenSave_SetControlText (dialog, FILE_NAME_TEXT_FIELD, "Current Directory"); EnableWindow (edit_control, FALSE); --- 13297,13333 ---- if (msg == WM_NOTIFY) { OFNOTIFY * notify = (OFNOTIFY *)lParam; + HWND dialog, edit_control; + if (notify->hdr.code == CDN_INITDONE) + { + /* Directory selection only. */ + if (EQ (Vread_file_name_predicate, Qfile_directory_p)) + { + notify->lpOFN->nFilterIndex = 2; + strcpy (notify->lpOFN->lpstrFile, "Current Directory"); + /* Reset the OFN_FILEMUSTEXIST flags because the dummy + filename "Current Directory" don't need to exist! */ + notify->lpOFN->Flags &= ~OFN_FILEMUSTEXIST; + /* Disallow change of filename and type filter. */ + dialog = GetParent (hwnd); + edit_control = GetDlgItem (dialog, FILE_NAME_TEXT_FIELD); + EnableWindow (edit_control, FALSE); + edit_control = GetDlgItem (dialog, TYPE_FILTERS_COMBO_FIELD); + EnableWindow (edit_control, FALSE); + } + } /* Detect when the Filter dropdown is changed. */ ! else if (notify->hdr.code == CDN_TYPECHANGE) { ! dialog = GetParent (hwnd); ! edit_control = GetDlgItem (dialog, FILE_NAME_TEXT_FIELD); /* Directories is in index 2. */ if (notify->lpOFN->nFilterIndex == 2) { + /* Reset the OFN_FILEMUSTEXIST flags because the dummy + filename "Current Directory" don't need to exist! */ + notify->lpOFN->Flags &= ~OFN_FILEMUSTEXIST; CommDlg_OpenSave_SetControlText (dialog, FILE_NAME_TEXT_FIELD, "Current Directory"); EnableWindow (edit_control, FALSE);