Mercurial > vim
annotate src/gui_w32.c @ 10322:5adc318767be v8.0.0056
commit https://github.com/vim/vim/commit/d0b5138ba4bccff8a744c99836041ef6322ed39a
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Nov 4 15:23:45 2016 +0100
patch 8.0.0056
Problem: When setting 'filetype' there is no check for a valid name.
Solution: Only allow valid characters in 'filetype', 'syntax' and 'keymap'.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Fri, 04 Nov 2016 15:30:07 +0100 |
parents | c036c0f636d5 |
children | 66f1b5bf3fa6 |
rev | line source |
---|---|
10042
4aead6a9b7a9
commit https://github.com/vim/vim/commit/edf3f97ae2af024708ebb4ac614227327033ca47
Christian Brabandt <cb@256bit.org>
parents:
9959
diff
changeset
|
1 /* vi:set ts=8 sts=4 sw=4 noet: |
7 | 2 * |
3 * VIM - Vi IMproved by Bram Moolenaar | |
4 * GUI support by Robert Webb | |
5 * | |
6 * Do ":help uganda" in Vim to read copying and usage conditions. | |
7 * Do ":help credits" in Vim to see a list of people who contributed. | |
8 * See README.txt for an overview of the Vim source code. | |
9 */ | |
10 /* | |
11 * Windows GUI. | |
12 * | |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
13 * GUI support for Microsoft Windows, aka Win32. Also for Win64. |
7 | 14 * |
15 * George V. Reilly <george@reilly.org> wrote the original Win32 GUI. | |
16 * Robert Webb reworked it to use the existing GUI stuff and added menu, | |
17 * scrollbars, etc. | |
18 * | |
19 * Note: Clipboard stuff, for cutting and pasting text to other windows, is in | |
7009 | 20 * winclip.c. (It can also be done from the terminal version). |
7 | 21 * |
22 * TODO: Some of the function signatures ought to be updated for Win64; | |
23 * e.g., replace LONG with LONG_PTR, etc. | |
24 */ | |
25 | |
1376 | 26 #include "vim.h" |
27 | |
6110 | 28 #if defined(FEAT_DIRECTX) |
29 # include "gui_dwrite.h" | |
30 #endif | |
31 | |
6359 | 32 #if defined(FEAT_DIRECTX) |
6110 | 33 static DWriteContext *s_dwc = NULL; |
34 static int s_directx_enabled = 0; | |
35 static int s_directx_load_attempted = 0; | |
36 # define IS_ENABLE_DIRECTX() (s_directx_enabled && s_dwc != NULL) | |
6359 | 37 #endif |
38 | |
8138
f52504c10387
commit https://github.com/vim/vim/commit/065bbac8adfe29a09958570237d223457f235c6c
Christian Brabandt <cb@256bit.org>
parents:
8108
diff
changeset
|
39 #ifdef FEAT_MENU |
f52504c10387
commit https://github.com/vim/vim/commit/065bbac8adfe29a09958570237d223457f235c6c
Christian Brabandt <cb@256bit.org>
parents:
8108
diff
changeset
|
40 static int gui_mswin_get_menu_height(int fix_window); |
f52504c10387
commit https://github.com/vim/vim/commit/065bbac8adfe29a09958570237d223457f235c6c
Christian Brabandt <cb@256bit.org>
parents:
8108
diff
changeset
|
41 #endif |
f52504c10387
commit https://github.com/vim/vim/commit/065bbac8adfe29a09958570237d223457f235c6c
Christian Brabandt <cb@256bit.org>
parents:
8108
diff
changeset
|
42 |
6359 | 43 #if defined(FEAT_DIRECTX) || defined(PROTO) |
6110 | 44 int |
45 directx_enabled(void) | |
46 { | |
47 if (s_dwc != NULL) | |
48 return 1; | |
49 else if (s_directx_load_attempted) | |
50 return 0; | |
51 /* load DirectX */ | |
52 DWrite_Init(); | |
53 s_directx_load_attempted = 1; | |
54 s_dwc = DWriteContext_Open(); | |
55 return s_dwc != NULL ? 1 : 0; | |
56 } | |
57 #endif | |
58 | |
59 #if defined(FEAT_RENDER_OPTIONS) || defined(PROTO) | |
60 int | |
61 gui_mch_set_rendering_options(char_u *s) | |
62 { | |
63 #ifdef FEAT_DIRECTX | |
64 char_u *p, *q; | |
65 | |
66 int dx_enable = 0; | |
67 int dx_flags = 0; | |
68 float dx_gamma = 0.0f; | |
69 float dx_contrast = 0.0f; | |
70 float dx_level = 0.0f; | |
71 int dx_geom = 0; | |
72 int dx_renmode = 0; | |
73 int dx_taamode = 0; | |
74 | |
75 /* parse string as rendering options. */ | |
76 for (p = s; p != NULL && *p != NUL; ) | |
77 { | |
78 char_u item[256]; | |
79 char_u name[128]; | |
80 char_u value[128]; | |
81 | |
7009 | 82 copy_option_part(&p, item, sizeof(item), ","); |
6110 | 83 if (p == NULL) |
84 break; | |
85 q = &item[0]; | |
86 copy_option_part(&q, name, sizeof(name), ":"); | |
87 if (q == NULL) | |
88 return FAIL; | |
89 copy_option_part(&q, value, sizeof(value), ":"); | |
90 | |
91 if (STRCMP(name, "type") == 0) | |
92 { | |
93 if (STRCMP(value, "directx") == 0) | |
94 dx_enable = 1; | |
95 else | |
96 return FAIL; | |
97 } | |
98 else if (STRCMP(name, "gamma") == 0) | |
99 { | |
100 dx_flags |= 1 << 0; | |
8108
50515f2e81d1
commit https://github.com/vim/vim/commit/7f0608fb5219645d776fadfe13efb867c2460698
Christian Brabandt <cb@256bit.org>
parents:
8102
diff
changeset
|
101 dx_gamma = (float)atof((char *)value); |
6110 | 102 } |
103 else if (STRCMP(name, "contrast") == 0) | |
104 { | |
105 dx_flags |= 1 << 1; | |
8108
50515f2e81d1
commit https://github.com/vim/vim/commit/7f0608fb5219645d776fadfe13efb867c2460698
Christian Brabandt <cb@256bit.org>
parents:
8102
diff
changeset
|
106 dx_contrast = (float)atof((char *)value); |
6110 | 107 } |
108 else if (STRCMP(name, "level") == 0) | |
109 { | |
110 dx_flags |= 1 << 2; | |
8108
50515f2e81d1
commit https://github.com/vim/vim/commit/7f0608fb5219645d776fadfe13efb867c2460698
Christian Brabandt <cb@256bit.org>
parents:
8102
diff
changeset
|
111 dx_level = (float)atof((char *)value); |
6110 | 112 } |
113 else if (STRCMP(name, "geom") == 0) | |
114 { | |
115 dx_flags |= 1 << 3; | |
8108
50515f2e81d1
commit https://github.com/vim/vim/commit/7f0608fb5219645d776fadfe13efb867c2460698
Christian Brabandt <cb@256bit.org>
parents:
8102
diff
changeset
|
116 dx_geom = atoi((char *)value); |
6110 | 117 if (dx_geom < 0 || dx_geom > 2) |
118 return FAIL; | |
119 } | |
120 else if (STRCMP(name, "renmode") == 0) | |
121 { | |
122 dx_flags |= 1 << 4; | |
8108
50515f2e81d1
commit https://github.com/vim/vim/commit/7f0608fb5219645d776fadfe13efb867c2460698
Christian Brabandt <cb@256bit.org>
parents:
8102
diff
changeset
|
123 dx_renmode = atoi((char *)value); |
6110 | 124 if (dx_renmode < 0 || dx_renmode > 6) |
125 return FAIL; | |
126 } | |
127 else if (STRCMP(name, "taamode") == 0) | |
128 { | |
129 dx_flags |= 1 << 5; | |
8108
50515f2e81d1
commit https://github.com/vim/vim/commit/7f0608fb5219645d776fadfe13efb867c2460698
Christian Brabandt <cb@256bit.org>
parents:
8102
diff
changeset
|
130 dx_taamode = atoi((char *)value); |
6110 | 131 if (dx_taamode < 0 || dx_taamode > 3) |
132 return FAIL; | |
133 } | |
134 else | |
135 return FAIL; | |
136 } | |
137 | |
138 /* Enable DirectX/DirectWrite */ | |
139 if (dx_enable) | |
140 { | |
141 if (!directx_enabled()) | |
142 return FAIL; | |
143 DWriteContext_SetRenderingParams(s_dwc, NULL); | |
144 if (dx_flags) | |
145 { | |
146 DWriteRenderingParams param; | |
147 DWriteContext_GetRenderingParams(s_dwc, ¶m); | |
148 if (dx_flags & (1 << 0)) | |
149 param.gamma = dx_gamma; | |
150 if (dx_flags & (1 << 1)) | |
151 param.enhancedContrast = dx_contrast; | |
152 if (dx_flags & (1 << 2)) | |
153 param.clearTypeLevel = dx_level; | |
154 if (dx_flags & (1 << 3)) | |
155 param.pixelGeometry = dx_geom; | |
156 if (dx_flags & (1 << 4)) | |
157 param.renderingMode = dx_renmode; | |
158 if (dx_flags & (1 << 5)) | |
159 param.textAntialiasMode = dx_taamode; | |
160 DWriteContext_SetRenderingParams(s_dwc, ¶m); | |
161 } | |
162 } | |
163 s_directx_enabled = dx_enable; | |
164 | |
165 return OK; | |
166 #else | |
167 return FAIL; | |
168 #endif | |
169 } | |
170 #endif | |
171 | |
7 | 172 /* |
173 * These are new in Windows ME/XP, only defined in recent compilers. | |
174 */ | |
175 #ifndef HANDLE_WM_XBUTTONUP | |
176 # define HANDLE_WM_XBUTTONUP(hwnd, wParam, lParam, fn) \ | |
177 ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
178 #endif | |
179 #ifndef HANDLE_WM_XBUTTONDOWN | |
180 # define HANDLE_WM_XBUTTONDOWN(hwnd, wParam, lParam, fn) \ | |
181 ((fn)((hwnd), FALSE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
182 #endif | |
183 #ifndef HANDLE_WM_XBUTTONDBLCLK | |
184 # define HANDLE_WM_XBUTTONDBLCLK(hwnd, wParam, lParam, fn) \ | |
185 ((fn)((hwnd), TRUE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
186 #endif | |
187 | |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
188 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
189 #include "version.h" /* used by dialog box routine for default title */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
190 #ifdef DEBUG |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
191 # include <tchar.h> |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
192 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
193 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
194 /* cproto fails on missing include files */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
195 #ifndef PROTO |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
196 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
197 #ifndef __MINGW32__ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
198 # include <shellapi.h> |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
199 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
200 #if defined(FEAT_TOOLBAR) || defined(FEAT_BEVAL) || defined(FEAT_GUI_TABLINE) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
201 # include <commctrl.h> |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
202 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
203 #include <windowsx.h> |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
204 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
205 #ifdef GLOBAL_IME |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
206 # include "glbl_ime.h" |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
207 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
208 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
209 #endif /* PROTO */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
210 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
211 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
212 # define MENUHINTS /* show menu hints in command line */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
213 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
214 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
215 /* Some parameters for dialog boxes. All in pixels. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
216 #define DLG_PADDING_X 10 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
217 #define DLG_PADDING_Y 10 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
218 #define DLG_OLD_STYLE_PADDING_X 5 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
219 #define DLG_OLD_STYLE_PADDING_Y 5 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
220 #define DLG_VERT_PADDING_X 4 /* For vertical buttons */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
221 #define DLG_VERT_PADDING_Y 4 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
222 #define DLG_ICON_WIDTH 34 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
223 #define DLG_ICON_HEIGHT 34 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
224 #define DLG_MIN_WIDTH 150 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
225 #define DLG_FONT_NAME "MS Sans Serif" |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
226 #define DLG_FONT_POINT_SIZE 8 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
227 #define DLG_MIN_MAX_WIDTH 400 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
228 #define DLG_MIN_MAX_HEIGHT 400 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
229 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
230 #define DLG_NONBUTTON_CONTROL 5000 /* First ID of non-button controls */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
231 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
232 #ifndef WM_XBUTTONDOWN /* For Win2K / winME ONLY */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
233 # define WM_XBUTTONDOWN 0x020B |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
234 # define WM_XBUTTONUP 0x020C |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
235 # define WM_XBUTTONDBLCLK 0x020D |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
236 # define MK_XBUTTON1 0x0020 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
237 # define MK_XBUTTON2 0x0040 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
238 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
239 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
240 #ifdef PROTO |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
241 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
242 * Define a few things for generating prototypes. This is just to avoid |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
243 * syntax errors, the defines do not need to be correct. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
244 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
245 # define APIENTRY |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
246 # define CALLBACK |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
247 # define CONST |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
248 # define FAR |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
249 # define NEAR |
9834
80ace3687eec
commit https://github.com/vim/vim/commit/a6b7a08ae04a3cd4d9c45c906bb7a197e2135179
Christian Brabandt <cb@256bit.org>
parents:
9428
diff
changeset
|
250 # undef _cdecl |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
251 # define _cdecl |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
252 typedef int BOOL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
253 typedef int BYTE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
254 typedef int DWORD; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
255 typedef int WCHAR; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
256 typedef int ENUMLOGFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
257 typedef int FINDREPLACE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
258 typedef int HANDLE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
259 typedef int HBITMAP; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
260 typedef int HBRUSH; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
261 typedef int HDROP; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
262 typedef int INT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
263 typedef int LOGFONT[]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
264 typedef int LPARAM; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
265 typedef int LPCREATESTRUCT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
266 typedef int LPCSTR; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
267 typedef int LPCTSTR; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
268 typedef int LPRECT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
269 typedef int LPSTR; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
270 typedef int LPWINDOWPOS; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
271 typedef int LPWORD; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
272 typedef int LRESULT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
273 typedef int HRESULT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
274 # undef MSG |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
275 typedef int MSG; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
276 typedef int NEWTEXTMETRIC; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
277 typedef int OSVERSIONINFO; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
278 typedef int PWORD; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
279 typedef int RECT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
280 typedef int UINT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
281 typedef int WORD; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
282 typedef int WPARAM; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
283 typedef int POINT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
284 typedef void *HINSTANCE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
285 typedef void *HMENU; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
286 typedef void *HWND; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
287 typedef void *HDC; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
288 typedef void VOID; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
289 typedef int LPNMHDR; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
290 typedef int LONG; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
291 typedef int WNDPROC; |
9834
80ace3687eec
commit https://github.com/vim/vim/commit/a6b7a08ae04a3cd4d9c45c906bb7a197e2135179
Christian Brabandt <cb@256bit.org>
parents:
9428
diff
changeset
|
292 typedef int UINT_PTR; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
293 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
294 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
295 #ifndef GET_X_LPARAM |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
296 # define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
297 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
298 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
299 static void _OnPaint( HWND hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
300 static void clear_rect(RECT *rcp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
301 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
302 static WORD s_dlgfntheight; /* height of the dialog font */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
303 static WORD s_dlgfntwidth; /* width of the dialog font */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
304 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
305 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
306 static HMENU s_menuBar = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
307 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
308 #ifdef FEAT_TEAROFF |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
309 static void rebuild_tearoff(vimmenu_T *menu); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
310 static HBITMAP s_htearbitmap; /* bitmap used to indicate tearoff */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
311 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
312 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
313 /* Flag that is set while processing a message that must not be interrupted by |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
314 * processing another message. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
315 static int s_busy_processing = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
316 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
317 static int destroying = FALSE; /* call DestroyWindow() ourselves */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
318 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
319 #ifdef MSWIN_FIND_REPLACE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
320 static UINT s_findrep_msg = 0; /* set in gui_w[16/32].c */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
321 static FINDREPLACE s_findrep_struct; |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
322 # ifdef FEAT_MBYTE |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
323 static FINDREPLACEW s_findrep_struct_w; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
324 # endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
325 static HWND s_findrep_hwnd = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
326 static int s_findrep_is_find; /* TRUE for find dialog, FALSE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
327 for find/replace dialog */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
328 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
329 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
330 static HINSTANCE s_hinst = NULL; |
8281
74b15ed0a259
commit https://github.com/vim/vim/commit/85b11769ab507c7df93f319fd964fa579701b76b
Christian Brabandt <cb@256bit.org>
parents:
8273
diff
changeset
|
331 #if !defined(FEAT_GUI) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
332 static |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
333 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
334 HWND s_hwnd = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
335 static HDC s_hdc = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
336 static HBRUSH s_brush = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
337 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
338 #ifdef FEAT_TOOLBAR |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
339 static HWND s_toolbarhwnd = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
340 static WNDPROC s_toolbar_wndproc = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
341 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
342 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
343 #ifdef FEAT_GUI_TABLINE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
344 static HWND s_tabhwnd = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
345 static WNDPROC s_tabline_wndproc = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
346 static int showing_tabline = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
347 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
348 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
349 static WPARAM s_wParam = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
350 static LPARAM s_lParam = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
351 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
352 static HWND s_textArea = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
353 static UINT s_uMsg = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
354 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
355 static char_u *s_textfield; /* Used by dialogs to pass back strings */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
356 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
357 static int s_need_activate = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
358 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
359 /* This variable is set when waiting for an event, which is the only moment |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
360 * scrollbar dragging can be done directly. It's not allowed while commands |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
361 * are executed, because it may move the cursor and that may cause unexpected |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
362 * problems (e.g., while ":s" is working). |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
363 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
364 static int allow_scrollbar = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
365 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
366 #ifdef GLOBAL_IME |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
367 # define MyTranslateMessage(x) global_ime_TranslateMessage(x) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
368 #else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
369 # define MyTranslateMessage(x) TranslateMessage(x) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
370 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
371 |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
372 #if defined(FEAT_MBYTE) || defined(GLOBAL_IME) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
373 /* use of WindowProc depends on wide_WindowProc */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
374 # define MyWindowProc vim_WindowProc |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
375 #else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
376 /* use ordinary WindowProc */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
377 # define MyWindowProc DefWindowProc |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
378 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
379 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
380 extern int current_font_height; /* this is in os_mswin.c */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
381 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
382 static struct |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
383 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
384 UINT key_sym; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
385 char_u vim_code0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
386 char_u vim_code1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
387 } special_keys[] = |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
388 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
389 {VK_UP, 'k', 'u'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
390 {VK_DOWN, 'k', 'd'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
391 {VK_LEFT, 'k', 'l'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
392 {VK_RIGHT, 'k', 'r'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
393 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
394 {VK_F1, 'k', '1'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
395 {VK_F2, 'k', '2'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
396 {VK_F3, 'k', '3'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
397 {VK_F4, 'k', '4'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
398 {VK_F5, 'k', '5'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
399 {VK_F6, 'k', '6'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
400 {VK_F7, 'k', '7'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
401 {VK_F8, 'k', '8'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
402 {VK_F9, 'k', '9'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
403 {VK_F10, 'k', ';'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
404 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
405 {VK_F11, 'F', '1'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
406 {VK_F12, 'F', '2'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
407 {VK_F13, 'F', '3'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
408 {VK_F14, 'F', '4'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
409 {VK_F15, 'F', '5'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
410 {VK_F16, 'F', '6'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
411 {VK_F17, 'F', '7'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
412 {VK_F18, 'F', '8'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
413 {VK_F19, 'F', '9'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
414 {VK_F20, 'F', 'A'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
415 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
416 {VK_F21, 'F', 'B'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
417 #ifdef FEAT_NETBEANS_INTG |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
418 {VK_PAUSE, 'F', 'B'}, /* Pause == F21 (see gui_gtk_x11.c) */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
419 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
420 {VK_F22, 'F', 'C'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
421 {VK_F23, 'F', 'D'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
422 {VK_F24, 'F', 'E'}, /* winuser.h defines up to F24 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
423 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
424 {VK_HELP, '%', '1'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
425 {VK_BACK, 'k', 'b'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
426 {VK_INSERT, 'k', 'I'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
427 {VK_DELETE, 'k', 'D'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
428 {VK_HOME, 'k', 'h'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
429 {VK_END, '@', '7'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
430 {VK_PRIOR, 'k', 'P'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
431 {VK_NEXT, 'k', 'N'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
432 {VK_PRINT, '%', '9'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
433 {VK_ADD, 'K', '6'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
434 {VK_SUBTRACT, 'K', '7'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
435 {VK_DIVIDE, 'K', '8'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
436 {VK_MULTIPLY, 'K', '9'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
437 {VK_SEPARATOR, 'K', 'A'}, /* Keypad Enter */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
438 {VK_DECIMAL, 'K', 'B'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
439 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
440 {VK_NUMPAD0, 'K', 'C'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
441 {VK_NUMPAD1, 'K', 'D'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
442 {VK_NUMPAD2, 'K', 'E'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
443 {VK_NUMPAD3, 'K', 'F'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
444 {VK_NUMPAD4, 'K', 'G'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
445 {VK_NUMPAD5, 'K', 'H'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
446 {VK_NUMPAD6, 'K', 'I'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
447 {VK_NUMPAD7, 'K', 'J'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
448 {VK_NUMPAD8, 'K', 'K'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
449 {VK_NUMPAD9, 'K', 'L'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
450 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
451 /* Keys that we want to be able to use any modifier with: */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
452 {VK_SPACE, ' ', NUL}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
453 {VK_TAB, TAB, NUL}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
454 {VK_ESCAPE, ESC, NUL}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
455 {NL, NL, NUL}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
456 {CAR, CAR, NUL}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
457 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
458 /* End of list marker: */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
459 {0, 0, 0} |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
460 }; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
461 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
462 /* Local variables */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
463 static int s_button_pending = -1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
464 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
465 /* s_getting_focus is set when we got focus but didn't see mouse-up event yet, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
466 * so don't reset s_button_pending. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
467 static int s_getting_focus = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
468 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
469 static int s_x_pending; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
470 static int s_y_pending; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
471 static UINT s_kFlags_pending; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
472 static UINT s_wait_timer = 0; /* Timer for get char from user */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
473 static int s_timed_out = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
474 static int dead_key = 0; /* 0: no dead key, 1: dead key pressed */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
475 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
476 #ifdef FEAT_BEVAL |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
477 /* balloon-eval WM_NOTIFY_HANDLER */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
478 static void Handle_WM_Notify(HWND hwnd, LPNMHDR pnmh); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
479 static void TrackUserActivity(UINT uMsg); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
480 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
481 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
482 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
483 * For control IME. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
484 * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
485 * These LOGFONT used for IME. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
486 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
487 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
488 # ifdef USE_IM_CONTROL |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
489 /* holds LOGFONT for 'guifontwide' if available, otherwise 'guifont' */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
490 static LOGFONT norm_logfont; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
491 /* holds LOGFONT for 'guifont' always. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
492 static LOGFONT sub_logfont; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
493 # endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
494 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
495 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
496 #ifdef FEAT_MBYTE_IME |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
497 static LRESULT _OnImeNotify(HWND hWnd, DWORD dwCommand, DWORD dwData); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
498 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
499 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
500 #if defined(FEAT_BROWSE) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
501 static char_u *convert_filter(char_u *s); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
502 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
503 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
504 #ifdef DEBUG_PRINT_ERROR |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
505 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
506 * Print out the last Windows error message |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
507 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
508 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
509 print_windows_error(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
510 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
511 LPVOID lpMsgBuf; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
512 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
513 FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
514 NULL, GetLastError(), |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
515 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
516 (LPTSTR) &lpMsgBuf, 0, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
517 TRACE1("Error: %s\n", lpMsgBuf); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
518 LocalFree(lpMsgBuf); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
519 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
520 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
521 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
522 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
523 * Cursor blink functions. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
524 * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
525 * This is a simple state machine: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
526 * BLINK_NONE not blinking at all |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
527 * BLINK_OFF blinking, cursor is not shown |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
528 * BLINK_ON blinking, cursor is shown |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
529 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
530 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
531 #define BLINK_NONE 0 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
532 #define BLINK_OFF 1 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
533 #define BLINK_ON 2 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
534 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
535 static int blink_state = BLINK_NONE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
536 static long_u blink_waittime = 700; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
537 static long_u blink_ontime = 400; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
538 static long_u blink_offtime = 250; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
539 static UINT blink_timer = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
540 |
9213
bb86514cad15
commit https://github.com/vim/vim/commit/703a8044b5393d37d355b0b1054a9a5a13912a3f
Christian Brabandt <cb@256bit.org>
parents:
9181
diff
changeset
|
541 int |
bb86514cad15
commit https://github.com/vim/vim/commit/703a8044b5393d37d355b0b1054a9a5a13912a3f
Christian Brabandt <cb@256bit.org>
parents:
9181
diff
changeset
|
542 gui_mch_is_blinking(void) |
bb86514cad15
commit https://github.com/vim/vim/commit/703a8044b5393d37d355b0b1054a9a5a13912a3f
Christian Brabandt <cb@256bit.org>
parents:
9181
diff
changeset
|
543 { |
bb86514cad15
commit https://github.com/vim/vim/commit/703a8044b5393d37d355b0b1054a9a5a13912a3f
Christian Brabandt <cb@256bit.org>
parents:
9181
diff
changeset
|
544 return blink_state != BLINK_NONE; |
bb86514cad15
commit https://github.com/vim/vim/commit/703a8044b5393d37d355b0b1054a9a5a13912a3f
Christian Brabandt <cb@256bit.org>
parents:
9181
diff
changeset
|
545 } |
bb86514cad15
commit https://github.com/vim/vim/commit/703a8044b5393d37d355b0b1054a9a5a13912a3f
Christian Brabandt <cb@256bit.org>
parents:
9181
diff
changeset
|
546 |
9428
0c7f47088e55
commit https://github.com/vim/vim/commit/9d5d3c9c4468ad76f16b50eabd3d9e7eab2ed44d
Christian Brabandt <cb@256bit.org>
parents:
9252
diff
changeset
|
547 int |
0c7f47088e55
commit https://github.com/vim/vim/commit/9d5d3c9c4468ad76f16b50eabd3d9e7eab2ed44d
Christian Brabandt <cb@256bit.org>
parents:
9252
diff
changeset
|
548 gui_mch_is_blink_off(void) |
0c7f47088e55
commit https://github.com/vim/vim/commit/9d5d3c9c4468ad76f16b50eabd3d9e7eab2ed44d
Christian Brabandt <cb@256bit.org>
parents:
9252
diff
changeset
|
549 { |
0c7f47088e55
commit https://github.com/vim/vim/commit/9d5d3c9c4468ad76f16b50eabd3d9e7eab2ed44d
Christian Brabandt <cb@256bit.org>
parents:
9252
diff
changeset
|
550 return blink_state == BLINK_OFF; |
0c7f47088e55
commit https://github.com/vim/vim/commit/9d5d3c9c4468ad76f16b50eabd3d9e7eab2ed44d
Christian Brabandt <cb@256bit.org>
parents:
9252
diff
changeset
|
551 } |
0c7f47088e55
commit https://github.com/vim/vim/commit/9d5d3c9c4468ad76f16b50eabd3d9e7eab2ed44d
Christian Brabandt <cb@256bit.org>
parents:
9252
diff
changeset
|
552 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
553 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
554 gui_mch_set_blinking(long wait, long on, long off) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
555 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
556 blink_waittime = wait; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
557 blink_ontime = on; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
558 blink_offtime = off; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
559 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
560 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
561 /* ARGSUSED */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
562 static VOID CALLBACK |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
563 _OnBlinkTimer( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
564 HWND hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
565 UINT uMsg, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
566 UINT idEvent, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
567 DWORD dwTime) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
568 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
569 MSG msg; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
570 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
571 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
572 TRACE2("Got timer event, id %d, blink_timer %d\n", idEvent, blink_timer); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
573 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
574 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
575 KillTimer(NULL, idEvent); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
576 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
577 /* Eat spurious WM_TIMER messages */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
578 while (pPeekMessage(&msg, hwnd, WM_TIMER, WM_TIMER, PM_REMOVE)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
579 ; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
580 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
581 if (blink_state == BLINK_ON) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
582 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
583 gui_undraw_cursor(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
584 blink_state = BLINK_OFF; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
585 blink_timer = (UINT) SetTimer(NULL, 0, (UINT)blink_offtime, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
586 (TIMERPROC)_OnBlinkTimer); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
587 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
588 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
589 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
590 gui_update_cursor(TRUE, FALSE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
591 blink_state = BLINK_ON; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
592 blink_timer = (UINT) SetTimer(NULL, 0, (UINT)blink_ontime, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
593 (TIMERPROC)_OnBlinkTimer); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
594 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
595 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
596 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
597 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
598 gui_mswin_rm_blink_timer(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
599 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
600 MSG msg; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
601 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
602 if (blink_timer != 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
603 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
604 KillTimer(NULL, blink_timer); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
605 /* Eat spurious WM_TIMER messages */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
606 while (pPeekMessage(&msg, s_hwnd, WM_TIMER, WM_TIMER, PM_REMOVE)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
607 ; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
608 blink_timer = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
609 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
610 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
611 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
612 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
613 * Stop the cursor blinking. Show the cursor if it wasn't shown. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
614 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
615 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
616 gui_mch_stop_blink(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
617 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
618 gui_mswin_rm_blink_timer(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
619 if (blink_state == BLINK_OFF) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
620 gui_update_cursor(TRUE, FALSE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
621 blink_state = BLINK_NONE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
622 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
623 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
624 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
625 * Start the cursor blinking. If it was already blinking, this restarts the |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
626 * waiting time and shows the cursor. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
627 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
628 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
629 gui_mch_start_blink(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
630 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
631 gui_mswin_rm_blink_timer(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
632 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
633 /* Only switch blinking on if none of the times is zero */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
634 if (blink_waittime && blink_ontime && blink_offtime && gui.in_focus) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
635 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
636 blink_timer = (UINT)SetTimer(NULL, 0, (UINT)blink_waittime, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
637 (TIMERPROC)_OnBlinkTimer); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
638 blink_state = BLINK_ON; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
639 gui_update_cursor(TRUE, FALSE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
640 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
641 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
642 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
643 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
644 * Call-back routines. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
645 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
646 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
647 /*ARGSUSED*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
648 static VOID CALLBACK |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
649 _OnTimer( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
650 HWND hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
651 UINT uMsg, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
652 UINT idEvent, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
653 DWORD dwTime) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
654 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
655 MSG msg; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
656 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
657 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
658 TRACE2("Got timer event, id %d, s_wait_timer %d\n", idEvent, s_wait_timer); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
659 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
660 KillTimer(NULL, idEvent); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
661 s_timed_out = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
662 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
663 /* Eat spurious WM_TIMER messages */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
664 while (pPeekMessage(&msg, hwnd, WM_TIMER, WM_TIMER, PM_REMOVE)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
665 ; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
666 if (idEvent == s_wait_timer) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
667 s_wait_timer = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
668 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
669 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
670 /*ARGSUSED*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
671 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
672 _OnDeadChar( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
673 HWND hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
674 UINT ch, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
675 int cRepeat) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
676 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
677 dead_key = 1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
678 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
679 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
680 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
681 * Convert Unicode character "ch" to bytes in "string[slen]". |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
682 * When "had_alt" is TRUE the ALT key was included in "ch". |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
683 * Return the length. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
684 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
685 static int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
686 char_to_string(int ch, char_u *string, int slen, int had_alt) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
687 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
688 int len; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
689 int i; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
690 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
691 WCHAR wstring[2]; |
9252
c25898cc99c1
commit https://github.com/vim/vim/commit/945ec093cd4ddefab930239990564b12eb232153
Christian Brabandt <cb@256bit.org>
parents:
9236
diff
changeset
|
692 char_u *ws = NULL; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
693 |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
694 wstring[0] = ch; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
695 len = 1; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
696 |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
697 /* "ch" is a UTF-16 character. Convert it to a string of bytes. When |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
698 * "enc_codepage" is non-zero use the standard Win32 function, |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
699 * otherwise use our own conversion function (e.g., for UTF-8). */ |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
700 if (enc_codepage > 0) |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
701 { |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
702 len = WideCharToMultiByte(enc_codepage, 0, wstring, len, |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
703 (LPSTR)string, slen, 0, NULL); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
704 /* If we had included the ALT key into the character but now the |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
705 * upper bit is no longer set, that probably means the conversion |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
706 * failed. Convert the original character and set the upper bit |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
707 * afterwards. */ |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
708 if (had_alt && len == 1 && ch >= 0x80 && string[0] < 0x80) |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
709 { |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
710 wstring[0] = ch & 0x7f; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
711 len = WideCharToMultiByte(enc_codepage, 0, wstring, len, |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
712 (LPSTR)string, slen, 0, NULL); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
713 if (len == 1) /* safety check */ |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
714 string[0] |= 0x80; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
715 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
716 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
717 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
718 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
719 len = 1; |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
720 ws = utf16_to_enc(wstring, &len); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
721 if (ws == NULL) |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
722 len = 0; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
723 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
724 { |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
725 if (len > slen) /* just in case */ |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
726 len = slen; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
727 mch_memmove(string, ws, len); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
728 vim_free(ws); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
729 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
730 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
731 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
732 if (len == 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
733 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
734 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
735 string[0] = ch; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
736 len = 1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
737 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
738 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
739 for (i = 0; i < len; ++i) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
740 if (string[i] == CSI && len <= slen - 2) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
741 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
742 /* Insert CSI as K_CSI. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
743 mch_memmove(string + i + 3, string + i + 1, len - i - 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
744 string[++i] = KS_EXTRA; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
745 string[++i] = (int)KE_CSI; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
746 len += 2; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
747 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
748 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
749 return len; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
750 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
751 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
752 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
753 * Key hit, add it to the input buffer. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
754 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
755 /*ARGSUSED*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
756 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
757 _OnChar( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
758 HWND hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
759 UINT ch, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
760 int cRepeat) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
761 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
762 char_u string[40]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
763 int len = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
764 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
765 dead_key = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
766 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
767 len = char_to_string(ch, string, 40, FALSE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
768 if (len == 1 && string[0] == Ctrl_C && ctrl_c_interrupts) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
769 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
770 trash_input_buf(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
771 got_int = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
772 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
773 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
774 add_to_input_buf(string, len); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
775 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
776 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
777 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
778 * Alt-Key hit, add it to the input buffer. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
779 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
780 /*ARGSUSED*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
781 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
782 _OnSysChar( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
783 HWND hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
784 UINT cch, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
785 int cRepeat) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
786 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
787 char_u string[40]; /* Enough for multibyte character */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
788 int len; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
789 int modifiers; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
790 int ch = cch; /* special keys are negative */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
791 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
792 dead_key = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
793 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
794 /* TRACE("OnSysChar(%d, %c)\n", ch, ch); */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
795 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
796 /* OK, we have a character key (given by ch) which was entered with the |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
797 * ALT key pressed. Eg, if the user presses Alt-A, then ch == 'A'. Note |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
798 * that the system distinguishes Alt-a and Alt-A (Alt-Shift-a unless |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
799 * CAPSLOCK is pressed) at this point. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
800 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
801 modifiers = MOD_MASK_ALT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
802 if (GetKeyState(VK_SHIFT) & 0x8000) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
803 modifiers |= MOD_MASK_SHIFT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
804 if (GetKeyState(VK_CONTROL) & 0x8000) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
805 modifiers |= MOD_MASK_CTRL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
806 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
807 ch = simplify_key(ch, &modifiers); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
808 /* remove the SHIFT modifier for keys where it's already included, e.g., |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
809 * '(' and '*' */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
810 if (ch < 0x100 && !isalpha(ch) && isprint(ch)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
811 modifiers &= ~MOD_MASK_SHIFT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
812 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
813 /* Interpret the ALT key as making the key META, include SHIFT, etc. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
814 ch = extract_modifiers(ch, &modifiers); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
815 if (ch == CSI) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
816 ch = K_CSI; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
817 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
818 len = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
819 if (modifiers) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
820 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
821 string[len++] = CSI; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
822 string[len++] = KS_MODIFIER; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
823 string[len++] = modifiers; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
824 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
825 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
826 if (IS_SPECIAL((int)ch)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
827 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
828 string[len++] = CSI; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
829 string[len++] = K_SECOND((int)ch); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
830 string[len++] = K_THIRD((int)ch); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
831 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
832 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
833 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
834 /* Although the documentation isn't clear about it, we assume "ch" is |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
835 * a Unicode character. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
836 len += char_to_string(ch, string + len, 40 - len, TRUE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
837 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
838 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
839 add_to_input_buf(string, len); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
840 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
841 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
842 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
843 _OnMouseEvent( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
844 int button, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
845 int x, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
846 int y, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
847 int repeated_click, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
848 UINT keyFlags) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
849 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
850 int vim_modifiers = 0x0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
851 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
852 s_getting_focus = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
853 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
854 if (keyFlags & MK_SHIFT) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
855 vim_modifiers |= MOUSE_SHIFT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
856 if (keyFlags & MK_CONTROL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
857 vim_modifiers |= MOUSE_CTRL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
858 if (GetKeyState(VK_MENU) & 0x8000) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
859 vim_modifiers |= MOUSE_ALT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
860 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
861 gui_send_mouse_event(button, x, y, repeated_click, vim_modifiers); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
862 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
863 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
864 /*ARGSUSED*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
865 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
866 _OnMouseButtonDown( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
867 HWND hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
868 BOOL fDoubleClick, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
869 int x, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
870 int y, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
871 UINT keyFlags) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
872 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
873 static LONG s_prevTime = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
874 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
875 LONG currentTime = GetMessageTime(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
876 int button = -1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
877 int repeated_click; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
878 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
879 /* Give main window the focus: this is so the cursor isn't hollow. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
880 (void)SetFocus(s_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
881 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
882 if (s_uMsg == WM_LBUTTONDOWN || s_uMsg == WM_LBUTTONDBLCLK) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
883 button = MOUSE_LEFT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
884 else if (s_uMsg == WM_MBUTTONDOWN || s_uMsg == WM_MBUTTONDBLCLK) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
885 button = MOUSE_MIDDLE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
886 else if (s_uMsg == WM_RBUTTONDOWN || s_uMsg == WM_RBUTTONDBLCLK) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
887 button = MOUSE_RIGHT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
888 else if (s_uMsg == WM_XBUTTONDOWN || s_uMsg == WM_XBUTTONDBLCLK) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
889 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
890 #ifndef GET_XBUTTON_WPARAM |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
891 # define GET_XBUTTON_WPARAM(wParam) (HIWORD(wParam)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
892 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
893 button = ((GET_XBUTTON_WPARAM(s_wParam) == 1) ? MOUSE_X1 : MOUSE_X2); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
894 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
895 else if (s_uMsg == WM_CAPTURECHANGED) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
896 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
897 /* on W95/NT4, somehow you get in here with an odd Msg |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
898 * if you press one button while holding down the other..*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
899 if (s_button_pending == MOUSE_LEFT) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
900 button = MOUSE_RIGHT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
901 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
902 button = MOUSE_LEFT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
903 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
904 if (button >= 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
905 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
906 repeated_click = ((int)(currentTime - s_prevTime) < p_mouset); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
907 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
908 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
909 * Holding down the left and right buttons simulates pushing the middle |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
910 * button. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
911 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
912 if (repeated_click |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
913 && ((button == MOUSE_LEFT && s_button_pending == MOUSE_RIGHT) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
914 || (button == MOUSE_RIGHT |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
915 && s_button_pending == MOUSE_LEFT))) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
916 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
917 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
918 * Hmm, gui.c will ignore more than one button down at a time, so |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
919 * pretend we let go of it first. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
920 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
921 gui_send_mouse_event(MOUSE_RELEASE, x, y, FALSE, 0x0); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
922 button = MOUSE_MIDDLE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
923 repeated_click = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
924 s_button_pending = -1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
925 _OnMouseEvent(button, x, y, repeated_click, keyFlags); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
926 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
927 else if ((repeated_click) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
928 || (mouse_model_popup() && (button == MOUSE_RIGHT))) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
929 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
930 if (s_button_pending > -1) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
931 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
932 _OnMouseEvent(s_button_pending, x, y, FALSE, keyFlags); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
933 s_button_pending = -1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
934 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
935 /* TRACE("Button down at x %d, y %d\n", x, y); */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
936 _OnMouseEvent(button, x, y, repeated_click, keyFlags); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
937 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
938 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
939 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
940 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
941 * If this is the first press (i.e. not a multiple click) don't |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
942 * action immediately, but store and wait for: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
943 * i) button-up |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
944 * ii) mouse move |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
945 * iii) another button press |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
946 * before using it. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
947 * This enables us to make left+right simulate middle button, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
948 * without left or right being actioned first. The side-effect is |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
949 * that if you click and hold the mouse without dragging, the |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
950 * cursor doesn't move until you release the button. In practice |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
951 * this is hardly a problem. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
952 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
953 s_button_pending = button; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
954 s_x_pending = x; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
955 s_y_pending = y; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
956 s_kFlags_pending = keyFlags; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
957 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
958 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
959 s_prevTime = currentTime; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
960 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
961 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
962 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
963 /*ARGSUSED*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
964 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
965 _OnMouseMoveOrRelease( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
966 HWND hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
967 int x, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
968 int y, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
969 UINT keyFlags) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
970 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
971 int button; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
972 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
973 s_getting_focus = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
974 if (s_button_pending > -1) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
975 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
976 /* Delayed action for mouse down event */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
977 _OnMouseEvent(s_button_pending, s_x_pending, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
978 s_y_pending, FALSE, s_kFlags_pending); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
979 s_button_pending = -1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
980 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
981 if (s_uMsg == WM_MOUSEMOVE) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
982 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
983 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
984 * It's only a MOUSE_DRAG if one or more mouse buttons are being held |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
985 * down. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
986 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
987 if (!(keyFlags & (MK_LBUTTON | MK_MBUTTON | MK_RBUTTON |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
988 | MK_XBUTTON1 | MK_XBUTTON2))) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
989 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
990 gui_mouse_moved(x, y); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
991 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
992 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
993 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
994 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
995 * While button is down, keep grabbing mouse move events when |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
996 * the mouse goes outside the window |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
997 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
998 SetCapture(s_textArea); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
999 button = MOUSE_DRAG; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1000 /* TRACE(" move at x %d, y %d\n", x, y); */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1001 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1002 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1003 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1004 ReleaseCapture(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1005 button = MOUSE_RELEASE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1006 /* TRACE(" up at x %d, y %d\n", x, y); */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1007 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1008 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1009 _OnMouseEvent(button, x, y, FALSE, keyFlags); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1010 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1011 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1012 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1013 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1014 * Find the vimmenu_T with the given id |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1015 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1016 static vimmenu_T * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1017 gui_mswin_find_menu( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1018 vimmenu_T *pMenu, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1019 int id) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1020 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1021 vimmenu_T *pChildMenu; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1022 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1023 while (pMenu) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1024 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1025 if (pMenu->id == (UINT)id) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1026 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1027 if (pMenu->children != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1028 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1029 pChildMenu = gui_mswin_find_menu(pMenu->children, id); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1030 if (pChildMenu) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1031 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1032 pMenu = pChildMenu; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1033 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1034 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1035 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1036 pMenu = pMenu->next; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1037 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1038 return pMenu; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1039 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1040 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1041 /*ARGSUSED*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1042 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1043 _OnMenu( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1044 HWND hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1045 int id, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1046 HWND hwndCtl, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1047 UINT codeNotify) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1048 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1049 vimmenu_T *pMenu; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1050 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1051 pMenu = gui_mswin_find_menu(root_menu, id); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1052 if (pMenu) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1053 gui_menu_cb(pMenu); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1054 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1055 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1056 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1057 #ifdef MSWIN_FIND_REPLACE |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1058 # ifdef FEAT_MBYTE |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1059 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1060 * copy useful data from structure LPFINDREPLACE to structure LPFINDREPLACEW |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1061 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1062 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1063 findrep_atow(LPFINDREPLACEW lpfrw, LPFINDREPLACE lpfr) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1064 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1065 WCHAR *wp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1066 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1067 lpfrw->hwndOwner = lpfr->hwndOwner; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1068 lpfrw->Flags = lpfr->Flags; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1069 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1070 wp = enc_to_utf16((char_u *)lpfr->lpstrFindWhat, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1071 wcsncpy(lpfrw->lpstrFindWhat, wp, lpfrw->wFindWhatLen - 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1072 vim_free(wp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1073 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1074 /* the field "lpstrReplaceWith" doesn't need to be copied */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1075 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1076 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1077 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1078 * copy useful data from structure LPFINDREPLACEW to structure LPFINDREPLACE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1079 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1080 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1081 findrep_wtoa(LPFINDREPLACE lpfr, LPFINDREPLACEW lpfrw) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1082 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1083 char_u *p; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1084 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1085 lpfr->Flags = lpfrw->Flags; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1086 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1087 p = utf16_to_enc((short_u*)lpfrw->lpstrFindWhat, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1088 vim_strncpy((char_u *)lpfr->lpstrFindWhat, p, lpfr->wFindWhatLen - 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1089 vim_free(p); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1090 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1091 p = utf16_to_enc((short_u*)lpfrw->lpstrReplaceWith, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1092 vim_strncpy((char_u *)lpfr->lpstrReplaceWith, p, lpfr->wReplaceWithLen - 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1093 vim_free(p); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1094 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1095 # endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1096 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1097 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1098 * Handle a Find/Replace window message. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1099 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1100 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1101 _OnFindRepl(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1102 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1103 int flags = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1104 int down; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1105 |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1106 # ifdef FEAT_MBYTE |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1107 /* If the OS is Windows NT, and 'encoding' differs from active codepage: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1108 * convert text from wide string. */ |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1109 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1110 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1111 findrep_wtoa(&s_findrep_struct, &s_findrep_struct_w); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1112 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1113 # endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1114 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1115 if (s_findrep_struct.Flags & FR_DIALOGTERM) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1116 /* Give main window the focus back. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1117 (void)SetFocus(s_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1118 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1119 if (s_findrep_struct.Flags & FR_FINDNEXT) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1120 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1121 flags = FRD_FINDNEXT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1122 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1123 /* Give main window the focus back: this is so the cursor isn't |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1124 * hollow. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1125 (void)SetFocus(s_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1126 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1127 else if (s_findrep_struct.Flags & FR_REPLACE) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1128 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1129 flags = FRD_REPLACE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1130 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1131 /* Give main window the focus back: this is so the cursor isn't |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1132 * hollow. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1133 (void)SetFocus(s_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1134 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1135 else if (s_findrep_struct.Flags & FR_REPLACEALL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1136 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1137 flags = FRD_REPLACEALL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1138 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1139 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1140 if (flags != 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1141 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1142 /* Call the generic GUI function to do the actual work. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1143 if (s_findrep_struct.Flags & FR_WHOLEWORD) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1144 flags |= FRD_WHOLE_WORD; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1145 if (s_findrep_struct.Flags & FR_MATCHCASE) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1146 flags |= FRD_MATCH_CASE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1147 down = (s_findrep_struct.Flags & FR_DOWN) != 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1148 gui_do_findrepl(flags, (char_u *)s_findrep_struct.lpstrFindWhat, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1149 (char_u *)s_findrep_struct.lpstrReplaceWith, down); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1150 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1151 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1152 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1153 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1154 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1155 HandleMouseHide(UINT uMsg, LPARAM lParam) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1156 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1157 static LPARAM last_lParam = 0L; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1158 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1159 /* We sometimes get a mousemove when the mouse didn't move... */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1160 if (uMsg == WM_MOUSEMOVE || uMsg == WM_NCMOUSEMOVE) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1161 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1162 if (lParam == last_lParam) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1163 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1164 last_lParam = lParam; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1165 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1166 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1167 /* Handle specially, to centralise coding. We need to be sure we catch all |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1168 * possible events which should cause us to restore the cursor (as it is a |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1169 * shared resource, we take full responsibility for it). |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1170 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1171 switch (uMsg) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1172 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1173 case WM_KEYUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1174 case WM_CHAR: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1175 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1176 * blank out the pointer if necessary |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1177 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1178 if (p_mh) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1179 gui_mch_mousehide(TRUE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1180 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1181 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1182 case WM_SYSKEYUP: /* show the pointer when a system-key is pressed */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1183 case WM_SYSCHAR: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1184 case WM_MOUSEMOVE: /* show the pointer on any mouse action */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1185 case WM_LBUTTONDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1186 case WM_LBUTTONUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1187 case WM_MBUTTONDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1188 case WM_MBUTTONUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1189 case WM_RBUTTONDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1190 case WM_RBUTTONUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1191 case WM_XBUTTONDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1192 case WM_XBUTTONUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1193 case WM_NCMOUSEMOVE: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1194 case WM_NCLBUTTONDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1195 case WM_NCLBUTTONUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1196 case WM_NCMBUTTONDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1197 case WM_NCMBUTTONUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1198 case WM_NCRBUTTONDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1199 case WM_NCRBUTTONUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1200 case WM_KILLFOCUS: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1201 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1202 * if the pointer is currently hidden, then we should show it. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1203 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1204 gui_mch_mousehide(FALSE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1205 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1206 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1207 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1208 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1209 static LRESULT CALLBACK |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1210 _TextAreaWndProc( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1211 HWND hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1212 UINT uMsg, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1213 WPARAM wParam, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1214 LPARAM lParam) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1215 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1216 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1217 TRACE("TextAreaWndProc: hwnd = %08x, msg = %x, wParam = %x, lParam = %x\n", |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1218 hwnd, uMsg, wParam, lParam); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1219 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1220 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1221 HandleMouseHide(uMsg, lParam); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1222 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1223 s_uMsg = uMsg; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1224 s_wParam = wParam; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1225 s_lParam = lParam; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1226 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1227 #ifdef FEAT_BEVAL |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1228 TrackUserActivity(uMsg); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1229 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1230 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1231 switch (uMsg) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1232 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1233 HANDLE_MSG(hwnd, WM_LBUTTONDBLCLK,_OnMouseButtonDown); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1234 HANDLE_MSG(hwnd, WM_LBUTTONDOWN,_OnMouseButtonDown); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1235 HANDLE_MSG(hwnd, WM_LBUTTONUP, _OnMouseMoveOrRelease); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1236 HANDLE_MSG(hwnd, WM_MBUTTONDBLCLK,_OnMouseButtonDown); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1237 HANDLE_MSG(hwnd, WM_MBUTTONDOWN,_OnMouseButtonDown); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1238 HANDLE_MSG(hwnd, WM_MBUTTONUP, _OnMouseMoveOrRelease); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1239 HANDLE_MSG(hwnd, WM_MOUSEMOVE, _OnMouseMoveOrRelease); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1240 HANDLE_MSG(hwnd, WM_PAINT, _OnPaint); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1241 HANDLE_MSG(hwnd, WM_RBUTTONDBLCLK,_OnMouseButtonDown); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1242 HANDLE_MSG(hwnd, WM_RBUTTONDOWN,_OnMouseButtonDown); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1243 HANDLE_MSG(hwnd, WM_RBUTTONUP, _OnMouseMoveOrRelease); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1244 HANDLE_MSG(hwnd, WM_XBUTTONDBLCLK,_OnMouseButtonDown); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1245 HANDLE_MSG(hwnd, WM_XBUTTONDOWN,_OnMouseButtonDown); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1246 HANDLE_MSG(hwnd, WM_XBUTTONUP, _OnMouseMoveOrRelease); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1247 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1248 #ifdef FEAT_BEVAL |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1249 case WM_NOTIFY: Handle_WM_Notify(hwnd, (LPNMHDR)lParam); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1250 return TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1251 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1252 default: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1253 return MyWindowProc(hwnd, uMsg, wParam, lParam); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1254 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1255 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1256 |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1257 #if defined(FEAT_MBYTE) \ |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1258 || defined(GLOBAL_IME) \ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1259 || defined(PROTO) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1260 # ifdef PROTO |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1261 typedef int WINAPI; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1262 # endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1263 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1264 LRESULT WINAPI |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1265 vim_WindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1266 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1267 # ifdef GLOBAL_IME |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1268 return global_ime_DefWindowProc(hwnd, message, wParam, lParam); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1269 # else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1270 if (wide_WindowProc) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1271 return DefWindowProcW(hwnd, message, wParam, lParam); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1272 return DefWindowProc(hwnd, message, wParam, lParam); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1273 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1274 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1275 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1276 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1277 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1278 * Called when the foreground or background color has been changed. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1279 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1280 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1281 gui_mch_new_colors(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1282 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1283 /* nothing to do? */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1284 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1285 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1286 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1287 * Set the colors to their default values. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1288 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1289 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1290 gui_mch_def_colors(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1291 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1292 gui.norm_pixel = GetSysColor(COLOR_WINDOWTEXT); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1293 gui.back_pixel = GetSysColor(COLOR_WINDOW); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1294 gui.def_norm_pixel = gui.norm_pixel; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1295 gui.def_back_pixel = gui.back_pixel; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1296 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1297 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1298 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1299 * Open the GUI window which was created by a call to gui_mch_init(). |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1300 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1301 int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1302 gui_mch_open(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1303 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1304 #ifndef SW_SHOWDEFAULT |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1305 # define SW_SHOWDEFAULT 10 /* Borland 5.0 doesn't have it */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1306 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1307 /* Actually open the window, if not already visible |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1308 * (may be done already in gui_mch_set_shellsize) */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1309 if (!IsWindowVisible(s_hwnd)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1310 ShowWindow(s_hwnd, SW_SHOWDEFAULT); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1311 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1312 #ifdef MSWIN_FIND_REPLACE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1313 /* Init replace string here, so that we keep it when re-opening the |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1314 * dialog. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1315 s_findrep_struct.lpstrReplaceWith[0] = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1316 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1317 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1318 return OK; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1319 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1320 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1321 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1322 * Get the position of the top left corner of the window. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1323 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1324 int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1325 gui_mch_get_winpos(int *x, int *y) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1326 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1327 RECT rect; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1328 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1329 GetWindowRect(s_hwnd, &rect); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1330 *x = rect.left; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1331 *y = rect.top; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1332 return OK; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1333 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1334 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1335 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1336 * Set the position of the top left corner of the window to the given |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1337 * coordinates. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1338 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1339 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1340 gui_mch_set_winpos(int x, int y) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1341 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1342 SetWindowPos(s_hwnd, NULL, x, y, 0, 0, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1343 SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1344 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1345 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1346 gui_mch_set_text_area_pos(int x, int y, int w, int h) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1347 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1348 static int oldx = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1349 static int oldy = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1350 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1351 SetWindowPos(s_textArea, NULL, x, y, w, h, SWP_NOZORDER | SWP_NOACTIVATE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1352 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1353 #ifdef FEAT_TOOLBAR |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1354 if (vim_strchr(p_go, GO_TOOLBAR) != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1355 SendMessage(s_toolbarhwnd, WM_SIZE, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1356 (WPARAM)0, (LPARAM)(w + ((long)(TOOLBAR_BUTTON_HEIGHT+8)<<16))); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1357 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1358 #if defined(FEAT_GUI_TABLINE) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1359 if (showing_tabline) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1360 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1361 int top = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1362 RECT rect; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1363 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1364 # ifdef FEAT_TOOLBAR |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1365 if (vim_strchr(p_go, GO_TOOLBAR) != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1366 top = TOOLBAR_BUTTON_HEIGHT + TOOLBAR_BORDER_HEIGHT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1367 # endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1368 GetClientRect(s_hwnd, &rect); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1369 MoveWindow(s_tabhwnd, 0, top, rect.right, gui.tabline_height, TRUE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1370 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1371 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1372 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1373 /* When side scroll bar is unshown, the size of window will change. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1374 * then, the text area move left or right. thus client rect should be |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1375 * forcedly redrawn. (Yasuhiro Matsumoto) */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1376 if (oldx != x || oldy != y) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1377 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1378 InvalidateRect(s_hwnd, NULL, FALSE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1379 oldx = x; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1380 oldy = y; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1381 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1382 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1383 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1384 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1385 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1386 * Scrollbar stuff: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1387 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1388 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1389 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1390 gui_mch_enable_scrollbar( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1391 scrollbar_T *sb, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1392 int flag) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1393 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1394 ShowScrollBar(sb->id, SB_CTL, flag); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1395 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1396 /* TODO: When the window is maximized, the size of the window stays the |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1397 * same, thus the size of the text area changes. On Win98 it's OK, on Win |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1398 * NT 4.0 it's not... */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1399 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1400 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1401 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1402 gui_mch_set_scrollbar_pos( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1403 scrollbar_T *sb, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1404 int x, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1405 int y, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1406 int w, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1407 int h) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1408 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1409 SetWindowPos(sb->id, NULL, x, y, w, h, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1410 SWP_NOZORDER | SWP_NOACTIVATE | SWP_SHOWWINDOW); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1411 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1412 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1413 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1414 gui_mch_create_scrollbar( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1415 scrollbar_T *sb, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1416 int orient) /* SBAR_VERT or SBAR_HORIZ */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1417 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1418 sb->id = CreateWindow( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1419 "SCROLLBAR", "Scrollbar", |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1420 WS_CHILD | ((orient == SBAR_VERT) ? SBS_VERT : SBS_HORZ), 0, 0, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1421 10, /* Any value will do for now */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1422 10, /* Any value will do for now */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1423 s_hwnd, NULL, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1424 s_hinst, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1425 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1426 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1427 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1428 * Find the scrollbar with the given hwnd. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1429 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1430 static scrollbar_T * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1431 gui_mswin_find_scrollbar(HWND hwnd) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1432 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1433 win_T *wp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1434 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1435 if (gui.bottom_sbar.id == hwnd) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1436 return &gui.bottom_sbar; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1437 FOR_ALL_WINDOWS(wp) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1438 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1439 if (wp->w_scrollbars[SBAR_LEFT].id == hwnd) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1440 return &wp->w_scrollbars[SBAR_LEFT]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1441 if (wp->w_scrollbars[SBAR_RIGHT].id == hwnd) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1442 return &wp->w_scrollbars[SBAR_RIGHT]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1443 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1444 return NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1445 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1446 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1447 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1448 * Get the character size of a font. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1449 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1450 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1451 GetFontSize(GuiFont font) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1452 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1453 HWND hwnd = GetDesktopWindow(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1454 HDC hdc = GetWindowDC(hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1455 HFONT hfntOld = SelectFont(hdc, (HFONT)font); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1456 TEXTMETRIC tm; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1457 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1458 GetTextMetrics(hdc, &tm); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1459 gui.char_width = tm.tmAveCharWidth + tm.tmOverhang; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1460 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1461 gui.char_height = tm.tmHeight + p_linespace; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1462 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1463 SelectFont(hdc, hfntOld); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1464 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1465 ReleaseDC(hwnd, hdc); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1466 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1467 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1468 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1469 * Adjust gui.char_height (after 'linespace' was changed). |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1470 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1471 int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1472 gui_mch_adjust_charheight(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1473 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1474 GetFontSize(gui.norm_font); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1475 return OK; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1476 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1477 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1478 static GuiFont |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1479 get_font_handle(LOGFONT *lf) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1480 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1481 HFONT font = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1482 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1483 /* Load the font */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1484 font = CreateFontIndirect(lf); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1485 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1486 if (font == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1487 return NOFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1488 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1489 return (GuiFont)font; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1490 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1491 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1492 static int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1493 pixels_to_points(int pixels, int vertical) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1494 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1495 int points; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1496 HWND hwnd; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1497 HDC hdc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1498 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1499 hwnd = GetDesktopWindow(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1500 hdc = GetWindowDC(hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1501 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1502 points = MulDiv(pixels, 72, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1503 GetDeviceCaps(hdc, vertical ? LOGPIXELSY : LOGPIXELSX)); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1504 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1505 ReleaseDC(hwnd, hdc); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1506 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1507 return points; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1508 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1509 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1510 GuiFont |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1511 gui_mch_get_font( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1512 char_u *name, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1513 int giveErrorIfMissing) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1514 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1515 LOGFONT lf; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1516 GuiFont font = NOFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1517 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1518 if (get_logfont(&lf, name, NULL, giveErrorIfMissing) == OK) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1519 font = get_font_handle(&lf); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1520 if (font == NOFONT && giveErrorIfMissing) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1521 EMSG2(_(e_font), name); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1522 return font; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1523 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1524 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1525 #if defined(FEAT_EVAL) || defined(PROTO) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1526 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1527 * Return the name of font "font" in allocated memory. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1528 * Don't know how to get the actual name, thus use the provided name. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1529 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1530 /*ARGSUSED*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1531 char_u * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1532 gui_mch_get_fontname(GuiFont font, char_u *name) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1533 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1534 if (name == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1535 return NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1536 return vim_strsave(name); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1537 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1538 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1539 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1540 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1541 gui_mch_free_font(GuiFont font) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1542 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1543 if (font) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1544 DeleteObject((HFONT)font); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1545 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1546 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1547 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1548 * Return the Pixel value (color) for the given color name. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1549 * Return INVALCOLOR for error. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1550 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1551 guicolor_T |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1552 gui_mch_get_color(char_u *name) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1553 { |
9017
7b1200ea03a1
commit https://github.com/vim/vim/commit/c285fe7c3ffdb3ec4eff20a1d1d5accfc80f1a86
Christian Brabandt <cb@256bit.org>
parents:
9013
diff
changeset
|
1554 int i; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1555 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1556 typedef struct SysColorTable |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1557 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1558 char *name; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1559 int color; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1560 } SysColorTable; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1561 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1562 static SysColorTable sys_table[] = |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1563 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1564 {"SYS_3DDKSHADOW", COLOR_3DDKSHADOW}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1565 {"SYS_3DHILIGHT", COLOR_3DHILIGHT}, |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1566 #ifdef COLOR_3DHIGHLIGHT |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1567 {"SYS_3DHIGHLIGHT", COLOR_3DHIGHLIGHT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1568 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1569 {"SYS_BTNHILIGHT", COLOR_BTNHILIGHT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1570 {"SYS_BTNHIGHLIGHT", COLOR_BTNHIGHLIGHT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1571 {"SYS_3DLIGHT", COLOR_3DLIGHT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1572 {"SYS_3DSHADOW", COLOR_3DSHADOW}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1573 {"SYS_DESKTOP", COLOR_DESKTOP}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1574 {"SYS_INFOBK", COLOR_INFOBK}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1575 {"SYS_INFOTEXT", COLOR_INFOTEXT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1576 {"SYS_3DFACE", COLOR_3DFACE}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1577 {"SYS_BTNFACE", COLOR_BTNFACE}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1578 {"SYS_BTNSHADOW", COLOR_BTNSHADOW}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1579 {"SYS_ACTIVEBORDER", COLOR_ACTIVEBORDER}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1580 {"SYS_ACTIVECAPTION", COLOR_ACTIVECAPTION}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1581 {"SYS_APPWORKSPACE", COLOR_APPWORKSPACE}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1582 {"SYS_BACKGROUND", COLOR_BACKGROUND}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1583 {"SYS_BTNTEXT", COLOR_BTNTEXT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1584 {"SYS_CAPTIONTEXT", COLOR_CAPTIONTEXT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1585 {"SYS_GRAYTEXT", COLOR_GRAYTEXT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1586 {"SYS_HIGHLIGHT", COLOR_HIGHLIGHT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1587 {"SYS_HIGHLIGHTTEXT", COLOR_HIGHLIGHTTEXT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1588 {"SYS_INACTIVEBORDER", COLOR_INACTIVEBORDER}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1589 {"SYS_INACTIVECAPTION", COLOR_INACTIVECAPTION}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1590 {"SYS_INACTIVECAPTIONTEXT", COLOR_INACTIVECAPTIONTEXT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1591 {"SYS_MENU", COLOR_MENU}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1592 {"SYS_MENUTEXT", COLOR_MENUTEXT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1593 {"SYS_SCROLLBAR", COLOR_SCROLLBAR}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1594 {"SYS_WINDOW", COLOR_WINDOW}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1595 {"SYS_WINDOWFRAME", COLOR_WINDOWFRAME}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1596 {"SYS_WINDOWTEXT", COLOR_WINDOWTEXT} |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1597 }; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1598 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1599 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1600 * Try to look up a system colour. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1601 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1602 for (i = 0; i < sizeof(sys_table) / sizeof(sys_table[0]); i++) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1603 if (STRICMP(name, sys_table[i].name) == 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1604 return GetSysColor(sys_table[i].color); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1605 |
9013
22c29a515b53
commit https://github.com/vim/vim/commit/ab3022196ea4f1496e79b8ee85996e31c45d02f1
Christian Brabandt <cb@256bit.org>
parents:
8835
diff
changeset
|
1606 return gui_get_color_cmn(name); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1607 } |
9017
7b1200ea03a1
commit https://github.com/vim/vim/commit/c285fe7c3ffdb3ec4eff20a1d1d5accfc80f1a86
Christian Brabandt <cb@256bit.org>
parents:
9013
diff
changeset
|
1608 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1609 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1610 * Return OK if the key with the termcap name "name" is supported. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1611 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1612 int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1613 gui_mch_haskey(char_u *name) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1614 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1615 int i; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1616 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1617 for (i = 0; special_keys[i].vim_code1 != NUL; i++) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1618 if (name[0] == special_keys[i].vim_code0 && |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1619 name[1] == special_keys[i].vim_code1) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1620 return OK; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1621 return FAIL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1622 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1623 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1624 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1625 gui_mch_beep(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1626 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1627 MessageBeep(MB_OK); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1628 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1629 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1630 * Invert a rectangle from row r, column c, for nr rows and nc columns. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1631 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1632 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1633 gui_mch_invert_rectangle( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1634 int r, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1635 int c, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1636 int nr, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1637 int nc) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1638 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1639 RECT rc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1640 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1641 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1642 * Note: InvertRect() excludes right and bottom of rectangle. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1643 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1644 rc.left = FILL_X(c); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1645 rc.top = FILL_Y(r); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1646 rc.right = rc.left + nc * gui.char_width; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1647 rc.bottom = rc.top + nr * gui.char_height; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1648 InvertRect(s_hdc, &rc); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1649 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1650 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1651 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1652 * Iconify the GUI window. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1653 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1654 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1655 gui_mch_iconify(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1656 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1657 ShowWindow(s_hwnd, SW_MINIMIZE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1658 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1659 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1660 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1661 * Draw a cursor without focus. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1662 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1663 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1664 gui_mch_draw_hollow_cursor(guicolor_T color) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1665 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1666 HBRUSH hbr; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1667 RECT rc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1668 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1669 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1670 * Note: FrameRect() excludes right and bottom of rectangle. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1671 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1672 rc.left = FILL_X(gui.col); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1673 rc.top = FILL_Y(gui.row); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1674 rc.right = rc.left + gui.char_width; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1675 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1676 if (mb_lefthalve(gui.row, gui.col)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1677 rc.right += gui.char_width; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1678 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1679 rc.bottom = rc.top + gui.char_height; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1680 hbr = CreateSolidBrush(color); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1681 FrameRect(s_hdc, &rc, hbr); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1682 DeleteBrush(hbr); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1683 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1684 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1685 * Draw part of a cursor, "w" pixels wide, and "h" pixels high, using |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1686 * color "color". |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1687 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1688 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1689 gui_mch_draw_part_cursor( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1690 int w, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1691 int h, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1692 guicolor_T color) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1693 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1694 HBRUSH hbr; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1695 RECT rc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1696 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1697 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1698 * Note: FillRect() excludes right and bottom of rectangle. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1699 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1700 rc.left = |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1701 #ifdef FEAT_RIGHTLEFT |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1702 /* vertical line should be on the right of current point */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1703 CURSOR_BAR_RIGHT ? FILL_X(gui.col + 1) - w : |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1704 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1705 FILL_X(gui.col); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1706 rc.top = FILL_Y(gui.row) + gui.char_height - h; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1707 rc.right = rc.left + w; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1708 rc.bottom = rc.top + h; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1709 hbr = CreateSolidBrush(color); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1710 FillRect(s_hdc, &rc, hbr); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1711 DeleteBrush(hbr); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1712 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1713 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1714 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1715 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1716 * Generates a VK_SPACE when the internal dead_key flag is set to output the |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1717 * dead key's nominal character and re-post the original message. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1718 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1719 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1720 outputDeadKey_rePost(MSG originalMsg) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1721 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1722 static MSG deadCharExpel; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1723 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1724 if (!dead_key) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1725 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1726 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1727 dead_key = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1728 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1729 /* Make Windows generate the dead key's character */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1730 deadCharExpel.message = originalMsg.message; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1731 deadCharExpel.hwnd = originalMsg.hwnd; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1732 deadCharExpel.wParam = VK_SPACE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1733 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1734 MyTranslateMessage(&deadCharExpel); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1735 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1736 /* re-generate the current character free of the dead char influence */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1737 PostMessage(originalMsg.hwnd, originalMsg.message, originalMsg.wParam, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1738 originalMsg.lParam); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1739 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1740 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1741 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1742 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1743 * Process a single Windows message. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1744 * If one is not available we hang until one is. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1745 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1746 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1747 process_message(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1748 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1749 MSG msg; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1750 UINT vk = 0; /* Virtual key */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1751 char_u string[40]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1752 int i; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1753 int modifiers = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1754 int key; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1755 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1756 static char_u k10[] = {K_SPECIAL, 'k', ';', 0}; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1757 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1758 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1759 pGetMessage(&msg, NULL, 0, 0); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1760 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1761 #ifdef FEAT_OLE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1762 /* Look after OLE Automation commands */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1763 if (msg.message == WM_OLE) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1764 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1765 char_u *str = (char_u *)msg.lParam; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1766 if (str == NULL || *str == NUL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1767 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1768 /* Message can't be ours, forward it. Fixes problem with Ultramon |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1769 * 3.0.4 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1770 pDispatchMessage(&msg); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1771 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1772 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1773 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1774 add_to_input_buf(str, (int)STRLEN(str)); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1775 vim_free(str); /* was allocated in CVim::SendKeys() */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1776 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1777 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1778 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1779 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1780 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1781 #ifdef MSWIN_FIND_REPLACE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1782 /* Don't process messages used by the dialog */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1783 if (s_findrep_hwnd != NULL && pIsDialogMessage(s_findrep_hwnd, &msg)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1784 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1785 HandleMouseHide(msg.message, msg.lParam); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1786 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1787 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1788 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1789 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1790 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1791 * Check if it's a special key that we recognise. If not, call |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1792 * TranslateMessage(). |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1793 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1794 if (msg.message == WM_KEYDOWN || msg.message == WM_SYSKEYDOWN) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1795 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1796 vk = (int) msg.wParam; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1797 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1798 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1799 * Handle dead keys in special conditions in other cases we let Windows |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1800 * handle them and do not interfere. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1801 * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1802 * The dead_key flag must be reset on several occasions: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1803 * - in _OnChar() (or _OnSysChar()) as any dead key was necessarily |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1804 * consumed at that point (This is when we let Windows combine the |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1805 * dead character on its own) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1806 * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1807 * - Before doing something special such as regenerating keypresses to |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1808 * expel the dead character as this could trigger an infinite loop if |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1809 * for some reason MyTranslateMessage() do not trigger a call |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1810 * immediately to _OnChar() (or _OnSysChar()). |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1811 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1812 if (dead_key) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1813 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1814 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1815 * If a dead key was pressed and the user presses VK_SPACE, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1816 * VK_BACK, or VK_ESCAPE it means that he actually wants to deal |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1817 * with the dead char now, so do nothing special and let Windows |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1818 * handle it. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1819 * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1820 * Note that VK_SPACE combines with the dead_key's character and |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1821 * only one WM_CHAR will be generated by TranslateMessage(), in |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1822 * the two other cases two WM_CHAR will be generated: the dead |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1823 * char and VK_BACK or VK_ESCAPE. That is most likely what the |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1824 * user expects. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1825 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1826 if ((vk == VK_SPACE || vk == VK_BACK || vk == VK_ESCAPE)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1827 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1828 dead_key = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1829 MyTranslateMessage(&msg); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1830 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1831 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1832 /* In modes where we are not typing, dead keys should behave |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1833 * normally */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1834 else if (!(get_real_state() & (INSERT | CMDLINE | SELECTMODE))) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1835 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1836 outputDeadKey_rePost(msg); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1837 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1838 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1839 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1840 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1841 /* Check for CTRL-BREAK */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1842 if (vk == VK_CANCEL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1843 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1844 trash_input_buf(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1845 got_int = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1846 string[0] = Ctrl_C; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1847 add_to_input_buf(string, 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1848 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1849 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1850 for (i = 0; special_keys[i].key_sym != 0; i++) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1851 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1852 /* ignore VK_SPACE when ALT key pressed: system menu */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1853 if (special_keys[i].key_sym == vk |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1854 && (vk != VK_SPACE || !(GetKeyState(VK_MENU) & 0x8000))) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1855 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1856 /* |
9252
c25898cc99c1
commit https://github.com/vim/vim/commit/945ec093cd4ddefab930239990564b12eb232153
Christian Brabandt <cb@256bit.org>
parents:
9236
diff
changeset
|
1857 * Behave as expected if we have a dead key and the special key |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1858 * is a key that would normally trigger the dead key nominal |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1859 * character output (such as a NUMPAD printable character or |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1860 * the TAB key, etc...). |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1861 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1862 if (dead_key && (special_keys[i].vim_code0 == 'K' |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1863 || vk == VK_TAB || vk == CAR)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1864 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1865 outputDeadKey_rePost(msg); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1866 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1867 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1868 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1869 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1870 /* Check for <F10>: Windows selects the menu. When <F10> is |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1871 * mapped we want to use the mapping instead. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1872 if (vk == VK_F10 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1873 && gui.menu_is_active |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1874 && check_map(k10, State, FALSE, TRUE, FALSE, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1875 NULL, NULL) == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1876 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1877 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1878 if (GetKeyState(VK_SHIFT) & 0x8000) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1879 modifiers |= MOD_MASK_SHIFT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1880 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1881 * Don't use caps-lock as shift, because these are special keys |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1882 * being considered here, and we only want letters to get |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1883 * shifted -- webb |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1884 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1885 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1886 if (GetKeyState(VK_CAPITAL) & 0x0001) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1887 modifiers ^= MOD_MASK_SHIFT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1888 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1889 if (GetKeyState(VK_CONTROL) & 0x8000) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1890 modifiers |= MOD_MASK_CTRL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1891 if (GetKeyState(VK_MENU) & 0x8000) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1892 modifiers |= MOD_MASK_ALT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1893 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1894 if (special_keys[i].vim_code1 == NUL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1895 key = special_keys[i].vim_code0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1896 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1897 key = TO_SPECIAL(special_keys[i].vim_code0, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1898 special_keys[i].vim_code1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1899 key = simplify_key(key, &modifiers); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1900 if (key == CSI) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1901 key = K_CSI; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1902 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1903 if (modifiers) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1904 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1905 string[0] = CSI; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1906 string[1] = KS_MODIFIER; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1907 string[2] = modifiers; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1908 add_to_input_buf(string, 3); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1909 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1910 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1911 if (IS_SPECIAL(key)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1912 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1913 string[0] = CSI; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1914 string[1] = K_SECOND(key); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1915 string[2] = K_THIRD(key); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1916 add_to_input_buf(string, 3); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1917 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1918 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1919 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1920 int len; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1921 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1922 /* Handle "key" as a Unicode character. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1923 len = char_to_string(key, string, 40, FALSE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1924 add_to_input_buf(string, len); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1925 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1926 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1927 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1928 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1929 if (special_keys[i].key_sym == 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1930 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1931 /* Some keys need C-S- where they should only need C-. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1932 * Ignore 0xff, Windows XP sends it when NUMLOCK has changed since |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1933 * system startup (Helmut Stiegler, 2003 Oct 3). */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1934 if (vk != 0xff |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1935 && (GetKeyState(VK_CONTROL) & 0x8000) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1936 && !(GetKeyState(VK_SHIFT) & 0x8000) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1937 && !(GetKeyState(VK_MENU) & 0x8000)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1938 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1939 /* CTRL-6 is '^'; Japanese keyboard maps '^' to vk == 0xDE */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1940 if (vk == '6' || MapVirtualKey(vk, 2) == (UINT)'^') |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1941 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1942 string[0] = Ctrl_HAT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1943 add_to_input_buf(string, 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1944 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1945 /* vk == 0xBD AZERTY for CTRL-'-', but CTRL-[ for * QWERTY! */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1946 else if (vk == 0xBD) /* QWERTY for CTRL-'-' */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1947 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1948 string[0] = Ctrl__; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1949 add_to_input_buf(string, 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1950 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1951 /* CTRL-2 is '@'; Japanese keyboard maps '@' to vk == 0xC0 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1952 else if (vk == '2' || MapVirtualKey(vk, 2) == (UINT)'@') |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1953 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1954 string[0] = Ctrl_AT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1955 add_to_input_buf(string, 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1956 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1957 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1958 MyTranslateMessage(&msg); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1959 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1960 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1961 MyTranslateMessage(&msg); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1962 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1963 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1964 #ifdef FEAT_MBYTE_IME |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1965 else if (msg.message == WM_IME_NOTIFY) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1966 _OnImeNotify(msg.hwnd, (DWORD)msg.wParam, (DWORD)msg.lParam); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1967 else if (msg.message == WM_KEYUP && im_get_status()) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1968 /* added for non-MS IME (Yasuhiro Matsumoto) */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1969 MyTranslateMessage(&msg); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1970 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1971 #if !defined(FEAT_MBYTE_IME) && defined(GLOBAL_IME) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1972 /* GIME_TEST */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1973 else if (msg.message == WM_IME_STARTCOMPOSITION) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1974 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1975 POINT point; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1976 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1977 global_ime_set_font(&norm_logfont); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1978 point.x = FILL_X(gui.col); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1979 point.y = FILL_Y(gui.row); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1980 MapWindowPoints(s_textArea, s_hwnd, &point, 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1981 global_ime_set_position(&point); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1982 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1983 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1984 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1985 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1986 /* Check for <F10>: Default effect is to select the menu. When <F10> is |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1987 * mapped we need to stop it here to avoid strange effects (e.g., for the |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1988 * key-up event) */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1989 if (vk != VK_F10 || check_map(k10, State, FALSE, TRUE, FALSE, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1990 NULL, NULL) == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1991 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1992 pDispatchMessage(&msg); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1993 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1994 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1995 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1996 * Catch up with any queued events. This may put keyboard input into the |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1997 * input buffer, call resize call-backs, trigger timers etc. If there is |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1998 * nothing in the event queue (& no timers pending), then we return |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1999 * immediately. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2000 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2001 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2002 gui_mch_update(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2003 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2004 MSG msg; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2005 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2006 if (!s_busy_processing) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2007 while (pPeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2008 && !vim_is_input_buf_full()) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2009 process_message(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2010 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2011 |
9179
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2012 static void |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2013 remove_any_timer(void) |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2014 { |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2015 MSG msg; |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2016 |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2017 if (s_wait_timer != 0 && !s_timed_out) |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2018 { |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2019 KillTimer(NULL, s_wait_timer); |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2020 |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2021 /* Eat spurious WM_TIMER messages */ |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2022 while (pPeekMessage(&msg, s_hwnd, WM_TIMER, WM_TIMER, PM_REMOVE)) |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2023 ; |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2024 s_wait_timer = 0; |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2025 } |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2026 } |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2027 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2028 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2029 * GUI input routine called by gui_wait_for_chars(). Waits for a character |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2030 * from the keyboard. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2031 * wtime == -1 Wait forever. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2032 * wtime == 0 This should never happen. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2033 * wtime > 0 Wait wtime milliseconds for a character. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2034 * Returns OK if a character was found to be available within the given time, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2035 * or FAIL otherwise. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2036 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2037 int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2038 gui_mch_wait_for_chars(int wtime) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2039 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2040 int focus; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2041 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2042 s_timed_out = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2043 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2044 if (wtime > 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2045 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2046 /* Don't do anything while processing a (scroll) message. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2047 if (s_busy_processing) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2048 return FAIL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2049 s_wait_timer = (UINT)SetTimer(NULL, 0, (UINT)wtime, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2050 (TIMERPROC)_OnTimer); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2051 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2052 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2053 allow_scrollbar = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2054 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2055 focus = gui.in_focus; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2056 while (!s_timed_out) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2057 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2058 /* Stop or start blinking when focus changes */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2059 if (gui.in_focus != focus) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2060 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2061 if (gui.in_focus) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2062 gui_mch_start_blink(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2063 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2064 gui_mch_stop_blink(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2065 focus = gui.in_focus; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2066 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2067 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2068 if (s_need_activate) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2069 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2070 (void)SetForegroundWindow(s_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2071 s_need_activate = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2072 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2073 |
9179
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2074 #ifdef FEAT_TIMERS |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2075 did_add_timer = FALSE; |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2076 #endif |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2077 #ifdef MESSAGE_QUEUE |
8222
4f0677020a43
commit https://github.com/vim/vim/commit/9186a276222ea8a7c88f4092ac5b4201381f4e20
Christian Brabandt <cb@256bit.org>
parents:
8172
diff
changeset
|
2078 /* Check channel while waiting message. */ |
4f0677020a43
commit https://github.com/vim/vim/commit/9186a276222ea8a7c88f4092ac5b4201381f4e20
Christian Brabandt <cb@256bit.org>
parents:
8172
diff
changeset
|
2079 for (;;) |
4f0677020a43
commit https://github.com/vim/vim/commit/9186a276222ea8a7c88f4092ac5b4201381f4e20
Christian Brabandt <cb@256bit.org>
parents:
8172
diff
changeset
|
2080 { |
4f0677020a43
commit https://github.com/vim/vim/commit/9186a276222ea8a7c88f4092ac5b4201381f4e20
Christian Brabandt <cb@256bit.org>
parents:
8172
diff
changeset
|
2081 MSG msg; |
4f0677020a43
commit https://github.com/vim/vim/commit/9186a276222ea8a7c88f4092ac5b4201381f4e20
Christian Brabandt <cb@256bit.org>
parents:
8172
diff
changeset
|
2082 |
4f0677020a43
commit https://github.com/vim/vim/commit/9186a276222ea8a7c88f4092ac5b4201381f4e20
Christian Brabandt <cb@256bit.org>
parents:
8172
diff
changeset
|
2083 parse_queued_messages(); |
4f0677020a43
commit https://github.com/vim/vim/commit/9186a276222ea8a7c88f4092ac5b4201381f4e20
Christian Brabandt <cb@256bit.org>
parents:
8172
diff
changeset
|
2084 |
4f0677020a43
commit https://github.com/vim/vim/commit/9186a276222ea8a7c88f4092ac5b4201381f4e20
Christian Brabandt <cb@256bit.org>
parents:
8172
diff
changeset
|
2085 if (pPeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) |
8813
b92938076e40
commit https://github.com/vim/vim/commit/f28d87146544e3b5d70aaa6a2513019f6de043ad
Christian Brabandt <cb@256bit.org>
parents:
8571
diff
changeset
|
2086 || MsgWaitForMultipleObjects(0, NULL, FALSE, 100, QS_ALLINPUT) |
8222
4f0677020a43
commit https://github.com/vim/vim/commit/9186a276222ea8a7c88f4092ac5b4201381f4e20
Christian Brabandt <cb@256bit.org>
parents:
8172
diff
changeset
|
2087 != WAIT_TIMEOUT) |
4f0677020a43
commit https://github.com/vim/vim/commit/9186a276222ea8a7c88f4092ac5b4201381f4e20
Christian Brabandt <cb@256bit.org>
parents:
8172
diff
changeset
|
2088 break; |
4f0677020a43
commit https://github.com/vim/vim/commit/9186a276222ea8a7c88f4092ac5b4201381f4e20
Christian Brabandt <cb@256bit.org>
parents:
8172
diff
changeset
|
2089 } |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2090 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2091 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2092 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2093 * Don't use gui_mch_update() because then we will spin-lock until a |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2094 * char arrives, instead we use GetMessage() to hang until an |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2095 * event arrives. No need to check for input_buf_full because we are |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2096 * returning as soon as it contains a single char -- webb |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2097 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2098 process_message(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2099 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2100 if (input_available()) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2101 { |
9179
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2102 remove_any_timer(); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2103 allow_scrollbar = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2104 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2105 /* Clear pending mouse button, the release event may have been |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2106 * taken by the dialog window. But don't do this when getting |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2107 * focus, we need the mouse-up event then. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2108 if (!s_getting_focus) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2109 s_button_pending = -1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2110 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2111 return OK; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2112 } |
9179
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2113 |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2114 #ifdef FEAT_TIMERS |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2115 if (did_add_timer) |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2116 { |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2117 /* Need to recompute the waiting time. */ |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2118 remove_any_timer(); |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2119 break; |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2120 } |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2121 #endif |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2122 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2123 allow_scrollbar = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2124 return FAIL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2125 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2126 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2127 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2128 * Clear a rectangular region of the screen from text pos (row1, col1) to |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2129 * (row2, col2) inclusive. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2130 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2131 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2132 gui_mch_clear_block( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2133 int row1, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2134 int col1, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2135 int row2, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2136 int col2) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2137 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2138 RECT rc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2139 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2140 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2141 * Clear one extra pixel at the far right, for when bold characters have |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2142 * spilled over to the window border. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2143 * Note: FillRect() excludes right and bottom of rectangle. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2144 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2145 rc.left = FILL_X(col1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2146 rc.top = FILL_Y(row1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2147 rc.right = FILL_X(col2 + 1) + (col2 == Columns - 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2148 rc.bottom = FILL_Y(row2 + 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2149 clear_rect(&rc); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2150 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2151 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2152 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2153 * Clear the whole text window. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2154 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2155 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2156 gui_mch_clear_all(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2157 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2158 RECT rc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2159 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2160 rc.left = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2161 rc.top = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2162 rc.right = Columns * gui.char_width + 2 * gui.border_width; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2163 rc.bottom = Rows * gui.char_height + 2 * gui.border_width; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2164 clear_rect(&rc); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2165 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2166 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2167 * Menu stuff. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2168 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2169 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2170 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2171 gui_mch_enable_menu(int flag) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2172 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2173 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2174 SetMenu(s_hwnd, flag ? s_menuBar : NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2175 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2176 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2177 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2178 /*ARGSUSED*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2179 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2180 gui_mch_set_menu_pos( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2181 int x, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2182 int y, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2183 int w, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2184 int h) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2185 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2186 /* It will be in the right place anyway */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2187 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2188 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2189 #if defined(FEAT_MENU) || defined(PROTO) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2190 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2191 * Make menu item hidden or not hidden |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2192 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2193 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2194 gui_mch_menu_hidden( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2195 vimmenu_T *menu, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2196 int hidden) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2197 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2198 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2199 * This doesn't do what we want. Hmm, just grey the menu items for now. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2200 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2201 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2202 if (hidden) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2203 EnableMenuItem(s_menuBar, menu->id, MF_BYCOMMAND | MF_DISABLED); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2204 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2205 EnableMenuItem(s_menuBar, menu->id, MF_BYCOMMAND | MF_ENABLED); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2206 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2207 gui_mch_menu_grey(menu, hidden); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2208 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2209 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2210 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2211 * This is called after setting all the menus to grey/hidden or not. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2212 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2213 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2214 gui_mch_draw_menubar(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2215 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2216 DrawMenuBar(s_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2217 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2218 #endif /*FEAT_MENU*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2219 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2220 #ifndef PROTO |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2221 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2222 #ifdef VIMDLL |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2223 _export |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2224 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2225 _cdecl |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2226 SaveInst(HINSTANCE hInst) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2227 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2228 s_hinst = hInst; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2229 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2230 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2231 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2232 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2233 * Return the RGB value of a pixel as a long. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2234 */ |
9939
ccb6461b82df
commit https://github.com/vim/vim/commit/1b58cdd160c2e0ada0f638679a2aa27e4665fc48
Christian Brabandt <cb@256bit.org>
parents:
9834
diff
changeset
|
2235 guicolor_T |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2236 gui_mch_get_rgb(guicolor_T pixel) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2237 { |
9939
ccb6461b82df
commit https://github.com/vim/vim/commit/1b58cdd160c2e0ada0f638679a2aa27e4665fc48
Christian Brabandt <cb@256bit.org>
parents:
9834
diff
changeset
|
2238 return (guicolor_T)((GetRValue(pixel) << 16) + (GetGValue(pixel) << 8) |
ccb6461b82df
commit https://github.com/vim/vim/commit/1b58cdd160c2e0ada0f638679a2aa27e4665fc48
Christian Brabandt <cb@256bit.org>
parents:
9834
diff
changeset
|
2239 + GetBValue(pixel)); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2240 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2241 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2242 #if defined(FEAT_GUI_DIALOG) || defined(PROTO) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2243 /* Convert pixels in X to dialog units */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2244 static WORD |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2245 PixelToDialogX(int numPixels) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2246 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2247 return (WORD)((numPixels * 4) / s_dlgfntwidth); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2248 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2249 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2250 /* Convert pixels in Y to dialog units */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2251 static WORD |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2252 PixelToDialogY(int numPixels) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2253 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2254 return (WORD)((numPixels * 8) / s_dlgfntheight); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2255 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2256 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2257 /* Return the width in pixels of the given text in the given DC. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2258 static int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2259 GetTextWidth(HDC hdc, char_u *str, int len) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2260 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2261 SIZE size; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2262 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2263 GetTextExtentPoint(hdc, (LPCSTR)str, len, &size); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2264 return size.cx; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2265 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2266 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2267 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2268 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2269 * Return the width in pixels of the given text in the given DC, taking care |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2270 * of 'encoding' to active codepage conversion. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2271 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2272 static int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2273 GetTextWidthEnc(HDC hdc, char_u *str, int len) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2274 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2275 SIZE size; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2276 WCHAR *wstr; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2277 int n; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2278 int wlen = len; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2279 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2280 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2281 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2282 /* 'encoding' differs from active codepage: convert text and use wide |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2283 * function */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2284 wstr = enc_to_utf16(str, &wlen); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2285 if (wstr != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2286 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2287 n = GetTextExtentPointW(hdc, wstr, wlen, &size); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2288 vim_free(wstr); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2289 if (n) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2290 return size.cx; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2291 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2292 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2293 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2294 return GetTextWidth(hdc, str, len); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2295 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2296 #else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2297 # define GetTextWidthEnc(h, s, l) GetTextWidth((h), (s), (l)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2298 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2299 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2300 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2301 * A quick little routine that will center one window over another, handy for |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2302 * dialog boxes. Taken from the Win32SDK samples. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2303 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2304 static BOOL |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2305 CenterWindow( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2306 HWND hwndChild, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2307 HWND hwndParent) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2308 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2309 RECT rChild, rParent; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2310 int wChild, hChild, wParent, hParent; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2311 int wScreen, hScreen, xNew, yNew; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2312 HDC hdc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2313 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2314 GetWindowRect(hwndChild, &rChild); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2315 wChild = rChild.right - rChild.left; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2316 hChild = rChild.bottom - rChild.top; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2317 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2318 /* If Vim is minimized put the window in the middle of the screen. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2319 if (hwndParent == NULL || IsMinimized(hwndParent)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2320 SystemParametersInfo(SPI_GETWORKAREA, 0, &rParent, 0); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2321 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2322 GetWindowRect(hwndParent, &rParent); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2323 wParent = rParent.right - rParent.left; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2324 hParent = rParent.bottom - rParent.top; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2325 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2326 hdc = GetDC(hwndChild); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2327 wScreen = GetDeviceCaps (hdc, HORZRES); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2328 hScreen = GetDeviceCaps (hdc, VERTRES); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2329 ReleaseDC(hwndChild, hdc); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2330 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2331 xNew = rParent.left + ((wParent - wChild) /2); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2332 if (xNew < 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2333 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2334 xNew = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2335 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2336 else if ((xNew+wChild) > wScreen) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2337 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2338 xNew = wScreen - wChild; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2339 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2340 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2341 yNew = rParent.top + ((hParent - hChild) /2); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2342 if (yNew < 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2343 yNew = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2344 else if ((yNew+hChild) > hScreen) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2345 yNew = hScreen - hChild; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2346 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2347 return SetWindowPos(hwndChild, NULL, xNew, yNew, 0, 0, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2348 SWP_NOSIZE | SWP_NOZORDER); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2349 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2350 #endif /* FEAT_GUI_DIALOG */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2351 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2352 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2353 gui_mch_activate_window(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2354 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2355 (void)SetActiveWindow(s_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2356 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2357 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2358 #if defined(FEAT_TOOLBAR) || defined(PROTO) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2359 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2360 gui_mch_show_toolbar(int showit) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2361 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2362 if (s_toolbarhwnd == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2363 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2364 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2365 if (showit) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2366 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2367 # ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2368 # ifndef TB_SETUNICODEFORMAT |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2369 /* For older compilers. We assume this never changes. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2370 # define TB_SETUNICODEFORMAT 0x2005 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2371 # endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2372 /* Enable/disable unicode support */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2373 int uu = (enc_codepage >= 0 && (int)GetACP() != enc_codepage); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2374 SendMessage(s_toolbarhwnd, TB_SETUNICODEFORMAT, (WPARAM)uu, (LPARAM)0); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2375 # endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2376 ShowWindow(s_toolbarhwnd, SW_SHOW); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2377 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2378 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2379 ShowWindow(s_toolbarhwnd, SW_HIDE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2380 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2381 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2382 /* Then number of bitmaps is fixed. Exit is missing! */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2383 #define TOOLBAR_BITMAP_COUNT 31 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2384 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2385 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2386 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2387 #if defined(FEAT_GUI_TABLINE) || defined(PROTO) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2388 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2389 add_tabline_popup_menu_entry(HMENU pmenu, UINT item_id, char_u *item_text) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2390 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2391 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2392 WCHAR *wn = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2393 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2394 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2395 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2396 /* 'encoding' differs from active codepage: convert menu name |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2397 * and use wide function */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2398 wn = enc_to_utf16(item_text, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2399 if (wn != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2400 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2401 MENUITEMINFOW infow; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2402 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2403 infow.cbSize = sizeof(infow); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2404 infow.fMask = MIIM_TYPE | MIIM_ID; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2405 infow.wID = item_id; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2406 infow.fType = MFT_STRING; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2407 infow.dwTypeData = wn; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2408 infow.cch = (UINT)wcslen(wn); |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
2409 InsertMenuItemW(pmenu, item_id, FALSE, &infow); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2410 vim_free(wn); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2411 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2412 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2413 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2414 if (wn == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2415 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2416 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2417 MENUITEMINFO info; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2418 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2419 info.cbSize = sizeof(info); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2420 info.fMask = MIIM_TYPE | MIIM_ID; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2421 info.wID = item_id; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2422 info.fType = MFT_STRING; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2423 info.dwTypeData = (LPTSTR)item_text; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2424 info.cch = (UINT)STRLEN(item_text); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2425 InsertMenuItem(pmenu, item_id, FALSE, &info); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2426 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2427 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2428 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2429 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2430 show_tabline_popup_menu(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2431 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2432 HMENU tab_pmenu; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2433 long rval; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2434 POINT pt; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2435 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2436 /* When ignoring events don't show the menu. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2437 if (hold_gui_events |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2438 # ifdef FEAT_CMDWIN |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2439 || cmdwin_type != 0 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2440 # endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2441 ) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2442 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2443 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2444 tab_pmenu = CreatePopupMenu(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2445 if (tab_pmenu == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2446 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2447 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2448 if (first_tabpage->tp_next != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2449 add_tabline_popup_menu_entry(tab_pmenu, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2450 TABLINE_MENU_CLOSE, (char_u *)_("Close tab")); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2451 add_tabline_popup_menu_entry(tab_pmenu, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2452 TABLINE_MENU_NEW, (char_u *)_("New tab")); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2453 add_tabline_popup_menu_entry(tab_pmenu, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2454 TABLINE_MENU_OPEN, (char_u *)_("Open tab...")); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2455 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2456 GetCursorPos(&pt); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2457 rval = TrackPopupMenuEx(tab_pmenu, TPM_RETURNCMD, pt.x, pt.y, s_tabhwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2458 NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2459 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2460 DestroyMenu(tab_pmenu); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2461 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2462 /* Add the string cmd into input buffer */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2463 if (rval > 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2464 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2465 TCHITTESTINFO htinfo; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2466 int idx; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2467 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2468 if (ScreenToClient(s_tabhwnd, &pt) == 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2469 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2470 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2471 htinfo.pt.x = pt.x; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2472 htinfo.pt.y = pt.y; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2473 idx = TabCtrl_HitTest(s_tabhwnd, &htinfo); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2474 if (idx == -1) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2475 idx = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2476 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2477 idx += 1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2478 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2479 send_tabline_menu_event(idx, (int)rval); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2480 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2481 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2482 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2483 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2484 * Show or hide the tabline. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2485 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2486 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2487 gui_mch_show_tabline(int showit) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2488 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2489 if (s_tabhwnd == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2490 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2491 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2492 if (!showit != !showing_tabline) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2493 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2494 if (showit) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2495 ShowWindow(s_tabhwnd, SW_SHOW); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2496 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2497 ShowWindow(s_tabhwnd, SW_HIDE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2498 showing_tabline = showit; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2499 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2500 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2501 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2502 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2503 * Return TRUE when tabline is displayed. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2504 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2505 int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2506 gui_mch_showing_tabline(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2507 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2508 return s_tabhwnd != NULL && showing_tabline; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2509 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2510 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2511 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2512 * Update the labels of the tabline. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2513 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2514 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2515 gui_mch_update_tabline(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2516 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2517 tabpage_T *tp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2518 TCITEM tie; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2519 int nr = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2520 int curtabidx = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2521 int tabadded = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2522 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2523 static int use_unicode = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2524 int uu; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2525 WCHAR *wstr = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2526 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2527 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2528 if (s_tabhwnd == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2529 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2530 |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
2531 #ifdef FEAT_MBYTE |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2532 # ifndef CCM_SETUNICODEFORMAT |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2533 /* For older compilers. We assume this never changes. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2534 # define CCM_SETUNICODEFORMAT 0x2005 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2535 # endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2536 uu = (enc_codepage >= 0 && (int)GetACP() != enc_codepage); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2537 if (uu != use_unicode) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2538 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2539 /* Enable/disable unicode support */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2540 SendMessage(s_tabhwnd, CCM_SETUNICODEFORMAT, (WPARAM)uu, (LPARAM)0); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2541 use_unicode = uu; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2542 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2543 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2544 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2545 tie.mask = TCIF_TEXT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2546 tie.iImage = -1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2547 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2548 /* Disable redraw for tab updates to eliminate O(N^2) draws. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2549 SendMessage(s_tabhwnd, WM_SETREDRAW, (WPARAM)FALSE, 0); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2550 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2551 /* Add a label for each tab page. They all contain the same text area. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2552 for (tp = first_tabpage; tp != NULL; tp = tp->tp_next, ++nr) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2553 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2554 if (tp == curtab) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2555 curtabidx = nr; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2556 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2557 if (nr >= TabCtrl_GetItemCount(s_tabhwnd)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2558 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2559 /* Add the tab */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2560 tie.pszText = "-Empty-"; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2561 TabCtrl_InsertItem(s_tabhwnd, nr, &tie); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2562 tabadded = 1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2563 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2564 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2565 get_tabline_label(tp, FALSE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2566 tie.pszText = (LPSTR)NameBuff; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2567 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2568 wstr = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2569 if (use_unicode) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2570 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2571 /* Need to go through Unicode. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2572 wstr = enc_to_utf16(NameBuff, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2573 if (wstr != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2574 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2575 TCITEMW tiw; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2576 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2577 tiw.mask = TCIF_TEXT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2578 tiw.iImage = -1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2579 tiw.pszText = wstr; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2580 SendMessage(s_tabhwnd, TCM_SETITEMW, (WPARAM)nr, (LPARAM)&tiw); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2581 vim_free(wstr); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2582 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2583 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2584 if (wstr == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2585 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2586 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2587 TabCtrl_SetItem(s_tabhwnd, nr, &tie); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2588 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2589 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2590 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2591 /* Remove any old labels. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2592 while (nr < TabCtrl_GetItemCount(s_tabhwnd)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2593 TabCtrl_DeleteItem(s_tabhwnd, nr); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2594 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2595 if (!tabadded && TabCtrl_GetCurSel(s_tabhwnd) != curtabidx) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2596 TabCtrl_SetCurSel(s_tabhwnd, curtabidx); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2597 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2598 /* Re-enable redraw and redraw. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2599 SendMessage(s_tabhwnd, WM_SETREDRAW, (WPARAM)TRUE, 0); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2600 RedrawWindow(s_tabhwnd, NULL, NULL, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2601 RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2602 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2603 if (tabadded && TabCtrl_GetCurSel(s_tabhwnd) != curtabidx) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2604 TabCtrl_SetCurSel(s_tabhwnd, curtabidx); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2605 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2606 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2607 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2608 * Set the current tab to "nr". First tab is 1. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2609 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2610 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2611 gui_mch_set_curtab(int nr) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2612 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2613 if (s_tabhwnd == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2614 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2615 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2616 if (TabCtrl_GetCurSel(s_tabhwnd) != nr - 1) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2617 TabCtrl_SetCurSel(s_tabhwnd, nr - 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2618 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2619 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2620 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2621 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2622 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2623 * ":simalt" command. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2624 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2625 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2626 ex_simalt(exarg_T *eap) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2627 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2628 char_u *keys = eap->arg; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2629 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2630 PostMessage(s_hwnd, WM_SYSCOMMAND, (WPARAM)SC_KEYMENU, (LPARAM)0); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2631 while (*keys) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2632 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2633 if (*keys == '~') |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2634 *keys = ' '; /* for showing system menu */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2635 PostMessage(s_hwnd, WM_CHAR, (WPARAM)*keys, (LPARAM)0); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2636 keys++; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2637 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2638 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2639 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2640 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2641 * Create the find & replace dialogs. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2642 * You can't have both at once: ":find" when replace is showing, destroys |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2643 * the replace dialog first, and the other way around. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2644 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2645 #ifdef MSWIN_FIND_REPLACE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2646 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2647 initialise_findrep(char_u *initial_string) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2648 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2649 int wword = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2650 int mcase = !p_ic; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2651 char_u *entry_text; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2652 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2653 /* Get the search string to use. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2654 entry_text = get_find_dialog_text(initial_string, &wword, &mcase); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2655 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2656 s_findrep_struct.hwndOwner = s_hwnd; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2657 s_findrep_struct.Flags = FR_DOWN; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2658 if (mcase) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2659 s_findrep_struct.Flags |= FR_MATCHCASE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2660 if (wword) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2661 s_findrep_struct.Flags |= FR_WHOLEWORD; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2662 if (entry_text != NULL && *entry_text != NUL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2663 vim_strncpy((char_u *)s_findrep_struct.lpstrFindWhat, entry_text, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2664 s_findrep_struct.wFindWhatLen - 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2665 vim_free(entry_text); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2666 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2667 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2668 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2669 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2670 set_window_title(HWND hwnd, char *title) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2671 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2672 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2673 if (title != NULL && enc_codepage >= 0 && enc_codepage != (int)GetACP()) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2674 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2675 WCHAR *wbuf; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2676 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2677 /* Convert the title from 'encoding' to UTF-16. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2678 wbuf = (WCHAR *)enc_to_utf16((char_u *)title, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2679 if (wbuf != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2680 { |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
2681 SetWindowTextW(hwnd, wbuf); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2682 vim_free(wbuf); |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
2683 } |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
2684 return; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2685 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2686 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2687 (void)SetWindowText(hwnd, (LPCSTR)title); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2688 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2689 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2690 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2691 gui_mch_find_dialog(exarg_T *eap) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2692 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2693 #ifdef MSWIN_FIND_REPLACE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2694 if (s_findrep_msg != 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2695 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2696 if (IsWindow(s_findrep_hwnd) && !s_findrep_is_find) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2697 DestroyWindow(s_findrep_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2698 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2699 if (!IsWindow(s_findrep_hwnd)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2700 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2701 initialise_findrep(eap->arg); |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
2702 # ifdef FEAT_MBYTE |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2703 /* If the OS is Windows NT, and 'encoding' differs from active |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2704 * codepage: convert text and use wide function. */ |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
2705 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2706 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2707 findrep_atow(&s_findrep_struct_w, &s_findrep_struct); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2708 s_findrep_hwnd = FindTextW( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2709 (LPFINDREPLACEW) &s_findrep_struct_w); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2710 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2711 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2712 # endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2713 s_findrep_hwnd = FindText((LPFINDREPLACE) &s_findrep_struct); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2714 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2715 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2716 set_window_title(s_findrep_hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2717 _("Find string (use '\\\\' to find a '\\')")); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2718 (void)SetFocus(s_findrep_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2719 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2720 s_findrep_is_find = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2721 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2722 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2723 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2724 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2725 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2726 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2727 gui_mch_replace_dialog(exarg_T *eap) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2728 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2729 #ifdef MSWIN_FIND_REPLACE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2730 if (s_findrep_msg != 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2731 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2732 if (IsWindow(s_findrep_hwnd) && s_findrep_is_find) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2733 DestroyWindow(s_findrep_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2734 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2735 if (!IsWindow(s_findrep_hwnd)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2736 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2737 initialise_findrep(eap->arg); |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
2738 # ifdef FEAT_MBYTE |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
2739 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2740 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2741 findrep_atow(&s_findrep_struct_w, &s_findrep_struct); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2742 s_findrep_hwnd = ReplaceTextW( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2743 (LPFINDREPLACEW) &s_findrep_struct_w); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2744 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2745 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2746 # endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2747 s_findrep_hwnd = ReplaceText( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2748 (LPFINDREPLACE) &s_findrep_struct); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2749 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2750 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2751 set_window_title(s_findrep_hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2752 _("Find & Replace (use '\\\\' to find a '\\')")); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2753 (void)SetFocus(s_findrep_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2754 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2755 s_findrep_is_find = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2756 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2757 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2758 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2759 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2760 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2761 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2762 * Set visibility of the pointer. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2763 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2764 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2765 gui_mch_mousehide(int hide) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2766 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2767 if (hide != gui.pointer_hidden) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2768 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2769 ShowCursor(!hide); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2770 gui.pointer_hidden = hide; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2771 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2772 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2773 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2774 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2775 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2776 gui_mch_show_popupmenu_at(vimmenu_T *menu, int x, int y) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2777 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2778 /* Unhide the mouse, we don't get move events here. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2779 gui_mch_mousehide(FALSE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2780 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2781 (void)TrackPopupMenu( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2782 (HMENU)menu->submenu_id, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2783 TPM_LEFTALIGN | TPM_LEFTBUTTON, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2784 x, y, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2785 (int)0, /*reserved param*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2786 s_hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2787 NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2788 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2789 * NOTE: The pop-up menu can eat the mouse up event. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2790 * We deal with this in normal.c. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2791 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2792 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2793 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2794 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2795 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2796 * Got a message when the system will go down. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2797 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2798 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2799 _OnEndSession(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2800 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2801 getout_preserve_modified(1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2802 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2803 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2804 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2805 * Get this message when the user clicks on the cross in the top right corner |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2806 * of a Windows95 window. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2807 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2808 /*ARGSUSED*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2809 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2810 _OnClose( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2811 HWND hwnd) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2812 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2813 gui_shell_closed(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2814 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2815 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2816 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2817 * Get a message when the window is being destroyed. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2818 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2819 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2820 _OnDestroy( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2821 HWND hwnd) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2822 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2823 if (!destroying) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2824 _OnClose(hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2825 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2826 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2827 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2828 _OnPaint( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2829 HWND hwnd) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2830 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2831 if (!IsMinimized(hwnd)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2832 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2833 PAINTSTRUCT ps; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2834 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2835 out_flush(); /* make sure all output has been processed */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2836 (void)BeginPaint(hwnd, &ps); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2837 #if defined(FEAT_DIRECTX) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2838 if (IS_ENABLE_DIRECTX()) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2839 DWriteContext_BeginDraw(s_dwc); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2840 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2841 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2842 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2843 /* prevent multi-byte characters from misprinting on an invalid |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2844 * rectangle */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2845 if (has_mbyte) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2846 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2847 RECT rect; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2848 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2849 GetClientRect(hwnd, &rect); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2850 ps.rcPaint.left = rect.left; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2851 ps.rcPaint.right = rect.right; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2852 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2853 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2854 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2855 if (!IsRectEmpty(&ps.rcPaint)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2856 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2857 #if defined(FEAT_DIRECTX) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2858 if (IS_ENABLE_DIRECTX()) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2859 DWriteContext_BindDC(s_dwc, s_hdc, &ps.rcPaint); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2860 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2861 gui_redraw(ps.rcPaint.left, ps.rcPaint.top, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2862 ps.rcPaint.right - ps.rcPaint.left + 1, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2863 ps.rcPaint.bottom - ps.rcPaint.top + 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2864 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2865 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2866 #if defined(FEAT_DIRECTX) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2867 if (IS_ENABLE_DIRECTX()) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2868 DWriteContext_EndDraw(s_dwc); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2869 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2870 EndPaint(hwnd, &ps); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2871 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2872 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2873 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2874 /*ARGSUSED*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2875 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2876 _OnSize( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2877 HWND hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2878 UINT state, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2879 int cx, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2880 int cy) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2881 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2882 if (!IsMinimized(hwnd)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2883 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2884 gui_resize_shell(cx, cy); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2885 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2886 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2887 /* Menu bar may wrap differently now */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2888 gui_mswin_get_menu_height(TRUE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2889 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2890 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2891 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2892 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2893 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2894 _OnSetFocus( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2895 HWND hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2896 HWND hwndOldFocus) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2897 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2898 gui_focus_change(TRUE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2899 s_getting_focus = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2900 (void)MyWindowProc(hwnd, WM_SETFOCUS, (WPARAM)hwndOldFocus, 0); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2901 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2902 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2903 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2904 _OnKillFocus( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2905 HWND hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2906 HWND hwndNewFocus) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2907 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2908 gui_focus_change(FALSE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2909 s_getting_focus = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2910 (void)MyWindowProc(hwnd, WM_KILLFOCUS, (WPARAM)hwndNewFocus, 0); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2911 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2912 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2913 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2914 * Get a message when the user switches back to vim |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2915 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2916 static LRESULT |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2917 _OnActivateApp( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2918 HWND hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2919 BOOL fActivate, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2920 DWORD dwThreadId) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2921 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2922 /* we call gui_focus_change() in _OnSetFocus() */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2923 /* gui_focus_change((int)fActivate); */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2924 return MyWindowProc(hwnd, WM_ACTIVATEAPP, fActivate, (DWORD)dwThreadId); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2925 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2926 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2927 #if defined(FEAT_WINDOWS) || defined(PROTO) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2928 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2929 gui_mch_destroy_scrollbar(scrollbar_T *sb) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2930 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2931 DestroyWindow(sb->id); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2932 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2933 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2934 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2935 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2936 * Get current mouse coordinates in text window. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2937 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2938 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2939 gui_mch_getmouse(int *x, int *y) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2940 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2941 RECT rct; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2942 POINT mp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2943 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2944 (void)GetWindowRect(s_textArea, &rct); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2945 (void)GetCursorPos((LPPOINT)&mp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2946 *x = (int)(mp.x - rct.left); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2947 *y = (int)(mp.y - rct.top); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2948 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2949 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2950 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2951 * Move mouse pointer to character at (x, y). |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2952 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2953 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2954 gui_mch_setmouse(int x, int y) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2955 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2956 RECT rct; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2957 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2958 (void)GetWindowRect(s_textArea, &rct); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2959 (void)SetCursorPos(x + gui.border_offset + rct.left, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2960 y + gui.border_offset + rct.top); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2961 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2962 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2963 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2964 gui_mswin_get_valid_dimensions( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2965 int w, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2966 int h, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2967 int *valid_w, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2968 int *valid_h) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2969 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2970 int base_width, base_height; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2971 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2972 base_width = gui_get_base_width() |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2973 + (GetSystemMetrics(SM_CXFRAME) + |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2974 GetSystemMetrics(SM_CXPADDEDBORDER)) * 2; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2975 base_height = gui_get_base_height() |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2976 + (GetSystemMetrics(SM_CYFRAME) + |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2977 GetSystemMetrics(SM_CXPADDEDBORDER)) * 2 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2978 + GetSystemMetrics(SM_CYCAPTION) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2979 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2980 + gui_mswin_get_menu_height(FALSE) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2981 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2982 ; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2983 *valid_w = base_width + |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2984 ((w - base_width) / gui.char_width) * gui.char_width; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2985 *valid_h = base_height + |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2986 ((h - base_height) / gui.char_height) * gui.char_height; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2987 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2988 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2989 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2990 gui_mch_flash(int msec) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2991 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2992 RECT rc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2993 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2994 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2995 * Note: InvertRect() excludes right and bottom of rectangle. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2996 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2997 rc.left = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2998 rc.top = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2999 rc.right = gui.num_cols * gui.char_width; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3000 rc.bottom = gui.num_rows * gui.char_height; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3001 InvertRect(s_hdc, &rc); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3002 gui_mch_flush(); /* make sure it's displayed */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3003 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3004 ui_delay((long)msec, TRUE); /* wait for a few msec */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3005 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3006 InvertRect(s_hdc, &rc); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3007 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3008 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3009 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3010 * Return flags used for scrolling. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3011 * The SW_INVALIDATE is required when part of the window is covered or |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3012 * off-screen. Refer to MS KB Q75236. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3013 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3014 static int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3015 get_scroll_flags(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3016 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3017 HWND hwnd; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3018 RECT rcVim, rcOther, rcDest; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3019 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3020 GetWindowRect(s_hwnd, &rcVim); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3021 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3022 /* Check if the window is partly above or below the screen. We don't care |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3023 * about partly left or right of the screen, it is not relevant when |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3024 * scrolling up or down. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3025 if (rcVim.top < 0 || rcVim.bottom > GetSystemMetrics(SM_CYFULLSCREEN)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3026 return SW_INVALIDATE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3027 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3028 /* Check if there is an window (partly) on top of us. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3029 for (hwnd = s_hwnd; (hwnd = GetWindow(hwnd, GW_HWNDPREV)) != (HWND)0; ) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3030 if (IsWindowVisible(hwnd)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3031 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3032 GetWindowRect(hwnd, &rcOther); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3033 if (IntersectRect(&rcDest, &rcVim, &rcOther)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3034 return SW_INVALIDATE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3035 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3036 return 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3037 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3038 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3039 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3040 * On some Intel GPUs, the regions drawn just prior to ScrollWindowEx() |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3041 * may not be scrolled out properly. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3042 * For gVim, when _OnScroll() is repeated, the character at the |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3043 * previous cursor position may be left drawn after scroll. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3044 * The problem can be avoided by calling GetPixel() to get a pixel in |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3045 * the region before ScrollWindowEx(). |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3046 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3047 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3048 intel_gpu_workaround(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3049 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3050 GetPixel(s_hdc, FILL_X(gui.col), FILL_Y(gui.row)); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3051 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3052 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3053 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3054 * Delete the given number of lines from the given row, scrolling up any |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3055 * text further down within the scroll region. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3056 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3057 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3058 gui_mch_delete_lines( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3059 int row, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3060 int num_lines) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3061 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3062 RECT rc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3063 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3064 intel_gpu_workaround(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3065 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3066 rc.left = FILL_X(gui.scroll_region_left); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3067 rc.right = FILL_X(gui.scroll_region_right + 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3068 rc.top = FILL_Y(row); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3069 rc.bottom = FILL_Y(gui.scroll_region_bot + 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3070 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3071 ScrollWindowEx(s_textArea, 0, -num_lines * gui.char_height, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3072 &rc, &rc, NULL, NULL, get_scroll_flags()); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3073 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3074 UpdateWindow(s_textArea); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3075 /* This seems to be required to avoid the cursor disappearing when |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3076 * scrolling such that the cursor ends up in the top-left character on |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3077 * the screen... But why? (Webb) */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3078 /* It's probably fixed by disabling drawing the cursor while scrolling. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3079 /* gui.cursor_is_valid = FALSE; */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3080 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3081 gui_clear_block(gui.scroll_region_bot - num_lines + 1, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3082 gui.scroll_region_left, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3083 gui.scroll_region_bot, gui.scroll_region_right); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3084 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3085 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3086 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3087 * Insert the given number of lines before the given row, scrolling down any |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3088 * following text within the scroll region. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3089 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3090 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3091 gui_mch_insert_lines( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3092 int row, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3093 int num_lines) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3094 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3095 RECT rc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3096 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3097 intel_gpu_workaround(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3098 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3099 rc.left = FILL_X(gui.scroll_region_left); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3100 rc.right = FILL_X(gui.scroll_region_right + 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3101 rc.top = FILL_Y(row); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3102 rc.bottom = FILL_Y(gui.scroll_region_bot + 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3103 /* The SW_INVALIDATE is required when part of the window is covered or |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3104 * off-screen. How do we avoid it when it's not needed? */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3105 ScrollWindowEx(s_textArea, 0, num_lines * gui.char_height, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3106 &rc, &rc, NULL, NULL, get_scroll_flags()); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3107 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3108 UpdateWindow(s_textArea); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3109 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3110 gui_clear_block(row, gui.scroll_region_left, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3111 row + num_lines - 1, gui.scroll_region_right); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3112 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3113 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3114 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3115 /*ARGSUSED*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3116 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3117 gui_mch_exit(int rc) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3118 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3119 #if defined(FEAT_DIRECTX) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3120 DWriteContext_Close(s_dwc); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3121 DWrite_Final(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3122 s_dwc = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3123 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3124 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3125 ReleaseDC(s_textArea, s_hdc); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3126 DeleteObject(s_brush); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3127 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3128 #ifdef FEAT_TEAROFF |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3129 /* Unload the tearoff bitmap */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3130 (void)DeleteObject((HGDIOBJ)s_htearbitmap); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3131 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3132 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3133 /* Destroy our window (if we have one). */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3134 if (s_hwnd != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3135 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3136 destroying = TRUE; /* ignore WM_DESTROY message now */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3137 DestroyWindow(s_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3138 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3139 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3140 #ifdef GLOBAL_IME |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3141 global_ime_end(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3142 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3143 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3144 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3145 static char_u * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3146 logfont2name(LOGFONT lf) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3147 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3148 char *p; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3149 char *res; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3150 char *charset_name; |
8835
c1a5623cfc86
commit https://github.com/vim/vim/commit/7c1c6dbb6817640fd3956a0d5417da23fde336d8
Christian Brabandt <cb@256bit.org>
parents:
8813
diff
changeset
|
3151 char *quality_name; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3152 char *font_name = lf.lfFaceName; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3153 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3154 charset_name = charset_id2name((int)lf.lfCharSet); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3155 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3156 /* Convert a font name from the current codepage to 'encoding'. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3157 * TODO: Use Wide APIs (including LOGFONTW) instead of ANSI APIs. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3158 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3159 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3160 int len; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3161 acp_to_enc((char_u *)lf.lfFaceName, (int)strlen(lf.lfFaceName), |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3162 (char_u **)&font_name, &len); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3163 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3164 #endif |
8835
c1a5623cfc86
commit https://github.com/vim/vim/commit/7c1c6dbb6817640fd3956a0d5417da23fde336d8
Christian Brabandt <cb@256bit.org>
parents:
8813
diff
changeset
|
3165 quality_name = quality_id2name((int)lf.lfQuality); |
c1a5623cfc86
commit https://github.com/vim/vim/commit/7c1c6dbb6817640fd3956a0d5417da23fde336d8
Christian Brabandt <cb@256bit.org>
parents:
8813
diff
changeset
|
3166 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3167 res = (char *)alloc((unsigned)(strlen(font_name) + 20 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3168 + (charset_name == NULL ? 0 : strlen(charset_name) + 2))); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3169 if (res != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3170 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3171 p = res; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3172 /* make a normal font string out of the lf thing:*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3173 sprintf((char *)p, "%s:h%d", font_name, pixels_to_points( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3174 lf.lfHeight < 0 ? -lf.lfHeight : lf.lfHeight, TRUE)); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3175 while (*p) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3176 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3177 if (*p == ' ') |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3178 *p = '_'; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3179 ++p; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3180 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3181 if (lf.lfItalic) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3182 STRCAT(p, ":i"); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3183 if (lf.lfWeight >= FW_BOLD) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3184 STRCAT(p, ":b"); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3185 if (lf.lfUnderline) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3186 STRCAT(p, ":u"); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3187 if (lf.lfStrikeOut) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3188 STRCAT(p, ":s"); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3189 if (charset_name != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3190 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3191 STRCAT(p, ":c"); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3192 STRCAT(p, charset_name); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3193 } |
8835
c1a5623cfc86
commit https://github.com/vim/vim/commit/7c1c6dbb6817640fd3956a0d5417da23fde336d8
Christian Brabandt <cb@256bit.org>
parents:
8813
diff
changeset
|
3194 if (quality_name != NULL) |
c1a5623cfc86
commit https://github.com/vim/vim/commit/7c1c6dbb6817640fd3956a0d5417da23fde336d8
Christian Brabandt <cb@256bit.org>
parents:
8813
diff
changeset
|
3195 { |
c1a5623cfc86
commit https://github.com/vim/vim/commit/7c1c6dbb6817640fd3956a0d5417da23fde336d8
Christian Brabandt <cb@256bit.org>
parents:
8813
diff
changeset
|
3196 STRCAT(p, ":q"); |
c1a5623cfc86
commit https://github.com/vim/vim/commit/7c1c6dbb6817640fd3956a0d5417da23fde336d8
Christian Brabandt <cb@256bit.org>
parents:
8813
diff
changeset
|
3197 STRCAT(p, quality_name); |
c1a5623cfc86
commit https://github.com/vim/vim/commit/7c1c6dbb6817640fd3956a0d5417da23fde336d8
Christian Brabandt <cb@256bit.org>
parents:
8813
diff
changeset
|
3198 } |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3199 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3200 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3201 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3202 if (font_name != lf.lfFaceName) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3203 vim_free(font_name); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3204 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3205 return (char_u *)res; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3206 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3207 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3208 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3209 #ifdef FEAT_MBYTE_IME |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3210 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3211 * Set correct LOGFONT to IME. Use 'guifontwide' if available, otherwise use |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3212 * 'guifont' |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3213 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3214 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3215 update_im_font(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3216 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3217 LOGFONT lf_wide; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3218 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3219 if (p_guifontwide != NULL && *p_guifontwide != NUL |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3220 && gui.wide_font != NOFONT |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3221 && GetObject((HFONT)gui.wide_font, sizeof(lf_wide), &lf_wide)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3222 norm_logfont = lf_wide; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3223 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3224 norm_logfont = sub_logfont; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3225 im_set_font(&norm_logfont); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3226 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3227 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3228 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3229 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3230 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3231 * Handler of gui.wide_font (p_guifontwide) changed notification. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3232 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3233 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3234 gui_mch_wide_font_changed(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3235 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3236 LOGFONT lf; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3237 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3238 # ifdef FEAT_MBYTE_IME |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3239 update_im_font(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3240 # endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3241 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3242 gui_mch_free_font(gui.wide_ital_font); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3243 gui.wide_ital_font = NOFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3244 gui_mch_free_font(gui.wide_bold_font); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3245 gui.wide_bold_font = NOFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3246 gui_mch_free_font(gui.wide_boldital_font); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3247 gui.wide_boldital_font = NOFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3248 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3249 if (gui.wide_font |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3250 && GetObject((HFONT)gui.wide_font, sizeof(lf), &lf)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3251 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3252 if (!lf.lfItalic) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3253 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3254 lf.lfItalic = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3255 gui.wide_ital_font = get_font_handle(&lf); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3256 lf.lfItalic = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3257 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3258 if (lf.lfWeight < FW_BOLD) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3259 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3260 lf.lfWeight = FW_BOLD; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3261 gui.wide_bold_font = get_font_handle(&lf); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3262 if (!lf.lfItalic) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3263 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3264 lf.lfItalic = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3265 gui.wide_boldital_font = get_font_handle(&lf); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3266 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3267 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3268 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3269 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3270 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3271 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3272 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3273 * Initialise vim to use the font with the given name. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3274 * Return FAIL if the font could not be loaded, OK otherwise. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3275 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3276 /*ARGSUSED*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3277 int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3278 gui_mch_init_font(char_u *font_name, int fontset) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3279 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3280 LOGFONT lf; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3281 GuiFont font = NOFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3282 char_u *p; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3283 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3284 /* Load the font */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3285 if (get_logfont(&lf, font_name, NULL, TRUE) == OK) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3286 font = get_font_handle(&lf); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3287 if (font == NOFONT) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3288 return FAIL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3289 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3290 if (font_name == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3291 font_name = (char_u *)lf.lfFaceName; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3292 #if defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3293 norm_logfont = lf; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3294 sub_logfont = lf; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3295 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3296 #ifdef FEAT_MBYTE_IME |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3297 update_im_font(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3298 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3299 gui_mch_free_font(gui.norm_font); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3300 gui.norm_font = font; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3301 current_font_height = lf.lfHeight; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3302 GetFontSize(font); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3303 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3304 p = logfont2name(lf); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3305 if (p != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3306 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3307 hl_set_font_name(p); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3308 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3309 /* When setting 'guifont' to "*" replace it with the actual font name. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3310 * */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3311 if (STRCMP(font_name, "*") == 0 && STRCMP(p_guifont, "*") == 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3312 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3313 vim_free(p_guifont); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3314 p_guifont = p; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3315 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3316 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3317 vim_free(p); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3318 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3319 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3320 gui_mch_free_font(gui.ital_font); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3321 gui.ital_font = NOFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3322 gui_mch_free_font(gui.bold_font); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3323 gui.bold_font = NOFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3324 gui_mch_free_font(gui.boldital_font); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3325 gui.boldital_font = NOFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3326 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3327 if (!lf.lfItalic) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3328 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3329 lf.lfItalic = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3330 gui.ital_font = get_font_handle(&lf); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3331 lf.lfItalic = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3332 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3333 if (lf.lfWeight < FW_BOLD) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3334 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3335 lf.lfWeight = FW_BOLD; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3336 gui.bold_font = get_font_handle(&lf); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3337 if (!lf.lfItalic) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3338 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3339 lf.lfItalic = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3340 gui.boldital_font = get_font_handle(&lf); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3341 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3342 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3343 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3344 return OK; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3345 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3346 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3347 #ifndef WPF_RESTORETOMAXIMIZED |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3348 # define WPF_RESTORETOMAXIMIZED 2 /* just in case someone doesn't have it */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3349 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3350 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3351 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3352 * Return TRUE if the GUI window is maximized, filling the whole screen. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3353 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3354 int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3355 gui_mch_maximized(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3356 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3357 WINDOWPLACEMENT wp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3358 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3359 wp.length = sizeof(WINDOWPLACEMENT); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3360 if (GetWindowPlacement(s_hwnd, &wp)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3361 return wp.showCmd == SW_SHOWMAXIMIZED |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3362 || (wp.showCmd == SW_SHOWMINIMIZED |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3363 && wp.flags == WPF_RESTORETOMAXIMIZED); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3364 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3365 return 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3366 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3367 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3368 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3369 * Called when the font changed while the window is maximized. Compute the |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3370 * new Rows and Columns. This is like resizing the window. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3371 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3372 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3373 gui_mch_newfont(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3374 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3375 RECT rect; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3376 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3377 GetWindowRect(s_hwnd, &rect); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3378 if (win_socket_id == 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3379 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3380 gui_resize_shell(rect.right - rect.left |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3381 - (GetSystemMetrics(SM_CXFRAME) + |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3382 GetSystemMetrics(SM_CXPADDEDBORDER)) * 2, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3383 rect.bottom - rect.top |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3384 - (GetSystemMetrics(SM_CYFRAME) + |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3385 GetSystemMetrics(SM_CXPADDEDBORDER)) * 2 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3386 - GetSystemMetrics(SM_CYCAPTION) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3387 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3388 - gui_mswin_get_menu_height(FALSE) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3389 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3390 ); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3391 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3392 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3393 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3394 /* Inside another window, don't use the frame and border. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3395 gui_resize_shell(rect.right - rect.left, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3396 rect.bottom - rect.top |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3397 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3398 - gui_mswin_get_menu_height(FALSE) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3399 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3400 ); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3401 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3402 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3403 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3404 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3405 * Set the window title |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3406 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3407 /*ARGSUSED*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3408 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3409 gui_mch_settitle( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3410 char_u *title, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3411 char_u *icon) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3412 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3413 set_window_title(s_hwnd, (title == NULL ? "VIM" : (char *)title)); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3414 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3415 |
9834
80ace3687eec
commit https://github.com/vim/vim/commit/a6b7a08ae04a3cd4d9c45c906bb7a197e2135179
Christian Brabandt <cb@256bit.org>
parents:
9428
diff
changeset
|
3416 #if defined(FEAT_MOUSESHAPE) || defined(PROTO) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3417 /* Table for shape IDCs. Keep in sync with the mshape_names[] table in |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3418 * misc2.c! */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3419 static LPCSTR mshape_idcs[] = |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3420 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3421 IDC_ARROW, /* arrow */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3422 MAKEINTRESOURCE(0), /* blank */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3423 IDC_IBEAM, /* beam */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3424 IDC_SIZENS, /* updown */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3425 IDC_SIZENS, /* udsizing */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3426 IDC_SIZEWE, /* leftright */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3427 IDC_SIZEWE, /* lrsizing */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3428 IDC_WAIT, /* busy */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3429 IDC_NO, /* no */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3430 IDC_ARROW, /* crosshair */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3431 IDC_ARROW, /* hand1 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3432 IDC_ARROW, /* hand2 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3433 IDC_ARROW, /* pencil */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3434 IDC_ARROW, /* question */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3435 IDC_ARROW, /* right-arrow */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3436 IDC_UPARROW, /* up-arrow */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3437 IDC_ARROW /* last one */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3438 }; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3439 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3440 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3441 mch_set_mouse_shape(int shape) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3442 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3443 LPCSTR idc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3444 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3445 if (shape == MSHAPE_HIDE) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3446 ShowCursor(FALSE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3447 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3448 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3449 if (shape >= MSHAPE_NUMBERED) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3450 idc = IDC_ARROW; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3451 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3452 idc = mshape_idcs[shape]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3453 #ifdef SetClassLongPtr |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3454 SetClassLongPtr(s_textArea, GCLP_HCURSOR, (__int3264)(LONG_PTR)LoadCursor(NULL, idc)); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3455 #else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3456 SetClassLong(s_textArea, GCL_HCURSOR, (long_u)LoadCursor(NULL, idc)); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3457 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3458 if (!p_mh) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3459 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3460 POINT mp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3461 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3462 /* Set the position to make it redrawn with the new shape. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3463 (void)GetCursorPos((LPPOINT)&mp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3464 (void)SetCursorPos(mp.x, mp.y); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3465 ShowCursor(TRUE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3466 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3467 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3468 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3469 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3470 |
9834
80ace3687eec
commit https://github.com/vim/vim/commit/a6b7a08ae04a3cd4d9c45c906bb7a197e2135179
Christian Brabandt <cb@256bit.org>
parents:
9428
diff
changeset
|
3471 #if defined(FEAT_BROWSE) || defined(PROTO) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3472 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3473 * The file browser exists in two versions: with "W" uses wide characters, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3474 * without "W" the current codepage. When FEAT_MBYTE is defined and on |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3475 * Windows NT/2000/XP the "W" functions are used. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3476 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3477 |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
3478 # ifdef FEAT_MBYTE |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3479 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3480 * Wide version of convert_filter(). |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3481 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3482 static WCHAR * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3483 convert_filterW(char_u *s) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3484 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3485 char_u *tmp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3486 int len; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3487 WCHAR *res; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3488 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3489 tmp = convert_filter(s); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3490 if (tmp == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3491 return NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3492 len = (int)STRLEN(s) + 3; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3493 res = enc_to_utf16(tmp, &len); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3494 vim_free(tmp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3495 return res; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3496 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3497 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3498 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3499 * Wide version of gui_mch_browse(). Keep in sync! |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3500 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3501 static char_u * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3502 gui_mch_browseW( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3503 int saving, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3504 char_u *title, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3505 char_u *dflt, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3506 char_u *ext, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3507 char_u *initdir, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3508 char_u *filter) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3509 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3510 /* We always use the wide function. This means enc_to_utf16() must work, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3511 * otherwise it fails miserably! */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3512 OPENFILENAMEW fileStruct; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3513 WCHAR fileBuf[MAXPATHL]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3514 WCHAR *wp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3515 int i; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3516 WCHAR *titlep = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3517 WCHAR *extp = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3518 WCHAR *initdirp = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3519 WCHAR *filterp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3520 char_u *p; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3521 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3522 if (dflt == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3523 fileBuf[0] = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3524 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3525 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3526 wp = enc_to_utf16(dflt, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3527 if (wp == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3528 fileBuf[0] = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3529 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3530 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3531 for (i = 0; wp[i] != NUL && i < MAXPATHL - 1; ++i) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3532 fileBuf[i] = wp[i]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3533 fileBuf[i] = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3534 vim_free(wp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3535 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3536 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3537 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3538 /* Convert the filter to Windows format. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3539 filterp = convert_filterW(filter); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3540 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3541 vim_memset(&fileStruct, 0, sizeof(OPENFILENAMEW)); |
8571
debe6347024d
commit https://github.com/vim/vim/commit/89e375a88f3eceb73bbd97e78aca1a1c4647c897
Christian Brabandt <cb@256bit.org>
parents:
8281
diff
changeset
|
3542 #ifdef OPENFILENAME_SIZE_VERSION_400W |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3543 /* be compatible with Windows NT 4.0 */ |
8571
debe6347024d
commit https://github.com/vim/vim/commit/89e375a88f3eceb73bbd97e78aca1a1c4647c897
Christian Brabandt <cb@256bit.org>
parents:
8281
diff
changeset
|
3544 fileStruct.lStructSize = OPENFILENAME_SIZE_VERSION_400W; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3545 #else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3546 fileStruct.lStructSize = sizeof(fileStruct); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3547 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3548 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3549 if (title != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3550 titlep = enc_to_utf16(title, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3551 fileStruct.lpstrTitle = titlep; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3552 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3553 if (ext != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3554 extp = enc_to_utf16(ext, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3555 fileStruct.lpstrDefExt = extp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3556 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3557 fileStruct.lpstrFile = fileBuf; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3558 fileStruct.nMaxFile = MAXPATHL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3559 fileStruct.lpstrFilter = filterp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3560 fileStruct.hwndOwner = s_hwnd; /* main Vim window is owner*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3561 /* has an initial dir been specified? */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3562 if (initdir != NULL && *initdir != NUL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3563 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3564 /* Must have backslashes here, no matter what 'shellslash' says */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3565 initdirp = enc_to_utf16(initdir, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3566 if (initdirp != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3567 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3568 for (wp = initdirp; *wp != NUL; ++wp) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3569 if (*wp == '/') |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3570 *wp = '\\'; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3571 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3572 fileStruct.lpstrInitialDir = initdirp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3573 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3574 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3575 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3576 * TODO: Allow selection of multiple files. Needs another arg to this |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3577 * function to ask for it, and need to use OFN_ALLOWMULTISELECT below. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3578 * Also, should we use OFN_FILEMUSTEXIST when opening? Vim can edit on |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3579 * files that don't exist yet, so I haven't put it in. What about |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3580 * OFN_PATHMUSTEXIST? |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3581 * Don't use OFN_OVERWRITEPROMPT, Vim has its own ":confirm" dialog. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3582 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3583 fileStruct.Flags = (OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3584 #ifdef FEAT_SHORTCUT |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3585 if (curbuf->b_p_bin) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3586 fileStruct.Flags |= OFN_NODEREFERENCELINKS; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3587 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3588 if (saving) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3589 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3590 if (!GetSaveFileNameW(&fileStruct)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3591 return NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3592 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3593 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3594 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3595 if (!GetOpenFileNameW(&fileStruct)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3596 return NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3597 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3598 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3599 vim_free(filterp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3600 vim_free(initdirp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3601 vim_free(titlep); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3602 vim_free(extp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3603 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3604 /* Convert from UCS2 to 'encoding'. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3605 p = utf16_to_enc(fileBuf, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3606 if (p != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3607 /* when out of memory we get garbage for non-ASCII chars */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3608 STRCPY(fileBuf, p); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3609 vim_free(p); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3610 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3611 /* Give focus back to main window (when using MDI). */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3612 SetFocus(s_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3613 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3614 /* Shorten the file name if possible */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3615 return vim_strsave(shorten_fname1((char_u *)fileBuf)); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3616 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3617 # endif /* FEAT_MBYTE */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3618 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3619 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3620 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3621 * Convert the string s to the proper format for a filter string by replacing |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3622 * the \t and \n delimiters with \0. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3623 * Returns the converted string in allocated memory. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3624 * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3625 * Keep in sync with convert_filterW() above! |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3626 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3627 static char_u * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3628 convert_filter(char_u *s) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3629 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3630 char_u *res; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3631 unsigned s_len = (unsigned)STRLEN(s); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3632 unsigned i; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3633 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3634 res = alloc(s_len + 3); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3635 if (res != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3636 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3637 for (i = 0; i < s_len; ++i) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3638 if (s[i] == '\t' || s[i] == '\n') |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3639 res[i] = '\0'; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3640 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3641 res[i] = s[i]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3642 res[s_len] = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3643 /* Add two extra NULs to make sure it's properly terminated. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3644 res[s_len + 1] = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3645 res[s_len + 2] = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3646 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3647 return res; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3648 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3649 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3650 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3651 * Select a directory. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3652 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3653 char_u * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3654 gui_mch_browsedir(char_u *title, char_u *initdir) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3655 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3656 /* We fake this: Use a filter that doesn't select anything and a default |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3657 * file name that won't be used. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3658 return gui_mch_browse(0, title, (char_u *)_("Not Used"), NULL, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3659 initdir, (char_u *)_("Directory\t*.nothing\n")); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3660 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3661 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3662 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3663 * Pop open a file browser and return the file selected, in allocated memory, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3664 * or NULL if Cancel is hit. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3665 * saving - TRUE if the file will be saved to, FALSE if it will be opened. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3666 * title - Title message for the file browser dialog. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3667 * dflt - Default name of file. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3668 * ext - Default extension to be added to files without extensions. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3669 * initdir - directory in which to open the browser (NULL = current dir) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3670 * filter - Filter for matched files to choose from. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3671 * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3672 * Keep in sync with gui_mch_browseW() above! |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3673 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3674 char_u * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3675 gui_mch_browse( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3676 int saving, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3677 char_u *title, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3678 char_u *dflt, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3679 char_u *ext, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3680 char_u *initdir, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3681 char_u *filter) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3682 { |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
3683 # ifdef FEAT_MBYTE |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
3684 return gui_mch_browseW(saving, title, dflt, ext, initdir, filter); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
3685 # else |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3686 OPENFILENAME fileStruct; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3687 char_u fileBuf[MAXPATHL]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3688 char_u *initdirp = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3689 char_u *filterp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3690 char_u *p; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3691 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3692 if (dflt == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3693 fileBuf[0] = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3694 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3695 vim_strncpy(fileBuf, dflt, MAXPATHL - 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3696 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3697 /* Convert the filter to Windows format. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3698 filterp = convert_filter(filter); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3699 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3700 vim_memset(&fileStruct, 0, sizeof(OPENFILENAME)); |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
3701 # ifdef OPENFILENAME_SIZE_VERSION_400 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3702 /* be compatible with Windows NT 4.0 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3703 fileStruct.lStructSize = OPENFILENAME_SIZE_VERSION_400; |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
3704 # else |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3705 fileStruct.lStructSize = sizeof(fileStruct); |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
3706 # endif |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3707 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3708 fileStruct.lpstrTitle = (LPSTR)title; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3709 fileStruct.lpstrDefExt = (LPSTR)ext; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3710 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3711 fileStruct.lpstrFile = (LPSTR)fileBuf; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3712 fileStruct.nMaxFile = MAXPATHL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3713 fileStruct.lpstrFilter = (LPSTR)filterp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3714 fileStruct.hwndOwner = s_hwnd; /* main Vim window is owner*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3715 /* has an initial dir been specified? */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3716 if (initdir != NULL && *initdir != NUL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3717 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3718 /* Must have backslashes here, no matter what 'shellslash' says */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3719 initdirp = vim_strsave(initdir); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3720 if (initdirp != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3721 for (p = initdirp; *p != NUL; ++p) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3722 if (*p == '/') |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3723 *p = '\\'; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3724 fileStruct.lpstrInitialDir = (LPSTR)initdirp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3725 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3726 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3727 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3728 * TODO: Allow selection of multiple files. Needs another arg to this |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3729 * function to ask for it, and need to use OFN_ALLOWMULTISELECT below. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3730 * Also, should we use OFN_FILEMUSTEXIST when opening? Vim can edit on |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3731 * files that don't exist yet, so I haven't put it in. What about |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3732 * OFN_PATHMUSTEXIST? |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3733 * Don't use OFN_OVERWRITEPROMPT, Vim has its own ":confirm" dialog. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3734 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3735 fileStruct.Flags = (OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY); |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
3736 # ifdef FEAT_SHORTCUT |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3737 if (curbuf->b_p_bin) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3738 fileStruct.Flags |= OFN_NODEREFERENCELINKS; |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
3739 # endif |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3740 if (saving) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3741 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3742 if (!GetSaveFileName(&fileStruct)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3743 return NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3744 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3745 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3746 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3747 if (!GetOpenFileName(&fileStruct)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3748 return NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3749 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3750 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3751 vim_free(filterp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3752 vim_free(initdirp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3753 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3754 /* Give focus back to main window (when using MDI). */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3755 SetFocus(s_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3756 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3757 /* Shorten the file name if possible */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3758 return vim_strsave(shorten_fname1((char_u *)fileBuf)); |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
3759 # endif |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3760 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3761 #endif /* FEAT_BROWSE */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3762 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3763 /*ARGSUSED*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3764 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3765 _OnDropFiles( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3766 HWND hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3767 HDROP hDrop) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3768 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3769 #ifdef FEAT_WINDOWS |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3770 # define BUFPATHLEN _MAX_PATH |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3771 # define DRAGQVAL 0xFFFFFFFF |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
3772 # ifdef FEAT_MBYTE |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3773 WCHAR wszFile[BUFPATHLEN]; |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
3774 # endif |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3775 char szFile[BUFPATHLEN]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3776 UINT cFiles = DragQueryFile(hDrop, DRAGQVAL, NULL, 0); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3777 UINT i; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3778 char_u **fnames; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3779 POINT pt; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3780 int_u modifiers = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3781 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3782 /* TRACE("_OnDropFiles: %d files dropped\n", cFiles); */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3783 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3784 /* Obtain dropped position */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3785 DragQueryPoint(hDrop, &pt); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3786 MapWindowPoints(s_hwnd, s_textArea, &pt, 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3787 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3788 reset_VIsual(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3789 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3790 fnames = (char_u **)alloc(cFiles * sizeof(char_u *)); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3791 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3792 if (fnames != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3793 for (i = 0; i < cFiles; ++i) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3794 { |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
3795 # ifdef FEAT_MBYTE |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3796 if (DragQueryFileW(hDrop, i, wszFile, BUFPATHLEN) > 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3797 fnames[i] = utf16_to_enc(wszFile, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3798 else |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
3799 # endif |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3800 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3801 DragQueryFile(hDrop, i, szFile, BUFPATHLEN); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3802 fnames[i] = vim_strsave((char_u *)szFile); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3803 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3804 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3805 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3806 DragFinish(hDrop); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3807 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3808 if (fnames != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3809 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3810 if ((GetKeyState(VK_SHIFT) & 0x8000) != 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3811 modifiers |= MOUSE_SHIFT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3812 if ((GetKeyState(VK_CONTROL) & 0x8000) != 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3813 modifiers |= MOUSE_CTRL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3814 if ((GetKeyState(VK_MENU) & 0x8000) != 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3815 modifiers |= MOUSE_ALT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3816 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3817 gui_handle_drop(pt.x, pt.y, modifiers, fnames, cFiles); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3818 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3819 s_need_activate = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3820 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3821 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3822 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3823 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3824 /*ARGSUSED*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3825 static int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3826 _OnScroll( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3827 HWND hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3828 HWND hwndCtl, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3829 UINT code, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3830 int pos) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3831 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3832 static UINT prev_code = 0; /* code of previous call */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3833 scrollbar_T *sb, *sb_info; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3834 long val; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3835 int dragging = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3836 int dont_scroll_save = dont_scroll; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3837 SCROLLINFO si; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3838 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3839 si.cbSize = sizeof(si); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3840 si.fMask = SIF_POS; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3841 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3842 sb = gui_mswin_find_scrollbar(hwndCtl); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3843 if (sb == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3844 return 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3845 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3846 if (sb->wp != NULL) /* Left or right scrollbar */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3847 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3848 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3849 * Careful: need to get scrollbar info out of first (left) scrollbar |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3850 * for window, but keep real scrollbar too because we must pass it to |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3851 * gui_drag_scrollbar(). |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3852 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3853 sb_info = &sb->wp->w_scrollbars[0]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3854 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3855 else /* Bottom scrollbar */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3856 sb_info = sb; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3857 val = sb_info->value; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3858 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3859 switch (code) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3860 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3861 case SB_THUMBTRACK: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3862 val = pos; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3863 dragging = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3864 if (sb->scroll_shift > 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3865 val <<= sb->scroll_shift; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3866 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3867 case SB_LINEDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3868 val++; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3869 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3870 case SB_LINEUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3871 val--; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3872 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3873 case SB_PAGEDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3874 val += (sb_info->size > 2 ? sb_info->size - 2 : 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3875 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3876 case SB_PAGEUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3877 val -= (sb_info->size > 2 ? sb_info->size - 2 : 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3878 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3879 case SB_TOP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3880 val = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3881 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3882 case SB_BOTTOM: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3883 val = sb_info->max; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3884 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3885 case SB_ENDSCROLL: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3886 if (prev_code == SB_THUMBTRACK) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3887 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3888 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3889 * "pos" only gives us 16-bit data. In case of large file, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3890 * use GetScrollPos() which returns 32-bit. Unfortunately it |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3891 * is not valid while the scrollbar is being dragged. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3892 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3893 val = GetScrollPos(hwndCtl, SB_CTL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3894 if (sb->scroll_shift > 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3895 val <<= sb->scroll_shift; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3896 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3897 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3898 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3899 default: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3900 /* TRACE("Unknown scrollbar event %d\n", code); */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3901 return 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3902 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3903 prev_code = code; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3904 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3905 si.nPos = (sb->scroll_shift > 0) ? val >> sb->scroll_shift : val; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3906 SetScrollInfo(hwndCtl, SB_CTL, &si, TRUE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3907 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3908 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3909 * When moving a vertical scrollbar, move the other vertical scrollbar too. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3910 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3911 if (sb->wp != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3912 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3913 scrollbar_T *sba = sb->wp->w_scrollbars; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3914 HWND id = sba[ (sb == sba + SBAR_LEFT) ? SBAR_RIGHT : SBAR_LEFT].id; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3915 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3916 SetScrollInfo(id, SB_CTL, &si, TRUE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3917 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3918 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3919 /* Don't let us be interrupted here by another message. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3920 s_busy_processing = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3921 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3922 /* When "allow_scrollbar" is FALSE still need to remember the new |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3923 * position, but don't actually scroll by setting "dont_scroll". */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3924 dont_scroll = !allow_scrollbar; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3925 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3926 gui_drag_scrollbar(sb, val, dragging); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3927 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3928 s_busy_processing = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3929 dont_scroll = dont_scroll_save; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3930 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3931 return 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3932 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3933 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3934 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3935 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3936 * Get command line arguments. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3937 * Use "prog" as the name of the program and "cmdline" as the arguments. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3938 * Copy the arguments to allocated memory. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3939 * Return the number of arguments (including program name). |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3940 * Return pointers to the arguments in "argvp". Memory is allocated with |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3941 * malloc(), use free() instead of vim_free(). |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3942 * Return pointer to buffer in "tofree". |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3943 * Returns zero when out of memory. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3944 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3945 /*ARGSUSED*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3946 int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3947 get_cmd_args(char *prog, char *cmdline, char ***argvp, char **tofree) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3948 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3949 int i; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3950 char *p; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3951 char *progp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3952 char *pnew = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3953 char *newcmdline; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3954 int inquote; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3955 int argc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3956 char **argv = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3957 int round; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3958 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3959 *tofree = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3960 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3961 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3962 /* Try using the Unicode version first, it takes care of conversion when |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3963 * 'encoding' is changed. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3964 argc = get_cmd_argsW(&argv); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3965 if (argc != 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3966 goto done; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3967 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3968 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3969 /* Handle the program name. Remove the ".exe" extension, and find the 1st |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3970 * non-space. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3971 p = strrchr(prog, '.'); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3972 if (p != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3973 *p = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3974 for (progp = prog; *progp == ' '; ++progp) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3975 ; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3976 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3977 /* The command line is copied to allocated memory, so that we can change |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3978 * it. Add the size of the string, the separating NUL and a terminating |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3979 * NUL. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3980 newcmdline = malloc(STRLEN(cmdline) + STRLEN(progp) + 2); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3981 if (newcmdline == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3982 return 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3983 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3984 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3985 * First round: count the number of arguments ("pnew" == NULL). |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3986 * Second round: produce the arguments. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3987 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3988 for (round = 1; round <= 2; ++round) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3989 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3990 /* First argument is the program name. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3991 if (pnew != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3992 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3993 argv[0] = pnew; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3994 strcpy(pnew, progp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3995 pnew += strlen(pnew); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3996 *pnew++ = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3997 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3998 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3999 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4000 * Isolate each argument and put it in argv[]. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4001 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4002 p = cmdline; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4003 argc = 1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4004 while (*p != NUL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4005 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4006 inquote = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4007 if (pnew != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4008 argv[argc] = pnew; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4009 ++argc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4010 while (*p != NUL && (inquote || (*p != ' ' && *p != '\t'))) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4011 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4012 /* Backslashes are only special when followed by a double |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4013 * quote. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4014 i = (int)strspn(p, "\\"); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4015 if (p[i] == '"') |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4016 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4017 /* Halve the number of backslashes. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4018 if (i > 1 && pnew != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4019 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4020 vim_memset(pnew, '\\', i / 2); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4021 pnew += i / 2; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4022 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4023 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4024 /* Even nr of backslashes toggles quoting, uneven copies |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4025 * the double quote. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4026 if ((i & 1) == 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4027 inquote = !inquote; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4028 else if (pnew != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4029 *pnew++ = '"'; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4030 p += i + 1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4031 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4032 else if (i > 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4033 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4034 /* Copy span of backslashes unmodified. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4035 if (pnew != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4036 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4037 vim_memset(pnew, '\\', i); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4038 pnew += i; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4039 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4040 p += i; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4041 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4042 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4043 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4044 if (pnew != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4045 *pnew++ = *p; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4046 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4047 /* Can't use mb_* functions, because 'encoding' is not |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4048 * initialized yet here. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4049 if (IsDBCSLeadByte(*p)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4050 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4051 ++p; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4052 if (pnew != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4053 *pnew++ = *p; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4054 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4055 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4056 ++p; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4057 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4058 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4059 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4060 if (pnew != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4061 *pnew++ = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4062 while (*p == ' ' || *p == '\t') |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4063 ++p; /* advance until a non-space */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4064 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4065 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4066 if (round == 1) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4067 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4068 argv = (char **)malloc((argc + 1) * sizeof(char *)); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4069 if (argv == NULL ) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4070 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4071 free(newcmdline); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4072 return 0; /* malloc error */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4073 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4074 pnew = newcmdline; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4075 *tofree = newcmdline; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4076 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4077 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4078 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4079 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4080 done: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4081 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4082 argv[argc] = NULL; /* NULL-terminated list */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4083 *argvp = argv; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4084 return argc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4085 } |
7 | 4086 |
4087 #ifdef FEAT_XPM_W32 | |
4088 # include "xpm_w32.h" | |
4089 #endif | |
4090 | |
4091 #ifdef PROTO | |
4092 # define WINAPI | |
4093 #endif | |
4094 | |
4095 #ifdef __MINGW32__ | |
4096 /* | |
4097 * Add a lot of missing defines. | |
4098 * They are not always missing, we need the #ifndef's. | |
4099 */ | |
4100 # ifndef _cdecl | |
4101 # define _cdecl | |
4102 # endif | |
4103 # ifndef IsMinimized | |
4104 # define IsMinimized(hwnd) IsIconic(hwnd) | |
4105 # endif | |
4106 # ifndef IsMaximized | |
4107 # define IsMaximized(hwnd) IsZoomed(hwnd) | |
4108 # endif | |
4109 # ifndef SelectFont | |
4110 # define SelectFont(hdc, hfont) ((HFONT)SelectObject((hdc), (HGDIOBJ)(HFONT)(hfont))) | |
4111 # endif | |
4112 # ifndef GetStockBrush | |
4113 # define GetStockBrush(i) ((HBRUSH)GetStockObject(i)) | |
4114 # endif | |
4115 # ifndef DeleteBrush | |
4116 # define DeleteBrush(hbr) DeleteObject((HGDIOBJ)(HBRUSH)(hbr)) | |
4117 # endif | |
4118 | |
4119 # ifndef HANDLE_WM_RBUTTONDBLCLK | |
4120 # define HANDLE_WM_RBUTTONDBLCLK(hwnd, wParam, lParam, fn) \ | |
4121 ((fn)((hwnd), TRUE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
4122 # endif | |
4123 # ifndef HANDLE_WM_MBUTTONUP | |
4124 # define HANDLE_WM_MBUTTONUP(hwnd, wParam, lParam, fn) \ | |
4125 ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
4126 # endif | |
4127 # ifndef HANDLE_WM_MBUTTONDBLCLK | |
4128 # define HANDLE_WM_MBUTTONDBLCLK(hwnd, wParam, lParam, fn) \ | |
4129 ((fn)((hwnd), TRUE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
4130 # endif | |
4131 # ifndef HANDLE_WM_LBUTTONDBLCLK | |
4132 # define HANDLE_WM_LBUTTONDBLCLK(hwnd, wParam, lParam, fn) \ | |
4133 ((fn)((hwnd), TRUE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
4134 # endif | |
4135 # ifndef HANDLE_WM_RBUTTONDOWN | |
4136 # define HANDLE_WM_RBUTTONDOWN(hwnd, wParam, lParam, fn) \ | |
4137 ((fn)((hwnd), FALSE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
4138 # endif | |
4139 # ifndef HANDLE_WM_MOUSEMOVE | |
4140 # define HANDLE_WM_MOUSEMOVE(hwnd, wParam, lParam, fn) \ | |
4141 ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
4142 # endif | |
4143 # ifndef HANDLE_WM_RBUTTONUP | |
4144 # define HANDLE_WM_RBUTTONUP(hwnd, wParam, lParam, fn) \ | |
4145 ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
4146 # endif | |
4147 # ifndef HANDLE_WM_MBUTTONDOWN | |
4148 # define HANDLE_WM_MBUTTONDOWN(hwnd, wParam, lParam, fn) \ | |
4149 ((fn)((hwnd), FALSE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
4150 # endif | |
4151 # ifndef HANDLE_WM_LBUTTONUP | |
4152 # define HANDLE_WM_LBUTTONUP(hwnd, wParam, lParam, fn) \ | |
4153 ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
4154 # endif | |
4155 # ifndef HANDLE_WM_LBUTTONDOWN | |
4156 # define HANDLE_WM_LBUTTONDOWN(hwnd, wParam, lParam, fn) \ | |
4157 ((fn)((hwnd), FALSE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
4158 # endif | |
4159 # ifndef HANDLE_WM_SYSCHAR | |
4160 # define HANDLE_WM_SYSCHAR(hwnd, wParam, lParam, fn) \ | |
4161 ((fn)((hwnd), (TCHAR)(wParam), (int)(short)LOWORD(lParam)), 0L) | |
4162 # endif | |
4163 # ifndef HANDLE_WM_ACTIVATEAPP | |
4164 # define HANDLE_WM_ACTIVATEAPP(hwnd, wParam, lParam, fn) \ | |
4165 ((fn)((hwnd), (BOOL)(wParam), (DWORD)(lParam)), 0L) | |
4166 # endif | |
4167 # ifndef HANDLE_WM_WINDOWPOSCHANGING | |
4168 # define HANDLE_WM_WINDOWPOSCHANGING(hwnd, wParam, lParam, fn) \ | |
4169 (LRESULT)(DWORD)(BOOL)(fn)((hwnd), (LPWINDOWPOS)(lParam)) | |
4170 # endif | |
4171 # ifndef HANDLE_WM_VSCROLL | |
4172 # define HANDLE_WM_VSCROLL(hwnd, wParam, lParam, fn) \ | |
4173 ((fn)((hwnd), (HWND)(lParam), (UINT)(LOWORD(wParam)), (int)(short)HIWORD(wParam)), 0L) | |
4174 # endif | |
4175 # ifndef HANDLE_WM_SETFOCUS | |
4176 # define HANDLE_WM_SETFOCUS(hwnd, wParam, lParam, fn) \ | |
4177 ((fn)((hwnd), (HWND)(wParam)), 0L) | |
4178 # endif | |
4179 # ifndef HANDLE_WM_KILLFOCUS | |
4180 # define HANDLE_WM_KILLFOCUS(hwnd, wParam, lParam, fn) \ | |
4181 ((fn)((hwnd), (HWND)(wParam)), 0L) | |
4182 # endif | |
4183 # ifndef HANDLE_WM_HSCROLL | |
4184 # define HANDLE_WM_HSCROLL(hwnd, wParam, lParam, fn) \ | |
4185 ((fn)((hwnd), (HWND)(lParam), (UINT)(LOWORD(wParam)), (int)(short)HIWORD(wParam)), 0L) | |
4186 # endif | |
4187 # ifndef HANDLE_WM_DROPFILES | |
4188 # define HANDLE_WM_DROPFILES(hwnd, wParam, lParam, fn) \ | |
4189 ((fn)((hwnd), (HDROP)(wParam)), 0L) | |
4190 # endif | |
4191 # ifndef HANDLE_WM_CHAR | |
4192 # define HANDLE_WM_CHAR(hwnd, wParam, lParam, fn) \ | |
4193 ((fn)((hwnd), (TCHAR)(wParam), (int)(short)LOWORD(lParam)), 0L) | |
4194 # endif | |
4195 # ifndef HANDLE_WM_SYSDEADCHAR | |
4196 # define HANDLE_WM_SYSDEADCHAR(hwnd, wParam, lParam, fn) \ | |
4197 ((fn)((hwnd), (TCHAR)(wParam), (int)(short)LOWORD(lParam)), 0L) | |
4198 # endif | |
4199 # ifndef HANDLE_WM_DEADCHAR | |
4200 # define HANDLE_WM_DEADCHAR(hwnd, wParam, lParam, fn) \ | |
4201 ((fn)((hwnd), (TCHAR)(wParam), (int)(short)LOWORD(lParam)), 0L) | |
4202 # endif | |
4203 #endif /* __MINGW32__ */ | |
4204 | |
4205 | |
4206 /* Some parameters for tearoff menus. All in pixels. */ | |
4207 #define TEAROFF_PADDING_X 2 | |
4208 #define TEAROFF_BUTTON_PAD_X 8 | |
4209 #define TEAROFF_MIN_WIDTH 200 | |
4210 #define TEAROFF_SUBMENU_LABEL ">>" | |
4211 #define TEAROFF_COLUMN_PADDING 3 // # spaces to pad column with. | |
4212 | |
4213 | |
4214 /* For the Intellimouse: */ | |
4215 #ifndef WM_MOUSEWHEEL | |
4216 #define WM_MOUSEWHEEL 0x20a | |
4217 #endif | |
4218 | |
4219 | |
4220 #ifdef FEAT_BEVAL | |
4221 # define ID_BEVAL_TOOLTIP 200 | |
4222 # define BEVAL_TEXT_LEN MAXPATHL | |
4223 | |
2224
a0cce15dd2a9
Fix definition of UINT_PTR for 64 bit systems.
Bram Moolenaar <bram@vim.org>
parents:
2217
diff
changeset
|
4224 #if (defined(_MSC_VER) && _MSC_VER < 1300) || !defined(MAXULONG_PTR) |
1621 | 4225 /* Work around old versions of basetsd.h which wrongly declares |
4226 * UINT_PTR as unsigned long. */ | |
2224
a0cce15dd2a9
Fix definition of UINT_PTR for 64 bit systems.
Bram Moolenaar <bram@vim.org>
parents:
2217
diff
changeset
|
4227 # undef UINT_PTR |
837 | 4228 # define UINT_PTR UINT |
4229 #endif | |
840 | 4230 |
7801
a1e71a01dbd6
commit https://github.com/vim/vim/commit/d25c16e2f2776d50245bf31d6e4d5364f12d188e
Christian Brabandt <cb@256bit.org>
parents:
7797
diff
changeset
|
4231 static void make_tooltip(BalloonEval *beval, char *text, POINT pt); |
a1e71a01dbd6
commit https://github.com/vim/vim/commit/d25c16e2f2776d50245bf31d6e4d5364f12d188e
Christian Brabandt <cb@256bit.org>
parents:
7797
diff
changeset
|
4232 static void delete_tooltip(BalloonEval *beval); |
a1e71a01dbd6
commit https://github.com/vim/vim/commit/d25c16e2f2776d50245bf31d6e4d5364f12d188e
Christian Brabandt <cb@256bit.org>
parents:
7797
diff
changeset
|
4233 static VOID CALLBACK BevalTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime); |
840 | 4234 |
7 | 4235 static BalloonEval *cur_beval = NULL; |
835 | 4236 static UINT_PTR BevalTimerId = 0; |
7 | 4237 static DWORD LastActivity = 0; |
435 | 4238 |
3927 | 4239 |
4240 /* cproto fails on missing include files */ | |
4241 #ifndef PROTO | |
4242 | |
435 | 4243 /* |
4244 * excerpts from headers since this may not be presented | |
843 | 4245 * in the extremely old compilers |
435 | 4246 */ |
3927 | 4247 # include <pshpack1.h> |
4248 | |
4249 #endif | |
435 | 4250 |
4251 typedef struct _DllVersionInfo | |
4252 { | |
4253 DWORD cbSize; | |
4254 DWORD dwMajorVersion; | |
4255 DWORD dwMinorVersion; | |
4256 DWORD dwBuildNumber; | |
4257 DWORD dwPlatformID; | |
4258 } DLLVERSIONINFO; | |
4259 | |
3927 | 4260 #ifndef PROTO |
4261 # include <poppack.h> | |
4262 #endif | |
2026 | 4263 |
435 | 4264 typedef struct tagTOOLINFOA_NEW |
4265 { | |
4266 UINT cbSize; | |
4267 UINT uFlags; | |
4268 HWND hwnd; | |
2026 | 4269 UINT_PTR uId; |
435 | 4270 RECT rect; |
4271 HINSTANCE hinst; | |
4272 LPSTR lpszText; | |
4273 LPARAM lParam; | |
4274 } TOOLINFO_NEW; | |
4275 | |
4276 typedef struct tagNMTTDISPINFO_NEW | |
4277 { | |
4278 NMHDR hdr; | |
2026 | 4279 LPSTR lpszText; |
435 | 4280 char szText[80]; |
4281 HINSTANCE hinst; | |
4282 UINT uFlags; | |
4283 LPARAM lParam; | |
4284 } NMTTDISPINFO_NEW; | |
4285 | |
4286 typedef HRESULT (WINAPI* DLLGETVERSIONPROC)(DLLVERSIONINFO *); | |
4287 #ifndef TTM_SETMAXTIPWIDTH | |
842 | 4288 # define TTM_SETMAXTIPWIDTH (WM_USER+24) |
7 | 4289 #endif |
4290 | |
435 | 4291 #ifndef TTF_DI_SETITEM |
842 | 4292 # define TTF_DI_SETITEM 0x8000 |
435 | 4293 #endif |
4294 | |
4295 #ifndef TTN_GETDISPINFO | |
842 | 4296 # define TTN_GETDISPINFO (TTN_FIRST - 0) |
435 | 4297 #endif |
4298 | |
4299 #endif /* defined(FEAT_BEVAL) */ | |
4300 | |
1213 | 4301 #if defined(FEAT_TOOLBAR) || defined(FEAT_GUI_TABLINE) |
4302 /* Older MSVC compilers don't have LPNMTTDISPINFO[AW] thus we need to define | |
4303 * it here if LPNMTTDISPINFO isn't defined. | |
4304 * MingW doesn't define LPNMTTDISPINFO but typedefs it. Thus we need to check | |
4305 * _MSC_VER. */ | |
4306 # if !defined(LPNMTTDISPINFO) && defined(_MSC_VER) | |
4307 typedef struct tagNMTTDISPINFOA { | |
4308 NMHDR hdr; | |
4309 LPSTR lpszText; | |
4310 char szText[80]; | |
4311 HINSTANCE hinst; | |
4312 UINT uFlags; | |
4313 LPARAM lParam; | |
4314 } NMTTDISPINFOA, *LPNMTTDISPINFOA; | |
4315 # define LPNMTTDISPINFO LPNMTTDISPINFOA | |
4316 | |
4317 # ifdef FEAT_MBYTE | |
4318 typedef struct tagNMTTDISPINFOW { | |
4319 NMHDR hdr; | |
4320 LPWSTR lpszText; | |
4321 WCHAR szText[80]; | |
4322 HINSTANCE hinst; | |
4323 UINT uFlags; | |
4324 LPARAM lParam; | |
4325 } NMTTDISPINFOW, *LPNMTTDISPINFOW; | |
4326 # endif | |
4327 # endif | |
4328 #endif | |
4329 | |
842 | 4330 #ifndef TTN_GETDISPINFOW |
4331 # define TTN_GETDISPINFOW (TTN_FIRST - 10) | |
4332 #endif | |
4333 | |
7 | 4334 /* Local variables: */ |
4335 | |
4336 #ifdef FEAT_MENU | |
4337 static UINT s_menu_id = 100; | |
2614 | 4338 #endif |
7 | 4339 |
4340 /* | |
4341 * Use the system font for dialogs and tear-off menus. Remove this line to | |
4342 * use DLG_FONT_NAME. | |
4343 */ | |
2614 | 4344 #define USE_SYSMENU_FONT |
7 | 4345 |
4346 #define VIM_NAME "vim" | |
4347 #define VIM_CLASS "Vim" | |
4348 #define VIM_CLASSW L"Vim" | |
4349 | |
4350 /* Initial size for the dialog template. For gui_mch_dialog() it's fixed, | |
4351 * thus there should be room for every dialog. For tearoffs it's made bigger | |
4352 * when needed. */ | |
4353 #define DLG_ALLOC_SIZE 16 * 1024 | |
4354 | |
4355 /* | |
4356 * stuff for dialogs, menus, tearoffs etc. | |
4357 */ | |
4358 static LRESULT APIENTRY dialog_callback(HWND, UINT, WPARAM, LPARAM); | |
8138
f52504c10387
commit https://github.com/vim/vim/commit/065bbac8adfe29a09958570237d223457f235c6c
Christian Brabandt <cb@256bit.org>
parents:
8108
diff
changeset
|
4359 #ifdef FEAT_TEAROFF |
7 | 4360 static LRESULT APIENTRY tearoff_callback(HWND, UINT, WPARAM, LPARAM); |
8138
f52504c10387
commit https://github.com/vim/vim/commit/065bbac8adfe29a09958570237d223457f235c6c
Christian Brabandt <cb@256bit.org>
parents:
8108
diff
changeset
|
4361 #endif |
7 | 4362 static PWORD |
4363 add_dialog_element( | |
4364 PWORD p, | |
4365 DWORD lStyle, | |
4366 WORD x, | |
4367 WORD y, | |
4368 WORD w, | |
4369 WORD h, | |
4370 WORD Id, | |
4371 WORD clss, | |
4372 const char *caption); | |
4373 static LPWORD lpwAlign(LPWORD); | |
4374 static int nCopyAnsiToWideChar(LPWORD, LPSTR); | |
8138
f52504c10387
commit https://github.com/vim/vim/commit/065bbac8adfe29a09958570237d223457f235c6c
Christian Brabandt <cb@256bit.org>
parents:
8108
diff
changeset
|
4375 #if defined(FEAT_MENU) && defined(FEAT_TEAROFF) |
7 | 4376 static void gui_mch_tearoff(char_u *title, vimmenu_T *menu, int initX, int initY); |
8138
f52504c10387
commit https://github.com/vim/vim/commit/065bbac8adfe29a09958570237d223457f235c6c
Christian Brabandt <cb@256bit.org>
parents:
8108
diff
changeset
|
4377 #endif |
7 | 4378 static void get_dialog_font_metrics(void); |
4379 | |
4380 static int dialog_default_button = -1; | |
4381 | |
4382 /* Intellimouse support */ | |
4383 static int mouse_scroll_lines = 0; | |
4384 | |
4385 static int s_usenewlook; /* emulate W95/NT4 non-bold dialogs */ | |
4386 #ifdef FEAT_TOOLBAR | |
4387 static void initialise_toolbar(void); | |
5223
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
4388 static LRESULT CALLBACK toolbar_wndproc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); |
7 | 4389 static int get_toolbar_bitmap(vimmenu_T *menu); |
4390 #endif | |
4391 | |
810 | 4392 #ifdef FEAT_GUI_TABLINE |
4393 static void initialise_tabline(void); | |
5223
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
4394 static LRESULT CALLBACK tabline_wndproc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); |
810 | 4395 #endif |
4396 | |
7 | 4397 #ifdef FEAT_MBYTE_IME |
4398 static LRESULT _OnImeComposition(HWND hwnd, WPARAM dbcs, LPARAM param); | |
4399 static char_u *GetResultStr(HWND hwnd, int GCS, int *lenp); | |
4400 #endif | |
4401 #if defined(FEAT_MBYTE_IME) && defined(DYNAMIC_IME) | |
4402 # ifdef NOIME | |
4403 typedef struct tagCOMPOSITIONFORM { | |
4404 DWORD dwStyle; | |
4405 POINT ptCurrentPos; | |
4406 RECT rcArea; | |
4407 } COMPOSITIONFORM, *PCOMPOSITIONFORM, NEAR *NPCOMPOSITIONFORM, FAR *LPCOMPOSITIONFORM; | |
4408 typedef HANDLE HIMC; | |
4409 # endif | |
4410 | |
344 | 4411 static HINSTANCE hLibImm = NULL; |
4412 static LONG (WINAPI *pImmGetCompositionStringA)(HIMC, DWORD, LPVOID, DWORD); | |
4413 static LONG (WINAPI *pImmGetCompositionStringW)(HIMC, DWORD, LPVOID, DWORD); | |
4414 static HIMC (WINAPI *pImmGetContext)(HWND); | |
4415 static HIMC (WINAPI *pImmAssociateContext)(HWND, HIMC); | |
4416 static BOOL (WINAPI *pImmReleaseContext)(HWND, HIMC); | |
4417 static BOOL (WINAPI *pImmGetOpenStatus)(HIMC); | |
4418 static BOOL (WINAPI *pImmSetOpenStatus)(HIMC, BOOL); | |
4419 static BOOL (WINAPI *pImmGetCompositionFont)(HIMC, LPLOGFONTA); | |
4420 static BOOL (WINAPI *pImmSetCompositionFont)(HIMC, LPLOGFONTA); | |
4421 static BOOL (WINAPI *pImmSetCompositionWindow)(HIMC, LPCOMPOSITIONFORM); | |
4422 static BOOL (WINAPI *pImmGetConversionStatus)(HIMC, LPDWORD, LPDWORD); | |
777 | 4423 static BOOL (WINAPI *pImmSetConversionStatus)(HIMC, DWORD, DWORD); |
7 | 4424 static void dyn_imm_load(void); |
4425 #else | |
4426 # define pImmGetCompositionStringA ImmGetCompositionStringA | |
4427 # define pImmGetCompositionStringW ImmGetCompositionStringW | |
4428 # define pImmGetContext ImmGetContext | |
4429 # define pImmAssociateContext ImmAssociateContext | |
4430 # define pImmReleaseContext ImmReleaseContext | |
4431 # define pImmGetOpenStatus ImmGetOpenStatus | |
4432 # define pImmSetOpenStatus ImmSetOpenStatus | |
4433 # define pImmGetCompositionFont ImmGetCompositionFontA | |
4434 # define pImmSetCompositionFont ImmSetCompositionFontA | |
4435 # define pImmSetCompositionWindow ImmSetCompositionWindow | |
4436 # define pImmGetConversionStatus ImmGetConversionStatus | |
777 | 4437 # define pImmSetConversionStatus ImmSetConversionStatus |
7 | 4438 #endif |
4439 | |
4440 #ifdef FEAT_MENU | |
4441 /* | |
4442 * Figure out how high the menu bar is at the moment. | |
4443 */ | |
4444 static int | |
4445 gui_mswin_get_menu_height( | |
4446 int fix_window) /* If TRUE, resize window if menu height changed */ | |
4447 { | |
4448 static int old_menu_height = -1; | |
4449 | |
4450 RECT rc1, rc2; | |
4451 int num; | |
4452 int menu_height; | |
4453 | |
4454 if (gui.menu_is_active) | |
4455 num = GetMenuItemCount(s_menuBar); | |
4456 else | |
4457 num = 0; | |
4458 | |
4459 if (num == 0) | |
4460 menu_height = 0; | |
6714 | 4461 else if (IsMinimized(s_hwnd)) |
4462 { | |
4463 /* The height of the menu cannot be determined while the window is | |
4464 * minimized. Take the previous height if the menu is changed in that | |
4465 * state, to avoid that Vim's vertical window size accidentally | |
4466 * increases due to the unaccounted-for menu height. */ | |
4467 menu_height = old_menu_height == -1 ? 0 : old_menu_height; | |
4468 } | |
7 | 4469 else |
4470 { | |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4471 /* |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4472 * In case 'lines' is set in _vimrc/_gvimrc window width doesn't |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4473 * seem to have been set yet, so menu wraps in default window |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4474 * width which is very narrow. Instead just return height of a |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4475 * single menu item. Will still be wrong when the menu really |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4476 * should wrap over more than one line. |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4477 */ |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4478 GetMenuItemRect(s_hwnd, s_menuBar, 0, &rc1); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4479 if (gui.starting) |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4480 menu_height = rc1.bottom - rc1.top + 1; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4481 else |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4482 { |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4483 GetMenuItemRect(s_hwnd, s_menuBar, num - 1, &rc2); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4484 menu_height = rc2.bottom - rc1.top + 1; |
7 | 4485 } |
4486 } | |
4487 | |
4488 if (fix_window && menu_height != old_menu_height) | |
4489 { | |
812 | 4490 gui_set_shellsize(FALSE, FALSE, RESIZE_VERT); |
7 | 4491 } |
6714 | 4492 old_menu_height = menu_height; |
7 | 4493 |
4494 return menu_height; | |
4495 } | |
4496 #endif /*FEAT_MENU*/ | |
4497 | |
4498 | |
4499 /* | |
4500 * Setup for the Intellimouse | |
4501 */ | |
4502 static void | |
4503 init_mouse_wheel(void) | |
4504 { | |
4505 | |
4506 #ifndef SPI_GETWHEELSCROLLLINES | |
4507 # define SPI_GETWHEELSCROLLLINES 104 | |
4508 #endif | |
336 | 4509 #ifndef SPI_SETWHEELSCROLLLINES |
4510 # define SPI_SETWHEELSCROLLLINES 105 | |
4511 #endif | |
7 | 4512 |
4513 #define VMOUSEZ_CLASSNAME "MouseZ" /* hidden wheel window class */ | |
4514 #define VMOUSEZ_TITLE "Magellan MSWHEEL" /* hidden wheel window title */ | |
4515 #define VMSH_MOUSEWHEEL "MSWHEEL_ROLLMSG" | |
4516 #define VMSH_SCROLL_LINES "MSH_SCROLL_LINES_MSG" | |
4517 | |
4518 mouse_scroll_lines = 3; /* reasonable default */ | |
4519 | |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4520 /* if NT 4.0+ (or Win98) get scroll lines directly from system */ |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4521 SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4522 &mouse_scroll_lines, 0); |
7 | 4523 } |
4524 | |
4525 | |
4526 /* Intellimouse wheel handler */ | |
4527 static void | |
4528 _OnMouseWheel( | |
4529 HWND hwnd, | |
4530 short zDelta) | |
4531 { | |
4532 /* Treat a mouse wheel event as if it were a scroll request */ | |
4533 int i; | |
4534 int size; | |
4535 HWND hwndCtl; | |
4536 | |
4537 if (curwin->w_scrollbars[SBAR_RIGHT].id != 0) | |
4538 { | |
4539 hwndCtl = curwin->w_scrollbars[SBAR_RIGHT].id; | |
4540 size = curwin->w_scrollbars[SBAR_RIGHT].size; | |
4541 } | |
4542 else if (curwin->w_scrollbars[SBAR_LEFT].id != 0) | |
4543 { | |
4544 hwndCtl = curwin->w_scrollbars[SBAR_LEFT].id; | |
4545 size = curwin->w_scrollbars[SBAR_LEFT].size; | |
4546 } | |
4547 else | |
4548 return; | |
4549 | |
4550 size = curwin->w_height; | |
4551 if (mouse_scroll_lines == 0) | |
4552 init_mouse_wheel(); | |
4553 | |
4554 if (mouse_scroll_lines > 0 | |
4555 && mouse_scroll_lines < (size > 2 ? size - 2 : 1)) | |
4556 { | |
4557 for (i = mouse_scroll_lines; i > 0; --i) | |
4558 _OnScroll(hwnd, hwndCtl, zDelta >= 0 ? SB_LINEUP : SB_LINEDOWN, 0); | |
4559 } | |
4560 else | |
4561 _OnScroll(hwnd, hwndCtl, zDelta >= 0 ? SB_PAGEUP : SB_PAGEDOWN, 0); | |
4562 } | |
4563 | |
843 | 4564 #ifdef USE_SYSMENU_FONT |
4565 /* | |
4566 * Get Menu Font. | |
4567 * Return OK or FAIL. | |
4568 */ | |
4569 static int | |
4570 gui_w32_get_menu_font(LOGFONT *lf) | |
4571 { | |
4572 NONCLIENTMETRICS nm; | |
4573 | |
4574 nm.cbSize = sizeof(NONCLIENTMETRICS); | |
4575 if (!SystemParametersInfo( | |
4576 SPI_GETNONCLIENTMETRICS, | |
4577 sizeof(NONCLIENTMETRICS), | |
4578 &nm, | |
4579 0)) | |
4580 return FAIL; | |
4581 *lf = nm.lfMenuFont; | |
4582 return OK; | |
4583 } | |
4584 #endif | |
4585 | |
4586 | |
4587 #if defined(FEAT_GUI_TABLINE) && defined(USE_SYSMENU_FONT) | |
4588 /* | |
4589 * Set the GUI tabline font to the system menu font | |
4590 */ | |
4591 static void | |
4592 set_tabline_font(void) | |
4593 { | |
4594 LOGFONT lfSysmenu; | |
4595 HFONT font; | |
4596 HWND hwnd; | |
4597 HDC hdc; | |
4598 HFONT hfntOld; | |
4599 TEXTMETRIC tm; | |
4600 | |
4601 if (gui_w32_get_menu_font(&lfSysmenu) != OK) | |
4602 return; | |
4603 | |
4604 font = CreateFontIndirect(&lfSysmenu); | |
4605 | |
4606 SendMessage(s_tabhwnd, WM_SETFONT, (WPARAM)font, TRUE); | |
4607 | |
4608 /* | |
4609 * Compute the height of the font used for the tab text | |
4610 */ | |
4611 hwnd = GetDesktopWindow(); | |
4612 hdc = GetWindowDC(hwnd); | |
4613 hfntOld = SelectFont(hdc, font); | |
4614 | |
4615 GetTextMetrics(hdc, &tm); | |
4616 | |
4617 SelectFont(hdc, hfntOld); | |
4618 ReleaseDC(hwnd, hdc); | |
4619 | |
4620 /* | |
4621 * The space used by the tab border and the space between the tab label | |
4622 * and the tab border is included as 7. | |
4623 */ | |
4624 gui.tabline_height = tm.tmHeight + tm.tmInternalLeading + 7; | |
4625 } | |
4626 #endif | |
4627 | |
333 | 4628 /* |
4629 * Invoked when a setting was changed. | |
4630 */ | |
4631 static LRESULT CALLBACK | |
4632 _OnSettingChange(UINT n) | |
4633 { | |
4634 if (n == SPI_SETWHEELSCROLLLINES) | |
4635 SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, | |
4636 &mouse_scroll_lines, 0); | |
843 | 4637 #if defined(FEAT_GUI_TABLINE) && defined(USE_SYSMENU_FONT) |
4638 if (n == SPI_SETNONCLIENTMETRICS) | |
4639 set_tabline_font(); | |
4640 #endif | |
333 | 4641 return 0; |
4642 } | |
4643 | |
7 | 4644 #ifdef FEAT_NETBEANS_INTG |
4645 static void | |
4646 _OnWindowPosChanged( | |
4647 HWND hwnd, | |
4648 const LPWINDOWPOS lpwpos) | |
4649 { | |
4650 static int x = 0, y = 0, cx = 0, cy = 0; | |
7797
0d46cea25641
commit https://github.com/vim/vim/commit/f12d983deab06b0408781d7a6c2f8970d765b723
Christian Brabandt <cb@256bit.org>
parents:
7743
diff
changeset
|
4651 extern int WSInitialized; |
7 | 4652 |
4653 if (WSInitialized && (lpwpos->x != x || lpwpos->y != y | |
4654 || lpwpos->cx != cx || lpwpos->cy != cy)) | |
4655 { | |
4656 x = lpwpos->x; | |
4657 y = lpwpos->y; | |
4658 cx = lpwpos->cx; | |
4659 cy = lpwpos->cy; | |
4660 netbeans_frame_moved(x, y); | |
4661 } | |
4662 /* Allow to send WM_SIZE and WM_MOVE */ | |
4663 FORWARD_WM_WINDOWPOSCHANGED(hwnd, lpwpos, MyWindowProc); | |
4664 } | |
4665 #endif | |
4666 | |
4667 static int | |
4668 _DuringSizing( | |
4669 UINT fwSide, | |
4670 LPRECT lprc) | |
4671 { | |
4672 int w, h; | |
4673 int valid_w, valid_h; | |
4674 int w_offset, h_offset; | |
4675 | |
4676 w = lprc->right - lprc->left; | |
4677 h = lprc->bottom - lprc->top; | |
4678 gui_mswin_get_valid_dimensions(w, h, &valid_w, &valid_h); | |
4679 w_offset = w - valid_w; | |
4680 h_offset = h - valid_h; | |
4681 | |
4682 if (fwSide == WMSZ_LEFT || fwSide == WMSZ_TOPLEFT | |
4683 || fwSide == WMSZ_BOTTOMLEFT) | |
4684 lprc->left += w_offset; | |
4685 else if (fwSide == WMSZ_RIGHT || fwSide == WMSZ_TOPRIGHT | |
4686 || fwSide == WMSZ_BOTTOMRIGHT) | |
4687 lprc->right -= w_offset; | |
4688 | |
4689 if (fwSide == WMSZ_TOP || fwSide == WMSZ_TOPLEFT | |
4690 || fwSide == WMSZ_TOPRIGHT) | |
4691 lprc->top += h_offset; | |
4692 else if (fwSide == WMSZ_BOTTOM || fwSide == WMSZ_BOTTOMLEFT | |
4693 || fwSide == WMSZ_BOTTOMRIGHT) | |
4694 lprc->bottom -= h_offset; | |
4695 return TRUE; | |
4696 } | |
4697 | |
4698 | |
4699 | |
4700 static LRESULT CALLBACK | |
4701 _WndProc( | |
4702 HWND hwnd, | |
4703 UINT uMsg, | |
4704 WPARAM wParam, | |
4705 LPARAM lParam) | |
4706 { | |
4707 /* | |
4708 TRACE("WndProc: hwnd = %08x, msg = %x, wParam = %x, lParam = %x\n", | |
4709 hwnd, uMsg, wParam, lParam); | |
4710 */ | |
4711 | |
4712 HandleMouseHide(uMsg, lParam); | |
4713 | |
4714 s_uMsg = uMsg; | |
4715 s_wParam = wParam; | |
4716 s_lParam = lParam; | |
4717 | |
4718 switch (uMsg) | |
4719 { | |
4720 HANDLE_MSG(hwnd, WM_DEADCHAR, _OnDeadChar); | |
4721 HANDLE_MSG(hwnd, WM_SYSDEADCHAR, _OnDeadChar); | |
4722 /* HANDLE_MSG(hwnd, WM_ACTIVATE, _OnActivate); */ | |
4723 HANDLE_MSG(hwnd, WM_CLOSE, _OnClose); | |
4724 /* HANDLE_MSG(hwnd, WM_COMMAND, _OnCommand); */ | |
4725 HANDLE_MSG(hwnd, WM_DESTROY, _OnDestroy); | |
4726 HANDLE_MSG(hwnd, WM_DROPFILES, _OnDropFiles); | |
4727 HANDLE_MSG(hwnd, WM_HSCROLL, _OnScroll); | |
4728 HANDLE_MSG(hwnd, WM_KILLFOCUS, _OnKillFocus); | |
4729 #ifdef FEAT_MENU | |
4730 HANDLE_MSG(hwnd, WM_COMMAND, _OnMenu); | |
4731 #endif | |
4732 /* HANDLE_MSG(hwnd, WM_MOVE, _OnMove); */ | |
4733 /* HANDLE_MSG(hwnd, WM_NCACTIVATE, _OnNCActivate); */ | |
4734 HANDLE_MSG(hwnd, WM_SETFOCUS, _OnSetFocus); | |
4735 HANDLE_MSG(hwnd, WM_SIZE, _OnSize); | |
4736 /* HANDLE_MSG(hwnd, WM_SYSCOMMAND, _OnSysCommand); */ | |
4737 /* HANDLE_MSG(hwnd, WM_SYSKEYDOWN, _OnAltKey); */ | |
4738 HANDLE_MSG(hwnd, WM_VSCROLL, _OnScroll); | |
4739 // HANDLE_MSG(hwnd, WM_WINDOWPOSCHANGING, _OnWindowPosChanging); | |
4740 HANDLE_MSG(hwnd, WM_ACTIVATEAPP, _OnActivateApp); | |
4741 #ifdef FEAT_NETBEANS_INTG | |
4742 HANDLE_MSG(hwnd, WM_WINDOWPOSCHANGED, _OnWindowPosChanged); | |
4743 #endif | |
4744 | |
812 | 4745 #ifdef FEAT_GUI_TABLINE |
4746 case WM_RBUTTONUP: | |
4747 { | |
4748 if (gui_mch_showing_tabline()) | |
4749 { | |
4750 POINT pt; | |
4751 RECT rect; | |
4752 | |
4753 /* | |
4754 * If the cursor is on the tabline, display the tab menu | |
4755 */ | |
4756 GetCursorPos((LPPOINT)&pt); | |
4757 GetWindowRect(s_textArea, &rect); | |
4758 if (pt.y < rect.top) | |
4759 { | |
4760 show_tabline_popup_menu(); | |
3225 | 4761 return 0L; |
812 | 4762 } |
4763 } | |
4764 return MyWindowProc(hwnd, uMsg, wParam, lParam); | |
4765 } | |
819 | 4766 case WM_LBUTTONDBLCLK: |
4767 { | |
4768 /* | |
4769 * If the user double clicked the tabline, create a new tab | |
4770 */ | |
4771 if (gui_mch_showing_tabline()) | |
4772 { | |
4773 POINT pt; | |
4774 RECT rect; | |
4775 | |
4776 GetCursorPos((LPPOINT)&pt); | |
4777 GetWindowRect(s_textArea, &rect); | |
4778 if (pt.y < rect.top) | |
824 | 4779 send_tabline_menu_event(0, TABLINE_MENU_NEW); |
819 | 4780 } |
4781 return MyWindowProc(hwnd, uMsg, wParam, lParam); | |
4782 } | |
812 | 4783 #endif |
4784 | |
7 | 4785 case WM_QUERYENDSESSION: /* System wants to go down. */ |
4786 gui_shell_closed(); /* Will exit when no changed buffers. */ | |
4787 return FALSE; /* Do NOT allow system to go down. */ | |
4788 | |
4789 case WM_ENDSESSION: | |
4790 if (wParam) /* system only really goes down when wParam is TRUE */ | |
3225 | 4791 { |
7 | 4792 _OnEndSession(); |
3225 | 4793 return 0L; |
4794 } | |
7 | 4795 break; |
4796 | |
4797 case WM_CHAR: | |
4798 /* Don't use HANDLE_MSG() for WM_CHAR, it truncates wParam to a single | |
4799 * byte while we want the UTF-16 character value. */ | |
835 | 4800 _OnChar(hwnd, (UINT)wParam, (int)(short)LOWORD(lParam)); |
7 | 4801 return 0L; |
4802 | |
4803 case WM_SYSCHAR: | |
4804 /* | |
4805 * if 'winaltkeys' is "no", or it's "menu" and it's not a menu | |
4806 * shortcut key, handle like a typed ALT key, otherwise call Windows | |
4807 * ALT key handling. | |
4808 */ | |
4809 #ifdef FEAT_MENU | |
4810 if ( !gui.menu_is_active | |
4811 || p_wak[0] == 'n' | |
4812 || (p_wak[0] == 'm' && !gui_is_menu_shortcut((int)wParam)) | |
4813 ) | |
4814 #endif | |
4815 { | |
835 | 4816 _OnSysChar(hwnd, (UINT)wParam, (int)(short)LOWORD(lParam)); |
7 | 4817 return 0L; |
4818 } | |
4819 #ifdef FEAT_MENU | |
4820 else | |
4821 return MyWindowProc(hwnd, uMsg, wParam, lParam); | |
4822 #endif | |
4823 | |
4824 case WM_SYSKEYUP: | |
4825 #ifdef FEAT_MENU | |
4826 /* This used to be done only when menu is active: ALT key is used for | |
4827 * that. But that caused problems when menu is disabled and using | |
4828 * Alt-Tab-Esc: get into a strange state where no mouse-moved events | |
4829 * are received, mouse pointer remains hidden. */ | |
4830 return MyWindowProc(hwnd, uMsg, wParam, lParam); | |
4831 #else | |
3225 | 4832 return 0L; |
7 | 4833 #endif |
4834 | |
4835 case WM_SIZING: /* HANDLE_MSG doesn't seem to handle this one */ | |
323 | 4836 return _DuringSizing((UINT)wParam, (LPRECT)lParam); |
7 | 4837 |
4838 case WM_MOUSEWHEEL: | |
4839 _OnMouseWheel(hwnd, HIWORD(wParam)); | |
3225 | 4840 return 0L; |
7 | 4841 |
333 | 4842 /* Notification for change in SystemParametersInfo() */ |
4843 case WM_SETTINGCHANGE: | |
4844 return _OnSettingChange((UINT)wParam); | |
4845 | |
810 | 4846 #if defined(FEAT_TOOLBAR) || defined(FEAT_GUI_TABLINE) |
7 | 4847 case WM_NOTIFY: |
4848 switch (((LPNMHDR) lParam)->code) | |
4849 { | |
840 | 4850 # ifdef FEAT_MBYTE |
4851 case TTN_GETDISPINFOW: | |
4852 # endif | |
948 | 4853 case TTN_GETDISPINFO: |
7 | 4854 { |
948 | 4855 LPNMHDR hdr = (LPNMHDR)lParam; |
4856 char_u *str = NULL; | |
4857 static void *tt_text = NULL; | |
4858 | |
4859 vim_free(tt_text); | |
4860 tt_text = NULL; | |
4861 | |
4862 # ifdef FEAT_GUI_TABLINE | |
4863 if (gui_mch_showing_tabline() | |
4864 && hdr->hwndFrom == TabCtrl_GetToolTips(s_tabhwnd)) | |
840 | 4865 { |
948 | 4866 POINT pt; |
840 | 4867 /* |
948 | 4868 * Mouse is over the GUI tabline. Display the |
4869 * tooltip for the tab under the cursor | |
4870 * | |
4871 * Get the cursor position within the tab control | |
840 | 4872 */ |
948 | 4873 GetCursorPos(&pt); |
4874 if (ScreenToClient(s_tabhwnd, &pt) != 0) | |
840 | 4875 { |
948 | 4876 TCHITTESTINFO htinfo; |
4877 int idx; | |
4878 | |
4879 /* | |
4880 * Get the tab under the cursor | |
4881 */ | |
4882 htinfo.pt.x = pt.x; | |
4883 htinfo.pt.y = pt.y; | |
4884 idx = TabCtrl_HitTest(s_tabhwnd, &htinfo); | |
4885 if (idx != -1) | |
840 | 4886 { |
948 | 4887 tabpage_T *tp; |
4888 | |
4889 tp = find_tabpage(idx + 1); | |
4890 if (tp != NULL) | |
840 | 4891 { |
948 | 4892 get_tabline_label(tp, TRUE); |
4893 str = NameBuff; | |
840 | 4894 } |
4895 } | |
4896 } | |
4897 } | |
4898 # endif | |
4899 # ifdef FEAT_TOOLBAR | |
948 | 4900 # ifdef FEAT_GUI_TABLINE |
4901 else | |
4902 # endif | |
4903 { | |
4904 UINT idButton; | |
4905 vimmenu_T *pMenu; | |
4906 | |
4907 idButton = (UINT) hdr->idFrom; | |
4908 pMenu = gui_mswin_find_menu(root_menu, idButton); | |
4909 if (pMenu) | |
4910 str = pMenu->strings[MENU_INDEX_TIP]; | |
4911 } | |
4912 # endif | |
4913 if (str != NULL) | |
7 | 4914 { |
948 | 4915 # ifdef FEAT_MBYTE |
4916 if (hdr->code == TTN_GETDISPINFOW) | |
7 | 4917 { |
948 | 4918 LPNMTTDISPINFOW lpdi = (LPNMTTDISPINFOW)lParam; |
4919 | |
1481 | 4920 /* Set the maximum width, this also enables using |
4921 * \n for line break. */ | |
4922 SendMessage(lpdi->hdr.hwndFrom, TTM_SETMAXTIPWIDTH, | |
4923 0, 500); | |
4924 | |
1752 | 4925 tt_text = enc_to_utf16(str, NULL); |
948 | 4926 lpdi->lpszText = tt_text; |
4927 /* can't show tooltip if failed */ | |
4928 } | |
4929 else | |
4930 # endif | |
4931 { | |
4932 LPNMTTDISPINFO lpdi = (LPNMTTDISPINFO)lParam; | |
4933 | |
1481 | 4934 /* Set the maximum width, this also enables using |
4935 * \n for line break. */ | |
4936 SendMessage(lpdi->hdr.hwndFrom, TTM_SETMAXTIPWIDTH, | |
4937 0, 500); | |
4938 | |
948 | 4939 if (STRLEN(str) < sizeof(lpdi->szText) |
4940 || ((tt_text = vim_strsave(str)) == NULL)) | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
4941 vim_strncpy((char_u *)lpdi->szText, str, |
948 | 4942 sizeof(lpdi->szText) - 1); |
4943 else | |
4944 lpdi->lpszText = tt_text; | |
7 | 4945 } |
4946 } | |
4947 } | |
4948 break; | |
810 | 4949 # ifdef FEAT_GUI_TABLINE |
4950 case TCN_SELCHANGE: | |
4951 if (gui_mch_showing_tabline() | |
4952 && ((LPNMHDR)lParam)->hwndFrom == s_tabhwnd) | |
3225 | 4953 { |
810 | 4954 send_tabline_event(TabCtrl_GetCurSel(s_tabhwnd) + 1); |
3225 | 4955 return 0L; |
4956 } | |
810 | 4957 break; |
812 | 4958 |
4959 case NM_RCLICK: | |
4960 if (gui_mch_showing_tabline() | |
4961 && ((LPNMHDR)lParam)->hwndFrom == s_tabhwnd) | |
3225 | 4962 { |
812 | 4963 show_tabline_popup_menu(); |
3225 | 4964 return 0L; |
4965 } | |
812 | 4966 break; |
810 | 4967 # endif |
7 | 4968 default: |
810 | 4969 # ifdef FEAT_GUI_TABLINE |
4970 if (gui_mch_showing_tabline() | |
4971 && ((LPNMHDR)lParam)->hwndFrom == s_tabhwnd) | |
4972 return MyWindowProc(hwnd, uMsg, wParam, lParam); | |
4973 # endif | |
7 | 4974 break; |
4975 } | |
4976 break; | |
4977 #endif | |
4978 #if defined(MENUHINTS) && defined(FEAT_MENU) | |
4979 case WM_MENUSELECT: | |
4980 if (((UINT) HIWORD(wParam) | |
4981 & (0xffff ^ (MF_MOUSESELECT + MF_BITMAP + MF_POPUP))) | |
4982 == MF_HILITE | |
4983 && (State & CMDLINE) == 0) | |
4984 { | |
4985 UINT idButton; | |
4986 vimmenu_T *pMenu; | |
4987 static int did_menu_tip = FALSE; | |
4988 | |
4989 if (did_menu_tip) | |
4990 { | |
4991 msg_clr_cmdline(); | |
4992 setcursor(); | |
4993 out_flush(); | |
4994 did_menu_tip = FALSE; | |
4995 } | |
4996 | |
4997 idButton = (UINT)LOWORD(wParam); | |
4998 pMenu = gui_mswin_find_menu(root_menu, idButton); | |
4999 if (pMenu != NULL && pMenu->strings[MENU_INDEX_TIP] != 0 | |
5000 && GetMenuState(s_menuBar, pMenu->id, MF_BYCOMMAND) != -1) | |
5001 { | |
1288 | 5002 ++msg_hist_off; |
7 | 5003 msg(pMenu->strings[MENU_INDEX_TIP]); |
1288 | 5004 --msg_hist_off; |
7 | 5005 setcursor(); |
5006 out_flush(); | |
5007 did_menu_tip = TRUE; | |
5008 } | |
3225 | 5009 return 0L; |
7 | 5010 } |
5011 break; | |
5012 #endif | |
5013 case WM_NCHITTEST: | |
5014 { | |
5015 LRESULT result; | |
5016 int x, y; | |
5017 int xPos = GET_X_LPARAM(lParam); | |
5018 | |
5019 result = MyWindowProc(hwnd, uMsg, wParam, lParam); | |
5020 if (result == HTCLIENT) | |
5021 { | |
810 | 5022 #ifdef FEAT_GUI_TABLINE |
5023 if (gui_mch_showing_tabline()) | |
5024 { | |
5025 int yPos = GET_Y_LPARAM(lParam); | |
5026 RECT rct; | |
5027 | |
5028 /* If the cursor is on the GUI tabline, don't process this | |
5029 * event */ | |
5030 GetWindowRect(s_textArea, &rct); | |
5031 if (yPos < rct.top) | |
5032 return result; | |
5033 } | |
5034 #endif | |
7009 | 5035 (void)gui_mch_get_winpos(&x, &y); |
7 | 5036 xPos -= x; |
5037 | |
5038 if (xPos < 48) /* <VN> TODO should use system metric? */ | |
5039 return HTBOTTOMLEFT; | |
5040 else | |
5041 return HTBOTTOMRIGHT; | |
5042 } | |
5043 else | |
5044 return result; | |
5045 } | |
5046 /* break; notreached */ | |
5047 | |
5048 #ifdef FEAT_MBYTE_IME | |
5049 case WM_IME_NOTIFY: | |
5050 if (!_OnImeNotify(hwnd, (DWORD)wParam, (DWORD)lParam)) | |
5051 return MyWindowProc(hwnd, uMsg, wParam, lParam); | |
3225 | 5052 return 1L; |
5053 | |
7 | 5054 case WM_IME_COMPOSITION: |
5055 if (!_OnImeComposition(hwnd, wParam, lParam)) | |
5056 return MyWindowProc(hwnd, uMsg, wParam, lParam); | |
3225 | 5057 return 1L; |
7 | 5058 #endif |
5059 | |
5060 default: | |
5061 #ifdef MSWIN_FIND_REPLACE | |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5062 if (uMsg == s_findrep_msg && s_findrep_msg != 0) |
7 | 5063 { |
5064 _OnFindRepl(); | |
5065 } | |
5066 #endif | |
5067 return MyWindowProc(hwnd, uMsg, wParam, lParam); | |
5068 } | |
5069 | |
3212 | 5070 return DefWindowProc(hwnd, uMsg, wParam, lParam); |
7 | 5071 } |
5072 | |
5073 /* | |
5074 * End of call-back routines | |
5075 */ | |
5076 | |
5077 /* parent window, if specified with -P */ | |
5078 HWND vim_parent_hwnd = NULL; | |
5079 | |
5080 static BOOL CALLBACK | |
5081 FindWindowTitle(HWND hwnd, LPARAM lParam) | |
5082 { | |
5083 char buf[2048]; | |
5084 char *title = (char *)lParam; | |
5085 | |
5086 if (GetWindowText(hwnd, buf, sizeof(buf))) | |
5087 { | |
5088 if (strstr(buf, title) != NULL) | |
5089 { | |
9 | 5090 /* Found it. Store the window ref. and quit searching if MDI |
5091 * works. */ | |
7 | 5092 vim_parent_hwnd = FindWindowEx(hwnd, NULL, "MDIClient", NULL); |
9 | 5093 if (vim_parent_hwnd != NULL) |
5094 return FALSE; | |
7 | 5095 } |
5096 } | |
5097 return TRUE; /* continue searching */ | |
5098 } | |
5099 | |
5100 /* | |
5101 * Invoked for '-P "title"' argument: search for parent application to open | |
5102 * our window in. | |
5103 */ | |
5104 void | |
5105 gui_mch_set_parent(char *title) | |
5106 { | |
5107 EnumWindows(FindWindowTitle, (LPARAM)title); | |
5108 if (vim_parent_hwnd == NULL) | |
5109 { | |
5110 EMSG2(_("E671: Cannot find window title \"%s\""), title); | |
5111 mch_exit(2); | |
5112 } | |
5113 } | |
5114 | |
323 | 5115 #ifndef FEAT_OLE |
7 | 5116 static void |
5117 ole_error(char *arg) | |
5118 { | |
1116 | 5119 char buf[IOSIZE]; |
5120 | |
5121 /* Can't use EMSG() here, we have not finished initialisation yet. */ | |
5122 vim_snprintf(buf, IOSIZE, | |
5123 _("E243: Argument not supported: \"-%s\"; Use the OLE version."), | |
5124 arg); | |
5125 mch_errmsg(buf); | |
7 | 5126 } |
323 | 5127 #endif |
7 | 5128 |
5129 /* | |
5130 * Parse the GUI related command-line arguments. Any arguments used are | |
5131 * deleted from argv, and *argc is decremented accordingly. This is called | |
5132 * when vim is started, whether or not the GUI has been started. | |
5133 */ | |
5134 void | |
5135 gui_mch_prepare(int *argc, char **argv) | |
5136 { | |
5137 int silent = FALSE; | |
5138 int idx; | |
5139 | |
5140 /* Check for special OLE command line parameters */ | |
5141 if ((*argc == 2 || *argc == 3) && (argv[1][0] == '-' || argv[1][0] == '/')) | |
5142 { | |
5143 /* Check for a "-silent" argument first. */ | |
5144 if (*argc == 3 && STRICMP(argv[1] + 1, "silent") == 0 | |
5145 && (argv[2][0] == '-' || argv[2][0] == '/')) | |
5146 { | |
5147 silent = TRUE; | |
5148 idx = 2; | |
5149 } | |
5150 else | |
5151 idx = 1; | |
5152 | |
5153 /* Register Vim as an OLE Automation server */ | |
5154 if (STRICMP(argv[idx] + 1, "register") == 0) | |
5155 { | |
5156 #ifdef FEAT_OLE | |
5157 RegisterMe(silent); | |
5158 mch_exit(0); | |
5159 #else | |
5160 if (!silent) | |
5161 ole_error("register"); | |
5162 mch_exit(2); | |
5163 #endif | |
5164 } | |
5165 | |
5166 /* Unregister Vim as an OLE Automation server */ | |
5167 if (STRICMP(argv[idx] + 1, "unregister") == 0) | |
5168 { | |
5169 #ifdef FEAT_OLE | |
5170 UnregisterMe(!silent); | |
5171 mch_exit(0); | |
5172 #else | |
5173 if (!silent) | |
5174 ole_error("unregister"); | |
5175 mch_exit(2); | |
5176 #endif | |
5177 } | |
5178 | |
5179 /* Ignore an -embedding argument. It is only relevant if the | |
5180 * application wants to treat the case when it is started manually | |
5181 * differently from the case where it is started via automation (and | |
5182 * we don't). | |
5183 */ | |
5184 if (STRICMP(argv[idx] + 1, "embedding") == 0) | |
5185 { | |
5186 #ifdef FEAT_OLE | |
5187 *argc = 1; | |
5188 #else | |
5189 ole_error("embedding"); | |
5190 mch_exit(2); | |
5191 #endif | |
5192 } | |
5193 } | |
5194 | |
5195 #ifdef FEAT_OLE | |
5196 { | |
5197 int bDoRestart = FALSE; | |
5198 | |
5199 InitOLE(&bDoRestart); | |
5200 /* automatically exit after registering */ | |
5201 if (bDoRestart) | |
5202 mch_exit(0); | |
5203 } | |
5204 #endif | |
5205 | |
5206 #ifdef FEAT_NETBEANS_INTG | |
5207 { | |
4352 | 5208 /* stolen from gui_x11.c */ |
7 | 5209 int arg; |
5210 | |
5211 for (arg = 1; arg < *argc; arg++) | |
5212 if (strncmp("-nb", argv[arg], 3) == 0) | |
5213 { | |
5214 netbeansArg = argv[arg]; | |
5215 mch_memmove(&argv[arg], &argv[arg + 1], | |
5216 (--*argc - arg) * sizeof(char *)); | |
5217 argv[*argc] = NULL; | |
5218 break; /* enough? */ | |
5219 } | |
5220 } | |
5221 #endif | |
5222 } | |
5223 | |
5224 /* | |
5225 * Initialise the GUI. Create all the windows, set up all the call-backs | |
5226 * etc. | |
5227 */ | |
5228 int | |
5229 gui_mch_init(void) | |
5230 { | |
5231 const char szVimWndClass[] = VIM_CLASS; | |
5232 const char szTextAreaClass[] = "VimTextArea"; | |
5233 WNDCLASS wndclass; | |
5234 #ifdef FEAT_MBYTE | |
5235 const WCHAR szVimWndClassW[] = VIM_CLASSW; | |
2078
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5236 const WCHAR szTextAreaClassW[] = L"VimTextArea"; |
7 | 5237 WNDCLASSW wndclassw; |
5238 #endif | |
5239 #ifdef GLOBAL_IME | |
5240 ATOM atom; | |
5241 #endif | |
5242 | |
5243 /* Return here if the window was already opened (happens when | |
5244 * gui_mch_dialog() is called early). */ | |
5245 if (s_hwnd != NULL) | |
153 | 5246 goto theend; |
7 | 5247 |
5248 /* | |
5249 * Load the tearoff bitmap | |
5250 */ | |
5251 #ifdef FEAT_TEAROFF | |
5252 s_htearbitmap = LoadBitmap(s_hinst, "IDB_TEAROFF"); | |
5253 #endif | |
5254 | |
5255 gui.scrollbar_width = GetSystemMetrics(SM_CXVSCROLL); | |
5256 gui.scrollbar_height = GetSystemMetrics(SM_CYHSCROLL); | |
5257 #ifdef FEAT_MENU | |
5258 gui.menu_height = 0; /* Windows takes care of this */ | |
5259 #endif | |
5260 gui.border_width = 0; | |
5261 | |
5262 s_brush = CreateSolidBrush(GetSysColor(COLOR_BTNFACE)); | |
5263 | |
5264 #ifdef FEAT_MBYTE | |
5265 /* First try using the wide version, so that we can use any title. | |
5266 * Otherwise only characters in the active codepage will work. */ | |
5267 if (GetClassInfoW(s_hinst, szVimWndClassW, &wndclassw) == 0) | |
5268 { | |
819 | 5269 wndclassw.style = CS_DBLCLKS; |
7 | 5270 wndclassw.lpfnWndProc = _WndProc; |
5271 wndclassw.cbClsExtra = 0; | |
5272 wndclassw.cbWndExtra = 0; | |
5273 wndclassw.hInstance = s_hinst; | |
5274 wndclassw.hIcon = LoadIcon(wndclassw.hInstance, "IDR_VIM"); | |
5275 wndclassw.hCursor = LoadCursor(NULL, IDC_ARROW); | |
5276 wndclassw.hbrBackground = s_brush; | |
5277 wndclassw.lpszMenuName = NULL; | |
5278 wndclassw.lpszClassName = szVimWndClassW; | |
5279 | |
5280 if (( | |
5281 #ifdef GLOBAL_IME | |
5282 atom = | |
5283 #endif | |
5284 RegisterClassW(&wndclassw)) == 0) | |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5285 return FAIL; |
7 | 5286 else |
5287 wide_WindowProc = TRUE; | |
5288 } | |
5289 | |
5290 if (!wide_WindowProc) | |
5291 #endif | |
5292 | |
5293 if (GetClassInfo(s_hinst, szVimWndClass, &wndclass) == 0) | |
5294 { | |
819 | 5295 wndclass.style = CS_DBLCLKS; |
7 | 5296 wndclass.lpfnWndProc = _WndProc; |
5297 wndclass.cbClsExtra = 0; | |
5298 wndclass.cbWndExtra = 0; | |
5299 wndclass.hInstance = s_hinst; | |
5300 wndclass.hIcon = LoadIcon(wndclass.hInstance, "IDR_VIM"); | |
5301 wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); | |
5302 wndclass.hbrBackground = s_brush; | |
5303 wndclass.lpszMenuName = NULL; | |
5304 wndclass.lpszClassName = szVimWndClass; | |
5305 | |
5306 if (( | |
5307 #ifdef GLOBAL_IME | |
5308 atom = | |
5309 #endif | |
5310 RegisterClass(&wndclass)) == 0) | |
5311 return FAIL; | |
5312 } | |
5313 | |
5314 if (vim_parent_hwnd != NULL) | |
5315 { | |
5316 #ifdef HAVE_TRY_EXCEPT | |
5317 __try | |
5318 { | |
5319 #endif | |
5320 /* Open inside the specified parent window. | |
5321 * TODO: last argument should point to a CLIENTCREATESTRUCT | |
5322 * structure. */ | |
5323 s_hwnd = CreateWindowEx( | |
5324 WS_EX_MDICHILD, | |
5325 szVimWndClass, "Vim MSWindows GUI", | |
3006 | 5326 WS_OVERLAPPEDWINDOW | WS_CHILD |
5327 | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | 0xC000, | |
7 | 5328 gui_win_x == -1 ? CW_USEDEFAULT : gui_win_x, |
5329 gui_win_y == -1 ? CW_USEDEFAULT : gui_win_y, | |
5330 100, /* Any value will do */ | |
5331 100, /* Any value will do */ | |
5332 vim_parent_hwnd, NULL, | |
5333 s_hinst, NULL); | |
5334 #ifdef HAVE_TRY_EXCEPT | |
5335 } | |
5336 __except(EXCEPTION_EXECUTE_HANDLER) | |
5337 { | |
5338 /* NOP */ | |
5339 } | |
5340 #endif | |
5341 if (s_hwnd == NULL) | |
5342 { | |
5343 EMSG(_("E672: Unable to open window inside MDI application")); | |
5344 mch_exit(2); | |
5345 } | |
5346 } | |
5347 else | |
1376 | 5348 { |
5349 /* If the provided windowid is not valid reset it to zero, so that it | |
5350 * is ignored and we open our own window. */ | |
5351 if (IsWindow((HWND)win_socket_id) <= 0) | |
5352 win_socket_id = 0; | |
5353 | |
5354 /* Create a window. If win_socket_id is not zero without border and | |
5355 * titlebar, it will be reparented below. */ | |
7 | 5356 s_hwnd = CreateWindow( |
1376 | 5357 szVimWndClass, "Vim MSWindows GUI", |
3006 | 5358 (win_socket_id == 0 ? WS_OVERLAPPEDWINDOW : WS_POPUP) |
5359 | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, | |
1376 | 5360 gui_win_x == -1 ? CW_USEDEFAULT : gui_win_x, |
5361 gui_win_y == -1 ? CW_USEDEFAULT : gui_win_y, | |
5362 100, /* Any value will do */ | |
5363 100, /* Any value will do */ | |
5364 NULL, NULL, | |
5365 s_hinst, NULL); | |
5366 if (s_hwnd != NULL && win_socket_id != 0) | |
5367 { | |
5368 SetParent(s_hwnd, (HWND)win_socket_id); | |
5369 ShowWindow(s_hwnd, SW_SHOWMAXIMIZED); | |
5370 } | |
5371 } | |
7 | 5372 |
5373 if (s_hwnd == NULL) | |
5374 return FAIL; | |
5375 | |
5376 #ifdef GLOBAL_IME | |
5377 global_ime_init(atom, s_hwnd); | |
5378 #endif | |
5379 #if defined(FEAT_MBYTE_IME) && defined(DYNAMIC_IME) | |
5380 dyn_imm_load(); | |
5381 #endif | |
5382 | |
5383 /* Create the text area window */ | |
2078
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5384 #ifdef FEAT_MBYTE |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5385 if (wide_WindowProc) |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5386 { |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5387 if (GetClassInfoW(s_hinst, szTextAreaClassW, &wndclassw) == 0) |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5388 { |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5389 wndclassw.style = CS_OWNDC; |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5390 wndclassw.lpfnWndProc = _TextAreaWndProc; |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5391 wndclassw.cbClsExtra = 0; |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5392 wndclassw.cbWndExtra = 0; |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5393 wndclassw.hInstance = s_hinst; |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5394 wndclassw.hIcon = NULL; |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5395 wndclassw.hCursor = LoadCursor(NULL, IDC_ARROW); |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5396 wndclassw.hbrBackground = NULL; |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5397 wndclassw.lpszMenuName = NULL; |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5398 wndclassw.lpszClassName = szTextAreaClassW; |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5399 |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5400 if (RegisterClassW(&wndclassw) == 0) |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5401 return FAIL; |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5402 } |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5403 } |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5404 else |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5405 #endif |
7 | 5406 if (GetClassInfo(s_hinst, szTextAreaClass, &wndclass) == 0) |
5407 { | |
5408 wndclass.style = CS_OWNDC; | |
5409 wndclass.lpfnWndProc = _TextAreaWndProc; | |
5410 wndclass.cbClsExtra = 0; | |
5411 wndclass.cbWndExtra = 0; | |
5412 wndclass.hInstance = s_hinst; | |
5413 wndclass.hIcon = NULL; | |
5414 wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); | |
5415 wndclass.hbrBackground = NULL; | |
5416 wndclass.lpszMenuName = NULL; | |
5417 wndclass.lpszClassName = szTextAreaClass; | |
5418 | |
5419 if (RegisterClass(&wndclass) == 0) | |
5420 return FAIL; | |
5421 } | |
5422 s_textArea = CreateWindowEx( | |
7243
861a44fc5183
commit https://github.com/vim/vim/commit/97b0b0ec764d3a247ef600d809b965d5ab37155d
Christian Brabandt <cb@256bit.org>
parents:
7060
diff
changeset
|
5423 0, |
7 | 5424 szTextAreaClass, "Vim text area", |
5425 WS_CHILD | WS_VISIBLE, 0, 0, | |
5426 100, /* Any value will do for now */ | |
5427 100, /* Any value will do for now */ | |
5428 s_hwnd, NULL, | |
5429 s_hinst, NULL); | |
5430 | |
5431 if (s_textArea == NULL) | |
5432 return FAIL; | |
5433 | |
8100
ae50910ce279
commit https://github.com/vim/vim/commit/203219048fa007b5042d9b893fd647aef44722a0
Christian Brabandt <cb@256bit.org>
parents:
8090
diff
changeset
|
5434 #ifdef FEAT_LIBCALL |
6249 | 5435 /* Try loading an icon from $RUNTIMEPATH/bitmaps/vim.ico. */ |
5436 { | |
5437 HANDLE hIcon = NULL; | |
5438 | |
5439 if (mch_icon_load(&hIcon) == OK && hIcon != NULL) | |
6260 | 5440 SendMessage(s_hwnd, WM_SETICON, ICON_SMALL, (LPARAM)hIcon); |
6249 | 5441 } |
8100
ae50910ce279
commit https://github.com/vim/vim/commit/203219048fa007b5042d9b893fd647aef44722a0
Christian Brabandt <cb@256bit.org>
parents:
8090
diff
changeset
|
5442 #endif |
6249 | 5443 |
7 | 5444 #ifdef FEAT_MENU |
5445 s_menuBar = CreateMenu(); | |
5446 #endif | |
5447 s_hdc = GetDC(s_textArea); | |
5448 | |
5449 #ifdef FEAT_WINDOWS | |
5450 DragAcceptFiles(s_hwnd, TRUE); | |
5451 #endif | |
5452 | |
5453 /* Do we need to bother with this? */ | |
5454 /* m_fMouseAvail = GetSystemMetrics(SM_MOUSEPRESENT); */ | |
5455 | |
5456 /* Get background/foreground colors from the system */ | |
5457 gui_mch_def_colors(); | |
5458 | |
5459 /* Get the colors from the "Normal" group (set in syntax.c or in a vimrc | |
5460 * file) */ | |
5461 set_normal_colors(); | |
5462 | |
5463 /* | |
5464 * Check that none of the colors are the same as the background color. | |
5465 * Then store the current values as the defaults. | |
5466 */ | |
5467 gui_check_colors(); | |
5468 gui.def_norm_pixel = gui.norm_pixel; | |
5469 gui.def_back_pixel = gui.back_pixel; | |
5470 | |
5471 /* Get the colors for the highlight groups (gui_check_colors() might have | |
5472 * changed them) */ | |
5473 highlight_gui_started(); | |
5474 | |
5475 /* | |
7243
861a44fc5183
commit https://github.com/vim/vim/commit/97b0b0ec764d3a247ef600d809b965d5ab37155d
Christian Brabandt <cb@256bit.org>
parents:
7060
diff
changeset
|
5476 * Start out by adding the configured border width into the border offset. |
7 | 5477 */ |
7243
861a44fc5183
commit https://github.com/vim/vim/commit/97b0b0ec764d3a247ef600d809b965d5ab37155d
Christian Brabandt <cb@256bit.org>
parents:
7060
diff
changeset
|
5478 gui.border_offset = gui.border_width; |
7 | 5479 |
5480 /* | |
5481 * Set up for Intellimouse processing | |
5482 */ | |
5483 init_mouse_wheel(); | |
5484 | |
5485 /* | |
5486 * compute a couple of metrics used for the dialogs | |
5487 */ | |
5488 get_dialog_font_metrics(); | |
5489 #ifdef FEAT_TOOLBAR | |
5490 /* | |
5491 * Create the toolbar | |
5492 */ | |
5493 initialise_toolbar(); | |
5494 #endif | |
810 | 5495 #ifdef FEAT_GUI_TABLINE |
5496 /* | |
5497 * Create the tabline | |
5498 */ | |
5499 initialise_tabline(); | |
5500 #endif | |
7 | 5501 #ifdef MSWIN_FIND_REPLACE |
5502 /* | |
5503 * Initialise the dialog box stuff | |
5504 */ | |
5505 s_findrep_msg = RegisterWindowMessage(FINDMSGSTRING); | |
5506 | |
5507 /* Initialise the struct */ | |
5508 s_findrep_struct.lStructSize = sizeof(s_findrep_struct); | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
5509 s_findrep_struct.lpstrFindWhat = (LPSTR)alloc(MSWIN_FR_BUFSIZE); |
7 | 5510 s_findrep_struct.lpstrFindWhat[0] = NUL; |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
5511 s_findrep_struct.lpstrReplaceWith = (LPSTR)alloc(MSWIN_FR_BUFSIZE); |
7 | 5512 s_findrep_struct.lpstrReplaceWith[0] = NUL; |
5513 s_findrep_struct.wFindWhatLen = MSWIN_FR_BUFSIZE; | |
5514 s_findrep_struct.wReplaceWithLen = MSWIN_FR_BUFSIZE; | |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5515 # ifdef FEAT_MBYTE |
1795 | 5516 s_findrep_struct_w.lStructSize = sizeof(s_findrep_struct_w); |
5517 s_findrep_struct_w.lpstrFindWhat = | |
5518 (LPWSTR)alloc(MSWIN_FR_BUFSIZE * sizeof(WCHAR)); | |
5519 s_findrep_struct_w.lpstrFindWhat[0] = NUL; | |
5520 s_findrep_struct_w.lpstrReplaceWith = | |
5521 (LPWSTR)alloc(MSWIN_FR_BUFSIZE * sizeof(WCHAR)); | |
5522 s_findrep_struct_w.lpstrReplaceWith[0] = NUL; | |
5523 s_findrep_struct_w.wFindWhatLen = MSWIN_FR_BUFSIZE; | |
5524 s_findrep_struct_w.wReplaceWithLen = MSWIN_FR_BUFSIZE; | |
5525 # endif | |
7 | 5526 #endif |
5527 | |
2616 | 5528 #ifdef FEAT_EVAL |
7560
fb84355cd972
commit https://github.com/vim/vim/commit/f32c5cd6e0e6aa6d4aeacb6bf52e3d3ba21e5201
Christian Brabandt <cb@256bit.org>
parents:
7243
diff
changeset
|
5529 # if !defined(_MSC_VER) || (_MSC_VER < 1400) |
fb84355cd972
commit https://github.com/vim/vim/commit/f32c5cd6e0e6aa6d4aeacb6bf52e3d3ba21e5201
Christian Brabandt <cb@256bit.org>
parents:
7243
diff
changeset
|
5530 /* Define HandleToLong for old MS and non-MS compilers if not defined. */ |
fb84355cd972
commit https://github.com/vim/vim/commit/f32c5cd6e0e6aa6d4aeacb6bf52e3d3ba21e5201
Christian Brabandt <cb@256bit.org>
parents:
7243
diff
changeset
|
5531 # ifndef HandleToLong |
8102
441298d72f3c
commit https://github.com/vim/vim/commit/a87e2c277eabf0134925c340e9dc4fe9446f3636
Christian Brabandt <cb@256bit.org>
parents:
8100
diff
changeset
|
5532 # define HandleToLong(h) ((long)(intptr_t)(h)) |
7560
fb84355cd972
commit https://github.com/vim/vim/commit/f32c5cd6e0e6aa6d4aeacb6bf52e3d3ba21e5201
Christian Brabandt <cb@256bit.org>
parents:
7243
diff
changeset
|
5533 # endif |
2943 | 5534 # endif |
2616 | 5535 /* set the v:windowid variable */ |
2865 | 5536 set_vim_var_nr(VV_WINDOWID, HandleToLong(s_hwnd)); |
2616 | 5537 #endif |
5538 | |
6110 | 5539 #ifdef FEAT_RENDER_OPTIONS |
5540 if (p_rop) | |
5541 (void)gui_mch_set_rendering_options(p_rop); | |
5542 #endif | |
5543 | |
153 | 5544 theend: |
5545 /* Display any pending error messages */ | |
5546 display_errors(); | |
5547 | |
7 | 5548 return OK; |
5549 } | |
5550 | |
5551 /* | |
5552 * Get the size of the screen, taking position on multiple monitors into | |
5553 * account (if supported). | |
5554 */ | |
5555 static void | |
5556 get_work_area(RECT *spi_rect) | |
5557 { | |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5558 HMONITOR mon; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5559 MONITORINFO moninfo; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5560 |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5561 /* work out which monitor the window is on, and get *it's* work area */ |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5562 mon = MonitorFromWindow(s_hwnd, 1 /*MONITOR_DEFAULTTOPRIMARY*/); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5563 if (mon != NULL) |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5564 { |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5565 moninfo.cbSize = sizeof(MONITORINFO); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5566 if (GetMonitorInfo(mon, &moninfo)) |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5567 { |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5568 *spi_rect = moninfo.rcWork; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5569 return; |
7 | 5570 } |
5571 } | |
5572 /* this is the old method... */ | |
5573 SystemParametersInfo(SPI_GETWORKAREA, 0, spi_rect, 0); | |
5574 } | |
5575 | |
5576 /* | |
5577 * Set the size of the window to the given width and height in pixels. | |
5578 */ | |
323 | 5579 /*ARGSUSED*/ |
7 | 5580 void |
5581 gui_mch_set_shellsize(int width, int height, | |
812 | 5582 int min_width, int min_height, int base_width, int base_height, |
5583 int direction) | |
7 | 5584 { |
5585 RECT workarea_rect; | |
5586 int win_width, win_height; | |
5587 WINDOWPLACEMENT wndpl; | |
5588 | |
819 | 5589 /* Try to keep window completely on screen. */ |
5590 /* Get position of the screen work area. This is the part that is not | |
5591 * used by the taskbar or appbars. */ | |
7 | 5592 get_work_area(&workarea_rect); |
5593 | |
4352 | 5594 /* Get current position of our window. Note that the .left and .top are |
819 | 5595 * relative to the work area. */ |
7 | 5596 wndpl.length = sizeof(WINDOWPLACEMENT); |
5597 GetWindowPlacement(s_hwnd, &wndpl); | |
5598 | |
5599 /* Resizing a maximized window looks very strange, unzoom it first. | |
5600 * But don't do it when still starting up, it may have been requested in | |
5601 * the shortcut. */ | |
5602 if (wndpl.showCmd == SW_SHOWMAXIMIZED && starting == 0) | |
5603 { | |
5604 ShowWindow(s_hwnd, SW_SHOWNORMAL); | |
5605 /* Need to get the settings of the normal window. */ | |
5606 GetWindowPlacement(s_hwnd, &wndpl); | |
5607 } | |
5608 | |
5609 /* compute the size of the outside of the window */ | |
5225
8f983df0299f
updated for version 7.4a.038
Bram Moolenaar <bram@vim.org>
parents:
5223
diff
changeset
|
5610 win_width = width + (GetSystemMetrics(SM_CXFRAME) + |
6110 | 5611 GetSystemMetrics(SM_CXPADDEDBORDER)) * 2; |
5225
8f983df0299f
updated for version 7.4a.038
Bram Moolenaar <bram@vim.org>
parents:
5223
diff
changeset
|
5612 win_height = height + (GetSystemMetrics(SM_CYFRAME) + |
6110 | 5613 GetSystemMetrics(SM_CXPADDEDBORDER)) * 2 |
7 | 5614 + GetSystemMetrics(SM_CYCAPTION) |
5615 #ifdef FEAT_MENU | |
5616 + gui_mswin_get_menu_height(FALSE) | |
5617 #endif | |
5618 ; | |
5619 | |
3248 | 5620 /* The following should take care of keeping Vim on the same monitor, no |
5621 * matter if the secondary monitor is left or right of the primary | |
5622 * monitor. */ | |
5623 wndpl.rcNormalPosition.right = wndpl.rcNormalPosition.left + win_width; | |
5624 wndpl.rcNormalPosition.bottom = wndpl.rcNormalPosition.top + win_height; | |
5625 | |
5626 /* If the window is going off the screen, move it on to the screen. */ | |
819 | 5627 if ((direction & RESIZE_HOR) |
3248 | 5628 && wndpl.rcNormalPosition.right > workarea_rect.right) |
5629 OffsetRect(&wndpl.rcNormalPosition, | |
5630 workarea_rect.right - wndpl.rcNormalPosition.right, 0); | |
5631 | |
5632 if ((direction & RESIZE_HOR) | |
5633 && wndpl.rcNormalPosition.left < workarea_rect.left) | |
5634 OffsetRect(&wndpl.rcNormalPosition, | |
5635 workarea_rect.left - wndpl.rcNormalPosition.left, 0); | |
7 | 5636 |
812 | 5637 if ((direction & RESIZE_VERT) |
3248 | 5638 && wndpl.rcNormalPosition.bottom > workarea_rect.bottom) |
5639 OffsetRect(&wndpl.rcNormalPosition, | |
5640 0, workarea_rect.bottom - wndpl.rcNormalPosition.bottom); | |
5641 | |
5642 if ((direction & RESIZE_VERT) | |
5643 && wndpl.rcNormalPosition.top < workarea_rect.top) | |
5644 OffsetRect(&wndpl.rcNormalPosition, | |
5645 0, workarea_rect.top - wndpl.rcNormalPosition.top); | |
7 | 5646 |
5647 /* set window position - we should use SetWindowPlacement rather than | |
5648 * SetWindowPos as the MSDN docs say the coord systems returned by | |
5649 * these two are not compatible. */ | |
5650 SetWindowPlacement(s_hwnd, &wndpl); | |
5651 | |
5652 SetActiveWindow(s_hwnd); | |
5653 SetFocus(s_hwnd); | |
5654 | |
5655 #ifdef FEAT_MENU | |
5656 /* Menu may wrap differently now */ | |
5657 gui_mswin_get_menu_height(!gui.starting); | |
5658 #endif | |
5659 } | |
5660 | |
5661 | |
5662 void | |
5663 gui_mch_set_scrollbar_thumb( | |
5664 scrollbar_T *sb, | |
5665 long val, | |
5666 long size, | |
5667 long max) | |
5668 { | |
5669 SCROLLINFO info; | |
5670 | |
5671 sb->scroll_shift = 0; | |
5672 while (max > 32767) | |
5673 { | |
5674 max = (max + 1) >> 1; | |
5675 val >>= 1; | |
5676 size >>= 1; | |
5677 ++sb->scroll_shift; | |
5678 } | |
5679 | |
5680 if (sb->scroll_shift > 0) | |
5681 ++size; | |
5682 | |
5683 info.cbSize = sizeof(info); | |
5684 info.fMask = SIF_POS | SIF_RANGE | SIF_PAGE; | |
5685 info.nPos = val; | |
5686 info.nMin = 0; | |
5687 info.nMax = max; | |
5688 info.nPage = size; | |
5689 SetScrollInfo(sb->id, SB_CTL, &info, TRUE); | |
5690 } | |
5691 | |
5692 | |
5693 /* | |
5694 * Set the current text font. | |
5695 */ | |
5696 void | |
5697 gui_mch_set_font(GuiFont font) | |
5698 { | |
5699 gui.currFont = font; | |
5700 } | |
5701 | |
5702 | |
5703 /* | |
5704 * Set the current text foreground color. | |
5705 */ | |
5706 void | |
5707 gui_mch_set_fg_color(guicolor_T color) | |
5708 { | |
5709 gui.currFgColor = color; | |
5710 } | |
5711 | |
5712 /* | |
5713 * Set the current text background color. | |
5714 */ | |
5715 void | |
5716 gui_mch_set_bg_color(guicolor_T color) | |
5717 { | |
5718 gui.currBgColor = color; | |
5719 } | |
5720 | |
205 | 5721 /* |
5722 * Set the current text special color. | |
5723 */ | |
5724 void | |
5725 gui_mch_set_sp_color(guicolor_T color) | |
5726 { | |
5727 gui.currSpColor = color; | |
5728 } | |
5729 | |
7 | 5730 #if defined(FEAT_MBYTE) && defined(FEAT_MBYTE_IME) |
5731 /* | |
5732 * Multi-byte handling, originally by Sung-Hoon Baek. | |
5733 * First static functions (no prototypes generated). | |
5734 */ | |
5735 #ifdef _MSC_VER | |
5736 # include <ime.h> /* Apparently not needed for Cygwin, MingW or Borland. */ | |
5737 #endif | |
5738 #include <imm.h> | |
5739 | |
5740 /* | |
5741 * handle WM_IME_NOTIFY message | |
5742 */ | |
344 | 5743 /*ARGSUSED*/ |
7 | 5744 static LRESULT |
5745 _OnImeNotify(HWND hWnd, DWORD dwCommand, DWORD dwData) | |
5746 { | |
5747 LRESULT lResult = 0; | |
5748 HIMC hImc; | |
5749 | |
5750 if (!pImmGetContext || (hImc = pImmGetContext(hWnd)) == (HIMC)0) | |
5751 return lResult; | |
5752 switch (dwCommand) | |
5753 { | |
5754 case IMN_SETOPENSTATUS: | |
5755 if (pImmGetOpenStatus(hImc)) | |
5756 { | |
5757 pImmSetCompositionFont(hImc, &norm_logfont); | |
5758 im_set_position(gui.row, gui.col); | |
5759 | |
5760 /* Disable langmap */ | |
5761 State &= ~LANGMAP; | |
5762 if (State & INSERT) | |
5763 { | |
5764 #if defined(FEAT_WINDOWS) && defined(FEAT_KEYMAP) | |
5765 /* Unshown 'keymap' in status lines */ | |
5766 if (curbuf->b_p_iminsert == B_IMODE_LMAP) | |
5767 { | |
5768 /* Save cursor position */ | |
5769 int old_row = gui.row; | |
5770 int old_col = gui.col; | |
5771 | |
5772 // This must be called here before | |
5773 // status_redraw_curbuf(), otherwise the mode | |
5774 // message may appear in the wrong position. | |
5775 showmode(); | |
5776 status_redraw_curbuf(); | |
5777 update_screen(0); | |
5778 /* Restore cursor position */ | |
5779 gui.row = old_row; | |
5780 gui.col = old_col; | |
5781 } | |
5782 #endif | |
5783 } | |
5784 } | |
5785 gui_update_cursor(TRUE, FALSE); | |
5786 lResult = 0; | |
5787 break; | |
5788 } | |
5789 pImmReleaseContext(hWnd, hImc); | |
5790 return lResult; | |
5791 } | |
5792 | |
344 | 5793 /*ARGSUSED*/ |
7 | 5794 static LRESULT |
5795 _OnImeComposition(HWND hwnd, WPARAM dbcs, LPARAM param) | |
5796 { | |
5797 char_u *ret; | |
5798 int len; | |
5799 | |
5800 if ((param & GCS_RESULTSTR) == 0) /* Composition unfinished. */ | |
5801 return 0; | |
5802 | |
5803 ret = GetResultStr(hwnd, GCS_RESULTSTR, &len); | |
5804 if (ret != NULL) | |
5805 { | |
5806 add_to_input_buf_csi(ret, len); | |
5807 vim_free(ret); | |
5808 return 1; | |
5809 } | |
5810 return 0; | |
5811 } | |
5812 | |
5813 /* | |
5814 * get the current composition string, in UCS-2; *lenp is the number of | |
5815 * *lenp is the number of Unicode characters. | |
5816 */ | |
5817 static short_u * | |
5818 GetCompositionString_inUCS2(HIMC hIMC, DWORD GCS, int *lenp) | |
5819 { | |
5820 LONG ret; | |
5821 LPWSTR wbuf = NULL; | |
5822 char_u *buf; | |
5823 | |
5824 if (!pImmGetContext) | |
5825 return NULL; /* no imm32.dll */ | |
5826 | |
5827 /* Try Unicode; this'll always work on NT regardless of codepage. */ | |
5828 ret = pImmGetCompositionStringW(hIMC, GCS, NULL, 0); | |
5829 if (ret == 0) | |
5830 return NULL; /* empty */ | |
5831 | |
5832 if (ret > 0) | |
5833 { | |
5834 /* Allocate the requested buffer plus space for the NUL character. */ | |
5835 wbuf = (LPWSTR)alloc(ret + sizeof(WCHAR)); | |
5836 if (wbuf != NULL) | |
5837 { | |
5838 pImmGetCompositionStringW(hIMC, GCS, wbuf, ret); | |
5839 *lenp = ret / sizeof(WCHAR); | |
5840 } | |
5841 return (short_u *)wbuf; | |
5842 } | |
5843 | |
5844 /* ret < 0; we got an error, so try the ANSI version. This'll work | |
5845 * on 9x/ME, but only if the codepage happens to be set to whatever | |
5846 * we're inputting. */ | |
5847 ret = pImmGetCompositionStringA(hIMC, GCS, NULL, 0); | |
5848 if (ret <= 0) | |
5849 return NULL; /* empty or error */ | |
5850 | |
5851 buf = alloc(ret); | |
5852 if (buf == NULL) | |
5853 return NULL; | |
5854 pImmGetCompositionStringA(hIMC, GCS, buf, ret); | |
5855 | |
5856 /* convert from codepage to UCS-2 */ | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
5857 MultiByteToWideChar_alloc(GetACP(), 0, (LPCSTR)buf, ret, &wbuf, lenp); |
7 | 5858 vim_free(buf); |
5859 | |
5860 return (short_u *)wbuf; | |
5861 } | |
5862 | |
5863 /* | |
5864 * void GetResultStr() | |
5865 * | |
5866 * This handles WM_IME_COMPOSITION with GCS_RESULTSTR flag on. | |
5867 * get complete composition string | |
5868 */ | |
5869 static char_u * | |
5870 GetResultStr(HWND hwnd, int GCS, int *lenp) | |
5871 { | |
5872 HIMC hIMC; /* Input context handle. */ | |
5873 short_u *buf = NULL; | |
5874 char_u *convbuf = NULL; | |
5875 | |
5876 if (!pImmGetContext || (hIMC = pImmGetContext(hwnd)) == (HIMC)0) | |
5877 return NULL; | |
5878 | |
5879 /* Reads in the composition string. */ | |
5880 buf = GetCompositionString_inUCS2(hIMC, GCS, lenp); | |
5881 if (buf == NULL) | |
5882 return NULL; | |
5883 | |
1752 | 5884 convbuf = utf16_to_enc(buf, lenp); |
7 | 5885 pImmReleaseContext(hwnd, hIMC); |
5886 vim_free(buf); | |
5887 return convbuf; | |
5888 } | |
5889 #endif | |
5890 | |
5891 /* For global functions we need prototypes. */ | |
5892 #if (defined(FEAT_MBYTE) && defined(FEAT_MBYTE_IME)) || defined(PROTO) | |
5893 | |
5894 /* | |
5895 * set font to IM. | |
5896 */ | |
5897 void | |
5898 im_set_font(LOGFONT *lf) | |
5899 { | |
5900 HIMC hImc; | |
5901 | |
5902 if (pImmGetContext && (hImc = pImmGetContext(s_hwnd)) != (HIMC)0) | |
5903 { | |
5904 pImmSetCompositionFont(hImc, lf); | |
5905 pImmReleaseContext(s_hwnd, hImc); | |
5906 } | |
5907 } | |
5908 | |
5909 /* | |
5910 * Notify cursor position to IM. | |
5911 */ | |
5912 void | |
5913 im_set_position(int row, int col) | |
5914 { | |
5915 HIMC hImc; | |
5916 | |
5917 if (pImmGetContext && (hImc = pImmGetContext(s_hwnd)) != (HIMC)0) | |
5918 { | |
5919 COMPOSITIONFORM cfs; | |
5920 | |
5921 cfs.dwStyle = CFS_POINT; | |
5922 cfs.ptCurrentPos.x = FILL_X(col); | |
5923 cfs.ptCurrentPos.y = FILL_Y(row); | |
5924 MapWindowPoints(s_textArea, s_hwnd, &cfs.ptCurrentPos, 1); | |
5925 pImmSetCompositionWindow(hImc, &cfs); | |
5926 | |
5927 pImmReleaseContext(s_hwnd, hImc); | |
5928 } | |
5929 } | |
5930 | |
5931 /* | |
5932 * Set IM status on ("active" is TRUE) or off ("active" is FALSE). | |
5933 */ | |
5934 void | |
5935 im_set_active(int active) | |
5936 { | |
5937 HIMC hImc; | |
5938 static HIMC hImcOld = (HIMC)0; | |
5939 | |
5940 if (pImmGetContext) /* if NULL imm32.dll wasn't loaded (yet) */ | |
5941 { | |
5942 if (p_imdisable) | |
5943 { | |
5944 if (hImcOld == (HIMC)0) | |
5945 { | |
5946 hImcOld = pImmGetContext(s_hwnd); | |
5947 if (hImcOld) | |
5948 pImmAssociateContext(s_hwnd, (HIMC)0); | |
5949 } | |
5950 active = FALSE; | |
5951 } | |
5952 else if (hImcOld != (HIMC)0) | |
5953 { | |
5954 pImmAssociateContext(s_hwnd, hImcOld); | |
5955 hImcOld = (HIMC)0; | |
5956 } | |
5957 | |
5958 hImc = pImmGetContext(s_hwnd); | |
5959 if (hImc) | |
5960 { | |
777 | 5961 /* |
5962 * for Korean ime | |
5963 */ | |
5964 HKL hKL = GetKeyboardLayout(0); | |
5965 | |
5966 if (LOWORD(hKL) == MAKELANGID(LANG_KOREAN, SUBLANG_KOREAN)) | |
5967 { | |
5968 static DWORD dwConversionSaved = 0, dwSentenceSaved = 0; | |
5969 static BOOL bSaved = FALSE; | |
5970 | |
5971 if (active) | |
5972 { | |
5973 /* if we have a saved conversion status, restore it */ | |
5974 if (bSaved) | |
5975 pImmSetConversionStatus(hImc, dwConversionSaved, | |
5976 dwSentenceSaved); | |
5977 bSaved = FALSE; | |
5978 } | |
5979 else | |
5980 { | |
5981 /* save conversion status and disable korean */ | |
5982 if (pImmGetConversionStatus(hImc, &dwConversionSaved, | |
5983 &dwSentenceSaved)) | |
5984 { | |
5985 bSaved = TRUE; | |
5986 pImmSetConversionStatus(hImc, | |
5987 dwConversionSaved & ~(IME_CMODE_NATIVE | |
5988 | IME_CMODE_FULLSHAPE), | |
5989 dwSentenceSaved); | |
5990 } | |
5991 } | |
5992 } | |
5993 | |
7 | 5994 pImmSetOpenStatus(hImc, active); |
5995 pImmReleaseContext(s_hwnd, hImc); | |
5996 } | |
5997 } | |
5998 } | |
5999 | |
6000 /* | |
6001 * Get IM status. When IM is on, return not 0. Else return 0. | |
6002 */ | |
6003 int | |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
6004 im_get_status(void) |
7 | 6005 { |
6006 int status = 0; | |
6007 HIMC hImc; | |
6008 | |
6009 if (pImmGetContext && (hImc = pImmGetContext(s_hwnd)) != (HIMC)0) | |
6010 { | |
6011 status = pImmGetOpenStatus(hImc) ? 1 : 0; | |
6012 pImmReleaseContext(s_hwnd, hImc); | |
6013 } | |
6014 return status; | |
6015 } | |
6016 | |
6017 #endif /* FEAT_MBYTE && FEAT_MBYTE_IME */ | |
6018 | |
6019 #if defined(FEAT_MBYTE) && !defined(FEAT_MBYTE_IME) && defined(GLOBAL_IME) | |
6020 /* Win32 with GLOBAL IME */ | |
6021 | |
6022 /* | |
6023 * Notify cursor position to IM. | |
6024 */ | |
6025 void | |
6026 im_set_position(int row, int col) | |
6027 { | |
6028 /* Win32 with GLOBAL IME */ | |
6029 POINT p; | |
6030 | |
6031 p.x = FILL_X(col); | |
6032 p.y = FILL_Y(row); | |
6033 MapWindowPoints(s_textArea, s_hwnd, &p, 1); | |
6034 global_ime_set_position(&p); | |
6035 } | |
6036 | |
6037 /* | |
6038 * Set IM status on ("active" is TRUE) or off ("active" is FALSE). | |
6039 */ | |
6040 void | |
6041 im_set_active(int active) | |
6042 { | |
6043 global_ime_set_status(active); | |
6044 } | |
6045 | |
6046 /* | |
6047 * Get IM status. When IM is on, return not 0. Else return 0. | |
6048 */ | |
6049 int | |
7856
226ed297307f
commit https://github.com/vim/vim/commit/d14e00ea67afbaa8cb4a7e6b1eb306da6a2d5adb
Christian Brabandt <cb@256bit.org>
parents:
7823
diff
changeset
|
6050 im_get_status(void) |
7 | 6051 { |
6052 return global_ime_get_status(); | |
6053 } | |
6054 #endif | |
6055 | |
26 | 6056 #ifdef FEAT_MBYTE |
6057 /* | |
786 | 6058 * Convert latin9 text "text[len]" to ucs-2 in "unicodebuf". |
26 | 6059 */ |
6060 static void | |
6061 latin9_to_ucs(char_u *text, int len, WCHAR *unicodebuf) | |
6062 { | |
6063 int c; | |
6064 | |
777 | 6065 while (--len >= 0) |
26 | 6066 { |
6067 c = *text++; | |
6068 switch (c) | |
6069 { | |
6070 case 0xa4: c = 0x20ac; break; /* euro */ | |
6071 case 0xa6: c = 0x0160; break; /* S hat */ | |
6072 case 0xa8: c = 0x0161; break; /* S -hat */ | |
6073 case 0xb4: c = 0x017d; break; /* Z hat */ | |
6074 case 0xb8: c = 0x017e; break; /* Z -hat */ | |
6075 case 0xbc: c = 0x0152; break; /* OE */ | |
6076 case 0xbd: c = 0x0153; break; /* oe */ | |
6077 case 0xbe: c = 0x0178; break; /* Y */ | |
6078 } | |
6079 *unicodebuf++ = c; | |
6080 } | |
6081 } | |
6082 #endif | |
7 | 6083 |
6084 #ifdef FEAT_RIGHTLEFT | |
6085 /* | |
6086 * What is this for? In the case where you are using Win98 or Win2K or later, | |
6087 * and you are using a Hebrew font (or Arabic!), Windows does you a favor and | |
6088 * reverses the string sent to the TextOut... family. This sucks, because we | |
6089 * go to a lot of effort to do the right thing, and there doesn't seem to be a | |
6090 * way to tell Windblows not to do this! | |
6091 * | |
6092 * The short of it is that this 'RevOut' only gets called if you are running | |
6093 * one of the new, "improved" MS OSes, and only if you are running in | |
6094 * 'rightleft' mode. It makes display take *slightly* longer, but not | |
6095 * noticeably so. | |
6096 */ | |
6097 static void | |
6098 RevOut( HDC s_hdc, | |
6099 int col, | |
6100 int row, | |
6101 UINT foptions, | |
6102 CONST RECT *pcliprect, | |
6103 LPCTSTR text, | |
6104 UINT len, | |
6105 CONST INT *padding) | |
6106 { | |
6107 int ix; | |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6108 |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6109 for (ix = 0; ix < (int)len; ++ix) |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6110 ExtTextOut(s_hdc, col + TEXT_X(ix), row, foptions, |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6111 pcliprect, text + ix, 1, padding); |
7 | 6112 } |
6113 #endif | |
6114 | |
6115 void | |
6116 gui_mch_draw_string( | |
6117 int row, | |
6118 int col, | |
6119 char_u *text, | |
6120 int len, | |
6121 int flags) | |
6122 { | |
6123 static int *padding = NULL; | |
6124 static int pad_size = 0; | |
6125 int i; | |
6126 const RECT *pcliprect = NULL; | |
6127 UINT foptions = 0; | |
6128 #ifdef FEAT_MBYTE | |
6129 static WCHAR *unicodebuf = NULL; | |
6130 static int *unicodepdy = NULL; | |
236 | 6131 static int unibuflen = 0; |
7 | 6132 int n = 0; |
6133 #endif | |
6134 HPEN hpen, old_pen; | |
6135 int y; | |
6110 | 6136 #ifdef FEAT_DIRECTX |
6137 int font_is_ttf_or_vector = 0; | |
6138 #endif | |
7 | 6139 |
6140 /* | |
6141 * Italic and bold text seems to have an extra row of pixels at the bottom | |
6142 * (below where the bottom of the character should be). If we draw the | |
6143 * characters with a solid background, the top row of pixels in the | |
6144 * character below will be overwritten. We can fix this by filling in the | |
6145 * background ourselves, to the correct character proportions, and then | |
6146 * writing the character in transparent mode. Still have a problem when | |
6147 * the character is "_", which gets written on to the character below. | |
6148 * New fix: set gui.char_ascent to -1. This shifts all characters up one | |
6149 * pixel in their slots, which fixes the problem with the bottom row of | |
6150 * pixels. We still need this code because otherwise the top row of pixels | |
6151 * becomes a problem. - webb. | |
6152 */ | |
6153 static HBRUSH hbr_cache[2] = {NULL, NULL}; | |
6154 static guicolor_T brush_color[2] = {INVALCOLOR, INVALCOLOR}; | |
6155 static int brush_lru = 0; | |
6156 HBRUSH hbr; | |
6157 RECT rc; | |
6158 | |
6159 if (!(flags & DRAW_TRANSP)) | |
6160 { | |
6161 /* | |
6162 * Clear background first. | |
6163 * Note: FillRect() excludes right and bottom of rectangle. | |
6164 */ | |
6165 rc.left = FILL_X(col); | |
6166 rc.top = FILL_Y(row); | |
6167 #ifdef FEAT_MBYTE | |
6168 if (has_mbyte) | |
6169 { | |
6170 /* Compute the length in display cells. */ | |
2338
da6ec32d8d8f
Added strwidth() and strchars() functions.
Bram Moolenaar <bram@vim.org>
parents:
2311
diff
changeset
|
6171 rc.right = FILL_X(col + mb_string2cells(text, len)); |
7 | 6172 } |
6173 else | |
6174 #endif | |
6175 rc.right = FILL_X(col + len); | |
6176 rc.bottom = FILL_Y(row + 1); | |
6177 | |
6178 /* Cache the created brush, that saves a lot of time. We need two: | |
6179 * one for cursor background and one for the normal background. */ | |
6180 if (gui.currBgColor == brush_color[0]) | |
6181 { | |
6182 hbr = hbr_cache[0]; | |
6183 brush_lru = 1; | |
6184 } | |
6185 else if (gui.currBgColor == brush_color[1]) | |
6186 { | |
6187 hbr = hbr_cache[1]; | |
6188 brush_lru = 0; | |
6189 } | |
6190 else | |
6191 { | |
6192 if (hbr_cache[brush_lru] != NULL) | |
6193 DeleteBrush(hbr_cache[brush_lru]); | |
6194 hbr_cache[brush_lru] = CreateSolidBrush(gui.currBgColor); | |
6195 brush_color[brush_lru] = gui.currBgColor; | |
6196 hbr = hbr_cache[brush_lru]; | |
6197 brush_lru = !brush_lru; | |
6198 } | |
6199 FillRect(s_hdc, &rc, hbr); | |
6200 | |
6201 SetBkMode(s_hdc, TRANSPARENT); | |
6202 | |
6203 /* | |
6204 * When drawing block cursor, prevent inverted character spilling | |
6205 * over character cell (can happen with bold/italic) | |
6206 */ | |
6207 if (flags & DRAW_CURSOR) | |
6208 { | |
6209 pcliprect = &rc; | |
6210 foptions = ETO_CLIPPED; | |
6211 } | |
6212 } | |
6213 SetTextColor(s_hdc, gui.currFgColor); | |
6214 SelectFont(s_hdc, gui.currFont); | |
6215 | |
6110 | 6216 #ifdef FEAT_DIRECTX |
6217 if (IS_ENABLE_DIRECTX()) | |
6218 { | |
6219 TEXTMETRIC tm; | |
6220 | |
6221 GetTextMetrics(s_hdc, &tm); | |
6222 if (tm.tmPitchAndFamily & (TMPF_TRUETYPE | TMPF_VECTOR)) | |
6223 { | |
6224 font_is_ttf_or_vector = 1; | |
6225 DWriteContext_SetFont(s_dwc, (HFONT)gui.currFont); | |
6226 } | |
6227 } | |
6228 #endif | |
6229 | |
7 | 6230 if (pad_size != Columns || padding == NULL || padding[0] != gui.char_width) |
6231 { | |
6232 vim_free(padding); | |
6233 pad_size = Columns; | |
6234 | |
537 | 6235 /* Don't give an out-of-memory message here, it would call us |
6236 * recursively. */ | |
6237 padding = (int *)lalloc(pad_size * sizeof(int), FALSE); | |
7 | 6238 if (padding != NULL) |
6239 for (i = 0; i < pad_size; i++) | |
6240 padding[i] = gui.char_width; | |
6241 } | |
6242 | |
6243 /* | |
6244 * We have to provide the padding argument because italic and bold versions | |
6245 * of fixed-width fonts are often one pixel or so wider than their normal | |
6246 * versions. | |
6247 * No check for DRAW_BOLD, Windows will have done it already. | |
6248 */ | |
6249 | |
6250 #ifdef FEAT_MBYTE | |
6251 /* Check if there are any UTF-8 characters. If not, use normal text | |
6252 * output to speed up output. */ | |
6253 if (enc_utf8) | |
6254 for (n = 0; n < len; ++n) | |
6255 if (text[n] >= 0x80) | |
6256 break; | |
6257 | |
6110 | 6258 #if defined(FEAT_DIRECTX) |
6259 /* Quick hack to enable DirectWrite. To use DirectWrite (antialias), it is | |
6260 * required that unicode drawing routine, currently. So this forces it | |
6261 * enabled. */ | |
6262 if (enc_utf8 && IS_ENABLE_DIRECTX()) | |
6263 n = 0; /* Keep n < len, to enter block for unicode. */ | |
6264 #endif | |
6265 | |
7 | 6266 /* Check if the Unicode buffer exists and is big enough. Create it |
236 | 6267 * with the same length as the multi-byte string, the number of wide |
7 | 6268 * characters is always equal or smaller. */ |
26 | 6269 if ((enc_utf8 |
6270 || (enc_codepage > 0 && (int)GetACP() != enc_codepage) | |
6271 || enc_latin9) | |
7 | 6272 && (unicodebuf == NULL || len > unibuflen)) |
6273 { | |
6274 vim_free(unicodebuf); | |
537 | 6275 unicodebuf = (WCHAR *)lalloc(len * sizeof(WCHAR), FALSE); |
7 | 6276 |
6277 vim_free(unicodepdy); | |
537 | 6278 unicodepdy = (int *)lalloc(len * sizeof(int), FALSE); |
7 | 6279 |
6280 unibuflen = len; | |
6281 } | |
6282 | |
6283 if (enc_utf8 && n < len && unicodebuf != NULL) | |
6284 { | |
6285 /* Output UTF-8 characters. Caller has already separated | |
6286 * composing characters. */ | |
777 | 6287 int i; |
6288 int wlen; /* string length in words */ | |
6289 int clen; /* string length in characters */ | |
7 | 6290 int cells; /* cell width of string up to composing char */ |
6291 int cw; /* width of current cell */ | |
714 | 6292 int c; |
777 | 6293 |
782 | 6294 wlen = 0; |
777 | 6295 clen = 0; |
7 | 6296 cells = 0; |
777 | 6297 for (i = 0; i < len; ) |
7 | 6298 { |
714 | 6299 c = utf_ptr2char(text + i); |
6300 if (c >= 0x10000) | |
6301 { | |
6302 /* Turn into UTF-16 encoding. */ | |
777 | 6303 unicodebuf[wlen++] = ((c - 0x10000) >> 10) + 0xD800; |
6304 unicodebuf[wlen++] = ((c - 0x10000) & 0x3ff) + 0xDC00; | |
714 | 6305 } |
6306 else | |
6307 { | |
777 | 6308 unicodebuf[wlen++] = c; |
714 | 6309 } |
6310 cw = utf_char2cells(c); | |
7 | 6311 if (cw > 2) /* don't use 4 for unprintable char */ |
6312 cw = 1; | |
6313 if (unicodepdy != NULL) | |
6314 { | |
6315 /* Use unicodepdy to make characters fit as we expect, even | |
6316 * when the font uses different widths (e.g., bold character | |
6317 * is wider). */ | |
8273
0c3210caefa6
commit https://github.com/vim/vim/commit/d804fdf4c25435284333258856bc265f1ff10b09
Christian Brabandt <cb@256bit.org>
parents:
8222
diff
changeset
|
6318 if (c >= 0x10000) |
0c3210caefa6
commit https://github.com/vim/vim/commit/d804fdf4c25435284333258856bc265f1ff10b09
Christian Brabandt <cb@256bit.org>
parents:
8222
diff
changeset
|
6319 { |
0c3210caefa6
commit https://github.com/vim/vim/commit/d804fdf4c25435284333258856bc265f1ff10b09
Christian Brabandt <cb@256bit.org>
parents:
8222
diff
changeset
|
6320 unicodepdy[wlen - 2] = cw * gui.char_width; |
0c3210caefa6
commit https://github.com/vim/vim/commit/d804fdf4c25435284333258856bc265f1ff10b09
Christian Brabandt <cb@256bit.org>
parents:
8222
diff
changeset
|
6321 unicodepdy[wlen - 1] = 0; |
0c3210caefa6
commit https://github.com/vim/vim/commit/d804fdf4c25435284333258856bc265f1ff10b09
Christian Brabandt <cb@256bit.org>
parents:
8222
diff
changeset
|
6322 } |
0c3210caefa6
commit https://github.com/vim/vim/commit/d804fdf4c25435284333258856bc265f1ff10b09
Christian Brabandt <cb@256bit.org>
parents:
8222
diff
changeset
|
6323 else |
0c3210caefa6
commit https://github.com/vim/vim/commit/d804fdf4c25435284333258856bc265f1ff10b09
Christian Brabandt <cb@256bit.org>
parents:
8222
diff
changeset
|
6324 unicodepdy[wlen - 1] = cw * gui.char_width; |
7 | 6325 } |
6326 cells += cw; | |
474 | 6327 i += utfc_ptr2len_len(text + i, len - i); |
777 | 6328 ++clen; |
7 | 6329 } |
6110 | 6330 #if defined(FEAT_DIRECTX) |
6331 if (IS_ENABLE_DIRECTX() && font_is_ttf_or_vector) | |
6332 { | |
6112 | 6333 /* Add one to "cells" for italics. */ |
6110 | 6334 DWriteContext_DrawText(s_dwc, s_hdc, unicodebuf, wlen, |
6112 | 6335 TEXT_X(col), TEXT_Y(row), FILL_X(cells + 1), FILL_Y(1), |
6110 | 6336 gui.char_width, gui.currFgColor); |
6337 } | |
6338 else | |
6339 #endif | |
6340 ExtTextOutW(s_hdc, TEXT_X(col), TEXT_Y(row), | |
6341 foptions, pcliprect, unicodebuf, wlen, unicodepdy); | |
7 | 6342 len = cells; /* used for underlining */ |
6343 } | |
26 | 6344 else if ((enc_codepage > 0 && (int)GetACP() != enc_codepage) || enc_latin9) |
7 | 6345 { |
6346 /* If we want to display codepage data, and the current CP is not the | |
6347 * ANSI one, we need to go via Unicode. */ | |
6348 if (unicodebuf != NULL) | |
6349 { | |
26 | 6350 if (enc_latin9) |
6351 latin9_to_ucs(text, len, unicodebuf); | |
6352 else | |
6353 len = MultiByteToWideChar(enc_codepage, | |
7 | 6354 MB_PRECOMPOSED, |
6355 (char *)text, len, | |
6356 (LPWSTR)unicodebuf, unibuflen); | |
6357 if (len != 0) | |
179 | 6358 { |
6359 /* Use unicodepdy to make characters fit as we expect, even | |
6360 * when the font uses different widths (e.g., bold character | |
6361 * is wider). */ | |
6362 if (unicodepdy != NULL) | |
6363 { | |
6364 int i; | |
6365 int cw; | |
6366 | |
6367 for (i = 0; i < len; ++i) | |
6368 { | |
6369 cw = utf_char2cells(unicodebuf[i]); | |
6370 if (cw > 2) | |
6371 cw = 1; | |
6372 unicodepdy[i] = cw * gui.char_width; | |
6373 } | |
6374 } | |
7 | 6375 ExtTextOutW(s_hdc, TEXT_X(col), TEXT_Y(row), |
179 | 6376 foptions, pcliprect, unicodebuf, len, unicodepdy); |
6377 } | |
7 | 6378 } |
6379 } | |
6380 else | |
6381 #endif | |
6382 { | |
6383 #ifdef FEAT_RIGHTLEFT | |
6226 | 6384 /* Windows will mess up RL text, so we have to draw it character by |
6385 * character. Only do this if RL is on, since it's slow. */ | |
6386 if (curwin->w_p_rl) | |
7 | 6387 RevOut(s_hdc, TEXT_X(col), TEXT_Y(row), |
6388 foptions, pcliprect, (char *)text, len, padding); | |
6389 else | |
6390 #endif | |
6391 ExtTextOut(s_hdc, TEXT_X(col), TEXT_Y(row), | |
6392 foptions, pcliprect, (char *)text, len, padding); | |
6393 } | |
6394 | |
205 | 6395 /* Underline */ |
7 | 6396 if (flags & DRAW_UNDERL) |
6397 { | |
6398 hpen = CreatePen(PS_SOLID, 1, gui.currFgColor); | |
6399 old_pen = SelectObject(s_hdc, hpen); | |
6400 /* When p_linespace is 0, overwrite the bottom row of pixels. | |
6401 * Otherwise put the line just below the character. */ | |
6402 y = FILL_Y(row + 1) - 1; | |
6403 if (p_linespace > 1) | |
6404 y -= p_linespace - 1; | |
6405 MoveToEx(s_hdc, FILL_X(col), y, NULL); | |
6406 /* Note: LineTo() excludes the last pixel in the line. */ | |
6407 LineTo(s_hdc, FILL_X(col + len), y); | |
6408 DeleteObject(SelectObject(s_hdc, old_pen)); | |
6409 } | |
205 | 6410 |
6411 /* Undercurl */ | |
6412 if (flags & DRAW_UNDERC) | |
6413 { | |
6414 int x; | |
6415 int offset; | |
323 | 6416 static const int val[8] = {1, 0, 0, 0, 1, 2, 2, 2 }; |
205 | 6417 |
6418 y = FILL_Y(row + 1) - 1; | |
6419 for (x = FILL_X(col); x < FILL_X(col + len); ++x) | |
6420 { | |
6421 offset = val[x % 8]; | |
6422 SetPixel(s_hdc, x, y - offset, gui.currSpColor); | |
6423 } | |
6424 } | |
7 | 6425 } |
6426 | |
6427 | |
6428 /* | |
6429 * Output routines. | |
6430 */ | |
6431 | |
6432 /* Flush any output to the screen */ | |
6433 void | |
6434 gui_mch_flush(void) | |
6435 { | |
6436 # if defined(__BORLANDC__) | |
6437 /* | |
6438 * The GdiFlush declaration (in Borland C 5.01 <wingdi.h>) is not a | |
6439 * prototype declaration. | |
6440 * The compiler complains if __stdcall is not used in both declarations. | |
6441 */ | |
6442 BOOL __stdcall GdiFlush(void); | |
6443 # endif | |
6444 | |
6445 GdiFlush(); | |
6446 } | |
6447 | |
6448 static void | |
6449 clear_rect(RECT *rcp) | |
6450 { | |
6451 HBRUSH hbr; | |
6452 | |
6453 hbr = CreateSolidBrush(gui.back_pixel); | |
6454 FillRect(s_hdc, rcp, hbr); | |
6455 DeleteBrush(hbr); | |
6456 } | |
6457 | |
6458 | |
636 | 6459 void |
6460 gui_mch_get_screen_dimensions(int *screen_w, int *screen_h) | |
6461 { | |
6462 RECT workarea_rect; | |
6463 | |
6464 get_work_area(&workarea_rect); | |
6465 | |
819 | 6466 *screen_w = workarea_rect.right - workarea_rect.left |
5225
8f983df0299f
updated for version 7.4a.038
Bram Moolenaar <bram@vim.org>
parents:
5223
diff
changeset
|
6467 - (GetSystemMetrics(SM_CXFRAME) + |
6110 | 6468 GetSystemMetrics(SM_CXPADDEDBORDER)) * 2; |
636 | 6469 |
6470 /* FIXME: dirty trick: Because the gui_get_base_height() doesn't include | |
6471 * the menubar for MSwin, we subtract it from the screen height, so that | |
6472 * the window size can be made to fit on the screen. */ | |
819 | 6473 *screen_h = workarea_rect.bottom - workarea_rect.top |
5225
8f983df0299f
updated for version 7.4a.038
Bram Moolenaar <bram@vim.org>
parents:
5223
diff
changeset
|
6474 - (GetSystemMetrics(SM_CYFRAME) + |
6110 | 6475 GetSystemMetrics(SM_CXPADDEDBORDER)) * 2 |
636 | 6476 - GetSystemMetrics(SM_CYCAPTION) |
6477 #ifdef FEAT_MENU | |
856 | 6478 - gui_mswin_get_menu_height(FALSE) |
636 | 6479 #endif |
856 | 6480 ; |
636 | 6481 } |
6482 | |
6483 | |
7 | 6484 #if defined(FEAT_MENU) || defined(PROTO) |
6485 /* | |
6486 * Add a sub menu to the menu bar. | |
6487 */ | |
6488 void | |
6489 gui_mch_add_menu( | |
6490 vimmenu_T *menu, | |
6491 int pos) | |
6492 { | |
6493 vimmenu_T *parent = menu->parent; | |
6494 | |
6495 menu->submenu_id = CreatePopupMenu(); | |
6496 menu->id = s_menu_id++; | |
6497 | |
6498 if (menu_is_menubar(menu->name)) | |
6499 { | |
6500 #ifdef FEAT_MBYTE | |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6501 WCHAR *wn = NULL; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6502 |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6503 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6504 { |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6505 /* 'encoding' differs from active codepage: convert menu name |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6506 * and use wide function */ |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6507 wn = enc_to_utf16(menu->name, NULL); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6508 if (wn != NULL) |
7 | 6509 { |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6510 MENUITEMINFOW infow; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6511 |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6512 infow.cbSize = sizeof(infow); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6513 infow.fMask = MIIM_DATA | MIIM_TYPE | MIIM_ID |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6514 | MIIM_SUBMENU; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6515 infow.dwItemData = (long_u)menu; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6516 infow.wID = menu->id; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6517 infow.fType = MFT_STRING; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6518 infow.dwTypeData = wn; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6519 infow.cch = (UINT)wcslen(wn); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6520 infow.hSubMenu = menu->submenu_id; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6521 InsertMenuItemW((parent == NULL) |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6522 ? s_menuBar : parent->submenu_id, |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6523 (UINT)pos, TRUE, &infow); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6524 vim_free(wn); |
7 | 6525 } |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6526 } |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6527 |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6528 if (wn == NULL) |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6529 #endif |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6530 { |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6531 MENUITEMINFO info; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6532 |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6533 info.cbSize = sizeof(info); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6534 info.fMask = MIIM_DATA | MIIM_TYPE | MIIM_ID | MIIM_SUBMENU; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6535 info.dwItemData = (long_u)menu; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6536 info.wID = menu->id; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6537 info.fType = MFT_STRING; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6538 info.dwTypeData = (LPTSTR)menu->name; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6539 info.cch = (UINT)STRLEN(menu->name); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6540 info.hSubMenu = menu->submenu_id; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6541 InsertMenuItem((parent == NULL) |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6542 ? s_menuBar : parent->submenu_id, |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6543 (UINT)pos, TRUE, &info); |
7 | 6544 } |
6545 } | |
6546 | |
6547 /* Fix window size if menu may have wrapped */ | |
6548 if (parent == NULL) | |
6549 gui_mswin_get_menu_height(!gui.starting); | |
6550 #ifdef FEAT_TEAROFF | |
6551 else if (IsWindow(parent->tearoff_handle)) | |
6552 rebuild_tearoff(parent); | |
6553 #endif | |
6554 } | |
6555 | |
6556 void | |
6557 gui_mch_show_popupmenu(vimmenu_T *menu) | |
6558 { | |
6559 POINT mp; | |
6560 | |
6561 (void)GetCursorPos((LPPOINT)&mp); | |
6562 gui_mch_show_popupmenu_at(menu, (int)mp.x, (int)mp.y); | |
6563 } | |
6564 | |
6565 void | |
401 | 6566 gui_make_popup(char_u *path_name, int mouse_pos) |
7 | 6567 { |
6568 vimmenu_T *menu = gui_find_menu(path_name); | |
6569 | |
6570 if (menu != NULL) | |
6571 { | |
6572 POINT p; | |
6573 | |
6574 /* Find the position of the current cursor */ | |
6575 GetDCOrgEx(s_hdc, &p); | |
401 | 6576 if (mouse_pos) |
6577 { | |
6578 int mx, my; | |
6579 | |
6580 gui_mch_getmouse(&mx, &my); | |
6581 p.x += mx; | |
6582 p.y += my; | |
6583 } | |
6584 else if (curwin != NULL) | |
7 | 6585 { |
6586 p.x += TEXT_X(W_WINCOL(curwin) + curwin->w_wcol + 1); | |
6587 p.y += TEXT_Y(W_WINROW(curwin) + curwin->w_wrow + 1); | |
6588 } | |
6589 msg_scroll = FALSE; | |
6590 gui_mch_show_popupmenu_at(menu, (int)p.x, (int)p.y); | |
6591 } | |
6592 } | |
6593 | |
6594 #if defined(FEAT_TEAROFF) || defined(PROTO) | |
6595 /* | |
6596 * Given a menu descriptor, e.g. "File.New", find it in the menu hierarchy and | |
6597 * create it as a pseudo-"tearoff menu". | |
6598 */ | |
6599 void | |
6600 gui_make_tearoff(char_u *path_name) | |
6601 { | |
6602 vimmenu_T *menu = gui_find_menu(path_name); | |
6603 | |
6604 /* Found the menu, so tear it off. */ | |
6605 if (menu != NULL) | |
6606 gui_mch_tearoff(menu->dname, menu, 0xffffL, 0xffffL); | |
6607 } | |
6608 #endif | |
6609 | |
6610 /* | |
6611 * Add a menu item to a menu | |
6612 */ | |
6613 void | |
6614 gui_mch_add_menu_item( | |
6615 vimmenu_T *menu, | |
6616 int idx) | |
6617 { | |
6618 vimmenu_T *parent = menu->parent; | |
6619 | |
6620 menu->id = s_menu_id++; | |
6621 menu->submenu_id = NULL; | |
6622 | |
6623 #ifdef FEAT_TEAROFF | |
6624 if (STRNCMP(menu->name, TEAR_STRING, TEAR_LEN) == 0) | |
6625 { | |
6626 InsertMenu(parent->submenu_id, (UINT)idx, MF_BITMAP|MF_BYPOSITION, | |
6627 (UINT)menu->id, (LPCTSTR) s_htearbitmap); | |
6628 } | |
6629 else | |
6630 #endif | |
6631 #ifdef FEAT_TOOLBAR | |
6632 if (menu_is_toolbar(parent->name)) | |
6633 { | |
6634 TBBUTTON newtb; | |
6635 | |
6636 vim_memset(&newtb, 0, sizeof(newtb)); | |
6637 if (menu_is_separator(menu->name)) | |
6638 { | |
6639 newtb.iBitmap = 0; | |
6640 newtb.fsStyle = TBSTYLE_SEP; | |
6641 } | |
6642 else | |
6643 { | |
6644 newtb.iBitmap = get_toolbar_bitmap(menu); | |
6645 newtb.fsStyle = TBSTYLE_BUTTON; | |
6646 } | |
6647 newtb.idCommand = menu->id; | |
6648 newtb.fsState = TBSTATE_ENABLED; | |
6649 newtb.iString = 0; | |
6650 SendMessage(s_toolbarhwnd, TB_INSERTBUTTON, (WPARAM)idx, | |
6651 (LPARAM)&newtb); | |
6652 menu->submenu_id = (HMENU)-1; | |
6653 } | |
6654 else | |
6655 #endif | |
6656 { | |
6657 #ifdef FEAT_MBYTE | |
6658 WCHAR *wn = NULL; | |
6659 | |
6660 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) | |
6661 { | |
6662 /* 'encoding' differs from active codepage: convert menu item name | |
6663 * and use wide function */ | |
1752 | 6664 wn = enc_to_utf16(menu->name, NULL); |
7 | 6665 if (wn != NULL) |
6666 { | |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6667 InsertMenuW(parent->submenu_id, (UINT)idx, |
7 | 6668 (menu_is_separator(menu->name) |
6669 ? MF_SEPARATOR : MF_STRING) | MF_BYPOSITION, | |
6670 (UINT)menu->id, wn); | |
6671 vim_free(wn); | |
6672 } | |
6673 } | |
6674 if (wn == NULL) | |
6675 #endif | |
6676 InsertMenu(parent->submenu_id, (UINT)idx, | |
6677 (menu_is_separator(menu->name) ? MF_SEPARATOR : MF_STRING) | |
6678 | MF_BYPOSITION, | |
6679 (UINT)menu->id, (LPCTSTR)menu->name); | |
6680 #ifdef FEAT_TEAROFF | |
6681 if (IsWindow(parent->tearoff_handle)) | |
6682 rebuild_tearoff(parent); | |
6683 #endif | |
6684 } | |
6685 } | |
6686 | |
6687 /* | |
6688 * Destroy the machine specific menu widget. | |
6689 */ | |
6690 void | |
6691 gui_mch_destroy_menu(vimmenu_T *menu) | |
6692 { | |
6693 #ifdef FEAT_TOOLBAR | |
6694 /* | |
6695 * is this a toolbar button? | |
6696 */ | |
6697 if (menu->submenu_id == (HMENU)-1) | |
6698 { | |
6699 int iButton; | |
6700 | |
6701 iButton = (int)SendMessage(s_toolbarhwnd, TB_COMMANDTOINDEX, | |
6702 (WPARAM)menu->id, 0); | |
6703 SendMessage(s_toolbarhwnd, TB_DELETEBUTTON, (WPARAM)iButton, 0); | |
6704 } | |
6705 else | |
6706 #endif | |
6707 { | |
6708 if (menu->parent != NULL | |
6709 && menu_is_popup(menu->parent->dname) | |
6710 && menu->parent->submenu_id != NULL) | |
6711 RemoveMenu(menu->parent->submenu_id, menu->id, MF_BYCOMMAND); | |
6712 else | |
6713 RemoveMenu(s_menuBar, menu->id, MF_BYCOMMAND); | |
6714 if (menu->submenu_id != NULL) | |
6715 DestroyMenu(menu->submenu_id); | |
6716 #ifdef FEAT_TEAROFF | |
6717 if (IsWindow(menu->tearoff_handle)) | |
6718 DestroyWindow(menu->tearoff_handle); | |
6719 if (menu->parent != NULL | |
6720 && menu->parent->children != NULL | |
6721 && IsWindow(menu->parent->tearoff_handle)) | |
6722 { | |
6723 /* This menu must not show up when rebuilding the tearoff window. */ | |
6724 menu->modes = 0; | |
6725 rebuild_tearoff(menu->parent); | |
6726 } | |
6727 #endif | |
6728 } | |
6729 } | |
6730 | |
6731 #ifdef FEAT_TEAROFF | |
6732 static void | |
6733 rebuild_tearoff(vimmenu_T *menu) | |
6734 { | |
6735 /*hackish*/ | |
6736 char_u tbuf[128]; | |
6737 RECT trect; | |
6738 RECT rct; | |
6739 RECT roct; | |
6740 int x, y; | |
6741 | |
6742 HWND thwnd = menu->tearoff_handle; | |
6743 | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
6744 GetWindowText(thwnd, (LPSTR)tbuf, 127); |
7 | 6745 if (GetWindowRect(thwnd, &trect) |
6746 && GetWindowRect(s_hwnd, &rct) | |
6747 && GetClientRect(s_hwnd, &roct)) | |
6748 { | |
6749 x = trect.left - rct.left; | |
6750 y = (trect.top - rct.bottom + roct.bottom); | |
6751 } | |
6752 else | |
6753 { | |
6754 x = y = 0xffffL; | |
6755 } | |
6756 DestroyWindow(thwnd); | |
6757 if (menu->children != NULL) | |
6758 { | |
6759 gui_mch_tearoff(tbuf, menu, x, y); | |
6760 if (IsWindow(menu->tearoff_handle)) | |
6761 (void) SetWindowPos(menu->tearoff_handle, | |
6762 NULL, | |
6763 (int)trect.left, | |
6764 (int)trect.top, | |
6765 0, 0, | |
6766 SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); | |
6767 } | |
6768 } | |
6769 #endif /* FEAT_TEAROFF */ | |
6770 | |
6771 /* | |
6772 * Make a menu either grey or not grey. | |
6773 */ | |
6774 void | |
6775 gui_mch_menu_grey( | |
6776 vimmenu_T *menu, | |
6777 int grey) | |
6778 { | |
6779 #ifdef FEAT_TOOLBAR | |
6780 /* | |
6781 * is this a toolbar button? | |
6782 */ | |
6783 if (menu->submenu_id == (HMENU)-1) | |
6784 { | |
6785 SendMessage(s_toolbarhwnd, TB_ENABLEBUTTON, | |
6786 (WPARAM)menu->id, (LPARAM) MAKELONG((grey ? FALSE : TRUE), 0) ); | |
6787 } | |
6788 else | |
6789 #endif | |
9236
9940e9b2a725
commit https://github.com/vim/vim/commit/762f1754370a1278167c8cba6c047ef319fc099c
Christian Brabandt <cb@256bit.org>
parents:
9213
diff
changeset
|
6790 (void)EnableMenuItem(menu->parent ? menu->parent->submenu_id : s_menuBar, |
9940e9b2a725
commit https://github.com/vim/vim/commit/762f1754370a1278167c8cba6c047ef319fc099c
Christian Brabandt <cb@256bit.org>
parents:
9213
diff
changeset
|
6791 menu->id, MF_BYCOMMAND | (grey ? MF_GRAYED : MF_ENABLED)); |
7 | 6792 |
6793 #ifdef FEAT_TEAROFF | |
6794 if ((menu->parent != NULL) && (IsWindow(menu->parent->tearoff_handle))) | |
6795 { | |
6796 WORD menuID; | |
6797 HWND menuHandle; | |
6798 | |
6799 /* | |
6800 * A tearoff button has changed state. | |
6801 */ | |
6802 if (menu->children == NULL) | |
6803 menuID = (WORD)(menu->id); | |
6804 else | |
840 | 6805 menuID = (WORD)((long_u)(menu->submenu_id) | (DWORD)0x8000); |
7 | 6806 menuHandle = GetDlgItem(menu->parent->tearoff_handle, menuID); |
6807 if (menuHandle) | |
6808 EnableWindow(menuHandle, !grey); | |
6809 | |
6810 } | |
6811 #endif | |
6812 } | |
6813 | |
6814 #endif /* FEAT_MENU */ | |
6815 | |
6816 | |
6817 /* define some macros used to make the dialogue creation more readable */ | |
6818 | |
6819 #define add_string(s) strcpy((LPSTR)p, s); (LPSTR)p += (strlen((LPSTR)p) + 1) | |
6820 #define add_word(x) *p++ = (x) | |
615 | 6821 #define add_long(x) dwp = (DWORD *)p; *dwp++ = (x); p = (WORD *)dwp |
7 | 6822 |
6823 #if defined(FEAT_GUI_DIALOG) || defined(PROTO) | |
6824 /* | |
6825 * stuff for dialogs | |
6826 */ | |
6827 | |
6828 /* | |
6829 * The callback routine used by all the dialogs. Very simple. First, | |
6830 * acknowledges the INITDIALOG message so that Windows knows to do standard | |
6831 * dialog stuff (Return = default, Esc = cancel....) Second, if a button is | |
6832 * pressed, return that button's ID - IDCANCEL (2), which is the button's | |
6833 * number. | |
6834 */ | |
323 | 6835 /*ARGSUSED*/ |
7 | 6836 static LRESULT CALLBACK |
6837 dialog_callback( | |
6838 HWND hwnd, | |
6839 UINT message, | |
6840 WPARAM wParam, | |
6841 LPARAM lParam) | |
6842 { | |
6843 if (message == WM_INITDIALOG) | |
6844 { | |
6845 CenterWindow(hwnd, GetWindow(hwnd, GW_OWNER)); | |
6846 /* Set focus to the dialog. Set the default button, if specified. */ | |
6847 (void)SetFocus(hwnd); | |
6848 if (dialog_default_button > IDCANCEL) | |
6849 (void)SetFocus(GetDlgItem(hwnd, dialog_default_button)); | |
1356 | 6850 else |
6851 /* We don't have a default, set focus on another element of the | |
6852 * dialog window, probably the icon */ | |
6853 (void)SetFocus(GetDlgItem(hwnd, DLG_NONBUTTON_CONTROL)); | |
7 | 6854 return FALSE; |
6855 } | |
6856 | |
6857 if (message == WM_COMMAND) | |
6858 { | |
6859 int button = LOWORD(wParam); | |
6860 | |
6861 /* Don't end the dialog if something was selected that was | |
6862 * not a button. | |
6863 */ | |
6864 if (button >= DLG_NONBUTTON_CONTROL) | |
6865 return TRUE; | |
6866 | |
6867 /* If the edit box exists, copy the string. */ | |
6868 if (s_textfield != NULL) | |
1795 | 6869 { |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6870 # ifdef FEAT_MBYTE |
1795 | 6871 /* If the OS is Windows NT, and 'encoding' differs from active |
6872 * codepage: use wide function and convert text. */ | |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6873 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) |
2311
ccda151dde4e
Support completion for ":find". (Nazri Ramliy)
Bram Moolenaar <bram@vim.org>
parents:
2224
diff
changeset
|
6874 { |
1795 | 6875 WCHAR *wp = (WCHAR *)alloc(IOSIZE * sizeof(WCHAR)); |
6876 char_u *p; | |
6877 | |
6878 GetDlgItemTextW(hwnd, DLG_NONBUTTON_CONTROL + 2, wp, IOSIZE); | |
6879 p = utf16_to_enc(wp, NULL); | |
6880 vim_strncpy(s_textfield, p, IOSIZE); | |
6881 vim_free(p); | |
6882 vim_free(wp); | |
6883 } | |
6884 else | |
6885 # endif | |
6886 GetDlgItemText(hwnd, DLG_NONBUTTON_CONTROL + 2, | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
6887 (LPSTR)s_textfield, IOSIZE); |
1795 | 6888 } |
7 | 6889 |
6890 /* | |
6891 * Need to check for IDOK because if the user just hits Return to | |
6892 * accept the default value, some reason this is what we get. | |
6893 */ | |
6894 if (button == IDOK) | |
6895 { | |
6896 if (dialog_default_button > IDCANCEL) | |
6897 EndDialog(hwnd, dialog_default_button); | |
6898 } | |
6899 else | |
6900 EndDialog(hwnd, button - IDCANCEL); | |
6901 return TRUE; | |
6902 } | |
6903 | |
6904 if ((message == WM_SYSCOMMAND) && (wParam == SC_CLOSE)) | |
6905 { | |
6906 EndDialog(hwnd, 0); | |
6907 return TRUE; | |
6908 } | |
6909 return FALSE; | |
6910 } | |
6911 | |
6912 /* | |
6913 * Create a dialog dynamically from the parameter strings. | |
6914 * type = type of dialog (question, alert, etc.) | |
6915 * title = dialog title. may be NULL for default title. | |
6916 * message = text to display. Dialog sizes to accommodate it. | |
6917 * buttons = '\n' separated list of button captions, default first. | |
6918 * dfltbutton = number of default button. | |
6919 * | |
6920 * This routine returns 1 if the first button is pressed, | |
6921 * 2 for the second, etc. | |
6922 * | |
6923 * 0 indicates Esc was pressed. | |
6924 * -1 for unexpected error | |
6925 * | |
6926 * If stubbing out this fn, return 1. | |
6927 */ | |
6928 | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
6929 static const char *dlg_icons[] = /* must match names in resource file */ |
7 | 6930 { |
6931 "IDR_VIM", | |
6932 "IDR_VIM_ERROR", | |
6933 "IDR_VIM_ALERT", | |
6934 "IDR_VIM_INFO", | |
6935 "IDR_VIM_QUESTION" | |
6936 }; | |
6937 | |
6938 int | |
6939 gui_mch_dialog( | |
6940 int type, | |
6941 char_u *title, | |
6942 char_u *message, | |
6943 char_u *buttons, | |
6944 int dfltbutton, | |
2684 | 6945 char_u *textfield, |
6946 int ex_cmd) | |
7 | 6947 { |
6948 WORD *p, *pdlgtemplate, *pnumitems; | |
615 | 6949 DWORD *dwp; |
7 | 6950 int numButtons; |
6951 int *buttonWidths, *buttonPositions; | |
6952 int buttonYpos; | |
6953 int nchar, i; | |
6954 DWORD lStyle; | |
6955 int dlgwidth = 0; | |
6956 int dlgheight; | |
6957 int editboxheight; | |
6958 int horizWidth = 0; | |
6959 int msgheight; | |
6960 char_u *pstart; | |
6961 char_u *pend; | |
158 | 6962 char_u *last_white; |
7 | 6963 char_u *tbuffer; |
6964 RECT rect; | |
6965 HWND hwnd; | |
6966 HDC hdc; | |
6967 HFONT font, oldFont; | |
6968 TEXTMETRIC fontInfo; | |
6969 int fontHeight; | |
6970 int textWidth, minButtonWidth, messageWidth; | |
6971 int maxDialogWidth; | |
153 | 6972 int maxDialogHeight; |
6973 int scroll_flag = 0; | |
7 | 6974 int vertical; |
6975 int dlgPaddingX; | |
6976 int dlgPaddingY; | |
6977 #ifdef USE_SYSMENU_FONT | |
6978 LOGFONT lfSysmenu; | |
6979 int use_lfSysmenu = FALSE; | |
6980 #endif | |
158 | 6981 garray_T ga; |
6982 int l; | |
7 | 6983 |
6984 #ifndef NO_CONSOLE | |
6985 /* Don't output anything in silent mode ("ex -s") */ | |
6986 if (silent_mode) | |
6987 return dfltbutton; /* return default option */ | |
6988 #endif | |
6989 | |
153 | 6990 if (s_hwnd == NULL) |
6991 get_dialog_font_metrics(); | |
7 | 6992 |
6993 if ((type < 0) || (type > VIM_LAST_TYPE)) | |
6994 type = 0; | |
6995 | |
6996 /* allocate some memory for dialog template */ | |
39 | 6997 /* TODO should compute this really */ |
158 | 6998 pdlgtemplate = p = (PWORD)LocalAlloc(LPTR, |
840 | 6999 DLG_ALLOC_SIZE + STRLEN(message) * 2); |
7 | 7000 |
7001 if (p == NULL) | |
7002 return -1; | |
7003 | |
7004 /* | |
4352 | 7005 * make a copy of 'buttons' to fiddle with it. compiler grizzles because |
7 | 7006 * vim_strsave() doesn't take a const arg (why not?), so cast away the |
7007 * const. | |
7008 */ | |
7009 tbuffer = vim_strsave(buttons); | |
7010 if (tbuffer == NULL) | |
7011 return -1; | |
7012 | |
7013 --dfltbutton; /* Change from one-based to zero-based */ | |
7014 | |
7015 /* Count buttons */ | |
7016 numButtons = 1; | |
7017 for (i = 0; tbuffer[i] != '\0'; i++) | |
7018 { | |
7019 if (tbuffer[i] == DLG_BUTTON_SEP) | |
7020 numButtons++; | |
7021 } | |
7022 if (dfltbutton >= numButtons) | |
7023 dfltbutton = -1; | |
7024 | |
7025 /* Allocate array to hold the width of each button */ | |
537 | 7026 buttonWidths = (int *)lalloc(numButtons * sizeof(int), TRUE); |
7 | 7027 if (buttonWidths == NULL) |
7028 return -1; | |
7029 | |
7030 /* Allocate array to hold the X position of each button */ | |
537 | 7031 buttonPositions = (int *)lalloc(numButtons * sizeof(int), TRUE); |
7 | 7032 if (buttonPositions == NULL) |
7033 return -1; | |
7034 | |
7035 /* | |
7036 * Calculate how big the dialog must be. | |
7037 */ | |
7038 hwnd = GetDesktopWindow(); | |
7039 hdc = GetWindowDC(hwnd); | |
7040 #ifdef USE_SYSMENU_FONT | |
7041 if (gui_w32_get_menu_font(&lfSysmenu) == OK) | |
7042 { | |
7043 font = CreateFontIndirect(&lfSysmenu); | |
7044 use_lfSysmenu = TRUE; | |
7045 } | |
7046 else | |
7047 #endif | |
7048 font = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
7049 VARIABLE_PITCH , DLG_FONT_NAME); | |
7050 if (s_usenewlook) | |
7051 { | |
7052 oldFont = SelectFont(hdc, font); | |
7053 dlgPaddingX = DLG_PADDING_X; | |
7054 dlgPaddingY = DLG_PADDING_Y; | |
7055 } | |
7056 else | |
7057 { | |
7058 oldFont = SelectFont(hdc, GetStockObject(SYSTEM_FONT)); | |
7059 dlgPaddingX = DLG_OLD_STYLE_PADDING_X; | |
7060 dlgPaddingY = DLG_OLD_STYLE_PADDING_Y; | |
7061 } | |
7062 GetTextMetrics(hdc, &fontInfo); | |
7063 fontHeight = fontInfo.tmHeight; | |
7064 | |
7065 /* Minimum width for horizontal button */ | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
7066 minButtonWidth = GetTextWidth(hdc, (char_u *)"Cancel", 6); |
7 | 7067 |
7068 /* Maximum width of a dialog, if possible */ | |
158 | 7069 if (s_hwnd == NULL) |
7070 { | |
7071 RECT workarea_rect; | |
7072 | |
636 | 7073 /* We don't have a window, use the desktop area. */ |
158 | 7074 get_work_area(&workarea_rect); |
7075 maxDialogWidth = workarea_rect.right - workarea_rect.left - 100; | |
7076 if (maxDialogWidth > 600) | |
7077 maxDialogWidth = 600; | |
5249
47a09a572ea6
updated for version 7.4b.001
Bram Moolenaar <bram@vim.org>
parents:
5225
diff
changeset
|
7078 /* Leave some room for the taskbar. */ |
47a09a572ea6
updated for version 7.4b.001
Bram Moolenaar <bram@vim.org>
parents:
5225
diff
changeset
|
7079 maxDialogHeight = workarea_rect.bottom - workarea_rect.top - 150; |
158 | 7080 } |
7081 else | |
7082 { | |
5284
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
7083 /* Use our own window for the size, unless it's very small. */ |
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
7084 GetWindowRect(s_hwnd, &rect); |
158 | 7085 maxDialogWidth = rect.right - rect.left |
5225
8f983df0299f
updated for version 7.4a.038
Bram Moolenaar <bram@vim.org>
parents:
5223
diff
changeset
|
7086 - (GetSystemMetrics(SM_CXFRAME) + |
6110 | 7087 GetSystemMetrics(SM_CXPADDEDBORDER)) * 2; |
158 | 7088 if (maxDialogWidth < DLG_MIN_MAX_WIDTH) |
7089 maxDialogWidth = DLG_MIN_MAX_WIDTH; | |
7090 | |
7091 maxDialogHeight = rect.bottom - rect.top | |
5249
47a09a572ea6
updated for version 7.4b.001
Bram Moolenaar <bram@vim.org>
parents:
5225
diff
changeset
|
7092 - (GetSystemMetrics(SM_CYFRAME) + |
6110 | 7093 GetSystemMetrics(SM_CXPADDEDBORDER)) * 4 |
5284
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
7094 - GetSystemMetrics(SM_CYCAPTION); |
158 | 7095 if (maxDialogHeight < DLG_MIN_MAX_HEIGHT) |
7096 maxDialogHeight = DLG_MIN_MAX_HEIGHT; | |
7097 } | |
7098 | |
7099 /* Set dlgwidth to width of message. | |
7100 * Copy the message into "ga", changing NL to CR-NL and inserting line | |
7101 * breaks where needed. */ | |
7 | 7102 pstart = message; |
7103 messageWidth = 0; | |
158 | 7104 msgheight = 0; |
7105 ga_init2(&ga, sizeof(char), 500); | |
7 | 7106 do |
7107 { | |
158 | 7108 msgheight += fontHeight; /* at least one line */ |
7109 | |
7110 /* Need to figure out where to break the string. The system does it | |
7111 * at a word boundary, which would mean we can't compute the number of | |
7112 * wrapped lines. */ | |
7113 textWidth = 0; | |
7114 last_white = NULL; | |
7115 for (pend = pstart; *pend != NUL && *pend != '\n'; ) | |
153 | 7116 { |
158 | 7117 #ifdef FEAT_MBYTE |
474 | 7118 l = (*mb_ptr2len)(pend); |
158 | 7119 #else |
7120 l = 1; | |
7121 #endif | |
7122 if (l == 1 && vim_iswhite(*pend) | |
7123 && textWidth > maxDialogWidth * 3 / 4) | |
7124 last_white = pend; | |
4999
b4a71dbdb787
updated for version 7.3.1244
Bram Moolenaar <bram@vim.org>
parents:
4352
diff
changeset
|
7125 textWidth += GetTextWidthEnc(hdc, pend, l); |
158 | 7126 if (textWidth >= maxDialogWidth) |
153 | 7127 { |
158 | 7128 /* Line will wrap. */ |
7129 messageWidth = maxDialogWidth; | |
153 | 7130 msgheight += fontHeight; |
158 | 7131 textWidth = 0; |
7132 | |
7133 if (last_white != NULL) | |
7134 { | |
7135 /* break the line just after a space */ | |
835 | 7136 ga.ga_len -= (int)(pend - (last_white + 1)); |
158 | 7137 pend = last_white + 1; |
7138 last_white = NULL; | |
7139 } | |
7140 ga_append(&ga, '\r'); | |
7141 ga_append(&ga, '\n'); | |
7142 continue; | |
153 | 7143 } |
158 | 7144 |
7145 while (--l >= 0) | |
7146 ga_append(&ga, *pend++); | |
153 | 7147 } |
158 | 7148 if (textWidth > messageWidth) |
7 | 7149 messageWidth = textWidth; |
158 | 7150 |
7151 ga_append(&ga, '\r'); | |
7152 ga_append(&ga, '\n'); | |
7 | 7153 pstart = pend + 1; |
7154 } while (*pend != NUL); | |
153 | 7155 |
158 | 7156 if (ga.ga_data != NULL) |
7157 message = ga.ga_data; | |
7158 | |
153 | 7159 messageWidth += 10; /* roundoff space */ |
7160 | |
7 | 7161 /* Add width of icon to dlgwidth, and some space */ |
5284
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
7162 dlgwidth = messageWidth + DLG_ICON_WIDTH + 3 * dlgPaddingX |
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
7163 + GetSystemMetrics(SM_CXVSCROLL); |
7 | 7164 |
7165 if (msgheight < DLG_ICON_HEIGHT) | |
7166 msgheight = DLG_ICON_HEIGHT; | |
7167 | |
7168 /* | |
7169 * Check button names. A long one will make the dialog wider. | |
1116 | 7170 * When called early (-register error message) p_go isn't initialized. |
7 | 7171 */ |
1116 | 7172 vertical = (p_go != NULL && vim_strchr(p_go, GO_VERTICAL) != NULL); |
7 | 7173 if (!vertical) |
7174 { | |
7175 // Place buttons horizontally if they fit. | |
7176 horizWidth = dlgPaddingX; | |
7177 pstart = tbuffer; | |
7178 i = 0; | |
7179 do | |
7180 { | |
7181 pend = vim_strchr(pstart, DLG_BUTTON_SEP); | |
7182 if (pend == NULL) | |
7183 pend = pstart + STRLEN(pstart); // Last button name. | |
5001
43329b2b5b79
updated for version 7.3.1245
Bram Moolenaar <bram@vim.org>
parents:
4999
diff
changeset
|
7184 textWidth = GetTextWidthEnc(hdc, pstart, (int)(pend - pstart)); |
7 | 7185 if (textWidth < minButtonWidth) |
7186 textWidth = minButtonWidth; | |
7187 textWidth += dlgPaddingX; /* Padding within button */ | |
7188 buttonWidths[i] = textWidth; | |
7189 buttonPositions[i++] = horizWidth; | |
7190 horizWidth += textWidth + dlgPaddingX; /* Pad between buttons */ | |
7191 pstart = pend + 1; | |
7192 } while (*pend != NUL); | |
7193 | |
7194 if (horizWidth > maxDialogWidth) | |
7195 vertical = TRUE; // Too wide to fit on the screen. | |
7196 else if (horizWidth > dlgwidth) | |
7197 dlgwidth = horizWidth; | |
7198 } | |
7199 | |
7200 if (vertical) | |
7201 { | |
7202 // Stack buttons vertically. | |
7203 pstart = tbuffer; | |
7204 do | |
7205 { | |
7206 pend = vim_strchr(pstart, DLG_BUTTON_SEP); | |
7207 if (pend == NULL) | |
7208 pend = pstart + STRLEN(pstart); // Last button name. | |
5001
43329b2b5b79
updated for version 7.3.1245
Bram Moolenaar <bram@vim.org>
parents:
4999
diff
changeset
|
7209 textWidth = GetTextWidthEnc(hdc, pstart, (int)(pend - pstart)); |
7 | 7210 textWidth += dlgPaddingX; /* Padding within button */ |
7211 textWidth += DLG_VERT_PADDING_X * 2; /* Padding around button */ | |
7212 if (textWidth > dlgwidth) | |
7213 dlgwidth = textWidth; | |
7214 pstart = pend + 1; | |
7215 } while (*pend != NUL); | |
7216 } | |
7217 | |
7218 if (dlgwidth < DLG_MIN_WIDTH) | |
7219 dlgwidth = DLG_MIN_WIDTH; /* Don't allow a really thin dialog!*/ | |
7220 | |
7221 /* start to fill in the dlgtemplate information. addressing by WORDs */ | |
7222 if (s_usenewlook) | |
7223 lStyle = DS_MODALFRAME | WS_CAPTION |DS_3DLOOK| WS_VISIBLE |DS_SETFONT; | |
7224 else | |
7225 lStyle = DS_MODALFRAME | WS_CAPTION |DS_3DLOOK| WS_VISIBLE; | |
7226 | |
7227 add_long(lStyle); | |
7228 add_long(0); // (lExtendedStyle) | |
7229 pnumitems = p; /*save where the number of items must be stored*/ | |
7230 add_word(0); // NumberOfItems(will change later) | |
7231 add_word(10); // x | |
7232 add_word(10); // y | |
7233 add_word(PixelToDialogX(dlgwidth)); // cx | |
7234 | |
7235 // Dialog height. | |
7236 if (vertical) | |
5284
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
7237 dlgheight = msgheight + 2 * dlgPaddingY |
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
7238 + DLG_VERT_PADDING_Y + 2 * fontHeight * numButtons; |
7 | 7239 else |
7240 dlgheight = msgheight + 3 * dlgPaddingY + 2 * fontHeight; | |
7241 | |
7242 // Dialog needs to be taller if contains an edit box. | |
7243 editboxheight = fontHeight + dlgPaddingY + 4 * DLG_VERT_PADDING_Y; | |
7244 if (textfield != NULL) | |
7245 dlgheight += editboxheight; | |
7246 | |
5284
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
7247 /* Restrict the size to a maximum. Causes a scrollbar to show up. */ |
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
7248 if (dlgheight > maxDialogHeight) |
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
7249 { |
6110 | 7250 msgheight = msgheight - (dlgheight - maxDialogHeight); |
7251 dlgheight = maxDialogHeight; | |
7252 scroll_flag = WS_VSCROLL; | |
7253 /* Make sure scrollbar doesn't appear in the middle of the dialog */ | |
7254 messageWidth = dlgwidth - DLG_ICON_WIDTH - 3 * dlgPaddingX; | |
5284
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
7255 } |
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
7256 |
7 | 7257 add_word(PixelToDialogY(dlgheight)); |
7258 | |
7259 add_word(0); // Menu | |
7260 add_word(0); // Class | |
7261 | |
7262 /* copy the title of the dialog */ | |
7263 nchar = nCopyAnsiToWideChar(p, (title ? | |
7264 (LPSTR)title : | |
7265 (LPSTR)("Vim "VIM_VERSION_MEDIUM))); | |
7266 p += nchar; | |
7267 | |
7268 if (s_usenewlook) | |
7269 { | |
7270 /* do the font, since DS_3DLOOK doesn't work properly */ | |
7271 #ifdef USE_SYSMENU_FONT | |
7272 if (use_lfSysmenu) | |
7273 { | |
7274 /* point size */ | |
7275 *p++ = -MulDiv(lfSysmenu.lfHeight, 72, | |
7276 GetDeviceCaps(hdc, LOGPIXELSY)); | |
7277 nchar = nCopyAnsiToWideChar(p, TEXT(lfSysmenu.lfFaceName)); | |
7278 } | |
7279 else | |
7280 #endif | |
7281 { | |
7282 *p++ = DLG_FONT_POINT_SIZE; // point size | |
7283 nchar = nCopyAnsiToWideChar(p, TEXT(DLG_FONT_NAME)); | |
7284 } | |
7285 p += nchar; | |
7286 } | |
7287 | |
7288 buttonYpos = msgheight + 2 * dlgPaddingY; | |
7289 | |
7290 if (textfield != NULL) | |
7291 buttonYpos += editboxheight; | |
7292 | |
7293 pstart = tbuffer; | |
7294 if (!vertical) | |
7295 horizWidth = (dlgwidth - horizWidth) / 2; /* Now it's X offset */ | |
7296 for (i = 0; i < numButtons; i++) | |
7297 { | |
7298 /* get end of this button. */ | |
7299 for ( pend = pstart; | |
7300 *pend && (*pend != DLG_BUTTON_SEP); | |
7301 pend++) | |
7302 ; | |
7303 | |
7304 if (*pend) | |
7305 *pend = '\0'; | |
7306 | |
7307 /* | |
7308 * old NOTE: | |
7309 * setting the BS_DEFPUSHBUTTON style doesn't work because Windows sets | |
7310 * the focus to the first tab-able button and in so doing makes that | |
7311 * the default!! Grrr. Workaround: Make the default button the only | |
7312 * one with WS_TABSTOP style. Means user can't tab between buttons, but | |
7313 * he/she can use arrow keys. | |
7314 * | |
7315 * new NOTE: BS_DEFPUSHBUTTON is required to be able to select the | |
1213 | 7316 * right button when hitting <Enter>. E.g., for the ":confirm quit" |
7 | 7317 * dialog. Also needed for when the textfield is the default control. |
7318 * It appears to work now (perhaps not on Win95?). | |
7319 */ | |
7320 if (vertical) | |
7321 { | |
7322 p = add_dialog_element(p, | |
7323 (i == dfltbutton | |
7324 ? BS_DEFPUSHBUTTON : BS_PUSHBUTTON) | WS_TABSTOP, | |
7325 PixelToDialogX(DLG_VERT_PADDING_X), | |
7326 PixelToDialogY(buttonYpos /* TBK */ | |
7327 + 2 * fontHeight * i), | |
7328 PixelToDialogX(dlgwidth - 2 * DLG_VERT_PADDING_X), | |
7329 (WORD)(PixelToDialogY(2 * fontHeight) - 1), | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
7330 (WORD)(IDCANCEL + 1 + i), (WORD)0x0080, (char *)pstart); |
7 | 7331 } |
7332 else | |
7333 { | |
7334 p = add_dialog_element(p, | |
7335 (i == dfltbutton | |
7336 ? BS_DEFPUSHBUTTON : BS_PUSHBUTTON) | WS_TABSTOP, | |
7337 PixelToDialogX(horizWidth + buttonPositions[i]), | |
7338 PixelToDialogY(buttonYpos), /* TBK */ | |
7339 PixelToDialogX(buttonWidths[i]), | |
7340 (WORD)(PixelToDialogY(2 * fontHeight) - 1), | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
7341 (WORD)(IDCANCEL + 1 + i), (WORD)0x0080, (char *)pstart); |
7 | 7342 } |
7343 pstart = pend + 1; /*next button*/ | |
7344 } | |
7345 *pnumitems += numButtons; | |
7346 | |
7347 /* Vim icon */ | |
7348 p = add_dialog_element(p, SS_ICON, | |
7349 PixelToDialogX(dlgPaddingX), | |
7350 PixelToDialogY(dlgPaddingY), | |
7351 PixelToDialogX(DLG_ICON_WIDTH), | |
7352 PixelToDialogY(DLG_ICON_HEIGHT), | |
7353 DLG_NONBUTTON_CONTROL + 0, (WORD)0x0082, | |
7354 dlg_icons[type]); | |
7355 | |
153 | 7356 /* Dialog message */ |
7357 p = add_dialog_element(p, ES_LEFT|scroll_flag|ES_MULTILINE|ES_READONLY, | |
7358 PixelToDialogX(2 * dlgPaddingX + DLG_ICON_WIDTH), | |
7359 PixelToDialogY(dlgPaddingY), | |
7360 (WORD)(PixelToDialogX(messageWidth) + 1), | |
7361 PixelToDialogY(msgheight), | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
7362 DLG_NONBUTTON_CONTROL + 1, (WORD)0x0081, (char *)message); |
7 | 7363 |
7364 /* Edit box */ | |
7365 if (textfield != NULL) | |
7366 { | |
7367 p = add_dialog_element(p, ES_LEFT|ES_AUTOHSCROLL|WS_TABSTOP|WS_BORDER, | |
7368 PixelToDialogX(2 * dlgPaddingX), | |
7369 PixelToDialogY(2 * dlgPaddingY + msgheight), | |
7370 PixelToDialogX(dlgwidth - 4 * dlgPaddingX), | |
7371 PixelToDialogY(fontHeight + dlgPaddingY), | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
7372 DLG_NONBUTTON_CONTROL + 2, (WORD)0x0081, (char *)textfield); |
7 | 7373 *pnumitems += 1; |
7374 } | |
7375 | |
7376 *pnumitems += 2; | |
7377 | |
7378 SelectFont(hdc, oldFont); | |
7379 DeleteObject(font); | |
7380 ReleaseDC(hwnd, hdc); | |
7381 | |
7382 /* Let the dialog_callback() function know which button to make default | |
7383 * If we have an edit box, make that the default. We also need to tell | |
7384 * dialog_callback() if this dialog contains an edit box or not. We do | |
7385 * this by setting s_textfield if it does. | |
7386 */ | |
7387 if (textfield != NULL) | |
7388 { | |
7389 dialog_default_button = DLG_NONBUTTON_CONTROL + 2; | |
7390 s_textfield = textfield; | |
7391 } | |
7392 else | |
7393 { | |
7394 dialog_default_button = IDCANCEL + 1 + dfltbutton; | |
7395 s_textfield = NULL; | |
7396 } | |
7397 | |
7398 /* show the dialog box modally and get a return value */ | |
7399 nchar = (int)DialogBoxIndirect( | |
7400 s_hinst, | |
7401 (LPDLGTEMPLATE)pdlgtemplate, | |
7402 s_hwnd, | |
7403 (DLGPROC)dialog_callback); | |
7404 | |
7405 LocalFree(LocalHandle(pdlgtemplate)); | |
7406 vim_free(tbuffer); | |
7407 vim_free(buttonWidths); | |
7408 vim_free(buttonPositions); | |
158 | 7409 vim_free(ga.ga_data); |
7 | 7410 |
7411 /* Focus back to our window (for when MDI is used). */ | |
7412 (void)SetFocus(s_hwnd); | |
7413 | |
7414 return nchar; | |
7415 } | |
7416 | |
7417 #endif /* FEAT_GUI_DIALOG */ | |
840 | 7418 |
7 | 7419 /* |
7420 * Put a simple element (basic class) onto a dialog template in memory. | |
7421 * return a pointer to where the next item should be added. | |
7422 * | |
7423 * parameters: | |
7424 * lStyle = additional style flags | |
7425 * (be careful, NT3.51 & Win32s will ignore the new ones) | |
7426 * x,y = x & y positions IN DIALOG UNITS | |
7427 * w,h = width and height IN DIALOG UNITS | |
7428 * Id = ID used in messages | |
7429 * clss = class ID, e.g 0x0080 for a button, 0x0082 for a static | |
7430 * caption = usually text or resource name | |
7431 * | |
7432 * TODO: use the length information noted here to enable the dialog creation | |
7433 * routines to work out more exactly how much memory they need to alloc. | |
7434 */ | |
7435 static PWORD | |
7436 add_dialog_element( | |
7437 PWORD p, | |
7438 DWORD lStyle, | |
7439 WORD x, | |
7440 WORD y, | |
7441 WORD w, | |
7442 WORD h, | |
7443 WORD Id, | |
7444 WORD clss, | |
7445 const char *caption) | |
7446 { | |
7447 int nchar; | |
7448 | |
7449 p = lpwAlign(p); /* Align to dword boundary*/ | |
7450 lStyle = lStyle | WS_VISIBLE | WS_CHILD; | |
7451 *p++ = LOWORD(lStyle); | |
7452 *p++ = HIWORD(lStyle); | |
7453 *p++ = 0; // LOWORD (lExtendedStyle) | |
7454 *p++ = 0; // HIWORD (lExtendedStyle) | |
7455 *p++ = x; | |
7456 *p++ = y; | |
7457 *p++ = w; | |
7458 *p++ = h; | |
7459 *p++ = Id; //9 or 10 words in all | |
7460 | |
7461 *p++ = (WORD)0xffff; | |
7462 *p++ = clss; //2 more here | |
7463 | |
7464 nchar = nCopyAnsiToWideChar(p, (LPSTR)caption); //strlen(caption)+1 | |
7465 p += nchar; | |
7466 | |
7467 *p++ = 0; // advance pointer over nExtraStuff WORD - 2 more | |
7468 | |
7469 return p; //total = 15+ (strlen(caption)) words | |
7470 // = 30 + 2(strlen(caption) bytes reqd | |
7471 } | |
7472 | |
7473 | |
7474 /* | |
7475 * Helper routine. Take an input pointer, return closest pointer that is | |
7476 * aligned on a DWORD (4 byte) boundary. Taken from the Win32SDK samples. | |
7477 */ | |
7478 static LPWORD | |
7479 lpwAlign( | |
7480 LPWORD lpIn) | |
7481 { | |
840 | 7482 long_u ul; |
7483 | |
7484 ul = (long_u)lpIn; | |
7 | 7485 ul += 3; |
7486 ul >>= 2; | |
7487 ul <<= 2; | |
7488 return (LPWORD)ul; | |
7489 } | |
7490 | |
7491 /* | |
7492 * Helper routine. Takes second parameter as Ansi string, copies it to first | |
7493 * parameter as wide character (16-bits / char) string, and returns integer | |
7494 * number of wide characters (words) in string (including the trailing wide | |
7495 * char NULL). Partly taken from the Win32SDK samples. | |
7496 */ | |
7497 static int | |
7498 nCopyAnsiToWideChar( | |
7499 LPWORD lpWCStr, | |
7500 LPSTR lpAnsiIn) | |
7501 { | |
7502 int nChar = 0; | |
7503 #ifdef FEAT_MBYTE | |
7504 int len = lstrlen(lpAnsiIn) + 1; /* include NUL character */ | |
7505 int i; | |
7506 WCHAR *wn; | |
7507 | |
7508 if (enc_codepage == 0 && (int)GetACP() != enc_codepage) | |
7509 { | |
7510 /* Not a codepage, use our own conversion function. */ | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
7511 wn = enc_to_utf16((char_u *)lpAnsiIn, NULL); |
7 | 7512 if (wn != NULL) |
7513 { | |
7514 wcscpy(lpWCStr, wn); | |
835 | 7515 nChar = (int)wcslen(wn) + 1; |
7 | 7516 vim_free(wn); |
7517 } | |
7518 } | |
7519 if (nChar == 0) | |
7520 /* Use Win32 conversion function. */ | |
7521 nChar = MultiByteToWideChar( | |
7522 enc_codepage > 0 ? enc_codepage : CP_ACP, | |
7523 MB_PRECOMPOSED, | |
7524 lpAnsiIn, len, | |
7525 lpWCStr, len); | |
7526 for (i = 0; i < nChar; ++i) | |
7527 if (lpWCStr[i] == (WORD)'\t') /* replace tabs with spaces */ | |
7528 lpWCStr[i] = (WORD)' '; | |
7529 #else | |
7530 do | |
7531 { | |
7532 if (*lpAnsiIn == '\t') | |
7533 *lpWCStr++ = (WORD)' '; | |
7534 else | |
7535 *lpWCStr++ = (WORD)*lpAnsiIn; | |
7536 nChar++; | |
7537 } while (*lpAnsiIn++); | |
7538 #endif | |
7539 | |
7540 return nChar; | |
7541 } | |
7542 | |
7543 | |
7544 #ifdef FEAT_TEAROFF | |
7545 /* | |
7546 * The callback function for all the modeless dialogs that make up the | |
7547 * "tearoff menus" Very simple - forward button presses (to fool Vim into | |
7548 * thinking its menus have been clicked), and go away when closed. | |
7549 */ | |
7550 static LRESULT CALLBACK | |
7551 tearoff_callback( | |
7552 HWND hwnd, | |
7553 UINT message, | |
7554 WPARAM wParam, | |
7555 LPARAM lParam) | |
7556 { | |
7557 if (message == WM_INITDIALOG) | |
7558 return (TRUE); | |
7559 | |
7560 /* May show the mouse pointer again. */ | |
7561 HandleMouseHide(message, lParam); | |
7562 | |
7563 if (message == WM_COMMAND) | |
7564 { | |
7565 if ((WORD)(LOWORD(wParam)) & 0x8000) | |
7566 { | |
7567 POINT mp; | |
7568 RECT rect; | |
7569 | |
7570 if (GetCursorPos(&mp) && GetWindowRect(hwnd, &rect)) | |
7571 { | |
7572 (void)TrackPopupMenu( | |
840 | 7573 (HMENU)(long_u)(LOWORD(wParam) ^ 0x8000), |
7 | 7574 TPM_LEFTALIGN | TPM_LEFTBUTTON, |
7575 (int)rect.right - 8, | |
7576 (int)mp.y, | |
7577 (int)0, /*reserved param*/ | |
7578 s_hwnd, | |
7579 NULL); | |
7580 /* | |
7581 * NOTE: The pop-up menu can eat the mouse up event. | |
7582 * We deal with this in normal.c. | |
7583 */ | |
7584 } | |
7585 } | |
7586 else | |
7587 /* Pass on messages to the main Vim window */ | |
7588 PostMessage(s_hwnd, WM_COMMAND, LOWORD(wParam), 0); | |
7589 /* | |
7590 * Give main window the focus back: this is so after | |
7591 * choosing a tearoff button you can start typing again | |
7592 * straight away. | |
7593 */ | |
7594 (void)SetFocus(s_hwnd); | |
7595 return TRUE; | |
7596 } | |
7597 if ((message == WM_SYSCOMMAND) && (wParam == SC_CLOSE)) | |
7598 { | |
7599 DestroyWindow(hwnd); | |
7600 return TRUE; | |
7601 } | |
7602 | |
7603 /* When moved around, give main window the focus back. */ | |
7604 if (message == WM_EXITSIZEMOVE) | |
7605 (void)SetActiveWindow(s_hwnd); | |
7606 | |
7607 return FALSE; | |
7608 } | |
7609 #endif | |
7610 | |
7611 | |
7612 /* | |
7613 * Decide whether to use the "new look" (small, non-bold font) or the "old | |
7614 * look" (big, clanky font) for dialogs, and work out a few values for use | |
7615 * later accordingly. | |
7616 */ | |
7617 static void | |
7618 get_dialog_font_metrics(void) | |
7619 { | |
7620 HDC hdc; | |
7621 HFONT hfontTools = 0; | |
7622 DWORD dlgFontSize; | |
7623 SIZE size; | |
7624 #ifdef USE_SYSMENU_FONT | |
7625 LOGFONT lfSysmenu; | |
7626 #endif | |
7627 | |
7628 s_usenewlook = FALSE; | |
7629 | |
7630 #ifdef USE_SYSMENU_FONT | |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7631 if (gui_w32_get_menu_font(&lfSysmenu) == OK) |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7632 hfontTools = CreateFontIndirect(&lfSysmenu); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7633 else |
7 | 7634 #endif |
7635 hfontTools = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0, | |
7636 0, 0, 0, 0, VARIABLE_PITCH , DLG_FONT_NAME); | |
7637 | |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7638 if (hfontTools) |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7639 { |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7640 hdc = GetDC(s_hwnd); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7641 SelectObject(hdc, hfontTools); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7642 /* |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7643 * GetTextMetrics() doesn't return the right value in |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7644 * tmAveCharWidth, so we have to figure out the dialog base units |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7645 * ourselves. |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7646 */ |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7647 GetTextExtentPoint(hdc, |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7648 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7649 52, &size); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7650 ReleaseDC(s_hwnd, hdc); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7651 |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7652 s_dlgfntwidth = (WORD)((size.cx / 26 + 1) / 2); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7653 s_dlgfntheight = (WORD)size.cy; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7654 s_usenewlook = TRUE; |
7 | 7655 } |
7656 | |
7657 if (!s_usenewlook) | |
7658 { | |
7659 dlgFontSize = GetDialogBaseUnits(); /* fall back to big old system*/ | |
7660 s_dlgfntwidth = LOWORD(dlgFontSize); | |
7661 s_dlgfntheight = HIWORD(dlgFontSize); | |
7662 } | |
7663 } | |
7664 | |
7665 #if defined(FEAT_MENU) && defined(FEAT_TEAROFF) | |
7666 /* | |
7667 * Create a pseudo-"tearoff menu" based on the child | |
7668 * items of a given menu pointer. | |
7669 */ | |
7670 static void | |
7671 gui_mch_tearoff( | |
7672 char_u *title, | |
7673 vimmenu_T *menu, | |
7674 int initX, | |
7675 int initY) | |
7676 { | |
7677 WORD *p, *pdlgtemplate, *pnumitems, *ptrueheight; | |
7678 int template_len; | |
7679 int nchar, textWidth, submenuWidth; | |
7680 DWORD lStyle; | |
7681 DWORD lExtendedStyle; | |
7682 WORD dlgwidth; | |
7683 WORD menuID; | |
7684 vimmenu_T *pmenu; | |
7685 vimmenu_T *the_menu = menu; | |
7686 HWND hwnd; | |
7687 HDC hdc; | |
7688 HFONT font, oldFont; | |
7689 int col, spaceWidth, len; | |
7690 int columnWidths[2]; | |
7691 char_u *label, *text; | |
7692 int acLen = 0; | |
7693 int nameLen; | |
7694 int padding0, padding1, padding2 = 0; | |
7695 int sepPadding=0; | |
87 | 7696 int x; |
7697 int y; | |
7 | 7698 #ifdef USE_SYSMENU_FONT |
7699 LOGFONT lfSysmenu; | |
7700 int use_lfSysmenu = FALSE; | |
7701 #endif | |
7702 | |
7703 /* | |
7704 * If this menu is already torn off, move it to the mouse position. | |
7705 */ | |
7706 if (IsWindow(menu->tearoff_handle)) | |
7707 { | |
7708 POINT mp; | |
7709 if (GetCursorPos((LPPOINT)&mp)) | |
7710 { | |
7711 SetWindowPos(menu->tearoff_handle, NULL, mp.x, mp.y, 0, 0, | |
7712 SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER); | |
7713 } | |
7714 return; | |
7715 } | |
7716 | |
7717 /* | |
7718 * Create a new tearoff. | |
7719 */ | |
7720 if (*title == MNU_HIDDEN_CHAR) | |
7721 title++; | |
7722 | |
7723 /* Allocate memory to store the dialog template. It's made bigger when | |
7724 * needed. */ | |
7725 template_len = DLG_ALLOC_SIZE; | |
7726 pdlgtemplate = p = (WORD *)LocalAlloc(LPTR, template_len); | |
7727 if (p == NULL) | |
7728 return; | |
7729 | |
7730 hwnd = GetDesktopWindow(); | |
7731 hdc = GetWindowDC(hwnd); | |
7732 #ifdef USE_SYSMENU_FONT | |
7733 if (gui_w32_get_menu_font(&lfSysmenu) == OK) | |
7734 { | |
7735 font = CreateFontIndirect(&lfSysmenu); | |
7736 use_lfSysmenu = TRUE; | |
7737 } | |
7738 else | |
7739 #endif | |
7740 font = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
7741 VARIABLE_PITCH , DLG_FONT_NAME); | |
7742 if (s_usenewlook) | |
7743 oldFont = SelectFont(hdc, font); | |
7744 else | |
7745 oldFont = SelectFont(hdc, GetStockObject(SYSTEM_FONT)); | |
7746 | |
7747 /* Calculate width of a single space. Used for padding columns to the | |
7748 * right width. */ | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
7749 spaceWidth = GetTextWidth(hdc, (char_u *)" ", 1); |
7 | 7750 |
7751 /* Figure out max width of the text column, the accelerator column and the | |
7752 * optional submenu column. */ | |
7753 submenuWidth = 0; | |
7754 for (col = 0; col < 2; col++) | |
7755 { | |
7756 columnWidths[col] = 0; | |
7757 for (pmenu = menu->children; pmenu != NULL; pmenu = pmenu->next) | |
7758 { | |
7759 /* Use "dname" here to compute the width of the visible text. */ | |
7760 text = (col == 0) ? pmenu->dname : pmenu->actext; | |
7761 if (text != NULL && *text != NUL) | |
7762 { | |
7763 textWidth = GetTextWidthEnc(hdc, text, (int)STRLEN(text)); | |
7764 if (textWidth > columnWidths[col]) | |
7765 columnWidths[col] = textWidth; | |
7766 } | |
7767 if (pmenu->children != NULL) | |
7768 submenuWidth = TEAROFF_COLUMN_PADDING * spaceWidth; | |
7769 } | |
7770 } | |
7771 if (columnWidths[1] == 0) | |
7772 { | |
7773 /* no accelerators */ | |
7774 if (submenuWidth != 0) | |
7775 columnWidths[0] += submenuWidth; | |
7776 else | |
7777 columnWidths[0] += spaceWidth; | |
7778 } | |
7779 else | |
7780 { | |
7781 /* there is an accelerator column */ | |
7782 columnWidths[0] += TEAROFF_COLUMN_PADDING * spaceWidth; | |
7783 columnWidths[1] += submenuWidth; | |
7784 } | |
7785 | |
7786 /* | |
7787 * Now find the total width of our 'menu'. | |
7788 */ | |
7789 textWidth = columnWidths[0] + columnWidths[1]; | |
7790 if (submenuWidth != 0) | |
7791 { | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
7792 submenuWidth = GetTextWidth(hdc, (char_u *)TEAROFF_SUBMENU_LABEL, |
7 | 7793 (int)STRLEN(TEAROFF_SUBMENU_LABEL)); |
7794 textWidth += submenuWidth; | |
7795 } | |
7796 dlgwidth = GetTextWidthEnc(hdc, title, (int)STRLEN(title)); | |
7797 if (textWidth > dlgwidth) | |
7798 dlgwidth = textWidth; | |
7799 dlgwidth += 2 * TEAROFF_PADDING_X + TEAROFF_BUTTON_PAD_X; | |
7800 | |
7801 /* start to fill in the dlgtemplate information. addressing by WORDs */ | |
7802 if (s_usenewlook) | |
7803 lStyle = DS_MODALFRAME | WS_CAPTION| WS_SYSMENU |DS_SETFONT| WS_VISIBLE; | |
7804 else | |
7805 lStyle = DS_MODALFRAME | WS_CAPTION| WS_SYSMENU | WS_VISIBLE; | |
7806 | |
7807 lExtendedStyle = WS_EX_TOOLWINDOW|WS_EX_STATICEDGE; | |
7808 *p++ = LOWORD(lStyle); | |
7809 *p++ = HIWORD(lStyle); | |
7810 *p++ = LOWORD(lExtendedStyle); | |
7811 *p++ = HIWORD(lExtendedStyle); | |
7812 pnumitems = p; /* save where the number of items must be stored */ | |
7813 *p++ = 0; // NumberOfItems(will change later) | |
87 | 7814 gui_mch_getmouse(&x, &y); |
7 | 7815 if (initX == 0xffffL) |
87 | 7816 *p++ = PixelToDialogX(x); // x |
7 | 7817 else |
7818 *p++ = PixelToDialogX(initX); // x | |
7819 if (initY == 0xffffL) | |
87 | 7820 *p++ = PixelToDialogY(y); // y |
7 | 7821 else |
7822 *p++ = PixelToDialogY(initY); // y | |
7823 *p++ = PixelToDialogX(dlgwidth); // cx | |
7824 ptrueheight = p; | |
7825 *p++ = 0; // dialog height: changed later anyway | |
7826 *p++ = 0; // Menu | |
7827 *p++ = 0; // Class | |
7828 | |
7829 /* copy the title of the dialog */ | |
7830 nchar = nCopyAnsiToWideChar(p, ((*title) | |
7831 ? (LPSTR)title | |
7832 : (LPSTR)("Vim "VIM_VERSION_MEDIUM))); | |
7833 p += nchar; | |
7834 | |
7835 if (s_usenewlook) | |
7836 { | |
7837 /* do the font, since DS_3DLOOK doesn't work properly */ | |
7838 #ifdef USE_SYSMENU_FONT | |
7839 if (use_lfSysmenu) | |
7840 { | |
7841 /* point size */ | |
7842 *p++ = -MulDiv(lfSysmenu.lfHeight, 72, | |
7843 GetDeviceCaps(hdc, LOGPIXELSY)); | |
7844 nchar = nCopyAnsiToWideChar(p, TEXT(lfSysmenu.lfFaceName)); | |
7845 } | |
7846 else | |
7847 #endif | |
7848 { | |
7849 *p++ = DLG_FONT_POINT_SIZE; // point size | |
7850 nchar = nCopyAnsiToWideChar (p, TEXT(DLG_FONT_NAME)); | |
7851 } | |
7852 p += nchar; | |
7853 } | |
7854 | |
7855 /* | |
7856 * Loop over all the items in the menu. | |
7857 * But skip over the tearbar. | |
7858 */ | |
7859 if (STRCMP(menu->children->name, TEAR_STRING) == 0) | |
7860 menu = menu->children->next; | |
7861 else | |
7862 menu = menu->children; | |
7863 for ( ; menu != NULL; menu = menu->next) | |
7864 { | |
7865 if (menu->modes == 0) /* this menu has just been deleted */ | |
7866 continue; | |
7867 if (menu_is_separator(menu->dname)) | |
7868 { | |
7869 sepPadding += 3; | |
7870 continue; | |
7871 } | |
7872 | |
7873 /* Check if there still is plenty of room in the template. Make it | |
7874 * larger when needed. */ | |
7875 if (((char *)p - (char *)pdlgtemplate) + 1000 > template_len) | |
7876 { | |
7877 WORD *newp; | |
7878 | |
7879 newp = (WORD *)LocalAlloc(LPTR, template_len + 4096); | |
7880 if (newp != NULL) | |
7881 { | |
7882 template_len += 4096; | |
7883 mch_memmove(newp, pdlgtemplate, | |
7884 (char *)p - (char *)pdlgtemplate); | |
7885 p = newp + (p - pdlgtemplate); | |
7886 pnumitems = newp + (pnumitems - pdlgtemplate); | |
7887 ptrueheight = newp + (ptrueheight - pdlgtemplate); | |
7888 LocalFree(LocalHandle(pdlgtemplate)); | |
7889 pdlgtemplate = newp; | |
7890 } | |
7891 } | |
7892 | |
7893 /* Figure out minimal length of this menu label. Use "name" for the | |
7894 * actual text, "dname" for estimating the displayed size. "name" | |
7895 * has "&a" for mnemonic and includes the accelerator. */ | |
7896 len = nameLen = (int)STRLEN(menu->name); | |
7897 padding0 = (columnWidths[0] - GetTextWidthEnc(hdc, menu->dname, | |
7898 (int)STRLEN(menu->dname))) / spaceWidth; | |
7899 len += padding0; | |
7900 | |
7901 if (menu->actext != NULL) | |
7902 { | |
7903 acLen = (int)STRLEN(menu->actext); | |
7904 len += acLen; | |
7905 textWidth = GetTextWidthEnc(hdc, menu->actext, acLen); | |
7906 } | |
7907 else | |
7908 textWidth = 0; | |
7909 padding1 = (columnWidths[1] - textWidth) / spaceWidth; | |
7910 len += padding1; | |
7911 | |
7912 if (menu->children == NULL) | |
7913 { | |
7914 padding2 = submenuWidth / spaceWidth; | |
7915 len += padding2; | |
7916 menuID = (WORD)(menu->id); | |
7917 } | |
7918 else | |
7919 { | |
7920 len += (int)STRLEN(TEAROFF_SUBMENU_LABEL); | |
840 | 7921 menuID = (WORD)((long_u)(menu->submenu_id) | (DWORD)0x8000); |
7 | 7922 } |
7923 | |
7924 /* Allocate menu label and fill it in */ | |
7925 text = label = alloc((unsigned)len + 1); | |
7926 if (label == NULL) | |
7927 break; | |
7928 | |
419 | 7929 vim_strncpy(text, menu->name, nameLen); |
7 | 7930 text = vim_strchr(text, TAB); /* stop at TAB before actext */ |
7931 if (text == NULL) | |
7932 text = label + nameLen; /* no actext, use whole name */ | |
7933 while (padding0-- > 0) | |
7934 *text++ = ' '; | |
7935 if (menu->actext != NULL) | |
7936 { | |
7937 STRNCPY(text, menu->actext, acLen); | |
7938 text += acLen; | |
7939 } | |
7940 while (padding1-- > 0) | |
7941 *text++ = ' '; | |
7942 if (menu->children != NULL) | |
7943 { | |
7944 STRCPY(text, TEAROFF_SUBMENU_LABEL); | |
7945 text += STRLEN(TEAROFF_SUBMENU_LABEL); | |
7946 } | |
7947 else | |
7948 { | |
7949 while (padding2-- > 0) | |
7950 *text++ = ' '; | |
7951 } | |
7952 *text = NUL; | |
7953 | |
7954 /* | |
7955 * BS_LEFT will just be ignored on Win32s/NT3.5x - on | |
7956 * W95/NT4 it makes the tear-off look more like a menu. | |
7957 */ | |
7958 p = add_dialog_element(p, | |
7959 BS_PUSHBUTTON|BS_LEFT, | |
7960 (WORD)PixelToDialogX(TEAROFF_PADDING_X), | |
7961 (WORD)(sepPadding + 1 + 13 * (*pnumitems)), | |
7962 (WORD)PixelToDialogX(dlgwidth - 2 * TEAROFF_PADDING_X), | |
7963 (WORD)12, | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
7964 menuID, (WORD)0x0080, (char *)label); |
7 | 7965 vim_free(label); |
7966 (*pnumitems)++; | |
7967 } | |
7968 | |
7969 *ptrueheight = (WORD)(sepPadding + 1 + 13 * (*pnumitems)); | |
7970 | |
7971 | |
7972 /* show modelessly */ | |
7973 the_menu->tearoff_handle = CreateDialogIndirect( | |
7974 s_hinst, | |
7975 (LPDLGTEMPLATE)pdlgtemplate, | |
7976 s_hwnd, | |
7977 (DLGPROC)tearoff_callback); | |
7978 | |
7979 LocalFree(LocalHandle(pdlgtemplate)); | |
7980 SelectFont(hdc, oldFont); | |
7981 DeleteObject(font); | |
7982 ReleaseDC(hwnd, hdc); | |
7983 | |
7984 /* | |
7985 * Reassert ourselves as the active window. This is so that after creating | |
7986 * a tearoff, the user doesn't have to click with the mouse just to start | |
7987 * typing again! | |
7988 */ | |
7989 (void)SetActiveWindow(s_hwnd); | |
7990 | |
7991 /* make sure the right buttons are enabled */ | |
7992 force_menu_update = TRUE; | |
7993 } | |
7994 #endif | |
7995 | |
7996 #if defined(FEAT_TOOLBAR) || defined(PROTO) | |
7997 #include "gui_w32_rc.h" | |
7998 | |
7999 /* This not defined in older SDKs */ | |
8000 # ifndef TBSTYLE_FLAT | |
8001 # define TBSTYLE_FLAT 0x0800 | |
8002 # endif | |
8003 | |
8004 /* | |
8005 * Create the toolbar, initially unpopulated. | |
8006 * (just like the menu, there are no defaults, it's all | |
8007 * set up through menu.vim) | |
8008 */ | |
8009 static void | |
8010 initialise_toolbar(void) | |
8011 { | |
8012 InitCommonControls(); | |
8013 s_toolbarhwnd = CreateToolbarEx( | |
8014 s_hwnd, | |
8015 WS_CHILD | TBSTYLE_TOOLTIPS | TBSTYLE_FLAT, | |
8016 4000, //any old big number | |
1213 | 8017 31, //number of images in initial bitmap |
7 | 8018 s_hinst, |
8019 IDR_TOOLBAR1, // id of initial bitmap | |
8020 NULL, | |
8021 0, // initial number of buttons | |
8022 TOOLBAR_BUTTON_WIDTH, //api guide is wrong! | |
8023 TOOLBAR_BUTTON_HEIGHT, | |
8024 TOOLBAR_BUTTON_WIDTH, | |
8025 TOOLBAR_BUTTON_HEIGHT, | |
8026 sizeof(TBBUTTON) | |
8027 ); | |
5223
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8028 s_toolbar_wndproc = SubclassWindow(s_toolbarhwnd, toolbar_wndproc); |
7 | 8029 |
8030 gui_mch_show_toolbar(vim_strchr(p_go, GO_TOOLBAR) != NULL); | |
8031 } | |
8032 | |
5223
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8033 static LRESULT CALLBACK |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8034 toolbar_wndproc( |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8035 HWND hwnd, |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8036 UINT uMsg, |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8037 WPARAM wParam, |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8038 LPARAM lParam) |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8039 { |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8040 HandleMouseHide(uMsg, lParam); |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8041 return CallWindowProc(s_toolbar_wndproc, hwnd, uMsg, wParam, lParam); |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8042 } |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8043 |
7 | 8044 static int |
8045 get_toolbar_bitmap(vimmenu_T *menu) | |
8046 { | |
8047 int i = -1; | |
8048 | |
8049 /* | |
8050 * Check user bitmaps first, unless builtin is specified. | |
8051 */ | |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
8052 if (!menu->icon_builtin) |
7 | 8053 { |
8054 char_u fname[MAXPATHL]; | |
8055 HANDLE hbitmap = NULL; | |
8056 | |
8057 if (menu->iconfile != NULL) | |
8058 { | |
8059 gui_find_iconfile(menu->iconfile, fname, "bmp"); | |
8060 hbitmap = LoadImage( | |
8061 NULL, | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8062 (LPCSTR)fname, |
7 | 8063 IMAGE_BITMAP, |
8064 TOOLBAR_BUTTON_WIDTH, | |
8065 TOOLBAR_BUTTON_HEIGHT, | |
8066 LR_LOADFROMFILE | | |
8067 LR_LOADMAP3DCOLORS | |
8068 ); | |
8069 } | |
8070 | |
8071 /* | |
8072 * If the LoadImage call failed, or the "icon=" file | |
8073 * didn't exist or wasn't specified, try the menu name | |
8074 */ | |
8075 if (hbitmap == NULL | |
5020
5eff37e92f03
updated for version 7.3.1254
Bram Moolenaar <bram@vim.org>
parents:
5016
diff
changeset
|
8076 && (gui_find_bitmap( |
5eff37e92f03
updated for version 7.3.1254
Bram Moolenaar <bram@vim.org>
parents:
5016
diff
changeset
|
8077 #ifdef FEAT_MULTI_LANG |
5eff37e92f03
updated for version 7.3.1254
Bram Moolenaar <bram@vim.org>
parents:
5016
diff
changeset
|
8078 menu->en_dname != NULL ? menu->en_dname : |
5eff37e92f03
updated for version 7.3.1254
Bram Moolenaar <bram@vim.org>
parents:
5016
diff
changeset
|
8079 #endif |
5eff37e92f03
updated for version 7.3.1254
Bram Moolenaar <bram@vim.org>
parents:
5016
diff
changeset
|
8080 menu->dname, fname, "bmp") == OK)) |
7 | 8081 hbitmap = LoadImage( |
8082 NULL, | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8083 (LPCSTR)fname, |
7 | 8084 IMAGE_BITMAP, |
8085 TOOLBAR_BUTTON_WIDTH, | |
8086 TOOLBAR_BUTTON_HEIGHT, | |
8087 LR_LOADFROMFILE | | |
8088 LR_LOADMAP3DCOLORS | |
8089 ); | |
8090 | |
8091 if (hbitmap != NULL) | |
8092 { | |
8093 TBADDBITMAP tbAddBitmap; | |
8094 | |
8095 tbAddBitmap.hInst = NULL; | |
840 | 8096 tbAddBitmap.nID = (long_u)hbitmap; |
7 | 8097 |
8098 i = (int)SendMessage(s_toolbarhwnd, TB_ADDBITMAP, | |
8099 (WPARAM)1, (LPARAM)&tbAddBitmap); | |
8100 /* i will be set to -1 if it fails */ | |
8101 } | |
8102 } | |
8103 if (i == -1 && menu->iconidx >= 0 && menu->iconidx < TOOLBAR_BITMAP_COUNT) | |
8104 i = menu->iconidx; | |
8105 | |
8106 return i; | |
8107 } | |
8108 #endif | |
8109 | |
810 | 8110 #if defined(FEAT_GUI_TABLINE) || defined(PROTO) |
8111 static void | |
8112 initialise_tabline(void) | |
8113 { | |
8114 InitCommonControls(); | |
8115 | |
819 | 8116 s_tabhwnd = CreateWindow(WC_TABCONTROL, "Vim tabline", |
840 | 8117 WS_CHILD|TCS_FOCUSNEVER|TCS_TOOLTIPS, |
810 | 8118 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, |
8119 CW_USEDEFAULT, s_hwnd, NULL, s_hinst, NULL); | |
5223
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8120 s_tabline_wndproc = SubclassWindow(s_tabhwnd, tabline_wndproc); |
819 | 8121 |
843 | 8122 gui.tabline_height = TABLINE_HEIGHT; |
8123 | |
819 | 8124 # ifdef USE_SYSMENU_FONT |
843 | 8125 set_tabline_font(); |
819 | 8126 # endif |
810 | 8127 } |
5223
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8128 |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8129 static LRESULT CALLBACK |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8130 tabline_wndproc( |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8131 HWND hwnd, |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8132 UINT uMsg, |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8133 WPARAM wParam, |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8134 LPARAM lParam) |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8135 { |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8136 HandleMouseHide(uMsg, lParam); |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8137 return CallWindowProc(s_tabline_wndproc, hwnd, uMsg, wParam, lParam); |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8138 } |
810 | 8139 #endif |
8140 | |
7 | 8141 #if defined(FEAT_OLE) || defined(FEAT_EVAL) || defined(PROTO) |
8142 /* | |
8143 * Make the GUI window come to the foreground. | |
8144 */ | |
8145 void | |
8146 gui_mch_set_foreground(void) | |
8147 { | |
8148 if (IsIconic(s_hwnd)) | |
8149 SendMessage(s_hwnd, WM_SYSCOMMAND, SC_RESTORE, 0); | |
8150 SetForegroundWindow(s_hwnd); | |
8151 } | |
8152 #endif | |
8153 | |
8154 #if defined(FEAT_MBYTE_IME) && defined(DYNAMIC_IME) | |
8155 static void | |
8156 dyn_imm_load(void) | |
8157 { | |
2612 | 8158 hLibImm = vimLoadLib("imm32.dll"); |
7 | 8159 if (hLibImm == NULL) |
8160 return; | |
8161 | |
8162 pImmGetCompositionStringA | |
8163 = (void *)GetProcAddress(hLibImm, "ImmGetCompositionStringA"); | |
8164 pImmGetCompositionStringW | |
8165 = (void *)GetProcAddress(hLibImm, "ImmGetCompositionStringW"); | |
8166 pImmGetContext | |
8167 = (void *)GetProcAddress(hLibImm, "ImmGetContext"); | |
8168 pImmAssociateContext | |
8169 = (void *)GetProcAddress(hLibImm, "ImmAssociateContext"); | |
8170 pImmReleaseContext | |
8171 = (void *)GetProcAddress(hLibImm, "ImmReleaseContext"); | |
8172 pImmGetOpenStatus | |
8173 = (void *)GetProcAddress(hLibImm, "ImmGetOpenStatus"); | |
8174 pImmSetOpenStatus | |
8175 = (void *)GetProcAddress(hLibImm, "ImmSetOpenStatus"); | |
8176 pImmGetCompositionFont | |
8177 = (void *)GetProcAddress(hLibImm, "ImmGetCompositionFontA"); | |
8178 pImmSetCompositionFont | |
8179 = (void *)GetProcAddress(hLibImm, "ImmSetCompositionFontA"); | |
8180 pImmSetCompositionWindow | |
8181 = (void *)GetProcAddress(hLibImm, "ImmSetCompositionWindow"); | |
8182 pImmGetConversionStatus | |
8183 = (void *)GetProcAddress(hLibImm, "ImmGetConversionStatus"); | |
777 | 8184 pImmSetConversionStatus |
8185 = (void *)GetProcAddress(hLibImm, "ImmSetConversionStatus"); | |
7 | 8186 |
8187 if ( pImmGetCompositionStringA == NULL | |
8188 || pImmGetCompositionStringW == NULL | |
8189 || pImmGetContext == NULL | |
8190 || pImmAssociateContext == NULL | |
8191 || pImmReleaseContext == NULL | |
8192 || pImmGetOpenStatus == NULL | |
8193 || pImmSetOpenStatus == NULL | |
8194 || pImmGetCompositionFont == NULL | |
8195 || pImmSetCompositionFont == NULL | |
8196 || pImmSetCompositionWindow == NULL | |
777 | 8197 || pImmGetConversionStatus == NULL |
8198 || pImmSetConversionStatus == NULL) | |
7 | 8199 { |
8200 FreeLibrary(hLibImm); | |
8201 hLibImm = NULL; | |
8202 pImmGetContext = NULL; | |
8203 return; | |
8204 } | |
8205 | |
8206 return; | |
8207 } | |
8208 | |
8209 #endif | |
8210 | |
8211 #if defined(FEAT_SIGN_ICONS) || defined(PROTO) | |
8212 | |
8213 # ifdef FEAT_XPM_W32 | |
8214 # define IMAGE_XPM 100 | |
8215 # endif | |
8216 | |
8217 typedef struct _signicon_t | |
8218 { | |
8219 HANDLE hImage; | |
8220 UINT uType; | |
8221 #ifdef FEAT_XPM_W32 | |
8222 HANDLE hShape; /* Mask bitmap handle */ | |
8223 #endif | |
8224 } signicon_t; | |
8225 | |
8226 void | |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8227 gui_mch_drawsign(int row, int col, int typenr) |
7 | 8228 { |
8229 signicon_t *sign; | |
8230 int x, y, w, h; | |
8231 | |
8232 if (!gui.in_use || (sign = (signicon_t *)sign_get_image(typenr)) == NULL) | |
8233 return; | |
8234 | |
8235 x = TEXT_X(col); | |
8236 y = TEXT_Y(row); | |
8237 w = gui.char_width * 2; | |
8238 h = gui.char_height; | |
8239 switch (sign->uType) | |
8240 { | |
8241 case IMAGE_BITMAP: | |
8242 { | |
8243 HDC hdcMem; | |
8244 HBITMAP hbmpOld; | |
8245 | |
8246 hdcMem = CreateCompatibleDC(s_hdc); | |
8247 hbmpOld = (HBITMAP)SelectObject(hdcMem, sign->hImage); | |
8248 BitBlt(s_hdc, x, y, w, h, hdcMem, 0, 0, SRCCOPY); | |
8249 SelectObject(hdcMem, hbmpOld); | |
8250 DeleteDC(hdcMem); | |
8251 } | |
8252 break; | |
8253 case IMAGE_ICON: | |
8254 case IMAGE_CURSOR: | |
8255 DrawIconEx(s_hdc, x, y, (HICON)sign->hImage, w, h, 0, NULL, DI_NORMAL); | |
8256 break; | |
8257 #ifdef FEAT_XPM_W32 | |
8258 case IMAGE_XPM: | |
8259 { | |
8260 HDC hdcMem; | |
8261 HBITMAP hbmpOld; | |
8262 | |
8263 hdcMem = CreateCompatibleDC(s_hdc); | |
8264 hbmpOld = (HBITMAP)SelectObject(hdcMem, sign->hShape); | |
8265 /* Make hole */ | |
8266 BitBlt(s_hdc, x, y, w, h, hdcMem, 0, 0, SRCAND); | |
8267 | |
8268 SelectObject(hdcMem, sign->hImage); | |
8269 /* Paint sign */ | |
8270 BitBlt(s_hdc, x, y, w, h, hdcMem, 0, 0, SRCPAINT); | |
8271 SelectObject(hdcMem, hbmpOld); | |
8272 DeleteDC(hdcMem); | |
8273 } | |
8274 break; | |
8275 #endif | |
8276 } | |
8277 } | |
8278 | |
8279 static void | |
8280 close_signicon_image(signicon_t *sign) | |
8281 { | |
8282 if (sign) | |
8283 switch (sign->uType) | |
8284 { | |
8285 case IMAGE_BITMAP: | |
8286 DeleteObject((HGDIOBJ)sign->hImage); | |
8287 break; | |
8288 case IMAGE_CURSOR: | |
8289 DestroyCursor((HCURSOR)sign->hImage); | |
8290 break; | |
8291 case IMAGE_ICON: | |
8292 DestroyIcon((HICON)sign->hImage); | |
8293 break; | |
8294 #ifdef FEAT_XPM_W32 | |
8295 case IMAGE_XPM: | |
8296 DeleteObject((HBITMAP)sign->hImage); | |
8297 DeleteObject((HBITMAP)sign->hShape); | |
8298 break; | |
8299 #endif | |
8300 } | |
8301 } | |
8302 | |
8303 void * | |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8304 gui_mch_register_sign(char_u *signfile) |
7 | 8305 { |
8306 signicon_t sign, *psign; | |
8307 char_u *ext; | |
8308 | |
8309 sign.hImage = NULL; | |
4352 | 8310 ext = signfile + STRLEN(signfile) - 4; /* get extension */ |
7 | 8311 if (ext > signfile) |
8312 { | |
8313 int do_load = 1; | |
8314 | |
8315 if (!STRICMP(ext, ".bmp")) | |
8316 sign.uType = IMAGE_BITMAP; | |
8317 else if (!STRICMP(ext, ".ico")) | |
8318 sign.uType = IMAGE_ICON; | |
8319 else if (!STRICMP(ext, ".cur") || !STRICMP(ext, ".ani")) | |
8320 sign.uType = IMAGE_CURSOR; | |
8321 else | |
8322 do_load = 0; | |
8323 | |
8324 if (do_load) | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8325 sign.hImage = (HANDLE)LoadImage(NULL, (LPCSTR)signfile, sign.uType, |
7 | 8326 gui.char_width * 2, gui.char_height, |
8327 LR_LOADFROMFILE | LR_CREATEDIBSECTION); | |
8328 #ifdef FEAT_XPM_W32 | |
8329 if (!STRICMP(ext, ".xpm")) | |
8330 { | |
8331 sign.uType = IMAGE_XPM; | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8332 LoadXpmImage((char *)signfile, (HBITMAP *)&sign.hImage, |
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8333 (HBITMAP *)&sign.hShape); |
7 | 8334 } |
8335 #endif | |
8336 } | |
8337 | |
8338 psign = NULL; | |
8339 if (sign.hImage && (psign = (signicon_t *)alloc(sizeof(signicon_t))) | |
8340 != NULL) | |
8341 *psign = sign; | |
8342 | |
8343 if (!psign) | |
8344 { | |
8345 if (sign.hImage) | |
8346 close_signicon_image(&sign); | |
8347 EMSG(_(e_signdata)); | |
8348 } | |
8349 return (void *)psign; | |
8350 | |
8351 } | |
8352 | |
8353 void | |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8354 gui_mch_destroy_sign(void *sign) |
7 | 8355 { |
8356 if (sign) | |
8357 { | |
8358 close_signicon_image((signicon_t *)sign); | |
8359 vim_free(sign); | |
8360 } | |
8361 } | |
293 | 8362 #endif |
7 | 8363 |
8364 #if defined(FEAT_BEVAL) || defined(PROTO) | |
8365 | |
8366 /* BALLOON-EVAL IMPLEMENTATION FOR WINDOWS. | |
148 | 8367 * Added by Sergey Khorev <sergey.khorev@gmail.com> |
7 | 8368 * |
189 | 8369 * The only reused thing is gui_beval.h and get_beval_info() |
7 | 8370 * from gui_beval.c (note it uses x and y of the BalloonEval struct |
8371 * to get current mouse position). | |
8372 * | |
8373 * Trying to use as more Windows services as possible, and as less | |
8374 * IE version as possible :)). | |
8375 * | |
8376 * 1) Don't create ToolTip in gui_mch_create_beval_area, only initialize | |
8377 * BalloonEval struct. | |
8378 * 2) Enable/Disable simply create/kill BalloonEval Timer | |
8379 * 3) When there was enough inactivity, timer procedure posts | |
8380 * async request to debugger | |
8381 * 4) gui_mch_post_balloon (invoked from netbeans.c) creates tooltip control | |
8382 * and performs some actions to show it ASAP | |
1621 | 8383 * 5) WM_NOTIFY:TTN_POP destroys created tooltip |
7 | 8384 */ |
8385 | |
435 | 8386 /* |
8387 * determine whether installed Common Controls support multiline tooltips | |
8388 * (i.e. their version is >= 4.70 | |
8389 */ | |
8390 int | |
8391 multiline_balloon_available(void) | |
8392 { | |
8393 HINSTANCE hDll; | |
8394 static char comctl_dll[] = "comctl32.dll"; | |
8395 static int multiline_tip = MAYBE; | |
8396 | |
8397 if (multiline_tip != MAYBE) | |
8398 return multiline_tip; | |
8399 | |
8400 hDll = GetModuleHandle(comctl_dll); | |
8401 if (hDll != NULL) | |
8402 { | |
856 | 8403 DLLGETVERSIONPROC pGetVer; |
8404 pGetVer = (DLLGETVERSIONPROC)GetProcAddress(hDll, "DllGetVersion"); | |
8405 | |
8406 if (pGetVer != NULL) | |
8407 { | |
8408 DLLVERSIONINFO dvi; | |
8409 HRESULT hr; | |
8410 | |
8411 ZeroMemory(&dvi, sizeof(dvi)); | |
8412 dvi.cbSize = sizeof(dvi); | |
8413 | |
8414 hr = (*pGetVer)(&dvi); | |
8415 | |
8416 if (SUCCEEDED(hr) | |
435 | 8417 && (dvi.dwMajorVersion > 4 |
856 | 8418 || (dvi.dwMajorVersion == 4 |
8419 && dvi.dwMinorVersion >= 70))) | |
435 | 8420 { |
8421 multiline_tip = TRUE; | |
8422 return multiline_tip; | |
8423 } | |
856 | 8424 } |
435 | 8425 else |
8426 { | |
8427 /* there is chance we have ancient CommCtl 4.70 | |
8428 which doesn't export DllGetVersion */ | |
8429 DWORD dwHandle = 0; | |
8430 DWORD len = GetFileVersionInfoSize(comctl_dll, &dwHandle); | |
8431 if (len > 0) | |
8432 { | |
8433 VS_FIXEDFILEINFO *ver; | |
8434 UINT vlen = 0; | |
8435 void *data = alloc(len); | |
8436 | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8437 if ((data != NULL |
435 | 8438 && GetFileVersionInfo(comctl_dll, 0, len, data) |
8439 && VerQueryValue(data, "\\", (void **)&ver, &vlen) | |
8440 && vlen | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8441 && HIWORD(ver->dwFileVersionMS) > 4) |
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8442 || ((HIWORD(ver->dwFileVersionMS) == 4 |
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8443 && LOWORD(ver->dwFileVersionMS) >= 70))) |
435 | 8444 { |
8445 vim_free(data); | |
8446 multiline_tip = TRUE; | |
8447 return multiline_tip; | |
8448 } | |
8449 vim_free(data); | |
8450 } | |
8451 } | |
8452 } | |
8453 multiline_tip = FALSE; | |
8454 return multiline_tip; | |
8455 } | |
8456 | |
7 | 8457 static void |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8458 make_tooltip(BalloonEval *beval, char *text, POINT pt) |
7 | 8459 { |
435 | 8460 TOOLINFO *pti; |
8461 int ToolInfoSize; | |
8462 | |
8463 if (multiline_balloon_available() == TRUE) | |
8464 ToolInfoSize = sizeof(TOOLINFO_NEW); | |
8465 else | |
8466 ToolInfoSize = sizeof(TOOLINFO); | |
8467 | |
8468 pti = (TOOLINFO *)alloc(ToolInfoSize); | |
8469 if (pti == NULL) | |
8470 return; | |
7 | 8471 |
8472 beval->balloon = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, | |
8473 NULL, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, | |
8474 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, | |
8475 beval->target, NULL, s_hinst, NULL); | |
8476 | |
8477 SetWindowPos(beval->balloon, HWND_TOPMOST, 0, 0, 0, 0, | |
8478 SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); | |
8479 | |
435 | 8480 pti->cbSize = ToolInfoSize; |
8481 pti->uFlags = TTF_SUBCLASS; | |
8482 pti->hwnd = beval->target; | |
8483 pti->hinst = 0; /* Don't use string resources */ | |
8484 pti->uId = ID_BEVAL_TOOLTIP; | |
8485 | |
8486 if (multiline_balloon_available() == TRUE) | |
8487 { | |
8488 RECT rect; | |
8489 TOOLINFO_NEW *ptin = (TOOLINFO_NEW *)pti; | |
8490 pti->lpszText = LPSTR_TEXTCALLBACK; | |
8491 ptin->lParam = (LPARAM)text; | |
8492 if (GetClientRect(s_textArea, &rect)) /* switch multiline tooltips on */ | |
8493 SendMessage(beval->balloon, TTM_SETMAXTIPWIDTH, 0, | |
8494 (LPARAM)rect.right); | |
8495 } | |
8496 else | |
8497 pti->lpszText = text; /* do this old way */ | |
7 | 8498 |
8499 /* Limit ballooneval bounding rect to CursorPos neighbourhood */ | |
435 | 8500 pti->rect.left = pt.x - 3; |
8501 pti->rect.top = pt.y - 3; | |
8502 pti->rect.right = pt.x + 3; | |
8503 pti->rect.bottom = pt.y + 3; | |
8504 | |
8505 SendMessage(beval->balloon, TTM_ADDTOOL, 0, (LPARAM)pti); | |
7 | 8506 /* Make tooltip appear sooner */ |
8507 SendMessage(beval->balloon, TTM_SETDELAYTIME, TTDT_INITIAL, 10); | |
1489 | 8508 /* I've performed some tests and it seems the longest possible life time |
8509 * of tooltip is 30 seconds */ | |
8510 SendMessage(beval->balloon, TTM_SETDELAYTIME, TTDT_AUTOPOP, 30000); | |
7 | 8511 /* |
8512 * HACK: force tooltip to appear, because it'll not appear until | |
8513 * first mouse move. D*mn M$ | |
1489 | 8514 * Amazingly moving (2, 2) and then (-1, -1) the mouse doesn't move. |
7 | 8515 */ |
1489 | 8516 mouse_event(MOUSEEVENTF_MOVE, 2, 2, 0, 0); |
7 | 8517 mouse_event(MOUSEEVENTF_MOVE, (DWORD)-1, (DWORD)-1, 0, 0); |
435 | 8518 vim_free(pti); |
7 | 8519 } |
8520 | |
8521 static void | |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8522 delete_tooltip(BalloonEval *beval) |
7 | 8523 { |
7056
1ebd7608cfd9
commit https://github.com/vim/vim/commit/8e5f5b47c2198ffa4161c21a4140eaa9bed46f37
Christian Brabandt <cb@256bit.org>
parents:
7032
diff
changeset
|
8524 PostMessage(beval->balloon, WM_CLOSE, 0, 0); |
7 | 8525 } |
8526 | |
323 | 8527 /*ARGSUSED*/ |
7 | 8528 static VOID CALLBACK |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8529 BevalTimerProc( |
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8530 HWND hwnd, |
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8531 UINT uMsg, |
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8532 UINT_PTR idEvent, |
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8533 DWORD dwTime) |
7 | 8534 { |
8535 POINT pt; | |
8536 RECT rect; | |
8537 | |
8538 if (cur_beval == NULL || cur_beval->showState == ShS_SHOWING || !p_beval) | |
8539 return; | |
8540 | |
8541 GetCursorPos(&pt); | |
8542 if (WindowFromPoint(pt) != s_textArea) | |
8543 return; | |
8544 | |
8545 ScreenToClient(s_textArea, &pt); | |
8546 GetClientRect(s_textArea, &rect); | |
8547 if (!PtInRect(&rect, pt)) | |
8548 return; | |
8549 | |
8550 if (LastActivity > 0 | |
8551 && (dwTime - LastActivity) >= (DWORD)p_bdlay | |
8552 && (cur_beval->showState != ShS_PENDING | |
8553 || abs(cur_beval->x - pt.x) > 3 | |
8554 || abs(cur_beval->y - pt.y) > 3)) | |
8555 { | |
8556 /* Pointer resting in one place long enough, it's time to show | |
8557 * the tooltip. */ | |
8558 cur_beval->showState = ShS_PENDING; | |
8559 cur_beval->x = pt.x; | |
8560 cur_beval->y = pt.y; | |
8561 | |
205 | 8562 // TRACE0("BevalTimerProc: sending request"); |
7 | 8563 |
8564 if (cur_beval->msgCB != NULL) | |
8565 (*cur_beval->msgCB)(cur_beval, 0); | |
8566 } | |
8567 } | |
8568 | |
323 | 8569 /*ARGSUSED*/ |
7 | 8570 void |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8571 gui_mch_disable_beval_area(BalloonEval *beval) |
7 | 8572 { |
205 | 8573 // TRACE0("gui_mch_disable_beval_area {{{"); |
7 | 8574 KillTimer(s_textArea, BevalTimerId); |
205 | 8575 // TRACE0("gui_mch_disable_beval_area }}}"); |
7 | 8576 } |
8577 | |
323 | 8578 /*ARGSUSED*/ |
7 | 8579 void |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8580 gui_mch_enable_beval_area(BalloonEval *beval) |
7 | 8581 { |
205 | 8582 // TRACE0("gui_mch_enable_beval_area |||"); |
7 | 8583 if (beval == NULL) |
8584 return; | |
205 | 8585 // TRACE0("gui_mch_enable_beval_area {{{"); |
2224
a0cce15dd2a9
Fix definition of UINT_PTR for 64 bit systems.
Bram Moolenaar <bram@vim.org>
parents:
2217
diff
changeset
|
8586 BevalTimerId = SetTimer(s_textArea, 0, (UINT)(p_bdlay / 2), BevalTimerProc); |
205 | 8587 // TRACE0("gui_mch_enable_beval_area }}}"); |
7 | 8588 } |
8589 | |
8590 void | |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8591 gui_mch_post_balloon(BalloonEval *beval, char_u *mesg) |
7 | 8592 { |
8593 POINT pt; | |
205 | 8594 // TRACE0("gui_mch_post_balloon {{{"); |
7 | 8595 if (beval->showState == ShS_SHOWING) |
8596 return; | |
8597 GetCursorPos(&pt); | |
8598 ScreenToClient(s_textArea, &pt); | |
8599 | |
8600 if (abs(beval->x - pt.x) < 3 && abs(beval->y - pt.y) < 3) | |
8601 /* cursor is still here */ | |
8602 { | |
8603 gui_mch_disable_beval_area(cur_beval); | |
8604 beval->showState = ShS_SHOWING; | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8605 make_tooltip(beval, (char *)mesg, pt); |
7 | 8606 } |
205 | 8607 // TRACE0("gui_mch_post_balloon }}}"); |
7 | 8608 } |
8609 | |
344 | 8610 /*ARGSUSED*/ |
7 | 8611 BalloonEval * |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8612 gui_mch_create_beval_area( |
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8613 void *target, /* ignored, always use s_textArea */ |
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8614 char_u *mesg, |
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8615 void (*mesgCB)(BalloonEval *, int), |
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8616 void *clientData) |
7 | 8617 { |
8618 /* partially stolen from gui_beval.c */ | |
8619 BalloonEval *beval; | |
8620 | |
8621 if (mesg != NULL && mesgCB != NULL) | |
8622 { | |
8623 EMSG(_("E232: Cannot create BalloonEval with both message and callback")); | |
8624 return NULL; | |
8625 } | |
8626 | |
8627 beval = (BalloonEval *)alloc(sizeof(BalloonEval)); | |
8628 if (beval != NULL) | |
8629 { | |
8630 beval->target = s_textArea; | |
8631 beval->balloon = NULL; | |
8632 | |
8633 beval->showState = ShS_NEUTRAL; | |
8634 beval->x = 0; | |
8635 beval->y = 0; | |
8636 beval->msg = mesg; | |
8637 beval->msgCB = mesgCB; | |
8638 beval->clientData = clientData; | |
8639 | |
8640 InitCommonControls(); | |
8641 cur_beval = beval; | |
8642 | |
8643 if (p_beval) | |
8644 gui_mch_enable_beval_area(beval); | |
8645 | |
8646 } | |
8647 return beval; | |
8648 } | |
8649 | |
323 | 8650 /*ARGSUSED*/ |
7 | 8651 static void |
2217
120502692d82
Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents:
2210
diff
changeset
|
8652 Handle_WM_Notify(HWND hwnd, LPNMHDR pnmh) |
7 | 8653 { |
8654 if (pnmh->idFrom != ID_BEVAL_TOOLTIP) /* it is not our tooltip */ | |
8655 return; | |
8656 | |
8657 if (cur_beval != NULL) | |
8658 { | |
435 | 8659 switch (pnmh->code) |
7 | 8660 { |
435 | 8661 case TTN_SHOW: |
205 | 8662 // TRACE0("TTN_SHOW {{{"); |
8663 // TRACE0("TTN_SHOW }}}"); | |
435 | 8664 break; |
8665 case TTN_POP: /* Before tooltip disappear */ | |
205 | 8666 // TRACE0("TTN_POP {{{"); |
7 | 8667 delete_tooltip(cur_beval); |
8668 gui_mch_enable_beval_area(cur_beval); | |
205 | 8669 // TRACE0("TTN_POP }}}"); |
7 | 8670 |
8671 cur_beval->showState = ShS_NEUTRAL; | |
435 | 8672 break; |
8673 case TTN_GETDISPINFO: | |
1481 | 8674 { |
8675 /* if you get there then we have new common controls */ | |
8676 NMTTDISPINFO_NEW *info = (NMTTDISPINFO_NEW *)pnmh; | |
8677 info->lpszText = (LPSTR)info->lParam; | |
8678 info->uFlags |= TTF_DI_SETITEM; | |
8679 } | |
435 | 8680 break; |
7 | 8681 } |
8682 } | |
8683 } | |
8684 | |
8685 static void | |
8686 TrackUserActivity(UINT uMsg) | |
8687 { | |
8688 if ((uMsg >= WM_MOUSEFIRST && uMsg <= WM_MOUSELAST) | |
8689 || (uMsg >= WM_KEYFIRST && uMsg <= WM_KEYLAST)) | |
8690 LastActivity = GetTickCount(); | |
8691 } | |
8692 | |
8693 void | |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8694 gui_mch_destroy_beval_area(BalloonEval *beval) |
7 | 8695 { |
8696 vim_free(beval); | |
8697 } | |
8698 #endif /* FEAT_BEVAL */ | |
8699 | |
8700 #if defined(FEAT_NETBEANS_INTG) || defined(PROTO) | |
8701 /* | |
8702 * We have multiple signs to draw at the same location. Draw the | |
8703 * multi-sign indicator (down-arrow) instead. This is the Win32 version. | |
8704 */ | |
8705 void | |
8706 netbeans_draw_multisign_indicator(int row) | |
8707 { | |
8708 int i; | |
8709 int y; | |
8710 int x; | |
8711 | |
2210 | 8712 if (!netbeans_active()) |
2311
ccda151dde4e
Support completion for ":find". (Nazri Ramliy)
Bram Moolenaar <bram@vim.org>
parents:
2224
diff
changeset
|
8713 return; |
2210 | 8714 |
7 | 8715 x = 0; |
8716 y = TEXT_Y(row); | |
8717 | |
8718 for (i = 0; i < gui.char_height - 3; i++) | |
8719 SetPixel(s_hdc, x+2, y++, gui.currFgColor); | |
8720 | |
8721 SetPixel(s_hdc, x+0, y, gui.currFgColor); | |
8722 SetPixel(s_hdc, x+2, y, gui.currFgColor); | |
8723 SetPixel(s_hdc, x+4, y++, gui.currFgColor); | |
8724 SetPixel(s_hdc, x+1, y, gui.currFgColor); | |
8725 SetPixel(s_hdc, x+2, y, gui.currFgColor); | |
8726 SetPixel(s_hdc, x+3, y++, gui.currFgColor); | |
8727 SetPixel(s_hdc, x+2, y, gui.currFgColor); | |
8728 } | |
7743
6069f43cea4e
commit https://github.com/vim/vim/commit/e0874f8cbcddfcf9965a85ba35199964efb1d01a
Christian Brabandt <cb@256bit.org>
parents:
7560
diff
changeset
|
8729 #endif |