]> git.pld-linux.org Git - packages/vim.git/blame - 6.2.419
- remove missing .po files
[packages/vim.git] / 6.2.419
CommitLineData
51f9884c
AG
1To: vim-dev@vim.org
2Subject: Patch 6.2.419 (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.419 (extra)
11Problem: Win32: Cannot open the Vim window inside another application.
12Solution: Add the "-P" argument to specify the window title of the
13 application to run inside. (Zibo Zhao)
14Files: runtime/starting.txt, src/main.c, src/gui_w32.c, src/gui_w48.c,
15 src/if_ole.cpp, src/os_mswin.c, src/proto/gui_w32.pro
16
17
18diff: runtime/starting.txt: No such file or directory
19*** ../vim-6.2.418/src/main.c Fri Mar 12 21:16:48 2004
20--- src/main.c Fri Mar 26 16:20:31 2004
21***************
22*** 843,848 ****
23--- 843,851 ----
24 case 'u': /* "-u {vimrc}" vim inits file */
25 case 'U': /* "-U {gvimrc}" gvim inits file */
26 case 'W': /* "-W {scriptout}" overwrite */
27+ #ifdef FEAT_GUI_W32
28+ case 'P': /* "-P {parent title}" MDI parent */
29+ #endif
30 want_argument = TRUE;
31 break;
32
33***************
34*** 985,990 ****
35--- 988,999 ----
36 mch_exit(2);
37 }
38 break;
39+
40+ #ifdef FEAT_GUI_W32
41+ case 'P': /* "-P {parent title}" MDI parent */
42+ gui_mch_set_parent(argv[0]);
43+ break;
44+ #endif
45 }
46 }
47 }
48***************
49*** 2596,2601 ****
50--- 2605,2613 ----
51 main_msg(_("--role <role>\tSet a unique role to identify the main window"));
52 # endif
53 main_msg(_("--socketid <xid>\tOpen Vim inside another GTK widget"));
54+ #endif
55+ #ifdef FEAT_GUI_W32
56+ main_msg(_("-P <parent title>\tOpen Vim inside parent application"));
57 #endif
58
59 #ifdef FEAT_GUI_GNOME
60*** ../vim-6.2.418/src/gui_w32.c Mon Mar 15 17:18:54 2004
61--- src/gui_w32.c Fri Mar 26 17:16:40 2004
62***************
63*** 791,801 ****
64 return 1;
65 }
66
67
68
69 /*
70! * End of call-back routines
71 */
72
73 static void
74 ole_error(char *arg)
75--- 791,830 ----
76 return 1;
77 }
78
79+ /*
80+ * End of call-back routines
81+ */
82
83+ /* parent window, if specified with -P */
84+ HWND vim_parent_hwnd = NULL;
85+
86+ static BOOL CALLBACK
87+ FindWindowTitle(HWND hwnd, LPARAM lParam)
88+ {
89+ char buf[2048];
90+ char *title = (char *)lParam;
91+
92+ if (GetWindowText(hwnd, buf, sizeof(buf)))
93+ {
94+ if (strstr(buf, title) != NULL)
95+ {
96+ /* Found it. Store the window ref. and quit searching. */
97+ vim_parent_hwnd = FindWindowEx(hwnd, NULL, "MDIClient", NULL);
98+ return FALSE;
99+ }
100+ }
101+ return TRUE; /* continue searching */
102+ }
103
104 /*
105! * Invoked for '-P "title"' argument: search for parent application to open
106! * our window in.
107 */
108+ void
109+ gui_mch_set_parent(char *title)
110+ {
111+ EnumWindows(FindWindowTitle, (LPARAM)title);
112+ }
113
114 static void
115 ole_error(char *arg)
116***************
117*** 893,898 ****
118--- 922,928 ----
119 netbeansArg = argv[arg];
120 mch_memmove(&argv[arg], &argv[arg + 1],
121 (--*argc - arg) * sizeof(char *));
122+ argv[*argc] = NULL;
123 break; /* enough? */
124 }
125
126***************
127*** 986,1000 ****
128 return FAIL;
129 }
130
131! s_hwnd = CreateWindow(
132! szVimWndClass, "Vim MSWindows GUI",
133! WS_OVERLAPPEDWINDOW,
134! gui_win_x == -1 ? CW_USEDEFAULT : gui_win_x,
135! gui_win_y == -1 ? CW_USEDEFAULT : gui_win_y,
136! 100, /* Any value will do */
137! 100, /* Any value will do */
138! NULL, NULL,
139! s_hinst, NULL);
140
141 if (s_hwnd == NULL)
142 return FAIL;
143--- 1016,1044 ----
144 return FAIL;
145 }
146
147! if (vim_parent_hwnd != NULL)
148! /* Open inside the specified parent window. */
149! s_hwnd = CreateWindowEx(
150! WS_EX_MDICHILD,
151! szVimWndClass, "Vim MSWindows GUI",
152! WS_OVERLAPPEDWINDOW | WS_CHILD | WS_CLIPSIBLINGS | 0xC000,
153! gui_win_x == -1 ? CW_USEDEFAULT : gui_win_x,
154! gui_win_y == -1 ? CW_USEDEFAULT : gui_win_y,
155! 100, /* Any value will do */
156! 100, /* Any value will do */
157! vim_parent_hwnd, NULL,
158! s_hinst, NULL);
159! else
160! /* Open toplevel window. */
161! s_hwnd = CreateWindow(
162! szVimWndClass, "Vim MSWindows GUI",
163! WS_OVERLAPPEDWINDOW,
164! gui_win_x == -1 ? CW_USEDEFAULT : gui_win_x,
165! gui_win_y == -1 ? CW_USEDEFAULT : gui_win_y,
166! 100, /* Any value will do */
167! 100, /* Any value will do */
168! NULL, NULL,
169! s_hinst, NULL);
170
171 if (s_hwnd == NULL)
172 return FAIL;
173***************
174*** 1216,1221 ****
175--- 1260,1268 ----
176 * these two are not compatible. */
177 SetWindowPlacement(s_hwnd, &wndpl);
178
179+ SetActiveWindow(s_hwnd);
180+ SetFocus(s_hwnd);
181+
182 #ifdef FEAT_MENU
183 /* Menu may wrap differently now */
184 gui_mswin_get_menu_height(!gui.starting);
185***************
186*** 2698,2703 ****
187--- 2745,2753 ----
188 vim_free(buttonWidths);
189 vim_free(buttonPositions);
190
191+ /* Focus back to our window (for when MDI is used). */
192+ (void)SetFocus(s_hwnd);
193+
194 return nchar;
195 }
196
197***************
198*** 2916,2923 ****
199
200 if (hfontTools)
201 {
202! hdc = GetDC (s_hwnd);
203! SelectObject (hdc, hfontTools);
204 /*
205 * GetTextMetrics() doesn't return the right value in
206 * tmAveCharWidth, so we have to figure out the dialog base units
207--- 2966,2973 ----
208
209 if (hfontTools)
210 {
211! hdc = GetDC(s_hwnd);
212! SelectObject(hdc, hfontTools);
213 /*
214 * GetTextMetrics() doesn't return the right value in
215 * tmAveCharWidth, so we have to figure out the dialog base units
216***************
217*** 2926,2932 ****
218 GetTextExtentPoint(hdc,
219 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
220 52, &size);
221! ReleaseDC (s_hwnd, hdc);
222
223 s_dlgfntwidth = (WORD)((size.cx / 26 + 1) / 2);
224 s_dlgfntheight = (WORD)size.cy;
225--- 2976,2982 ----
226 GetTextExtentPoint(hdc,
227 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
228 52, &size);
229! ReleaseDC(s_hwnd, hdc);
230
231 s_dlgfntwidth = (WORD)((size.cx / 26 + 1) / 2);
232 s_dlgfntheight = (WORD)size.cy;
233*** ../vim-6.2.418/src/gui_w48.c Wed Feb 4 21:44:27 2004
234--- src/gui_w48.c Fri Mar 26 17:20:43 2004
235***************
236*** 87,92 ****
237--- 87,93 ----
238 typedef int BOOL;
239 typedef int BYTE;
240 typedef int DWORD;
241+ typedef int WCHAR;
242 typedef int ENUMLOGFONT;
243 typedef int FINDREPLACE;
244 typedef int HANDLE;
245***************
246*** 113,118 ****
247--- 114,120 ----
248 typedef int UINT;
249 typedef int WORD;
250 typedef int WPARAM;
251+ typedef int POINT;
252 typedef void *HINSTANCE;
253 typedef void *HMENU;
254 typedef void *HWND;
255***************
256*** 618,623 ****
257--- 620,628 ----
258 int button = -1;
259 int repeated_click;
260
261+ /* Give main window the focus: this is so the cursor isn't hollow. */
262+ (void)SetFocus(s_hwnd);
263+
264 if (s_uMsg == WM_LBUTTONDOWN || s_uMsg == WM_LBUTTONDBLCLK)
265 button = MOUSE_LEFT;
266 else if (s_uMsg == WM_MBUTTONDOWN || s_uMsg == WM_MBUTTONDBLCLK)
267***************
268*** 801,807 ****
269 int flags = 0;
270 int down;
271
272! /* if (s_findrep_struct.Flags & FR_DIALOGTERM) nothing to do */
273
274 if (s_findrep_struct.Flags & FR_FINDNEXT)
275 {
276--- 806,814 ----
277 int flags = 0;
278 int down;
279
280! if (s_findrep_struct.Flags & FR_DIALOGTERM)
281! /* Give main window the focus back. */
282! (void)SetFocus(s_hwnd);
283
284 if (s_findrep_struct.Flags & FR_FINDNEXT)
285 {
286*** ../vim-6.2.418/src/if_ole.cpp Sun May 4 22:43:33 2003
287--- src/if_ole.cpp Fri Mar 26 16:59:10 2004
288***************
289*** 19,24 ****
290--- 19,25 ----
291 extern "C" {
292 #include "vim.h"
293 extern HWND s_hwnd;
294+ extern HWND vim_parent_hwnd;
295 }
296
297 #include "if_ole.h" // Interface definitions
298***************
299*** 184,190 ****
300
301 CVim::~CVim()
302 {
303! if (typeinfo)
304 typeinfo->Release();
305 }
306
307--- 185,191 ----
308
309 CVim::~CVim()
310 {
311! if (typeinfo && vim_parent_hwnd == NULL)
312 typeinfo->Release();
313 }
314
315*** ../vim-6.2.418/src/os_mswin.c Sat Mar 13 16:13:48 2004
316--- src/os_mswin.c Fri Mar 26 17:14:39 2004
317***************
318*** 2098,2103 ****
319--- 2112,2122 ----
320 di.cbSize = sizeof(DOCINFO);
321 di.lpszDocName = psettings->jobname;
322 ret = StartDoc(prt_dlg.hDC, &di);
323+
324+ #ifdef FEAT_GUI
325+ /* Give focus back to main window (when using MDI). */
326+ SetFocus(s_hwnd);
327+ #endif
328
329 return (ret > 0);
330 }
331*** ../vim-6.2.418/src/proto/gui_w32.pro Sun Oct 12 16:42:14 2003
332--- src/proto/gui_w32.pro Fri Mar 26 17:29:35 2004
333***************
334*** 53,58 ****
335--- 53,59 ----
336 char_u *gui_mch_browse __ARGS((int saving, char_u *title, char_u *dflt, char_u *ext, char_u *initdir, char_u *filter));
337 int get_cmd_args __ARGS((char *prog, char *cmdline, char ***argvp, char **tofree));
338 int gui_is_win32s __ARGS((void));
339+ void gui_mch_set_parent __ARGS((char *title));
340 void gui_mch_prepare __ARGS((int *argc, char **argv));
341 int gui_mch_init __ARGS((void));
342 void gui_mch_set_shellsize __ARGS((int width, int height, int min_width, int min_height, int base_width, int base_height));
343*** ../vim-6.2.418/src/version.c Tue Mar 30 22:00:48 2004
344--- src/version.c Tue Mar 30 22:02:13 2004
345***************
346*** 639,640 ****
347--- 639,642 ----
348 { /* Add new patch number below this line */
349+ /**/
350+ 419,
351 /**/
352
353--
354Some of the well know MS-Windows errors:
355 EMULTI Multitasking attempted, system confused
356 EKEYBOARD Keyboard locked, try getting out of this one!
357 EXPLAIN Unexplained error, please tell us what happened
358 EFUTURE Reserved for our future mistakes
359
360 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
361/// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
362\\\ Project leader for A-A-P -- http://www.A-A-P.org ///
363 \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///
This page took 0.065769 seconds and 4 git commands to generate.