comparison src/w32fns.c @ 90195:a1b34dec1104

Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-63 Merge from emacs--cvs-trunk--0 Patches applied: * emacs--cvs-trunk--0 (patch 358-423) - Update from CVS - Remove "-face" suffix from widget faces - Remove "-face" suffix from custom faces - Remove "-face" suffix from change-log faces - Remove "-face" suffix from compilation faces - Remove "-face" suffix from diff-mode faces - lisp/longlines.el (longlines-visible-face): Face removed - Remove "-face" suffix from woman faces - Remove "-face" suffix from whitespace-highlight face - Remove "-face" suffix from ruler-mode faces - Remove "-face" suffix from show-paren faces - Remove "-face" suffix from log-view faces - Remove "-face" suffix from smerge faces - Remove "-face" suffix from show-tabs faces - Remove "-face" suffix from highlight-changes faces - Remove "-face" suffix from and downcase info faces - Remove "-face" suffix from pcvs faces - Update uses of renamed pcvs faces - Tweak ChangeLog - Remove "-face" suffix from strokes-char face - Remove "-face" suffix from compare-windows face - Remove "-face" suffix from calendar faces - Remove "-face" suffix from diary-button face - Remove "-face" suffix from testcover faces - Remove "-face" suffix from viper faces - Remove "-face" suffix from org faces - Remove "-face" suffix from sgml-namespace face - Remove "-face" suffix from table-cell face - Remove "-face" suffix from tex-mode faces - Remove "-face" suffix from texinfo-heading face - Remove "-face" suffix from flyspell faces - Remove "-face" suffix from gomoku faces - Remove "-face" suffix from mpuz faces - Merge from gnus--rel--5.10 - Remove "-face" suffix from Buffer-menu-buffer face - Remove "-face" suffix from antlr-mode faces - Remove "-face" suffix from ebrowse faces - Remove "-face" suffix from flymake faces - Remove "-face" suffix from idlwave faces - Remove "-face" suffix from sh-script faces - Remove "-face" suffix from vhdl-mode faces - Remove "-face" suffix from which-func face - Remove "-face" suffix from cperl-mode faces - Remove "-face" suffix from ld-script faces - Fix cperl-mode font-lock problem - Tweak which-func face * gnus--rel--5.10 (patch 80-82) - Merge from emacs--cvs-trunk--0 - Update from CVS
author Miles Bader <miles@gnu.org>
date Wed, 15 Jun 2005 23:32:15 +0000
parents cb67264d6096 abe4cbe0bdef
children b7da78284d4c
comparison
equal deleted inserted replaced
90194:d940db5a66b9 90195:a1b34dec1104
7819 } 7819 }
7820 } 7820 }
7821 return 0; 7821 return 0;
7822 } 7822 }
7823 7823
7824 /* Since we compile with _WIN32_WINNT set to 0x0400 (for NT4 compatibility)
7825 we end up with the old file dialogs. Define a big enough struct for the
7826 new dialog to trick GetOpenFileName into giving us the new dialogs on
7827 Windows 2000 and XP. */
7828 typedef struct
7829 {
7830 OPENFILENAME real_details;
7831 void * pReserved;
7832 DWORD dwReserved;
7833 DWORD FlagsEx;
7834 } NEWOPENFILENAME;
7835
7836
7824 DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 5, 0, 7837 DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 5, 0,
7825 doc: /* Read file name, prompting with PROMPT in directory DIR. 7838 doc: /* Read file name, prompting with PROMPT in directory DIR.
7826 Use a file selection dialog. 7839 Use a file selection dialog.
7827 Select DEFAULT-FILENAME in the dialog's file selection box, if 7840 Select DEFAULT-FILENAME in the dialog's file selection box, if
7828 specified. Ensure that file exists if MUSTMATCH is non-nil. 7841 specified. Ensure that file exists if MUSTMATCH is non-nil.
7867 } 7880 }
7868 else 7881 else
7869 filename[0] = '\0'; 7882 filename[0] = '\0';
7870 7883
7871 { 7884 {
7872 OPENFILENAME file_details; 7885 NEWOPENFILENAME new_file_details;
7873 7886 BOOL file_opened = FALSE;
7887 OPENFILENAME * file_details = &new_file_details.real_details;
7888
7874 /* Prevent redisplay. */ 7889 /* Prevent redisplay. */
7875 specbind (Qinhibit_redisplay, Qt); 7890 specbind (Qinhibit_redisplay, Qt);
7876 BLOCK_INPUT; 7891 BLOCK_INPUT;
7877 7892
7878 bzero (&file_details, sizeof (file_details)); 7893 bzero (&new_file_details, sizeof (new_file_details));
7879 file_details.lStructSize = sizeof (file_details); 7894 /* Apparently NT4 crashes if you give it an unexpected size.
7880 file_details.hwndOwner = FRAME_W32_WINDOW (f); 7895 I'm not sure about Windows 9x, so play it safe. */
7896 if (w32_major_version > 4 && w32_major_version < 95)
7897 file_details->lStructSize = sizeof (new_file_details);
7898 else
7899 file_details->lStructSize = sizeof (file_details);
7900
7901 file_details->hwndOwner = FRAME_W32_WINDOW (f);
7881 /* Undocumented Bug in Common File Dialog: 7902 /* Undocumented Bug in Common File Dialog:
7882 If a filter is not specified, shell links are not resolved. */ 7903 If a filter is not specified, shell links are not resolved. */
7883 file_details.lpstrFilter = "All Files (*.*)\0*.*\0Directories\0*|*\0\0"; 7904 file_details->lpstrFilter = "All Files (*.*)\0*.*\0Directories\0*|*\0\0";
7884 file_details.lpstrFile = filename; 7905 file_details->lpstrFile = filename;
7885 file_details.nMaxFile = sizeof (filename); 7906 file_details->nMaxFile = sizeof (filename);
7886 file_details.lpstrInitialDir = init_dir; 7907 file_details->lpstrInitialDir = init_dir;
7887 file_details.lpstrTitle = SDATA (prompt); 7908 file_details->lpstrTitle = SDATA (prompt);
7888 7909
7889 if (! NILP (only_dir_p)) 7910 if (! NILP (only_dir_p))
7890 default_filter_index = 2; 7911 default_filter_index = 2;
7891 7912
7892 file_details.nFilterIndex = default_filter_index; 7913 file_details->nFilterIndex = default_filter_index;
7893 7914
7894 file_details.Flags = (OFN_HIDEREADONLY | OFN_NOCHANGEDIR 7915 file_details->Flags = (OFN_HIDEREADONLY | OFN_NOCHANGEDIR
7895 | OFN_EXPLORER | OFN_ENABLEHOOK); 7916 | OFN_EXPLORER | OFN_ENABLEHOOK);
7896 if (!NILP (mustmatch)) 7917 if (!NILP (mustmatch))
7897 file_details.Flags |= OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST; 7918 {
7898 7919 /* Require that the path to the parent directory exists. */
7899 file_details.lpfnHook = (LPOFNHOOKPROC) file_dialog_callback; 7920 file_details->Flags |= OFN_PATHMUSTEXIST;
7900 7921 /* If we are looking for a file, require that it exists. */
7901 if (GetOpenFileName (&file_details)) 7922 if (NILP (only_dir_p))
7923 file_details->Flags |= OFN_FILEMUSTEXIST;
7924 }
7925
7926 file_details->lpfnHook = (LPOFNHOOKPROC) file_dialog_callback;
7927
7928 file_opened = GetOpenFileName (file_details);
7929
7930 UNBLOCK_INPUT;
7931
7932 if (file_opened)
7902 { 7933 {
7903 dostounix_filename (filename); 7934 dostounix_filename (filename);
7904 if (file_details.nFilterIndex == 2) 7935
7936 if (file_details->nFilterIndex == 2)
7905 { 7937 {
7906 /* "Directories" selected - strip dummy file name. */ 7938 /* "Directories" selected - strip dummy file name. */
7907 char * last = strrchr (filename, '/'); 7939 char * last = strrchr (filename, '/');
7908 *last = '\0'; 7940 *last = '\0';
7909 } 7941 }
7917 else 7949 else
7918 file = Fcompleting_read (prompt, intern ("read-file-name-internal"), 7950 file = Fcompleting_read (prompt, intern ("read-file-name-internal"),
7919 dir, mustmatch, dir, Qfile_name_history, 7951 dir, mustmatch, dir, Qfile_name_history,
7920 default_filename, Qnil); 7952 default_filename, Qnil);
7921 7953
7922 UNBLOCK_INPUT;
7923 file = unbind_to (count, file); 7954 file = unbind_to (count, file);
7924 } 7955 }
7925 7956
7926 UNGCPRO; 7957 UNGCPRO;
7927 7958
8758 w32_strict_fontnames = 0; 8789 w32_strict_fontnames = 0;
8759 8790
8760 DEFVAR_BOOL ("w32-strict-painting", 8791 DEFVAR_BOOL ("w32-strict-painting",
8761 &w32_strict_painting, 8792 &w32_strict_painting,
8762 doc: /* Non-nil means use strict rules for repainting frames. 8793 doc: /* Non-nil means use strict rules for repainting frames.
8763 Set this to nil to get the old behaviour for repainting; this should 8794 Set this to nil to get the old behavior for repainting; this should
8764 only be necessary if the default setting causes problems. */); 8795 only be necessary if the default setting causes problems. */);
8765 w32_strict_painting = 1; 8796 w32_strict_painting = 1;
8766 8797
8767 DEFVAR_LISP ("w32-charset-info-alist", 8798 DEFVAR_LISP ("w32-charset-info-alist",
8768 &Vw32_charset_info_alist, 8799 &Vw32_charset_info_alist,
8951 w32_ansi_code_page = GetACP (); 8982 w32_ansi_code_page = GetACP ();
8952 } 8983 }
8953 8984
8954 #undef abort 8985 #undef abort
8955 8986
8987 void w32_abort (void) NO_RETURN;
8988
8956 void 8989 void
8957 w32_abort() 8990 w32_abort()
8958 { 8991 {
8959 int button; 8992 int button;
8960 button = MessageBox (NULL, 8993 button = MessageBox (NULL,
8961 "A fatal error has occurred!\n\n" 8994 "A fatal error has occurred!\n\n"
8962 "Select Abort to exit, Retry to debug, Ignore to continue", 8995 "Would you like to attach a debugger?\n\n"
8996 "Select YES to debug, NO to abort Emacs",
8963 "Emacs Abort Dialog", 8997 "Emacs Abort Dialog",
8964 MB_ICONEXCLAMATION | MB_TASKMODAL 8998 MB_ICONEXCLAMATION | MB_TASKMODAL
8965 | MB_SETFOREGROUND | MB_ABORTRETRYIGNORE); 8999 | MB_SETFOREGROUND | MB_YESNO);
8966 switch (button) 9000 switch (button)
8967 { 9001 {
8968 case IDRETRY: 9002 case IDYES:
8969 DebugBreak (); 9003 DebugBreak ();
8970 break; 9004 exit (2); /* tell the compiler we will never return */
8971 case IDIGNORE: 9005 case IDNO:
8972 break;
8973 case IDABORT:
8974 default: 9006 default:
8975 abort (); 9007 abort ();
8976 break; 9008 break;
8977 } 9009 }
8978 } 9010 }