]> git.pld-linux.org Git - packages/vim.git/blame - 6.2.495
- remove missing .po files
[packages/vim.git] / 6.2.495
CommitLineData
2bb96920
AG
1To: vim-dev@vim.org
2Subject: Patch 6.2.495 (extra)
3Fcc: outbox
4From: Bram Moolenaar <Bram@moolenaar.net>
5Mime-Version: 1.0
6Content-Type: text/plain; charset=ISO-8859-1
7Content-Transfer-Encoding: 8bit
8------------
9
10Patch 6.2.495 (extra, after 6.2.456)
11Problem: Win32: The file dialog doesn't work on Windows 95.
12Solution: Put the wide code of gui_mch_browse() in gui_mch_browseW() and use
13 it only on Windows NT/2000/XP.
14Files: src/gui_w32.c, src/gui_w48.c
15
16
17*** ../vim-6.2.494/src/gui_w32.c Fri Apr 16 11:08:02 2004
18--- src/gui_w32.c Fri Apr 23 17:10:40 2004
19***************
20*** 202,209 ****
21 #define VIM_NAME "vim"
22 #define VIM_CLASS "Vim"
23
24- static OSVERSIONINFO os_version; /* like it says. Init in gui_mch_init() */
25-
26 /* Initial size for the dialog template. For gui_mch_dialog() it's fixed,
27 * thus there should be room for every dialog. For tearoffs it's made bigger
28 * when needed. */
29--- 201,206 ----
30***************
31*** 545,551 ****
32 y = lpwpos->y;
33 cx = lpwpos->cx;
34 cy = lpwpos->cy;
35! netbeans_frame_moved(x, y);
36 }
37 /* Allow to send WM_SIZE and WM_MOVE */
38 FORWARD_WM_WINDOWPOSCHANGED(hwnd, lpwpos, DefWindowProc);
39--- 542,548 ----
40 y = lpwpos->y;
41 cx = lpwpos->cx;
42 cy = lpwpos->cy;
43! netbeans_frame_moved(x, y);
44 }
45 /* Allow to send WM_SIZE and WM_MOVE */
46 FORWARD_WM_WINDOWPOSCHANGED(hwnd, lpwpos, DefWindowProc);
47*** ../vim-6.2.494/src/gui_w48.c Mon Apr 19 20:29:16 2004
48--- src/gui_w48.c Fri Apr 23 17:11:29 2004
49***************
50*** 286,291 ****
51--- 286,295 ----
52 static int s_timed_out = FALSE;
53 static int dead_key = 0; /* 0 - no dead key, 1 - dead key pressed */
54
55+ #ifdef WIN3264
56+ static OSVERSIONINFO os_version; /* like it says. Init in gui_mch_init() */
57+ #endif
58+
59 #ifdef FEAT_BEVAL
60 /* balloon-eval WM_NOTIFY_HANDLER */
61 static void Handle_WM_Notify __ARGS((HWND hwnd, LPNMHDR pnmh));
62***************
63*** 2710,2739 ****
64
65 #ifdef FEAT_BROWSE
66 /*
67! * Convert the string s to the proper format for a filter string by replacing
68! * the \t and \n delimeters with \0.
69! * Returns the converted string in allocated memory.
70 */
71- # ifdef FEAT_MBYTE
72 static WCHAR *
73! # else
74! static char_u *
75! # endif
76! convert_filter(char_u *s)
77 {
78- # ifdef FEAT_MBYTE
79 WCHAR *res;
80- # else
81- char_u *res;
82- # endif
83 unsigned s_len = (unsigned)STRLEN(s);
84 unsigned i;
85
86! # ifdef FEAT_MBYTE
87! res = (WCHAR *)alloc((s_len + 3) * 2);
88! # else
89! res = alloc(s_len + 3);
90! # endif
91 if (res != NULL)
92 {
93 for (i = 0; i < s_len; ++i)
94--- 2714,2736 ----
95
96 #ifdef FEAT_BROWSE
97 /*
98! * The file browser exists in two versions: with "W" uses wide characters,
99! * without "W" the current codepage. When FEAT_MBYTE is defined and on
100! * Windows NT/2000/XP the "W" functions are used.
101! */
102!
103! # if defined(FEAT_MBYTE) && defined(WIN3264)
104! /*
105! * Wide version of convert_filter(). Keep in sync!
106 */
107 static WCHAR *
108! convert_filterW(char_u *s)
109 {
110 WCHAR *res;
111 unsigned s_len = (unsigned)STRLEN(s);
112 unsigned i;
113
114! res = (WCHAR *)alloc((s_len + 3) * sizeof(WCHAR));
115 if (res != NULL)
116 {
117 for (i = 0; i < s_len; ++i)
118***************
119*** 2750,2766 ****
120 }
121
122 /*
123! * Pop open a file browser and return the file selected, in allocated memory,
124! * or NULL if Cancel is hit.
125! * saving - TRUE if the file will be saved to, FALSE if it will be opened.
126! * title - Title message for the file browser dialog.
127! * dflt - Default name of file.
128! * ext - Default extension to be added to files without extensions.
129! * initdir - directory in which to open the browser (NULL = current dir)
130! * filter - Filter for matched files to choose from.
131 */
132! char_u *
133! gui_mch_browse(
134 int saving,
135 char_u *title,
136 char_u *dflt,
137--- 2747,2756 ----
138 }
139
140 /*
141! * Wide version of gui_mch_browse(). Keep in sync!
142 */
143! static char_u *
144! gui_mch_browseW(
145 int saving,
146 char_u *title,
147 char_u *dflt,
148***************
149*** 2768,2774 ****
150 char_u *initdir,
151 char_u *filter)
152 {
153- #ifdef FEAT_MBYTE
154 /* We always use the wide function. This means enc_to_ucs2() must work,
155 * otherwise it fails miserably! */
156 OPENFILENAMEW fileStruct;
157--- 2758,2763 ----
158***************
159*** 2779,2797 ****
160 WCHAR *extp = NULL;
161 WCHAR *initdirp = NULL;
162 WCHAR *filterp;
163- #else
164- OPENFILENAME fileStruct;
165- char_u fileBuf[MAXPATHL];
166- char_u *initdirp = NULL;
167- char_u *filterp;
168- #endif
169 char_u *p;
170
171 if (dflt == NULL)
172 fileBuf[0] = NUL;
173 else
174 {
175- #ifdef FEAT_MBYTE
176 wp = enc_to_ucs2(dflt, NULL);
177 if (wp == NULL)
178 fileBuf[0] = NUL;
179--- 2768,2779 ----
180***************
181*** 2802,2840 ****
182 fileBuf[i] = NUL;
183 vim_free(wp);
184 }
185- #else
186- STRNCPY(fileBuf, dflt, MAXPATHL - 1);
187- fileBuf[MAXPATHL - 1] = NUL;
188- #endif
189 }
190
191 /* Convert the filter to Windows format. */
192! filterp = convert_filter(filter);
193
194! memset(&fileStruct, 0, sizeof(OPENFILENAME));
195 #ifdef OPENFILENAME_SIZE_VERSION_400
196 /* be compatible with Windows NT 4.0 */
197! /* TODO: what when using OPENFILENAMEW??? */
198 fileStruct.lStructSize = sizeof(OPENFILENAME_SIZE_VERSION_400);
199 #else
200 fileStruct.lStructSize = sizeof(fileStruct);
201 #endif
202
203- #ifdef FEAT_MBYTE
204 if (title != NULL)
205 titlep = enc_to_ucs2(title, NULL);
206 fileStruct.lpstrTitle = titlep;
207- #else
208- fileStruct.lpstrTitle = title;
209- #endif
210
211- #ifdef FEAT_MBYTE
212 if (ext != NULL)
213 extp = enc_to_ucs2(ext, NULL);
214 fileStruct.lpstrDefExt = extp;
215- #else
216- fileStruct.lpstrDefExt = ext;
217- #endif
218
219 fileStruct.lpstrFile = fileBuf;
220 fileStruct.nMaxFile = MAXPATHL;
221--- 2784,2810 ----
222 fileBuf[i] = NUL;
223 vim_free(wp);
224 }
225 }
226
227 /* Convert the filter to Windows format. */
228! filterp = convert_filterW(filter);
229
230! memset(&fileStruct, 0, sizeof(OPENFILENAMEW));
231 #ifdef OPENFILENAME_SIZE_VERSION_400
232 /* be compatible with Windows NT 4.0 */
233! /* TODO: what to use for OPENFILENAMEW??? */
234 fileStruct.lStructSize = sizeof(OPENFILENAME_SIZE_VERSION_400);
235 #else
236 fileStruct.lStructSize = sizeof(fileStruct);
237 #endif
238
239 if (title != NULL)
240 titlep = enc_to_ucs2(title, NULL);
241 fileStruct.lpstrTitle = titlep;
242
243 if (ext != NULL)
244 extp = enc_to_ucs2(ext, NULL);
245 fileStruct.lpstrDefExt = extp;
246
247 fileStruct.lpstrFile = fileBuf;
248 fileStruct.nMaxFile = MAXPATHL;
249***************
250*** 2844,2850 ****
251 if (initdir != NULL && *initdir != NUL)
252 {
253 /* Must have backslashes here, no matter what 'shellslash' says */
254- #ifdef FEAT_MBYTE
255 initdirp = enc_to_ucs2(initdir, NULL);
256 if (initdirp != NULL)
257 {
258--- 2814,2819 ----
259***************
260*** 2852,2864 ****
261 if (*wp == '/')
262 *wp = '\\';
263 }
264- #else
265- initdirp = vim_strsave(initdir);
266- if (initdirp != NULL)
267- for (p = initdirp; *p != NUL; ++p)
268- if (*p == '/')
269- *p = '\\';
270- #endif
271 fileStruct.lpstrInitialDir = initdirp;
272 }
273
274--- 2821,2826 ----
275***************
276*** 2877,2913 ****
277 #endif
278 if (saving)
279 {
280- #ifdef FEAT_MBYTE
281 if (!GetSaveFileNameW(&fileStruct))
282- #else
283- if (!GetSaveFileName(&fileStruct))
284- #endif
285 return NULL;
286 }
287 else
288 {
289- #ifdef FEAT_MBYTE
290 if (!GetOpenFileNameW(&fileStruct))
291- #else
292- if (!GetOpenFileName(&fileStruct))
293- #endif
294 return NULL;
295 }
296
297 vim_free(filterp);
298 vim_free(initdirp);
299- #ifdef FEAT_MBYTE
300 vim_free(titlep);
301 vim_free(extp);
302- #endif
303
304- #ifdef FEAT_MBYTE
305 /* Convert from UCS2 to 'encoding'. */
306 p = ucs2_to_enc(fileBuf, NULL);
307! if (p != NULL) /* when out of memory we get garbage... */
308 STRCPY(fileBuf, p);
309 vim_free(p);
310 #endif
311
312 /* Give focus back to main window (when using MDI). */
313 SetFocus(s_hwnd);
314--- 2839,3004 ----
315 #endif
316 if (saving)
317 {
318 if (!GetSaveFileNameW(&fileStruct))
319 return NULL;
320 }
321 else
322 {
323 if (!GetOpenFileNameW(&fileStruct))
324 return NULL;
325 }
326
327 vim_free(filterp);
328 vim_free(initdirp);
329 vim_free(titlep);
330 vim_free(extp);
331
332 /* Convert from UCS2 to 'encoding'. */
333 p = ucs2_to_enc(fileBuf, NULL);
334! if (p != NULL)
335! /* when out of memory we get garbage for non-ASCII chars */
336 STRCPY(fileBuf, p);
337 vim_free(p);
338+
339+ /* Give focus back to main window (when using MDI). */
340+ SetFocus(s_hwnd);
341+
342+ /* Shorten the file name if possible */
343+ mch_dirname(IObuff, IOSIZE);
344+ p = shorten_fname((char_u *)fileBuf, IObuff);
345+ if (p == NULL)
346+ p = (char_u *)fileBuf;
347+ return vim_strsave(p);
348+ }
349+ # endif /* FEAT_MBYTE */
350+
351+
352+ /*
353+ * Convert the string s to the proper format for a filter string by replacing
354+ * the \t and \n delimeters with \0.
355+ * Returns the converted string in allocated memory.
356+ *
357+ * Keep in sync with convert_filterW() above!
358+ */
359+ static char_u *
360+ convert_filter(char_u *s)
361+ {
362+ char_u *res;
363+ unsigned s_len = (unsigned)STRLEN(s);
364+ unsigned i;
365+
366+ res = alloc(s_len + 3);
367+ if (res != NULL)
368+ {
369+ for (i = 0; i < s_len; ++i)
370+ if (s[i] == '\t' || s[i] == '\n')
371+ res[i] = '\0';
372+ else
373+ res[i] = s[i];
374+ res[s_len] = NUL;
375+ /* Add two extra NULs to make sure it's properly terminated. */
376+ res[s_len + 1] = NUL;
377+ res[s_len + 2] = NUL;
378+ }
379+ return res;
380+ }
381+
382+ /*
383+ * Pop open a file browser and return the file selected, in allocated memory,
384+ * or NULL if Cancel is hit.
385+ * saving - TRUE if the file will be saved to, FALSE if it will be opened.
386+ * title - Title message for the file browser dialog.
387+ * dflt - Default name of file.
388+ * ext - Default extension to be added to files without extensions.
389+ * initdir - directory in which to open the browser (NULL = current dir)
390+ * filter - Filter for matched files to choose from.
391+ *
392+ * Keep in sync with gui_mch_browseW() above!
393+ */
394+ char_u *
395+ gui_mch_browse(
396+ int saving,
397+ char_u *title,
398+ char_u *dflt,
399+ char_u *ext,
400+ char_u *initdir,
401+ char_u *filter)
402+ {
403+ OPENFILENAME fileStruct;
404+ char_u fileBuf[MAXPATHL];
405+ char_u *initdirp = NULL;
406+ char_u *filterp;
407+ char_u *p;
408+
409+ # if defined(FEAT_MBYTE) && defined(WIN3264)
410+ if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT)
411+ return gui_mch_browseW(saving, title, dflt, ext, initdir, filter);
412+ # endif
413+
414+ if (dflt == NULL)
415+ fileBuf[0] = NUL;
416+ else
417+ {
418+ STRNCPY(fileBuf, dflt, MAXPATHL - 1);
419+ fileBuf[MAXPATHL - 1] = NUL;
420+ }
421+
422+ /* Convert the filter to Windows format. */
423+ filterp = convert_filter(filter);
424+
425+ memset(&fileStruct, 0, sizeof(OPENFILENAME));
426+ #ifdef OPENFILENAME_SIZE_VERSION_400
427+ /* be compatible with Windows NT 4.0 */
428+ fileStruct.lStructSize = sizeof(OPENFILENAME_SIZE_VERSION_400);
429+ #else
430+ fileStruct.lStructSize = sizeof(fileStruct);
431 #endif
432+
433+ fileStruct.lpstrTitle = title;
434+ fileStruct.lpstrDefExt = ext;
435+
436+ fileStruct.lpstrFile = fileBuf;
437+ fileStruct.nMaxFile = MAXPATHL;
438+ fileStruct.lpstrFilter = filterp;
439+ fileStruct.hwndOwner = s_hwnd; /* main Vim window is owner*/
440+ /* has an initial dir been specified? */
441+ if (initdir != NULL && *initdir != NUL)
442+ {
443+ /* Must have backslashes here, no matter what 'shellslash' says */
444+ initdirp = vim_strsave(initdir);
445+ if (initdirp != NULL)
446+ for (p = initdirp; *p != NUL; ++p)
447+ if (*p == '/')
448+ *p = '\\';
449+ fileStruct.lpstrInitialDir = initdirp;
450+ }
451+
452+ /*
453+ * TODO: Allow selection of multiple files. Needs another arg to this
454+ * function to ask for it, and need to use OFN_ALLOWMULTISELECT below.
455+ * Also, should we use OFN_FILEMUSTEXIST when opening? Vim can edit on
456+ * files that don't exist yet, so I haven't put it in. What about
457+ * OFN_PATHMUSTEXIST?
458+ * Don't use OFN_OVERWRITEPROMPT, Vim has its own ":confirm" dialog.
459+ */
460+ fileStruct.Flags = (OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY);
461+ #ifdef FEAT_SHORTCUT
462+ if (curbuf->b_p_bin)
463+ fileStruct.Flags |= OFN_NODEREFERENCELINKS;
464+ #endif
465+ if (saving)
466+ {
467+ if (!GetSaveFileName(&fileStruct))
468+ return NULL;
469+ }
470+ else
471+ {
472+ if (!GetOpenFileName(&fileStruct))
473+ return NULL;
474+ }
475+
476+ vim_free(filterp);
477+ vim_free(initdirp);
478
479 /* Give focus back to main window (when using MDI). */
480 SetFocus(s_hwnd);
481*** ../vim-6.2.494/src/version.c Fri Apr 23 15:40:30 2004
482--- src/version.c Sun Apr 25 13:03:26 2004
483***************
484*** 639,640 ****
485--- 639,642 ----
486 { /* Add new patch number below this line */
487+ /**/
488+ 495,
489 /**/
490
491--
492hundred-and-one symptoms of being an internet addict:
49328. You have comandeered your teenager's phone line for the net and even his
494 friends know not to call on his line anymore.
495
496 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
497/// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
498\\\ Project leader for A-A-P -- http://www.A-A-P.org ///
499 \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///
This page took 0.07394 seconds and 4 git commands to generate.