diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/w32fns.c | 25 |
2 files changed, 25 insertions, 7 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index bb72bf7b671..383f479aabd 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2004-06-27 Jason Rumney <jasonr@gnu.org> | ||
| 2 | |||
| 3 | * w32fns.c (file_dialog_callback): Disable edit control if set | ||
| 4 | to directories only on CDN_INITDONE message. | ||
| 5 | (Fx_file_dialog): Default to directories only when prompt starts | ||
| 6 | with "Dired". | ||
| 7 | |||
| 1 | 2004-06-25 Kim F. Storm <storm@cua.dk> | 8 | 2004-06-25 Kim F. Storm <storm@cua.dk> |
| 2 | 9 | ||
| 3 | * alloc.c (allocate_misc): Update total_free_markers. | 10 | * alloc.c (allocate_misc): Update total_free_markers. |
diff --git a/src/w32fns.c b/src/w32fns.c index e7ead136ced..b12bd7be28b 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -7686,7 +7686,8 @@ file_dialog_callback (hwnd, msg, wParam, lParam) | |||
| 7686 | { | 7686 | { |
| 7687 | OFNOTIFY * notify = (OFNOTIFY *)lParam; | 7687 | OFNOTIFY * notify = (OFNOTIFY *)lParam; |
| 7688 | /* Detect when the Filter dropdown is changed. */ | 7688 | /* Detect when the Filter dropdown is changed. */ |
| 7689 | if (notify->hdr.code == CDN_TYPECHANGE) | 7689 | if (notify->hdr.code == CDN_TYPECHANGE |
| 7690 | || notify->hdr.code == CDN_INITDONE) | ||
| 7690 | { | 7691 | { |
| 7691 | HWND dialog = GetParent (hwnd); | 7692 | HWND dialog = GetParent (hwnd); |
| 7692 | HWND edit_control = GetDlgItem (dialog, FILE_NAME_TEXT_FIELD); | 7693 | HWND edit_control = GetDlgItem (dialog, FILE_NAME_TEXT_FIELD); |
| @@ -7700,8 +7701,10 @@ file_dialog_callback (hwnd, msg, wParam, lParam) | |||
| 7700 | } | 7701 | } |
| 7701 | else | 7702 | else |
| 7702 | { | 7703 | { |
| 7703 | CommDlg_OpenSave_SetControlText (dialog, FILE_NAME_TEXT_FIELD, | 7704 | /* Don't override default filename on init done. */ |
| 7704 | ""); | 7705 | if (notify->hdr.code == CDN_TYPECHANGE) |
| 7706 | CommDlg_OpenSave_SetControlText (dialog, | ||
| 7707 | FILE_NAME_TEXT_FIELD, ""); | ||
| 7705 | EnableWindow (edit_control, TRUE); | 7708 | EnableWindow (edit_control, TRUE); |
| 7706 | } | 7709 | } |
| 7707 | } | 7710 | } |
| @@ -7723,6 +7726,7 @@ specified. Ensure that file exists if MUSTMATCH is non-nil. */) | |||
| 7723 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; | 7726 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; |
| 7724 | char filename[MAX_PATH + 1]; | 7727 | char filename[MAX_PATH + 1]; |
| 7725 | char init_dir[MAX_PATH + 1]; | 7728 | char init_dir[MAX_PATH + 1]; |
| 7729 | int default_filter_index = 1; /* 1: All Files, 2: Directories only */ | ||
| 7726 | 7730 | ||
| 7727 | GCPRO5 (prompt, dir, default_filename, mustmatch, file); | 7731 | GCPRO5 (prompt, dir, default_filename, mustmatch, file); |
| 7728 | CHECK_STRING (prompt); | 7732 | CHECK_STRING (prompt); |
| @@ -7746,9 +7750,7 @@ specified. Ensure that file exists if MUSTMATCH is non-nil. */) | |||
| 7746 | if (!file_name_only) | 7750 | if (!file_name_only) |
| 7747 | file_name_only = full_path_name; | 7751 | file_name_only = full_path_name; |
| 7748 | else | 7752 | else |
| 7749 | { | 7753 | file_name_only++; |
| 7750 | file_name_only++; | ||
| 7751 | } | ||
| 7752 | 7754 | ||
| 7753 | strncpy (filename, file_name_only, MAX_PATH); | 7755 | strncpy (filename, file_name_only, MAX_PATH); |
| 7754 | filename[MAX_PATH] = '\0'; | 7756 | filename[MAX_PATH] = '\0'; |
| @@ -7773,6 +7775,15 @@ specified. Ensure that file exists if MUSTMATCH is non-nil. */) | |||
| 7773 | file_details.nMaxFile = sizeof (filename); | 7775 | file_details.nMaxFile = sizeof (filename); |
| 7774 | file_details.lpstrInitialDir = init_dir; | 7776 | file_details.lpstrInitialDir = init_dir; |
| 7775 | file_details.lpstrTitle = SDATA (prompt); | 7777 | file_details.lpstrTitle = SDATA (prompt); |
| 7778 | |||
| 7779 | /* If prompt starts with Dired, default to directories only. */ | ||
| 7780 | /* A bit hacky, but there doesn't seem to be a better way to | ||
| 7781 | DTRT for dired. */ | ||
| 7782 | if (strncmp (file_details.lpstrTitle, "Dired", 5) == 0) | ||
| 7783 | default_filter_index = 2; | ||
| 7784 | |||
| 7785 | file_details.nFilterIndex = default_filter_index; | ||
| 7786 | |||
| 7776 | file_details.Flags = (OFN_HIDEREADONLY | OFN_NOCHANGEDIR | 7787 | file_details.Flags = (OFN_HIDEREADONLY | OFN_NOCHANGEDIR |
| 7777 | | OFN_EXPLORER | OFN_ENABLEHOOK); | 7788 | | OFN_EXPLORER | OFN_ENABLEHOOK); |
| 7778 | if (!NILP (mustmatch)) | 7789 | if (!NILP (mustmatch)) |
| @@ -7785,7 +7796,7 @@ specified. Ensure that file exists if MUSTMATCH is non-nil. */) | |||
| 7785 | dostounix_filename (filename); | 7796 | dostounix_filename (filename); |
| 7786 | if (file_details.nFilterIndex == 2) | 7797 | if (file_details.nFilterIndex == 2) |
| 7787 | { | 7798 | { |
| 7788 | /* "Folder Only" selected - strip dummy file name. */ | 7799 | /* "Directories" selected - strip dummy file name. */ |
| 7789 | char * last = strrchr (filename, '/'); | 7800 | char * last = strrchr (filename, '/'); |
| 7790 | *last = '\0'; | 7801 | *last = '\0'; |
| 7791 | } | 7802 | } |