Mercurial > hg > xemacs-beta
changeset 673:685b588e92d8
[xemacs-hg @ 2001-10-30 05:13:26 by andyp]
merge of windows 21.4.5 codeline
author | andyp |
---|---|
date | Tue, 30 Oct 2001 05:13:31 +0000 |
parents | 42a8626b741e |
children | a05e8cd20cce |
files | lisp/ChangeLog lisp/code-files.el lisp/dialog.el lisp/minibuf.el lisp/package-net.el lisp/toolbar-items.el netinstall/ChangeLog netinstall/Makefile.in.in netinstall/localdir.cc netinstall/log.cc netinstall/msg.cc netinstall/net.cc netinstall/res.rc netinstall/resource.h netinstall/source.cc src/ChangeLog src/dialog-msw.c src/event-msw.c src/general-slots.h src/scrollbar-msw.c src/syswindows.h src/win32.c |
diffstat | 22 files changed, 404 insertions(+), 98 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Fri Oct 26 02:42:53 2001 +0000 +++ b/lisp/ChangeLog Tue Oct 30 05:13:31 2001 +0000 @@ -1,3 +1,18 @@ +2001-10-29 Andy Piper <andy@xemacs.org> + + * code-files.el (toggle-buffer-file-coding-system): mark buffer as + modified when changing coding system. + + * toolbar-items.el (toolbar-dired): Use interactive "D" spec so + that we invoke the GUI directory selector. + +2001-10-25 Andy Piper <andy@xemacs.org> + + * dialog.el (make-dialog-box): use new directory dialog support. + * minibuf.el (read-file-name-1): ditto. + (read-file-name): ditto. + (read-directory-name): ditto. + 2001-09-28 Ben Wing <ben@xemacs.org> * font-lock.el:
--- a/lisp/code-files.el Fri Oct 26 02:42:53 2001 +0000 +++ b/lisp/code-files.el Tue Oct 30 05:13:31 2001 +0000 @@ -116,7 +116,8 @@ (coding-system-base buffer-file-coding-system) (cond ((eq eol-type 'lf) 'crlf) ((eq eol-type 'crlf) 'lf) - ((eq eol-type 'cr) 'lf)))))) + ((eq eol-type 'cr) 'lf)))) + (set-buffer-modified-p t))) (define-obsolete-function-alias 'set-file-coding-system
--- a/lisp/dialog.el Fri Oct 26 02:42:53 2001 +0000 +++ b/lisp/dialog.el Tue Oct 30 05:13:31 2001 +0000 @@ -262,6 +262,18 @@ --------------------------------------------------------------------------- +For type `directory': + +The keywords allowed are + +:initial-directory + The initial directory to be selected in the dialog box (defaults to the + current buffer's `default-directory). +:title + The title of the dialog box (defaults to \"Open\"). + +--------------------------------------------------------------------------- + For type `print': This invokes the Windows standard Print dialog.
--- a/lisp/minibuf.el Fri Oct 26 02:42:53 2001 +0000 +++ b/lisp/minibuf.el Tue Oct 30 05:13:31 2001 +0000 @@ -1664,22 +1664,22 @@ :activate-callback 'read-file-name-activate-callback) (goto-char (point-min) completion-buf))))) -(defun read-file-name-1 (history prompt dir default - must-match initial-contents - completer) +(defun read-file-name-1 (type history prompt dir default + must-match initial-contents + completer) (if (should-use-dialog-box-p) (condition-case nil (let ((file (apply #'make-dialog-box - 'file `(:title ,(capitalize-string-as-title - ;; Kludge: Delete ": " off the end. - (replace-in-string prompt ": $" "")) - ,@(and dir (list :initial-directory - dir)) - :file-must-exist ,must-match - ,@(and initial-contents - (list :initial-filename - initial-contents)))))) + type `(:title ,(capitalize-string-as-title + ;; Kludge: Delete ": " off the end. + (replace-in-string prompt ": $" "")) + ,@(and dir (list :initial-directory + dir)) + :file-must-exist ,must-match + ,@(and initial-contents + (list :initial-filename + initial-contents)))))) ;; hack -- until we implement reading a directory properly, ;; allow a file as indicating the directory it's in (if (and (eq completer 'read-directory-name-internal) @@ -1730,8 +1730,8 @@ Sixth arg HISTORY specifies the history list to use. Default is `file-name-history'. DIR defaults to current buffer's directory default." - (read-file-name-1 - (or history 'file-name-history) + (read-file-name-1 + 'file (or history 'file-name-history) prompt dir (or default (and initial-contents (abbreviate-file-name (expand-file-name @@ -1761,9 +1761,9 @@ `file-name-history'. DIR defaults to current buffer's directory default." (read-file-name-1 - (or history 'file-name-history) - prompt dir (or default default-directory) must-match initial-contents - 'read-directory-name-internal)) + 'directory (or history 'file-name-history) + prompt dir (or default default-directory) must-match initial-contents + 'read-directory-name-internal)) ;; Environment-variable and ~username completion hack
--- a/lisp/package-net.el Fri Oct 26 02:42:53 2001 +0000 +++ b/lisp/package-net.el Tue Oct 30 05:13:31 2001 +0000 @@ -55,32 +55,9 @@ ;; ;; 3. For package releases that's all you need to do. For binary ;; releases you need to build both cygwin and win32 binaries and put -;; them in appropriate tarballs: -;; -;; For cygwin, configure, make and install and then do (this is for -;; 21.1.13): -;; -;; cd <install dir> -;; tar cvzf xemacs-i686-pc-cygwin32-21.1.13.tar.gz \ -;; ./bin/i686-pc-cygwin32 ./lib/xemacs-21.1.13 \ -;; ./lib/xemacs/lock ./man/man1/xemacs.1 \ -;; ./man/man1/ctags.1 ./man/man1/gnu*.1' +;; them in appropriate tarballs: This can be achieved by running +;; build-msw-release.sh ;; -;; Note that the naming of the package is important. Don't be tempted -;; to change the order in any way. -;; -;; For win32 build and install the release and then (again for -;; 21.1.13): -;; -;; cd <install dir> -;; tar cvzf xemacs-i386-pc-win32-21.1.13.tar.gz ./XEmacs-21.1.13 -;; -;; The binaries should be uploaded to -;; `ftp://ftp.xemacs.org/pub/xemacs/binaries/cygwin32' and -;; `ftp://ftp.xemacs.org/pub/xemacs/binaries/win32' respectively. Take -;; a note of their sizes and set `package-net-cygwin32-binary-size' -;; and `package-net-win32-binary-size' appropriately in this file and -;; then follow step 2. (require 'package-admin) (require 'package-get) @@ -99,12 +76,15 @@ ;; ;; 2. Generating setup.ini should be more automatic. -(defvar package-net-cygwin32-binary-size 6917126 +(defvar package-net-cygwin32-binary-size 0 "The size in bytes of the cygwin32 binary distribution.") -(defvar package-net-win32-binary-size 6563941 +(defvar package-net-win32-binary-size 0 "The size in bytes of the win32 binary distribution.") +(defvar package-net-setup-version "1.0" + "The version string of setup.") + ;;;###autoload (defun package-net-setup-directory () (file-truename (concat data-directory "../../" (if (eq system-type 'cygwin32) @@ -171,14 +151,48 @@ (write-region (point-min) (point-max) (concat destdir "setup.ini"))) (kill-buffer buf)))) -(defun package-net-batch-convert-index-to-ini () + +(defun package-net-generate-bin-ini (&optional version) + "Convert the package index to ini file format in the current directory." + (let ((buf (get-buffer-create "*setup-bin.ini*"))) + (unwind-protect + (save-excursion + (set-buffer buf) + (erase-buffer buf) + (goto-char (point-min)) + (insert "# This file is automatically generated. If you edit it, your\n") + (insert "# edits will be discarded next time the file is generated.\n") + (insert "#\n\n") + (insert (format "setup-timestamp: %d\n" + (+ (* (car (current-time)) 65536) (car (cdr (current-time)))))) + (insert (format "setup-version: %s\n\n" (or version "1.0"))) + ;; Native version + (insert (format "@ %s\n" "xemacs-i586-pc-win32")) + (insert (format "version: %s\n" emacs-program-version)) + (insert "type: native\n") + (insert (format "install: win32/%s %d\n\n" + (concat emacs-program-name + "-i586-pc-win32-" + emacs-program-version ".tar.gz") + package-net-win32-binary-size)) + ;; Cygwin version + (insert (format "@ %s\n" "xemacs-i686-pc-cygwin")) + (insert (format "version: %s\n" emacs-program-version)) + (insert "type: cygwin\n") + (insert (format "install: cygwin32/%s %d\n\n" + (concat emacs-program-name + "-i686-pc-cygwin-" + emacs-program-version ".tar.gz") + package-net-cygwin32-binary-size)) + (insert "# setup.ini file ends here\n") + (write-region (point-min) (point-max) "setup-bin.ini"))) + (kill-buffer buf))) + +(defun package-net-batch-generate-bin-ini () "Convert the package index to ini file format." (unless noninteractive - (error "`package-net-batch-convert-index-to-ini' is to be used only with -batch")) - (let ((dir (car command-line-args-left)) - (version (car (cdr command-line-args-left))) - (package-get-require-signed-base-updates nil)) - (package-net-convert-index-to-ini dir nil version))) + (error "`package-net-batch-generate-bin-ini' is to be used only with -batch")) + (package-net-generate-bin-ini package-net-setup-version)) ;;;###autoload (defun package-net-update-installed-db (&optional destdir)
--- a/lisp/toolbar-items.el Fri Oct 26 02:42:53 2001 +0000 +++ b/lisp/toolbar-items.el Tue Oct 30 05:13:31 2001 +0000 @@ -71,9 +71,9 @@ (function :tag "Other")) :group 'toolbar) -(defun toolbar-dired () - (interactive) - (call-interactively toolbar-dired-function)) +(defun toolbar-dired (dir) + (interactive "DDired directory: ") + (funcall toolbar-dired-function dir)) (defcustom toolbar-save-function 'save-buffer "*Function to call when the save icon is selected."
--- a/netinstall/ChangeLog Fri Oct 26 02:42:53 2001 +0000 +++ b/netinstall/ChangeLog Tue Oct 30 05:13:31 2001 +0000 @@ -1,3 +1,30 @@ +2001-10-27 Andy Piper <andy@xemacs.org> + + * localdir.cc (dialog_cmd): allow download directory to be + created. + * log.cc (exit_setup): cygwin -> XEmacs + * net.cc (dialog_cmd): + (dialog_proc): + (do_net): sync with cygwin installer. + * res.rc: + * resource.h (IDS_CREATE_DIR): new. + * source.cc (load_dialog): + (save_dialog): + (dialog_cmd): + (dialog_proc): + (do_source): sync with cygwin installer. + * uninstall.cc (progress): remove log message. + * Makefile.in.in: generated setup-bin.ini correctly. + +2001-10-25 Andy Piper <andy@xemacs.org> + + * Merge 21.5 codeline. + +2001-10-25 Andy Piper <andy@xemacs.org> + + * setup.mak (OBJS): minor build fixes. + (distclean): + 2001-10-25 Andy Piper <andy@xemacs.org> * desktop.cc: @@ -322,6 +349,7 @@ * all: port from cygwin setup. -%%% $Id: ChangeLog,v 1.9 2001/10/26 02:42:53 andyp Exp $ -$Revision: 1.9 $ +%%% $Id: ChangeLog,v 1.10 2001/10/30 05:13:28 andyp Exp $ +$Revision: 1.10 $ +
--- a/netinstall/Makefile.in.in Fri Oct 26 02:42:53 2001 +0000 +++ b/netinstall/Makefile.in.in Tue Oct 30 05:13:31 2001 +0000 @@ -94,6 +94,9 @@ PROGS = setup.exe XEMACS=${blddir}/src/${PROGNAME} +CYGWIN_SIZE=0 +WIN32_SIZE=0 + CONFIG_H = ../src/config.h OBJS = \ @@ -153,12 +156,15 @@ -L$(MINGW_ZLIB_DIR) -lz -lmingw32 @chmod a-x $@ -setup-bin.ini: setup.exe +setup-bin.ini: V=`grep '^\$$Revision.*' $(srcdir)/ChangeLog \ - | sed -e 's/\$$Revision:* *//' \ - -e 's/ *$$.*//'` ;\ - $(XEMACS) -batch -vanilla -l ${srcdir}/../lisp/package-net.el \ - -f package-net-batch-generate-bin-ini . $$V + | sed -e 's/\$$Revision:* *//' -e 's/ *$$.*//'` ;\ + $(XEMACS) -batch -vanilla \ + -eval '(setq package-net-cygwin32-binary-size $(CYGWIN_SIZE) \ + package-net-win32-binary-size $(WIN32_SIZE) \ + package-net-setup-version "'$$V'")' \ + -l ${srcdir}/../lisp/package-net.el \ + -f package-net-batch-generate-bin-ini install: @echo; echo "Installing net setup." @@ -193,7 +199,7 @@ .PHONY: mostlyclean clean distclean realclean extraclean mostlyclean: - $(RM) *.o *.i core $(PROGS) + $(RM) *.o *.i *.ini core $(PROGS) clean: mostlyclean
--- a/netinstall/localdir.cc Fri Oct 26 02:42:53 2001 +0000 +++ b/netinstall/localdir.cc Tue Oct 30 05:13:31 2001 +0000 @@ -12,6 +12,7 @@ * Written by Andrej Borsenkow <Andrej.Borsenkow@mow.siemens.ru> * based on work and suggestions of DJ Delorie * + * Sync'ed with cinstall 2001-10-16 */ /* The purpose of this file is to ask the user where they want the @@ -23,7 +24,9 @@ #include <stdio.h> #include <stdlib.h> #include <ctype.h> +#include <io.h> +#include "mkdir.h" #include "dialog.h" #include "resource.h" #include "state.h" @@ -102,6 +105,11 @@ case IDOK: save_dialog (h); + if (_access (local_dir, 0) != 0 && yesno (IDS_CREATE_DIR, local_dir) == IDYES) + { + log (0, "Created install directory %s\n", local_dir); + mkdir_p (1, local_dir); + } if (SetCurrentDirectoryA (local_dir)) { switch (source) @@ -132,7 +140,6 @@ NEXT (0); break; } - return FALSE; } static BOOL CALLBACK
--- a/netinstall/log.cc Fri Oct 26 02:42:53 2001 +0000 +++ b/netinstall/log.cc Tue Oct 30 05:13:31 2001 +0000 @@ -110,7 +110,7 @@ if (exit_msg) note (exit_msg); - log (LOG_TIMESTAMP, "Ending cygwin install"); + log (LOG_TIMESTAMP, "Ending XEmacs install"); if (source == IDC_SOURCE_DOWNLOAD || !root_dir) {
--- a/netinstall/msg.cc Fri Oct 26 02:42:53 2001 +0000 +++ b/netinstall/msg.cc Tue Oct 30 05:13:31 2001 +0000 @@ -16,8 +16,6 @@ /* The purpose of this file is to centralize all the message functions. */ -static char *cvsid = "\n%%% $Id: msg.cc,v 1.3 2001/04/13 09:11:35 michaels Exp $\n"; - #include "win32.h" #include <stdio.h> #include <stdarg.h>
--- a/netinstall/net.cc Fri Oct 26 02:42:53 2001 +0000 +++ b/netinstall/net.cc Tue Oct 30 05:13:31 2001 +0000 @@ -11,6 +11,7 @@ * * Written by DJ Delorie <dj@cygnus.com> * + * Sync'ed with cinstall 2001-10-16 */ /* The purpose of this file is to get the network configuration @@ -115,7 +116,6 @@ NEXT (0); break; } - return FALSE; } static BOOL CALLBACK @@ -125,6 +125,13 @@ { case WM_INITDIALOG: load_dialog (h); + + // Check to see if any radio buttons are selected. If not, select a default. + if ((!SendMessage(GetDlgItem (h, IDC_NET_IE5), BM_GETCHECK, 0, 0) == BST_CHECKED) + && (!SendMessage(GetDlgItem (h, IDC_NET_PROXY), BM_GETCHECK, 0, 0) == BST_CHECKED)) + { + SendMessage(GetDlgItem (h, IDC_NET_DIRECT), BM_CLICK, 0, 0); + } return FALSE; case WM_COMMAND: return HANDLE_WM_COMMAND (h, wParam, lParam, dialog_cmd); @@ -137,6 +144,7 @@ { int rv = 0; + net_method = IDC_NET_DIRECT; rv = DialogBox (h, MAKEINTRESOURCE (IDD_NET), 0, dialog_proc); if (rv == -1) fatal (IDS_DIALOG_FAILED);
--- a/netinstall/res.rc Fri Oct 26 02:42:53 2001 +0000 +++ b/netinstall/res.rc Tue Oct 30 05:13:31 2001 +0000 @@ -33,7 +33,7 @@ CAPTION "XEmacs Setup" FONT 8, "MS Sans Serif" BEGIN - PUSHBUTTON "Next >",IDOK,199,176,45,15,WS_DISABLED | WS_GROUP + PUSHBUTTON "Next >",IDOK,199,176,45,15, WS_GROUP PUSHBUTTON "Cancel",IDCANCEL,256,176,45,15 CONTROL "Download from the Internet",IDC_SOURCE_DOWNLOAD,"Button", BS_AUTORADIOBUTTON | WS_TABSTOP,127,102,152,10 @@ -516,11 +516,12 @@ IDS_ERR_OPEN_READ "Can't open %s for reading: %s" IDS_ROOT_ABSOLUTE "The install directory must be absolute, with both a drive letter and leading slash, like C:\\Cygwin" IDS_DOWNLOAD_COMPLETE "Download Complete" - IDS_CVSID "\n%%% $Id: res.rc,v 1.6 2001/10/26 02:42:53 andyp Exp $\n" + IDS_CVSID "\n%%% $Id: res.rc,v 1.7 2001/10/30 05:13:28 andyp Exp $\n" IDS_NOLOGFILE "Cannot open log file %s for writing" IDS_UNINSTALL_COMPLETE "Uninstalls complete." IDS_WININET "Unable to find or load the Internet Explorer 5 DLLs" IDS_ERR_CHDIR "Could not change dir to %s" + IDS_CREATE_DIR "The directory %s does not exist, create it?" IDS_OLD_SETUP_VERSION "This setup is version %s, but setup.ini claims version %s is available.\nYou might want to upgrade to get the latest features and bug fixes." IDS_DOWNLOAD_FAILED "Unable to download %s" IDS_DOWNLOAD_INCOMPLETE "Download Incomplete. Try again?"
--- a/netinstall/resource.h Fri Oct 26 02:42:53 2001 +0000 +++ b/netinstall/resource.h Tue Oct 30 05:13:31 2001 +0000 @@ -28,6 +28,7 @@ #define IDS_DOWNLOAD_INCOMPLETE 26 #define IDS_INSTALL_INCOMPLETE 27 #define IDS_ROOT_NOCYGWIN 28 +#define IDS_CREATE_DIR 29 #define IDD_ROOT 101 #define IDD_SOURCE 102 #define IDD_OTHER_URL 103
--- a/netinstall/source.cc Fri Oct 26 02:42:53 2001 +0000 +++ b/netinstall/source.cc Tue Oct 30 05:13:31 2001 +0000 @@ -11,6 +11,7 @@ * * Written by DJ Delorie <dj@cygnus.com> * + * Sync'ed with cinstall 2001-10-16 */ /* The purpose of this file is to manage the dialog box that lets the @@ -25,7 +26,7 @@ #include "msg.h" #include "log.h" -static int rb[] = { IDC_SOURCE_DOWNLOAD, IDC_SOURCE_NETINST, IDC_SOURCE_CWD, 0 }; +static int rb[] = { IDC_SOURCE_NETINST, IDC_SOURCE_DOWNLOAD, IDC_SOURCE_CWD, 0 }; static void check_if_enable_next (HWND h) @@ -36,13 +37,14 @@ static void load_dialog (HWND h) { + int i; rbset (h, rb, source); - check_if_enable_next (h); } static void save_dialog (HWND h) { + int i; source = rbget (h, rb); } @@ -56,7 +58,6 @@ case IDC_SOURCE_NETINST: case IDC_SOURCE_CWD: save_dialog (h); - check_if_enable_next (h); break; case IDOK: @@ -72,8 +73,10 @@ case IDCANCEL: NEXT (0); break; + + default: + break; } - return FALSE; } static BOOL CALLBACK @@ -83,6 +86,12 @@ { case WM_INITDIALOG: load_dialog (h); + // Check to see if any radio buttons are selected. If not, select a default. + if ((!SendMessage(GetDlgItem (h, IDC_SOURCE_DOWNLOAD), BM_GETCHECK, 0, 0) == BST_CHECKED) + && (!SendMessage(GetDlgItem (h, IDC_SOURCE_CWD), BM_GETCHECK, 0, 0) == BST_CHECKED)) + { + SendMessage(GetDlgItem (h, IDC_SOURCE_NETINST), BM_SETCHECK, BST_CHECKED, 0); + } return FALSE; case WM_COMMAND: return HANDLE_WM_COMMAND (h, wParam, lParam, dialog_cmd); @@ -94,6 +103,8 @@ do_source (HINSTANCE h) { int rv = 0; + /* source = IDC_SOURCE_CWD;*/ + source = IDC_SOURCE_NETINST; rv = DialogBox (h, MAKEINTRESOURCE (IDD_SOURCE), 0, dialog_proc); if (rv == -1) fatal (IDS_DIALOG_FAILED);
--- a/src/ChangeLog Fri Oct 26 02:42:53 2001 +0000 +++ b/src/ChangeLog Tue Oct 30 05:13:31 2001 +0000 @@ -1,3 +1,33 @@ +2001-10-26 Mike Alexander <mta@arbortext.com> + + * event-msw.c (slurper_free_shared_data_maybe): Free the pipe handle. + +2001-10-25 Andy Piper <andy@xemacs.org> + + * ChangeLog: + * dialog-msw.c (handle_directory_proc): new function. + (handle_directory_dialog_box): new fucntion. + (handle_file_dialog_box): use new directory dialog support. + (mswindows_make_dialog_box_internal): ditto. + * event-msw.c (mswindows_wnd_proc): minor fix to scrollbar event + handling. + (mswindows_find_frame): make global. + * fileio.c (Fexpand_file_name): build fix. + * general-slots.h: add Qdirectory. + * scrollbar-msw.c (mswindows_handle_scrollbar_event): fix focus + handling. + * syswindows.h (LOCAL_TO_WIN32_FILE_FORMAT): fix problem with + cygwin not leaving win32 paths unchanged. + * win32.c (Fmswindows_cygwin_to_win32_path): new function. Use the + cygwin runtime to do path conversion. + (Fmswindows_shell_execute): fix cygwin handling of URLs. + (syms_of_win32): add new function. + * window.c (window_loop): build fix. + +2001-10-15 Andy Piper <andy@xemacs.org> + + (Fmswindows_shell_execute): fix handling of URL's under cygwin. + 2001-08-30 Daiki Ueno <ueno@unixuser.org> * process-unix.c (unix_open_multicast_group): Remove too much
--- a/src/dialog-msw.c Fri Oct 26 02:42:53 2001 +0000 +++ b/src/dialog-msw.c Tue Oct 30 05:13:31 2001 +0000 @@ -332,14 +332,132 @@ { FRERR_BUFFERLENGTHZERO, "FRERR_BUFFERLENGTHZERO" }, }; +struct param_data { + char* fname; + char* unknown_fname; + int validate; +}; + +static int +CALLBACK handle_directory_proc (HWND hwnd, UINT msg, + LPARAM lParam, LPARAM lpData) +{ + TCHAR szDir[MAX_PATH]; + struct param_data* pd = (struct param_data*)lpData; + + switch(msg) { + case BFFM_INITIALIZED: + // WParam is TRUE since you are passing a path. + // It would be FALSE if you were passing a pidl. + SendMessage(hwnd, BFFM_SETSELECTION, TRUE, (LPARAM)pd->fname); + break; + + case BFFM_SELCHANGED: + // Set the status window to the currently selected path. + if (SHGetPathFromIDList((LPITEMIDLIST) lParam, szDir)) { + SendMessage(hwnd, BFFM_SETSTATUSTEXT, 0, (LPARAM)szDir); + } + break; + + case BFFM_VALIDATEFAILED: + if (pd->validate) + return TRUE; + else + pd->unknown_fname = xstrdup((char*)lParam); + break; + + default: + break; + } + return 0; +} + +static Lisp_Object +handle_directory_dialog_box (struct frame *f, Lisp_Object keys) +{ + Lisp_Object ret = Qnil; + BROWSEINFO bi; + LPITEMIDLIST pidl; + LPMALLOC pMalloc; + struct param_data pd; + + xzero(pd); + xzero(bi); + + bi.lParam = (LPARAM)&pd; + bi.hwndOwner = FRAME_MSWINDOWS_HANDLE (f); + bi.pszDisplayName = 0; + bi.pidlRoot = 0; + bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT | BIF_EDITBOX; + bi.lpfn = handle_directory_proc; + + LOCAL_FILE_FORMAT_TO_TSTR (Fexpand_file_name (build_string (""), Qnil), + (char*)pd.fname); + + { + EXTERNAL_PROPERTY_LIST_LOOP_3 (key, value, keys) + { + if (EQ (key, Q_title)) + { + CHECK_STRING (value); + LISP_STRING_TO_EXTERNAL (value, bi.lpszTitle, Qmswindows_tstr); + } + else if (EQ (key, Q_initial_directory)) + LOCAL_FILE_FORMAT_TO_TSTR (Fexpand_file_name (value, Qnil), + pd.fname); + else if (EQ (key, Q_initial_filename)) + ; /* do nothing */ + else if (EQ (key, Q_file_must_exist)) + { + if (!NILP (value)) { + pd.validate = TRUE; + bi.ulFlags |= BIF_VALIDATE; + } + else + bi.ulFlags &= ~BIF_VALIDATE; + } + else + invalid_constant ("Unrecognized directory-dialog keyword", key); + } + } + + if (SHGetMalloc(&pMalloc) == NOERROR) + { + pidl = SHBrowseForFolder(&bi); + if (pidl) { + TCHAR* szDir = alloca (MAX_PATH); + + if (SHGetPathFromIDList(pidl, szDir)) { + ret = tstr_to_local_file_format (szDir); + } + + pMalloc->lpVtbl->Free(pMalloc, pidl); + pMalloc->lpVtbl->Release(pMalloc); + return ret; + } + else if (pd.unknown_fname != 0) { + ret = tstr_to_local_file_format (pd.unknown_fname); + xfree(pd.unknown_fname); + } + + } + else + signal_error (Qdialog_box_error, + "Unable to create folder browser", + make_int (0)); + return ret; +} + static Lisp_Object handle_file_dialog_box (struct frame *f, Lisp_Object keys) { OPENFILENAME ofn; + char fnbuf[8000]; xzero (ofn); ofn.lStructSize = sizeof (ofn); + ofn.Flags = OFN_EXPLORER; ofn.hwndOwner = FRAME_MSWINDOWS_HANDLE (f); ofn.lpstrFile = fnbuf; ofn.nMaxFile = sizeof (fnbuf) / XETCHAR_SIZE; @@ -676,6 +794,8 @@ { if (EQ (type, Qfile)) return handle_file_dialog_box (f, keys); + else if (EQ (type, Qdirectory)) + return handle_directory_dialog_box (f, keys); else if (EQ (type, Qquestion)) return handle_question_dialog_box (f, keys); else if (EQ (type, Qprint))
--- a/src/event-msw.c Fri Oct 26 02:42:53 2001 +0000 +++ b/src/event-msw.c Tue Oct 30 05:13:31 2001 +0000 @@ -229,6 +229,7 @@ CloseHandle (s->hev_thread); CloseHandle (s->hev_caller); CloseHandle (s->hev_unsleep); + CloseHandle (s->hpipe); s->inuse_p = 0; } } @@ -2835,7 +2836,8 @@ MAKEPOINTS (lParam))) { GCPRO2 (emacs_event, fobj); - mswindows_pump_outstanding_events (); /* Can GC */ + if (UNBOUNDP(mswindows_pump_outstanding_events ())) /* Can GC */ + SendMessage (hwnd, WM_CANCELMODE, 0, 0); UNGCPRO; } else
--- a/src/general-slots.h Fri Oct 26 02:42:53 2001 +0000 +++ b/src/general-slots.h Tue Oct 30 05:13:31 2001 +0000 @@ -92,6 +92,7 @@ SYMBOL (Qdevice); SYMBOL_KEYWORD (Q_device); SYMBOL (Qdialog); +SYMBOL (Qdirectory); SYMBOL (Qdimension); SYMBOL (Qdisplay); SYMBOL (Qdoc_string);
--- a/src/scrollbar-msw.c Fri Oct 26 02:42:53 2001 +0000 +++ b/src/scrollbar-msw.c Tue Oct 30 05:13:31 2001 +0000 @@ -44,6 +44,7 @@ #define VERTICAL_SCROLLBAR_DRAG_HACK static int vertical_drag_in_progress = 0; +extern Lisp_Object mswindows_find_frame (HWND hwnd); /* As long as the HWND is around, the scrollbar instance must be GC-protected. We have gotten crashes, apparently from trying to access a dead, freed @@ -235,9 +236,9 @@ f = XFRAME (frame); } - /* SB_LINEDOWN == SB_CHARLEFT etc. This is the way they will - always be -- any Windows is binary compatible backward with - old programs. */ + /* SB_LINEDOWN == SB_CHARLEFT etc. This is the way they will + always be - any Windows is binary compatible backward with + old programs */ switch (code) {
--- a/src/syswindows.h Fri Oct 26 02:42:53 2001 +0000 +++ b/src/syswindows.h Tue Oct 30 05:13:31 2001 +0000 @@ -85,6 +85,7 @@ # define Status int # endif # include <mmsystem.h> +# include <shlobj.h> # include <shellapi.h> # include <ddeml.h> #endif @@ -122,6 +123,17 @@ #define PHYSICALOFFSETY 113 #endif +/* shlobj.h defines. */ +#ifndef BIF_EDITBOX +#define BIF_EDITBOX 0x10 +#endif +#ifndef BIF_VALIDATE +#define BIF_VALIDATE 0x20 +#endif +#ifndef BFFM_VALIDATEFAILED +#define BFFM_VALIDATEFAILED 3 +#endif + /* windows.h defines. */ #if defined (CYGWIN) && (CYGWIN_VERSION_DLL_MAJOR < 20) typedef NMHDR *LPNMHDR; @@ -261,12 +273,15 @@ is ASCII-compatible, and so these functions will work fine with \ this data. */ \ Lisp_Object ltwff1 = (path); \ - int ltwff2 = \ - cygwin_posix_to_win32_path_list_buf_size ((char *) \ - XSTRING_DATA (ltwff1)); \ - pathout = (Intbyte *) alloca (ltwff2); \ - cygwin_posix_to_win32_path_list ((char *) XSTRING_DATA (ltwff1), \ - (char *) pathout); \ + Intbyte* ltwffp = XSTRING_DATA (ltwff1); \ + if (isalpha (ltwffp[0]) && (IS_DEVICE_SEP (ltwffp[1]))) \ + pathout = ltwffp; \ + else { \ + int ltwff2 = \ + cygwin_posix_to_win32_path_list_buf_size ((char*)ltwffp); \ + pathout = (Intbyte *) alloca (ltwff2); \ + cygwin_posix_to_win32_path_list ((char*) ltwffp, (char*) pathout); \ + } \ } while (0) #else #define LOCAL_TO_WIN32_FILE_FORMAT(path, pathout) \
--- a/src/win32.c Fri Oct 26 02:42:53 2001 +0000 +++ b/src/win32.c Tue Oct 30 05:13:31 2001 +0000 @@ -183,8 +183,11 @@ /* Encode filename and current directory. */ Lisp_Object current_dir = Ffile_name_directory (document); char* path = NULL; +#ifdef CYGWIN + char* fname1, *fname2; + int pos, sz; +#endif char* doc = NULL; - Extbyte* f=0; int ret; struct gcpro gcpro1, gcpro2; @@ -198,25 +201,31 @@ /* Use mule and cygwin-safe APIs top get at file data. */ if (STRINGP (current_dir)) { - TO_EXTERNAL_FORMAT (LISP_STRING, current_dir, - C_STRING_ALLOCA, f, - Qfile_name); -#ifdef CYGWIN - CYGWIN_WIN32_PATH (f, path); -#else - path = f; -#endif + LOCAL_TO_WIN32_FILE_FORMAT (current_dir, path); } if (STRINGP (document)) { - TO_EXTERNAL_FORMAT (LISP_STRING, document, - C_STRING_ALLOCA, f, - Qfile_name); + doc = XSTRING_DATA (document); #ifdef CYGWIN - CYGWIN_WIN32_PATH (f, doc); -#else - doc = f; + if ((fname1 = strchr (doc, ':')) != NULL + && *++fname1 == '/' && *++fname1 == '/') + { + fname1++; + pos = fname1 - doc; + if (!(isalpha (fname1[0]) && (IS_DEVICE_SEP (fname1[1])))) + { + sz = cygwin_posix_to_win32_path_list_buf_size (fname1); + fname2 = alloca (sz + pos); + strncpy (fname2, doc, pos); + doc = fname2; + fname2 += pos; + cygwin_posix_to_win32_path_list (fname1, fname2); + } + } + else { + LOCAL_TO_WIN32_FILE_FORMAT (document, doc); + } #endif } @@ -249,6 +258,29 @@ return Qnil; } +#ifdef CYGWIN +DEFUN ("mswindows-cygwin-to-win32-path", Fmswindows_cygwin_to_win32_path, 1, 1, 0, /* +Get the cygwin environment to convert the Unix PATH to win32 format. +No expansion is performed, all conversion is done by the cygwin runtime. +*/ + (path)) +{ + Extbyte* f; + Intbyte* p; + CHECK_STRING (path); + + /* There appears to be a bug in the cygwin conversion routines in + that they are not idempotent. */ + p = XSTRING_DATA (path); + if (isalpha (p[0]) && (IS_DEVICE_SEP (p[1]))) + return path; + + /* Use mule and cygwin-safe APIs top get at file data. */ + LOCAL_TO_WIN32_FILE_FORMAT (path, f); + return build_ext_string (f, Qnative); +} +#endif + #if defined (WIN32_NATIVE) || defined (CYGWIN_BROKEN_SIGNALS) /* setitimer() does not exist on native MS Windows, and appears broken @@ -502,6 +534,9 @@ syms_of_win32 (void) { DEFSUBR (Fmswindows_shell_execute); +#ifdef CYGWIN + DEFSUBR (Fmswindows_cygwin_to_win32_path); +#endif } void