Mercurial > emacs
comparison src/w32fns.c @ 89945:59dcbfe97385
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-17
Merge from emacs--cvs-trunk--0
Patches applied:
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-417
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-419
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-420
Tweak permissions
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-421
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-430
Update from CVS
author | Miles Bader <miles@gnu.org> |
---|---|
date | Tue, 29 Jun 2004 16:46:06 +0000 |
parents | 4c90ffeb71c5 1b78563a75d6 |
children | 97905c4f1a42 |
comparison
equal
deleted
inserted
replaced
89944:ecb75580442e | 89945:59dcbfe97385 |
---|---|
7747 { | 7747 { |
7748 if (msg == WM_NOTIFY) | 7748 if (msg == WM_NOTIFY) |
7749 { | 7749 { |
7750 OFNOTIFY * notify = (OFNOTIFY *)lParam; | 7750 OFNOTIFY * notify = (OFNOTIFY *)lParam; |
7751 /* Detect when the Filter dropdown is changed. */ | 7751 /* Detect when the Filter dropdown is changed. */ |
7752 if (notify->hdr.code == CDN_TYPECHANGE) | 7752 if (notify->hdr.code == CDN_TYPECHANGE |
7753 || notify->hdr.code == CDN_INITDONE) | |
7753 { | 7754 { |
7754 HWND dialog = GetParent (hwnd); | 7755 HWND dialog = GetParent (hwnd); |
7755 HWND edit_control = GetDlgItem (dialog, FILE_NAME_TEXT_FIELD); | 7756 HWND edit_control = GetDlgItem (dialog, FILE_NAME_TEXT_FIELD); |
7756 | 7757 |
7757 /* Directories is in index 2. */ | 7758 /* Directories is in index 2. */ |
7761 "Current Directory"); | 7762 "Current Directory"); |
7762 EnableWindow (edit_control, FALSE); | 7763 EnableWindow (edit_control, FALSE); |
7763 } | 7764 } |
7764 else | 7765 else |
7765 { | 7766 { |
7766 CommDlg_OpenSave_SetControlText (dialog, FILE_NAME_TEXT_FIELD, | 7767 /* Don't override default filename on init done. */ |
7767 ""); | 7768 if (notify->hdr.code == CDN_TYPECHANGE) |
7769 CommDlg_OpenSave_SetControlText (dialog, | |
7770 FILE_NAME_TEXT_FIELD, ""); | |
7768 EnableWindow (edit_control, TRUE); | 7771 EnableWindow (edit_control, TRUE); |
7769 } | 7772 } |
7770 } | 7773 } |
7771 } | 7774 } |
7772 return 0; | 7775 return 0; |
7784 Lisp_Object file = Qnil; | 7787 Lisp_Object file = Qnil; |
7785 int count = SPECPDL_INDEX (); | 7788 int count = SPECPDL_INDEX (); |
7786 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; | 7789 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; |
7787 char filename[MAX_PATH + 1]; | 7790 char filename[MAX_PATH + 1]; |
7788 char init_dir[MAX_PATH + 1]; | 7791 char init_dir[MAX_PATH + 1]; |
7792 int default_filter_index = 1; /* 1: All Files, 2: Directories only */ | |
7789 | 7793 |
7790 GCPRO5 (prompt, dir, default_filename, mustmatch, file); | 7794 GCPRO5 (prompt, dir, default_filename, mustmatch, file); |
7791 CHECK_STRING (prompt); | 7795 CHECK_STRING (prompt); |
7792 CHECK_STRING (dir); | 7796 CHECK_STRING (dir); |
7793 | 7797 |
7807 | 7811 |
7808 file_name_only = strrchr (full_path_name, '\\'); | 7812 file_name_only = strrchr (full_path_name, '\\'); |
7809 if (!file_name_only) | 7813 if (!file_name_only) |
7810 file_name_only = full_path_name; | 7814 file_name_only = full_path_name; |
7811 else | 7815 else |
7812 { | 7816 file_name_only++; |
7813 file_name_only++; | |
7814 } | |
7815 | 7817 |
7816 strncpy (filename, file_name_only, MAX_PATH); | 7818 strncpy (filename, file_name_only, MAX_PATH); |
7817 filename[MAX_PATH] = '\0'; | 7819 filename[MAX_PATH] = '\0'; |
7818 } | 7820 } |
7819 else | 7821 else |
7834 file_details.lpstrFilter = "All Files (*.*)\0*.*\0Directories\0*|*\0\0"; | 7836 file_details.lpstrFilter = "All Files (*.*)\0*.*\0Directories\0*|*\0\0"; |
7835 file_details.lpstrFile = filename; | 7837 file_details.lpstrFile = filename; |
7836 file_details.nMaxFile = sizeof (filename); | 7838 file_details.nMaxFile = sizeof (filename); |
7837 file_details.lpstrInitialDir = init_dir; | 7839 file_details.lpstrInitialDir = init_dir; |
7838 file_details.lpstrTitle = SDATA (prompt); | 7840 file_details.lpstrTitle = SDATA (prompt); |
7841 | |
7842 /* If prompt starts with Dired, default to directories only. */ | |
7843 /* A bit hacky, but there doesn't seem to be a better way to | |
7844 DTRT for dired. */ | |
7845 if (strncmp (file_details.lpstrTitle, "Dired", 5) == 0) | |
7846 default_filter_index = 2; | |
7847 | |
7848 file_details.nFilterIndex = default_filter_index; | |
7849 | |
7839 file_details.Flags = (OFN_HIDEREADONLY | OFN_NOCHANGEDIR | 7850 file_details.Flags = (OFN_HIDEREADONLY | OFN_NOCHANGEDIR |
7840 | OFN_EXPLORER | OFN_ENABLEHOOK); | 7851 | OFN_EXPLORER | OFN_ENABLEHOOK); |
7841 if (!NILP (mustmatch)) | 7852 if (!NILP (mustmatch)) |
7842 file_details.Flags |= OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST; | 7853 file_details.Flags |= OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST; |
7843 | 7854 |
7846 if (GetOpenFileName (&file_details)) | 7857 if (GetOpenFileName (&file_details)) |
7847 { | 7858 { |
7848 dostounix_filename (filename); | 7859 dostounix_filename (filename); |
7849 if (file_details.nFilterIndex == 2) | 7860 if (file_details.nFilterIndex == 2) |
7850 { | 7861 { |
7851 /* "Folder Only" selected - strip dummy file name. */ | 7862 /* "Directories" selected - strip dummy file name. */ |
7852 char * last = strrchr (filename, '/'); | 7863 char * last = strrchr (filename, '/'); |
7853 *last = '\0'; | 7864 *last = '\0'; |
7854 } | 7865 } |
7855 | 7866 |
7856 file = DECODE_FILE(build_string (filename)); | 7867 file = DECODE_FILE(build_string (filename)); |