Mercurial > vim
annotate src/gui_w32.c @ 28398:8b474e8eff92
Added tag v8.2.4723 for changeset d1702731786c29d2e83cc29e903118be6d76c72d
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 09 Apr 2022 19:30:03 +0200 |
parents | b4ef8f851be4 |
children | 29b30e2376fe |
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; | |
13028
cfce9ac1d1e8
patch 8.0.1390: DirectX scrolling can be slow, vertical positioning is off
Christian Brabandt <cb@256bit.org>
parents:
12994
diff
changeset
|
36 # define IS_ENABLE_DIRECTX() (s_directx_enabled && s_dwc != NULL && enc_utf8) |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
37 static int directx_enabled(void); |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
38 static void directx_binddc(void); |
6359 | 39 #endif |
40 | |
8138
f52504c10387
commit https://github.com/vim/vim/commit/065bbac8adfe29a09958570237d223457f235c6c
Christian Brabandt <cb@256bit.org>
parents:
8108
diff
changeset
|
41 #ifdef FEAT_MENU |
f52504c10387
commit https://github.com/vim/vim/commit/065bbac8adfe29a09958570237d223457f235c6c
Christian Brabandt <cb@256bit.org>
parents:
8108
diff
changeset
|
42 static int gui_mswin_get_menu_height(int fix_window); |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
43 #else |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
44 # define gui_mswin_get_menu_height(fix_window) 0 |
8138
f52504c10387
commit https://github.com/vim/vim/commit/065bbac8adfe29a09958570237d223457f235c6c
Christian Brabandt <cb@256bit.org>
parents:
8108
diff
changeset
|
45 #endif |
f52504c10387
commit https://github.com/vim/vim/commit/065bbac8adfe29a09958570237d223457f235c6c
Christian Brabandt <cb@256bit.org>
parents:
8108
diff
changeset
|
46 |
6110 | 47 #if defined(FEAT_RENDER_OPTIONS) || defined(PROTO) |
48 int | |
49 gui_mch_set_rendering_options(char_u *s) | |
50 { | |
13028
cfce9ac1d1e8
patch 8.0.1390: DirectX scrolling can be slow, vertical positioning is off
Christian Brabandt <cb@256bit.org>
parents:
12994
diff
changeset
|
51 # ifdef FEAT_DIRECTX |
6110 | 52 char_u *p, *q; |
53 | |
54 int dx_enable = 0; | |
55 int dx_flags = 0; | |
56 float dx_gamma = 0.0f; | |
57 float dx_contrast = 0.0f; | |
58 float dx_level = 0.0f; | |
59 int dx_geom = 0; | |
60 int dx_renmode = 0; | |
61 int dx_taamode = 0; | |
62 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
63 // parse string as rendering options. |
6110 | 64 for (p = s; p != NULL && *p != NUL; ) |
65 { | |
66 char_u item[256]; | |
67 char_u name[128]; | |
68 char_u value[128]; | |
69 | |
7009 | 70 copy_option_part(&p, item, sizeof(item), ","); |
6110 | 71 if (p == NULL) |
72 break; | |
73 q = &item[0]; | |
74 copy_option_part(&q, name, sizeof(name), ":"); | |
75 if (q == NULL) | |
76 return FAIL; | |
77 copy_option_part(&q, value, sizeof(value), ":"); | |
78 | |
79 if (STRCMP(name, "type") == 0) | |
80 { | |
81 if (STRCMP(value, "directx") == 0) | |
82 dx_enable = 1; | |
83 else | |
84 return FAIL; | |
85 } | |
86 else if (STRCMP(name, "gamma") == 0) | |
87 { | |
88 dx_flags |= 1 << 0; | |
8108
50515f2e81d1
commit https://github.com/vim/vim/commit/7f0608fb5219645d776fadfe13efb867c2460698
Christian Brabandt <cb@256bit.org>
parents:
8102
diff
changeset
|
89 dx_gamma = (float)atof((char *)value); |
6110 | 90 } |
91 else if (STRCMP(name, "contrast") == 0) | |
92 { | |
93 dx_flags |= 1 << 1; | |
8108
50515f2e81d1
commit https://github.com/vim/vim/commit/7f0608fb5219645d776fadfe13efb867c2460698
Christian Brabandt <cb@256bit.org>
parents:
8102
diff
changeset
|
94 dx_contrast = (float)atof((char *)value); |
6110 | 95 } |
96 else if (STRCMP(name, "level") == 0) | |
97 { | |
98 dx_flags |= 1 << 2; | |
8108
50515f2e81d1
commit https://github.com/vim/vim/commit/7f0608fb5219645d776fadfe13efb867c2460698
Christian Brabandt <cb@256bit.org>
parents:
8102
diff
changeset
|
99 dx_level = (float)atof((char *)value); |
6110 | 100 } |
101 else if (STRCMP(name, "geom") == 0) | |
102 { | |
103 dx_flags |= 1 << 3; | |
8108
50515f2e81d1
commit https://github.com/vim/vim/commit/7f0608fb5219645d776fadfe13efb867c2460698
Christian Brabandt <cb@256bit.org>
parents:
8102
diff
changeset
|
104 dx_geom = atoi((char *)value); |
6110 | 105 if (dx_geom < 0 || dx_geom > 2) |
106 return FAIL; | |
107 } | |
108 else if (STRCMP(name, "renmode") == 0) | |
109 { | |
110 dx_flags |= 1 << 4; | |
8108
50515f2e81d1
commit https://github.com/vim/vim/commit/7f0608fb5219645d776fadfe13efb867c2460698
Christian Brabandt <cb@256bit.org>
parents:
8102
diff
changeset
|
111 dx_renmode = atoi((char *)value); |
6110 | 112 if (dx_renmode < 0 || dx_renmode > 6) |
113 return FAIL; | |
114 } | |
115 else if (STRCMP(name, "taamode") == 0) | |
116 { | |
117 dx_flags |= 1 << 5; | |
8108
50515f2e81d1
commit https://github.com/vim/vim/commit/7f0608fb5219645d776fadfe13efb867c2460698
Christian Brabandt <cb@256bit.org>
parents:
8102
diff
changeset
|
118 dx_taamode = atoi((char *)value); |
6110 | 119 if (dx_taamode < 0 || dx_taamode > 3) |
120 return FAIL; | |
121 } | |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
122 else if (STRCMP(name, "scrlines") == 0) |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
123 { |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
124 // Deprecated. Simply ignore it. |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
125 } |
6110 | 126 else |
127 return FAIL; | |
128 } | |
129 | |
12994
8566eaa08788
patch 8.0.1373: no error when settting 'renderoptions' before starting GUI
Christian Brabandt <cb@256bit.org>
parents:
12986
diff
changeset
|
130 if (!gui.in_use) |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
131 return OK; // only checking the syntax of the value |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
132 |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
133 // Enable DirectX/DirectWrite |
6110 | 134 if (dx_enable) |
135 { | |
136 if (!directx_enabled()) | |
137 return FAIL; | |
138 DWriteContext_SetRenderingParams(s_dwc, NULL); | |
139 if (dx_flags) | |
140 { | |
141 DWriteRenderingParams param; | |
142 DWriteContext_GetRenderingParams(s_dwc, ¶m); | |
143 if (dx_flags & (1 << 0)) | |
144 param.gamma = dx_gamma; | |
145 if (dx_flags & (1 << 1)) | |
146 param.enhancedContrast = dx_contrast; | |
147 if (dx_flags & (1 << 2)) | |
148 param.clearTypeLevel = dx_level; | |
149 if (dx_flags & (1 << 3)) | |
150 param.pixelGeometry = dx_geom; | |
151 if (dx_flags & (1 << 4)) | |
152 param.renderingMode = dx_renmode; | |
153 if (dx_flags & (1 << 5)) | |
154 param.textAntialiasMode = dx_taamode; | |
155 DWriteContext_SetRenderingParams(s_dwc, ¶m); | |
156 } | |
157 } | |
158 s_directx_enabled = dx_enable; | |
159 | |
160 return OK; | |
13028
cfce9ac1d1e8
patch 8.0.1390: DirectX scrolling can be slow, vertical positioning is off
Christian Brabandt <cb@256bit.org>
parents:
12994
diff
changeset
|
161 # else |
6110 | 162 return FAIL; |
13028
cfce9ac1d1e8
patch 8.0.1390: DirectX scrolling can be slow, vertical positioning is off
Christian Brabandt <cb@256bit.org>
parents:
12994
diff
changeset
|
163 # endif |
6110 | 164 } |
165 #endif | |
166 | |
7 | 167 /* |
168 * These are new in Windows ME/XP, only defined in recent compilers. | |
169 */ | |
170 #ifndef HANDLE_WM_XBUTTONUP | |
171 # define HANDLE_WM_XBUTTONUP(hwnd, wParam, lParam, fn) \ | |
172 ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
173 #endif | |
174 #ifndef HANDLE_WM_XBUTTONDOWN | |
175 # define HANDLE_WM_XBUTTONDOWN(hwnd, wParam, lParam, fn) \ | |
176 ((fn)((hwnd), FALSE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
177 #endif | |
178 #ifndef HANDLE_WM_XBUTTONDBLCLK | |
179 # define HANDLE_WM_XBUTTONDBLCLK(hwnd, wParam, lParam, fn) \ | |
180 ((fn)((hwnd), TRUE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
181 #endif | |
182 | |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
183 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
184 #include "version.h" // used by dialog box routine for default title |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
185 #ifdef DEBUG |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
186 # include <tchar.h> |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
187 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
188 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
189 // cproto fails on missing include files |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
190 #ifndef PROTO |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
191 |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
192 # ifndef __MINGW32__ |
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
193 # include <shellapi.h> |
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
194 # endif |
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
195 # if defined(FEAT_TOOLBAR) || defined(FEAT_BEVAL_GUI) || defined(FEAT_GUI_TABLINE) |
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
196 # include <commctrl.h> |
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
197 # endif |
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
198 # include <windowsx.h> |
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
199 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
200 #endif // PROTO |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
201 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
202 #ifdef FEAT_MENU |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
203 # define MENUHINTS // show menu hints in command line |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
204 #endif |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
205 |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
206 // Some parameters for dialog boxes. All in pixels. |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
207 #define DLG_PADDING_X 10 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
208 #define DLG_PADDING_Y 10 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
209 #define DLG_VERT_PADDING_X 4 // For vertical buttons |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
210 #define DLG_VERT_PADDING_Y 4 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
211 #define DLG_ICON_WIDTH 34 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
212 #define DLG_ICON_HEIGHT 34 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
213 #define DLG_MIN_WIDTH 150 |
27322
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
214 #define DLG_FONT_NAME "MS Shell Dlg" |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
215 #define DLG_FONT_POINT_SIZE 8 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
216 #define DLG_MIN_MAX_WIDTH 400 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
217 #define DLG_MIN_MAX_HEIGHT 400 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
218 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
219 #define DLG_NONBUTTON_CONTROL 5000 // First ID of non-button controls |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
220 |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
221 #ifndef WM_DPICHANGED |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
222 # define WM_DPICHANGED 0x02E0 |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
223 #endif |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
224 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
225 #ifdef PROTO |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
226 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
227 * 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
|
228 * 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
|
229 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
230 # define APIENTRY |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
231 # define CALLBACK |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
232 # define CONST |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
233 # define FAR |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
234 # define NEAR |
21361
75514c95b948
patch 8.2.1231: MS-Windows: GUI code can be cleaned up
Bram Moolenaar <Bram@vim.org>
parents:
21355
diff
changeset
|
235 # define WINAPI |
9834
80ace3687eec
commit https://github.com/vim/vim/commit/a6b7a08ae04a3cd4d9c45c906bb7a197e2135179
Christian Brabandt <cb@256bit.org>
parents:
9428
diff
changeset
|
236 # undef _cdecl |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
237 # define _cdecl |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
238 typedef int BOOL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
239 typedef int BYTE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
240 typedef int DWORD; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
241 typedef int WCHAR; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
242 typedef int ENUMLOGFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
243 typedef int FINDREPLACE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
244 typedef int HANDLE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
245 typedef int HBITMAP; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
246 typedef int HBRUSH; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
247 typedef int HDROP; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
248 typedef int INT; |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
249 typedef int LOGFONTW[]; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
250 typedef int LPARAM; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
251 typedef int LPCREATESTRUCT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
252 typedef int LPCSTR; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
253 typedef int LPCTSTR; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
254 typedef int LPRECT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
255 typedef int LPSTR; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
256 typedef int LPWINDOWPOS; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
257 typedef int LPWORD; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
258 typedef int LRESULT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
259 typedef int HRESULT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
260 # undef MSG |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
261 typedef int MSG; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
262 typedef int NEWTEXTMETRIC; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
263 typedef int OSVERSIONINFO; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
264 typedef int PWORD; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
265 typedef int RECT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
266 typedef int UINT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
267 typedef int WORD; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
268 typedef int WPARAM; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
269 typedef int POINT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
270 typedef void *HINSTANCE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
271 typedef void *HMENU; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
272 typedef void *HWND; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
273 typedef void *HDC; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
274 typedef void VOID; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
275 typedef int LPNMHDR; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
276 typedef int LONG; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
277 typedef int WNDPROC; |
9834
80ace3687eec
commit https://github.com/vim/vim/commit/a6b7a08ae04a3cd4d9c45c906bb7a197e2135179
Christian Brabandt <cb@256bit.org>
parents:
9428
diff
changeset
|
278 typedef int UINT_PTR; |
13963 | 279 typedef int COLORREF; |
280 typedef int HCURSOR; | |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
281 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
282 |
27281
f7d73708b391
patch 8.2.4169: MS-Windows: unnessary casts and other minor things
Bram Moolenaar <Bram@vim.org>
parents:
27261
diff
changeset
|
283 static void _OnPaint(HWND hwnd); |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
284 static void fill_rect(const RECT *rcp, HBRUSH hbr, COLORREF color); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
285 static void clear_rect(RECT *rcp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
286 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
287 static WORD s_dlgfntheight; // height of the dialog font |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
288 static WORD s_dlgfntwidth; // width of the dialog font |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
289 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
290 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
291 static HMENU s_menuBar = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
292 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
293 #ifdef FEAT_TEAROFF |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
294 static void rebuild_tearoff(vimmenu_T *menu); |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
295 static HBITMAP s_htearbitmap; // bitmap used to indicate tearoff |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
296 #endif |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
297 |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
298 // Flag that is set while processing a message that must not be interrupted by |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
299 // processing another message. |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
300 static int s_busy_processing = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
301 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
302 static int destroying = FALSE; // call DestroyWindow() ourselves |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
303 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
304 #ifdef MSWIN_FIND_REPLACE |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
305 static UINT s_findrep_msg = 0; |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
306 static FINDREPLACEW s_findrep_struct; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
307 static HWND s_findrep_hwnd = NULL; |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
308 static int s_findrep_is_find; // TRUE for find dialog, FALSE |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
309 // for find/replace dialog |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
310 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
311 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
312 HWND s_hwnd = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
313 static HDC s_hdc = NULL; |
18617
5beda1754026
patch 8.1.2301: MS-Windows GUI: drawing error when background color changes
Bram Moolenaar <Bram@vim.org>
parents:
18526
diff
changeset
|
314 static HBRUSH s_brush = NULL; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
315 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
316 #ifdef FEAT_TOOLBAR |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
317 static HWND s_toolbarhwnd = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
318 static WNDPROC s_toolbar_wndproc = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
319 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
320 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
321 #ifdef FEAT_GUI_TABLINE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
322 static HWND s_tabhwnd = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
323 static WNDPROC s_tabline_wndproc = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
324 static int showing_tabline = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
325 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
326 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
327 static WPARAM s_wParam = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
328 static LPARAM s_lParam = 0; |
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 HWND s_textArea = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
331 static UINT s_uMsg = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
332 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
333 static char_u *s_textfield; // Used by dialogs to pass back strings |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
334 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
335 static int s_need_activate = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
336 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
337 // This variable is set when waiting for an event, which is the only moment |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
338 // scrollbar dragging can be done directly. It's not allowed while commands |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
339 // are executed, because it may move the cursor and that may cause unexpected |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
340 // problems (e.g., while ":s" is working). |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
341 static int allow_scrollbar = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
342 |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
343 #ifndef _DPI_AWARENESS_CONTEXTS_ |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
344 typedef HANDLE DPI_AWARENESS_CONTEXT; |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
345 |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
346 typedef enum DPI_AWARENESS { |
27229
6837d2c14dee
patch 8.2.4143: MS-Windows: IME support for Win9x is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27160
diff
changeset
|
347 DPI_AWARENESS_INVALID = -1, |
6837d2c14dee
patch 8.2.4143: MS-Windows: IME support for Win9x is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27160
diff
changeset
|
348 DPI_AWARENESS_UNAWARE = 0, |
6837d2c14dee
patch 8.2.4143: MS-Windows: IME support for Win9x is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27160
diff
changeset
|
349 DPI_AWARENESS_SYSTEM_AWARE = 1, |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
350 DPI_AWARENESS_PER_MONITOR_AWARE = 2 |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
351 } DPI_AWARENESS; |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
352 |
27229
6837d2c14dee
patch 8.2.4143: MS-Windows: IME support for Win9x is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27160
diff
changeset
|
353 # define DPI_AWARENESS_CONTEXT_UNAWARE ((DPI_AWARENESS_CONTEXT)-1) |
6837d2c14dee
patch 8.2.4143: MS-Windows: IME support for Win9x is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27160
diff
changeset
|
354 # define DPI_AWARENESS_CONTEXT_SYSTEM_AWARE ((DPI_AWARENESS_CONTEXT)-2) |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
355 # define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE ((DPI_AWARENESS_CONTEXT)-3) |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
356 # define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 ((DPI_AWARENESS_CONTEXT)-4) |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
357 # define DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED ((DPI_AWARENESS_CONTEXT)-5) |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
358 #endif |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
359 |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
360 #define DEFAULT_DPI 96 |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
361 static int s_dpi = DEFAULT_DPI; |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
362 static BOOL s_in_dpichanged = FALSE; |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
363 static DPI_AWARENESS s_process_dpi_aware = DPI_AWARENESS_INVALID; |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
364 |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
365 static UINT (WINAPI *pGetDpiForSystem)(void) = NULL; |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
366 static UINT (WINAPI *pGetDpiForWindow)(HWND hwnd) = NULL; |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
367 static int (WINAPI *pGetSystemMetricsForDpi)(int, UINT) = NULL; |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
368 //static INT (WINAPI *pGetWindowDpiAwarenessContext)(HWND hwnd) = NULL; |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
369 static DPI_AWARENESS_CONTEXT (WINAPI *pSetThreadDpiAwarenessContext)(DPI_AWARENESS_CONTEXT dpiContext) = NULL; |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
370 static DPI_AWARENESS (WINAPI *pGetAwarenessFromDpiAwarenessContext)(DPI_AWARENESS_CONTEXT) = NULL; |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
371 |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
372 static UINT WINAPI |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
373 stubGetDpiForSystem(void) |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
374 { |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
375 HWND hwnd = GetDesktopWindow(); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
376 HDC hdc = GetWindowDC(hwnd); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
377 UINT dpi = GetDeviceCaps(hdc, LOGPIXELSY); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
378 ReleaseDC(hwnd, hdc); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
379 return dpi; |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
380 } |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
381 |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
382 static int WINAPI |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
383 stubGetSystemMetricsForDpi(int nIndex, UINT dpi) |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
384 { |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
385 return GetSystemMetrics(nIndex); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
386 } |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
387 |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
388 static int |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
389 adjust_fontsize_by_dpi(int size) |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
390 { |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
391 return size * s_dpi / (int)pGetDpiForSystem(); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
392 } |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
393 |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
394 static int |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
395 adjust_by_system_dpi(int size) |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
396 { |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
397 return size * (int)pGetDpiForSystem() / DEFAULT_DPI; |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
398 } |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
399 |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
400 #if defined(FEAT_DIRECTX) |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
401 static int |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
402 directx_enabled(void) |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
403 { |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
404 if (s_dwc != NULL) |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
405 return 1; |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
406 else if (s_directx_load_attempted) |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
407 return 0; |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
408 // load DirectX |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
409 DWrite_Init(); |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
410 s_directx_load_attempted = 1; |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
411 s_dwc = DWriteContext_Open(); |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
412 directx_binddc(); |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
413 return s_dwc != NULL ? 1 : 0; |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
414 } |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
415 |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
416 static void |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
417 directx_binddc(void) |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
418 { |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
419 if (s_textArea != NULL) |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
420 { |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
421 RECT rect; |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
422 GetClientRect(s_textArea, &rect); |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
423 DWriteContext_BindDC(s_dwc, s_hdc, &rect); |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
424 } |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
425 } |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
426 #endif |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
427 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
428 extern int current_font_height; // this is in os_mswin.c |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
429 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
430 static struct |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
431 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
432 UINT key_sym; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
433 char_u vim_code0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
434 char_u vim_code1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
435 } special_keys[] = |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
436 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
437 {VK_UP, 'k', 'u'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
438 {VK_DOWN, 'k', 'd'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
439 {VK_LEFT, 'k', 'l'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
440 {VK_RIGHT, 'k', 'r'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
441 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
442 {VK_F1, 'k', '1'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
443 {VK_F2, 'k', '2'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
444 {VK_F3, 'k', '3'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
445 {VK_F4, 'k', '4'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
446 {VK_F5, 'k', '5'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
447 {VK_F6, 'k', '6'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
448 {VK_F7, 'k', '7'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
449 {VK_F8, 'k', '8'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
450 {VK_F9, 'k', '9'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
451 {VK_F10, 'k', ';'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
452 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
453 {VK_F11, 'F', '1'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
454 {VK_F12, 'F', '2'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
455 {VK_F13, 'F', '3'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
456 {VK_F14, 'F', '4'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
457 {VK_F15, 'F', '5'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
458 {VK_F16, 'F', '6'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
459 {VK_F17, 'F', '7'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
460 {VK_F18, 'F', '8'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
461 {VK_F19, 'F', '9'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
462 {VK_F20, 'F', 'A'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
463 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
464 {VK_F21, 'F', 'B'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
465 #ifdef FEAT_NETBEANS_INTG |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
466 {VK_PAUSE, 'F', 'B'}, // Pause == F21 (see gui_gtk_x11.c) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
467 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
468 {VK_F22, 'F', 'C'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
469 {VK_F23, 'F', 'D'}, |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
470 {VK_F24, 'F', 'E'}, // winuser.h defines up to F24 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
471 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
472 {VK_HELP, '%', '1'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
473 {VK_BACK, 'k', 'b'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
474 {VK_INSERT, 'k', 'I'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
475 {VK_DELETE, 'k', 'D'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
476 {VK_HOME, 'k', 'h'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
477 {VK_END, '@', '7'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
478 {VK_PRIOR, 'k', 'P'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
479 {VK_NEXT, 'k', 'N'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
480 {VK_PRINT, '%', '9'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
481 {VK_ADD, 'K', '6'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
482 {VK_SUBTRACT, 'K', '7'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
483 {VK_DIVIDE, 'K', '8'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
484 {VK_MULTIPLY, 'K', '9'}, |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
485 {VK_SEPARATOR, 'K', 'A'}, // Keypad Enter |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
486 {VK_DECIMAL, 'K', 'B'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
487 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
488 {VK_NUMPAD0, 'K', 'C'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
489 {VK_NUMPAD1, 'K', 'D'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
490 {VK_NUMPAD2, 'K', 'E'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
491 {VK_NUMPAD3, 'K', 'F'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
492 {VK_NUMPAD4, 'K', 'G'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
493 {VK_NUMPAD5, 'K', 'H'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
494 {VK_NUMPAD6, 'K', 'I'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
495 {VK_NUMPAD7, 'K', 'J'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
496 {VK_NUMPAD8, 'K', 'K'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
497 {VK_NUMPAD9, 'K', 'L'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
498 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
499 // Keys that we want to be able to use any modifier with: |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
500 {VK_SPACE, ' ', NUL}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
501 {VK_TAB, TAB, NUL}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
502 {VK_ESCAPE, ESC, NUL}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
503 {NL, NL, NUL}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
504 {CAR, CAR, NUL}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
505 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
506 // End of list marker: |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
507 {0, 0, 0} |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
508 }; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
509 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
510 // Local variables |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
511 static int s_button_pending = -1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
512 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
513 // s_getting_focus is set when we got focus but didn't see mouse-up event yet, |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
514 // so don't reset s_button_pending. |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
515 static int s_getting_focus = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
516 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
517 static int s_x_pending; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
518 static int s_y_pending; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
519 static UINT s_kFlags_pending; |
27525
27694b525305
patch 8.2.4290: MS-Windows: using type casts for timer IDs
Bram Moolenaar <Bram@vim.org>
parents:
27455
diff
changeset
|
520 static UINT_PTR s_wait_timer = 0; // Timer for get char from user |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
521 static int s_timed_out = FALSE; |
13766
74294f0fbf28
patch 8.0.1755: MS-Windows: high unicode char received as two utf-16 words
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
522 static int dead_key = 0; // 0: no dead key, 1: dead key pressed |
74294f0fbf28
patch 8.0.1755: MS-Windows: high unicode char received as two utf-16 words
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
523 static UINT surrogate_pending_ch = 0; // 0: no surrogate pending, |
74294f0fbf28
patch 8.0.1755: MS-Windows: high unicode char received as two utf-16 words
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
524 // else a high surrogate |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
525 |
12871
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
12802
diff
changeset
|
526 #ifdef FEAT_BEVAL_GUI |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
527 // balloon-eval WM_NOTIFY_HANDLER |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
528 static void Handle_WM_Notify(HWND hwnd, LPNMHDR pnmh); |
27525
27694b525305
patch 8.2.4290: MS-Windows: using type casts for timer IDs
Bram Moolenaar <Bram@vim.org>
parents:
27455
diff
changeset
|
529 static void track_user_activity(UINT uMsg); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
530 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
531 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
532 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
533 * For control IME. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
534 * |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
535 * These LOGFONTW used for IME. |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
536 */ |
27249
d5570658f18d
patch 8.2.4153: MS-Windows: Global IME is no longer supported
Bram Moolenaar <Bram@vim.org>
parents:
27229
diff
changeset
|
537 #ifdef FEAT_MBYTE_IME |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
538 // holds LOGFONTW for 'guifontwide' if available, otherwise 'guifont' |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
539 static LOGFONTW norm_logfont; |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
540 // holds LOGFONTW for 'guifont' always. |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
541 static LOGFONTW sub_logfont; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
542 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
543 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
544 #ifdef FEAT_MBYTE_IME |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
545 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
|
546 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
547 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
548 #if defined(FEAT_BROWSE) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
549 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
|
550 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
551 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
552 #ifdef DEBUG_PRINT_ERROR |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
553 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
554 * 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
|
555 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
556 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
557 print_windows_error(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
558 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
559 LPVOID lpMsgBuf; |
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 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
|
562 NULL, GetLastError(), |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
563 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
564 (LPTSTR) &lpMsgBuf, 0, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
565 TRACE1("Error: %s\n", lpMsgBuf); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
566 LocalFree(lpMsgBuf); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
567 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
568 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
569 |
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 * Cursor blink functions. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
572 * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
573 * This is a simple state machine: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
574 * BLINK_NONE not blinking at all |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
575 * 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
|
576 * BLINK_ON blinking, cursor is shown |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
577 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
578 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
579 #define BLINK_NONE 0 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
580 #define BLINK_OFF 1 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
581 #define BLINK_ON 2 |
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 static int blink_state = BLINK_NONE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
584 static long_u blink_waittime = 700; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
585 static long_u blink_ontime = 400; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
586 static long_u blink_offtime = 250; |
27525
27694b525305
patch 8.2.4290: MS-Windows: using type casts for timer IDs
Bram Moolenaar <Bram@vim.org>
parents:
27455
diff
changeset
|
587 static UINT_PTR blink_timer = 0; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
588 |
9213
bb86514cad15
commit https://github.com/vim/vim/commit/703a8044b5393d37d355b0b1054a9a5a13912a3f
Christian Brabandt <cb@256bit.org>
parents:
9181
diff
changeset
|
589 int |
bb86514cad15
commit https://github.com/vim/vim/commit/703a8044b5393d37d355b0b1054a9a5a13912a3f
Christian Brabandt <cb@256bit.org>
parents:
9181
diff
changeset
|
590 gui_mch_is_blinking(void) |
bb86514cad15
commit https://github.com/vim/vim/commit/703a8044b5393d37d355b0b1054a9a5a13912a3f
Christian Brabandt <cb@256bit.org>
parents:
9181
diff
changeset
|
591 { |
bb86514cad15
commit https://github.com/vim/vim/commit/703a8044b5393d37d355b0b1054a9a5a13912a3f
Christian Brabandt <cb@256bit.org>
parents:
9181
diff
changeset
|
592 return blink_state != BLINK_NONE; |
bb86514cad15
commit https://github.com/vim/vim/commit/703a8044b5393d37d355b0b1054a9a5a13912a3f
Christian Brabandt <cb@256bit.org>
parents:
9181
diff
changeset
|
593 } |
bb86514cad15
commit https://github.com/vim/vim/commit/703a8044b5393d37d355b0b1054a9a5a13912a3f
Christian Brabandt <cb@256bit.org>
parents:
9181
diff
changeset
|
594 |
9428
0c7f47088e55
commit https://github.com/vim/vim/commit/9d5d3c9c4468ad76f16b50eabd3d9e7eab2ed44d
Christian Brabandt <cb@256bit.org>
parents:
9252
diff
changeset
|
595 int |
0c7f47088e55
commit https://github.com/vim/vim/commit/9d5d3c9c4468ad76f16b50eabd3d9e7eab2ed44d
Christian Brabandt <cb@256bit.org>
parents:
9252
diff
changeset
|
596 gui_mch_is_blink_off(void) |
0c7f47088e55
commit https://github.com/vim/vim/commit/9d5d3c9c4468ad76f16b50eabd3d9e7eab2ed44d
Christian Brabandt <cb@256bit.org>
parents:
9252
diff
changeset
|
597 { |
0c7f47088e55
commit https://github.com/vim/vim/commit/9d5d3c9c4468ad76f16b50eabd3d9e7eab2ed44d
Christian Brabandt <cb@256bit.org>
parents:
9252
diff
changeset
|
598 return blink_state == BLINK_OFF; |
0c7f47088e55
commit https://github.com/vim/vim/commit/9d5d3c9c4468ad76f16b50eabd3d9e7eab2ed44d
Christian Brabandt <cb@256bit.org>
parents:
9252
diff
changeset
|
599 } |
0c7f47088e55
commit https://github.com/vim/vim/commit/9d5d3c9c4468ad76f16b50eabd3d9e7eab2ed44d
Christian Brabandt <cb@256bit.org>
parents:
9252
diff
changeset
|
600 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
601 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
602 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
|
603 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
604 blink_waittime = wait; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
605 blink_ontime = on; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
606 blink_offtime = off; |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
609 static VOID CALLBACK |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
610 _OnBlinkTimer( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
611 HWND hwnd, |
10783
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
612 UINT uMsg UNUSED, |
27525
27694b525305
patch 8.2.4290: MS-Windows: using type casts for timer IDs
Bram Moolenaar <Bram@vim.org>
parents:
27455
diff
changeset
|
613 UINT_PTR idEvent, |
10783
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
614 DWORD dwTime UNUSED) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
615 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
616 MSG msg; |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
619 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
|
620 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
621 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
622 KillTimer(NULL, idEvent); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
623 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
624 // Eat spurious WM_TIMER messages |
27283
b4d92a69035b
patch 8.2.4170: MS-Windows: still using old message API calls
Bram Moolenaar <Bram@vim.org>
parents:
27281
diff
changeset
|
625 while (PeekMessageW(&msg, hwnd, WM_TIMER, WM_TIMER, PM_REMOVE)) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
626 ; |
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 if (blink_state == BLINK_ON) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
629 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
630 gui_undraw_cursor(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
631 blink_state = BLINK_OFF; |
27525
27694b525305
patch 8.2.4290: MS-Windows: using type casts for timer IDs
Bram Moolenaar <Bram@vim.org>
parents:
27455
diff
changeset
|
632 blink_timer = SetTimer(NULL, 0, (UINT)blink_offtime, _OnBlinkTimer); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
633 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
634 else |
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 gui_update_cursor(TRUE, FALSE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
637 blink_state = BLINK_ON; |
27525
27694b525305
patch 8.2.4290: MS-Windows: using type casts for timer IDs
Bram Moolenaar <Bram@vim.org>
parents:
27455
diff
changeset
|
638 blink_timer = SetTimer(NULL, 0, (UINT)blink_ontime, _OnBlinkTimer); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
639 } |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
640 gui_mch_flush(); |
8140
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 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
644 gui_mswin_rm_blink_timer(void) |
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 MSG msg; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
647 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
648 if (blink_timer != 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
649 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
650 KillTimer(NULL, blink_timer); |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
651 // Eat spurious WM_TIMER messages |
27283
b4d92a69035b
patch 8.2.4170: MS-Windows: still using old message API calls
Bram Moolenaar <Bram@vim.org>
parents:
27281
diff
changeset
|
652 while (PeekMessageW(&msg, s_hwnd, WM_TIMER, WM_TIMER, PM_REMOVE)) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
653 ; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
654 blink_timer = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
655 } |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
659 * 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
|
660 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
661 void |
13152
f4c3a7f410f4
patch 8.0.1450: GUI: endless loop when stopping cursor blinking
Christian Brabandt <cb@256bit.org>
parents:
13150
diff
changeset
|
662 gui_mch_stop_blink(int may_call_gui_update_cursor) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
663 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
664 gui_mswin_rm_blink_timer(); |
13152
f4c3a7f410f4
patch 8.0.1450: GUI: endless loop when stopping cursor blinking
Christian Brabandt <cb@256bit.org>
parents:
13150
diff
changeset
|
665 if (blink_state == BLINK_OFF && may_call_gui_update_cursor) |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
666 { |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
667 gui_update_cursor(TRUE, FALSE); |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
668 gui_mch_flush(); |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
669 } |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
670 blink_state = BLINK_NONE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
671 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
672 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
673 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
674 * 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
|
675 * waiting time and shows the cursor. |
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 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
678 gui_mch_start_blink(void) |
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 gui_mswin_rm_blink_timer(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
681 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
682 // Only switch blinking on if none of the times is zero |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
683 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
|
684 { |
27525
27694b525305
patch 8.2.4290: MS-Windows: using type casts for timer IDs
Bram Moolenaar <Bram@vim.org>
parents:
27455
diff
changeset
|
685 blink_timer = SetTimer(NULL, 0, (UINT)blink_waittime, _OnBlinkTimer); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
686 blink_state = BLINK_ON; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
687 gui_update_cursor(TRUE, FALSE); |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
688 gui_mch_flush(); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
689 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
690 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
691 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
692 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
693 * Call-back routines. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
694 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
695 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
696 static VOID CALLBACK |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
697 _OnTimer( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
698 HWND hwnd, |
10783
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
699 UINT uMsg UNUSED, |
27525
27694b525305
patch 8.2.4290: MS-Windows: using type casts for timer IDs
Bram Moolenaar <Bram@vim.org>
parents:
27455
diff
changeset
|
700 UINT_PTR idEvent, |
10783
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
701 DWORD dwTime UNUSED) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
702 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
703 MSG msg; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
704 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
705 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
706 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
|
707 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
708 KillTimer(NULL, idEvent); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
709 s_timed_out = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
710 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
711 // Eat spurious WM_TIMER messages |
27283
b4d92a69035b
patch 8.2.4170: MS-Windows: still using old message API calls
Bram Moolenaar <Bram@vim.org>
parents:
27281
diff
changeset
|
712 while (PeekMessageW(&msg, hwnd, WM_TIMER, WM_TIMER, PM_REMOVE)) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
713 ; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
714 if (idEvent == s_wait_timer) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
715 s_wait_timer = 0; |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
718 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
719 _OnDeadChar( |
10783
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
720 HWND hwnd UNUSED, |
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
721 UINT ch UNUSED, |
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
722 int cRepeat UNUSED) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
723 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
724 dead_key = 1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
725 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
726 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
727 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
728 * 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
|
729 * 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
|
730 * Return the length. |
13766
74294f0fbf28
patch 8.0.1755: MS-Windows: high unicode char received as two utf-16 words
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
731 * Because the Windows API uses UTF-16, we have to deal with surrogate |
74294f0fbf28
patch 8.0.1755: MS-Windows: high unicode char received as two utf-16 words
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
732 * pairs; this is where we choose to deal with them: if "ch" is a high |
74294f0fbf28
patch 8.0.1755: MS-Windows: high unicode char received as two utf-16 words
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
733 * surrogate, it will be stored, and the length returned will be zero; the next |
74294f0fbf28
patch 8.0.1755: MS-Windows: high unicode char received as two utf-16 words
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
734 * char_to_string call will then include the high surrogate, decoding the pair |
74294f0fbf28
patch 8.0.1755: MS-Windows: high unicode char received as two utf-16 words
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
735 * of UTF-16 code units to a single Unicode code point, presuming it is the |
74294f0fbf28
patch 8.0.1755: MS-Windows: high unicode char received as two utf-16 words
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
736 * matching low surrogate. |
8140
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 static int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
739 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
|
740 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
741 int len; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
742 int i; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
743 WCHAR wstring[2]; |
9252
c25898cc99c1
commit https://github.com/vim/vim/commit/945ec093cd4ddefab930239990564b12eb232153
Christian Brabandt <cb@256bit.org>
parents:
9236
diff
changeset
|
744 char_u *ws = NULL; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
745 |
13766
74294f0fbf28
patch 8.0.1755: MS-Windows: high unicode char received as two utf-16 words
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
746 if (surrogate_pending_ch != 0) |
74294f0fbf28
patch 8.0.1755: MS-Windows: high unicode char received as two utf-16 words
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
747 { |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
748 // We don't guarantee ch is a low surrogate to match the high surrogate |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
749 // we already have; it should be, but if it isn't, tough luck. |
13766
74294f0fbf28
patch 8.0.1755: MS-Windows: high unicode char received as two utf-16 words
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
750 wstring[0] = surrogate_pending_ch; |
74294f0fbf28
patch 8.0.1755: MS-Windows: high unicode char received as two utf-16 words
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
751 wstring[1] = ch; |
74294f0fbf28
patch 8.0.1755: MS-Windows: high unicode char received as two utf-16 words
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
752 surrogate_pending_ch = 0; |
74294f0fbf28
patch 8.0.1755: MS-Windows: high unicode char received as two utf-16 words
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
753 len = 2; |
74294f0fbf28
patch 8.0.1755: MS-Windows: high unicode char received as two utf-16 words
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
754 } |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
755 else if (ch >= 0xD800 && ch <= 0xDBFF) // high surrogate |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
756 { |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
757 // We don't have the entire code point yet, only the first UTF-16 code |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
758 // unit; so just remember it and use it in the next call. |
13766
74294f0fbf28
patch 8.0.1755: MS-Windows: high unicode char received as two utf-16 words
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
759 surrogate_pending_ch = ch; |
74294f0fbf28
patch 8.0.1755: MS-Windows: high unicode char received as two utf-16 words
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
760 return 0; |
74294f0fbf28
patch 8.0.1755: MS-Windows: high unicode char received as two utf-16 words
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
761 } |
74294f0fbf28
patch 8.0.1755: MS-Windows: high unicode char received as two utf-16 words
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
762 else |
74294f0fbf28
patch 8.0.1755: MS-Windows: high unicode char received as two utf-16 words
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
763 { |
74294f0fbf28
patch 8.0.1755: MS-Windows: high unicode char received as two utf-16 words
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
764 wstring[0] = ch; |
74294f0fbf28
patch 8.0.1755: MS-Windows: high unicode char received as two utf-16 words
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
765 len = 1; |
74294f0fbf28
patch 8.0.1755: MS-Windows: high unicode char received as two utf-16 words
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
766 } |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
767 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
768 // "ch" is a UTF-16 character. Convert it to a string of bytes. When |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
769 // "enc_codepage" is non-zero use the standard Win32 function, |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
770 // otherwise use our own conversion function (e.g., for UTF-8). |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
771 if (enc_codepage > 0) |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
772 { |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
773 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
|
774 (LPSTR)string, slen, 0, NULL); |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
775 // If we had included the ALT key into the character but now the |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
776 // upper bit is no longer set, that probably means the conversion |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
777 // failed. Convert the original character and set the upper bit |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
778 // afterwards. |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
779 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
|
780 { |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
781 wstring[0] = ch & 0x7f; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
782 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
|
783 (LPSTR)string, slen, 0, NULL); |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
784 if (len == 1) // safety check |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
785 string[0] |= 0x80; |
8140
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 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
788 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
789 { |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
790 ws = utf16_to_enc(wstring, &len); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
791 if (ws == NULL) |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
792 len = 0; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
793 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
794 { |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
795 if (len > slen) // just in case |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
796 len = slen; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
797 mch_memmove(string, ws, len); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
798 vim_free(ws); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
799 } |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
802 if (len == 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
803 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
804 string[0] = ch; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
805 len = 1; |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
808 for (i = 0; i < len; ++i) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
809 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
|
810 { |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
811 // Insert CSI as K_CSI. |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
812 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
|
813 string[++i] = KS_EXTRA; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
814 string[++i] = (int)KE_CSI; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
815 len += 2; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
816 } |
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 return len; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
819 } |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
822 * 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
|
823 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
824 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
825 _OnChar( |
10783
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
826 HWND hwnd UNUSED, |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
827 UINT ch, |
10783
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
828 int cRepeat UNUSED) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
829 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
830 char_u string[40]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
831 int len = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
832 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
833 dead_key = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
834 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
835 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
|
836 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
|
837 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
838 trash_input_buf(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
839 got_int = TRUE; |
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 add_to_input_buf(string, len); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
843 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
844 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
845 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
846 * 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
|
847 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
848 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
849 _OnSysChar( |
10783
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
850 HWND hwnd UNUSED, |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
851 UINT cch, |
10783
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
852 int cRepeat UNUSED) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
853 { |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
854 char_u string[40]; // Enough for multibyte character |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
855 int len; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
856 int modifiers; |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
857 int ch = cch; // special keys are negative |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
858 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
859 dead_key = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
860 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
861 // TRACE("OnSysChar(%d, %c)\n", ch, ch); |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
862 |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
863 // OK, we have a character key (given by ch) which was entered with the |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
864 // ALT key pressed. Eg, if the user presses Alt-A, then ch == 'A'. Note |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
865 // that the system distinguishes Alt-a and Alt-A (Alt-Shift-a unless |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
866 // CAPSLOCK is pressed) at this point. |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
867 modifiers = MOD_MASK_ALT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
868 if (GetKeyState(VK_SHIFT) & 0x8000) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
869 modifiers |= MOD_MASK_SHIFT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
870 if (GetKeyState(VK_CONTROL) & 0x8000) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
871 modifiers |= MOD_MASK_CTRL; |
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 ch = simplify_key(ch, &modifiers); |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
874 // remove the SHIFT modifier for keys where it's already included, e.g., |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
875 // '(' and '*' |
22407
c19acd92ee83
patch 8.2.1752: GTK GUI: cannot map alt-? with <A-?>
Bram Moolenaar <Bram@vim.org>
parents:
21363
diff
changeset
|
876 modifiers = may_remove_shift_modifier(modifiers, ch); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
877 |
20421
8590a462ad46
patch 8.2.0765: In the GUI can't use all the modifiers.
Bram Moolenaar <Bram@vim.org>
parents:
20007
diff
changeset
|
878 // Unify modifiers somewhat. No longer use ALT to set the 8th bit. |
8590a462ad46
patch 8.2.0765: In the GUI can't use all the modifiers.
Bram Moolenaar <Bram@vim.org>
parents:
20007
diff
changeset
|
879 ch = extract_modifiers(ch, &modifiers, FALSE, NULL); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
880 if (ch == CSI) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
881 ch = K_CSI; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
882 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
883 len = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
884 if (modifiers) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
885 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
886 string[len++] = CSI; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
887 string[len++] = KS_MODIFIER; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
888 string[len++] = modifiers; |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
891 if (IS_SPECIAL((int)ch)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
892 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
893 string[len++] = CSI; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
894 string[len++] = K_SECOND((int)ch); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
895 string[len++] = K_THIRD((int)ch); |
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 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
898 { |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
899 // Although the documentation isn't clear about it, we assume "ch" is |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
900 // a Unicode character. |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
901 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
|
902 } |
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 add_to_input_buf(string, len); |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
907 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
908 _OnMouseEvent( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
909 int button, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
910 int x, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
911 int y, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
912 int repeated_click, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
913 UINT keyFlags) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
914 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
915 int vim_modifiers = 0x0; |
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 s_getting_focus = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
918 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
919 if (keyFlags & MK_SHIFT) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
920 vim_modifiers |= MOUSE_SHIFT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
921 if (keyFlags & MK_CONTROL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
922 vim_modifiers |= MOUSE_CTRL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
923 if (GetKeyState(VK_MENU) & 0x8000) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
924 vim_modifiers |= MOUSE_ALT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
925 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
926 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
|
927 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
928 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
929 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
930 _OnMouseButtonDown( |
10783
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
931 HWND hwnd UNUSED, |
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
932 BOOL fDoubleClick UNUSED, |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
933 int x, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
934 int y, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
935 UINT keyFlags) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
936 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
937 static LONG s_prevTime = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
938 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
939 LONG currentTime = GetMessageTime(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
940 int button = -1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
941 int repeated_click; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
942 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
943 // Give main window the focus: this is so the cursor isn't hollow. |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
944 (void)SetFocus(s_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
945 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
946 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
|
947 button = MOUSE_LEFT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
948 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
|
949 button = MOUSE_MIDDLE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
950 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
|
951 button = MOUSE_RIGHT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
952 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
|
953 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
954 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
|
955 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
956 else if (s_uMsg == WM_CAPTURECHANGED) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
957 { |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
958 // on W95/NT4, somehow you get in here with an odd Msg |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
959 // if you press one button while holding down the other.. |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
960 if (s_button_pending == MOUSE_LEFT) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
961 button = MOUSE_RIGHT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
962 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
963 button = MOUSE_LEFT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
964 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
965 if (button >= 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
966 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
967 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
|
968 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
969 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
970 * 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
|
971 * 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 if (repeated_click |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
974 && ((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
|
975 || (button == MOUSE_RIGHT |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
976 && s_button_pending == MOUSE_LEFT))) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
977 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
978 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
979 * 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
|
980 * 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
|
981 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
982 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
|
983 button = MOUSE_MIDDLE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
984 repeated_click = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
985 s_button_pending = -1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
986 _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
|
987 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
988 else if ((repeated_click) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
989 || (mouse_model_popup() && (button == MOUSE_RIGHT))) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
990 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
991 if (s_button_pending > -1) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
992 { |
27281
f7d73708b391
patch 8.2.4169: MS-Windows: unnessary casts and other minor things
Bram Moolenaar <Bram@vim.org>
parents:
27261
diff
changeset
|
993 _OnMouseEvent(s_button_pending, x, y, FALSE, keyFlags); |
f7d73708b391
patch 8.2.4169: MS-Windows: unnessary casts and other minor things
Bram Moolenaar <Bram@vim.org>
parents:
27261
diff
changeset
|
994 s_button_pending = -1; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
995 } |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
996 // TRACE("Button down at x %d, y %d\n", x, y); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
997 _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
|
998 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
999 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1000 { |
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 * 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
|
1003 * 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
|
1004 * i) button-up |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1005 * ii) mouse move |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1006 * iii) another button press |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1007 * before using it. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1008 * 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
|
1009 * 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
|
1010 * 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
|
1011 * 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
|
1012 * this is hardly a problem. |
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 s_button_pending = button; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1015 s_x_pending = x; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1016 s_y_pending = y; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1017 s_kFlags_pending = keyFlags; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1018 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1019 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1020 s_prevTime = currentTime; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1021 } |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1024 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1025 _OnMouseMoveOrRelease( |
10783
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
1026 HWND hwnd UNUSED, |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1027 int x, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1028 int y, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1029 UINT keyFlags) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1030 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1031 int button; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1032 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1033 s_getting_focus = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1034 if (s_button_pending > -1) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1035 { |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1036 // Delayed action for mouse down event |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1037 _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
|
1038 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
|
1039 s_button_pending = -1; |
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 if (s_uMsg == WM_MOUSEMOVE) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1042 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1043 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1044 * 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
|
1045 * down. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1046 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1047 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
|
1048 | MK_XBUTTON1 | MK_XBUTTON2))) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1049 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1050 gui_mouse_moved(x, y); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1051 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1052 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1053 |
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 * 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
|
1056 * the mouse goes outside the window |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1057 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1058 SetCapture(s_textArea); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1059 button = MOUSE_DRAG; |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1060 // TRACE(" move at x %d, y %d\n", x, y); |
8140
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 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1063 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1064 ReleaseCapture(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1065 button = MOUSE_RELEASE; |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1066 // TRACE(" up at x %d, y %d\n", x, y); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1067 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1068 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1069 _OnMouseEvent(button, x, y, FALSE, keyFlags); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1070 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1071 |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1072 static void |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1073 _OnSizeTextArea( |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1074 HWND hwnd UNUSED, |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1075 UINT state UNUSED, |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1076 int cx UNUSED, |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1077 int cy UNUSED) |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1078 { |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1079 #if defined(FEAT_DIRECTX) |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1080 if (IS_ENABLE_DIRECTX()) |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1081 directx_binddc(); |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1082 #endif |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1083 } |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1084 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1085 #ifdef FEAT_MENU |
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 * 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
|
1088 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1089 static vimmenu_T * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1090 gui_mswin_find_menu( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1091 vimmenu_T *pMenu, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1092 int id) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1093 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1094 vimmenu_T *pChildMenu; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1095 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1096 while (pMenu) |
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 if (pMenu->id == (UINT)id) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1099 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1100 if (pMenu->children != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1101 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1102 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
|
1103 if (pChildMenu) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1104 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1105 pMenu = pChildMenu; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1106 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1107 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1108 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1109 pMenu = pMenu->next; |
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 return pMenu; |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1114 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1115 _OnMenu( |
10783
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
1116 HWND hwnd UNUSED, |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1117 int id, |
10783
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
1118 HWND hwndCtl UNUSED, |
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
1119 UINT codeNotify UNUSED) |
8140
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 vimmenu_T *pMenu; |
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 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
|
1124 if (pMenu) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1125 gui_menu_cb(pMenu); |
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 #endif |
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 #ifdef MSWIN_FIND_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 * Handle a Find/Replace window message. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1132 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1133 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1134 _OnFindRepl(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1135 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1136 int flags = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1137 int down; |
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 if (s_findrep_struct.Flags & FR_DIALOGTERM) |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1140 // Give main window the focus back. |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1141 (void)SetFocus(s_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1142 |
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_FINDNEXT) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1144 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1145 flags = FRD_FINDNEXT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1146 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1147 // Give main window the focus back: this is so the cursor isn't |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1148 // hollow. |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1149 (void)SetFocus(s_hwnd); |
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 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
|
1152 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1153 flags = FRD_REPLACE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1154 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1155 // Give main window the focus back: this is so the cursor isn't |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1156 // hollow. |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1157 (void)SetFocus(s_hwnd); |
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 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
|
1160 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1161 flags = FRD_REPLACEALL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1162 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1163 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1164 if (flags != 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1165 { |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
1166 char_u *p, *q; |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
1167 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1168 // Call the generic GUI function to do the actual work. |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1169 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
|
1170 flags |= FRD_WHOLE_WORD; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1171 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
|
1172 flags |= FRD_MATCH_CASE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1173 down = (s_findrep_struct.Flags & FR_DOWN) != 0; |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
1174 p = utf16_to_enc(s_findrep_struct.lpstrFindWhat, NULL); |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
1175 q = utf16_to_enc(s_findrep_struct.lpstrReplaceWith, NULL); |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
1176 if (p != NULL && q != NULL) |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
1177 gui_do_findrepl(flags, p, q, down); |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
1178 vim_free(p); |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
1179 vim_free(q); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1180 } |
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 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1183 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1184 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1185 HandleMouseHide(UINT uMsg, LPARAM lParam) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1186 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1187 static LPARAM last_lParam = 0L; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1188 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1189 // We sometimes get a mousemove when the mouse didn't move... |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1190 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
|
1191 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1192 if (lParam == last_lParam) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1193 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1194 last_lParam = lParam; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1195 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1196 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1197 // Handle specially, to centralise coding. We need to be sure we catch all |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1198 // possible events which should cause us to restore the cursor (as it is a |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1199 // shared resource, we take full responsibility for it). |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1200 switch (uMsg) |
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 case WM_KEYUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1203 case WM_CHAR: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1204 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1205 * blank out the pointer if necessary |
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 if (p_mh) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1208 gui_mch_mousehide(TRUE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1209 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1210 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1211 case WM_SYSKEYUP: // show the pointer when a system-key is pressed |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1212 case WM_SYSCHAR: |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1213 case WM_MOUSEMOVE: // show the pointer on any mouse action |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1214 case WM_LBUTTONDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1215 case WM_LBUTTONUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1216 case WM_MBUTTONDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1217 case WM_MBUTTONUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1218 case WM_RBUTTONDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1219 case WM_RBUTTONUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1220 case WM_XBUTTONDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1221 case WM_XBUTTONUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1222 case WM_NCMOUSEMOVE: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1223 case WM_NCLBUTTONDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1224 case WM_NCLBUTTONUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1225 case WM_NCMBUTTONDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1226 case WM_NCMBUTTONUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1227 case WM_NCRBUTTONDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1228 case WM_NCRBUTTONUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1229 case WM_KILLFOCUS: |
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 * 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
|
1232 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1233 gui_mch_mousehide(FALSE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1234 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1235 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1236 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1237 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1238 static LRESULT CALLBACK |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1239 _TextAreaWndProc( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1240 HWND hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1241 UINT uMsg, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1242 WPARAM wParam, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1243 LPARAM lParam) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1244 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1245 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1246 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
|
1247 hwnd, uMsg, wParam, lParam); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1248 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1249 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1250 HandleMouseHide(uMsg, lParam); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1251 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1252 s_uMsg = uMsg; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1253 s_wParam = wParam; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1254 s_lParam = lParam; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1255 |
12871
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
12802
diff
changeset
|
1256 #ifdef FEAT_BEVAL_GUI |
27525
27694b525305
patch 8.2.4290: MS-Windows: using type casts for timer IDs
Bram Moolenaar <Bram@vim.org>
parents:
27455
diff
changeset
|
1257 track_user_activity(uMsg); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1258 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1259 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1260 switch (uMsg) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1261 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1262 HANDLE_MSG(hwnd, WM_LBUTTONDBLCLK,_OnMouseButtonDown); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1263 HANDLE_MSG(hwnd, WM_LBUTTONDOWN,_OnMouseButtonDown); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1264 HANDLE_MSG(hwnd, WM_LBUTTONUP, _OnMouseMoveOrRelease); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1265 HANDLE_MSG(hwnd, WM_MBUTTONDBLCLK,_OnMouseButtonDown); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1266 HANDLE_MSG(hwnd, WM_MBUTTONDOWN,_OnMouseButtonDown); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1267 HANDLE_MSG(hwnd, WM_MBUTTONUP, _OnMouseMoveOrRelease); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1268 HANDLE_MSG(hwnd, WM_MOUSEMOVE, _OnMouseMoveOrRelease); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1269 HANDLE_MSG(hwnd, WM_PAINT, _OnPaint); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1270 HANDLE_MSG(hwnd, WM_RBUTTONDBLCLK,_OnMouseButtonDown); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1271 HANDLE_MSG(hwnd, WM_RBUTTONDOWN,_OnMouseButtonDown); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1272 HANDLE_MSG(hwnd, WM_RBUTTONUP, _OnMouseMoveOrRelease); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1273 HANDLE_MSG(hwnd, WM_XBUTTONDBLCLK,_OnMouseButtonDown); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1274 HANDLE_MSG(hwnd, WM_XBUTTONDOWN,_OnMouseButtonDown); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1275 HANDLE_MSG(hwnd, WM_XBUTTONUP, _OnMouseMoveOrRelease); |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1276 HANDLE_MSG(hwnd, WM_SIZE, _OnSizeTextArea); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1277 |
12871
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
12802
diff
changeset
|
1278 #ifdef FEAT_BEVAL_GUI |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1279 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
|
1280 return TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1281 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1282 default: |
27249
d5570658f18d
patch 8.2.4153: MS-Windows: Global IME is no longer supported
Bram Moolenaar <Bram@vim.org>
parents:
27229
diff
changeset
|
1283 return DefWindowProcW(hwnd, uMsg, wParam, lParam); |
d5570658f18d
patch 8.2.4153: MS-Windows: Global IME is no longer supported
Bram Moolenaar <Bram@vim.org>
parents:
27229
diff
changeset
|
1284 } |
8140
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1288 * 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
|
1289 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1290 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1291 gui_mch_new_colors(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1292 { |
18617
5beda1754026
patch 8.1.2301: MS-Windows GUI: drawing error when background color changes
Bram Moolenaar <Bram@vim.org>
parents:
18526
diff
changeset
|
1293 HBRUSH prevBrush; |
5beda1754026
patch 8.1.2301: MS-Windows GUI: drawing error when background color changes
Bram Moolenaar <Bram@vim.org>
parents:
18526
diff
changeset
|
1294 |
5beda1754026
patch 8.1.2301: MS-Windows GUI: drawing error when background color changes
Bram Moolenaar <Bram@vim.org>
parents:
18526
diff
changeset
|
1295 s_brush = CreateSolidBrush(gui.back_pixel); |
5beda1754026
patch 8.1.2301: MS-Windows GUI: drawing error when background color changes
Bram Moolenaar <Bram@vim.org>
parents:
18526
diff
changeset
|
1296 prevBrush = (HBRUSH)SetClassLongPtr( |
5beda1754026
patch 8.1.2301: MS-Windows GUI: drawing error when background color changes
Bram Moolenaar <Bram@vim.org>
parents:
18526
diff
changeset
|
1297 s_hwnd, GCLP_HBRBACKGROUND, (LONG_PTR)s_brush); |
5beda1754026
patch 8.1.2301: MS-Windows GUI: drawing error when background color changes
Bram Moolenaar <Bram@vim.org>
parents:
18526
diff
changeset
|
1298 InvalidateRect(s_hwnd, NULL, TRUE); |
5beda1754026
patch 8.1.2301: MS-Windows GUI: drawing error when background color changes
Bram Moolenaar <Bram@vim.org>
parents:
18526
diff
changeset
|
1299 DeleteObject(prevBrush); |
8140
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1302 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1303 * 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
|
1304 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1305 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1306 gui_mch_def_colors(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1307 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1308 gui.norm_pixel = GetSysColor(COLOR_WINDOWTEXT); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1309 gui.back_pixel = GetSysColor(COLOR_WINDOW); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1310 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
|
1311 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
|
1312 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1313 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1314 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1315 * 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
|
1316 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1317 int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1318 gui_mch_open(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1319 { |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1320 // Actually open the window, if not already visible |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1321 // (may be done already in gui_mch_set_shellsize) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1322 if (!IsWindowVisible(s_hwnd)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1323 ShowWindow(s_hwnd, SW_SHOWDEFAULT); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1324 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1325 #ifdef MSWIN_FIND_REPLACE |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1326 // Init replace string here, so that we keep it when re-opening the |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1327 // dialog. |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1328 s_findrep_struct.lpstrReplaceWith[0] = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1329 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1330 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1331 return OK; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1332 } |
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 * 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
|
1336 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1337 int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1338 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
|
1339 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1340 RECT rect; |
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 GetWindowRect(s_hwnd, &rect); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1343 *x = rect.left; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1344 *y = rect.top; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1345 return OK; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1346 } |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1349 * 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
|
1350 * coordinates. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1351 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1352 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1353 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
|
1354 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1355 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
|
1356 SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1357 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1358 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1359 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
|
1360 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1361 static int oldx = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1362 static int oldy = 0; |
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 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
|
1365 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1366 #ifdef FEAT_TOOLBAR |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1367 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
|
1368 SendMessage(s_toolbarhwnd, WM_SIZE, |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
1369 (WPARAM)0, MAKELPARAM(w, gui.toolbar_height)); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1370 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1371 #if defined(FEAT_GUI_TABLINE) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1372 if (showing_tabline) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1373 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1374 int top = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1375 RECT rect; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1376 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1377 # ifdef FEAT_TOOLBAR |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1378 if (vim_strchr(p_go, GO_TOOLBAR) != NULL) |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
1379 top = gui.toolbar_height; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1380 # endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1381 GetClientRect(s_hwnd, &rect); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1382 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
|
1383 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1384 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1385 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1386 // When side scroll bar is unshown, the size of window will change. |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1387 // then, the text area move left or right. thus client rect should be |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1388 // forcedly redrawn. (Yasuhiro Matsumoto) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1389 if (oldx != x || oldy != y) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1390 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1391 InvalidateRect(s_hwnd, NULL, FALSE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1392 oldx = x; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1393 oldy = y; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1394 } |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1397 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1398 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1399 * Scrollbar stuff: |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1402 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1403 gui_mch_enable_scrollbar( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1404 scrollbar_T *sb, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1405 int flag) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1406 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1407 ShowScrollBar(sb->id, SB_CTL, flag); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1408 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1409 // TODO: When the window is maximized, the size of the window stays the |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1410 // same, thus the size of the text area changes. On Win98 it's OK, on Win |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1411 // NT 4.0 it's not... |
8140
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1414 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1415 gui_mch_set_scrollbar_pos( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1416 scrollbar_T *sb, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1417 int x, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1418 int y, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1419 int w, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1420 int h) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1421 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1422 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
|
1423 SWP_NOZORDER | SWP_NOACTIVATE | SWP_SHOWWINDOW); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1424 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1425 |
21355
fcccc29bd386
patch 8.2.1228: scrollbars not flush against the window edges when maximised
Bram Moolenaar <Bram@vim.org>
parents:
21351
diff
changeset
|
1426 int |
fcccc29bd386
patch 8.2.1228: scrollbars not flush against the window edges when maximised
Bram Moolenaar <Bram@vim.org>
parents:
21351
diff
changeset
|
1427 gui_mch_get_scrollbar_xpadding(void) |
fcccc29bd386
patch 8.2.1228: scrollbars not flush against the window edges when maximised
Bram Moolenaar <Bram@vim.org>
parents:
21351
diff
changeset
|
1428 { |
fcccc29bd386
patch 8.2.1228: scrollbars not flush against the window edges when maximised
Bram Moolenaar <Bram@vim.org>
parents:
21351
diff
changeset
|
1429 RECT rcTxt, rcWnd; |
fcccc29bd386
patch 8.2.1228: scrollbars not flush against the window edges when maximised
Bram Moolenaar <Bram@vim.org>
parents:
21351
diff
changeset
|
1430 int xpad; |
fcccc29bd386
patch 8.2.1228: scrollbars not flush against the window edges when maximised
Bram Moolenaar <Bram@vim.org>
parents:
21351
diff
changeset
|
1431 |
fcccc29bd386
patch 8.2.1228: scrollbars not flush against the window edges when maximised
Bram Moolenaar <Bram@vim.org>
parents:
21351
diff
changeset
|
1432 GetWindowRect(s_textArea, &rcTxt); |
fcccc29bd386
patch 8.2.1228: scrollbars not flush against the window edges when maximised
Bram Moolenaar <Bram@vim.org>
parents:
21351
diff
changeset
|
1433 GetWindowRect(s_hwnd, &rcWnd); |
fcccc29bd386
patch 8.2.1228: scrollbars not flush against the window edges when maximised
Bram Moolenaar <Bram@vim.org>
parents:
21351
diff
changeset
|
1434 xpad = rcWnd.right - rcTxt.right - gui.scrollbar_width |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
1435 - pGetSystemMetricsForDpi(SM_CXFRAME, s_dpi) |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
1436 - pGetSystemMetricsForDpi(SM_CXPADDEDBORDER, s_dpi); |
21355
fcccc29bd386
patch 8.2.1228: scrollbars not flush against the window edges when maximised
Bram Moolenaar <Bram@vim.org>
parents:
21351
diff
changeset
|
1437 return (xpad < 0) ? 0 : xpad; |
fcccc29bd386
patch 8.2.1228: scrollbars not flush against the window edges when maximised
Bram Moolenaar <Bram@vim.org>
parents:
21351
diff
changeset
|
1438 } |
fcccc29bd386
patch 8.2.1228: scrollbars not flush against the window edges when maximised
Bram Moolenaar <Bram@vim.org>
parents:
21351
diff
changeset
|
1439 |
fcccc29bd386
patch 8.2.1228: scrollbars not flush against the window edges when maximised
Bram Moolenaar <Bram@vim.org>
parents:
21351
diff
changeset
|
1440 int |
fcccc29bd386
patch 8.2.1228: scrollbars not flush against the window edges when maximised
Bram Moolenaar <Bram@vim.org>
parents:
21351
diff
changeset
|
1441 gui_mch_get_scrollbar_ypadding(void) |
fcccc29bd386
patch 8.2.1228: scrollbars not flush against the window edges when maximised
Bram Moolenaar <Bram@vim.org>
parents:
21351
diff
changeset
|
1442 { |
fcccc29bd386
patch 8.2.1228: scrollbars not flush against the window edges when maximised
Bram Moolenaar <Bram@vim.org>
parents:
21351
diff
changeset
|
1443 RECT rcTxt, rcWnd; |
fcccc29bd386
patch 8.2.1228: scrollbars not flush against the window edges when maximised
Bram Moolenaar <Bram@vim.org>
parents:
21351
diff
changeset
|
1444 int ypad; |
fcccc29bd386
patch 8.2.1228: scrollbars not flush against the window edges when maximised
Bram Moolenaar <Bram@vim.org>
parents:
21351
diff
changeset
|
1445 |
fcccc29bd386
patch 8.2.1228: scrollbars not flush against the window edges when maximised
Bram Moolenaar <Bram@vim.org>
parents:
21351
diff
changeset
|
1446 GetWindowRect(s_textArea, &rcTxt); |
fcccc29bd386
patch 8.2.1228: scrollbars not flush against the window edges when maximised
Bram Moolenaar <Bram@vim.org>
parents:
21351
diff
changeset
|
1447 GetWindowRect(s_hwnd, &rcWnd); |
fcccc29bd386
patch 8.2.1228: scrollbars not flush against the window edges when maximised
Bram Moolenaar <Bram@vim.org>
parents:
21351
diff
changeset
|
1448 ypad = rcWnd.bottom - rcTxt.bottom - gui.scrollbar_height |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
1449 - pGetSystemMetricsForDpi(SM_CYFRAME, s_dpi) |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
1450 - pGetSystemMetricsForDpi(SM_CXPADDEDBORDER, s_dpi); |
21355
fcccc29bd386
patch 8.2.1228: scrollbars not flush against the window edges when maximised
Bram Moolenaar <Bram@vim.org>
parents:
21351
diff
changeset
|
1451 return (ypad < 0) ? 0 : ypad; |
fcccc29bd386
patch 8.2.1228: scrollbars not flush against the window edges when maximised
Bram Moolenaar <Bram@vim.org>
parents:
21351
diff
changeset
|
1452 } |
fcccc29bd386
patch 8.2.1228: scrollbars not flush against the window edges when maximised
Bram Moolenaar <Bram@vim.org>
parents:
21351
diff
changeset
|
1453 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1454 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1455 gui_mch_create_scrollbar( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1456 scrollbar_T *sb, |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1457 int orient) // SBAR_VERT or SBAR_HORIZ |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1458 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1459 sb->id = CreateWindow( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1460 "SCROLLBAR", "Scrollbar", |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1461 WS_CHILD | ((orient == SBAR_VERT) ? SBS_VERT : SBS_HORZ), 0, 0, |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1462 10, // Any value will do for now |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1463 10, // Any value will do for now |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1464 s_hwnd, NULL, |
16451
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
1465 g_hinst, NULL); |
8140
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 * 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
|
1470 */ |
21351
a4f213630151
patch 8.2.1226: MS-Windows: windows positioning wrong depending on taskbar
Bram Moolenaar <Bram@vim.org>
parents:
20421
diff
changeset
|
1471 static scrollbar_T * |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1472 gui_mswin_find_scrollbar(HWND hwnd) |
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 win_T *wp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1475 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1476 if (gui.bottom_sbar.id == hwnd) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1477 return &gui.bottom_sbar; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1478 FOR_ALL_WINDOWS(wp) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1479 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1480 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
|
1481 return &wp->w_scrollbars[SBAR_LEFT]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1482 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
|
1483 return &wp->w_scrollbars[SBAR_RIGHT]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1484 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1485 return NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1486 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1487 |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
1488 static void |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
1489 update_scrollbar_size(void) |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
1490 { |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
1491 gui.scrollbar_width = pGetSystemMetricsForDpi(SM_CXVSCROLL, s_dpi); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
1492 gui.scrollbar_height = pGetSystemMetricsForDpi(SM_CYHSCROLL, s_dpi); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
1493 } |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
1494 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1495 /* |
27332
251cae25bb49
patch 8.2.4194: MS-Windows: code for calculating font size is duplicated
Bram Moolenaar <Bram@vim.org>
parents:
27322
diff
changeset
|
1496 * Get the average character size of a font. |
251cae25bb49
patch 8.2.4194: MS-Windows: code for calculating font size is duplicated
Bram Moolenaar <Bram@vim.org>
parents:
27322
diff
changeset
|
1497 */ |
251cae25bb49
patch 8.2.4194: MS-Windows: code for calculating font size is duplicated
Bram Moolenaar <Bram@vim.org>
parents:
27322
diff
changeset
|
1498 static void |
251cae25bb49
patch 8.2.4194: MS-Windows: code for calculating font size is duplicated
Bram Moolenaar <Bram@vim.org>
parents:
27322
diff
changeset
|
1499 GetAverageFontSize(HDC hdc, SIZE *size) |
251cae25bb49
patch 8.2.4194: MS-Windows: code for calculating font size is duplicated
Bram Moolenaar <Bram@vim.org>
parents:
27322
diff
changeset
|
1500 { |
251cae25bb49
patch 8.2.4194: MS-Windows: code for calculating font size is duplicated
Bram Moolenaar <Bram@vim.org>
parents:
27322
diff
changeset
|
1501 // GetTextMetrics() may not return the right value in tmAveCharWidth |
251cae25bb49
patch 8.2.4194: MS-Windows: code for calculating font size is duplicated
Bram Moolenaar <Bram@vim.org>
parents:
27322
diff
changeset
|
1502 // for some fonts. Do our own average computation. |
251cae25bb49
patch 8.2.4194: MS-Windows: code for calculating font size is duplicated
Bram Moolenaar <Bram@vim.org>
parents:
27322
diff
changeset
|
1503 GetTextExtentPoint(hdc, |
251cae25bb49
patch 8.2.4194: MS-Windows: code for calculating font size is duplicated
Bram Moolenaar <Bram@vim.org>
parents:
27322
diff
changeset
|
1504 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", |
251cae25bb49
patch 8.2.4194: MS-Windows: code for calculating font size is duplicated
Bram Moolenaar <Bram@vim.org>
parents:
27322
diff
changeset
|
1505 52, size); |
251cae25bb49
patch 8.2.4194: MS-Windows: code for calculating font size is duplicated
Bram Moolenaar <Bram@vim.org>
parents:
27322
diff
changeset
|
1506 size->cx = (size->cx / 26 + 1) / 2; |
251cae25bb49
patch 8.2.4194: MS-Windows: code for calculating font size is duplicated
Bram Moolenaar <Bram@vim.org>
parents:
27322
diff
changeset
|
1507 } |
251cae25bb49
patch 8.2.4194: MS-Windows: code for calculating font size is duplicated
Bram Moolenaar <Bram@vim.org>
parents:
27322
diff
changeset
|
1508 |
251cae25bb49
patch 8.2.4194: MS-Windows: code for calculating font size is duplicated
Bram Moolenaar <Bram@vim.org>
parents:
27322
diff
changeset
|
1509 /* |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1510 * 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
|
1511 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1512 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1513 GetFontSize(GuiFont font) |
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 HWND hwnd = GetDesktopWindow(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1516 HDC hdc = GetWindowDC(hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1517 HFONT hfntOld = SelectFont(hdc, (HFONT)font); |
16582
9a7d98e11954
patch 8.1.1294: MS-Windows: Some fonts return wrong average char width
Bram Moolenaar <Bram@vim.org>
parents:
16468
diff
changeset
|
1518 SIZE size; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1519 TEXTMETRIC tm; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1520 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1521 GetTextMetrics(hdc, &tm); |
27332
251cae25bb49
patch 8.2.4194: MS-Windows: code for calculating font size is duplicated
Bram Moolenaar <Bram@vim.org>
parents:
27322
diff
changeset
|
1522 GetAverageFontSize(hdc, &size); |
251cae25bb49
patch 8.2.4194: MS-Windows: code for calculating font size is duplicated
Bram Moolenaar <Bram@vim.org>
parents:
27322
diff
changeset
|
1523 |
251cae25bb49
patch 8.2.4194: MS-Windows: code for calculating font size is duplicated
Bram Moolenaar <Bram@vim.org>
parents:
27322
diff
changeset
|
1524 gui.char_width = size.cx + tm.tmOverhang; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1525 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
|
1526 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1527 SelectFont(hdc, hfntOld); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1528 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1529 ReleaseDC(hwnd, hdc); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1530 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1531 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1532 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1533 * 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
|
1534 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1535 int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1536 gui_mch_adjust_charheight(void) |
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 GetFontSize(gui.norm_font); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1539 return OK; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1540 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1541 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1542 static GuiFont |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
1543 get_font_handle(LOGFONTW *lf) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1544 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1545 HFONT font = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1546 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1547 // Load the font |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
1548 font = CreateFontIndirectW(lf); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1549 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1550 if (font == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1551 return NOFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1552 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1553 return (GuiFont)font; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1554 } |
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 static int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1557 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
|
1558 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1559 int points; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1560 HWND hwnd; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1561 HDC hdc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1562 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1563 hwnd = GetDesktopWindow(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1564 hdc = GetWindowDC(hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1565 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1566 points = MulDiv(pixels, 72, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1567 GetDeviceCaps(hdc, vertical ? LOGPIXELSY : LOGPIXELSX)); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1568 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1569 ReleaseDC(hwnd, hdc); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1570 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1571 return points; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1572 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1573 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1574 GuiFont |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1575 gui_mch_get_font( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1576 char_u *name, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1577 int giveErrorIfMissing) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1578 { |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
1579 LOGFONTW lf; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1580 GuiFont font = NOFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1581 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1582 if (get_logfont(&lf, name, NULL, giveErrorIfMissing) == OK) |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
1583 { |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
1584 lf.lfHeight = adjust_fontsize_by_dpi(lf.lfHeight); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1585 font = get_font_handle(&lf); |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
1586 } |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1587 if (font == NOFONT && giveErrorIfMissing) |
26865
bce848ec8b1b
patch 8.2.3961: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26771
diff
changeset
|
1588 semsg(_(e_unknown_font_str), name); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1589 return font; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1590 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1591 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1592 #if defined(FEAT_EVAL) || defined(PROTO) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1593 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1594 * 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
|
1595 * 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
|
1596 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1597 char_u * |
10783
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
1598 gui_mch_get_fontname(GuiFont font UNUSED, char_u *name) |
8140
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 if (name == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1601 return NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1602 return vim_strsave(name); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1603 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1604 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1605 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1606 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1607 gui_mch_free_font(GuiFont font) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1608 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1609 if (font) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1610 DeleteObject((HFONT)font); |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1613 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1614 * 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
|
1615 * Return INVALCOLOR for error. |
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 guicolor_T |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1618 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
|
1619 { |
9017
7b1200ea03a1
commit https://github.com/vim/vim/commit/c285fe7c3ffdb3ec4eff20a1d1d5accfc80f1a86
Christian Brabandt <cb@256bit.org>
parents:
9013
diff
changeset
|
1620 int i; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1621 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1622 typedef struct SysColorTable |
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 char *name; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1625 int color; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1626 } SysColorTable; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1627 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1628 static SysColorTable sys_table[] = |
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 {"SYS_3DDKSHADOW", COLOR_3DDKSHADOW}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1631 {"SYS_3DHILIGHT", COLOR_3DHILIGHT}, |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1632 #ifdef COLOR_3DHIGHLIGHT |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1633 {"SYS_3DHIGHLIGHT", COLOR_3DHIGHLIGHT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1634 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1635 {"SYS_BTNHILIGHT", COLOR_BTNHILIGHT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1636 {"SYS_BTNHIGHLIGHT", COLOR_BTNHIGHLIGHT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1637 {"SYS_3DLIGHT", COLOR_3DLIGHT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1638 {"SYS_3DSHADOW", COLOR_3DSHADOW}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1639 {"SYS_DESKTOP", COLOR_DESKTOP}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1640 {"SYS_INFOBK", COLOR_INFOBK}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1641 {"SYS_INFOTEXT", COLOR_INFOTEXT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1642 {"SYS_3DFACE", COLOR_3DFACE}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1643 {"SYS_BTNFACE", COLOR_BTNFACE}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1644 {"SYS_BTNSHADOW", COLOR_BTNSHADOW}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1645 {"SYS_ACTIVEBORDER", COLOR_ACTIVEBORDER}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1646 {"SYS_ACTIVECAPTION", COLOR_ACTIVECAPTION}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1647 {"SYS_APPWORKSPACE", COLOR_APPWORKSPACE}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1648 {"SYS_BACKGROUND", COLOR_BACKGROUND}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1649 {"SYS_BTNTEXT", COLOR_BTNTEXT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1650 {"SYS_CAPTIONTEXT", COLOR_CAPTIONTEXT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1651 {"SYS_GRAYTEXT", COLOR_GRAYTEXT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1652 {"SYS_HIGHLIGHT", COLOR_HIGHLIGHT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1653 {"SYS_HIGHLIGHTTEXT", COLOR_HIGHLIGHTTEXT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1654 {"SYS_INACTIVEBORDER", COLOR_INACTIVEBORDER}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1655 {"SYS_INACTIVECAPTION", COLOR_INACTIVECAPTION}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1656 {"SYS_INACTIVECAPTIONTEXT", COLOR_INACTIVECAPTIONTEXT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1657 {"SYS_MENU", COLOR_MENU}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1658 {"SYS_MENUTEXT", COLOR_MENUTEXT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1659 {"SYS_SCROLLBAR", COLOR_SCROLLBAR}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1660 {"SYS_WINDOW", COLOR_WINDOW}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1661 {"SYS_WINDOWFRAME", COLOR_WINDOWFRAME}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1662 {"SYS_WINDOWTEXT", COLOR_WINDOWTEXT} |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1663 }; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1664 |
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 * 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
|
1667 */ |
24768
7334bf933510
patch 8.2.2922: computing array length is done in various ways
Bram Moolenaar <Bram@vim.org>
parents:
22922
diff
changeset
|
1668 for (i = 0; i < ARRAY_LENGTH(sys_table); i++) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1669 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
|
1670 return GetSysColor(sys_table[i].color); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1671 |
9013
22c29a515b53
commit https://github.com/vim/vim/commit/ab3022196ea4f1496e79b8ee85996e31c45d02f1
Christian Brabandt <cb@256bit.org>
parents:
8835
diff
changeset
|
1672 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
|
1673 } |
9017
7b1200ea03a1
commit https://github.com/vim/vim/commit/c285fe7c3ffdb3ec4eff20a1d1d5accfc80f1a86
Christian Brabandt <cb@256bit.org>
parents:
9013
diff
changeset
|
1674 |
11745
5a5709918a98
patch 8.0.0755: terminal window does not have colors in the GUI
Christian Brabandt <cb@256bit.org>
parents:
11410
diff
changeset
|
1675 guicolor_T |
5a5709918a98
patch 8.0.0755: terminal window does not have colors in the GUI
Christian Brabandt <cb@256bit.org>
parents:
11410
diff
changeset
|
1676 gui_mch_get_rgb_color(int r, int g, int b) |
5a5709918a98
patch 8.0.0755: terminal window does not have colors in the GUI
Christian Brabandt <cb@256bit.org>
parents:
11410
diff
changeset
|
1677 { |
5a5709918a98
patch 8.0.0755: terminal window does not have colors in the GUI
Christian Brabandt <cb@256bit.org>
parents:
11410
diff
changeset
|
1678 return gui_get_rgb_color_cmn(r, g, b); |
5a5709918a98
patch 8.0.0755: terminal window does not have colors in the GUI
Christian Brabandt <cb@256bit.org>
parents:
11410
diff
changeset
|
1679 } |
5a5709918a98
patch 8.0.0755: terminal window does not have colors in the GUI
Christian Brabandt <cb@256bit.org>
parents:
11410
diff
changeset
|
1680 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1681 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1682 * 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
|
1683 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1684 int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1685 gui_mch_haskey(char_u *name) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1686 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1687 int i; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1688 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1689 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
|
1690 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
|
1691 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
|
1692 return OK; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1693 return FAIL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1694 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1695 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1696 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1697 gui_mch_beep(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1698 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1699 MessageBeep(MB_OK); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1700 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1701 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1702 * 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
|
1703 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1704 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1705 gui_mch_invert_rectangle( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1706 int r, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1707 int c, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1708 int nr, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1709 int nc) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1710 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1711 RECT rc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1712 |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1713 #if defined(FEAT_DIRECTX) |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1714 if (IS_ENABLE_DIRECTX()) |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1715 DWriteContext_Flush(s_dwc); |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1716 #endif |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1717 |
8140
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 * 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
|
1720 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1721 rc.left = FILL_X(c); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1722 rc.top = FILL_Y(r); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1723 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
|
1724 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
|
1725 InvertRect(s_hdc, &rc); |
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 |
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 * Iconify the GUI window. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1730 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1731 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1732 gui_mch_iconify(void) |
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 ShowWindow(s_hwnd, SW_MINIMIZE); |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1737 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1738 * Draw a cursor without focus. |
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 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1741 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
|
1742 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1743 HBRUSH hbr; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1744 RECT rc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1745 |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1746 #if defined(FEAT_DIRECTX) |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1747 if (IS_ENABLE_DIRECTX()) |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1748 DWriteContext_Flush(s_dwc); |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1749 #endif |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1750 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1751 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1752 * 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
|
1753 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1754 rc.left = FILL_X(gui.col); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1755 rc.top = FILL_Y(gui.row); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1756 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
|
1757 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
|
1758 rc.right += gui.char_width; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1759 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
|
1760 hbr = CreateSolidBrush(color); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1761 FrameRect(s_hdc, &rc, hbr); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1762 DeleteBrush(hbr); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1763 } |
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 * 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
|
1766 * color "color". |
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 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1769 gui_mch_draw_part_cursor( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1770 int w, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1771 int h, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1772 guicolor_T color) |
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 RECT rc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1775 |
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 * 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
|
1778 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1779 rc.left = |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1780 #ifdef FEAT_RIGHTLEFT |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1781 // vertical line should be on the right of current point |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1782 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
|
1783 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1784 FILL_X(gui.col); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1785 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
|
1786 rc.right = rc.left + w; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1787 rc.bottom = rc.top + h; |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1788 |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
1789 fill_rect(&rc, NULL, color); |
8140
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1792 |
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 * 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
|
1795 * 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
|
1796 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1797 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1798 outputDeadKey_rePost(MSG originalMsg) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1799 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1800 static MSG deadCharExpel; |
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 if (!dead_key) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1803 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1804 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1805 dead_key = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1806 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1807 // Make Windows generate the dead key's character |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1808 deadCharExpel.message = originalMsg.message; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1809 deadCharExpel.hwnd = originalMsg.hwnd; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1810 deadCharExpel.wParam = VK_SPACE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1811 |
27249
d5570658f18d
patch 8.2.4153: MS-Windows: Global IME is no longer supported
Bram Moolenaar <Bram@vim.org>
parents:
27229
diff
changeset
|
1812 TranslateMessage(&deadCharExpel); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1813 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1814 // re-generate the current character free of the dead char influence |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1815 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
|
1816 originalMsg.lParam); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1817 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1818 |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1821 * Process a single Windows message. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1822 * 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
|
1823 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1824 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1825 process_message(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1826 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1827 MSG msg; |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1828 UINT vk = 0; // Virtual key |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1829 char_u string[40]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1830 int i; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1831 int modifiers = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1832 int key; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1833 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1834 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
|
1835 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1836 |
27283
b4d92a69035b
patch 8.2.4170: MS-Windows: still using old message API calls
Bram Moolenaar <Bram@vim.org>
parents:
27281
diff
changeset
|
1837 GetMessageW(&msg, NULL, 0, 0); |
8140
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 #ifdef FEAT_OLE |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1840 // Look after OLE Automation commands |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1841 if (msg.message == WM_OLE) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1842 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1843 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
|
1844 if (str == NULL || *str == NUL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1845 { |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1846 // Message can't be ours, forward it. Fixes problem with Ultramon |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1847 // 3.0.4 |
27283
b4d92a69035b
patch 8.2.4170: MS-Windows: still using old message API calls
Bram Moolenaar <Bram@vim.org>
parents:
27281
diff
changeset
|
1848 DispatchMessageW(&msg); |
8140
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 else |
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 add_to_input_buf(str, (int)STRLEN(str)); |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1853 vim_free(str); // was allocated in CVim::SendKeys() |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1854 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1855 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1856 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1857 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1858 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1859 #ifdef MSWIN_FIND_REPLACE |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1860 // Don't process messages used by the dialog |
27283
b4d92a69035b
patch 8.2.4170: MS-Windows: still using old message API calls
Bram Moolenaar <Bram@vim.org>
parents:
27281
diff
changeset
|
1861 if (s_findrep_hwnd != NULL && IsDialogMessageW(s_findrep_hwnd, &msg)) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1862 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1863 HandleMouseHide(msg.message, msg.lParam); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1864 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1865 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1866 #endif |
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 * 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
|
1870 * TranslateMessage(). |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1871 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1872 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
|
1873 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1874 vk = (int) msg.wParam; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1875 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1876 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1877 * 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
|
1878 * handle them and do not interfere. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1879 * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1880 * 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
|
1881 * - 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
|
1882 * 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
|
1883 * dead character on its own) |
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 * - 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
|
1886 * expel the dead character as this could trigger an infinite loop if |
27249
d5570658f18d
patch 8.2.4153: MS-Windows: Global IME is no longer supported
Bram Moolenaar <Bram@vim.org>
parents:
27229
diff
changeset
|
1887 * for some reason TranslateMessage() do not trigger a call |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1888 * immediately to _OnChar() (or _OnSysChar()). |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1889 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1890 if (dead_key) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1891 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1892 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1893 * 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
|
1894 * 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
|
1895 * 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
|
1896 * handle it. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1897 * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1898 * 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
|
1899 * 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
|
1900 * 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
|
1901 * 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
|
1902 * user expects. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1903 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1904 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
|
1905 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1906 dead_key = 0; |
27249
d5570658f18d
patch 8.2.4153: MS-Windows: Global IME is no longer supported
Bram Moolenaar <Bram@vim.org>
parents:
27229
diff
changeset
|
1907 TranslateMessage(&msg); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1908 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1909 } |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1910 // In modes where we are not typing, dead keys should behave |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1911 // normally |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1912 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
|
1913 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1914 outputDeadKey_rePost(msg); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1915 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1916 } |
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 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1919 // Check for CTRL-BREAK |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1920 if (vk == VK_CANCEL) |
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 trash_input_buf(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1923 got_int = TRUE; |
12066
8ad282dee649
patch 8.0.0913: MS-Windows: CTRL-C kills shell in terminal window
Christian Brabandt <cb@256bit.org>
parents:
11745
diff
changeset
|
1924 ctrl_break_was_pressed = TRUE; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1925 string[0] = Ctrl_C; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1926 add_to_input_buf(string, 1); |
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 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
|
1930 { |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1931 // ignore VK_SPACE when ALT key pressed: system menu |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1932 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
|
1933 && (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
|
1934 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1935 /* |
9252
c25898cc99c1
commit https://github.com/vim/vim/commit/945ec093cd4ddefab930239990564b12eb232153
Christian Brabandt <cb@256bit.org>
parents:
9236
diff
changeset
|
1936 * 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
|
1937 * 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
|
1938 * 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
|
1939 * the TAB key, etc...). |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1940 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1941 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
|
1942 || vk == VK_TAB || vk == CAR)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1943 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1944 outputDeadKey_rePost(msg); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1945 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1946 } |
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 #ifdef FEAT_MENU |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1949 // Check for <F10>: Windows selects the menu. When <F10> is |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
1950 // mapped we want to use the mapping instead. |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1951 if (vk == VK_F10 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1952 && gui.menu_is_active |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1953 && 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
|
1954 NULL, NULL) == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1955 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1956 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1957 if (GetKeyState(VK_SHIFT) & 0x8000) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1958 modifiers |= MOD_MASK_SHIFT; |
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 * 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
|
1961 * 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
|
1962 * shifted -- webb |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1965 if (GetKeyState(VK_CAPITAL) & 0x0001) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1966 modifiers ^= MOD_MASK_SHIFT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1967 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1968 if (GetKeyState(VK_CONTROL) & 0x8000) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1969 modifiers |= MOD_MASK_CTRL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1970 if (GetKeyState(VK_MENU) & 0x8000) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1971 modifiers |= MOD_MASK_ALT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1972 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1973 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
|
1974 key = special_keys[i].vim_code0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1975 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1976 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
|
1977 special_keys[i].vim_code1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1978 key = simplify_key(key, &modifiers); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1979 if (key == CSI) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1980 key = K_CSI; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1981 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1982 if (modifiers) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1983 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1984 string[0] = CSI; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1985 string[1] = KS_MODIFIER; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1986 string[2] = modifiers; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1987 add_to_input_buf(string, 3); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1988 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1989 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1990 if (IS_SPECIAL(key)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1991 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1992 string[0] = CSI; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1993 string[1] = K_SECOND(key); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1994 string[2] = K_THIRD(key); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1995 add_to_input_buf(string, 3); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1996 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1997 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1998 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1999 int len; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2000 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2001 // Handle "key" as a Unicode character. |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2002 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
|
2003 add_to_input_buf(string, len); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2004 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2005 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2006 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2007 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2008 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
|
2009 { |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2010 // Some keys need C-S- where they should only need C-. |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2011 // Ignore 0xff, Windows XP sends it when NUMLOCK has changed since |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2012 // system startup (Helmut Stiegler, 2003 Oct 3). |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2013 if (vk != 0xff |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2014 && (GetKeyState(VK_CONTROL) & 0x8000) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2015 && !(GetKeyState(VK_SHIFT) & 0x8000) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2016 && !(GetKeyState(VK_MENU) & 0x8000)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2017 { |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2018 // CTRL-6 is '^'; Japanese keyboard maps '^' to vk == 0xDE |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2019 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
|
2020 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2021 string[0] = Ctrl_HAT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2022 add_to_input_buf(string, 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2023 } |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2024 // vk == 0xBD AZERTY for CTRL-'-', but CTRL-[ for * QWERTY! |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2025 else if (vk == 0xBD) // QWERTY for CTRL-'-' |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2026 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2027 string[0] = Ctrl__; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2028 add_to_input_buf(string, 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2029 } |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2030 // CTRL-2 is '@'; Japanese keyboard maps '@' to vk == 0xC0 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2031 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
|
2032 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2033 string[0] = Ctrl_AT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2034 add_to_input_buf(string, 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2035 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2036 else |
27249
d5570658f18d
patch 8.2.4153: MS-Windows: Global IME is no longer supported
Bram Moolenaar <Bram@vim.org>
parents:
27229
diff
changeset
|
2037 TranslateMessage(&msg); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2038 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2039 else |
27249
d5570658f18d
patch 8.2.4153: MS-Windows: Global IME is no longer supported
Bram Moolenaar <Bram@vim.org>
parents:
27229
diff
changeset
|
2040 TranslateMessage(&msg); |
8140
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 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2043 #ifdef FEAT_MBYTE_IME |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2044 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
|
2045 _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
|
2046 else if (msg.message == WM_KEYUP && im_get_status()) |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2047 // added for non-MS IME (Yasuhiro Matsumoto) |
27249
d5570658f18d
patch 8.2.4153: MS-Windows: Global IME is no longer supported
Bram Moolenaar <Bram@vim.org>
parents:
27229
diff
changeset
|
2048 TranslateMessage(&msg); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2049 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2050 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2051 #ifdef FEAT_MENU |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2052 // Check for <F10>: Default effect is to select the menu. When <F10> is |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2053 // mapped we need to stop it here to avoid strange effects (e.g., for the |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2054 // key-up event) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2055 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
|
2056 NULL, NULL) == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2057 #endif |
27283
b4d92a69035b
patch 8.2.4170: MS-Windows: still using old message API calls
Bram Moolenaar <Bram@vim.org>
parents:
27281
diff
changeset
|
2058 DispatchMessageW(&msg); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2059 } |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2062 * 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
|
2063 * 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
|
2064 * 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
|
2065 * immediately. |
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 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2068 gui_mch_update(void) |
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 MSG msg; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2071 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2072 if (!s_busy_processing) |
27283
b4d92a69035b
patch 8.2.4170: MS-Windows: still using old message API calls
Bram Moolenaar <Bram@vim.org>
parents:
27281
diff
changeset
|
2073 while (PeekMessageW(&msg, NULL, 0, 0, PM_NOREMOVE) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2074 && !vim_is_input_buf_full()) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2075 process_message(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2076 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2077 |
9179
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2078 static void |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2079 remove_any_timer(void) |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2080 { |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2081 MSG msg; |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2082 |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2083 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
|
2084 { |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2085 KillTimer(NULL, s_wait_timer); |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2086 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2087 // Eat spurious WM_TIMER messages |
27283
b4d92a69035b
patch 8.2.4170: MS-Windows: still using old message API calls
Bram Moolenaar <Bram@vim.org>
parents:
27281
diff
changeset
|
2088 while (PeekMessageW(&msg, s_hwnd, WM_TIMER, WM_TIMER, PM_REMOVE)) |
9179
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2089 ; |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2090 s_wait_timer = 0; |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2091 } |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2092 } |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2093 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2094 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2095 * 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
|
2096 * from the keyboard. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2097 * wtime == -1 Wait forever. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2098 * wtime == 0 This should never happen. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2099 * 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
|
2100 * 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
|
2101 * or FAIL otherwise. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2102 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2103 int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2104 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
|
2105 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2106 int focus; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2107 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2108 s_timed_out = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2109 |
15665
31367ce5aac7
patch 8.1.0840: getchar(0) never returns a character in the terminal
Bram Moolenaar <Bram@vim.org>
parents:
15601
diff
changeset
|
2110 if (wtime >= 0) |
31367ce5aac7
patch 8.1.0840: getchar(0) never returns a character in the terminal
Bram Moolenaar <Bram@vim.org>
parents:
15601
diff
changeset
|
2111 { |
31367ce5aac7
patch 8.1.0840: getchar(0) never returns a character in the terminal
Bram Moolenaar <Bram@vim.org>
parents:
15601
diff
changeset
|
2112 // Don't do anything while processing a (scroll) message. |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2113 if (s_busy_processing) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2114 return FAIL; |
15665
31367ce5aac7
patch 8.1.0840: getchar(0) never returns a character in the terminal
Bram Moolenaar <Bram@vim.org>
parents:
15601
diff
changeset
|
2115 |
31367ce5aac7
patch 8.1.0840: getchar(0) never returns a character in the terminal
Bram Moolenaar <Bram@vim.org>
parents:
15601
diff
changeset
|
2116 // When called with "wtime" zero, just want one msec. |
27525
27694b525305
patch 8.2.4290: MS-Windows: using type casts for timer IDs
Bram Moolenaar <Bram@vim.org>
parents:
27455
diff
changeset
|
2117 s_wait_timer = SetTimer(NULL, 0, (UINT)(wtime == 0 ? 1 : wtime), |
27694b525305
patch 8.2.4290: MS-Windows: using type casts for timer IDs
Bram Moolenaar <Bram@vim.org>
parents:
27455
diff
changeset
|
2118 _OnTimer); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2119 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2120 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2121 allow_scrollbar = TRUE; |
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 focus = gui.in_focus; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2124 while (!s_timed_out) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2125 { |
17958
1d69e11db360
patch 8.1.1975: MS-Windows GUI responds slowly to timer
Bram Moolenaar <Bram@vim.org>
parents:
16827
diff
changeset
|
2126 // Stop or start blinking when focus changes |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2127 if (gui.in_focus != focus) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2128 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2129 if (gui.in_focus) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2130 gui_mch_start_blink(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2131 else |
13152
f4c3a7f410f4
patch 8.0.1450: GUI: endless loop when stopping cursor blinking
Christian Brabandt <cb@256bit.org>
parents:
13150
diff
changeset
|
2132 gui_mch_stop_blink(TRUE); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2133 focus = gui.in_focus; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2134 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2135 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2136 if (s_need_activate) |
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 (void)SetForegroundWindow(s_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2139 s_need_activate = FALSE; |
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 |
9179
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2142 #ifdef FEAT_TIMERS |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2143 did_add_timer = FALSE; |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2144 #endif |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2145 #ifdef MESSAGE_QUEUE |
17958
1d69e11db360
patch 8.1.1975: MS-Windows GUI responds slowly to timer
Bram Moolenaar <Bram@vim.org>
parents:
16827
diff
changeset
|
2146 // Check channel I/O while waiting for a message. |
8222
4f0677020a43
commit https://github.com/vim/vim/commit/9186a276222ea8a7c88f4092ac5b4201381f4e20
Christian Brabandt <cb@256bit.org>
parents:
8172
diff
changeset
|
2147 for (;;) |
4f0677020a43
commit https://github.com/vim/vim/commit/9186a276222ea8a7c88f4092ac5b4201381f4e20
Christian Brabandt <cb@256bit.org>
parents:
8172
diff
changeset
|
2148 { |
4f0677020a43
commit https://github.com/vim/vim/commit/9186a276222ea8a7c88f4092ac5b4201381f4e20
Christian Brabandt <cb@256bit.org>
parents:
8172
diff
changeset
|
2149 MSG msg; |
4f0677020a43
commit https://github.com/vim/vim/commit/9186a276222ea8a7c88f4092ac5b4201381f4e20
Christian Brabandt <cb@256bit.org>
parents:
8172
diff
changeset
|
2150 |
4f0677020a43
commit https://github.com/vim/vim/commit/9186a276222ea8a7c88f4092ac5b4201381f4e20
Christian Brabandt <cb@256bit.org>
parents:
8172
diff
changeset
|
2151 parse_queued_messages(); |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2152 # ifdef FEAT_TIMERS |
17958
1d69e11db360
patch 8.1.1975: MS-Windows GUI responds slowly to timer
Bram Moolenaar <Bram@vim.org>
parents:
16827
diff
changeset
|
2153 if (did_add_timer) |
1d69e11db360
patch 8.1.1975: MS-Windows GUI responds slowly to timer
Bram Moolenaar <Bram@vim.org>
parents:
16827
diff
changeset
|
2154 break; |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2155 # endif |
27283
b4d92a69035b
patch 8.2.4170: MS-Windows: still using old message API calls
Bram Moolenaar <Bram@vim.org>
parents:
27281
diff
changeset
|
2156 if (PeekMessageW(&msg, NULL, 0, 0, PM_NOREMOVE)) |
12090
c4caf49c8bf4
patch 8.0.0925: MS-Windows GUI: channel I/O not handled right away
Christian Brabandt <cb@256bit.org>
parents:
12066
diff
changeset
|
2157 { |
c4caf49c8bf4
patch 8.0.0925: MS-Windows GUI: channel I/O not handled right away
Christian Brabandt <cb@256bit.org>
parents:
12066
diff
changeset
|
2158 process_message(); |
8222
4f0677020a43
commit https://github.com/vim/vim/commit/9186a276222ea8a7c88f4092ac5b4201381f4e20
Christian Brabandt <cb@256bit.org>
parents:
8172
diff
changeset
|
2159 break; |
12090
c4caf49c8bf4
patch 8.0.0925: MS-Windows GUI: channel I/O not handled right away
Christian Brabandt <cb@256bit.org>
parents:
12066
diff
changeset
|
2160 } |
17958
1d69e11db360
patch 8.1.1975: MS-Windows GUI responds slowly to timer
Bram Moolenaar <Bram@vim.org>
parents:
16827
diff
changeset
|
2161 else if (input_available() |
22922
5d8990ad211e
patch 8.2.2008: MS-Windows GUI: handling channel messages lags
Bram Moolenaar <Bram@vim.org>
parents:
22748
diff
changeset
|
2162 // TODO: The 10 msec is a compromise between laggy response |
5d8990ad211e
patch 8.2.2008: MS-Windows GUI: handling channel messages lags
Bram Moolenaar <Bram@vim.org>
parents:
22748
diff
changeset
|
2163 // and consuming more CPU time. Better would be to handle |
5d8990ad211e
patch 8.2.2008: MS-Windows GUI: handling channel messages lags
Bram Moolenaar <Bram@vim.org>
parents:
22748
diff
changeset
|
2164 // channel messages when they arrive. |
5d8990ad211e
patch 8.2.2008: MS-Windows GUI: handling channel messages lags
Bram Moolenaar <Bram@vim.org>
parents:
22748
diff
changeset
|
2165 || MsgWaitForMultipleObjects(0, NULL, FALSE, 10, |
17958
1d69e11db360
patch 8.1.1975: MS-Windows GUI responds slowly to timer
Bram Moolenaar <Bram@vim.org>
parents:
16827
diff
changeset
|
2166 QS_ALLINPUT) != WAIT_TIMEOUT) |
12090
c4caf49c8bf4
patch 8.0.0925: MS-Windows GUI: channel I/O not handled right away
Christian Brabandt <cb@256bit.org>
parents:
12066
diff
changeset
|
2167 break; |
c4caf49c8bf4
patch 8.0.0925: MS-Windows GUI: channel I/O not handled right away
Christian Brabandt <cb@256bit.org>
parents:
12066
diff
changeset
|
2168 } |
c4caf49c8bf4
patch 8.0.0925: MS-Windows GUI: channel I/O not handled right away
Christian Brabandt <cb@256bit.org>
parents:
12066
diff
changeset
|
2169 #else |
17958
1d69e11db360
patch 8.1.1975: MS-Windows GUI responds slowly to timer
Bram Moolenaar <Bram@vim.org>
parents:
16827
diff
changeset
|
2170 // Don't use gui_mch_update() because then we will spin-lock until a |
1d69e11db360
patch 8.1.1975: MS-Windows GUI responds slowly to timer
Bram Moolenaar <Bram@vim.org>
parents:
16827
diff
changeset
|
2171 // char arrives, instead we use GetMessage() to hang until an |
1d69e11db360
patch 8.1.1975: MS-Windows GUI responds slowly to timer
Bram Moolenaar <Bram@vim.org>
parents:
16827
diff
changeset
|
2172 // event arrives. No need to check for input_buf_full because we are |
1d69e11db360
patch 8.1.1975: MS-Windows GUI responds slowly to timer
Bram Moolenaar <Bram@vim.org>
parents:
16827
diff
changeset
|
2173 // returning as soon as it contains a single char -- webb |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2174 process_message(); |
12090
c4caf49c8bf4
patch 8.0.0925: MS-Windows GUI: channel I/O not handled right away
Christian Brabandt <cb@256bit.org>
parents:
12066
diff
changeset
|
2175 #endif |
8140
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 if (input_available()) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2178 { |
9179
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2179 remove_any_timer(); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2180 allow_scrollbar = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2181 |
17958
1d69e11db360
patch 8.1.1975: MS-Windows GUI responds slowly to timer
Bram Moolenaar <Bram@vim.org>
parents:
16827
diff
changeset
|
2182 // Clear pending mouse button, the release event may have been |
1d69e11db360
patch 8.1.1975: MS-Windows GUI responds slowly to timer
Bram Moolenaar <Bram@vim.org>
parents:
16827
diff
changeset
|
2183 // taken by the dialog window. But don't do this when getting |
1d69e11db360
patch 8.1.1975: MS-Windows GUI responds slowly to timer
Bram Moolenaar <Bram@vim.org>
parents:
16827
diff
changeset
|
2184 // focus, we need the mouse-up event then. |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2185 if (!s_getting_focus) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2186 s_button_pending = -1; |
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 return OK; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2189 } |
9179
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2190 |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2191 #ifdef FEAT_TIMERS |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2192 if (did_add_timer) |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2193 { |
17958
1d69e11db360
patch 8.1.1975: MS-Windows GUI responds slowly to timer
Bram Moolenaar <Bram@vim.org>
parents:
16827
diff
changeset
|
2194 // Need to recompute the waiting time. |
9179
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2195 remove_any_timer(); |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2196 break; |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2197 } |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2198 #endif |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2199 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2200 allow_scrollbar = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2201 return FAIL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2202 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2203 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2204 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2205 * 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
|
2206 * (row2, col2) inclusive. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2207 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2208 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2209 gui_mch_clear_block( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2210 int row1, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2211 int col1, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2212 int row2, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2213 int col2) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2214 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2215 RECT rc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2216 |
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 * 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
|
2219 * spilled over to the window border. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2220 * 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
|
2221 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2222 rc.left = FILL_X(col1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2223 rc.top = FILL_Y(row1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2224 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
|
2225 rc.bottom = FILL_Y(row2 + 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2226 clear_rect(&rc); |
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 |
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 * Clear the whole text window. |
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 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2233 gui_mch_clear_all(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2234 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2235 RECT rc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2236 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2237 rc.left = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2238 rc.top = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2239 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
|
2240 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
|
2241 clear_rect(&rc); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2242 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2243 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2244 * Menu stuff. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2245 */ |
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 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2248 gui_mch_enable_menu(int flag) |
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 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2251 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
|
2252 #endif |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2255 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2256 gui_mch_set_menu_pos( |
10783
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
2257 int x UNUSED, |
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
2258 int y UNUSED, |
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
2259 int w UNUSED, |
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
2260 int h UNUSED) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2261 { |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2262 // It will be in the right place anyway |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2263 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2264 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2265 #if defined(FEAT_MENU) || defined(PROTO) |
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 * 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
|
2268 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2269 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2270 gui_mch_menu_hidden( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2271 vimmenu_T *menu, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2272 int hidden) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2273 { |
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 * 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
|
2276 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2277 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2278 if (hidden) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2279 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
|
2280 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2281 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
|
2282 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2283 gui_mch_menu_grey(menu, hidden); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2284 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2285 |
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 * 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
|
2288 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2289 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2290 gui_mch_draw_menubar(void) |
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 DrawMenuBar(s_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2293 } |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2294 #endif // FEAT_MENU |
8140
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2297 * 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
|
2298 */ |
9939
ccb6461b82df
commit https://github.com/vim/vim/commit/1b58cdd160c2e0ada0f638679a2aa27e4665fc48
Christian Brabandt <cb@256bit.org>
parents:
9834
diff
changeset
|
2299 guicolor_T |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2300 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
|
2301 { |
9939
ccb6461b82df
commit https://github.com/vim/vim/commit/1b58cdd160c2e0ada0f638679a2aa27e4665fc48
Christian Brabandt <cb@256bit.org>
parents:
9834
diff
changeset
|
2302 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
|
2303 + GetBValue(pixel)); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2304 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2305 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2306 #if defined(FEAT_GUI_DIALOG) || defined(PROTO) |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2307 /* |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2308 * Convert pixels in X to dialog units |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2309 */ |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2310 static WORD |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2311 PixelToDialogX(int numPixels) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2312 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2313 return (WORD)((numPixels * 4) / s_dlgfntwidth); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2314 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2315 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2316 /* |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2317 * Convert pixels in Y to dialog units |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2318 */ |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2319 static WORD |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2320 PixelToDialogY(int numPixels) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2321 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2322 return (WORD)((numPixels * 8) / s_dlgfntheight); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2323 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2324 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2325 /* |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2326 * Return the width in pixels of the given text in the given DC. |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2327 */ |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2328 static int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2329 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
|
2330 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2331 SIZE size; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2332 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2333 GetTextExtentPoint(hdc, (LPCSTR)str, len, &size); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2334 return size.cx; |
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 |
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 * 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
|
2339 * of 'encoding' to active codepage conversion. |
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 static int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2342 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
|
2343 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2344 SIZE size; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2345 WCHAR *wstr; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2346 int n; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2347 int wlen = len; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2348 |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2349 wstr = enc_to_utf16(str, &wlen); |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2350 if (wstr == NULL) |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2351 return 0; |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2352 |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2353 n = GetTextExtentPointW(hdc, wstr, wlen, &size); |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2354 vim_free(wstr); |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2355 if (n) |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2356 return size.cx; |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2357 return 0; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2358 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2359 |
10438
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2360 static void get_work_area(RECT *spi_rect); |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2361 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2362 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2363 * A quick little routine that will center one window over another, handy for |
10438
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2364 * dialog boxes. Taken from the Win32SDK samples and modified for multiple |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2365 * monitors. |
8140
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 static BOOL |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2368 CenterWindow( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2369 HWND hwndChild, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2370 HWND hwndParent) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2371 { |
10438
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2372 HMONITOR mon; |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2373 MONITORINFO moninfo; |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2374 RECT rChild, rParent, rScreen; |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2375 int wChild, hChild, wParent, hParent; |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2376 int xNew, yNew; |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2377 HDC hdc; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2378 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2379 GetWindowRect(hwndChild, &rChild); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2380 wChild = rChild.right - rChild.left; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2381 hChild = rChild.bottom - rChild.top; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2382 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2383 // If Vim is minimized put the window in the middle of the screen. |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2384 if (hwndParent == NULL || IsMinimized(hwndParent)) |
10438
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2385 get_work_area(&rParent); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2386 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2387 GetWindowRect(hwndParent, &rParent); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2388 wParent = rParent.right - rParent.left; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2389 hParent = rParent.bottom - rParent.top; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2390 |
10438
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2391 moninfo.cbSize = sizeof(MONITORINFO); |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2392 mon = MonitorFromWindow(hwndChild, MONITOR_DEFAULTTOPRIMARY); |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2393 if (mon != NULL && GetMonitorInfo(mon, &moninfo)) |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2394 { |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2395 rScreen = moninfo.rcWork; |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2396 } |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2397 else |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2398 { |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2399 hdc = GetDC(hwndChild); |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2400 rScreen.left = 0; |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2401 rScreen.top = 0; |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2402 rScreen.right = GetDeviceCaps(hdc, HORZRES); |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2403 rScreen.bottom = GetDeviceCaps(hdc, VERTRES); |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2404 ReleaseDC(hwndChild, hdc); |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2405 } |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2406 |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2407 xNew = rParent.left + ((wParent - wChild) / 2); |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2408 if (xNew < rScreen.left) |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2409 xNew = rScreen.left; |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2410 else if ((xNew + wChild) > rScreen.right) |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2411 xNew = rScreen.right - wChild; |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2412 |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2413 yNew = rParent.top + ((hParent - hChild) / 2); |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2414 if (yNew < rScreen.top) |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2415 yNew = rScreen.top; |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2416 else if ((yNew + hChild) > rScreen.bottom) |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2417 yNew = rScreen.bottom - hChild; |
8140
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 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
|
2420 SWP_NOSIZE | SWP_NOZORDER); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2421 } |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2422 #endif // FEAT_GUI_DIALOG |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2423 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2424 #if defined(FEAT_TOOLBAR) || defined(PROTO) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2425 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2426 gui_mch_show_toolbar(int showit) |
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 if (s_toolbarhwnd == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2429 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2430 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2431 if (showit) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2432 { |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2433 // Enable unicode support |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2434 SendMessage(s_toolbarhwnd, TB_SETUNICODEFORMAT, (WPARAM)TRUE, |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2435 (LPARAM)0); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2436 ShowWindow(s_toolbarhwnd, SW_SHOW); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2437 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2438 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2439 ShowWindow(s_toolbarhwnd, SW_HIDE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2440 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2441 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2442 // The number of bitmaps is fixed. Exit is missing! |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2443 # define TOOLBAR_BITMAP_COUNT 31 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2444 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2445 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2446 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2447 #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
|
2448 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2449 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
|
2450 { |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2451 WCHAR *wn; |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2452 MENUITEMINFOW infow; |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2453 |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2454 wn = enc_to_utf16(item_text, NULL); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2455 if (wn == NULL) |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2456 return; |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2457 |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2458 infow.cbSize = sizeof(infow); |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2459 infow.fMask = MIIM_TYPE | MIIM_ID; |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2460 infow.wID = item_id; |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2461 infow.fType = MFT_STRING; |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2462 infow.dwTypeData = wn; |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2463 infow.cch = (UINT)wcslen(wn); |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2464 InsertMenuItemW(pmenu, item_id, FALSE, &infow); |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2465 vim_free(wn); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2466 } |
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 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2469 show_tabline_popup_menu(void) |
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 HMENU tab_pmenu; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2472 long rval; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2473 POINT pt; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2474 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2475 // When ignoring events don't show the menu. |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2476 if (hold_gui_events |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2477 # ifdef FEAT_CMDWIN |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2478 || cmdwin_type != 0 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2479 # endif |
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 return; |
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 tab_pmenu = CreatePopupMenu(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2484 if (tab_pmenu == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2485 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2486 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2487 if (first_tabpage->tp_next != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2488 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
|
2489 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
|
2490 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
|
2491 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
|
2492 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
|
2493 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
|
2494 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2495 GetCursorPos(&pt); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2496 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
|
2497 NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2498 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2499 DestroyMenu(tab_pmenu); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2500 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2501 // Add the string cmd into input buffer |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2502 if (rval > 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2503 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2504 TCHITTESTINFO htinfo; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2505 int idx; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2506 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2507 if (ScreenToClient(s_tabhwnd, &pt) == 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2508 return; |
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 htinfo.pt.x = pt.x; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2511 htinfo.pt.y = pt.y; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2512 idx = TabCtrl_HitTest(s_tabhwnd, &htinfo); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2513 if (idx == -1) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2514 idx = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2515 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2516 idx += 1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2517 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2518 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
|
2519 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2520 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2521 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2522 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2523 * Show or hide the tabline. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2524 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2525 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2526 gui_mch_show_tabline(int showit) |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2531 if (!showit != !showing_tabline) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2532 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2533 if (showit) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2534 ShowWindow(s_tabhwnd, SW_SHOW); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2535 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2536 ShowWindow(s_tabhwnd, SW_HIDE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2537 showing_tabline = showit; |
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 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2540 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2541 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2542 * Return TRUE when tabline is displayed. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2543 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2544 int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2545 gui_mch_showing_tabline(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2546 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2547 return s_tabhwnd != NULL && showing_tabline; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2548 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2549 |
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 * Update the labels of the tabline. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2552 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2553 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2554 gui_mch_update_tabline(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2555 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2556 tabpage_T *tp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2557 TCITEM tie; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2558 int nr = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2559 int curtabidx = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2560 int tabadded = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2561 WCHAR *wstr = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2562 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2563 if (s_tabhwnd == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2564 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2565 |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2566 // Enable unicode support |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2567 SendMessage(s_tabhwnd, CCM_SETUNICODEFORMAT, (WPARAM)TRUE, (LPARAM)0); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2568 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2569 tie.mask = TCIF_TEXT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2570 tie.iImage = -1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2571 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2572 // Disable redraw for tab updates to eliminate O(N^2) draws. |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2573 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
|
2574 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2575 // Add a label for each tab page. They all contain the same text area. |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2576 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
|
2577 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2578 if (tp == curtab) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2579 curtabidx = nr; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2580 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2581 if (nr >= TabCtrl_GetItemCount(s_tabhwnd)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2582 { |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2583 // Add the tab |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2584 tie.pszText = "-Empty-"; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2585 TabCtrl_InsertItem(s_tabhwnd, nr, &tie); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2586 tabadded = 1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2587 } |
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 get_tabline_label(tp, FALSE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2590 tie.pszText = (LPSTR)NameBuff; |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2591 |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2592 wstr = enc_to_utf16(NameBuff, NULL); |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2593 if (wstr != NULL) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2594 { |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2595 TCITEMW tiw; |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2596 |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2597 tiw.mask = TCIF_TEXT; |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2598 tiw.iImage = -1; |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2599 tiw.pszText = wstr; |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2600 SendMessage(s_tabhwnd, TCM_SETITEMW, (WPARAM)nr, (LPARAM)&tiw); |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2601 vim_free(wstr); |
8140
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 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2604 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2605 // Remove any old labels. |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2606 while (nr < TabCtrl_GetItemCount(s_tabhwnd)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2607 TabCtrl_DeleteItem(s_tabhwnd, nr); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2608 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2609 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
|
2610 TabCtrl_SetCurSel(s_tabhwnd, curtabidx); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2611 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2612 // Re-enable redraw and redraw. |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2613 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
|
2614 RedrawWindow(s_tabhwnd, NULL, NULL, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2615 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
|
2616 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2617 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
|
2618 TabCtrl_SetCurSel(s_tabhwnd, curtabidx); |
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 |
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 * 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
|
2623 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2624 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2625 gui_mch_set_curtab(int nr) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2626 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2627 if (s_tabhwnd == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2628 return; |
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 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
|
2631 TabCtrl_SetCurSel(s_tabhwnd, nr - 1); |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2634 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2635 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2636 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2637 * ":simalt" command. |
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 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2640 ex_simalt(exarg_T *eap) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2641 { |
11386
e2b34123c7dc
patch 8.0.0578: :simalt on MS-Windows does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
2642 char_u *keys = eap->arg; |
e2b34123c7dc
patch 8.0.0578: :simalt on MS-Windows does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
2643 int fill_typebuf = FALSE; |
e2b34123c7dc
patch 8.0.0578: :simalt on MS-Windows does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
2644 char_u key_name[4]; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2645 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2646 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
|
2647 while (*keys) |
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 if (*keys == '~') |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2650 *keys = ' '; // for showing system menu |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2651 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
|
2652 keys++; |
11386
e2b34123c7dc
patch 8.0.0578: :simalt on MS-Windows does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
2653 fill_typebuf = TRUE; |
e2b34123c7dc
patch 8.0.0578: :simalt on MS-Windows does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
2654 } |
e2b34123c7dc
patch 8.0.0578: :simalt on MS-Windows does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
2655 if (fill_typebuf) |
e2b34123c7dc
patch 8.0.0578: :simalt on MS-Windows does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
2656 { |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2657 // Put a NOP in the typeahead buffer so that the message will get |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2658 // processed. |
11386
e2b34123c7dc
patch 8.0.0578: :simalt on MS-Windows does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
2659 key_name[0] = K_SPECIAL; |
e2b34123c7dc
patch 8.0.0578: :simalt on MS-Windows does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
2660 key_name[1] = KS_EXTRA; |
11410
db21cc7b40f0
patch 8.0.0589: :simalt still does not work
Christian Brabandt <cb@256bit.org>
parents:
11386
diff
changeset
|
2661 key_name[2] = KE_NOP; |
11386
e2b34123c7dc
patch 8.0.0578: :simalt on MS-Windows does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
2662 key_name[3] = NUL; |
18416
59b3d19511d0
patch 8.1.2202: MS-Windows: build failure with GUI and small features
Bram Moolenaar <Bram@vim.org>
parents:
18301
diff
changeset
|
2663 #if defined(FEAT_CLIENTSERVER) || defined(FEAT_EVAL) |
11386
e2b34123c7dc
patch 8.0.0578: :simalt on MS-Windows does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
2664 typebuf_was_filled = TRUE; |
18416
59b3d19511d0
patch 8.1.2202: MS-Windows: build failure with GUI and small features
Bram Moolenaar <Bram@vim.org>
parents:
18301
diff
changeset
|
2665 #endif |
11386
e2b34123c7dc
patch 8.0.0578: :simalt on MS-Windows does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
2666 (void)ins_typebuf(key_name, REMAP_NONE, 0, TRUE, FALSE); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2667 } |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2670 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2671 * Create the find & replace dialogs. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2672 * 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
|
2673 * 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
|
2674 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2675 #ifdef MSWIN_FIND_REPLACE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2676 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2677 initialise_findrep(char_u *initial_string) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2678 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2679 int wword = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2680 int mcase = !p_ic; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2681 char_u *entry_text; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2682 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2683 // Get the search string to use. |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2684 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
|
2685 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2686 s_findrep_struct.hwndOwner = s_hwnd; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2687 s_findrep_struct.Flags = FR_DOWN; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2688 if (mcase) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2689 s_findrep_struct.Flags |= FR_MATCHCASE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2690 if (wword) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2691 s_findrep_struct.Flags |= FR_WHOLEWORD; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2692 if (entry_text != NULL && *entry_text != NUL) |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2693 { |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2694 WCHAR *p = enc_to_utf16(entry_text, NULL); |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2695 if (p != NULL) |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2696 { |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2697 int len = s_findrep_struct.wFindWhatLen - 1; |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2698 |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2699 wcsncpy(s_findrep_struct.lpstrFindWhat, p, len); |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2700 s_findrep_struct.lpstrFindWhat[len] = NUL; |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2701 vim_free(p); |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2702 } |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2703 } |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2704 vim_free(entry_text); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2705 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2706 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2707 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2708 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2709 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
|
2710 { |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2711 if (title != NULL) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2712 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2713 WCHAR *wbuf; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2714 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2715 // Convert the title from 'encoding' to UTF-16. |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2716 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
|
2717 if (wbuf != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2718 { |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
2719 SetWindowTextW(hwnd, wbuf); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2720 vim_free(wbuf); |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
2721 } |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2722 } |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2723 else |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2724 (void)SetWindowTextW(hwnd, NULL); |
8140
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2727 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2728 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
|
2729 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2730 #ifdef MSWIN_FIND_REPLACE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2731 if (s_findrep_msg != 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2732 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2733 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
|
2734 DestroyWindow(s_findrep_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2735 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2736 if (!IsWindow(s_findrep_hwnd)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2737 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2738 initialise_findrep(eap->arg); |
27281
f7d73708b391
patch 8.2.4169: MS-Windows: unnessary casts and other minor things
Bram Moolenaar <Bram@vim.org>
parents:
27261
diff
changeset
|
2739 s_findrep_hwnd = FindTextW(&s_findrep_struct); |
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 |
14364
d876b8588731
patch 8.1.0197: Windows GUI: title for search/replace is wrong
Christian Brabandt <cb@256bit.org>
parents:
14208
diff
changeset
|
2742 set_window_title(s_findrep_hwnd, _("Find string")); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2743 (void)SetFocus(s_findrep_hwnd); |
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 s_findrep_is_find = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2746 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2747 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2748 } |
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 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2752 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
|
2753 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2754 #ifdef MSWIN_FIND_REPLACE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2755 if (s_findrep_msg != 0) |
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 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
|
2758 DestroyWindow(s_findrep_hwnd); |
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 if (!IsWindow(s_findrep_hwnd)) |
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 initialise_findrep(eap->arg); |
27281
f7d73708b391
patch 8.2.4169: MS-Windows: unnessary casts and other minor things
Bram Moolenaar <Bram@vim.org>
parents:
27261
diff
changeset
|
2763 s_findrep_hwnd = ReplaceTextW(&s_findrep_struct); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2764 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2765 |
14364
d876b8588731
patch 8.1.0197: Windows GUI: title for search/replace is wrong
Christian Brabandt <cb@256bit.org>
parents:
14208
diff
changeset
|
2766 set_window_title(s_findrep_hwnd, _("Find & Replace")); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2767 (void)SetFocus(s_findrep_hwnd); |
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 s_findrep_is_find = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2770 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2771 #endif |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2775 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2776 * Set visibility of the pointer. |
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 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2779 gui_mch_mousehide(int hide) |
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 if (hide != gui.pointer_hidden) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2782 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2783 ShowCursor(!hide); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2784 gui.pointer_hidden = hide; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2785 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2786 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2787 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2788 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2789 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2790 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
|
2791 { |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2792 // Unhide the mouse, we don't get move events here. |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2793 gui_mch_mousehide(FALSE); |
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 (void)TrackPopupMenu( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2796 (HMENU)menu->submenu_id, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2797 TPM_LEFTALIGN | TPM_LEFTBUTTON, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2798 x, y, |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2799 (int)0, //reserved param |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2800 s_hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2801 NULL); |
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 * 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
|
2804 * 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
|
2805 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2806 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2807 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2808 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2809 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2810 * 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
|
2811 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2812 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2813 _OnEndSession(void) |
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 getout_preserve_modified(1); |
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 |
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 * 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
|
2820 * of a Windows95 window. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2821 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2822 static void |
10783
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
2823 _OnClose(HWND hwnd UNUSED) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2824 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2825 gui_shell_closed(); |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2828 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2829 * 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
|
2830 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2831 static void |
10783
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
2832 _OnDestroy(HWND hwnd) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2833 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2834 if (!destroying) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2835 _OnClose(hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2836 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2837 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2838 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2839 _OnPaint( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2840 HWND hwnd) |
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 if (!IsMinimized(hwnd)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2843 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2844 PAINTSTRUCT ps; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2845 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2846 out_flush(); // make sure all output has been processed |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2847 (void)BeginPaint(hwnd, &ps); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2848 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2849 // prevent multi-byte characters from misprinting on an invalid |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2850 // rectangle |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2851 if (has_mbyte) |
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 RECT rect; |
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 GetClientRect(hwnd, &rect); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2856 ps.rcPaint.left = rect.left; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2857 ps.rcPaint.right = rect.right; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2858 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2859 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2860 if (!IsRectEmpty(&ps.rcPaint)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2861 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2862 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
|
2863 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
|
2864 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
|
2865 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2866 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2867 EndPaint(hwnd, &ps); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2868 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2869 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2870 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2871 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2872 _OnSize( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2873 HWND hwnd, |
10783
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
2874 UINT state UNUSED, |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2875 int cx, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2876 int cy) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2877 { |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
2878 if (!IsMinimized(hwnd) && !s_in_dpichanged) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2879 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2880 gui_resize_shell(cx, cy); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2881 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2882 // Menu bar may wrap differently now |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2883 gui_mswin_get_menu_height(TRUE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2884 } |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2887 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2888 _OnSetFocus( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2889 HWND hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2890 HWND hwndOldFocus) |
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 gui_focus_change(TRUE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2893 s_getting_focus = TRUE; |
27249
d5570658f18d
patch 8.2.4153: MS-Windows: Global IME is no longer supported
Bram Moolenaar <Bram@vim.org>
parents:
27229
diff
changeset
|
2894 (void)DefWindowProcW(hwnd, WM_SETFOCUS, (WPARAM)hwndOldFocus, 0); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2895 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2896 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2897 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2898 _OnKillFocus( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2899 HWND hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2900 HWND hwndNewFocus) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2901 { |
27871
2be33ea63428
patch 8.2.4461: MS-Windows: garbage characters on stdout with VIMDLL
Bram Moolenaar <Bram@vim.org>
parents:
27525
diff
changeset
|
2902 if (destroying) |
2be33ea63428
patch 8.2.4461: MS-Windows: garbage characters on stdout with VIMDLL
Bram Moolenaar <Bram@vim.org>
parents:
27525
diff
changeset
|
2903 return; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2904 gui_focus_change(FALSE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2905 s_getting_focus = FALSE; |
27249
d5570658f18d
patch 8.2.4153: MS-Windows: Global IME is no longer supported
Bram Moolenaar <Bram@vim.org>
parents:
27229
diff
changeset
|
2906 (void)DefWindowProcW(hwnd, WM_KILLFOCUS, (WPARAM)hwndNewFocus, 0); |
8140
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2909 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2910 * 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
|
2911 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2912 static LRESULT |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2913 _OnActivateApp( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2914 HWND hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2915 BOOL fActivate, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2916 DWORD dwThreadId) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2917 { |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2918 // we call gui_focus_change() in _OnSetFocus() |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
2919 // gui_focus_change((int)fActivate); |
27249
d5570658f18d
patch 8.2.4153: MS-Windows: Global IME is no longer supported
Bram Moolenaar <Bram@vim.org>
parents:
27229
diff
changeset
|
2920 return DefWindowProcW(hwnd, WM_ACTIVATEAPP, fActivate, (DWORD)dwThreadId); |
8140
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2923 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2924 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
|
2925 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2926 DestroyWindow(sb->id); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2927 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2928 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2929 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2930 * 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
|
2931 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2932 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2933 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
|
2934 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2935 RECT rct; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2936 POINT mp; |
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)GetWindowRect(s_textArea, &rct); |
27281
f7d73708b391
patch 8.2.4169: MS-Windows: unnessary casts and other minor things
Bram Moolenaar <Bram@vim.org>
parents:
27261
diff
changeset
|
2939 (void)GetCursorPos(&mp); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2940 *x = (int)(mp.x - rct.left); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2941 *y = (int)(mp.y - rct.top); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2942 } |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2945 * 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
|
2946 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2947 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2948 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
|
2949 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2950 RECT rct; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2951 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2952 (void)GetWindowRect(s_textArea, &rct); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2953 (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
|
2954 y + gui.border_offset + rct.top); |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2957 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2958 gui_mswin_get_valid_dimensions( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2959 int w, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2960 int h, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2961 int *valid_w, |
24804
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
2962 int *valid_h, |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
2963 int *cols, |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
2964 int *rows) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2965 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2966 int base_width, base_height; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2967 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2968 base_width = gui_get_base_width() |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
2969 + (pGetSystemMetricsForDpi(SM_CXFRAME, s_dpi) + |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
2970 pGetSystemMetricsForDpi(SM_CXPADDEDBORDER, s_dpi)) * 2; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2971 base_height = gui_get_base_height() |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
2972 + (pGetSystemMetricsForDpi(SM_CYFRAME, s_dpi) + |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
2973 pGetSystemMetricsForDpi(SM_CXPADDEDBORDER, s_dpi)) * 2 |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
2974 + pGetSystemMetricsForDpi(SM_CYCAPTION, s_dpi) |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
2975 + gui_mswin_get_menu_height(FALSE); |
24804
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
2976 *cols = (w - base_width) / gui.char_width; |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
2977 *rows = (h - base_height) / gui.char_height; |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
2978 *valid_w = base_width + *cols * gui.char_width; |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
2979 *valid_h = base_height + *rows * gui.char_height; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2980 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2981 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2982 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2983 gui_mch_flash(int msec) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2984 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2985 RECT rc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2986 |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
2987 #if defined(FEAT_DIRECTX) |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
2988 if (IS_ENABLE_DIRECTX()) |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
2989 DWriteContext_Flush(s_dwc); |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
2990 #endif |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
2991 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2992 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2993 * 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
|
2994 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2995 rc.left = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2996 rc.top = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2997 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
|
2998 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
|
2999 InvertRect(s_hdc, &rc); |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3000 gui_mch_flush(); // make sure it's displayed |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3001 |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3002 ui_delay((long)msec, TRUE); // wait for a few msec |
8140
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 InvertRect(s_hdc, &rc); |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3007 /* |
22748
837983942264
patch 8.2.1922: Win32: scrolling problems when part of window is off-screen
Bram Moolenaar <Bram@vim.org>
parents:
22407
diff
changeset
|
3008 * Check if the specified point is on-screen. (multi-monitor aware) |
837983942264
patch 8.2.1922: Win32: scrolling problems when part of window is off-screen
Bram Moolenaar <Bram@vim.org>
parents:
22407
diff
changeset
|
3009 */ |
837983942264
patch 8.2.1922: Win32: scrolling problems when part of window is off-screen
Bram Moolenaar <Bram@vim.org>
parents:
22407
diff
changeset
|
3010 static BOOL |
837983942264
patch 8.2.1922: Win32: scrolling problems when part of window is off-screen
Bram Moolenaar <Bram@vim.org>
parents:
22407
diff
changeset
|
3011 is_point_onscreen(int x, int y) |
837983942264
patch 8.2.1922: Win32: scrolling problems when part of window is off-screen
Bram Moolenaar <Bram@vim.org>
parents:
22407
diff
changeset
|
3012 { |
837983942264
patch 8.2.1922: Win32: scrolling problems when part of window is off-screen
Bram Moolenaar <Bram@vim.org>
parents:
22407
diff
changeset
|
3013 POINT pt = {x, y}; |
837983942264
patch 8.2.1922: Win32: scrolling problems when part of window is off-screen
Bram Moolenaar <Bram@vim.org>
parents:
22407
diff
changeset
|
3014 |
837983942264
patch 8.2.1922: Win32: scrolling problems when part of window is off-screen
Bram Moolenaar <Bram@vim.org>
parents:
22407
diff
changeset
|
3015 return MonitorFromPoint(pt, MONITOR_DEFAULTTONULL) != NULL; |
837983942264
patch 8.2.1922: Win32: scrolling problems when part of window is off-screen
Bram Moolenaar <Bram@vim.org>
parents:
22407
diff
changeset
|
3016 } |
837983942264
patch 8.2.1922: Win32: scrolling problems when part of window is off-screen
Bram Moolenaar <Bram@vim.org>
parents:
22407
diff
changeset
|
3017 |
837983942264
patch 8.2.1922: Win32: scrolling problems when part of window is off-screen
Bram Moolenaar <Bram@vim.org>
parents:
22407
diff
changeset
|
3018 /* |
27922
b4ef8f851be4
patch 8.2.4486: MS-Windows GUI: slow scrolling with maximized window
Bram Moolenaar <Bram@vim.org>
parents:
27871
diff
changeset
|
3019 * Check if the whole client area of the specified window is on-screen. |
22748
837983942264
patch 8.2.1922: Win32: scrolling problems when part of window is off-screen
Bram Moolenaar <Bram@vim.org>
parents:
22407
diff
changeset
|
3020 * |
837983942264
patch 8.2.1922: Win32: scrolling problems when part of window is off-screen
Bram Moolenaar <Bram@vim.org>
parents:
22407
diff
changeset
|
3021 * Note about DirectX: Windows 10 1809 or above no longer maintains image of |
837983942264
patch 8.2.1922: Win32: scrolling problems when part of window is off-screen
Bram Moolenaar <Bram@vim.org>
parents:
22407
diff
changeset
|
3022 * the window portion that is off-screen. Scrolling by DWriteContext_Scroll() |
837983942264
patch 8.2.1922: Win32: scrolling problems when part of window is off-screen
Bram Moolenaar <Bram@vim.org>
parents:
22407
diff
changeset
|
3023 * only works when the whole window is on-screen. |
837983942264
patch 8.2.1922: Win32: scrolling problems when part of window is off-screen
Bram Moolenaar <Bram@vim.org>
parents:
22407
diff
changeset
|
3024 */ |
837983942264
patch 8.2.1922: Win32: scrolling problems when part of window is off-screen
Bram Moolenaar <Bram@vim.org>
parents:
22407
diff
changeset
|
3025 static BOOL |
837983942264
patch 8.2.1922: Win32: scrolling problems when part of window is off-screen
Bram Moolenaar <Bram@vim.org>
parents:
22407
diff
changeset
|
3026 is_window_onscreen(HWND hwnd) |
837983942264
patch 8.2.1922: Win32: scrolling problems when part of window is off-screen
Bram Moolenaar <Bram@vim.org>
parents:
22407
diff
changeset
|
3027 { |
837983942264
patch 8.2.1922: Win32: scrolling problems when part of window is off-screen
Bram Moolenaar <Bram@vim.org>
parents:
22407
diff
changeset
|
3028 RECT rc; |
27922
b4ef8f851be4
patch 8.2.4486: MS-Windows GUI: slow scrolling with maximized window
Bram Moolenaar <Bram@vim.org>
parents:
27871
diff
changeset
|
3029 POINT p1, p2; |
b4ef8f851be4
patch 8.2.4486: MS-Windows GUI: slow scrolling with maximized window
Bram Moolenaar <Bram@vim.org>
parents:
27871
diff
changeset
|
3030 |
b4ef8f851be4
patch 8.2.4486: MS-Windows GUI: slow scrolling with maximized window
Bram Moolenaar <Bram@vim.org>
parents:
27871
diff
changeset
|
3031 GetClientRect(hwnd, &rc); |
b4ef8f851be4
patch 8.2.4486: MS-Windows GUI: slow scrolling with maximized window
Bram Moolenaar <Bram@vim.org>
parents:
27871
diff
changeset
|
3032 p1.x = rc.left; |
b4ef8f851be4
patch 8.2.4486: MS-Windows GUI: slow scrolling with maximized window
Bram Moolenaar <Bram@vim.org>
parents:
27871
diff
changeset
|
3033 p1.y = rc.top; |
b4ef8f851be4
patch 8.2.4486: MS-Windows GUI: slow scrolling with maximized window
Bram Moolenaar <Bram@vim.org>
parents:
27871
diff
changeset
|
3034 p2.x = rc.right - 1; |
b4ef8f851be4
patch 8.2.4486: MS-Windows GUI: slow scrolling with maximized window
Bram Moolenaar <Bram@vim.org>
parents:
27871
diff
changeset
|
3035 p2.y = rc.bottom - 1; |
b4ef8f851be4
patch 8.2.4486: MS-Windows GUI: slow scrolling with maximized window
Bram Moolenaar <Bram@vim.org>
parents:
27871
diff
changeset
|
3036 ClientToScreen(hwnd, &p1); |
b4ef8f851be4
patch 8.2.4486: MS-Windows GUI: slow scrolling with maximized window
Bram Moolenaar <Bram@vim.org>
parents:
27871
diff
changeset
|
3037 ClientToScreen(hwnd, &p2); |
b4ef8f851be4
patch 8.2.4486: MS-Windows GUI: slow scrolling with maximized window
Bram Moolenaar <Bram@vim.org>
parents:
27871
diff
changeset
|
3038 |
b4ef8f851be4
patch 8.2.4486: MS-Windows GUI: slow scrolling with maximized window
Bram Moolenaar <Bram@vim.org>
parents:
27871
diff
changeset
|
3039 if (!is_point_onscreen(p1.x, p1.y)) |
22748
837983942264
patch 8.2.1922: Win32: scrolling problems when part of window is off-screen
Bram Moolenaar <Bram@vim.org>
parents:
22407
diff
changeset
|
3040 return FALSE; |
27922
b4ef8f851be4
patch 8.2.4486: MS-Windows GUI: slow scrolling with maximized window
Bram Moolenaar <Bram@vim.org>
parents:
27871
diff
changeset
|
3041 if (!is_point_onscreen(p1.x, p2.y)) |
22748
837983942264
patch 8.2.1922: Win32: scrolling problems when part of window is off-screen
Bram Moolenaar <Bram@vim.org>
parents:
22407
diff
changeset
|
3042 return FALSE; |
27922
b4ef8f851be4
patch 8.2.4486: MS-Windows GUI: slow scrolling with maximized window
Bram Moolenaar <Bram@vim.org>
parents:
27871
diff
changeset
|
3043 if (!is_point_onscreen(p2.x, p1.y)) |
22748
837983942264
patch 8.2.1922: Win32: scrolling problems when part of window is off-screen
Bram Moolenaar <Bram@vim.org>
parents:
22407
diff
changeset
|
3044 return FALSE; |
27922
b4ef8f851be4
patch 8.2.4486: MS-Windows GUI: slow scrolling with maximized window
Bram Moolenaar <Bram@vim.org>
parents:
27871
diff
changeset
|
3045 if (!is_point_onscreen(p2.x, p2.y)) |
22748
837983942264
patch 8.2.1922: Win32: scrolling problems when part of window is off-screen
Bram Moolenaar <Bram@vim.org>
parents:
22407
diff
changeset
|
3046 return FALSE; |
837983942264
patch 8.2.1922: Win32: scrolling problems when part of window is off-screen
Bram Moolenaar <Bram@vim.org>
parents:
22407
diff
changeset
|
3047 return TRUE; |
837983942264
patch 8.2.1922: Win32: scrolling problems when part of window is off-screen
Bram Moolenaar <Bram@vim.org>
parents:
22407
diff
changeset
|
3048 } |
837983942264
patch 8.2.1922: Win32: scrolling problems when part of window is off-screen
Bram Moolenaar <Bram@vim.org>
parents:
22407
diff
changeset
|
3049 |
837983942264
patch 8.2.1922: Win32: scrolling problems when part of window is off-screen
Bram Moolenaar <Bram@vim.org>
parents:
22407
diff
changeset
|
3050 /* |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3051 * Return flags used for scrolling. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3052 * 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
|
3053 * 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
|
3054 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3055 static int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3056 get_scroll_flags(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3057 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3058 HWND hwnd; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3059 RECT rcVim, rcOther, rcDest; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3060 |
22748
837983942264
patch 8.2.1922: Win32: scrolling problems when part of window is off-screen
Bram Moolenaar <Bram@vim.org>
parents:
22407
diff
changeset
|
3061 // Check if the window is (partly) off-screen. |
837983942264
patch 8.2.1922: Win32: scrolling problems when part of window is off-screen
Bram Moolenaar <Bram@vim.org>
parents:
22407
diff
changeset
|
3062 if (!is_window_onscreen(s_hwnd)) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3063 return SW_INVALIDATE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3064 |
26771
fc859aea8cec
patch 8.2.3914: various spelling mistakes in comments
Bram Moolenaar <Bram@vim.org>
parents:
24804
diff
changeset
|
3065 // Check if there is a window (partly) on top of us. |
22748
837983942264
patch 8.2.1922: Win32: scrolling problems when part of window is off-screen
Bram Moolenaar <Bram@vim.org>
parents:
22407
diff
changeset
|
3066 GetWindowRect(s_hwnd, &rcVim); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3067 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
|
3068 if (IsWindowVisible(hwnd)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3069 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3070 GetWindowRect(hwnd, &rcOther); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3071 if (IntersectRect(&rcDest, &rcVim, &rcOther)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3072 return SW_INVALIDATE; |
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 return 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3075 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3076 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3077 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3078 * 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
|
3079 * may not be scrolled out properly. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3080 * 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
|
3081 * 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
|
3082 * 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
|
3083 * the region before ScrollWindowEx(). |
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 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3086 intel_gpu_workaround(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3087 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3088 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
|
3089 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3090 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3091 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3092 * 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
|
3093 * 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
|
3094 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3095 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3096 gui_mch_delete_lines( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3097 int row, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3098 int num_lines) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3099 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3100 RECT rc; |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
3101 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3102 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
|
3103 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
|
3104 rc.top = FILL_Y(row); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3105 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
|
3106 |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
3107 #if defined(FEAT_DIRECTX) |
22748
837983942264
patch 8.2.1922: Win32: scrolling problems when part of window is off-screen
Bram Moolenaar <Bram@vim.org>
parents:
22407
diff
changeset
|
3108 if (IS_ENABLE_DIRECTX() && is_window_onscreen(s_hwnd)) |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
3109 { |
13150
808625d4b71b
patch 8.0.1449: slow redrawing with DirectX
Christian Brabandt <cb@256bit.org>
parents:
13028
diff
changeset
|
3110 DWriteContext_Scroll(s_dwc, 0, -num_lines * gui.char_height, &rc); |
808625d4b71b
patch 8.0.1449: slow redrawing with DirectX
Christian Brabandt <cb@256bit.org>
parents:
13028
diff
changeset
|
3111 } |
808625d4b71b
patch 8.0.1449: slow redrawing with DirectX
Christian Brabandt <cb@256bit.org>
parents:
13028
diff
changeset
|
3112 else |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
3113 #endif |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
3114 { |
22748
837983942264
patch 8.2.1922: Win32: scrolling problems when part of window is off-screen
Bram Moolenaar <Bram@vim.org>
parents:
22407
diff
changeset
|
3115 #if defined(FEAT_DIRECTX) |
837983942264
patch 8.2.1922: Win32: scrolling problems when part of window is off-screen
Bram Moolenaar <Bram@vim.org>
parents:
22407
diff
changeset
|
3116 if (IS_ENABLE_DIRECTX()) |
837983942264
patch 8.2.1922: Win32: scrolling problems when part of window is off-screen
Bram Moolenaar <Bram@vim.org>
parents:
22407
diff
changeset
|
3117 DWriteContext_Flush(s_dwc); |
837983942264
patch 8.2.1922: Win32: scrolling problems when part of window is off-screen
Bram Moolenaar <Bram@vim.org>
parents:
22407
diff
changeset
|
3118 #endif |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
3119 intel_gpu_workaround(); |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
3120 ScrollWindowEx(s_textArea, 0, -num_lines * gui.char_height, |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3121 &rc, &rc, NULL, NULL, get_scroll_flags()); |
13028
cfce9ac1d1e8
patch 8.0.1390: DirectX scrolling can be slow, vertical positioning is off
Christian Brabandt <cb@256bit.org>
parents:
12994
diff
changeset
|
3122 UpdateWindow(s_textArea); |
cfce9ac1d1e8
patch 8.0.1390: DirectX scrolling can be slow, vertical positioning is off
Christian Brabandt <cb@256bit.org>
parents:
12994
diff
changeset
|
3123 } |
cfce9ac1d1e8
patch 8.0.1390: DirectX scrolling can be slow, vertical positioning is off
Christian Brabandt <cb@256bit.org>
parents:
12994
diff
changeset
|
3124 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3125 // This seems to be required to avoid the cursor disappearing when |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3126 // scrolling such that the cursor ends up in the top-left character on |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3127 // the screen... But why? (Webb) |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3128 // It's probably fixed by disabling drawing the cursor while scrolling. |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3129 // gui.cursor_is_valid = FALSE; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3130 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3131 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
|
3132 gui.scroll_region_left, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3133 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
|
3134 } |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3137 * 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
|
3138 * following text within the scroll region. |
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 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3141 gui_mch_insert_lines( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3142 int row, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3143 int num_lines) |
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 RECT rc; |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
3146 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3147 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
|
3148 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
|
3149 rc.top = FILL_Y(row); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3150 rc.bottom = FILL_Y(gui.scroll_region_bot + 1); |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
3151 |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
3152 #if defined(FEAT_DIRECTX) |
22748
837983942264
patch 8.2.1922: Win32: scrolling problems when part of window is off-screen
Bram Moolenaar <Bram@vim.org>
parents:
22407
diff
changeset
|
3153 if (IS_ENABLE_DIRECTX() && is_window_onscreen(s_hwnd)) |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
3154 { |
13150
808625d4b71b
patch 8.0.1449: slow redrawing with DirectX
Christian Brabandt <cb@256bit.org>
parents:
13028
diff
changeset
|
3155 DWriteContext_Scroll(s_dwc, 0, num_lines * gui.char_height, &rc); |
808625d4b71b
patch 8.0.1449: slow redrawing with DirectX
Christian Brabandt <cb@256bit.org>
parents:
13028
diff
changeset
|
3156 } |
808625d4b71b
patch 8.0.1449: slow redrawing with DirectX
Christian Brabandt <cb@256bit.org>
parents:
13028
diff
changeset
|
3157 else |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
3158 #endif |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
3159 { |
22748
837983942264
patch 8.2.1922: Win32: scrolling problems when part of window is off-screen
Bram Moolenaar <Bram@vim.org>
parents:
22407
diff
changeset
|
3160 #if defined(FEAT_DIRECTX) |
837983942264
patch 8.2.1922: Win32: scrolling problems when part of window is off-screen
Bram Moolenaar <Bram@vim.org>
parents:
22407
diff
changeset
|
3161 if (IS_ENABLE_DIRECTX()) |
837983942264
patch 8.2.1922: Win32: scrolling problems when part of window is off-screen
Bram Moolenaar <Bram@vim.org>
parents:
22407
diff
changeset
|
3162 DWriteContext_Flush(s_dwc); |
837983942264
patch 8.2.1922: Win32: scrolling problems when part of window is off-screen
Bram Moolenaar <Bram@vim.org>
parents:
22407
diff
changeset
|
3163 #endif |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
3164 intel_gpu_workaround(); |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3165 // The SW_INVALIDATE is required when part of the window is covered or |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3166 // off-screen. How do we avoid it when it's not needed? |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
3167 ScrollWindowEx(s_textArea, 0, num_lines * gui.char_height, |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3168 &rc, &rc, NULL, NULL, get_scroll_flags()); |
13028
cfce9ac1d1e8
patch 8.0.1390: DirectX scrolling can be slow, vertical positioning is off
Christian Brabandt <cb@256bit.org>
parents:
12994
diff
changeset
|
3169 UpdateWindow(s_textArea); |
cfce9ac1d1e8
patch 8.0.1390: DirectX scrolling can be slow, vertical positioning is off
Christian Brabandt <cb@256bit.org>
parents:
12994
diff
changeset
|
3170 } |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3171 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3172 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
|
3173 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
|
3174 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3175 |
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 void |
10783
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
3178 gui_mch_exit(int rc UNUSED) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3179 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3180 #if defined(FEAT_DIRECTX) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3181 DWriteContext_Close(s_dwc); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3182 DWrite_Final(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3183 s_dwc = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3184 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3185 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3186 ReleaseDC(s_textArea, s_hdc); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3187 DeleteObject(s_brush); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3188 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3189 #ifdef FEAT_TEAROFF |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3190 // Unload the tearoff bitmap |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3191 (void)DeleteObject((HGDIOBJ)s_htearbitmap); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3192 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3193 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3194 // Destroy our window (if we have one). |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3195 if (s_hwnd != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3196 { |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3197 destroying = TRUE; // ignore WM_DESTROY message now |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3198 DestroyWindow(s_hwnd); |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3202 static char_u * |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
3203 logfont2name(LOGFONTW lf) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3204 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3205 char *p; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3206 char *res; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3207 char *charset_name; |
8835
c1a5623cfc86
commit https://github.com/vim/vim/commit/7c1c6dbb6817640fd3956a0d5417da23fde336d8
Christian Brabandt <cb@256bit.org>
parents:
8813
diff
changeset
|
3208 char *quality_name; |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
3209 char *font_name; |
16439
9d20e26dc13c
patch 8.1.1224: MS-Windows: cannot specify font weight
Bram Moolenaar <Bram@vim.org>
parents:
16425
diff
changeset
|
3210 int points; |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
3211 |
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
3212 font_name = (char *)utf16_to_enc(lf.lfFaceName, NULL); |
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
3213 if (font_name == NULL) |
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
3214 return NULL; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3215 charset_name = charset_id2name((int)lf.lfCharSet); |
8835
c1a5623cfc86
commit https://github.com/vim/vim/commit/7c1c6dbb6817640fd3956a0d5417da23fde336d8
Christian Brabandt <cb@256bit.org>
parents:
8813
diff
changeset
|
3216 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
|
3217 |
16825
ce04ebdf26b8
patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
Bram Moolenaar <Bram@vim.org>
parents:
16768
diff
changeset
|
3218 res = alloc(strlen(font_name) + 30 |
16425
e263ace0c9d0
patch 8.1.1217: MS-Windows: no space reserved for font quality name
Bram Moolenaar <Bram@vim.org>
parents:
16196
diff
changeset
|
3219 + (charset_name == NULL ? 0 : strlen(charset_name) + 2) |
16764
ef00b6bc186b
patch 8.1.1384: using "int" for alloc() often results in compiler warnings
Bram Moolenaar <Bram@vim.org>
parents:
16606
diff
changeset
|
3220 + (quality_name == NULL ? 0 : strlen(quality_name) + 2)); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3221 if (res != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3222 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3223 p = res; |
16439
9d20e26dc13c
patch 8.1.1224: MS-Windows: cannot specify font weight
Bram Moolenaar <Bram@vim.org>
parents:
16425
diff
changeset
|
3224 // make a normal font string out of the lf thing: |
9d20e26dc13c
patch 8.1.1224: MS-Windows: cannot specify font weight
Bram Moolenaar <Bram@vim.org>
parents:
16425
diff
changeset
|
3225 points = pixels_to_points( |
9d20e26dc13c
patch 8.1.1224: MS-Windows: cannot specify font weight
Bram Moolenaar <Bram@vim.org>
parents:
16425
diff
changeset
|
3226 lf.lfHeight < 0 ? -lf.lfHeight : lf.lfHeight, TRUE); |
9d20e26dc13c
patch 8.1.1224: MS-Windows: cannot specify font weight
Bram Moolenaar <Bram@vim.org>
parents:
16425
diff
changeset
|
3227 if (lf.lfWeight == FW_NORMAL || lf.lfWeight == FW_BOLD) |
9d20e26dc13c
patch 8.1.1224: MS-Windows: cannot specify font weight
Bram Moolenaar <Bram@vim.org>
parents:
16425
diff
changeset
|
3228 sprintf((char *)p, "%s:h%d", font_name, points); |
9d20e26dc13c
patch 8.1.1224: MS-Windows: cannot specify font weight
Bram Moolenaar <Bram@vim.org>
parents:
16425
diff
changeset
|
3229 else |
16468
045ab97fe320
patch 8.1.1238: MS-Windows: compiler warning for sprintf() format
Bram Moolenaar <Bram@vim.org>
parents:
16451
diff
changeset
|
3230 sprintf((char *)p, "%s:h%d:W%ld", font_name, points, lf.lfWeight); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3231 while (*p) |
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 if (*p == ' ') |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3234 *p = '_'; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3235 ++p; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3236 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3237 if (lf.lfItalic) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3238 STRCAT(p, ":i"); |
16439
9d20e26dc13c
patch 8.1.1224: MS-Windows: cannot specify font weight
Bram Moolenaar <Bram@vim.org>
parents:
16425
diff
changeset
|
3239 if (lf.lfWeight == FW_BOLD) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3240 STRCAT(p, ":b"); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3241 if (lf.lfUnderline) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3242 STRCAT(p, ":u"); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3243 if (lf.lfStrikeOut) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3244 STRCAT(p, ":s"); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3245 if (charset_name != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3246 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3247 STRCAT(p, ":c"); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3248 STRCAT(p, charset_name); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3249 } |
8835
c1a5623cfc86
commit https://github.com/vim/vim/commit/7c1c6dbb6817640fd3956a0d5417da23fde336d8
Christian Brabandt <cb@256bit.org>
parents:
8813
diff
changeset
|
3250 if (quality_name != NULL) |
c1a5623cfc86
commit https://github.com/vim/vim/commit/7c1c6dbb6817640fd3956a0d5417da23fde336d8
Christian Brabandt <cb@256bit.org>
parents:
8813
diff
changeset
|
3251 { |
c1a5623cfc86
commit https://github.com/vim/vim/commit/7c1c6dbb6817640fd3956a0d5417da23fde336d8
Christian Brabandt <cb@256bit.org>
parents:
8813
diff
changeset
|
3252 STRCAT(p, ":q"); |
c1a5623cfc86
commit https://github.com/vim/vim/commit/7c1c6dbb6817640fd3956a0d5417da23fde336d8
Christian Brabandt <cb@256bit.org>
parents:
8813
diff
changeset
|
3253 STRCAT(p, quality_name); |
c1a5623cfc86
commit https://github.com/vim/vim/commit/7c1c6dbb6817640fd3956a0d5417da23fde336d8
Christian Brabandt <cb@256bit.org>
parents:
8813
diff
changeset
|
3254 } |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3255 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3256 |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
3257 vim_free(font_name); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3258 return (char_u *)res; |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3261 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3262 #ifdef FEAT_MBYTE_IME |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3263 /* |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
3264 * Set correct LOGFONTW to IME. Use 'guifontwide' if available, otherwise use |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
3265 * 'guifont'. |
8140
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 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3268 update_im_font(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3269 { |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
3270 LOGFONTW lf_wide, lf; |
8140
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 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
|
3273 && gui.wide_font != NOFONT |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
3274 && GetObjectW((HFONT)gui.wide_font, sizeof(lf_wide), &lf_wide)) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3275 norm_logfont = lf_wide; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3276 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3277 norm_logfont = sub_logfont; |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
3278 |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
3279 lf = norm_logfont; |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
3280 if (s_process_dpi_aware == DPI_AWARENESS_UNAWARE) |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
3281 // Work around when PerMonitorV2 is not enabled in the process level. |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
3282 lf.lfHeight = lf.lfHeight * DEFAULT_DPI / s_dpi; |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
3283 im_set_font(&lf); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3284 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3285 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3286 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3287 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3288 * 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
|
3289 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3290 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3291 gui_mch_wide_font_changed(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3292 { |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
3293 LOGFONTW lf; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3294 |
15597
536dd2bc5ac9
patch 8.1.0806: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15549
diff
changeset
|
3295 #ifdef FEAT_MBYTE_IME |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3296 update_im_font(); |
15597
536dd2bc5ac9
patch 8.1.0806: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15549
diff
changeset
|
3297 #endif |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3298 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3299 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
|
3300 gui.wide_ital_font = NOFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3301 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
|
3302 gui.wide_bold_font = NOFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3303 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
|
3304 gui.wide_boldital_font = NOFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3305 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3306 if (gui.wide_font |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
3307 && GetObjectW((HFONT)gui.wide_font, sizeof(lf), &lf)) |
8140
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 if (!lf.lfItalic) |
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 lf.lfItalic = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3312 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
|
3313 lf.lfItalic = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3314 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3315 if (lf.lfWeight < FW_BOLD) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3316 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3317 lf.lfWeight = FW_BOLD; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3318 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
|
3319 if (!lf.lfItalic) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3320 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3321 lf.lfItalic = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3322 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
|
3323 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3324 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3325 } |
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 |
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 * 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
|
3330 * 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
|
3331 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3332 int |
10783
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
3333 gui_mch_init_font(char_u *font_name, int fontset UNUSED) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3334 { |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
3335 LOGFONTW lf, lfOrig; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3336 GuiFont font = NOFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3337 char_u *p; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3338 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3339 // Load the font |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3340 if (get_logfont(&lf, font_name, NULL, TRUE) == OK) |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
3341 { |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
3342 lfOrig = lf; |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
3343 lf.lfHeight = adjust_fontsize_by_dpi(lf.lfHeight); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3344 font = get_font_handle(&lf); |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
3345 } |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3346 if (font == NOFONT) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3347 return FAIL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3348 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3349 if (font_name == NULL) |
27281
f7d73708b391
patch 8.2.4169: MS-Windows: unnessary casts and other minor things
Bram Moolenaar <Bram@vim.org>
parents:
27261
diff
changeset
|
3350 font_name = (char_u *)""; |
27249
d5570658f18d
patch 8.2.4153: MS-Windows: Global IME is no longer supported
Bram Moolenaar <Bram@vim.org>
parents:
27229
diff
changeset
|
3351 #ifdef FEAT_MBYTE_IME |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3352 norm_logfont = lf; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3353 sub_logfont = lf; |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
3354 if (!s_in_dpichanged) |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
3355 update_im_font(); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3356 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3357 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
|
3358 gui.norm_font = font; |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
3359 current_font_height = lfOrig.lfHeight; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3360 GetFontSize(font); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3361 |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
3362 p = logfont2name(lfOrig); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3363 if (p != NULL) |
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 hl_set_font_name(p); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3366 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3367 // When setting 'guifont' to "*" replace it with the actual font name. |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3368 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
|
3369 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3370 vim_free(p_guifont); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3371 p_guifont = p; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3372 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3373 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3374 vim_free(p); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3375 } |
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 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
|
3378 gui.ital_font = NOFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3379 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
|
3380 gui.bold_font = NOFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3381 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
|
3382 gui.boldital_font = NOFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3383 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3384 if (!lf.lfItalic) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3385 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3386 lf.lfItalic = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3387 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
|
3388 lf.lfItalic = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3389 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3390 if (lf.lfWeight < FW_BOLD) |
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 lf.lfWeight = FW_BOLD; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3393 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
|
3394 if (!lf.lfItalic) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3395 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3396 lf.lfItalic = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3397 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
|
3398 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3399 } |
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 return OK; |
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 * Return TRUE if the GUI window is maximized, filling the whole screen. |
21363
ef2290a53dd0
patch 8.2.1232: MS-Windows GUI: Snap cancelled by split command
Bram Moolenaar <Bram@vim.org>
parents:
21361
diff
changeset
|
3406 * Also return TRUE if the window is snapped. |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3407 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3408 int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3409 gui_mch_maximized(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3410 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3411 WINDOWPLACEMENT wp; |
21363
ef2290a53dd0
patch 8.2.1232: MS-Windows GUI: Snap cancelled by split command
Bram Moolenaar <Bram@vim.org>
parents:
21361
diff
changeset
|
3412 RECT rc; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3413 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3414 wp.length = sizeof(WINDOWPLACEMENT); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3415 if (GetWindowPlacement(s_hwnd, &wp)) |
21363
ef2290a53dd0
patch 8.2.1232: MS-Windows GUI: Snap cancelled by split command
Bram Moolenaar <Bram@vim.org>
parents:
21361
diff
changeset
|
3416 { |
ef2290a53dd0
patch 8.2.1232: MS-Windows GUI: Snap cancelled by split command
Bram Moolenaar <Bram@vim.org>
parents:
21361
diff
changeset
|
3417 if (wp.showCmd == SW_SHOWMAXIMIZED |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3418 || (wp.showCmd == SW_SHOWMINIMIZED |
21363
ef2290a53dd0
patch 8.2.1232: MS-Windows GUI: Snap cancelled by split command
Bram Moolenaar <Bram@vim.org>
parents:
21361
diff
changeset
|
3419 && wp.flags == WPF_RESTORETOMAXIMIZED)) |
ef2290a53dd0
patch 8.2.1232: MS-Windows GUI: Snap cancelled by split command
Bram Moolenaar <Bram@vim.org>
parents:
21361
diff
changeset
|
3420 return TRUE; |
ef2290a53dd0
patch 8.2.1232: MS-Windows GUI: Snap cancelled by split command
Bram Moolenaar <Bram@vim.org>
parents:
21361
diff
changeset
|
3421 if (wp.showCmd == SW_SHOWMINIMIZED) |
ef2290a53dd0
patch 8.2.1232: MS-Windows GUI: Snap cancelled by split command
Bram Moolenaar <Bram@vim.org>
parents:
21361
diff
changeset
|
3422 return FALSE; |
ef2290a53dd0
patch 8.2.1232: MS-Windows GUI: Snap cancelled by split command
Bram Moolenaar <Bram@vim.org>
parents:
21361
diff
changeset
|
3423 |
ef2290a53dd0
patch 8.2.1232: MS-Windows GUI: Snap cancelled by split command
Bram Moolenaar <Bram@vim.org>
parents:
21361
diff
changeset
|
3424 // Assume the window is snapped when the sizes from two APIs differ. |
ef2290a53dd0
patch 8.2.1232: MS-Windows GUI: Snap cancelled by split command
Bram Moolenaar <Bram@vim.org>
parents:
21361
diff
changeset
|
3425 GetWindowRect(s_hwnd, &rc); |
ef2290a53dd0
patch 8.2.1232: MS-Windows GUI: Snap cancelled by split command
Bram Moolenaar <Bram@vim.org>
parents:
21361
diff
changeset
|
3426 if ((rc.right - rc.left != |
ef2290a53dd0
patch 8.2.1232: MS-Windows GUI: Snap cancelled by split command
Bram Moolenaar <Bram@vim.org>
parents:
21361
diff
changeset
|
3427 wp.rcNormalPosition.right - wp.rcNormalPosition.left) |
ef2290a53dd0
patch 8.2.1232: MS-Windows GUI: Snap cancelled by split command
Bram Moolenaar <Bram@vim.org>
parents:
21361
diff
changeset
|
3428 || (rc.bottom - rc.top != |
ef2290a53dd0
patch 8.2.1232: MS-Windows GUI: Snap cancelled by split command
Bram Moolenaar <Bram@vim.org>
parents:
21361
diff
changeset
|
3429 wp.rcNormalPosition.bottom - wp.rcNormalPosition.top)) |
ef2290a53dd0
patch 8.2.1232: MS-Windows GUI: Snap cancelled by split command
Bram Moolenaar <Bram@vim.org>
parents:
21361
diff
changeset
|
3430 return TRUE; |
ef2290a53dd0
patch 8.2.1232: MS-Windows GUI: Snap cancelled by split command
Bram Moolenaar <Bram@vim.org>
parents:
21361
diff
changeset
|
3431 } |
ef2290a53dd0
patch 8.2.1232: MS-Windows GUI: Snap cancelled by split command
Bram Moolenaar <Bram@vim.org>
parents:
21361
diff
changeset
|
3432 return FALSE; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3433 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3434 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3435 /* |
12802
29a728529f92
patch 8.0.1278: GUI window always resizes when adding scrollbar
Christian Brabandt <cb@256bit.org>
parents:
12712
diff
changeset
|
3436 * Called when the font changed while the window is maximized or GO_KEEPWINSIZE |
29a728529f92
patch 8.0.1278: GUI window always resizes when adding scrollbar
Christian Brabandt <cb@256bit.org>
parents:
12712
diff
changeset
|
3437 * is set. Compute the new Rows and Columns. This is like resizing the |
29a728529f92
patch 8.0.1278: GUI window always resizes when adding scrollbar
Christian Brabandt <cb@256bit.org>
parents:
12712
diff
changeset
|
3438 * window. |
8140
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 gui_mch_newfont(void) |
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 RECT rect; |
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 GetWindowRect(s_hwnd, &rect); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3446 if (win_socket_id == 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3447 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3448 gui_resize_shell(rect.right - rect.left |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
3449 - (pGetSystemMetricsForDpi(SM_CXFRAME, s_dpi) + |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
3450 pGetSystemMetricsForDpi(SM_CXPADDEDBORDER, s_dpi)) * 2, |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3451 rect.bottom - rect.top |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
3452 - (pGetSystemMetricsForDpi(SM_CYFRAME, s_dpi) + |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
3453 pGetSystemMetricsForDpi(SM_CXPADDEDBORDER, s_dpi)) * 2 |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
3454 - pGetSystemMetricsForDpi(SM_CYCAPTION, s_dpi) |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
3455 - gui_mswin_get_menu_height(FALSE)); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3456 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3457 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3458 { |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3459 // Inside another window, don't use the frame and border. |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3460 gui_resize_shell(rect.right - rect.left, |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
3461 rect.bottom - rect.top - gui_mswin_get_menu_height(FALSE)); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3462 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3463 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3464 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3465 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3466 * Set the window title |
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 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3469 gui_mch_settitle( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3470 char_u *title, |
10783
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
3471 char_u *icon UNUSED) |
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 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
|
3474 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3475 |
9834
80ace3687eec
commit https://github.com/vim/vim/commit/a6b7a08ae04a3cd4d9c45c906bb7a197e2135179
Christian Brabandt <cb@256bit.org>
parents:
9428
diff
changeset
|
3476 #if defined(FEAT_MOUSESHAPE) || defined(PROTO) |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3477 // Table for shape IDCs. Keep in sync with the mshape_names[] table in |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3478 // misc2.c! |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3479 static LPCSTR mshape_idcs[] = |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3480 { |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3481 IDC_ARROW, // arrow |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3482 MAKEINTRESOURCE(0), // blank |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3483 IDC_IBEAM, // beam |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3484 IDC_SIZENS, // updown |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3485 IDC_SIZENS, // udsizing |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3486 IDC_SIZEWE, // leftright |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3487 IDC_SIZEWE, // lrsizing |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3488 IDC_WAIT, // busy |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3489 IDC_NO, // no |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3490 IDC_ARROW, // crosshair |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3491 IDC_ARROW, // hand1 |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3492 IDC_ARROW, // hand2 |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3493 IDC_ARROW, // pencil |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3494 IDC_ARROW, // question |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3495 IDC_ARROW, // right-arrow |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3496 IDC_UPARROW, // up-arrow |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3497 IDC_ARROW // last one |
8140
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3500 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3501 mch_set_mouse_shape(int shape) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3502 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3503 LPCSTR idc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3504 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3505 if (shape == MSHAPE_HIDE) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3506 ShowCursor(FALSE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3507 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3508 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3509 if (shape >= MSHAPE_NUMBERED) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3510 idc = IDC_ARROW; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3511 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3512 idc = mshape_idcs[shape]; |
18662
652ac5edf8d0
patch 8.1.2323: Old MSVC version no longer tested.
Bram Moolenaar <Bram@vim.org>
parents:
18652
diff
changeset
|
3513 SetClassLongPtr(s_textArea, GCLP_HCURSOR, (LONG_PTR)LoadCursor(NULL, idc)); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3514 if (!p_mh) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3515 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3516 POINT mp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3517 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3518 // Set the position to make it redrawn with the new shape. |
27281
f7d73708b391
patch 8.2.4169: MS-Windows: unnessary casts and other minor things
Bram Moolenaar <Bram@vim.org>
parents:
27261
diff
changeset
|
3519 (void)GetCursorPos(&mp); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3520 (void)SetCursorPos(mp.x, mp.y); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3521 ShowCursor(TRUE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3522 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3523 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3524 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3525 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3526 |
9834
80ace3687eec
commit https://github.com/vim/vim/commit/a6b7a08ae04a3cd4d9c45c906bb7a197e2135179
Christian Brabandt <cb@256bit.org>
parents:
9428
diff
changeset
|
3527 #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
|
3528 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3529 * Wide version of convert_filter(). |
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 static WCHAR * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3532 convert_filterW(char_u *s) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3533 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3534 char_u *tmp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3535 int len; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3536 WCHAR *res; |
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 tmp = convert_filter(s); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3539 if (tmp == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3540 return NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3541 len = (int)STRLEN(s) + 3; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3542 res = enc_to_utf16(tmp, &len); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3543 vim_free(tmp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3544 return res; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3545 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3546 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3547 /* |
15597
536dd2bc5ac9
patch 8.1.0806: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15549
diff
changeset
|
3548 * Pop open a file browser and return the file selected, in allocated memory, |
536dd2bc5ac9
patch 8.1.0806: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15549
diff
changeset
|
3549 * or NULL if Cancel is hit. |
536dd2bc5ac9
patch 8.1.0806: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15549
diff
changeset
|
3550 * saving - TRUE if the file will be saved to, FALSE if it will be opened. |
536dd2bc5ac9
patch 8.1.0806: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15549
diff
changeset
|
3551 * title - Title message for the file browser dialog. |
536dd2bc5ac9
patch 8.1.0806: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15549
diff
changeset
|
3552 * dflt - Default name of file. |
536dd2bc5ac9
patch 8.1.0806: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15549
diff
changeset
|
3553 * ext - Default extension to be added to files without extensions. |
536dd2bc5ac9
patch 8.1.0806: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15549
diff
changeset
|
3554 * initdir - directory in which to open the browser (NULL = current dir) |
536dd2bc5ac9
patch 8.1.0806: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15549
diff
changeset
|
3555 * filter - Filter for matched files to choose from. |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3556 */ |
15601
8ab9ad27fca4
patch 8.1.0808: MS-Windows: build error with GUI
Bram Moolenaar <Bram@vim.org>
parents:
15597
diff
changeset
|
3557 char_u * |
15597
536dd2bc5ac9
patch 8.1.0806: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15549
diff
changeset
|
3558 gui_mch_browse( |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3559 int saving, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3560 char_u *title, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3561 char_u *dflt, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3562 char_u *ext, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3563 char_u *initdir, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3564 char_u *filter) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3565 { |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3566 // We always use the wide function. This means enc_to_utf16() must work, |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3567 // otherwise it fails miserably! |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3568 OPENFILENAMEW fileStruct; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3569 WCHAR fileBuf[MAXPATHL]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3570 WCHAR *wp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3571 int i; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3572 WCHAR *titlep = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3573 WCHAR *extp = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3574 WCHAR *initdirp = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3575 WCHAR *filterp; |
14830
9d9e4a929357
patch 8.1.0427: MS-Windows GUI: using invalid encoded file name
Christian Brabandt <cb@256bit.org>
parents:
14364
diff
changeset
|
3576 char_u *p, *q; |
27259
59cdcd1e47b8
patch 8.2.4158: MS-Windows: memory leak in :browse
Bram Moolenaar <Bram@vim.org>
parents:
27249
diff
changeset
|
3577 BOOL ret; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3578 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3579 if (dflt == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3580 fileBuf[0] = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3581 else |
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 wp = enc_to_utf16(dflt, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3584 if (wp == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3585 fileBuf[0] = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3586 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3587 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3588 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
|
3589 fileBuf[i] = wp[i]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3590 fileBuf[i] = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3591 vim_free(wp); |
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 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3594 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3595 // Convert the filter to Windows format. |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3596 filterp = convert_filterW(filter); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3597 |
20007
aadd1cae2ff5
patch 8.2.0559: clearing a struct is verbose
Bram Moolenaar <Bram@vim.org>
parents:
19934
diff
changeset
|
3598 CLEAR_FIELD(fileStruct); |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
3599 # ifdef OPENFILENAME_SIZE_VERSION_400W |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3600 // 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
|
3601 fileStruct.lStructSize = OPENFILENAME_SIZE_VERSION_400W; |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
3602 # else |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3603 fileStruct.lStructSize = sizeof(fileStruct); |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
3604 # endif |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3605 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3606 if (title != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3607 titlep = enc_to_utf16(title, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3608 fileStruct.lpstrTitle = titlep; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3609 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3610 if (ext != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3611 extp = enc_to_utf16(ext, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3612 fileStruct.lpstrDefExt = extp; |
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 fileStruct.lpstrFile = fileBuf; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3615 fileStruct.nMaxFile = MAXPATHL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3616 fileStruct.lpstrFilter = filterp; |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3617 fileStruct.hwndOwner = s_hwnd; // main Vim window is owner |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3618 // has an initial dir been specified? |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3619 if (initdir != NULL && *initdir != NUL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3620 { |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3621 // Must have backslashes here, no matter what 'shellslash' says |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3622 initdirp = enc_to_utf16(initdir, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3623 if (initdirp != NULL) |
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 for (wp = initdirp; *wp != NUL; ++wp) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3626 if (*wp == '/') |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3627 *wp = '\\'; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3628 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3629 fileStruct.lpstrInitialDir = initdirp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3630 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3631 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3632 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3633 * 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
|
3634 * 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
|
3635 * 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
|
3636 * 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
|
3637 * OFN_PATHMUSTEXIST? |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3638 * 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
|
3639 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3640 fileStruct.Flags = (OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY); |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
3641 # ifdef FEAT_SHORTCUT |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3642 if (curbuf->b_p_bin) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3643 fileStruct.Flags |= OFN_NODEREFERENCELINKS; |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
3644 # endif |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3645 if (saving) |
27259
59cdcd1e47b8
patch 8.2.4158: MS-Windows: memory leak in :browse
Bram Moolenaar <Bram@vim.org>
parents:
27249
diff
changeset
|
3646 ret = GetSaveFileNameW(&fileStruct); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3647 else |
27259
59cdcd1e47b8
patch 8.2.4158: MS-Windows: memory leak in :browse
Bram Moolenaar <Bram@vim.org>
parents:
27249
diff
changeset
|
3648 ret = GetOpenFileNameW(&fileStruct); |
8140
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 vim_free(filterp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3651 vim_free(initdirp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3652 vim_free(titlep); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3653 vim_free(extp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3654 |
27259
59cdcd1e47b8
patch 8.2.4158: MS-Windows: memory leak in :browse
Bram Moolenaar <Bram@vim.org>
parents:
27249
diff
changeset
|
3655 if (!ret) |
59cdcd1e47b8
patch 8.2.4158: MS-Windows: memory leak in :browse
Bram Moolenaar <Bram@vim.org>
parents:
27249
diff
changeset
|
3656 return NULL; |
59cdcd1e47b8
patch 8.2.4158: MS-Windows: memory leak in :browse
Bram Moolenaar <Bram@vim.org>
parents:
27249
diff
changeset
|
3657 |
59cdcd1e47b8
patch 8.2.4158: MS-Windows: memory leak in :browse
Bram Moolenaar <Bram@vim.org>
parents:
27249
diff
changeset
|
3658 // Convert from UTF-16 to 'encoding'. |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3659 p = utf16_to_enc(fileBuf, NULL); |
14830
9d9e4a929357
patch 8.1.0427: MS-Windows GUI: using invalid encoded file name
Christian Brabandt <cb@256bit.org>
parents:
14364
diff
changeset
|
3660 if (p == NULL) |
9d9e4a929357
patch 8.1.0427: MS-Windows GUI: using invalid encoded file name
Christian Brabandt <cb@256bit.org>
parents:
14364
diff
changeset
|
3661 return NULL; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3662 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3663 // Give focus back to main window (when using MDI). |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3664 SetFocus(s_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3665 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3666 // Shorten the file name if possible |
14830
9d9e4a929357
patch 8.1.0427: MS-Windows GUI: using invalid encoded file name
Christian Brabandt <cb@256bit.org>
parents:
14364
diff
changeset
|
3667 q = vim_strsave(shorten_fname1(p)); |
9d9e4a929357
patch 8.1.0427: MS-Windows GUI: using invalid encoded file name
Christian Brabandt <cb@256bit.org>
parents:
14364
diff
changeset
|
3668 vim_free(p); |
9d9e4a929357
patch 8.1.0427: MS-Windows GUI: using invalid encoded file name
Christian Brabandt <cb@256bit.org>
parents:
14364
diff
changeset
|
3669 return q; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3670 } |
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 |
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 * 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
|
3675 * 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
|
3676 * 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
|
3677 * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3678 * 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
|
3679 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3680 static char_u * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3681 convert_filter(char_u *s) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3682 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3683 char_u *res; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3684 unsigned s_len = (unsigned)STRLEN(s); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3685 unsigned i; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3686 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3687 res = alloc(s_len + 3); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3688 if (res != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3689 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3690 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
|
3691 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
|
3692 res[i] = '\0'; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3693 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3694 res[i] = s[i]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3695 res[s_len] = NUL; |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3696 // Add two extra NULs to make sure it's properly terminated. |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3697 res[s_len + 1] = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3698 res[s_len + 2] = NUL; |
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 return res; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3701 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3702 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3703 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3704 * Select a directory. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3705 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3706 char_u * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3707 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
|
3708 { |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3709 // We fake this: Use a filter that doesn't select anything and a default |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3710 // file name that won't be used. |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3711 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
|
3712 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
|
3713 } |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3714 #endif // FEAT_BROWSE |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3715 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3716 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3717 _OnDropFiles( |
10783
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
3718 HWND hwnd UNUSED, |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3719 HDROP hDrop) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3720 { |
12477
68d7bc045dbe
patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
12317
diff
changeset
|
3721 #define BUFPATHLEN _MAX_PATH |
68d7bc045dbe
patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
12317
diff
changeset
|
3722 #define DRAGQVAL 0xFFFFFFFF |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3723 WCHAR wszFile[BUFPATHLEN]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3724 char szFile[BUFPATHLEN]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3725 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
|
3726 UINT i; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3727 char_u **fnames; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3728 POINT pt; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3729 int_u modifiers = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3730 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3731 // TRACE("_OnDropFiles: %d files dropped\n", cFiles); |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3732 |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3733 // Obtain dropped position |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3734 DragQueryPoint(hDrop, &pt); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3735 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
|
3736 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3737 reset_VIsual(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3738 |
16825
ce04ebdf26b8
patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
Bram Moolenaar <Bram@vim.org>
parents:
16768
diff
changeset
|
3739 fnames = ALLOC_MULT(char_u *, cFiles); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3740 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3741 if (fnames != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3742 for (i = 0; i < cFiles; ++i) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3743 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3744 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
|
3745 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
|
3746 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3747 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3748 DragQueryFile(hDrop, i, szFile, BUFPATHLEN); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3749 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
|
3750 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3751 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3752 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3753 DragFinish(hDrop); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3754 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3755 if (fnames != NULL) |
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 if ((GetKeyState(VK_SHIFT) & 0x8000) != 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3758 modifiers |= MOUSE_SHIFT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3759 if ((GetKeyState(VK_CONTROL) & 0x8000) != 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3760 modifiers |= MOUSE_CTRL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3761 if ((GetKeyState(VK_MENU) & 0x8000) != 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3762 modifiers |= MOUSE_ALT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3763 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3764 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
|
3765 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3766 s_need_activate = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3767 } |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3770 static int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3771 _OnScroll( |
10783
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
3772 HWND hwnd UNUSED, |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3773 HWND hwndCtl, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3774 UINT code, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3775 int pos) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3776 { |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3777 static UINT prev_code = 0; // code of previous call |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3778 scrollbar_T *sb, *sb_info; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3779 long val; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3780 int dragging = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3781 int dont_scroll_save = dont_scroll; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3782 SCROLLINFO si; |
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 si.cbSize = sizeof(si); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3785 si.fMask = SIF_POS; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3786 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3787 sb = gui_mswin_find_scrollbar(hwndCtl); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3788 if (sb == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3789 return 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3790 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3791 if (sb->wp != NULL) // Left or right scrollbar |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3792 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3793 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3794 * 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
|
3795 * 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
|
3796 * gui_drag_scrollbar(). |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3797 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3798 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
|
3799 } |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3800 else // Bottom scrollbar |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3801 sb_info = sb; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3802 val = sb_info->value; |
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 switch (code) |
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 case SB_THUMBTRACK: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3807 val = pos; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3808 dragging = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3809 if (sb->scroll_shift > 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3810 val <<= sb->scroll_shift; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3811 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3812 case SB_LINEDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3813 val++; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3814 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3815 case SB_LINEUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3816 val--; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3817 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3818 case SB_PAGEDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3819 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
|
3820 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3821 case SB_PAGEUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3822 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
|
3823 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3824 case SB_TOP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3825 val = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3826 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3827 case SB_BOTTOM: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3828 val = sb_info->max; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3829 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3830 case SB_ENDSCROLL: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3831 if (prev_code == SB_THUMBTRACK) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3832 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3833 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3834 * "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
|
3835 * 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
|
3836 * 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
|
3837 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3838 val = GetScrollPos(hwndCtl, SB_CTL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3839 if (sb->scroll_shift > 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3840 val <<= sb->scroll_shift; |
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 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3843 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3844 default: |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3845 // TRACE("Unknown scrollbar event %d\n", code); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3846 return 0; |
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 prev_code = code; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3849 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3850 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
|
3851 SetScrollInfo(hwndCtl, SB_CTL, &si, TRUE); |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3854 * 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
|
3855 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3856 if (sb->wp != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3857 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3858 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
|
3859 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
|
3860 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3861 SetScrollInfo(id, SB_CTL, &si, TRUE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3862 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3863 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3864 // Don't let us be interrupted here by another message. |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3865 s_busy_processing = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3866 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3867 // When "allow_scrollbar" is FALSE still need to remember the new |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3868 // position, but don't actually scroll by setting "dont_scroll". |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3869 dont_scroll = !allow_scrollbar; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3870 |
13150
808625d4b71b
patch 8.0.1449: slow redrawing with DirectX
Christian Brabandt <cb@256bit.org>
parents:
13028
diff
changeset
|
3871 mch_disable_flush(); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3872 gui_drag_scrollbar(sb, val, dragging); |
13150
808625d4b71b
patch 8.0.1449: slow redrawing with DirectX
Christian Brabandt <cb@256bit.org>
parents:
13028
diff
changeset
|
3873 mch_enable_flush(); |
808625d4b71b
patch 8.0.1449: slow redrawing with DirectX
Christian Brabandt <cb@256bit.org>
parents:
13028
diff
changeset
|
3874 gui_may_flush(); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3875 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3876 s_busy_processing = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3877 dont_scroll = dont_scroll_save; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3878 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3879 return 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3880 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3881 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3882 |
7 | 3883 #ifdef FEAT_XPM_W32 |
3884 # include "xpm_w32.h" | |
3885 #endif | |
3886 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3887 |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3888 // Some parameters for tearoff menus. All in pixels. |
7 | 3889 #define TEAROFF_PADDING_X 2 |
3890 #define TEAROFF_BUTTON_PAD_X 8 | |
3891 #define TEAROFF_MIN_WIDTH 200 | |
3892 #define TEAROFF_SUBMENU_LABEL ">>" | |
3893 #define TEAROFF_COLUMN_PADDING 3 // # spaces to pad column with. | |
3894 | |
3895 | |
12871
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
12802
diff
changeset
|
3896 #ifdef FEAT_BEVAL_GUI |
7 | 3897 # define ID_BEVAL_TOOLTIP 200 |
3898 # define BEVAL_TEXT_LEN MAXPATHL | |
3899 | |
3900 static BalloonEval *cur_beval = NULL; | |
27525
27694b525305
patch 8.2.4290: MS-Windows: using type casts for timer IDs
Bram Moolenaar <Bram@vim.org>
parents:
27455
diff
changeset
|
3901 static UINT_PTR beval_timer_id = 0; |
27694b525305
patch 8.2.4290: MS-Windows: using type casts for timer IDs
Bram Moolenaar <Bram@vim.org>
parents:
27455
diff
changeset
|
3902 static DWORD last_user_activity = 0; |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3903 #endif // defined(FEAT_BEVAL_GUI) |
435 | 3904 |
842 | 3905 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3906 // Local variables: |
7 | 3907 |
3908 #ifdef FEAT_MENU | |
3909 static UINT s_menu_id = 100; | |
2614 | 3910 #endif |
7 | 3911 |
3912 /* | |
3913 * Use the system font for dialogs and tear-off menus. Remove this line to | |
3914 * use DLG_FONT_NAME. | |
3915 */ | |
2614 | 3916 #define USE_SYSMENU_FONT |
7 | 3917 |
3918 #define VIM_NAME "vim" | |
3919 #define VIM_CLASSW L"Vim" | |
3920 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3921 // Initial size for the dialog template. For gui_mch_dialog() it's fixed, |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3922 // thus there should be room for every dialog. For tearoffs it's made bigger |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3923 // when needed. |
7 | 3924 #define DLG_ALLOC_SIZE 16 * 1024 |
3925 | |
3926 /* | |
3927 * stuff for dialogs, menus, tearoffs etc. | |
3928 */ | |
3929 static PWORD | |
3930 add_dialog_element( | |
3931 PWORD p, | |
3932 DWORD lStyle, | |
3933 WORD x, | |
3934 WORD y, | |
3935 WORD w, | |
3936 WORD h, | |
3937 WORD Id, | |
3938 WORD clss, | |
3939 const char *caption); | |
3940 static LPWORD lpwAlign(LPWORD); | |
12543
e9028055f6d6
patch 8.0.1150: MS-Windows GUI: dialog font size is incorrect
Christian Brabandt <cb@256bit.org>
parents:
12513
diff
changeset
|
3941 static int nCopyAnsiToWideChar(LPWORD, LPSTR, BOOL); |
8138
f52504c10387
commit https://github.com/vim/vim/commit/065bbac8adfe29a09958570237d223457f235c6c
Christian Brabandt <cb@256bit.org>
parents:
8108
diff
changeset
|
3942 #if defined(FEAT_MENU) && defined(FEAT_TEAROFF) |
7 | 3943 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
|
3944 #endif |
7 | 3945 static void get_dialog_font_metrics(void); |
3946 | |
3947 static int dialog_default_button = -1; | |
3948 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
3949 // Intellimouse support |
7 | 3950 static int mouse_scroll_lines = 0; |
3951 | |
3952 #ifdef FEAT_TOOLBAR | |
3953 static void initialise_toolbar(void); | |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
3954 static void update_toolbar_size(void); |
5223
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
3955 static LRESULT CALLBACK toolbar_wndproc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); |
7 | 3956 static int get_toolbar_bitmap(vimmenu_T *menu); |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
3957 #else |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
3958 # define update_toolbar_size() |
7 | 3959 #endif |
3960 | |
810 | 3961 #ifdef FEAT_GUI_TABLINE |
3962 static void initialise_tabline(void); | |
5223
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
3963 static LRESULT CALLBACK tabline_wndproc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); |
810 | 3964 #endif |
3965 | |
7 | 3966 #ifdef FEAT_MBYTE_IME |
3967 static LRESULT _OnImeComposition(HWND hwnd, WPARAM dbcs, LPARAM param); | |
3968 static char_u *GetResultStr(HWND hwnd, int GCS, int *lenp); | |
3969 #endif | |
3970 #if defined(FEAT_MBYTE_IME) && defined(DYNAMIC_IME) | |
3971 # ifdef NOIME | |
3972 typedef struct tagCOMPOSITIONFORM { | |
3973 DWORD dwStyle; | |
3974 POINT ptCurrentPos; | |
3975 RECT rcArea; | |
3976 } COMPOSITIONFORM, *PCOMPOSITIONFORM, NEAR *NPCOMPOSITIONFORM, FAR *LPCOMPOSITIONFORM; | |
3977 typedef HANDLE HIMC; | |
3978 # endif | |
3979 | |
344 | 3980 static HINSTANCE hLibImm = NULL; |
3981 static LONG (WINAPI *pImmGetCompositionStringW)(HIMC, DWORD, LPVOID, DWORD); | |
3982 static HIMC (WINAPI *pImmGetContext)(HWND); | |
3983 static HIMC (WINAPI *pImmAssociateContext)(HWND, HIMC); | |
3984 static BOOL (WINAPI *pImmReleaseContext)(HWND, HIMC); | |
3985 static BOOL (WINAPI *pImmGetOpenStatus)(HIMC); | |
3986 static BOOL (WINAPI *pImmSetOpenStatus)(HIMC, BOOL); | |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
3987 static BOOL (WINAPI *pImmGetCompositionFontW)(HIMC, LPLOGFONTW); |
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
3988 static BOOL (WINAPI *pImmSetCompositionFontW)(HIMC, LPLOGFONTW); |
344 | 3989 static BOOL (WINAPI *pImmSetCompositionWindow)(HIMC, LPCOMPOSITIONFORM); |
3990 static BOOL (WINAPI *pImmGetConversionStatus)(HIMC, LPDWORD, LPDWORD); | |
777 | 3991 static BOOL (WINAPI *pImmSetConversionStatus)(HIMC, DWORD, DWORD); |
7 | 3992 static void dyn_imm_load(void); |
3993 #else | |
3994 # define pImmGetCompositionStringW ImmGetCompositionStringW | |
3995 # define pImmGetContext ImmGetContext | |
3996 # define pImmAssociateContext ImmAssociateContext | |
3997 # define pImmReleaseContext ImmReleaseContext | |
3998 # define pImmGetOpenStatus ImmGetOpenStatus | |
3999 # define pImmSetOpenStatus ImmSetOpenStatus | |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
4000 # define pImmGetCompositionFontW ImmGetCompositionFontW |
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
4001 # define pImmSetCompositionFontW ImmSetCompositionFontW |
7 | 4002 # define pImmSetCompositionWindow ImmSetCompositionWindow |
4003 # define pImmGetConversionStatus ImmGetConversionStatus | |
777 | 4004 # define pImmSetConversionStatus ImmSetConversionStatus |
7 | 4005 #endif |
4006 | |
4007 #ifdef FEAT_MENU | |
4008 /* | |
4009 * Figure out how high the menu bar is at the moment. | |
4010 */ | |
4011 static int | |
4012 gui_mswin_get_menu_height( | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
4013 int fix_window) // If TRUE, resize window if menu height changed |
7 | 4014 { |
4015 static int old_menu_height = -1; | |
4016 | |
4017 RECT rc1, rc2; | |
4018 int num; | |
4019 int menu_height; | |
4020 | |
4021 if (gui.menu_is_active) | |
4022 num = GetMenuItemCount(s_menuBar); | |
4023 else | |
4024 num = 0; | |
4025 | |
4026 if (num == 0) | |
4027 menu_height = 0; | |
6714 | 4028 else if (IsMinimized(s_hwnd)) |
4029 { | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
4030 // The height of the menu cannot be determined while the window is |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
4031 // minimized. Take the previous height if the menu is changed in that |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
4032 // state, to avoid that Vim's vertical window size accidentally |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
4033 // increases due to the unaccounted-for menu height. |
6714 | 4034 menu_height = old_menu_height == -1 ? 0 : old_menu_height; |
4035 } | |
7 | 4036 else |
4037 { | |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4038 /* |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4039 * 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
|
4040 * 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
|
4041 * 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
|
4042 * 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
|
4043 * 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
|
4044 */ |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4045 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
|
4046 if (gui.starting) |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4047 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
|
4048 else |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4049 { |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4050 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
|
4051 menu_height = rc2.bottom - rc1.top + 1; |
7 | 4052 } |
4053 } | |
4054 | |
4055 if (fix_window && menu_height != old_menu_height) | |
812 | 4056 gui_set_shellsize(FALSE, FALSE, RESIZE_VERT); |
6714 | 4057 old_menu_height = menu_height; |
7 | 4058 |
4059 return menu_height; | |
4060 } | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
4061 #endif // FEAT_MENU |
7 | 4062 |
4063 | |
4064 /* | |
4065 * Setup for the Intellimouse | |
4066 */ | |
4067 static void | |
4068 init_mouse_wheel(void) | |
4069 { | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
4070 mouse_scroll_lines = 3; // reasonable default |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
4071 |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
4072 // if NT 4.0+ (or Win98) get scroll lines directly from system |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4073 SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4074 &mouse_scroll_lines, 0); |
7 | 4075 } |
4076 | |
4077 | |
18526
334b1f897f3a
patch 8.1.2257: MS-Windows GUI: scroll wheel always uses current window
Bram Moolenaar <Bram@vim.org>
parents:
18520
diff
changeset
|
4078 /* |
334b1f897f3a
patch 8.1.2257: MS-Windows GUI: scroll wheel always uses current window
Bram Moolenaar <Bram@vim.org>
parents:
18520
diff
changeset
|
4079 * Intellimouse wheel handler. |
334b1f897f3a
patch 8.1.2257: MS-Windows GUI: scroll wheel always uses current window
Bram Moolenaar <Bram@vim.org>
parents:
18520
diff
changeset
|
4080 * Treat a mouse wheel event as if it were a scroll request. |
334b1f897f3a
patch 8.1.2257: MS-Windows GUI: scroll wheel always uses current window
Bram Moolenaar <Bram@vim.org>
parents:
18520
diff
changeset
|
4081 */ |
7 | 4082 static void |
4083 _OnMouseWheel( | |
4084 HWND hwnd, | |
4085 short zDelta) | |
4086 { | |
4087 int i; | |
4088 int size; | |
4089 HWND hwndCtl; | |
18526
334b1f897f3a
patch 8.1.2257: MS-Windows GUI: scroll wheel always uses current window
Bram Moolenaar <Bram@vim.org>
parents:
18520
diff
changeset
|
4090 win_T *wp; |
334b1f897f3a
patch 8.1.2257: MS-Windows GUI: scroll wheel always uses current window
Bram Moolenaar <Bram@vim.org>
parents:
18520
diff
changeset
|
4091 |
7 | 4092 if (mouse_scroll_lines == 0) |
4093 init_mouse_wheel(); | |
4094 | |
18526
334b1f897f3a
patch 8.1.2257: MS-Windows GUI: scroll wheel always uses current window
Bram Moolenaar <Bram@vim.org>
parents:
18520
diff
changeset
|
4095 wp = gui_mouse_window(FIND_POPUP); |
334b1f897f3a
patch 8.1.2257: MS-Windows GUI: scroll wheel always uses current window
Bram Moolenaar <Bram@vim.org>
parents:
18520
diff
changeset
|
4096 |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18742
diff
changeset
|
4097 #ifdef FEAT_PROP_POPUP |
18526
334b1f897f3a
patch 8.1.2257: MS-Windows GUI: scroll wheel always uses current window
Bram Moolenaar <Bram@vim.org>
parents:
18520
diff
changeset
|
4098 if (wp != NULL && popup_is_popup(wp)) |
334b1f897f3a
patch 8.1.2257: MS-Windows GUI: scroll wheel always uses current window
Bram Moolenaar <Bram@vim.org>
parents:
18520
diff
changeset
|
4099 { |
334b1f897f3a
patch 8.1.2257: MS-Windows GUI: scroll wheel always uses current window
Bram Moolenaar <Bram@vim.org>
parents:
18520
diff
changeset
|
4100 cmdarg_T cap; |
334b1f897f3a
patch 8.1.2257: MS-Windows GUI: scroll wheel always uses current window
Bram Moolenaar <Bram@vim.org>
parents:
18520
diff
changeset
|
4101 oparg_T oa; |
334b1f897f3a
patch 8.1.2257: MS-Windows GUI: scroll wheel always uses current window
Bram Moolenaar <Bram@vim.org>
parents:
18520
diff
changeset
|
4102 |
334b1f897f3a
patch 8.1.2257: MS-Windows GUI: scroll wheel always uses current window
Bram Moolenaar <Bram@vim.org>
parents:
18520
diff
changeset
|
4103 // Mouse hovers over popup window, scroll it if possible. |
334b1f897f3a
patch 8.1.2257: MS-Windows GUI: scroll wheel always uses current window
Bram Moolenaar <Bram@vim.org>
parents:
18520
diff
changeset
|
4104 mouse_row = wp->w_winrow; |
334b1f897f3a
patch 8.1.2257: MS-Windows GUI: scroll wheel always uses current window
Bram Moolenaar <Bram@vim.org>
parents:
18520
diff
changeset
|
4105 mouse_col = wp->w_wincol; |
20007
aadd1cae2ff5
patch 8.2.0559: clearing a struct is verbose
Bram Moolenaar <Bram@vim.org>
parents:
19934
diff
changeset
|
4106 CLEAR_FIELD(cap); |
18526
334b1f897f3a
patch 8.1.2257: MS-Windows GUI: scroll wheel always uses current window
Bram Moolenaar <Bram@vim.org>
parents:
18520
diff
changeset
|
4107 cap.arg = zDelta < 0 ? MSCR_UP : MSCR_DOWN; |
334b1f897f3a
patch 8.1.2257: MS-Windows GUI: scroll wheel always uses current window
Bram Moolenaar <Bram@vim.org>
parents:
18520
diff
changeset
|
4108 cap.cmdchar = zDelta < 0 ? K_MOUSEUP : K_MOUSEDOWN; |
334b1f897f3a
patch 8.1.2257: MS-Windows GUI: scroll wheel always uses current window
Bram Moolenaar <Bram@vim.org>
parents:
18520
diff
changeset
|
4109 clear_oparg(&oa); |
334b1f897f3a
patch 8.1.2257: MS-Windows GUI: scroll wheel always uses current window
Bram Moolenaar <Bram@vim.org>
parents:
18520
diff
changeset
|
4110 cap.oap = &oa; |
334b1f897f3a
patch 8.1.2257: MS-Windows GUI: scroll wheel always uses current window
Bram Moolenaar <Bram@vim.org>
parents:
18520
diff
changeset
|
4111 nv_mousescroll(&cap); |
334b1f897f3a
patch 8.1.2257: MS-Windows GUI: scroll wheel always uses current window
Bram Moolenaar <Bram@vim.org>
parents:
18520
diff
changeset
|
4112 update_screen(0); |
334b1f897f3a
patch 8.1.2257: MS-Windows GUI: scroll wheel always uses current window
Bram Moolenaar <Bram@vim.org>
parents:
18520
diff
changeset
|
4113 setcursor(); |
334b1f897f3a
patch 8.1.2257: MS-Windows GUI: scroll wheel always uses current window
Bram Moolenaar <Bram@vim.org>
parents:
18520
diff
changeset
|
4114 out_flush(); |
334b1f897f3a
patch 8.1.2257: MS-Windows GUI: scroll wheel always uses current window
Bram Moolenaar <Bram@vim.org>
parents:
18520
diff
changeset
|
4115 return; |
334b1f897f3a
patch 8.1.2257: MS-Windows GUI: scroll wheel always uses current window
Bram Moolenaar <Bram@vim.org>
parents:
18520
diff
changeset
|
4116 } |
334b1f897f3a
patch 8.1.2257: MS-Windows GUI: scroll wheel always uses current window
Bram Moolenaar <Bram@vim.org>
parents:
18520
diff
changeset
|
4117 #endif |
334b1f897f3a
patch 8.1.2257: MS-Windows GUI: scroll wheel always uses current window
Bram Moolenaar <Bram@vim.org>
parents:
18520
diff
changeset
|
4118 |
334b1f897f3a
patch 8.1.2257: MS-Windows GUI: scroll wheel always uses current window
Bram Moolenaar <Bram@vim.org>
parents:
18520
diff
changeset
|
4119 if (wp == NULL || !p_scf) |
334b1f897f3a
patch 8.1.2257: MS-Windows GUI: scroll wheel always uses current window
Bram Moolenaar <Bram@vim.org>
parents:
18520
diff
changeset
|
4120 wp = curwin; |
334b1f897f3a
patch 8.1.2257: MS-Windows GUI: scroll wheel always uses current window
Bram Moolenaar <Bram@vim.org>
parents:
18520
diff
changeset
|
4121 |
334b1f897f3a
patch 8.1.2257: MS-Windows GUI: scroll wheel always uses current window
Bram Moolenaar <Bram@vim.org>
parents:
18520
diff
changeset
|
4122 if (wp->w_scrollbars[SBAR_RIGHT].id != 0) |
334b1f897f3a
patch 8.1.2257: MS-Windows GUI: scroll wheel always uses current window
Bram Moolenaar <Bram@vim.org>
parents:
18520
diff
changeset
|
4123 hwndCtl = wp->w_scrollbars[SBAR_RIGHT].id; |
334b1f897f3a
patch 8.1.2257: MS-Windows GUI: scroll wheel always uses current window
Bram Moolenaar <Bram@vim.org>
parents:
18520
diff
changeset
|
4124 else if (wp->w_scrollbars[SBAR_LEFT].id != 0) |
334b1f897f3a
patch 8.1.2257: MS-Windows GUI: scroll wheel always uses current window
Bram Moolenaar <Bram@vim.org>
parents:
18520
diff
changeset
|
4125 hwndCtl = wp->w_scrollbars[SBAR_LEFT].id; |
334b1f897f3a
patch 8.1.2257: MS-Windows GUI: scroll wheel always uses current window
Bram Moolenaar <Bram@vim.org>
parents:
18520
diff
changeset
|
4126 else |
334b1f897f3a
patch 8.1.2257: MS-Windows GUI: scroll wheel always uses current window
Bram Moolenaar <Bram@vim.org>
parents:
18520
diff
changeset
|
4127 return; |
334b1f897f3a
patch 8.1.2257: MS-Windows GUI: scroll wheel always uses current window
Bram Moolenaar <Bram@vim.org>
parents:
18520
diff
changeset
|
4128 size = wp->w_height; |
18520
6067fbb46625
patch 8.1.2254: MS-Windows: mouse scroll wheel doesn't work in popup
Bram Moolenaar <Bram@vim.org>
parents:
18416
diff
changeset
|
4129 |
13150
808625d4b71b
patch 8.0.1449: slow redrawing with DirectX
Christian Brabandt <cb@256bit.org>
parents:
13028
diff
changeset
|
4130 mch_disable_flush(); |
7 | 4131 if (mouse_scroll_lines > 0 |
4132 && mouse_scroll_lines < (size > 2 ? size - 2 : 1)) | |
4133 { | |
4134 for (i = mouse_scroll_lines; i > 0; --i) | |
4135 _OnScroll(hwnd, hwndCtl, zDelta >= 0 ? SB_LINEUP : SB_LINEDOWN, 0); | |
4136 } | |
4137 else | |
4138 _OnScroll(hwnd, hwndCtl, zDelta >= 0 ? SB_PAGEUP : SB_PAGEDOWN, 0); | |
13150
808625d4b71b
patch 8.0.1449: slow redrawing with DirectX
Christian Brabandt <cb@256bit.org>
parents:
13028
diff
changeset
|
4139 mch_enable_flush(); |
808625d4b71b
patch 8.0.1449: slow redrawing with DirectX
Christian Brabandt <cb@256bit.org>
parents:
13028
diff
changeset
|
4140 gui_may_flush(); |
7 | 4141 } |
4142 | |
843 | 4143 #ifdef USE_SYSMENU_FONT |
4144 /* | |
4145 * Get Menu Font. | |
4146 * Return OK or FAIL. | |
4147 */ | |
4148 static int | |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
4149 gui_w32_get_menu_font(LOGFONTW *lf) |
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
4150 { |
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
4151 NONCLIENTMETRICSW nm; |
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
4152 |
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
4153 nm.cbSize = sizeof(NONCLIENTMETRICSW); |
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
4154 if (!SystemParametersInfoW( |
843 | 4155 SPI_GETNONCLIENTMETRICS, |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
4156 sizeof(NONCLIENTMETRICSW), |
843 | 4157 &nm, |
4158 0)) | |
4159 return FAIL; | |
4160 *lf = nm.lfMenuFont; | |
4161 return OK; | |
4162 } | |
4163 #endif | |
4164 | |
4165 | |
4166 #if defined(FEAT_GUI_TABLINE) && defined(USE_SYSMENU_FONT) | |
4167 /* | |
4168 * Set the GUI tabline font to the system menu font | |
4169 */ | |
4170 static void | |
4171 set_tabline_font(void) | |
4172 { | |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
4173 LOGFONTW lfSysmenu; |
843 | 4174 HFONT font; |
4175 HWND hwnd; | |
4176 HDC hdc; | |
4177 HFONT hfntOld; | |
4178 TEXTMETRIC tm; | |
4179 | |
4180 if (gui_w32_get_menu_font(&lfSysmenu) != OK) | |
4181 return; | |
4182 | |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
4183 lfSysmenu.lfHeight = adjust_fontsize_by_dpi(lfSysmenu.lfHeight); |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
4184 font = CreateFontIndirectW(&lfSysmenu); |
843 | 4185 |
4186 SendMessage(s_tabhwnd, WM_SETFONT, (WPARAM)font, TRUE); | |
4187 | |
4188 /* | |
4189 * Compute the height of the font used for the tab text | |
4190 */ | |
4191 hwnd = GetDesktopWindow(); | |
4192 hdc = GetWindowDC(hwnd); | |
4193 hfntOld = SelectFont(hdc, font); | |
4194 | |
4195 GetTextMetrics(hdc, &tm); | |
4196 | |
4197 SelectFont(hdc, hfntOld); | |
4198 ReleaseDC(hwnd, hdc); | |
4199 | |
4200 /* | |
4201 * The space used by the tab border and the space between the tab label | |
4202 * and the tab border is included as 7. | |
4203 */ | |
4204 gui.tabline_height = tm.tmHeight + tm.tmInternalLeading + 7; | |
4205 } | |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
4206 #else |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
4207 # define set_tabline_font() |
843 | 4208 #endif |
4209 | |
333 | 4210 /* |
4211 * Invoked when a setting was changed. | |
4212 */ | |
4213 static LRESULT CALLBACK | |
4214 _OnSettingChange(UINT n) | |
4215 { | |
4216 if (n == SPI_SETWHEELSCROLLLINES) | |
4217 SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, | |
4218 &mouse_scroll_lines, 0); | |
843 | 4219 if (n == SPI_SETNONCLIENTMETRICS) |
4220 set_tabline_font(); | |
333 | 4221 return 0; |
4222 } | |
4223 | |
7 | 4224 #ifdef FEAT_NETBEANS_INTG |
4225 static void | |
4226 _OnWindowPosChanged( | |
4227 HWND hwnd, | |
4228 const LPWINDOWPOS lpwpos) | |
4229 { | |
4230 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
|
4231 extern int WSInitialized; |
7 | 4232 |
4233 if (WSInitialized && (lpwpos->x != x || lpwpos->y != y | |
4234 || lpwpos->cx != cx || lpwpos->cy != cy)) | |
4235 { | |
4236 x = lpwpos->x; | |
4237 y = lpwpos->y; | |
4238 cx = lpwpos->cx; | |
4239 cy = lpwpos->cy; | |
4240 netbeans_frame_moved(x, y); | |
4241 } | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
4242 // Allow to send WM_SIZE and WM_MOVE |
27249
d5570658f18d
patch 8.2.4153: MS-Windows: Global IME is no longer supported
Bram Moolenaar <Bram@vim.org>
parents:
27229
diff
changeset
|
4243 FORWARD_WM_WINDOWPOSCHANGED(hwnd, lpwpos, DefWindowProcW); |
7 | 4244 } |
4245 #endif | |
4246 | |
24804
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4247 |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4248 static HWND hwndTip = NULL; |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4249 |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4250 static void |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4251 show_sizing_tip(int cols, int rows) |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4252 { |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4253 TOOLINFOA ti = {sizeof(ti)}; |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4254 char buf[32]; |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4255 |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4256 ti.hwnd = s_hwnd; |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4257 ti.uId = (UINT_PTR)s_hwnd; |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4258 ti.uFlags = TTF_SUBCLASS | TTF_IDISHWND; |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4259 ti.lpszText = buf; |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4260 sprintf(buf, "%dx%d", cols, rows); |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4261 if (hwndTip == NULL) |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4262 { |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4263 hwndTip = CreateWindowExA(0, TOOLTIPS_CLASSA, NULL, |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4264 WS_POPUP | TTS_ALWAYSTIP | TTS_NOPREFIX, |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4265 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4266 s_hwnd, NULL, GetModuleHandle(NULL), NULL); |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4267 SendMessage(hwndTip, TTM_ADDTOOL, 0, (LPARAM)&ti); |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4268 SendMessage(hwndTip, TTM_TRACKACTIVATE, TRUE, (LPARAM)&ti); |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4269 } |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4270 else |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4271 { |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4272 SendMessage(hwndTip, TTM_UPDATETIPTEXT, 0, (LPARAM)&ti); |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4273 } |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4274 SendMessage(hwndTip, TTM_POPUP, 0, 0); |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4275 } |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4276 |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4277 static void |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4278 destroy_sizing_tip(void) |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4279 { |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4280 if (hwndTip != NULL) |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4281 { |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4282 DestroyWindow(hwndTip); |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4283 hwndTip = NULL; |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4284 } |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4285 } |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4286 |
7 | 4287 static int |
4288 _DuringSizing( | |
4289 UINT fwSide, | |
4290 LPRECT lprc) | |
4291 { | |
4292 int w, h; | |
4293 int valid_w, valid_h; | |
4294 int w_offset, h_offset; | |
24804
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4295 int cols, rows; |
7 | 4296 |
4297 w = lprc->right - lprc->left; | |
4298 h = lprc->bottom - lprc->top; | |
24804
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4299 gui_mswin_get_valid_dimensions(w, h, &valid_w, &valid_h, &cols, &rows); |
7 | 4300 w_offset = w - valid_w; |
4301 h_offset = h - valid_h; | |
4302 | |
4303 if (fwSide == WMSZ_LEFT || fwSide == WMSZ_TOPLEFT | |
4304 || fwSide == WMSZ_BOTTOMLEFT) | |
4305 lprc->left += w_offset; | |
4306 else if (fwSide == WMSZ_RIGHT || fwSide == WMSZ_TOPRIGHT | |
4307 || fwSide == WMSZ_BOTTOMRIGHT) | |
4308 lprc->right -= w_offset; | |
4309 | |
4310 if (fwSide == WMSZ_TOP || fwSide == WMSZ_TOPLEFT | |
4311 || fwSide == WMSZ_TOPRIGHT) | |
4312 lprc->top += h_offset; | |
4313 else if (fwSide == WMSZ_BOTTOM || fwSide == WMSZ_BOTTOMLEFT | |
4314 || fwSide == WMSZ_BOTTOMRIGHT) | |
4315 lprc->bottom -= h_offset; | |
24804
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4316 |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4317 show_sizing_tip(cols, rows); |
7 | 4318 return TRUE; |
4319 } | |
4320 | |
27261
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4321 #ifdef FEAT_GUI_TABLINE |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4322 static void |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4323 _OnRButtonUp(HWND hwnd, int x, int y, UINT keyFlags) |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4324 { |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4325 if (gui_mch_showing_tabline()) |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4326 { |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4327 POINT pt; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4328 RECT rect; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4329 |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4330 /* |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4331 * If the cursor is on the tabline, display the tab menu |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4332 */ |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4333 GetCursorPos(&pt); |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4334 GetWindowRect(s_textArea, &rect); |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4335 if (pt.y < rect.top) |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4336 { |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4337 show_tabline_popup_menu(); |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4338 return; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4339 } |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4340 } |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4341 FORWARD_WM_RBUTTONUP(hwnd, x, y, keyFlags, DefWindowProcW); |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4342 } |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4343 |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4344 static void |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4345 _OnLButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT keyFlags) |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4346 { |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4347 /* |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4348 * If the user double clicked the tabline, create a new tab |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4349 */ |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4350 if (gui_mch_showing_tabline()) |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4351 { |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4352 POINT pt; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4353 RECT rect; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4354 |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4355 GetCursorPos(&pt); |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4356 GetWindowRect(s_textArea, &rect); |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4357 if (pt.y < rect.top) |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4358 send_tabline_menu_event(0, TABLINE_MENU_NEW); |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4359 } |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4360 FORWARD_WM_LBUTTONDOWN(hwnd, fDoubleClick, x, y, keyFlags, DefWindowProcW); |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4361 } |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4362 #endif |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4363 |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4364 static UINT |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4365 _OnNCHitTest(HWND hwnd, int xPos, int yPos) |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4366 { |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4367 UINT result; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4368 int x, y; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4369 |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4370 result = FORWARD_WM_NCHITTEST(hwnd, xPos, yPos, DefWindowProcW); |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4371 if (result != HTCLIENT) |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4372 return result; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4373 |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4374 #ifdef FEAT_GUI_TABLINE |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4375 if (gui_mch_showing_tabline()) |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4376 { |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4377 RECT rct; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4378 |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4379 // If the cursor is on the GUI tabline, don't process this event |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4380 GetWindowRect(s_textArea, &rct); |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4381 if (yPos < rct.top) |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4382 return result; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4383 } |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4384 #endif |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4385 (void)gui_mch_get_winpos(&x, &y); |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4386 xPos -= x; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4387 |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4388 if (xPos < 48) // <VN> TODO should use system metric? |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4389 return HTBOTTOMLEFT; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4390 else |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4391 return HTBOTTOMRIGHT; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4392 } |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4393 |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4394 #if defined(FEAT_TOOLBAR) || defined(FEAT_GUI_TABLINE) |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4395 static LRESULT |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4396 _OnNotify(HWND hwnd, UINT id, NMHDR *hdr) |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4397 { |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4398 switch (hdr->code) |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4399 { |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4400 case TTN_GETDISPINFOW: |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4401 case TTN_GETDISPINFO: |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4402 { |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4403 char_u *str = NULL; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4404 static void *tt_text = NULL; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4405 |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4406 VIM_CLEAR(tt_text); |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4407 |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4408 # ifdef FEAT_GUI_TABLINE |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4409 if (gui_mch_showing_tabline() |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4410 && hdr->hwndFrom == TabCtrl_GetToolTips(s_tabhwnd)) |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4411 { |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4412 POINT pt; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4413 /* |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4414 * Mouse is over the GUI tabline. Display the |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4415 * tooltip for the tab under the cursor |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4416 * |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4417 * Get the cursor position within the tab control |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4418 */ |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4419 GetCursorPos(&pt); |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4420 if (ScreenToClient(s_tabhwnd, &pt) != 0) |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4421 { |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4422 TCHITTESTINFO htinfo; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4423 int idx; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4424 |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4425 /* |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4426 * Get the tab under the cursor |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4427 */ |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4428 htinfo.pt.x = pt.x; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4429 htinfo.pt.y = pt.y; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4430 idx = TabCtrl_HitTest(s_tabhwnd, &htinfo); |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4431 if (idx != -1) |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4432 { |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4433 tabpage_T *tp; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4434 |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4435 tp = find_tabpage(idx + 1); |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4436 if (tp != NULL) |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4437 { |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4438 get_tabline_label(tp, TRUE); |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4439 str = NameBuff; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4440 } |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4441 } |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4442 } |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4443 } |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4444 # endif |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4445 # ifdef FEAT_TOOLBAR |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4446 # ifdef FEAT_GUI_TABLINE |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4447 else |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4448 # endif |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4449 { |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4450 UINT idButton; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4451 vimmenu_T *pMenu; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4452 |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4453 idButton = (UINT) hdr->idFrom; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4454 pMenu = gui_mswin_find_menu(root_menu, idButton); |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4455 if (pMenu) |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4456 str = pMenu->strings[MENU_INDEX_TIP]; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4457 } |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4458 # endif |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4459 if (str == NULL) |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4460 break; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4461 |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4462 // Set the maximum width, this also enables using \n for |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4463 // line break. |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4464 SendMessage(hdr->hwndFrom, TTM_SETMAXTIPWIDTH, 0, 500); |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4465 |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4466 if (hdr->code == TTN_GETDISPINFOW) |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4467 { |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4468 LPNMTTDISPINFOW lpdi = (LPNMTTDISPINFOW)hdr; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4469 |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4470 tt_text = enc_to_utf16(str, NULL); |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4471 lpdi->lpszText = tt_text; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4472 // can't show tooltip if failed |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4473 } |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4474 else |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4475 { |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4476 LPNMTTDISPINFO lpdi = (LPNMTTDISPINFO)hdr; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4477 |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4478 if (STRLEN(str) < sizeof(lpdi->szText) |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4479 || ((tt_text = vim_strsave(str)) == NULL)) |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4480 vim_strncpy((char_u *)lpdi->szText, str, |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4481 sizeof(lpdi->szText) - 1); |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4482 else |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4483 lpdi->lpszText = tt_text; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4484 } |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4485 } |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4486 break; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4487 |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4488 # ifdef FEAT_GUI_TABLINE |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4489 case TCN_SELCHANGE: |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4490 if (gui_mch_showing_tabline() && (hdr->hwndFrom == s_tabhwnd)) |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4491 { |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4492 send_tabline_event(TabCtrl_GetCurSel(s_tabhwnd) + 1); |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4493 return 0L; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4494 } |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4495 break; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4496 |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4497 case NM_RCLICK: |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4498 if (gui_mch_showing_tabline() && (hdr->hwndFrom == s_tabhwnd)) |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4499 { |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4500 show_tabline_popup_menu(); |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4501 return 0L; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4502 } |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4503 break; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4504 # endif |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4505 |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4506 default: |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4507 break; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4508 } |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4509 return DefWindowProcW(hwnd, WM_NOTIFY, (WPARAM)id, (LPARAM)hdr); |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4510 } |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4511 #endif |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4512 |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4513 #if defined(MENUHINTS) && defined(FEAT_MENU) |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4514 static LRESULT |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4515 _OnMenuSelect(HWND hwnd, WPARAM wParam, LPARAM lParam) |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4516 { |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4517 if (((UINT) HIWORD(wParam) |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4518 & (0xffff ^ (MF_MOUSESELECT + MF_BITMAP + MF_POPUP))) |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4519 == MF_HILITE |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4520 && (State & CMDLINE) == 0) |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4521 { |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4522 UINT idButton; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4523 vimmenu_T *pMenu; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4524 static int did_menu_tip = FALSE; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4525 |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4526 if (did_menu_tip) |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4527 { |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4528 msg_clr_cmdline(); |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4529 setcursor(); |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4530 out_flush(); |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4531 did_menu_tip = FALSE; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4532 } |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4533 |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4534 idButton = (UINT)LOWORD(wParam); |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4535 pMenu = gui_mswin_find_menu(root_menu, idButton); |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4536 if (pMenu != NULL && pMenu->strings[MENU_INDEX_TIP] != 0 |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4537 && GetMenuState(s_menuBar, pMenu->id, MF_BYCOMMAND) != -1) |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4538 { |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4539 ++msg_hist_off; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4540 msg((char *)pMenu->strings[MENU_INDEX_TIP]); |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4541 --msg_hist_off; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4542 setcursor(); |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4543 out_flush(); |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4544 did_menu_tip = TRUE; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4545 } |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4546 return 0L; |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4547 } |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4548 return DefWindowProcW(hwnd, WM_MENUSELECT, wParam, lParam); |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4549 } |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4550 #endif |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4551 |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
4552 static LRESULT |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
4553 _OnDpiChanged(HWND hwnd, UINT xdpi, UINT ydpi, RECT *rc) |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
4554 { |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
4555 s_dpi = ydpi; |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
4556 s_in_dpichanged = TRUE; |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
4557 //TRACE("DPI: %d", ydpi); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
4558 |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
4559 update_scrollbar_size(); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
4560 update_toolbar_size(); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
4561 set_tabline_font(); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
4562 |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
4563 gui_init_font(*p_guifont == NUL ? hl_get_font_name() : p_guifont, FALSE); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
4564 gui_get_wide_font(); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
4565 gui_mswin_get_menu_height(FALSE); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
4566 #ifdef FEAT_MBYTE_IME |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
4567 im_set_position(gui.row, gui.col); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
4568 #endif |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
4569 InvalidateRect(hwnd, NULL, TRUE); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
4570 |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
4571 s_in_dpichanged = FALSE; |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
4572 return 0L; |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
4573 } |
7 | 4574 |
4575 | |
4576 static LRESULT CALLBACK | |
4577 _WndProc( | |
4578 HWND hwnd, | |
4579 UINT uMsg, | |
4580 WPARAM wParam, | |
4581 LPARAM lParam) | |
4582 { | |
4583 /* | |
4584 TRACE("WndProc: hwnd = %08x, msg = %x, wParam = %x, lParam = %x\n", | |
4585 hwnd, uMsg, wParam, lParam); | |
4586 */ | |
4587 | |
4588 HandleMouseHide(uMsg, lParam); | |
4589 | |
4590 s_uMsg = uMsg; | |
4591 s_wParam = wParam; | |
4592 s_lParam = lParam; | |
4593 | |
4594 switch (uMsg) | |
4595 { | |
4596 HANDLE_MSG(hwnd, WM_DEADCHAR, _OnDeadChar); | |
4597 HANDLE_MSG(hwnd, WM_SYSDEADCHAR, _OnDeadChar); | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
4598 // HANDLE_MSG(hwnd, WM_ACTIVATE, _OnActivate); |
7 | 4599 HANDLE_MSG(hwnd, WM_CLOSE, _OnClose); |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
4600 // HANDLE_MSG(hwnd, WM_COMMAND, _OnCommand); |
7 | 4601 HANDLE_MSG(hwnd, WM_DESTROY, _OnDestroy); |
4602 HANDLE_MSG(hwnd, WM_DROPFILES, _OnDropFiles); | |
4603 HANDLE_MSG(hwnd, WM_HSCROLL, _OnScroll); | |
4604 HANDLE_MSG(hwnd, WM_KILLFOCUS, _OnKillFocus); | |
4605 #ifdef FEAT_MENU | |
4606 HANDLE_MSG(hwnd, WM_COMMAND, _OnMenu); | |
4607 #endif | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
4608 // HANDLE_MSG(hwnd, WM_MOVE, _OnMove); |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
4609 // HANDLE_MSG(hwnd, WM_NCACTIVATE, _OnNCActivate); |
7 | 4610 HANDLE_MSG(hwnd, WM_SETFOCUS, _OnSetFocus); |
4611 HANDLE_MSG(hwnd, WM_SIZE, _OnSize); | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
4612 // HANDLE_MSG(hwnd, WM_SYSCOMMAND, _OnSysCommand); |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
4613 // HANDLE_MSG(hwnd, WM_SYSKEYDOWN, _OnAltKey); |
7 | 4614 HANDLE_MSG(hwnd, WM_VSCROLL, _OnScroll); |
4615 // HANDLE_MSG(hwnd, WM_WINDOWPOSCHANGING, _OnWindowPosChanging); | |
4616 HANDLE_MSG(hwnd, WM_ACTIVATEAPP, _OnActivateApp); | |
4617 #ifdef FEAT_NETBEANS_INTG | |
4618 HANDLE_MSG(hwnd, WM_WINDOWPOSCHANGED, _OnWindowPosChanged); | |
4619 #endif | |
812 | 4620 #ifdef FEAT_GUI_TABLINE |
27261
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4621 HANDLE_MSG(hwnd, WM_RBUTTONUP, _OnRButtonUp); |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4622 HANDLE_MSG(hwnd, WM_LBUTTONDBLCLK, _OnLButtonDown); |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4623 #endif |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4624 HANDLE_MSG(hwnd, WM_NCHITTEST, _OnNCHitTest); |
812 | 4625 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
4626 case WM_QUERYENDSESSION: // System wants to go down. |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
4627 gui_shell_closed(); // Will exit when no changed buffers. |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
4628 return FALSE; // Do NOT allow system to go down. |
7 | 4629 |
4630 case WM_ENDSESSION: | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
4631 if (wParam) // system only really goes down when wParam is TRUE |
3225 | 4632 { |
7 | 4633 _OnEndSession(); |
3225 | 4634 return 0L; |
4635 } | |
7 | 4636 break; |
4637 | |
4638 case WM_CHAR: | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
4639 // Don't use HANDLE_MSG() for WM_CHAR, it truncates wParam to a single |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
4640 // byte while we want the UTF-16 character value. |
835 | 4641 _OnChar(hwnd, (UINT)wParam, (int)(short)LOWORD(lParam)); |
7 | 4642 return 0L; |
4643 | |
4644 case WM_SYSCHAR: | |
4645 /* | |
4646 * if 'winaltkeys' is "no", or it's "menu" and it's not a menu | |
4647 * shortcut key, handle like a typed ALT key, otherwise call Windows | |
4648 * ALT key handling. | |
4649 */ | |
4650 #ifdef FEAT_MENU | |
4651 if ( !gui.menu_is_active | |
4652 || p_wak[0] == 'n' | |
4653 || (p_wak[0] == 'm' && !gui_is_menu_shortcut((int)wParam)) | |
4654 ) | |
4655 #endif | |
4656 { | |
835 | 4657 _OnSysChar(hwnd, (UINT)wParam, (int)(short)LOWORD(lParam)); |
7 | 4658 return 0L; |
4659 } | |
4660 #ifdef FEAT_MENU | |
4661 else | |
27249
d5570658f18d
patch 8.2.4153: MS-Windows: Global IME is no longer supported
Bram Moolenaar <Bram@vim.org>
parents:
27229
diff
changeset
|
4662 return DefWindowProcW(hwnd, uMsg, wParam, lParam); |
7 | 4663 #endif |
4664 | |
4665 case WM_SYSKEYUP: | |
4666 #ifdef FEAT_MENU | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
4667 // This used to be done only when menu is active: ALT key is used for |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
4668 // that. But that caused problems when menu is disabled and using |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
4669 // Alt-Tab-Esc: get into a strange state where no mouse-moved events |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
4670 // are received, mouse pointer remains hidden. |
27249
d5570658f18d
patch 8.2.4153: MS-Windows: Global IME is no longer supported
Bram Moolenaar <Bram@vim.org>
parents:
27229
diff
changeset
|
4671 return DefWindowProcW(hwnd, uMsg, wParam, lParam); |
7 | 4672 #else |
3225 | 4673 return 0L; |
7 | 4674 #endif |
4675 | |
24804
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4676 case WM_EXITSIZEMOVE: |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4677 destroy_sizing_tip(); |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4678 break; |
324086c6f757
patch 8.2.2940: MS-Windows: cannot see the size when resizing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
4679 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
4680 case WM_SIZING: // HANDLE_MSG doesn't seem to handle this one |
323 | 4681 return _DuringSizing((UINT)wParam, (LPRECT)lParam); |
7 | 4682 |
4683 case WM_MOUSEWHEEL: | |
4684 _OnMouseWheel(hwnd, HIWORD(wParam)); | |
3225 | 4685 return 0L; |
7 | 4686 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
4687 // Notification for change in SystemParametersInfo() |
333 | 4688 case WM_SETTINGCHANGE: |
4689 return _OnSettingChange((UINT)wParam); | |
4690 | |
810 | 4691 #if defined(FEAT_TOOLBAR) || defined(FEAT_GUI_TABLINE) |
7 | 4692 case WM_NOTIFY: |
27261
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4693 return _OnNotify(hwnd, (UINT)wParam, (NMHDR*)lParam); |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4694 #endif |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4695 |
7 | 4696 #if defined(MENUHINTS) && defined(FEAT_MENU) |
4697 case WM_MENUSELECT: | |
27261
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4698 return _OnMenuSelect(hwnd, wParam, lParam); |
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4699 #endif |
7 | 4700 |
4701 #ifdef FEAT_MBYTE_IME | |
4702 case WM_IME_NOTIFY: | |
4703 if (!_OnImeNotify(hwnd, (DWORD)wParam, (DWORD)lParam)) | |
27249
d5570658f18d
patch 8.2.4153: MS-Windows: Global IME is no longer supported
Bram Moolenaar <Bram@vim.org>
parents:
27229
diff
changeset
|
4704 return DefWindowProcW(hwnd, uMsg, wParam, lParam); |
3225 | 4705 return 1L; |
4706 | |
7 | 4707 case WM_IME_COMPOSITION: |
4708 if (!_OnImeComposition(hwnd, wParam, lParam)) | |
27249
d5570658f18d
patch 8.2.4153: MS-Windows: Global IME is no longer supported
Bram Moolenaar <Bram@vim.org>
parents:
27229
diff
changeset
|
4709 return DefWindowProcW(hwnd, uMsg, wParam, lParam); |
3225 | 4710 return 1L; |
7 | 4711 #endif |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
4712 case WM_DPICHANGED: |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
4713 return _OnDpiChanged(hwnd, (UINT)LOWORD(wParam), (UINT)HIWORD(wParam), |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
4714 (RECT*)lParam); |
7 | 4715 |
4716 default: | |
4717 #ifdef MSWIN_FIND_REPLACE | |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4718 if (uMsg == s_findrep_msg && s_findrep_msg != 0) |
7 | 4719 _OnFindRepl(); |
4720 #endif | |
27261
a63505f33894
patch 8.2.4159: MS-Windows: _WndProc() is very long
Bram Moolenaar <Bram@vim.org>
parents:
27259
diff
changeset
|
4721 break; |
27249
d5570658f18d
patch 8.2.4153: MS-Windows: Global IME is no longer supported
Bram Moolenaar <Bram@vim.org>
parents:
27229
diff
changeset
|
4722 } |
d5570658f18d
patch 8.2.4153: MS-Windows: Global IME is no longer supported
Bram Moolenaar <Bram@vim.org>
parents:
27229
diff
changeset
|
4723 |
d5570658f18d
patch 8.2.4153: MS-Windows: Global IME is no longer supported
Bram Moolenaar <Bram@vim.org>
parents:
27229
diff
changeset
|
4724 return DefWindowProcW(hwnd, uMsg, wParam, lParam); |
7 | 4725 } |
4726 | |
4727 /* | |
4728 * End of call-back routines | |
4729 */ | |
4730 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
4731 // parent window, if specified with -P |
7 | 4732 HWND vim_parent_hwnd = NULL; |
4733 | |
4734 static BOOL CALLBACK | |
4735 FindWindowTitle(HWND hwnd, LPARAM lParam) | |
4736 { | |
4737 char buf[2048]; | |
4738 char *title = (char *)lParam; | |
4739 | |
4740 if (GetWindowText(hwnd, buf, sizeof(buf))) | |
4741 { | |
4742 if (strstr(buf, title) != NULL) | |
4743 { | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
4744 // Found it. Store the window ref. and quit searching if MDI |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
4745 // works. |
7 | 4746 vim_parent_hwnd = FindWindowEx(hwnd, NULL, "MDIClient", NULL); |
9 | 4747 if (vim_parent_hwnd != NULL) |
4748 return FALSE; | |
7 | 4749 } |
4750 } | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
4751 return TRUE; // continue searching |
7 | 4752 } |
4753 | |
4754 /* | |
4755 * Invoked for '-P "title"' argument: search for parent application to open | |
4756 * our window in. | |
4757 */ | |
4758 void | |
4759 gui_mch_set_parent(char *title) | |
4760 { | |
4761 EnumWindows(FindWindowTitle, (LPARAM)title); | |
4762 if (vim_parent_hwnd == NULL) | |
4763 { | |
26952
b34ddbca305c
patch 8.2.4005: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26893
diff
changeset
|
4764 semsg(_(e_cannot_find_window_title_str), title); |
7 | 4765 mch_exit(2); |
4766 } | |
4767 } | |
4768 | |
323 | 4769 #ifndef FEAT_OLE |
7 | 4770 static void |
4771 ole_error(char *arg) | |
4772 { | |
1116 | 4773 char buf[IOSIZE]; |
4774 | |
16596
2f86ca0c1e6b
patch 8.1.1301: when compiled with VIMDLL some messages are not shown
Bram Moolenaar <Bram@vim.org>
parents:
16582
diff
changeset
|
4775 # ifdef VIMDLL |
2f86ca0c1e6b
patch 8.1.1301: when compiled with VIMDLL some messages are not shown
Bram Moolenaar <Bram@vim.org>
parents:
16582
diff
changeset
|
4776 gui.in_use = mch_is_gui_executable(); |
2f86ca0c1e6b
patch 8.1.1301: when compiled with VIMDLL some messages are not shown
Bram Moolenaar <Bram@vim.org>
parents:
16582
diff
changeset
|
4777 # endif |
2f86ca0c1e6b
patch 8.1.1301: when compiled with VIMDLL some messages are not shown
Bram Moolenaar <Bram@vim.org>
parents:
16582
diff
changeset
|
4778 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
4779 // Can't use emsg() here, we have not finished initialisation yet. |
1116 | 4780 vim_snprintf(buf, IOSIZE, |
26893
79c76ca2c53c
patch 8.2.3975: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26883
diff
changeset
|
4781 _(e_argument_not_supported_str_use_ole_version), arg); |
1116 | 4782 mch_errmsg(buf); |
7 | 4783 } |
323 | 4784 #endif |
7 | 4785 |
16451
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4786 #if defined(GUI_MAY_SPAWN) || defined(PROTO) |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4787 static char * |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4788 gvim_error(void) |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4789 { |
26966
ac75c145f0a9
patch 8.2.4012: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26952
diff
changeset
|
4790 char *msg = _(e_gui_cannot_be_used_cannot_execute_gvim_exe); |
16451
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4791 |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4792 if (starting) |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4793 { |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4794 mch_errmsg(msg); |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4795 mch_errmsg("\n"); |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4796 mch_exit(2); |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4797 } |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4798 return msg; |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4799 } |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4800 |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4801 char * |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4802 gui_mch_do_spawn(char_u *arg) |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4803 { |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4804 int len; |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4805 # if defined(FEAT_SESSION) && defined(EXPERIMENTAL_GUI_CMD) |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4806 char_u *session = NULL; |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4807 LPWSTR tofree1 = NULL; |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4808 # endif |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4809 WCHAR name[MAX_PATH]; |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4810 LPWSTR cmd, newcmd = NULL, p, warg, tofree2 = NULL; |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4811 STARTUPINFOW si = {sizeof(si)}; |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4812 PROCESS_INFORMATION pi; |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4813 |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4814 if (!GetModuleFileNameW(g_hinst, name, MAX_PATH)) |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4815 goto error; |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4816 p = wcsrchr(name, L'\\'); |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4817 if (p == NULL) |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4818 goto error; |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4819 // Replace the executable name from vim(d).exe to gvim(d).exe. |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4820 # ifdef DEBUG |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4821 wcscpy(p + 1, L"gvimd.exe"); |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4822 # else |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4823 wcscpy(p + 1, L"gvim.exe"); |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4824 # endif |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4825 |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4826 # if defined(FEAT_SESSION) && defined(EXPERIMENTAL_GUI_CMD) |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4827 if (starting) |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4828 # endif |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4829 { |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4830 // Pass the command line to the new process. |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4831 p = GetCommandLineW(); |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4832 // Skip 1st argument. |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4833 while (*p && *p != L' ' && *p != L'\t') |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4834 { |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4835 if (*p == L'"') |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4836 { |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4837 while (*p && *p != L'"') |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4838 ++p; |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4839 if (*p) |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4840 ++p; |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4841 } |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4842 else |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4843 ++p; |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4844 } |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4845 cmd = p; |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4846 } |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4847 # if defined(FEAT_SESSION) && defined(EXPERIMENTAL_GUI_CMD) |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4848 else |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4849 { |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4850 // Create a session file and pass it to the new process. |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4851 LPWSTR wsession; |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4852 char_u *savebg; |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4853 int ret; |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4854 |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4855 session = vim_tempname('s', FALSE); |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4856 if (session == NULL) |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4857 goto error; |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4858 savebg = p_bg; |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4859 p_bg = vim_strsave((char_u *)"light"); // Set 'bg' to "light". |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4860 ret = write_session_file(session); |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4861 vim_free(p_bg); |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4862 p_bg = savebg; |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4863 if (!ret) |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4864 goto error; |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4865 wsession = enc_to_utf16(session, NULL); |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4866 if (wsession == NULL) |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4867 goto error; |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4868 len = (int)wcslen(wsession) * 2 + 27 + 1; |
16825
ce04ebdf26b8
patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
Bram Moolenaar <Bram@vim.org>
parents:
16768
diff
changeset
|
4869 cmd = ALLOC_MULT(WCHAR, len); |
16451
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4870 if (cmd == NULL) |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4871 { |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4872 vim_free(wsession); |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4873 goto error; |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4874 } |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4875 tofree1 = cmd; |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4876 _snwprintf(cmd, len, L" -S \"%s\" -c \"call delete('%s')\"", |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4877 wsession, wsession); |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4878 vim_free(wsession); |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4879 } |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4880 # endif |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4881 |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4882 // Check additional arguments to the `:gui` command. |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4883 if (arg != NULL) |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4884 { |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4885 warg = enc_to_utf16(arg, NULL); |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4886 if (warg == NULL) |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4887 goto error; |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4888 tofree2 = warg; |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4889 } |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4890 else |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4891 warg = L""; |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4892 |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4893 // Set up the new command line. |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4894 len = (int)wcslen(name) + (int)wcslen(cmd) + (int)wcslen(warg) + 4; |
16825
ce04ebdf26b8
patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
Bram Moolenaar <Bram@vim.org>
parents:
16768
diff
changeset
|
4895 newcmd = ALLOC_MULT(WCHAR, len); |
16451
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4896 if (newcmd == NULL) |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4897 goto error; |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4898 _snwprintf(newcmd, len, L"\"%s\"%s %s", name, cmd, warg); |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4899 |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4900 // Spawn a new GUI process. |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4901 if (!CreateProcessW(NULL, newcmd, NULL, NULL, TRUE, 0, |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4902 NULL, NULL, &si, &pi)) |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4903 goto error; |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4904 CloseHandle(pi.hProcess); |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4905 CloseHandle(pi.hThread); |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4906 mch_exit(0); |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4907 |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4908 error: |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4909 # if defined(FEAT_SESSION) && defined(EXPERIMENTAL_GUI_CMD) |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4910 if (session) |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4911 mch_remove(session); |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4912 vim_free(session); |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4913 vim_free(tofree1); |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4914 # endif |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4915 vim_free(newcmd); |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4916 vim_free(tofree2); |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4917 return gvim_error(); |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4918 } |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4919 #endif |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
4920 |
7 | 4921 /* |
4922 * Parse the GUI related command-line arguments. Any arguments used are | |
4923 * deleted from argv, and *argc is decremented accordingly. This is called | |
24768
7334bf933510
patch 8.2.2922: computing array length is done in various ways
Bram Moolenaar <Bram@vim.org>
parents:
22922
diff
changeset
|
4924 * when Vim is started, whether or not the GUI has been started. |
7 | 4925 */ |
4926 void | |
4927 gui_mch_prepare(int *argc, char **argv) | |
4928 { | |
4929 int silent = FALSE; | |
4930 int idx; | |
4931 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
4932 // Check for special OLE command line parameters |
7 | 4933 if ((*argc == 2 || *argc == 3) && (argv[1][0] == '-' || argv[1][0] == '/')) |
4934 { | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
4935 // Check for a "-silent" argument first. |
7 | 4936 if (*argc == 3 && STRICMP(argv[1] + 1, "silent") == 0 |
4937 && (argv[2][0] == '-' || argv[2][0] == '/')) | |
4938 { | |
4939 silent = TRUE; | |
4940 idx = 2; | |
4941 } | |
4942 else | |
4943 idx = 1; | |
4944 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
4945 // Register Vim as an OLE Automation server |
7 | 4946 if (STRICMP(argv[idx] + 1, "register") == 0) |
4947 { | |
4948 #ifdef FEAT_OLE | |
4949 RegisterMe(silent); | |
4950 mch_exit(0); | |
4951 #else | |
4952 if (!silent) | |
4953 ole_error("register"); | |
4954 mch_exit(2); | |
4955 #endif | |
4956 } | |
4957 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
4958 // Unregister Vim as an OLE Automation server |
7 | 4959 if (STRICMP(argv[idx] + 1, "unregister") == 0) |
4960 { | |
4961 #ifdef FEAT_OLE | |
4962 UnregisterMe(!silent); | |
4963 mch_exit(0); | |
4964 #else | |
4965 if (!silent) | |
4966 ole_error("unregister"); | |
4967 mch_exit(2); | |
4968 #endif | |
4969 } | |
4970 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
4971 // Ignore an -embedding argument. It is only relevant if the |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
4972 // application wants to treat the case when it is started manually |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
4973 // differently from the case where it is started via automation (and |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
4974 // we don't). |
7 | 4975 if (STRICMP(argv[idx] + 1, "embedding") == 0) |
4976 { | |
4977 #ifdef FEAT_OLE | |
4978 *argc = 1; | |
4979 #else | |
4980 ole_error("embedding"); | |
4981 mch_exit(2); | |
4982 #endif | |
4983 } | |
4984 } | |
4985 | |
4986 #ifdef FEAT_OLE | |
4987 { | |
4988 int bDoRestart = FALSE; | |
4989 | |
4990 InitOLE(&bDoRestart); | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
4991 // automatically exit after registering |
7 | 4992 if (bDoRestart) |
4993 mch_exit(0); | |
4994 } | |
4995 #endif | |
4996 | |
4997 #ifdef FEAT_NETBEANS_INTG | |
4998 { | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
4999 // stolen from gui_x11.c |
7 | 5000 int arg; |
5001 | |
5002 for (arg = 1; arg < *argc; arg++) | |
5003 if (strncmp("-nb", argv[arg], 3) == 0) | |
5004 { | |
5005 netbeansArg = argv[arg]; | |
5006 mch_memmove(&argv[arg], &argv[arg + 1], | |
5007 (--*argc - arg) * sizeof(char *)); | |
5008 argv[*argc] = NULL; | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5009 break; // enough? |
7 | 5010 } |
5011 } | |
5012 #endif | |
5013 } | |
5014 | |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5015 static void |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5016 load_dpi_func(void) |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5017 { |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5018 HMODULE hUser32; |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5019 |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5020 hUser32 = GetModuleHandle("user32.dll"); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5021 if (hUser32 == NULL) |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5022 goto fail; |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5023 |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5024 pGetDpiForSystem = (void*)GetProcAddress(hUser32, "GetDpiForSystem"); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5025 pGetDpiForWindow = (void*)GetProcAddress(hUser32, "GetDpiForWindow"); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5026 pGetSystemMetricsForDpi = (void*)GetProcAddress(hUser32, "GetSystemMetricsForDpi"); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5027 //pGetWindowDpiAwarenessContext = (void*)GetProcAddress(hUser32, "GetWindowDpiAwarenessContext"); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5028 pSetThreadDpiAwarenessContext = (void*)GetProcAddress(hUser32, "SetThreadDpiAwarenessContext"); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5029 pGetAwarenessFromDpiAwarenessContext = (void*)GetProcAddress(hUser32, "GetAwarenessFromDpiAwarenessContext"); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5030 |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5031 if (pSetThreadDpiAwarenessContext != NULL) |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5032 { |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5033 DPI_AWARENESS_CONTEXT oldctx = pSetThreadDpiAwarenessContext( |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5034 DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5035 if (oldctx != NULL) |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5036 { |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5037 TRACE("DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 enabled"); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5038 s_process_dpi_aware = pGetAwarenessFromDpiAwarenessContext(oldctx); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5039 #ifdef DEBUG |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5040 if (s_process_dpi_aware == DPI_AWARENESS_UNAWARE) |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5041 { |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5042 TRACE("WARNING: PerMonitorV2 is not enabled in the process level for some reasons. IME window may not shown correctly."); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5043 } |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5044 #endif |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5045 return; |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5046 } |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5047 } |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5048 |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5049 fail: |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5050 // Disable PerMonitorV2 APIs. |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5051 pGetDpiForSystem = stubGetDpiForSystem; |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5052 pGetDpiForWindow = NULL; |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5053 pGetSystemMetricsForDpi = stubGetSystemMetricsForDpi; |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5054 pSetThreadDpiAwarenessContext = NULL; |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5055 pGetAwarenessFromDpiAwarenessContext = NULL; |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5056 } |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5057 |
7 | 5058 /* |
5059 * Initialise the GUI. Create all the windows, set up all the call-backs | |
5060 * etc. | |
5061 */ | |
5062 int | |
5063 gui_mch_init(void) | |
5064 { | |
5065 const WCHAR szVimWndClassW[] = VIM_CLASSW; | |
2078
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5066 const WCHAR szTextAreaClassW[] = L"VimTextArea"; |
7 | 5067 WNDCLASSW wndclassw; |
5068 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5069 // Return here if the window was already opened (happens when |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5070 // gui_mch_dialog() is called early). |
7 | 5071 if (s_hwnd != NULL) |
153 | 5072 goto theend; |
7 | 5073 |
5074 /* | |
5075 * Load the tearoff bitmap | |
5076 */ | |
5077 #ifdef FEAT_TEAROFF | |
16451
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
5078 s_htearbitmap = LoadBitmap(g_hinst, "IDB_TEAROFF"); |
7 | 5079 #endif |
5080 | |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5081 load_dpi_func(); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5082 |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5083 s_dpi = pGetDpiForSystem(); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5084 update_scrollbar_size(); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5085 |
7 | 5086 #ifdef FEAT_MENU |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5087 gui.menu_height = 0; // Windows takes care of this |
7 | 5088 #endif |
5089 gui.border_width = 0; | |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5090 #ifdef FEAT_TOOLBAR |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5091 gui.toolbar_height = TOOLBAR_BUTTON_HEIGHT + TOOLBAR_BORDER_HEIGHT; |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5092 #endif |
7 | 5093 |
5094 s_brush = CreateSolidBrush(GetSysColor(COLOR_BTNFACE)); | |
5095 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5096 // First try using the wide version, so that we can use any title. |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5097 // Otherwise only characters in the active codepage will work. |
16451
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
5098 if (GetClassInfoW(g_hinst, szVimWndClassW, &wndclassw) == 0) |
7 | 5099 { |
819 | 5100 wndclassw.style = CS_DBLCLKS; |
7 | 5101 wndclassw.lpfnWndProc = _WndProc; |
5102 wndclassw.cbClsExtra = 0; | |
5103 wndclassw.cbWndExtra = 0; | |
16451
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
5104 wndclassw.hInstance = g_hinst; |
7 | 5105 wndclassw.hIcon = LoadIcon(wndclassw.hInstance, "IDR_VIM"); |
5106 wndclassw.hCursor = LoadCursor(NULL, IDC_ARROW); | |
5107 wndclassw.hbrBackground = s_brush; | |
5108 wndclassw.lpszMenuName = NULL; | |
5109 wndclassw.lpszClassName = szVimWndClassW; | |
5110 | |
27249
d5570658f18d
patch 8.2.4153: MS-Windows: Global IME is no longer supported
Bram Moolenaar <Bram@vim.org>
parents:
27229
diff
changeset
|
5111 if (RegisterClassW(&wndclassw) == 0) |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5112 return FAIL; |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
5113 } |
7 | 5114 |
5115 if (vim_parent_hwnd != NULL) | |
5116 { | |
5117 #ifdef HAVE_TRY_EXCEPT | |
5118 __try | |
5119 { | |
5120 #endif | |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
5121 // Open inside the specified parent window. |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
5122 // TODO: last argument should point to a CLIENTCREATESTRUCT |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
5123 // structure. |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
5124 s_hwnd = CreateWindowExW( |
7 | 5125 WS_EX_MDICHILD, |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
5126 szVimWndClassW, L"Vim MSWindows GUI", |
3006 | 5127 WS_OVERLAPPEDWINDOW | WS_CHILD |
5128 | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | 0xC000, | |
7 | 5129 gui_win_x == -1 ? CW_USEDEFAULT : gui_win_x, |
5130 gui_win_y == -1 ? CW_USEDEFAULT : gui_win_y, | |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
5131 100, // Any value will do |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
5132 100, // Any value will do |
7 | 5133 vim_parent_hwnd, NULL, |
16451
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
5134 g_hinst, NULL); |
7 | 5135 #ifdef HAVE_TRY_EXCEPT |
5136 } | |
5137 __except(EXCEPTION_EXECUTE_HANDLER) | |
5138 { | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5139 // NOP |
7 | 5140 } |
5141 #endif | |
5142 if (s_hwnd == NULL) | |
5143 { | |
26952
b34ddbca305c
patch 8.2.4005: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26893
diff
changeset
|
5144 emsg(_(e_unable_to_open_window_inside_mdi_application)); |
7 | 5145 mch_exit(2); |
5146 } | |
5147 } | |
5148 else | |
1376 | 5149 { |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5150 // If the provided windowid is not valid reset it to zero, so that it |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5151 // is ignored and we open our own window. |
1376 | 5152 if (IsWindow((HWND)win_socket_id) <= 0) |
5153 win_socket_id = 0; | |
5154 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5155 // Create a window. If win_socket_id is not zero without border and |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5156 // titlebar, it will be reparented below. |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
5157 s_hwnd = CreateWindowW( |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
5158 szVimWndClassW, L"Vim MSWindows GUI", |
3006 | 5159 (win_socket_id == 0 ? WS_OVERLAPPEDWINDOW : WS_POPUP) |
5160 | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, | |
1376 | 5161 gui_win_x == -1 ? CW_USEDEFAULT : gui_win_x, |
5162 gui_win_y == -1 ? CW_USEDEFAULT : gui_win_y, | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5163 100, // Any value will do |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5164 100, // Any value will do |
1376 | 5165 NULL, NULL, |
16451
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
5166 g_hinst, NULL); |
1376 | 5167 if (s_hwnd != NULL && win_socket_id != 0) |
5168 { | |
5169 SetParent(s_hwnd, (HWND)win_socket_id); | |
5170 ShowWindow(s_hwnd, SW_SHOWMAXIMIZED); | |
5171 } | |
5172 } | |
7 | 5173 |
5174 if (s_hwnd == NULL) | |
5175 return FAIL; | |
5176 | |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5177 if (pGetDpiForWindow != NULL) |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5178 { |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5179 s_dpi = pGetDpiForWindow(s_hwnd); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5180 update_scrollbar_size(); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5181 //TRACE("System DPI: %d, DPI: %d", pGetDpiForSystem(), s_dpi); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5182 } |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5183 |
7 | 5184 #if defined(FEAT_MBYTE_IME) && defined(DYNAMIC_IME) |
5185 dyn_imm_load(); | |
5186 #endif | |
5187 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5188 // Create the text area window |
16451
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
5189 if (GetClassInfoW(g_hinst, szTextAreaClassW, &wndclassw) == 0) |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
5190 { |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
5191 wndclassw.style = CS_OWNDC; |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
5192 wndclassw.lpfnWndProc = _TextAreaWndProc; |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
5193 wndclassw.cbClsExtra = 0; |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
5194 wndclassw.cbWndExtra = 0; |
16451
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
5195 wndclassw.hInstance = g_hinst; |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
5196 wndclassw.hIcon = NULL; |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
5197 wndclassw.hCursor = LoadCursor(NULL, IDC_ARROW); |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
5198 wndclassw.hbrBackground = NULL; |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
5199 wndclassw.lpszMenuName = NULL; |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
5200 wndclassw.lpszClassName = szTextAreaClassW; |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
5201 |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
5202 if (RegisterClassW(&wndclassw) == 0) |
7 | 5203 return FAIL; |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
5204 } |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
5205 |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
5206 s_textArea = CreateWindowExW( |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
5207 0, |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
5208 szTextAreaClassW, L"Vim text area", |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
5209 WS_CHILD | WS_VISIBLE, 0, 0, |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
5210 100, // Any value will do for now |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
5211 100, // Any value will do for now |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
5212 s_hwnd, NULL, |
16451
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
5213 g_hinst, NULL); |
7 | 5214 |
5215 if (s_textArea == NULL) | |
5216 return FAIL; | |
5217 | |
8100
ae50910ce279
commit https://github.com/vim/vim/commit/203219048fa007b5042d9b893fd647aef44722a0
Christian Brabandt <cb@256bit.org>
parents:
8090
diff
changeset
|
5218 #ifdef FEAT_LIBCALL |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5219 // Try loading an icon from $RUNTIMEPATH/bitmaps/vim.ico. |
6249 | 5220 { |
5221 HANDLE hIcon = NULL; | |
5222 | |
5223 if (mch_icon_load(&hIcon) == OK && hIcon != NULL) | |
6260 | 5224 SendMessage(s_hwnd, WM_SETICON, ICON_SMALL, (LPARAM)hIcon); |
6249 | 5225 } |
8100
ae50910ce279
commit https://github.com/vim/vim/commit/203219048fa007b5042d9b893fd647aef44722a0
Christian Brabandt <cb@256bit.org>
parents:
8090
diff
changeset
|
5226 #endif |
6249 | 5227 |
7 | 5228 #ifdef FEAT_MENU |
5229 s_menuBar = CreateMenu(); | |
5230 #endif | |
5231 s_hdc = GetDC(s_textArea); | |
5232 | |
5233 DragAcceptFiles(s_hwnd, TRUE); | |
5234 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5235 // Do we need to bother with this? |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5236 // m_fMouseAvail = pGetSystemMetricsForDpi(SM_MOUSEPRESENT, s_dpi); |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5237 |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5238 // Get background/foreground colors from the system |
7 | 5239 gui_mch_def_colors(); |
5240 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5241 // Get the colors from the "Normal" group (set in syntax.c or in a vimrc |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5242 // file) |
7 | 5243 set_normal_colors(); |
5244 | |
5245 /* | |
5246 * Check that none of the colors are the same as the background color. | |
5247 * Then store the current values as the defaults. | |
5248 */ | |
5249 gui_check_colors(); | |
5250 gui.def_norm_pixel = gui.norm_pixel; | |
5251 gui.def_back_pixel = gui.back_pixel; | |
5252 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5253 // Get the colors for the highlight groups (gui_check_colors() might have |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5254 // changed them) |
7 | 5255 highlight_gui_started(); |
5256 | |
5257 /* | |
7243
861a44fc5183
commit https://github.com/vim/vim/commit/97b0b0ec764d3a247ef600d809b965d5ab37155d
Christian Brabandt <cb@256bit.org>
parents:
7060
diff
changeset
|
5258 * Start out by adding the configured border width into the border offset. |
7 | 5259 */ |
7243
861a44fc5183
commit https://github.com/vim/vim/commit/97b0b0ec764d3a247ef600d809b965d5ab37155d
Christian Brabandt <cb@256bit.org>
parents:
7060
diff
changeset
|
5260 gui.border_offset = gui.border_width; |
7 | 5261 |
5262 /* | |
5263 * Set up for Intellimouse processing | |
5264 */ | |
5265 init_mouse_wheel(); | |
5266 | |
5267 /* | |
5268 * compute a couple of metrics used for the dialogs | |
5269 */ | |
5270 get_dialog_font_metrics(); | |
5271 #ifdef FEAT_TOOLBAR | |
5272 /* | |
5273 * Create the toolbar | |
5274 */ | |
5275 initialise_toolbar(); | |
5276 #endif | |
810 | 5277 #ifdef FEAT_GUI_TABLINE |
5278 /* | |
5279 * Create the tabline | |
5280 */ | |
5281 initialise_tabline(); | |
5282 #endif | |
7 | 5283 #ifdef MSWIN_FIND_REPLACE |
5284 /* | |
5285 * Initialise the dialog box stuff | |
5286 */ | |
5287 s_findrep_msg = RegisterWindowMessage(FINDMSGSTRING); | |
5288 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5289 // Initialise the struct |
7 | 5290 s_findrep_struct.lStructSize = sizeof(s_findrep_struct); |
16825
ce04ebdf26b8
patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
Bram Moolenaar <Bram@vim.org>
parents:
16768
diff
changeset
|
5291 s_findrep_struct.lpstrFindWhat = ALLOC_MULT(WCHAR, MSWIN_FR_BUFSIZE); |
7 | 5292 s_findrep_struct.lpstrFindWhat[0] = NUL; |
16825
ce04ebdf26b8
patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
Bram Moolenaar <Bram@vim.org>
parents:
16768
diff
changeset
|
5293 s_findrep_struct.lpstrReplaceWith = ALLOC_MULT(WCHAR, MSWIN_FR_BUFSIZE); |
7 | 5294 s_findrep_struct.lpstrReplaceWith[0] = NUL; |
5295 s_findrep_struct.wFindWhatLen = MSWIN_FR_BUFSIZE; | |
5296 s_findrep_struct.wReplaceWithLen = MSWIN_FR_BUFSIZE; | |
5297 #endif | |
5298 | |
2616 | 5299 #ifdef FEAT_EVAL |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5300 // set the v:windowid variable |
2865 | 5301 set_vim_var_nr(VV_WINDOWID, HandleToLong(s_hwnd)); |
2616 | 5302 #endif |
5303 | |
6110 | 5304 #ifdef FEAT_RENDER_OPTIONS |
5305 if (p_rop) | |
5306 (void)gui_mch_set_rendering_options(p_rop); | |
5307 #endif | |
5308 | |
153 | 5309 theend: |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5310 // Display any pending error messages |
153 | 5311 display_errors(); |
5312 | |
7 | 5313 return OK; |
5314 } | |
5315 | |
5316 /* | |
5317 * Get the size of the screen, taking position on multiple monitors into | |
5318 * account (if supported). | |
5319 */ | |
5320 static void | |
5321 get_work_area(RECT *spi_rect) | |
5322 { | |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5323 HMONITOR mon; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5324 MONITORINFO moninfo; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5325 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5326 // work out which monitor the window is on, and get *its* work area |
10438
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
5327 mon = MonitorFromWindow(s_hwnd, MONITOR_DEFAULTTOPRIMARY); |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5328 if (mon != NULL) |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5329 { |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5330 moninfo.cbSize = sizeof(MONITORINFO); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5331 if (GetMonitorInfo(mon, &moninfo)) |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5332 { |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5333 *spi_rect = moninfo.rcWork; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5334 return; |
7 | 5335 } |
5336 } | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5337 // this is the old method... |
7 | 5338 SystemParametersInfo(SPI_GETWORKAREA, 0, spi_rect, 0); |
5339 } | |
5340 | |
5341 /* | |
5342 * Set the size of the window to the given width and height in pixels. | |
5343 */ | |
5344 void | |
10783
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
5345 gui_mch_set_shellsize( |
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
5346 int width, |
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
5347 int height, |
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
5348 int min_width UNUSED, |
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
5349 int min_height UNUSED, |
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
5350 int base_width UNUSED, |
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
5351 int base_height UNUSED, |
812 | 5352 int direction) |
7 | 5353 { |
5354 RECT workarea_rect; | |
21351
a4f213630151
patch 8.2.1226: MS-Windows: windows positioning wrong depending on taskbar
Bram Moolenaar <Bram@vim.org>
parents:
20421
diff
changeset
|
5355 RECT window_rect; |
7 | 5356 int win_width, win_height; |
5357 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5358 // Try to keep window completely on screen. |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5359 // Get position of the screen work area. This is the part that is not |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5360 // used by the taskbar or appbars. |
7 | 5361 get_work_area(&workarea_rect); |
5362 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5363 // Resizing a maximized window looks very strange, unzoom it first. |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5364 // But don't do it when still starting up, it may have been requested in |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5365 // the shortcut. |
21351
a4f213630151
patch 8.2.1226: MS-Windows: windows positioning wrong depending on taskbar
Bram Moolenaar <Bram@vim.org>
parents:
20421
diff
changeset
|
5366 if (IsZoomed(s_hwnd) && starting == 0) |
7 | 5367 ShowWindow(s_hwnd, SW_SHOWNORMAL); |
21351
a4f213630151
patch 8.2.1226: MS-Windows: windows positioning wrong depending on taskbar
Bram Moolenaar <Bram@vim.org>
parents:
20421
diff
changeset
|
5368 |
a4f213630151
patch 8.2.1226: MS-Windows: windows positioning wrong depending on taskbar
Bram Moolenaar <Bram@vim.org>
parents:
20421
diff
changeset
|
5369 GetWindowRect(s_hwnd, &window_rect); |
7 | 5370 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5371 // compute the size of the outside of the window |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5372 win_width = width + (pGetSystemMetricsForDpi(SM_CXFRAME, s_dpi) + |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5373 pGetSystemMetricsForDpi(SM_CXPADDEDBORDER, s_dpi)) * 2; |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5374 win_height = height + (pGetSystemMetricsForDpi(SM_CYFRAME, s_dpi) + |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5375 pGetSystemMetricsForDpi(SM_CXPADDEDBORDER, s_dpi)) * 2 |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5376 + pGetSystemMetricsForDpi(SM_CYCAPTION, s_dpi) |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5377 + gui_mswin_get_menu_height(FALSE); |
7 | 5378 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5379 // The following should take care of keeping Vim on the same monitor, no |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5380 // matter if the secondary monitor is left or right of the primary |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5381 // monitor. |
21351
a4f213630151
patch 8.2.1226: MS-Windows: windows positioning wrong depending on taskbar
Bram Moolenaar <Bram@vim.org>
parents:
20421
diff
changeset
|
5382 window_rect.right = window_rect.left + win_width; |
a4f213630151
patch 8.2.1226: MS-Windows: windows positioning wrong depending on taskbar
Bram Moolenaar <Bram@vim.org>
parents:
20421
diff
changeset
|
5383 window_rect.bottom = window_rect.top + win_height; |
3248 | 5384 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5385 // If the window is going off the screen, move it on to the screen. |
21351
a4f213630151
patch 8.2.1226: MS-Windows: windows positioning wrong depending on taskbar
Bram Moolenaar <Bram@vim.org>
parents:
20421
diff
changeset
|
5386 if ((direction & RESIZE_HOR) && window_rect.right > workarea_rect.right) |
a4f213630151
patch 8.2.1226: MS-Windows: windows positioning wrong depending on taskbar
Bram Moolenaar <Bram@vim.org>
parents:
20421
diff
changeset
|
5387 OffsetRect(&window_rect, workarea_rect.right - window_rect.right, 0); |
a4f213630151
patch 8.2.1226: MS-Windows: windows positioning wrong depending on taskbar
Bram Moolenaar <Bram@vim.org>
parents:
20421
diff
changeset
|
5388 |
a4f213630151
patch 8.2.1226: MS-Windows: windows positioning wrong depending on taskbar
Bram Moolenaar <Bram@vim.org>
parents:
20421
diff
changeset
|
5389 if ((direction & RESIZE_HOR) && window_rect.left < workarea_rect.left) |
a4f213630151
patch 8.2.1226: MS-Windows: windows positioning wrong depending on taskbar
Bram Moolenaar <Bram@vim.org>
parents:
20421
diff
changeset
|
5390 OffsetRect(&window_rect, workarea_rect.left - window_rect.left, 0); |
a4f213630151
patch 8.2.1226: MS-Windows: windows positioning wrong depending on taskbar
Bram Moolenaar <Bram@vim.org>
parents:
20421
diff
changeset
|
5391 |
a4f213630151
patch 8.2.1226: MS-Windows: windows positioning wrong depending on taskbar
Bram Moolenaar <Bram@vim.org>
parents:
20421
diff
changeset
|
5392 if ((direction & RESIZE_VERT) && window_rect.bottom > workarea_rect.bottom) |
a4f213630151
patch 8.2.1226: MS-Windows: windows positioning wrong depending on taskbar
Bram Moolenaar <Bram@vim.org>
parents:
20421
diff
changeset
|
5393 OffsetRect(&window_rect, 0, workarea_rect.bottom - window_rect.bottom); |
a4f213630151
patch 8.2.1226: MS-Windows: windows positioning wrong depending on taskbar
Bram Moolenaar <Bram@vim.org>
parents:
20421
diff
changeset
|
5394 |
a4f213630151
patch 8.2.1226: MS-Windows: windows positioning wrong depending on taskbar
Bram Moolenaar <Bram@vim.org>
parents:
20421
diff
changeset
|
5395 if ((direction & RESIZE_VERT) && window_rect.top < workarea_rect.top) |
a4f213630151
patch 8.2.1226: MS-Windows: windows positioning wrong depending on taskbar
Bram Moolenaar <Bram@vim.org>
parents:
20421
diff
changeset
|
5396 OffsetRect(&window_rect, 0, workarea_rect.top - window_rect.top); |
a4f213630151
patch 8.2.1226: MS-Windows: windows positioning wrong depending on taskbar
Bram Moolenaar <Bram@vim.org>
parents:
20421
diff
changeset
|
5397 |
a4f213630151
patch 8.2.1226: MS-Windows: windows positioning wrong depending on taskbar
Bram Moolenaar <Bram@vim.org>
parents:
20421
diff
changeset
|
5398 MoveWindow(s_hwnd, window_rect.left, window_rect.top, |
a4f213630151
patch 8.2.1226: MS-Windows: windows positioning wrong depending on taskbar
Bram Moolenaar <Bram@vim.org>
parents:
20421
diff
changeset
|
5399 win_width, win_height, TRUE); |
7 | 5400 |
5401 SetActiveWindow(s_hwnd); | |
5402 SetFocus(s_hwnd); | |
5403 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5404 // Menu may wrap differently now |
7 | 5405 gui_mswin_get_menu_height(!gui.starting); |
5406 } | |
5407 | |
5408 | |
5409 void | |
5410 gui_mch_set_scrollbar_thumb( | |
5411 scrollbar_T *sb, | |
5412 long val, | |
5413 long size, | |
5414 long max) | |
5415 { | |
5416 SCROLLINFO info; | |
5417 | |
5418 sb->scroll_shift = 0; | |
5419 while (max > 32767) | |
5420 { | |
5421 max = (max + 1) >> 1; | |
5422 val >>= 1; | |
5423 size >>= 1; | |
5424 ++sb->scroll_shift; | |
5425 } | |
5426 | |
5427 if (sb->scroll_shift > 0) | |
5428 ++size; | |
5429 | |
5430 info.cbSize = sizeof(info); | |
5431 info.fMask = SIF_POS | SIF_RANGE | SIF_PAGE; | |
5432 info.nPos = val; | |
5433 info.nMin = 0; | |
5434 info.nMax = max; | |
5435 info.nPage = size; | |
5436 SetScrollInfo(sb->id, SB_CTL, &info, TRUE); | |
5437 } | |
5438 | |
5439 | |
5440 /* | |
5441 * Set the current text font. | |
5442 */ | |
5443 void | |
5444 gui_mch_set_font(GuiFont font) | |
5445 { | |
5446 gui.currFont = font; | |
5447 } | |
5448 | |
5449 | |
5450 /* | |
5451 * Set the current text foreground color. | |
5452 */ | |
5453 void | |
5454 gui_mch_set_fg_color(guicolor_T color) | |
5455 { | |
5456 gui.currFgColor = color; | |
5457 } | |
5458 | |
5459 /* | |
5460 * Set the current text background color. | |
5461 */ | |
5462 void | |
5463 gui_mch_set_bg_color(guicolor_T color) | |
5464 { | |
5465 gui.currBgColor = color; | |
5466 } | |
5467 | |
205 | 5468 /* |
5469 * Set the current text special color. | |
5470 */ | |
5471 void | |
5472 gui_mch_set_sp_color(guicolor_T color) | |
5473 { | |
5474 gui.currSpColor = color; | |
5475 } | |
5476 | |
12950
e60b2aa04903
patch 8.0.1351: warning for unused variables building with MinGW
Christian Brabandt <cb@256bit.org>
parents:
12934
diff
changeset
|
5477 #ifdef FEAT_MBYTE_IME |
7 | 5478 /* |
5479 * Multi-byte handling, originally by Sung-Hoon Baek. | |
5480 * First static functions (no prototypes generated). | |
5481 */ | |
12950
e60b2aa04903
patch 8.0.1351: warning for unused variables building with MinGW
Christian Brabandt <cb@256bit.org>
parents:
12934
diff
changeset
|
5482 # ifdef _MSC_VER |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5483 # include <ime.h> // Apparently not needed for Cygwin or MinGW. |
12950
e60b2aa04903
patch 8.0.1351: warning for unused variables building with MinGW
Christian Brabandt <cb@256bit.org>
parents:
12934
diff
changeset
|
5484 # endif |
e60b2aa04903
patch 8.0.1351: warning for unused variables building with MinGW
Christian Brabandt <cb@256bit.org>
parents:
12934
diff
changeset
|
5485 # include <imm.h> |
7 | 5486 |
5487 /* | |
5488 * handle WM_IME_NOTIFY message | |
5489 */ | |
5490 static LRESULT | |
10783
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
5491 _OnImeNotify(HWND hWnd, DWORD dwCommand, DWORD dwData UNUSED) |
7 | 5492 { |
5493 LRESULT lResult = 0; | |
5494 HIMC hImc; | |
5495 | |
5496 if (!pImmGetContext || (hImc = pImmGetContext(hWnd)) == (HIMC)0) | |
5497 return lResult; | |
5498 switch (dwCommand) | |
5499 { | |
5500 case IMN_SETOPENSTATUS: | |
5501 if (pImmGetOpenStatus(hImc)) | |
5502 { | |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5503 LOGFONTW lf = norm_logfont; |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5504 if (s_process_dpi_aware == DPI_AWARENESS_UNAWARE) |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5505 // Work around when PerMonitorV2 is not enabled in the process level. |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5506 lf.lfHeight = lf.lfHeight * DEFAULT_DPI / s_dpi; |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5507 pImmSetCompositionFontW(hImc, &lf); |
7 | 5508 im_set_position(gui.row, gui.col); |
5509 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5510 // Disable langmap |
7 | 5511 State &= ~LANGMAP; |
5512 if (State & INSERT) | |
5513 { | |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
5514 # if defined(FEAT_KEYMAP) |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5515 // Unshown 'keymap' in status lines |
7 | 5516 if (curbuf->b_p_iminsert == B_IMODE_LMAP) |
5517 { | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5518 // Save cursor position |
7 | 5519 int old_row = gui.row; |
5520 int old_col = gui.col; | |
5521 | |
5522 // This must be called here before | |
5523 // status_redraw_curbuf(), otherwise the mode | |
5524 // message may appear in the wrong position. | |
5525 showmode(); | |
5526 status_redraw_curbuf(); | |
5527 update_screen(0); | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5528 // Restore cursor position |
7 | 5529 gui.row = old_row; |
5530 gui.col = old_col; | |
5531 } | |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
5532 # endif |
7 | 5533 } |
5534 } | |
5535 gui_update_cursor(TRUE, FALSE); | |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5536 gui_mch_flush(); |
7 | 5537 lResult = 0; |
5538 break; | |
5539 } | |
5540 pImmReleaseContext(hWnd, hImc); | |
5541 return lResult; | |
5542 } | |
5543 | |
5544 static LRESULT | |
10783
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
5545 _OnImeComposition(HWND hwnd, WPARAM dbcs UNUSED, LPARAM param) |
7 | 5546 { |
5547 char_u *ret; | |
5548 int len; | |
5549 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5550 if ((param & GCS_RESULTSTR) == 0) // Composition unfinished. |
7 | 5551 return 0; |
5552 | |
5553 ret = GetResultStr(hwnd, GCS_RESULTSTR, &len); | |
5554 if (ret != NULL) | |
5555 { | |
5556 add_to_input_buf_csi(ret, len); | |
5557 vim_free(ret); | |
5558 return 1; | |
5559 } | |
5560 return 0; | |
5561 } | |
5562 | |
5563 /* | |
5564 * void GetResultStr() | |
5565 * | |
5566 * This handles WM_IME_COMPOSITION with GCS_RESULTSTR flag on. | |
5567 * get complete composition string | |
5568 */ | |
5569 static char_u * | |
5570 GetResultStr(HWND hwnd, int GCS, int *lenp) | |
5571 { | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5572 HIMC hIMC; // Input context handle. |
27229
6837d2c14dee
patch 8.2.4143: MS-Windows: IME support for Win9x is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27160
diff
changeset
|
5573 LONG ret; |
6837d2c14dee
patch 8.2.4143: MS-Windows: IME support for Win9x is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27160
diff
changeset
|
5574 WCHAR *buf = NULL; |
7 | 5575 char_u *convbuf = NULL; |
5576 | |
5577 if (!pImmGetContext || (hIMC = pImmGetContext(hwnd)) == (HIMC)0) | |
5578 return NULL; | |
5579 | |
27229
6837d2c14dee
patch 8.2.4143: MS-Windows: IME support for Win9x is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27160
diff
changeset
|
5580 // Get the length of the composition string. |
6837d2c14dee
patch 8.2.4143: MS-Windows: IME support for Win9x is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27160
diff
changeset
|
5581 ret = pImmGetCompositionStringW(hIMC, GCS, NULL, 0); |
6837d2c14dee
patch 8.2.4143: MS-Windows: IME support for Win9x is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27160
diff
changeset
|
5582 if (ret <= 0) |
6837d2c14dee
patch 8.2.4143: MS-Windows: IME support for Win9x is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27160
diff
changeset
|
5583 return NULL; |
6837d2c14dee
patch 8.2.4143: MS-Windows: IME support for Win9x is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27160
diff
changeset
|
5584 |
6837d2c14dee
patch 8.2.4143: MS-Windows: IME support for Win9x is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27160
diff
changeset
|
5585 // Allocate the requested buffer plus space for the NUL character. |
6837d2c14dee
patch 8.2.4143: MS-Windows: IME support for Win9x is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27160
diff
changeset
|
5586 buf = alloc(ret + sizeof(WCHAR)); |
7 | 5587 if (buf == NULL) |
5588 return NULL; | |
5589 | |
27229
6837d2c14dee
patch 8.2.4143: MS-Windows: IME support for Win9x is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27160
diff
changeset
|
5590 // Reads in the composition string. |
6837d2c14dee
patch 8.2.4143: MS-Windows: IME support for Win9x is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27160
diff
changeset
|
5591 pImmGetCompositionStringW(hIMC, GCS, buf, ret); |
6837d2c14dee
patch 8.2.4143: MS-Windows: IME support for Win9x is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27160
diff
changeset
|
5592 *lenp = ret / sizeof(WCHAR); |
6837d2c14dee
patch 8.2.4143: MS-Windows: IME support for Win9x is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27160
diff
changeset
|
5593 |
1752 | 5594 convbuf = utf16_to_enc(buf, lenp); |
7 | 5595 pImmReleaseContext(hwnd, hIMC); |
5596 vim_free(buf); | |
5597 return convbuf; | |
5598 } | |
5599 #endif | |
5600 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5601 // For global functions we need prototypes. |
12950
e60b2aa04903
patch 8.0.1351: warning for unused variables building with MinGW
Christian Brabandt <cb@256bit.org>
parents:
12934
diff
changeset
|
5602 #if defined(FEAT_MBYTE_IME) || defined(PROTO) |
7 | 5603 |
5604 /* | |
5605 * set font to IM. | |
5606 */ | |
5607 void | |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
5608 im_set_font(LOGFONTW *lf) |
7 | 5609 { |
5610 HIMC hImc; | |
5611 | |
5612 if (pImmGetContext && (hImc = pImmGetContext(s_hwnd)) != (HIMC)0) | |
5613 { | |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
5614 pImmSetCompositionFontW(hImc, lf); |
7 | 5615 pImmReleaseContext(s_hwnd, hImc); |
5616 } | |
5617 } | |
5618 | |
5619 /* | |
5620 * Notify cursor position to IM. | |
5621 */ | |
5622 void | |
5623 im_set_position(int row, int col) | |
5624 { | |
5625 HIMC hImc; | |
5626 | |
5627 if (pImmGetContext && (hImc = pImmGetContext(s_hwnd)) != (HIMC)0) | |
5628 { | |
5629 COMPOSITIONFORM cfs; | |
5630 | |
5631 cfs.dwStyle = CFS_POINT; | |
5632 cfs.ptCurrentPos.x = FILL_X(col); | |
5633 cfs.ptCurrentPos.y = FILL_Y(row); | |
5634 MapWindowPoints(s_textArea, s_hwnd, &cfs.ptCurrentPos, 1); | |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5635 if (s_process_dpi_aware == DPI_AWARENESS_UNAWARE) |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5636 { |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5637 // Work around when PerMonitorV2 is not enabled in the process level. |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5638 cfs.ptCurrentPos.x = cfs.ptCurrentPos.x * DEFAULT_DPI / s_dpi; |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5639 cfs.ptCurrentPos.y = cfs.ptCurrentPos.y * DEFAULT_DPI / s_dpi; |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
5640 } |
7 | 5641 pImmSetCompositionWindow(hImc, &cfs); |
5642 | |
5643 pImmReleaseContext(s_hwnd, hImc); | |
5644 } | |
5645 } | |
5646 | |
5647 /* | |
5648 * Set IM status on ("active" is TRUE) or off ("active" is FALSE). | |
5649 */ | |
5650 void | |
5651 im_set_active(int active) | |
5652 { | |
5653 HIMC hImc; | |
5654 static HIMC hImcOld = (HIMC)0; | |
5655 | |
18742
e9b2ade1adbd
patch 8.1.2361: MS-Windows: test failures related to VIMDLL
Bram Moolenaar <Bram@vim.org>
parents:
18662
diff
changeset
|
5656 # ifdef VIMDLL |
e9b2ade1adbd
patch 8.1.2361: MS-Windows: test failures related to VIMDLL
Bram Moolenaar <Bram@vim.org>
parents:
18662
diff
changeset
|
5657 if (!gui.in_use && !gui.starting) |
e9b2ade1adbd
patch 8.1.2361: MS-Windows: test failures related to VIMDLL
Bram Moolenaar <Bram@vim.org>
parents:
18662
diff
changeset
|
5658 { |
e9b2ade1adbd
patch 8.1.2361: MS-Windows: test failures related to VIMDLL
Bram Moolenaar <Bram@vim.org>
parents:
18662
diff
changeset
|
5659 mbyte_im_set_active(active); |
e9b2ade1adbd
patch 8.1.2361: MS-Windows: test failures related to VIMDLL
Bram Moolenaar <Bram@vim.org>
parents:
18662
diff
changeset
|
5660 return; |
e9b2ade1adbd
patch 8.1.2361: MS-Windows: test failures related to VIMDLL
Bram Moolenaar <Bram@vim.org>
parents:
18662
diff
changeset
|
5661 } |
e9b2ade1adbd
patch 8.1.2361: MS-Windows: test failures related to VIMDLL
Bram Moolenaar <Bram@vim.org>
parents:
18662
diff
changeset
|
5662 # endif |
e9b2ade1adbd
patch 8.1.2361: MS-Windows: test failures related to VIMDLL
Bram Moolenaar <Bram@vim.org>
parents:
18662
diff
changeset
|
5663 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5664 if (pImmGetContext) // if NULL imm32.dll wasn't loaded (yet) |
7 | 5665 { |
5666 if (p_imdisable) | |
5667 { | |
5668 if (hImcOld == (HIMC)0) | |
5669 { | |
5670 hImcOld = pImmGetContext(s_hwnd); | |
5671 if (hImcOld) | |
5672 pImmAssociateContext(s_hwnd, (HIMC)0); | |
5673 } | |
5674 active = FALSE; | |
5675 } | |
5676 else if (hImcOld != (HIMC)0) | |
5677 { | |
5678 pImmAssociateContext(s_hwnd, hImcOld); | |
5679 hImcOld = (HIMC)0; | |
5680 } | |
5681 | |
5682 hImc = pImmGetContext(s_hwnd); | |
5683 if (hImc) | |
5684 { | |
777 | 5685 /* |
5686 * for Korean ime | |
5687 */ | |
5688 HKL hKL = GetKeyboardLayout(0); | |
5689 | |
5690 if (LOWORD(hKL) == MAKELANGID(LANG_KOREAN, SUBLANG_KOREAN)) | |
5691 { | |
5692 static DWORD dwConversionSaved = 0, dwSentenceSaved = 0; | |
5693 static BOOL bSaved = FALSE; | |
5694 | |
5695 if (active) | |
5696 { | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5697 // if we have a saved conversion status, restore it |
777 | 5698 if (bSaved) |
5699 pImmSetConversionStatus(hImc, dwConversionSaved, | |
5700 dwSentenceSaved); | |
5701 bSaved = FALSE; | |
5702 } | |
5703 else | |
5704 { | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5705 // save conversion status and disable korean |
777 | 5706 if (pImmGetConversionStatus(hImc, &dwConversionSaved, |
5707 &dwSentenceSaved)) | |
5708 { | |
5709 bSaved = TRUE; | |
5710 pImmSetConversionStatus(hImc, | |
5711 dwConversionSaved & ~(IME_CMODE_NATIVE | |
5712 | IME_CMODE_FULLSHAPE), | |
5713 dwSentenceSaved); | |
5714 } | |
5715 } | |
5716 } | |
5717 | |
7 | 5718 pImmSetOpenStatus(hImc, active); |
5719 pImmReleaseContext(s_hwnd, hImc); | |
5720 } | |
5721 } | |
5722 } | |
5723 | |
5724 /* | |
5725 * Get IM status. When IM is on, return not 0. Else return 0. | |
5726 */ | |
5727 int | |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
5728 im_get_status(void) |
7 | 5729 { |
5730 int status = 0; | |
5731 HIMC hImc; | |
5732 | |
18742
e9b2ade1adbd
patch 8.1.2361: MS-Windows: test failures related to VIMDLL
Bram Moolenaar <Bram@vim.org>
parents:
18662
diff
changeset
|
5733 # ifdef VIMDLL |
e9b2ade1adbd
patch 8.1.2361: MS-Windows: test failures related to VIMDLL
Bram Moolenaar <Bram@vim.org>
parents:
18662
diff
changeset
|
5734 if (!gui.in_use && !gui.starting) |
e9b2ade1adbd
patch 8.1.2361: MS-Windows: test failures related to VIMDLL
Bram Moolenaar <Bram@vim.org>
parents:
18662
diff
changeset
|
5735 return mbyte_im_get_status(); |
e9b2ade1adbd
patch 8.1.2361: MS-Windows: test failures related to VIMDLL
Bram Moolenaar <Bram@vim.org>
parents:
18662
diff
changeset
|
5736 # endif |
e9b2ade1adbd
patch 8.1.2361: MS-Windows: test failures related to VIMDLL
Bram Moolenaar <Bram@vim.org>
parents:
18662
diff
changeset
|
5737 |
7 | 5738 if (pImmGetContext && (hImc = pImmGetContext(s_hwnd)) != (HIMC)0) |
5739 { | |
5740 status = pImmGetOpenStatus(hImc) ? 1 : 0; | |
5741 pImmReleaseContext(s_hwnd, hImc); | |
5742 } | |
5743 return status; | |
5744 } | |
5745 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5746 #endif // FEAT_MBYTE_IME |
7 | 5747 |
5748 | |
26 | 5749 /* |
786 | 5750 * Convert latin9 text "text[len]" to ucs-2 in "unicodebuf". |
26 | 5751 */ |
5752 static void | |
5753 latin9_to_ucs(char_u *text, int len, WCHAR *unicodebuf) | |
5754 { | |
5755 int c; | |
5756 | |
777 | 5757 while (--len >= 0) |
26 | 5758 { |
5759 c = *text++; | |
5760 switch (c) | |
5761 { | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5762 case 0xa4: c = 0x20ac; break; // euro |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5763 case 0xa6: c = 0x0160; break; // S hat |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5764 case 0xa8: c = 0x0161; break; // S -hat |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5765 case 0xb4: c = 0x017d; break; // Z hat |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5766 case 0xb8: c = 0x017e; break; // Z -hat |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5767 case 0xbc: c = 0x0152; break; // OE |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5768 case 0xbd: c = 0x0153; break; // oe |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5769 case 0xbe: c = 0x0178; break; // Y |
26 | 5770 } |
5771 *unicodebuf++ = c; | |
5772 } | |
5773 } | |
7 | 5774 |
5775 #ifdef FEAT_RIGHTLEFT | |
5776 /* | |
5777 * What is this for? In the case where you are using Win98 or Win2K or later, | |
5778 * and you are using a Hebrew font (or Arabic!), Windows does you a favor and | |
5779 * reverses the string sent to the TextOut... family. This sucks, because we | |
5780 * go to a lot of effort to do the right thing, and there doesn't seem to be a | |
5781 * way to tell Windblows not to do this! | |
5782 * | |
5783 * The short of it is that this 'RevOut' only gets called if you are running | |
5784 * one of the new, "improved" MS OSes, and only if you are running in | |
5785 * 'rightleft' mode. It makes display take *slightly* longer, but not | |
5786 * noticeably so. | |
5787 */ | |
5788 static void | |
27455
6045bf58926d
patch 8.2.4256: MS-Windows: compiler warnings when compiled with /W4
Bram Moolenaar <Bram@vim.org>
parents:
27370
diff
changeset
|
5789 RevOut( HDC hdc, |
7 | 5790 int col, |
5791 int row, | |
5792 UINT foptions, | |
5793 CONST RECT *pcliprect, | |
5794 LPCTSTR text, | |
5795 UINT len, | |
5796 CONST INT *padding) | |
5797 { | |
5798 int ix; | |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5799 |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5800 for (ix = 0; ix < (int)len; ++ix) |
27455
6045bf58926d
patch 8.2.4256: MS-Windows: compiler warnings when compiled with /W4
Bram Moolenaar <Bram@vim.org>
parents:
27370
diff
changeset
|
5801 ExtTextOut(hdc, col + TEXT_X(ix), row, foptions, |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5802 pcliprect, text + ix, 1, padding); |
7 | 5803 } |
5804 #endif | |
5805 | |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5806 static void |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5807 draw_line( |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5808 int x1, |
15277
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
5809 int y1, |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
5810 int x2, |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
5811 int y2, |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5812 COLORREF color) |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5813 { |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5814 #if defined(FEAT_DIRECTX) |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5815 if (IS_ENABLE_DIRECTX()) |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5816 DWriteContext_DrawLine(s_dwc, x1, y1, x2, y2, color); |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5817 else |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5818 #endif |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5819 { |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5820 HPEN hpen = CreatePen(PS_SOLID, 1, color); |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5821 HPEN old_pen = SelectObject(s_hdc, hpen); |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5822 MoveToEx(s_hdc, x1, y1, NULL); |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5823 // Note: LineTo() excludes the last pixel in the line. |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5824 LineTo(s_hdc, x2, y2); |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5825 DeleteObject(SelectObject(s_hdc, old_pen)); |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5826 } |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5827 } |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5828 |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5829 static void |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5830 set_pixel( |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5831 int x, |
15277
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
5832 int y, |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5833 COLORREF color) |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5834 { |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5835 #if defined(FEAT_DIRECTX) |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5836 if (IS_ENABLE_DIRECTX()) |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5837 DWriteContext_SetPixel(s_dwc, x, y, color); |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5838 else |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5839 #endif |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5840 SetPixel(s_hdc, x, y, color); |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5841 } |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5842 |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5843 static void |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5844 fill_rect( |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5845 const RECT *rcp, |
15277
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
5846 HBRUSH hbr, |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5847 COLORREF color) |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5848 { |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5849 #if defined(FEAT_DIRECTX) |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5850 if (IS_ENABLE_DIRECTX()) |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5851 DWriteContext_FillRect(s_dwc, rcp, color); |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5852 else |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5853 #endif |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5854 { |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5855 HBRUSH hbr2; |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5856 |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5857 if (hbr == NULL) |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5858 hbr2 = CreateSolidBrush(color); |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5859 else |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5860 hbr2 = hbr; |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5861 FillRect(s_hdc, rcp, hbr2); |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5862 if (hbr == NULL) |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5863 DeleteBrush(hbr2); |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5864 } |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5865 } |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5866 |
7 | 5867 void |
5868 gui_mch_draw_string( | |
5869 int row, | |
5870 int col, | |
5871 char_u *text, | |
5872 int len, | |
5873 int flags) | |
5874 { | |
5875 static int *padding = NULL; | |
5876 static int pad_size = 0; | |
5877 const RECT *pcliprect = NULL; | |
5878 UINT foptions = 0; | |
5879 static WCHAR *unicodebuf = NULL; | |
5880 static int *unicodepdy = NULL; | |
236 | 5881 static int unibuflen = 0; |
7 | 5882 int n = 0; |
5883 int y; | |
5884 | |
5885 /* | |
5886 * Italic and bold text seems to have an extra row of pixels at the bottom | |
5887 * (below where the bottom of the character should be). If we draw the | |
5888 * characters with a solid background, the top row of pixels in the | |
5889 * character below will be overwritten. We can fix this by filling in the | |
5890 * background ourselves, to the correct character proportions, and then | |
5891 * writing the character in transparent mode. Still have a problem when | |
5892 * the character is "_", which gets written on to the character below. | |
5893 * New fix: set gui.char_ascent to -1. This shifts all characters up one | |
5894 * pixel in their slots, which fixes the problem with the bottom row of | |
5895 * pixels. We still need this code because otherwise the top row of pixels | |
5896 * becomes a problem. - webb. | |
5897 */ | |
5898 static HBRUSH hbr_cache[2] = {NULL, NULL}; | |
5899 static guicolor_T brush_color[2] = {INVALCOLOR, INVALCOLOR}; | |
5900 static int brush_lru = 0; | |
5901 HBRUSH hbr; | |
5902 RECT rc; | |
5903 | |
5904 if (!(flags & DRAW_TRANSP)) | |
5905 { | |
5906 /* | |
5907 * Clear background first. | |
5908 * Note: FillRect() excludes right and bottom of rectangle. | |
5909 */ | |
5910 rc.left = FILL_X(col); | |
5911 rc.top = FILL_Y(row); | |
5912 if (has_mbyte) | |
5913 { | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5914 // Compute the length in display cells. |
2338
da6ec32d8d8f
Added strwidth() and strchars() functions.
Bram Moolenaar <bram@vim.org>
parents:
2311
diff
changeset
|
5915 rc.right = FILL_X(col + mb_string2cells(text, len)); |
7 | 5916 } |
5917 else | |
5918 rc.right = FILL_X(col + len); | |
5919 rc.bottom = FILL_Y(row + 1); | |
5920 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5921 // Cache the created brush, that saves a lot of time. We need two: |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5922 // one for cursor background and one for the normal background. |
7 | 5923 if (gui.currBgColor == brush_color[0]) |
5924 { | |
5925 hbr = hbr_cache[0]; | |
5926 brush_lru = 1; | |
5927 } | |
5928 else if (gui.currBgColor == brush_color[1]) | |
5929 { | |
5930 hbr = hbr_cache[1]; | |
5931 brush_lru = 0; | |
5932 } | |
5933 else | |
5934 { | |
5935 if (hbr_cache[brush_lru] != NULL) | |
5936 DeleteBrush(hbr_cache[brush_lru]); | |
5937 hbr_cache[brush_lru] = CreateSolidBrush(gui.currBgColor); | |
5938 brush_color[brush_lru] = gui.currBgColor; | |
5939 hbr = hbr_cache[brush_lru]; | |
5940 brush_lru = !brush_lru; | |
5941 } | |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
5942 |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5943 fill_rect(&rc, hbr, gui.currBgColor); |
7 | 5944 |
5945 SetBkMode(s_hdc, TRANSPARENT); | |
5946 | |
5947 /* | |
5948 * When drawing block cursor, prevent inverted character spilling | |
5949 * over character cell (can happen with bold/italic) | |
5950 */ | |
5951 if (flags & DRAW_CURSOR) | |
5952 { | |
5953 pcliprect = &rc; | |
5954 foptions = ETO_CLIPPED; | |
5955 } | |
5956 } | |
5957 SetTextColor(s_hdc, gui.currFgColor); | |
5958 SelectFont(s_hdc, gui.currFont); | |
5959 | |
6110 | 5960 #ifdef FEAT_DIRECTX |
5961 if (IS_ENABLE_DIRECTX()) | |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
5962 DWriteContext_SetFont(s_dwc, (HFONT)gui.currFont); |
6110 | 5963 #endif |
5964 | |
7 | 5965 if (pad_size != Columns || padding == NULL || padding[0] != gui.char_width) |
5966 { | |
27455
6045bf58926d
patch 8.2.4256: MS-Windows: compiler warnings when compiled with /W4
Bram Moolenaar <Bram@vim.org>
parents:
27370
diff
changeset
|
5967 int i; |
6045bf58926d
patch 8.2.4256: MS-Windows: compiler warnings when compiled with /W4
Bram Moolenaar <Bram@vim.org>
parents:
27370
diff
changeset
|
5968 |
7 | 5969 vim_free(padding); |
5970 pad_size = Columns; | |
5971 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5972 // Don't give an out-of-memory message here, it would call us |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5973 // recursively. |
16827
ce562b9f702e
patch 8.1.1415: build error in MS-Windows GUI
Bram Moolenaar <Bram@vim.org>
parents:
16825
diff
changeset
|
5974 padding = LALLOC_MULT(int, pad_size); |
7 | 5975 if (padding != NULL) |
5976 for (i = 0; i < pad_size; i++) | |
5977 padding[i] = gui.char_width; | |
5978 } | |
5979 | |
5980 /* | |
5981 * We have to provide the padding argument because italic and bold versions | |
5982 * of fixed-width fonts are often one pixel or so wider than their normal | |
5983 * versions. | |
5984 * No check for DRAW_BOLD, Windows will have done it already. | |
5985 */ | |
5986 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5987 // Check if there are any UTF-8 characters. If not, use normal text |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5988 // output to speed up output. |
7 | 5989 if (enc_utf8) |
5990 for (n = 0; n < len; ++n) | |
5991 if (text[n] >= 0x80) | |
5992 break; | |
5993 | |
15597
536dd2bc5ac9
patch 8.1.0806: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15549
diff
changeset
|
5994 #if defined(FEAT_DIRECTX) |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5995 // Quick hack to enable DirectWrite. To use DirectWrite (antialias), it is |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5996 // required that unicode drawing routine, currently. So this forces it |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5997 // enabled. |
13028
cfce9ac1d1e8
patch 8.0.1390: DirectX scrolling can be slow, vertical positioning is off
Christian Brabandt <cb@256bit.org>
parents:
12994
diff
changeset
|
5998 if (IS_ENABLE_DIRECTX()) |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
5999 n = 0; // Keep n < len, to enter block for unicode. |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6000 #endif |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6001 |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6002 // Check if the Unicode buffer exists and is big enough. Create it |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6003 // with the same length as the multi-byte string, the number of wide |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6004 // characters is always equal or smaller. |
26 | 6005 if ((enc_utf8 |
6006 || (enc_codepage > 0 && (int)GetACP() != enc_codepage) | |
6007 || enc_latin9) | |
7 | 6008 && (unicodebuf == NULL || len > unibuflen)) |
6009 { | |
6010 vim_free(unicodebuf); | |
16825
ce04ebdf26b8
patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
Bram Moolenaar <Bram@vim.org>
parents:
16768
diff
changeset
|
6011 unicodebuf = LALLOC_MULT(WCHAR, len); |
7 | 6012 |
6013 vim_free(unicodepdy); | |
16825
ce04ebdf26b8
patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
Bram Moolenaar <Bram@vim.org>
parents:
16768
diff
changeset
|
6014 unicodepdy = LALLOC_MULT(int, len); |
7 | 6015 |
6016 unibuflen = len; | |
6017 } | |
6018 | |
6019 if (enc_utf8 && n < len && unicodebuf != NULL) | |
6020 { | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6021 // Output UTF-8 characters. Composing characters should be |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6022 // handled here. |
777 | 6023 int i; |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6024 int wlen; // string length in words |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6025 int clen; // string length in characters |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6026 int cells; // cell width of string up to composing char |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6027 int cw; // width of current cell |
714 | 6028 int c; |
777 | 6029 |
782 | 6030 wlen = 0; |
777 | 6031 clen = 0; |
7 | 6032 cells = 0; |
777 | 6033 for (i = 0; i < len; ) |
7 | 6034 { |
714 | 6035 c = utf_ptr2char(text + i); |
6036 if (c >= 0x10000) | |
6037 { | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6038 // Turn into UTF-16 encoding. |
777 | 6039 unicodebuf[wlen++] = ((c - 0x10000) >> 10) + 0xD800; |
6040 unicodebuf[wlen++] = ((c - 0x10000) & 0x3ff) + 0xDC00; | |
714 | 6041 } |
6042 else | |
6043 { | |
777 | 6044 unicodebuf[wlen++] = c; |
714 | 6045 } |
12712
25f7d8ee04c7
patch 8.0.1234: MS-Windows: composing chars are not shown properly
Christian Brabandt <cb@256bit.org>
parents:
12668
diff
changeset
|
6046 |
25f7d8ee04c7
patch 8.0.1234: MS-Windows: composing chars are not shown properly
Christian Brabandt <cb@256bit.org>
parents:
12668
diff
changeset
|
6047 if (utf_iscomposing(c)) |
25f7d8ee04c7
patch 8.0.1234: MS-Windows: composing chars are not shown properly
Christian Brabandt <cb@256bit.org>
parents:
12668
diff
changeset
|
6048 cw = 0; |
25f7d8ee04c7
patch 8.0.1234: MS-Windows: composing chars are not shown properly
Christian Brabandt <cb@256bit.org>
parents:
12668
diff
changeset
|
6049 else |
25f7d8ee04c7
patch 8.0.1234: MS-Windows: composing chars are not shown properly
Christian Brabandt <cb@256bit.org>
parents:
12668
diff
changeset
|
6050 { |
25f7d8ee04c7
patch 8.0.1234: MS-Windows: composing chars are not shown properly
Christian Brabandt <cb@256bit.org>
parents:
12668
diff
changeset
|
6051 cw = utf_char2cells(c); |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6052 if (cw > 2) // don't use 4 for unprintable char |
12712
25f7d8ee04c7
patch 8.0.1234: MS-Windows: composing chars are not shown properly
Christian Brabandt <cb@256bit.org>
parents:
12668
diff
changeset
|
6053 cw = 1; |
25f7d8ee04c7
patch 8.0.1234: MS-Windows: composing chars are not shown properly
Christian Brabandt <cb@256bit.org>
parents:
12668
diff
changeset
|
6054 } |
25f7d8ee04c7
patch 8.0.1234: MS-Windows: composing chars are not shown properly
Christian Brabandt <cb@256bit.org>
parents:
12668
diff
changeset
|
6055 |
7 | 6056 if (unicodepdy != NULL) |
6057 { | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6058 // Use unicodepdy to make characters fit as we expect, even |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6059 // when the font uses different widths (e.g., bold character |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6060 // is wider). |
8273
0c3210caefa6
commit https://github.com/vim/vim/commit/d804fdf4c25435284333258856bc265f1ff10b09
Christian Brabandt <cb@256bit.org>
parents:
8222
diff
changeset
|
6061 if (c >= 0x10000) |
0c3210caefa6
commit https://github.com/vim/vim/commit/d804fdf4c25435284333258856bc265f1ff10b09
Christian Brabandt <cb@256bit.org>
parents:
8222
diff
changeset
|
6062 { |
0c3210caefa6
commit https://github.com/vim/vim/commit/d804fdf4c25435284333258856bc265f1ff10b09
Christian Brabandt <cb@256bit.org>
parents:
8222
diff
changeset
|
6063 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
|
6064 unicodepdy[wlen - 1] = 0; |
0c3210caefa6
commit https://github.com/vim/vim/commit/d804fdf4c25435284333258856bc265f1ff10b09
Christian Brabandt <cb@256bit.org>
parents:
8222
diff
changeset
|
6065 } |
0c3210caefa6
commit https://github.com/vim/vim/commit/d804fdf4c25435284333258856bc265f1ff10b09
Christian Brabandt <cb@256bit.org>
parents:
8222
diff
changeset
|
6066 else |
0c3210caefa6
commit https://github.com/vim/vim/commit/d804fdf4c25435284333258856bc265f1ff10b09
Christian Brabandt <cb@256bit.org>
parents:
8222
diff
changeset
|
6067 unicodepdy[wlen - 1] = cw * gui.char_width; |
7 | 6068 } |
6069 cells += cw; | |
12712
25f7d8ee04c7
patch 8.0.1234: MS-Windows: composing chars are not shown properly
Christian Brabandt <cb@256bit.org>
parents:
12668
diff
changeset
|
6070 i += utf_ptr2len_len(text + i, len - i); |
777 | 6071 ++clen; |
7 | 6072 } |
15597
536dd2bc5ac9
patch 8.1.0806: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15549
diff
changeset
|
6073 #if defined(FEAT_DIRECTX) |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
6074 if (IS_ENABLE_DIRECTX()) |
6110 | 6075 { |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6076 // Add one to "cells" for italics. |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
6077 DWriteContext_DrawText(s_dwc, unicodebuf, wlen, |
16048
728bef04b0d4
patch 8.1.1029: DirectWrite doesn't take 'linespace' into account
Bram Moolenaar <Bram@vim.org>
parents:
15665
diff
changeset
|
6078 TEXT_X(col), TEXT_Y(row), |
728bef04b0d4
patch 8.1.1029: DirectWrite doesn't take 'linespace' into account
Bram Moolenaar <Bram@vim.org>
parents:
15665
diff
changeset
|
6079 FILL_X(cells + 1), FILL_Y(1) - p_linespace, |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
6080 gui.char_width, gui.currFgColor, |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
6081 foptions, pcliprect, unicodepdy); |
6110 | 6082 } |
6083 else | |
15597
536dd2bc5ac9
patch 8.1.0806: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15549
diff
changeset
|
6084 #endif |
6110 | 6085 ExtTextOutW(s_hdc, TEXT_X(col), TEXT_Y(row), |
6086 foptions, pcliprect, unicodebuf, wlen, unicodepdy); | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6087 len = cells; // used for underlining |
7 | 6088 } |
26 | 6089 else if ((enc_codepage > 0 && (int)GetACP() != enc_codepage) || enc_latin9) |
7 | 6090 { |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6091 // If we want to display codepage data, and the current CP is not the |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6092 // ANSI one, we need to go via Unicode. |
7 | 6093 if (unicodebuf != NULL) |
6094 { | |
26 | 6095 if (enc_latin9) |
6096 latin9_to_ucs(text, len, unicodebuf); | |
6097 else | |
6098 len = MultiByteToWideChar(enc_codepage, | |
7 | 6099 MB_PRECOMPOSED, |
6100 (char *)text, len, | |
6101 (LPWSTR)unicodebuf, unibuflen); | |
6102 if (len != 0) | |
179 | 6103 { |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6104 // Use unicodepdy to make characters fit as we expect, even |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6105 // when the font uses different widths (e.g., bold character |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6106 // is wider). |
179 | 6107 if (unicodepdy != NULL) |
6108 { | |
6109 int i; | |
6110 int cw; | |
6111 | |
6112 for (i = 0; i < len; ++i) | |
6113 { | |
6114 cw = utf_char2cells(unicodebuf[i]); | |
6115 if (cw > 2) | |
6116 cw = 1; | |
6117 unicodepdy[i] = cw * gui.char_width; | |
6118 } | |
6119 } | |
7 | 6120 ExtTextOutW(s_hdc, TEXT_X(col), TEXT_Y(row), |
179 | 6121 foptions, pcliprect, unicodebuf, len, unicodepdy); |
6122 } | |
7 | 6123 } |
6124 } | |
6125 else | |
6126 { | |
6127 #ifdef FEAT_RIGHTLEFT | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6128 // Windows will mess up RL text, so we have to draw it character by |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6129 // character. Only do this if RL is on, since it's slow. |
6226 | 6130 if (curwin->w_p_rl) |
7 | 6131 RevOut(s_hdc, TEXT_X(col), TEXT_Y(row), |
6132 foptions, pcliprect, (char *)text, len, padding); | |
6133 else | |
6134 #endif | |
6135 ExtTextOut(s_hdc, TEXT_X(col), TEXT_Y(row), | |
6136 foptions, pcliprect, (char *)text, len, padding); | |
6137 } | |
6138 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6139 // Underline |
7 | 6140 if (flags & DRAW_UNDERL) |
6141 { | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6142 // When p_linespace is 0, overwrite the bottom row of pixels. |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6143 // Otherwise put the line just below the character. |
7 | 6144 y = FILL_Y(row + 1) - 1; |
6145 if (p_linespace > 1) | |
6146 y -= p_linespace - 1; | |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6147 draw_line(FILL_X(col), y, FILL_X(col + len), y, gui.currFgColor); |
7 | 6148 } |
205 | 6149 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6150 // Strikethrough |
12317
2a8890b80923
patch 8.0.1038: strike-through text not supported
Christian Brabandt <cb@256bit.org>
parents:
12090
diff
changeset
|
6151 if (flags & DRAW_STRIKE) |
2a8890b80923
patch 8.0.1038: strike-through text not supported
Christian Brabandt <cb@256bit.org>
parents:
12090
diff
changeset
|
6152 { |
2a8890b80923
patch 8.0.1038: strike-through text not supported
Christian Brabandt <cb@256bit.org>
parents:
12090
diff
changeset
|
6153 y = FILL_Y(row + 1) - gui.char_height/2; |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6154 draw_line(FILL_X(col), y, FILL_X(col + len), y, gui.currSpColor); |
12317
2a8890b80923
patch 8.0.1038: strike-through text not supported
Christian Brabandt <cb@256bit.org>
parents:
12090
diff
changeset
|
6155 } |
2a8890b80923
patch 8.0.1038: strike-through text not supported
Christian Brabandt <cb@256bit.org>
parents:
12090
diff
changeset
|
6156 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6157 // Undercurl |
205 | 6158 if (flags & DRAW_UNDERC) |
6159 { | |
6160 int x; | |
6161 int offset; | |
323 | 6162 static const int val[8] = {1, 0, 0, 0, 1, 2, 2, 2 }; |
205 | 6163 |
6164 y = FILL_Y(row + 1) - 1; | |
6165 for (x = FILL_X(col); x < FILL_X(col + len); ++x) | |
6166 { | |
6167 offset = val[x % 8]; | |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6168 set_pixel(x, y - offset, gui.currSpColor); |
205 | 6169 } |
6170 } | |
7 | 6171 } |
6172 | |
6173 | |
6174 /* | |
6175 * Output routines. | |
6176 */ | |
6177 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6178 /* |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6179 * Flush any output to the screen |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6180 */ |
7 | 6181 void |
6182 gui_mch_flush(void) | |
6183 { | |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
6184 #if defined(FEAT_DIRECTX) |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
6185 if (IS_ENABLE_DIRECTX()) |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
6186 DWriteContext_Flush(s_dwc); |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
6187 #endif |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
6188 |
7 | 6189 GdiFlush(); |
6190 } | |
6191 | |
6192 static void | |
6193 clear_rect(RECT *rcp) | |
6194 { | |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6195 fill_rect(rcp, NULL, gui.back_pixel); |
7 | 6196 } |
6197 | |
6198 | |
636 | 6199 void |
6200 gui_mch_get_screen_dimensions(int *screen_w, int *screen_h) | |
6201 { | |
6202 RECT workarea_rect; | |
6203 | |
6204 get_work_area(&workarea_rect); | |
6205 | |
819 | 6206 *screen_w = workarea_rect.right - workarea_rect.left |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
6207 - (pGetSystemMetricsForDpi(SM_CXFRAME, s_dpi) + |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
6208 pGetSystemMetricsForDpi(SM_CXPADDEDBORDER, s_dpi)) * 2; |
636 | 6209 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6210 // FIXME: dirty trick: Because the gui_get_base_height() doesn't include |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6211 // the menubar for MSwin, we subtract it from the screen height, so that |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6212 // the window size can be made to fit on the screen. |
819 | 6213 *screen_h = workarea_rect.bottom - workarea_rect.top |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
6214 - (pGetSystemMetricsForDpi(SM_CYFRAME, s_dpi) + |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
6215 pGetSystemMetricsForDpi(SM_CXPADDEDBORDER, s_dpi)) * 2 |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
6216 - pGetSystemMetricsForDpi(SM_CYCAPTION, s_dpi) |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
6217 - gui_mswin_get_menu_height(FALSE); |
636 | 6218 } |
6219 | |
6220 | |
7 | 6221 #if defined(FEAT_MENU) || defined(PROTO) |
6222 /* | |
6223 * Add a sub menu to the menu bar. | |
6224 */ | |
6225 void | |
6226 gui_mch_add_menu( | |
6227 vimmenu_T *menu, | |
6228 int pos) | |
6229 { | |
6230 vimmenu_T *parent = menu->parent; | |
6231 | |
6232 menu->submenu_id = CreatePopupMenu(); | |
6233 menu->id = s_menu_id++; | |
6234 | |
6235 if (menu_is_menubar(menu->name)) | |
6236 { | |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
6237 WCHAR *wn; |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
6238 MENUITEMINFOW infow; |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
6239 |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
6240 wn = enc_to_utf16(menu->name, NULL); |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6241 if (wn == NULL) |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
6242 return; |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
6243 |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
6244 infow.cbSize = sizeof(infow); |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
6245 infow.fMask = MIIM_DATA | MIIM_TYPE | MIIM_ID |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
6246 | MIIM_SUBMENU; |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
6247 infow.dwItemData = (long_u)menu; |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
6248 infow.wID = menu->id; |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
6249 infow.fType = MFT_STRING; |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
6250 infow.dwTypeData = wn; |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
6251 infow.cch = (UINT)wcslen(wn); |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
6252 infow.hSubMenu = menu->submenu_id; |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
6253 InsertMenuItemW((parent == NULL) |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
6254 ? s_menuBar : parent->submenu_id, |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
6255 (UINT)pos, TRUE, &infow); |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
6256 vim_free(wn); |
7 | 6257 } |
6258 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6259 // Fix window size if menu may have wrapped |
7 | 6260 if (parent == NULL) |
6261 gui_mswin_get_menu_height(!gui.starting); | |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6262 # ifdef FEAT_TEAROFF |
7 | 6263 else if (IsWindow(parent->tearoff_handle)) |
6264 rebuild_tearoff(parent); | |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6265 # endif |
7 | 6266 } |
6267 | |
6268 void | |
6269 gui_mch_show_popupmenu(vimmenu_T *menu) | |
6270 { | |
6271 POINT mp; | |
6272 | |
27281
f7d73708b391
patch 8.2.4169: MS-Windows: unnessary casts and other minor things
Bram Moolenaar <Bram@vim.org>
parents:
27261
diff
changeset
|
6273 (void)GetCursorPos(&mp); |
7 | 6274 gui_mch_show_popupmenu_at(menu, (int)mp.x, (int)mp.y); |
6275 } | |
6276 | |
6277 void | |
401 | 6278 gui_make_popup(char_u *path_name, int mouse_pos) |
7 | 6279 { |
6280 vimmenu_T *menu = gui_find_menu(path_name); | |
6281 | |
6282 if (menu != NULL) | |
6283 { | |
6284 POINT p; | |
6285 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6286 // Find the position of the current cursor |
7 | 6287 GetDCOrgEx(s_hdc, &p); |
401 | 6288 if (mouse_pos) |
6289 { | |
6290 int mx, my; | |
6291 | |
6292 gui_mch_getmouse(&mx, &my); | |
6293 p.x += mx; | |
6294 p.y += my; | |
6295 } | |
6296 else if (curwin != NULL) | |
7 | 6297 { |
12513
3ca08bf99396
patch 8.0.1135: W_WINCOL() is always the same
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
6298 p.x += TEXT_X(curwin->w_wincol + curwin->w_wcol + 1); |
7 | 6299 p.y += TEXT_Y(W_WINROW(curwin) + curwin->w_wrow + 1); |
6300 } | |
6301 msg_scroll = FALSE; | |
6302 gui_mch_show_popupmenu_at(menu, (int)p.x, (int)p.y); | |
6303 } | |
6304 } | |
6305 | |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6306 # if defined(FEAT_TEAROFF) || defined(PROTO) |
7 | 6307 /* |
6308 * Given a menu descriptor, e.g. "File.New", find it in the menu hierarchy and | |
6309 * create it as a pseudo-"tearoff menu". | |
6310 */ | |
6311 void | |
6312 gui_make_tearoff(char_u *path_name) | |
6313 { | |
6314 vimmenu_T *menu = gui_find_menu(path_name); | |
6315 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6316 // Found the menu, so tear it off. |
7 | 6317 if (menu != NULL) |
6318 gui_mch_tearoff(menu->dname, menu, 0xffffL, 0xffffL); | |
6319 } | |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6320 # endif |
7 | 6321 |
6322 /* | |
6323 * Add a menu item to a menu | |
6324 */ | |
6325 void | |
6326 gui_mch_add_menu_item( | |
6327 vimmenu_T *menu, | |
6328 int idx) | |
6329 { | |
6330 vimmenu_T *parent = menu->parent; | |
6331 | |
6332 menu->id = s_menu_id++; | |
6333 menu->submenu_id = NULL; | |
6334 | |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6335 # ifdef FEAT_TEAROFF |
7 | 6336 if (STRNCMP(menu->name, TEAR_STRING, TEAR_LEN) == 0) |
6337 { | |
6338 InsertMenu(parent->submenu_id, (UINT)idx, MF_BITMAP|MF_BYPOSITION, | |
6339 (UINT)menu->id, (LPCTSTR) s_htearbitmap); | |
6340 } | |
6341 else | |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6342 # endif |
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6343 # ifdef FEAT_TOOLBAR |
7 | 6344 if (menu_is_toolbar(parent->name)) |
6345 { | |
6346 TBBUTTON newtb; | |
6347 | |
20007
aadd1cae2ff5
patch 8.2.0559: clearing a struct is verbose
Bram Moolenaar <Bram@vim.org>
parents:
19934
diff
changeset
|
6348 CLEAR_FIELD(newtb); |
7 | 6349 if (menu_is_separator(menu->name)) |
6350 { | |
6351 newtb.iBitmap = 0; | |
6352 newtb.fsStyle = TBSTYLE_SEP; | |
6353 } | |
6354 else | |
6355 { | |
6356 newtb.iBitmap = get_toolbar_bitmap(menu); | |
6357 newtb.fsStyle = TBSTYLE_BUTTON; | |
6358 } | |
6359 newtb.idCommand = menu->id; | |
6360 newtb.fsState = TBSTATE_ENABLED; | |
6361 newtb.iString = 0; | |
6362 SendMessage(s_toolbarhwnd, TB_INSERTBUTTON, (WPARAM)idx, | |
6363 (LPARAM)&newtb); | |
6364 menu->submenu_id = (HMENU)-1; | |
6365 } | |
6366 else | |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6367 # endif |
7 | 6368 { |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
6369 WCHAR *wn; |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
6370 |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
6371 wn = enc_to_utf16(menu->name, NULL); |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
6372 if (wn != NULL) |
7 | 6373 { |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
6374 InsertMenuW(parent->submenu_id, (UINT)idx, |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
6375 (menu_is_separator(menu->name) |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
6376 ? MF_SEPARATOR : MF_STRING) | MF_BYPOSITION, |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
6377 (UINT)menu->id, wn); |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
6378 vim_free(wn); |
7 | 6379 } |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6380 # ifdef FEAT_TEAROFF |
7 | 6381 if (IsWindow(parent->tearoff_handle)) |
6382 rebuild_tearoff(parent); | |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6383 # endif |
7 | 6384 } |
6385 } | |
6386 | |
6387 /* | |
6388 * Destroy the machine specific menu widget. | |
6389 */ | |
6390 void | |
6391 gui_mch_destroy_menu(vimmenu_T *menu) | |
6392 { | |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6393 # ifdef FEAT_TOOLBAR |
7 | 6394 /* |
6395 * is this a toolbar button? | |
6396 */ | |
6397 if (menu->submenu_id == (HMENU)-1) | |
6398 { | |
6399 int iButton; | |
6400 | |
6401 iButton = (int)SendMessage(s_toolbarhwnd, TB_COMMANDTOINDEX, | |
6402 (WPARAM)menu->id, 0); | |
6403 SendMessage(s_toolbarhwnd, TB_DELETEBUTTON, (WPARAM)iButton, 0); | |
6404 } | |
6405 else | |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6406 # endif |
7 | 6407 { |
6408 if (menu->parent != NULL | |
6409 && menu_is_popup(menu->parent->dname) | |
6410 && menu->parent->submenu_id != NULL) | |
6411 RemoveMenu(menu->parent->submenu_id, menu->id, MF_BYCOMMAND); | |
6412 else | |
6413 RemoveMenu(s_menuBar, menu->id, MF_BYCOMMAND); | |
6414 if (menu->submenu_id != NULL) | |
6415 DestroyMenu(menu->submenu_id); | |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6416 # ifdef FEAT_TEAROFF |
7 | 6417 if (IsWindow(menu->tearoff_handle)) |
6418 DestroyWindow(menu->tearoff_handle); | |
6419 if (menu->parent != NULL | |
6420 && menu->parent->children != NULL | |
6421 && IsWindow(menu->parent->tearoff_handle)) | |
6422 { | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6423 // This menu must not show up when rebuilding the tearoff window. |
7 | 6424 menu->modes = 0; |
6425 rebuild_tearoff(menu->parent); | |
6426 } | |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6427 # endif |
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6428 } |
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6429 } |
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6430 |
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6431 # ifdef FEAT_TEAROFF |
7 | 6432 static void |
6433 rebuild_tearoff(vimmenu_T *menu) | |
6434 { | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6435 //hackish |
7 | 6436 char_u tbuf[128]; |
6437 RECT trect; | |
6438 RECT rct; | |
6439 RECT roct; | |
6440 int x, y; | |
6441 | |
6442 HWND thwnd = menu->tearoff_handle; | |
6443 | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
6444 GetWindowText(thwnd, (LPSTR)tbuf, 127); |
7 | 6445 if (GetWindowRect(thwnd, &trect) |
6446 && GetWindowRect(s_hwnd, &rct) | |
6447 && GetClientRect(s_hwnd, &roct)) | |
6448 { | |
6449 x = trect.left - rct.left; | |
6450 y = (trect.top - rct.bottom + roct.bottom); | |
6451 } | |
6452 else | |
6453 { | |
6454 x = y = 0xffffL; | |
6455 } | |
6456 DestroyWindow(thwnd); | |
6457 if (menu->children != NULL) | |
6458 { | |
6459 gui_mch_tearoff(tbuf, menu, x, y); | |
6460 if (IsWindow(menu->tearoff_handle)) | |
6461 (void) SetWindowPos(menu->tearoff_handle, | |
6462 NULL, | |
6463 (int)trect.left, | |
6464 (int)trect.top, | |
6465 0, 0, | |
6466 SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); | |
6467 } | |
6468 } | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6469 # endif // FEAT_TEAROFF |
7 | 6470 |
6471 /* | |
6472 * Make a menu either grey or not grey. | |
6473 */ | |
6474 void | |
6475 gui_mch_menu_grey( | |
6476 vimmenu_T *menu, | |
6477 int grey) | |
6478 { | |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6479 # ifdef FEAT_TOOLBAR |
7 | 6480 /* |
6481 * is this a toolbar button? | |
6482 */ | |
6483 if (menu->submenu_id == (HMENU)-1) | |
6484 { | |
6485 SendMessage(s_toolbarhwnd, TB_ENABLEBUTTON, | |
27281
f7d73708b391
patch 8.2.4169: MS-Windows: unnessary casts and other minor things
Bram Moolenaar <Bram@vim.org>
parents:
27261
diff
changeset
|
6486 (WPARAM)menu->id, (LPARAM) MAKELONG((grey ? FALSE : TRUE), 0)); |
7 | 6487 } |
6488 else | |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6489 # endif |
9236
9940e9b2a725
commit https://github.com/vim/vim/commit/762f1754370a1278167c8cba6c047ef319fc099c
Christian Brabandt <cb@256bit.org>
parents:
9213
diff
changeset
|
6490 (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
|
6491 menu->id, MF_BYCOMMAND | (grey ? MF_GRAYED : MF_ENABLED)); |
7 | 6492 |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6493 # ifdef FEAT_TEAROFF |
7 | 6494 if ((menu->parent != NULL) && (IsWindow(menu->parent->tearoff_handle))) |
6495 { | |
6496 WORD menuID; | |
6497 HWND menuHandle; | |
6498 | |
6499 /* | |
6500 * A tearoff button has changed state. | |
6501 */ | |
6502 if (menu->children == NULL) | |
6503 menuID = (WORD)(menu->id); | |
6504 else | |
840 | 6505 menuID = (WORD)((long_u)(menu->submenu_id) | (DWORD)0x8000); |
7 | 6506 menuHandle = GetDlgItem(menu->parent->tearoff_handle, menuID); |
6507 if (menuHandle) | |
6508 EnableWindow(menuHandle, !grey); | |
6509 | |
6510 } | |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6511 # endif |
7 | 6512 } |
6513 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6514 #endif // FEAT_MENU |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6515 |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6516 |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6517 // define some macros used to make the dialogue creation more readable |
7 | 6518 |
6519 #define add_word(x) *p++ = (x) | |
615 | 6520 #define add_long(x) dwp = (DWORD *)p; *dwp++ = (x); p = (WORD *)dwp |
7 | 6521 |
6522 #if defined(FEAT_GUI_DIALOG) || defined(PROTO) | |
6523 /* | |
6524 * stuff for dialogs | |
6525 */ | |
6526 | |
6527 /* | |
6528 * The callback routine used by all the dialogs. Very simple. First, | |
6529 * acknowledges the INITDIALOG message so that Windows knows to do standard | |
6530 * dialog stuff (Return = default, Esc = cancel....) Second, if a button is | |
6531 * pressed, return that button's ID - IDCANCEL (2), which is the button's | |
6532 * number. | |
6533 */ | |
6534 static LRESULT CALLBACK | |
6535 dialog_callback( | |
6536 HWND hwnd, | |
6537 UINT message, | |
6538 WPARAM wParam, | |
10783
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
6539 LPARAM lParam UNUSED) |
7 | 6540 { |
6541 if (message == WM_INITDIALOG) | |
6542 { | |
6543 CenterWindow(hwnd, GetWindow(hwnd, GW_OWNER)); | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6544 // Set focus to the dialog. Set the default button, if specified. |
7 | 6545 (void)SetFocus(hwnd); |
6546 if (dialog_default_button > IDCANCEL) | |
6547 (void)SetFocus(GetDlgItem(hwnd, dialog_default_button)); | |
1356 | 6548 else |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6549 // We don't have a default, set focus on another element of the |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6550 // dialog window, probably the icon |
1356 | 6551 (void)SetFocus(GetDlgItem(hwnd, DLG_NONBUTTON_CONTROL)); |
7 | 6552 return FALSE; |
6553 } | |
6554 | |
6555 if (message == WM_COMMAND) | |
6556 { | |
6557 int button = LOWORD(wParam); | |
6558 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6559 // Don't end the dialog if something was selected that was |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6560 // not a button. |
7 | 6561 if (button >= DLG_NONBUTTON_CONTROL) |
6562 return TRUE; | |
6563 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6564 // If the edit box exists, copy the string. |
7 | 6565 if (s_textfield != NULL) |
1795 | 6566 { |
16825
ce04ebdf26b8
patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
Bram Moolenaar <Bram@vim.org>
parents:
16768
diff
changeset
|
6567 WCHAR *wp = ALLOC_MULT(WCHAR, IOSIZE); |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
6568 char_u *p; |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
6569 |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
6570 GetDlgItemTextW(hwnd, DLG_NONBUTTON_CONTROL + 2, wp, IOSIZE); |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
6571 p = utf16_to_enc(wp, NULL); |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
6572 vim_strncpy(s_textfield, p, IOSIZE); |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
6573 vim_free(p); |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
6574 vim_free(wp); |
1795 | 6575 } |
7 | 6576 |
6577 /* | |
6578 * Need to check for IDOK because if the user just hits Return to | |
6579 * accept the default value, some reason this is what we get. | |
6580 */ | |
6581 if (button == IDOK) | |
6582 { | |
6583 if (dialog_default_button > IDCANCEL) | |
6584 EndDialog(hwnd, dialog_default_button); | |
6585 } | |
6586 else | |
6587 EndDialog(hwnd, button - IDCANCEL); | |
6588 return TRUE; | |
6589 } | |
6590 | |
6591 if ((message == WM_SYSCOMMAND) && (wParam == SC_CLOSE)) | |
6592 { | |
6593 EndDialog(hwnd, 0); | |
6594 return TRUE; | |
6595 } | |
6596 return FALSE; | |
6597 } | |
6598 | |
6599 /* | |
6600 * Create a dialog dynamically from the parameter strings. | |
6601 * type = type of dialog (question, alert, etc.) | |
6602 * title = dialog title. may be NULL for default title. | |
6603 * message = text to display. Dialog sizes to accommodate it. | |
6604 * buttons = '\n' separated list of button captions, default first. | |
6605 * dfltbutton = number of default button. | |
6606 * | |
6607 * This routine returns 1 if the first button is pressed, | |
6608 * 2 for the second, etc. | |
6609 * | |
6610 * 0 indicates Esc was pressed. | |
6611 * -1 for unexpected error | |
6612 * | |
6613 * If stubbing out this fn, return 1. | |
6614 */ | |
6615 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6616 static const char *dlg_icons[] = // must match names in resource file |
7 | 6617 { |
6618 "IDR_VIM", | |
6619 "IDR_VIM_ERROR", | |
6620 "IDR_VIM_ALERT", | |
6621 "IDR_VIM_INFO", | |
6622 "IDR_VIM_QUESTION" | |
6623 }; | |
6624 | |
6625 int | |
6626 gui_mch_dialog( | |
6627 int type, | |
6628 char_u *title, | |
6629 char_u *message, | |
6630 char_u *buttons, | |
6631 int dfltbutton, | |
2684 | 6632 char_u *textfield, |
18139
59bc3cd42cf5
patch 8.1.2064: MS-Windows: compiler warnings for unused arguments
Bram Moolenaar <Bram@vim.org>
parents:
17958
diff
changeset
|
6633 int ex_cmd UNUSED) |
7 | 6634 { |
6635 WORD *p, *pdlgtemplate, *pnumitems; | |
615 | 6636 DWORD *dwp; |
7 | 6637 int numButtons; |
6638 int *buttonWidths, *buttonPositions; | |
6639 int buttonYpos; | |
6640 int nchar, i; | |
6641 DWORD lStyle; | |
6642 int dlgwidth = 0; | |
6643 int dlgheight; | |
6644 int editboxheight; | |
6645 int horizWidth = 0; | |
6646 int msgheight; | |
6647 char_u *pstart; | |
6648 char_u *pend; | |
158 | 6649 char_u *last_white; |
7 | 6650 char_u *tbuffer; |
6651 RECT rect; | |
6652 HWND hwnd; | |
6653 HDC hdc; | |
6654 HFONT font, oldFont; | |
6655 TEXTMETRIC fontInfo; | |
6656 int fontHeight; | |
6657 int textWidth, minButtonWidth, messageWidth; | |
6658 int maxDialogWidth; | |
153 | 6659 int maxDialogHeight; |
6660 int scroll_flag = 0; | |
7 | 6661 int vertical; |
6662 int dlgPaddingX; | |
6663 int dlgPaddingY; | |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6664 # ifdef USE_SYSMENU_FONT |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
6665 LOGFONTW lfSysmenu; |
7 | 6666 int use_lfSysmenu = FALSE; |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6667 # endif |
158 | 6668 garray_T ga; |
6669 int l; | |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
6670 int dlg_icon_width; |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
6671 int dlg_icon_height; |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
6672 int dpi; |
7 | 6673 |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6674 # ifndef NO_CONSOLE |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6675 // Don't output anything in silent mode ("ex -s") |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6676 # ifdef VIMDLL |
16451
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
6677 if (!(gui.in_use || gui.starting)) |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6678 # endif |
16451
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
6679 if (silent_mode) |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6680 return dfltbutton; // return default option |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6681 # endif |
7 | 6682 |
153 | 6683 if (s_hwnd == NULL) |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
6684 { |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
6685 load_dpi_func(); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
6686 s_dpi = dpi = pGetDpiForSystem(); |
153 | 6687 get_dialog_font_metrics(); |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
6688 } |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
6689 else |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
6690 dpi = pGetDpiForSystem(); |
7 | 6691 |
6692 if ((type < 0) || (type > VIM_LAST_TYPE)) | |
6693 type = 0; | |
6694 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6695 // allocate some memory for dialog template |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6696 // TODO should compute this really |
158 | 6697 pdlgtemplate = p = (PWORD)LocalAlloc(LPTR, |
840 | 6698 DLG_ALLOC_SIZE + STRLEN(message) * 2); |
7 | 6699 |
6700 if (p == NULL) | |
6701 return -1; | |
6702 | |
6703 /* | |
4352 | 6704 * make a copy of 'buttons' to fiddle with it. compiler grizzles because |
7 | 6705 * vim_strsave() doesn't take a const arg (why not?), so cast away the |
6706 * const. | |
6707 */ | |
6708 tbuffer = vim_strsave(buttons); | |
6709 if (tbuffer == NULL) | |
6710 return -1; | |
6711 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6712 --dfltbutton; // Change from one-based to zero-based |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6713 |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6714 // Count buttons |
7 | 6715 numButtons = 1; |
6716 for (i = 0; tbuffer[i] != '\0'; i++) | |
6717 { | |
6718 if (tbuffer[i] == DLG_BUTTON_SEP) | |
6719 numButtons++; | |
6720 } | |
6721 if (dfltbutton >= numButtons) | |
6722 dfltbutton = -1; | |
6723 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6724 // Allocate array to hold the width of each button |
16825
ce04ebdf26b8
patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
Bram Moolenaar <Bram@vim.org>
parents:
16768
diff
changeset
|
6725 buttonWidths = ALLOC_MULT(int, numButtons); |
7 | 6726 if (buttonWidths == NULL) |
6727 return -1; | |
6728 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6729 // Allocate array to hold the X position of each button |
16825
ce04ebdf26b8
patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
Bram Moolenaar <Bram@vim.org>
parents:
16768
diff
changeset
|
6730 buttonPositions = ALLOC_MULT(int, numButtons); |
7 | 6731 if (buttonPositions == NULL) |
6732 return -1; | |
6733 | |
6734 /* | |
6735 * Calculate how big the dialog must be. | |
6736 */ | |
6737 hwnd = GetDesktopWindow(); | |
6738 hdc = GetWindowDC(hwnd); | |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6739 # ifdef USE_SYSMENU_FONT |
7 | 6740 if (gui_w32_get_menu_font(&lfSysmenu) == OK) |
6741 { | |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
6742 font = CreateFontIndirectW(&lfSysmenu); |
7 | 6743 use_lfSysmenu = TRUE; |
6744 } | |
6745 else | |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6746 # endif |
27322
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
6747 font = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0, |
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
6748 0, 0, 0, 0, VARIABLE_PITCH, DLG_FONT_NAME); |
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
6749 |
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
6750 oldFont = SelectFont(hdc, font); |
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
6751 dlgPaddingX = DLG_PADDING_X; |
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
6752 dlgPaddingY = DLG_PADDING_Y; |
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
6753 |
7 | 6754 GetTextMetrics(hdc, &fontInfo); |
6755 fontHeight = fontInfo.tmHeight; | |
6756 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6757 // Minimum width for horizontal button |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
6758 minButtonWidth = GetTextWidth(hdc, (char_u *)"Cancel", 6); |
7 | 6759 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6760 // Maximum width of a dialog, if possible |
158 | 6761 if (s_hwnd == NULL) |
6762 { | |
6763 RECT workarea_rect; | |
6764 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6765 // We don't have a window, use the desktop area. |
158 | 6766 get_work_area(&workarea_rect); |
6767 maxDialogWidth = workarea_rect.right - workarea_rect.left - 100; | |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
6768 if (maxDialogWidth > adjust_by_system_dpi(600)) |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
6769 maxDialogWidth = adjust_by_system_dpi(600); |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6770 // Leave some room for the taskbar. |
5249
47a09a572ea6
updated for version 7.4b.001
Bram Moolenaar <bram@vim.org>
parents:
5225
diff
changeset
|
6771 maxDialogHeight = workarea_rect.bottom - workarea_rect.top - 150; |
158 | 6772 } |
6773 else | |
6774 { | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6775 // Use our own window for the size, unless it's very small. |
5284
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
6776 GetWindowRect(s_hwnd, &rect); |
158 | 6777 maxDialogWidth = rect.right - rect.left |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
6778 - (pGetSystemMetricsForDpi(SM_CXFRAME, dpi) + |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
6779 pGetSystemMetricsForDpi(SM_CXPADDEDBORDER, dpi)) * 2; |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
6780 if (maxDialogWidth < adjust_by_system_dpi(DLG_MIN_MAX_WIDTH)) |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
6781 maxDialogWidth = adjust_by_system_dpi(DLG_MIN_MAX_WIDTH); |
158 | 6782 |
6783 maxDialogHeight = rect.bottom - rect.top | |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
6784 - (pGetSystemMetricsForDpi(SM_CYFRAME, dpi) + |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
6785 pGetSystemMetricsForDpi(SM_CXPADDEDBORDER, dpi)) * 4 |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
6786 - pGetSystemMetricsForDpi(SM_CYCAPTION, dpi); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
6787 if (maxDialogHeight < adjust_by_system_dpi(DLG_MIN_MAX_HEIGHT)) |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
6788 maxDialogHeight = adjust_by_system_dpi(DLG_MIN_MAX_HEIGHT); |
158 | 6789 } |
6790 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6791 // Set dlgwidth to width of message. |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6792 // Copy the message into "ga", changing NL to CR-NL and inserting line |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6793 // breaks where needed. |
7 | 6794 pstart = message; |
6795 messageWidth = 0; | |
158 | 6796 msgheight = 0; |
6797 ga_init2(&ga, sizeof(char), 500); | |
7 | 6798 do |
6799 { | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6800 msgheight += fontHeight; // at least one line |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6801 |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6802 // Need to figure out where to break the string. The system does it |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6803 // at a word boundary, which would mean we can't compute the number of |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6804 // wrapped lines. |
158 | 6805 textWidth = 0; |
6806 last_white = NULL; | |
6807 for (pend = pstart; *pend != NUL && *pend != '\n'; ) | |
153 | 6808 { |
474 | 6809 l = (*mb_ptr2len)(pend); |
11129
f4ea50924c6d
patch 8.0.0452: some macros are in lower case
Christian Brabandt <cb@256bit.org>
parents:
10783
diff
changeset
|
6810 if (l == 1 && VIM_ISWHITE(*pend) |
158 | 6811 && textWidth > maxDialogWidth * 3 / 4) |
6812 last_white = pend; | |
4999
b4a71dbdb787
updated for version 7.3.1244
Bram Moolenaar <bram@vim.org>
parents:
4352
diff
changeset
|
6813 textWidth += GetTextWidthEnc(hdc, pend, l); |
158 | 6814 if (textWidth >= maxDialogWidth) |
153 | 6815 { |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6816 // Line will wrap. |
158 | 6817 messageWidth = maxDialogWidth; |
153 | 6818 msgheight += fontHeight; |
158 | 6819 textWidth = 0; |
6820 | |
6821 if (last_white != NULL) | |
6822 { | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6823 // break the line just after a space |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
6824 if (pend > last_white) |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
6825 ga.ga_len -= (int)(pend - (last_white + 1)); |
158 | 6826 pend = last_white + 1; |
6827 last_white = NULL; | |
6828 } | |
6829 ga_append(&ga, '\r'); | |
6830 ga_append(&ga, '\n'); | |
6831 continue; | |
153 | 6832 } |
158 | 6833 |
6834 while (--l >= 0) | |
6835 ga_append(&ga, *pend++); | |
153 | 6836 } |
158 | 6837 if (textWidth > messageWidth) |
7 | 6838 messageWidth = textWidth; |
158 | 6839 |
6840 ga_append(&ga, '\r'); | |
6841 ga_append(&ga, '\n'); | |
7 | 6842 pstart = pend + 1; |
6843 } while (*pend != NUL); | |
153 | 6844 |
158 | 6845 if (ga.ga_data != NULL) |
6846 message = ga.ga_data; | |
6847 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6848 messageWidth += 10; // roundoff space |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6849 |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
6850 dlg_icon_width = adjust_by_system_dpi(DLG_ICON_WIDTH); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
6851 dlg_icon_height = adjust_by_system_dpi(DLG_ICON_HEIGHT); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
6852 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6853 // Add width of icon to dlgwidth, and some space |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
6854 dlgwidth = messageWidth + dlg_icon_width + 3 * dlgPaddingX |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
6855 + pGetSystemMetricsForDpi(SM_CXVSCROLL, dpi); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
6856 |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
6857 if (msgheight < dlg_icon_height) |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
6858 msgheight = dlg_icon_height; |
7 | 6859 |
6860 /* | |
6861 * Check button names. A long one will make the dialog wider. | |
1116 | 6862 * When called early (-register error message) p_go isn't initialized. |
7 | 6863 */ |
1116 | 6864 vertical = (p_go != NULL && vim_strchr(p_go, GO_VERTICAL) != NULL); |
7 | 6865 if (!vertical) |
6866 { | |
6867 // Place buttons horizontally if they fit. | |
6868 horizWidth = dlgPaddingX; | |
6869 pstart = tbuffer; | |
6870 i = 0; | |
6871 do | |
6872 { | |
6873 pend = vim_strchr(pstart, DLG_BUTTON_SEP); | |
6874 if (pend == NULL) | |
6875 pend = pstart + STRLEN(pstart); // Last button name. | |
5001
43329b2b5b79
updated for version 7.3.1245
Bram Moolenaar <bram@vim.org>
parents:
4999
diff
changeset
|
6876 textWidth = GetTextWidthEnc(hdc, pstart, (int)(pend - pstart)); |
7 | 6877 if (textWidth < minButtonWidth) |
6878 textWidth = minButtonWidth; | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6879 textWidth += dlgPaddingX; // Padding within button |
7 | 6880 buttonWidths[i] = textWidth; |
6881 buttonPositions[i++] = horizWidth; | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6882 horizWidth += textWidth + dlgPaddingX; // Pad between buttons |
7 | 6883 pstart = pend + 1; |
6884 } while (*pend != NUL); | |
6885 | |
6886 if (horizWidth > maxDialogWidth) | |
6887 vertical = TRUE; // Too wide to fit on the screen. | |
6888 else if (horizWidth > dlgwidth) | |
6889 dlgwidth = horizWidth; | |
6890 } | |
6891 | |
6892 if (vertical) | |
6893 { | |
6894 // Stack buttons vertically. | |
6895 pstart = tbuffer; | |
6896 do | |
6897 { | |
6898 pend = vim_strchr(pstart, DLG_BUTTON_SEP); | |
6899 if (pend == NULL) | |
6900 pend = pstart + STRLEN(pstart); // Last button name. | |
5001
43329b2b5b79
updated for version 7.3.1245
Bram Moolenaar <bram@vim.org>
parents:
4999
diff
changeset
|
6901 textWidth = GetTextWidthEnc(hdc, pstart, (int)(pend - pstart)); |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6902 textWidth += dlgPaddingX; // Padding within button |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6903 textWidth += DLG_VERT_PADDING_X * 2; // Padding around button |
7 | 6904 if (textWidth > dlgwidth) |
6905 dlgwidth = textWidth; | |
6906 pstart = pend + 1; | |
6907 } while (*pend != NUL); | |
6908 } | |
6909 | |
6910 if (dlgwidth < DLG_MIN_WIDTH) | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6911 dlgwidth = DLG_MIN_WIDTH; // Don't allow a really thin dialog! |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6912 |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6913 // start to fill in the dlgtemplate information. addressing by WORDs |
27322
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
6914 lStyle = DS_MODALFRAME | WS_CAPTION | DS_3DLOOK | WS_VISIBLE | DS_SETFONT; |
7 | 6915 |
6916 add_long(lStyle); | |
6917 add_long(0); // (lExtendedStyle) | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6918 pnumitems = p; //save where the number of items must be stored |
7 | 6919 add_word(0); // NumberOfItems(will change later) |
6920 add_word(10); // x | |
6921 add_word(10); // y | |
6922 add_word(PixelToDialogX(dlgwidth)); // cx | |
6923 | |
6924 // Dialog height. | |
6925 if (vertical) | |
5284
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
6926 dlgheight = msgheight + 2 * dlgPaddingY |
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
6927 + DLG_VERT_PADDING_Y + 2 * fontHeight * numButtons; |
7 | 6928 else |
6929 dlgheight = msgheight + 3 * dlgPaddingY + 2 * fontHeight; | |
6930 | |
6931 // Dialog needs to be taller if contains an edit box. | |
6932 editboxheight = fontHeight + dlgPaddingY + 4 * DLG_VERT_PADDING_Y; | |
6933 if (textfield != NULL) | |
6934 dlgheight += editboxheight; | |
6935 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6936 // Restrict the size to a maximum. Causes a scrollbar to show up. |
5284
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
6937 if (dlgheight > maxDialogHeight) |
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
6938 { |
6110 | 6939 msgheight = msgheight - (dlgheight - maxDialogHeight); |
6940 dlgheight = maxDialogHeight; | |
6941 scroll_flag = WS_VSCROLL; | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6942 // Make sure scrollbar doesn't appear in the middle of the dialog |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
6943 messageWidth = dlgwidth - dlg_icon_width - 3 * dlgPaddingX; |
5284
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
6944 } |
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
6945 |
7 | 6946 add_word(PixelToDialogY(dlgheight)); |
6947 | |
6948 add_word(0); // Menu | |
6949 add_word(0); // Class | |
6950 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6951 // copy the title of the dialog |
12543
e9028055f6d6
patch 8.0.1150: MS-Windows GUI: dialog font size is incorrect
Christian Brabandt <cb@256bit.org>
parents:
12513
diff
changeset
|
6952 nchar = nCopyAnsiToWideChar(p, (title ? (LPSTR)title |
e9028055f6d6
patch 8.0.1150: MS-Windows GUI: dialog font size is incorrect
Christian Brabandt <cb@256bit.org>
parents:
12513
diff
changeset
|
6953 : (LPSTR)("Vim "VIM_VERSION_MEDIUM)), TRUE); |
7 | 6954 p += nchar; |
6955 | |
27322
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
6956 // do the font, since DS_3DLOOK doesn't work properly |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6957 # ifdef USE_SYSMENU_FONT |
27322
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
6958 if (use_lfSysmenu) |
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
6959 { |
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
6960 // point size |
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
6961 *p++ = -MulDiv(lfSysmenu.lfHeight, 72, |
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
6962 GetDeviceCaps(hdc, LOGPIXELSY)); |
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
6963 wcscpy(p, lfSysmenu.lfFaceName); |
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
6964 nchar = (int)wcslen(lfSysmenu.lfFaceName) + 1; |
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
6965 } |
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
6966 else |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6967 # endif |
27322
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
6968 { |
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
6969 *p++ = DLG_FONT_POINT_SIZE; // point size |
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
6970 nchar = nCopyAnsiToWideChar(p, DLG_FONT_NAME, FALSE); |
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
6971 } |
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
6972 p += nchar; |
7 | 6973 |
6974 buttonYpos = msgheight + 2 * dlgPaddingY; | |
6975 | |
6976 if (textfield != NULL) | |
6977 buttonYpos += editboxheight; | |
6978 | |
6979 pstart = tbuffer; | |
6980 if (!vertical) | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6981 horizWidth = (dlgwidth - horizWidth) / 2; // Now it's X offset |
7 | 6982 for (i = 0; i < numButtons; i++) |
6983 { | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
6984 // get end of this button. |
7 | 6985 for ( pend = pstart; |
6986 *pend && (*pend != DLG_BUTTON_SEP); | |
6987 pend++) | |
6988 ; | |
6989 | |
6990 if (*pend) | |
6991 *pend = '\0'; | |
6992 | |
6993 /* | |
6994 * old NOTE: | |
6995 * setting the BS_DEFPUSHBUTTON style doesn't work because Windows sets | |
6996 * the focus to the first tab-able button and in so doing makes that | |
6997 * the default!! Grrr. Workaround: Make the default button the only | |
6998 * one with WS_TABSTOP style. Means user can't tab between buttons, but | |
6999 * he/she can use arrow keys. | |
7000 * | |
7001 * new NOTE: BS_DEFPUSHBUTTON is required to be able to select the | |
1213 | 7002 * right button when hitting <Enter>. E.g., for the ":confirm quit" |
7 | 7003 * dialog. Also needed for when the textfield is the default control. |
7004 * It appears to work now (perhaps not on Win95?). | |
7005 */ | |
7006 if (vertical) | |
7007 { | |
7008 p = add_dialog_element(p, | |
7009 (i == dfltbutton | |
7010 ? BS_DEFPUSHBUTTON : BS_PUSHBUTTON) | WS_TABSTOP, | |
7011 PixelToDialogX(DLG_VERT_PADDING_X), | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7012 PixelToDialogY(buttonYpos // TBK |
7 | 7013 + 2 * fontHeight * i), |
7014 PixelToDialogX(dlgwidth - 2 * DLG_VERT_PADDING_X), | |
7015 (WORD)(PixelToDialogY(2 * fontHeight) - 1), | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
7016 (WORD)(IDCANCEL + 1 + i), (WORD)0x0080, (char *)pstart); |
7 | 7017 } |
7018 else | |
7019 { | |
7020 p = add_dialog_element(p, | |
7021 (i == dfltbutton | |
7022 ? BS_DEFPUSHBUTTON : BS_PUSHBUTTON) | WS_TABSTOP, | |
7023 PixelToDialogX(horizWidth + buttonPositions[i]), | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7024 PixelToDialogY(buttonYpos), // TBK |
7 | 7025 PixelToDialogX(buttonWidths[i]), |
7026 (WORD)(PixelToDialogY(2 * fontHeight) - 1), | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
7027 (WORD)(IDCANCEL + 1 + i), (WORD)0x0080, (char *)pstart); |
7 | 7028 } |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7029 pstart = pend + 1; //next button |
7 | 7030 } |
7031 *pnumitems += numButtons; | |
7032 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7033 // Vim icon |
7 | 7034 p = add_dialog_element(p, SS_ICON, |
7035 PixelToDialogX(dlgPaddingX), | |
7036 PixelToDialogY(dlgPaddingY), | |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
7037 PixelToDialogX(dlg_icon_width), |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
7038 PixelToDialogY(dlg_icon_height), |
7 | 7039 DLG_NONBUTTON_CONTROL + 0, (WORD)0x0082, |
7040 dlg_icons[type]); | |
7041 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7042 // Dialog message |
153 | 7043 p = add_dialog_element(p, ES_LEFT|scroll_flag|ES_MULTILINE|ES_READONLY, |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
7044 PixelToDialogX(2 * dlgPaddingX + dlg_icon_width), |
153 | 7045 PixelToDialogY(dlgPaddingY), |
7046 (WORD)(PixelToDialogX(messageWidth) + 1), | |
7047 PixelToDialogY(msgheight), | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
7048 DLG_NONBUTTON_CONTROL + 1, (WORD)0x0081, (char *)message); |
7 | 7049 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7050 // Edit box |
7 | 7051 if (textfield != NULL) |
7052 { | |
7053 p = add_dialog_element(p, ES_LEFT|ES_AUTOHSCROLL|WS_TABSTOP|WS_BORDER, | |
7054 PixelToDialogX(2 * dlgPaddingX), | |
7055 PixelToDialogY(2 * dlgPaddingY + msgheight), | |
7056 PixelToDialogX(dlgwidth - 4 * dlgPaddingX), | |
7057 PixelToDialogY(fontHeight + dlgPaddingY), | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
7058 DLG_NONBUTTON_CONTROL + 2, (WORD)0x0081, (char *)textfield); |
7 | 7059 *pnumitems += 1; |
7060 } | |
7061 | |
7062 *pnumitems += 2; | |
7063 | |
7064 SelectFont(hdc, oldFont); | |
7065 DeleteObject(font); | |
7066 ReleaseDC(hwnd, hdc); | |
7067 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7068 // Let the dialog_callback() function know which button to make default |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7069 // If we have an edit box, make that the default. We also need to tell |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7070 // dialog_callback() if this dialog contains an edit box or not. We do |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7071 // this by setting s_textfield if it does. |
7 | 7072 if (textfield != NULL) |
7073 { | |
7074 dialog_default_button = DLG_NONBUTTON_CONTROL + 2; | |
7075 s_textfield = textfield; | |
7076 } | |
7077 else | |
7078 { | |
7079 dialog_default_button = IDCANCEL + 1 + dfltbutton; | |
7080 s_textfield = NULL; | |
7081 } | |
7082 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7083 // show the dialog box modally and get a return value |
7 | 7084 nchar = (int)DialogBoxIndirect( |
16451
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
7085 g_hinst, |
7 | 7086 (LPDLGTEMPLATE)pdlgtemplate, |
7087 s_hwnd, | |
7088 (DLGPROC)dialog_callback); | |
7089 | |
7090 LocalFree(LocalHandle(pdlgtemplate)); | |
7091 vim_free(tbuffer); | |
7092 vim_free(buttonWidths); | |
7093 vim_free(buttonPositions); | |
158 | 7094 vim_free(ga.ga_data); |
7 | 7095 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7096 // Focus back to our window (for when MDI is used). |
7 | 7097 (void)SetFocus(s_hwnd); |
7098 | |
7099 return nchar; | |
7100 } | |
7101 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7102 #endif // FEAT_GUI_DIALOG |
840 | 7103 |
7 | 7104 /* |
7105 * Put a simple element (basic class) onto a dialog template in memory. | |
7106 * return a pointer to where the next item should be added. | |
7107 * | |
7108 * parameters: | |
7109 * lStyle = additional style flags | |
7110 * (be careful, NT3.51 & Win32s will ignore the new ones) | |
7111 * x,y = x & y positions IN DIALOG UNITS | |
7112 * w,h = width and height IN DIALOG UNITS | |
7113 * Id = ID used in messages | |
7114 * clss = class ID, e.g 0x0080 for a button, 0x0082 for a static | |
7115 * caption = usually text or resource name | |
7116 * | |
7117 * TODO: use the length information noted here to enable the dialog creation | |
7118 * routines to work out more exactly how much memory they need to alloc. | |
7119 */ | |
7120 static PWORD | |
7121 add_dialog_element( | |
7122 PWORD p, | |
7123 DWORD lStyle, | |
7124 WORD x, | |
7125 WORD y, | |
7126 WORD w, | |
7127 WORD h, | |
7128 WORD Id, | |
7129 WORD clss, | |
7130 const char *caption) | |
7131 { | |
7132 int nchar; | |
7133 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7134 p = lpwAlign(p); // Align to dword boundary |
7 | 7135 lStyle = lStyle | WS_VISIBLE | WS_CHILD; |
7136 *p++ = LOWORD(lStyle); | |
7137 *p++ = HIWORD(lStyle); | |
7138 *p++ = 0; // LOWORD (lExtendedStyle) | |
7139 *p++ = 0; // HIWORD (lExtendedStyle) | |
7140 *p++ = x; | |
7141 *p++ = y; | |
7142 *p++ = w; | |
7143 *p++ = h; | |
7144 *p++ = Id; //9 or 10 words in all | |
7145 | |
7146 *p++ = (WORD)0xffff; | |
7147 *p++ = clss; //2 more here | |
7148 | |
12543
e9028055f6d6
patch 8.0.1150: MS-Windows GUI: dialog font size is incorrect
Christian Brabandt <cb@256bit.org>
parents:
12513
diff
changeset
|
7149 nchar = nCopyAnsiToWideChar(p, (LPSTR)caption, TRUE); //strlen(caption)+1 |
7 | 7150 p += nchar; |
7151 | |
7152 *p++ = 0; // advance pointer over nExtraStuff WORD - 2 more | |
7153 | |
26771
fc859aea8cec
patch 8.2.3914: various spelling mistakes in comments
Bram Moolenaar <Bram@vim.org>
parents:
24804
diff
changeset
|
7154 return p; // total = 15 + strlen(caption) words |
fc859aea8cec
patch 8.2.3914: various spelling mistakes in comments
Bram Moolenaar <Bram@vim.org>
parents:
24804
diff
changeset
|
7155 // bytes read = 2 * total |
7 | 7156 } |
7157 | |
7158 | |
7159 /* | |
7160 * Helper routine. Take an input pointer, return closest pointer that is | |
7161 * aligned on a DWORD (4 byte) boundary. Taken from the Win32SDK samples. | |
7162 */ | |
7163 static LPWORD | |
7164 lpwAlign( | |
7165 LPWORD lpIn) | |
7166 { | |
840 | 7167 long_u ul; |
7168 | |
7169 ul = (long_u)lpIn; | |
7 | 7170 ul += 3; |
7171 ul >>= 2; | |
7172 ul <<= 2; | |
7173 return (LPWORD)ul; | |
7174 } | |
7175 | |
7176 /* | |
7177 * Helper routine. Takes second parameter as Ansi string, copies it to first | |
7178 * parameter as wide character (16-bits / char) string, and returns integer | |
7179 * number of wide characters (words) in string (including the trailing wide | |
7180 * char NULL). Partly taken from the Win32SDK samples. | |
12543
e9028055f6d6
patch 8.0.1150: MS-Windows GUI: dialog font size is incorrect
Christian Brabandt <cb@256bit.org>
parents:
12513
diff
changeset
|
7181 * If "use_enc" is TRUE, 'encoding' is used for "lpAnsiIn". If FALSE, current |
e9028055f6d6
patch 8.0.1150: MS-Windows GUI: dialog font size is incorrect
Christian Brabandt <cb@256bit.org>
parents:
12513
diff
changeset
|
7182 * ACP is used for "lpAnsiIn". */ |
7 | 7183 static int |
7184 nCopyAnsiToWideChar( | |
7185 LPWORD lpWCStr, | |
12543
e9028055f6d6
patch 8.0.1150: MS-Windows GUI: dialog font size is incorrect
Christian Brabandt <cb@256bit.org>
parents:
12513
diff
changeset
|
7186 LPSTR lpAnsiIn, |
e9028055f6d6
patch 8.0.1150: MS-Windows GUI: dialog font size is incorrect
Christian Brabandt <cb@256bit.org>
parents:
12513
diff
changeset
|
7187 BOOL use_enc) |
7 | 7188 { |
7189 int nChar = 0; | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7190 int len = lstrlen(lpAnsiIn) + 1; // include NUL character |
7 | 7191 int i; |
7192 WCHAR *wn; | |
7193 | |
12543
e9028055f6d6
patch 8.0.1150: MS-Windows GUI: dialog font size is incorrect
Christian Brabandt <cb@256bit.org>
parents:
12513
diff
changeset
|
7194 if (use_enc && enc_codepage >= 0 && (int)GetACP() != enc_codepage) |
7 | 7195 { |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7196 // 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
|
7197 wn = enc_to_utf16((char_u *)lpAnsiIn, NULL); |
7 | 7198 if (wn != NULL) |
7199 { | |
7200 wcscpy(lpWCStr, wn); | |
835 | 7201 nChar = (int)wcslen(wn) + 1; |
7 | 7202 vim_free(wn); |
7203 } | |
7204 } | |
7205 if (nChar == 0) | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7206 // Use Win32 conversion function. |
7 | 7207 nChar = MultiByteToWideChar( |
7208 enc_codepage > 0 ? enc_codepage : CP_ACP, | |
7209 MB_PRECOMPOSED, | |
7210 lpAnsiIn, len, | |
7211 lpWCStr, len); | |
7212 for (i = 0; i < nChar; ++i) | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7213 if (lpWCStr[i] == (WORD)'\t') // replace tabs with spaces |
7 | 7214 lpWCStr[i] = (WORD)' '; |
7215 | |
7216 return nChar; | |
7217 } | |
7218 | |
7219 | |
7220 #ifdef FEAT_TEAROFF | |
7221 /* | |
12668
637096f179c4
patch 8.0.1212: MS-Windows: tear-off menu does not work on 64 bit
Christian Brabandt <cb@256bit.org>
parents:
12666
diff
changeset
|
7222 * Lookup menu handle from "menu_id". |
637096f179c4
patch 8.0.1212: MS-Windows: tear-off menu does not work on 64 bit
Christian Brabandt <cb@256bit.org>
parents:
12666
diff
changeset
|
7223 */ |
637096f179c4
patch 8.0.1212: MS-Windows: tear-off menu does not work on 64 bit
Christian Brabandt <cb@256bit.org>
parents:
12666
diff
changeset
|
7224 static HMENU |
637096f179c4
patch 8.0.1212: MS-Windows: tear-off menu does not work on 64 bit
Christian Brabandt <cb@256bit.org>
parents:
12666
diff
changeset
|
7225 tearoff_lookup_menuhandle( |
637096f179c4
patch 8.0.1212: MS-Windows: tear-off menu does not work on 64 bit
Christian Brabandt <cb@256bit.org>
parents:
12666
diff
changeset
|
7226 vimmenu_T *menu, |
637096f179c4
patch 8.0.1212: MS-Windows: tear-off menu does not work on 64 bit
Christian Brabandt <cb@256bit.org>
parents:
12666
diff
changeset
|
7227 WORD menu_id) |
637096f179c4
patch 8.0.1212: MS-Windows: tear-off menu does not work on 64 bit
Christian Brabandt <cb@256bit.org>
parents:
12666
diff
changeset
|
7228 { |
637096f179c4
patch 8.0.1212: MS-Windows: tear-off menu does not work on 64 bit
Christian Brabandt <cb@256bit.org>
parents:
12666
diff
changeset
|
7229 for ( ; menu != NULL; menu = menu->next) |
637096f179c4
patch 8.0.1212: MS-Windows: tear-off menu does not work on 64 bit
Christian Brabandt <cb@256bit.org>
parents:
12666
diff
changeset
|
7230 { |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7231 if (menu->modes == 0) // this menu has just been deleted |
12668
637096f179c4
patch 8.0.1212: MS-Windows: tear-off menu does not work on 64 bit
Christian Brabandt <cb@256bit.org>
parents:
12666
diff
changeset
|
7232 continue; |
637096f179c4
patch 8.0.1212: MS-Windows: tear-off menu does not work on 64 bit
Christian Brabandt <cb@256bit.org>
parents:
12666
diff
changeset
|
7233 if (menu_is_separator(menu->dname)) |
637096f179c4
patch 8.0.1212: MS-Windows: tear-off menu does not work on 64 bit
Christian Brabandt <cb@256bit.org>
parents:
12666
diff
changeset
|
7234 continue; |
637096f179c4
patch 8.0.1212: MS-Windows: tear-off menu does not work on 64 bit
Christian Brabandt <cb@256bit.org>
parents:
12666
diff
changeset
|
7235 if ((WORD)((long_u)(menu->submenu_id) | (DWORD)0x8000) == menu_id) |
637096f179c4
patch 8.0.1212: MS-Windows: tear-off menu does not work on 64 bit
Christian Brabandt <cb@256bit.org>
parents:
12666
diff
changeset
|
7236 return menu->submenu_id; |
637096f179c4
patch 8.0.1212: MS-Windows: tear-off menu does not work on 64 bit
Christian Brabandt <cb@256bit.org>
parents:
12666
diff
changeset
|
7237 } |
637096f179c4
patch 8.0.1212: MS-Windows: tear-off menu does not work on 64 bit
Christian Brabandt <cb@256bit.org>
parents:
12666
diff
changeset
|
7238 return NULL; |
637096f179c4
patch 8.0.1212: MS-Windows: tear-off menu does not work on 64 bit
Christian Brabandt <cb@256bit.org>
parents:
12666
diff
changeset
|
7239 } |
637096f179c4
patch 8.0.1212: MS-Windows: tear-off menu does not work on 64 bit
Christian Brabandt <cb@256bit.org>
parents:
12666
diff
changeset
|
7240 |
637096f179c4
patch 8.0.1212: MS-Windows: tear-off menu does not work on 64 bit
Christian Brabandt <cb@256bit.org>
parents:
12666
diff
changeset
|
7241 /* |
7 | 7242 * The callback function for all the modeless dialogs that make up the |
7243 * "tearoff menus" Very simple - forward button presses (to fool Vim into | |
7244 * thinking its menus have been clicked), and go away when closed. | |
7245 */ | |
7246 static LRESULT CALLBACK | |
7247 tearoff_callback( | |
7248 HWND hwnd, | |
7249 UINT message, | |
7250 WPARAM wParam, | |
7251 LPARAM lParam) | |
7252 { | |
7253 if (message == WM_INITDIALOG) | |
12668
637096f179c4
patch 8.0.1212: MS-Windows: tear-off menu does not work on 64 bit
Christian Brabandt <cb@256bit.org>
parents:
12666
diff
changeset
|
7254 { |
637096f179c4
patch 8.0.1212: MS-Windows: tear-off menu does not work on 64 bit
Christian Brabandt <cb@256bit.org>
parents:
12666
diff
changeset
|
7255 SetWindowLongPtr(hwnd, DWLP_USER, (LONG_PTR)lParam); |
7 | 7256 return (TRUE); |
12668
637096f179c4
patch 8.0.1212: MS-Windows: tear-off menu does not work on 64 bit
Christian Brabandt <cb@256bit.org>
parents:
12666
diff
changeset
|
7257 } |
7 | 7258 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7259 // May show the mouse pointer again. |
7 | 7260 HandleMouseHide(message, lParam); |
7261 | |
7262 if (message == WM_COMMAND) | |
7263 { | |
7264 if ((WORD)(LOWORD(wParam)) & 0x8000) | |
7265 { | |
7266 POINT mp; | |
7267 RECT rect; | |
7268 | |
7269 if (GetCursorPos(&mp) && GetWindowRect(hwnd, &rect)) | |
7270 { | |
12668
637096f179c4
patch 8.0.1212: MS-Windows: tear-off menu does not work on 64 bit
Christian Brabandt <cb@256bit.org>
parents:
12666
diff
changeset
|
7271 vimmenu_T *menu; |
637096f179c4
patch 8.0.1212: MS-Windows: tear-off menu does not work on 64 bit
Christian Brabandt <cb@256bit.org>
parents:
12666
diff
changeset
|
7272 |
637096f179c4
patch 8.0.1212: MS-Windows: tear-off menu does not work on 64 bit
Christian Brabandt <cb@256bit.org>
parents:
12666
diff
changeset
|
7273 menu = (vimmenu_T*)GetWindowLongPtr(hwnd, DWLP_USER); |
7 | 7274 (void)TrackPopupMenu( |
12668
637096f179c4
patch 8.0.1212: MS-Windows: tear-off menu does not work on 64 bit
Christian Brabandt <cb@256bit.org>
parents:
12666
diff
changeset
|
7275 tearoff_lookup_menuhandle(menu, LOWORD(wParam)), |
7 | 7276 TPM_LEFTALIGN | TPM_LEFTBUTTON, |
7277 (int)rect.right - 8, | |
7278 (int)mp.y, | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7279 (int)0, // reserved param |
7 | 7280 s_hwnd, |
7281 NULL); | |
7282 /* | |
7283 * NOTE: The pop-up menu can eat the mouse up event. | |
7284 * We deal with this in normal.c. | |
7285 */ | |
7286 } | |
7287 } | |
7288 else | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7289 // Pass on messages to the main Vim window |
7 | 7290 PostMessage(s_hwnd, WM_COMMAND, LOWORD(wParam), 0); |
7291 /* | |
7292 * Give main window the focus back: this is so after | |
7293 * choosing a tearoff button you can start typing again | |
7294 * straight away. | |
7295 */ | |
7296 (void)SetFocus(s_hwnd); | |
7297 return TRUE; | |
7298 } | |
7299 if ((message == WM_SYSCOMMAND) && (wParam == SC_CLOSE)) | |
7300 { | |
7301 DestroyWindow(hwnd); | |
7302 return TRUE; | |
7303 } | |
7304 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7305 // When moved around, give main window the focus back. |
7 | 7306 if (message == WM_EXITSIZEMOVE) |
7307 (void)SetActiveWindow(s_hwnd); | |
7308 | |
7309 return FALSE; | |
7310 } | |
7311 #endif | |
7312 | |
7313 | |
7314 /* | |
27322
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
7315 * Computes the dialog base units based on the current dialog font. |
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
7316 * We don't use the GetDialogBaseUnits() API, because we don't use the |
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
7317 * (old-style) system font. |
7 | 7318 */ |
7319 static void | |
7320 get_dialog_font_metrics(void) | |
7321 { | |
7322 HDC hdc; | |
7323 HFONT hfontTools = 0; | |
7324 SIZE size; | |
7325 #ifdef USE_SYSMENU_FONT | |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
7326 LOGFONTW lfSysmenu; |
7 | 7327 #endif |
7328 | |
7329 #ifdef USE_SYSMENU_FONT | |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7330 if (gui_w32_get_menu_font(&lfSysmenu) == OK) |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
7331 hfontTools = CreateFontIndirectW(&lfSysmenu); |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7332 else |
7 | 7333 #endif |
7334 hfontTools = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0, | |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
7335 0, 0, 0, 0, VARIABLE_PITCH, DLG_FONT_NAME); |
7 | 7336 |
27322
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
7337 hdc = GetDC(s_hwnd); |
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
7338 SelectObject(hdc, hfontTools); |
27332
251cae25bb49
patch 8.2.4194: MS-Windows: code for calculating font size is duplicated
Bram Moolenaar <Bram@vim.org>
parents:
27322
diff
changeset
|
7339 GetAverageFontSize(hdc, &size); |
27322
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
7340 ReleaseDC(s_hwnd, hdc); |
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
7341 |
27332
251cae25bb49
patch 8.2.4194: MS-Windows: code for calculating font size is duplicated
Bram Moolenaar <Bram@vim.org>
parents:
27322
diff
changeset
|
7342 s_dlgfntwidth = (WORD)size.cx; |
27322
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
7343 s_dlgfntheight = (WORD)size.cy; |
7 | 7344 } |
7345 | |
7346 #if defined(FEAT_MENU) && defined(FEAT_TEAROFF) | |
7347 /* | |
7348 * Create a pseudo-"tearoff menu" based on the child | |
7349 * items of a given menu pointer. | |
7350 */ | |
7351 static void | |
7352 gui_mch_tearoff( | |
7353 char_u *title, | |
7354 vimmenu_T *menu, | |
7355 int initX, | |
7356 int initY) | |
7357 { | |
7358 WORD *p, *pdlgtemplate, *pnumitems, *ptrueheight; | |
7359 int template_len; | |
7360 int nchar, textWidth, submenuWidth; | |
7361 DWORD lStyle; | |
7362 DWORD lExtendedStyle; | |
7363 WORD dlgwidth; | |
7364 WORD menuID; | |
7365 vimmenu_T *pmenu; | |
12668
637096f179c4
patch 8.0.1212: MS-Windows: tear-off menu does not work on 64 bit
Christian Brabandt <cb@256bit.org>
parents:
12666
diff
changeset
|
7366 vimmenu_T *top_menu; |
7 | 7367 vimmenu_T *the_menu = menu; |
7368 HWND hwnd; | |
7369 HDC hdc; | |
7370 HFONT font, oldFont; | |
7371 int col, spaceWidth, len; | |
7372 int columnWidths[2]; | |
7373 char_u *label, *text; | |
7374 int acLen = 0; | |
7375 int nameLen; | |
7376 int padding0, padding1, padding2 = 0; | |
7377 int sepPadding=0; | |
87 | 7378 int x; |
7379 int y; | |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
7380 # ifdef USE_SYSMENU_FONT |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
7381 LOGFONTW lfSysmenu; |
7 | 7382 int use_lfSysmenu = FALSE; |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
7383 # endif |
7 | 7384 |
7385 /* | |
7386 * If this menu is already torn off, move it to the mouse position. | |
7387 */ | |
7388 if (IsWindow(menu->tearoff_handle)) | |
7389 { | |
7390 POINT mp; | |
27281
f7d73708b391
patch 8.2.4169: MS-Windows: unnessary casts and other minor things
Bram Moolenaar <Bram@vim.org>
parents:
27261
diff
changeset
|
7391 if (GetCursorPos(&mp)) |
7 | 7392 { |
7393 SetWindowPos(menu->tearoff_handle, NULL, mp.x, mp.y, 0, 0, | |
7394 SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER); | |
7395 } | |
7396 return; | |
7397 } | |
7398 | |
7399 /* | |
7400 * Create a new tearoff. | |
7401 */ | |
7402 if (*title == MNU_HIDDEN_CHAR) | |
7403 title++; | |
7404 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7405 // Allocate memory to store the dialog template. It's made bigger when |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7406 // needed. |
7 | 7407 template_len = DLG_ALLOC_SIZE; |
7408 pdlgtemplate = p = (WORD *)LocalAlloc(LPTR, template_len); | |
7409 if (p == NULL) | |
7410 return; | |
7411 | |
7412 hwnd = GetDesktopWindow(); | |
7413 hdc = GetWindowDC(hwnd); | |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
7414 # ifdef USE_SYSMENU_FONT |
7 | 7415 if (gui_w32_get_menu_font(&lfSysmenu) == OK) |
7416 { | |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
7417 font = CreateFontIndirectW(&lfSysmenu); |
7 | 7418 use_lfSysmenu = TRUE; |
7419 } | |
7420 else | |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
7421 # endif |
27322
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
7422 font = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0, |
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
7423 0, 0, 0, 0, VARIABLE_PITCH, DLG_FONT_NAME); |
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
7424 |
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
7425 oldFont = SelectFont(hdc, font); |
7 | 7426 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7427 // Calculate width of a single space. Used for padding columns to the |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7428 // right width. |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
7429 spaceWidth = GetTextWidth(hdc, (char_u *)" ", 1); |
7 | 7430 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7431 // Figure out max width of the text column, the accelerator column and the |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7432 // optional submenu column. |
7 | 7433 submenuWidth = 0; |
7434 for (col = 0; col < 2; col++) | |
7435 { | |
7436 columnWidths[col] = 0; | |
19934
3ff714d765ba
patch 8.2.0523: loops are repeated
Bram Moolenaar <Bram@vim.org>
parents:
18788
diff
changeset
|
7437 FOR_ALL_CHILD_MENUS(menu, pmenu) |
7 | 7438 { |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7439 // Use "dname" here to compute the width of the visible text. |
7 | 7440 text = (col == 0) ? pmenu->dname : pmenu->actext; |
7441 if (text != NULL && *text != NUL) | |
7442 { | |
7443 textWidth = GetTextWidthEnc(hdc, text, (int)STRLEN(text)); | |
7444 if (textWidth > columnWidths[col]) | |
7445 columnWidths[col] = textWidth; | |
7446 } | |
7447 if (pmenu->children != NULL) | |
7448 submenuWidth = TEAROFF_COLUMN_PADDING * spaceWidth; | |
7449 } | |
7450 } | |
7451 if (columnWidths[1] == 0) | |
7452 { | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7453 // no accelerators |
7 | 7454 if (submenuWidth != 0) |
7455 columnWidths[0] += submenuWidth; | |
7456 else | |
7457 columnWidths[0] += spaceWidth; | |
7458 } | |
7459 else | |
7460 { | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7461 // there is an accelerator column |
7 | 7462 columnWidths[0] += TEAROFF_COLUMN_PADDING * spaceWidth; |
7463 columnWidths[1] += submenuWidth; | |
7464 } | |
7465 | |
7466 /* | |
7467 * Now find the total width of our 'menu'. | |
7468 */ | |
7469 textWidth = columnWidths[0] + columnWidths[1]; | |
7470 if (submenuWidth != 0) | |
7471 { | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
7472 submenuWidth = GetTextWidth(hdc, (char_u *)TEAROFF_SUBMENU_LABEL, |
7 | 7473 (int)STRLEN(TEAROFF_SUBMENU_LABEL)); |
7474 textWidth += submenuWidth; | |
7475 } | |
7476 dlgwidth = GetTextWidthEnc(hdc, title, (int)STRLEN(title)); | |
7477 if (textWidth > dlgwidth) | |
7478 dlgwidth = textWidth; | |
7479 dlgwidth += 2 * TEAROFF_PADDING_X + TEAROFF_BUTTON_PAD_X; | |
7480 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7481 // start to fill in the dlgtemplate information. addressing by WORDs |
27322
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
7482 lStyle = DS_MODALFRAME | WS_CAPTION | WS_SYSMENU | DS_SETFONT | WS_VISIBLE; |
7 | 7483 |
7484 lExtendedStyle = WS_EX_TOOLWINDOW|WS_EX_STATICEDGE; | |
7485 *p++ = LOWORD(lStyle); | |
7486 *p++ = HIWORD(lStyle); | |
7487 *p++ = LOWORD(lExtendedStyle); | |
7488 *p++ = HIWORD(lExtendedStyle); | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7489 pnumitems = p; // save where the number of items must be stored |
7 | 7490 *p++ = 0; // NumberOfItems(will change later) |
87 | 7491 gui_mch_getmouse(&x, &y); |
7 | 7492 if (initX == 0xffffL) |
87 | 7493 *p++ = PixelToDialogX(x); // x |
7 | 7494 else |
7495 *p++ = PixelToDialogX(initX); // x | |
7496 if (initY == 0xffffL) | |
87 | 7497 *p++ = PixelToDialogY(y); // y |
7 | 7498 else |
7499 *p++ = PixelToDialogY(initY); // y | |
7500 *p++ = PixelToDialogX(dlgwidth); // cx | |
7501 ptrueheight = p; | |
7502 *p++ = 0; // dialog height: changed later anyway | |
7503 *p++ = 0; // Menu | |
7504 *p++ = 0; // Class | |
7505 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7506 // copy the title of the dialog |
7 | 7507 nchar = nCopyAnsiToWideChar(p, ((*title) |
12543
e9028055f6d6
patch 8.0.1150: MS-Windows GUI: dialog font size is incorrect
Christian Brabandt <cb@256bit.org>
parents:
12513
diff
changeset
|
7508 ? (LPSTR)title |
e9028055f6d6
patch 8.0.1150: MS-Windows GUI: dialog font size is incorrect
Christian Brabandt <cb@256bit.org>
parents:
12513
diff
changeset
|
7509 : (LPSTR)("Vim "VIM_VERSION_MEDIUM)), TRUE); |
7 | 7510 p += nchar; |
7511 | |
27322
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
7512 // do the font, since DS_3DLOOK doesn't work properly |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
7513 # ifdef USE_SYSMENU_FONT |
27322
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
7514 if (use_lfSysmenu) |
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
7515 { |
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
7516 // point size |
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
7517 *p++ = -MulDiv(lfSysmenu.lfHeight, 72, |
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
7518 GetDeviceCaps(hdc, LOGPIXELSY)); |
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
7519 wcscpy(p, lfSysmenu.lfFaceName); |
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
7520 nchar = (int)wcslen(lfSysmenu.lfFaceName) + 1; |
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
7521 } |
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
7522 else |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
7523 # endif |
27322
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
7524 { |
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
7525 *p++ = DLG_FONT_POINT_SIZE; // point size |
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
7526 nchar = nCopyAnsiToWideChar(p, DLG_FONT_NAME, FALSE); |
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
7527 } |
574cd25f0962
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27293
diff
changeset
|
7528 p += nchar; |
7 | 7529 |
7530 /* | |
7531 * Loop over all the items in the menu. | |
7532 * But skip over the tearbar. | |
7533 */ | |
7534 if (STRCMP(menu->children->name, TEAR_STRING) == 0) | |
7535 menu = menu->children->next; | |
7536 else | |
7537 menu = menu->children; | |
12668
637096f179c4
patch 8.0.1212: MS-Windows: tear-off menu does not work on 64 bit
Christian Brabandt <cb@256bit.org>
parents:
12666
diff
changeset
|
7538 top_menu = menu; |
7 | 7539 for ( ; menu != NULL; menu = menu->next) |
7540 { | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7541 if (menu->modes == 0) // this menu has just been deleted |
7 | 7542 continue; |
7543 if (menu_is_separator(menu->dname)) | |
7544 { | |
7545 sepPadding += 3; | |
7546 continue; | |
7547 } | |
7548 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7549 // Check if there still is plenty of room in the template. Make it |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7550 // larger when needed. |
7 | 7551 if (((char *)p - (char *)pdlgtemplate) + 1000 > template_len) |
7552 { | |
7553 WORD *newp; | |
7554 | |
7555 newp = (WORD *)LocalAlloc(LPTR, template_len + 4096); | |
7556 if (newp != NULL) | |
7557 { | |
7558 template_len += 4096; | |
7559 mch_memmove(newp, pdlgtemplate, | |
7560 (char *)p - (char *)pdlgtemplate); | |
7561 p = newp + (p - pdlgtemplate); | |
7562 pnumitems = newp + (pnumitems - pdlgtemplate); | |
7563 ptrueheight = newp + (ptrueheight - pdlgtemplate); | |
7564 LocalFree(LocalHandle(pdlgtemplate)); | |
7565 pdlgtemplate = newp; | |
7566 } | |
7567 } | |
7568 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7569 // Figure out minimal length of this menu label. Use "name" for the |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7570 // actual text, "dname" for estimating the displayed size. "name" |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7571 // has "&a" for mnemonic and includes the accelerator. |
7 | 7572 len = nameLen = (int)STRLEN(menu->name); |
7573 padding0 = (columnWidths[0] - GetTextWidthEnc(hdc, menu->dname, | |
7574 (int)STRLEN(menu->dname))) / spaceWidth; | |
7575 len += padding0; | |
7576 | |
7577 if (menu->actext != NULL) | |
7578 { | |
7579 acLen = (int)STRLEN(menu->actext); | |
7580 len += acLen; | |
7581 textWidth = GetTextWidthEnc(hdc, menu->actext, acLen); | |
7582 } | |
7583 else | |
7584 textWidth = 0; | |
7585 padding1 = (columnWidths[1] - textWidth) / spaceWidth; | |
7586 len += padding1; | |
7587 | |
7588 if (menu->children == NULL) | |
7589 { | |
7590 padding2 = submenuWidth / spaceWidth; | |
7591 len += padding2; | |
7592 menuID = (WORD)(menu->id); | |
7593 } | |
7594 else | |
7595 { | |
7596 len += (int)STRLEN(TEAROFF_SUBMENU_LABEL); | |
840 | 7597 menuID = (WORD)((long_u)(menu->submenu_id) | (DWORD)0x8000); |
7 | 7598 } |
7599 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7600 // Allocate menu label and fill it in |
16764
ef00b6bc186b
patch 8.1.1384: using "int" for alloc() often results in compiler warnings
Bram Moolenaar <Bram@vim.org>
parents:
16606
diff
changeset
|
7601 text = label = alloc(len + 1); |
7 | 7602 if (label == NULL) |
7603 break; | |
7604 | |
419 | 7605 vim_strncpy(text, menu->name, nameLen); |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7606 text = vim_strchr(text, TAB); // stop at TAB before actext |
7 | 7607 if (text == NULL) |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7608 text = label + nameLen; // no actext, use whole name |
7 | 7609 while (padding0-- > 0) |
7610 *text++ = ' '; | |
7611 if (menu->actext != NULL) | |
7612 { | |
7613 STRNCPY(text, menu->actext, acLen); | |
7614 text += acLen; | |
7615 } | |
7616 while (padding1-- > 0) | |
7617 *text++ = ' '; | |
7618 if (menu->children != NULL) | |
7619 { | |
7620 STRCPY(text, TEAROFF_SUBMENU_LABEL); | |
7621 text += STRLEN(TEAROFF_SUBMENU_LABEL); | |
7622 } | |
7623 else | |
7624 { | |
7625 while (padding2-- > 0) | |
7626 *text++ = ' '; | |
7627 } | |
7628 *text = NUL; | |
7629 | |
7630 /* | |
7631 * BS_LEFT will just be ignored on Win32s/NT3.5x - on | |
7632 * W95/NT4 it makes the tear-off look more like a menu. | |
7633 */ | |
7634 p = add_dialog_element(p, | |
7635 BS_PUSHBUTTON|BS_LEFT, | |
7636 (WORD)PixelToDialogX(TEAROFF_PADDING_X), | |
7637 (WORD)(sepPadding + 1 + 13 * (*pnumitems)), | |
7638 (WORD)PixelToDialogX(dlgwidth - 2 * TEAROFF_PADDING_X), | |
7639 (WORD)12, | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
7640 menuID, (WORD)0x0080, (char *)label); |
7 | 7641 vim_free(label); |
7642 (*pnumitems)++; | |
7643 } | |
7644 | |
7645 *ptrueheight = (WORD)(sepPadding + 1 + 13 * (*pnumitems)); | |
7646 | |
7647 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7648 // show modelessly |
12668
637096f179c4
patch 8.0.1212: MS-Windows: tear-off menu does not work on 64 bit
Christian Brabandt <cb@256bit.org>
parents:
12666
diff
changeset
|
7649 the_menu->tearoff_handle = CreateDialogIndirectParam( |
16451
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
7650 g_hinst, |
7 | 7651 (LPDLGTEMPLATE)pdlgtemplate, |
7652 s_hwnd, | |
12668
637096f179c4
patch 8.0.1212: MS-Windows: tear-off menu does not work on 64 bit
Christian Brabandt <cb@256bit.org>
parents:
12666
diff
changeset
|
7653 (DLGPROC)tearoff_callback, |
637096f179c4
patch 8.0.1212: MS-Windows: tear-off menu does not work on 64 bit
Christian Brabandt <cb@256bit.org>
parents:
12666
diff
changeset
|
7654 (LPARAM)top_menu); |
7 | 7655 |
7656 LocalFree(LocalHandle(pdlgtemplate)); | |
7657 SelectFont(hdc, oldFont); | |
7658 DeleteObject(font); | |
7659 ReleaseDC(hwnd, hdc); | |
7660 | |
7661 /* | |
7662 * Reassert ourselves as the active window. This is so that after creating | |
7663 * a tearoff, the user doesn't have to click with the mouse just to start | |
7664 * typing again! | |
7665 */ | |
7666 (void)SetActiveWindow(s_hwnd); | |
7667 | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7668 // make sure the right buttons are enabled |
7 | 7669 force_menu_update = TRUE; |
7670 } | |
7671 #endif | |
7672 | |
7673 #if defined(FEAT_TOOLBAR) || defined(PROTO) | |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
7674 # include "gui_w32_rc.h" |
7 | 7675 |
7676 /* | |
7677 * Create the toolbar, initially unpopulated. | |
7678 * (just like the menu, there are no defaults, it's all | |
7679 * set up through menu.vim) | |
7680 */ | |
7681 static void | |
7682 initialise_toolbar(void) | |
7683 { | |
7684 InitCommonControls(); | |
7685 s_toolbarhwnd = CreateToolbarEx( | |
7686 s_hwnd, | |
7687 WS_CHILD | TBSTYLE_TOOLTIPS | TBSTYLE_FLAT, | |
7688 4000, //any old big number | |
1213 | 7689 31, //number of images in initial bitmap |
16451
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
7690 g_hinst, |
7 | 7691 IDR_TOOLBAR1, // id of initial bitmap |
7692 NULL, | |
7693 0, // initial number of buttons | |
7694 TOOLBAR_BUTTON_WIDTH, //api guide is wrong! | |
7695 TOOLBAR_BUTTON_HEIGHT, | |
7696 TOOLBAR_BUTTON_WIDTH, | |
7697 TOOLBAR_BUTTON_HEIGHT, | |
7698 sizeof(TBBUTTON) | |
7699 ); | |
18652
94b88fa5825d
patch 8.1.2318: MS-Windows GUI: main background shows in toolbar
Bram Moolenaar <Bram@vim.org>
parents:
18617
diff
changeset
|
7700 |
94b88fa5825d
patch 8.1.2318: MS-Windows GUI: main background shows in toolbar
Bram Moolenaar <Bram@vim.org>
parents:
18617
diff
changeset
|
7701 // Remove transparency from the toolbar to prevent the main window |
94b88fa5825d
patch 8.1.2318: MS-Windows GUI: main background shows in toolbar
Bram Moolenaar <Bram@vim.org>
parents:
18617
diff
changeset
|
7702 // background colour showing through |
94b88fa5825d
patch 8.1.2318: MS-Windows GUI: main background shows in toolbar
Bram Moolenaar <Bram@vim.org>
parents:
18617
diff
changeset
|
7703 SendMessage(s_toolbarhwnd, TB_SETSTYLE, 0, |
94b88fa5825d
patch 8.1.2318: MS-Windows GUI: main background shows in toolbar
Bram Moolenaar <Bram@vim.org>
parents:
18617
diff
changeset
|
7704 SendMessage(s_toolbarhwnd, TB_GETSTYLE, 0, 0) & ~TBSTYLE_TRANSPARENT); |
94b88fa5825d
patch 8.1.2318: MS-Windows GUI: main background shows in toolbar
Bram Moolenaar <Bram@vim.org>
parents:
18617
diff
changeset
|
7705 |
5223
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
7706 s_toolbar_wndproc = SubclassWindow(s_toolbarhwnd, toolbar_wndproc); |
7 | 7707 |
7708 gui_mch_show_toolbar(vim_strchr(p_go, GO_TOOLBAR) != NULL); | |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
7709 |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
7710 update_toolbar_size(); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
7711 } |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
7712 |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
7713 static void |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
7714 update_toolbar_size(void) |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
7715 { |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
7716 int w, h; |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
7717 TBMETRICS tbm = {sizeof(TBMETRICS)}; |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
7718 |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
7719 tbm.dwMask = TBMF_PAD | TBMF_BUTTONSPACING; |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
7720 SendMessage(s_toolbarhwnd, TB_GETMETRICS, 0, (LPARAM)&tbm); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
7721 //TRACE("Pad: %d, %d", tbm.cxPad, tbm.cyPad); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
7722 //TRACE("ButtonSpacing: %d, %d", tbm.cxButtonSpacing, tbm.cyButtonSpacing); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
7723 |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
7724 w = (TOOLBAR_BUTTON_WIDTH + tbm.cxPad) * s_dpi / DEFAULT_DPI; |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
7725 h = (TOOLBAR_BUTTON_HEIGHT + tbm.cyPad) * s_dpi / DEFAULT_DPI; |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
7726 //TRACE("button size: %d, %d", w, h); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
7727 SendMessage(s_toolbarhwnd, TB_SETBUTTONSIZE, 0, MAKELPARAM(w, h)); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
7728 gui.toolbar_height = h + 6; |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
7729 |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
7730 //DWORD s = SendMessage(s_toolbarhwnd, TB_GETBUTTONSIZE, 0, 0); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
7731 //TRACE("actual button size: %d, %d", LOWORD(s), HIWORD(s)); |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
7732 |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
7733 // TODO: |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
7734 // Currently, this function only updates the size of toolbar buttons. |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
7735 // It would be nice if the toolbar images are resized based on DPI. |
7 | 7736 } |
7737 | |
5223
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
7738 static LRESULT CALLBACK |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
7739 toolbar_wndproc( |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
7740 HWND hwnd, |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
7741 UINT uMsg, |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
7742 WPARAM wParam, |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
7743 LPARAM lParam) |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
7744 { |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
7745 HandleMouseHide(uMsg, lParam); |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
7746 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
|
7747 } |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
7748 |
7 | 7749 static int |
7750 get_toolbar_bitmap(vimmenu_T *menu) | |
7751 { | |
7752 int i = -1; | |
7753 | |
7754 /* | |
7755 * Check user bitmaps first, unless builtin is specified. | |
7756 */ | |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7757 if (!menu->icon_builtin) |
7 | 7758 { |
7759 char_u fname[MAXPATHL]; | |
7760 HANDLE hbitmap = NULL; | |
7761 | |
7762 if (menu->iconfile != NULL) | |
7763 { | |
7764 gui_find_iconfile(menu->iconfile, fname, "bmp"); | |
7765 hbitmap = LoadImage( | |
7766 NULL, | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
7767 (LPCSTR)fname, |
7 | 7768 IMAGE_BITMAP, |
7769 TOOLBAR_BUTTON_WIDTH, | |
7770 TOOLBAR_BUTTON_HEIGHT, | |
7771 LR_LOADFROMFILE | | |
7772 LR_LOADMAP3DCOLORS | |
7773 ); | |
7774 } | |
7775 | |
7776 /* | |
7777 * If the LoadImage call failed, or the "icon=" file | |
7778 * didn't exist or wasn't specified, try the menu name | |
7779 */ | |
7780 if (hbitmap == NULL | |
5020
5eff37e92f03
updated for version 7.3.1254
Bram Moolenaar <bram@vim.org>
parents:
5016
diff
changeset
|
7781 && (gui_find_bitmap( |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
7782 # ifdef FEAT_MULTI_LANG |
5020
5eff37e92f03
updated for version 7.3.1254
Bram Moolenaar <bram@vim.org>
parents:
5016
diff
changeset
|
7783 menu->en_dname != NULL ? menu->en_dname : |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
7784 # endif |
5020
5eff37e92f03
updated for version 7.3.1254
Bram Moolenaar <bram@vim.org>
parents:
5016
diff
changeset
|
7785 menu->dname, fname, "bmp") == OK)) |
7 | 7786 hbitmap = LoadImage( |
7787 NULL, | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
7788 (LPCSTR)fname, |
7 | 7789 IMAGE_BITMAP, |
7790 TOOLBAR_BUTTON_WIDTH, | |
7791 TOOLBAR_BUTTON_HEIGHT, | |
7792 LR_LOADFROMFILE | | |
7793 LR_LOADMAP3DCOLORS | |
7794 ); | |
7795 | |
7796 if (hbitmap != NULL) | |
7797 { | |
7798 TBADDBITMAP tbAddBitmap; | |
7799 | |
7800 tbAddBitmap.hInst = NULL; | |
840 | 7801 tbAddBitmap.nID = (long_u)hbitmap; |
7 | 7802 |
7803 i = (int)SendMessage(s_toolbarhwnd, TB_ADDBITMAP, | |
7804 (WPARAM)1, (LPARAM)&tbAddBitmap); | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7805 // i will be set to -1 if it fails |
7 | 7806 } |
7807 } | |
7808 if (i == -1 && menu->iconidx >= 0 && menu->iconidx < TOOLBAR_BITMAP_COUNT) | |
7809 i = menu->iconidx; | |
7810 | |
7811 return i; | |
7812 } | |
7813 #endif | |
7814 | |
810 | 7815 #if defined(FEAT_GUI_TABLINE) || defined(PROTO) |
7816 static void | |
7817 initialise_tabline(void) | |
7818 { | |
7819 InitCommonControls(); | |
7820 | |
819 | 7821 s_tabhwnd = CreateWindow(WC_TABCONTROL, "Vim tabline", |
840 | 7822 WS_CHILD|TCS_FOCUSNEVER|TCS_TOOLTIPS, |
810 | 7823 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, |
16451
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
7824 CW_USEDEFAULT, s_hwnd, NULL, g_hinst, NULL); |
5223
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
7825 s_tabline_wndproc = SubclassWindow(s_tabhwnd, tabline_wndproc); |
819 | 7826 |
843 | 7827 gui.tabline_height = TABLINE_HEIGHT; |
7828 | |
7829 set_tabline_font(); | |
810 | 7830 } |
5223
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
7831 |
12666
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7832 /* |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7833 * Get tabpage_T from POINT. |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7834 */ |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7835 static tabpage_T * |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7836 GetTabFromPoint( |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7837 HWND hWnd, |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7838 POINT pt) |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7839 { |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7840 tabpage_T *ptp = NULL; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7841 |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7842 if (gui_mch_showing_tabline()) |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7843 { |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7844 TCHITTESTINFO htinfo; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7845 htinfo.pt = pt; |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
7846 // ignore if a window under cursor is not tabcontrol. |
12666
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7847 if (s_tabhwnd == hWnd) |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7848 { |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7849 int idx = TabCtrl_HitTest(s_tabhwnd, &htinfo); |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7850 if (idx != -1) |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7851 ptp = find_tabpage(idx + 1); |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7852 } |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7853 } |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7854 return ptp; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7855 } |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7856 |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7857 static POINT s_pt = {0, 0}; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7858 static HCURSOR s_hCursor = NULL; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7859 |
5223
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
7860 static LRESULT CALLBACK |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
7861 tabline_wndproc( |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
7862 HWND hwnd, |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
7863 UINT uMsg, |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
7864 WPARAM wParam, |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
7865 LPARAM lParam) |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
7866 { |
12666
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7867 POINT pt; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7868 tabpage_T *tp; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7869 RECT rect; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7870 int nCenter; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7871 int idx0; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7872 int idx1; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7873 |
5223
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
7874 HandleMouseHide(uMsg, lParam); |
12666
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7875 |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7876 switch (uMsg) |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7877 { |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7878 case WM_LBUTTONDOWN: |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7879 { |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7880 s_pt.x = GET_X_LPARAM(lParam); |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7881 s_pt.y = GET_Y_LPARAM(lParam); |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7882 SetCapture(hwnd); |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7883 s_hCursor = GetCursor(); // backup default cursor |
12666
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7884 break; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7885 } |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7886 case WM_MOUSEMOVE: |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7887 if (GetCapture() == hwnd |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7888 && ((wParam & MK_LBUTTON)) != 0) |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7889 { |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7890 pt.x = GET_X_LPARAM(lParam); |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7891 pt.y = s_pt.y; |
27160
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
7892 if (abs(pt.x - s_pt.x) > |
4482dd5f8869
patch 8.2.4109: MS-Windows: high dpi support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26966
diff
changeset
|
7893 pGetSystemMetricsForDpi(SM_CXDRAG, s_dpi)) |
12666
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7894 { |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7895 SetCursor(LoadCursor(NULL, IDC_SIZEWE)); |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7896 |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7897 tp = GetTabFromPoint(hwnd, pt); |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7898 if (tp != NULL) |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7899 { |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7900 idx0 = tabpage_index(curtab) - 1; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7901 idx1 = tabpage_index(tp) - 1; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7902 |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7903 TabCtrl_GetItemRect(hwnd, idx1, &rect); |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7904 nCenter = rect.left + (rect.right - rect.left) / 2; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7905 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7906 // Check if the mouse cursor goes over the center of |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
7907 // the next tab to prevent "flickering". |
12666
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7908 if ((idx0 < idx1) && (nCenter < pt.x)) |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7909 { |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7910 tabpage_move(idx1 + 1); |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7911 update_screen(0); |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7912 } |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7913 else if ((idx1 < idx0) && (pt.x < nCenter)) |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7914 { |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7915 tabpage_move(idx1); |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7916 update_screen(0); |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7917 } |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7918 } |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7919 } |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7920 } |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7921 break; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7922 case WM_LBUTTONUP: |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7923 { |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7924 if (GetCapture() == hwnd) |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7925 { |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7926 SetCursor(s_hCursor); |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7927 ReleaseCapture(); |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7928 } |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7929 break; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7930 } |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7931 default: |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7932 break; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7933 } |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7934 |
5223
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
7935 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
|
7936 } |
810 | 7937 #endif |
7938 | |
7 | 7939 #if defined(FEAT_OLE) || defined(FEAT_EVAL) || defined(PROTO) |
7940 /* | |
7941 * Make the GUI window come to the foreground. | |
7942 */ | |
7943 void | |
7944 gui_mch_set_foreground(void) | |
7945 { | |
7946 if (IsIconic(s_hwnd)) | |
7947 SendMessage(s_hwnd, WM_SYSCOMMAND, SC_RESTORE, 0); | |
7948 SetForegroundWindow(s_hwnd); | |
7949 } | |
7950 #endif | |
7951 | |
7952 #if defined(FEAT_MBYTE_IME) && defined(DYNAMIC_IME) | |
7953 static void | |
7954 dyn_imm_load(void) | |
7955 { | |
2612 | 7956 hLibImm = vimLoadLib("imm32.dll"); |
7 | 7957 if (hLibImm == NULL) |
7958 return; | |
7959 | |
7960 pImmGetCompositionStringW | |
7961 = (void *)GetProcAddress(hLibImm, "ImmGetCompositionStringW"); | |
7962 pImmGetContext | |
7963 = (void *)GetProcAddress(hLibImm, "ImmGetContext"); | |
7964 pImmAssociateContext | |
7965 = (void *)GetProcAddress(hLibImm, "ImmAssociateContext"); | |
7966 pImmReleaseContext | |
7967 = (void *)GetProcAddress(hLibImm, "ImmReleaseContext"); | |
7968 pImmGetOpenStatus | |
7969 = (void *)GetProcAddress(hLibImm, "ImmGetOpenStatus"); | |
7970 pImmSetOpenStatus | |
7971 = (void *)GetProcAddress(hLibImm, "ImmSetOpenStatus"); | |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
7972 pImmGetCompositionFontW |
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
7973 = (void *)GetProcAddress(hLibImm, "ImmGetCompositionFontW"); |
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
7974 pImmSetCompositionFontW |
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
7975 = (void *)GetProcAddress(hLibImm, "ImmSetCompositionFontW"); |
7 | 7976 pImmSetCompositionWindow |
7977 = (void *)GetProcAddress(hLibImm, "ImmSetCompositionWindow"); | |
7978 pImmGetConversionStatus | |
7979 = (void *)GetProcAddress(hLibImm, "ImmGetConversionStatus"); | |
777 | 7980 pImmSetConversionStatus |
7981 = (void *)GetProcAddress(hLibImm, "ImmSetConversionStatus"); | |
7 | 7982 |
27229
6837d2c14dee
patch 8.2.4143: MS-Windows: IME support for Win9x is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27160
diff
changeset
|
7983 if ( pImmGetCompositionStringW == NULL |
7 | 7984 || pImmGetContext == NULL |
7985 || pImmAssociateContext == NULL | |
7986 || pImmReleaseContext == NULL | |
7987 || pImmGetOpenStatus == NULL | |
7988 || pImmSetOpenStatus == NULL | |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
7989 || pImmGetCompositionFontW == NULL |
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
7990 || pImmSetCompositionFontW == NULL |
7 | 7991 || pImmSetCompositionWindow == NULL |
777 | 7992 || pImmGetConversionStatus == NULL |
7993 || pImmSetConversionStatus == NULL) | |
7 | 7994 { |
7995 FreeLibrary(hLibImm); | |
7996 hLibImm = NULL; | |
7997 pImmGetContext = NULL; | |
7998 return; | |
7999 } | |
8000 | |
8001 return; | |
8002 } | |
8003 | |
8004 #endif | |
8005 | |
8006 #if defined(FEAT_SIGN_ICONS) || defined(PROTO) | |
8007 | |
8008 # ifdef FEAT_XPM_W32 | |
8009 # define IMAGE_XPM 100 | |
8010 # endif | |
8011 | |
8012 typedef struct _signicon_t | |
8013 { | |
8014 HANDLE hImage; | |
8015 UINT uType; | |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
8016 # ifdef FEAT_XPM_W32 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
8017 HANDLE hShape; // Mask bitmap handle |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
8018 # endif |
7 | 8019 } signicon_t; |
8020 | |
8021 void | |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8022 gui_mch_drawsign(int row, int col, int typenr) |
7 | 8023 { |
8024 signicon_t *sign; | |
8025 int x, y, w, h; | |
8026 | |
8027 if (!gui.in_use || (sign = (signicon_t *)sign_get_image(typenr)) == NULL) | |
8028 return; | |
8029 | |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
8030 # if defined(FEAT_DIRECTX) |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
8031 if (IS_ENABLE_DIRECTX()) |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
8032 DWriteContext_Flush(s_dwc); |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
8033 # endif |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
8034 |
7 | 8035 x = TEXT_X(col); |
8036 y = TEXT_Y(row); | |
8037 w = gui.char_width * 2; | |
8038 h = gui.char_height; | |
8039 switch (sign->uType) | |
8040 { | |
8041 case IMAGE_BITMAP: | |
8042 { | |
8043 HDC hdcMem; | |
8044 HBITMAP hbmpOld; | |
8045 | |
8046 hdcMem = CreateCompatibleDC(s_hdc); | |
8047 hbmpOld = (HBITMAP)SelectObject(hdcMem, sign->hImage); | |
8048 BitBlt(s_hdc, x, y, w, h, hdcMem, 0, 0, SRCCOPY); | |
8049 SelectObject(hdcMem, hbmpOld); | |
8050 DeleteDC(hdcMem); | |
8051 } | |
8052 break; | |
8053 case IMAGE_ICON: | |
8054 case IMAGE_CURSOR: | |
8055 DrawIconEx(s_hdc, x, y, (HICON)sign->hImage, w, h, 0, NULL, DI_NORMAL); | |
8056 break; | |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
8057 # ifdef FEAT_XPM_W32 |
7 | 8058 case IMAGE_XPM: |
8059 { | |
8060 HDC hdcMem; | |
8061 HBITMAP hbmpOld; | |
8062 | |
8063 hdcMem = CreateCompatibleDC(s_hdc); | |
8064 hbmpOld = (HBITMAP)SelectObject(hdcMem, sign->hShape); | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
8065 // Make hole |
7 | 8066 BitBlt(s_hdc, x, y, w, h, hdcMem, 0, 0, SRCAND); |
8067 | |
8068 SelectObject(hdcMem, sign->hImage); | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
8069 // Paint sign |
7 | 8070 BitBlt(s_hdc, x, y, w, h, hdcMem, 0, 0, SRCPAINT); |
8071 SelectObject(hdcMem, hbmpOld); | |
8072 DeleteDC(hdcMem); | |
8073 } | |
8074 break; | |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
8075 # endif |
7 | 8076 } |
8077 } | |
8078 | |
8079 static void | |
8080 close_signicon_image(signicon_t *sign) | |
8081 { | |
8082 if (sign) | |
8083 switch (sign->uType) | |
8084 { | |
8085 case IMAGE_BITMAP: | |
8086 DeleteObject((HGDIOBJ)sign->hImage); | |
8087 break; | |
8088 case IMAGE_CURSOR: | |
8089 DestroyCursor((HCURSOR)sign->hImage); | |
8090 break; | |
8091 case IMAGE_ICON: | |
8092 DestroyIcon((HICON)sign->hImage); | |
8093 break; | |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
8094 # ifdef FEAT_XPM_W32 |
7 | 8095 case IMAGE_XPM: |
8096 DeleteObject((HBITMAP)sign->hImage); | |
8097 DeleteObject((HBITMAP)sign->hShape); | |
8098 break; | |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
8099 # endif |
7 | 8100 } |
8101 } | |
8102 | |
8103 void * | |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8104 gui_mch_register_sign(char_u *signfile) |
7 | 8105 { |
8106 signicon_t sign, *psign; | |
8107 char_u *ext; | |
8108 | |
8109 sign.hImage = NULL; | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
8110 ext = signfile + STRLEN(signfile) - 4; // get extension |
7 | 8111 if (ext > signfile) |
8112 { | |
8113 int do_load = 1; | |
8114 | |
8115 if (!STRICMP(ext, ".bmp")) | |
8116 sign.uType = IMAGE_BITMAP; | |
8117 else if (!STRICMP(ext, ".ico")) | |
8118 sign.uType = IMAGE_ICON; | |
8119 else if (!STRICMP(ext, ".cur") || !STRICMP(ext, ".ani")) | |
8120 sign.uType = IMAGE_CURSOR; | |
8121 else | |
8122 do_load = 0; | |
8123 | |
8124 if (do_load) | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8125 sign.hImage = (HANDLE)LoadImage(NULL, (LPCSTR)signfile, sign.uType, |
7 | 8126 gui.char_width * 2, gui.char_height, |
8127 LR_LOADFROMFILE | LR_CREATEDIBSECTION); | |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
8128 # ifdef FEAT_XPM_W32 |
7 | 8129 if (!STRICMP(ext, ".xpm")) |
8130 { | |
8131 sign.uType = IMAGE_XPM; | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8132 LoadXpmImage((char *)signfile, (HBITMAP *)&sign.hImage, |
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8133 (HBITMAP *)&sign.hShape); |
7 | 8134 } |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
8135 # endif |
7 | 8136 } |
8137 | |
8138 psign = NULL; | |
16825
ce04ebdf26b8
patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
Bram Moolenaar <Bram@vim.org>
parents:
16768
diff
changeset
|
8139 if (sign.hImage && (psign = ALLOC_ONE(signicon_t)) != NULL) |
7 | 8140 *psign = sign; |
8141 | |
8142 if (!psign) | |
8143 { | |
8144 if (sign.hImage) | |
8145 close_signicon_image(&sign); | |
26883
7f150a4936f2
patch 8.2.3970: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26865
diff
changeset
|
8146 emsg(_(e_couldnt_read_in_sign_data)); |
7 | 8147 } |
8148 return (void *)psign; | |
8149 | |
8150 } | |
8151 | |
8152 void | |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8153 gui_mch_destroy_sign(void *sign) |
7 | 8154 { |
8155 if (sign) | |
8156 { | |
8157 close_signicon_image((signicon_t *)sign); | |
8158 vim_free(sign); | |
8159 } | |
8160 } | |
293 | 8161 #endif |
7 | 8162 |
12871
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
12802
diff
changeset
|
8163 #if defined(FEAT_BEVAL_GUI) || defined(PROTO) |
7 | 8164 |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
8165 /* |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
8166 * BALLOON-EVAL IMPLEMENTATION FOR WINDOWS. |
148 | 8167 * Added by Sergey Khorev <sergey.khorev@gmail.com> |
7 | 8168 * |
12871
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
12802
diff
changeset
|
8169 * The only reused thing is beval.h and get_beval_info() |
7 | 8170 * from gui_beval.c (note it uses x and y of the BalloonEval struct |
8171 * to get current mouse position). | |
8172 * | |
8173 * Trying to use as more Windows services as possible, and as less | |
8174 * IE version as possible :)). | |
8175 * | |
8176 * 1) Don't create ToolTip in gui_mch_create_beval_area, only initialize | |
8177 * BalloonEval struct. | |
8178 * 2) Enable/Disable simply create/kill BalloonEval Timer | |
8179 * 3) When there was enough inactivity, timer procedure posts | |
8180 * async request to debugger | |
8181 * 4) gui_mch_post_balloon (invoked from netbeans.c) creates tooltip control | |
8182 * and performs some actions to show it ASAP | |
1621 | 8183 * 5) WM_NOTIFY:TTN_POP destroys created tooltip |
7 | 8184 */ |
8185 | |
15277
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8186 static void |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
8187 make_tooltip(BalloonEval *beval, char *text, POINT pt) |
15277
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8188 { |
27370
584f91cc2508
patch 8.2.4213: too much code for supporting old MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
27342
diff
changeset
|
8189 TOOLINFOW *pti; |
584f91cc2508
patch 8.2.4213: too much code for supporting old MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
27342
diff
changeset
|
8190 RECT rect; |
584f91cc2508
patch 8.2.4213: too much code for supporting old MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
27342
diff
changeset
|
8191 |
584f91cc2508
patch 8.2.4213: too much code for supporting old MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
27342
diff
changeset
|
8192 pti = alloc(sizeof(TOOLINFOW)); |
15277
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8193 if (pti == NULL) |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8194 return; |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8195 |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8196 beval->balloon = CreateWindowExW(WS_EX_TOPMOST, TOOLTIPS_CLASSW, |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8197 NULL, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8198 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, |
16451
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16439
diff
changeset
|
8199 beval->target, NULL, g_hinst, NULL); |
15277
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8200 |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8201 SetWindowPos(beval->balloon, HWND_TOPMOST, 0, 0, 0, 0, |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8202 SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8203 |
27370
584f91cc2508
patch 8.2.4213: too much code for supporting old MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
27342
diff
changeset
|
8204 pti->cbSize = sizeof(TOOLINFOW); |
15277
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8205 pti->uFlags = TTF_SUBCLASS; |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8206 pti->hwnd = beval->target; |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8207 pti->hinst = 0; // Don't use string resources |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8208 pti->uId = ID_BEVAL_TOOLTIP; |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8209 |
27293
e91b577be192
patch 8.2.4175: MS-Windows: runtime check for multi-line balloon is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27283
diff
changeset
|
8210 pti->lpszText = LPSTR_TEXTCALLBACKW; |
e91b577be192
patch 8.2.4175: MS-Windows: runtime check for multi-line balloon is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27283
diff
changeset
|
8211 beval->tofree = enc_to_utf16((char_u*)text, NULL); |
e91b577be192
patch 8.2.4175: MS-Windows: runtime check for multi-line balloon is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27283
diff
changeset
|
8212 pti->lParam = (LPARAM)beval->tofree; |
e91b577be192
patch 8.2.4175: MS-Windows: runtime check for multi-line balloon is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27283
diff
changeset
|
8213 // switch multiline tooltips on |
e91b577be192
patch 8.2.4175: MS-Windows: runtime check for multi-line balloon is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27283
diff
changeset
|
8214 if (GetClientRect(s_textArea, &rect)) |
e91b577be192
patch 8.2.4175: MS-Windows: runtime check for multi-line balloon is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27283
diff
changeset
|
8215 SendMessageW(beval->balloon, TTM_SETMAXTIPWIDTH, 0, |
e91b577be192
patch 8.2.4175: MS-Windows: runtime check for multi-line balloon is obsolete
Bram Moolenaar <Bram@vim.org>
parents:
27283
diff
changeset
|
8216 (LPARAM)rect.right); |
15277
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8217 |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8218 // Limit ballooneval bounding rect to CursorPos neighbourhood. |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8219 pti->rect.left = pt.x - 3; |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8220 pti->rect.top = pt.y - 3; |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8221 pti->rect.right = pt.x + 3; |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8222 pti->rect.bottom = pt.y + 3; |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8223 |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8224 SendMessageW(beval->balloon, TTM_ADDTOOLW, 0, (LPARAM)pti); |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8225 // Make tooltip appear sooner. |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8226 SendMessageW(beval->balloon, TTM_SETDELAYTIME, TTDT_INITIAL, 10); |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8227 // I've performed some tests and it seems the longest possible life time |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8228 // of tooltip is 30 seconds. |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8229 SendMessageW(beval->balloon, TTM_SETDELAYTIME, TTDT_AUTOPOP, 30000); |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8230 /* |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8231 * HACK: force tooltip to appear, because it'll not appear until |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8232 * first mouse move. D*mn M$ |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8233 * Amazingly moving (2, 2) and then (-1, -1) the mouse doesn't move. |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8234 */ |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8235 mouse_event(MOUSEEVENTF_MOVE, 2, 2, 0, 0); |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8236 mouse_event(MOUSEEVENTF_MOVE, (DWORD)-1, (DWORD)-1, 0, 0); |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8237 vim_free(pti); |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8238 } |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8239 |
7 | 8240 static void |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8241 delete_tooltip(BalloonEval *beval) |
7 | 8242 { |
7056
1ebd7608cfd9
commit https://github.com/vim/vim/commit/8e5f5b47c2198ffa4161c21a4140eaa9bed46f37
Christian Brabandt <cb@256bit.org>
parents:
7032
diff
changeset
|
8243 PostMessage(beval->balloon, WM_CLOSE, 0, 0); |
7 | 8244 } |
8245 | |
8246 static VOID CALLBACK | |
27525
27694b525305
patch 8.2.4290: MS-Windows: using type casts for timer IDs
Bram Moolenaar <Bram@vim.org>
parents:
27455
diff
changeset
|
8247 beval_timer_proc( |
10783
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
8248 HWND hwnd UNUSED, |
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
8249 UINT uMsg UNUSED, |
27525
27694b525305
patch 8.2.4290: MS-Windows: using type casts for timer IDs
Bram Moolenaar <Bram@vim.org>
parents:
27455
diff
changeset
|
8250 UINT_PTR idEvent UNUSED, |
10783
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
8251 DWORD dwTime) |
7 | 8252 { |
8253 POINT pt; | |
8254 RECT rect; | |
8255 | |
8256 if (cur_beval == NULL || cur_beval->showState == ShS_SHOWING || !p_beval) | |
8257 return; | |
8258 | |
8259 GetCursorPos(&pt); | |
8260 if (WindowFromPoint(pt) != s_textArea) | |
8261 return; | |
8262 | |
8263 ScreenToClient(s_textArea, &pt); | |
8264 GetClientRect(s_textArea, &rect); | |
8265 if (!PtInRect(&rect, pt)) | |
8266 return; | |
8267 | |
27525
27694b525305
patch 8.2.4290: MS-Windows: using type casts for timer IDs
Bram Moolenaar <Bram@vim.org>
parents:
27455
diff
changeset
|
8268 if (last_user_activity > 0 |
27694b525305
patch 8.2.4290: MS-Windows: using type casts for timer IDs
Bram Moolenaar <Bram@vim.org>
parents:
27455
diff
changeset
|
8269 && (dwTime - last_user_activity) >= (DWORD)p_bdlay |
7 | 8270 && (cur_beval->showState != ShS_PENDING |
8271 || abs(cur_beval->x - pt.x) > 3 | |
8272 || abs(cur_beval->y - pt.y) > 3)) | |
8273 { | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
8274 // Pointer resting in one place long enough, it's time to show |
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
8275 // the tooltip. |
7 | 8276 cur_beval->showState = ShS_PENDING; |
8277 cur_beval->x = pt.x; | |
8278 cur_beval->y = pt.y; | |
8279 | |
8280 if (cur_beval->msgCB != NULL) | |
8281 (*cur_beval->msgCB)(cur_beval, 0); | |
8282 } | |
8283 } | |
8284 | |
8285 void | |
10783
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
8286 gui_mch_disable_beval_area(BalloonEval *beval UNUSED) |
7 | 8287 { |
27525
27694b525305
patch 8.2.4290: MS-Windows: using type casts for timer IDs
Bram Moolenaar <Bram@vim.org>
parents:
27455
diff
changeset
|
8288 KillTimer(s_textArea, beval_timer_id); |
7 | 8289 } |
8290 | |
8291 void | |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8292 gui_mch_enable_beval_area(BalloonEval *beval) |
7 | 8293 { |
8294 if (beval == NULL) | |
8295 return; | |
27525
27694b525305
patch 8.2.4290: MS-Windows: using type casts for timer IDs
Bram Moolenaar <Bram@vim.org>
parents:
27455
diff
changeset
|
8296 beval_timer_id = SetTimer(s_textArea, 0, (UINT)(p_bdlay / 2), |
27694b525305
patch 8.2.4290: MS-Windows: using type casts for timer IDs
Bram Moolenaar <Bram@vim.org>
parents:
27455
diff
changeset
|
8297 beval_timer_proc); |
7 | 8298 } |
8299 | |
8300 void | |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8301 gui_mch_post_balloon(BalloonEval *beval, char_u *mesg) |
7 | 8302 { |
8303 POINT pt; | |
11129
f4ea50924c6d
patch 8.0.0452: some macros are in lower case
Christian Brabandt <cb@256bit.org>
parents:
10783
diff
changeset
|
8304 |
16600
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16596
diff
changeset
|
8305 vim_free(beval->msg); |
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16596
diff
changeset
|
8306 beval->msg = mesg == NULL ? NULL : vim_strsave(mesg); |
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16596
diff
changeset
|
8307 if (beval->msg == NULL) |
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16596
diff
changeset
|
8308 { |
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16596
diff
changeset
|
8309 delete_tooltip(beval); |
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16596
diff
changeset
|
8310 beval->showState = ShS_NEUTRAL; |
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16596
diff
changeset
|
8311 return; |
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16596
diff
changeset
|
8312 } |
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16596
diff
changeset
|
8313 |
7 | 8314 if (beval->showState == ShS_SHOWING) |
8315 return; | |
8316 GetCursorPos(&pt); | |
8317 ScreenToClient(s_textArea, &pt); | |
8318 | |
8319 if (abs(beval->x - pt.x) < 3 && abs(beval->y - pt.y) < 3) | |
11129
f4ea50924c6d
patch 8.0.0452: some macros are in lower case
Christian Brabandt <cb@256bit.org>
parents:
10783
diff
changeset
|
8320 { |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
8321 // cursor is still here |
7 | 8322 gui_mch_disable_beval_area(cur_beval); |
8323 beval->showState = ShS_SHOWING; | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8324 make_tooltip(beval, (char *)mesg, pt); |
7 | 8325 } |
8326 } | |
8327 | |
8328 BalloonEval * | |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8329 gui_mch_create_beval_area( |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
8330 void *target UNUSED, // ignored, always use s_textArea |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8331 char_u *mesg, |
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8332 void (*mesgCB)(BalloonEval *, int), |
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8333 void *clientData) |
7 | 8334 { |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
8335 // partially stolen from gui_beval.c |
7 | 8336 BalloonEval *beval; |
8337 | |
8338 if (mesg != NULL && mesgCB != NULL) | |
8339 { | |
26893
79c76ca2c53c
patch 8.2.3975: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26883
diff
changeset
|
8340 iemsg(_(e_cannot_create_ballooneval_with_both_message_and_callback)); |
7 | 8341 return NULL; |
8342 } | |
8343 | |
16825
ce04ebdf26b8
patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
Bram Moolenaar <Bram@vim.org>
parents:
16768
diff
changeset
|
8344 beval = ALLOC_CLEAR_ONE(BalloonEval); |
7 | 8345 if (beval != NULL) |
8346 { | |
8347 beval->target = s_textArea; | |
8348 | |
8349 beval->showState = ShS_NEUTRAL; | |
8350 beval->msg = mesg; | |
8351 beval->msgCB = mesgCB; | |
8352 beval->clientData = clientData; | |
8353 | |
8354 InitCommonControls(); | |
8355 cur_beval = beval; | |
8356 | |
8357 if (p_beval) | |
8358 gui_mch_enable_beval_area(beval); | |
8359 } | |
8360 return beval; | |
8361 } | |
8362 | |
8363 static void | |
10783
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
8364 Handle_WM_Notify(HWND hwnd UNUSED, LPNMHDR pnmh) |
7 | 8365 { |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
8366 if (pnmh->idFrom != ID_BEVAL_TOOLTIP) // it is not our tooltip |
7 | 8367 return; |
8368 | |
8369 if (cur_beval != NULL) | |
8370 { | |
435 | 8371 switch (pnmh->code) |
7 | 8372 { |
435 | 8373 case TTN_SHOW: |
8374 break; | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
8375 case TTN_POP: // Before tooltip disappear |
7 | 8376 delete_tooltip(cur_beval); |
8377 gui_mch_enable_beval_area(cur_beval); | |
8378 | |
8379 cur_beval->showState = ShS_NEUTRAL; | |
435 | 8380 break; |
8381 case TTN_GETDISPINFO: | |
1481 | 8382 { |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
8383 // if you get there then we have new common controls |
27370
584f91cc2508
patch 8.2.4213: too much code for supporting old MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
27342
diff
changeset
|
8384 NMTTDISPINFO *info = (NMTTDISPINFO *)pnmh; |
1481 | 8385 info->lpszText = (LPSTR)info->lParam; |
8386 info->uFlags |= TTF_DI_SETITEM; | |
8387 } | |
435 | 8388 break; |
15277
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8389 case TTN_GETDISPINFOW: |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8390 { |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8391 // if we get here then we have new common controls |
27370
584f91cc2508
patch 8.2.4213: too much code for supporting old MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
27342
diff
changeset
|
8392 NMTTDISPINFOW *info = (NMTTDISPINFOW *)pnmh; |
15277
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8393 info->lpszText = (LPWSTR)info->lParam; |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8394 info->uFlags |= TTF_DI_SETITEM; |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8395 } |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8396 break; |
7 | 8397 } |
8398 } | |
8399 } | |
8400 | |
8401 static void | |
27525
27694b525305
patch 8.2.4290: MS-Windows: using type casts for timer IDs
Bram Moolenaar <Bram@vim.org>
parents:
27455
diff
changeset
|
8402 track_user_activity(UINT uMsg) |
7 | 8403 { |
8404 if ((uMsg >= WM_MOUSEFIRST && uMsg <= WM_MOUSELAST) | |
8405 || (uMsg >= WM_KEYFIRST && uMsg <= WM_KEYLAST)) | |
27525
27694b525305
patch 8.2.4290: MS-Windows: using type casts for timer IDs
Bram Moolenaar <Bram@vim.org>
parents:
27455
diff
changeset
|
8406 last_user_activity = GetTickCount(); |
7 | 8407 } |
8408 | |
8409 void | |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8410 gui_mch_destroy_beval_area(BalloonEval *beval) |
7 | 8411 { |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
8412 # ifdef FEAT_VARTABS |
15288
e3dfd25b0679
patch 8.1.0652: freeing memory for balloon eval too early
Bram Moolenaar <Bram@vim.org>
parents:
15277
diff
changeset
|
8413 vim_free(beval->vts); |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
8414 # endif |
15288
e3dfd25b0679
patch 8.1.0652: freeing memory for balloon eval too early
Bram Moolenaar <Bram@vim.org>
parents:
15277
diff
changeset
|
8415 vim_free(beval->tofree); |
7 | 8416 vim_free(beval); |
8417 } | |
18788
e1f4e9d78a6a
patch 8.1.2383: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18773
diff
changeset
|
8418 #endif // FEAT_BEVAL_GUI |
7 | 8419 |
8420 #if defined(FEAT_NETBEANS_INTG) || defined(PROTO) | |
8421 /* | |
8422 * We have multiple signs to draw at the same location. Draw the | |
8423 * multi-sign indicator (down-arrow) instead. This is the Win32 version. | |
8424 */ | |
8425 void | |
8426 netbeans_draw_multisign_indicator(int row) | |
8427 { | |
8428 int i; | |
8429 int y; | |
8430 int x; | |
8431 | |
2210 | 8432 if (!netbeans_active()) |
2311
ccda151dde4e
Support completion for ":find". (Nazri Ramliy)
Bram Moolenaar <bram@vim.org>
parents:
2224
diff
changeset
|
8433 return; |
2210 | 8434 |
7 | 8435 x = 0; |
8436 y = TEXT_Y(row); | |
8437 | |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
8438 # if defined(FEAT_DIRECTX) |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
8439 if (IS_ENABLE_DIRECTX()) |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
8440 DWriteContext_Flush(s_dwc); |
18773
38a3bef525e6
patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
8441 # endif |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
8442 |
7 | 8443 for (i = 0; i < gui.char_height - 3; i++) |
8444 SetPixel(s_hdc, x+2, y++, gui.currFgColor); | |
8445 | |
8446 SetPixel(s_hdc, x+0, y, gui.currFgColor); | |
8447 SetPixel(s_hdc, x+2, y, gui.currFgColor); | |
8448 SetPixel(s_hdc, x+4, y++, gui.currFgColor); | |
8449 SetPixel(s_hdc, x+1, y, gui.currFgColor); | |
8450 SetPixel(s_hdc, x+2, y, gui.currFgColor); | |
8451 SetPixel(s_hdc, x+3, y++, gui.currFgColor); | |
8452 SetPixel(s_hdc, x+2, y, gui.currFgColor); | |
8453 } | |
7743
6069f43cea4e
commit https://github.com/vim/vim/commit/e0874f8cbcddfcf9965a85ba35199964efb1d01a
Christian Brabandt <cb@256bit.org>
parents:
7560
diff
changeset
|
8454 #endif |